file
stringlengths 18
26
| data
stringlengths 3
1.04M
|
---|---|
the_stack_data/248581447.c | //===-- floatunssidfvfp_test.c - Test __floatunssidfvfp -------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file tests __floatunssidfvfp for the compiler_rt library.
//
//===----------------------------------------------------------------------===//
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
extern double __floatunssidfvfp(unsigned int a);
#if __arm__
int test__floatunssidfvfp(unsigned int a)
{
double actual = __floatunssidfvfp(a);
double expected = a;
if (actual != expected)
printf("error in test__floatunssidfvfp(%u) = %f, expected %f\n",
a, actual, expected);
return actual != expected;
}
#endif
int main()
{
#if __arm__
if (test__floatunssidfvfp(0))
return 1;
if (test__floatunssidfvfp(1))
return 1;
if (test__floatunssidfvfp(0x7FFFFFFF))
return 1;
if (test__floatunssidfvfp(0x80000000))
return 1;
if (test__floatunssidfvfp(0xFFFFFFFF))
return 1;
#else
printf("skipped\n");
#endif
return 0;
}
|
the_stack_data/26338.c | int removeDuplicates(int* nums, int numsSize) {
int i,count = 0;
if(numsSize == 0)
return 0;
for(i = 0; i < numsSize; ++i)
if(nums[i] != nums[count])
nums[++count] = nums[i];
return count+1;
}
|
the_stack_data/178266295.c | #include <stdio.h>
void print_array(int lst[], int num);
void get_divisors(int list[], int num);
int divisors_counter(int num);
int main()
{
int num;
printf("Please enter an integer number:");
scanf("%d", &num);
printf("\n");
int num_of_divisors = divisors_counter(num);
int list_of_divisors[num_of_divisors];
printf("Number of divisors: %d\n", num_of_divisors);
get_divisors(list_of_divisors, num);
print_array(list_of_divisors, num_of_divisors);
return 0;
}
void print_array(int lst[], int num)
{
printf("List of divisor elements:\n");
for(int i=0; i<num; i++)
{
printf("%d", lst[i]);
if(i<num-1)
{
printf(", ");
}
}
printf("\n");
}
int divisors_counter(int num)
{
if(num==0) return 0;
if(num<0) num = -num;
int counter = 0;
for(int i=1; i<=num; i++)
{
if(num % i == 0) counter++;
}
return counter;
}
void get_divisors(int list[], int num)
{
int counter = 0;
for(int i=1; i<=num; i++)
{
if(num % i == 0)
{
list[counter] = i;
counter++;
}
}
}
|
the_stack_data/86075230.c | // IOSUB BIANCA-ALEXANDRA 313CA TEMA 3
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef struct {
char oras[20];
char tip_cadou[20];
int nr;
char directie;
} zona;
typedef struct {
char oras[20];
char tip[20];
} cadou;
typedef struct {
int nr;
char oras[20];
char tip[20];
} unic;
void citire(zona ***a, int *N, int *M, int *startx, int *starty, int *pasi) {
int i, j;
scanf("%d%d", N, M);
scanf("%d%d", startx, starty);
scanf("%d", pasi);
*a = (zona **) malloc((*N) * sizeof(zona *));
for(j = 0; j < *N; j++) {
(*a)[j] = malloc((*M) * sizeof(zona)); //aloc fiecare linie din matrice
}
for(i = 0; i < *N; i++)
for(j = 0; j < *M; j++) {
scanf("%s", (*a)[i][j].oras);
scanf("%s", (*a)[i][j].tip_cadou);
scanf("%d", &(*a)[i][j].nr);
scanf("%*c%c", &(*a)[i][j].directie); // am folosit %*c pentru a putea sării peste null
}
}
int cmp(const void *p1, const void *p2) { //funcția de comparare pentru qsort
int aux;
cadou a, b;
a = *((cadou*)p1);
b = *((cadou*)p2);
aux = strcmp(a.oras, b.oras);
if(aux != 0)
return aux;
else
return strcmp(a.tip, b.tip);
}
int cmp_unic(const void *p1, const void *p2) {
int aux1, aux2;
unic a, b;
a = *((unic*)p1);
b = *((unic*)p2);
aux1 = strcmp(a.oras, b.oras);
if(aux1 != 0)
return aux1;
aux2 = b.nr - a.nr;
if(aux2 != 0)
return aux2;
return strcmp(a.tip, b.tip);
}
int main() {
zona **a;
cadou *sac;
int N, M, startx, starty, pasi, nr = -1, k = -1, dim_max = 2;
sac = malloc(dim_max * sizeof(cadou)); //inițial în sac intră doar 2 cadouri
citire(&a, &N, &M, &startx, &starty, &pasi);
while(nr < pasi) { //nr = numarul de pași făcuți deja de Moș Crăciun
if((startx < 0) || (starty < 0) || (startx >= N) || (starty >= M)) //când a ieșit din Laponia
{
printf("TOO MUCH SNOW !\n");
break;
}
if(a[startx][starty].nr > 0) // dacă există cadou
{
k++; //se mărește nr. de cadouri din sac
if(k >= dim_max) //dacă nu mai are loc în sac, realoc dimensiunea acestuia
{
dim_max = dim_max * 2;
sac = realloc(sac, dim_max * sizeof(cadou));
}
if( k < dim_max) //dacă are loc în sac, il adaug
{
strcpy(sac[k].oras, a[startx][starty].oras);
strcpy(sac[k].tip, a[startx][starty].tip_cadou);
a[startx][starty].nr--; //scade nr. de cadouri din zonă
}
}
switch(a[startx][starty].directie)
{
case 'U': startx--; break;
case 'D': startx++; break;
case 'L': starty--; break;
case 'R': starty++; break;
}
nr++; //crește nr. de pași
}
free(a); //eliberez memoria alocată lui a
printf("%d\n", nr); //afișez nr. de pași realizați de Moș Crăciun
printf("%d\n", k + 1); //afișez nr. de cadouri adunate
int dim = 0; // dim = dimensiunea sacului auxiliar
//cadourile din sac sunt ordonate alfabetic după oraș, și apoi alfabetic după tip
qsort(sac, k + 1, sizeof(cadou), cmp);
//aux = sac auxiliar în care fiecare element (oraș, tip_cadou) apare o singură dată
unic *aux = malloc(sizeof(unic));
int i = 0;
int j;
while(i <= k){
j = i + 1;
while((j <= k) && (strcmp(sac[i].oras, sac[j].oras) == 0) && strcmp(sac[i].tip, sac[j].tip) == 0)
j++;
dim++;
if(dim != 1) aux = realloc(aux, dim * sizeof(unic)); //realoc dimensiunea sacului auxiliar
strcpy(aux[dim - 1].oras, sac[i].oras);
strcpy(aux[dim - 1].tip, sac[i].tip);
aux[dim - 1].nr = j - i; //rețin nr. de orașe + tipul de cadou (cele care sunt identice)
i = j;
}
free(sac); //eliberez memoria alocată sacului
qsort(aux, dim, sizeof(unic), cmp_unic);
//orasele sunt ordonate lexicografic,
//cadourile sunt ordonate descrescător după numarul de apariții
//dacă două sau mai multe tipuri de daruri au același număr de apariții atunci se ordonează lexicografic
i = 0;
while(i < dim) {
printf("%s:\n", aux[i].oras);
printf(" %d %s\n", aux[i].nr, aux[i].tip);
j = i + 1;
while((j < dim) && (strcmp(aux[i].oras, aux[j].oras) == 0))
{
printf(" %d %s\n", aux[j].nr, aux[j].tip);
j++;
}
i = j;
}
free(aux); //eliberez memoria alocată lui aux
return 0;
} |
the_stack_data/348015.c | /***
* This code is a part of EvoApproxLib library (ehw.fit.vutbr.cz/approxlib) distributed under The MIT License.
* When used, please cite the following article(s): V. Mrazek, Z. Vasicek, L. Sekanina, H. Jiang and J. Han, "Scalable Construction of Approximate Multipliers With Formally Guaranteed Worst Case Error" in IEEE Transactions on Very Large Scale Integration (VLSI) Systems, vol. 26, no. 11, pp. 2572-2576, Nov. 2018. doi: 10.1109/TVLSI.2018.2856362
* This file contains a circuit from a sub-set of pareto optimal circuits with respect to the pwr and mre parameters
***/
// MAE% = 0.048 %
// MAE = 2040348
// WCE% = 0.20 %
// WCE = 8404992
// WCRE% = 100.00 %
// EP% = 100.00 %
// MRE% = 1.34 %
// MSE = 61508.569e8
// PDK45_PWR = 0.512 mW
// PDK45_AREA = 872.9 um2
// PDK45_DELAY = 1.64 ns
#include <stdint.h>
#include <stdlib.h>
uint16_t trun8_tam00b(uint8_t A, uint8_t B)
{
uint16_t P, P_;
uint8_t tmp, C_1_0,C_1_1,C_1_2,C_1_3,C_1_4,C_1_5,C_1_6,C_2_0,C_2_1,C_2_2,C_2_3,C_2_4,C_2_5,C_2_6,C_3_0,C_3_1,C_3_2,C_3_3,C_3_4,C_3_5,C_3_6,C_4_0,C_4_1,C_4_2,C_4_3,C_4_4,C_4_5,C_4_6,C_5_0,C_5_1,C_5_2,C_5_3,C_5_4,C_5_5,C_5_6,C_6_0,C_6_1,C_6_2,C_6_3,C_6_4,C_6_5,C_6_6,C_7_0,C_7_1,C_7_2,C_7_3,C_7_4,C_7_5,C_7_6,S_0_0,S_0_1,S_0_2,S_0_3,S_0_4,S_0_5,S_0_6,S_0_7,S_1_0,S_1_1,S_1_2,S_1_3,S_1_4,S_1_5,S_1_6,S_1_7,S_2_0,S_2_1,S_2_2,S_2_3,S_2_4,S_2_5,S_2_6,S_2_7,S_3_0,S_3_1,S_3_2,S_3_3,S_3_4,S_3_5,S_3_6,S_3_7,S_4_0,S_4_1,S_4_2,S_4_3,S_4_4,S_4_5,S_4_6,S_4_7,S_5_0,S_5_1,S_5_2,S_5_3,S_5_4,S_5_5,S_5_6,S_5_7,S_6_0,S_6_1,S_6_2,S_6_3,S_6_4,S_6_5,S_6_6,S_6_7,S_7_0,S_7_1,S_7_2,S_7_3,S_7_4,S_7_5,S_7_6,S_7_7,S_8_0,S_8_1,S_8_2,S_8_3,S_8_4,S_8_5,S_8_6,S_8_7;
S_0_0 = (((A>>0)&1) & ((B>>0)&1));
S_0_1 = (((A>>0)&1) & ((B>>1)&1));
S_0_2 = (((A>>0)&1) & ((B>>2)&1));
S_0_3 = (((A>>0)&1) & ((B>>3)&1));
S_0_4 = (((A>>0)&1) & ((B>>4)&1));
S_0_5 = (((A>>0)&1) & ((B>>5)&1));
S_0_6 = (((A>>0)&1) & ((B>>6)&1));
S_0_7 = (((A>>0)&1) & ((B>>7)&1));
S_1_0 = S_0_1^(((A>>1)&1) & ((B>>0)&1));
C_1_0 = S_0_1&(((A>>1)&1) & ((B>>0)&1));
S_1_1 = S_0_2^(((A>>1)&1) & ((B>>1)&1));
C_1_1 = S_0_2&(((A>>1)&1) & ((B>>1)&1));
S_1_2 = S_0_3^(((A>>1)&1) & ((B>>2)&1));
C_1_2 = S_0_3&(((A>>1)&1) & ((B>>2)&1));
S_1_3 = S_0_4^(((A>>1)&1) & ((B>>3)&1));
C_1_3 = S_0_4&(((A>>1)&1) & ((B>>3)&1));
S_1_4 = S_0_5^(((A>>1)&1) & ((B>>4)&1));
C_1_4 = S_0_5&(((A>>1)&1) & ((B>>4)&1));
S_1_5 = S_0_6^(((A>>1)&1) & ((B>>5)&1));
C_1_5 = S_0_6&(((A>>1)&1) & ((B>>5)&1));
S_1_6 = S_0_7^(((A>>1)&1) & ((B>>6)&1));
C_1_6 = S_0_7&(((A>>1)&1) & ((B>>6)&1));
S_1_7 = (((A>>1)&1) & ((B>>7)&1));
tmp = S_1_1^C_1_0;
S_2_0 = tmp^(((A>>2)&1) & ((B>>0)&1));
C_2_0 = (tmp&(((A>>2)&1) & ((B>>0)&1)))|(S_1_1&C_1_0);
tmp = S_1_2^C_1_1;
S_2_1 = tmp^(((A>>2)&1) & ((B>>1)&1));
C_2_1 = (tmp&(((A>>2)&1) & ((B>>1)&1)))|(S_1_2&C_1_1);
tmp = S_1_3^C_1_2;
S_2_2 = tmp^(((A>>2)&1) & ((B>>2)&1));
C_2_2 = (tmp&(((A>>2)&1) & ((B>>2)&1)))|(S_1_3&C_1_2);
tmp = S_1_4^C_1_3;
S_2_3 = tmp^(((A>>2)&1) & ((B>>3)&1));
C_2_3 = (tmp&(((A>>2)&1) & ((B>>3)&1)))|(S_1_4&C_1_3);
tmp = S_1_5^C_1_4;
S_2_4 = tmp^(((A>>2)&1) & ((B>>4)&1));
C_2_4 = (tmp&(((A>>2)&1) & ((B>>4)&1)))|(S_1_5&C_1_4);
tmp = S_1_6^C_1_5;
S_2_5 = tmp^(((A>>2)&1) & ((B>>5)&1));
C_2_5 = (tmp&(((A>>2)&1) & ((B>>5)&1)))|(S_1_6&C_1_5);
tmp = S_1_7^C_1_6;
S_2_6 = tmp^(((A>>2)&1) & ((B>>6)&1));
C_2_6 = (tmp&(((A>>2)&1) & ((B>>6)&1)))|(S_1_7&C_1_6);
S_2_7 = (((A>>2)&1) & ((B>>7)&1));
tmp = S_2_1^C_2_0;
S_3_0 = tmp^(((A>>3)&1) & ((B>>0)&1));
C_3_0 = (tmp&(((A>>3)&1) & ((B>>0)&1)))|(S_2_1&C_2_0);
tmp = S_2_2^C_2_1;
S_3_1 = tmp^(((A>>3)&1) & ((B>>1)&1));
C_3_1 = (tmp&(((A>>3)&1) & ((B>>1)&1)))|(S_2_2&C_2_1);
tmp = S_2_3^C_2_2;
S_3_2 = tmp^(((A>>3)&1) & ((B>>2)&1));
C_3_2 = (tmp&(((A>>3)&1) & ((B>>2)&1)))|(S_2_3&C_2_2);
tmp = S_2_4^C_2_3;
S_3_3 = tmp^(((A>>3)&1) & ((B>>3)&1));
C_3_3 = (tmp&(((A>>3)&1) & ((B>>3)&1)))|(S_2_4&C_2_3);
tmp = S_2_5^C_2_4;
S_3_4 = tmp^(((A>>3)&1) & ((B>>4)&1));
C_3_4 = (tmp&(((A>>3)&1) & ((B>>4)&1)))|(S_2_5&C_2_4);
tmp = S_2_6^C_2_5;
S_3_5 = tmp^(((A>>3)&1) & ((B>>5)&1));
C_3_5 = (tmp&(((A>>3)&1) & ((B>>5)&1)))|(S_2_6&C_2_5);
tmp = S_2_7^C_2_6;
S_3_6 = tmp^(((A>>3)&1) & ((B>>6)&1));
C_3_6 = (tmp&(((A>>3)&1) & ((B>>6)&1)))|(S_2_7&C_2_6);
S_3_7 = (((A>>3)&1) & ((B>>7)&1));
tmp = S_3_1^C_3_0;
S_4_0 = tmp^(((A>>4)&1) & ((B>>0)&1));
C_4_0 = (tmp&(((A>>4)&1) & ((B>>0)&1)))|(S_3_1&C_3_0);
tmp = S_3_2^C_3_1;
S_4_1 = tmp^(((A>>4)&1) & ((B>>1)&1));
C_4_1 = (tmp&(((A>>4)&1) & ((B>>1)&1)))|(S_3_2&C_3_1);
tmp = S_3_3^C_3_2;
S_4_2 = tmp^(((A>>4)&1) & ((B>>2)&1));
C_4_2 = (tmp&(((A>>4)&1) & ((B>>2)&1)))|(S_3_3&C_3_2);
tmp = S_3_4^C_3_3;
S_4_3 = tmp^(((A>>4)&1) & ((B>>3)&1));
C_4_3 = (tmp&(((A>>4)&1) & ((B>>3)&1)))|(S_3_4&C_3_3);
tmp = S_3_5^C_3_4;
S_4_4 = tmp^(((A>>4)&1) & ((B>>4)&1));
C_4_4 = (tmp&(((A>>4)&1) & ((B>>4)&1)))|(S_3_5&C_3_4);
tmp = S_3_6^C_3_5;
S_4_5 = tmp^(((A>>4)&1) & ((B>>5)&1));
C_4_5 = (tmp&(((A>>4)&1) & ((B>>5)&1)))|(S_3_6&C_3_5);
tmp = S_3_7^C_3_6;
S_4_6 = tmp^(((A>>4)&1) & ((B>>6)&1));
C_4_6 = (tmp&(((A>>4)&1) & ((B>>6)&1)))|(S_3_7&C_3_6);
S_4_7 = (((A>>4)&1) & ((B>>7)&1));
tmp = S_4_1^C_4_0;
S_5_0 = tmp^(((A>>5)&1) & ((B>>0)&1));
C_5_0 = (tmp&(((A>>5)&1) & ((B>>0)&1)))|(S_4_1&C_4_0);
tmp = S_4_2^C_4_1;
S_5_1 = tmp^(((A>>5)&1) & ((B>>1)&1));
C_5_1 = (tmp&(((A>>5)&1) & ((B>>1)&1)))|(S_4_2&C_4_1);
tmp = S_4_3^C_4_2;
S_5_2 = tmp^(((A>>5)&1) & ((B>>2)&1));
C_5_2 = (tmp&(((A>>5)&1) & ((B>>2)&1)))|(S_4_3&C_4_2);
tmp = S_4_4^C_4_3;
S_5_3 = tmp^(((A>>5)&1) & ((B>>3)&1));
C_5_3 = (tmp&(((A>>5)&1) & ((B>>3)&1)))|(S_4_4&C_4_3);
tmp = S_4_5^C_4_4;
S_5_4 = tmp^(((A>>5)&1) & ((B>>4)&1));
C_5_4 = (tmp&(((A>>5)&1) & ((B>>4)&1)))|(S_4_5&C_4_4);
tmp = S_4_6^C_4_5;
S_5_5 = tmp^(((A>>5)&1) & ((B>>5)&1));
C_5_5 = (tmp&(((A>>5)&1) & ((B>>5)&1)))|(S_4_6&C_4_5);
tmp = S_4_7^C_4_6;
S_5_6 = tmp^(((A>>5)&1) & ((B>>6)&1));
C_5_6 = (tmp&(((A>>5)&1) & ((B>>6)&1)))|(S_4_7&C_4_6);
S_5_7 = (((A>>5)&1) & ((B>>7)&1));
tmp = S_5_1^C_5_0;
S_6_0 = tmp^(((A>>6)&1) & ((B>>0)&1));
C_6_0 = (tmp&(((A>>6)&1) & ((B>>0)&1)))|(S_5_1&C_5_0);
tmp = S_5_2^C_5_1;
S_6_1 = tmp^(((A>>6)&1) & ((B>>1)&1));
C_6_1 = (tmp&(((A>>6)&1) & ((B>>1)&1)))|(S_5_2&C_5_1);
tmp = S_5_3^C_5_2;
S_6_2 = tmp^(((A>>6)&1) & ((B>>2)&1));
C_6_2 = (tmp&(((A>>6)&1) & ((B>>2)&1)))|(S_5_3&C_5_2);
tmp = S_5_4^C_5_3;
S_6_3 = tmp^(((A>>6)&1) & ((B>>3)&1));
C_6_3 = (tmp&(((A>>6)&1) & ((B>>3)&1)))|(S_5_4&C_5_3);
tmp = S_5_5^C_5_4;
S_6_4 = tmp^(((A>>6)&1) & ((B>>4)&1));
C_6_4 = (tmp&(((A>>6)&1) & ((B>>4)&1)))|(S_5_5&C_5_4);
tmp = S_5_6^C_5_5;
S_6_5 = tmp^(((A>>6)&1) & ((B>>5)&1));
C_6_5 = (tmp&(((A>>6)&1) & ((B>>5)&1)))|(S_5_6&C_5_5);
tmp = S_5_7^C_5_6;
S_6_6 = tmp^(((A>>6)&1) & ((B>>6)&1));
C_6_6 = (tmp&(((A>>6)&1) & ((B>>6)&1)))|(S_5_7&C_5_6);
S_6_7 = (((A>>6)&1) & ((B>>7)&1));
tmp = S_6_1^C_6_0;
S_7_0 = tmp^(((A>>7)&1) & ((B>>0)&1));
C_7_0 = (tmp&(((A>>7)&1) & ((B>>0)&1)))|(S_6_1&C_6_0);
tmp = S_6_2^C_6_1;
S_7_1 = tmp^(((A>>7)&1) & ((B>>1)&1));
C_7_1 = (tmp&(((A>>7)&1) & ((B>>1)&1)))|(S_6_2&C_6_1);
tmp = S_6_3^C_6_2;
S_7_2 = tmp^(((A>>7)&1) & ((B>>2)&1));
C_7_2 = (tmp&(((A>>7)&1) & ((B>>2)&1)))|(S_6_3&C_6_2);
tmp = S_6_4^C_6_3;
S_7_3 = tmp^(((A>>7)&1) & ((B>>3)&1));
C_7_3 = (tmp&(((A>>7)&1) & ((B>>3)&1)))|(S_6_4&C_6_3);
tmp = S_6_5^C_6_4;
S_7_4 = tmp^(((A>>7)&1) & ((B>>4)&1));
C_7_4 = (tmp&(((A>>7)&1) & ((B>>4)&1)))|(S_6_5&C_6_4);
tmp = S_6_6^C_6_5;
S_7_5 = tmp^(((A>>7)&1) & ((B>>5)&1));
C_7_5 = (tmp&(((A>>7)&1) & ((B>>5)&1)))|(S_6_6&C_6_5);
tmp = S_6_7^C_6_6;
S_7_6 = tmp^(((A>>7)&1) & ((B>>6)&1));
C_7_6 = (tmp&(((A>>7)&1) & ((B>>6)&1)))|(S_6_7&C_6_6);
S_7_7 = (((A>>7)&1) & ((B>>7)&1));
P_ = (((C_7_0 & 1)<<0)|((C_7_1 & 1)<<1)|((C_7_2 & 1)<<2)|((C_7_3 & 1)<<3)|((C_7_4 & 1)<<4)|((C_7_5 & 1)<<5)|((C_7_6 & 1)<<6)) + (((S_7_1 & 1)<<0)|((S_7_2 & 1)<<1)|((S_7_3 & 1)<<2)|((S_7_4 & 1)<<3)|((S_7_5 & 1)<<4)|((S_7_6 & 1)<<5)|((S_7_7 & 1)<<6));
S_8_0 = (P_ >> 0) & 1;
S_8_1 = (P_ >> 1) & 1;
S_8_2 = (P_ >> 2) & 1;
S_8_3 = (P_ >> 3) & 1;
S_8_4 = (P_ >> 4) & 1;
S_8_5 = (P_ >> 5) & 1;
S_8_6 = (P_ >> 6) & 1;
S_8_7 = (P_ >> 7) & 1;
P = 0;
P |= (S_0_0 & 1) << 0;
P |= (S_1_0 & 1) << 1;
P |= (S_2_0 & 1) << 2;
P |= (S_3_0 & 1) << 3;
P |= (S_4_0 & 1) << 4;
P |= (S_5_0 & 1) << 5;
P |= (S_6_0 & 1) << 6;
P |= (S_7_0 & 1) << 7;
P |= (S_8_0 & 1) << 8;
P |= (S_8_1 & 1) << 9;
P |= (S_8_2 & 1) << 10;
P |= (S_8_3 & 1) << 11;
P |= (S_8_4 & 1) << 12;
P |= (S_8_5 & 1) << 13;
P |= (S_8_6 & 1) << 14;
P |= (S_8_7 & 1) << 15;
return P;
}
uint64_t mult8_cgp14ep_ep65536_wc16384_2_csamcsa(const uint64_t B,const uint64_t A)
{
uint64_t O, dout_225, dout_267, dout_268, dout_299, dout_300, dout_302, dout_328, dout_331; int avg=0;
dout_225=((B >> 7)&1)&((A >> 6)&1);
dout_267=((B >> 6)&1)&((A >> 7)&1);
dout_268=((B >> 7)&1)&((A >> 7)&1);
dout_299=dout_225|dout_267;
dout_300=dout_225&dout_267;
dout_302=dout_299|dout_268;
dout_328=dout_268^dout_300;
dout_331=dout_328^dout_302;
O = 0;
O |= (0&1) << 0;
O |= (0&1) << 1;
O |= (0&1) << 2;
O |= (0&1) << 3;
O |= (0&1) << 4;
O |= (0&1) << 5;
O |= (0&1) << 6;
O |= (0&1) << 7;
O |= (0&1) << 8;
O |= (0&1) << 9;
O |= (0&1) << 10;
O |= (0&1) << 11;
O |= (0&1) << 12;
O |= (0&1) << 13;
O |= (dout_331&1) << 14;
O |= (dout_268&1) << 15;
return O;
}
uint32_t mul16u_6NY (uint16_t a, uint16_t b) {
static uint16_t * cacheLL = NULL;
static uint16_t * cacheLH = NULL;
static uint16_t * cacheHL = NULL;
static uint16_t * cacheHH = NULL;
int fillData = cacheLL == NULL || cacheLH == NULL || cacheHL == NULL || cacheHH == NULL;
if(!cacheLL) cacheLL = (uint16_t *)malloc(256 * 256 * sizeof(uint16_t));
if(!cacheLH) cacheLH = (uint16_t *)malloc(256 * 256 * sizeof(uint16_t));
if(!cacheHL) cacheHL = (uint16_t *)malloc(256 * 256 * sizeof(uint16_t));
if(!cacheHH) cacheHH = (uint16_t *)malloc(256 * 256 * sizeof(uint16_t));
if(fillData) {
for(int i = 0; i < 256; i++) {
for(int j = 0; j < 256; j++) {
cacheLL[i * 256 + j] = mult8_cgp14ep_ep65536_wc16384_2_csamcsa(i, j);
cacheLH[i * 256 + j] = mult8_cgp14ep_ep65536_wc16384_2_csamcsa(i, j);
cacheHL[i * 256 + j] = mult8_cgp14ep_ep65536_wc16384_2_csamcsa(i, j);
cacheHH[i * 256 + j] = trun8_tam00b(i, j);
}
}
}
uint32_t opt = 0;
opt += (uint32_t)cacheLL[(a & 0xFF ) * 256 + (b & 0xFF )];
opt += (uint32_t)cacheLH[(a & 0xFF ) * 256 + ((b >> 8) & 0xFF )] << 8;
opt += (uint32_t)cacheHL[((a >> 8) & 0xFF) * 256 + (b & 0xFF )] << 8;
opt += (uint32_t)cacheHH[((a >> 8) & 0xFF) * 256 + ((b >> 8) & 0xFF )] << 16;
return opt;
}
|
the_stack_data/108247.c | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
int main(void)
{
char *format = "Room %lu somedata\n";
int len = snprintf(0, 0, format, LONG_MAX);
printf("%ld\n", LONG_MIN);
printf("%d\n", len);
/*
char *format = "Room %lu somedata\n";
char *description = malloc(sizeof(char) * strlen(format) + 1);
sprintf(description, format, LONG_MAX);
puts(description);
*/
return 0;
}
|
the_stack_data/1009965.c | #include <stdio.h>
int a[105];
int n;
int N(int l,int r)
{ int i; int sum=0;
for(i=l;i<=r;i++)
{sum+=a[i]; sum%=n; }
return sum;
}
int M(int l,int r)
{ int i,s=1;
for(i=l;i<=r;i++)
{s*=(a[i]%n); s%=n; }
return s; }
int H(int l,int r)
{ int i,s;
s=a[l];
for(i=l+1;i<=r;i++)
{ s^=a[i]; }
return s;
}
int main()
{int K; int l,r; int i; int c,b;
scanf("%d%d",&n,&K);
for(i=0;i<n;i++)
{scanf("%d",&a[i]); }
for(i=0;i<K;i++)
{scanf("%d%d",&l,&r);
c=N(l,r); b=M(l,r);
if(c>b)c^=b^=c^=b;
printf("%d\n",H(c,b)); }
return 0;
} |
the_stack_data/116083.c | #include <stdio.h>
int *value() {
int a = 12;
return &a;
}
int get_value() { return *value(); }
int main() { printf("%d\n", get_value()); }
|
the_stack_data/39274.c | // blibioteca
#include <stdio.h>
#include <stdlib.h>
//funçao principal
main()
{ // variaveis
int N, cont;
printf("Digite um numero: ");
scanf("%d", &N);
// condiçao
if (N < 0 || N % 2 == 1)
{
printf("Comando Invalido");
}
if ( N % 2 == 0)
if ( N >= 0)
{
printf("O numero %d em ordem decrescente em razao de numeros pares eh: ", N);
for ( cont = N; cont > 0; cont = cont - 2)
{
printf("\n%d", cont);
}
}
return(0);
}
|
the_stack_data/390359.c | #include <stdio.h>
void swap(double a[], double b[], int n, double *vet1, double *vet2, int *x1, int *x2);
void gauss(double matriz[10][10], double vet[], int x[], int m, int n);
void jordan(double matriz[10][10], double vet[], int m, int n);
int main()
{
double matriz[10][10], vet[10];
int x[10];
int m, n; // m = linhas, n = colunas.
scanf("%i", &m);
getchar();
scanf("%i", &n);
getchar();
for (int i = 0; i < m; i++)
{
for (int j = 0; j <= n; j++)
{
if (j == n)
{
scanf("%lf", &vet[i]);
x[i] = i + 1;
getchar();
}
else
{
scanf("%lf", &matriz[i][j]);
getchar();
}
}
}
gauss(matriz, vet, x, m, n);
jordan(matriz, vet, m, n);
for (int i = 0; i < m; i++)
{
for (int j = 0; j <= n; j++)
{
if (j == n)
printf("| %10lf", vet[i]);
else
printf("%10lf ", matriz[i][j]);
}
putchar('\n');
}
putchar('\n');
for (int i = 0; i < n; i++)
{
printf("x%i = %lf\n", x[i], vet[i]);
}
return 0;
}
void gauss(double matriz[10][10], double vet[], int x[], int m, int n)
{
double l;
for (int i = 0; i < m - 1; i++)
{
for (int k = i + 1; k < m; k++)
{
if (matriz[i][i] == 0)
{
for (int j = i; j < m; j++)
{
if (matriz[j][i] != 0)
swap(matriz[j], matriz[i], n, &vet[j], &vet[i], &x[j], &x[i]);
}
}
if (matriz[i][i] != 0)
{
l = -(matriz[k][i] / matriz[i][i]);
for (int j = i; j <= n; j++)
{
if (j == n)
vet[k] += l * vet[i];
else
matriz[k][j] += l * matriz[i][j];
}
}
}
}
}
void jordan(double matriz[10][10], double vet[], int m, int n)
{
double l;
for (int i = m - 1; i >= 0; i--)
{
vet[i] /= matriz[i][i];
matriz[i][i] /= matriz[i][i];
for (int k = i - 1; k >= 0; k--)
{
if (matriz[i][i] != 0)
{
l = -(matriz[k][i] / matriz[i][i]);
for (int j = n; j >= 0; j--)
{
if (j == n)
vet[k] += l * vet[i];
else
matriz[k][j] += l * matriz[i][j];
}
}
}
}
}
void swap(double a[], double b[], int n, double *vet1, double *vet2, int *x1, int *x2)
{
double aux;
int aux2;
for (int i = 0; i <= n; i++)
{
if (i == n)
{
aux = *vet1;
*vet1 = *vet2;
*vet2 = aux;
aux2 = *x1;
*x1 = *x2;
*x2 = aux2;
}
else
{
aux = a[i];
a[i] = b[i];
b[i] = aux;
}
}
} |
the_stack_data/825491.c | // This file is part of CPAchecker,
// a tool for configurable software verification:
// https://cpachecker.sosy-lab.org
//
// SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <https://www.sosy-lab.org>
//
// SPDX-License-Identifier: Apache-2.0
/*
* The ideal verdict differs from the ideal one: state is covered and usage is lost
* The problem also is at visualization stage.
*/
typedef int pthread_mutex_t;
extern void pthread_mutex_lock(pthread_mutex_t *lock) ;
extern void pthread_mutex_unlock(pthread_mutex_t *lock) ;
extern int __VERIFIER_nondet_int();
int global;
pthread_mutex_t mutex;
int func(unsigned int cmd) {
switch (cmd) {
case (1UL | (unsigned long )3 ):
global++;
break;
}
return 0;
}
int main() {
func(1UL | (unsigned long )3);
}
|
the_stack_data/40762134.c | #include <stdio.h>
void main()
{
int n,fact,i;
fact=1;
printf("Enter the number for factorial");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
fact=fact*i;
}
printf("factorial is %d",fact);
}
|
the_stack_data/212642759.c | # 1 "utility/log/log.c"
# 1 "/home/stone/Documents/Ali_IOT//"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "utility/log/log.c"
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/lib/gcc/arm-none-eabi/5.4.1/include/stdarg.h" 1 3 4
# 40 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/lib/gcc/arm-none-eabi/5.4.1/include/stdarg.h" 3 4
# 40 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/lib/gcc/arm-none-eabi/5.4.1/include/stdarg.h" 3 4
typedef __builtin_va_list __gnuc_va_list;
# 98 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/lib/gcc/arm-none-eabi/5.4.1/include/stdarg.h" 3 4
typedef __gnuc_va_list va_list;
# 6 "utility/log/log.c" 2
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/stdio.h" 1 3
# 29 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/stdio.h" 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/_ansi.h" 1 3
# 15 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/_ansi.h" 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/newlib.h" 1 3
# 14 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/newlib.h" 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/_newlib_version.h" 1 3
# 15 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/newlib.h" 2 3
# 16 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/_ansi.h" 2 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/config.h" 1 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/machine/ieeefp.h" 1 3
# 5 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/config.h" 2 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/features.h" 1 3
# 6 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/config.h" 2 3
# 17 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/_ansi.h" 2 3
# 30 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/stdio.h" 2 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/cdefs.h" 1 3
# 43 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/cdefs.h" 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/machine/_default_types.h" 1 3
# 27 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/machine/_default_types.h" 3
typedef signed char __int8_t;
typedef unsigned char __uint8_t;
# 41 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/machine/_default_types.h" 3
typedef short int __int16_t;
typedef short unsigned int __uint16_t;
# 63 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/machine/_default_types.h" 3
typedef long int __int32_t;
typedef long unsigned int __uint32_t;
# 89 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/machine/_default_types.h" 3
typedef long long int __int64_t;
typedef long long unsigned int __uint64_t;
# 120 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/machine/_default_types.h" 3
typedef signed char __int_least8_t;
typedef unsigned char __uint_least8_t;
# 146 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/machine/_default_types.h" 3
typedef short int __int_least16_t;
typedef short unsigned int __uint_least16_t;
# 168 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/machine/_default_types.h" 3
typedef long int __int_least32_t;
typedef long unsigned int __uint_least32_t;
# 186 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/machine/_default_types.h" 3
typedef long long int __int_least64_t;
typedef long long unsigned int __uint_least64_t;
# 200 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/machine/_default_types.h" 3
typedef int __intptr_t;
typedef unsigned int __uintptr_t;
# 44 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/cdefs.h" 2 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/lib/gcc/arm-none-eabi/5.4.1/include/stddef.h" 1 3 4
# 216 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/lib/gcc/arm-none-eabi/5.4.1/include/stddef.h" 3 4
typedef unsigned int size_t;
# 46 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/cdefs.h" 2 3
# 36 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/stdio.h" 2 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/lib/gcc/arm-none-eabi/5.4.1/include/stddef.h" 1 3 4
# 149 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/lib/gcc/arm-none-eabi/5.4.1/include/stddef.h" 3 4
typedef int ptrdiff_t;
# 328 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/lib/gcc/arm-none-eabi/5.4.1/include/stddef.h" 3 4
typedef unsigned int wchar_t;
# 426 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/lib/gcc/arm-none-eabi/5.4.1/include/stddef.h" 3 4
typedef struct {
long long __max_align_ll __attribute__((__aligned__(__alignof__(long long))));
long double __max_align_ld __attribute__((__aligned__(__alignof__(long double))));
} max_align_t;
# 37 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/stdio.h" 2 3
# 60 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/stdio.h" 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/reent.h" 1 3
# 13 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/reent.h" 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/_ansi.h" 1 3
# 14 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/reent.h" 2 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/lib/gcc/arm-none-eabi/5.4.1/include/stddef.h" 1 3 4
# 15 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/reent.h" 2 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/_types.h" 1 3
# 24 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/_types.h" 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/machine/_types.h" 1 3
# 25 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/_types.h" 2 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/lock.h" 1 3
typedef int _LOCK_T;
typedef int _LOCK_RECURSIVE_T;
# 26 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/_types.h" 2 3
typedef long __blkcnt_t;
typedef long __blksize_t;
typedef __uint64_t __fsblkcnt_t;
typedef __uint32_t __fsfilcnt_t;
typedef long _off_t;
typedef int __pid_t;
typedef short __dev_t;
typedef unsigned short __uid_t;
typedef unsigned short __gid_t;
typedef __uint32_t __id_t;
typedef unsigned short __ino_t;
# 88 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/_types.h" 3
typedef __uint32_t __mode_t;
__extension__ typedef long long _off64_t;
typedef _off_t __off_t;
typedef _off64_t __loff_t;
typedef long __key_t;
typedef long _fpos_t;
# 129 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/_types.h" 3
typedef unsigned int __size_t;
# 145 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/_types.h" 3
typedef signed int _ssize_t;
# 156 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/_types.h" 3
typedef _ssize_t __ssize_t;
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/lib/gcc/arm-none-eabi/5.4.1/include/stddef.h" 1 3 4
# 357 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/lib/gcc/arm-none-eabi/5.4.1/include/stddef.h" 3 4
typedef unsigned int wint_t;
# 160 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/_types.h" 2 3
typedef struct
{
int __count;
union
{
wint_t __wch;
unsigned char __wchb[4];
} __value;
} _mbstate_t;
typedef _LOCK_RECURSIVE_T _flock_t;
typedef void *_iconv_t;
typedef unsigned long __clock_t;
typedef long __time_t;
typedef unsigned long __clockid_t;
typedef unsigned long __timer_t;
typedef __uint8_t __sa_family_t;
typedef __uint32_t __socklen_t;
typedef unsigned short __nlink_t;
typedef long __suseconds_t;
typedef unsigned long __useconds_t;
typedef __builtin_va_list __va_list;
# 16 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/reent.h" 2 3
typedef unsigned long __ULong;
# 38 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/reent.h" 3
struct _reent;
struct __locale_t;
struct _Bigint
{
struct _Bigint *_next;
int _k, _maxwds, _sign, _wds;
__ULong _x[1];
};
struct __tm
{
int __tm_sec;
int __tm_min;
int __tm_hour;
int __tm_mday;
int __tm_mon;
int __tm_year;
int __tm_wday;
int __tm_yday;
int __tm_isdst;
};
struct _on_exit_args {
void * _fnargs[32];
void * _dso_handle[32];
__ULong _fntypes;
__ULong _is_cxa;
};
# 93 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/reent.h" 3
struct _atexit {
struct _atexit *_next;
int _ind;
void (*_fns[32])(void);
struct _on_exit_args _on_exit_args;
};
# 117 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/reent.h" 3
struct __sbuf {
unsigned char *_base;
int _size;
};
# 181 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/reent.h" 3
struct __sFILE {
unsigned char *_p;
int _r;
int _w;
short _flags;
short _file;
struct __sbuf _bf;
int _lbfsize;
void * _cookie;
int (* _read) (struct _reent *, void *, char *, int)
;
int (* _write) (struct _reent *, void *, const char *, int)
;
_fpos_t (* _seek) (struct _reent *, void *, _fpos_t, int);
int (* _close) (struct _reent *, void *);
struct __sbuf _ub;
unsigned char *_up;
int _ur;
unsigned char _ubuf[3];
unsigned char _nbuf[1];
struct __sbuf _lb;
int _blksize;
_off_t _offset;
struct _reent *_data;
_flock_t _lock;
_mbstate_t _mbstate;
int _flags2;
};
# 287 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/reent.h" 3
typedef struct __sFILE __FILE;
struct _glue
{
struct _glue *_next;
int _niobs;
__FILE *_iobs;
};
# 319 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/reent.h" 3
struct _rand48 {
unsigned short _seed[3];
unsigned short _mult[3];
unsigned short _add;
};
# 569 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/reent.h" 3
struct _reent
{
int _errno;
__FILE *_stdin, *_stdout, *_stderr;
int _inc;
char _emergency[25];
int _unspecified_locale_info;
struct __locale_t *_locale;
int __sdidinit;
void (* __cleanup) (struct _reent *);
struct _Bigint *_result;
int _result_k;
struct _Bigint *_p5s;
struct _Bigint **_freelist;
int _cvtlen;
char *_cvtbuf;
union
{
struct
{
unsigned int _unused_rand;
char * _strtok_last;
char _asctime_buf[26];
struct __tm _localtime_buf;
int _gamma_signgam;
__extension__ unsigned long long _rand_next;
struct _rand48 _r48;
_mbstate_t _mblen_state;
_mbstate_t _mbtowc_state;
_mbstate_t _wctomb_state;
char _l64a_buf[8];
char _signal_buf[24];
int _getdate_err;
_mbstate_t _mbrlen_state;
_mbstate_t _mbrtowc_state;
_mbstate_t _mbsrtowcs_state;
_mbstate_t _wcrtomb_state;
_mbstate_t _wcsrtombs_state;
int _h_errno;
} _reent;
struct
{
unsigned char * _nextf[30];
unsigned int _nmalloc[30];
} _unused;
} _new;
struct _atexit *_atexit;
struct _atexit _atexit0;
void (**(_sig_func))(int);
struct _glue __sglue;
__FILE __sf[3];
};
# 766 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/reent.h" 3
extern struct _reent *_impure_ptr ;
extern struct _reent *const _global_impure_ptr ;
void _reclaim_reent (struct _reent *);
# 61 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/stdio.h" 2 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/types.h" 1 3
# 28 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/types.h" 3
typedef __uint8_t u_int8_t;
typedef __uint16_t u_int16_t;
typedef __uint32_t u_int32_t;
typedef __uint64_t u_int64_t;
typedef int register_t;
# 62 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/types.h" 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/lib/gcc/arm-none-eabi/5.4.1/include/stddef.h" 1 3 4
# 63 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/types.h" 2 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/_stdint.h" 1 3
# 20 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/_stdint.h" 3
typedef __int8_t int8_t ;
typedef __uint8_t uint8_t ;
typedef __int16_t int16_t ;
typedef __uint16_t uint16_t ;
typedef __int32_t int32_t ;
typedef __uint32_t uint32_t ;
typedef __int64_t int64_t ;
typedef __uint64_t uint64_t ;
typedef __intptr_t intptr_t;
typedef __uintptr_t uintptr_t;
# 65 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/types.h" 2 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/machine/endian.h" 1 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/machine/_endian.h" 1 3
# 7 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/machine/endian.h" 2 3
# 68 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/types.h" 2 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/select.h" 1 3
# 25 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/select.h" 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/_sigset.h" 1 3
# 41 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/_sigset.h" 3
typedef unsigned long __sigset_t;
# 26 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/select.h" 2 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/_timeval.h" 1 3
# 35 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/_timeval.h" 3
typedef __suseconds_t suseconds_t;
typedef long time_t;
# 52 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/_timeval.h" 3
struct timeval {
time_t tv_sec;
suseconds_t tv_usec;
};
# 27 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/select.h" 2 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/timespec.h" 1 3
# 38 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/timespec.h" 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/_timespec.h" 1 3
# 45 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/_timespec.h" 3
struct timespec {
time_t tv_sec;
long tv_nsec;
};
# 39 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/timespec.h" 2 3
# 58 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/timespec.h" 3
struct itimerspec {
struct timespec it_interval;
struct timespec it_value;
};
# 28 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/select.h" 2 3
typedef __sigset_t sigset_t;
# 45 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/select.h" 3
typedef unsigned long fd_mask;
typedef struct _types_fd_set {
fd_mask fds_bits[(((64)+(((sizeof (fd_mask) * 8))-1))/((sizeof (fd_mask) * 8)))];
} _types_fd_set;
# 71 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/select.h" 3
int select (int __n, _types_fd_set *__readfds, _types_fd_set *__writefds, _types_fd_set *__exceptfds, struct timeval *__timeout)
;
int pselect (int __n, _types_fd_set *__readfds, _types_fd_set *__writefds, _types_fd_set *__exceptfds, const struct timespec *__timeout, const sigset_t *__set)
;
# 69 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/types.h" 2 3
typedef __uint32_t in_addr_t;
typedef __uint16_t in_port_t;
# 87 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/types.h" 3
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;
typedef __blkcnt_t blkcnt_t;
typedef __blksize_t blksize_t;
typedef unsigned long clock_t;
# 135 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/types.h" 3
typedef long daddr_t;
typedef char * caddr_t;
typedef __fsblkcnt_t fsblkcnt_t;
typedef __fsfilcnt_t fsfilcnt_t;
typedef __id_t id_t;
typedef __ino_t ino_t;
# 173 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/types.h" 3
typedef __off_t off_t;
typedef __dev_t dev_t;
typedef __uid_t uid_t;
typedef __gid_t gid_t;
typedef __pid_t pid_t;
typedef __key_t key_t;
typedef _ssize_t ssize_t;
typedef __mode_t mode_t;
typedef __nlink_t nlink_t;
typedef __clockid_t clockid_t;
typedef __timer_t timer_t;
typedef __useconds_t useconds_t;
# 236 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/types.h" 3
typedef __int64_t sbintime_t;
# 465 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/types.h" 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/machine/types.h" 1 3
# 466 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/types.h" 2 3
# 62 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/stdio.h" 2 3
typedef __FILE FILE;
typedef _fpos_t fpos_t;
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/stdio.h" 1 3
# 80 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/stdio.h" 2 3
# 181 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/stdio.h" 3
char * ctermid (char *);
FILE * tmpfile (void);
char * tmpnam (char *);
char * tempnam (const char *, const char *);
int fclose (FILE *);
int fflush (FILE *);
FILE * freopen (const char *restrict, const char *restrict, FILE *restrict);
void setbuf (FILE *restrict, char *restrict);
int setvbuf (FILE *restrict, char *restrict, int, size_t);
int fprintf (FILE *restrict, const char *restrict, ...) __attribute__ ((__format__ (__printf__, 2, 3)))
;
int fscanf (FILE *restrict, const char *restrict, ...) __attribute__ ((__format__ (__scanf__, 2, 3)))
;
int printf (const char *restrict, ...) __attribute__ ((__format__ (__printf__, 1, 2)))
;
int scanf (const char *restrict, ...) __attribute__ ((__format__ (__scanf__, 1, 2)))
;
int sscanf (const char *restrict, const char *restrict, ...) __attribute__ ((__format__ (__scanf__, 2, 3)))
;
int vfprintf (FILE *restrict, const char *restrict, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 2, 0)))
;
int vprintf (const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 1, 0)))
;
int vsprintf (char *restrict, const char *restrict, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 2, 0)))
;
int fgetc (FILE *);
char * fgets (char *restrict, int, FILE *restrict);
int fputc (int, FILE *);
int fputs (const char *restrict, FILE *restrict);
int getc (FILE *);
int getchar (void);
char * gets (char *);
int putc (int, FILE *);
int putchar (int);
int puts (const char *);
int ungetc (int, FILE *);
size_t fread (void * restrict, size_t _size, size_t _n, FILE *restrict);
size_t fwrite (const void * restrict , size_t _size, size_t _n, FILE *);
int fgetpos (FILE *restrict, fpos_t *restrict);
int fseek (FILE *, long, int);
int fsetpos (FILE *, const fpos_t *);
long ftell ( FILE *);
void rewind (FILE *);
void clearerr (FILE *);
int feof (FILE *);
int ferror (FILE *);
void perror (const char *);
FILE * fopen (const char *restrict _name, const char *restrict _type);
int sprintf (char *restrict, const char *restrict, ...) __attribute__ ((__format__ (__printf__, 2, 3)))
;
int remove (const char *);
int rename (const char *, const char *);
# 257 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/stdio.h" 3
int fseeko (FILE *, off_t, int);
off_t ftello ( FILE *);
int snprintf (char *restrict, size_t, const char *restrict, ...) __attribute__ ((__format__ (__printf__, 3, 4)))
;
int vsnprintf (char *restrict, size_t, const char *restrict, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 3, 0)))
;
int vfscanf (FILE *restrict, const char *restrict, __gnuc_va_list) __attribute__ ((__format__ (__scanf__, 2, 0)))
;
int vscanf (const char *, __gnuc_va_list) __attribute__ ((__format__ (__scanf__, 1, 0)))
;
int vsscanf (const char *restrict, const char *restrict, __gnuc_va_list) __attribute__ ((__format__ (__scanf__, 2, 0)))
;
# 284 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/stdio.h" 3
int asiprintf (char **, const char *, ...) __attribute__ ((__format__ (__printf__, 2, 3)))
;
char * asniprintf (char *, size_t *, const char *, ...) __attribute__ ((__format__ (__printf__, 3, 4)))
;
char * asnprintf (char *restrict, size_t *restrict, const char *restrict, ...) __attribute__ ((__format__ (__printf__, 3, 4)))
;
int diprintf (int, const char *, ...) __attribute__ ((__format__ (__printf__, 2, 3)))
;
int fiprintf (FILE *, const char *, ...) __attribute__ ((__format__ (__printf__, 2, 3)))
;
int fiscanf (FILE *, const char *, ...) __attribute__ ((__format__ (__scanf__, 2, 3)))
;
int iprintf (const char *, ...) __attribute__ ((__format__ (__printf__, 1, 2)))
;
int iscanf (const char *, ...) __attribute__ ((__format__ (__scanf__, 1, 2)))
;
int siprintf (char *, const char *, ...) __attribute__ ((__format__ (__printf__, 2, 3)))
;
int siscanf (const char *, const char *, ...) __attribute__ ((__format__ (__scanf__, 2, 3)))
;
int sniprintf (char *, size_t, const char *, ...) __attribute__ ((__format__ (__printf__, 3, 4)))
;
int vasiprintf (char **, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 2, 0)))
;
char * vasniprintf (char *, size_t *, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 3, 0)))
;
char * vasnprintf (char *, size_t *, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 3, 0)))
;
int vdiprintf (int, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 2, 0)))
;
int vfiprintf (FILE *, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 2, 0)))
;
int vfiscanf (FILE *, const char *, __gnuc_va_list) __attribute__ ((__format__ (__scanf__, 2, 0)))
;
int viprintf (const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 1, 0)))
;
int viscanf (const char *, __gnuc_va_list) __attribute__ ((__format__ (__scanf__, 1, 0)))
;
int vsiprintf (char *, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 2, 0)))
;
int vsiscanf (const char *, const char *, __gnuc_va_list) __attribute__ ((__format__ (__scanf__, 2, 0)))
;
int vsniprintf (char *, size_t, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 3, 0)))
;
# 339 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/stdio.h" 3
FILE * fdopen (int, const char *);
int fileno (FILE *);
int pclose (FILE *);
FILE * popen (const char *, const char *);
void setbuffer (FILE *, char *, int);
int setlinebuf (FILE *);
int getw (FILE *);
int putw (int, FILE *);
int getc_unlocked (FILE *);
int getchar_unlocked (void);
void flockfile (FILE *);
int ftrylockfile (FILE *);
void funlockfile (FILE *);
int putc_unlocked (int, FILE *);
int putchar_unlocked (int);
# 374 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/stdio.h" 3
int dprintf (int, const char *restrict, ...) __attribute__ ((__format__ (__printf__, 2, 3)))
;
FILE * fmemopen (void *restrict, size_t, const char *restrict);
FILE * open_memstream (char **, size_t *);
int vdprintf (int, const char *restrict, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 2, 0)))
;
int renameat (int, const char *, int, const char *);
int _asiprintf_r (struct _reent *, char **, const char *, ...) __attribute__ ((__format__ (__printf__, 3, 4)))
;
char * _asniprintf_r (struct _reent *, char *, size_t *, const char *, ...) __attribute__ ((__format__ (__printf__, 4, 5)))
;
char * _asnprintf_r (struct _reent *, char *restrict, size_t *restrict, const char *restrict, ...) __attribute__ ((__format__ (__printf__, 4, 5)))
;
int _asprintf_r (struct _reent *, char **restrict, const char *restrict, ...) __attribute__ ((__format__ (__printf__, 3, 4)))
;
int _diprintf_r (struct _reent *, int, const char *, ...) __attribute__ ((__format__ (__printf__, 3, 4)))
;
int _dprintf_r (struct _reent *, int, const char *restrict, ...) __attribute__ ((__format__ (__printf__, 3, 4)))
;
int _fclose_r (struct _reent *, FILE *);
int _fcloseall_r (struct _reent *);
FILE * _fdopen_r (struct _reent *, int, const char *);
int _fflush_r (struct _reent *, FILE *);
int _fgetc_r (struct _reent *, FILE *);
int _fgetc_unlocked_r (struct _reent *, FILE *);
char * _fgets_r (struct _reent *, char *restrict, int, FILE *restrict);
char * _fgets_unlocked_r (struct _reent *, char *restrict, int, FILE *restrict);
int _fgetpos_r (struct _reent *, FILE *, fpos_t *);
int _fsetpos_r (struct _reent *, FILE *, const fpos_t *);
int _fiprintf_r (struct _reent *, FILE *, const char *, ...) __attribute__ ((__format__ (__printf__, 3, 4)))
;
int _fiscanf_r (struct _reent *, FILE *, const char *, ...) __attribute__ ((__format__ (__scanf__, 3, 4)))
;
FILE * _fmemopen_r (struct _reent *, void *restrict, size_t, const char *restrict);
FILE * _fopen_r (struct _reent *, const char *restrict, const char *restrict);
FILE * _freopen_r (struct _reent *, const char *restrict, const char *restrict, FILE *restrict);
int _fprintf_r (struct _reent *, FILE *restrict, const char *restrict, ...) __attribute__ ((__format__ (__printf__, 3, 4)))
;
int _fpurge_r (struct _reent *, FILE *);
int _fputc_r (struct _reent *, int, FILE *);
int _fputc_unlocked_r (struct _reent *, int, FILE *);
int _fputs_r (struct _reent *, const char *restrict, FILE *restrict);
int _fputs_unlocked_r (struct _reent *, const char *restrict, FILE *restrict);
size_t _fread_r (struct _reent *, void * restrict, size_t _size, size_t _n, FILE *restrict);
size_t _fread_unlocked_r (struct _reent *, void * restrict, size_t _size, size_t _n, FILE *restrict);
int _fscanf_r (struct _reent *, FILE *restrict, const char *restrict, ...) __attribute__ ((__format__ (__scanf__, 3, 4)))
;
int _fseek_r (struct _reent *, FILE *, long, int);
int _fseeko_r (struct _reent *, FILE *, _off_t, int);
long _ftell_r (struct _reent *, FILE *);
_off_t _ftello_r (struct _reent *, FILE *);
void _rewind_r (struct _reent *, FILE *);
size_t _fwrite_r (struct _reent *, const void * restrict, size_t _size, size_t _n, FILE *restrict);
size_t _fwrite_unlocked_r (struct _reent *, const void * restrict, size_t _size, size_t _n, FILE *restrict);
int _getc_r (struct _reent *, FILE *);
int _getc_unlocked_r (struct _reent *, FILE *);
int _getchar_r (struct _reent *);
int _getchar_unlocked_r (struct _reent *);
char * _gets_r (struct _reent *, char *);
int _iprintf_r (struct _reent *, const char *, ...) __attribute__ ((__format__ (__printf__, 2, 3)))
;
int _iscanf_r (struct _reent *, const char *, ...) __attribute__ ((__format__ (__scanf__, 2, 3)))
;
FILE * _open_memstream_r (struct _reent *, char **, size_t *);
void _perror_r (struct _reent *, const char *);
int _printf_r (struct _reent *, const char *restrict, ...) __attribute__ ((__format__ (__printf__, 2, 3)))
;
int _putc_r (struct _reent *, int, FILE *);
int _putc_unlocked_r (struct _reent *, int, FILE *);
int _putchar_unlocked_r (struct _reent *, int);
int _putchar_r (struct _reent *, int);
int _puts_r (struct _reent *, const char *);
int _remove_r (struct _reent *, const char *);
int _rename_r (struct _reent *, const char *_old, const char *_new)
;
int _scanf_r (struct _reent *, const char *restrict, ...) __attribute__ ((__format__ (__scanf__, 2, 3)))
;
int _siprintf_r (struct _reent *, char *, const char *, ...) __attribute__ ((__format__ (__printf__, 3, 4)))
;
int _siscanf_r (struct _reent *, const char *, const char *, ...) __attribute__ ((__format__ (__scanf__, 3, 4)))
;
int _sniprintf_r (struct _reent *, char *, size_t, const char *, ...) __attribute__ ((__format__ (__printf__, 4, 5)))
;
int _snprintf_r (struct _reent *, char *restrict, size_t, const char *restrict, ...) __attribute__ ((__format__ (__printf__, 4, 5)))
;
int _sprintf_r (struct _reent *, char *restrict, const char *restrict, ...) __attribute__ ((__format__ (__printf__, 3, 4)))
;
int _sscanf_r (struct _reent *, const char *restrict, const char *restrict, ...) __attribute__ ((__format__ (__scanf__, 3, 4)))
;
char * _tempnam_r (struct _reent *, const char *, const char *);
FILE * _tmpfile_r (struct _reent *);
char * _tmpnam_r (struct _reent *, char *);
int _ungetc_r (struct _reent *, int, FILE *);
int _vasiprintf_r (struct _reent *, char **, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 3, 0)))
;
char * _vasniprintf_r (struct _reent*, char *, size_t *, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 4, 0)))
;
char * _vasnprintf_r (struct _reent*, char *, size_t *, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 4, 0)))
;
int _vasprintf_r (struct _reent *, char **, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 3, 0)))
;
int _vdiprintf_r (struct _reent *, int, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 3, 0)))
;
int _vdprintf_r (struct _reent *, int, const char *restrict, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 3, 0)))
;
int _vfiprintf_r (struct _reent *, FILE *, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 3, 0)))
;
int _vfiscanf_r (struct _reent *, FILE *, const char *, __gnuc_va_list) __attribute__ ((__format__ (__scanf__, 3, 0)))
;
int _vfprintf_r (struct _reent *, FILE *restrict, const char *restrict, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 3, 0)))
;
int _vfscanf_r (struct _reent *, FILE *restrict, const char *restrict, __gnuc_va_list) __attribute__ ((__format__ (__scanf__, 3, 0)))
;
int _viprintf_r (struct _reent *, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 2, 0)))
;
int _viscanf_r (struct _reent *, const char *, __gnuc_va_list) __attribute__ ((__format__ (__scanf__, 2, 0)))
;
int _vprintf_r (struct _reent *, const char *restrict, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 2, 0)))
;
int _vscanf_r (struct _reent *, const char *restrict, __gnuc_va_list) __attribute__ ((__format__ (__scanf__, 2, 0)))
;
int _vsiprintf_r (struct _reent *, char *, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 3, 0)))
;
int _vsiscanf_r (struct _reent *, const char *, const char *, __gnuc_va_list) __attribute__ ((__format__ (__scanf__, 3, 0)))
;
int _vsniprintf_r (struct _reent *, char *, size_t, const char *, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 4, 0)))
;
int _vsnprintf_r (struct _reent *, char *restrict, size_t, const char *restrict, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 4, 0)))
;
int _vsprintf_r (struct _reent *, char *restrict, const char *restrict, __gnuc_va_list) __attribute__ ((__format__ (__printf__, 3, 0)))
;
int _vsscanf_r (struct _reent *, const char *restrict, const char *restrict, __gnuc_va_list) __attribute__ ((__format__ (__scanf__, 3, 0)))
;
int fpurge (FILE *);
ssize_t __getdelim (char **, size_t *, int, FILE *);
ssize_t __getline (char **, size_t *, FILE *);
void clearerr_unlocked (FILE *);
int feof_unlocked (FILE *);
int ferror_unlocked (FILE *);
int fileno_unlocked (FILE *);
int fflush_unlocked (FILE *);
int fgetc_unlocked (FILE *);
int fputc_unlocked (int, FILE *);
size_t fread_unlocked (void * restrict, size_t _size, size_t _n, FILE *restrict);
size_t fwrite_unlocked (const void * restrict , size_t _size, size_t _n, FILE *);
# 574 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/stdio.h" 3
int __srget_r (struct _reent *, FILE *);
int __swbuf_r (struct _reent *, int, FILE *);
# 598 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/stdio.h" 3
FILE *funopen (const void * __cookie, int (*__readfn)(void * __cookie, char *__buf, int __n), int (*__writefn)(void * __cookie, const char *__buf, int __n), fpos_t (*__seekfn)(void * __cookie, fpos_t __off, int __whence), int (*__closefn)(void * __cookie))
;
FILE *_funopen_r (struct _reent *, const void * __cookie, int (*__readfn)(void * __cookie, char *__buf, int __n), int (*__writefn)(void * __cookie, const char *__buf, int __n), fpos_t (*__seekfn)(void * __cookie, fpos_t __off, int __whence), int (*__closefn)(void * __cookie))
;
# 684 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/stdio.h" 3
static __inline__ int __sputc_r(struct _reent *_ptr, int _c, FILE *_p) {
if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
return (*_p->_p++ = _c);
else
return (__swbuf_r(_ptr, _c, _p));
}
# 767 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/stdio.h" 3
# 7 "utility/log/log.c" 2
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/string.h" 1 3
# 17 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/string.h" 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/lib/gcc/arm-none-eabi/5.4.1/include/stddef.h" 1 3 4
# 18 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/string.h" 2 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/_locale.h" 1 3
# 9 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/_locale.h" 3
struct __locale_t;
typedef struct __locale_t *locale_t;
# 21 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/string.h" 2 3
void * memchr (const void *, int, size_t);
int memcmp (const void *, const void *, size_t);
void * memcpy (void * restrict, const void * restrict, size_t);
void * memmove (void *, const void *, size_t);
void * memset (void *, int, size_t);
char *strcat (char *restrict, const char *restrict);
char *strchr (const char *, int);
int strcmp (const char *, const char *);
int strcoll (const char *, const char *);
char *strcpy (char *restrict, const char *restrict);
size_t strcspn (const char *, const char *);
char *strerror (int);
size_t strlen (const char *);
char *strncat (char *restrict, const char *restrict, size_t);
int strncmp (const char *, const char *, size_t);
char *strncpy (char *restrict, const char *restrict, size_t);
char *strpbrk (const char *, const char *);
char *strrchr (const char *, int);
size_t strspn (const char *, const char *);
char *strstr (const char *, const char *);
char *strtok (char *restrict, const char *restrict);
size_t strxfrm (char *restrict, const char *restrict, size_t);
int strcoll_l (const char *, const char *, locale_t);
char *strerror_l (int, locale_t);
size_t strxfrm_l (char *restrict, const char *restrict, size_t, locale_t);
char *strtok_r (char *restrict, const char *restrict, char **restrict);
int bcmp (const void *, const void *, size_t);
void bcopy (const void *, void *, size_t);
void bzero (void *, size_t);
void explicit_bzero (void *, size_t);
int timingsafe_bcmp (const void *, const void *, size_t);
int timingsafe_memcmp (const void *, const void *, size_t);
int ffs (int);
char *index (const char *, int);
void * memccpy (void * restrict, const void * restrict, int, size_t);
# 86 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/string.h" 3
char *rindex (const char *, int);
char *stpcpy (char *restrict, const char *restrict);
char *stpncpy (char *restrict, const char *restrict, size_t);
int strcasecmp (const char *, const char *);
char *strdup (const char *);
char *_strdup_r (struct _reent *, const char *);
char *strndup (const char *, size_t);
char *_strndup_r (struct _reent *, const char *, size_t);
# 121 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/string.h" 3
int strerror_r (int, char *, size_t)
__asm__ ("" "__xpg_strerror_r")
;
char * _strerror_r (struct _reent *, int, int, int *);
size_t strlcat (char *, const char *, size_t);
size_t strlcpy (char *, const char *, size_t);
int strncasecmp (const char *, const char *, size_t);
size_t strnlen (const char *, size_t);
char *strsep (char **, const char *);
char *strlwr (char *);
char *strupr (char *);
char *strsignal (int __signo);
# 192 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/string.h" 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/string.h" 1 3
# 193 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/string.h" 2 3
# 8 "utility/log/log.c" 2
# 1 "./include/aos/aos.h" 1
# 12 "./include/aos/aos.h"
# 1 "./include/aos/types.h" 1
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/lib/gcc/arm-none-eabi/5.4.1/include/stdint.h" 1 3 4
# 9 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/lib/gcc/arm-none-eabi/5.4.1/include/stdint.h" 3 4
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/stdint.h" 1 3 4
# 13 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/stdint.h" 3 4
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/_intsup.h" 1 3 4
# 49 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/_intsup.h" 3 4
# 201 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/_intsup.h" 3 4
# 14 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/stdint.h" 2 3 4
typedef __int_least8_t int_least8_t;
typedef __uint_least8_t uint_least8_t;
typedef __int_least16_t int_least16_t;
typedef __uint_least16_t uint_least16_t;
typedef __int_least32_t int_least32_t;
typedef __uint_least32_t uint_least32_t;
typedef __int_least64_t int_least64_t;
typedef __uint_least64_t uint_least64_t;
# 51 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/stdint.h" 3 4
typedef int int_fast8_t;
typedef unsigned int uint_fast8_t;
# 61 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/stdint.h" 3 4
typedef int int_fast16_t;
typedef unsigned int uint_fast16_t;
# 71 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/stdint.h" 3 4
typedef int int_fast32_t;
typedef unsigned int uint_fast32_t;
# 81 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/stdint.h" 3 4
typedef long long int int_fast64_t;
typedef long long unsigned int uint_fast64_t;
# 130 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/stdint.h" 3 4
typedef long long int intmax_t;
# 139 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/stdint.h" 3 4
typedef long long unsigned int uintmax_t;
# 10 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/lib/gcc/arm-none-eabi/5.4.1/include/stdint.h" 2 3 4
# 9 "./include/aos/types.h" 2
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/lib/gcc/arm-none-eabi/5.4.1/include/stddef.h" 1 3 4
# 10 "./include/aos/types.h" 2
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/unistd.h" 1 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/unistd.h" 1 3
# 14 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/unistd.h" 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/lib/gcc/arm-none-eabi/5.4.1/include/stddef.h" 1 3 4
# 15 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/unistd.h" 2 3
extern char **environ;
void _exit (int __status ) __attribute__ ((__noreturn__));
int access (const char *__path, int __amode );
unsigned alarm (unsigned __secs );
int chdir (const char *__path );
int chmod (const char *__path, mode_t __mode );
int chown (const char *__path, uid_t __owner, gid_t __group );
int chroot (const char *__path );
int close (int __fildes );
size_t confstr (int __name, char *__buf, size_t __len);
# 44 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/unistd.h" 3
int daemon (int nochdir, int noclose);
int dup (int __fildes );
int dup2 (int __fildes, int __fildes2 );
# 56 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/unistd.h" 3
void endusershell (void);
int execl (const char *__path, const char *, ... );
int execle (const char *__path, const char *, ... );
int execlp (const char *__file, const char *, ... );
int execlpe (const char *__file, const char *, ... );
int execv (const char *__path, char * const __argv[] );
int execve (const char *__path, char * const __argv[], char * const __envp[] );
int execvp (const char *__file, char * const __argv[] );
int faccessat (int __dirfd, const char *__path, int __mode, int __flags);
int fchdir (int __fildes);
int fchmod (int __fildes, mode_t __mode );
int fchown (int __fildes, uid_t __owner, gid_t __group );
int fchownat (int __dirfd, const char *__path, uid_t __owner, gid_t __group, int __flags);
int fexecve (int __fd, char * const __argv[], char * const __envp[] );
pid_t fork (void );
long fpathconf (int __fd, int __name );
int fsync (int __fd);
int fdatasync (int __fd);
char * getcwd (char *__buf, size_t __size );
int getdomainname (char *__name, size_t __len);
int getentropy (void *, size_t);
gid_t getegid (void );
uid_t geteuid (void );
gid_t getgid (void );
int getgroups (int __gidsetsize, gid_t __grouplist[] );
long gethostid (void);
char * getlogin (void );
char * getpass (const char *__prompt);
int getpagesize (void);
int getpeereid (int, uid_t *, gid_t *);
pid_t getpgid (pid_t);
pid_t getpgrp (void );
pid_t getpid (void );
pid_t getppid (void );
pid_t getsid (pid_t);
uid_t getuid (void );
char * getusershell (void);
char * getwd (char *__buf );
int iruserok (unsigned long raddr, int superuser, const char *ruser, const char *luser);
int isatty (int __fildes );
int issetugid (void);
int lchown (const char *__path, uid_t __owner, gid_t __group );
int link (const char *__path1, const char *__path2 );
int linkat (int __dirfd1, const char *__path1, int __dirfd2, const char *__path2, int __flags );
int nice (int __nice_value );
off_t lseek (int __fildes, off_t __offset, int __whence );
int lockf (int __fd, int __cmd, off_t __len);
long pathconf (const char *__path, int __name );
int pause (void );
int pthread_atfork (void (*)(void), void (*)(void), void (*)(void));
int pipe (int __fildes[2] );
ssize_t pread (int __fd, void *__buf, size_t __nbytes, off_t __offset);
ssize_t pwrite (int __fd, const void *__buf, size_t __nbytes, off_t __offset);
int read (int __fd, void *__buf, size_t __nbyte );
int rresvport (int *__alport);
int revoke (char *__path);
int rmdir (const char *__path );
int ruserok (const char *rhost, int superuser, const char *ruser, const char *luser);
void * sbrk (ptrdiff_t __incr);
int setegid (gid_t __gid );
int seteuid (uid_t __uid );
int setgid (gid_t __gid );
int setgroups (int ngroups, const gid_t *grouplist );
int sethostname (const char *, size_t);
int setpgid (pid_t __pid, pid_t __pgid );
int setpgrp (void );
int setregid (gid_t __rgid, gid_t __egid);
int setreuid (uid_t __ruid, uid_t __euid);
pid_t setsid (void );
int setuid (uid_t __uid );
void setusershell (void);
unsigned sleep (unsigned int __seconds );
void swab (const void *restrict, void *restrict, ssize_t);
long sysconf (int __name );
pid_t tcgetpgrp (int __fildes );
int tcsetpgrp (int __fildes, pid_t __pgrp_id );
char * ttyname (int __fildes );
int ttyname_r (int, char *, size_t);
int unlink (const char *__path );
int usleep (useconds_t __useconds);
int vhangup (void );
int write (int __fd, const void *__buf, size_t __nbyte );
extern char *optarg;
extern int optind, opterr, optopt;
int getopt(int, char * const [], const char *);
extern int optreset;
pid_t vfork (void );
# 257 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/unistd.h" 3
int ftruncate (int __fd, off_t __length);
int truncate (const char *, off_t __length);
# 278 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/unistd.h" 3
ssize_t readlink (const char *restrict __path, char *restrict __buf, size_t __buflen)
;
int symlink (const char *__name1, const char *__name2);
ssize_t readlinkat (int __dirfd1, const char *restrict __path, char *restrict __buf, size_t __buflen)
;
int symlinkat (const char *, int, const char *);
int unlinkat (int, const char *, int);
# 5 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/unistd.h" 2 3
# 11 "./include/aos/types.h" 2
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/fcntl.h" 1 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/fcntl.h" 1 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/_default_fcntl.h" 1 3
# 163 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/_default_fcntl.h" 3
struct flock {
short l_type;
short l_whence;
long l_start;
long l_len;
short l_pid;
short l_xxx;
};
struct eflock {
short l_type;
short l_whence;
long l_start;
long l_len;
short l_pid;
short l_xxx;
long l_rpid;
long l_rsys;
};
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/stat.h" 1 3
# 9 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/stat.h" 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/time.h" 1 3
# 16 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/time.h" 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/lib/gcc/arm-none-eabi/5.4.1/include/stddef.h" 1 3 4
# 17 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/time.h" 2 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/machine/time.h" 1 3
# 20 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/time.h" 2 3
# 35 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/time.h" 3
struct tm
{
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
int tm_wday;
int tm_yday;
int tm_isdst;
};
clock_t clock (void);
double difftime (time_t _time2, time_t _time1);
time_t mktime (struct tm *_timeptr);
time_t time (time_t *_timer);
char *asctime (const struct tm *_tblock);
char *ctime (const time_t *_time);
struct tm *gmtime (const time_t *_timer);
struct tm *localtime (const time_t *_timer);
size_t strftime (char *restrict _s, size_t _maxsize, const char *restrict _fmt, const struct tm *restrict _t)
;
extern size_t strftime_l (char *restrict _s, size_t _maxsize,
const char *restrict _fmt,
const struct tm *restrict _t, locale_t _l);
char *asctime_r (const struct tm *restrict, char *restrict)
;
char *ctime_r (const time_t *, char *);
struct tm *gmtime_r (const time_t *restrict, struct tm *restrict)
;
struct tm *localtime_r (const time_t *restrict, struct tm *restrict)
;
# 101 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/time.h" 3
void tzset (void);
void _tzset_r (struct _reent *);
typedef struct __tzrule_struct
{
char ch;
int m;
int n;
int d;
int s;
time_t change;
long offset;
} __tzrule_type;
typedef struct __tzinfo_struct
{
int __tznorth;
int __tzyear;
__tzrule_type __tzrule[2];
} __tzinfo_type;
__tzinfo_type *__gettzinfo (void);
# 154 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/time.h" 3
extern long _timezone;
extern int _daylight;
extern char *_tzname[2];
# 10 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/stat.h" 2 3
# 27 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/stat.h" 3
struct stat
{
dev_t st_dev;
ino_t st_ino;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
dev_t st_rdev;
off_t st_size;
# 50 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/stat.h" 3
time_t st_atime;
long st_spare1;
time_t st_mtime;
long st_spare2;
time_t st_ctime;
long st_spare3;
blksize_t st_blksize;
blkcnt_t st_blocks;
long st_spare4[2];
};
# 147 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/stat.h" 3
int chmod ( const char *__path, mode_t __mode );
int fchmod (int __fd, mode_t __mode);
int fstat ( int __fd, struct stat *__sbuf );
int mkdir ( const char *_path, mode_t __mode );
int mkfifo ( const char *__path, mode_t __mode );
int stat ( const char *restrict __path, struct stat *restrict __sbuf );
mode_t umask ( mode_t __mask );
int fchmodat (int, const char *, mode_t, int);
int fstatat (int, const char *restrict , struct stat *restrict, int);
int mkdirat (int, const char *, mode_t);
int mkfifoat (int, const char *, mode_t);
int mknodat (int, const char *, mode_t, dev_t);
int utimensat (int, const char *, const struct timespec *, int);
int futimens (int, const struct timespec *);
# 189 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/_default_fcntl.h" 2 3
extern int open (const char *, int, ...);
extern int openat (int, const char *, int, ...);
extern int creat (const char *, mode_t);
extern int fcntl (int, int, ...);
extern int flock (int, int);
# 5 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/fcntl.h" 2 3
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/fcntl.h" 2 3
# 12 "./include/aos/types.h" 2
# 17 "./include/aos/types.h"
struct pollfd {
int fd;
short events;
short revents;
};
# 13 "./include/aos/aos.h" 2
# 1 "./include/aos/cli.h" 1
# 18 "./include/aos/cli.h"
typedef void (*FUNCPTR)(void);
struct cli_command {
const char *name;
const char *help;
void (*function)(char *pcWriteBuffer, int xWriteBufferLen, int argc, char **argv);
};
struct cli_st {
int initialized;
int echo_disabled;
const struct cli_command *commands[64];
unsigned int num_commands;
unsigned int bp;
char inbuf[256];
char outbuf[2048];
int his_idx;
int his_cur;
char history[5][256];
};
# 137 "./include/aos/cli.h"
# 1 "././platform/arch/arm/armv5/./gcc/k_types.h" 1
# 14 "././platform/arch/arm/armv5/./gcc/k_types.h"
typedef char name_t;
typedef uint32_t sem_count_t;
typedef uint32_t cpu_stack_t;
typedef uint32_t hr_timer_t;
typedef uint32_t lr_timer_t;
typedef uint32_t mutex_nested_t;
typedef uint8_t suspend_nested_t;
typedef uint64_t ctx_switch_t;
typedef uint32_t cpu_cpsr_t;
# 138 "./include/aos/cli.h" 2
static inline int aos_cli_register_command(const struct cli_command *command)
{
return 0;
}
static inline int aos_cli_unregister_command(const struct cli_command *command)
{
return 0;
}
static inline int aos_cli_register_commands(const struct cli_command *commands,
int num_commands)
{
return 0;
}
static inline int aos_cli_unregister_commands(const struct cli_command *commands,
int num_commands)
{
return 0;
}
static inline int aos_cli_init(void)
{
return 0;
}
static inline int aos_cli_stop(void)
{
return 0;
}
# 14 "./include/aos/aos.h" 2
# 1 "./include/aos/cloud.h" 1
enum {
CLOUD_CONNECTED,
CLOUD_DISCONNECTED,
GET_DEVICE_STATUS,
SET_DEVICE_STATUS,
GET_DEVICE_RAWDATA,
SET_DEVICE_RAWDATA,
UPGRADE_DEVICE,
CANCEL_UPGRADE_DEVICE,
GET_SUB_DEVICE_STATUS,
SET_SUB_DEVICE_STATUS,
MAX_EVENT_TYPE,
};
typedef void (*aos_cloud_cb_t)(int event, const char *json_buffer);
# 32 "./include/aos/cloud.h"
int aos_cloud_register_callback(int cb_type, aos_cloud_cb_t cb);
# 44 "./include/aos/cloud.h"
int aos_cloud_report(const char *method,
const char *json_buffer,
void (*done_cb)(void *),
void *arg);
void aos_cloud_trigger(int cb_type, const char *json_buffer);
void aos_cloud_register_backend(int (*report)(const char *method, const char *json_buffer));
# 15 "./include/aos/aos.h" 2
# 1 "./include/aos/debug.h" 1
# 16 "./include/aos/aos.h" 2
# 1 "./include/aos/kernel.h" 1
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/lib/gcc/arm-none-eabi/5.4.1/include/stddef.h" 1 3 4
# 9 "./include/aos/kernel.h" 2
# 19 "./include/aos/kernel.h"
typedef struct {
void *hdl;
} aos_hdl_t;
typedef aos_hdl_t aos_task_t;
typedef aos_hdl_t aos_mutex_t;
typedef aos_hdl_t aos_sem_t;
typedef aos_hdl_t aos_queue_t;
typedef aos_hdl_t aos_timer_t;
typedef aos_hdl_t aos_work_t;
typedef aos_hdl_t aos_event_t;
typedef struct {
void *hdl;
void *stk;
} aos_workqueue_t;
typedef unsigned int aos_task_key_t;
void aos_reboot(void);
int aos_get_hz(void);
const char *aos_version_get(void);
# 67 "./include/aos/kernel.h"
int aos_task_new(const char *name, void (*fn)(void *), void *arg, int stack_size);
# 82 "./include/aos/kernel.h"
int aos_task_new_ext(aos_task_t *task, const char *name, void (*fn)(void *), void *arg,
int stack_size, int prio);
void aos_task_exit(int code);
const char *aos_task_name(void);
# 106 "./include/aos/kernel.h"
int aos_task_key_create(aos_task_key_t *key);
void aos_task_key_delete(aos_task_key_t key);
# 123 "./include/aos/kernel.h"
int aos_task_setspecific(aos_task_key_t key, void *vp);
void *aos_task_getspecific(aos_task_key_t key);
# 140 "./include/aos/kernel.h"
int aos_mutex_new(aos_mutex_t *mutex);
void aos_mutex_free(aos_mutex_t *mutex);
# 158 "./include/aos/kernel.h"
int aos_mutex_lock(aos_mutex_t *mutex, unsigned int timeout);
# 167 "./include/aos/kernel.h"
int aos_mutex_unlock(aos_mutex_t *mutex);
# 176 "./include/aos/kernel.h"
int aos_mutex_is_valid(aos_mutex_t *mutex);
# 187 "./include/aos/kernel.h"
int aos_sem_new(aos_sem_t *sem, int count);
void aos_sem_free(aos_sem_t *sem);
# 205 "./include/aos/kernel.h"
int aos_sem_wait(aos_sem_t *sem, unsigned int timeout);
void aos_sem_signal(aos_sem_t *sem);
# 221 "./include/aos/kernel.h"
int aos_sem_is_valid(aos_sem_t *sem);
void aos_sem_signal_all(aos_sem_t *sem);
# 240 "./include/aos/kernel.h"
int aos_event_new(aos_event_t *event, unsigned int flags);
# 251 "./include/aos/kernel.h"
void aos_event_free(aos_event_t *event);
# 272 "./include/aos/kernel.h"
int aos_event_get(aos_event_t *event, unsigned int flags, unsigned char opt,
unsigned int *actl_flags, unsigned int timeout);
# 286 "./include/aos/kernel.h"
int aos_event_set(aos_event_t *event, unsigned int flags, unsigned char opt);
# 299 "./include/aos/kernel.h"
int aos_queue_new(aos_queue_t *queue, void *buf, unsigned int size, int max_msg);
void aos_queue_free(aos_queue_t *queue);
# 317 "./include/aos/kernel.h"
int aos_queue_send(aos_queue_t *queue, void *msg, unsigned int size);
# 329 "./include/aos/kernel.h"
int aos_queue_recv(aos_queue_t *queue, unsigned int ms, void *msg, unsigned int *size);
# 338 "./include/aos/kernel.h"
int aos_queue_is_valid(aos_queue_t *queue);
# 347 "./include/aos/kernel.h"
void *aos_queue_buf_ptr(aos_queue_t *queue);
# 360 "./include/aos/kernel.h"
int aos_timer_new(aos_timer_t *timer, void (*fn)(void *, void *),
void *arg, int ms, int repeat);
# 375 "./include/aos/kernel.h"
int aos_timer_new_ext(aos_timer_t *timer, void (*fn)(void *, void *),
void *arg, int ms, int repeat, unsigned char auto_run);
void aos_timer_free(aos_timer_t *timer);
# 392 "./include/aos/kernel.h"
int aos_timer_start(aos_timer_t *timer);
# 401 "./include/aos/kernel.h"
int aos_timer_stop(aos_timer_t *timer);
# 411 "./include/aos/kernel.h"
int aos_timer_change(aos_timer_t *timer, int ms);
# 422 "./include/aos/kernel.h"
int aos_workqueue_create(aos_workqueue_t *workqueue, int pri, int stack_size);
# 434 "./include/aos/kernel.h"
int aos_work_init(aos_work_t *work, void (*fn)(void *), void *arg, int dly);
void aos_work_destroy(aos_work_t *work);
# 451 "./include/aos/kernel.h"
int aos_work_run(aos_workqueue_t *workqueue, aos_work_t *work);
# 460 "./include/aos/kernel.h"
int aos_work_sched(aos_work_t *work);
# 469 "./include/aos/kernel.h"
int aos_work_cancel(aos_work_t *work);
# 479 "./include/aos/kernel.h"
void *aos_realloc(void *mem, unsigned int size);
# 488 "./include/aos/kernel.h"
void *aos_malloc(unsigned int size);
# 497 "./include/aos/kernel.h"
void *aos_zalloc(unsigned int size);
void aos_alloc_trace(void *addr, size_t allocator);
void aos_free(void *mem);
long long aos_now(void);
long long aos_now_ms(void);
void aos_msleep(int ms);
void aos_init(void);
void aos_start(void);
# 17 "./include/aos/aos.h" 2
# 1 "./include/aos/kv.h" 1
# 25 "./include/aos/kv.h"
int aos_kv_set(const char *key, const void *value, int len, int sync);
# 40 "./include/aos/kv.h"
int aos_kv_get(const char *key, void *buffer, int *buffer_len);
# 49 "./include/aos/kv.h"
int aos_kv_del(const char *key);
# 18 "./include/aos/aos.h" 2
# 1 "./include/aos/list.h" 1
# 31 "./include/aos/list.h"
typedef struct dlist_s {
struct dlist_s *prev;
struct dlist_s *next;
} dlist_t;
static inline void __dlist_add(dlist_t *node, dlist_t *prev, dlist_t *next)
{
node->next = next;
node->prev = prev;
prev->next = node;
next->prev = node;
}
# 56 "./include/aos/list.h"
static inline void dlist_add(dlist_t *node, dlist_t *queue)
{
__dlist_add(node, queue, queue->next);
}
static inline void dlist_add_tail(dlist_t *node, dlist_t *queue)
{
__dlist_add(node, queue->prev, queue);
}
static inline void dlist_del(dlist_t *node)
{
dlist_t *prev = node->prev;
dlist_t *next = node->next;
prev->next = next;
next->prev = prev;
}
static inline void dlist_init(dlist_t *node)
{
node->next = node->prev = node;
}
static inline void INIT_AOS_DLIST_HEAD(dlist_t *list)
{
list->next = list;
list->prev = list;
}
static inline int dlist_empty(const dlist_t *head)
{
return head->next == head;
}
# 185 "./include/aos/list.h"
static inline int dlist_entry_number(dlist_t *queue)
{
int num;
dlist_t *cur = queue;
for (num=0;cur->next != queue;cur=cur->next, num++)
;
return num;
}
# 213 "./include/aos/list.h"
typedef struct slist_s {
struct slist_s *next;
} slist_t;
static inline void slist_add(slist_t *node, slist_t *head)
{
node->next = head->next;
head->next = node;
}
static inline void slist_add_tail(slist_t *node, slist_t *head)
{
while (head->next) {
head = head->next;
}
slist_add(node, head);
}
static inline void slist_del(slist_t *node, slist_t *head)
{
while (head->next) {
if (head->next == node) {
head->next = node->next;
break;
}
head = head->next;
}
}
static inline int slist_empty(const slist_t *head)
{
return !head->next;
}
static inline void slist_init(slist_t *head)
{
head->next = 0;
}
# 322 "./include/aos/list.h"
static inline int slist_entry_number(slist_t *queue)
{
int num;
slist_t *cur = queue;
for (num=0;cur->next;cur=cur->next, num++)
;
return num;
}
# 19 "./include/aos/aos.h" 2
# 1 "./include/aos/log.h" 1
# 12 "./include/aos/log.h"
# 1 "./include/aos/internal/log_impl.h" 1
# 12 "./include/aos/internal/log_impl.h"
extern unsigned int aos_log_level;
static inline unsigned int aos_log_get_level(void)
{
return aos_log_level;
}
enum log_level_bit {
AOS_LL_V_NONE_BIT = -1,
AOS_LL_V_FATAL_BIT,
AOS_LL_V_ERROR_BIT,
AOS_LL_V_WARN_BIT,
AOS_LL_V_INFO_BIT,
AOS_LL_V_DEBUG_BIT,
AOS_LL_V_MAX_BIT
};
# 52 "./include/aos/internal/log_impl.h"
extern int csp_printf(const char *fmt, ...);
# 80 "./include/aos/internal/log_impl.h"
int csp_printf(const char *fmt, ...);
# 13 "./include/aos/log.h" 2
typedef enum {
AOS_LL_NONE,
AOS_LL_FATAL,
AOS_LL_ERROR,
AOS_LL_WARN,
AOS_LL_INFO,
AOS_LL_DEBUG,
} aos_log_level_t;
extern unsigned int aos_log_level;
static inline int aos_get_log_level(void)
{
return aos_log_level;
}
void aos_set_log_level(aos_log_level_t log_level);
# 20 "./include/aos/aos.h" 2
# 1 "./include/aos/vfs.h" 1
# 16 "./include/aos/vfs.h"
typedef struct {
int d_ino;
uint8_t d_type;
char d_name[];
} aos_dirent_t;
typedef struct {
int dd_vfs_fd;
int dd_rsv;
} aos_dir_t;
# 35 "./include/aos/vfs.h"
int aos_open(const char *path, int flags);
# 44 "./include/aos/vfs.h"
int aos_close(int fd);
# 55 "./include/aos/vfs.h"
ssize_t aos_read(int fd, void *buf, size_t nbytes);
# 66 "./include/aos/vfs.h"
ssize_t aos_write(int fd, const void *buf, size_t nbytes);
# 77 "./include/aos/vfs.h"
int aos_ioctl(int fd, int cmd, unsigned long arg);
# 89 "./include/aos/vfs.h"
int aos_poll(struct pollfd *fds, int nfds, int timeout);
# 100 "./include/aos/vfs.h"
int aos_fcntl(int fd, int cmd, int val);
# 114 "./include/aos/vfs.h"
off_t aos_lseek(int fd, off_t offset, int whence);
# 123 "./include/aos/vfs.h"
int aos_sync(int fd);
# 133 "./include/aos/vfs.h"
int aos_stat(const char *path, struct stat *st);
# 142 "./include/aos/vfs.h"
int aos_unlink(const char *path);
# 152 "./include/aos/vfs.h"
int aos_rename(const char *oldpath, const char *newpath);
# 161 "./include/aos/vfs.h"
aos_dir_t *aos_opendir(const char *path);
# 170 "./include/aos/vfs.h"
int aos_closedir(aos_dir_t *dir);
# 179 "./include/aos/vfs.h"
aos_dirent_t *aos_readdir(aos_dir_t *dir);
# 188 "./include/aos/vfs.h"
int aos_mkdir(const char *path);
# 21 "./include/aos/aos.h" 2
# 1 "./include/aos/version.h" 1
# 13 "./include/aos/version.h"
const char *aos_get_product_model(void);
const char *aos_get_os_version(void);
const char *aos_get_kernel_version(void);
const char *aos_get_app_version(void);
const char *aos_get_device_name(void);
void dump_sys_info(void);
# 22 "./include/aos/aos.h" 2
# 1 "./include/aos/yloop.h" 1
# 14 "./include/aos/yloop.h"
# 1 "./include/aos/internal/event_type_code.h" 1
# 15 "./include/aos/yloop.h" 2
# 65 "./include/aos/yloop.h"
typedef struct {
uint32_t time;
uint16_t type;
uint16_t code;
unsigned long value;
unsigned long extra;
} input_event_t;
typedef void (*aos_event_cb)(input_event_t *event, void *private_data);
typedef void (*aos_call_t)(void *arg);
typedef void (*aos_poll_call_t)(int fd, void *arg);
# 94 "./include/aos/yloop.h"
int aos_register_event_filter(uint16_t type, aos_event_cb cb, void *priv);
# 105 "./include/aos/yloop.h"
int aos_unregister_event_filter(uint16_t type, aos_event_cb cb, void *priv);
# 116 "./include/aos/yloop.h"
int aos_post_event(uint16_t type, uint16_t code, unsigned long value);
# 127 "./include/aos/yloop.h"
int aos_poll_read_fd(int fd, aos_poll_call_t action, void *param);
# 136 "./include/aos/yloop.h"
void aos_cancel_poll_read_fd(int fd, aos_poll_call_t action, void *param);
# 147 "./include/aos/yloop.h"
int aos_post_delayed_action(int ms, aos_call_t action, void *arg);
# 156 "./include/aos/yloop.h"
void aos_cancel_delayed_action(int ms, aos_call_t action, void *arg);
# 169 "./include/aos/yloop.h"
int aos_schedule_call(aos_call_t action, void *arg);
typedef void *aos_loop_t;
aos_loop_t aos_loop_init(void);
aos_loop_t aos_current_loop(void);
void aos_loop_run(void);
void aos_loop_exit(void);
void aos_loop_destroy(void);
# 211 "./include/aos/yloop.h"
int aos_loop_schedule_call(aos_loop_t *loop, aos_call_t action, void *arg);
# 224 "./include/aos/yloop.h"
void *aos_loop_schedule_work(int ms, aos_call_t action, void *arg1,
aos_call_t fini_cb, void *arg2);
# 234 "./include/aos/yloop.h"
void aos_cancel_work(void *work, aos_call_t action, void *arg1);
# 23 "./include/aos/aos.h" 2
# 1 "./include/aos/errno.h" 1
# 13 "./include/aos/errno.h"
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/errno.h" 1 3
# 5 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/errno.h" 3
typedef int error_t;
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/errno.h" 1 3
# 15 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/sys/errno.h" 3
extern int *__errno (void);
extern const char * const _sys_errlist[];
extern int _sys_nerr;
# 10 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/arm-none-eabi/include/errno.h" 2 3
# 14 "./include/aos/errno.h" 2
# 24 "./include/aos/aos.h" 2
# 1 "./include/aos/init.h" 1
# 1 "/home/stone/Documents/Ali_IOT/build/compiler/gcc-arm-none-eabi/Linux64/lib/gcc/arm-none-eabi/5.4.1/include/stdbool.h" 1 3 4
# 9 "./include/aos/init.h" 2
# 11 "./include/aos/init.h"
typedef struct {
int argc;
char **argv;
# 15 "./include/aos/init.h" 3 4
_Bool
# 15 "./include/aos/init.h"
cli_enable;
} kinit_t;
extern int aos_kernel_init(kinit_t *kinit);
# 25 "./include/aos/aos.h" 2
# 9 "utility/log/log.c" 2
unsigned int aos_log_level = (1 << AOS_LL_V_DEBUG_BIT) | (1 << AOS_LL_V_INFO_BIT) | (1 << AOS_LL_V_WARN_BIT) | (1 << AOS_LL_V_ERROR_BIT) | (1 << AOS_LL_V_FATAL_BIT);
aos_mutex_t log_mutex;
__attribute__((weak)) int csp_printf(const char *fmt, ...)
{
va_list args;
int ret;
ret = aos_mutex_lock(&log_mutex, 0xffffffffu);
if (ret == 0) {
# 21 "utility/log/log.c" 3 4
__builtin_va_start(
# 21 "utility/log/log.c"
args
# 21 "utility/log/log.c" 3 4
,
# 21 "utility/log/log.c"
fmt
# 21 "utility/log/log.c" 3 4
)
# 21 "utility/log/log.c"
;
ret = vprintf(fmt, args);
# 23 "utility/log/log.c" 3 4
__builtin_va_end(
# 23 "utility/log/log.c"
args
# 23 "utility/log/log.c" 3 4
)
# 23 "utility/log/log.c"
;
fflush(
# 25 "utility/log/log.c" 3
(_impure_ptr->_stdout)
# 25 "utility/log/log.c"
);
}
aos_mutex_unlock(&log_mutex);
return ret;
}
void aos_set_log_level(aos_log_level_t log_level)
{
unsigned int value = 0;
switch (log_level) {
case AOS_LL_NONE:
value |= 0;
break;
case AOS_LL_DEBUG:
value |= (1 << AOS_LL_V_DEBUG_BIT);
case AOS_LL_INFO:
value |= (1 << AOS_LL_V_INFO_BIT);
case AOS_LL_WARN:
value |= (1 << AOS_LL_V_WARN_BIT);
case AOS_LL_ERROR:
value |= (1 << AOS_LL_V_ERROR_BIT);
case AOS_LL_FATAL:
value |= (1 << AOS_LL_V_FATAL_BIT);
break;
default:
break;
}
aos_log_level = value;
}
static void log_cmd(char *buf, int len, int argc, char **argv)
{
const char *lvls[] = {
[AOS_LL_FATAL] = "fatal",
[AOS_LL_ERROR] = "error",
[AOS_LL_WARN] = "warn",
[AOS_LL_INFO] = "info",
[AOS_LL_DEBUG] = "debug",
};
if (argc < 2) {
csp_printf("log level : %02x\r\n", aos_get_log_level());
return;
}
int i;
for (i=0;i<sizeof(lvls)/sizeof(lvls[0]);i++) {
if (strncmp(lvls[i], argv[1], strlen(lvls[i])+1) != 0)
continue;
aos_set_log_level((aos_log_level_t)i);
csp_printf("set log level success\r\n");
return;
}
csp_printf("set log level fail\r\n");
}
struct cli_command log_cli_cmd[] = {
{ "loglevel", "set log level", log_cmd }
};
void log_cli_init(void)
{
aos_log_level = (1 << AOS_LL_V_DEBUG_BIT) | (1 << AOS_LL_V_INFO_BIT) | (1 << AOS_LL_V_WARN_BIT) | (1 << AOS_LL_V_ERROR_BIT) | (1 << AOS_LL_V_FATAL_BIT);
aos_cli_register_commands(&log_cli_cmd[0],sizeof(log_cli_cmd) / sizeof(struct cli_command));
aos_mutex_new(&log_mutex);
}
void log_no_cli_init(void)
{
aos_mutex_new(&log_mutex);
}
|
the_stack_data/1046461.c | /* A lexical scanner generated by flex */
/* Scanner skeleton version:
* $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $
*/
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
#include <stdio.h>
/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
#ifdef c_plusplus
#ifndef __cplusplus
#define __cplusplus
#endif
#endif
#ifdef __cplusplus
#include <stdlib.h>
#include <unistd.h>
/* Use prototypes in function declarations. */
#define YY_USE_PROTOS
/* The "const" storage-class-modifier is valid. */
#define YY_USE_CONST
#else /* ! __cplusplus */
#if __STDC__
#define YY_USE_PROTOS
#define YY_USE_CONST
#endif /* __STDC__ */
#endif /* ! __cplusplus */
#ifdef __TURBOC__
#pragma warn -rch
#pragma warn -use
#include <io.h>
#include <stdlib.h>
#define YY_USE_CONST
#define YY_USE_PROTOS
#endif
#ifdef YY_USE_CONST
#define yyconst const
#else
#define yyconst
#endif
#ifdef YY_USE_PROTOS
#define YY_PROTO(proto) proto
#else
#define YY_PROTO(proto) ()
#endif
/* Returned upon end-of-file. */
#define YY_NULL 0
/* Promotes a possibly negative, possibly signed char to an unsigned
* integer for use as an array index. If the signed char is negative,
* we want to instead treat it as an 8-bit unsigned char, hence the
* double cast.
*/
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
/* Enter a start condition. This macro really ought to take a parameter,
* but we do it the disgusting crufty way forced on us by the ()-less
* definition of BEGIN.
*/
#define BEGIN yy_start = 1 + 2 *
/* Translate the current start state into a value that can be later handed
* to BEGIN to return to the state. The YYSTATE alias is for lex
* compatibility.
*/
#define YY_START ((yy_start - 1) / 2)
#define YYSTATE YY_START
/* Action number for EOF rule of a given start state. */
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
/* Special action meaning "start processing a new file". */
#define YY_NEW_FILE yyrestart( yyin )
#define YY_END_OF_BUFFER_CHAR 0
/* Size of default input buffer. */
#define YY_BUF_SIZE 16384
typedef struct yy_buffer_state *YY_BUFFER_STATE;
extern int yyleng;
extern FILE *yyin, *yyout;
#define EOB_ACT_CONTINUE_SCAN 0
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2
/* The funky do-while in the following #define is used to turn the definition
* int a single C statement (which needs a semi-colon terminator). This
* avoids problems with code like:
*
* if ( condition_holds )
* yyless( 5 );
* else
* do_something_else();
*
* Prior to using the do-while the compiler would get upset at the
* "else" because it interpreted the "if" statement as being all
* done when it reached the ';' after the yyless() call.
*/
/* Return all but the first 'n' matched characters back to the input stream. */
#define yyless(n) \
do \
{ \
/* Undo effects of setting up yytext. */ \
*yy_cp = yy_hold_char; \
YY_RESTORE_YY_MORE_OFFSET \
yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
YY_DO_BEFORE_ACTION; /* set up yytext again */ \
} \
while ( 0 )
#define unput(c) yyunput( c, yytext_ptr )
/* The following is because we cannot portably get our hands on size_t
* (without autoconf's help, which isn't available because we want
* flex-generated scanners to compile on their own).
*/
typedef unsigned int yy_size_t;
struct yy_buffer_state
{
FILE *yy_input_file;
char *yy_ch_buf; /* input buffer */
char *yy_buf_pos; /* current position in input buffer */
/* Size of input buffer in bytes, not including room for EOB
* characters.
*/
yy_size_t yy_buf_size;
/* Number of characters read into yy_ch_buf, not including EOB
* characters.
*/
int yy_n_chars;
/* Whether we "own" the buffer - i.e., we know we created it,
* and can realloc() it to grow it, and should free() it to
* delete it.
*/
int yy_is_our_buffer;
/* Whether this is an "interactive" input source; if so, and
* if we're using stdio for input, then we want to use getc()
* instead of fread(), to make sure we stop fetching input after
* each newline.
*/
int yy_is_interactive;
/* Whether we're considered to be at the beginning of a line.
* If so, '^' rules will be active on the next match, otherwise
* not.
*/
int yy_at_bol;
/* Whether to try to fill the input buffer when we reach the
* end of it.
*/
int yy_fill_buffer;
int yy_buffer_status;
#define YY_BUFFER_NEW 0
#define YY_BUFFER_NORMAL 1
/* When an EOF's been seen but there's still some text to process
* then we mark the buffer as YY_EOF_PENDING, to indicate that we
* shouldn't try reading from the input source any more. We might
* still have a bunch of tokens to match, though, because of
* possible backing-up.
*
* When we actually see the EOF, we change the status to "new"
* (via yyrestart()), so that the user can continue scanning by
* just pointing yyin at a new input file.
*/
#define YY_BUFFER_EOF_PENDING 2
};
static YY_BUFFER_STATE yy_current_buffer = 0;
/* We provide macros for accessing buffer states in case in the
* future we want to put the buffer states in a more general
* "scanner state".
*/
#define YY_CURRENT_BUFFER yy_current_buffer
/* yy_hold_char holds the character lost when yytext is formed. */
static char yy_hold_char;
static int yy_n_chars; /* number of characters read into yy_ch_buf */
int yyleng;
/* Points to current character in buffer. */
static char *yy_c_buf_p = (char *) 0;
static int yy_init = 1; /* whether we need to initialize */
static int yy_start = 0; /* start state number */
/* Flag which is used to allow yywrap()'s to do buffer switches
* instead of setting up a fresh yyin. A bit of a hack ...
*/
static int yy_did_buffer_switch_on_eof;
void yyrestart YY_PROTO(( FILE *input_file ));
void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
void yy_load_buffer_state YY_PROTO(( void ));
YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
static void yy_flex_free YY_PROTO(( void * ));
#define yy_new_buffer yy_create_buffer
#define yy_set_interactive(is_interactive) \
{ \
if ( ! yy_current_buffer ) \
yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
yy_current_buffer->yy_is_interactive = is_interactive; \
}
#define yy_set_bol(at_bol) \
{ \
if ( ! yy_current_buffer ) \
yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
yy_current_buffer->yy_at_bol = at_bol; \
}
#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
typedef unsigned char YY_CHAR;
FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
typedef int yy_state_type;
extern char *yytext;
#define yytext_ptr yytext
static yy_state_type yy_get_previous_state YY_PROTO(( void ));
static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
static int yy_get_next_buffer YY_PROTO(( void ));
static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
/* Done after the current pattern has been matched and before the
* corresponding action - sets up yytext.
*/
#define YY_DO_BEFORE_ACTION \
yytext_ptr = yy_bp; \
yyleng = (int) (yy_cp - yy_bp); \
yy_hold_char = *yy_cp; \
*yy_cp = '\0'; \
yy_c_buf_p = yy_cp;
#define YY_NUM_RULES 5
#define YY_END_OF_BUFFER 6
static yyconst short int yy_accept[14] =
{ 0,
0, 0, 6, 3, 4, 5, 2, 1, 3, 2,
3, 1, 0
} ;
static yyconst int yy_ec[256] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 1, 1, 1,
1, 1, 1, 1, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
1, 1, 1, 1, 1, 1, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1
} ;
static yyconst int yy_meta[6] =
{ 0,
1, 2, 2, 2, 2
} ;
static yyconst short int yy_base[15] =
{ 0,
0, 0, 12, 0, 13, 13, 2, 4, 0, 0,
7, 0, 13, 9
} ;
static yyconst short int yy_def[15] =
{ 0,
13, 1, 13, 14, 13, 13, 13, 13, 14, 7,
7, 8, 0, 13
} ;
static yyconst short int yy_nxt[19] =
{ 0,
4, 5, 6, 7, 8, 10, 11, 11, 12, 9,
11, 13, 3, 13, 13, 13, 13, 13
} ;
static yyconst short int yy_chk[19] =
{ 0,
1, 1, 1, 1, 1, 7, 7, 8, 8, 14,
11, 3, 13, 13, 13, 13, 13, 13
} ;
static yy_state_type yy_last_accepting_state;
static char *yy_last_accepting_cpos;
/* The intent behind this definition is that it'll catch
* any uses of REJECT which flex missed.
*/
#define REJECT reject_used_but_not_detected
#define yymore() yymore_used_but_not_detected
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
char *yytext;
#line 1 "lex3.l"
#define INITIAL 0
#line 2 "lex3.l"
#include<stdio.h>
#line 372 "lex.yy.c"
/* Macros after this point can all be overridden by user definitions in
* section 1.
*/
#ifndef YY_SKIP_YYWRAP
#ifdef __cplusplus
extern "C" int yywrap YY_PROTO(( void ));
#else
extern int yywrap YY_PROTO(( void ));
#endif
#endif
#ifndef YY_NO_UNPUT
static void yyunput YY_PROTO(( int c, char *buf_ptr ));
#endif
#ifndef yytext_ptr
static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
#endif
#ifdef YY_NEED_STRLEN
static int yy_flex_strlen YY_PROTO(( yyconst char * ));
#endif
#ifndef YY_NO_INPUT
#ifdef __cplusplus
static int yyinput YY_PROTO(( void ));
#else
static int input YY_PROTO(( void ));
#endif
#endif
#if YY_STACK_USED
static int yy_start_stack_ptr = 0;
static int yy_start_stack_depth = 0;
static int *yy_start_stack = 0;
#ifndef YY_NO_PUSH_STATE
static void yy_push_state YY_PROTO(( int new_state ));
#endif
#ifndef YY_NO_POP_STATE
static void yy_pop_state YY_PROTO(( void ));
#endif
#ifndef YY_NO_TOP_STATE
static int yy_top_state YY_PROTO(( void ));
#endif
#else
#define YY_NO_PUSH_STATE 1
#define YY_NO_POP_STATE 1
#define YY_NO_TOP_STATE 1
#endif
#ifdef YY_MALLOC_DECL
YY_MALLOC_DECL
#else
#if __STDC__
#ifndef __cplusplus
#include <stdlib.h>
#endif
#else
/* Just try to get by without declaring the routines. This will fail
* miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
* or sizeof(void*) != sizeof(int).
*/
#endif
#endif
/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
#define YY_READ_BUF_SIZE 8192
#endif
/* Copy whatever the last rule matched to the standard output. */
#ifndef ECHO
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
* is returned in "result".
*/
#ifndef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
if ( yy_current_buffer->yy_is_interactive ) \
{ \
int c = '*', n; \
for ( n = 0; n < max_size && \
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
if ( c == '\n' ) \
buf[n++] = (char) c; \
if ( c == EOF && ferror( yyin ) ) \
YY_FATAL_ERROR( "input in flex scanner failed" ); \
result = n; \
} \
else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
&& ferror( yyin ) ) \
YY_FATAL_ERROR( "input in flex scanner failed" );
#endif
/* No semi-colon after return; correct usage is to write "yyterminate();" -
* we don't want an extra ';' after the "return" because that will cause
* some compilers to complain about unreachable statements.
*/
#ifndef yyterminate
#define yyterminate() return YY_NULL
#endif
/* Number of entries by which start-condition stack grows. */
#ifndef YY_START_STACK_INCR
#define YY_START_STACK_INCR 25
#endif
/* Report a fatal error. */
#ifndef YY_FATAL_ERROR
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
#endif
/* Default declaration of generated scanner - a define so the user can
* easily add parameters.
*/
#ifndef YY_DECL
#define YY_DECL int yylex YY_PROTO(( void ))
#endif
/* Code executed at the beginning of each rule, after yytext and yyleng
* have been set up.
*/
#ifndef YY_USER_ACTION
#define YY_USER_ACTION
#endif
/* Code executed at the end of each rule. */
#ifndef YY_BREAK
#define YY_BREAK break;
#endif
#define YY_RULE_SETUP \
YY_USER_ACTION
YY_DECL
{
register yy_state_type yy_current_state;
register char *yy_cp, *yy_bp;
register int yy_act;
#line 7 "lex3.l"
#line 526 "lex.yy.c"
if ( yy_init )
{
yy_init = 0;
#ifdef YY_USER_INIT
YY_USER_INIT;
#endif
if ( ! yy_start )
yy_start = 1; /* first start state */
if ( ! yyin )
yyin = stdin;
if ( ! yyout )
yyout = stdout;
if ( ! yy_current_buffer )
yy_current_buffer =
yy_create_buffer( yyin, YY_BUF_SIZE );
yy_load_buffer_state();
}
while ( 1 ) /* loops until end-of-file is reached */
{
yy_cp = yy_c_buf_p;
/* Support of yytext. */
*yy_cp = yy_hold_char;
/* yy_bp points to the position in yy_ch_buf of the start of
* the current run.
*/
yy_bp = yy_cp;
yy_current_state = yy_start;
yy_match:
do
{
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
if ( yy_accept[yy_current_state] )
{
yy_last_accepting_state = yy_current_state;
yy_last_accepting_cpos = yy_cp;
}
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 14 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
while ( yy_base[yy_current_state] != 13 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
if ( yy_act == 0 )
{ /* have to back up */
yy_cp = yy_last_accepting_cpos;
yy_current_state = yy_last_accepting_state;
yy_act = yy_accept[yy_current_state];
}
YY_DO_BEFORE_ACTION;
do_action: /* This label is used only to access EOF actions. */
switch ( yy_act )
{ /* beginning of action switch */
case 0: /* must back up */
/* undo the effects of YY_DO_BEFORE_ACTION */
*yy_cp = yy_hold_char;
yy_cp = yy_last_accepting_cpos;
yy_current_state = yy_last_accepting_state;
goto yy_find_action;
case 1:
YY_RULE_SETUP
#line 9 "lex3.l"
{printf("Word : %s\n",yytext);}
YY_BREAK
case 2:
YY_RULE_SETUP
#line 11 "lex3.l"
{printf("Number : %s\n",yytext);}
YY_BREAK
case 3:
YY_RULE_SETUP
#line 13 "lex3.l"
{printf("Others : %s\n",yytext);}
YY_BREAK
case 4:
YY_RULE_SETUP
#line 15 "lex3.l"
;
YY_BREAK
case 5:
YY_RULE_SETUP
#line 17 "lex3.l"
ECHO;
YY_BREAK
#line 634 "lex.yy.c"
case YY_STATE_EOF(INITIAL):
yyterminate();
case YY_END_OF_BUFFER:
{
/* Amount of text matched not including the EOB char. */
int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
/* Undo the effects of YY_DO_BEFORE_ACTION. */
*yy_cp = yy_hold_char;
YY_RESTORE_YY_MORE_OFFSET
if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
{
/* We're scanning a new file or input source. It's
* possible that this happened because the user
* just pointed yyin at a new source and called
* yylex(). If so, then we have to assure
* consistency between yy_current_buffer and our
* globals. Here is the right place to do so, because
* this is the first action (other than possibly a
* back-up) that will match for the new input source.
*/
yy_n_chars = yy_current_buffer->yy_n_chars;
yy_current_buffer->yy_input_file = yyin;
yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
}
/* Note that here we test for yy_c_buf_p "<=" to the position
* of the first EOB in the buffer, since yy_c_buf_p will
* already have been incremented past the NUL character
* (since all states make transitions on EOB to the
* end-of-buffer state). Contrast this with the test
* in input().
*/
if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
{ /* This was really a NUL. */
yy_state_type yy_next_state;
yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
yy_current_state = yy_get_previous_state();
/* Okay, we're now positioned to make the NUL
* transition. We couldn't have
* yy_get_previous_state() go ahead and do it
* for us because it doesn't know how to deal
* with the possibility of jamming (and we don't
* want to build jamming into it because then it
* will run more slowly).
*/
yy_next_state = yy_try_NUL_trans( yy_current_state );
yy_bp = yytext_ptr + YY_MORE_ADJ;
if ( yy_next_state )
{
/* Consume the NUL. */
yy_cp = ++yy_c_buf_p;
yy_current_state = yy_next_state;
goto yy_match;
}
else
{
yy_cp = yy_c_buf_p;
goto yy_find_action;
}
}
else switch ( yy_get_next_buffer() )
{
case EOB_ACT_END_OF_FILE:
{
yy_did_buffer_switch_on_eof = 0;
if ( yywrap() )
{
/* Note: because we've taken care in
* yy_get_next_buffer() to have set up
* yytext, we can now set up
* yy_c_buf_p so that if some total
* hoser (like flex itself) wants to
* call the scanner after we return the
* YY_NULL, it'll still work - another
* YY_NULL will get returned.
*/
yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
yy_act = YY_STATE_EOF(YY_START);
goto do_action;
}
else
{
if ( ! yy_did_buffer_switch_on_eof )
YY_NEW_FILE;
}
break;
}
case EOB_ACT_CONTINUE_SCAN:
yy_c_buf_p =
yytext_ptr + yy_amount_of_matched_text;
yy_current_state = yy_get_previous_state();
yy_cp = yy_c_buf_p;
yy_bp = yytext_ptr + YY_MORE_ADJ;
goto yy_match;
case EOB_ACT_LAST_MATCH:
yy_c_buf_p =
&yy_current_buffer->yy_ch_buf[yy_n_chars];
yy_current_state = yy_get_previous_state();
yy_cp = yy_c_buf_p;
yy_bp = yytext_ptr + YY_MORE_ADJ;
goto yy_find_action;
}
break;
}
default:
YY_FATAL_ERROR(
"fatal flex scanner internal error--no action found" );
} /* end of action switch */
} /* end of scanning one token */
} /* end of yylex */
/* yy_get_next_buffer - try to read in a new buffer
*
* Returns a code representing an action:
* EOB_ACT_LAST_MATCH -
* EOB_ACT_CONTINUE_SCAN - continue scanning from current position
* EOB_ACT_END_OF_FILE - end of file
*/
static int yy_get_next_buffer()
{
register char *dest = yy_current_buffer->yy_ch_buf;
register char *source = yytext_ptr;
register int number_to_move, i;
int ret_val;
if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
YY_FATAL_ERROR(
"fatal flex scanner internal error--end of buffer missed" );
if ( yy_current_buffer->yy_fill_buffer == 0 )
{ /* Don't try to fill the buffer, so this is an EOF. */
if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
{
/* We matched a single character, the EOB, so
* treat this as a final EOF.
*/
return EOB_ACT_END_OF_FILE;
}
else
{
/* We matched some text prior to the EOB, first
* process it.
*/
return EOB_ACT_LAST_MATCH;
}
}
/* Try to read more data. */
/* First move last chars to start of buffer. */
number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
for ( i = 0; i < number_to_move; ++i )
*(dest++) = *(source++);
if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
/* don't do the read, it's not guaranteed to return an EOF,
* just force an EOF
*/
yy_current_buffer->yy_n_chars = yy_n_chars = 0;
else
{
int num_to_read =
yy_current_buffer->yy_buf_size - number_to_move - 1;
while ( num_to_read <= 0 )
{ /* Not enough room in the buffer - grow it. */
#ifdef YY_USES_REJECT
YY_FATAL_ERROR(
"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
#else
/* just a shorter name for the current buffer */
YY_BUFFER_STATE b = yy_current_buffer;
int yy_c_buf_p_offset =
(int) (yy_c_buf_p - b->yy_ch_buf);
if ( b->yy_is_our_buffer )
{
int new_size = b->yy_buf_size * 2;
if ( new_size <= 0 )
b->yy_buf_size += b->yy_buf_size / 8;
else
b->yy_buf_size *= 2;
b->yy_ch_buf = (char *)
/* Include room in for 2 EOB chars. */
yy_flex_realloc( (void *) b->yy_ch_buf,
b->yy_buf_size + 2 );
}
else
/* Can't grow it, we don't own it. */
b->yy_ch_buf = 0;
if ( ! b->yy_ch_buf )
YY_FATAL_ERROR(
"fatal error - scanner input buffer overflow" );
yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
num_to_read = yy_current_buffer->yy_buf_size -
number_to_move - 1;
#endif
}
if ( num_to_read > YY_READ_BUF_SIZE )
num_to_read = YY_READ_BUF_SIZE;
/* Read in more data. */
YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
yy_n_chars, num_to_read );
yy_current_buffer->yy_n_chars = yy_n_chars;
}
if ( yy_n_chars == 0 )
{
if ( number_to_move == YY_MORE_ADJ )
{
ret_val = EOB_ACT_END_OF_FILE;
yyrestart( yyin );
}
else
{
ret_val = EOB_ACT_LAST_MATCH;
yy_current_buffer->yy_buffer_status =
YY_BUFFER_EOF_PENDING;
}
}
else
ret_val = EOB_ACT_CONTINUE_SCAN;
yy_n_chars += number_to_move;
yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
return ret_val;
}
/* yy_get_previous_state - get the state just before the EOB char was reached */
static yy_state_type yy_get_previous_state()
{
register yy_state_type yy_current_state;
register char *yy_cp;
yy_current_state = yy_start;
for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
{
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
if ( yy_accept[yy_current_state] )
{
yy_last_accepting_state = yy_current_state;
yy_last_accepting_cpos = yy_cp;
}
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 14 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
}
return yy_current_state;
}
/* yy_try_NUL_trans - try to make a transition on the NUL character
*
* synopsis
* next_state = yy_try_NUL_trans( current_state );
*/
#ifdef YY_USE_PROTOS
static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
#else
static yy_state_type yy_try_NUL_trans( yy_current_state )
yy_state_type yy_current_state;
#endif
{
register int yy_is_jam;
register char *yy_cp = yy_c_buf_p;
register YY_CHAR yy_c = 1;
if ( yy_accept[yy_current_state] )
{
yy_last_accepting_state = yy_current_state;
yy_last_accepting_cpos = yy_cp;
}
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 14 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
yy_is_jam = (yy_current_state == 13);
return yy_is_jam ? 0 : yy_current_state;
}
#ifndef YY_NO_UNPUT
#ifdef YY_USE_PROTOS
static void yyunput( int c, register char *yy_bp )
#else
static void yyunput( c, yy_bp )
int c;
register char *yy_bp;
#endif
{
register char *yy_cp = yy_c_buf_p;
/* undo effects of setting up yytext */
*yy_cp = yy_hold_char;
if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
{ /* need to shift things up to make room */
/* +2 for EOB chars. */
register int number_to_move = yy_n_chars + 2;
register char *dest = &yy_current_buffer->yy_ch_buf[
yy_current_buffer->yy_buf_size + 2];
register char *source =
&yy_current_buffer->yy_ch_buf[number_to_move];
while ( source > yy_current_buffer->yy_ch_buf )
*--dest = *--source;
yy_cp += (int) (dest - source);
yy_bp += (int) (dest - source);
yy_current_buffer->yy_n_chars =
yy_n_chars = yy_current_buffer->yy_buf_size;
if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
YY_FATAL_ERROR( "flex scanner push-back overflow" );
}
*--yy_cp = (char) c;
yytext_ptr = yy_bp;
yy_hold_char = *yy_cp;
yy_c_buf_p = yy_cp;
}
#endif /* ifndef YY_NO_UNPUT */
#ifdef __cplusplus
static int yyinput()
#else
static int input()
#endif
{
int c;
*yy_c_buf_p = yy_hold_char;
if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
{
/* yy_c_buf_p now points to the character we want to return.
* If this occurs *before* the EOB characters, then it's a
* valid NUL; if not, then we've hit the end of the buffer.
*/
if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
/* This was really a NUL. */
*yy_c_buf_p = '\0';
else
{ /* need more input */
int offset = yy_c_buf_p - yytext_ptr;
++yy_c_buf_p;
switch ( yy_get_next_buffer() )
{
case EOB_ACT_LAST_MATCH:
/* This happens because yy_g_n_b()
* sees that we've accumulated a
* token and flags that we need to
* try matching the token before
* proceeding. But for input(),
* there's no matching to consider.
* So convert the EOB_ACT_LAST_MATCH
* to EOB_ACT_END_OF_FILE.
*/
/* Reset buffer status. */
yyrestart( yyin );
/* fall through */
case EOB_ACT_END_OF_FILE:
{
if ( yywrap() )
return EOF;
if ( ! yy_did_buffer_switch_on_eof )
YY_NEW_FILE;
#ifdef __cplusplus
return yyinput();
#else
return input();
#endif
}
case EOB_ACT_CONTINUE_SCAN:
yy_c_buf_p = yytext_ptr + offset;
break;
}
}
}
c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
*yy_c_buf_p = '\0'; /* preserve yytext */
yy_hold_char = *++yy_c_buf_p;
return c;
}
#ifdef YY_USE_PROTOS
void yyrestart( FILE *input_file )
#else
void yyrestart( input_file )
FILE *input_file;
#endif
{
if ( ! yy_current_buffer )
yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
yy_init_buffer( yy_current_buffer, input_file );
yy_load_buffer_state();
}
#ifdef YY_USE_PROTOS
void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
#else
void yy_switch_to_buffer( new_buffer )
YY_BUFFER_STATE new_buffer;
#endif
{
if ( yy_current_buffer == new_buffer )
return;
if ( yy_current_buffer )
{
/* Flush out information for old buffer. */
*yy_c_buf_p = yy_hold_char;
yy_current_buffer->yy_buf_pos = yy_c_buf_p;
yy_current_buffer->yy_n_chars = yy_n_chars;
}
yy_current_buffer = new_buffer;
yy_load_buffer_state();
/* We don't actually know whether we did this switch during
* EOF (yywrap()) processing, but the only time this flag
* is looked at is after yywrap() is called, so it's safe
* to go ahead and always set it.
*/
yy_did_buffer_switch_on_eof = 1;
}
#ifdef YY_USE_PROTOS
void yy_load_buffer_state( void )
#else
void yy_load_buffer_state()
#endif
{
yy_n_chars = yy_current_buffer->yy_n_chars;
yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
yyin = yy_current_buffer->yy_input_file;
yy_hold_char = *yy_c_buf_p;
}
#ifdef YY_USE_PROTOS
YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
#else
YY_BUFFER_STATE yy_create_buffer( file, size )
FILE *file;
int size;
#endif
{
YY_BUFFER_STATE b;
b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
b->yy_buf_size = size;
/* yy_ch_buf has to be 2 characters longer than the size given because
* we need to put in 2 end-of-buffer characters.
*/
b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
if ( ! b->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
b->yy_is_our_buffer = 1;
yy_init_buffer( b, file );
return b;
}
#ifdef YY_USE_PROTOS
void yy_delete_buffer( YY_BUFFER_STATE b )
#else
void yy_delete_buffer( b )
YY_BUFFER_STATE b;
#endif
{
if ( ! b )
return;
if ( b == yy_current_buffer )
yy_current_buffer = (YY_BUFFER_STATE) 0;
if ( b->yy_is_our_buffer )
yy_flex_free( (void *) b->yy_ch_buf );
yy_flex_free( (void *) b );
}
#ifndef YY_ALWAYS_INTERACTIVE
#ifndef YY_NEVER_INTERACTIVE
extern int isatty YY_PROTO(( int ));
#endif
#endif
#ifdef YY_USE_PROTOS
void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
#else
void yy_init_buffer( b, file )
YY_BUFFER_STATE b;
FILE *file;
#endif
{
yy_flush_buffer( b );
b->yy_input_file = file;
b->yy_fill_buffer = 1;
#if YY_ALWAYS_INTERACTIVE
b->yy_is_interactive = 1;
#else
#if YY_NEVER_INTERACTIVE
b->yy_is_interactive = 0;
#else
b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
#endif
#endif
}
#ifdef YY_USE_PROTOS
void yy_flush_buffer( YY_BUFFER_STATE b )
#else
void yy_flush_buffer( b )
YY_BUFFER_STATE b;
#endif
{
if ( ! b )
return;
b->yy_n_chars = 0;
/* We always need two end-of-buffer characters. The first causes
* a transition to the end-of-buffer state. The second causes
* a jam in that state.
*/
b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
b->yy_buf_pos = &b->yy_ch_buf[0];
b->yy_at_bol = 1;
b->yy_buffer_status = YY_BUFFER_NEW;
if ( b == yy_current_buffer )
yy_load_buffer_state();
}
#ifndef YY_NO_SCAN_BUFFER
#ifdef YY_USE_PROTOS
YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
#else
YY_BUFFER_STATE yy_scan_buffer( base, size )
char *base;
yy_size_t size;
#endif
{
YY_BUFFER_STATE b;
if ( size < 2 ||
base[size-2] != YY_END_OF_BUFFER_CHAR ||
base[size-1] != YY_END_OF_BUFFER_CHAR )
/* They forgot to leave room for the EOB's. */
return 0;
b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
b->yy_buf_pos = b->yy_ch_buf = base;
b->yy_is_our_buffer = 0;
b->yy_input_file = 0;
b->yy_n_chars = b->yy_buf_size;
b->yy_is_interactive = 0;
b->yy_at_bol = 1;
b->yy_fill_buffer = 0;
b->yy_buffer_status = YY_BUFFER_NEW;
yy_switch_to_buffer( b );
return b;
}
#endif
#ifndef YY_NO_SCAN_STRING
#ifdef YY_USE_PROTOS
YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
#else
YY_BUFFER_STATE yy_scan_string( yy_str )
yyconst char *yy_str;
#endif
{
int len;
for ( len = 0; yy_str[len]; ++len )
;
return yy_scan_bytes( yy_str, len );
}
#endif
#ifndef YY_NO_SCAN_BYTES
#ifdef YY_USE_PROTOS
YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
#else
YY_BUFFER_STATE yy_scan_bytes( bytes, len )
yyconst char *bytes;
int len;
#endif
{
YY_BUFFER_STATE b;
char *buf;
yy_size_t n;
int i;
/* Get memory for full buffer, including space for trailing EOB's. */
n = len + 2;
buf = (char *) yy_flex_alloc( n );
if ( ! buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
for ( i = 0; i < len; ++i )
buf[i] = bytes[i];
buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
b = yy_scan_buffer( buf, n );
if ( ! b )
YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
/* It's okay to grow etc. this buffer, and we should throw it
* away when we're done.
*/
b->yy_is_our_buffer = 1;
return b;
}
#endif
#ifndef YY_NO_PUSH_STATE
#ifdef YY_USE_PROTOS
static void yy_push_state( int new_state )
#else
static void yy_push_state( new_state )
int new_state;
#endif
{
if ( yy_start_stack_ptr >= yy_start_stack_depth )
{
yy_size_t new_size;
yy_start_stack_depth += YY_START_STACK_INCR;
new_size = yy_start_stack_depth * sizeof( int );
if ( ! yy_start_stack )
yy_start_stack = (int *) yy_flex_alloc( new_size );
else
yy_start_stack = (int *) yy_flex_realloc(
(void *) yy_start_stack, new_size );
if ( ! yy_start_stack )
YY_FATAL_ERROR(
"out of memory expanding start-condition stack" );
}
yy_start_stack[yy_start_stack_ptr++] = YY_START;
BEGIN(new_state);
}
#endif
#ifndef YY_NO_POP_STATE
static void yy_pop_state()
{
if ( --yy_start_stack_ptr < 0 )
YY_FATAL_ERROR( "start-condition stack underflow" );
BEGIN(yy_start_stack[yy_start_stack_ptr]);
}
#endif
#ifndef YY_NO_TOP_STATE
static int yy_top_state()
{
return yy_start_stack[yy_start_stack_ptr - 1];
}
#endif
#ifndef YY_EXIT_FAILURE
#define YY_EXIT_FAILURE 2
#endif
#ifdef YY_USE_PROTOS
static void yy_fatal_error( yyconst char msg[] )
#else
static void yy_fatal_error( msg )
char msg[];
#endif
{
(void) fprintf( stderr, "%s\n", msg );
exit( YY_EXIT_FAILURE );
}
/* Redefine yyless() so it works in section 3 code. */
#undef yyless
#define yyless(n) \
do \
{ \
/* Undo effects of setting up yytext. */ \
yytext[yyleng] = yy_hold_char; \
yy_c_buf_p = yytext + n; \
yy_hold_char = *yy_c_buf_p; \
*yy_c_buf_p = '\0'; \
yyleng = n; \
} \
while ( 0 )
/* Internal utility routines. */
#ifndef yytext_ptr
#ifdef YY_USE_PROTOS
static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
#else
static void yy_flex_strncpy( s1, s2, n )
char *s1;
yyconst char *s2;
int n;
#endif
{
register int i;
for ( i = 0; i < n; ++i )
s1[i] = s2[i];
}
#endif
#ifdef YY_NEED_STRLEN
#ifdef YY_USE_PROTOS
static int yy_flex_strlen( yyconst char *s )
#else
static int yy_flex_strlen( s )
yyconst char *s;
#endif
{
register int n;
for ( n = 0; s[n]; ++n )
;
return n;
}
#endif
#ifdef YY_USE_PROTOS
static void *yy_flex_alloc( yy_size_t size )
#else
static void *yy_flex_alloc( size )
yy_size_t size;
#endif
{
return (void *) malloc( size );
}
#ifdef YY_USE_PROTOS
static void *yy_flex_realloc( void *ptr, yy_size_t size )
#else
static void *yy_flex_realloc( ptr, size )
void *ptr;
yy_size_t size;
#endif
{
/* The cast to (char *) in the following accommodates both
* implementations that use char* generic pointers, and those
* that use void* generic pointers. It works with the latter
* because both ANSI C and C++ allow castless assignment from
* any pointer type to void*, and deal with argument conversions
* as though doing an assignment.
*/
return (void *) realloc( (char *) ptr, size );
}
#ifdef YY_USE_PROTOS
static void yy_flex_free( void *ptr )
#else
static void yy_flex_free( ptr )
void *ptr;
#endif
{
free( ptr );
}
#if YY_MAIN
int main()
{
yylex();
return 0;
}
#endif
#line 17 "lex3.l"
int main(void)
{
yylex();
printf("\n");
return 0;
}
int yywrap()
{return(1);} |
the_stack_data/357159.c | #include <stdio.h>
#include <stdlib.h>
typedef char ElemType;
typedef struct BiTNode
{
ElemType data;
struct BiTNode *lchild, *rchild;
} BiTNode, *BiTree;
//创建一棵二叉树,约定用户遵循前序遍历的方式输入数据
void BuildBiTree(BiTree *T)
{
char c;
scanf("%c", &c);
if (c == ' ') {
*T = NULL;
} else {
*T = (BiTNode *)malloc(sizeof(BiTNode));
(*T)->data = c;
BuildBiTree(&(*T)->lchild);
BuildBiTree(&(*T)->rchild);
}
}
//访问二叉树结点的具体操作
void visit(ElemType c, int level)
{
printf("%c 位于第 %d 层\n", c, level);
}
//前序遍历
void PreOrderTraverse(BiTree T, int level)
{
if (T) {
visit(T->data, level);
PreOrderTraverse(T->lchild, level + 1);
PreOrderTraverse(T->rchild, level + 1);
}
}
int main(int argc, char const *argv[])
{
int level = 1;
BiTree T = NULL;
BuildBiTree(&T);
PreOrderTraverse(T, level);
return 0;
}
|
the_stack_data/458652.c | struct EFI_SYSTEM_TABLE {
char _buf[60];
struct EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL {
unsigned long long _buf;
unsigned long long (*OutputString)(
struct EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
short unsigned int *String);
unsigned long long _buf2[4];
unsigned long long (*ClearScreen)(
struct EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This);
} * ConOut;
};
void efi_main(void *ImageHandle, struct EFI_SYSTEM_TABLE *SystemTable) {
SystemTable->ConOut->ClearScreen(SystemTable->ConOut);
SystemTable->ConOut->OutputString(SystemTable->ConOut,
L"Hello, UEFI! This is hikalium!!!");
while (1)
;
}
|
the_stack_data/7949501.c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* rush02.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: oseitama <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/05/30 08:39:47 by oseitama #+# #+# */
/* Updated: 2021/05/30 09:06:18 by oseitama ### ########.fr */
/* */
/* ************************************************************************** */
void ft_putchar(char c);
void ft_print_middle_rows(int x, int width)
{
if (width == 0 || width == x - 1)
{
ft_putchar('B');
}
else
{
ft_putchar(' ');
}
}
void ft_print_length(int x, int width, int y, int length)
{
if (length == 0 || length == y - 1)
{
if (width == 0 || width == x - 1)
{
if (length == 0)
{
ft_putchar('A');
}
else
{
ft_putchar('C');
}
}
else
{
ft_putchar('B');
}
}
else
{
ft_print_middle_rows(x, width);
}
}
void rush(int x, int y)
{
int width;
int length;
length = 0;
if ((x > 0) && (y > 0))
{
while (length < y)
{
width = 0;
while (width < x)
{
ft_print_length(x, width, y, length);
width++;
}
ft_putchar('\n');
length++;
}
}
}
|
the_stack_data/51836.c | //Day17b.c
//
//Question 2: What is the length of the longest path to the bottom-right room?
//
//We have to assume here that an infinite path is impossible -- that all paths
//eventually either reach the bottom-right room or hit a closed room. Since our
//paths can definitely be longer than 64 steps, we need to modify our MD5
//implementation to handle multiple data blocks.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <stdbool.h>
#include <stdint.h>
#include <limits.h>
//The path nodes and queue structures don't change
typedef struct sPathNode
{
char stepTaken;
int x, y, depth;
struct sPathNode *parent;
} sPathNode;
typedef struct sQueueNode
{
sPathNode *node;
struct sQueueNode *next;
} sQueueNode;
typedef struct
{
unsigned long numElements;
sQueueNode *first, *last;
} sQueue;
//We need more memory for the MD5 input string, but everything else is the same.
//Technically we should resize the string at run time, but let's keep this part
//simple.
#define NONE_OPEN 0x0
#define UP_OPEN (1 << 0)
#define DOWN_OPEN (1 << 1)
#define LEFT_OPEN (1 << 2)
#define RIGHT_OPEN (1 << 3)
#define MD5SIZE 16
#define MAX_PATH_LEN 4096
#define MIN_X 1
#define MIN_Y 1
#define MAX_X 4
#define MAX_Y 4
void Copy_Path_Chars(char *dest, const sPathNode *leaf);
unsigned short Get_Door_States(const char *inputPath);
sPathNode *Create_Child_Node(sPathNode *parent);
void Init_Queue(sQueue *queue);
void Enqueue(sQueue *queue, sPathNode *foundNode);
sQueueNode Dequeue(sQueue *queue);
void Delete_Queue(sQueue *queue);
void MD5(const char *input, uint8_t *output);
void Print_MD5_Hash(uint_least8_t *hash);
int main(int argc, char **argv)
{
//Now we need to save the longest path
sQueue queue;
sPathNode *next, *new;
sPathNode start;
char *inputPath;
int inputLen, longestPath;
unsigned short doorState;
//The usual command line argument processing
if (argc != 2)
{
fprintf(stderr, "Usage:\n\tDay17 <input data>\n");
return EXIT_FAILURE;
}
inputLen = strlen(argv[1]);
//Allocate memory for the MD5 input string and copy the input into it
inputPath = malloc(inputLen + MAX_PATH_LEN + 1);
if (inputPath == NULL)
{
fprintf(stderr, "Error allocating memory: %s\n", strerror(errno));
return EXIT_FAILURE;
}
strcpy(inputPath, argv[1]);
//The starting node is still the same
start.stepTaken = '\0';
start.x = MIN_X;
start.y = MIN_Y;
start.depth = 0;
start.parent = NULL;
//Create a queue
Init_Queue(&queue);
//Now we continue building the tree until it's complete. This is indicated
//by a queue underrun. (Dequeue() now returns null for an underrun.)
next = &start;
longestPath = 0;
while (next != NULL)
{
//If we've reached the bottom-right, we don't need to continue the path.
//All we have to do is check whether this is a new longest path.
if (next->x == MAX_X && next->y == MAX_Y)
{
if (next->depth > longestPath)
longestPath = next->depth;
next = Dequeue(&queue).node;
continue;
}
//No change to the door state or child node creation
Copy_Path_Chars(inputPath + inputLen, next);
doorState = Get_Door_States(inputPath);
if ((doorState & UP_OPEN) && next->y > MIN_Y)
{
new = Create_Child_Node(next);
new->stepTaken = 'U';
new->y--;
Enqueue(&queue, new);
}
if ((doorState & DOWN_OPEN) && next->y < MAX_Y)
{
new = Create_Child_Node(next);
new->stepTaken = 'D';
new->y++;
Enqueue(&queue, new);
}
if ((doorState & LEFT_OPEN) && next->x > MIN_X)
{
new = Create_Child_Node(next);
new->stepTaken = 'L';
new->x--;
Enqueue(&queue, new);
}
if ((doorState & RIGHT_OPEN) && next->x < MAX_X)
{
new = Create_Child_Node(next);
new->stepTaken = 'R';
new->x++;
Enqueue(&queue, new);
}
next = Dequeue(&queue).node;
}
//Delete the queue as soon as we're done with the search
Delete_Queue(&queue);
//Print the longest path length
printf("The longest path is %d steps long\n", longestPath);
//Free the MD5 input buffer
free(inputPath);
return EXIT_SUCCESS;
}
//The MD5 input strings still work the same way
void Copy_Path_Chars(char *dest, const sPathNode *leaf)
{
const sPathNode *nextNode;
dest[leaf->depth] = '\0';
nextNode = leaf;
while (nextNode->depth > 0)
{
dest[nextNode->depth - 1] = nextNode->stepTaken;
nextNode = nextNode->parent;
}
}
//The door states still work the same way
unsigned short Get_Door_States(const char *inputPath)
{
uint_least8_t hash[MD5SIZE];
unsigned short state = NONE_OPEN;
MD5(inputPath, hash);
if ((hash[0] >> 4) >= 0xb)
state |= UP_OPEN;
if ((hash[0] & 0x0f) >= 0xb)
state |= DOWN_OPEN;
if ((hash[1] >> 4) >= 0xb)
state |= LEFT_OPEN;
if ((hash[1] & 0x0f) >= 0xb)
state |= RIGHT_OPEN;
// printf("%s\n", inputPath);
// Print_MD5_Hash(hash);
// printf("\n%hx\n", state);
return state;
}
//Child nodes are still the same
sPathNode *Create_Child_Node(sPathNode *parent)
{
sPathNode *new;
new = malloc(sizeof(sPathNode));
if (new == NULL)
{
fprintf(stderr, "Error allocating memory: %s\n", strerror(errno));
exit(EXIT_FAILURE);
}
new->x = parent->x;
new->y = parent->y;
new->depth = parent->depth + 1;
new->parent = parent;
return new;
}
//We just need to modify Dequeue(). Everything else is unchanged.
//Remove and return the next path node from the queue. If the queue is empty,
//return a null node.
sQueueNode Dequeue(sQueue *queue)
{
sQueueNode *oldest;
sQueueNode retVal;
//Return a queue node with a null pointer if empty
if (queue->numElements == 0)
{
retVal.node = NULL;
retVal.next = NULL;
return retVal;
}
//Copy the oldest node
oldest = queue->first;
retVal = *oldest;
//Delete the oldest node from the linked list. We can only update the queue
//pointers if there are still other nodes left in the list.
if (queue->numElements > 1)
queue->first = oldest->next;
free(oldest);
queue->numElements--;
return retVal;
}
//Initialize the step queue
void Init_Queue(sQueue *queue)
{
queue->numElements = 0;
queue->first = NULL;
queue->last = NULL;
}
//Add a step to the queue
void Enqueue(sQueue *queue, sPathNode *foundNode)
{
sQueueNode *new;
//Create the new step node for the linked list
new = malloc(sizeof(sQueueNode));
if (new == NULL)
{
fprintf(stderr, "Error allocating memory: %s\n", strerror(errno));
exit(EXIT_FAILURE);
}
new->node = foundNode;
new->next = NULL;
//Add the node to the tail of the list. If the list is empty, we need to
//update the queue pointers to cover the new list.
if (queue->numElements > 0)
queue->last->next = new;
else
queue->first = new;
queue->last = new;
queue->numElements++;
}
//Free all the memory used by the queue
void Delete_Queue(sQueue *queue)
{
sQueueNode *next;
while (queue->numElements > 0)
{
next = queue->first->next;
free(queue->first);
queue->first = next;
queue->numElements--;
}
}
//We have the modify the MD5 code to take data of any length. This is now a full
//implementation of RFC 1321.
//The Wikipedia explanation of the algorithm is a bit too concise, so I
//recommend reading the primary source (RFC 1321) instead. All of the weird
//functions and constants here come directly from that document. Most of the
//values in the algorithm have bit sizes specified, so we'll be using integer
//types from stdint.h, which was introduced in C99.
//We need to do left rotates on 32-bit values. Strangely, C doesn't have an
//operator for this even though it's a very common CPU instruction.
#define lrot(val, bits) (((val) << (bits)) | ((val) >> (32 - (bits))))
//We also need a constant table. These values are based on sines, and are
//provided in the RFC.
const uint32_t T[64] = {0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee,
0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,
0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be,
0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821,
0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa,
0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8,
0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed,
0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a,
0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c,
0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70,
0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05,
0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665,
0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039,
0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1,
0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1,
0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391};
//This table holds the order in which we access the data array. There's no
//pattern that I can see.
const int k[64] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, //R1
1, 6, 11, 0, 5, 10, 15, 4, 9, 14, 3, 8, 13, 2, 7, 12, //R2
5, 8, 11, 14, 1, 4, 7, 10, 13, 0, 3, 6, 9, 12, 15, 2, //R3
0, 7, 14, 5, 12, 3, 10, 1, 8, 15, 6, 13, 4, 11, 2, 9}; //R4
//We also need to define some helper functions. We don't want to add function
//call overhead, so let's use the preprocessor. ("But... the preprocessor is
//evil!" I hear you say. "The optimizer will take care of everything!" Maybe on
//x86 and x64 it will, but good luck getting a magical level of optimization on
//some obscure CPU architecture. Anyway, always remember to put parentheses
//around macro definitions and every input variable. This keeps the order of
//operations correct even if you pass in something like a + 5.
#define F(x, y, z) (((x) & (y)) | (~(x) & (z)))
#define G(x, y, z) (((x) & (z)) | ((y) & ~(z)))
#define H(x, y, z) ((x) ^ (y) ^ (z))
#define I(x, y, z) ((y) ^ ((x) | ~(z)))
#define ROUND1(a, b, c, d, x, s, i) (a) = (b)+lrot((a) + F(b,c,d) + (x) + (i), (s))
#define ROUND2(a, b, c, d, x, s, i) (a) = (b)+lrot((a) + G(b,c,d) + (x) + (i), (s))
#define ROUND3(a, b, c, d, x, s, i) (a) = (b)+lrot((a) + H(b,c,d) + (x) + (i), (s))
#define ROUND4(a, b, c, d, x, s, i) (a) = (b)+lrot((a) + I(b,c,d) + (x) + (i), (s))
//Finally, some miscellaneous constants
#define A_INIT 0x67452301
#define B_INIT 0xefcdab89
#define C_INIT 0x98badcfe
#define D_INIT 0x10325476
//Now we can get into the actual function
void MD5(const char *input, uint_least8_t *output)
{
//The input must be padded to a multiple of 512 bits, so we need a buffer
//for that. We also need four 32-bit state variables initialized to specific
//values.
uint32_t *msg, *buffer;
uint32_t A = A_INIT;
uint32_t B = B_INIT;
uint32_t C = C_INIT;
uint32_t D = D_INIT;
uint32_t AA, BB, CC, DD;
size_t msgLen, paddedLen, bufLen;
int block, op, base;
//Get the length of the input message and determine the total input length
//after padding. The rules here are that we always have to pad, the padded
//length must be a multiple of 512 bits, and the minimum number of padding
//bits is 65, of which 64 are the message length. This means that any
//message length congruent to >=448 mod 512 must add an additional 512-bit
//block composed entirely of padding. The bitwise trick for rounding up
//to the next multiple of 512 comes from the excellent book Hacker's Delight
//by Henry Warren.
msgLen = strlen(input) * CHAR_BIT;
paddedLen = (msgLen + 511) & -512;
if (msgLen % 512 >= 448 || msgLen % 512 == 0)
paddedLen += 512;
//Allocate a buffer to hold the padded input. Using calloc() clears the
//buffer automatically, which helps with the padding.
bufLen = paddedLen / (CHAR_BIT * sizeof(uint32_t));
buffer = calloc(bufLen, sizeof(uint32_t));
if (buffer == NULL)
{
fprintf(stderr, "Error allocating memory: %s\n", strerror(errno));
exit(EXIT_FAILURE);
}
//Copy the input data into the message buffer
strncpy((char *)buffer, input, bufLen * sizeof(uint32_t));
//Pad the data to 512 bits. There are three parts to this:
//
//1. The bit right after the end of the message becomes a one. We can do
// this using strcat() for convenience.
//2. All the bits from there to bit 447 become zeros. This happened when we
// called calloc() earlier.
//3. The last 64 bits hold the message length (in bits) before the padding.
// The value is stored as two 32-bit words in little-endian order, so the
// length will be in the first word. We can use a uint64_t pointer to
// access both words at once.
strcat((char *)buffer, "\x80");
//Let's break this one down:
//
//buffer + bufLen - 2 A pointer to a 32-bit word 64 bits before the end
// of the message.
//*(uint64_t *) Cast the above to a pointer to a 64-bit value at
// the same address, then dereference (access) it.
*(uint64_t *)(buffer + bufLen - 2) = msgLen;
//Now that the message is padded, we can get to the core algorithm, which
//processes one 512-bit block of data at a time. The process consists of
//four rounds, each of which has 16 operations. The operations all follow
//the same basic pattern. Here's round 1:
//
// A = B + (A + F(B,C,D) + msg[k] + T[i])<<<s
//
//In later rounds, F is replaced by G, H, and I, respectively. The
//parameters vary in each operation within a round. The state variables and
//shift values repeat every four operations, so loops of four seem like a
//natural choice. Only the data indices are totally irregular, so we'll
//use a look-up table for those.
for (block = 0; block < paddedLen/512; block++)
{
//Point to the start of the next data block
msg = buffer + block*16;
//Save the starting values of the state variables so we can add them
//back in later.
AA = A;
BB = B;
CC = C;
DD = D;
//Do the four rounds
for (op = 0; op < 16; op += 4)
{
base = 0 + op;
ROUND1(A, B, C, D, msg[k[base+0]], 7, T[base+0]);
ROUND1(D, A, B, C, msg[k[base+1]], 12, T[base+1]);
ROUND1(C, D, A, B, msg[k[base+2]], 17, T[base+2]);
ROUND1(B, C, D, A, msg[k[base+3]], 22, T[base+3]);
}
for (op = 0; op < 16; op += 4)
{
base = 16 + op;
ROUND2(A, B, C, D, msg[k[base+0]], 5, T[base+0]);
ROUND2(D, A, B, C, msg[k[base+1]], 9, T[base+1]);
ROUND2(C, D, A, B, msg[k[base+2]], 14, T[base+2]);
ROUND2(B, C, D, A, msg[k[base+3]], 20, T[base+3]);
}
for (op = 0; op < 16; op += 4)
{
base = 32 + op;
ROUND3(A, B, C, D, msg[k[base+0]], 4, T[base+0]);
ROUND3(D, A, B, C, msg[k[base+1]], 11, T[base+1]);
ROUND3(C, D, A, B, msg[k[base+2]], 16, T[base+2]);
ROUND3(B, C, D, A, msg[k[base+3]], 23, T[base+3]);
}
for (op = 0; op < 16; op += 4)
{
base = 48 + op;
ROUND4(A, B, C, D, msg[k[base+0]], 6, T[base+0]);
ROUND4(D, A, B, C, msg[k[base+1]], 10, T[base+1]);
ROUND4(C, D, A, B, msg[k[base+2]], 15, T[base+2]);
ROUND4(B, C, D, A, msg[k[base+3]], 21, T[base+3]);
}
//Add back in the saved state variable values
A += AA;
B += BB;
C += CC;
D += DD;
}
//Free the message buffer once we're done with it
free(buffer);
//The four state variables are the output. Unfortunately, the standard hex
//representation prints the bytes in little-endian order, which is the
//opposite of how 32-bit values are printed! To make the result unambiguous,
//we're going to return the 128-bit result as an 8-bit array. We'll do this
//using one last pointer conversion trick. This time, we'll use the typecast
//pointer with an array index.
((uint32_t *)output)[0] = A;
((uint32_t *)output)[1] = B;
((uint32_t *)output)[2] = C;
((uint32_t *)output)[3] = D;
}
//Print an MD5 hash in the canonical little-endian hexadecimal format
void Print_MD5_Hash(uint_least8_t *hash)
{
int c;
for (c = 0; c < MD5SIZE; c++)
{
printf("%02x", hash[c]);
}
}
|
the_stack_data/9931.c | /*
* la.c
*
* Copyright 2015 Rohan Verma <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
#include <stdio.h>
#include <limits.h>
int max_arr(int arr[][5], int l, int b){
int max = INT_MIN;
for(int i = 0; i < l; i++){
for (int j = 0; j < b; j++){
if(max < arr[i][j]) max = arr[i][j];
}
}
return max;
}
int main(int argc, char **argv)
{
int input[5][5];
for(int i = 0; i < 5; i++)
{
for(int j = 0; j < 5; j++)
{
scanf("%d", &input[i][j]);
}
}
printf("\nMAX: %d\n", max_arr(input,5,5));
return 0;
}
|
the_stack_data/827889.c | // RUN: %clang_cc1 -E -dM -triple=aarch64 -xc /dev/null > %t.aarch64
// RUN: FileCheck --check-prefixes=AARCH64,AARCH64_LE,AARCH64_C %s --match-full-lines < %t.aarch64
// RUN: %clang_cc1 -E -dM -triple=arm64 -xc /dev/null > %t.arm64
// RUN: cmp %t.aarch64 %t.arm64
// RUN: %clang_cc1 -E -dM -triple=aarch64_be -xc /dev/null | FileCheck --check-prefixes=AARCH64,AARCH64_BE,AARCH64_C --match-full-lines %s
// RUN: %clang_cc1 -E -dM -triple=arm64 -xc++ /dev/null | FileCheck --check-prefixes=AARCH64,AARCH64_LE,AARCH64_CXX --match-full-lines %s
// AARCH64: #define _LP64 1
// AARCH64_BE-NEXT: #define __AARCH64EB__ 1
// AARCH64_BE-NEXT: #define __AARCH64_CMODEL_SMALL__ 1
// AARCH64_BE-NEXT: #define __AARCH_BIG_ENDIAN 1
// AARCH64_LE-NEXT: #define __AARCH64EL__ 1
// AARCH64_LE-NEXT: #define __AARCH64_CMODEL_SMALL__ 1
// AARCH64-NEXT: #define __ARM_64BIT_STATE 1
// AARCH64-NEXT: #define __ARM_ACLE 200
// AARCH64-NEXT: #define __ARM_ALIGN_MAX_STACK_PWR 4
// AARCH64-NEXT: #define __ARM_ARCH 8
// AARCH64-NEXT: #define __ARM_ARCH_ISA_A64 1
// AARCH64-NEXT: #define __ARM_ARCH_PROFILE 'A'
// AARCH64_BE-NEXT: #define __ARM_BIG_ENDIAN 1
// AARCH64-NEXT: #define __ARM_FEATURE_CLZ 1
// AARCH64-NEXT: #define __ARM_FEATURE_DIRECTED_ROUNDING 1
// AARCH64-NEXT: #define __ARM_FEATURE_DIV 1
// AARCH64-NEXT: #define __ARM_FEATURE_FMA 1
// AARCH64-NEXT: #define __ARM_FEATURE_IDIV 1
// AARCH64-NEXT: #define __ARM_FEATURE_LDREX 0xF
// AARCH64-NEXT: #define __ARM_FEATURE_NUMERIC_MAXMIN 1
// AARCH64-NEXT: #define __ARM_FEATURE_UNALIGNED 1
// AARCH64-NEXT: #define __ARM_FP 0xE
// AARCH64-NEXT: #define __ARM_FP16_ARGS 1
// AARCH64-NEXT: #define __ARM_FP16_FORMAT_IEEE 1
// AARCH64-NEXT: #define __ARM_PCS_AAPCS64 1
// AARCH64-NEXT: #define __ARM_SIZEOF_MINIMAL_ENUM 4
// AARCH64-NEXT: #define __ARM_SIZEOF_WCHAR_T 4
// AARCH64-NEXT: #define __ATOMIC_ACQUIRE 2
// AARCH64-NEXT: #define __ATOMIC_ACQ_REL 4
// AARCH64-NEXT: #define __ATOMIC_CONSUME 1
// AARCH64-NEXT: #define __ATOMIC_RELAXED 0
// AARCH64-NEXT: #define __ATOMIC_RELEASE 3
// AARCH64-NEXT: #define __ATOMIC_SEQ_CST 5
// AARCH64: #define __BIGGEST_ALIGNMENT__ 16
// AARCH64_BE-NEXT: #define __BIG_ENDIAN__ 1
// AARCH64_BE-NEXT: #define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__
// AARCH64_LE-NEXT: #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
// AARCH64-NEXT: #define __CHAR16_TYPE__ unsigned short
// AARCH64-NEXT: #define __CHAR32_TYPE__ unsigned int
// AARCH64-NEXT: #define __CHAR_BIT__ 8
// AARCH64-NEXT: #define __CLANG_ATOMIC_BOOL_LOCK_FREE 2
// AARCH64-NEXT: #define __CLANG_ATOMIC_CHAR16_T_LOCK_FREE 2
// AARCH64-NEXT: #define __CLANG_ATOMIC_CHAR32_T_LOCK_FREE 2
// AARCH64-NEXT: #define __CLANG_ATOMIC_CHAR_LOCK_FREE 2
// AARCH64-NEXT: #define __CLANG_ATOMIC_INT_LOCK_FREE 2
// AARCH64-NEXT: #define __CLANG_ATOMIC_LLONG_LOCK_FREE 2
// AARCH64-NEXT: #define __CLANG_ATOMIC_LONG_LOCK_FREE 2
// AARCH64-NEXT: #define __CLANG_ATOMIC_POINTER_LOCK_FREE 2
// AARCH64-NEXT: #define __CLANG_ATOMIC_SHORT_LOCK_FREE 2
// AARCH64-NEXT: #define __CLANG_ATOMIC_WCHAR_T_LOCK_FREE 2
// AARCH64-NEXT: #define __CONSTANT_CFSTRINGS__ 1
// AARCH64-NEXT: #define __DBL_DECIMAL_DIG__ 17
// AARCH64-NEXT: #define __DBL_DENORM_MIN__ 4.9406564584124654e-324
// AARCH64-NEXT: #define __DBL_DIG__ 15
// AARCH64-NEXT: #define __DBL_EPSILON__ 2.2204460492503131e-16
// AARCH64-NEXT: #define __DBL_HAS_DENORM__ 1
// AARCH64-NEXT: #define __DBL_HAS_INFINITY__ 1
// AARCH64-NEXT: #define __DBL_HAS_QUIET_NAN__ 1
// AARCH64-NEXT: #define __DBL_MANT_DIG__ 53
// AARCH64-NEXT: #define __DBL_MAX_10_EXP__ 308
// AARCH64-NEXT: #define __DBL_MAX_EXP__ 1024
// AARCH64-NEXT: #define __DBL_MAX__ 1.7976931348623157e+308
// AARCH64-NEXT: #define __DBL_MIN_10_EXP__ (-307)
// AARCH64-NEXT: #define __DBL_MIN_EXP__ (-1021)
// AARCH64-NEXT: #define __DBL_MIN__ 2.2250738585072014e-308
// AARCH64-NEXT: #define __DECIMAL_DIG__ __LDBL_DECIMAL_DIG__
// AARCH64-NEXT: #define __ELF__ 1
// AARCH64-NEXT: #define __FINITE_MATH_ONLY__ 0
// AARCH64-NEXT: #define __FLT16_DECIMAL_DIG__ 5
// AARCH64-NEXT: #define __FLT16_DENORM_MIN__ 5.9604644775390625e-8F16
// AARCH64-NEXT: #define __FLT16_DIG__ 3
// AARCH64-NEXT: #define __FLT16_EPSILON__ 9.765625e-4F16
// AARCH64-NEXT: #define __FLT16_HAS_DENORM__ 1
// AARCH64-NEXT: #define __FLT16_HAS_INFINITY__ 1
// AARCH64-NEXT: #define __FLT16_HAS_QUIET_NAN__ 1
// AARCH64-NEXT: #define __FLT16_MANT_DIG__ 11
// AARCH64-NEXT: #define __FLT16_MAX_10_EXP__ 4
// AARCH64-NEXT: #define __FLT16_MAX_EXP__ 16
// AARCH64-NEXT: #define __FLT16_MAX__ 6.5504e+4F16
// AARCH64-NEXT: #define __FLT16_MIN_10_EXP__ (-4)
// AARCH64-NEXT: #define __FLT16_MIN_EXP__ (-13)
// AARCH64-NEXT: #define __FLT16_MIN__ 6.103515625e-5F16
// AARCH64-NEXT: #define __FLT_DECIMAL_DIG__ 9
// AARCH64-NEXT: #define __FLT_DENORM_MIN__ 1.40129846e-45F
// AARCH64-NEXT: #define __FLT_DIG__ 6
// AARCH64-NEXT: #define __FLT_EPSILON__ 1.19209290e-7F
// AARCH64-NEXT: #define __FLT_HAS_DENORM__ 1
// AARCH64-NEXT: #define __FLT_HAS_INFINITY__ 1
// AARCH64-NEXT: #define __FLT_HAS_QUIET_NAN__ 1
// AARCH64-NEXT: #define __FLT_MANT_DIG__ 24
// AARCH64-NEXT: #define __FLT_MAX_10_EXP__ 38
// AARCH64-NEXT: #define __FLT_MAX_EXP__ 128
// AARCH64-NEXT: #define __FLT_MAX__ 3.40282347e+38F
// AARCH64-NEXT: #define __FLT_MIN_10_EXP__ (-37)
// AARCH64-NEXT: #define __FLT_MIN_EXP__ (-125)
// AARCH64-NEXT: #define __FLT_MIN__ 1.17549435e-38F
// AARCH64-NEXT: #define __FLT_RADIX__ 2
// AARCH64-NEXT: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
// AARCH64-NEXT: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
// AARCH64-NEXT: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
// AARCH64-NEXT: #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
// AARCH64_CXX-NEXT: #define __GLIBCXX_BITSIZE_INT_N_0 128
// AARCH64_CXX-NEXT: #define __GLIBCXX_TYPE_INT_N_0 __int128
// AARCH64-NEXT: #define __INT16_C_SUFFIX__
// AARCH64-NEXT: #define __INT16_FMTd__ "hd"
// AARCH64-NEXT: #define __INT16_FMTi__ "hi"
// AARCH64-NEXT: #define __INT16_MAX__ 32767
// AARCH64-NEXT: #define __INT16_TYPE__ short
// AARCH64-NEXT: #define __INT32_C_SUFFIX__
// AARCH64-NEXT: #define __INT32_FMTd__ "d"
// AARCH64-NEXT: #define __INT32_FMTi__ "i"
// AARCH64-NEXT: #define __INT32_MAX__ 2147483647
// AARCH64-NEXT: #define __INT32_TYPE__ int
// AARCH64-NEXT: #define __INT64_C_SUFFIX__ L
// AARCH64-NEXT: #define __INT64_FMTd__ "ld"
// AARCH64-NEXT: #define __INT64_FMTi__ "li"
// AARCH64-NEXT: #define __INT64_MAX__ 9223372036854775807L
// AARCH64-NEXT: #define __INT64_TYPE__ long int
// AARCH64-NEXT: #define __INT8_C_SUFFIX__
// AARCH64-NEXT: #define __INT8_FMTd__ "hhd"
// AARCH64-NEXT: #define __INT8_FMTi__ "hhi"
// AARCH64-NEXT: #define __INT8_MAX__ 127
// AARCH64-NEXT: #define __INT8_TYPE__ signed char
// AARCH64-NEXT: #define __INTMAX_C_SUFFIX__ L
// AARCH64-NEXT: #define __INTMAX_FMTd__ "ld"
// AARCH64-NEXT: #define __INTMAX_FMTi__ "li"
// AARCH64-NEXT: #define __INTMAX_MAX__ 9223372036854775807L
// AARCH64-NEXT: #define __INTMAX_TYPE__ long int
// AARCH64-NEXT: #define __INTMAX_WIDTH__ 64
// AARCH64-NEXT: #define __INTPTR_FMTd__ "ld"
// AARCH64-NEXT: #define __INTPTR_FMTi__ "li"
// AARCH64-NEXT: #define __INTPTR_MAX__ 9223372036854775807L
// AARCH64-NEXT: #define __INTPTR_TYPE__ long int
// AARCH64-NEXT: #define __INTPTR_WIDTH__ 64
// AARCH64-NEXT: #define __INT_FAST16_FMTd__ "hd"
// AARCH64-NEXT: #define __INT_FAST16_FMTi__ "hi"
// AARCH64-NEXT: #define __INT_FAST16_MAX__ 32767
// AARCH64-NEXT: #define __INT_FAST16_TYPE__ short
// AARCH64-NEXT: #define __INT_FAST32_FMTd__ "d"
// AARCH64-NEXT: #define __INT_FAST32_FMTi__ "i"
// AARCH64-NEXT: #define __INT_FAST32_MAX__ 2147483647
// AARCH64-NEXT: #define __INT_FAST32_TYPE__ int
// AARCH64-NEXT: #define __INT_FAST64_FMTd__ "ld"
// AARCH64-NEXT: #define __INT_FAST64_FMTi__ "li"
// AARCH64-NEXT: #define __INT_FAST64_MAX__ 9223372036854775807L
// AARCH64-NEXT: #define __INT_FAST64_TYPE__ long int
// AARCH64-NEXT: #define __INT_FAST8_FMTd__ "hhd"
// AARCH64-NEXT: #define __INT_FAST8_FMTi__ "hhi"
// AARCH64-NEXT: #define __INT_FAST8_MAX__ 127
// AARCH64-NEXT: #define __INT_FAST8_TYPE__ signed char
// AARCH64-NEXT: #define __INT_LEAST16_FMTd__ "hd"
// AARCH64-NEXT: #define __INT_LEAST16_FMTi__ "hi"
// AARCH64-NEXT: #define __INT_LEAST16_MAX__ 32767
// AARCH64-NEXT: #define __INT_LEAST16_TYPE__ short
// AARCH64-NEXT: #define __INT_LEAST32_FMTd__ "d"
// AARCH64-NEXT: #define __INT_LEAST32_FMTi__ "i"
// AARCH64-NEXT: #define __INT_LEAST32_MAX__ 2147483647
// AARCH64-NEXT: #define __INT_LEAST32_TYPE__ int
// AARCH64-NEXT: #define __INT_LEAST64_FMTd__ "ld"
// AARCH64-NEXT: #define __INT_LEAST64_FMTi__ "li"
// AARCH64-NEXT: #define __INT_LEAST64_MAX__ 9223372036854775807L
// AARCH64-NEXT: #define __INT_LEAST64_TYPE__ long int
// AARCH64-NEXT: #define __INT_LEAST8_FMTd__ "hhd"
// AARCH64-NEXT: #define __INT_LEAST8_FMTi__ "hhi"
// AARCH64-NEXT: #define __INT_LEAST8_MAX__ 127
// AARCH64-NEXT: #define __INT_LEAST8_TYPE__ signed char
// AARCH64-NEXT: #define __INT_MAX__ 2147483647
// AARCH64-NEXT: #define __LDBL_DECIMAL_DIG__ 36
// AARCH64-NEXT: #define __LDBL_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966L
// AARCH64-NEXT: #define __LDBL_DIG__ 33
// AARCH64-NEXT: #define __LDBL_EPSILON__ 1.92592994438723585305597794258492732e-34L
// AARCH64-NEXT: #define __LDBL_HAS_DENORM__ 1
// AARCH64-NEXT: #define __LDBL_HAS_INFINITY__ 1
// AARCH64-NEXT: #define __LDBL_HAS_QUIET_NAN__ 1
// AARCH64-NEXT: #define __LDBL_MANT_DIG__ 113
// AARCH64-NEXT: #define __LDBL_MAX_10_EXP__ 4932
// AARCH64-NEXT: #define __LDBL_MAX_EXP__ 16384
// AARCH64-NEXT: #define __LDBL_MAX__ 1.18973149535723176508575932662800702e+4932L
// AARCH64-NEXT: #define __LDBL_MIN_10_EXP__ (-4931)
// AARCH64-NEXT: #define __LDBL_MIN_EXP__ (-16381)
// AARCH64-NEXT: #define __LDBL_MIN__ 3.36210314311209350626267781732175260e-4932L
// AARCH64_LE-NEXT: #define __LITTLE_ENDIAN__ 1
// AARCH64-NEXT: #define __LONG_LONG_MAX__ 9223372036854775807LL
// AARCH64-NEXT: #define __LONG_MAX__ 9223372036854775807L
// AARCH64-NEXT: #define __LP64__ 1
// AARCH64-NEXT: #define __NO_INLINE__ 1
// AARCH64-NEXT: #define __OBJC_BOOL_IS_BOOL 0
// AARCH64-NEXT: #define __OPENCL_MEMORY_SCOPE_ALL_SVM_DEVICES 3
// AARCH64-NEXT: #define __OPENCL_MEMORY_SCOPE_DEVICE 2
// AARCH64-NEXT: #define __OPENCL_MEMORY_SCOPE_SUB_GROUP 4
// AARCH64-NEXT: #define __OPENCL_MEMORY_SCOPE_WORK_GROUP 1
// AARCH64-NEXT: #define __OPENCL_MEMORY_SCOPE_WORK_ITEM 0
// AARCH64-NEXT: #define __ORDER_BIG_ENDIAN__ 4321
// AARCH64-NEXT: #define __ORDER_LITTLE_ENDIAN__ 1234
// AARCH64-NEXT: #define __ORDER_PDP_ENDIAN__ 3412
// AARCH64-NEXT: #define __POINTER_WIDTH__ 64
// AARCH64-NEXT: #define __PRAGMA_REDEFINE_EXTNAME 1
// AARCH64-NEXT: #define __PTRDIFF_FMTd__ "ld"
// AARCH64-NEXT: #define __PTRDIFF_FMTi__ "li"
// AARCH64-NEXT: #define __PTRDIFF_MAX__ 9223372036854775807L
// AARCH64-NEXT: #define __PTRDIFF_TYPE__ long int
// AARCH64-NEXT: #define __PTRDIFF_WIDTH__ 64
// AARCH64-NEXT: #define __SCHAR_MAX__ 127
// AARCH64-NEXT: #define __SHRT_MAX__ 32767
// AARCH64-NEXT: #define __SIG_ATOMIC_MAX__ 2147483647
// AARCH64-NEXT: #define __SIG_ATOMIC_WIDTH__ 32
// AARCH64-NEXT: #define __SIZEOF_DOUBLE__ 8
// AARCH64-NEXT: #define __SIZEOF_FLOAT__ 4
// AARCH64-NEXT: #define __SIZEOF_INT128__ 16
// AARCH64-NEXT: #define __SIZEOF_INT__ 4
// AARCH64-NEXT: #define __SIZEOF_LONG_DOUBLE__ 16
// AARCH64-NEXT: #define __SIZEOF_LONG_LONG__ 8
// AARCH64-NEXT: #define __SIZEOF_LONG__ 8
// AARCH64-NEXT: #define __SIZEOF_POINTER__ 8
// AARCH64-NEXT: #define __SIZEOF_PTRDIFF_T__ 8
// AARCH64-NEXT: #define __SIZEOF_SHORT__ 2
// AARCH64-NEXT: #define __SIZEOF_SIZE_T__ 8
// AARCH64-NEXT: #define __SIZEOF_WCHAR_T__ 4
// AARCH64-NEXT: #define __SIZEOF_WINT_T__ 4
// AARCH64-NEXT: #define __SIZE_FMTX__ "lX"
// AARCH64-NEXT: #define __SIZE_FMTo__ "lo"
// AARCH64-NEXT: #define __SIZE_FMTu__ "lu"
// AARCH64-NEXT: #define __SIZE_FMTx__ "lx"
// AARCH64-NEXT: #define __SIZE_MAX__ 18446744073709551615UL
// AARCH64-NEXT: #define __SIZE_TYPE__ long unsigned int
// AARCH64-NEXT: #define __SIZE_WIDTH__ 64
// AARCH64_CXX: #define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 16UL
// AARCH64_CXX: #define __STDCPP_THREADS__ 1
// AARCH64-NEXT: #define __STDC_HOSTED__ 1
// AARCH64-NEXT: #define __STDC_UTF_16__ 1
// AARCH64-NEXT: #define __STDC_UTF_32__ 1
// AARCH64_C: #define __STDC_VERSION__ 201710L
// AARCH64-NEXT: #define __STDC__ 1
// AARCH64-NEXT: #define __UINT16_C_SUFFIX__
// AARCH64-NEXT: #define __UINT16_FMTX__ "hX"
// AARCH64-NEXT: #define __UINT16_FMTo__ "ho"
// AARCH64-NEXT: #define __UINT16_FMTu__ "hu"
// AARCH64-NEXT: #define __UINT16_FMTx__ "hx"
// AARCH64-NEXT: #define __UINT16_MAX__ 65535
// AARCH64-NEXT: #define __UINT16_TYPE__ unsigned short
// AARCH64-NEXT: #define __UINT32_C_SUFFIX__ U
// AARCH64-NEXT: #define __UINT32_FMTX__ "X"
// AARCH64-NEXT: #define __UINT32_FMTo__ "o"
// AARCH64-NEXT: #define __UINT32_FMTu__ "u"
// AARCH64-NEXT: #define __UINT32_FMTx__ "x"
// AARCH64-NEXT: #define __UINT32_MAX__ 4294967295U
// AARCH64-NEXT: #define __UINT32_TYPE__ unsigned int
// AARCH64-NEXT: #define __UINT64_C_SUFFIX__ UL
// AARCH64-NEXT: #define __UINT64_FMTX__ "lX"
// AARCH64-NEXT: #define __UINT64_FMTo__ "lo"
// AARCH64-NEXT: #define __UINT64_FMTu__ "lu"
// AARCH64-NEXT: #define __UINT64_FMTx__ "lx"
// AARCH64-NEXT: #define __UINT64_MAX__ 18446744073709551615UL
// AARCH64-NEXT: #define __UINT64_TYPE__ long unsigned int
// AARCH64-NEXT: #define __UINT8_C_SUFFIX__
// AARCH64-NEXT: #define __UINT8_FMTX__ "hhX"
// AARCH64-NEXT: #define __UINT8_FMTo__ "hho"
// AARCH64-NEXT: #define __UINT8_FMTu__ "hhu"
// AARCH64-NEXT: #define __UINT8_FMTx__ "hhx"
// AARCH64-NEXT: #define __UINT8_MAX__ 255
// AARCH64-NEXT: #define __UINT8_TYPE__ unsigned char
// AARCH64-NEXT: #define __UINTMAX_C_SUFFIX__ UL
// AARCH64-NEXT: #define __UINTMAX_FMTX__ "lX"
// AARCH64-NEXT: #define __UINTMAX_FMTo__ "lo"
// AARCH64-NEXT: #define __UINTMAX_FMTu__ "lu"
// AARCH64-NEXT: #define __UINTMAX_FMTx__ "lx"
// AARCH64-NEXT: #define __UINTMAX_MAX__ 18446744073709551615UL
// AARCH64-NEXT: #define __UINTMAX_TYPE__ long unsigned int
// AARCH64-NEXT: #define __UINTMAX_WIDTH__ 64
// AARCH64-NEXT: #define __UINTPTR_FMTX__ "lX"
// AARCH64-NEXT: #define __UINTPTR_FMTo__ "lo"
// AARCH64-NEXT: #define __UINTPTR_FMTu__ "lu"
// AARCH64-NEXT: #define __UINTPTR_FMTx__ "lx"
// AARCH64-NEXT: #define __UINTPTR_MAX__ 18446744073709551615UL
// AARCH64-NEXT: #define __UINTPTR_TYPE__ long unsigned int
// AARCH64-NEXT: #define __UINTPTR_WIDTH__ 64
// AARCH64-NEXT: #define __UINT_FAST16_FMTX__ "hX"
// AARCH64-NEXT: #define __UINT_FAST16_FMTo__ "ho"
// AARCH64-NEXT: #define __UINT_FAST16_FMTu__ "hu"
// AARCH64-NEXT: #define __UINT_FAST16_FMTx__ "hx"
// AARCH64-NEXT: #define __UINT_FAST16_MAX__ 65535
// AARCH64-NEXT: #define __UINT_FAST16_TYPE__ unsigned short
// AARCH64-NEXT: #define __UINT_FAST32_FMTX__ "X"
// AARCH64-NEXT: #define __UINT_FAST32_FMTo__ "o"
// AARCH64-NEXT: #define __UINT_FAST32_FMTu__ "u"
// AARCH64-NEXT: #define __UINT_FAST32_FMTx__ "x"
// AARCH64-NEXT: #define __UINT_FAST32_MAX__ 4294967295U
// AARCH64-NEXT: #define __UINT_FAST32_TYPE__ unsigned int
// AARCH64-NEXT: #define __UINT_FAST64_FMTX__ "lX"
// AARCH64-NEXT: #define __UINT_FAST64_FMTo__ "lo"
// AARCH64-NEXT: #define __UINT_FAST64_FMTu__ "lu"
// AARCH64-NEXT: #define __UINT_FAST64_FMTx__ "lx"
// AARCH64-NEXT: #define __UINT_FAST64_MAX__ 18446744073709551615UL
// AARCH64-NEXT: #define __UINT_FAST64_TYPE__ long unsigned int
// AARCH64-NEXT: #define __UINT_FAST8_FMTX__ "hhX"
// AARCH64-NEXT: #define __UINT_FAST8_FMTo__ "hho"
// AARCH64-NEXT: #define __UINT_FAST8_FMTu__ "hhu"
// AARCH64-NEXT: #define __UINT_FAST8_FMTx__ "hhx"
// AARCH64-NEXT: #define __UINT_FAST8_MAX__ 255
// AARCH64-NEXT: #define __UINT_FAST8_TYPE__ unsigned char
// AARCH64-NEXT: #define __UINT_LEAST16_FMTX__ "hX"
// AARCH64-NEXT: #define __UINT_LEAST16_FMTo__ "ho"
// AARCH64-NEXT: #define __UINT_LEAST16_FMTu__ "hu"
// AARCH64-NEXT: #define __UINT_LEAST16_FMTx__ "hx"
// AARCH64-NEXT: #define __UINT_LEAST16_MAX__ 65535
// AARCH64-NEXT: #define __UINT_LEAST16_TYPE__ unsigned short
// AARCH64-NEXT: #define __UINT_LEAST32_FMTX__ "X"
// AARCH64-NEXT: #define __UINT_LEAST32_FMTo__ "o"
// AARCH64-NEXT: #define __UINT_LEAST32_FMTu__ "u"
// AARCH64-NEXT: #define __UINT_LEAST32_FMTx__ "x"
// AARCH64-NEXT: #define __UINT_LEAST32_MAX__ 4294967295U
// AARCH64-NEXT: #define __UINT_LEAST32_TYPE__ unsigned int
// AARCH64-NEXT: #define __UINT_LEAST64_FMTX__ "lX"
// AARCH64-NEXT: #define __UINT_LEAST64_FMTo__ "lo"
// AARCH64-NEXT: #define __UINT_LEAST64_FMTu__ "lu"
// AARCH64-NEXT: #define __UINT_LEAST64_FMTx__ "lx"
// AARCH64-NEXT: #define __UINT_LEAST64_MAX__ 18446744073709551615UL
// AARCH64-NEXT: #define __UINT_LEAST64_TYPE__ long unsigned int
// AARCH64-NEXT: #define __UINT_LEAST8_FMTX__ "hhX"
// AARCH64-NEXT: #define __UINT_LEAST8_FMTo__ "hho"
// AARCH64-NEXT: #define __UINT_LEAST8_FMTu__ "hhu"
// AARCH64-NEXT: #define __UINT_LEAST8_FMTx__ "hhx"
// AARCH64-NEXT: #define __UINT_LEAST8_MAX__ 255
// AARCH64-NEXT: #define __UINT_LEAST8_TYPE__ unsigned char
// AARCH64-NEXT: #define __USER_LABEL_PREFIX__
// AARCH64-NEXT: #define __VERSION__ "{{.*}}"
// AARCH64-NEXT: #define __WCHAR_MAX__ 4294967295U
// AARCH64-NEXT: #define __WCHAR_TYPE__ unsigned int
// AARCH64-NEXT: #define __WCHAR_UNSIGNED__ 1
// AARCH64-NEXT: #define __WCHAR_WIDTH__ 32
// AARCH64-NEXT: #define __WINT_MAX__ 2147483647
// AARCH64-NEXT: #define __WINT_TYPE__ int
// AARCH64-NEXT: #define __WINT_WIDTH__ 32
// AARCH64-NEXT: #define __aarch64__ 1
// RUN: %clang_cc1 -E -dM -ffreestanding -triple=aarch64-apple-ios7.0 < /dev/null | FileCheck -match-full-lines -check-prefix AARCH64-DARWIN %s
// AARCH64-DARWIN: #define _LP64 1
// AARCH64-DARWIN-NOT: #define __AARCH64EB__ 1
// AARCH64-DARWIN: #define __AARCH64EL__ 1
// AARCH64-DARWIN-NOT: #define __AARCH_BIG_ENDIAN 1
// AARCH64-DARWIN: #define __ARM_64BIT_STATE 1
// AARCH64-DARWIN: #define __ARM_ARCH 8
// AARCH64-DARWIN: #define __ARM_ARCH_ISA_A64 1
// AARCH64-DARWIN-NOT: #define __ARM_BIG_ENDIAN 1
// AARCH64-DARWIN: #define __BIGGEST_ALIGNMENT__ 8
// AARCH64-DARWIN: #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
// AARCH64-DARWIN: #define __CHAR16_TYPE__ unsigned short
// AARCH64-DARWIN: #define __CHAR32_TYPE__ unsigned int
// AARCH64-DARWIN: #define __CHAR_BIT__ 8
// AARCH64-DARWIN: #define __DBL_DENORM_MIN__ 4.9406564584124654e-324
// AARCH64-DARWIN: #define __DBL_DIG__ 15
// AARCH64-DARWIN: #define __DBL_EPSILON__ 2.2204460492503131e-16
// AARCH64-DARWIN: #define __DBL_HAS_DENORM__ 1
// AARCH64-DARWIN: #define __DBL_HAS_INFINITY__ 1
// AARCH64-DARWIN: #define __DBL_HAS_QUIET_NAN__ 1
// AARCH64-DARWIN: #define __DBL_MANT_DIG__ 53
// AARCH64-DARWIN: #define __DBL_MAX_10_EXP__ 308
// AARCH64-DARWIN: #define __DBL_MAX_EXP__ 1024
// AARCH64-DARWIN: #define __DBL_MAX__ 1.7976931348623157e+308
// AARCH64-DARWIN: #define __DBL_MIN_10_EXP__ (-307)
// AARCH64-DARWIN: #define __DBL_MIN_EXP__ (-1021)
// AARCH64-DARWIN: #define __DBL_MIN__ 2.2250738585072014e-308
// AARCH64-DARWIN: #define __DECIMAL_DIG__ __LDBL_DECIMAL_DIG__
// AARCH64-DARWIN: #define __FLT_DENORM_MIN__ 1.40129846e-45F
// AARCH64-DARWIN: #define __FLT_DIG__ 6
// AARCH64-DARWIN: #define __FLT_EPSILON__ 1.19209290e-7F
// AARCH64-DARWIN: #define __FLT_HAS_DENORM__ 1
// AARCH64-DARWIN: #define __FLT_HAS_INFINITY__ 1
// AARCH64-DARWIN: #define __FLT_HAS_QUIET_NAN__ 1
// AARCH64-DARWIN: #define __FLT_MANT_DIG__ 24
// AARCH64-DARWIN: #define __FLT_MAX_10_EXP__ 38
// AARCH64-DARWIN: #define __FLT_MAX_EXP__ 128
// AARCH64-DARWIN: #define __FLT_MAX__ 3.40282347e+38F
// AARCH64-DARWIN: #define __FLT_MIN_10_EXP__ (-37)
// AARCH64-DARWIN: #define __FLT_MIN_EXP__ (-125)
// AARCH64-DARWIN: #define __FLT_MIN__ 1.17549435e-38F
// AARCH64-DARWIN: #define __FLT_RADIX__ 2
// AARCH64-DARWIN: #define __INT16_C_SUFFIX__
// AARCH64-DARWIN: #define __INT16_FMTd__ "hd"
// AARCH64-DARWIN: #define __INT16_FMTi__ "hi"
// AARCH64-DARWIN: #define __INT16_MAX__ 32767
// AARCH64-DARWIN: #define __INT16_TYPE__ short
// AARCH64-DARWIN: #define __INT32_C_SUFFIX__
// AARCH64-DARWIN: #define __INT32_FMTd__ "d"
// AARCH64-DARWIN: #define __INT32_FMTi__ "i"
// AARCH64-DARWIN: #define __INT32_MAX__ 2147483647
// AARCH64-DARWIN: #define __INT32_TYPE__ int
// AARCH64-DARWIN: #define __INT64_C_SUFFIX__ LL
// AARCH64-DARWIN: #define __INT64_FMTd__ "lld"
// AARCH64-DARWIN: #define __INT64_FMTi__ "lli"
// AARCH64-DARWIN: #define __INT64_MAX__ 9223372036854775807LL
// AARCH64-DARWIN: #define __INT64_TYPE__ long long int
// AARCH64-DARWIN: #define __INT8_C_SUFFIX__
// AARCH64-DARWIN: #define __INT8_FMTd__ "hhd"
// AARCH64-DARWIN: #define __INT8_FMTi__ "hhi"
// AARCH64-DARWIN: #define __INT8_MAX__ 127
// AARCH64-DARWIN: #define __INT8_TYPE__ signed char
// AARCH64-DARWIN: #define __INTMAX_C_SUFFIX__ L
// AARCH64-DARWIN: #define __INTMAX_FMTd__ "ld"
// AARCH64-DARWIN: #define __INTMAX_FMTi__ "li"
// AARCH64-DARWIN: #define __INTMAX_MAX__ 9223372036854775807L
// AARCH64-DARWIN: #define __INTMAX_TYPE__ long int
// AARCH64-DARWIN: #define __INTMAX_WIDTH__ 64
// AARCH64-DARWIN: #define __INTPTR_FMTd__ "ld"
// AARCH64-DARWIN: #define __INTPTR_FMTi__ "li"
// AARCH64-DARWIN: #define __INTPTR_MAX__ 9223372036854775807L
// AARCH64-DARWIN: #define __INTPTR_TYPE__ long int
// AARCH64-DARWIN: #define __INTPTR_WIDTH__ 64
// AARCH64-DARWIN: #define __INT_FAST16_FMTd__ "hd"
// AARCH64-DARWIN: #define __INT_FAST16_FMTi__ "hi"
// AARCH64-DARWIN: #define __INT_FAST16_MAX__ 32767
// AARCH64-DARWIN: #define __INT_FAST16_TYPE__ short
// AARCH64-DARWIN: #define __INT_FAST32_FMTd__ "d"
// AARCH64-DARWIN: #define __INT_FAST32_FMTi__ "i"
// AARCH64-DARWIN: #define __INT_FAST32_MAX__ 2147483647
// AARCH64-DARWIN: #define __INT_FAST32_TYPE__ int
// AARCH64-DARWIN: #define __INT_FAST64_FMTd__ "lld"
// AARCH64-DARWIN: #define __INT_FAST64_FMTi__ "lli"
// AARCH64-DARWIN: #define __INT_FAST64_MAX__ 9223372036854775807LL
// AARCH64-DARWIN: #define __INT_FAST64_TYPE__ long long int
// AARCH64-DARWIN: #define __INT_FAST8_FMTd__ "hhd"
// AARCH64-DARWIN: #define __INT_FAST8_FMTi__ "hhi"
// AARCH64-DARWIN: #define __INT_FAST8_MAX__ 127
// AARCH64-DARWIN: #define __INT_FAST8_TYPE__ signed char
// AARCH64-DARWIN: #define __INT_LEAST16_FMTd__ "hd"
// AARCH64-DARWIN: #define __INT_LEAST16_FMTi__ "hi"
// AARCH64-DARWIN: #define __INT_LEAST16_MAX__ 32767
// AARCH64-DARWIN: #define __INT_LEAST16_TYPE__ short
// AARCH64-DARWIN: #define __INT_LEAST32_FMTd__ "d"
// AARCH64-DARWIN: #define __INT_LEAST32_FMTi__ "i"
// AARCH64-DARWIN: #define __INT_LEAST32_MAX__ 2147483647
// AARCH64-DARWIN: #define __INT_LEAST32_TYPE__ int
// AARCH64-DARWIN: #define __INT_LEAST64_FMTd__ "lld"
// AARCH64-DARWIN: #define __INT_LEAST64_FMTi__ "lli"
// AARCH64-DARWIN: #define __INT_LEAST64_MAX__ 9223372036854775807LL
// AARCH64-DARWIN: #define __INT_LEAST64_TYPE__ long long int
// AARCH64-DARWIN: #define __INT_LEAST8_FMTd__ "hhd"
// AARCH64-DARWIN: #define __INT_LEAST8_FMTi__ "hhi"
// AARCH64-DARWIN: #define __INT_LEAST8_MAX__ 127
// AARCH64-DARWIN: #define __INT_LEAST8_TYPE__ signed char
// AARCH64-DARWIN: #define __INT_MAX__ 2147483647
// AARCH64-DARWIN: #define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L
// AARCH64-DARWIN: #define __LDBL_DIG__ 15
// AARCH64-DARWIN: #define __LDBL_EPSILON__ 2.2204460492503131e-16L
// AARCH64-DARWIN: #define __LDBL_HAS_DENORM__ 1
// AARCH64-DARWIN: #define __LDBL_HAS_INFINITY__ 1
// AARCH64-DARWIN: #define __LDBL_HAS_QUIET_NAN__ 1
// AARCH64-DARWIN: #define __LDBL_MANT_DIG__ 53
// AARCH64-DARWIN: #define __LDBL_MAX_10_EXP__ 308
// AARCH64-DARWIN: #define __LDBL_MAX_EXP__ 1024
// AARCH64-DARWIN: #define __LDBL_MAX__ 1.7976931348623157e+308L
// AARCH64-DARWIN: #define __LDBL_MIN_10_EXP__ (-307)
// AARCH64-DARWIN: #define __LDBL_MIN_EXP__ (-1021)
// AARCH64-DARWIN: #define __LDBL_MIN__ 2.2250738585072014e-308L
// AARCH64-DARWIN: #define __LONG_LONG_MAX__ 9223372036854775807LL
// AARCH64-DARWIN: #define __LONG_MAX__ 9223372036854775807L
// AARCH64-DARWIN: #define __LP64__ 1
// AARCH64-DARWIN: #define __POINTER_WIDTH__ 64
// AARCH64-DARWIN: #define __PTRDIFF_TYPE__ long int
// AARCH64-DARWIN: #define __PTRDIFF_WIDTH__ 64
// AARCH64-DARWIN: #define __SCHAR_MAX__ 127
// AARCH64-DARWIN: #define __SHRT_MAX__ 32767
// AARCH64-DARWIN: #define __SIG_ATOMIC_MAX__ 2147483647
// AARCH64-DARWIN: #define __SIG_ATOMIC_WIDTH__ 32
// AARCH64-DARWIN: #define __SIZEOF_DOUBLE__ 8
// AARCH64-DARWIN: #define __SIZEOF_FLOAT__ 4
// AARCH64-DARWIN: #define __SIZEOF_INT128__ 16
// AARCH64-DARWIN: #define __SIZEOF_INT__ 4
// AARCH64-DARWIN: #define __SIZEOF_LONG_DOUBLE__ 8
// AARCH64-DARWIN: #define __SIZEOF_LONG_LONG__ 8
// AARCH64-DARWIN: #define __SIZEOF_LONG__ 8
// AARCH64-DARWIN: #define __SIZEOF_POINTER__ 8
// AARCH64-DARWIN: #define __SIZEOF_PTRDIFF_T__ 8
// AARCH64-DARWIN: #define __SIZEOF_SHORT__ 2
// AARCH64-DARWIN: #define __SIZEOF_SIZE_T__ 8
// AARCH64-DARWIN: #define __SIZEOF_WCHAR_T__ 4
// AARCH64-DARWIN: #define __SIZEOF_WINT_T__ 4
// AARCH64-DARWIN: #define __SIZE_MAX__ 18446744073709551615UL
// AARCH64-DARWIN: #define __SIZE_TYPE__ long unsigned int
// AARCH64-DARWIN: #define __SIZE_WIDTH__ 64
// AARCH64-DARWIN: #define __UINT16_C_SUFFIX__
// AARCH64-DARWIN: #define __UINT16_MAX__ 65535
// AARCH64-DARWIN: #define __UINT16_TYPE__ unsigned short
// AARCH64-DARWIN: #define __UINT32_C_SUFFIX__ U
// AARCH64-DARWIN: #define __UINT32_MAX__ 4294967295U
// AARCH64-DARWIN: #define __UINT32_TYPE__ unsigned int
// AARCH64-DARWIN: #define __UINT64_C_SUFFIX__ ULL
// AARCH64-DARWIN: #define __UINT64_MAX__ 18446744073709551615ULL
// AARCH64-DARWIN: #define __UINT64_TYPE__ long long unsigned int
// AARCH64-DARWIN: #define __UINT8_C_SUFFIX__
// AARCH64-DARWIN: #define __UINT8_MAX__ 255
// AARCH64-DARWIN: #define __UINT8_TYPE__ unsigned char
// AARCH64-DARWIN: #define __UINTMAX_C_SUFFIX__ UL
// AARCH64-DARWIN: #define __UINTMAX_MAX__ 18446744073709551615UL
// AARCH64-DARWIN: #define __UINTMAX_TYPE__ long unsigned int
// AARCH64-DARWIN: #define __UINTMAX_WIDTH__ 64
// AARCH64-DARWIN: #define __UINTPTR_MAX__ 18446744073709551615UL
// AARCH64-DARWIN: #define __UINTPTR_TYPE__ long unsigned int
// AARCH64-DARWIN: #define __UINTPTR_WIDTH__ 64
// AARCH64-DARWIN: #define __UINT_FAST16_MAX__ 65535
// AARCH64-DARWIN: #define __UINT_FAST16_TYPE__ unsigned short
// AARCH64-DARWIN: #define __UINT_FAST32_MAX__ 4294967295U
// AARCH64-DARWIN: #define __UINT_FAST32_TYPE__ unsigned int
// AARCH64-DARWIN: #define __UINT_FAST64_MAX__ 18446744073709551615ULL
// AARCH64-DARWIN: #define __UINT_FAST64_TYPE__ long long unsigned int
// AARCH64-DARWIN: #define __UINT_FAST8_MAX__ 255
// AARCH64-DARWIN: #define __UINT_FAST8_TYPE__ unsigned char
// AARCH64-DARWIN: #define __UINT_LEAST16_MAX__ 65535
// AARCH64-DARWIN: #define __UINT_LEAST16_TYPE__ unsigned short
// AARCH64-DARWIN: #define __UINT_LEAST32_MAX__ 4294967295U
// AARCH64-DARWIN: #define __UINT_LEAST32_TYPE__ unsigned int
// AARCH64-DARWIN: #define __UINT_LEAST64_MAX__ 18446744073709551615ULL
// AARCH64-DARWIN: #define __UINT_LEAST64_TYPE__ long long unsigned int
// AARCH64-DARWIN: #define __UINT_LEAST8_MAX__ 255
// AARCH64-DARWIN: #define __UINT_LEAST8_TYPE__ unsigned char
// AARCH64-DARWIN: #define __USER_LABEL_PREFIX__ _
// AARCH64-DARWIN: #define __WCHAR_MAX__ 2147483647
// AARCH64-DARWIN: #define __WCHAR_TYPE__ int
// AARCH64-DARWIN-NOT: #define __WCHAR_UNSIGNED__
// AARCH64-DARWIN: #define __WCHAR_WIDTH__ 32
// AARCH64-DARWIN: #define __WINT_TYPE__ int
// AARCH64-DARWIN: #define __WINT_WIDTH__ 32
// AARCH64-DARWIN: #define __aarch64__ 1
// RUN: %clang_cc1 -E -dM -triple=aarch64-apple-ios7.0 -x c++ < /dev/null | FileCheck -match-full-lines -check-prefix AARCH64-DARWIN-CXX %s
// AARCH64-DARWIN-CXX: #define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 16UL
// RUN: %clang_cc1 -E -dM -ffreestanding -triple=aarch64-windows-msvc < /dev/null | FileCheck -match-full-lines -check-prefix AARCH64-MSVC %s
// AARCH64-MSVC: #define _INTEGRAL_MAX_BITS 64
// AARCH64-MSVC-NOT: #define _LP64 1
// AARCH64-MSVC: #define _M_ARM64 1
// AARCH64-MSVC: #define _WIN32 1
// AARCH64-MSVC: #define _WIN64 1
// AARCH64-MSVC: #define __AARCH64EL__ 1
// AARCH64-MSVC: #define __ARM_64BIT_STATE 1
// AARCH64-MSVC: #define __ARM_ACLE 200
// AARCH64-MSVC: #define __ARM_ALIGN_MAX_STACK_PWR 4
// AARCH64-MSVC: #define __ARM_ARCH 8
// AARCH64-MSVC: #define __ARM_ARCH_ISA_A64 1
// AARCH64-MSVC: #define __ARM_ARCH_PROFILE 'A'
// AARCH64-MSVC: #define __ARM_FEATURE_CLZ 1
// AARCH64-MSVC: #define __ARM_FEATURE_DIRECTED_ROUNDING 1
// AARCH64-MSVC: #define __ARM_FEATURE_DIV 1
// AARCH64-MSVC: #define __ARM_FEATURE_FMA 1
// AARCH64-MSVC: #define __ARM_FEATURE_IDIV 1
// AARCH64-MSVC: #define __ARM_FEATURE_LDREX 0xF
// AARCH64-MSVC: #define __ARM_FEATURE_NUMERIC_MAXMIN 1
// AARCH64-MSVC: #define __ARM_FEATURE_UNALIGNED 1
// AARCH64-MSVC: #define __ARM_FP 0xE
// AARCH64-MSVC: #define __ARM_FP16_ARGS 1
// AARCH64-MSVC: #define __ARM_FP16_FORMAT_IEEE 1
// AARCH64-MSVC: #define __ARM_PCS_AAPCS64 1
// AARCH64-MSVC: #define __ARM_SIZEOF_MINIMAL_ENUM 4
// AARCH64-MSVC: #define __ARM_SIZEOF_WCHAR_T 4
// AARCH64-MSVC: #define __BIGGEST_ALIGNMENT__ 16
// AARCH64-MSVC: #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
// AARCH64-MSVC: #define __CHAR16_TYPE__ unsigned short
// AARCH64-MSVC: #define __CHAR32_TYPE__ unsigned int
// AARCH64-MSVC: #define __CHAR_BIT__ 8
// AARCH64-MSVC: #define __CONSTANT_CFSTRINGS__ 1
// AARCH64-MSVC: #define __DBL_DECIMAL_DIG__ 17
// AARCH64-MSVC: #define __DBL_DENORM_MIN__ 4.9406564584124654e-324
// AARCH64-MSVC: #define __DBL_DIG__ 15
// AARCH64-MSVC: #define __DBL_EPSILON__ 2.2204460492503131e-16
// AARCH64-MSVC: #define __DBL_HAS_DENORM__ 1
// AARCH64-MSVC: #define __DBL_HAS_INFINITY__ 1
// AARCH64-MSVC: #define __DBL_HAS_QUIET_NAN__ 1
// AARCH64-MSVC: #define __DBL_MANT_DIG__ 53
// AARCH64-MSVC: #define __DBL_MAX_10_EXP__ 308
// AARCH64-MSVC: #define __DBL_MAX_EXP__ 1024
// AARCH64-MSVC: #define __DBL_MAX__ 1.7976931348623157e+308
// AARCH64-MSVC: #define __DBL_MIN_10_EXP__ (-307)
// AARCH64-MSVC: #define __DBL_MIN_EXP__ (-1021)
// AARCH64-MSVC: #define __DBL_MIN__ 2.2250738585072014e-308
// AARCH64-MSVC: #define __DECIMAL_DIG__ __LDBL_DECIMAL_DIG__
// AARCH64-MSVC: #define __FINITE_MATH_ONLY__ 0
// AARCH64-MSVC: #define __FLT_DECIMAL_DIG__ 9
// AARCH64-MSVC: #define __FLT_DENORM_MIN__ 1.40129846e-45F
// AARCH64-MSVC: #define __FLT_DIG__ 6
// AARCH64-MSVC: #define __FLT_EPSILON__ 1.19209290e-7F
// AARCH64-MSVC: #define __FLT_HAS_DENORM__ 1
// AARCH64-MSVC: #define __FLT_HAS_INFINITY__ 1
// AARCH64-MSVC: #define __FLT_HAS_QUIET_NAN__ 1
// AARCH64-MSVC: #define __FLT_MANT_DIG__ 24
// AARCH64-MSVC: #define __FLT_MAX_10_EXP__ 38
// AARCH64-MSVC: #define __FLT_MAX_EXP__ 128
// AARCH64-MSVC: #define __FLT_MAX__ 3.40282347e+38F
// AARCH64-MSVC: #define __FLT_MIN_10_EXP__ (-37)
// AARCH64-MSVC: #define __FLT_MIN_EXP__ (-125)
// AARCH64-MSVC: #define __FLT_MIN__ 1.17549435e-38F
// AARCH64-MSVC: #define __FLT_RADIX__ 2
// AARCH64-MSVC: #define __INT_MAX__ 2147483647
// AARCH64-MSVC: #define __LDBL_DECIMAL_DIG__ 17
// AARCH64-MSVC: #define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L
// AARCH64-MSVC: #define __LDBL_DIG__ 15
// AARCH64-MSVC: #define __LDBL_EPSILON__ 2.2204460492503131e-16L
// AARCH64-MSVC: #define __LDBL_HAS_DENORM__ 1
// AARCH64-MSVC: #define __LDBL_HAS_INFINITY__ 1
// AARCH64-MSVC: #define __LDBL_HAS_QUIET_NAN__ 1
// AARCH64-MSVC: #define __LDBL_MANT_DIG__ 53
// AARCH64-MSVC: #define __LDBL_MAX_10_EXP__ 308
// AARCH64-MSVC: #define __LDBL_MAX_EXP__ 1024
// AARCH64-MSVC: #define __LDBL_MAX__ 1.7976931348623157e+308L
// AARCH64-MSVC: #define __LDBL_MIN_10_EXP__ (-307)
// AARCH64-MSVC: #define __LDBL_MIN_EXP__ (-1021)
// AARCH64-MSVC: #define __LDBL_MIN__ 2.2250738585072014e-308L
// AARCH64-MSVC: #define __LITTLE_ENDIAN__ 1
// AARCH64-MSVC: #define __LONG_LONG_MAX__ 9223372036854775807LL
// AARCH64-MSVC: #define __LONG_MAX__ 2147483647L
// AARCH64-MSVC-NOT: #define __LP64__ 1
// AARCH64-MSVC: #define __NO_INLINE__ 1
// AARCH64-MSVC: #define __OBJC_BOOL_IS_BOOL 0
// AARCH64-MSVC: #define __ORDER_BIG_ENDIAN__ 4321
// AARCH64-MSVC: #define __ORDER_LITTLE_ENDIAN__ 1234
// AARCH64-MSVC: #define __ORDER_PDP_ENDIAN__ 3412
// AARCH64-MSVC: #define __POINTER_WIDTH__ 64
// AARCH64-MSVC: #define __PRAGMA_REDEFINE_EXTNAME 1
// AARCH64-MSVC: #define __SCHAR_MAX__ 127
// AARCH64-MSVC: #define __SHRT_MAX__ 32767
// AARCH64-MSVC: #define __SIG_ATOMIC_MAX__ 2147483647
// AARCH64-MSVC: #define __SIG_ATOMIC_WIDTH__ 32
// AARCH64-MSVC: #define __SIZEOF_DOUBLE__ 8
// AARCH64-MSVC: #define __SIZEOF_FLOAT__ 4
// AARCH64-MSVC: #define __SIZEOF_INT128__ 16
// AARCH64-MSVC: #define __SIZEOF_INT__ 4
// AARCH64-MSVC: #define __SIZEOF_LONG_DOUBLE__ 8
// AARCH64-MSVC: #define __SIZEOF_LONG_LONG__ 8
// AARCH64-MSVC: #define __SIZEOF_LONG__ 4
// AARCH64-MSVC: #define __SIZEOF_POINTER__ 8
// AARCH64-MSVC: #define __SIZEOF_PTRDIFF_T__ 8
// AARCH64-MSVC: #define __SIZEOF_SHORT__ 2
// AARCH64-MSVC: #define __SIZEOF_SIZE_T__ 8
// AARCH64-MSVC: #define __SIZEOF_WCHAR_T__ 2
// AARCH64-MSVC: #define __SIZEOF_WINT_T__ 2
// AARCH64-MSVC: #define __SIZE_MAX__ 18446744073709551615ULL
// AARCH64-MSVC: #define __SIZE_TYPE__ long long unsigned int
// AARCH64-MSVC: #define __SIZE_WIDTH__ 64
// AARCH64-MSVC: #define __STDC_HOSTED__ 0
// AARCH64-MSVC: #define __STDC_UTF_16__ 1
// AARCH64-MSVC: #define __STDC_UTF_32__ 1
// AARCH64-MSVC: #define __STDC_VERSION__ 201710L
// AARCH64-MSVC: #define __STDC__ 1
// AARCH64-MSVC: #define __UINT16_C_SUFFIX__
// AARCH64-MSVC: #define __UINT16_MAX__ 65535
// AARCH64-MSVC: #define __UINT16_TYPE__ unsigned short
// AARCH64-MSVC: #define __UINT32_C_SUFFIX__ U
// AARCH64-MSVC: #define __UINT32_MAX__ 4294967295U
// AARCH64-MSVC: #define __UINT32_TYPE__ unsigned int
// AARCH64-MSVC: #define __UINT64_C_SUFFIX__ ULL
// AARCH64-MSVC: #define __UINT64_MAX__ 18446744073709551615ULL
// AARCH64-MSVC: #define __UINT64_TYPE__ long long unsigned int
// AARCH64-MSVC: #define __UINT8_C_SUFFIX__
// AARCH64-MSVC: #define __UINT8_MAX__ 255
// AARCH64-MSVC: #define __UINT8_TYPE__ unsigned char
// AARCH64-MSVC: #define __UINTMAX_C_SUFFIX__ ULL
// AARCH64-MSVC: #define __UINTMAX_MAX__ 18446744073709551615ULL
// AARCH64-MSVC: #define __UINTMAX_TYPE__ long long unsigned int
// AARCH64-MSVC: #define __UINTMAX_WIDTH__ 64
// AARCH64-MSVC: #define __UINTPTR_MAX__ 18446744073709551615ULL
// AARCH64-MSVC: #define __UINTPTR_TYPE__ long long unsigned int
// AARCH64-MSVC: #define __UINTPTR_WIDTH__ 64
// AARCH64-MSVC: #define __UINT_FAST16_MAX__ 65535
// AARCH64-MSVC: #define __UINT_FAST16_TYPE__ unsigned short
// AARCH64-MSVC: #define __UINT_FAST32_MAX__ 4294967295U
// AARCH64-MSVC: #define __UINT_FAST32_TYPE__ unsigned int
// AARCH64-MSVC: #define __UINT_FAST64_MAX__ 18446744073709551615ULL
// AARCH64-MSVC: #define __UINT_FAST64_TYPE__ long long unsigned int
// AARCH64-MSVC: #define __UINT_FAST8_MAX__ 255
// AARCH64-MSVC: #define __UINT_FAST8_TYPE__ unsigned char
// AARCH64-MSVC: #define __UINT_LEAST16_MAX__ 65535
// AARCH64-MSVC: #define __UINT_LEAST16_TYPE__ unsigned short
// AARCH64-MSVC: #define __UINT_LEAST32_MAX__ 4294967295U
// AARCH64-MSVC: #define __UINT_LEAST32_TYPE__ unsigned int
// AARCH64-MSVC: #define __UINT_LEAST64_MAX__ 18446744073709551615ULL
// AARCH64-MSVC: #define __UINT_LEAST64_TYPE__ long long unsigned int
// AARCH64-MSVC: #define __UINT_LEAST8_MAX__ 255
// AARCH64-MSVC: #define __UINT_LEAST8_TYPE__ unsigned char
// AARCH64-MSVC: #define __USER_LABEL_PREFIX__
// AARCH64-MSVC: #define __WCHAR_MAX__ 65535
// AARCH64-MSVC: #define __WCHAR_TYPE__ unsigned short
// AARCH64-MSVC: #define __WCHAR_UNSIGNED__ 1
// AARCH64-MSVC: #define __WCHAR_WIDTH__ 16
// AARCH64-MSVC: #define __WINT_TYPE__ unsigned short
// AARCH64-MSVC: #define __WINT_WIDTH__ 16
// AARCH64-MSVC: #define __aarch64__ 1
// RUN: %clang_cc1 -triple=aarch64 -E -dM -mcmodel=small -xc /dev/null | FileCheck --check-prefix=CMODEL_SMALL %s
// RUN: %clang_cc1 -triple=aarch64 -E -dM -mcmodel=tiny -xc /dev/null | FileCheck --check-prefix=CMODEL_TINY %s
// RUN: %clang_cc1 -triple=aarch64 -E -dM -mcmodel=large -xc /dev/null | FileCheck --check-prefix=CMODEL_LARGE %s
// CMODEL_TINY: #define __AARCH64_CMODEL_TINY__ 1
// CMODEL_SMALL: #define __AARCH64_CMODEL_SMALL__ 1
// CMODEL_LARGE: #define __AARCH64_CMODEL_LARGE__ 1
|
the_stack_data/433380.c | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <CL/cl.h>
unsigned char *read_buffer(char *file_name, size_t *size_ptr)
{
FILE *f;
unsigned char *buf;
size_t size;
/* Open file */
f = fopen(file_name, "rb");
if (!f)
return NULL;
/* Obtain file size */
fseek(f, 0, SEEK_END);
size = ftell(f);
fseek(f, 0, SEEK_SET);
/* Allocate and read buffer */
buf = malloc(size + 1);
fread(buf, 1, size, f);
buf[size] = '\0';
/* Return size of buffer */
if (size_ptr)
*size_ptr = size;
/* Return buffer */
return buf;
}
void write_buffer(char *file_name, const char *buffer, size_t buffer_size)
{
FILE *f;
/* Open file */
f = fopen(file_name, "w+");
/* Write buffer */
if(buffer)
fwrite(buffer, 1, buffer_size, f);
/* Close file */
fclose(f);
}
int main(int argc, char const *argv[])
{
/* Get platform */
cl_platform_id platform;
cl_uint num_platforms;
cl_int ret = clGetPlatformIDs(1, &platform, &num_platforms);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clGetPlatformIDs' failed\n");
exit(1);
}
printf("Number of platforms: %d\n", num_platforms);
printf("platform=%p\n", platform);
/* Get platform name */
char platform_name[100];
ret = clGetPlatformInfo(platform, CL_PLATFORM_NAME, sizeof(platform_name), platform_name, NULL);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clGetPlatformInfo' failed\n");
exit(1);
}
printf("platform.name='%s'\n\n", platform_name);
/* Get device */
cl_device_id device;
cl_uint num_devices;
ret = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 1, &device, &num_devices);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clGetDeviceIDs' failed\n");
exit(1);
}
printf("Number of devices: %d\n", num_devices);
printf("device=%p\n", device);
/* Get device name */
char device_name[100];
ret = clGetDeviceInfo(device, CL_DEVICE_NAME, sizeof(device_name),
device_name, NULL);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clGetDeviceInfo' failed\n");
exit(1);
}
printf("device.name='%s'\n", device_name);
printf("\n");
/* Create a Context Object */
cl_context context;
context = clCreateContext(NULL, 1, &device, NULL, NULL, &ret);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clCreateContext' failed\n");
exit(1);
}
printf("context=%p\n", context);
/* Create a Command Queue Object*/
cl_command_queue command_queue;
command_queue = clCreateCommandQueue(context, device, 0, &ret);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clCreateCommandQueue' failed\n");
exit(1);
}
printf("command_queue=%p\n", command_queue);
printf("\n");
/* Program source */
unsigned char *source_code;
size_t source_length;
/* Read program from 'unary_minus_ushort8.cl' */
source_code = read_buffer("unary_minus_ushort8.cl", &source_length);
/* Create a program */
cl_program program;
program = clCreateProgramWithSource(context, 1, (const char **)&source_code, &source_length, &ret);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clCreateProgramWithSource' failed\n");
exit(1);
}
printf("program=%p\n", program);
/* Build program */
ret = clBuildProgram(program, 1, &device, NULL, NULL, NULL);
if (ret != CL_SUCCESS )
{
size_t size;
char *log;
/* Get log size */
clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG,0, NULL, &size);
/* Allocate log and print */
log = malloc(size);
clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG,size, log, NULL);
printf("error: call to 'clBuildProgram' failed:\n%s\n", log);
/* Free log and exit */
free(log);
exit(1);
}
printf("program built\n");
printf("\n");
/* Create a Kernel Object */
cl_kernel kernel;
kernel = clCreateKernel(program, "unary_minus_ushort8", &ret);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clCreateKernel' failed\n");
exit(1);
}
/* Create and allocate host buffers */
size_t num_elem = 10;
/* Create and init host side src buffer 0 */
cl_ushort8 *src_0_host_buffer;
src_0_host_buffer = malloc(num_elem * sizeof(cl_ushort8));
for (int i = 0; i < num_elem; i++)
src_0_host_buffer[i] = (cl_ushort8){{2, 2, 2, 2, 2, 2, 2, 2}};
/* Create and init device side src buffer 0 */
cl_mem src_0_device_buffer;
src_0_device_buffer = clCreateBuffer(context, CL_MEM_READ_ONLY, num_elem * sizeof(cl_ushort8), NULL, &ret);
if (ret != CL_SUCCESS)
{
printf("error: could not create source buffer\n");
exit(1);
}
ret = clEnqueueWriteBuffer(command_queue, src_0_device_buffer, CL_TRUE, 0, num_elem * sizeof(cl_ushort8), src_0_host_buffer, 0, NULL, NULL);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clEnqueueWriteBuffer' failed\n");
exit(1);
}
/* Create host dst buffer */
cl_ushort8 *dst_host_buffer;
dst_host_buffer = malloc(num_elem * sizeof(cl_ushort8));
memset((void *)dst_host_buffer, 1, num_elem * sizeof(cl_ushort8));
/* Create device dst buffer */
cl_mem dst_device_buffer;
dst_device_buffer = clCreateBuffer(context, CL_MEM_WRITE_ONLY, num_elem *sizeof(cl_ushort8), NULL, &ret);
if (ret != CL_SUCCESS)
{
printf("error: could not create dst buffer\n");
exit(1);
}
/* Set kernel arguments */
ret = CL_SUCCESS;
ret |= clSetKernelArg(kernel, 0, sizeof(cl_mem), &src_0_device_buffer);
ret |= clSetKernelArg(kernel, 1, sizeof(cl_mem), &dst_device_buffer);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clSetKernelArg' failed\n");
exit(1);
}
/* Launch the kernel */
size_t global_work_size = num_elem;
size_t local_work_size = num_elem;
ret = clEnqueueNDRangeKernel(command_queue, kernel, 1, NULL, &global_work_size, &local_work_size, 0, NULL, NULL);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clEnqueueNDRangeKernel' failed\n");
exit(1);
}
/* Wait for it to finish */
clFinish(command_queue);
/* Read results from GPU */
ret = clEnqueueReadBuffer(command_queue, dst_device_buffer, CL_TRUE,0, num_elem * sizeof(cl_ushort8), dst_host_buffer, 0, NULL, NULL);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clEnqueueReadBuffer' failed\n");
exit(1);
}
/* Dump dst buffer to file */
char dump_file[100];
sprintf((char *)&dump_file, "%s.result", argv[0]);
write_buffer(dump_file, (const char *)dst_host_buffer, num_elem * sizeof(cl_ushort8));
printf("Result dumped to %s\n", dump_file);
/* Free host dst buffer */
free(dst_host_buffer);
/* Free device dst buffer */
ret = clReleaseMemObject(dst_device_buffer);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clReleaseMemObject' failed\n");
exit(1);
}
/* Free host side src buffer 0 */
free(src_0_host_buffer);
/* Free device side src buffer 0 */
ret = clReleaseMemObject(src_0_device_buffer);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clReleaseMemObject' failed\n");
exit(1);
}
/* Release kernel */
ret = clReleaseKernel(kernel);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clReleaseKernel' failed\n");
exit(1);
}
/* Release program */
ret = clReleaseProgram(program);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clReleaseProgram' failed\n");
exit(1);
}
/* Release command queue */
ret = clReleaseCommandQueue(command_queue);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clReleaseCommandQueue' failed\n");
exit(1);
}
/* Release context */
ret = clReleaseContext(context);
if (ret != CL_SUCCESS)
{
printf("error: call to 'clReleaseContext' failed\n");
exit(1);
}
return 0;
} |
the_stack_data/132855.c | #include <stdlib.h>
int main()
{
char *p = malloc(100);
assert(p); // should fail, given the malloc-may-fail option
}
|
the_stack_data/220455387.c | #include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#define MAX_N 50000000
typedef struct {
int *arr;
int num;
} Arr_Num;
int n, v[MAX_N], step;
Arr_Num *an_list[MAX_N];
pthread_t tid[MAX_N], tid2[MAX_N];
pthread_mutex_t mutex;
int cmp(const void *a, const void *b) {
return *(int*)a - *(int*)b;
}
int min(int a, int b) {
return a < b ? a : b;
}
int _ceil(int a, int b) {
if (a % b == 0) {
return a / b;
}
else {
return a / b + 1;
}
}
void *sort(void *arg) {
pthread_mutex_lock(&mutex);
long idx = (long)arg;
printf("Handling elements:\n");
int *_arr = an_list[idx]->arr, _num = an_list[idx]->num;
for (int i = 0; i < _num; i++) {
printf("%d%s", _arr[i], i+1 == _num ? "\n" : " ");
}
printf("Sorted %d elements.\n", _num);
pthread_mutex_unlock(&mutex);
qsort(_arr, _num, sizeof(int), cmp);
return (void*)0;
}
void *merge(void *arg) {
long L = (long)arg, R = L + step/2;
int nl = an_list[L]->num, nr = an_list[R]->num, total = nl + nr;
int dup = 0;
int i = 0, il = 0, ir = 0;
int *tmp = (int*)malloc(sizeof(int)*total);
while (i < total && il < nl && ir < nr) {
int d = an_list[L]->arr[il] - an_list[R]->arr[ir];
if (d <= 0) {
tmp[i++] = an_list[L]->arr[il++];
if (d == 0) {
dup++;
}
}
else if (d > 0) {
tmp[i++] = an_list[R]->arr[ir++];
}
}
while (il < nl) {
tmp[i++] = an_list[L]->arr[il++];
}
while (ir < nr) {
tmp[i++] = an_list[R]->arr[ir++];
}
pthread_mutex_lock(&mutex);
printf("Handling elements:\n");
for (int i = 0; i < total; i++) {
printf("%d%s", an_list[L]->arr[i], i+1 == total ? "\n" : " ");
}
printf("Merged %d and %d elements with %d duplicates.\n", nl, nr, dup);
pthread_mutex_unlock(&mutex);
an_list[L]->num = total;
for (int i = 0; i < total; i++) {
an_list[L]->arr[i] = tmp[i];
}
free(tmp);
return (void*)0;
}
int main(int argc, char *argv[]) {
if (argc != 2) {
printf("Usage: ./merger [segment_size]\n");
return -1;
}
int seg_size = atoi(argv[1]);
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &v[i]);
}
int thr_num = _ceil(n, seg_size);
for (int i = 0; i < thr_num; i++) {
an_list[i] = (Arr_Num*)malloc(sizeof(Arr_Num));
an_list[i]->arr = v + i*seg_size;
an_list[i]->num = min(seg_size, n - i*seg_size);
}
pthread_mutex_init(&mutex, NULL);
for (long i = 0; i < thr_num; i++) {
pthread_create(&tid[i], NULL, sort, (void*)i);
}
for (long i = 0; i < thr_num; i++) {
pthread_join(tid[i], NULL);
}
step = 2;
int cnt = thr_num;
while (cnt > 1) {
int round = cnt / 2;
for (long i = 0; i < round; i++) {
pthread_create(&tid2[i], NULL, merge, (void*)(i * step));
}
for (long i = 0; i < round; i++) {
pthread_join(tid2[i], NULL);
}
cnt -= round;
step *= 2;
}
for (int i = 0; i < n; i++) {
printf("%d%s", v[i], i+1 == n ? "\n" : " ");
}
printf("\n");
for (int i = 0; i < thr_num; i++) {
free(an_list[i]);
}
pthread_mutex_destroy(&mutex);
return 0;
}
|
the_stack_data/74368.c | // BUG: unable to handle kernel paging request in insert_char
// https://syzkaller.appspot.com/bug?id=320c74e7566b5327120cbfc28f7fee369caf84e4
// status:open
// autogenerated by syzkaller (https://github.com/google/syzkaller)
#define _GNU_SOURCE
#include <arpa/inet.h>
#include <endian.h>
#include <fcntl.h>
#include <net/if.h>
#include <netinet/in.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
#include <sched.h>
#include <linux/genetlink.h>
#include <linux/if_addr.h>
#include <linux/if_link.h>
#include <linux/in6.h>
#include <linux/neighbour.h>
#include <linux/net.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <linux/veth.h>
struct nlmsg {
char* pos;
int nesting;
struct nlattr* nested[8];
char buf[1024];
};
static struct nlmsg nlmsg;
static void netlink_init(struct nlmsg* nlmsg, int typ, int flags,
const void* data, int size)
{
memset(nlmsg, 0, sizeof(*nlmsg));
struct nlmsghdr* hdr = (struct nlmsghdr*)nlmsg->buf;
hdr->nlmsg_type = typ;
hdr->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK | flags;
memcpy(hdr + 1, data, size);
nlmsg->pos = (char*)(hdr + 1) + NLMSG_ALIGN(size);
}
static void netlink_attr(struct nlmsg* nlmsg, int typ, const void* data,
int size)
{
struct nlattr* attr = (struct nlattr*)nlmsg->pos;
attr->nla_len = sizeof(*attr) + size;
attr->nla_type = typ;
memcpy(attr + 1, data, size);
nlmsg->pos += NLMSG_ALIGN(attr->nla_len);
}
static int netlink_send_ext(struct nlmsg* nlmsg, int sock, uint16_t reply_type,
int* reply_len)
{
if (nlmsg->pos > nlmsg->buf + sizeof(nlmsg->buf) || nlmsg->nesting)
exit(1);
struct nlmsghdr* hdr = (struct nlmsghdr*)nlmsg->buf;
hdr->nlmsg_len = nlmsg->pos - nlmsg->buf;
struct sockaddr_nl addr;
memset(&addr, 0, sizeof(addr));
addr.nl_family = AF_NETLINK;
unsigned n = sendto(sock, nlmsg->buf, hdr->nlmsg_len, 0,
(struct sockaddr*)&addr, sizeof(addr));
if (n != hdr->nlmsg_len)
exit(1);
n = recv(sock, nlmsg->buf, sizeof(nlmsg->buf), 0);
if (hdr->nlmsg_type == NLMSG_DONE) {
*reply_len = 0;
return 0;
}
if (n < sizeof(struct nlmsghdr))
exit(1);
if (reply_len && hdr->nlmsg_type == reply_type) {
*reply_len = n;
return 0;
}
if (n < sizeof(struct nlmsghdr) + sizeof(struct nlmsgerr))
exit(1);
if (hdr->nlmsg_type != NLMSG_ERROR)
exit(1);
return -((struct nlmsgerr*)(hdr + 1))->error;
}
static int netlink_send(struct nlmsg* nlmsg, int sock)
{
return netlink_send_ext(nlmsg, sock, 0, NULL);
}
static int netlink_next_msg(struct nlmsg* nlmsg, unsigned int offset,
unsigned int total_len)
{
struct nlmsghdr* hdr = (struct nlmsghdr*)(nlmsg->buf + offset);
if (offset == total_len || offset + hdr->nlmsg_len > total_len)
return -1;
return hdr->nlmsg_len;
}
static void netlink_device_change(struct nlmsg* nlmsg, int sock,
const char* name, bool up, const char* master,
const void* mac, int macsize,
const char* new_name)
{
struct ifinfomsg hdr;
memset(&hdr, 0, sizeof(hdr));
if (up)
hdr.ifi_flags = hdr.ifi_change = IFF_UP;
hdr.ifi_index = if_nametoindex(name);
netlink_init(nlmsg, RTM_NEWLINK, 0, &hdr, sizeof(hdr));
if (new_name)
netlink_attr(nlmsg, IFLA_IFNAME, new_name, strlen(new_name));
if (master) {
int ifindex = if_nametoindex(master);
netlink_attr(nlmsg, IFLA_MASTER, &ifindex, sizeof(ifindex));
}
if (macsize)
netlink_attr(nlmsg, IFLA_ADDRESS, mac, macsize);
int err = netlink_send(nlmsg, sock);
(void)err;
}
const int kInitNetNsFd = 239;
#define DEVLINK_FAMILY_NAME "devlink"
#define DEVLINK_CMD_PORT_GET 5
#define DEVLINK_CMD_RELOAD 37
#define DEVLINK_ATTR_BUS_NAME 1
#define DEVLINK_ATTR_DEV_NAME 2
#define DEVLINK_ATTR_NETDEV_NAME 7
#define DEVLINK_ATTR_NETNS_FD 138
static int netlink_devlink_id_get(struct nlmsg* nlmsg, int sock)
{
struct genlmsghdr genlhdr;
struct nlattr* attr;
int err, n;
uint16_t id = 0;
memset(&genlhdr, 0, sizeof(genlhdr));
genlhdr.cmd = CTRL_CMD_GETFAMILY;
netlink_init(nlmsg, GENL_ID_CTRL, 0, &genlhdr, sizeof(genlhdr));
netlink_attr(nlmsg, CTRL_ATTR_FAMILY_NAME, DEVLINK_FAMILY_NAME,
strlen(DEVLINK_FAMILY_NAME) + 1);
err = netlink_send_ext(nlmsg, sock, GENL_ID_CTRL, &n);
if (err) {
return -1;
}
attr = (struct nlattr*)(nlmsg->buf + NLMSG_HDRLEN +
NLMSG_ALIGN(sizeof(genlhdr)));
for (; (char*)attr < nlmsg->buf + n;
attr = (struct nlattr*)((char*)attr + NLMSG_ALIGN(attr->nla_len))) {
if (attr->nla_type == CTRL_ATTR_FAMILY_ID) {
id = *(uint16_t*)(attr + 1);
break;
}
}
if (!id) {
return -1;
}
recv(sock, nlmsg->buf, sizeof(nlmsg->buf), 0); /* recv ack */
return id;
}
static void netlink_devlink_netns_move(const char* bus_name,
const char* dev_name, int netns_fd)
{
struct genlmsghdr genlhdr;
int sock;
int id, err;
sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (sock == -1)
exit(1);
id = netlink_devlink_id_get(&nlmsg, sock);
if (id == -1)
goto error;
memset(&genlhdr, 0, sizeof(genlhdr));
genlhdr.cmd = DEVLINK_CMD_RELOAD;
netlink_init(&nlmsg, id, 0, &genlhdr, sizeof(genlhdr));
netlink_attr(&nlmsg, DEVLINK_ATTR_BUS_NAME, bus_name, strlen(bus_name) + 1);
netlink_attr(&nlmsg, DEVLINK_ATTR_DEV_NAME, dev_name, strlen(dev_name) + 1);
netlink_attr(&nlmsg, DEVLINK_ATTR_NETNS_FD, &netns_fd, sizeof(netns_fd));
err = netlink_send(&nlmsg, sock);
if (err) {
}
error:
close(sock);
}
static struct nlmsg nlmsg2;
static void initialize_devlink_ports(const char* bus_name, const char* dev_name,
const char* netdev_prefix)
{
struct genlmsghdr genlhdr;
int len, total_len, id, err, offset;
uint16_t netdev_index;
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (sock == -1)
exit(1);
int rtsock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
if (rtsock == -1)
exit(1);
id = netlink_devlink_id_get(&nlmsg, sock);
if (id == -1)
goto error;
memset(&genlhdr, 0, sizeof(genlhdr));
genlhdr.cmd = DEVLINK_CMD_PORT_GET;
netlink_init(&nlmsg, id, NLM_F_DUMP, &genlhdr, sizeof(genlhdr));
netlink_attr(&nlmsg, DEVLINK_ATTR_BUS_NAME, bus_name, strlen(bus_name) + 1);
netlink_attr(&nlmsg, DEVLINK_ATTR_DEV_NAME, dev_name, strlen(dev_name) + 1);
err = netlink_send_ext(&nlmsg, sock, id, &total_len);
if (err) {
goto error;
}
offset = 0;
netdev_index = 0;
while ((len = netlink_next_msg(&nlmsg, offset, total_len)) != -1) {
struct nlattr* attr = (struct nlattr*)(nlmsg.buf + offset + NLMSG_HDRLEN +
NLMSG_ALIGN(sizeof(genlhdr)));
for (; (char*)attr < nlmsg.buf + offset + len;
attr = (struct nlattr*)((char*)attr + NLMSG_ALIGN(attr->nla_len))) {
if (attr->nla_type == DEVLINK_ATTR_NETDEV_NAME) {
char* port_name;
char netdev_name[IFNAMSIZ];
port_name = (char*)(attr + 1);
snprintf(netdev_name, sizeof(netdev_name), "%s%d", netdev_prefix,
netdev_index);
netlink_device_change(&nlmsg2, rtsock, port_name, true, 0, 0, 0,
netdev_name);
break;
}
}
offset += len;
netdev_index++;
}
error:
close(rtsock);
close(sock);
}
static void initialize_devlink_pci(void)
{
int netns = open("/proc/self/ns/net", O_RDONLY);
if (netns == -1)
exit(1);
int ret = setns(kInitNetNsFd, 0);
if (ret == -1)
exit(1);
netlink_devlink_netns_move("pci", "0000:00:10.0", netns);
ret = setns(netns, 0);
if (ret == -1)
exit(1);
close(netns);
initialize_devlink_ports("pci", "0000:00:10.0", "netpci");
}
static long syz_open_dev(volatile long a0, volatile long a1, volatile long a2)
{
if (a0 == 0xc || a0 == 0xb) {
char buf[128];
sprintf(buf, "/dev/%s/%d:%d", a0 == 0xc ? "char" : "block", (uint8_t)a1,
(uint8_t)a2);
return open(buf, O_RDWR, 0);
} else {
char buf[1024];
char* hash;
strncpy(buf, (char*)a0, sizeof(buf) - 1);
buf[sizeof(buf) - 1] = 0;
while ((hash = strchr(buf, '#'))) {
*hash = '0' + (char)(a1 % 10);
a1 /= 10;
}
return open(buf, a2, 0);
}
}
uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff};
int main(void)
{
syscall(__NR_mmap, 0x20000000ul, 0x1000000ul, 3ul, 0x32ul, -1, 0);
intptr_t res = 0;
memcpy((void*)0x20000180, "/dev/fb0\000", 9);
res = syscall(__NR_openat, 0xffffffffffffff9cul, 0x20000180ul, 0ul, 0ul);
if (res != -1)
r[0] = res;
*(uint32_t*)0x20000000 = 0;
*(uint32_t*)0x20000004 = 0;
*(uint32_t*)0x20000008 = 0;
*(uint32_t*)0x2000000c = 0;
*(uint32_t*)0x20000010 = 0;
*(uint32_t*)0x20000014 = 0;
*(uint32_t*)0x20000018 = 8;
*(uint32_t*)0x2000001c = 0;
*(uint32_t*)0x20000020 = 0;
*(uint32_t*)0x20000024 = 0;
*(uint32_t*)0x20000028 = 0;
*(uint32_t*)0x2000002c = 0;
*(uint32_t*)0x20000030 = 0;
*(uint32_t*)0x20000034 = 0;
*(uint32_t*)0x20000038 = 0;
*(uint32_t*)0x2000003c = 0;
*(uint32_t*)0x20000040 = 0;
*(uint32_t*)0x20000044 = 0;
*(uint32_t*)0x20000048 = 0;
*(uint32_t*)0x2000004c = 0;
*(uint32_t*)0x20000050 = 0;
*(uint32_t*)0x20000054 = 0;
*(uint32_t*)0x20000058 = 0;
*(uint32_t*)0x2000005c = 0;
*(uint32_t*)0x20000060 = 0;
*(uint32_t*)0x20000064 = 0;
*(uint32_t*)0x20000068 = 0;
*(uint32_t*)0x2000006c = 0;
*(uint32_t*)0x20000070 = 0;
*(uint32_t*)0x20000074 = 0;
*(uint32_t*)0x20000078 = 0;
*(uint32_t*)0x2000007c = 0;
*(uint32_t*)0x20000080 = 0;
*(uint32_t*)0x20000084 = 0;
*(uint32_t*)0x20000088 = 0;
*(uint32_t*)0x2000008c = 0;
*(uint32_t*)0x20000090 = 0;
*(uint32_t*)0x20000094 = 0;
*(uint32_t*)0x20000098 = 0;
*(uint32_t*)0x2000009c = 0;
syscall(__NR_ioctl, r[0], 0x4601ul, 0x20000000ul);
res = syz_open_dev(0xc, 4, 0x14);
if (res != -1)
r[1] = res;
*(uint8_t*)0x20000000 = 0xe;
*(uint8_t*)0x20000001 = 0x9b;
*(uint8_t*)0x20000002 = 0x3e;
*(uint8_t*)0x20000003 = 0x9b;
*(uint8_t*)0x20000004 = 0;
*(uint8_t*)0x20000005 = 0;
*(uint8_t*)0x20000006 = 0;
*(uint8_t*)0x20000007 = 0;
*(uint64_t*)0x20000008 = 0;
*(uint16_t*)0x20000010 = 0;
*(uint16_t*)0x20000012 = 0;
*(uint32_t*)0x20000014 = 0;
*(uint64_t*)0x20000018 = 0;
*(uint64_t*)0x20000020 = 0x40;
*(uint64_t*)0x20000028 = 0;
*(uint32_t*)0x20000030 = 0;
*(uint16_t*)0x20000034 = 0;
*(uint16_t*)0x20000036 = 0x38;
*(uint16_t*)0x20000038 = 0;
*(uint16_t*)0x2000003a = 0;
*(uint16_t*)0x2000003c = 0;
*(uint16_t*)0x2000003e = 0;
*(uint32_t*)0x20000040 = 0;
*(uint32_t*)0x20000044 = 0;
*(uint64_t*)0x20000048 = 0;
*(uint64_t*)0x20000050 = 0;
*(uint64_t*)0x20000058 = 0;
*(uint64_t*)0x20000060 = 0;
*(uint64_t*)0x20000068 = 0;
*(uint64_t*)0x20000070 = 0;
syscall(__NR_write, r[1], 0x20000000ul, 0x78ul);
return 0;
}
|
the_stack_data/234776.c | #include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main(){
char name[100];
printf("ENTER YOUR NAME -");
scanf("%[^\n]s" ,name);
int a,b,c=1,turns,p1=0,cpu=0;
printf("\nENTER THE NUMBER OF TURNS YOU WANT TO PLAY- ");
scanf("%d" ,&turns);
while(c<=turns){
c++;
printf("\nCHOOSE - (1)ROCK (2)PAPER (3)SCISSOR");
printf("\nYOUR CHOICE-");
scanf("%d" ,&a);
if(a>0 && a<=3){
if(a==1){
printf("\nVALID CHOICE - ROCK");
}
if(a==2){
printf("\nVALID CHOICE - PAPER");
}
if(a==3){
printf("\nVALID CHOICE - SCISSOR");
}
}
else{
printf("INVALID CHOICE");
}
srand(time(NULL));
b = rand()%2;
if(b==0){
printf("\nCPU CHOSE ROCK");
}
if(b==1){
printf("\nCPU CHOSE PAPER");
}
if(b==2){
printf("\nCPU CHOSE SCISSOR");
}
if(a==1 && b==0){
printf("\nDRAW");
}
if(a==2 && b==1){
printf("\nDRAW");
}
if(a==3 && b==2){
printf("\nDRAW");
}
if(a==1 && b==1){
printf("\nCPU WINS");
++cpu;
}
if(a==1 && b==2){
printf("\n%s WIN" ,name);
++p1;
}
if(a==2 && b==0){
printf("\n%s WIN" ,name);
++p1;
}
if(a==2 && b==2){
printf("\nCPU WINS");
++cpu;
}
if(a==3 && b==0){
printf("\nCPU WINS");
++cpu;
}
if(a==3 && b==1){
printf("\n%s WIN" ,name);
++p1;
}
}
if(p1>cpu){
printf("\n%s wins %d-%d" ,name,p1,cpu);
}
if(p1<cpu){
printf("\nCPU wins %d-%d" ,p1,cpu);
}
if(p1==cpu){
printf("\nTIE %d-%d" ,p1,cpu);
}
} |
the_stack_data/156393424.c | //===-- CBackend.cpp - Library for converting LLVM code to C --------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This code tests to see that the CBE will properly use a pointer to
// access an array.
// *TW
//
//===----------------------------------------------------------------------===//
int main() {
int *ip;
int a[2];
a[0] = 1;
a[1] = 6;
ip = &a[1];
return *ip;
}
|
the_stack_data/87637981.c | /* While Purchasing certain items, a discount of 10% is offered if the quantity
purchased is more than 1000. if quantity and price per item input through
the keyboard, write a program to claculate the total expenses. */
#include<stdio.h>
int main()
{
int qty, dis;
float rate, tot;
printf("Enter quantity and rate:");
scanf("%d%f", &qty, &rate);
if(qty>1000)
dis=10;
else
dis=0;
tot=(qty*rate)-(qty*rate*dis/100);
printf("Total expenses= Rs.%f\n",tot);
return 0;
}
/* OUTPUT: Enter quantity and rate: 1200 15.50
Total expenses= Rs.16740.000000 */
|
the_stack_data/67324737.c | // TExaS.c
// Runs on TM4C123
// Periodic timer interrupt data collection
// PLL turned on at 80 MHz
// Implements Logic Analyzer on Port B, D, or E
//
// Jonathan Valvano. Daniel Valvano
// August 29, 2018
/* This example accompanies the book
"Embedded Systems: Introduction to ARM Cortex M Microcontrollers",
ISBN: 978-1469998749, Jonathan Valvano, copyright (c) 2018
Copyright 2018 by Jonathan W. Valvano, [email protected]
You may use, edit, run or distribute this file
as long as the above copyright notice remains
THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
VALVANO SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL,
OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
For more information about my classes, my research, and my books, see
http://users.ece.utexas.edu/~valvano/
*/
// Timer5A periodic interrupt implements logic analyzer
void PLL_Init(void);
void UART0_Init(void);
volatile unsigned long *PortDataAddr; // pointer to data
//*****************************************************************************
//
// I/O ports so students do not have to include port header file
//
//*****************************************************************************
#define SYSCTL_RCGCGPIO_R (*((volatile unsigned long *)0x400FE608))
#define SYSCTL_RCGCTIMER_R (*((volatile unsigned long *)0x400FE604))
#define NVIC_PRI17_R (*((volatile unsigned long *)0xE000E444))
#define NVIC_PRI23_R (*((volatile unsigned long *)0xE000E45C))
#define NVIC_EN2_R (*((volatile unsigned long *)0xE000E108))
#define NVIC_DIS2_R (*((volatile unsigned long *)0xE000E188))
#define TIMER5_CFG_R (*((volatile unsigned long *)0x40035000))
#define TIMER5_TAMR_R (*((volatile unsigned long *)0x40035004))
#define TIMER5_TBMR_R (*((volatile unsigned long *)0x40035008))
#define TIMER5_CTL_R (*((volatile unsigned long *)0x4003500C))
#define TIMER5_SYNC_R (*((volatile unsigned long *)0x40035010))
#define TIMER5_IMR_R (*((volatile unsigned long *)0x40035018))
#define TIMER5_RIS_R (*((volatile unsigned long *)0x4003501C))
#define TIMER5_MIS_R (*((volatile unsigned long *)0x40035020))
#define TIMER5_ICR_R (*((volatile unsigned long *)0x40035024))
#define TIMER5_TAILR_R (*((volatile unsigned long *)0x40035028))
#define TIMER5_TBILR_R (*((volatile unsigned long *)0x4003502C))
#define TIMER5_TAMATCHR_R (*((volatile unsigned long *)0x40035030))
#define TIMER5_TBMATCHR_R (*((volatile unsigned long *)0x40035034))
#define TIMER5_TAPR_R (*((volatile unsigned long *)0x40035038))
#define TIMER5_TBPR_R (*((volatile unsigned long *)0x4003503C))
#define TIMER5_TAPMR_R (*((volatile unsigned long *)0x40035040))
#define TIMER5_TBPMR_R (*((volatile unsigned long *)0x40035044))
#define TIMER5_TAR_R (*((volatile unsigned long *)0x40035048))
#define TIMER5_TBR_R (*((volatile unsigned long *)0x4003504C))
#define TIMER5_TAV_R (*((volatile unsigned long *)0x40035050))
#define TIMER5_TBV_R (*((volatile unsigned long *)0x40035054))
#define TIMER5_RTCPD_R (*((volatile unsigned long *)0x40035058))
#define TIMER5_TAPS_R (*((volatile unsigned long *)0x4003505C))
#define TIMER5_TBPS_R (*((volatile unsigned long *)0x40035060))
#define TIMER5_TAPV_R (*((volatile unsigned long *)0x40035064))
#define TIMER5_TBPV_R (*((volatile unsigned long *)0x40035068))
#define TIMER5_PP_R (*((volatile unsigned long *)0x40035FC0))
#define GPIO_PORTA_DATA_R (*((volatile unsigned long *)0x400043FC))
#define GPIO_PORTB_DATA_R (*((volatile unsigned long *)0x400053FC))
#define GPIO_PORTE_DATA_R (*((volatile unsigned long *)0x400243FC))
#define GPIO_PORTF_DATA_R (*((volatile unsigned long *)0x400253FC))
#define GPIO_PORTD_DATA_R (*((volatile unsigned long *)0x400073FC))
void (*sendDataPt)(void);
// ************TExaS_Init*****************
// Initialize grader, 7-bit logic analyzer on timer 5A 100us
// sets PLL to 80 MHz
// This needs to be called once
// Inputs: function to send data
// This will only activate clock, user sets direction and other modes
// Outputs: none
void TExaS_Init(void(*task)(void)){
PLL_Init(); // PLL on at 80 MHz
sendDataPt = task;
/* if(port==0){
SYSCTL_RCGCGPIO_R |= 1; // Port A
PortDataAddr = ((volatile unsigned long *)0x400043FC); // GPIO_PORTA_DATA_R
}else if(port==1){
SYSCTL_RCGCGPIO_R |= 2; // Port B
PortDataAddr = ((volatile unsigned long *)0x400053FC); // GPIO_PORTB_DATA_R
}else if(port==3){
SYSCTL_RCGCGPIO_R |= 8; // Port D
PortDataAddr = ((volatile unsigned long *)0x400073FC); //GPIO_PORTD_DATA_R
}else if(port==4){
SYSCTL_RCGCGPIO_R |= 0x10; // Port E
PortDataAddr = ((volatile unsigned long *)0x400243FC); //GPIO_PORTE_DATA_R
}else if(port==5){
SYSCTL_RCGCGPIO_R |= 0x20; // Port F
PortDataAddr = ((volatile unsigned long *)0x400253FC); // GPIO_PORTF_DATA_R
}else{
return; // bad input
}
*/
SYSCTL_RCGCTIMER_R |= 0x20; // 0) activate timer5
UART0_Init(); // UART0 is connected to TExaSdisplay
TIMER5_CTL_R = 0x00000000; // 1) disable timer5A during setup
TIMER5_CFG_R = 0x00000000; // 2) configure for 32-bit mode
TIMER5_TAMR_R = 0x00000002; // 3) configure for periodic mode, default down-count settings
TIMER5_TAILR_R = 7999; // 4) 100us reload value
TIMER5_TAPR_R = 0; // 5) bus clock resolution
TIMER5_ICR_R = 0x00000001; // 6) clear timer5A timeout flag
TIMER5_IMR_R = 0x00000001; // 7) arm timeout interrupt
NVIC_PRI23_R = (NVIC_PRI23_R&0xFFFFFF00)|0x00000040; // 8) priority 2
// interrupts enabled in the main program after all devices initialized
// vector number 108, interrupt number 92
NVIC_EN2_R = 0x10000000; // 9) enable interrupt 92 in NVIC
TIMER5_CTL_R = 0x00000001; // 10) enable timer5A
}
#define UART0_DR_R (*((volatile unsigned long *)0x4000C000))
// Timer5 implements the logic analyzer
// Sends 7-bit data to PC running TExaSdisplay via the USB cable
void Timer5A_Handler(void){
TIMER5_ICR_R = 0x00000001; // acknowledge timer5A timeout
(*sendDataPt)();
// UART0_DR_R = (*PortDataAddr)|0x80; // send digital data to TExaSdisplay
}
// ************TExaS_Stop*****************
// Stop the transfer
// Inputs: none
// Outputs: none
void TExaS_Stop(void){
NVIC_DIS2_R = 0x10000000; // 9) disable interrupt 92 in NVIC
TIMER5_CTL_R = 0x00000000; // 10) disable timer5A
}
// The #define statement SYSDIV2 in PLL.h
// initializes the PLL to the desired frequency.
// bus frequency is 400MHz/(SYSDIV2+1) = 400MHz/(4+1) = 80 MHz
// see the table at the end of this file
#define SYSCTL_RIS_R (*((volatile unsigned long *)0x400FE050))
#define SYSCTL_RIS_PLLLRIS 0x00000040 // PLL Lock Raw Interrupt Status
#define SYSCTL_RCC_R (*((volatile unsigned long *)0x400FE060))
#define SYSCTL_RCC_XTAL_M 0x000007C0 // Crystal Value
#define SYSCTL_RCC_XTAL_6MHZ 0x000002C0 // 6 MHz Crystal
#define SYSCTL_RCC_XTAL_8MHZ 0x00000380 // 8 MHz Crystal
#define SYSCTL_RCC_XTAL_16MHZ 0x00000540 // 16 MHz Crystal
#define SYSCTL_RCC2_R (*((volatile unsigned long *)0x400FE070))
#define SYSCTL_RCC2_USERCC2 0x80000000 // Use RCC2
#define SYSCTL_RCC2_DIV400 0x40000000 // Divide PLL as 400 MHz vs. 200
// MHz
#define SYSCTL_RCC2_SYSDIV2_M 0x1F800000 // System Clock Divisor 2
#define SYSCTL_RCC2_SYSDIV2LSB 0x00400000 // Additional LSB for SYSDIV2
#define SYSCTL_RCC2_PWRDN2 0x00002000 // Power-Down PLL 2
#define SYSCTL_RCC2_BYPASS2 0x00000800 // PLL Bypass 2
#define SYSCTL_RCC2_OSCSRC2_M 0x00000070 // Oscillator Source 2
#define SYSCTL_RCC2_OSCSRC2_MO 0x00000000 // MOSC
// The #define statement SYSDIV2 initializes
// the PLL to the desired frequency.
#define SYSDIV2 4
// bus frequency is 400MHz/(SYSDIV2+1) = 400MHz/(4+1) = 80 MHz
// configure the system to get its clock from the PLL
void PLL_Init(void){
// 0) configure the system to use RCC2 for advanced features
// such as 400 MHz PLL and non-integer System Clock Divisor
SYSCTL_RCC2_R |= SYSCTL_RCC2_USERCC2;
// 1) bypass PLL while initializing
SYSCTL_RCC2_R |= SYSCTL_RCC2_BYPASS2;
// 2) select the crystal value and oscillator source
SYSCTL_RCC_R &= ~SYSCTL_RCC_XTAL_M; // clear XTAL field
SYSCTL_RCC_R += SYSCTL_RCC_XTAL_16MHZ;// configure for 16 MHz crystal
SYSCTL_RCC2_R &= ~SYSCTL_RCC2_OSCSRC2_M;// clear oscillator source field
SYSCTL_RCC2_R += SYSCTL_RCC2_OSCSRC2_MO;// configure for main oscillator source
// 3) activate PLL by clearing PWRDN
SYSCTL_RCC2_R &= ~SYSCTL_RCC2_PWRDN2;
// 4) set the desired system divider and the system divider least significant bit
SYSCTL_RCC2_R |= SYSCTL_RCC2_DIV400; // use 400 MHz PLL
SYSCTL_RCC2_R = (SYSCTL_RCC2_R&~0x1FC00000) // clear system clock divider field
+ (SYSDIV2<<22); // configure for 80 MHz clock
// 5) wait for the PLL to lock by polling PLLLRIS
while((SYSCTL_RIS_R&SYSCTL_RIS_PLLLRIS)==0){};
// 6) enable use of PLL by clearing BYPASS
SYSCTL_RCC2_R &= ~SYSCTL_RCC2_BYPASS2;
}
#define GPIO_PORTA_AFSEL_R (*((volatile unsigned long *)0x40004420))
#define GPIO_PORTA_DEN_R (*((volatile unsigned long *)0x4000451C))
#define GPIO_PORTA_AMSEL_R (*((volatile unsigned long *)0x40004528))
#define GPIO_PORTA_PCTL_R (*((volatile unsigned long *)0x4000452C))
#define UART0_FR_R (*((volatile unsigned long *)0x4000C018))
#define UART0_IBRD_R (*((volatile unsigned long *)0x4000C024))
#define UART0_FBRD_R (*((volatile unsigned long *)0x4000C028))
#define UART0_LCRH_R (*((volatile unsigned long *)0x4000C02C))
#define UART0_CTL_R (*((volatile unsigned long *)0x4000C030))
#define UART0_CC_R (*((volatile unsigned long *)0x4000CFC8))
#define UART_FR_TXFF 0x00000020 // UART Transmit FIFO Full
#define UART_FR_RXFE 0x00000010 // UART Receive FIFO Empty
#define UART_LCRH_WLEN_8 0x00000060 // 8 bit word length
#define UART_LCRH_FEN 0x00000010 // UART Enable FIFOs
#define UART_CTL_UARTEN 0x00000001 // UART Enable
#define UART_CC_CS_M 0x0000000F // UART Baud Clock Source
#define UART_CC_CS_SYSCLK 0x00000000 // The system clock (default)
#define SYSCTL_RCGCUART_R (*((volatile unsigned long *)0x400FE618))
#define SYSCTL_RCGC1_R (*((volatile unsigned long *)0x400FE104))
#define SYSCTL_RCGC2_R (*((volatile unsigned long *)0x400FE108))
#define SYSCTL_RCGC1_UART0 0x00000001 // UART0 Clock Gating Control
#define SYSCTL_RCGC2_GPIOA 0x00000001 // port A Clock Gating Control
#define SYSCTL_PRGPIO_R (*((volatile unsigned long *)0x400FEA08))
#define SYSCTL_PRUART_R (*((volatile unsigned long *)0x400FEA18))
#define SYSCTL_PRGPIO_R0 0x00000001 // GPIO Port A Peripheral Ready
#define SYSCTL_PRUART_R0 0x00000001 // UART Module 0 Peripheral Ready
//------------UART0_Init------------
// Initialize the UART for 115,200 baud rate (assuming 80 MHz UART clock),
// 8 bit word length, no parity bits, one stop bit, FIFOs enabled
// Input: none
// Output: none
void UART0_Init(void){volatile unsigned long delay;
SYSCTL_RCGCUART_R |= 0x01; // activate UART0
SYSCTL_RCGCGPIO_R |= SYSCTL_RCGC2_GPIOA; // activate port A
// wait for clock to stabilize
// while((SYSCTL_PRUART_R&SYSCTL_PRUART_R0) == 0){};
delay = SYSCTL_RCGCGPIO_R;
delay = SYSCTL_RCGCGPIO_R;
UART0_CTL_R &= ~UART_CTL_UARTEN; // disable UART
UART0_IBRD_R = 43; // IBRD = int(80,000,000 / (16 * 115200)) = int(43.402778)
UART0_FBRD_R = 26; // FBRD = round(0.402778 * 64) = 26
// 8 bit word length (no parity bits, one stop bit, FIFOs)
UART0_LCRH_R = (UART_LCRH_WLEN_8|UART_LCRH_FEN);
UART0_CC_R &= ~UART_CC_CS_M; // clear baud clock control field
UART0_CC_R |= UART_CC_CS_SYSCLK; // configure for system clock
UART0_CTL_R |= UART_CTL_UARTEN; // enable UART
// while((SYSCTL_PRGPIO_R&SYSCTL_PRGPIO_R0) == 0){};
GPIO_PORTA_AFSEL_R |= 0x03; // enable alt funct on PA1-0
GPIO_PORTA_DEN_R |= 0x03; // enable digital I/O on PA1-0
// configure PA1-0 as UART
GPIO_PORTA_PCTL_R = (GPIO_PORTA_PCTL_R&0xFFFFFF00)+0x00000011;
GPIO_PORTA_AMSEL_R &= ~0x03; // disable analog functionality on PA
}
|
the_stack_data/15764200.c | #include <stdio.h>
// [opt] 0 1
// [out] <auto>
int main(int argc, char* argv[])
{
float a, b;
printf("a =\n");
scanf("%f", &a); // [in] -1782.726
printf("b =\n");
scanf("%f", &b); // [in] 148.821
printf("\n");
printf(" a + b = %f\n", (double)( a + b));
printf("2 * a - b = %f\n", (double)(2 * a - b));
printf("3 * a + a / b = %f\n", (double)(3 * a + a / b));
printf("4 * a * a - b = %f\n", (double)(4 * a * a - b));
printf("\n");
printf("a / b = %f\n", (double)(a / b));
// frem isn't tested. don't know how.
return 0;
}
|
the_stack_data/165769309.c | #include<stdio.h>
#include<time.h>
void main()
{
time_t t;
time(&t);
printf("current time is %s",ctime(&t));
} |
the_stack_data/89199982.c | #include <stdio.h>
int main(){
int n,i,x,y,j;
scanf("%d", &n);
for (i=0;i<n;i++){
int sum=0;
scanf("%d%d", &x, &y);
if (x%2==0) x++;
for (j=0;j<y;j++, x+=2) sum+=x;
printf("%d\n", sum);
}
return 0;
}
|
the_stack_data/165768081.c | #include <stdlib.h>
int main(void) {
__builtin_autoseccomp();
void *p = malloc(1024);
return 0;
}
|
the_stack_data/25137161.c | /////////////////////////////////////////////////
// Generated file Do not Modify
/////////////////////////////////////////////////
typedef struct net_config_info
{
int imask;
short rx_buffs;
short tx_buffs;
short rx_buff_datalen;
short tx_buff_datalen;
short buff_area;
short buff_area_size;
short use_dhcp;
unsigned char mac_addr[6];
int ipaddr;
int netmask;
int gateway;
}net_config_info;
extern struct net_config_info user_net_config_info[];
struct net_config_info user_net_config_info[]= {
{
0,
60,
40,
1600,
1548,
0,
0,
1,
{0x00,0x00,0x00,0x00,0x00,0x00},
0x0,
0x0,
0x0,
},
};
int user_net_num_ifces = sizeof(user_net_config_info)/sizeof(net_config_info);
|
the_stack_data/248580684.c | /*
gcc -std=c17 -lc -lm -pthread -o ../_build/c/string_multibyte_mbsrtowcs.exe ./c/string_multibyte_mbsrtowcs.c && (cd ../_build/c/;./string_multibyte_mbsrtowcs.exe)
https://en.cppreference.com/w/c/string/multibyte/mbsrtowcs
*/
#include <stdio.h>
#include <locale.h>
#include <wchar.h>
#include <string.h>
void print_as_wide(const char* mbstr)
{
mbstate_t state;
memset(&state, 0, sizeof state);
size_t len = 1 + mbsrtowcs(NULL, &mbstr, 0, &state);
wchar_t wstr[len];
mbsrtowcs(&wstr[0], &mbstr, len, &state);
wprintf(L"Wide string: %ls \n", wstr);
wprintf(L"The length, including L'\\0': %zu\n", len);
}
int main(void)
{
setlocale(LC_ALL, "en_US.utf8");
print_as_wide(u8"z\u00df\u6c34\U0001f34c"); // u8"zß水🍌"
}
|
the_stack_data/729334.c | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(int argc, char *args[]){
int N = atoi(args[1]);
int M = atoi(args[2]);
int max = 0;
srand(time(NULL));
int tab[10];
for(int i = 0; i < 10; i++){
tab[i] = 0;
}
for(int i = 1; i <= N; i++){
int stevilo = rand()%((100 - 1) + 1) + 1;
//printf("%d\n", stevilo);
//printf("%d\n", stevilo / 11);
int idex = (stevilo -1) / 10;
tab[idex]++;
if (tab[idex] > max){
max = tab[idex];
}
}
printf("\n");
for(int i = 0; i < 10; i++){
printf("%d\n",tab[i]);
}
printf("\n");
for(int i = 0; i < 10; i++){
tab[i] = (tab[i] * M) / max;
printf("%d\n",tab[i]);
}
printf("\n");
printf("\n");
for(int i = max; i >= 0; i--){
for(int j = 0; j < 10; j++){
if(tab[j] <= i){
printf(" ");
}
else{
printf("O ");
}
}
printf("\n");
}
for(int i = 0; i < 10; i++){
printf("-------");
}
printf("\n");
printf("1-10 11-20 21-30 31-40 41-50 51-60 61-70 71-80 81-90 91-100\n");
}
|
the_stack_data/569166.c | /******************************************************************************
*
* Copyright(c) 2013 Realtek Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
*
******************************************************************************/
#ifdef CONFIG_BT_COEXIST
#include <rtw_btcoex.h>
#include <hal_btcoex.h>
void rtw_btcoex_Initialize(PADAPTER padapter)
{
hal_btcoex_Initialize(padapter);
}
void rtw_btcoex_HAL_Initialize(PADAPTER padapter)
{
hal_btcoex_InitHwConfig(padapter);
}
void rtw_btcoex_IpsNotify(PADAPTER padapter, u8 type)
{
hal_btcoex_IpsNotify(padapter, type);
}
void rtw_btcoex_LpsNotify(PADAPTER padapter, u8 type)
{
hal_btcoex_LpsNotify(padapter, type);
}
void rtw_btcoex_ScanNotify(PADAPTER padapter, u8 type)
{
#ifdef CONFIG_CONCURRENT_MODE
if ((_FALSE == type) && (padapter->pbuddy_adapter))
{
PADAPTER pbuddy = padapter->pbuddy_adapter;
if (check_fwstate(&pbuddy->mlmepriv, WIFI_SITE_MONITOR) == _TRUE)
return;
}
#endif
hal_btcoex_ScanNotify(padapter, type);
}
void rtw_btcoex_ConnectNotify(PADAPTER padapter, u8 action)
{
#ifdef DBG_CONFIG_ERROR_RESET
if (_TRUE == rtw_hal_sreset_inprogress(padapter))
{
DBG_8192C(FUNC_ADPT_FMT ": [BTCoex] under reset, skip notify!\n",
FUNC_ADPT_ARG(padapter));
return;
}
#endif // DBG_CONFIG_ERROR_RESET
#ifdef CONFIG_CONCURRENT_MODE
if ((_FALSE == action) && (padapter->pbuddy_adapter))
{
PADAPTER pbuddy = padapter->pbuddy_adapter;
if (check_fwstate(&pbuddy->mlmepriv, WIFI_UNDER_LINKING) == _TRUE)
return;
}
#endif
hal_btcoex_ConnectNotify(padapter, action);
}
void rtw_btcoex_MediaStatusNotify(PADAPTER padapter, u8 mediaStatus)
{
#ifdef DBG_CONFIG_ERROR_RESET
if (_TRUE == rtw_hal_sreset_inprogress(padapter))
{
DBG_8192C(FUNC_ADPT_FMT ": [BTCoex] under reset, skip notify!\n",
FUNC_ADPT_ARG(padapter));
return;
}
#endif // DBG_CONFIG_ERROR_RESET
#ifdef CONFIG_CONCURRENT_MODE
if ((RT_MEDIA_DISCONNECT == mediaStatus) && (padapter->pbuddy_adapter))
{
PADAPTER pbuddy = padapter->pbuddy_adapter;
if (check_fwstate(&pbuddy->mlmepriv, WIFI_ASOC_STATE) == _TRUE)
return;
}
#endif // CONFIG_CONCURRENT_MODE
if ((RT_MEDIA_CONNECT == mediaStatus)
&& (check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE) == _TRUE))
{
rtw_hal_set_hwreg(padapter, HW_VAR_DL_RSVD_PAGE, NULL);
}
hal_btcoex_MediaStatusNotify(padapter, mediaStatus);
}
void rtw_btcoex_SpecialPacketNotify(PADAPTER padapter, u8 pktType)
{
hal_btcoex_SpecialPacketNotify(padapter, pktType);
}
void rtw_btcoex_IQKNotify(PADAPTER padapter, u8 state)
{
hal_btcoex_IQKNotify(padapter, state);
}
void rtw_btcoex_BtInfoNotify(PADAPTER padapter, u8 length, u8 *tmpBuf)
{
hal_btcoex_BtInfoNotify(padapter, length, tmpBuf);
}
void rtw_btcoex_SuspendNotify(PADAPTER padapter, u8 state)
{
hal_btcoex_SuspendNotify(padapter, state);
}
void rtw_btcoex_HaltNotify(PADAPTER padapter)
{
if (_FALSE == padapter->bup)
{
DBG_871X(FUNC_ADPT_FMT ": bup=%d Skip!\n",
FUNC_ADPT_ARG(padapter), padapter->bup);
return;
}
if (_TRUE == padapter->bSurpriseRemoved)
{
DBG_871X(FUNC_ADPT_FMT ": bSurpriseRemoved=%d Skip!\n",
FUNC_ADPT_ARG(padapter), padapter->bSurpriseRemoved);
return;
}
hal_btcoex_HaltNotify(padapter);
}
void rtw_btcoex_SwitchGntBt(PADAPTER padapter)
{
hal_btcoex_SwitchGntBt(padapter);
}
void rtw_btcoex_Switch(PADAPTER padapter, u8 enable)
{
hal_btcoex_SetBTCoexist(padapter, enable);
}
u8 rtw_btcoex_IsBtDisabled(PADAPTER padapter)
{
return hal_btcoex_IsBtDisabled(padapter);
}
void rtw_btcoex_Handler(PADAPTER padapter)
{
#if defined(CONFIG_CONCURRENT_MODE)
if (padapter->adapter_type != PRIMARY_ADAPTER)
return;
#endif
hal_btcoex_Hanlder(padapter);
}
s32 rtw_btcoex_IsBTCoexCtrlAMPDUSize(PADAPTER padapter)
{
s32 coexctrl;
coexctrl = hal_btcoex_IsBTCoexCtrlAMPDUSize(padapter);
return coexctrl;
}
u32 rtw_btcoex_GetAMPDUSize(PADAPTER padapter)
{
u32 size;
size = hal_btcoex_GetAMPDUSize(padapter);
return size;
}
void rtw_btcoex_SetManualControl(PADAPTER padapter, u8 manual)
{
if (_TRUE == manual)
{
hal_btcoex_SetManualControl(padapter, _TRUE);
}
else
{
hal_btcoex_SetManualControl(padapter, _FALSE);
}
}
u8 rtw_btcoex_1Ant(PADAPTER padapter)
{
return hal_btcoex_1Ant(padapter);
}
u8 rtw_btcoex_IsBtControlLps(PADAPTER padapter)
{
return hal_btcoex_IsBtControlLps(padapter);
}
u8 rtw_btcoex_IsLpsOn(PADAPTER padapter)
{
return hal_btcoex_IsLpsOn(padapter);
}
u8 rtw_btcoex_RpwmVal(PADAPTER padapter)
{
return hal_btcoex_RpwmVal(padapter);
}
u8 rtw_btcoex_LpsVal(PADAPTER padapter)
{
return hal_btcoex_LpsVal(padapter);
}
void rtw_btcoex_SetBTCoexist(PADAPTER padapter, u8 bBtExist)
{
hal_btcoex_SetBTCoexist(padapter, bBtExist);
}
void rtw_btcoex_SetChipType(PADAPTER padapter, u8 chipType)
{
hal_btcoex_SetChipType(padapter, chipType);
}
void rtw_btcoex_SetPGAntNum(PADAPTER padapter, u8 antNum, u8 antInverse)
{
hal_btcoex_SetPgAntNum(padapter, antNum, antInverse);
}
u8 rtw_btcoex_GetPGAntNum(PADAPTER padapter)
{
return hal_btcoex_GetPgAntNum(padapter);
}
u32 rtw_btcoex_GetRaMask(PADAPTER padapter)
{
return hal_btcoex_GetRaMask(padapter);
}
void rtw_btcoex_RecordPwrMode(PADAPTER padapter, u8 *pCmdBuf, u8 cmdLen)
{
hal_btcoex_RecordPwrMode(padapter, pCmdBuf, cmdLen);
}
void rtw_btcoex_DisplayBtCoexInfo(PADAPTER padapter, u8 *pbuf, u32 bufsize)
{
hal_btcoex_DisplayBtCoexInfo(padapter, pbuf, bufsize);
}
void rtw_btcoex_SetDBG(PADAPTER padapter, u32 *pDbgModule)
{
hal_btcoex_SetDBG(padapter, pDbgModule);
}
u32 rtw_btcoex_GetDBG(PADAPTER padapter, u8 *pStrBuf, u32 bufSize)
{
return hal_btcoex_GetDBG(padapter, pStrBuf, bufSize);
}
u8 rtw_btcoex_IncreaseScanDeviceNum(PADAPTER padapter)
{
return hal_btcoex_IncreaseScanDeviceNum(padapter);
}
u8 rtw_btcoex_IsBtLinkExist(PADAPTER padapter)
{
return hal_btcoex_IsBtLinkExist(padapter);
}
// ==================================================
// Below Functions are called by BT-Coex
// ==================================================
void rtw_btcoex_RejectApAggregatedPacket(PADAPTER padapter, u8 enable)
{
struct mlme_ext_info *pmlmeinfo;
struct sta_info *psta;
pmlmeinfo = &padapter->mlmeextpriv.mlmext_info;
psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(&padapter->mlmepriv));
if (_TRUE == enable)
{
pmlmeinfo->bAcceptAddbaReq = _FALSE;
send_delba(padapter, 0, psta->hwaddr);
}
else
{
pmlmeinfo->bAcceptAddbaReq = _TRUE;
}
}
void rtw_btcoex_LPS_Enter(PADAPTER padapter)
{
struct pwrctrl_priv *pwrpriv;
u8 lpsVal;
pwrpriv = adapter_to_pwrctl(padapter);
pwrpriv->bpower_saving = _TRUE;
lpsVal = rtw_btcoex_LpsVal(padapter);
rtw_set_ps_mode(padapter, PS_MODE_MIN, 0, lpsVal, "BTCOEX");
}
void rtw_btcoex_LPS_Leave(PADAPTER padapter)
{
struct pwrctrl_priv *pwrpriv;
pwrpriv = adapter_to_pwrctl(padapter);
if (pwrpriv->pwr_mode != PS_MODE_ACTIVE)
{
rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "BTCOEX");
LPS_RF_ON_check(padapter, 100);
pwrpriv->bpower_saving = _FALSE;
}
}
#endif // CONFIG_BT_COEXIST
|
the_stack_data/1059466.c | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
typedef struct TYPE_6__ TYPE_3__ ;
typedef struct TYPE_5__ TYPE_2__ ;
typedef struct TYPE_4__ TYPE_1__ ;
/* Type definitions */
struct TYPE_5__ {int default_len; int* len; scalar_t__ keys_set; } ;
struct TYPE_6__ {int /*<<< orphan*/ security_policy; TYPE_2__ wep; } ;
struct hostapd_bss_config {scalar_t__ individual_wep_key_len; int wpa; int rsn_pairwise; int wpa_pairwise; int group_cipher; int wpa_group; int wpa_group_rekey; int default_wep_key_len; void* wpa_key_mgmt; TYPE_3__ ssid; scalar_t__ osen; scalar_t__ ieee802_1x; TYPE_1__* radius; int /*<<< orphan*/ wpa_group_rekey_set; scalar_t__ broadcast_key_idx_min; } ;
struct TYPE_4__ {int /*<<< orphan*/ acct_servers; int /*<<< orphan*/ acct_server; int /*<<< orphan*/ auth_servers; int /*<<< orphan*/ auth_server; } ;
/* Variables and functions */
int /*<<< orphan*/ SECURITY_IEEE_802_1X ;
int /*<<< orphan*/ SECURITY_OSEN ;
int /*<<< orphan*/ SECURITY_PLAINTEXT ;
int /*<<< orphan*/ SECURITY_STATIC_WEP ;
int /*<<< orphan*/ SECURITY_WPA ;
int /*<<< orphan*/ SECURITY_WPA_PSK ;
void* WPA_CIPHER_CCMP ;
void* WPA_CIPHER_NONE ;
int WPA_CIPHER_TKIP ;
int WPA_CIPHER_WEP104 ;
int WPA_CIPHER_WEP40 ;
void* WPA_KEY_MGMT_IEEE8021X_NO_WPA ;
void* WPA_KEY_MGMT_NONE ;
int wpa_select_ap_group_cipher (int,int,int) ;
void hostapd_set_security_params(struct hostapd_bss_config *bss,
int full_config)
{
if (bss->individual_wep_key_len == 0) {
/* individual keys are not use; can use key idx0 for
* broadcast keys */
bss->broadcast_key_idx_min = 0;
}
if ((bss->wpa & 2) && bss->rsn_pairwise == 0)
bss->rsn_pairwise = bss->wpa_pairwise;
if (bss->group_cipher)
bss->wpa_group = bss->group_cipher;
else
bss->wpa_group = wpa_select_ap_group_cipher(bss->wpa,
bss->wpa_pairwise,
bss->rsn_pairwise);
if (!bss->wpa_group_rekey_set)
bss->wpa_group_rekey = bss->wpa_group == WPA_CIPHER_TKIP ?
600 : 86400;
if (full_config) {
bss->radius->auth_server = bss->radius->auth_servers;
bss->radius->acct_server = bss->radius->acct_servers;
}
if (bss->wpa && bss->ieee802_1x) {
bss->ssid.security_policy = SECURITY_WPA;
} else if (bss->wpa) {
bss->ssid.security_policy = SECURITY_WPA_PSK;
} else if (bss->ieee802_1x) {
int cipher = WPA_CIPHER_NONE;
bss->ssid.security_policy = SECURITY_IEEE_802_1X;
bss->ssid.wep.default_len = bss->default_wep_key_len;
if (full_config && bss->default_wep_key_len) {
cipher = bss->default_wep_key_len >= 13 ?
WPA_CIPHER_WEP104 : WPA_CIPHER_WEP40;
} else if (full_config && bss->ssid.wep.keys_set) {
if (bss->ssid.wep.len[0] >= 13)
cipher = WPA_CIPHER_WEP104;
else
cipher = WPA_CIPHER_WEP40;
}
bss->wpa_group = cipher;
bss->wpa_pairwise = cipher;
bss->rsn_pairwise = cipher;
if (full_config)
bss->wpa_key_mgmt = WPA_KEY_MGMT_IEEE8021X_NO_WPA;
} else if (bss->ssid.wep.keys_set) {
int cipher = WPA_CIPHER_WEP40;
if (bss->ssid.wep.len[0] >= 13)
cipher = WPA_CIPHER_WEP104;
bss->ssid.security_policy = SECURITY_STATIC_WEP;
bss->wpa_group = cipher;
bss->wpa_pairwise = cipher;
bss->rsn_pairwise = cipher;
if (full_config)
bss->wpa_key_mgmt = WPA_KEY_MGMT_NONE;
} else if (bss->osen) {
bss->ssid.security_policy = SECURITY_OSEN;
bss->wpa_group = WPA_CIPHER_CCMP;
bss->wpa_pairwise = 0;
bss->rsn_pairwise = WPA_CIPHER_CCMP;
} else {
bss->ssid.security_policy = SECURITY_PLAINTEXT;
if (full_config) {
bss->wpa_group = WPA_CIPHER_NONE;
bss->wpa_pairwise = WPA_CIPHER_NONE;
bss->rsn_pairwise = WPA_CIPHER_NONE;
bss->wpa_key_mgmt = WPA_KEY_MGMT_NONE;
}
}
} |
the_stack_data/31387089.c | /* Default definition for ARGP_PROGRAM_VERSION.
Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <[email protected]>.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
/* If set by the user program to a non-zero value, then a default option
--version is added (unless the ARGP_NO_HELP flag is used), which will
print this this string followed by a newline and exit (unless the
ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */
const char *argp_program_version;
|
the_stack_data/26273.c | void get_square(int *arr, int k)
{
int i;
int min;
int x;
if(arr[k])
return ;
min = k;
for(i = 1; i*i < k; ++i){
x = i * i;
if(arr[k-x] == 0)
get_square(arr,k-x);
min = 1 + arr[k-x] < min ? 1 + arr[k-x] : min;
}
arr[k] = min;
}
int numSquares(int n) {
int *arr;
int i,ret;
arr = (int *)malloc(sizeof(int) * (n+1));
memset(arr,0,sizeof(int) * (n+1));
for(i = 1; i * i <= n; ++i)
arr[i*i] = 1;
get_square(arr, n);
ret = arr[n];
free(arr);
return ret;
}
|
the_stack_data/109084.c | #include <stdio.h>
void MoveDisk(int diskNumber, int startPost, int endPost, int midPost);
int main()
{
MoveDisk(3, 1, 3, 2);
}
/*
** Inputs
** diskNumber is the disk to be moved (disk1 is smallest)
** startPost is the post the disk is currently on
** endPost is the post we want the disk to end on
** midPost is the intermediate post
*/
void MoveDisk(int diskNumber, int startPost, int endPost, int midPost)
{
if (diskNumber > 1)
{
/* Move n-1 disks off the current disk on */
/* startPost and put them on the midPost */
MoveDisk(diskNumber-1, startPost, midPost, endPost);
/* Move the largest disk. */
printf("Move disk %d from post %d to post %d.\n",
diskNumber, startPost, endPost);
/* Move all n-1 disks from midPost onto endPost */
MoveDisk(diskNumber-1, midPost, endPost, startPost);
}
else
printf("Move disk 1 from post %d to post %d.\n",
startPost, endPost);
}
|
the_stack_data/648903.c | /* Assignment 5 - Question 3
* File: prodcons.c
* Description: Implementation of m-producer, n-consumer problem using semaphores
* Author: Asmit De 10/CSE/53
* Date: 30-Mar-2013
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <signal.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/sem.h>
#define P(s) semop(s, &pop, 1) // Simulates the wait() operation
#define V(s) semop(s, &vop, 1) // Simulates the signal() operation
#define SIZE 20 // Size of the buffer
// Queue structure and its functions
// Begin
typedef struct Queue
{
int _queue[SIZE];
int front, rear;
}Queue;
void InitQueue(Queue *q)
{
q->front = -1;
q->rear = -1;
}
int IsFull(Queue *q)
{
if((q->rear == SIZE - 1 && q->front == -1) || (q->front == q->rear && q->front != -1))
return 1;
else
return 0;
}
int IsEmpty(Queue *q)
{
if(q->front == q->rear && q->front == -1)
return 1;
else
return 0;
}
int Enqueue(Queue *q, int data)
{
if(IsFull(q))
{
printf("\nError: Queue is full...");
return 1;
}
q->rear = (q->rear + 1) % SIZE;
q->_queue[q->rear] = data;
return 0;
}
int Dequeue(Queue *q, int *data)
{
if(IsEmpty(q))
{
printf("\nError: Queue is empty...");
return 1;
}
q->front = (q->front + 1) % SIZE;
*data = q->_queue[q->front];
return 0;
}
// End
// Signal handler for SIGUSR1
void catchSIGUSR1()
{
// Terminate the consumer
exit(0);
}
int main()
{
pid_t *pidP, // Pointer to process id of producers
*pidC; // Pointer to process id of consumers
int m, // Stores the number of producers
n, // Stores the number of consumers
*sum, // Pointer variable to shared memory segment containing sum
shmidSum, // Id of the shared memory segment containing sum
shmidBuffer, // Id of the shared memory segment containing buffer
semidCS, // Id of the semaphore for critical section
semidBuffFull, // Id of the semaphore for buffer full condition
semidBuffEmpty, // Id of the semaphore for buffer empty condition
i; // Iterator for loops
Queue *buffer; // Pointer variable to shared memory segment containing buffer
struct sembuf pop, // Structure for P() operation
vop; // Structure for V() operation
// Obtain a shared memory segment and attach it to sum
shmidSum = shmget(IPC_PRIVATE, sizeof(int), 0777 | IPC_CREAT);
sum = (int*)shmat(shmidSum, 0, 0);
// Initialize the shared sum to 0
*sum = 0;
// Obtain a shared memory segment and attach it to buffer
shmidBuffer = shmget(IPC_PRIVATE, sizeof(Queue), 0777 | IPC_CREAT);
buffer = (Queue*)shmat(shmidBuffer, 0, 0);
// Initialize the shared buffer
InitQueue(buffer);
// Create a semaphore for critical section and set the value
semidCS = semget(IPC_PRIVATE, 1, 0777 | IPC_CREAT);
semctl(semidCS, 0, SETVAL, 1);
// Create a semaphore for buffer empty condition and set the value
semidBuffEmpty = semget(IPC_PRIVATE, 1, 0777 | IPC_CREAT);
semctl(semidBuffEmpty, 0, SETVAL, 0);
// Create a semaphore for buffer full condition and set the value
semidBuffFull = semget(IPC_PRIVATE, 1, 0777 | IPC_CREAT);
semctl(semidBuffFull, 0, SETVAL, SIZE);
// Initialize the pop and vop structure fields
pop.sem_num = vop.sem_num = 0;
pop.sem_flg = vop.sem_flg = 0;
pop.sem_op = -1;
vop.sem_op = 1;
// Get the number of producers and consumers and create their pid arrays
printf("Enter the number of producers and consumers: ");
scanf("%d %d", &m, &n);
pidP = (pid_t*)calloc(m, sizeof(pid_t));
pidC = (pid_t*)calloc(n, sizeof(pid_t));
// Function definition for producers
void Producer()
{
int j;
for(j = 1; j <= 50; j++)
{
// Check and lock semaphore for buffer full condition
P(semidBuffFull);
// Check and lock semaphore for critical section
P(semidCS);
// Critical section
// Begin
Enqueue(buffer, j);
//printf("\nProducer produces %d", j);
// End
// Release semaphore for critical section
V(semidCS);
// Release semaphore for buffer empty condition
V(semidBuffEmpty);
}
}
// Function definition for consumers
void Consumer()
{
// Initialize handler for SIGALRM
signal(SIGUSR1, catchSIGUSR1);
int data, j;
for(;;)
{
// If all data has been consumed after all producers
// have finished producing, but parent is still creating
// consumers, terminate the consumer
if(*sum == m*1275)
exit(0);
// Check and lock semaphore for buffer empty condition
P(semidBuffEmpty);
// Check and lock semaphore for critical section
P(semidCS);
// Critical section
// Begin
Dequeue(buffer, &data);
*sum = *sum + data;
// Check if all data has been consumed after all producers have finished producing
if(*sum == m*1275)
{
// Send signal to all consumers
for(j = 0; j < n; j++)
kill(pidC[j], SIGUSR1);
}
// End
// Release semaphore for critical section
V(semidCS);
// Release semaphore for buffer full condition
V(semidBuffFull);
}
}
// Set to ignore SIGUSR1 if received
signal(SIGUSR1, SIG_IGN);
// Create m producers
for(i = 0; i < m; i++)
{
pidP[i] = fork();
if(pidP[i] == 0)
{
Producer();
exit(0);
}
else if(pidP[i] == -1)
{
// Error handling for fork errors
perror("Error");
}
}
// Create n consumers
for(i = 0; i < n; i++)
{
pidC[i] = fork();
if(pidC[i] == 0)
{
Consumer();
}
else if(pidC[i] == -1)
{
// Error handling for fork errors
perror("Error");
}
}
// Parent process waits for all producers and consumers to exit
for(i = 0; i < m; i++)
waitpid(pidP[i]);
for(i = 0; i < n; i++)
waitpid(pidC[i]);
// Print the final shared sum
printf("Sum = %d\n", *sum);
// Delete all semaphores
semctl(semidCS, 0, IPC_RMID, 0);
semctl(semidBuffFull, 0, IPC_RMID, 0);
semctl(semidBuffEmpty, 0, IPC_RMID, 0);
// Detach sum and buffer from their shared memory segments and delete the segments
shmdt(sum);
shmctl(shmidSum, IPC_RMID, 0);
shmdt(buffer);
shmctl(shmidBuffer, IPC_RMID, 0);
return 0;
}
|
the_stack_data/175143972.c | #include<stdio.h>
int main()
{
int n,k,s,b,tb,r;
while(scanf("%d%d",&n,&k)==2)
{
s=n;
tb=0;
while(s>=k)
{
b=s/k;
r=s%k;
s=b+r;
tb=tb+b;
}
printf("%d\n",n+tb);
}
return 0;
}
|
the_stack_data/589420.c | #include "err.h"
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#ifdef __WIN32__
/* index replacement for win32 */
static char* index(const char* str, int c) {
char* p = str;
while (1) {
if (*p == c) return p;
if (*p == '\0') break;
p += 1;
}
return NULL;
}
#endif
int main(int argc, char **argv) {
FILE *f;
int nblock, btype, x, z, width, height;
char *fname, *levelname;
char buf[128];
int i;
srand(0);
if(argc != 2) errx(1, "Usage: %s levelfile", argv[0]);
fname = argv[1];
levelname = fname;
while(index(levelname, '/')) levelname = index(levelname, '/') + 1;
f = fopen(fname, "r");
if(!f) err(1, "%s", fname);
printf("uint8_t data_%s[] = {\n", levelname);
if(!fgets(buf, sizeof(buf), f)) err(1, "%s: Empty file?", fname);
if(1 == sscanf(buf, "%d", &nblock)) {
if(nblock < 1 || nblock > 255) errx(1, "%s: Invalid block count", fname);
printf("\t\t0x%02x,\n", nblock & 255);
printf("\t\t0x%02x,\n", nblock >> 8);
for(i = 0; i < nblock; i++) {
if(!fgets(buf, sizeof(buf), f)) err(1, "%s: Unexpected EOF", fname);
if(3 == sscanf(buf, "%d , %d , %d", &btype, &x, &z)) {
printf("\t\t0x%02x, 0x%02x, 0x%02x, 0x%02x,\n",
btype,
rand() % 6,
x,
z);
} else errx(1, "%s: Couldn't parse line", fname);
}
} else if(2 == sscanf(buf, "ascii %d %d", &width, &height)) {
uint8_t buffer[65536 * 4];
nblock = 0;
for(z = 0; z < height; z++) {
if(!fgets(buf, sizeof(buf), f)) err(1, "%s: Unexpected EOF", fname);
for(x = 0; x < width; x++) {
if(buf[x] != '.') {
if(nblock >= 65535) errx(1, "%s: Too many blocks", fname);
switch(buf[x]) {
case '*':
buffer[nblock * 4 + 0] = 1;
buffer[nblock * 4 + 1] = 0;
break;
case 'R':
buffer[nblock * 4 + 0] = 1;
buffer[nblock * 4 + 1] = rand() % 6;
break;
default:
buffer[nblock * 4 + 0] = 0;
buffer[nblock * 4 + 1] = buf[x] - '1';
break;
}
buffer[nblock * 4 + 2] = x * 16;
buffer[nblock * 4 + 3] = (height - 1 - z) * 16;
nblock++;
}
}
}
printf("\t\t0x%02x,\n", nblock & 255);
printf("\t\t0x%02x,\n", nblock >> 8);
for(i = 0; i < nblock; i++) {
printf("\t\t0x%02x, 0x%02x, 0x%02x, 0x%02x,\n",
buffer[i * 4 + 0],
buffer[i * 4 + 1],
buffer[i * 4 + 2],
buffer[i * 4 + 3]);
}
} else errx(1, "%s: Unsupported high-level format", fname);
printf("};\n");
return 0;
}
|
the_stack_data/237643975.c | // 編號 : L2_20-1026N2v0_Loop_右下三角形加邊框.c
// 程式類別 : C語言
// 基礎題 : 陣列練習 ( 難度 ★★☆☆☆ )
// 題目 : 右下三角形加邊框
// 時間:NULL ( 不限 ) //最佳 3s內
// 內存大小 : 128MB
// 題目內容 :
// 利用迴圈輸出一個右下三角形加邊框, 每單位以符號*表示
// 輸入 :
// 輸入三角形大小
// 輸出 :
// 右下三角形加邊框
// Sample input :
// 5
// Sample output :
// @
// @@
// @*@
// @**@
// @***@
// @@@@@@
#include <stdio.h>
int main(void) {
int size = 0;
printf("plz input triangle size.\n");
scanf("%d", &size);
//安全性檢查
if(size <= 0) {
printf("Size should be larger than 0.\n");
printf("End of run...\n");
return 0;
}
//繪製右下三角形加邊框
for (int i = 0; i <= size; i++) {
for (int j = i; j <= 5; j++) {
printf(" ");
}
for (int j = 0; j <= i; j++) {
if(
j == 0
|| j == i
|| i == size
) {
printf("@");
} else {
printf("*");
}
}
//換行到下一層
printf("\n");
}
return 0;
} |
the_stack_data/117240.c | /**/
#include <stdio.h>
#include <math.h>
int main()
{
int frst,
scnd,
thrd,
frth;
printf("Please enter 4 numbers separated by spaces > ");
scanf("%d%d%d%d", &frst, &scnd, &thrd, &frth);
if (frst < scnd && frst < thrd && frst < frth)
printf("%d is the smallest\n", frst);
else if (scnd < frst && scnd < thrd && scnd < frth)
printf("%d is the smallest\n", scnd);
else if (thrd < frst && thrd < scnd && thrd < frth)
printf("%d is the smallest\n", thrd);
else printf("%d is the smallest\n", frth);
return (0);
}
|
the_stack_data/130506.c | //Classification: #default/p/DAM/NP/gS/D(v)/fr/rp+cd
//Written by: Sergey Pomelov
//Reviewed by: Igor Eremeev
//Comment:
#include <stdio.h>
int *func(void)
{
static int q = 1;
int *p = &q;
return p;
};
int a;
int main(void)
{
int c;
int i;
a = 1;
scanf("%d",&c);
for(i=1; i<100; i++) {
if (c==i)
a = *func();
}
printf("%d %d",a,c);
return 0;
}
|
the_stack_data/150142615.c | /*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)atol.c 8.1 (Berkeley) 6/4/93
* $FreeBSD: src/lib/libc/stdlib/atol.c,v 1.5 2007/01/09 00:28:09 imp Exp $
* $DragonFly: src/lib/libc/stdlib/atol.c,v 1.3 2005/11/20 12:37:48 swildner Exp $
*/
#include <stdlib.h>
long
atol(const char *str)
{
return(strtol(str, NULL, 10));
}
|
the_stack_data/736278.c | #include <stdio.h>
#include <malloc.h>
/*----------------------------------------------------------------
Fonction create_complexe qui renvoie un nombre complexe
à partir de 2 réels
----------------------------------------------------------------*/
typedef struct complexe {
float pr;
float pi;
} Complexe, *P_complexe;
/* Profil (signature) des sous-programme utilisés */
P_complexe create_complexe(float a, float b);
void print_complexe(struct complexe c);
int main() {
struct complexe *ptc1;
ptc1 = create_complexe(1.5, 2.5);
print_complexe(*ptc1);
free(ptc1);
print_complexe(*ptc1);
ptc1 = NULL;
print_complexe(*ptc1);
return 0;
}
/*
make_complexe(a, b) crée le nombre complexe a +b*i à partir de 2 réels a et b
*/
P_complexe create_complexe(float reel1, float reel2) {
P_complexe pc;
pc= (P_complexe) malloc(sizeof(Complexe));
if(pc!=NULL) {
pc->pr=reel1;
pc->pi=reel2;
}
return pc;
}
void print_complexe(struct complexe a) {
printf("%f + %f*i\n", a.pr, a.pi);
return;
}
/* execution
> gcc -o create_complexe create_complexe.c
> ./create_complexe
./create_complexe
1.500000 + 2.500000*i
0.000000 + 2.500000*i
Erreur de segmentation (core dumped)
*/
|
the_stack_data/212642612.c | #include <string.h>
void* memcpy(void* restrict dstptr, const void* restrict srcptr, size_t size) {
unsigned char* dst = (unsigned char*) dstptr;
const unsigned char* src = (const unsigned char*) srcptr;
for (size_t i = 0; i < size; i++)
dst[i] = src[i];
return dstptr;
}
|
the_stack_data/156391977.c | int sum(int n1, int n2)
{
return n1+n2;
}
int main()
{
return sum(1, 10);
}
|
the_stack_data/803114.c | #include <stdint.h>
#include <stdio.h>
void main() {
int64_t x;
int16_t y;
int32_t z;
}
|
the_stack_data/23575735.c | #if LAB >= 9
#include <stdio.h>
#include <math.h>
int main()
{
printf("%f %f %f\n", 1.0, M_PI, -M_E);
printf("%.0f %#.0f %.0f\n", 1.0, -M_PI, M_E);
printf("%.3f %#.3f %.3f\n", 1.0, M_PI, M_E);
printf("%.15f %#.15f %.15f\n", -1.0, M_PI, M_E);
printf("%20f %20f %20f\n", 1.0, M_PI, M_E);
printf("%20.0f %20#.0f %20.0f\n", 1.0, M_PI, M_E);
printf("%20.3f %20#.3f %20.3f\n", 1.0, M_PI, M_E);
printf("%20.15f %20#.15f %20.15f\n", 1.0, M_PI, M_E);
printf("%+20f %-20f %+-20f\n", 1.0, M_PI, M_E);
printf("%f %f %f\n", 123456.123456123456, HUGE_VAL, -HUGE_VAL);
printf("%.3e %.3e %.3e\n", -1.2345, 12345.0, .000012345);
printf("%020.3e %-20.3e %20.3e\n", 1.2345, -12345.0, .000012345);
printf("%.3g %.3g %.3g %.3g %.3g %.3g\n", 1.2345, 123.45, -12345.0,
.0012345, .00012345, .000012345);
printf("%.3g %.3g %.3g %.3g %.3g %.3g\n", 1.2000, -120.00, 12000.0,
.0012000, .00012000, .000012000);
int x,y,z;
int rc = sscanf("-12345 0777 -0xffff", "%i%i%i", &x, &y, &z);
printf("rc%d %d %o %x\n", rc, x, y, z);
float a,b;
double c,d;
rc = sscanf("123456.123456 -.532 987654321.987654321 123",
"%f%f%lf%lf", &a, &b, &c, &d);
printf("rc%d %f %f %.15f %f\n", rc, a,b,c,d);
char s1[10], s2[10], s3[10], s4[10];
rc = sscanf(" abc def ghi jkl ", "%s%5s%2s%6c",
&s1, &s2, &s3, &s4);
printf("rc%d '%s' '%s' '%s' '%s'\n", rc, s1, s2, s3, s4);
return 0;
}
#endif // LAB >= 9
|
the_stack_data/242331708.c | #include <stdio.h>
int main(int argc, char *argv[]) {
if (argc < 3) {
printf("Usage: stlm username password\n");
return 0;
}
printf("%s %s\n", argv[1], argv[2]);
}
|
the_stack_data/170814.c | #include <stdio.h>
void rConvert(char* str, int num);
int main(){
int num;
char str[50];
scanf("%d", &num);
rConvert(str, num);
puts(str);
return 0;
}
void rConvert(char* str, int num){
if ( (num/10)<=0 ) {
/* missing code (i) */
*str = num + '0';
*(++str) = '\0';
}
else {
/* missing code (ii) */
*str = num%10 + '0';
rConvert(str+1, num/10);
}
} |
the_stack_data/72011938.c | /* { dg-require-effective-target arm_neon_hw } */
/* { dg-options "-O2 -ftree-vectorize -ffast-math" } */
/* { dg-add-options arm_neon } */
/* { dg-final { scan-assembler "vmls\\.i32" } } */
/* Verify that VMLS is used. */
void f1(int n, int a, int x[], int y[]) {
int i;
for (i = 0; i < n; ++i)
y[i] = y[i] - a * x[i];
}
|
the_stack_data/36329.c | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define SIZE 5
#define DEGREE_TO_RADIAN 3.14159 / 180
double getRadian(int degree); // convert from degree to radian
int main()
{
// Variable declaration
int X[SIZE] = { 10, 20, 30, 40, 50 };
double Y[SIZE];
// Display output
puts("X \t Y");
puts("----------------");
// Iterate
for (int i = 0; i < SIZE; ++i)
{
/*
for each angle (degree) in array X,
converts into radian compute its cosine and
store in the same index location in array Y.
*/
Y[i] = cos(getRadian(X[i]));
printf("%d \t %.2f \n", X[i], Y[i]);
}
puts("----------------");
puts("\n");
system("pause");
return 0;
}
double getRadian(int degree)
{
return degree * DEGREE_TO_RADIAN;
} |
the_stack_data/1187749.c | #include <stdio.h>
int isprime(int n)
{
int i,f,c=1;
for(i=2;i<n;i++)
{
if(n%i==0)
c++;
}
if(c==2)
{
f=1;
}
else
{
f=0;
}
return f;
}
int main()
{
int num;
printf("Enter a number:");
scanf("%d",&num);
int r=isprime(num);
if(r==0)
printf("%d is prime",num);
else
printf("%d is not prime",num);
return 0;
}
|
the_stack_data/97013064.c | /*
* Copyright (c) [2020-2021] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
*
* http://license.coscl.org.cn/MulanPSL2
*
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR
* FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
// CHECK: [[# FILENUM:]] "{{.*}}/boundary_count_call_insert.c"
#include <stdio.h>
struct S {
char info[2];
long a, b;
char tag[2];
};
struct A {
char info[2];
short s;
};
__attribute__((count(10)))
void f(char *buf) {
return;
}
void bar() {
char array[12];
char array2d[3][12];
struct A a;
char *m = &array2d[2][3];
// CHECK: LOC [[# FILENUM]] [[# @LINE + 2 ]]{{$}}
// CHECK: assertle{{.*}}
f(m); // expected-warning
}
int main() {
return 0;
}
|
the_stack_data/118256.c | #include<stdio.h>
int main() {
int num=0,temp=0,b=0,sum=0;
int i=0;
for(i=0;i<2;i++)
{
printf("\nEnter the number: ");
scanf("%d",&num);
b=num;
while(num>0)
{
temp=num%10;
sum=sum+(temp*temp*temp);
num=(num/10);
}
if(sum==b)
printf("The number is an armstrong number.");
else
printf("The number is not an armstrong number.");
}
}
|
the_stack_data/242330480.c | /*
* Secure packet radio login command. The system first prompts for the
* user's name. It then generates and sends a unique "challenge" (a 64-bit
* hexadecimal integer) based on the time of day. The user encrypts
* this value using the Data Encryption Standard and his private key and
* type it back to the system. The system also encrypts the challenge
* with the user's key and compares the two. If they match, he's in.
*
* 18 December 1986 Phil Karn, KA9Q
*
* mods:
* 870318 Bdale, N3EUA Add code to run user's .login commands.
* 870317 Bdale, N3EUA Hacked to remove putenv() by calling execle()
* instead of execl().
*/
#include <stdio.h>
#include <strings.h>
#include <pwd.h>
#include <utmp.h>
#define KEYFILE "/etc/rkeys" /* This file must be read-protected */
main(argc,argv)
int argc;
char *argv[];
{
struct passwd *pp,*getpwnam();
unsigned long t;
FILE *fp;
char name[64];
char key[8];
char work[8];
char answer[8];
char fbuf[64];
char ibuf[64];
char home[64];
char login[64];
char shell[64];
char user[64];
char *keyp;
char *cp,*tty,*ttyname();
int i,ikey[8];
struct utmp utmp;
char *ep[5]; /* we'll build an environment here */
if((fp = fopen(KEYFILE,"r")) == NULL){
printf("Can't open key file\n");
exit(1);
}
/* Get user's name and look it up in the database */
printf("Enter login name: ");
fgets(ibuf,sizeof(ibuf),stdin);
if((cp = index(ibuf,'\n')) != NULL)
*cp = '\0';
strncpy(name,ibuf,sizeof(name));
for(;;){
fgets(fbuf,sizeof(fbuf),fp);
if(feof(fp)){
printf("No key for login name\n");
exit(2);
}
if((cp = index(fbuf,'\n')) != NULL)
*cp = '\0';
if(strncmp(name,fbuf,strlen(name)) == 0)
break;
}
fclose(fp);
/* Find the user's DES key */
if((keyp = index(fbuf,' ')) == NULL){
printf("Missing key field\n");
exit(3);
}
keyp++;
/* Initialize DES with the user's key */
sscanf(keyp,"%2x%2x%2x%2x%2x%2x%2x%2x",
&ikey[0], &ikey[1], &ikey[2], &ikey[3], &ikey[4], &ikey[5],
&ikey[6], &ikey[7]);
for(i=0;i<8;i++)
key[i] = ikey[i];
desinit(0);
setkey(key);
/* Generate and send the challenge */
time(&t);
printf("Challenge: %016x\n",t);
/* Encrypt it locally... */
for(i=0;i<4;i++)
work[i] = 0;
work[4] = t >> 24;
work[5] = t >> 16;
work[6] = t >> 8;
work[7] = t;
endes(work);
/* ...and see if the user can do the same */
printf("Response: ");
for(i=0;i<8;i++){
scanf("%2x",&t);
answer[i] = t;
}
printf("\n"); /* I like it better with a blank line here - bdale */
/* Compare the ciphertexts. If they match, he's in */
for(i=0; i < 8; i++){
if(work[i] != answer[i]){
printf("Wrong response\n");
exit(4);
}
}
if((pp = getpwnam(name)) == NULL){
printf("login name \"%s\" not in /etc/passwd\n",name);
exit(4);
}
if((fp = fopen(UTMP_FILE,"r+")) == NULL){
printf("can't open utmp\n");
exit(4);
}
tty = ttyname(0);
if((cp = rindex(tty,'/')) != NULL)
tty = cp + 1;
while(fread((char *)&utmp,sizeof(struct utmp),1,fp),!feof(fp)){
if(strncmp(utmp.ut_line,tty,8) == 0){
strncpy(utmp.ut_name,name,8);
fseek(fp,(long)-sizeof(struct utmp),1);
fwrite((char *)&utmp,sizeof(struct utmp),1,fp);
break;
}
}
fclose(fp);
chdir(pp->pw_dir);
setregid(pp->pw_gid,pp->pw_gid);
setreuid(pp->pw_uid,pp->pw_uid);
if(pp->pw_shell == NULL || *pp->pw_shell == '\0')
pp->pw_shell = "/bin/ksh";
sprintf(home,"HOME=%s",pp->pw_dir);
sprintf(shell,"SHELL=%s",pp->pw_shell);
sprintf(user,"USER=%s",name);
sprintf(login,"%s/.login",pp->pw_dir);
ep[0] = home;
ep[1] = shell;
ep[2] = user;
ep[3] = (char *) NULL;
execle(pp->pw_shell,"-",0,ep);
printf("Exec failed\n");
}
|
the_stack_data/106092.c | // PARAM: --sets solver td3 --enable ana.int.interval --disable ana.int.def_exc --disable exp.fast_global_inits --enable exp.partition-arrays.enabled --set ana.activated "['base','expRelation','octagon']"
// These examples were cases were we saw issues of not reaching a fixpoint during development of the octagon domain. Since those issues might
// resurface, these tests without asserts are included
int main(int argc, char const *argv[])
{
int top;
int pad = 0;
int to_uppcase;
int change_case = 0;
while (change_case != 1 && to_uppcase != 0) {
if(top == 1) {
to_uppcase = 1;
continue;
}
if(top == 2) {
change_case = 1;
continue;
}
break;
}
return 0;
}
|
the_stack_data/609799.c | #include <math.h>
#include <stdio.h>
#include <time.h>
/*
* Pow
*
* Experimenting with power algorithms
*
* These are functions that raise a to the bth power fn(a, b)
*
* Only worrying about b being >= 0 and being an integer (for now)
*
* Structure:
* - Functions
* - Test boilerplate / registration
* - Main
*/
/*
* ========================================
* Functions
* ========================================
*/
/*
* Recursive 2
*
* Square each power every time
*/
double pow_rec2(double a, double b)
{
if (b == 0) {
return 1;
}
else if (b == 1) {
return a;
}
return a * a * pow_rec2(a, b - 2);
}
/*
* Loop
*
* Loop the multiplication
*/
double pow_loop(double a, double b)
{
double result = 1;
while (b-- > 0) {
result *= a;
}
return result;
}
/*
* ========================================
* Testing stuff
* ========================================
*/
struct Function {
double (*function)(double, double);
const char *name;
};
/* Register the functions */
struct Function functions[] = {
{pow, "stdlib"},
{pow_rec2, "Recursive 2"},
{pow_loop, "Loop"},
};
/* Test Cases */
int tests[][2] = {
{2, 2},
{2, 3},
{2, 64},
{9, 10}
};
/*
* ========================================
* Main
*
* Test runner
* ========================================
*/
int main(void)
{
for (int i = 0; i < sizeof(tests) / (2 * sizeof(int)); ++i) {
printf("%d to the %d\n\n", tests[i][0], tests[i][1]);
for (int j = 0; j < sizeof(functions) / sizeof(struct Function); ++j) {
clock_t start, end;
double result;
start = clock();
result = functions[j].function(tests[i][0], tests[i][1]);
end = clock();
printf("Function: %s\n", functions[j].name);
printf("Result: %f\n", result);
printf("Time elapsed: %f\n\n", (double) (end - start) / CLOCKS_PER_SEC);
}
printf("====================\n");
}
return 0;
}
|
the_stack_data/29265.c | #include <assert.h>
#include <math.h>
#include <pthread.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
/* You may need to define struct here */
typedef struct _arg {
int low;
int high;
const float *vec;
double partial_sum;
} arg_t;
/*!
* \brief subroutine function
*
* \param arg, input arguments pointer
* \return void*, return pointer
*/
void *l2_norm(void *arg) {
arg_t *data = (arg_t *)(arg);
const float *vec = data->vec;
double sum = 0.0f;
for (int i = data->low; i < data->high; ++i) {
sum += vec[i] * vec[i];
}
data->partial_sum = sum;
return NULL;
}
/*!
* \brief wrapper function
*
* \param vec, input vector array
* \param len, length of vector
* \param k, number of threads
* \return float, l2 norm
*/
float multi_thread_l2_norm(const float *vec, size_t len, int k) {
int chunk_size = len / k;
pthread_t ph[k];
arg_t args[k];
int rc;
int low = 0, high = 0;
for (int i = 0; i < k; i++) {
low = high;
high += chunk_size;
args[i] = (arg_t){low, high, vec, 0};
rc = pthread_create(&ph[i], NULL, l2_norm, (void *)&args[i]);
assert(rc == 0);
}
double sum = 0.0f;
for (int i = 0; i < k; i++) {
rc = pthread_join(ph[i], NULL);
assert(rc == 0);
sum += args[i].partial_sum;
}
return sqrt(sum);
}
// baseline function
float single_thread_l2_norm(const float *vec, size_t len) {
double sum = 0.0f;
for (int i = 0; i < len; ++i) {
sum += vec[i] * vec[i];
}
sum = sqrt(sum);
return sum;
}
float *gen_array(size_t len) {
float *p = (float *)malloc(len * sizeof(float));
if (!p) {
printf("failed to allocate %ld bytes memory!", len * sizeof(float));
exit(1);
}
return p;
}
void init_array(float *p, size_t len) {
for (int i = 0; i < len; ++i) {
p[i] = (float)rand() / RAND_MAX;
}
}
int main(int argc, char *argv[]) {
if (argc != 3) {
fprintf(stderr,
"Error: The program accepts exact 2 intergers.\n The first is the "
"vector size and the second is the number of threads.\n");
exit(1);
}
const int num = atoi(argv[1]);
const int k = atoi(argv[2]);
if (num < 0 || k < 1) {
fprintf(stderr, "Error: invalid arguments.\n");
exit(1);
}
printf("Vector size=%d\tthreads num=%d.\n", num, k);
float *vec = gen_array(num);
init_array(vec, num);
float your_result, groud_truth;
// warmup
single_thread_l2_norm(vec, num);
{
struct timespec start, end;
printf("[Singlethreading]start\n");
clock_gettime(CLOCK_MONOTONIC_RAW, &start);
groud_truth = single_thread_l2_norm(vec, num);
clock_gettime(CLOCK_MONOTONIC_RAW, &end);
float delta_us = (end.tv_sec - start.tv_sec) * 1.0e6 +
(end.tv_nsec - start.tv_nsec) * 1.0e-3;
printf("[Singlethreading]The elapsed time is %.2f ms.\n",
delta_us / 1000.0);
}
{
struct timespec start, end;
printf("[Multithreading]start\n");
clock_gettime(CLOCK_MONOTONIC_RAW, &start);
your_result = multi_thread_l2_norm(vec, num, k);
clock_gettime(CLOCK_MONOTONIC_RAW, &end);
float delta_us = (end.tv_sec - start.tv_sec) * 1.0e6 +
(end.tv_nsec - start.tv_nsec) * 1.0e-3;
printf("[Multithreading]The elapsed time is %.2f ms.\n", delta_us / 1000.0);
}
if (fabs(your_result - groud_truth) < 1e-6) {
printf("Accepted!\n");
} else {
printf("Wrong Answer!\n");
printf("your result=%.6f\tground truth=%.6f\n", your_result, groud_truth);
}
free(vec);
return 0;
} |
the_stack_data/184519060.c | #if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)strcpy.c 5.2 (Berkeley) 3/9/86";
#endif LIBC_SCCS and not lint
/*
* Copy string s2 to s1. s1 must be large enough.
* return s1
*/
char *
strcpy(s1, s2)
register char *s1, *s2;
{
register char *os1;
os1 = s1;
while (*s1++ = *s2++)
;
return(os1);
}
|
the_stack_data/95449454.c | #include <string.h>
void *memcpy(void *dst, const void *src, size_t n)
{
char *p = dst;
const char *q = src;
while (n--)
*p++ = *q++;
return dst;
}
|
the_stack_data/41827.c | #include <signal.h>
#include <unistd.h>
#include <stdlib.h>
void foo (void);
void bar (void);
void subroutine (int);
void handler (int);
void have_a_very_merry_interrupt (void);
main ()
{
foo (); /* Put a breakpoint on foo() and call it to see a dummy frame */
have_a_very_merry_interrupt ();
}
void
foo (void)
{
}
void
bar (void)
{
*(char *)0 = 0; /* try to cause a segfault */
/* On MMU-less system, previous memory access to address zero doesn't
trigger a SIGSEGV. Trigger a SIGILL. Each arch should define its
own illegal instruction here. */
#if defined(__arm__)
asm(".word 0xf8f00000");
#elif defined(__TMS320C6X__)
asm(".word 0x56454313");
#else
#endif
}
void
handler (int sig)
{
subroutine (sig);
}
/* The first statement in subroutine () is a place for a breakpoint.
Without it, the breakpoint is put on the while comparison and will
be hit at each iteration. */
void
subroutine (int in)
{
int count = in;
while (count < 100)
count++;
}
void
have_a_very_merry_interrupt (void)
{
signal (SIGALRM, handler);
alarm (1);
sleep (2); /* We'll receive that signal while sleeping */
}
|
the_stack_data/25138177.c | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
char* replace_name(char* in) {
char* out = strdup(in);
for(int i = 0; i < strlen(out); i++) {
if(out[i] == '/' || out[i] == '.') out[i] = '_';
}
return out;
}
int main(int argc, char* argv[]) {
if(argc != 2) {
printf("Usage: %s <file>\n", argv[0]);
return 1;
}
FILE* f = fopen(argv[1], "rb");
if(!f) {
printf("Could not open file %s\n", argv[1]);
return 1;
}
fseek(f, 0, SEEK_END);
size_t len = ftell(f);
fseek(f, 0, SEEK_SET);
char* data = malloc(len + 1);
fread(data, len, 1, f);
fclose(f);
char* name = replace_name(argv[1]);
printf("unsigned char %s[] = {", name);
for(int i = 0; i < (int)len; i++) {
printf("0x%02x", (unsigned char)(data[i]));
if(i < (int)len - 1) {
printf(", ");
}
}
printf("};\nunsigned int %s_len = %d;\n", name, (int)len);
fflush(stdout);
free(name);
free(data);
return 0;
}
|
the_stack_data/82950693.c | #include<stdio.h>
#include<math.h>
// function to solve AX=b for X
void gausspivot(int n,double A[n][n+1],double x[]){
int i,j,k;
for(i=0;i<n-1;i++){
//Partial Pivoting
for(k=i+1;k<n;k++){
//If the diagonal element is less than the terms below it
if(fabs(A[i][i])<fabs(A[k][i])){
//Swap the rows in the matrix
for(j=0;j<=n;j++){
double temp;
temp=A[i][j];
A[i][j]=A[k][j];
A[k][j]=temp;
}
}
}
//Begin the Gauss Elimination
for(k=i+1;k<n;k++){
double term;
term=A[k][i]/A[i][i];
for(j=0;j<=n;j++){
A[k][j]=A[k][j]-term*A[i][j];
}
}
}
//Start with the back-substitution
for(i=n-1;i>=0;i--){
x[i]=A[i][n];
for(j=i+1;j<n;j++){
x[i]=x[i]-A[i][j]*x[j];
}
x[i]=x[i]/A[i][i];
}
// printing the x array
for(i=0;i<n;i++) {
printf(" a[%d]= %.3lf\n",i,x[i]);
}
}
int main()
{
int n,N=11; // no of datapoints
//int n=2; // order of matrix or n-1 is the order of polynomial
printf("enter the order of augmented matrix:");
scanf("%d",&n);
int i,j,k;
double x[]={0,0.2,0.4,0.6,0.8,1,1.2,1.4,1.6,1.8,2};
double y[]={6.33,6.51,6.43,5.85,4.71,3.13,1.53,0.64,1.58,5.91,15.71};
double sigma[]={0.06,0.13,0.19,0.23,0.23,0.19,0.11,0.05,0.14,0.59,1.73};
double A[n][n+1];
// part A of augmented matrix [A:b]
for(i=0;i<n;i++) {
for(j=0;j<n;j++) {
double weight,sum=0,w=0;
for(k=0;k<N;k++) {
weight=1/pow(sigma[k],2);
sum+=pow(x[k],i+j)*weight;
w+=weight;
}
A[i][j]=sum/w;
}
}
// part b of augmented matrix [A:b]
for(i=0;i<n;i++) {
double weight,sum=0,w=0;
for(k=0;k<N;k++) {
weight=1/pow(sigma[k],2);
sum=sum+(pow(x[k],i)*y[k]*weight);
w+=weight;
}
A[i][n]=sum/w;
}
double a[n],yf[N]; //yf[N] is fitted values
// finding the coefficients
printf("The coefficients for order [%d] are:\n",n-1);
gausspivot(n,A,a);
FILE*fp=NULL;
fp=fopen("4.txt","w");
// defining the polynomial
k=0;
while(k<N) {
double sum=0;
for (i=0;i<n;++i)
sum += a[i]*pow(x[k],i);
yf[k]=sum;
fprintf(fp,"%.3lf\t%lf\n",x[k],yf[k]);
k++;
}
// calculating the chi square
double chi=0;
for (i=0;i<N;++i)
chi += 1/pow(sigma[i],2)*(yf[i]-y[i])*(yf[i]-y[i]);
printf("Chi square for order [%d]:%lf\n",n-1,chi);
} |
the_stack_data/701464.c | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <math.h>
#include <stdbool.h>
bool step(double_t speed, double_t *dist_remaining, double_t *time_passed);
int main() {
double_t dist_total = 42195.0;
double_t speed = 17.0 / 3.6;
bool finnished = false;;
double_t dist_current = dist_total;
double_t speed_current = speed;
double_t time_passed = 0.0f;
while (finnished == false) {
finnished = step(speed, &dist_current, &time_passed);
printf("%7.2f%10.2f%10.2f\n", speed_current, dist_current, time_passed);
}
printf("Time used: %ih %im %fs\n", (int)floor(time_passed / 3600.0), (int)floor(fmod(time_passed / 60.0, 60.0)), fmod(time_passed, 60.0));
exit(0);
}
bool step(double_t speed, double_t *dist_remaining, double_t *time_passed) {
double_t speed_current = speed * pow(0.99, floor(fmax(*time_passed - 3000.0, 0) / 600.0));
printf(">%f\n", floor(fmax(*time_passed - 3000.0, 0) / 600.0));
double_t dist_remaining_10m = fma(speed_current, -600.0, (*dist_remaining));
//printf("%f\n", dist_remaining_10m);
if (dist_remaining_10m > 0) {
*time_passed += 600.0;
*dist_remaining = dist_remaining_10m;
return false;
} else {
*time_passed += *dist_remaining / speed_current;
*dist_remaining = 0;
return true;
}
} |
the_stack_data/165767097.c | #ifdef STM32F2xx
#include "stm32f2xx_hal_cryp.c"
#endif
#ifdef STM32F4xx
#include "stm32f4xx_hal_cryp.c"
#endif
#ifdef STM32F7xx
#include "stm32f7xx_hal_cryp.c"
#endif
#ifdef STM32G0xx
#include "stm32g0xx_hal_cryp.c"
#endif
#ifdef STM32G4xx
#include "stm32g4xx_hal_cryp.c"
#endif
#ifdef STM32H7xx
#include "stm32h7xx_hal_cryp.c"
#endif
#ifdef STM32L0xx
#include "stm32l0xx_hal_cryp.c"
#endif
#ifdef STM32L1xx
#include "stm32l1xx_hal_cryp.c"
#endif
#ifdef STM32L4xx
#include "stm32l4xx_hal_cryp.c"
#endif
#ifdef STM32L5xx
#include "stm32l5xx_hal_cryp.c"
#endif
#ifdef STM32MP1xx
#include "stm32mp1xx_hal_cryp.c"
#endif
#ifdef STM32WBxx
#include "stm32wbxx_hal_cryp.c"
#endif
|
the_stack_data/84774.c | #include <stdio.h>
int main(int argc, char *argv[])
{
int distance = 100;
float power = 2.345f;
double super_power = 56789.121344;
char initial = "A";
char first_name[] = "Zed";
char last_name[] = "Shaw";
printf("You are %d miles away. \n", distance);
printf("You have %f levels of power. \n", power);
printf("You have %f awesome super powers. \n", super_power);
printf("I have an initial %c. \n", initial);
printf("I have a first name %s.\n", first_name);
printf("I have a last name %s.\n", last_name);
printf("My whole name is %s %c. %s.\n", first_name, initial, last_name);
return 0;
}
|
the_stack_data/64232.c | #include <stdio.h>
#define MAXLINE 1000
int get_line(char line[], int maxline);
void copy(char to[], char from[]);
/* print the longest input line */
int main()
{
int len;
int max;
char line[MAXLINE];
char longest[MAXLINE];
max = 0;
while ((len = get_line(line, MAXLINE)) > 0) {
if (len > max) {
max = len;
copy(longest, line);
}
}
if(max > 0)
printf("%s",longest);
}
int get_line(char s[], int lim)
{
int c, i;
for(i = 0; i < lim - 1 && (c = getc(stdin)) != EOF && c != '\n'; ++i)
s[i] = c;
if (c == '\n') {
s[i] = c;
++i;
}
s[i] = '\0';
return i;
}
void copy(char to[], char from[])
{
int i;
i = 0;
while ((to[i] = from[i]) != '\0')
++i;
}
|
the_stack_data/43574.c | // #include libs.h Ex:
#include <stdio.h>
#include <stdlib.h>
// Main funcion (with args):
int main(int argc, char *argv[]) {
// Check args. 2 is our example number.
if (argc < 2) {
printf("Usage %s [instructions]\n", argv[0]);
} else {
// Your code goes here.
printf("Do your thing.\n");
}
// Close program.
return 0;
} // End.
|
the_stack_data/193894234.c | #include <stdio.h>
#include <stdlib.h>
//Preorder , Inorder and Postorder traversal in binary tree
typedef struct node
{
int data;
struct node *left;
struct node *right;
} node;
node *create()
{
int x;
printf("\nEnter data (-1 for no node) -: ");
scanf("%d", &x);
if (x == -1)
{
return NULL;
}
else
{
node *newnode;
newnode = (node *)malloc(sizeof(node));
newnode->data = x;
printf("\nEnter left child of %d", x);
newnode->left = create();
printf("\nEnter right child of %d", x);
newnode->right = create();
return newnode;
}
}
void preorder(node *root)
{
if (root == NULL)
{
return;
}
else
{
printf("%d\t", root->data);
preorder(root->left);
preorder(root->right);
return;
}
}
void inorder(node *root)
{
if (root == NULL)
{
return;
}
else
{
inorder(root->left);
printf("%d\t", root->data);
inorder(root->right);
return;
}
}
void postorder(node *root)
{
if (root == NULL)
{
return;
}
else
{
postorder(root->left);
postorder(root->right);
printf("%d\t", root->data);
return;
}
}
int main()
{
int ch;
printf("Creation of the tree\n");
node *root = NULL;
root = create();
while (1)
{
printf("\n\n1. Preorder traversal of tree\n2. Inorder traversal of tree\n3. Postorder traversal of tree\n4. Exit");
printf("\nEnter your choice -: ");
scanf("%d", &ch);
switch (ch)
{
case 1:
printf("\nPreorder traversal of the tree is -: \n");
preorder(root);
break;
case 2:
printf("\nInorder traversal of the tree is -: \n");
inorder(root);
break;
case 3:
printf("\nPostorder traversal of the tree is -: \n");
postorder(root);
break;
case 4:
exit(0);
break;
default:
printf("\nInvalid choice!!\nPlease make a valid choice.");
break;
}
}
return 0;
} |
the_stack_data/1244739.c | /***
* This code is a part of EvoApproxLib library (ehw.fit.vutbr.cz/approxlib) distributed under The MIT License.
* When used, please cite the following article(s): V. Mrazek, L. Sekanina, Z. Vasicek "Libraries of Approximate Circuits: Automated Design and Application in CNN Accelerators" IEEE Journal on Emerging and Selected Topics in Circuits and Systems, Vol 10, No 4, 2020
* This file contains a circuit from a sub-set of pareto optimal circuits with respect to the pwr and mae parameters
***/
// MAE% = 1.82 %
// MAE = 9.3
// WCE% = 6.05 %
// WCE = 31
// WCRE% = 850.00 %
// EP% = 96.88 %
// MRE% = 15.90 %
// MSE = 128
// PDK45_PWR = 0.019 mW
// PDK45_AREA = 46.0 um2
// PDK45_DELAY = 0.35 ns
#include <stdint.h>
#include <stdlib.h>
uint64_t add9se_09M(const uint64_t B,const uint64_t A)
{
uint64_t dout_28, dout_29, dout_30, dout_31, dout_32, dout_33, dout_34, dout_36, dout_43, dout_44, dout_45, dout_46, dout_47, dout_48, dout_51, dout_53, dout_58, dout_59, dout_62, dout_64, dout_65, dout_66, dout_67, dout_71, dout_72, dout_73, dout_74, dout_75, dout_76;
uint64_t O;
dout_28=((A >> 5)&1)&((B >> 5)&1);
dout_29=((A >> 5)&1)^((B >> 5)&1);
dout_30=((A >> 6)&1)&((B >> 6)&1);
dout_31=((A >> 6)&1)^((B >> 6)&1);
dout_32=((A >> 7)&1)&((B >> 7)&1);
dout_33=((A >> 7)&1)^((B >> 7)&1);
dout_34=((A >> 8)&1)&((B >> 8)&1);
dout_36=((A >> 8)&1)^((B >> 8)&1);
dout_43=dout_31&dout_28;
dout_44=dout_31&dout_29;
dout_45=dout_30|dout_43;
dout_46=dout_36&dout_32;
dout_47=dout_36&dout_33;
dout_48=dout_34|dout_46;
dout_51=dout_44&((A >> 4)&1);
dout_53=dout_45|dout_51;
dout_58=dout_47&dout_53;
dout_59=dout_48|dout_58;
dout_62=((B >> 4)&1)&((A >> 4)&1);
dout_64=dout_29&((A >> 4)&1);
dout_65=dout_28|dout_64;
dout_66=dout_33&dout_53;
dout_67=dout_32|dout_66;
dout_71=((B >> 4)&1)^dout_62;
dout_72=dout_29^((A >> 4)&1);
dout_73=dout_31^dout_65;
dout_74=dout_33^dout_53;
dout_75=dout_36^dout_67;
dout_76=dout_36^dout_59;
O = 0;
O |= (dout_73&1) << 0;
O |= (dout_34&1) << 1;
O |= (dout_72&1) << 2;
O |= (dout_74&1) << 3;
O |= (dout_71&1) << 4;
O |= (dout_72&1) << 5;
O |= (dout_73&1) << 6;
O |= (dout_74&1) << 7;
O |= (dout_75&1) << 8;
O |= (dout_76&1) << 9;
return O;
}
|
the_stack_data/87638997.c | #include <stdio.h>
int main(int argc,char *argv[])
{
int i = -1234;
int count;
printf("i=%u\n%n",i,&count);
printf("count=%d\n",count);
}
|
the_stack_data/43888099.c | /// MentOS, The Mentoring Operating system project
/// @file touch.c
/// @brief
/// @copyright (c) 2014-2021 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#include <sys/unistd.h>
#include <string.h>
#include <stdio.h>
#include <fcntl.h>
int main(int argc, char** argv)
{
if (argc != 2) {
printf("%s: missing operand.\n", argv[0]);
printf("Try '%s --help' for more information.\n\n", argv[0]);
return 1;
}
if (strcmp(argv[1], "--help") == 0) {
printf(
"Updates modification times of a given fine. If the does not"
"exists, it creates it.\n"
);
printf("Usage:\n");
printf(" touch <filename>\n");
return 0;
}
int fd = open(argv[1], O_RDONLY, 0);
if (fd < 0) {
fd = open(argv[1], O_CREAT, 0);
if (fd >= 0) {
close(fd);
}
}
printf("\n");
return 0;
}
|
the_stack_data/155201.c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_str_is_uppercase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: drosa-ta <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/17 21:46:58 by drosa-ta #+# #+# */
/* Updated: 2017/01/17 21:47:22 by drosa-ta ### ########.fr */
/* */
/* ************************************************************************** */
int ft_str_is_uppercase(char *str)
{
int i;
int result;
i = 0;
result = 1;
while (str[i])
{
if (str[i] < 'A' || str[i] > 'Z')
result = 0;
i++;
}
return (result);
}
|
the_stack_data/51699386.c | #include <stdio.h>
int main()
{
// int radius = 5;
// float pi = 3.14;
// printf("The area of the circle is %f", pi*radius*radius);
float pi = 3.14;
int radius, height;
printf("Enter the radius of the cylinder \n");
scanf("%d", &radius);
printf("Area of the circle is %f \n", pi * radius * radius);
printf("Enter the height of cylinder \n");
scanf("%d", &height);
printf("The volume of the cylinder is %f", pi * radius * radius * height);
return 0;
} |
the_stack_data/154189.c | /*-
* Copyright (c) 1983, 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $OpenBSD: mkpath.c,v 1.2 2005/06/20 07:14:06 otto Exp $
* $FreeBSD: releng/11.0/usr.bin/patch/mkpath.c 246091 2013-01-29 20:05:16Z delphij $
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <err.h>
#include <errno.h>
#include <string.h>
int mkpath(char *);
/* Code taken directly from mkdir(1).
* mkpath -- create directories.
* path - path
*/
int
mkpath(char *path)
{
struct stat sb;
char *slash;
int done = 0;
slash = path;
while (!done) {
slash += strspn(slash, "/");
slash += strcspn(slash, "/");
done = (*slash == '\0');
*slash = '\0';
if (stat(path, &sb)) {
if (errno != ENOENT || (mkdir(path, 0777) &&
errno != EEXIST)) {
warn("%s", path);
return (-1);
}
} else if (!S_ISDIR(sb.st_mode)) {
warnx("%s: %s", path, strerror(ENOTDIR));
return (-1);
}
*slash = '/';
}
return (0);
}
|
the_stack_data/28261837.c | /* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-phiopt1-details" } */
int f(int a, int b)
{
int c = b;
if (a != b)
c = a;
return c;
}
/* Should have no ifs left after straightening. */
/* { dg-final { scan-tree-dump-times "if " 0 "phiopt1"} } */
|
the_stack_data/92389.c | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <assert.h>
int stub_arg1(int a) {
assert(a == 1);
return a * a;
}
int stub_arg2(int a, int b) {
assert(a == 1);
assert(b == 2);
return a * a + b * b;
}
int stub_arg3(int a, int b, int c) {
assert(a == 1);
assert(b == 2);
assert(c == 3);
return a * a + b * b + c * c;
}
int stub_arg4(int a, int b, int c, int d) {
assert(a == 1);
assert(b == 2);
assert(c == 3);
assert(d == 4);
return a * a + b * b + c * c + d * d;
}
int stub_arg5(int a, int b, int c, int d, int e) {
assert(a == 1);
assert(b == 2);
assert(c == 3);
assert(d == 4);
assert(e == 5);
return a * a + b * b + c * c + d * d + e * e;
}
int stub_arg6(int a, int b, int c, int d, int e, int f) {
assert(a == 1);
assert(b == 2);
assert(c == 3);
assert(d == 4);
assert(e == 5);
assert(f == 6);
return a * a + b * b + c * c + d * d + e * e + f * f;
}
int stub_arg7(int a, int b, int c, int d, int e, int f, int g) {
assert(a == 1);
assert(b == 2);
assert(c == 3);
assert(d == 4);
assert(e == 5);
assert(f == 6);
assert(g == 7);
return a * a + b * b + c * c + d * d + e * e + f * f + g * g;
}
int stub_arg8(int a, int b, int c, int d, int e, int f, int g, int h) {
assert(a == 1);
assert(b == 2);
assert(c == 3);
assert(d == 4);
assert(e == 5);
assert(f == 6);
assert(g == 7);
assert(h == 8);
return a * a + b * b + c * c + d * d + e * e + f * f + g * g + h * h;
}
bool stub_bool(int b) {
return b;
}
struct stub_struct {
char c;
int n;
int a[4];
struct {
int x, y, z;
} v;
};
void stub_struct(struct stub_struct *s) {
assert(s->c == 'A');
assert(s->n == 45);
assert(s->a[0] == 5);
assert(s->a[1] == 3);
assert(s->a[2] == 8);
assert(s->a[3] == 7);
assert(s->v.x == 67);
assert(s->v.y == 1);
assert(s->v.z == -41);
s->c = 'Z';
s->n = 82;
s->a[0] = 4;
s->a[1] = 4;
s->a[2] = 1234;
s->a[3] = -571;
s->v.x = 98;
s->v.y = 12;
s->v.z = 1;
}
|
the_stack_data/54201.c | #include<stdio.h>
int main(){
int n,k,i,h;
scanf("%d",&n);
h=0;
for(i=1;i<n-1;i++){
for(k=0;k<i*2-1;k++){
h++;}
}
printf("%d\n",h);
for(k=0;k<n-1;k++){
printf(" ");}
printf("*\n");
for(i=1;i<n-1;i++){
for(k=n-i-1;k>0;k--){printf(" ");};
printf("*");
for(k=0;k<i*2-1;k++){printf("#");};
printf("*");
for(k=n-i-1;k>0;k--){printf(" ");}
printf("\n");
}
for(k=0;k<n*2-1;k++){printf("*");};
return 0;
}
|
the_stack_data/73547.c | ////////////////////////////////////////////////////////////////////////////
//
// Function Name : Display()
// Description : Display 5 To 1 On Reverse Order
// Input : Integer
// Output : Integer
// Author : Prasad Dangare
// Date : 24 Feb 2021
//
////////////////////////////////////////////////////////////////////////////
#include<stdio.h>
int Display()
{
int i = 0; // Initilize To 0
for(i = 5; i >= 1; i--) // For Loop To Print In Reverse Order
{
printf("%d\n", i); // Display The Value
}
}
int main() // Entry Point Function
{
Display(); // Function Call
return 0;
} |
the_stack_data/218892753.c | /* 4) Escreva um algoritmo que dados a quantidade de litros de combustível utilizada, os
quilômetros percorridos por um automóvel e o valor do litro de combustível, calcule o
gasto em reais por km. */
#include <stdio.h>
int main(void)
{
float litros;
float km;
float valorlitro;
float gastokm;
printf("Informe a quantidade de litros usado: ");
scanf("%f", &litros);
printf("Informe os quilometros percorridos pelo automovel: ");
scanf("%f", &km);
printf("Informe o valor do litro de gasosa: ");
scanf("%f", &valorlitro);
gastokm = valorlitro * litros / km;
printf("O gasto por km foi de R$: %.2f\n", gastokm);
system("pause");
return (0);
}
|
the_stack_data/55189.c | #include <stdio.h>
void nameWithoutLastName(char *firstname);
int main(void)
{
char firstName[20] = {0};
char lastName[20] = {0};
printf("Please enter you firstname and lastname: ");
scanf("%s", firstName);
scanf("%s", lastName);
printf("%s,%s \n", firstName, lastName);
nameWithoutLastName(firstName);
return 0;
}
void nameWithoutLastName(char *firstname)
{
printf("\"%s\"\n", firstname);
printf("\"%20s\"\n", firstname);
printf("\"%-20s\"\n", firstname);
printf("\"%s \"\n", firstname);
} |
the_stack_data/12636531.c | /* Generated by CIL v. 1.7.0 */
/* print_CIL_Input is false */
struct _IO_FILE;
struct timeval;
extern float strtof(char const *str , char const *endptr ) ;
extern void signal(int sig , void *func ) ;
typedef struct _IO_FILE FILE;
extern int atoi(char const *s ) ;
extern double strtod(char const *str , char const *endptr ) ;
extern int fclose(void *stream ) ;
extern void *fopen(char const *filename , char const *mode ) ;
extern void abort() ;
extern void exit(int status ) ;
extern int raise(int sig ) ;
extern int fprintf(struct _IO_FILE *stream , char const *format , ...) ;
extern int strcmp(char const *a , char const *b ) ;
extern int rand() ;
extern unsigned long strtoul(char const *str , char const *endptr , int base ) ;
void RandomFunc(unsigned long input[1] , unsigned long output[1] ) ;
extern int strncmp(char const *s1 , char const *s2 , unsigned long maxlen ) ;
extern int gettimeofday(struct timeval *tv , void *tz , ...) ;
extern int printf(char const *format , ...) ;
int main(int argc , char *argv[] ) ;
void megaInit(void) ;
extern unsigned long strlen(char const *s ) ;
extern long strtol(char const *str , char const *endptr , int base ) ;
extern unsigned long strnlen(char const *s , unsigned long maxlen ) ;
extern void *memcpy(void *s1 , void const *s2 , unsigned long size ) ;
struct timeval {
long tv_sec ;
long tv_usec ;
};
extern void *malloc(unsigned long size ) ;
extern int scanf(char const *format , ...) ;
void megaInit(void)
{
{
}
}
int main(int argc , char *argv[] )
{
unsigned long input[1] ;
unsigned long output[1] ;
int randomFuns_i5 ;
unsigned long randomFuns_value6 ;
int randomFuns_main_i7 ;
{
megaInit();
if (argc != 2) {
printf("Call this program with %i arguments\n", 1);
exit(-1);
} else {
}
randomFuns_i5 = 0;
while (randomFuns_i5 < 1) {
randomFuns_value6 = strtoul(argv[randomFuns_i5 + 1], 0, 10);
input[randomFuns_i5] = randomFuns_value6;
randomFuns_i5 ++;
}
RandomFunc(input, output);
if (output[0] == 4242424242UL) {
printf("You win!\n");
} else {
}
randomFuns_main_i7 = 0;
while (randomFuns_main_i7 < 1) {
printf("%lu\n", output[randomFuns_main_i7]);
randomFuns_main_i7 ++;
}
}
}
void RandomFunc(unsigned long input[1] , unsigned long output[1] )
{
unsigned long state[1] ;
unsigned long local1 ;
unsigned int copy11 ;
char copy12 ;
{
state[0UL] = (input[0UL] + 51238316UL) + 274866410UL;
local1 = 0UL;
while (local1 < input[1UL]) {
if (state[0UL] < local1) {
copy11 = *((unsigned int *)(& state[local1]) + 1);
*((unsigned int *)(& state[local1]) + 1) = *((unsigned int *)(& state[local1]) + 0);
*((unsigned int *)(& state[local1]) + 0) = copy11;
} else {
state[0UL] = state[local1] * state[local1];
}
if (state[0UL] > local1) {
copy12 = *((char *)(& state[0UL]) + 3);
*((char *)(& state[0UL]) + 3) = *((char *)(& state[0UL]) + 1);
*((char *)(& state[0UL]) + 1) = copy12;
} else {
state[0UL] = state[local1] * state[0UL];
}
local1 += 2UL;
}
output[0UL] = state[0UL] + 839257860UL;
}
}
|
the_stack_data/987519.c | #include <stdio.h>
#include <string.h>
int main() {
char num[400],*numc[]={"ling","yi","er","san","si","wu","liu","qi","ba","jiu"};
int n[400],sum=0,bit[200],temp,k;
int i;
scanf("%s",num);
for(i=0;i<strlen(num);i++) {
n[i]=num[i]-48;
sum+=n[i];
//printf("%d",n[i]);
}
//printf("%d\n",sum);
i=0;
temp=1;
while(temp<=sum) {
bit[i++]=sum/temp%10;
temp*=10;
}
for(k=i-1;k>0;k--) {
printf("%s ",numc[bit[k]]);
}
printf("%s",numc[bit[0]]);
return 0;
}
|
the_stack_data/93001.c | // RUN: %ucc -S -o/dev/null %s
f(double d)
{
f((double)d);
}
|
the_stack_data/50138725.c | #include <stdio.h>
int tamanho(char s[])
{
int i;
for (i=0; s[i];i++);
return(i);
}
int main(int npar, char *pars[]) //Exemplo de main que recebe parametros
{
int i;
printf ("Recebi %d parametros\n", npar);
for (i=1; i<npar; i++){
printf("[%d] %d cars = %s\n", i, tamanho(pars[i]));
}
return(0);
}
|
the_stack_data/151706948.c | /*
* TINET (TCP/IP Protocol Stack)
*
* Copyright (C) 2001-2012 by Dep. of Computer Science and Engineering
* Tomakomai National College of Technology, JAPAN
*
* 上記著作権者は,以下の (1)~(4) の条件か,Free Software Foundation
* によって公表されている GNU General Public License の Version 2 に記
* 述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
* を改変したものを含む.以下同じ)を使用・複製・改変・再配布(以下,
* 利用と呼ぶ)することを無償で許諾する.
* (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
* 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
* スコード中に含まれていること.
* (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
* 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
* 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
* の無保証規定を掲載すること.
* (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
* 用できない形で再配布する場合には,次の条件を満たすこと.
* (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
* 作権表示,この利用条件および下記の無保証規定を掲載すること.
* (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
* 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
*
* 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
* よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
* 含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
* 接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
*
* @(#) $Id: netappn_subr.c 936 2016-05-02 11:18:27Z coas-nagasima $
*/
/*
* ネットワーク応用プログラムサポートルーチン
*/
#ifdef USE_TCP_EXTENTIONS
/*
* alloc_tcp_rep -- TCP 受付口を獲得する。
*/
ER
ALLOC_TCP_REP (ID *repid, ID tskid, T_TCPN_CREP *crep)
{
int_t ix;
*repid = TCP_REP_NONE;
syscall(wai_sem(SEM_ALLOC_TCP_REP_LOCK));
for (ix = NUM_VRID_TCP_REPS; ix -- > 0; ) {
if (TSKID_TCP_REP[ix] == TSK_NONE) {
*repid = VRID_TCP_REP[ix];
TSKID_TCP_REP[ix] = tskid;
break;
}
}
syscall(sig_sem(SEM_ALLOC_TCP_REP_LOCK));
if (*repid == TCP_REP_NONE)
return E_NOEXS;
else
return TCP_CRE_REP(*repid, crep);
}
/*
* free_tcp_rep -- TCP 受付口を解放する。
*/
ER
FREE_TCP_REP (ID repid, bool_t call_tcp_del_rep)
{
int_t ix;
syscall(wai_sem(SEM_ALLOC_TCP_REP_LOCK));
for (ix = NUM_VRID_TCP_REPS; ix -- > 0; ) {
if (repid == VRID_TCP_REP[ix]) {
TSKID_TCP_REP[ix] = TSK_NONE;
break;
}
}
syscall(sig_sem(SEM_ALLOC_TCP_REP_LOCK));
if (call_tcp_del_rep)
return tcp_del_rep(repid);
else
return E_OK;
}
/*
* tcpn_is_cepid -- TCP 通信端点が指定されたネットワーク層なら true を返す。
*/
bool_t
TCP_IS_CEPID (ID cepid)
{
int_t ix;
for (ix = NUM_VRID_TCP_CEPS; ix -- > 0; ) {
if (cepid == VRID_TCP_CEP[ix])
return true;
}
return false;
}
/*
* alloc_tcp_cep -- TCP 通信端点を獲得する。
*/
ER
ALLOC_TCP_CEP (ID *cepid, ID tskid, T_TCP_CCEP *ccep)
{
int_t ix;
*cepid = TCP_CEP_NONE;
syscall(wai_sem(SEM_ALLOC_TCP_CEP_LOCK));
for (ix = NUM_VRID_TCP_CEPS; ix -- > 0; ) {
if (TSKID_TCP_CEP[ix] == TSK_NONE) {
*cepid = VRID_TCP_CEP[ix];
TSKID_TCP_CEP[ix] = tskid;
break;
}
}
syscall(sig_sem(SEM_ALLOC_TCP_CEP_LOCK));
if (*cepid == TCP_CEP_NONE)
return E_NOEXS;
else
return tcp_cre_cep(*cepid, ccep);
}
/*
* free_tcp_cep -- TCP 通信端点を解放する。
*/
ER
FREE_TCP_CEP (ID cepid)
{
int_t ix;
syscall(wai_sem(SEM_ALLOC_TCP_CEP_LOCK));
for (ix = NUM_VRID_TCP_CEPS; ix -- > 0; ) {
if (cepid == VRID_TCP_CEP[ix]) {
TSKID_TCP_CEP[ix] = TSK_NONE;
break;
}
}
syscall(sig_sem(SEM_ALLOC_TCP_CEP_LOCK));
return tcp_del_cep(cepid);
}
#endif /* of #ifdef USE_TCP_EXTENTIONS */
#ifdef USE_UDP_EXTENTIONS
/*
* alloc_udp_cep -- UDP 通信端点を獲得する。
*/
ER
ALLOC_UDP_CEP (ID *cepid, ID tskid, T_UDPN_CCEP *ccep)
{
int_t ix;
*cepid = UDP_CEP_NONE;
syscall(wai_sem(SEM_ALLOC_UDP_CEP_LOCK));
for (ix = NUM_VRID_UDP_CEPS; ix -- > 0; ) {
if (TSKID_UDP_CEP[ix] == TSK_NONE) {
*cepid = VRID_UDP_CEP[ix];
TSKID_UDP_CEP[ix] = tskid;
break;
}
}
syscall(sig_sem(SEM_ALLOC_UDP_CEP_LOCK));
if (*cepid == UDP_CEP_NONE)
return E_NOEXS;
else
return UDP_CRE_CEP(*cepid, ccep);
}
/*
* free_udp_cep -- UDP 通信端点を解放する。
*/
ER
FREE_UDP_CEP (ID cepid, bool_t call_udp_del_cep)
{
int_t ix;
syscall(wai_sem(SEM_ALLOC_UDP_CEP_LOCK));
for (ix = NUM_VRID_UDP_CEPS; ix -- > 0; ) {
if (cepid == VRID_UDP_CEP[ix]) {
TSKID_UDP_CEP[ix] = TSK_NONE;
break;
}
}
syscall(sig_sem(SEM_ALLOC_UDP_CEP_LOCK));
if (call_udp_del_cep)
return UDP_DEL_CEP(cepid);
else
return E_OK;
}
#endif /* of #ifdef USE_UDP_EXTENTIONS */
|
the_stack_data/11074140.c | #include <stdio.h>
#include <math.h>
int ifPrime(int s);
int main()
{
int i,s,p;
scanf("%d",&s);
for(i = s+1;i<100003;i++)
{
if(ifPrime(i))
break;
}
printf("%d",i);
}
int ifPrime(int s)
{
int i,k;
k = sqrt(s);
for(i = 2;i<=k;i++)
if(s%i == 0) break;
if(i<=k)
return 0;
else
return 1;
} |
the_stack_data/1172829.c | /*-
* Copyright 1996, 1997, 1998, 2000 John D. Polstra.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: src/lib/csu/common/crtbegin.c,v 1.8 2002/01/28 19:02:34 obrien Exp $
*/
// RICH: #include <sys/param.h>
// RICH: #include <stdlib.h>
typedef void (*fptr)(void);
static fptr ctor_list[1] __attribute__((section(".ctors"))) = { (fptr) -1 };
static fptr dtor_list[1] __attribute__((section(".dtors"))) = { (fptr) -1 };
static void
do_ctors(void)
{
fptr *fpp;
for(fpp = ctor_list + 1; *fpp != 0; ++fpp)
;
while(--fpp > ctor_list)
(**fpp)();
}
static void
do_dtors(void)
{
fptr *fpp;
for(fpp = dtor_list + 1; *fpp != 0; ++fpp)
(**fpp)();
}
/*
* With very large programs on some architectures (e.g., the Alpha),
* it is possible to get relocation overflows on the limited
* displacements of call/bsr instructions. It is particularly likely
* for the calls from _init() and _fini(), because they are in
* separate sections. Avoid the problem by forcing indirect calls.
*/
static void (*p_do_ctors)(void) = do_ctors;
static void (*p_do_dtors)(void) = do_dtors;
extern void _init(void) __attribute__((section(".init")));
extern void _fini(void) __attribute__((section(".fini")));
void
_fini(void)
{
(*p_do_dtors)();
}
void
_init(void)
{
(*p_do_ctors)();
}
|
the_stack_data/1034558.c | /* MDH WCET BENCHMARK SUITE. File version $Id: minmax.c,v 1.1 2005/11/11 10:18:31 ael01 Exp $ */
/*
* Changes: JG 2005/12/23: Changed type of main to int, added prototypes.
Indented program.
*/
void swap(int *a, int *b);
int min(int a, int b, int c);
int max(int a, int b, int c);
void
swap(int *a, int *b)
{
int tmp = *a;
*a = *b;
*b = tmp;
}
int
min(int a, int b, int c)
{
int m;
if (a <= b) {
if (a <= c)
m = a;
else
m = c;
} else
m = (b <= c) ? b : c;
return m;
}
int
max(int a, int b, int c)
{
if (a <= b)
swap(&a, &b);
if (a <= c)
swap(&a, &c);
return a;
}
int
main(void)
{
int x = 10;
int y = 2;
int z = 1;
if (x <= y)
swap(&x, &y);
else if (x <= z)
x += min(x, y, z);
else
z *= max(z, y, x);
return (y <= z ? y + z : y - z);
}
|
the_stack_data/504058.c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strupcase.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ihoyos-s <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/08/23 12:48:46 by ihoyos-s #+# #+# */
/* Updated: 2021/08/23 12:50:04 by ihoyos-s ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
char *ft_strupcase(char *str)
{
int i;
i = 0;
while (str[i] != '\0')
{
if (str[i] >= 'a' && str[i] <= 'z')
str[i] -= 32;
i++;
}
return (str);
}
|
the_stack_data/225143242.c | /*
* Copyright (c) 2011, 2012 Jonas 'Sortie' Termansen.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* wctype/iswxdigit.c
* Returns whether the wide character is a hexadecimal digit.
*/
#include <wctype.h>
int iswxdigit(wint_t c)
{
if ( iswdigit(c) )
return 1;
if ( L'a' <= c && c <= L'f' )
return 1;
if ( L'A' <= c && c <= L'F' )
return 1;
return 0;
}
|
the_stack_data/142574.c | /*
* sysio.c
*
* Created: 28.04.2020 21:03:57
* Author: Admin
*/
|
the_stack_data/104828444.c | #include <stdio.h>
#include <math.h>
int main(){
float x,y;
printf("Please input the value of x:\n");
scanf("%f",&x);
if(x<5)
y=0;
else if(x>10)
y=sin(x)+cos(x);
else
y=sin(x);
printf("f(%.2f)=%.2f\n");
return 0;
}
|
the_stack_data/998455.c | #include <stdio.h>
typedef struct node
{
int value;
struct node* next;
struct node* prev;
} node;
typedef struct queue
{
int size;
struct node* head;
struct node* tail;
} queue;
void init_queue( queue* q )
{
q->tail = q->head = NULL;
q->size=0;
return;
}
int isEmpty( queue* q )
{
return q->head == NULL;
}
int push( queue* q, int value )
{
node* new_node = (node*) malloc( sizeof(node) );
new_node->value = value;
new_node->next = NULL;
if( isEmpty( q ) == 1 )
{
q->head = new_node;
q->tail = new_node;
q->head->prev = NULL;
}
else
{
q->tail->next = new_node;
new_node->prev = q->tail;
q->tail = new_node;
}
q->size++;
return 0;
}
int pop( queue* q )
{
if( isEmpty( q ) == 1 )
{
printf( "Очередь пуста!\n" );
}
else
{
q->head=q->head->next;
free( q->head->prev );
q->head->prev = NULL;
q->size--;
}
return 0;
}
int size( queue* q )
{
return q->size;
}
int top( queue* q )
{
if( isEmpty( q ) == 1 )
{
printf( "Очередь пуста!\n" );
return 0;
}
else
{
return q->head->value;
}
}
int back ( queue* q )
{
if( isEmpty( q ) == 1 )
{
printf( "Очередь пуста!\n" );
return 0;
}
else
{
return q->tail->value;
}
}
void view( queue* q )
{
if( isEmpty( q ) == 1 )
{
printf( "Очередь пуста!\n" );
}
else
{
node* ptr = q->head;
while( ptr != NULL )
{
printf( "%d ", ptr->value );
ptr = ptr->next;
}
printf( "\n" );
}
return;
}
void delete_queue( queue* q );
void delete_queue( queue* q )
{
if( isEmpty( q ) == 0 )
{
node* ptr = q->head;
while( ptr->next != NULL )
{
ptr = ptr->next;
free( ptr->prev );
}
free( ptr );
}
return;
}
int main( void )
{
queue queue_A;
init_queue( &queue_A );
int N = 0, temp = 0;
scanf( "%d", &N );
int i;
for( i = 0; i < N; i++ )
{
scanf( "%d", &temp );
push( &queue_A, temp );
}
view( &queue_A );
printf( "top: %d\n", top( &queue_A ) );
printf( "back: %d\n", back( &queue_A ) );
pop( &queue_A );
printf( "top after pop: %d\n", top( &queue_A ) );
delete_queue( &queue_A );
printf( "Queue deleted!\nBye!\n" );
return 0;
}
|
the_stack_data/368037.c | int peakIndexInMountainArray(int *arr, int arrSize) {
int i = 0, j = arrSize;
int m = (j + i) / 2;
while (1) {
int mid = arr[m];
if (arr[m + 1] > mid)
i = m + 1;
else if (arr[m - 1] > mid)
j = m - 1;
else
return m;
m = (j + i) / 2;
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.