file
stringlengths
18
26
data
stringlengths
3
1.04M
the_stack_data/569302.c
#include <limits.h> void foo (int j) { int i1 = (int)(double)1.0 + INT_MAX; /* { dg-warning "integer overflow" } */ int i2 = (int)(double)1 + INT_MAX; /* { dg-warning "integer overflow" } */ int i3 = 1 + INT_MAX; /* { dg-warning "integer overflow" } */ int i4 = +1 + INT_MAX; /* { dg-warning "integer overflow" } */ int i5 = (int)((double)1.0 + INT_MAX); int i6 = (double)1.0 + INT_MAX; /* { dg-warning "overflow in implicit constant" } */ int i7 = 0 ? (int)(double)1.0 + INT_MAX : 1; int i8 = 1 ? 1 : (int)(double)1.0 + INT_MAX; int i9 = j ? (int)(double)1.0 + INT_MAX : 1; /* { dg-warning "integer overflow" } */ unsigned int i10 = 0 ? (int)(double)1.0 + INT_MAX : 9U; unsigned int i11 = 1 ? 9U : (int)(double)1.0 + INT_MAX; unsigned int i12 = j ? (int)(double)1.0 + INT_MAX : 9U; /* { dg-warning "integer overflow" } */ int i13 = 1 || (int)(double)1.0 + INT_MAX < 0; int i14 = 0 && (int)(double)1.0 + INT_MAX < 0; int i15 = 0 || (int)(double)1.0 + INT_MAX < 0; /* { dg-warning "integer overflow" } */ int i16 = 1 && (int)(double)1.0 + INT_MAX < 0; /* { dg-warning "integer overflow" } */ int i17 = j || (int)(double)1.0 + INT_MAX < 0; /* { dg-warning "integer overflow" } */ int i18 = j && (int)(double)1.0 + INT_MAX < 0; /* { dg-warning "integer overflow" } */ }
the_stack_data/447431.c
/********************************************************************************************** rluaparser - raylib header parser to generate automatic Lua binding This parser scans raylib.h for functions that start with RLAPI and generates raylib-lua function binding. Converts: RLAPI Color Fade(Color color, float alpha); // Color fade-in or fade-out, alpha goes from 0.0f to 1.0f To: // Color fade-in or fade-out, alpha goes from 0.0f to 1.0f int lua_Fade(lua_State* L) { Color arg1 = LuaGetArgument_Color(L, 1); float arg2 = LuaGetArgument_float(L, 2); Color result = Fade(arg1, arg2); LuaPush_Color(L, result); return 1; } Requirements to create binding raylib -> raylib-lua NOTE: "Type" refers to raylib defined structs (Vector2, Texture2D...) [ ] 1. Review LuaPush_Type defines/functions [ ] 2. Review LuaGetArgument_Type defines/functions [ ] 3. Review LuaIndexType functions (some raylib structs have changed) [ ] 4. Review lua_Type functions (raylib Lua structure constructors) [x] 5. Review function bindings (90% of raylib-lua.h code) --> DONE by this PARSER! NOTE: Some functions could require specific reviews [ ] 6. Review registered raylib lua functions --> REG() [ ] 7. Review enumerators setup on InitLuaDevice() LICENSE: zlib/libpng Copyright (c) 2018 Ramon Santamaria (@raysan5) **********************************************************************************************/ #include <stdio.h> #include <string.h> #include <stdbool.h> #include <stdlib.h> int main() { #define MAX_BUFFER_SIZE 512 FILE *rFile = fopen("raylib_test.h", "rt"); FILE *rluaFile = fopen("raylib-lua_test.h", "wt"); if ((rFile == NULL) || (rluaFile == NULL)) { printf("File could not be opened.\n"); return 0; } char *buffer = (char *)calloc(MAX_BUFFER_SIZE, 1); char *luaPushFuncs = (char *)calloc(1024*512, 1); // 512 KB char *luaPushPtr = luaPushFuncs; char *luaREG = (char *)calloc(1024*256, 1); // 256 KB char *luaREGPtr = luaREG; int funcsCount = 0; while (!feof(rFile)) { // Read one full line fgets(buffer, MAX_BUFFER_SIZE, rFile); if (buffer[0] == '/') fprintf(rluaFile, "%s", buffer); // Direct copy of code comments else if (strncmp(buffer, "RLAPI", 5) == 0) // raylib function declaration { char funcType[64]; char funcTypeAux[64]; char funcName[64]; char funcDesc[256]; char params[128]; char paramType[8][16]; char paramName[8][32]; sscanf(buffer, "RLAPI %s %[^(]s", funcType, funcName); if (strcmp(funcType, "const") == 0) { sscanf(buffer, "RLAPI %s %s %[^(]s", funcType, funcTypeAux, funcName); strcpy(funcType, "string"); } if ((funcName[0] == '*') && (funcName[1] == '*')) strcpy(funcName, funcName + 2); else if (funcName[0] == '*') strcpy(funcName, funcName + 1); int index = 0; char *ptr = NULL; ptr = strchr(buffer, '('); if (ptr != NULL) index = (int)(ptr - buffer); else printf("Character not found!\n"); sscanf(buffer + (index + 1), "%[^)]s", params); // Read what's inside '(' and ')' <-- CRASH after 128 iterations! ptr = strchr(buffer, '/'); index = (int)(ptr - buffer); sscanf(buffer + index, "%[^\n]s", funcDesc); // Read function comment after declaration // Generate Lua function lua_FuncName() //--------------------------------------- fprintf(rluaFile, "%s\n", funcDesc); fprintf(rluaFile, "int lua_%s(lua_State *L)\n{\n", funcName); // Scan params string for number of func params, type and name char *paramPtr[16]; // Allocate 16 pointers for possible parameters int paramsCount = 0; paramPtr[paramsCount] = strtok(params, ","); bool funcVoid = (strcmp(funcType, "void") == 0); bool paramsVoid = false; char paramConst[8][16]; int len = 0; while (paramPtr[paramsCount] != NULL) { sscanf(paramPtr[paramsCount], "%s %s\n", paramType[paramsCount], paramName[paramsCount]); if (paramName[paramsCount][0] == '*') strcpy(paramName[paramsCount], paramName[paramsCount] + 1); if (strcmp(paramType[paramsCount], "void") == 0) { paramsVoid = true; break; } if (strcmp(paramType[paramsCount], "const") == 0) { sscanf(paramPtr[paramsCount], "%s %s %s\n", paramConst[paramsCount], paramType[paramsCount], paramName[paramsCount]); if (paramName[paramsCount][0] == '*') strcpy(paramName[paramsCount], paramName[paramsCount] + 1); fprintf(rluaFile, " %s %s %s = LuaGetArgument_%s(L, %i);\n", paramConst[paramsCount], paramType[paramsCount], paramName[paramsCount], (strcmp(paramType[paramsCount], "char") == 0) ? "string" : paramType[paramsCount], paramsCount + 1); } else if (strcmp(paramType[paramsCount], "unsigned") == 0) { sscanf(paramPtr[paramsCount], "%s %s %s\n", paramConst[paramsCount], paramType[paramsCount], paramName[paramsCount]); if (paramName[paramsCount][0] == '*') strcpy(paramName[paramsCount], paramName[paramsCount] + 1); fprintf(rluaFile, " %s %s %s = LuaGetArgument_%s(L, %i);\n", paramConst[paramsCount], paramType[paramsCount], paramName[paramsCount], paramConst[paramsCount], paramsCount + 1); } //else if (strcmp(paramType[paramsCount], "...") == 0) else fprintf(rluaFile, " %s %s = LuaGetArgument_%s(L, %i);\n", paramType[paramsCount], paramName[paramsCount], paramType[paramsCount], paramsCount + 1); paramsCount++; paramPtr[paramsCount] = strtok(NULL, ","); } if (funcVoid) fprintf(rluaFile, " %s(", funcName); else fprintf(rluaFile, " %s result = %s(", funcType, funcName); if (!paramsVoid) { for (int i = 0; i < paramsCount - 1; i++) fprintf(rluaFile, "%s, ", paramName[i]); fprintf(rluaFile, "%s", paramName[paramsCount - 1]); } fprintf(rluaFile, ");\n"); if (!funcVoid) fprintf(rluaFile, " LuaPush_%s(L, result);\n", funcType); fprintf(rluaFile, " return %i;\n}\n\n", funcVoid ? 0:1); fflush(rluaFile); funcsCount++; printf("Function processed %02i: %s\n", funcsCount, funcName); memset(buffer, 0, MAX_BUFFER_SIZE); // Register function names REG() into luaREG string //-------------------------------------------------- len += sprintf(luaREGPtr + len, " REG(%s)\n", funcName); luaREGPtr += len; } else if (strncmp(buffer, "typedef", 7) == 0) // raylib data type definition { char typeName[64]; char typeDesc[256]; int paramsCount = 0; char paramTypes[16][32] = {{ 0 }}; char paramNames[16][32] = {{ 0 }}; char paramDescs[16][128] = {{ 0 }}; if (strncmp(buffer + 8, "struct", 6) == 0) { sscanf(buffer, "typedef struct %s {", typeName); fgets(buffer, MAX_BUFFER_SIZE, rFile); // Read one new full line while (buffer[0] != '}') // Not closing structure type { if (buffer[0] != '\n') { sscanf(buffer, " %s %[^;]s %[^\n]s", &paramTypes[paramsCount][0], &paramNames[paramsCount][0], &paramDescs[paramsCount][0]); paramsCount++; } fgets(buffer, MAX_BUFFER_SIZE, rFile); // Read one new full line } // Generate LuaGetArgument functions //----------------------------------- fprintf(rluaFile, "static %s LuaGetArgument_%s(lua_State *L, int index)\n{\n", typeName, typeName); fprintf(rluaFile, " %s result = { 0 };\n", typeName); fprintf(rluaFile, " index = lua_absindex(L, index); // Makes sure we use absolute indices because we push multiple values\n"); for (int i = 0; i < paramsCount; i++) { // TODO: Consider different types (LUA_TNUMBER, LUA_TTABLE) fprintf(rluaFile, " luaL_argcheck(L, lua_getfield(L, index, \"%s\") == LUA_TNUMBER, index, \"Expected %s.%s\");\n", paramNames[i], typeName, paramNames[i]); // TODO: Consider different data types (lua_tonumber, LuaGetArgument_Vector3) fprintf(rluaFile, " result.%s = LuaGetArgument_%s(L, -1);\n", paramNames[i], paramTypes[i]); } fprintf(rluaFile, " lua_pop(L, %i);\n", paramsCount); fprintf(rluaFile, " return result;\n}\n\n"); // Generate LuaPush functions // NOTE: LuaPush functions are written in a separate string buffer, that will be written to file at the end //----------------------------------- int len = 0; len += sprintf(luaPushPtr + len, "static void LuaPush_%s(lua_State* L, %s obj)\n{\n", typeName, typeName); len += sprintf(luaPushPtr + len, " lua_createtable(L, 0, %i);\n", paramsCount); for (int i = 0; i < paramsCount; i++) { len += sprintf(luaPushPtr + len, " LuaPush_%s(L, obj.%s);\n", paramTypes[i], (paramNames[i][0] == '*') ? (paramNames[i] + 1) : paramNames[i]); len += sprintf(luaPushPtr + len, " lua_setfield(L, -2, \"%s\");\n", paramNames[i]); } len += sprintf(luaPushPtr + len, "}\n\n"); luaPushPtr += len; } else if (strncmp(buffer + 8, "enum", 4) == 0) { //sscanf(buffer, "typedef enum {"); //printf("enum detected!\n"); fgets(buffer, MAX_BUFFER_SIZE, rFile); // Read one new full line fprintf(rluaFile, "LuaStartEnum();\n"); while (buffer[0] != '}') // Not closing structure type { if (buffer[0] != '\n') { sscanf(buffer, " %s", &paramNames[paramsCount][0]); fprintf(rluaFile, "LuaSetEnum(\"%s\", %s);\n", &paramNames[paramsCount][0], &paramNames[paramsCount][0]); paramsCount++; } fgets(buffer, MAX_BUFFER_SIZE, rFile); // Read one new full line } fprintf(rluaFile, "LuaEndEnum(\"name\");\n"); } } } fprintf(rluaFile, "%s", luaPushFuncs); fprintf(rluaFile, "// raylib Functions (and data types) list\nstatic luaL_Reg raylib_functions[] = {\n"); fprintf(rluaFile, "%s\n", luaREG); fprintf(rluaFile, " { NULL, NULL } // sentinel: end signal\n};"); free(buffer); free(luaPushFuncs); free(luaREG); fclose(rFile); fclose(rluaFile); return 0; }
the_stack_data/25137305.c
/* -- Insertion sort is a simple sorting algorithm that builds -- -- the final sorted array (or list) one item at a time. -- -- This example prepared for integer arrays. -- -- Still, it can be easily transform to other types like double. -- */ #pragma warning(disable:4996)//To close scanf warning on VS-17. Unless you use Visual Studio 2017, it's not necessary. //Headers.. #include <stdio.h> //Prototypes, void print(int*, int); void insertionSort(int*, int); int main() { int i, n; printf("////--- Welcome to Insertion Sorting Algorithm Example ! ---\\\\\\\\ \n\n\n\n"); printf("Input size of array : "); scanf("%d", &n); //n will be use for create int-array. int *arr = (int*)malloc(n * sizeof(int));//This line creating dynamically allocated memory. printf("Input the elements of the array :"); for (i = 0; i < n; i++) scanf("%d", &arr[i]); printf("Original array : "); print(arr, n); insertionSort(arr, n); printf("Sorted array : "); print(arr, n); return 0; }//End of main-func. void print(int *arr, int n) { for (int i = 0; i < n; i++) { printf("%d ", arr[i]); } printf("\n"); }//End of print-func. void insertionSort(int *arr, int size) { int i, j, temp; for (i = 1; i < size; i++) { temp = arr[i]; j = i - 1; while (j >= 0 && arr[j] > temp) { arr[j + 1] = arr[j]; j = j - 1; } arr[j + 1] = temp; } }//End of insertionSort-func.
the_stack_data/108168.c
#include <stdio.h> int main() { int i,j; for (i = 0; i < 5; i++) { for (j = 0; j < 9; j++) { printf("%dx%d=%d ", i, j, i * j); } } return 0; } // comment
the_stack_data/1256954.c
#include<stdio.h> #include<string.h> void main() { char grid[10][10],input[4][20]; int i,j; for(i=0;i<10;i++) { for(j=0;j<10;j++) { scanf("%c",&grid[i][j]);}} for(i=0;i<4;i++) { scanf("%s",input[i]);} }
the_stack_data/86074297.c
#include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <unistd.h> int main(int argc, char *argv[]) { int sockfd; int len; struct sockaddr_in address; int result; char ch = 'A'; //申请一个流 socket sockfd = socket(AF_INET, SOCK_STREAM, 0); //填充地址结构,指定服务器的 IP 和 端口 address.sin_family = AF_INET; //inet_addr 可以参考 man inet_addr //可以用现代的inet_pton()替代inet_addr(), example 中有参考例子 address.sin_addr.s_addr = inet_addr("127.0.0.1"); address.sin_port = htons(9734); len = sizeof(address); //下面的语句可以输出连接的 IP 地址 //但是inet_ntoa()是过时的方法,应该改用 inet_ntop(可参考 example)。但很多代码仍然遗留着inet_ntoa. //printf("%s\n", inet_ntoa( address.sin_addr)); result = connect(sockfd, (struct sockaddr *)&address, len); if (result == -1) { perror("oops: client1"); exit(1); } //往服务端写一个字节 write(sockfd, &ch, 1); //从服务端读一个字符 read(sockfd, &ch, 1); printf("char from server = %c\n", ch); close(sockfd); exit(0); }
the_stack_data/248581768.c
#include <unistd.h> #include "syscall.h" gid_t getegid(void) { return __async_syscall(SYS_getegid); }
the_stack_data/589644.c
#include <stdio.h> #include <string.h> int main() { int i; char str[100]; scanf("%s", str); for(i = 0; i < strlen(str); i++){ printf("%c\n", str[i]); } return 0; }
the_stack_data/26017.c
#include <stdio.h> #include <stdlib.h> #include <string.h> #define N 12 typedef char *Item; // Pila implementata come lista di interi (inserimento e cancellazione avvengono solo in testa) struct element { Item value; struct element *next; }; typedef struct element Element; struct stack { Element *head; }; typedef struct stack *Stack; Stack init( void ); /* alloca lo spazio per una pila vuota e ne restituisce un puntatore */ void destroy( Stack ); /* svuota la pila liberando la memoria */ int is_empty( Stack ); /* restituisce 1 se la pila e' vuota, 0 altrimenti */ Item top( Stack ); /* se la pila non e' vuota, restituisce il top de1la pila; altrimenti esce con messaggio di errore. */ Item pop( Stack ); /* se la pila non e' vuota, estrae il top da1la pila e lo restituisce; altrimenti esce con messaggio di errore. */ void push( Stack, Item ); /* se c'e' spazio, aggiunge l'item alla pila; altrimenti esce con messaggio d'errore. */ void print_stack( Stack ); /* stampa il contenuto della pila, partendo dal top. */ /******************************************************************** INSERIRE QUI LA FUNZIONE MAIN E EVENTUALI ALTRE FUNZIONI AGGIUNTIVE ********************************************************************/ int main() { Stack s = init(); char word[N], t[N]; int i = 1; char c; scanf("%s", &word); while (1) { // metto la parola senza tag in t if (word[0] != '<') { printf("NO"); break; } else { while (word[i] != '>') { t[i-1] = word[i]; i++; } t[i-1] = '\0'; i = 1; } if (t[0] == '/' && strcmp(top(s), &t[1]) == 0) { pop(s); } else {push(s, t); } if (getchar() == '\n') break; // finito la linea scanf("%s", &word); } if (is_empty(s)) printf("OK\n"); else printf("NO\n"); } Stack init(void) { Stack s = malloc( sizeof (struct stack) ); if ( s == NULL ) { printf( "err malloc\n" ); exit( EXIT_FAILURE ); } s -> head = NULL; return s; } void print_stack( Stack s ) { Element *p; if ( s == NULL ) return; printf( "Contenuto della pila: " ); for ( p = s -> head; p != NULL; p = p -> next ) { printf( "%s", p -> value ); printf( " " ); } printf( ".\n" ); } void destroy( Stack s ) { Element *p, *old; for ( p = s -> head; p != NULL; ) { old = p; p = p -> next; free( old ); } free( s ); } int is_empty( Stack s ){ return ( s -> head == NULL ); } Item top( Stack s ){ if ( is_empty( s ) ) { printf( "err pop: pila vuota\n" ); exit( EXIT_FAILURE ); } return s -> head -> value; } void push( Stack s, Item item ){ Element *new = malloc( sizeof( Element ) ); if ( new == NULL ) { printf( "err push: pila piena!\n" ); exit( EXIT_FAILURE ); } new -> value = malloc( sizeof( strlen(item)) + 1); strcpy(new -> value, item); new -> next = s -> head; s -> head = new; } /******* COMPLETATE LA FUNZIONE POP: *************/ Item pop( Stack s ){ Item item; Element *old; if ( is_empty( s ) ) { printf( "err pop: pila vuota\n" ); exit( EXIT_FAILURE ); } item = s -> head -> value; old = s -> head; s -> head = s -> head -> next; free(old); return item; }
the_stack_data/61074813.c
#include<stdio.h> int main() { int a, b; scanf("%d %d", &a, &b); printf("%d\n%d\n%d\n%d\n", (b%10)*a, ((b%100)/10)*a, (b/100)*a, a*b); return 0; }
the_stack_data/89855.c
#include <stdint.h> #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { uint32_t value; value = strtoul(argv[1], NULL, 16); value &= 0x3ff; if ((value >> 9) & 0x1) printf("%f\n", -(((value - 1) ^ 0x3ff) / 256.0f)); else printf("%f\n", value / 256.0f); return 0; }
the_stack_data/1197477.c
extern int __VERIFIER_nondet_int(); extern void __VERIFIER_assume(int); int nondet_signed_int() { int r = __VERIFIER_nondet_int(); __VERIFIER_assume ((-0x7fffffff - 1) <= r && r <= 0x7fffffff); return r; } signed int main() { signed int x; signed int y; signed int z; x = 0; y = 100; z = nondet_signed_int(); while(!(x >= 40)) if(z == 0) { while(!(!(x + 1 < (-0x7fffffff - 1) || 0x7fffffff < x + 1))); x = x + 1; } else { while(!(!(x + 2 < (-0x7fffffff - 1) || 0x7fffffff < x + 2))); x = x + 2; } return 0; }
the_stack_data/150142471.c
#include <time.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <wchar.h> #include <sys/stat.h> #define _GNU_SOURCE // necessário porque getline() é extensão GNU #define MAX_FILE_NAME 100 #define BUFFER_SIZE 50 typedef struct fileHeader { int files; int sizes[]; } fileHeader; void concatenar (FILE *base, FILE *copiado); int main() { wchar_t str[BUFFER_SIZE]; size_t strSize; struct stat sb; // https://www.delftstack.com/pt/howto/c/file-size-in-c/ char buffer[200]; // Buffer to store data FILE *base; FILE *arquivo2; FILE *arquivo3; size_t len = 100; fileHeader header; int line = 0; char *linha= malloc(len); base = fopen("base.txt", "r"); arquivo2 = fopen("arquivo2.txt", "w"); arquivo3 = fopen("arquivo3.txt", "w"); while ((getline(&linha, &len, base) > 0) && (line < 2)) { ++line; if (fputs(linha, arquivo2) == EOF) printf("Erro ao tentar gravar os dados! \n"); } rewind(base); fclose(arquivo2); arquivo2 = fopen("arquivo2.txt", "r"); concatenar(arquivo3,base); fputs("\n-----------------------\n", arquivo3); concatenar(arquivo3,arquivo2); fclose(base); fclose(arquivo3); fclose(arquivo2); header.files = 3; stat("base.txt", &sb); header.sizes[0] = sb.st_size; sb.st_size = 0; stat("arquivo2.txt", &sb); header.sizes[1] = sb.st_size; sb.st_size = 0; stat("arquivo3.txt", &sb); header.sizes[2] = sb.st_size; sb.st_size = 0; printf("tamanho do Base %d\n", header.sizes[0]); printf("tamanho do arquivo2 %d\n", header.sizes[1]); printf("tamanho do arquivo3 %d\n", header.sizes[2]); // fclose(base); // fclose(arquivo3); // fclose(arquivo2); // remove("arquivo2.txt"); free(linha); printf("\n"); return 0; } void concatenar ( FILE *base, FILE *copiado) { char leitor [1000]; while (fgets (leitor, sizeof leitor, copiado) != NULL) { fputs (leitor, base); } }
the_stack_data/212642476.c
#include <stdio.h> #include <stdlib.h> #include <sys/ioctl.h> #include <sys/types.h> #include <sys/stat.h> #include <termios.h> #include <unistd.h> #include <fcntl.h> void closeSerial(int fd) { if (close(fd) < 0) { perror("closeserial()"); } } int openSerial(char *devicename) { int fd; struct termios attr; if ((fd = open(devicename, O_RDWR)) == -1) { perror("openserial(): open()"); return 0; } if (tcgetattr(fd, &attr) == -1) { perror("openserial(): tcgetattr()"); return 0; } attr.c_cflag |= CRTSCTS | CLOCAL; attr.c_oflag = 0; if (tcflush(fd, TCIOFLUSH) == -1) { perror("openserial(): tcflush()"); return 0; } if (tcsetattr(fd, TCSANOW, &attr) == -1) { perror("initserial(): tcsetattr()"); return 0; } return fd; } int setDTR(int fd, int level) { int status; if (ioctl(fd, TIOCMGET, &status) == -1) { perror("setDTR(): TIOCMGET"); return 0; } if (level) { status |= TIOCM_DTR; } else { status &= ~TIOCM_DTR; } if (ioctl(fd, TIOCMSET, &status) == -1) { perror("setDTR(): TIOCMSET"); return 0; } return 1; } int main(int argc, char *argv[]) { char *device = "/dev/ttyUSB0"; int level = 1; int fd; if(argc != 3) { fprintf(stdout,"%s uses DTR on usb serial port to control a powerswitch\n", argv[0]); fprintf(stdout,"Usage : %s <port> <level>\n", argv[0]); fprintf(stdout,"Example: %s %s %d\n", argv[0], device, level); return 1; } device = argv[1]; fd = openSerial(device); if (!fd) { fprintf(stderr, "Error while initializing %s.\n", device); return 2; } level = atoi(argv[2]); level = !level; setDTR(fd, level); closeSerial(fd); return 0; }
the_stack_data/1061008.c
void foo(int x) { if(x==1) while(1); } void bar() { } int main(int argc, char** argv) { int x = 2; if(x==2) foo(argc); bar(); foo(1); return 0; //status should be UNKNOWN }
the_stack_data/130762.c
/* * Raises x to power n */ #include <stdio.h> long long power(int x, int n); int main(void) { int x, n; printf("Power: raises x to power n.\n"); printf("Enter x and n: "); scanf("%d %d", &x, &n); printf("%d ^ %d = %lld\n", x, n, power(x, n)); return 0; } long long power (int x, int n) { long long res = 1; int i; for (i = 0; i < n; i++) res *= x; return res; }
the_stack_data/117024.c
#include <stdio.h> #include <stdlib.h> long long gap[10]; long long count[10]; void init(void) { int i; for (i=0;i<10;i++) {gap[i]=-1; count[i]=0; } } void findlargest(long long *vv, long long *cc) { int l=0; int i; for (i=1;i<10;i++) { if (gap[i]>gap[l]) l=i; } if (gap[l]==-1) {fprintf(stderr, "table empty for largets\n"); exit(-1);} *vv=gap[l]; *cc=count[l]; gap[l]=-1; count[l]=0; } int find(long long v) { int i; int neg=-1; for (i=0;i<10;i++) { if (gap[i]==v) return i; if (gap[i]==-1LL) neg=i; } if (neg<0) {fprintf(stderr,"outa space\n"); exit(-1);} gap[neg]=v; count[neg]=0; return neg; } long long problem(void) { long long N,K; long long v,c; int i; init(); scanf("%lld %lld",&N, &K); gap[0]=N; count[0]=1; K--; while (1) { findlargest(&v, &c); //printf("largest =%lld(%lld) K=%lld\n",v,c,K); if (K<c) return v; i=find(v/2); count[i]+=c; i=find((v-1)/2); count[i]+=c; K-=c; } } int main(int argc, char **argv) { int i,tc; long long r; scanf("%d",&tc); for (i=1;i<=tc;i++) { r=problem(); printf("Case #%d: %lld %lld\n", i, r/2, (r-1)/2); } return 0; }
the_stack_data/550680.c
/* 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 15? */ #include<stdio.h> int prime(int n); int main(){ int num=15,i=1,rem; long int product=1; while(i<=15){ if(prime(i)==1){ product=product*i; i++; }else{ i++; } } for(i=1;i<15;i++){ if(product%i==0){ product; } else { if(i%2==0){ product=product*2; } else { product=product*3; } } } printf("The smallest positive number that is evenly divisible by all of the numbers from 1 to 15 is %ld",product); return 0; } int prime(int n){ int j,flag=0; for(j=2;j<n;j++){ if(n%j==0) flag=flag+1; } if(flag==0){ return 1; } else if(n==2){ return 1; } else { return 0; } }
the_stack_data/1249818.c
// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: MIT-0 #include<stdio.h> #include<string.h> int tests_run=0; int tests_success=0; int tests_fail=0; int ut_stub(char *test_name, int status) { tests_run++; printf(" %s %s\n",status?" ok ":"FAIL", test_name); if (status) { tests_success++; return 0; } tests_fail++; return 1; } void ut_name(char *name) { printf("%s\n",name); } int ut_assert(char *test_name,int value) { return ut_stub(test_name, value); } int ut_assert_true(char *test_name,int value) { return ut_stub(test_name, value); } int ut_assert_false(char *test_name,int value) { return ut_stub(test_name, !value); } int ut_assert_string_match(char *test_name, char *expected, char *value) { int match = (strcmp(expected,value) == 0); int result = ut_stub(test_name, match ); if (result) { printf(" Expected: '%s'\n",expected); printf(" Got: '%s'\n",value); } return result; } int ut_assert_int_match(char *test_name, int expected, int value) { int match = (expected == value); int result = ut_stub(test_name, match ); if (result) { printf(" Expected: '%i'\n",expected); printf(" Got: '%i'\n",value); } return result; } int ut_assert_long_match(char *test_name, long expected, long value) { int match = (expected == value); int result = ut_stub(test_name, match ); if (result) { printf(" Expected: '%li'\n",expected); printf(" Got: '%li'\n",value); } return result; }
the_stack_data/23575551.c
/* * bvhcopy.c * * Purpose: Extracts a part of a BVH motion file and copies it to a new one. * Controlled by commandline arguments explained in show_usage() * function. * * Created: Jaroslav Semancik, 16/12/2003 */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #define ROUND(x) floor((x) + 0.5) enum { FALSE, TRUE }; enum { FRAME, FRACTION, TIME }; int start_frame; /* copy from start_frame (frames are numbered from 0) */ int end_frame; /* copy to end_frame */ int n_frames; /* # of frames in input file */ int copied_frames; /* actually copied frames */ float frac_start_frame; /* fractional start frame - in [0.0, 1.0] */ float frac_end_frame; /* fractional end frame - in [0.0, 1.0] */ float start_time; /* start time */ float end_time; /* end time */ float delta; /* time difference between two consecutive frames */ int start_type, end_type; /* type of given start/end format */ char in_filename[1001]; /* input filename */ char out_filename[1001]; /* output filename */ FILE *in_file, *out_file; /* input and output file */ int parse_options(int n, char **arg); void show_usage(); int main(int argc, char **argv) { char line[10001]; int i; /* set defaults - copy the entire motion to out.bvh */ start_type = FRACTION; frac_start_frame = 0.0; end_type = FRACTION; frac_end_frame = 1.0; strcpy(in_filename, ""); strcpy(out_filename, "out.bvh"); /* without arguments show usage */ if (argc <= 1) { show_usage(); return 0; } /* parse options */ if (!parse_options(argc, argv)) return -1; /* open files */ in_file = fopen(in_filename, "rt"); if (!in_file) { printf("Error: Cannot open input file %s", in_filename); return -1; } out_file = fopen(out_filename, "wt"); if (!out_file) { printf("Error: Cannot create output file %s", out_filename); fclose(in_file); return -1; } /* copy HIERARCHY section */ do { if (feof(in_file)) break; fgets(line, 10000, in_file); fputs(line, out_file); } while (!(strstr(line, "MOTION") == line)); if (feof(in_file)) { printf("Error: Incomplete input file, the MOTION section missing"); fclose(in_file); fclose(out_file); return -1; } /* read number of frames and frame time */ fscanf(in_file, "%*s %d\n", &n_frames); fscanf(in_file, "%*s %*s %f\n", &delta); /* set start and end frames to cut */ if (start_type == FRACTION) start_frame = ROUND(frac_start_frame * (n_frames - 1)); else if (start_type == TIME) start_frame = ROUND(start_time / delta); if (end_type == FRACTION) end_frame = ROUND(frac_end_frame * (n_frames - 1)); else if (end_type == TIME) end_frame = ROUND(end_time / delta); if (start_frame < 0) start_frame = 0; if (end_frame > n_frames - 1) end_frame = n_frames - 1; if (end_frame < start_frame) end_frame = start_frame - 1; /* write number of frames and frame time */ fprintf(out_file, "Frames: %d\n", end_frame - start_frame + 1); fprintf(out_file, "Frame Time: %f\n", delta); /* copy frames */ for (i = 0; i < start_frame; i++) { if (feof(in_file)) break; fgets(line, 10000, in_file); } copied_frames = 0; for (i = start_frame; i <= end_frame; i++) { if (feof(in_file)) break; fgets(line, 10000, in_file); fputs(line, out_file); copied_frames++; } /* close files */ fclose(in_file); fclose(out_file); /* report status */ if (copied_frames == end_frame - start_frame + 1) printf("OK"); else printf("Warning: Incorrect value 'Frames' in input file, check number of copied frames."); printf("\nMotion with %d frames (%d..%d) from %s copied to %s\n", copied_frames, start_frame, start_frame + copied_frames - 1, in_filename, out_filename); return 0; } void show_usage() { printf("\n*** BVH cutter - extracts a part of .bvh motion file. ***\n"); printf(" by Jaroslav Semancik, 2003\n\n"); printf("Usage:\n"); printf(" bvhcopy.exe [OPTIONS] <input_file> [OPTIONS]\n"); printf(" Options:\n"); printf(" -s #[%%/s] start frame number # (default: 0 - the first frame)\n"); printf(" -e #[%%/s] end frame number # (default: the last frame)\n"); printf(" -o <filename> output file name (default: out.bvh)\n"); printf(" -h help, show usage\n"); printf("\n"); printf(" where format of # is: an integer frame number, or\n"); printf(" percentage (float) followed by %% sign, or\n"); printf(" time in seconds (float) followed by letter s\n"); printf("\n"); printf("Examples:\n"); printf(" bvhcopy.exe walk.bvh -s 20 -e 100 -o step.bvh - extract frames 20 to 100\n"); printf(" bvhcopy.exe jump.bvh -e 33.33%% -o jump1.bvh - extract first third\n"); printf(" bvhcopy.exe run.bvh -s 1.5s -e 50%% -o leap.bvh - from time 1.5s to the half\n"); printf("\n"); } int parse_options(int n, char **arg) { int i; i = 1; while (i < n) { /* start frame option -s */ if (strcmp(arg[i], "-s") == 0) { i++; if (i < n) { /* start given by percentage */ if (strchr(arg[i], '%')) { start_type = FRACTION; frac_start_frame = atof(arg[i]) / 100.0; } /* start given by time */ else if (strchr(arg[i], 's')) { start_type = TIME; start_time = atof(arg[i]); } /* start given by frame number */ else { start_type = FRAME; start_frame = atoi(arg[i]); } } } /* end frame option -e */ else if (strcmp(arg[i], "-e") == 0) { i++; if (i < n) { /* end given by percentage */ if (strchr(arg[i], '%')) { end_type = FRACTION; frac_end_frame = atof(arg[i]) / 100.0; } /* end given by time */ else if (strchr(arg[i], 's')) { end_type = TIME; end_time = atof(arg[i]); } /* end given by frame number */ else { end_type = FRAME; end_frame = atoi(arg[i]); } } } /* output filename option -o */ else if (strcmp(arg[i], "-o") == 0) { i++; if (i < n) strcpy(out_filename, arg[i]); } /* help option -h */ else if (strcmp(arg[i], "-h") == 0) show_usage(); /* invalid option */ else if (arg[i][0] == '-') { printf("Error: Invalid option %s\n", arg[i]); return FALSE; } /* argument is not an option, so it is an input filename */ else strcpy(in_filename, arg[i]); // move to next argument */ i++; } if (in_filename == "") { printf("Error: No input file given\n"); return FALSE; } /* options are OK */ return TRUE; }
the_stack_data/40763193.c
#ifndef __clang__ #include <stdbool.h> bool __builtin_add_overflow(signed short, signed short, signed short *); #endif int main(int argc, const char **argv) { signed short res; if (__builtin_add_overflow((signed short)0x0, (signed short)0x0, &res)) { return -1; } if (__builtin_add_overflow((signed short)0x7FFF, (signed short)0x0, &res)) { return -1; } if (__builtin_add_overflow((signed short)0x0, (signed short)0x7FFF, &res)) { return -1; } if (__builtin_add_overflow((signed short)0x8000, (signed short)0x7FFF, &res)) { return -1; } if (__builtin_add_overflow((signed short)0x7FFF, (signed short)0x8000, &res)) { return -1; } if (!__builtin_add_overflow((signed short)0x7FFF, (signed short)0x1, &res)) { return -1; } if (!__builtin_add_overflow((signed short)0x1, (signed short)0x7FFF, &res)) { return -1; } if (!__builtin_add_overflow((signed short)0x7FFF, (signed short)0x7FFF, &res)) { return -1; } if (!__builtin_add_overflow((signed short)0x8000, (signed short)0x8000, &res)) { return -1; } return 0; }
the_stack_data/8996.c
/* * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * The Universal Permissive License (UPL), Version 1.0 * * Subject to the condition set forth below, permission is hereby granted to any * person obtaining a copy of this software, associated documentation and/or * data (collectively the "Software"), free of charge and under any and all * copyright rights in the Software, and any and all patent rights owned or * freely licensable by each licensor hereunder covering either (i) the * unmodified Software as contributed to or provided by such licensor, or (ii) * the Larger Works (as defined below), to deal in both * * (a) the Software, and * * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if * one is included with the Software each a "Larger Work" to which the Software * is contributed by such licensors), * * without restriction, including without limitation the rights to copy, create * derivative works of, display, perform, and distribute the Software and make, * use, sell, offer for sale, import, export, have made, and have sold the * Software and the Larger Work(s), and to sublicense the foregoing rights on * either these or other terms. * * This license is subject to the following condition: * * The above copyright notice and either this complete permission notice or at a * minimum a reference to the UPL must be included in all copies or substantial * portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #include <stdio.h> int main() { int number = 1; int rows = 10; for (int i = 1; i <= rows; i++) { for (int j = 1; j <= i; j++) { printf("%d ", number); ++number; } printf(".\n"); } return 0; }
the_stack_data/96919.c
/* PR tree-optimization/20702 VRP did not insert ASSERT_EXPRs into dominator dominator children of a basic block ending with COND_EXPR unless the children are also immediate successors of the basic block. */ /* { dg-do compile } */ /* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-vrp1-details" } */ /* LLVM LOCAL test not applicable */ /* { dg-require-fdump "" } */ extern void bar (int); int foo (int *p, int b) { int a; if (b) bar (123); else bar (321); a = *p; if (p == 0) return 0; return a; } /* { dg-final { scan-tree-dump-times "Folding predicate" 1 "vrp1"} } */ /* { dg-final { cleanup-tree-dump "vrp1" } } */
the_stack_data/390076.c
// Exercício 2: Quero comprar um par de tênis para correr. O modelo comum custa R$300,00 e o modelo de competição custa R$600,00. Escreva um programa que pergunte quanto de dinheiro tenho (valor inteiro), e diga se posso comprar um par de tênis, e se sim, qual modelo seria. #include <stdio.h> int main(void) { int dinheiro; printf("Digite quanto voce tem: "); scanf("%i", &dinheiro); if (dinheiro < 300) { printf("Voce nao pode comprar nenhum tenis! :("); } else { if (dinheiro >= 600) { printf("Voce pode comprar o tenis de competicao!"); } else { printf("Voce pode comprar o tenis comum!"); } } return 0; }
the_stack_data/50891.c
#include <stdio.h> #ifdef _MSC_VER #pragma warning(disable : 4996) #endif // _MSC_VER // This convoluted function returns 0 // but will hopefully not be optimized away in release builds... #ifdef __clang__ __attribute__((optnone)) #endif int return_0_non_optimizable() { char buffer[100]; long value = 62831853; char *c; int result; sprintf(buffer, "%ld", value); c = buffer; result = 0; while (*c) { int digit = (int)(c[0] - '0'); result = result + digit; c++; } return result - 36; } // this function is infinitely recursive and will cause a stack overflow #ifdef __clang__ __attribute__((optnone)) #endif int fun(int x) { if (x == 1) return 5; x = 6; if (return_0_non_optimizable() == 0) fun(x); return x; } int main() { int x = 5; int y; y = fun(x); printf("%d", y); return 0; }
the_stack_data/179830049.c
#include <string.h> #include <stdio.h> int main(int argc, char **argv) { char *progname = strrchr(argv[0], '/'); if (!progname) progname = argv[0]; else progname++; if (!strcmp(progname, "true")) { return 1; } else if (!strcmp(progname, "false")) { return 0; } else { return -1; } }
the_stack_data/161080380.c
/* factor1.c * * Compile with -lm option (gcc) */ #include <stdio.h> #include <math.h> int main() { int number; int sqrt_n; int i; printf("Input a number: "); scanf("%d", &number); if (number < 2) { printf("Input a number greater than two.\n"); return -1; } printf("Factors: "); sqrt_n = (int)sqrt(number); for (i=2; i<=sqrt_n; i++) { if ((number % i) == 0) { printf(" %d %d", i, number / i); } } printf("\n"); return 0; }
the_stack_data/150140922.c
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <stdint.h> #include <sys/time.h> struct tspec { uint64_t sec; uint32_t nsec; }; extern int set_timer_handler(void (*callback)()); extern long long int start_thread_timer(struct tspec*); void handler() { printf("TICK!\n"); } int main(int argc, char **argv) { struct tspec ts = { 0, 20000000 }; int res; res = set_timer_handler(&handler); if(res != 0) { printf("set alarm fail: %d\n", res); exit(res); } res = start_thread_timer(&ts); if(res >= 0) { struct timeval cur, goal; printf("Got a timer!\n"); gettimeofday(&cur, NULL); goal.tv_sec = cur.tv_sec + 5; while(cur.tv_sec < goal.tv_sec) gettimeofday(&cur, NULL); } return res > 0 ? 0 : res; }
the_stack_data/6388995.c
int a[2]={2}; char b[200]=" \" \0 \n ' "; char x = '"'; char gf[2] = "'"; char gff[2] = "\""; int main(int a) { b[0]=(char)'\0'+-1; return a; }
the_stack_data/161081008.c
//@ ltl invariant negative: ((<> AP(x_18 - x_17 >= -1)) U ([] AP(x_0 - x_13 >= -7))); float x_0; float x_1; float x_2; float x_3; float x_4; float x_5; float x_6; float x_7; float x_8; float x_9; float x_10; float x_11; float x_12; float x_13; float x_14; float x_15; float x_16; float x_17; float x_18; float x_19; int main() { float x_0_; float x_1_; float x_2_; float x_3_; float x_4_; float x_5_; float x_6_; float x_7_; float x_8_; float x_9_; float x_10_; float x_11_; float x_12_; float x_13_; float x_14_; float x_15_; float x_16_; float x_17_; float x_18_; float x_19_; while(1) { x_0_ = ((((1.0 + x_1) > (3.0 + x_3)? (1.0 + x_1) : (3.0 + x_3)) > ((4.0 + x_6) > ((10.0 + x_8) > (3.0 + x_9)? (10.0 + x_8) : (3.0 + x_9))? (4.0 + x_6) : ((10.0 + x_8) > (3.0 + x_9)? (10.0 + x_8) : (3.0 + x_9)))? ((1.0 + x_1) > (3.0 + x_3)? (1.0 + x_1) : (3.0 + x_3)) : ((4.0 + x_6) > ((10.0 + x_8) > (3.0 + x_9)? (10.0 + x_8) : (3.0 + x_9))? (4.0 + x_6) : ((10.0 + x_8) > (3.0 + x_9)? (10.0 + x_8) : (3.0 + x_9)))) > (((15.0 + x_10) > (19.0 + x_13)? (15.0 + x_10) : (19.0 + x_13)) > ((11.0 + x_14) > ((15.0 + x_16) > (17.0 + x_17)? (15.0 + x_16) : (17.0 + x_17))? (11.0 + x_14) : ((15.0 + x_16) > (17.0 + x_17)? (15.0 + x_16) : (17.0 + x_17)))? ((15.0 + x_10) > (19.0 + x_13)? (15.0 + x_10) : (19.0 + x_13)) : ((11.0 + x_14) > ((15.0 + x_16) > (17.0 + x_17)? (15.0 + x_16) : (17.0 + x_17))? (11.0 + x_14) : ((15.0 + x_16) > (17.0 + x_17)? (15.0 + x_16) : (17.0 + x_17))))? (((1.0 + x_1) > (3.0 + x_3)? (1.0 + x_1) : (3.0 + x_3)) > ((4.0 + x_6) > ((10.0 + x_8) > (3.0 + x_9)? (10.0 + x_8) : (3.0 + x_9))? (4.0 + x_6) : ((10.0 + x_8) > (3.0 + x_9)? (10.0 + x_8) : (3.0 + x_9)))? ((1.0 + x_1) > (3.0 + x_3)? (1.0 + x_1) : (3.0 + x_3)) : ((4.0 + x_6) > ((10.0 + x_8) > (3.0 + x_9)? (10.0 + x_8) : (3.0 + x_9))? (4.0 + x_6) : ((10.0 + x_8) > (3.0 + x_9)? (10.0 + x_8) : (3.0 + x_9)))) : (((15.0 + x_10) > (19.0 + x_13)? (15.0 + x_10) : (19.0 + x_13)) > ((11.0 + x_14) > ((15.0 + x_16) > (17.0 + x_17)? (15.0 + x_16) : (17.0 + x_17))? (11.0 + x_14) : ((15.0 + x_16) > (17.0 + x_17)? (15.0 + x_16) : (17.0 + x_17)))? ((15.0 + x_10) > (19.0 + x_13)? (15.0 + x_10) : (19.0 + x_13)) : ((11.0 + x_14) > ((15.0 + x_16) > (17.0 + x_17)? (15.0 + x_16) : (17.0 + x_17))? (11.0 + x_14) : ((15.0 + x_16) > (17.0 + x_17)? (15.0 + x_16) : (17.0 + x_17))))); x_1_ = ((((20.0 + x_0) > (2.0 + x_4)? (20.0 + x_0) : (2.0 + x_4)) > ((20.0 + x_5) > ((18.0 + x_6) > (6.0 + x_8)? (18.0 + x_6) : (6.0 + x_8))? (20.0 + x_5) : ((18.0 + x_6) > (6.0 + x_8)? (18.0 + x_6) : (6.0 + x_8)))? ((20.0 + x_0) > (2.0 + x_4)? (20.0 + x_0) : (2.0 + x_4)) : ((20.0 + x_5) > ((18.0 + x_6) > (6.0 + x_8)? (18.0 + x_6) : (6.0 + x_8))? (20.0 + x_5) : ((18.0 + x_6) > (6.0 + x_8)? (18.0 + x_6) : (6.0 + x_8)))) > (((2.0 + x_10) > (4.0 + x_11)? (2.0 + x_10) : (4.0 + x_11)) > ((2.0 + x_13) > ((17.0 + x_16) > (20.0 + x_18)? (17.0 + x_16) : (20.0 + x_18))? (2.0 + x_13) : ((17.0 + x_16) > (20.0 + x_18)? (17.0 + x_16) : (20.0 + x_18)))? ((2.0 + x_10) > (4.0 + x_11)? (2.0 + x_10) : (4.0 + x_11)) : ((2.0 + x_13) > ((17.0 + x_16) > (20.0 + x_18)? (17.0 + x_16) : (20.0 + x_18))? (2.0 + x_13) : ((17.0 + x_16) > (20.0 + x_18)? (17.0 + x_16) : (20.0 + x_18))))? (((20.0 + x_0) > (2.0 + x_4)? (20.0 + x_0) : (2.0 + x_4)) > ((20.0 + x_5) > ((18.0 + x_6) > (6.0 + x_8)? (18.0 + x_6) : (6.0 + x_8))? (20.0 + x_5) : ((18.0 + x_6) > (6.0 + x_8)? (18.0 + x_6) : (6.0 + x_8)))? ((20.0 + x_0) > (2.0 + x_4)? (20.0 + x_0) : (2.0 + x_4)) : ((20.0 + x_5) > ((18.0 + x_6) > (6.0 + x_8)? (18.0 + x_6) : (6.0 + x_8))? (20.0 + x_5) : ((18.0 + x_6) > (6.0 + x_8)? (18.0 + x_6) : (6.0 + x_8)))) : (((2.0 + x_10) > (4.0 + x_11)? (2.0 + x_10) : (4.0 + x_11)) > ((2.0 + x_13) > ((17.0 + x_16) > (20.0 + x_18)? (17.0 + x_16) : (20.0 + x_18))? (2.0 + x_13) : ((17.0 + x_16) > (20.0 + x_18)? (17.0 + x_16) : (20.0 + x_18)))? ((2.0 + x_10) > (4.0 + x_11)? (2.0 + x_10) : (4.0 + x_11)) : ((2.0 + x_13) > ((17.0 + x_16) > (20.0 + x_18)? (17.0 + x_16) : (20.0 + x_18))? (2.0 + x_13) : ((17.0 + x_16) > (20.0 + x_18)? (17.0 + x_16) : (20.0 + x_18))))); x_2_ = ((((12.0 + x_0) > (12.0 + x_1)? (12.0 + x_0) : (12.0 + x_1)) > ((13.0 + x_4) > ((3.0 + x_5) > (1.0 + x_8)? (3.0 + x_5) : (1.0 + x_8))? (13.0 + x_4) : ((3.0 + x_5) > (1.0 + x_8)? (3.0 + x_5) : (1.0 + x_8)))? ((12.0 + x_0) > (12.0 + x_1)? (12.0 + x_0) : (12.0 + x_1)) : ((13.0 + x_4) > ((3.0 + x_5) > (1.0 + x_8)? (3.0 + x_5) : (1.0 + x_8))? (13.0 + x_4) : ((3.0 + x_5) > (1.0 + x_8)? (3.0 + x_5) : (1.0 + x_8)))) > (((11.0 + x_9) > (9.0 + x_12)? (11.0 + x_9) : (9.0 + x_12)) > ((20.0 + x_13) > ((10.0 + x_17) > (15.0 + x_18)? (10.0 + x_17) : (15.0 + x_18))? (20.0 + x_13) : ((10.0 + x_17) > (15.0 + x_18)? (10.0 + x_17) : (15.0 + x_18)))? ((11.0 + x_9) > (9.0 + x_12)? (11.0 + x_9) : (9.0 + x_12)) : ((20.0 + x_13) > ((10.0 + x_17) > (15.0 + x_18)? (10.0 + x_17) : (15.0 + x_18))? (20.0 + x_13) : ((10.0 + x_17) > (15.0 + x_18)? (10.0 + x_17) : (15.0 + x_18))))? (((12.0 + x_0) > (12.0 + x_1)? (12.0 + x_0) : (12.0 + x_1)) > ((13.0 + x_4) > ((3.0 + x_5) > (1.0 + x_8)? (3.0 + x_5) : (1.0 + x_8))? (13.0 + x_4) : ((3.0 + x_5) > (1.0 + x_8)? (3.0 + x_5) : (1.0 + x_8)))? ((12.0 + x_0) > (12.0 + x_1)? (12.0 + x_0) : (12.0 + x_1)) : ((13.0 + x_4) > ((3.0 + x_5) > (1.0 + x_8)? (3.0 + x_5) : (1.0 + x_8))? (13.0 + x_4) : ((3.0 + x_5) > (1.0 + x_8)? (3.0 + x_5) : (1.0 + x_8)))) : (((11.0 + x_9) > (9.0 + x_12)? (11.0 + x_9) : (9.0 + x_12)) > ((20.0 + x_13) > ((10.0 + x_17) > (15.0 + x_18)? (10.0 + x_17) : (15.0 + x_18))? (20.0 + x_13) : ((10.0 + x_17) > (15.0 + x_18)? (10.0 + x_17) : (15.0 + x_18)))? ((11.0 + x_9) > (9.0 + x_12)? (11.0 + x_9) : (9.0 + x_12)) : ((20.0 + x_13) > ((10.0 + x_17) > (15.0 + x_18)? (10.0 + x_17) : (15.0 + x_18))? (20.0 + x_13) : ((10.0 + x_17) > (15.0 + x_18)? (10.0 + x_17) : (15.0 + x_18))))); x_3_ = ((((7.0 + x_0) > (13.0 + x_3)? (7.0 + x_0) : (13.0 + x_3)) > ((7.0 + x_6) > ((10.0 + x_7) > (16.0 + x_8)? (10.0 + x_7) : (16.0 + x_8))? (7.0 + x_6) : ((10.0 + x_7) > (16.0 + x_8)? (10.0 + x_7) : (16.0 + x_8)))? ((7.0 + x_0) > (13.0 + x_3)? (7.0 + x_0) : (13.0 + x_3)) : ((7.0 + x_6) > ((10.0 + x_7) > (16.0 + x_8)? (10.0 + x_7) : (16.0 + x_8))? (7.0 + x_6) : ((10.0 + x_7) > (16.0 + x_8)? (10.0 + x_7) : (16.0 + x_8)))) > (((19.0 + x_11) > (13.0 + x_13)? (19.0 + x_11) : (13.0 + x_13)) > ((2.0 + x_14) > ((12.0 + x_15) > (2.0 + x_16)? (12.0 + x_15) : (2.0 + x_16))? (2.0 + x_14) : ((12.0 + x_15) > (2.0 + x_16)? (12.0 + x_15) : (2.0 + x_16)))? ((19.0 + x_11) > (13.0 + x_13)? (19.0 + x_11) : (13.0 + x_13)) : ((2.0 + x_14) > ((12.0 + x_15) > (2.0 + x_16)? (12.0 + x_15) : (2.0 + x_16))? (2.0 + x_14) : ((12.0 + x_15) > (2.0 + x_16)? (12.0 + x_15) : (2.0 + x_16))))? (((7.0 + x_0) > (13.0 + x_3)? (7.0 + x_0) : (13.0 + x_3)) > ((7.0 + x_6) > ((10.0 + x_7) > (16.0 + x_8)? (10.0 + x_7) : (16.0 + x_8))? (7.0 + x_6) : ((10.0 + x_7) > (16.0 + x_8)? (10.0 + x_7) : (16.0 + x_8)))? ((7.0 + x_0) > (13.0 + x_3)? (7.0 + x_0) : (13.0 + x_3)) : ((7.0 + x_6) > ((10.0 + x_7) > (16.0 + x_8)? (10.0 + x_7) : (16.0 + x_8))? (7.0 + x_6) : ((10.0 + x_7) > (16.0 + x_8)? (10.0 + x_7) : (16.0 + x_8)))) : (((19.0 + x_11) > (13.0 + x_13)? (19.0 + x_11) : (13.0 + x_13)) > ((2.0 + x_14) > ((12.0 + x_15) > (2.0 + x_16)? (12.0 + x_15) : (2.0 + x_16))? (2.0 + x_14) : ((12.0 + x_15) > (2.0 + x_16)? (12.0 + x_15) : (2.0 + x_16)))? ((19.0 + x_11) > (13.0 + x_13)? (19.0 + x_11) : (13.0 + x_13)) : ((2.0 + x_14) > ((12.0 + x_15) > (2.0 + x_16)? (12.0 + x_15) : (2.0 + x_16))? (2.0 + x_14) : ((12.0 + x_15) > (2.0 + x_16)? (12.0 + x_15) : (2.0 + x_16))))); x_4_ = ((((9.0 + x_2) > (16.0 + x_3)? (9.0 + x_2) : (16.0 + x_3)) > ((19.0 + x_5) > ((12.0 + x_8) > (6.0 + x_9)? (12.0 + x_8) : (6.0 + x_9))? (19.0 + x_5) : ((12.0 + x_8) > (6.0 + x_9)? (12.0 + x_8) : (6.0 + x_9)))? ((9.0 + x_2) > (16.0 + x_3)? (9.0 + x_2) : (16.0 + x_3)) : ((19.0 + x_5) > ((12.0 + x_8) > (6.0 + x_9)? (12.0 + x_8) : (6.0 + x_9))? (19.0 + x_5) : ((12.0 + x_8) > (6.0 + x_9)? (12.0 + x_8) : (6.0 + x_9)))) > (((17.0 + x_12) > (3.0 + x_13)? (17.0 + x_12) : (3.0 + x_13)) > ((17.0 + x_17) > ((15.0 + x_18) > (2.0 + x_19)? (15.0 + x_18) : (2.0 + x_19))? (17.0 + x_17) : ((15.0 + x_18) > (2.0 + x_19)? (15.0 + x_18) : (2.0 + x_19)))? ((17.0 + x_12) > (3.0 + x_13)? (17.0 + x_12) : (3.0 + x_13)) : ((17.0 + x_17) > ((15.0 + x_18) > (2.0 + x_19)? (15.0 + x_18) : (2.0 + x_19))? (17.0 + x_17) : ((15.0 + x_18) > (2.0 + x_19)? (15.0 + x_18) : (2.0 + x_19))))? (((9.0 + x_2) > (16.0 + x_3)? (9.0 + x_2) : (16.0 + x_3)) > ((19.0 + x_5) > ((12.0 + x_8) > (6.0 + x_9)? (12.0 + x_8) : (6.0 + x_9))? (19.0 + x_5) : ((12.0 + x_8) > (6.0 + x_9)? (12.0 + x_8) : (6.0 + x_9)))? ((9.0 + x_2) > (16.0 + x_3)? (9.0 + x_2) : (16.0 + x_3)) : ((19.0 + x_5) > ((12.0 + x_8) > (6.0 + x_9)? (12.0 + x_8) : (6.0 + x_9))? (19.0 + x_5) : ((12.0 + x_8) > (6.0 + x_9)? (12.0 + x_8) : (6.0 + x_9)))) : (((17.0 + x_12) > (3.0 + x_13)? (17.0 + x_12) : (3.0 + x_13)) > ((17.0 + x_17) > ((15.0 + x_18) > (2.0 + x_19)? (15.0 + x_18) : (2.0 + x_19))? (17.0 + x_17) : ((15.0 + x_18) > (2.0 + x_19)? (15.0 + x_18) : (2.0 + x_19)))? ((17.0 + x_12) > (3.0 + x_13)? (17.0 + x_12) : (3.0 + x_13)) : ((17.0 + x_17) > ((15.0 + x_18) > (2.0 + x_19)? (15.0 + x_18) : (2.0 + x_19))? (17.0 + x_17) : ((15.0 + x_18) > (2.0 + x_19)? (15.0 + x_18) : (2.0 + x_19))))); x_5_ = ((((13.0 + x_0) > (10.0 + x_2)? (13.0 + x_0) : (10.0 + x_2)) > ((8.0 + x_4) > ((14.0 + x_5) > (5.0 + x_9)? (14.0 + x_5) : (5.0 + x_9))? (8.0 + x_4) : ((14.0 + x_5) > (5.0 + x_9)? (14.0 + x_5) : (5.0 + x_9)))? ((13.0 + x_0) > (10.0 + x_2)? (13.0 + x_0) : (10.0 + x_2)) : ((8.0 + x_4) > ((14.0 + x_5) > (5.0 + x_9)? (14.0 + x_5) : (5.0 + x_9))? (8.0 + x_4) : ((14.0 + x_5) > (5.0 + x_9)? (14.0 + x_5) : (5.0 + x_9)))) > (((7.0 + x_10) > (12.0 + x_11)? (7.0 + x_10) : (12.0 + x_11)) > ((14.0 + x_12) > ((13.0 + x_16) > (2.0 + x_18)? (13.0 + x_16) : (2.0 + x_18))? (14.0 + x_12) : ((13.0 + x_16) > (2.0 + x_18)? (13.0 + x_16) : (2.0 + x_18)))? ((7.0 + x_10) > (12.0 + x_11)? (7.0 + x_10) : (12.0 + x_11)) : ((14.0 + x_12) > ((13.0 + x_16) > (2.0 + x_18)? (13.0 + x_16) : (2.0 + x_18))? (14.0 + x_12) : ((13.0 + x_16) > (2.0 + x_18)? (13.0 + x_16) : (2.0 + x_18))))? (((13.0 + x_0) > (10.0 + x_2)? (13.0 + x_0) : (10.0 + x_2)) > ((8.0 + x_4) > ((14.0 + x_5) > (5.0 + x_9)? (14.0 + x_5) : (5.0 + x_9))? (8.0 + x_4) : ((14.0 + x_5) > (5.0 + x_9)? (14.0 + x_5) : (5.0 + x_9)))? ((13.0 + x_0) > (10.0 + x_2)? (13.0 + x_0) : (10.0 + x_2)) : ((8.0 + x_4) > ((14.0 + x_5) > (5.0 + x_9)? (14.0 + x_5) : (5.0 + x_9))? (8.0 + x_4) : ((14.0 + x_5) > (5.0 + x_9)? (14.0 + x_5) : (5.0 + x_9)))) : (((7.0 + x_10) > (12.0 + x_11)? (7.0 + x_10) : (12.0 + x_11)) > ((14.0 + x_12) > ((13.0 + x_16) > (2.0 + x_18)? (13.0 + x_16) : (2.0 + x_18))? (14.0 + x_12) : ((13.0 + x_16) > (2.0 + x_18)? (13.0 + x_16) : (2.0 + x_18)))? ((7.0 + x_10) > (12.0 + x_11)? (7.0 + x_10) : (12.0 + x_11)) : ((14.0 + x_12) > ((13.0 + x_16) > (2.0 + x_18)? (13.0 + x_16) : (2.0 + x_18))? (14.0 + x_12) : ((13.0 + x_16) > (2.0 + x_18)? (13.0 + x_16) : (2.0 + x_18))))); x_6_ = ((((16.0 + x_0) > (10.0 + x_1)? (16.0 + x_0) : (10.0 + x_1)) > ((6.0 + x_3) > ((9.0 + x_4) > (11.0 + x_5)? (9.0 + x_4) : (11.0 + x_5))? (6.0 + x_3) : ((9.0 + x_4) > (11.0 + x_5)? (9.0 + x_4) : (11.0 + x_5)))? ((16.0 + x_0) > (10.0 + x_1)? (16.0 + x_0) : (10.0 + x_1)) : ((6.0 + x_3) > ((9.0 + x_4) > (11.0 + x_5)? (9.0 + x_4) : (11.0 + x_5))? (6.0 + x_3) : ((9.0 + x_4) > (11.0 + x_5)? (9.0 + x_4) : (11.0 + x_5)))) > (((9.0 + x_7) > (16.0 + x_8)? (9.0 + x_7) : (16.0 + x_8)) > ((13.0 + x_12) > ((15.0 + x_15) > (1.0 + x_17)? (15.0 + x_15) : (1.0 + x_17))? (13.0 + x_12) : ((15.0 + x_15) > (1.0 + x_17)? (15.0 + x_15) : (1.0 + x_17)))? ((9.0 + x_7) > (16.0 + x_8)? (9.0 + x_7) : (16.0 + x_8)) : ((13.0 + x_12) > ((15.0 + x_15) > (1.0 + x_17)? (15.0 + x_15) : (1.0 + x_17))? (13.0 + x_12) : ((15.0 + x_15) > (1.0 + x_17)? (15.0 + x_15) : (1.0 + x_17))))? (((16.0 + x_0) > (10.0 + x_1)? (16.0 + x_0) : (10.0 + x_1)) > ((6.0 + x_3) > ((9.0 + x_4) > (11.0 + x_5)? (9.0 + x_4) : (11.0 + x_5))? (6.0 + x_3) : ((9.0 + x_4) > (11.0 + x_5)? (9.0 + x_4) : (11.0 + x_5)))? ((16.0 + x_0) > (10.0 + x_1)? (16.0 + x_0) : (10.0 + x_1)) : ((6.0 + x_3) > ((9.0 + x_4) > (11.0 + x_5)? (9.0 + x_4) : (11.0 + x_5))? (6.0 + x_3) : ((9.0 + x_4) > (11.0 + x_5)? (9.0 + x_4) : (11.0 + x_5)))) : (((9.0 + x_7) > (16.0 + x_8)? (9.0 + x_7) : (16.0 + x_8)) > ((13.0 + x_12) > ((15.0 + x_15) > (1.0 + x_17)? (15.0 + x_15) : (1.0 + x_17))? (13.0 + x_12) : ((15.0 + x_15) > (1.0 + x_17)? (15.0 + x_15) : (1.0 + x_17)))? ((9.0 + x_7) > (16.0 + x_8)? (9.0 + x_7) : (16.0 + x_8)) : ((13.0 + x_12) > ((15.0 + x_15) > (1.0 + x_17)? (15.0 + x_15) : (1.0 + x_17))? (13.0 + x_12) : ((15.0 + x_15) > (1.0 + x_17)? (15.0 + x_15) : (1.0 + x_17))))); x_7_ = ((((6.0 + x_0) > (5.0 + x_1)? (6.0 + x_0) : (5.0 + x_1)) > ((19.0 + x_2) > ((2.0 + x_4) > (10.0 + x_7)? (2.0 + x_4) : (10.0 + x_7))? (19.0 + x_2) : ((2.0 + x_4) > (10.0 + x_7)? (2.0 + x_4) : (10.0 + x_7)))? ((6.0 + x_0) > (5.0 + x_1)? (6.0 + x_0) : (5.0 + x_1)) : ((19.0 + x_2) > ((2.0 + x_4) > (10.0 + x_7)? (2.0 + x_4) : (10.0 + x_7))? (19.0 + x_2) : ((2.0 + x_4) > (10.0 + x_7)? (2.0 + x_4) : (10.0 + x_7)))) > (((2.0 + x_8) > (12.0 + x_11)? (2.0 + x_8) : (12.0 + x_11)) > ((8.0 + x_12) > ((10.0 + x_14) > (6.0 + x_19)? (10.0 + x_14) : (6.0 + x_19))? (8.0 + x_12) : ((10.0 + x_14) > (6.0 + x_19)? (10.0 + x_14) : (6.0 + x_19)))? ((2.0 + x_8) > (12.0 + x_11)? (2.0 + x_8) : (12.0 + x_11)) : ((8.0 + x_12) > ((10.0 + x_14) > (6.0 + x_19)? (10.0 + x_14) : (6.0 + x_19))? (8.0 + x_12) : ((10.0 + x_14) > (6.0 + x_19)? (10.0 + x_14) : (6.0 + x_19))))? (((6.0 + x_0) > (5.0 + x_1)? (6.0 + x_0) : (5.0 + x_1)) > ((19.0 + x_2) > ((2.0 + x_4) > (10.0 + x_7)? (2.0 + x_4) : (10.0 + x_7))? (19.0 + x_2) : ((2.0 + x_4) > (10.0 + x_7)? (2.0 + x_4) : (10.0 + x_7)))? ((6.0 + x_0) > (5.0 + x_1)? (6.0 + x_0) : (5.0 + x_1)) : ((19.0 + x_2) > ((2.0 + x_4) > (10.0 + x_7)? (2.0 + x_4) : (10.0 + x_7))? (19.0 + x_2) : ((2.0 + x_4) > (10.0 + x_7)? (2.0 + x_4) : (10.0 + x_7)))) : (((2.0 + x_8) > (12.0 + x_11)? (2.0 + x_8) : (12.0 + x_11)) > ((8.0 + x_12) > ((10.0 + x_14) > (6.0 + x_19)? (10.0 + x_14) : (6.0 + x_19))? (8.0 + x_12) : ((10.0 + x_14) > (6.0 + x_19)? (10.0 + x_14) : (6.0 + x_19)))? ((2.0 + x_8) > (12.0 + x_11)? (2.0 + x_8) : (12.0 + x_11)) : ((8.0 + x_12) > ((10.0 + x_14) > (6.0 + x_19)? (10.0 + x_14) : (6.0 + x_19))? (8.0 + x_12) : ((10.0 + x_14) > (6.0 + x_19)? (10.0 + x_14) : (6.0 + x_19))))); x_8_ = ((((7.0 + x_4) > (8.0 + x_6)? (7.0 + x_4) : (8.0 + x_6)) > ((10.0 + x_7) > ((11.0 + x_8) > (10.0 + x_9)? (11.0 + x_8) : (10.0 + x_9))? (10.0 + x_7) : ((11.0 + x_8) > (10.0 + x_9)? (11.0 + x_8) : (10.0 + x_9)))? ((7.0 + x_4) > (8.0 + x_6)? (7.0 + x_4) : (8.0 + x_6)) : ((10.0 + x_7) > ((11.0 + x_8) > (10.0 + x_9)? (11.0 + x_8) : (10.0 + x_9))? (10.0 + x_7) : ((11.0 + x_8) > (10.0 + x_9)? (11.0 + x_8) : (10.0 + x_9)))) > (((18.0 + x_10) > (9.0 + x_12)? (18.0 + x_10) : (9.0 + x_12)) > ((15.0 + x_16) > ((4.0 + x_17) > (7.0 + x_19)? (4.0 + x_17) : (7.0 + x_19))? (15.0 + x_16) : ((4.0 + x_17) > (7.0 + x_19)? (4.0 + x_17) : (7.0 + x_19)))? ((18.0 + x_10) > (9.0 + x_12)? (18.0 + x_10) : (9.0 + x_12)) : ((15.0 + x_16) > ((4.0 + x_17) > (7.0 + x_19)? (4.0 + x_17) : (7.0 + x_19))? (15.0 + x_16) : ((4.0 + x_17) > (7.0 + x_19)? (4.0 + x_17) : (7.0 + x_19))))? (((7.0 + x_4) > (8.0 + x_6)? (7.0 + x_4) : (8.0 + x_6)) > ((10.0 + x_7) > ((11.0 + x_8) > (10.0 + x_9)? (11.0 + x_8) : (10.0 + x_9))? (10.0 + x_7) : ((11.0 + x_8) > (10.0 + x_9)? (11.0 + x_8) : (10.0 + x_9)))? ((7.0 + x_4) > (8.0 + x_6)? (7.0 + x_4) : (8.0 + x_6)) : ((10.0 + x_7) > ((11.0 + x_8) > (10.0 + x_9)? (11.0 + x_8) : (10.0 + x_9))? (10.0 + x_7) : ((11.0 + x_8) > (10.0 + x_9)? (11.0 + x_8) : (10.0 + x_9)))) : (((18.0 + x_10) > (9.0 + x_12)? (18.0 + x_10) : (9.0 + x_12)) > ((15.0 + x_16) > ((4.0 + x_17) > (7.0 + x_19)? (4.0 + x_17) : (7.0 + x_19))? (15.0 + x_16) : ((4.0 + x_17) > (7.0 + x_19)? (4.0 + x_17) : (7.0 + x_19)))? ((18.0 + x_10) > (9.0 + x_12)? (18.0 + x_10) : (9.0 + x_12)) : ((15.0 + x_16) > ((4.0 + x_17) > (7.0 + x_19)? (4.0 + x_17) : (7.0 + x_19))? (15.0 + x_16) : ((4.0 + x_17) > (7.0 + x_19)? (4.0 + x_17) : (7.0 + x_19))))); x_9_ = ((((10.0 + x_4) > (5.0 + x_5)? (10.0 + x_4) : (5.0 + x_5)) > ((13.0 + x_7) > ((3.0 + x_9) > (15.0 + x_10)? (3.0 + x_9) : (15.0 + x_10))? (13.0 + x_7) : ((3.0 + x_9) > (15.0 + x_10)? (3.0 + x_9) : (15.0 + x_10)))? ((10.0 + x_4) > (5.0 + x_5)? (10.0 + x_4) : (5.0 + x_5)) : ((13.0 + x_7) > ((3.0 + x_9) > (15.0 + x_10)? (3.0 + x_9) : (15.0 + x_10))? (13.0 + x_7) : ((3.0 + x_9) > (15.0 + x_10)? (3.0 + x_9) : (15.0 + x_10)))) > (((8.0 + x_11) > (3.0 + x_13)? (8.0 + x_11) : (3.0 + x_13)) > ((3.0 + x_14) > ((13.0 + x_15) > (4.0 + x_19)? (13.0 + x_15) : (4.0 + x_19))? (3.0 + x_14) : ((13.0 + x_15) > (4.0 + x_19)? (13.0 + x_15) : (4.0 + x_19)))? ((8.0 + x_11) > (3.0 + x_13)? (8.0 + x_11) : (3.0 + x_13)) : ((3.0 + x_14) > ((13.0 + x_15) > (4.0 + x_19)? (13.0 + x_15) : (4.0 + x_19))? (3.0 + x_14) : ((13.0 + x_15) > (4.0 + x_19)? (13.0 + x_15) : (4.0 + x_19))))? (((10.0 + x_4) > (5.0 + x_5)? (10.0 + x_4) : (5.0 + x_5)) > ((13.0 + x_7) > ((3.0 + x_9) > (15.0 + x_10)? (3.0 + x_9) : (15.0 + x_10))? (13.0 + x_7) : ((3.0 + x_9) > (15.0 + x_10)? (3.0 + x_9) : (15.0 + x_10)))? ((10.0 + x_4) > (5.0 + x_5)? (10.0 + x_4) : (5.0 + x_5)) : ((13.0 + x_7) > ((3.0 + x_9) > (15.0 + x_10)? (3.0 + x_9) : (15.0 + x_10))? (13.0 + x_7) : ((3.0 + x_9) > (15.0 + x_10)? (3.0 + x_9) : (15.0 + x_10)))) : (((8.0 + x_11) > (3.0 + x_13)? (8.0 + x_11) : (3.0 + x_13)) > ((3.0 + x_14) > ((13.0 + x_15) > (4.0 + x_19)? (13.0 + x_15) : (4.0 + x_19))? (3.0 + x_14) : ((13.0 + x_15) > (4.0 + x_19)? (13.0 + x_15) : (4.0 + x_19)))? ((8.0 + x_11) > (3.0 + x_13)? (8.0 + x_11) : (3.0 + x_13)) : ((3.0 + x_14) > ((13.0 + x_15) > (4.0 + x_19)? (13.0 + x_15) : (4.0 + x_19))? (3.0 + x_14) : ((13.0 + x_15) > (4.0 + x_19)? (13.0 + x_15) : (4.0 + x_19))))); x_10_ = ((((6.0 + x_0) > (6.0 + x_1)? (6.0 + x_0) : (6.0 + x_1)) > ((15.0 + x_2) > ((6.0 + x_4) > (10.0 + x_8)? (6.0 + x_4) : (10.0 + x_8))? (15.0 + x_2) : ((6.0 + x_4) > (10.0 + x_8)? (6.0 + x_4) : (10.0 + x_8)))? ((6.0 + x_0) > (6.0 + x_1)? (6.0 + x_0) : (6.0 + x_1)) : ((15.0 + x_2) > ((6.0 + x_4) > (10.0 + x_8)? (6.0 + x_4) : (10.0 + x_8))? (15.0 + x_2) : ((6.0 + x_4) > (10.0 + x_8)? (6.0 + x_4) : (10.0 + x_8)))) > (((1.0 + x_9) > (17.0 + x_10)? (1.0 + x_9) : (17.0 + x_10)) > ((12.0 + x_13) > ((18.0 + x_16) > (10.0 + x_17)? (18.0 + x_16) : (10.0 + x_17))? (12.0 + x_13) : ((18.0 + x_16) > (10.0 + x_17)? (18.0 + x_16) : (10.0 + x_17)))? ((1.0 + x_9) > (17.0 + x_10)? (1.0 + x_9) : (17.0 + x_10)) : ((12.0 + x_13) > ((18.0 + x_16) > (10.0 + x_17)? (18.0 + x_16) : (10.0 + x_17))? (12.0 + x_13) : ((18.0 + x_16) > (10.0 + x_17)? (18.0 + x_16) : (10.0 + x_17))))? (((6.0 + x_0) > (6.0 + x_1)? (6.0 + x_0) : (6.0 + x_1)) > ((15.0 + x_2) > ((6.0 + x_4) > (10.0 + x_8)? (6.0 + x_4) : (10.0 + x_8))? (15.0 + x_2) : ((6.0 + x_4) > (10.0 + x_8)? (6.0 + x_4) : (10.0 + x_8)))? ((6.0 + x_0) > (6.0 + x_1)? (6.0 + x_0) : (6.0 + x_1)) : ((15.0 + x_2) > ((6.0 + x_4) > (10.0 + x_8)? (6.0 + x_4) : (10.0 + x_8))? (15.0 + x_2) : ((6.0 + x_4) > (10.0 + x_8)? (6.0 + x_4) : (10.0 + x_8)))) : (((1.0 + x_9) > (17.0 + x_10)? (1.0 + x_9) : (17.0 + x_10)) > ((12.0 + x_13) > ((18.0 + x_16) > (10.0 + x_17)? (18.0 + x_16) : (10.0 + x_17))? (12.0 + x_13) : ((18.0 + x_16) > (10.0 + x_17)? (18.0 + x_16) : (10.0 + x_17)))? ((1.0 + x_9) > (17.0 + x_10)? (1.0 + x_9) : (17.0 + x_10)) : ((12.0 + x_13) > ((18.0 + x_16) > (10.0 + x_17)? (18.0 + x_16) : (10.0 + x_17))? (12.0 + x_13) : ((18.0 + x_16) > (10.0 + x_17)? (18.0 + x_16) : (10.0 + x_17))))); x_11_ = ((((2.0 + x_2) > (20.0 + x_4)? (2.0 + x_2) : (20.0 + x_4)) > ((19.0 + x_6) > ((20.0 + x_7) > (16.0 + x_9)? (20.0 + x_7) : (16.0 + x_9))? (19.0 + x_6) : ((20.0 + x_7) > (16.0 + x_9)? (20.0 + x_7) : (16.0 + x_9)))? ((2.0 + x_2) > (20.0 + x_4)? (2.0 + x_2) : (20.0 + x_4)) : ((19.0 + x_6) > ((20.0 + x_7) > (16.0 + x_9)? (20.0 + x_7) : (16.0 + x_9))? (19.0 + x_6) : ((20.0 + x_7) > (16.0 + x_9)? (20.0 + x_7) : (16.0 + x_9)))) > (((19.0 + x_13) > (7.0 + x_15)? (19.0 + x_13) : (7.0 + x_15)) > ((9.0 + x_16) > ((17.0 + x_17) > (14.0 + x_18)? (17.0 + x_17) : (14.0 + x_18))? (9.0 + x_16) : ((17.0 + x_17) > (14.0 + x_18)? (17.0 + x_17) : (14.0 + x_18)))? ((19.0 + x_13) > (7.0 + x_15)? (19.0 + x_13) : (7.0 + x_15)) : ((9.0 + x_16) > ((17.0 + x_17) > (14.0 + x_18)? (17.0 + x_17) : (14.0 + x_18))? (9.0 + x_16) : ((17.0 + x_17) > (14.0 + x_18)? (17.0 + x_17) : (14.0 + x_18))))? (((2.0 + x_2) > (20.0 + x_4)? (2.0 + x_2) : (20.0 + x_4)) > ((19.0 + x_6) > ((20.0 + x_7) > (16.0 + x_9)? (20.0 + x_7) : (16.0 + x_9))? (19.0 + x_6) : ((20.0 + x_7) > (16.0 + x_9)? (20.0 + x_7) : (16.0 + x_9)))? ((2.0 + x_2) > (20.0 + x_4)? (2.0 + x_2) : (20.0 + x_4)) : ((19.0 + x_6) > ((20.0 + x_7) > (16.0 + x_9)? (20.0 + x_7) : (16.0 + x_9))? (19.0 + x_6) : ((20.0 + x_7) > (16.0 + x_9)? (20.0 + x_7) : (16.0 + x_9)))) : (((19.0 + x_13) > (7.0 + x_15)? (19.0 + x_13) : (7.0 + x_15)) > ((9.0 + x_16) > ((17.0 + x_17) > (14.0 + x_18)? (17.0 + x_17) : (14.0 + x_18))? (9.0 + x_16) : ((17.0 + x_17) > (14.0 + x_18)? (17.0 + x_17) : (14.0 + x_18)))? ((19.0 + x_13) > (7.0 + x_15)? (19.0 + x_13) : (7.0 + x_15)) : ((9.0 + x_16) > ((17.0 + x_17) > (14.0 + x_18)? (17.0 + x_17) : (14.0 + x_18))? (9.0 + x_16) : ((17.0 + x_17) > (14.0 + x_18)? (17.0 + x_17) : (14.0 + x_18))))); x_12_ = ((((7.0 + x_0) > (13.0 + x_1)? (7.0 + x_0) : (13.0 + x_1)) > ((5.0 + x_4) > ((18.0 + x_7) > (2.0 + x_11)? (18.0 + x_7) : (2.0 + x_11))? (5.0 + x_4) : ((18.0 + x_7) > (2.0 + x_11)? (18.0 + x_7) : (2.0 + x_11)))? ((7.0 + x_0) > (13.0 + x_1)? (7.0 + x_0) : (13.0 + x_1)) : ((5.0 + x_4) > ((18.0 + x_7) > (2.0 + x_11)? (18.0 + x_7) : (2.0 + x_11))? (5.0 + x_4) : ((18.0 + x_7) > (2.0 + x_11)? (18.0 + x_7) : (2.0 + x_11)))) > (((18.0 + x_13) > (2.0 + x_14)? (18.0 + x_13) : (2.0 + x_14)) > ((13.0 + x_16) > ((10.0 + x_18) > (13.0 + x_19)? (10.0 + x_18) : (13.0 + x_19))? (13.0 + x_16) : ((10.0 + x_18) > (13.0 + x_19)? (10.0 + x_18) : (13.0 + x_19)))? ((18.0 + x_13) > (2.0 + x_14)? (18.0 + x_13) : (2.0 + x_14)) : ((13.0 + x_16) > ((10.0 + x_18) > (13.0 + x_19)? (10.0 + x_18) : (13.0 + x_19))? (13.0 + x_16) : ((10.0 + x_18) > (13.0 + x_19)? (10.0 + x_18) : (13.0 + x_19))))? (((7.0 + x_0) > (13.0 + x_1)? (7.0 + x_0) : (13.0 + x_1)) > ((5.0 + x_4) > ((18.0 + x_7) > (2.0 + x_11)? (18.0 + x_7) : (2.0 + x_11))? (5.0 + x_4) : ((18.0 + x_7) > (2.0 + x_11)? (18.0 + x_7) : (2.0 + x_11)))? ((7.0 + x_0) > (13.0 + x_1)? (7.0 + x_0) : (13.0 + x_1)) : ((5.0 + x_4) > ((18.0 + x_7) > (2.0 + x_11)? (18.0 + x_7) : (2.0 + x_11))? (5.0 + x_4) : ((18.0 + x_7) > (2.0 + x_11)? (18.0 + x_7) : (2.0 + x_11)))) : (((18.0 + x_13) > (2.0 + x_14)? (18.0 + x_13) : (2.0 + x_14)) > ((13.0 + x_16) > ((10.0 + x_18) > (13.0 + x_19)? (10.0 + x_18) : (13.0 + x_19))? (13.0 + x_16) : ((10.0 + x_18) > (13.0 + x_19)? (10.0 + x_18) : (13.0 + x_19)))? ((18.0 + x_13) > (2.0 + x_14)? (18.0 + x_13) : (2.0 + x_14)) : ((13.0 + x_16) > ((10.0 + x_18) > (13.0 + x_19)? (10.0 + x_18) : (13.0 + x_19))? (13.0 + x_16) : ((10.0 + x_18) > (13.0 + x_19)? (10.0 + x_18) : (13.0 + x_19))))); x_13_ = ((((6.0 + x_7) > (11.0 + x_8)? (6.0 + x_7) : (11.0 + x_8)) > ((20.0 + x_9) > ((7.0 + x_10) > (4.0 + x_11)? (7.0 + x_10) : (4.0 + x_11))? (20.0 + x_9) : ((7.0 + x_10) > (4.0 + x_11)? (7.0 + x_10) : (4.0 + x_11)))? ((6.0 + x_7) > (11.0 + x_8)? (6.0 + x_7) : (11.0 + x_8)) : ((20.0 + x_9) > ((7.0 + x_10) > (4.0 + x_11)? (7.0 + x_10) : (4.0 + x_11))? (20.0 + x_9) : ((7.0 + x_10) > (4.0 + x_11)? (7.0 + x_10) : (4.0 + x_11)))) > (((17.0 + x_12) > (19.0 + x_13)? (17.0 + x_12) : (19.0 + x_13)) > ((10.0 + x_14) > ((3.0 + x_15) > (12.0 + x_18)? (3.0 + x_15) : (12.0 + x_18))? (10.0 + x_14) : ((3.0 + x_15) > (12.0 + x_18)? (3.0 + x_15) : (12.0 + x_18)))? ((17.0 + x_12) > (19.0 + x_13)? (17.0 + x_12) : (19.0 + x_13)) : ((10.0 + x_14) > ((3.0 + x_15) > (12.0 + x_18)? (3.0 + x_15) : (12.0 + x_18))? (10.0 + x_14) : ((3.0 + x_15) > (12.0 + x_18)? (3.0 + x_15) : (12.0 + x_18))))? (((6.0 + x_7) > (11.0 + x_8)? (6.0 + x_7) : (11.0 + x_8)) > ((20.0 + x_9) > ((7.0 + x_10) > (4.0 + x_11)? (7.0 + x_10) : (4.0 + x_11))? (20.0 + x_9) : ((7.0 + x_10) > (4.0 + x_11)? (7.0 + x_10) : (4.0 + x_11)))? ((6.0 + x_7) > (11.0 + x_8)? (6.0 + x_7) : (11.0 + x_8)) : ((20.0 + x_9) > ((7.0 + x_10) > (4.0 + x_11)? (7.0 + x_10) : (4.0 + x_11))? (20.0 + x_9) : ((7.0 + x_10) > (4.0 + x_11)? (7.0 + x_10) : (4.0 + x_11)))) : (((17.0 + x_12) > (19.0 + x_13)? (17.0 + x_12) : (19.0 + x_13)) > ((10.0 + x_14) > ((3.0 + x_15) > (12.0 + x_18)? (3.0 + x_15) : (12.0 + x_18))? (10.0 + x_14) : ((3.0 + x_15) > (12.0 + x_18)? (3.0 + x_15) : (12.0 + x_18)))? ((17.0 + x_12) > (19.0 + x_13)? (17.0 + x_12) : (19.0 + x_13)) : ((10.0 + x_14) > ((3.0 + x_15) > (12.0 + x_18)? (3.0 + x_15) : (12.0 + x_18))? (10.0 + x_14) : ((3.0 + x_15) > (12.0 + x_18)? (3.0 + x_15) : (12.0 + x_18))))); x_14_ = ((((18.0 + x_0) > (2.0 + x_1)? (18.0 + x_0) : (2.0 + x_1)) > ((9.0 + x_2) > ((8.0 + x_4) > (4.0 + x_6)? (8.0 + x_4) : (4.0 + x_6))? (9.0 + x_2) : ((8.0 + x_4) > (4.0 + x_6)? (8.0 + x_4) : (4.0 + x_6)))? ((18.0 + x_0) > (2.0 + x_1)? (18.0 + x_0) : (2.0 + x_1)) : ((9.0 + x_2) > ((8.0 + x_4) > (4.0 + x_6)? (8.0 + x_4) : (4.0 + x_6))? (9.0 + x_2) : ((8.0 + x_4) > (4.0 + x_6)? (8.0 + x_4) : (4.0 + x_6)))) > (((6.0 + x_7) > (15.0 + x_9)? (6.0 + x_7) : (15.0 + x_9)) > ((6.0 + x_10) > ((19.0 + x_13) > (7.0 + x_16)? (19.0 + x_13) : (7.0 + x_16))? (6.0 + x_10) : ((19.0 + x_13) > (7.0 + x_16)? (19.0 + x_13) : (7.0 + x_16)))? ((6.0 + x_7) > (15.0 + x_9)? (6.0 + x_7) : (15.0 + x_9)) : ((6.0 + x_10) > ((19.0 + x_13) > (7.0 + x_16)? (19.0 + x_13) : (7.0 + x_16))? (6.0 + x_10) : ((19.0 + x_13) > (7.0 + x_16)? (19.0 + x_13) : (7.0 + x_16))))? (((18.0 + x_0) > (2.0 + x_1)? (18.0 + x_0) : (2.0 + x_1)) > ((9.0 + x_2) > ((8.0 + x_4) > (4.0 + x_6)? (8.0 + x_4) : (4.0 + x_6))? (9.0 + x_2) : ((8.0 + x_4) > (4.0 + x_6)? (8.0 + x_4) : (4.0 + x_6)))? ((18.0 + x_0) > (2.0 + x_1)? (18.0 + x_0) : (2.0 + x_1)) : ((9.0 + x_2) > ((8.0 + x_4) > (4.0 + x_6)? (8.0 + x_4) : (4.0 + x_6))? (9.0 + x_2) : ((8.0 + x_4) > (4.0 + x_6)? (8.0 + x_4) : (4.0 + x_6)))) : (((6.0 + x_7) > (15.0 + x_9)? (6.0 + x_7) : (15.0 + x_9)) > ((6.0 + x_10) > ((19.0 + x_13) > (7.0 + x_16)? (19.0 + x_13) : (7.0 + x_16))? (6.0 + x_10) : ((19.0 + x_13) > (7.0 + x_16)? (19.0 + x_13) : (7.0 + x_16)))? ((6.0 + x_7) > (15.0 + x_9)? (6.0 + x_7) : (15.0 + x_9)) : ((6.0 + x_10) > ((19.0 + x_13) > (7.0 + x_16)? (19.0 + x_13) : (7.0 + x_16))? (6.0 + x_10) : ((19.0 + x_13) > (7.0 + x_16)? (19.0 + x_13) : (7.0 + x_16))))); x_15_ = ((((2.0 + x_1) > (8.0 + x_3)? (2.0 + x_1) : (8.0 + x_3)) > ((4.0 + x_6) > ((11.0 + x_8) > (8.0 + x_9)? (11.0 + x_8) : (8.0 + x_9))? (4.0 + x_6) : ((11.0 + x_8) > (8.0 + x_9)? (11.0 + x_8) : (8.0 + x_9)))? ((2.0 + x_1) > (8.0 + x_3)? (2.0 + x_1) : (8.0 + x_3)) : ((4.0 + x_6) > ((11.0 + x_8) > (8.0 + x_9)? (11.0 + x_8) : (8.0 + x_9))? (4.0 + x_6) : ((11.0 + x_8) > (8.0 + x_9)? (11.0 + x_8) : (8.0 + x_9)))) > (((8.0 + x_10) > (20.0 + x_12)? (8.0 + x_10) : (20.0 + x_12)) > ((2.0 + x_13) > ((10.0 + x_16) > (12.0 + x_19)? (10.0 + x_16) : (12.0 + x_19))? (2.0 + x_13) : ((10.0 + x_16) > (12.0 + x_19)? (10.0 + x_16) : (12.0 + x_19)))? ((8.0 + x_10) > (20.0 + x_12)? (8.0 + x_10) : (20.0 + x_12)) : ((2.0 + x_13) > ((10.0 + x_16) > (12.0 + x_19)? (10.0 + x_16) : (12.0 + x_19))? (2.0 + x_13) : ((10.0 + x_16) > (12.0 + x_19)? (10.0 + x_16) : (12.0 + x_19))))? (((2.0 + x_1) > (8.0 + x_3)? (2.0 + x_1) : (8.0 + x_3)) > ((4.0 + x_6) > ((11.0 + x_8) > (8.0 + x_9)? (11.0 + x_8) : (8.0 + x_9))? (4.0 + x_6) : ((11.0 + x_8) > (8.0 + x_9)? (11.0 + x_8) : (8.0 + x_9)))? ((2.0 + x_1) > (8.0 + x_3)? (2.0 + x_1) : (8.0 + x_3)) : ((4.0 + x_6) > ((11.0 + x_8) > (8.0 + x_9)? (11.0 + x_8) : (8.0 + x_9))? (4.0 + x_6) : ((11.0 + x_8) > (8.0 + x_9)? (11.0 + x_8) : (8.0 + x_9)))) : (((8.0 + x_10) > (20.0 + x_12)? (8.0 + x_10) : (20.0 + x_12)) > ((2.0 + x_13) > ((10.0 + x_16) > (12.0 + x_19)? (10.0 + x_16) : (12.0 + x_19))? (2.0 + x_13) : ((10.0 + x_16) > (12.0 + x_19)? (10.0 + x_16) : (12.0 + x_19)))? ((8.0 + x_10) > (20.0 + x_12)? (8.0 + x_10) : (20.0 + x_12)) : ((2.0 + x_13) > ((10.0 + x_16) > (12.0 + x_19)? (10.0 + x_16) : (12.0 + x_19))? (2.0 + x_13) : ((10.0 + x_16) > (12.0 + x_19)? (10.0 + x_16) : (12.0 + x_19))))); x_16_ = ((((18.0 + x_0) > (14.0 + x_2)? (18.0 + x_0) : (14.0 + x_2)) > ((19.0 + x_3) > ((20.0 + x_5) > (6.0 + x_6)? (20.0 + x_5) : (6.0 + x_6))? (19.0 + x_3) : ((20.0 + x_5) > (6.0 + x_6)? (20.0 + x_5) : (6.0 + x_6)))? ((18.0 + x_0) > (14.0 + x_2)? (18.0 + x_0) : (14.0 + x_2)) : ((19.0 + x_3) > ((20.0 + x_5) > (6.0 + x_6)? (20.0 + x_5) : (6.0 + x_6))? (19.0 + x_3) : ((20.0 + x_5) > (6.0 + x_6)? (20.0 + x_5) : (6.0 + x_6)))) > (((1.0 + x_8) > (9.0 + x_11)? (1.0 + x_8) : (9.0 + x_11)) > ((10.0 + x_13) > ((9.0 + x_15) > (11.0 + x_17)? (9.0 + x_15) : (11.0 + x_17))? (10.0 + x_13) : ((9.0 + x_15) > (11.0 + x_17)? (9.0 + x_15) : (11.0 + x_17)))? ((1.0 + x_8) > (9.0 + x_11)? (1.0 + x_8) : (9.0 + x_11)) : ((10.0 + x_13) > ((9.0 + x_15) > (11.0 + x_17)? (9.0 + x_15) : (11.0 + x_17))? (10.0 + x_13) : ((9.0 + x_15) > (11.0 + x_17)? (9.0 + x_15) : (11.0 + x_17))))? (((18.0 + x_0) > (14.0 + x_2)? (18.0 + x_0) : (14.0 + x_2)) > ((19.0 + x_3) > ((20.0 + x_5) > (6.0 + x_6)? (20.0 + x_5) : (6.0 + x_6))? (19.0 + x_3) : ((20.0 + x_5) > (6.0 + x_6)? (20.0 + x_5) : (6.0 + x_6)))? ((18.0 + x_0) > (14.0 + x_2)? (18.0 + x_0) : (14.0 + x_2)) : ((19.0 + x_3) > ((20.0 + x_5) > (6.0 + x_6)? (20.0 + x_5) : (6.0 + x_6))? (19.0 + x_3) : ((20.0 + x_5) > (6.0 + x_6)? (20.0 + x_5) : (6.0 + x_6)))) : (((1.0 + x_8) > (9.0 + x_11)? (1.0 + x_8) : (9.0 + x_11)) > ((10.0 + x_13) > ((9.0 + x_15) > (11.0 + x_17)? (9.0 + x_15) : (11.0 + x_17))? (10.0 + x_13) : ((9.0 + x_15) > (11.0 + x_17)? (9.0 + x_15) : (11.0 + x_17)))? ((1.0 + x_8) > (9.0 + x_11)? (1.0 + x_8) : (9.0 + x_11)) : ((10.0 + x_13) > ((9.0 + x_15) > (11.0 + x_17)? (9.0 + x_15) : (11.0 + x_17))? (10.0 + x_13) : ((9.0 + x_15) > (11.0 + x_17)? (9.0 + x_15) : (11.0 + x_17))))); x_17_ = ((((7.0 + x_0) > (12.0 + x_4)? (7.0 + x_0) : (12.0 + x_4)) > ((9.0 + x_5) > ((1.0 + x_7) > (11.0 + x_8)? (1.0 + x_7) : (11.0 + x_8))? (9.0 + x_5) : ((1.0 + x_7) > (11.0 + x_8)? (1.0 + x_7) : (11.0 + x_8)))? ((7.0 + x_0) > (12.0 + x_4)? (7.0 + x_0) : (12.0 + x_4)) : ((9.0 + x_5) > ((1.0 + x_7) > (11.0 + x_8)? (1.0 + x_7) : (11.0 + x_8))? (9.0 + x_5) : ((1.0 + x_7) > (11.0 + x_8)? (1.0 + x_7) : (11.0 + x_8)))) > (((14.0 + x_9) > (17.0 + x_12)? (14.0 + x_9) : (17.0 + x_12)) > ((16.0 + x_15) > ((4.0 + x_17) > (16.0 + x_18)? (4.0 + x_17) : (16.0 + x_18))? (16.0 + x_15) : ((4.0 + x_17) > (16.0 + x_18)? (4.0 + x_17) : (16.0 + x_18)))? ((14.0 + x_9) > (17.0 + x_12)? (14.0 + x_9) : (17.0 + x_12)) : ((16.0 + x_15) > ((4.0 + x_17) > (16.0 + x_18)? (4.0 + x_17) : (16.0 + x_18))? (16.0 + x_15) : ((4.0 + x_17) > (16.0 + x_18)? (4.0 + x_17) : (16.0 + x_18))))? (((7.0 + x_0) > (12.0 + x_4)? (7.0 + x_0) : (12.0 + x_4)) > ((9.0 + x_5) > ((1.0 + x_7) > (11.0 + x_8)? (1.0 + x_7) : (11.0 + x_8))? (9.0 + x_5) : ((1.0 + x_7) > (11.0 + x_8)? (1.0 + x_7) : (11.0 + x_8)))? ((7.0 + x_0) > (12.0 + x_4)? (7.0 + x_0) : (12.0 + x_4)) : ((9.0 + x_5) > ((1.0 + x_7) > (11.0 + x_8)? (1.0 + x_7) : (11.0 + x_8))? (9.0 + x_5) : ((1.0 + x_7) > (11.0 + x_8)? (1.0 + x_7) : (11.0 + x_8)))) : (((14.0 + x_9) > (17.0 + x_12)? (14.0 + x_9) : (17.0 + x_12)) > ((16.0 + x_15) > ((4.0 + x_17) > (16.0 + x_18)? (4.0 + x_17) : (16.0 + x_18))? (16.0 + x_15) : ((4.0 + x_17) > (16.0 + x_18)? (4.0 + x_17) : (16.0 + x_18)))? ((14.0 + x_9) > (17.0 + x_12)? (14.0 + x_9) : (17.0 + x_12)) : ((16.0 + x_15) > ((4.0 + x_17) > (16.0 + x_18)? (4.0 + x_17) : (16.0 + x_18))? (16.0 + x_15) : ((4.0 + x_17) > (16.0 + x_18)? (4.0 + x_17) : (16.0 + x_18))))); x_18_ = ((((5.0 + x_2) > (5.0 + x_3)? (5.0 + x_2) : (5.0 + x_3)) > ((13.0 + x_7) > ((9.0 + x_9) > (20.0 + x_14)? (9.0 + x_9) : (20.0 + x_14))? (13.0 + x_7) : ((9.0 + x_9) > (20.0 + x_14)? (9.0 + x_9) : (20.0 + x_14)))? ((5.0 + x_2) > (5.0 + x_3)? (5.0 + x_2) : (5.0 + x_3)) : ((13.0 + x_7) > ((9.0 + x_9) > (20.0 + x_14)? (9.0 + x_9) : (20.0 + x_14))? (13.0 + x_7) : ((9.0 + x_9) > (20.0 + x_14)? (9.0 + x_9) : (20.0 + x_14)))) > (((8.0 + x_15) > (11.0 + x_16)? (8.0 + x_15) : (11.0 + x_16)) > ((5.0 + x_17) > ((14.0 + x_18) > (12.0 + x_19)? (14.0 + x_18) : (12.0 + x_19))? (5.0 + x_17) : ((14.0 + x_18) > (12.0 + x_19)? (14.0 + x_18) : (12.0 + x_19)))? ((8.0 + x_15) > (11.0 + x_16)? (8.0 + x_15) : (11.0 + x_16)) : ((5.0 + x_17) > ((14.0 + x_18) > (12.0 + x_19)? (14.0 + x_18) : (12.0 + x_19))? (5.0 + x_17) : ((14.0 + x_18) > (12.0 + x_19)? (14.0 + x_18) : (12.0 + x_19))))? (((5.0 + x_2) > (5.0 + x_3)? (5.0 + x_2) : (5.0 + x_3)) > ((13.0 + x_7) > ((9.0 + x_9) > (20.0 + x_14)? (9.0 + x_9) : (20.0 + x_14))? (13.0 + x_7) : ((9.0 + x_9) > (20.0 + x_14)? (9.0 + x_9) : (20.0 + x_14)))? ((5.0 + x_2) > (5.0 + x_3)? (5.0 + x_2) : (5.0 + x_3)) : ((13.0 + x_7) > ((9.0 + x_9) > (20.0 + x_14)? (9.0 + x_9) : (20.0 + x_14))? (13.0 + x_7) : ((9.0 + x_9) > (20.0 + x_14)? (9.0 + x_9) : (20.0 + x_14)))) : (((8.0 + x_15) > (11.0 + x_16)? (8.0 + x_15) : (11.0 + x_16)) > ((5.0 + x_17) > ((14.0 + x_18) > (12.0 + x_19)? (14.0 + x_18) : (12.0 + x_19))? (5.0 + x_17) : ((14.0 + x_18) > (12.0 + x_19)? (14.0 + x_18) : (12.0 + x_19)))? ((8.0 + x_15) > (11.0 + x_16)? (8.0 + x_15) : (11.0 + x_16)) : ((5.0 + x_17) > ((14.0 + x_18) > (12.0 + x_19)? (14.0 + x_18) : (12.0 + x_19))? (5.0 + x_17) : ((14.0 + x_18) > (12.0 + x_19)? (14.0 + x_18) : (12.0 + x_19))))); x_19_ = ((((9.0 + x_3) > (9.0 + x_5)? (9.0 + x_3) : (9.0 + x_5)) > ((15.0 + x_6) > ((19.0 + x_8) > (2.0 + x_9)? (19.0 + x_8) : (2.0 + x_9))? (15.0 + x_6) : ((19.0 + x_8) > (2.0 + x_9)? (19.0 + x_8) : (2.0 + x_9)))? ((9.0 + x_3) > (9.0 + x_5)? (9.0 + x_3) : (9.0 + x_5)) : ((15.0 + x_6) > ((19.0 + x_8) > (2.0 + x_9)? (19.0 + x_8) : (2.0 + x_9))? (15.0 + x_6) : ((19.0 + x_8) > (2.0 + x_9)? (19.0 + x_8) : (2.0 + x_9)))) > (((18.0 + x_11) > (9.0 + x_13)? (18.0 + x_11) : (9.0 + x_13)) > ((14.0 + x_14) > ((10.0 + x_16) > (11.0 + x_17)? (10.0 + x_16) : (11.0 + x_17))? (14.0 + x_14) : ((10.0 + x_16) > (11.0 + x_17)? (10.0 + x_16) : (11.0 + x_17)))? ((18.0 + x_11) > (9.0 + x_13)? (18.0 + x_11) : (9.0 + x_13)) : ((14.0 + x_14) > ((10.0 + x_16) > (11.0 + x_17)? (10.0 + x_16) : (11.0 + x_17))? (14.0 + x_14) : ((10.0 + x_16) > (11.0 + x_17)? (10.0 + x_16) : (11.0 + x_17))))? (((9.0 + x_3) > (9.0 + x_5)? (9.0 + x_3) : (9.0 + x_5)) > ((15.0 + x_6) > ((19.0 + x_8) > (2.0 + x_9)? (19.0 + x_8) : (2.0 + x_9))? (15.0 + x_6) : ((19.0 + x_8) > (2.0 + x_9)? (19.0 + x_8) : (2.0 + x_9)))? ((9.0 + x_3) > (9.0 + x_5)? (9.0 + x_3) : (9.0 + x_5)) : ((15.0 + x_6) > ((19.0 + x_8) > (2.0 + x_9)? (19.0 + x_8) : (2.0 + x_9))? (15.0 + x_6) : ((19.0 + x_8) > (2.0 + x_9)? (19.0 + x_8) : (2.0 + x_9)))) : (((18.0 + x_11) > (9.0 + x_13)? (18.0 + x_11) : (9.0 + x_13)) > ((14.0 + x_14) > ((10.0 + x_16) > (11.0 + x_17)? (10.0 + x_16) : (11.0 + x_17))? (14.0 + x_14) : ((10.0 + x_16) > (11.0 + x_17)? (10.0 + x_16) : (11.0 + x_17)))? ((18.0 + x_11) > (9.0 + x_13)? (18.0 + x_11) : (9.0 + x_13)) : ((14.0 + x_14) > ((10.0 + x_16) > (11.0 + x_17)? (10.0 + x_16) : (11.0 + x_17))? (14.0 + x_14) : ((10.0 + x_16) > (11.0 + x_17)? (10.0 + x_16) : (11.0 + x_17))))); x_0 = x_0_; x_1 = x_1_; x_2 = x_2_; x_3 = x_3_; x_4 = x_4_; x_5 = x_5_; x_6 = x_6_; x_7 = x_7_; x_8 = x_8_; x_9 = x_9_; x_10 = x_10_; x_11 = x_11_; x_12 = x_12_; x_13 = x_13_; x_14 = x_14_; x_15 = x_15_; x_16 = x_16_; x_17 = x_17_; x_18 = x_18_; x_19 = x_19_; } return 0; }
the_stack_data/75284.c
/* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton implementation for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. 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, 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. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 0 /* Using locations. */ #define YYLSP_NEEDED 0 /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { NUMBER = 258, TOKHEAT = 259, STATE = 260, TOKTARGET = 261, TOKTEMPERATURE = 262 }; #endif /* Tokens. */ #define NUMBER 258 #define TOKHEAT 259 #define STATE 260 #define TOKTARGET 261 #define TOKTEMPERATURE 262 /* Copy the first part of user declarations. */ #line 1 "grammar.y" #include <stdio.h> #include <string.h> void yyerror(const char *str) { fprintf(stderr,"error: %s\n",str); } int yywrap() { return 1; } main() { yyparse(); } /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* Enabling the token table. */ #ifndef YYTOKEN_TABLE # define YYTOKEN_TABLE 0 #endif #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif /* Copy the second part of user declarations. */ /* Line 216 of yacc.c. */ #line 141 "y.tab.c" #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #elif (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) typedef signed char yytype_int8; #else typedef short int yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ # define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(e) ((void) (e)) #else # define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint # define YYID(n) (n) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int YYID (int i) #else static int YYID (i) int i; #endif { return i; } #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss; YYSTYPE yyvs; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (YYID (0)) # endif # endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (YYID (0)) #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 2 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 6 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 8 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 5 /* YYNRULES -- Number of rules. */ #define YYNRULES 7 /* YYNRULES -- Number of states. */ #define YYNSTATES 11 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 262 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const yytype_uint8 yyprhs[] = { 0, 0, 3, 4, 7, 9, 11, 14 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { 9, 0, -1, -1, 9, 10, -1, 11, -1, 12, -1, 4, 5, -1, 6, 7, 3, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { 0, 25, 25, 26, 30, 32, 36, 43 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "NUMBER", "TOKHEAT", "STATE", "TOKTARGET", "TOKTEMPERATURE", "$accept", "commands", "command", "heat_switch", "target_set", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { 0, 8, 9, 9, 10, 10, 11, 12 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 0, 2, 1, 1, 2, 3 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { 2, 0, 1, 0, 0, 3, 4, 5, 6, 0, 7 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { -1, 1, 5, 6, 7 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -6 static const yytype_int8 yypact[] = { -6, 0, -6, -4, -5, -6, -6, -6, -6, 2, -6 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -6, -6, -6, -6, -6 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -1 static const yytype_uint8 yytable[] = { 2, 8, 9, 0, 3, 10, 4 }; static const yytype_int8 yycheck[] = { 0, 5, 7, -1, 4, 3, 6 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 9, 0, 4, 6, 10, 11, 12, 5, 7, 3 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ #define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ while (YYID (0)) #endif /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif #endif /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM # define YYLEX yylex (YYLEX_PARAM) #else # define YYLEX yylex () #endif /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (YYID (0)) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (YYID (0)) /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_value_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # else YYUSE (yyoutput); # endif switch (yytype) { default: break; } } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (yytype < YYNTOKENS) YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) #else static void yy_stack_print (bottom, top) yytype_int16 *bottom; yytype_int16 *top; #endif { YYFPRINTF (stderr, "Stack now"); for (; bottom <= top; ++bottom) YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_reduce_print (YYSTYPE *yyvsp, int yyrule) #else static void yy_reduce_print (yyvsp, yyrule) YYSTYPE *yyvsp; int yyrule; #endif { int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); fprintf (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyvsp, Rule); \ } while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) #else static YYSIZE_T yystrlen (yystr) const char *yystr; #endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) #else static char * yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; #endif { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif /* Copy into YYRESULT an error message about the unexpected token YYCHAR while in state YYSTATE. Return the number of bytes copied, including the terminating null byte. If YYRESULT is null, do not copy anything; just return the number of bytes that would be copied. As a special case, return 0 if an ordinary "syntax error" message will do. Return YYSIZE_MAXIMUM if overflow occurs during size calculation. */ static YYSIZE_T yysyntax_error (char *yyresult, int yystate, int yychar) { int yyn = yypact[yystate]; if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) return 0; else { int yytype = YYTRANSLATE (yychar); YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); YYSIZE_T yysize = yysize0; YYSIZE_T yysize1; int yysize_overflow = 0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; # if 0 /* This is so xgettext sees the translatable formats that are constructed on the fly. */ YY_("syntax error, unexpected %s"); YY_("syntax error, unexpected %s, expecting %s"); YY_("syntax error, unexpected %s, expecting %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); # endif char *yyfmt; char const *yyf; static char const yyunexpected[] = "syntax error, unexpected %s"; static char const yyexpecting[] = ", expecting %s"; static char const yyor[] = " or %s"; char yyformat[sizeof yyunexpected + sizeof yyexpecting - 1 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) * (sizeof yyor - 1))]; char const *yyprefix = yyexpecting; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yycount = 1; yyarg[0] = yytname[yytype]; yyfmt = yystpcpy (yyformat, yyunexpected); for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; yyformat[sizeof yyunexpected - 1] = '\0'; break; } yyarg[yycount++] = yytname[yyx]; yysize1 = yysize + yytnamerr (0, yytname[yyx]); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; yyfmt = yystpcpy (yyfmt, yyprefix); yyprefix = yyor; } yyf = YY_(yyformat); yysize1 = yysize + yystrlen (yyf); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; if (yysize_overflow) return YYSIZE_MAXIMUM; if (yyresult) { /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ char *yyp = yyresult; int yyi = 0; while ((*yyp = *yyf) != '\0') { if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyf += 2; } else { yyp++; yyf++; } } } return yysize; } } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else static void yydestruct (yymsg, yytype, yyvaluep) const char *yymsg; int yytype; YYSTYPE *yyvaluep; #endif { YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { default: break; } } /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); #else int yyparse (); #endif #else /* ! YYPARSE_PARAM */ #if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); #endif #endif /* ! YYPARSE_PARAM */ /* The look-ahead symbol. */ int yychar; /* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; /*----------. | yyparse. | `----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void *YYPARSE_PARAM) #else int yyparse (YYPARSE_PARAM) void *YYPARSE_PARAM; #endif #else /* ! YYPARSE_PARAM */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () #endif #endif { int yystate; int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif /* Three stacks and their tools: `yyss': related to states, `yyvs': related to semantic values, `yyls': related to locations. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss = yyssa; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; YYSTYPE *yyvsp; #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a look-ahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a look-ahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } if (yyn == YYFINAL) YYACCEPT; /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 6: #line 37 "grammar.y" { printf("\tHeat turned on or off\n"); } break; case 7: #line 44 "grammar.y" { printf("\tTemperature set\n"); } break; /* Line 1267 of yacc.c. */ #line 1340 "y.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else { YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) { YYSIZE_T yyalloc = 2 * yysize; if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) yyalloc = YYSTACK_ALLOC_MAXIMUM; if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yyalloc); if (yymsg) yymsg_alloc = yyalloc; else { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; } } if (0 < yysize && yysize <= yymsg_alloc) { (void) yysyntax_error (yymsg, yystate, yychar); yyerror (yymsg); } else { yyerror (YY_("syntax error")); if (yysize != 0) goto yyexhaustedlab; } } #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } if (yyn == YYFINAL) YYACCEPT; *++yyvsp = yylval; /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #ifndef yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif /* Make sure YYID is used. */ return YYID (yyresult); } #line 48 "grammar.y"
the_stack_data/218894090.c
/* * pr_08.c * Game of craps. * * Created on: Jun 4, 2013 * Author: delmadord */ #include <stdio.h> #include <stdbool.h> #include <time.h> #include <stdlib.h> int roll_dice(void); bool play_game(void); int main(void) { srand(time(NULL)); int wins = 0, loses = 0; char ch = 'y'; while (ch == 'y' || ch == 'Y') { if (play_game()) { wins++; printf("You win!\n"); } else { loses++; printf("You lose!\n"); } printf("\nPlay again? "); ch = getchar(); while (getchar() != '\n'); printf("\n"); } printf("Wins: %d Losses: %d", wins, loses); return 0; } // Generate a random number (simulation of rolling two dices) int roll_dice(void) { return rand() % 6 + rand() % 6 + 2; } bool play_game(void) { int status = false, roll = roll_dice(); printf("You rolled: %d\n", roll); if (roll == 7 || roll == 11) status = true; else if (roll == 2 || roll == 3) status = false; else { printf("Your point is %d\n", roll); int point = roll; while (roll = roll_dice()) { printf("You rolled: %d\n", roll); if (roll == point) { status = true; break; } else if (roll == 7) { status = false; break; } } } return status; }
the_stack_data/156393640.c
int main(void) { return 0; }
the_stack_data/157951720.c
#include<stdio.h> #include<unistd.h> #include<stdlib.h> #include<math.h> #include<string.h> #include<sys/stat.h> #include<fcntl.h> #include<time.h> #define MIN(a,b) (((a)<(b))?(a):(b)) #define MAX(a,b) (((a)>(b))?(a):(b)) #define sign(a) (((a)>(b))?(a):(b)) void delay(unsigned int mseconds) { clock_t goal = mseconds + clock(); while (goal > clock()); } int main(int argc, char *argv[]) { char str[200]; int sim_fd; int x, y, key,a,b,p,q,i,sp,sq, br; char buffer[10]; FILE *fp; fp = fopen("../storage/app/xy.txt", "r+"); x = 0; y = 0; const int sensitivity = 1; // Open the sysfs coordinate node sim_fd = open("/sys/devices/platform/virmouse/vmevent", O_RDWR); if (sim_fd < 0) { perror("Couldn't open vms coordinate file\n"); exit(-1); } while (1) { fscanf(fp, "%d %d %d %d",&x,&y,&key,&br); a = MAX(abs(x),abs(y)); b = MIN(abs(x),abs(y)); p = 0; q = 0; sp = 0; sq = 0; if(x!=0) {sp = x/abs(x);} if(y!=0) {sq = y/abs(y);} for(i=0;i<=a;i++) { if(abs(x) == a) { p = i*sp; q = 0; if(a != 0) { q = (i*b)/a*sq; } } else if(abs(y) == a) { p = 0; if(a!=0) {p = (i*b)/a*sp;} q = i*sq; } printf("%d %d %d %d\n",p,q,key,br); delay(3500); // Convey simulated coordinates to the virtual mouse driver p *= -sensitivity; q *= sensitivity; if(key!=0) { rewind(fp); fprintf(fp, "%d %d %d %d",0,0,0,br); } sprintf(buffer, "%d %d %d %d",p,q,key,br); write(sim_fd, buffer, strlen(buffer)); fsync(sim_fd); } rewind(fp); } close(sim_fd); }
the_stack_data/26700129.c
int NAND(int A, int B) { // Your code goes here! }
the_stack_data/15764064.c
#include <signal.h> /* sigemptyset(), sigaction(), kill(), SIGUSR1 */ #include <stdlib.h> /* exit() */ #include <unistd.h> /* getpid() */ #include <errno.h> /* errno */ #include <stdio.h> /* fprintf() */ static void mysig_handler(int sig) { exit(2); } int main() { /* setup sig handler */ struct sigaction sa; sa.sa_handler = mysig_handler; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; if (sigaction(SIGCHLD, &sa, NULL)) { fprintf(stderr, "could not set signal handler %d, aborted\n", errno); exit(1); } kill(getpid(), SIGCHLD); return 0; }
the_stack_data/67324553.c
#include <stdio.h> #include <string.h> int main() { int hap = 10; printf("%d",~hap); }
the_stack_data/61076540.c
extern void abort(void); void reach_error(){} extern unsigned int __VERIFIER_nondet_uint(void); void __VERIFIER_assert(int cond) { if (!(cond)) { ERROR: {reach_error();abort();} } return; } int main(void) { unsigned int x = __VERIFIER_nondet_uint(); while (x < 0x0fffffff) { x++; } __VERIFIER_assert(x > 0x0fffffff); }
the_stack_data/764107.c
//示例函数select()函数使用 #include<stdio.h> #include<stdlib.h> #include<sys/time.h> #include<sys/types.h> #include<unistd.h> #include<time.h> void display_time(const char *string){//显示时间 int seconds; seconds = time((time_t*)NULL); printf("%s,%d\n",string,seconds); } int main(){ fd_set readfds; struct timeval timeout; int ret; //监视文件描述符 0 是否有数据输入,文件描述符 0 表示标准输入,即键盘输入 FD_ZERO(&readfds); //刚开始使用一个文件描述符集合前一般要将其清空 FD_SET(0,&readfds); //设置阻塞时间为10秒 timeout.tv_sec = 10; timeout.tv_usec = 0; while(1){ display_time("before select"); ret = select(1,&readfds,NULL,NULL,&timeout); display_time("after select"); switch(ret){ case 0: printf("NO data in ten seconds!\n"); exit(0); break; case -1: perror("select"); exit(1); break; default: getchar(); //将数据读入,否则标准输入上将一直未读就绪 printf("Data is availiable now.\n"); } } return 0; }
the_stack_data/1112636.c
//@ #include "map.gh" /*@ //TODO: refactor this file //1. remove map, use list of pairs instead. //2. current version is not total. Therefore, well-definedness conditions need to be specified. lemma void map_contains_spec<tk,tv>(map<tk,tv> m, tk k, tv v) requires true; ensures map_contains(m, k, v) == (map_contains_key(m, k) && map_get(m, k) == v); { switch(m) { case mnil: case mcons(k2, v2, t): map_contains_spec(t, k, v); } } lemma void map_contains_functional<tk,tv>(map<tk,tv> m, tk k1, tv v1, tk k2, tv v2) requires map_contains(m, k1, v1) && map_contains(m, k2, v2); ensures (k1 == k2 ? v1 == v2 : true); { map_contains_spec(m, k1, v1); map_contains_spec(m, k2, v2); } lemma void map_put_maintains_map_contains<tk,tv>(map<tk,tv> m, tk k1, tv v1, tk k2, tv v2) requires k1 != k2; ensures map_contains(map_put(m, k2, v2), k1, v1) == map_contains(m, k1, v1); { switch(m) { case mnil: case mcons(k3, v3, t): if(k1 != k3 && k2 != k3) { map_put_maintains_map_contains(t, k1, v1, k2, v2); } } } lemma void map_put_causes_map_contains<tk,tv>(map<tk,tv> m, tk k1, tv v1) requires true; ensures map_contains(map_put(m, k1, v1), k1, v1) == true; { switch(m) { case mnil: case mcons(k3, v3, t): if(k1 != k3) { map_put_causes_map_contains(t, k1, v1); } } } lemma void map_remove_maintains_map_contains<tk,tv>(map<tk,tv> m, tk k1, tv v1, tk k2) requires k1 != k2; ensures map_contains(map_remove(m, k2), k1, v1) == map_contains(m, k1, v1); { switch(m) { case mnil: case mcons(k3, v3, t): if(k1 != k3) { map_remove_maintains_map_contains(t, k1, v1, k2); } } } lemma void map_put_invariant<tk,tv>(map<tk,tv> m, tk k1, tk k2, tv v2) requires k1 != k2; ensures map_get(map_put(m, k2, v2), k1) == map_get(m, k1); { switch(m) { case mnil: case mcons(k3, v3, t): if(k1 != k3 && k2 != k3) { map_put_invariant(t, k1, k2, v2); } } } lemma void map_remove_invariant<tk,tv>(map<tk,tv> m, tk k1, tk k2) requires k1 != k2; ensures map_get(map_remove(m, k2), k1) == map_get(m, k1); { switch(m) { case mnil: case mcons(k3, v3, t): if(k3 != k1) { map_remove_invariant(t, k1, k2); } } } lemma void map_contains_key_after_put<tk,tv>(map<tk,tv> m, tk k1, tk k2, tv v2) requires k1 != k2; ensures map_contains_key(map_put(m, k2, v2), k1) == map_contains_key(m, k1); { switch(m) { case mnil: case mcons(k3, v3, t): if(k1 != k3 && k2 != k3) { map_contains_key_after_put(t, k1, k2, v2); } } } lemma void map_contains_key_after_remove<tk,tv>(map<tk,tv> m, tk k1, tk k2) requires k1 != k2; ensures map_contains_key(map_remove(m, k2), k1) == map_contains_key(m, k1); { switch(m) { case mnil: case mcons(k3, v3, t): if(k1 != k3) { map_contains_key_after_remove(t, k1, k2); } } } lemma void map_contains_key_mem_map_keys<tk,tv>(map<tk,tv> m, tk k) requires true; ensures mem(k, map_keys(m)) == map_contains_key(m, k); { switch(m) { case mnil: case mcons(k2, v2, t): map_contains_key_mem_map_keys(t, k); } } lemma void map_put_map_keys<tk,tv>(map<tk,tv> m, tk k, tv v) requires !map_contains_key(m, k); ensures map_keys(map_put(m, k, v)) == snoc(map_keys(m), k); { switch(m) { case mnil: case mcons(k2, v2, t): map_put_map_keys(t, k, v); } } lemma void map_put_map_values<tk,tv>(map<tk,tv> m, tk k, tv v) requires !map_contains_key(m, k); ensures map_values(map_put(m, k, v)) == snoc(map_values(m), v); { switch(m) { case mnil: case mcons(k2, v2, t): map_put_map_values(t, k, v); } } lemma void map_put_map_contains_key<tk,tv>(map<tk,tv> m, tk k, tv v) requires true; ensures map_contains_key(map_put(m, k, v), k) == true; { switch(m) { case mnil: case mcons(k2, v2, t): map_put_map_contains_key(t, k, v); } } lemma void map_put_map_get<tk,tv>(map<tk,tv> m, tk k, tv v) requires true; ensures map_get(map_put(m, k, v), k) == v; { switch(m) { case mnil: case mcons(k2, v2, t): map_put_map_get(t, k, v); } } lemma void map_remove_map_keys<tk,tv>(map<tk,tv> m, tk k) requires true; ensures map_keys(map_remove(m, k)) == remove(k, map_keys(m)); { switch(m) { case mnil: case mcons(k2, v2, t): map_remove_map_keys(t, k); } } lemma void map_disjoint_mnil<tk,tv>(map<tk,tv> m) requires true; ensures map_disjoint(m, mnil) == true; { switch(m) { case mnil: case mcons(k, v, t): map_disjoint_mnil(t); } } lemma void map_alldisjoint_mnil<tk,tv>(list<map<tk,tv> > ms) requires true; ensures map_alldisjoint(mnil, ms) == true; { switch(ms) { case nil: case cons(h, t): map_alldisjoint_mnil(t); } } lemma void map_disjoint_cons_r<tk,tv>(map<tk,tv> m1, tk k, tv v, map<tk,tv> m2) requires true; ensures map_disjoint(m1, mcons(k, v, m2)) == (!map_contains_key(m1, k) && map_disjoint(m1, m2)); { switch(m1) { case mnil: map_disjoint_mnil(m2); case mcons(k2,v2,t): map_disjoint_cons_r(t, k, v, m2); } } lemma void map_disjoint_sym<tk,tv>(map<tk,tv> m1, map<tk,tv> m2) requires true; ensures map_disjoint(m1, m2) == map_disjoint(m2, m1); { switch(m1) { case mnil: map_disjoint_mnil(m2); case mcons(k,v,t): map_disjoint_sym(t, m2); map_disjoint_cons_r(m2, k, v, t); } } lemma void map_alldisjoint_snoc<tk,tv>(map<tk,tv> m, list<map<tk,tv> > ms, map<tk,tv> m2) requires true; ensures map_alldisjoint(m, snoc(ms, m2)) == (map_alldisjoint(m, ms) && map_disjoint(m, m2)); { switch(ms) { case nil: case cons(h, t): map_alldisjoint_snoc(m, t, m2); } } lemma void maps_disjoint_snoc<tk,tv>(list<map<tk,tv> > ms, map<tk,tv> m) requires true; ensures maps_disjoint(snoc(ms, m)) == (maps_disjoint(ms) && map_alldisjoint(m, ms)); { switch(ms) { case nil: case cons(h, t): map_alldisjoint_snoc(h, t, m); maps_disjoint_snoc(t, m); map_disjoint_sym(m, h); } } lemma void maps_disjunion_snoc_mnil<tk,tv>(list<map<tk,tv> > ms) requires true; ensures maps_disjunion(snoc(ms, mnil)) == maps_disjunion(ms); { switch(ms) { case nil: case cons(h, t): maps_disjunion_snoc_mnil(t); } } @*/
the_stack_data/84510.c
#include "string.h" /* TODO This is a temporary place to put libc functionality until we * decide on a lib to provide such functionality to the runtime */ #include <stdint.h> #include <ctype.h> void* memcpy(void* dest, const void* src, size_t len) { const char* s = src; char *d = dest; if ((((uintptr_t)dest | (uintptr_t)src) & (sizeof(uintptr_t)-1)) == 0) { while ((void*)d < (dest + len - (sizeof(uintptr_t)-1))) { *(uintptr_t*)d = *(const uintptr_t*)s; d += sizeof(uintptr_t); s += sizeof(uintptr_t); } } while (d < (char*)(dest + len)) *d++ = *s++; return dest; } void* memset(void* dest, int byte, size_t len) { if ((((uintptr_t)dest | len) & (sizeof(uintptr_t)-1)) == 0) { uintptr_t word = byte & 0xFF; word |= word << 8; word |= word << 16; word |= word << 16 << 16; uintptr_t *d = dest; while (d < (uintptr_t*)(dest + len)) *d++ = word; } else { char *d = dest; while (d < (char*)(dest + len)) *d++ = byte; } return dest; } int memcmp(const void* s1, const void* s2, size_t n) { unsigned char u1, u2; for ( ; n-- ; s1++, s2++) { u1 = * (unsigned char *) s1; u2 = * (unsigned char *) s2; if ( u1 != u2) { return (u1-u2); } } return 0; } /* Received from https://code.woboq.org/userspace/glibc/string/strcmp.c.html*/ /* Compare S1 and S2, returning less than, equal to or greater than zero if S1 is lexicographically less than, equal to or greater than S2. */ int strcmp (const char *p1, const char *p2) { const unsigned char *s1 = (const unsigned char *) p1; const unsigned char *s2 = (const unsigned char *) p2; unsigned char c1, c2; do { c1 = (unsigned char) *s1++; c2 = (unsigned char) *s2++; if (c1 == '\0') return c1 - c2; } while (c1 == c2); return c1 - c2; } /* Received from https://code.woboq.org/userspace/glibc/string/strcmp.c.html*/ char * strncpy (char *s1, const char *s2, size_t n) { size_t size = strnlen (s2, n); if (size != n) memset (s1 + size, '\0', n - size); return memcpy (s1, s2, size + 1); } size_t strlen (const char *str) { const char *tmp = str; for (;*tmp;tmp++); return tmp - str; } size_t strnlen(const char *str, size_t maxlen) { size_t i = 0; for (; i < maxlen && *str; str++, i++); return i; } char * strcpy (char *dest, const char *src) { size_t size = strlen(src); return memcpy(dest, src, size + 1); } /* Received from https://code.woboq.org/userspace/glibc/string/strcmp.c.html*/ /* Compare no more than N characters of S1 and S2, returning less than, equal to or greater than zero if S1 is lexicographically less than, equal to or greater than S2. */ int strncmp (const char *s1, const char *s2, size_t n) { unsigned char c1 = '\0'; unsigned char c2 = '\0'; if (n >= 4) { size_t n4 = n >> 2; do { c1 = (unsigned char) *s1++; c2 = (unsigned char) *s2++; if (c1 == '\0' || c1 != c2) return c1 - c2; c1 = (unsigned char) *s1++; c2 = (unsigned char) *s2++; if (c1 == '\0' || c1 != c2) return c1 - c2; c1 = (unsigned char) *s1++; c2 = (unsigned char) *s2++; if (c1 == '\0' || c1 != c2) return c1 - c2; c1 = (unsigned char) *s1++; c2 = (unsigned char) *s2++; if (c1 == '\0' || c1 != c2) return c1 - c2; } while (--n4 > 0); n &= 3; } while (n > 0) { c1 = (unsigned char) *s1++; c2 = (unsigned char) *s2++; if (c1 == '\0' || c1 != c2) return c1 - c2; n--; } return c1 - c2; } /* Received from https://code.woboq.org/userspace/glibc/string/strncat.c.html */ char * strncat (char *s1, const char *s2, size_t n) { char *s = s1; /* Find the end of S1. */ s1 += strlen (s1); size_t ss = strnlen (s2, n); s1[ss] = '\0'; memcpy (s1, s2, ss); return s; }
the_stack_data/42498.c
#include<stdio.h> int main() { int year; printf("Enter the year to be checked: "); scanf("%d",&year); if(year%4==0 && year%400==0 || year%100!=0) printf("The year is a leap year!!.. :-)"); else printf("The year is not a leap year :-("); return 0; }
the_stack_data/224448.c
// vim: syntax=c tabstop=4 softtabstop=0 noexpandtab laststatus=1 ruler /** * wrappers/docker_functions.c * * Functions for docker_wrapper. * * @author Andrea Dainese <[email protected]> * @copyright 2014-2016 Andrea Dainese * @license BSD-3-Clause https://github.com/dainok/unetlab/blob/master/LICENSE * @link http://www.unetlab.com/ * @version 20160719 */ #include <stdio.h> #include <stdlib.h> // Print usage void usage(const char *bin) { printf("Usage: %s <standard options> -- attach <Docker ID>\n", bin); printf("Standard Options:\n"); printf("-T <n> *Tenant ID\n"); printf("-D <n> *Device ID\n"); printf("-t <desc> Window (xterm) title\n"); printf("-F <n> *Docker executable\n"); printf("* Mandatory option\n"); exit(1); }
the_stack_data/43710.c
/* Use after free of an allocated integer in an array of pointers to integers. */ #include <stdlib.h> #define ARRSZ 100 int main() { int *arr[ARRSZ], i; arr[6] = malloc(sizeof(int)); *arr[6] = 20; free(arr[*arr[6] - 14]); *arr[6] = 100; return 0; }
the_stack_data/64056.c
/* version.c */ char version[]= "inet 0.35K, last compiled on " __DATE__ " " __TIME__; /* * $PchId: version.c,v 1.9 1996/12/17 08:01:39 philip Exp philip $ */
the_stack_data/85698.c
#include <pthread.h> #include <stdio.h> #include <stdlib.h> #define NUM_THREADS 5 void *PrintThread(void *threadid) { long tid; tid = (long) threadid; printf("Thread #%ld criada\n", tid); pthread_exit(NULL); } int main (int argc, char *argv[]) { pthread_t threads[NUM_THREADS]; int rc; long t; for(t=0; t < NUM_THREADS; t++){ printf("Base cria thread %ld\n", t); rc = pthread_create(&threads[t], NULL, PrintThread, (void *)t); if (rc){ printf("Falha no retorno de pthread_creat(), cod.= %d\n", rc); exit(-1); } } /* Last thing that maisn() should do */ pthread_exit(NULL); }
the_stack_data/57949738.c
int test_mul_x2; void undo_test_mul2(void); void test_mul2(void) { test_mul_x2 = test_mul_x2 * 7; test_mul_x2 = test_mul_x2 * 11; }
the_stack_data/920906.c
#include<stdio.h> /* Replace period with exclamation mark. */ int main(void) { const char STOP = '#'; int replace_count = 0; char ch; printf("Enter text to be replaced (# to quit)\n"); while ((ch = getchar()) != STOP) { switch (ch) { case '.': putchar('!'); replace_count++; break; case '!': printf("!!"); replace_count++; break; default: putchar(ch); break; } } printf("Done.\n"); printf("Replace count: %d\n", replace_count); return 0; }
the_stack_data/155065.c
// NAME : 10 Kinds of People // URL : https://open.kattis.com/problems/10kindsofpeople // ============================================================================= // Use a queue and iterative search to identify which cells are connected to // each other. A recursive solution is problematic because it can overflow // the stack given the right inputs. Once we have tagged contiguous sections // of like cells we are prepared to give answers to connectivity questions. // ============================================================================= #include <stdio.h> #include <stdlib.h> #define TRUE 1 #define FALSE 0 #define UNVISITED_BINARY 0 #define UNVISITED_DECIMAL 1 #define MAX_ROWS 1000 #define MAX_COLS 1000 // Kind of lame way to differentiate between decimal and binary tags (use // completely different ranges). We could instead keep track of which 'type' of // cell we are visiting when we assign a new tag and simply look up the 'type' // later when we need to print the result. This would let us avoid maintaining // distinct tags. #define DECIMAL_TAG_OFFSET 5000000 struct q_entry { int row; int col; }; struct map_entry { int tag; int queued; }; struct map_entry* map[MAX_ROWS]; struct q_entry* q = NULL; int rows = 0; int cols = 0; int q_start = 0; int q_end = 0; void queue_neighbor(int r, int c, int unvisited_val) { // Queue cell up if: // 1. In range // 2. Not already queued // 3. Has the same unvisited value as what we are searching for if (r >= 0 && r < rows && c >= 0 && c < cols && !map[r][c].queued && map[r][c].tag == unvisited_val) { //fprintf(stderr, "QUEUING -- R:%d C:%d\n", r, c); map[r][c].queued = 1; q[q_end].row = r; q[q_end].col = c; q_end++; } } int main(void) { int binary_tag = 2; int decimal_tag = DECIMAL_TAG_OFFSET; char line[MAX_ROWS + 1]; q = malloc(MAX_ROWS * MAX_COLS * sizeof(struct q_entry)); for (int i = 0; i < MAX_ROWS; i++) { map[i] = malloc(MAX_COLS * sizeof(struct map_entry)); } scanf("%d %d", &rows, &cols); //fprintf(stderr, "R:%d C:%d\n", rows, cols); for (int r = 0; r < rows; r++) { scanf("%s", (char *)&line); for (int c = 0; c < cols; c++) { map[r][c].tag = line[c] - '0'; map[r][c].queued = 0; } } for (int r = 0; r < rows; r++) { for (int c = 0; c < cols; c++) { int cell_val = map[r][c].tag; if (cell_val == UNVISITED_BINARY || cell_val == UNVISITED_DECIMAL) { q[q_end].row = r; q[q_end].col =c; q_end++; while (q_start < q_end) { int curr_row = q[q_start].row; int curr_col = q[q_start].col; //fprintf(stderr, "QSTART:%d QEND:%d R:%d C:%d\n", q_start, q_end, curr_row, curr_col); // Cell being searched matches our current search value (is connected). Process // it, then consider all neighbors. if (map[curr_row][curr_col].tag == cell_val) { if (cell_val == UNVISITED_BINARY) { //fprintf(stderr, "TAGGING -- R:%d C:%d T:%d\n", curr_row, curr_col, binary_tag); map[curr_row][curr_col].tag = binary_tag; } else { //fprintf(stderr, "TAGGING -- R:%d C:%d T:%d\n", curr_row, curr_col, binary_tag); map[curr_row][curr_col].tag = decimal_tag; } queue_neighbor(curr_row - 1, curr_col, cell_val); queue_neighbor(curr_row + 1, curr_col, cell_val); queue_neighbor(curr_row, curr_col - 1, cell_val); queue_neighbor(curr_row, curr_col + 1, cell_val); } q_start++; } if (cell_val == UNVISITED_BINARY) { binary_tag++; } else { decimal_tag++; } } } } int num_cases; int r1, c1, r2, c2; int tag1, tag2; scanf("%d", &num_cases); // Our map is built. All that is left is to solve each of the cases. This // step is trivial - all we need to do is look up the tags and see if // they are the same. If same, the cells are connected. If different, they // are not connected. for (int i = 0; i < num_cases; i++) { scanf("%d %d %d %d", &r1, &c1, &r2, &c2); tag1 = map[r1 - 1][c1 - 1].tag; tag2 = map[r2 - 1][c2 - 1].tag; if (tag1 == tag2) { if (tag1 >= DECIMAL_TAG_OFFSET) { printf("decimal\n"); } else { printf("binary\n"); } } else { printf("neither\n"); } } free(q); for (int i = 0; i < MAX_ROWS; i++) { free(map[i]); } return 0; }
the_stack_data/6387983.c
/* * getopt.c * * getopt_long(), or at least a common subset thereof: * * - Option reordering is not supported * - -W foo is not supported * - First optstring character "-" not supported. * * This file was imported from the klibc library from hpa */ #include <stdint.h> #include <unistd.h> #include <string.h> #include "getopt.h" char *optarg = NULL; int optind = 0, opterr = 0, optopt = 0; static struct getopt_private_state { const char *optptr; const char *last_optstring; char *const *last_argv; } pvt; static inline const char *option_matches(const char *arg_str, const char *opt_name, int smatch) { while (*arg_str != '\0' && *arg_str != '=') { if (*arg_str++ != *opt_name++) return NULL; } if (*opt_name && !smatch) return NULL; return arg_str; } int getopt_long_only(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *longindex) { const char *carg; const char *osptr; int opt; optarg = NULL; /* getopt() relies on a number of different global state variables, which can make this really confusing if there is more than one use of getopt() in the same program. This attempts to detect that situation by detecting if the "optstring" or "argv" argument have changed since last time we were called; if so, reinitialize the query state. */ if (optstring != pvt.last_optstring || argv != pvt.last_argv || optind < 1 || optind > argc) { /* optind doesn't match the current query */ pvt.last_optstring = optstring; pvt.last_argv = argv; optind = 1; pvt.optptr = NULL; } carg = argv[optind]; /* First, eliminate all non-option cases */ if (!carg || carg[0] != '-' || !carg[1]) return -1; if (carg[1] == '-') { const struct option *lo; const char *opt_end = NULL; optind++; /* Either it's a long option, or it's -- */ if (!carg[2]) { /* It's -- */ return -1; } for (lo = longopts; lo->name; lo++) { opt_end = option_matches(carg+2, lo->name, 0); if (opt_end) break; } /* * The GNU getopt_long_only() apparently allows a short match, * if it's unique and if we don't have a full match. Let's * do the same here, search and see if there is one (and only * one) short match. */ if (!opt_end) { const struct option *lo_match = NULL; for (lo = longopts; lo->name; lo++) { const char *ret; ret = option_matches(carg+2, lo->name, 1); if (!ret) continue; if (!opt_end) { opt_end = ret; lo_match = lo; } else { opt_end = NULL; break; } } if (!opt_end) return '?'; lo = lo_match; } if (longindex) *longindex = lo-longopts; if (*opt_end == '=') { if (lo->has_arg) optarg = (char *)opt_end+1; else return '?'; } else if (lo->has_arg == 1) { if (!(optarg = argv[optind])) return '?'; optind++; } if (lo->flag) { *lo->flag = lo->val; return 0; } else { return lo->val; } } if ((uintptr_t) (pvt.optptr - carg) > (uintptr_t) strlen(carg)) { /* Someone frobbed optind, change to new opt. */ pvt.optptr = carg + 1; } opt = *pvt.optptr++; if (opt != ':' && (osptr = strchr(optstring, opt))) { if (osptr[1] == ':') { if (*pvt.optptr) { /* Argument-taking option with attached argument */ optarg = (char *)pvt.optptr; optind++; } else { /* Argument-taking option with non-attached argument */ if (osptr[2] == ':') { if (argv[optind + 1]) { optarg = (char *)argv[optind+1]; optind += 2; } else { optarg = NULL; optind++; } return opt; } else if (argv[optind + 1]) { optarg = (char *)argv[optind+1]; optind += 2; } else { /* Missing argument */ optind++; return (optstring[0] == ':') ? ':' : '?'; } } return opt; } else { /* Non-argument-taking option */ /* pvt.optptr will remember the exact position to resume at */ if (!*pvt.optptr) optind++; return opt; } } else { /* Unknown option */ optopt = opt; if (!*pvt.optptr) optind++; return '?'; } }
the_stack_data/193894050.c
#include <stdio.h> #include <stdlib.h> #include <time.h> void fillMatrix(float *mat, int min, int max, int size) { srand(time(NULL)); for (int i = 0; i < size; i++) { mat[i] = (rand() % (max - min + 1)) + min; } } void multiply() { // create the matrices, 2 that contain the numbers we want to multiply int row_matrix_1 = 3000; int row_matrix_2 = 3000; int col_matrix_1 = 3000; int col_matrix_2 = 2700; // creating 3rd matrix to hold the final value int row_matrix_3 = 3000; int col_matrix_3 = 2700; float *matrix_one = (float*) malloc(sizeof(float)*row_matrix_1*col_matrix_1); float *matrix_two = (float*) malloc(sizeof(float)*row_matrix_2*col_matrix_2); float *matrix_three = (float*) malloc(sizeof(float)*row_matrix_3*col_matrix_3); float sum = 0; // fill the matrices with random numbers fillMatrix(matrix_one, 1, 100, row_matrix_1 * col_matrix_1); fillMatrix(matrix_two, 1, 100, row_matrix_2 * col_matrix_2); // multiply the matrices // print that multiplication is happening printf("Multiplying the matrices...\n"); for (int i = 0; i < 10; i++) { for(int i = 0; i < row_matrix_1; i++ ){ for(int j = 0; j < col_matrix_2; j++){ sum = 0; for(int k = 0; k < col_matrix_1; k++){ //printf("%f * %f = %f\n", matrix_one[i*col_matrix_1 + k], matrix_two[k*col_matrix_2 + j], sum); sum += matrix_one[i*col_matrix_1+k]* matrix_two[k*col_matrix_2+k]; } matrix_three[i* col_matrix_3 + j]=sum; } } } printf("Multiplication done\n"); // free the memory allocation free(matrix_one); free(matrix_two); free(matrix_three); // This code is contributed by Manish Kumar (mkumar2789) } int main() { // calls the multiple function // start clock clock_t start = clock(); multiply(); // stop clock clock_t end = clock(); double time_spent = (double)(end - start) / CLOCKS_PER_SEC; printf("Time: %f seconds\n", time_spent); }
the_stack_data/43889175.c
/* * lin-power-fndsockcode64.c * Copyright 2008 Ramon de Carvalho Valle <[email protected]> * * This 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. * * This 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 this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #define FNDSOCKPORT 86 char fndsockcode64[]= /* 171 bytes */ "\x7f\xff\xfa\x78" /* xor r31,r31,r31 */ "\x3b\xa0\x01\xff" /* li r29,511 */ "\x97\xe1\xff\xfc" /* stwu r31,-4(r1) */ "\x7c\x3c\x0b\x78" /* mr r28,r1 */ "\x3b\x7d\xfe\x11" /* addi r27,r29,-495 */ "\x97\x61\xff\xfc" /* stwu r27,-4(r1) */ "\x7c\x3a\x0b\x78" /* mr r26,r1 */ "\xfb\x41\xff\xf9" /* stdu r26,-8(r1) */ "\xfb\x81\xff\xf9" /* stdu r28,-8(r1) */ "\xfb\xe1\xff\xf9" /* stdu r31,-8(r1) */ "\x3b\xff\x01\xff" /* addi r31,r31,511 */ "\x3b\xff\xfe\x02" /* addi r31,r31,-510 */ "\x38\x21\x01\xff" /* addi r1,r1,511 */ "\x38\x21\xfe\x09" /* addi r1,r1,-503 */ "\xfb\xe1\xff\xf9" /* stdu r31,-8(r1) */ "\x7c\x24\x0b\x78" /* mr r4,r1 */ "\x38\x7d\xfe\x08" /* addi r3,r29,-504 */ "\x38\x1d\xfe\x67" /* addi r0,r29,-409 */ "\x44\xff\xff\x02" /* sc */ "\x3b\x3c\x01\xff" /* addi r25,r28,511 */ "\xa3\x39\xfe\x03" /* lhz r25,-509(r25) */ "\x28\x19\x04\xd2" /* cmplwi r25,1234 */ "\x40\x82\xff\xd0" /* bne+ <fndsockcode64+40> */ "\x3b\x1d\xfe\x03" /* addi r24,r29,-509 */ "\x7f\x04\xc3\x78" /* mr r4,r24 */ "\x7f\xe3\xfb\x78" /* mr r3,r31 */ "\x38\x1d\xfe\x40" /* addi r0,r29,-448 */ "\x44\xff\xff\x02" /* sc */ "\x37\x18\xff\xff" /* addic. r24,r24,-1 */ "\x40\x80\xff\xec" /* bge+ <fndsockcode64+96> */ "\x7c\xa5\x2a\x79" /* xor. r5,r5,r5 */ "\x40\x82\xff\xfd" /* bnel+ <fndsockcode64+120> */ "\x7f\xc8\x02\xa6" /* mflr r30 */ "\x3b\xde\x01\xff" /* addi r30,r30,511 */ "\x38\x7e\xfe\x25" /* addi r3,r30,-475 */ "\x98\xbe\xfe\x2c" /* stb r5,-468(r30) */ "\xf8\xa1\xff\xf9" /* stdu r5,-8(r1) */ "\xf8\x61\xff\xf9" /* stdu r3,-8(r1) */ "\x7c\x24\x0b\x78" /* mr r4,r1 */ "\x38\x1d\xfe\x0c" /* addi r0,r29,-500 */ "\x44\xff\xff\x02" /* sc */ "/bin/sh" ;
the_stack_data/72012587.c
#include <stdio.h> int main(void) { int copias; float valor; const float valor_sv = 0.25f, valor_cv = 0.20f; const int minimo_volume = 100; printf("Numero de copias a serem feitas\n"); scanf("%d", &copias); if(copias <= minimo_volume) { printf("o valor a ser pago e de %.2f\n", (valor_sv * (float)copias)); } else { printf("o valor a ser pago e de %.2f\n", (valor_cv * (float)copias)); } return 0; }
the_stack_data/211079897.c
int main() { int i = 0; int a = 0; while (1) { if (i == 20) { goto LOOPEND; } else { i++; a++; } if (i != a) { goto ERROR; } } LOOPEND: if (a != 20) { goto ERROR; } return (0); ERROR: return (-1); }
the_stack_data/97013200.c
// semmle-extractor-options: --edg --clang int x = 0; int* f(void) { int* x_addr = __builtin_addressof(x); return x_addr; }
the_stack_data/330822.c
#include <stdio.h> #include <stdlib.h> #define container_of(ptr, type, member) \ ((type *)((char *)(ptr) - (size_t)&(((type *)0)->member))) #define list_entry(ptr, type, member) \ container_of(ptr, type, member) #define hlist_for_each(pos, head) \ for (pos = (head)->first; pos; pos = pos->next) struct hlist_node; struct hlist_head { struct hlist_node *first; }; struct hlist_node { struct hlist_node *next, **prev; }; static inline void INIT_HLIST_HEAD(struct hlist_head *h) { h->first = NULL; } static inline int hlist_empty(struct hlist_head *h) { return !h->first; } static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) { if (h->first != NULL) { h->first->prev = &n->next; } n->next = h->first; n->prev = &h->first; h->first = n; } static inline void hlist_del(struct hlist_node *n) { struct hlist_node *next = n->next; struct hlist_node **prev = n->prev; *prev = next; if (next != NULL) { next->prev = prev; } } struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; }; struct order_node { struct hlist_node node; int val; int index; }; static int find(int num, int size, struct hlist_head *heads) { struct hlist_node *p; int hash = (num < 0 ? -num : num) % size; hlist_for_each(p, &heads[hash]) { struct order_node *on = list_entry(p, struct order_node, node); if (num == on->val) { return on->index; } } return -1; } static void node_add(int val, int index, int size, struct hlist_head *heads) { struct order_node *on = malloc(sizeof(*on)); on->val = val; on->index = index; int hash = (val < 0 ? -val : val) % size; hlist_add_head(&on->node, &heads[hash]); } static struct TreeNode *dfs(int *inorder, int in_lo, int in_hi, int *postorder, int post_lo, int post_hi, struct hlist_head *in_heads, int size) { if (in_lo > in_hi || post_lo > post_hi) { return NULL; } struct TreeNode *tn = malloc(sizeof(*tn)); tn->val = postorder[post_hi]; int index = find(postorder[post_hi], size, in_heads); tn->left = dfs(inorder, in_lo, index - 1, postorder, post_lo, post_lo + (index - 1 - in_lo), in_heads, size); tn->right = dfs(inorder, index + 1, in_hi, postorder, post_hi - (in_hi - index), post_hi - 1, in_heads, size); return tn; } static struct TreeNode *buildTree(int *inorder, int inorderSize, int *postorder, int postorderSize) { int i; struct hlist_head *in_heads = malloc(inorderSize * sizeof(*in_heads)); for (i = 0; i < inorderSize; i++) { INIT_HLIST_HEAD(&in_heads[i]); } for (i = 0; i < inorderSize; i++) { node_add(inorder[i], i, inorderSize, in_heads); } return dfs(inorder, 0, inorderSize - 1, postorder, 0, postorderSize - 1, in_heads, inorderSize); } static void dump(struct TreeNode *node) { if (node == NULL) { printf("# "); return; } printf("%d ", node->val); dump(node->left); dump(node->right); } int main(void) { //int postorder[] = { 1,2,3 }; //int postorder[] = { 2,1,3 }; //int postorder[] = { 1,3,2 }; //int postorder[] = { 2,3,1 }; int postorder[] = { 3,2,1 }; int inorder[] = { 1,2,3 }; int post_size = sizeof(postorder) / sizeof(*postorder); int in_size = sizeof(inorder) / sizeof(*inorder); struct TreeNode *root = buildTree(inorder, in_size, postorder, post_size); dump(root); printf("\n"); return 0; }
the_stack_data/7980.c
//Strassen's Algorithm for matrix multiplication /* In linear algebra, the Strassen algorithm, named after Volker Strassen, is an algorithm for matrix multiplication. It is faster than the standard matrix multiplication algorithm and is useful in practice for large matrices, but would be slower than the fastest known algorithms for extremely large matrices. */ /* AHED (Learn it as ‘Ahead’) Diagonal Last CR First CR Also, consider X as (Row +) and Y as (Column -) matrix ------*Step 1*--------- P1 = A P2= H P3= E P4= D P5= ( A + D ) * ( E + H ) ----------*Step 2*-------------- P1 = A P2= H P3= E P4= D P5= ( A + D ) * ( E + H ) P6= ( B – D ) * ( G + H) P7= ( A – C ) * ( E + F) ----------*Step 3*-------------- P1 = A * ( F – H) P2= H P3= E P4= D P5= ( A + D ) * ( E + H ) P6= ( B – D ) * ( G + H) P7= ( A – C ) * ( E + F) ----------*Step 4*-------------- P1= A * ( F – H ) P2= H * ( A + B ) P3= E * ( C + D ) P4= D P5= ( A + D ) * ( E + H ) P6= ( B – D ) * ( G + H) P7= ( A – C ) * ( E + F) */ #include<stdio.h> void main() { //int a, b, c, d , e, f, g; int FirstMatrix[2][2], SecondMatrix[2][2], ProductMatrix[2][2], i, j; //First matrix elements input: printf("Enter the 4 elements of first matrix: "); for(i = 0;i < 2; i++) { for(j = 0;j < 2; j++) { scanf("%d", &FirstMatrix[i][j]); } } //Second matrix elements input: printf("Enter the 4 elements of second matrix: "); for(i = 0; i < 2; i++) { for(j = 0;j < 2; j++) { scanf("%d", &SecondMatrix[i][j]); } } //As per the algorithm int a= (FirstMatrix[0][0] + FirstMatrix[1][1]) * (SecondMatrix[0][0] + SecondMatrix[1][1]); int b= (FirstMatrix[1][0] + FirstMatrix[1][1]) * SecondMatrix[0][0]; int c= FirstMatrix[0][0] * (SecondMatrix[0][1] - SecondMatrix[1][1]); int d= FirstMatrix[1][1] * (SecondMatrix[1][0] - SecondMatrix[0][0]); int e= (FirstMatrix[0][0] + FirstMatrix[0][1]) * SecondMatrix[1][1]; int f= (FirstMatrix[1][0] - FirstMatrix[0][0]) * (SecondMatrix[0][0]+SecondMatrix[0][1]); int g= (FirstMatrix[0][1] - FirstMatrix[1][1]) * (SecondMatrix[1][0]+SecondMatrix[1][1]); ProductMatrix[0][0] = a + d- e + g; ProductMatrix[0][1] = c + e; ProductMatrix[1][0] = b + d; ProductMatrix[1][1] = a - b + c + f; printf("\nAfter multiplication using Strassen's algorithm \n"); for(i = 0; i < 2 ; i++){ printf("\n"); for(j = 0;j < 2; j++){ printf("%d\t", ProductMatrix[i][j]); } } printf("\n"); } /* OUTPUT --------------------------------------------------- Enter the 4 elements of first matrix: 1 2 3 4 Enter the 4 elements of second matrix: 5 6 7 8 After multiplication using Strassen's algorithm 19 22 43 50 --------------------------------------------------- */
the_stack_data/598496.c
// Marco Ivaldi <[email protected]> #include <stdio.h> #include <string.h> #include <stdlib.h> #define STR_MAX 256 char* getName_bad() { char name[STR_MAX]; fillInName(name); // ruleid: raptor-ret-stack-address return name; } char* getName_good() { char *name = (char *)malloc(STR_MAX); fillInName(name); // ok: raptor-ret-stack-address return name; } char *findF(char *b) { char tmpbuf[1024]; char *p = tmpbuf; memcpy(tmpbuf, b, 1024); while (*p != '\0') { if (*p == 'F') // ruleid: raptor-ret-stack-address return p; p++; } return NULL; } void fillMem() { char a[2048]; memset(a, 'Z', sizeof(a)); } int recvStr(char *str) { char *fPtr = findF(str); fillMem(); if(fPtr == NULL) { printf("No F!"); } else { printf("F = %s", fPtr); } } int* f(void) { int local_auto; // ruleid: raptor-ret-stack-address return &local_auto; } int main() { printf("Hello, World!"); return 0; }
the_stack_data/118032.c
// RUN: %ucc -c -o %t %s f();
the_stack_data/97012188.c
// https://www.codewars.com/kata/highest-scoring-word/train/c // My solution #include <string.h> static int scoreWord(char* word) { int score = 0; for ( char* letter = word ; *letter ; letter++ ) { score += *letter - 'a' + 1; } return score; } char *highestScoringWord(const char *str) { char *copy = strdup( str ); char *token = strtok( copy, " " ); char *result = strdup( token ); // Malloc int highScore = scoreWord( result ); while( token != NULL ) { int newScore = scoreWord( token ); if ( newScore > highScore ) { free( result ); // Free result = strdup( token ); // Malloc highScore = newScore; } token = strtok( NULL, " " ); } free( copy ); return result; }
the_stack_data/10583.c
#include <stdio.h> int ara[101]; int main() { int n, m, l, r, i, count = 0; scanf("%d %d", &n, &m); while(n--) { /*for(i = 0; i <= m; i++) { ara[i] = 0; }*/ scanf("%d %d", &l, &r); for(i = l; l <= r; i++) { ara[i] = l; l++; } } for(i = 1; i <= m; i++) { if(ara[i] == 0) { count++; } } printf("%d\n", count); for(i = 1; i <= m; i++) { if(ara[i] == 0) { printf("%d ", i); } } return 0; }
the_stack_data/153267209.c
/* $OpenBSD: siglist.c,v 1.5 2009/11/27 19:47:45 guenther Exp $ */ /* * Copyright (c) 1983, 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. */ #include <sys/cdefs.h> #include <signal.h> const char *const _sys_siglist[NSIG] = { "Signal 0", "Hangup", /* SIGHUP */ "Interrupt", /* SIGINT */ "Quit", /* SIGQUIT */ "Illegal instruction", /* SIGILL */ "Trace/BPT trap", /* SIGTRAP */ "Abort trap", /* SIGABRT */ "EMT trap", /* SIGEMT */ "Floating point exception", /* SIGFPE */ "Killed", /* SIGKILL */ "Bus error", /* SIGBUS */ "Segmentation fault", /* SIGSEGV */ "Bad system call", /* SIGSYS */ "Broken pipe", /* SIGPIPE */ "Alarm clock", /* SIGALRM */ "Terminated", /* SIGTERM */ "Urgent I/O condition", /* SIGURG */ "Suspended (signal)", /* SIGSTOP */ "Suspended", /* SIGTSTP */ "Continued", /* SIGCONT */ "Child exited", /* SIGCHLD */ "Stopped (tty input)", /* SIGTTIN */ "Stopped (tty output)", /* SIGTTOU */ "I/O possible", /* SIGIO */ "Cputime limit exceeded", /* SIGXCPU */ "Filesize limit exceeded", /* SIGXFSZ */ "Virtual timer expired", /* SIGVTALRM */ "Profiling timer expired", /* SIGPROF */ "Window size changes", /* SIGWINCH */ "Information request", /* SIGINFO */ "User defined signal 1", /* SIGUSR1 */ "User defined signal 2", /* SIGUSR2 */ "Thread AST", /* SIGTHR */ };
the_stack_data/14199386.c
#include <malloc.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include "omp.h" #include <sys/time.h> double getusec_() { struct timeval time; gettimeofday(&time, NULL); return ((double)time.tv_sec * (double)1e6 + (double)time.tv_usec); } #define START_COUNT_TIME stamp = getusec_(); #define STOP_COUNT_TIME(_m) stamp = getusec_() - stamp;\ stamp = stamp/1e6;\ printf ("%s: %0.6f\n",(_m), stamp); // N and MIN must be powers of 2 long N; long MIN_SORT_SIZE; long MIN_MERGE_SIZE; int CUTOFF; #define T int void basicsort(long n, T data[n]); void basicmerge(long n, T left[n], T right[n], T result[n*2], long start, long length); void merge(long n, T left[n], T right[n], T result[n*2], long start, long length,int i) { if (length < MIN_MERGE_SIZE*2L || omp_in_final()) { // Base case basicmerge(n, left, right, result, start, length); } else { // Recursive decomposition #pragma omp task final(i == CUTOFF) merge(n, left, right, result, start, length/2,i+1); #pragma omp task final(i == CUTOFF) merge(n, left, right, result, start + length/2, length/2,i+1); } } void multisort(long n, T data[n], T tmp[n],int i) { //if(omp_in_final()) printf ("\na\n"); if (n >= MIN_SORT_SIZE*4L && !omp_in_final()) { // Recursive decomposition #pragma omp taskgroup { #pragma omp task final(i == CUTOFF) multisort(n/4L, &data[0], &tmp[0],i+1); #pragma omp task final(i == CUTOFF) multisort(n/4L, &data[n/4L], &tmp[n/4L],i+1); #pragma omp task final(i == CUTOFF) multisort(n/4L, &data[n/2L], &tmp[n/2L],i+1); #pragma omp task final(i == CUTOFF) multisort(n/4L, &data[3L*n/4L], &tmp[3L*n/4L],i+1); } #pragma omp taskgroup { #pragma omp task final(i == CUTOFF) merge(n/4L, &data[0], &data[n/4L], &tmp[0], 0, n/2L,i+1); #pragma omp task final(i == CUTOFF) merge(n/4L, &data[n/2L], &data[3L*n/4L], &tmp[n/2L], 0, n/2L,i+1); } #pragma omp task final(i >= CUTOFF) merge(n/2L, &tmp[0], &tmp[n/2L], &data[0], 0, n,i+1); } else { // Base case basicsort(n, data); } } static void initialize(long length, T data[length]) { long i; for (i = 0; i < length; i++) { if (i==0) { data[i] = rand(); } else { data[i] = ((data[i-1]+1) * i * 104723L) % N; } } } static void clear(long length, T data[length]) { long i; for (i = 0; i < length; i++) { data[i] = 0; } } void check_sorted(long n, T data[n]) { int unsorted=0; for (int i=1; i<n; i++) if (data[i-1] > data[i]) unsorted++; if (unsorted > 0) printf ("\nERROR: data is NOT properly sorted. There are %d unordered positions\n\n",unsorted); } int main(int argc, char **argv) { /* Defaults for command line arguments */ /* Important: all of them should be powers of two */ N = 32768 * 1024; MIN_SORT_SIZE = 1024; MIN_MERGE_SIZE = 1024; CUTOFF = 4; /* Process command-line arguments */ for (int i=1; i<argc; i++) { if (strcmp(argv[i], "-n")==0) { N = atol(argv[++i]) * 1024; } else if (strcmp(argv[i], "-s")==0) { MIN_SORT_SIZE = atol(argv[++i]); } else if (strcmp(argv[i], "-m")==0) { MIN_MERGE_SIZE = atol(argv[++i]); } #ifdef _OPENMP else if (strcmp(argv[i], "-c")==0) { CUTOFF = atoi(argv[++i]); } #endif else { #ifdef _OPENMP fprintf(stderr, "Usage: %s [-n vector_size -s MIN_SORT_SIZE -m MIN_MERGE_SIZE] -c CUTOFF\n", argv[0]); #else fprintf(stderr, "Usage: %s [-n vector_size -s MIN_SORT_SIZE -m MIN_MERGE_SIZE]\n", argv[0]); #endif fprintf(stderr, " -n to specify the size of the vector (in Kelements) to sort (default 32768)\n"); fprintf(stderr, " -s to specify the size of the vector (in elements) that breaks recursion in the sort phase (default 1024)\n"); fprintf(stderr, " -m to specify the size of the vector (in elements) that breaks recursion in the merge phase (default 1024)\n"); #ifdef _OPENMP fprintf(stderr, " -c to specify the cut off recursion level to stop task generation in OpenMP (default 16)\n"); #endif return EXIT_FAILURE; } } fprintf(stdout, "*****************************************************************************************\n"); fprintf(stdout, "Problem size (in number of elements): N=%ld, MIN_SORT_SIZE=%ld, MIN_MERGE_SIZE=%ld\n", N/1024, MIN_SORT_SIZE, MIN_MERGE_SIZE); #ifdef _OPENMP fprintf(stdout, "Cut-off level: CUTOFF=%d\n", CUTOFF); fprintf(stdout, "Number of threads in OpenMP: OMP_NUM_THREADS=%d\n", omp_get_max_threads()); #endif fprintf(stdout, "*****************************************************************************************\n"); T *data = malloc(N*sizeof(T)); T *tmp = malloc(N*sizeof(T)); double stamp; START_COUNT_TIME; initialize(N, data); clear(N, tmp); STOP_COUNT_TIME("Initialization time in seconds"); START_COUNT_TIME; #pragma omp parallel #pragma omp single multisort(N, data, tmp,0); STOP_COUNT_TIME("Multisort execution time"); START_COUNT_TIME; check_sorted (N, data); STOP_COUNT_TIME("Check sorted data execution time"); fprintf(stdout, "Multisort program finished\n"); fprintf(stdout, "*****************************************************************************************\n"); return 0; }
the_stack_data/86843.c
#include <stdio.h> int main() { int i = 0; int j = 0; printf("%d %d\n", ++ i, j ++); }
the_stack_data/29001.c
/** *********************************************************************************************************************** * Copyright (c) 2020, China Mobile Communications Group Co.,Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. * * @file drv_usart.c * * @brief This file implements usart driver for stm32 * * @revision * Date Author Notes * 2020-02-20 OneOS Team First Version *********************************************************************************************************************** */ #ifdef BSP_USING_ADC0 struct gd32_adc_info adc0_info = {"adc", ADC0}; OS_HAL_DEVICE_DEFINE("ADC_HandleTypeDef", "adc", adc0_info); #endif #ifdef BSP_USING_ADC1 struct gd32_adc_info adc1_info = {"adc1", ADC1}; OS_HAL_DEVICE_DEFINE("ADC_HandleTypeDef", "adc1", adc1_info); #endif
the_stack_data/31389173.c
#include <stdio.h> main() { printf("hello, world\z\n"); }
the_stack_data/28389.c
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <signal.h> #include <errno.h> #include <fcntl.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <string.h> #define MAX_NAME_LENGHT 256 #define BUF_SIZE 128 int main(int argc, char **argv) { int logicalSize, fileSize, bufSizeReal = BUF_SIZE, i; int sd, port, len, fd, ris; const int on = 1; struct sockaddr_in cliaddr, servaddr; struct hostent *clienthost; char fileName[MAX_NAME_LENGHT]; int result, count; char buf[BUF_SIZE]; //Controllo argomenti if (argc != 2) { printf("Error Usage : %s port \n", argv[0]); exit(1); } printf("NUMERO ARGC CONTROLLATO\n"); len = 0; while (argv[1][len] != '\0') { if (argv[1][len] < '0' || argv[1][len] > '9') { printf("Argument passed is not a integer"); exit(1); } len++; } printf("PORT CONTROLLATA\n"); port = atoi(argv[1]); if (port < 1024 || port > 65535) { printf("Error: incorrect number port "); exit(1); } printf("ARGOMENTI CONTROLLATI\n"); //inizializzo indirizzo server memset((char*) &servaddr, 0, sizeof(servaddr)); servaddr.sin_family = AF_INET; servaddr.sin_addr.s_addr = INADDR_ANY; servaddr.sin_port = htons(port); //creazione socket sd = socket(AF_INET, SOCK_DGRAM, 0); if (sd < 0) { perror("Error creating socket "); exit(1); } printf("Server: socket created, sd = %d\n", sd); //opzioni socket if (setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0) { perror("set opzions socket "); exit(1); } printf("Server: Socket Options setted ok\n"); // connessione socket if (bind(sd, (struct sockaddr*) &servaddr, sizeof(servaddr)) < 0) { perror("bind socket "); exit(1); } printf("Server: bind socket ok\n"); //INZIO BODY while (1) { //ricevo nomeFile len = sizeof(struct sockaddr_in); if (recvfrom(sd, &fileName, sizeof(fileName), 0, (struct sockaddr*) &cliaddr, &len) < 0) { perror("recvfrom"); continue; } printf("Operazione richiesta sul file %s \n", fileName); clienthost = gethostbyaddr((char*) &cliaddr.sin_addr,sizeof(cliaddr.sin_addr), AF_INET); if (clienthost == NULL) printf("client host information not found\n"); else printf("Operation required from: %s %i\n", clienthost->h_name, (unsigned) ntohs(cliaddr.sin_port)); //trovare lunghezza della parola piu lunga fd = open(fileName, O_RDONLY); if (fd < 0) { printf("Impossible open %s\n", fileName); result = -1; } else { fileSize = lseek(fd, 0, SEEK_END); lseek(fd, 0, SEEK_SET); if (fileSize < bufSizeReal) { bufSizeReal = fileSize; } count=0; result=0; while (read(fd, &buf, bufSizeReal * sizeof(char)) > 0) { logicalSize = sizeof(buf) / sizeof(buf[0]); for (i = 0; i < logicalSize; i++) { if (buf[i] == ' ' || buf[i] == '\n' || buf[i] == '\t') { if (count > result) { result = count; } count = 0; } else { count++; } } // Flush array memset(buf, 0, bufSizeReal * (sizeof buf[0])); } } close(fd); printf("RESULT: %d \n ", result); result = htonl(result); if (sendto(sd, &result, sizeof(result), 0, (struct sockaddr*) &cliaddr, len) < 0) { perror("ERROR sendto"); continue; } } return EXIT_SUCCESS; }
the_stack_data/95449630.c
// RUN: c-index-test -index-file %s | FileCheck %s // rdar://10941790 // Check that we don't get stack overflow trying to index a huge number of // logical operators. // UBSan increases stack usage. // REQUIRES: not_ubsan // CHECK: [indexDeclaration]: kind: function | name: foo int foo(int x) { return x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x && x; }
the_stack_data/76699386.c
int factorial( int n) { if(n==1)return 1; return n*factorial(n-1); } int main() { int facto; facto = factorial(4); return 0; }
the_stack_data/120638.c
extern int printf(const char *, ...); void foo(void) { printf("Hello from %s!\n", __FUNCTION__); }
the_stack_data/184519204.c
// RUN: %clang_cc1 %s -debug-info-kind=line-tables-only -S -emit-llvm -o - | FileCheck %s // RUN: %clang_cc1 %s -debug-info-kind=line-directives-only -S -emit-llvm -o - | FileCheck %s // Checks that clang with "-gline-tables-only" or "-gline-directives-only" emits metadata for // compile unit, subprogram and file. int main(void) { // CHECK: ret i32 0, !dbg return 0; } // CHECK: !llvm.dbg.cu = !{!0} // CHECK: !DICompileUnit( // CHECK: !DISubprogram( // CHECK: !DIFile(
the_stack_data/680971.c
/* ** Copyright 2001, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ /* * Copyright (c) 2008 Travis Geiselbrecht * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files * (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, * publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "string.h" #include "sys/types.h" void * memmove(void *dest, void const *src, size_t count) { char *d = (char *)dest; const char *s = (const char *)src; int len; if (count == 0 || dest == src) return dest; if (d < s) { for (len = count; len > 0; len--) *d++ = *s++; } else { for (len = count; len > 0; len--) *--d = *--s; } return dest; }
the_stack_data/25138313.c
#include <stdio.h> int main() { int n = 5; for(int i = 1; i <= n; i++) { for(int j = n; j >= 1; j--) { if(i >= j) { if(j % 2 == 0) printf("* "); else printf("%d ", j); } else printf(" "); } printf("\n"); } return 0; }
the_stack_data/54486.c
/* Generate assembler source containing symbol information * * Copyright 2002 by Kai Germaschewski * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * * Usage: nm -n vmlinux | scripts/kallsyms [--all-symbols] > symbols.S * * Table compression uses all the unused char codes on the symbols and * maps these to the most used substrings (tokens). For instance, it might * map char code 0xF7 to represent "write_" and then in every symbol where * "write_" appears it can be replaced by 0xF7, saving 5 bytes. * The used codes themselves are also placed in the table so that the * decompresion can work without "special cases". * Applied to kernel symbols, this usually produces a compression ratio * of about 50%. * */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <limits.h> #ifndef ARRAY_SIZE #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) #endif #define KSYM_NAME_LEN 128 struct sym_entry { unsigned long long addr; unsigned int len; unsigned int start_pos; unsigned char *sym; unsigned int percpu_absolute; }; struct addr_range { const char *start_sym, *end_sym; unsigned long long start, end; }; static unsigned long long _text; static unsigned long long relative_base; static struct addr_range text_ranges[] = { { "_stext", "_etext" }, { "_sinittext", "_einittext" }, { "_stext_l1", "_etext_l1" }, /* Blackfin on-chip L1 inst SRAM */ { "_stext_l2", "_etext_l2" }, /* Blackfin on-chip L2 SRAM */ }; #define text_range_text (&text_ranges[0]) #define text_range_inittext (&text_ranges[1]) static struct addr_range percpu_range = { "__per_cpu_start", "__per_cpu_end", -1ULL, 0 }; static struct sym_entry *table; static unsigned int table_size, table_cnt; static int all_symbols = 0; static int absolute_percpu = 0; static char symbol_prefix_char = '\0'; static int base_relative = 0; int token_profit[0x10000]; /* the table that holds the result of the compression */ unsigned char best_table[256][2]; unsigned char best_table_len[256]; static void usage(void) { fprintf(stderr, "Usage: kallsyms [--all-symbols] " "[--symbol-prefix=<prefix char>] " "[--base-relative] < in.map > out.S\n"); exit(1); } /* * This ignores the intensely annoying "mapping symbols" found * in ARM ELF files: $a, $t and $d. */ static inline int is_arm_mapping_symbol(const char *str) { return str[0] == '$' && strchr("axtd", str[1]) && (str[2] == '\0' || str[2] == '.'); } static int check_symbol_range(const char *sym, unsigned long long addr, struct addr_range *ranges, int entries) { size_t i; struct addr_range *ar; for (i = 0; i < entries; ++i) { ar = &ranges[i]; if (strcmp(sym, ar->start_sym) == 0) { ar->start = addr; return 0; } else if (strcmp(sym, ar->end_sym) == 0) { ar->end = addr; return 0; } } return 1; } static int read_symbol(FILE *in, struct sym_entry *s) { char str[500]; char *sym, stype; int rc; rc = fscanf(in, "%llx %c %499s\n", &s->addr, &stype, str); if (rc != 3) { if (rc != EOF && fgets(str, 500, in) == NULL) fprintf(stderr, "Read error or end of file.\n"); return -1; } if (strlen(str) > KSYM_NAME_LEN) { fprintf(stderr, "Symbol %s too long for kallsyms (%zu vs %d).\n" "Please increase KSYM_NAME_LEN both in kernel and kallsyms.c\n", str, strlen(str), KSYM_NAME_LEN); return -1; } sym = str; /* skip prefix char */ if (symbol_prefix_char && str[0] == symbol_prefix_char) sym++; /* Ignore most absolute/undefined (?) symbols. */ if (strcmp(sym, "_text") == 0) _text = s->addr; else if (check_symbol_range(sym, s->addr, text_ranges, ARRAY_SIZE(text_ranges)) == 0) /* nothing to do */; else if (toupper(stype) == 'A') { /* Keep these useful absolute symbols */ if (strcmp(sym, "__kernel_syscall_via_break") && strcmp(sym, "__kernel_syscall_via_epc") && strcmp(sym, "__kernel_sigtramp") && strcmp(sym, "__gp")) return -1; } else if (toupper(stype) == 'U' || is_arm_mapping_symbol(sym)) return -1; /* exclude also MIPS ELF local symbols ($L123 instead of .L123) */ else if (str[0] == '$') return -1; /* exclude debugging symbols */ else if (stype == 'N' || stype == 'n') return -1; /* include the type field in the symbol name, so that it gets * compressed together */ s->len = strlen(str) + 1; s->sym = malloc(s->len + 1); if (!s->sym) { fprintf(stderr, "kallsyms failure: " "unable to allocate required amount of memory\n"); exit(EXIT_FAILURE); } strcpy((char *)s->sym + 1, str); s->sym[0] = stype; s->percpu_absolute = 0; /* Record if we've found __per_cpu_start/end. */ check_symbol_range(sym, s->addr, &percpu_range, 1); return 0; } static int symbol_in_range(struct sym_entry *s, struct addr_range *ranges, int entries) { size_t i; struct addr_range *ar; for (i = 0; i < entries; ++i) { ar = &ranges[i]; if (s->addr >= ar->start && s->addr <= ar->end) return 1; } return 0; } static int symbol_valid(struct sym_entry *s) { /* Symbols which vary between passes. Passes 1 and 2 must have * identical symbol lists. The kallsyms_* symbols below are only added * after pass 1, they would be included in pass 2 when --all-symbols is * specified so exclude them to get a stable symbol list. */ static char *special_symbols[] = { "kallsyms_addresses", "kallsyms_offsets", "kallsyms_relative_base", "kallsyms_num_syms", "kallsyms_names", "kallsyms_markers", "kallsyms_token_table", "kallsyms_token_index", /* Exclude linker generated symbols which vary between passes */ "_SDA_BASE_", /* ppc */ "_SDA2_BASE_", /* ppc */ NULL }; static char *special_prefixes[] = { "__crc_", /* modversions */ "__efistub_", /* arm64 EFI stub namespace */ NULL }; static char *special_suffixes[] = { "_veneer", /* arm */ "_from_arm", /* arm */ "_from_thumb", /* arm */ NULL }; int i; char *sym_name = (char *)s->sym + 1; /* skip prefix char */ if (symbol_prefix_char && *sym_name == symbol_prefix_char) sym_name++; /* if --all-symbols is not specified, then symbols outside the text * and inittext sections are discarded */ if (!all_symbols) { if (symbol_in_range(s, text_ranges, ARRAY_SIZE(text_ranges)) == 0) return 0; /* Corner case. Discard any symbols with the same value as * _etext _einittext; they can move between pass 1 and 2 when * the kallsyms data are added. If these symbols move then * they may get dropped in pass 2, which breaks the kallsyms * rules. */ if ((s->addr == text_range_text->end && strcmp(sym_name, text_range_text->end_sym)) || (s->addr == text_range_inittext->end && strcmp(sym_name, text_range_inittext->end_sym))) return 0; } /* Exclude symbols which vary between passes. */ for (i = 0; special_symbols[i]; i++) if (strcmp(sym_name, special_symbols[i]) == 0) return 0; for (i = 0; special_prefixes[i]; i++) { int l = strlen(special_prefixes[i]); if (l <= strlen(sym_name) && strncmp(sym_name, special_prefixes[i], l) == 0) return 0; } for (i = 0; special_suffixes[i]; i++) { int l = strlen(sym_name) - strlen(special_suffixes[i]); if (l >= 0 && strcmp(sym_name + l, special_suffixes[i]) == 0) return 0; } return 1; } static void read_map(FILE *in) { while (!feof(in)) { if (table_cnt >= table_size) { table_size += 10000; table = realloc(table, sizeof(*table) * table_size); if (!table) { fprintf(stderr, "out of memory\n"); exit (1); } } if (read_symbol(in, &table[table_cnt]) == 0) { table[table_cnt].start_pos = table_cnt; table_cnt++; } } } static void output_label(char *label) { if (symbol_prefix_char) printf(".globl %c%s\n", symbol_prefix_char, label); else printf(".globl %s\n", label); printf("\tALGN\n"); if (symbol_prefix_char) printf("%c%s:\n", symbol_prefix_char, label); else printf("%s:\n", label); } /* uncompress a compressed symbol. When this function is called, the best table * might still be compressed itself, so the function needs to be recursive */ static int expand_symbol(unsigned char *data, int len, char *result) { int c, rlen, total=0; while (len) { c = *data; /* if the table holds a single char that is the same as the one * we are looking for, then end the search */ if (best_table[c][0]==c && best_table_len[c]==1) { *result++ = c; total++; } else { /* if not, recurse and expand */ rlen = expand_symbol(best_table[c], best_table_len[c], result); total += rlen; result += rlen; } data++; len--; } *result=0; return total; } static int symbol_absolute(struct sym_entry *s) { return s->percpu_absolute; } static void write_src(void) { unsigned int i, k, off; unsigned int best_idx[256]; unsigned int *markers; char buf[KSYM_NAME_LEN]; printf("#include <asm/types.h>\n"); printf("#if BITS_PER_LONG == 64\n"); printf("#define PTR .quad\n"); printf("#define ALGN .align 8\n"); printf("#else\n"); printf("#define PTR .long\n"); printf("#define ALGN .align 4\n"); printf("#endif\n"); printf("\t.section .rodata, \"a\"\n"); /* Provide proper symbols relocatability by their relativeness * to a fixed anchor point in the runtime image, either '_text' * for absolute address tables, in which case the linker will * emit the final addresses at build time. Otherwise, use the * offset relative to the lowest value encountered of all relative * symbols, and emit non-relocatable fixed offsets that will be fixed * up at runtime. * * The symbol names cannot be used to construct normal symbol * references as the list of symbols contains symbols that are * declared static and are private to their .o files. This prevents * .tmp_kallsyms.o or any other object from referencing them. */ if (!base_relative) output_label("kallsyms_addresses"); else output_label("kallsyms_offsets"); for (i = 0; i < table_cnt; i++) { if (base_relative) { long long offset; int overflow; if (!absolute_percpu) { offset = table[i].addr - relative_base; overflow = (offset < 0 || offset > UINT_MAX); } else if (symbol_absolute(&table[i])) { offset = table[i].addr; overflow = (offset < 0 || offset > INT_MAX); } else { offset = relative_base - table[i].addr - 1; overflow = (offset < INT_MIN || offset >= 0); } if (overflow) { fprintf(stderr, "kallsyms failure: " "%s symbol value %#llx out of range in relative mode\n", symbol_absolute(&table[i]) ? "absolute" : "relative", table[i].addr); exit(EXIT_FAILURE); } printf("\t.long\t%#x\n", (int)offset); } else if (!symbol_absolute(&table[i])) { if (_text <= table[i].addr) printf("\tPTR\t_text + %#llx\n", table[i].addr - _text); else printf("\tPTR\t_text - %#llx\n", _text - table[i].addr); } else { printf("\tPTR\t%#llx\n", table[i].addr); } } printf("\n"); if (base_relative) { output_label("kallsyms_relative_base"); printf("\tPTR\t_text - %#llx\n", _text - relative_base); printf("\n"); } output_label("kallsyms_num_syms"); printf("\tPTR\t%d\n", table_cnt); printf("\n"); /* table of offset markers, that give the offset in the compressed stream * every 256 symbols */ markers = malloc(sizeof(unsigned int) * ((table_cnt + 255) / 256)); if (!markers) { fprintf(stderr, "kallsyms failure: " "unable to allocate required memory\n"); exit(EXIT_FAILURE); } output_label("kallsyms_names"); off = 0; for (i = 0; i < table_cnt; i++) { if ((i & 0xFF) == 0) markers[i >> 8] = off; printf("\t.byte 0x%02x", table[i].len); for (k = 0; k < table[i].len; k++) printf(", 0x%02x", table[i].sym[k]); printf("\n"); off += table[i].len + 1; } printf("\n"); output_label("kallsyms_markers"); for (i = 0; i < ((table_cnt + 255) >> 8); i++) printf("\tPTR\t%d\n", markers[i]); printf("\n"); free(markers); output_label("kallsyms_token_table"); off = 0; for (i = 0; i < 256; i++) { best_idx[i] = off; expand_symbol(best_table[i], best_table_len[i], buf); printf("\t.asciz\t\"%s\"\n", buf); off += strlen(buf) + 1; } printf("\n"); output_label("kallsyms_token_index"); for (i = 0; i < 256; i++) printf("\t.short\t%d\n", best_idx[i]); printf("\n"); } /* table lookup compression functions */ /* count all the possible tokens in a symbol */ static void learn_symbol(unsigned char *symbol, int len) { int i; for (i = 0; i < len - 1; i++) token_profit[ symbol[i] + (symbol[i + 1] << 8) ]++; } /* decrease the count for all the possible tokens in a symbol */ static void forget_symbol(unsigned char *symbol, int len) { int i; for (i = 0; i < len - 1; i++) token_profit[ symbol[i] + (symbol[i + 1] << 8) ]--; } /* remove all the invalid symbols from the table and do the initial token count */ static void build_initial_tok_table(void) { unsigned int i, pos; pos = 0; for (i = 0; i < table_cnt; i++) { if ( symbol_valid(&table[i]) ) { if (pos != i) table[pos] = table[i]; learn_symbol(table[pos].sym, table[pos].len); pos++; } } table_cnt = pos; } static void *find_token(unsigned char *str, int len, unsigned char *token) { int i; for (i = 0; i < len - 1; i++) { if (str[i] == token[0] && str[i+1] == token[1]) return &str[i]; } return NULL; } /* replace a given token in all the valid symbols. Use the sampled symbols * to update the counts */ static void compress_symbols(unsigned char *str, int idx) { unsigned int i, len, size; unsigned char *p1, *p2; for (i = 0; i < table_cnt; i++) { len = table[i].len; p1 = table[i].sym; /* find the token on the symbol */ p2 = find_token(p1, len, str); if (!p2) continue; /* decrease the counts for this symbol's tokens */ forget_symbol(table[i].sym, len); size = len; do { *p2 = idx; p2++; size -= (p2 - p1); memmove(p2, p2 + 1, size); p1 = p2; len--; if (size < 2) break; /* find the token on the symbol */ p2 = find_token(p1, size, str); } while (p2); table[i].len = len; /* increase the counts for this symbol's new tokens */ learn_symbol(table[i].sym, len); } } /* search the token with the maximum profit */ static int find_best_token(void) { int i, best, bestprofit; bestprofit=-10000; best = 0; for (i = 0; i < 0x10000; i++) { if (token_profit[i] > bestprofit) { best = i; bestprofit = token_profit[i]; } } return best; } /* this is the core of the algorithm: calculate the "best" table */ static void optimize_result(void) { int i, best; /* using the '\0' symbol last allows compress_symbols to use standard * fast string functions */ for (i = 255; i >= 0; i--) { /* if this table slot is empty (it is not used by an actual * original char code */ if (!best_table_len[i]) { /* find the token with the breates profit value */ best = find_best_token(); if (token_profit[best] == 0) break; /* place it in the "best" table */ best_table_len[i] = 2; best_table[i][0] = best & 0xFF; best_table[i][1] = (best >> 8) & 0xFF; /* replace this token in all the valid symbols */ compress_symbols(best_table[i], i); } } } /* start by placing the symbols that are actually used on the table */ static void insert_real_symbols_in_table(void) { unsigned int i, j, c; memset(best_table, 0, sizeof(best_table)); memset(best_table_len, 0, sizeof(best_table_len)); for (i = 0; i < table_cnt; i++) { for (j = 0; j < table[i].len; j++) { c = table[i].sym[j]; best_table[c][0]=c; best_table_len[c]=1; } } } static void optimize_token_table(void) { build_initial_tok_table(); insert_real_symbols_in_table(); /* When valid symbol is not registered, exit to error */ if (!table_cnt) { fprintf(stderr, "No valid symbol.\n"); exit(1); } optimize_result(); } /* guess for "linker script provide" symbol */ static int may_be_linker_script_provide_symbol(const struct sym_entry *se) { const char *symbol = (char *)se->sym + 1; int len = se->len - 1; if (len < 8) return 0; if (symbol[0] != '_' || symbol[1] != '_') return 0; /* __start_XXXXX */ if (!memcmp(symbol + 2, "start_", 6)) return 1; /* __stop_XXXXX */ if (!memcmp(symbol + 2, "stop_", 5)) return 1; /* __end_XXXXX */ if (!memcmp(symbol + 2, "end_", 4)) return 1; /* __XXXXX_start */ if (!memcmp(symbol + len - 6, "_start", 6)) return 1; /* __XXXXX_end */ if (!memcmp(symbol + len - 4, "_end", 4)) return 1; return 0; } static int prefix_underscores_count(const char *str) { const char *tail = str; while (*tail == '_') tail++; return tail - str; } static int compare_symbols(const void *a, const void *b) { const struct sym_entry *sa; const struct sym_entry *sb; int wa, wb; sa = a; sb = b; /* sort by address first */ if (sa->addr > sb->addr) return 1; if (sa->addr < sb->addr) return -1; /* sort by "weakness" type */ wa = (sa->sym[0] == 'w') || (sa->sym[0] == 'W'); wb = (sb->sym[0] == 'w') || (sb->sym[0] == 'W'); if (wa != wb) return wa - wb; /* sort by "linker script provide" type */ wa = may_be_linker_script_provide_symbol(sa); wb = may_be_linker_script_provide_symbol(sb); if (wa != wb) return wa - wb; /* sort by the number of prefix underscores */ wa = prefix_underscores_count((const char *)sa->sym + 1); wb = prefix_underscores_count((const char *)sb->sym + 1); if (wa != wb) return wa - wb; /* sort by initial order, so that other symbols are left undisturbed */ return sa->start_pos - sb->start_pos; } static void sort_symbols(void) { qsort(table, table_cnt, sizeof(struct sym_entry), compare_symbols); } static void make_percpus_absolute(void) { unsigned int i; for (i = 0; i < table_cnt; i++) if (symbol_in_range(&table[i], &percpu_range, 1)) { /* * Keep the 'A' override for percpu symbols to * ensure consistent behavior compared to older * versions of this tool. */ table[i].sym[0] = 'A'; table[i].percpu_absolute = 1; } } /* find the minimum non-absolute symbol address */ static void record_relative_base(void) { unsigned int i; relative_base = -1ULL; for (i = 0; i < table_cnt; i++) if (!symbol_absolute(&table[i]) && table[i].addr < relative_base) relative_base = table[i].addr; } int main(int argc, char **argv) { if (argc >= 2) { int i; for (i = 1; i < argc; i++) { if(strcmp(argv[i], "--all-symbols") == 0) all_symbols = 1; else if (strcmp(argv[i], "--absolute-percpu") == 0) absolute_percpu = 1; else if (strncmp(argv[i], "--symbol-prefix=", 16) == 0) { char *p = &argv[i][16]; /* skip quote */ if ((*p == '"' && *(p+2) == '"') || (*p == '\'' && *(p+2) == '\'')) p++; symbol_prefix_char = *p; } else if (strcmp(argv[i], "--base-relative") == 0) base_relative = 1; else usage(); } } else if (argc != 1) usage(); read_map(stdin); if (absolute_percpu) make_percpus_absolute(); if (base_relative) record_relative_base(); sort_symbols(); optimize_token_table(); write_src(); return 0; }
the_stack_data/1104628.c
#include "stdlib.h" int atoi(const char *s) { int result=0, sign=1; if (*s == -1) { sign = -1; s++; } while (*s >= '0' && *s <= '9') result = result*10 + (*(s++)-'0'); return result*sign; }
the_stack_data/929854.c
/* Testbed, no change expected in this file */ int toplevel_fnc(void); int main(int argc, char *argv[]) { return toplevel_fnc(); }
the_stack_data/45449892.c
#include<stdio.h> main(){ int num1, num2, temp; printf("Enter first number: "); scanf("%d", &num1); printf("\nEnter second number: "); scanf("%d", &num2); printf("\n\n\nValue of first number before swapping: %4d", num1); printf("\nValue of second number before swapping: %3d", num2); temp = num1; num1 = num2; num2 = temp; printf("\n\nValue of first number after swapping: %5d", num1); printf("\nValue of second number after swapping: %4d", num2); }
the_stack_data/93686.c
/* This file is part of ToaruOS and is released under the terms * of the NCSA / University of Illinois License - see LICENSE.md * Copyright (C) 2013 Kevin Lange */ #include <stdio.h> int main(int argc, char ** argv) { unsigned int x = 0; unsigned int nulls = 0; for (x = 0; 1; ++x) { if (!argv[x]) { ++nulls; if (nulls == 2) { break; } continue; } if (nulls == 1) { printf("%s\n", argv[x]); } } }
the_stack_data/72048.c
/******************** (C) COPYRIGHT 2010 STMicroelectronics ******************** * File Name : otgd_fs_pcd.c * Author : MCD Application Team * Version : V3.2.1 * Date : 07/05/2010 * Description : Peripheral Device Interface low layer. ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ #ifdef STM32F10X_CL #include "usb_lib.h" #include "otgd_fs_cal.h" #include "otgd_fs_pcd.h" USB_OTG_PCD_DEV USB_OTG_PCD_dev; extern USB_OTG_CORE_REGS USB_OTG_FS_regs; /******************************************************************************* * Function Name : PCD_Init * Description : Initialize the USB Device portion of the driver. * Input : None * Output : None * Return : None *******************************************************************************/ void PCD_Init(void) { uint32_t i = 0; USB_OTG_EP *ep; /**** SOFTWARE INIT *****/ ep = &USB_OTG_PCD_dev.ep0; /* Init ep structure */ ep->num = 0; ep->tx_fifo_num = 0; /* Control until ep is actvated */ ep->type = EP_TYPE_CTRL; ep->maxpacket = MAX_PACKET_SIZE; ep->xfer_buff = 0; ep->xfer_len = 0; for (i = 1; i < NUM_TX_FIFOS ; i++) { ep = &USB_OTG_PCD_dev.in_ep[i-1]; /* Init ep structure */ ep->is_in = 1; ep->num = i; ep->tx_fifo_num = i; /* Control until ep is actvated */ ep->type = EP_TYPE_CTRL; ep->maxpacket = MAX_PACKET_SIZE; ep->xfer_buff = 0; ep->xfer_len = 0; } for (i = 1; i < NUM_TX_FIFOS; i++) { ep = &USB_OTG_PCD_dev.out_ep[i-1]; /* Init ep structure */ ep->is_in = 0; ep->num = i; ep->tx_fifo_num = i; /* Control until ep is activated */ ep->type = EP_TYPE_CTRL; ep->maxpacket = MAX_PACKET_SIZE; ep->xfer_buff = 0; ep->xfer_len = 0; } USB_OTG_PCD_dev.ep0.maxpacket = MAX_EP0_SIZE; USB_OTG_PCD_dev.ep0.type = EP_TYPE_CTRL; /**** HARDWARE INIT *****/ /* Set the OTG_USB base registers address */ OTGD_FS_SetAddress(USB_OTG_FS_BASE_ADDR); /* Disable all global interrupts */ OTGD_FS_DisableGlobalInt(); /*Init the Core */ OTGD_FS_CoreInit(); /* Init Device mode*/ OTGD_FS_CoreInitDev(); } /******************************************************************************* * Function Name : PCD_EP_Open * Description : Configure an Endpoint * Input : None * Output : None * Return : status *******************************************************************************/ uint32_t PCD_EP_Open(EP_DESCRIPTOR *epdesc) { USB_OTG_EP *ep; if ((0x80 & epdesc->bEndpointAddress) != 0) { ep = PCD_GetInEP(epdesc->bEndpointAddress & 0x7F); ep->is_in = 1; } else { ep = PCD_GetOutEP(epdesc->bEndpointAddress & 0x7F); ep->is_in = 0; } ep->num = epdesc->bEndpointAddress & 0x7F; ep->maxpacket = epdesc->wMaxPacketSize; ep->type = epdesc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; if (ep->is_in) { /* Assign a Tx FIFO */ ep->tx_fifo_num = ep->num; } OTGD_FS_EPActivate(ep ); return 0; } /******************************************************************************* * Function Name : PCD_EP_Close * Description : Called when an EP is disabled * Input : Endpoint address. * Output : None * Return : status *******************************************************************************/ uint32_t PCD_EP_Close(uint8_t ep_addr) { USB_OTG_EP *ep; if ((0x80 & ep_addr) != 0) { ep = PCD_GetInEP(ep_addr & 0x7F); } else { ep = PCD_GetOutEP(ep_addr & 0x7F); } ep->num = ep_addr & 0x7F; ep->is_in = (0x80 & ep_addr) != 0; OTGD_FS_EPDeactivate(ep ); return 0; } /******************************************************************************* * Function Name : PCD_EP_Read * Description : Read data from Fifo * Input : Endpoint address. * Output : None * Return : status *******************************************************************************/ uint32_t PCD_EP_Read (uint8_t ep_addr, uint8_t *pbuf, uint32_t buf_len) { USB_OTG_EP *ep; uint32_t i = 0; ep = PCD_GetOutEP(ep_addr & 0x7F); /* copy received data into application buffer */ for (i = 0 ; i < buf_len ; i++) { pbuf[i] = ep->xfer_buff[i]; } /*setup and start the Xfer */ ep->xfer_buff = pbuf; ep->xfer_len = buf_len; ep->xfer_count = 0; ep->is_in = 0; ep->num = ep_addr & 0x7F; if ( ep->num == 0 ) { OTGD_FS_EP0StartXfer(ep); } else { OTGD_FS_EPStartXfer( ep ); } return 0; } /******************************************************************************* * Function Name : USBF_EP_Write * Description : Read data from Fifo * Input : ep * Output : None * Return : status *******************************************************************************/ uint32_t PCD_EP_Write (uint8_t ep_addr, uint8_t *pbuf, uint32_t buf_len) { USB_OTG_EP *ep; ep = PCD_GetInEP(ep_addr & 0x7f); /* assign data to EP structure buffer */ ep->xfer_buff = pbuf; /* Setup and start the Transfer */ ep->xfer_count = 0; ep->xfer_len = buf_len; ep->is_in = 1; ep->num = ep_addr & 0x7F; if ( ep->num == 0 ) { OTGD_FS_EP0StartXfer(ep); } else { OTGD_FS_EPStartXfer( ep ); } return 0; } /******************************************************************************* * Function Name : PCD_EP_Stall * Description : Stall an endpoint. * Input : Endpoint Address. * Output : None * Return : status *******************************************************************************/ uint32_t PCD_EP_Stall (uint8_t ep_addr) { USB_OTG_EP *ep; if ((0x80 & ep_addr) != 0) { ep = PCD_GetInEP(ep_addr & 0x7F); } else { ep = PCD_GetOutEP(ep_addr & 0x7F); } ep->num = ep_addr & 0x7F; ep->is_in = ((ep_addr & 0x80) == 0x80) ? 1 : 0; OTGD_FS_EPSetStall(ep); return (0); } /******************************************************************************* * Function Name : PCD_EP_ClrStall * Description : Clear stall condition on endpoints. * Input : Endpoint Address. * Output : None * Return : status *******************************************************************************/ uint32_t PCD_EP_ClrStall (uint8_t ep_addr) { USB_OTG_EP *ep; if ((0x80 & ep_addr) != 0) { ep = PCD_GetInEP(ep_addr & 0x7F); } else { ep = PCD_GetOutEP(ep_addr & 0x7F); } ep->num = ep_addr & 0x7F; ep->is_in = ((ep_addr & 0x80) == 0x80) ? 1 : 0; OTGD_FS_EPClearStall(ep); return (0); } /******************************************************************************* * Function Name : USBF_FCD_EP_Flush() * Description : This Function flushes the buffer. * Input : Endpoint Address. * Output : None * Return : status *******************************************************************************/ uint32_t PCD_EP_Flush (uint8_t ep_addr) { uint8_t is_out = 0; uint8_t ep_nbr = 0; ep_nbr = ep_addr & 0x7F; is_out = ((ep_addr & 0x80) == 0x80) ? 0 : 1; if (is_out == 0) { OTGD_FS_FlushTxFifo(ep_nbr); } else { OTGD_FS_FlushRxFifo(); } PCD_EP_ClrStall(ep_addr); return (0); } /******************************************************************************* * Function Name : PCD_EP_SetAddress * Description : This Function set USB device address * Input : The new device Address to be set. * Output : None * Return : status *******************************************************************************/ void PCD_EP_SetAddress (uint8_t address) { USB_OTG_DCFG_TypeDef dcfg; dcfg.d32 = 0; dcfg.b.devaddr = address; USB_OTG_MODIFY_REG32( &USB_OTG_FS_regs.DEV->DCFG, 0, dcfg.d32); } /******************************************************************************* * Function Name : PCD_GetInEP * Description : This function returns pointer to IN EP struct with number ep_num * Input : Endpoint Number. * Output : None * Return : status *******************************************************************************/ USB_OTG_EP* PCD_GetInEP(uint32_t ep_num) { if (ep_num == 0) { return &USB_OTG_PCD_dev.ep0; } else { return &USB_OTG_PCD_dev.in_ep[ep_num - 1]; } } /******************************************************************************* * Function Name : PCD_GetOutEP * Description : returns pointer to OUT EP struct with number ep_num * Input : Endpoint Number. * Output : None * Return : USBF_EP *******************************************************************************/ USB_OTG_EP* PCD_GetOutEP(uint32_t ep_num) { if (ep_num == 0) { return &USB_OTG_PCD_dev.ep0; } else { return &USB_OTG_PCD_dev.out_ep[ep_num - 1]; } } /******************************************************************************* * Function Name : PCD_DevConnect * Description : Connect device * Input : None * Output : None * Return : status *******************************************************************************/ void PCD_DevConnect(void) { USB_OTG_DCTL_TypeDef dctl; dctl.d32 = 0; dctl.d32 = USB_OTG_READ_REG32(&USB_OTG_FS_regs.DEV->DCTL); /* Connect device */ dctl.b.sftdiscon = 0; USB_OTG_WRITE_REG32(&USB_OTG_FS_regs.DEV->DCTL, dctl.d32); mDELAY(25); } /******************************************************************************* * Function Name : PCD_DevDisconnect * Description : Disconnect device * Input : None * Output : None * Return : status *******************************************************************************/ void PCD_DevDisconnect (void) { USB_OTG_DCTL_TypeDef dctl; dctl.d32 = 0; dctl.d32 = USB_OTG_READ_REG32(&USB_OTG_FS_regs.DEV->DCTL); /* Disconnect device for 20ms */ dctl.b.sftdiscon = 1; USB_OTG_WRITE_REG32(&USB_OTG_FS_regs.DEV->DCTL, dctl.d32); mDELAY(25); } /******************************************************************************* * Function Name : PCD_EP0_OutStart * Description : Configures EPO to receive SETUP packets. * Input : None * Output : None * Return : None *******************************************************************************/ void PCD_EP0_OutStart(void) { USB_OTG_DOEPTSIZ0_TypeDef doeptsize0; doeptsize0.d32 = 0; doeptsize0.b.supcnt = 3; doeptsize0.b.pktcnt = 1; doeptsize0.b.xfersize = 8 * 3; USB_OTG_WRITE_REG32( &USB_OTG_FS_regs.DOUTEPS[0]->DOEPTSIZx, doeptsize0.d32 ); } #endif /* STM32F10X_CL */ /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/
the_stack_data/176705370.c
/* Not needed, it's the same as strtoul. */
the_stack_data/978794.c
/* * SPI testing utility (using spidev driver) * * Copyright (c) 2007 MontaVista Software, Inc. * Copyright (c) 2007 Anton Vorontsov <[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. * * Cross-compile with cross-gcc -I/path/to/cross-kernel/include */ #include <stdint.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <getopt.h> #include <fcntl.h> #include <sys/ioctl.h> #include <linux/types.h> #include <linux/spi/spidev.h> #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) static void pabort(const char *s) { perror(s); abort(); } static const char *device = "/dev/spidev1.1"; static uint8_t mode; static uint8_t bits = 8; static uint32_t speed = 500000; static uint16_t delay; static void transfer(int fd) { int ret; uint8_t tx[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x40, 0x00, 0x00, 0x00, 0x00, 0x95, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDE, 0xAD, 0xBE, 0xEF, 0xBA, 0xAD, 0xF0, 0x0D, }; uint8_t rx[ARRAY_SIZE(tx)] = {0, }; struct spi_ioc_transfer tr = { .tx_buf = (unsigned long)tx, .rx_buf = (unsigned long)rx, .len = ARRAY_SIZE(tx), .delay_usecs = delay, .speed_hz = speed, .bits_per_word = bits, }; ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr); if (ret < 1) pabort("can't send spi message"); for (ret = 0; ret < ARRAY_SIZE(tx); ret++) { if (!(ret % 6)) puts(""); printf("%.2X ", rx[ret]); } puts(""); } static void print_usage(const char *prog) { printf("Usage: %s [-DsbdlHOLC3]\n", prog); puts(" -D --device device to use (default /dev/spidev1.1)\n" " -s --speed max speed (Hz)\n" " -d --delay delay (usec)\n" " -b --bpw bits per word \n" " -l --loop loopback\n" " -H --cpha clock phase\n" " -O --cpol clock polarity\n" " -L --lsb least significant bit first\n" " -C --cs-high chip select active high\n" " -3 --3wire SI/SO signals shared\n"); exit(1); } static void parse_opts(int argc, char *argv[]) { while (1) { static const struct option lopts[] = { { "device", 1, 0, 'D' }, { "speed", 1, 0, 's' }, { "delay", 1, 0, 'd' }, { "bpw", 1, 0, 'b' }, { "loop", 0, 0, 'l' }, { "cpha", 0, 0, 'H' }, { "cpol", 0, 0, 'O' }, { "lsb", 0, 0, 'L' }, { "cs-high", 0, 0, 'C' }, { "3wire", 0, 0, '3' }, { "no-cs", 0, 0, 'N' }, { "ready", 0, 0, 'R' }, { NULL, 0, 0, 0 }, }; int c; c = getopt_long(argc, argv, "D:s:d:b:lHOLC3NR", lopts, NULL); if (c == -1) break; switch (c) { case 'D': device = optarg; break; case 's': speed = atoi(optarg); break; case 'd': delay = atoi(optarg); break; case 'b': bits = atoi(optarg); break; case 'l': mode |= SPI_LOOP; break; case 'H': mode |= SPI_CPHA; break; case 'O': mode |= SPI_CPOL; break; case 'L': mode |= SPI_LSB_FIRST; break; case 'C': mode |= SPI_CS_HIGH; break; case '3': mode |= SPI_3WIRE; break; case 'N': mode |= SPI_NO_CS; break; case 'R': mode |= SPI_READY; break; default: print_usage(argv[0]); break; } } } int main(int argc, char *argv[]) { int ret = 0; int fd; parse_opts(argc, argv); fd = open(device, O_RDWR); if (fd < 0) pabort("can't open device"); /* * spi mode */ ret = ioctl(fd, SPI_IOC_WR_MODE, &mode); if (ret == -1) pabort("can't set spi mode"); ret = ioctl(fd, SPI_IOC_RD_MODE, &mode); if (ret == -1) pabort("can't get spi mode"); /* * bits per word */ ret = ioctl(fd, SPI_IOC_WR_BITS_PER_WORD, &bits); if (ret == -1) pabort("can't set bits per word"); ret = ioctl(fd, SPI_IOC_RD_BITS_PER_WORD, &bits); if (ret == -1) pabort("can't get bits per word"); /* * max speed hz */ ret = ioctl(fd, SPI_IOC_WR_MAX_SPEED_HZ, &speed); if (ret == -1) pabort("can't set max speed hz"); ret = ioctl(fd, SPI_IOC_RD_MAX_SPEED_HZ, &speed); if (ret == -1) pabort("can't get max speed hz"); printf("spi mode: %d\n", mode); printf("bits per word: %d\n", bits); printf("max speed: %d Hz (%d KHz)\n", speed, speed/1000); transfer(fd); close(fd); return ret; }
the_stack_data/181392884.c
//http://www2.cs.uregina.ca/~hamilton/courses/330/notes/unix/pipes/pipes.html #include <stdio.h> #include <string.h> #include <unistd.h> int main() { int pid, pip[2]; char instring[20]; char * outstring = "Hello World!"; if (pipe(pip) < 0) { perror("pipe"); return 1; } pid = fork(); if (pid == 0) /* child : sends message to parent*/ { /* close read end */ close(pip[0]); /* send 7 characters in the string, including end-of-string */ int bytes = write(pip[1], outstring, strlen(outstring)); /* close write end */ close(pip[1]); /* check result */ if (bytes < 0) { perror("pipe write"); return 1; } else if (bytes != strlen(outstring)) { fprintf(stderr, "pipe write: %d != %d\n", bytes, strlen(outstring)); return 1; } return 0; } else /* parent : receives message from child */ { /* close write end */ close(pip[1]); /* clear memory */ memset(instring, 0, sizeof(instring)); /* read from the pipe */ int bytes = read(pip[0], instring, sizeof(instring) - 1); /* close read end */ close(pip[0]); /* check result */ if (bytes < 0) { perror("pipe read"); return 1; } else if (bytes != strlen(outstring)) { fprintf(stderr, "pipe read: %d != %d\n", bytes, strlen(outstring)); return 1; } else if (memcmp(instring, outstring, sizeof(outstring)) != 0) { fprintf(stderr, "pipe read does not match pipe write\n"); return 1; } else { printf("%s\n", instring); } return 0; } return 0; }
the_stack_data/198581847.c
#include<stdio.h> #include<stdlib.h> #include <string.h> void randstack(int i){ int j=random(); if (i>0) randstack(i-1); } struct Cell { int value; struct Cell * next, * prev; }; struct Cell *newCell(int value){ struct Cell *p=malloc(sizeof *p); if (p==NULL) exit(2); p->value = value; return p; } struct Cell * append(struct Cell *list, struct Cell *newCell){ struct Cell *p; if (list==NULL) return newCell; p=list; while(p->next != NULL) p=p->next; p->next = newCell; newCell -> prev = p; return list; } struct Cell *removeValue(struct Cell *list , int value){ struct Cell *tmp; if (list==NULL) return NULL; if (list->value==value) { tmp=list->next; free(list); return removeValue(tmp,value); } list->next = removeValue(list->next,value); return list; } struct Cell *reverseList(struct Cell *list){ struct Cell *tmp; if (list==NULL) return NULL; tmp = list->next; list->next = list->prev; list->prev=tmp; if (tmp==NULL) return list; else return reverseList(tmp); } void print(struct Cell *l){ if (l==NULL) { printf("\n"); return; } printf("%d ",l->value); print(l->next); } void freeList(struct Cell *l){ struct Cell *tmp; if (l==NULL) return; tmp=l->next; free(l); freeList(tmp); } int main(){ struct Cell *list = NULL; int i; randstack(100); for(i=0;i<100;++i) list = append(list,newCell(i)); print(list); for(i=10;i<50;i+=2) list = removeValue(list,i); print(list); list = reverseList(list); print(list); freeList(list); return EXIT_SUCCESS; }
the_stack_data/15762120.c
/* Declarations for math functions. Copyright (C) 1991-1993,1995-1999,2001,2002 Free Software Foundation, Inc. This file is part of the GNU C Library. 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. */ /* * ISO C99 Standard: 7.12 Mathematics <math.h> */ /* Copyright (C) 1991-1993,1995-2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. 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. */ /* These are defined by the user (or the compiler) to specify the desired environment: __STRICT_ANSI__ ISO Standard C. _ISOC99_SOURCE Extensions to ISO C89 from ISO C99. _POSIX_SOURCE IEEE Std 1003.1. _POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2; if >=199309L, add IEEE Std 1003.1b-1993; if >=199506L, add IEEE Std 1003.1c-1995 _XOPEN_SOURCE Includes POSIX and XPG things. Set to 500 if Single Unix conformance is wanted, to 600 for the upcoming sixth revision. _XOPEN_SOURCE_EXTENDED XPG things and X/Open Unix extensions. _LARGEFILE_SOURCE Some more functions for correct standard I/O. _LARGEFILE64_SOURCE Additional functionality from LFS for large files. _FILE_OFFSET_BITS=N Select default filesystem interface. _BSD_SOURCE ISO C, POSIX, and 4.3BSD things. _SVID_SOURCE ISO C, POSIX, and SVID things. _GNU_SOURCE All of the above, plus GNU extensions. _REENTRANT Select additionally reentrant object. _THREAD_SAFE Same as _REENTRANT, often used by other systems. The `-ansi' switch to the GNU C compiler defines __STRICT_ANSI__. If none of these are defined, the default is to have _SVID_SOURCE, _BSD_SOURCE, and _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to 199506L. If more than one of these are defined, they accumulate. For example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE together give you ISO C, 1003.1, and 1003.2, but nothing else. These are defined by this file and are used by the header files to decide what to declare or define: __USE_ISOC99 Define ISO C99 things. __USE_POSIX Define IEEE Std 1003.1 things. __USE_POSIX2 Define IEEE Std 1003.2 things. __USE_POSIX199309 Define IEEE Std 1003.1, and .1b things. __USE_POSIX199506 Define IEEE Std 1003.1, .1b, .1c and .1i things. __USE_XOPEN Define XPG things. __USE_XOPEN_EXTENDED Define X/Open Unix things. __USE_UNIX98 Define Single Unix V2 things. __USE_XOPEN2K Define XPG6 things. __USE_LARGEFILE Define correct standard I/O things. __USE_LARGEFILE64 Define LFS things with separate names. __USE_FILE_OFFSET64 Define 64bit interface as default. __USE_BSD Define 4.3BSD things. __USE_SVID Define SVID things. __USE_MISC Define things common to BSD and System V Unix. __USE_GNU Define GNU extensions. __USE_REENTRANT Define reentrant/thread-safe *_r functions. __FAVOR_BSD Favor 4.3BSD things in cases of conflict. The macros `__GNU_LIBRARY__', `__GLIBC__', and `__GLIBC_MINOR__' are defined by this file unconditionally. `__GNU_LIBRARY__' is provided only for compatibility. All new code should use the other symbols to test for features. All macros listed above as possibly being defined by this file are explicitly undefined if they are not explicitly defined. Feature-test macros that are not defined by the user or compiler but are implied by the other feature-test macros defined (or by the lack of any definitions) are defined by the file. */ /* Undefine everything, so we get a clean slate. */ /* Suppress kernel-name space pollution unless user expressedly asks for it. */ /* Always use ISO C things. */ /* If _BSD_SOURCE was defined by the user, favor BSD over POSIX. */ /* If _GNU_SOURCE was defined by the user, turn on all the other features. */ /* If nothing (other than _GNU_SOURCE) is defined, define _BSD_SOURCE and _SVID_SOURCE. */ /* This is to enable the ISO C99 extension. Also recognize the old macro which was used prior to the standard acceptance. This macro will eventually go away and the features enabled by default once the ISO C99 standard is widely adopted. */ /* If none of the ANSI/POSIX macros are defined, use POSIX.1 and POSIX.2 (and IEEE Std 1003.1b-1993 unless _XOPEN_SOURCE is defined). */ /* We do support the IEC 559 math functionality, real and complex. */ /* wchar_t uses ISO 10646-1 (2nd ed., published 2000-09-15) / Unicode 3.1. */ /* This macro indicates that the installed library is the GNU C Library. For historic reasons the value now is 6 and this will stay from now on. The use of this variable is deprecated. Use __GLIBC__ and __GLIBC_MINOR__ now (see below) when you want to test for a specific GNU C library version and use the values in <gnu/lib-names.h> to get the sonames of the shared libraries. */ /* Major and minor version number of the GNU C library package. Use these macros to test for features in specific releases. */ /* Convenience macros to test the versions of glibc and gcc. Use them like this: #if __GNUC_PREREQ (2,8) ... code requiring gcc 2.8 or later ... #endif Note - they won't work for gcc1 or glibc1, since the _MINOR macros were not defined then. */ /* Decide whether a compiler supports the long long datatypes. */ /* This is here only because every header file already includes this one. */ /* Copyright (C) 1992-2001, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. 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. */ /* We are almost always included from features.h. */ /* The GNU libc does not support any K&R compilers or the traditional mode of ISO C compilers anymore. Check for some of the combinations not anymore supported. */ /* Some user header file might have defined this before. */ /* For these things, GCC behaves the ANSI way normally, and the non-ANSI way under -traditional. */ /* This is not a typedef so `const __ptr_t' does the right thing. */ /* C++ needs to know that types and declarations are C, not C++. */ /* The standard library needs the functions from the ISO C90 standard in the std namespace. At the same time we want to be safe for future changes and we include the ISO C99 code in the non-standard namespace __c99. The C++ wrapper header take case of adding the definitions to the global namespace. */ /* For compatibility we do not add the declarations into any namespace. They will end up in the global namespace which is what old code expects. */ /* Support for bounded pointers. */ /* Support for flexible arrays. */ /* Some other non-C99 compiler. Approximate with [1]. */ /* __asm__ ("xyz") is used throughout the headers to rename functions at the assembly language level. This is wrapped by the __REDIRECT macro, in order to support compilers that can do this some other way. When compilers don't support asm-names at all, we have to do preprocessor tricks instead (which don't have exactly the right semantics, but it's the best we can do). Example: int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */ /* GCC has various useful declarations that can be made with the `__attribute__' syntax. All of the ways we use this do fine if they are omitted for compilers that don't understand it. */ /* At some point during the gcc 2.96 development the `malloc' attribute for functions was introduced. We don't want to use it unconditionally (although this would be possible) since it generates warnings. */ /* At some point during the gcc 2.96 development the `pure' attribute for functions was introduced. We don't want to use it unconditionally (although this would be possible) since it generates warnings. */ /* At some point during the gcc 3.1 development the `used' attribute for functions was introduced. We don't want to use it unconditionally (although this would be possible) since it generates warnings. */ /* gcc allows marking deprecated functions. */ /* At some point during the gcc 2.8 development the `format_arg' attribute for functions was introduced. We don't want to use it unconditionally (although this would be possible) since it generates warnings. If several `format_arg' attributes are given for the same function, in gcc-3.0 and older, all but the last one are ignored. In newer gccs, all designated arguments are considered. */ /* At some point during the gcc 2.97 development the `strfmon' format attribute for functions was introduced. We don't want to use it unconditionally (although this would be possible) since it generates warnings. */ /* It is possible to compile containing GCC extensions even if GCC is run in pedantic mode if the uses are carefully marked using the `__extension__' keyword. But this is not generally available before version 2.8. */ /* __restrict is known in EGCS 1.2 and above. */ /* ISO C99 also allows to declare arrays as non-overlapping. The syntax is array_name[restrict] GCC 3.1 supports this. */ /* Some other non-C99 compiler. */ /* If we don't have __REDIRECT, prototypes will be missing if __USE_FILE_OFFSET64 but not __USE_LARGEFILE[64]. */ /* Decide whether we can define 'extern inline' functions in headers. */ /* This is here only because every header file already includes this one. Get the definitions of all the appropriate `__stub_FUNCTION' symbols. <gnu/stubs.h> contains `#define __stub_FUNCTION' when FUNCTION is a stub that will always return failure (and set errno to ENOSYS). */ /* This file is automatically generated. It defines a symbol `__stub_FUNCTION' for each function in the C library which is a stub, meaning it will fail every time called, usually setting errno to ENOSYS. */ /* Get machine-dependent HUGE_VAL value (returned on overflow). On all IEEE754 machines, this is +Infinity. */ /* `HUGE_VAL' constants for ix86 (where it is infinity). Used by <stdlib.h> and <math.h> functions for overflow. Copyright (C) 1992, 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. 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. */ /* Copyright (C) 1991-1993,1995-2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. 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. */ /* IEEE positive infinity (-HUGE_VAL is negative infinity). */ static union { unsigned char __c[8]; double __d; } __huge_val = { { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } }; /* ISO C99 extensions: (float) HUGE_VALF and (long double) HUGE_VALL. */ /* Get machine-dependent NAN value (returned for some domain errors). */ /* Get general and ISO C99 specific information. */ /* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. 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. */ /* The file <bits/mathcalls.h> contains the prototypes for all the actual math functions. These macros are used for those prototypes, so we can easily declare each function as both `name' and `__name', and can declare the float versions `namef' and `__namef'. */ /* Prototype declarations for math functions; helper file for <math.h>. Copyright (C) 1996-2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. 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. */ /* NOTE: Because of the special way this file is used by <math.h>, this file must NOT be protected from multiple inclusion as header files usually are. This file provides prototype declarations for the math functions. Most functions are declared using the macro: __MATHCALL (NAME,[_r], (ARGS...)); This means there is a function `NAME' returning `double' and a function `NAMEf' returning `float'. Each place `_Mdouble_' appears in the prototype, that is actually `double' in the prototype for `NAME' and `float' in the prototype for `NAMEf'. Reentrant variant functions are called `NAME_r' and `NAMEf_r'. Functions returning other types like `int' are declared using the macro: __MATHDECL (TYPE, NAME,[_r], (ARGS...)); This is just like __MATHCALL but for a function returning `TYPE' instead of `_Mdouble_'. In all of these cases, there is still both a `NAME' and a `NAMEf' that takes `float' arguments. Note that there must be no whitespace before the argument passed for NAME, to make token pasting work with -traditional. */ /* Trigonometric functions. */ /* Arc cosine of X. */ extern double acos (double __x) ; extern double __acos (double __x) ; /* Arc sine of X. */ extern double asin (double __x) ; extern double __asin (double __x) ; /* Arc tangent of X. */ extern double atan (double __x) ; extern double __atan (double __x) ; /* Arc tangent of Y/X. */ extern double atan2 (double __y, double __x) ; extern double __atan2 (double __y, double __x) ; /* Cosine of X. */ extern double cos (double __x) ; extern double __cos (double __x) ; /* Sine of X. */ extern double sin (double __x) ; extern double __sin (double __x) ; /* Tangent of X. */ extern double tan (double __x) ; extern double __tan (double __x) ; /* Hyperbolic functions. */ /* Hyperbolic cosine of X. */ extern double cosh (double __x) ; extern double __cosh (double __x) ; /* Hyperbolic sine of X. */ extern double sinh (double __x) ; extern double __sinh (double __x) ; /* Hyperbolic tangent of X. */ extern double tanh (double __x) ; extern double __tanh (double __x) ; /* Hyperbolic arc cosine of X. */ extern double acosh (double __x) ; extern double __acosh (double __x) ; /* Hyperbolic arc sine of X. */ extern double asinh (double __x) ; extern double __asinh (double __x) ; /* Hyperbolic arc tangent of X. */ extern double atanh (double __x) ; extern double __atanh (double __x) ; /* Exponential and logarithmic functions. */ /* Exponential function of X. */ extern double exp (double __x) ; extern double __exp (double __x) ; /* Break VALUE into a normalized fraction and an integral power of 2. */ extern double frexp (double __x, int *__exponent) ; extern double __frexp (double __x, int *__exponent) ; /* X times (two to the EXP power). */ extern double ldexp (double __x, int __exponent) ; extern double __ldexp (double __x, int __exponent) ; /* Natural logarithm of X. */ extern double log (double __x) ; extern double __log (double __x) ; /* Base-ten logarithm of X. */ extern double log10 (double __x) ; extern double __log10 (double __x) ; /* Break VALUE into integral and fractional parts. */ extern double modf (double __x, double *__iptr) ; extern double __modf (double __x, double *__iptr) ; /* Return exp(X) - 1. */ extern double expm1 (double __x) ; extern double __expm1 (double __x) ; /* Return log(1 + X). */ extern double log1p (double __x) ; extern double __log1p (double __x) ; /* Return the base 2 signed integral exponent of X. */ extern double logb (double __x) ; extern double __logb (double __x) ; /* Power functions. */ /* Return X to the Y power. */ extern double pow (double __x, double __y) ; extern double __pow (double __x, double __y) ; /* Return the square root of X. */ extern double sqrt (double __x) ; extern double __sqrt (double __x) ; /* Return `sqrt(X*X + Y*Y)'. */ extern double hypot (double __x, double __y) ; extern double __hypot (double __x, double __y) ; /* Return the cube root of X. */ extern double cbrt (double __x) ; extern double __cbrt (double __x) ; /* Nearest integer, absolute value, and remainder functions. */ /* Smallest integral value not less than X. */ extern double ceil (double __x) ; extern double __ceil (double __x) ; /* Absolute value of X. */ extern double fabs (double __x) ; extern double __fabs (double __x) ; /* Largest integer not greater than X. */ extern double floor (double __x) ; extern double __floor (double __x) ; /* Floating-point modulo remainder of X/Y. */ extern double fmod (double __x, double __y) ; extern double __fmod (double __x, double __y) ; /* Return 0 if VALUE is finite or NaN, +1 if it is +Infinity, -1 if it is -Infinity. */ extern int __isinf (double __value) ; /* Return nonzero if VALUE is finite and not NaN. */ extern int __finite (double __value) ; /* Return 0 if VALUE is finite or NaN, +1 if it is +Infinity, -1 if it is -Infinity. */ extern int isinf (double __value) ; /* Return nonzero if VALUE is finite and not NaN. */ extern int finite (double __value) ; /* Return the remainder of X/Y. */ extern double drem (double __x, double __y) ; extern double __drem (double __x, double __y) ; /* Return the fractional part of X after dividing out `ilogb (X)'. */ extern double significand (double __x) ; extern double __significand (double __x) ; /* Return X with its signed changed to Y's. */ extern double copysign (double __x, double __y) ; extern double __copysign (double __x, double __y) ; /* Return nonzero if VALUE is not a number. */ extern int __isnan (double __value) ; /* Return nonzero if VALUE is not a number. */ extern int isnan (double __value) ; /* Bessel functions. */ extern double j0 (double) ; extern double __j0 (double) ; extern double j1 (double) ; extern double __j1 (double) ; extern double jn (int, double) ; extern double __jn (int, double) ; extern double y0 (double) ; extern double __y0 (double) ; extern double y1 (double) ; extern double __y1 (double) ; extern double yn (int, double) ; extern double __yn (int, double) ; /* Error and gamma functions. */ extern double erf (double) ; extern double __erf (double) ; extern double erfc (double) ; extern double __erfc (double) ; extern double lgamma (double) ; extern double __lgamma (double) ; /* Obsolete alias for `lgamma'. */ extern double gamma (double) ; extern double __gamma (double) ; /* Reentrant version of lgamma. This function uses the global variable `signgam'. The reentrant version instead takes a pointer and stores the value through it. */ extern double lgamma_r (double, int *__signgamp) ; extern double __lgamma_r (double, int *__signgamp) ; /* Return the integer nearest X in the direction of the prevailing rounding mode. */ extern double rint (double __x) ; extern double __rint (double __x) ; /* Return X + epsilon if X < Y, X - epsilon if X > Y. */ extern double nextafter (double __x, double __y) ; extern double __nextafter (double __x, double __y) ; /* Return the remainder of integer divison X / Y with infinite precision. */ extern double remainder (double __x, double __y) ; extern double __remainder (double __x, double __y) ; /* Return X times (2 to the Nth power). */ extern double scalbn (double __x, int __n) ; extern double __scalbn (double __x, int __n) ; /* Return the binary exponent of X, which must be nonzero. */ extern int ilogb (double __x) ; extern int __ilogb (double __x) ; /* Include the file of declarations again, this time using `float' instead of `double' and appending f to each function name. */ /* Prototype declarations for math functions; helper file for <math.h>. Copyright (C) 1996-2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. 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. */ /* NOTE: Because of the special way this file is used by <math.h>, this file must NOT be protected from multiple inclusion as header files usually are. This file provides prototype declarations for the math functions. Most functions are declared using the macro: __MATHCALL (NAME,[_r], (ARGS...)); This means there is a function `NAME' returning `double' and a function `NAMEf' returning `float'. Each place `_Mdouble_' appears in the prototype, that is actually `double' in the prototype for `NAME' and `float' in the prototype for `NAMEf'. Reentrant variant functions are called `NAME_r' and `NAMEf_r'. Functions returning other types like `int' are declared using the macro: __MATHDECL (TYPE, NAME,[_r], (ARGS...)); This is just like __MATHCALL but for a function returning `TYPE' instead of `_Mdouble_'. In all of these cases, there is still both a `NAME' and a `NAMEf' that takes `float' arguments. Note that there must be no whitespace before the argument passed for NAME, to make token pasting work with -traditional. */ /* Trigonometric functions. */ /* Arc cosine of X. */ extern float acosf (float __x) ; extern float __acosf (float __x) ; /* Arc sine of X. */ extern float asinf (float __x) ; extern float __asinf (float __x) ; /* Arc tangent of X. */ extern float atanf (float __x) ; extern float __atanf (float __x) ; /* Arc tangent of Y/X. */ extern float atan2f (float __y, float __x) ; extern float __atan2f (float __y, float __x) ; /* Cosine of X. */ extern float cosf (float __x) ; extern float __cosf (float __x) ; /* Sine of X. */ extern float sinf (float __x) ; extern float __sinf (float __x) ; /* Tangent of X. */ extern float tanf (float __x) ; extern float __tanf (float __x) ; /* Hyperbolic functions. */ /* Hyperbolic cosine of X. */ extern float coshf (float __x) ; extern float __coshf (float __x) ; /* Hyperbolic sine of X. */ extern float sinhf (float __x) ; extern float __sinhf (float __x) ; /* Hyperbolic tangent of X. */ extern float tanhf (float __x) ; extern float __tanhf (float __x) ; /* Hyperbolic arc cosine of X. */ extern float acoshf (float __x) ; extern float __acoshf (float __x) ; /* Hyperbolic arc sine of X. */ extern float asinhf (float __x) ; extern float __asinhf (float __x) ; /* Hyperbolic arc tangent of X. */ extern float atanhf (float __x) ; extern float __atanhf (float __x) ; /* Exponential and logarithmic functions. */ /* Exponential function of X. */ extern float expf (float __x) ; extern float __expf (float __x) ; /* Break VALUE into a normalized fraction and an integral power of 2. */ extern float frexpf (float __x, int *__exponent) ; extern float __frexpf (float __x, int *__exponent) ; /* X times (two to the EXP power). */ extern float ldexpf (float __x, int __exponent) ; extern float __ldexpf (float __x, int __exponent) ; /* Natural logarithm of X. */ extern float logf (float __x) ; extern float __logf (float __x) ; /* Base-ten logarithm of X. */ extern float log10f (float __x) ; extern float __log10f (float __x) ; /* Break VALUE into integral and fractional parts. */ extern float modff (float __x, float *__iptr) ; extern float __modff (float __x, float *__iptr) ; /* Return exp(X) - 1. */ extern float expm1f (float __x) ; extern float __expm1f (float __x) ; /* Return log(1 + X). */ extern float log1pf (float __x) ; extern float __log1pf (float __x) ; /* Return the base 2 signed integral exponent of X. */ extern float logbf (float __x) ; extern float __logbf (float __x) ; /* Power functions. */ /* Return X to the Y power. */ extern float powf (float __x, float __y) ; extern float __powf (float __x, float __y) ; /* Return the square root of X. */ extern float sqrtf (float __x) ; extern float __sqrtf (float __x) ; /* Return `sqrt(X*X + Y*Y)'. */ extern float hypotf (float __x, float __y) ; extern float __hypotf (float __x, float __y) ; /* Return the cube root of X. */ extern float cbrtf (float __x) ; extern float __cbrtf (float __x) ; /* Nearest integer, absolute value, and remainder functions. */ /* Smallest integral value not less than X. */ extern float ceilf (float __x) ; extern float __ceilf (float __x) ; /* Absolute value of X. */ extern float fabsf (float __x) ; extern float __fabsf (float __x) ; /* Largest integer not greater than X. */ extern float floorf (float __x) ; extern float __floorf (float __x) ; /* Floating-point modulo remainder of X/Y. */ extern float fmodf (float __x, float __y) ; extern float __fmodf (float __x, float __y) ; /* Return 0 if VALUE is finite or NaN, +1 if it is +Infinity, -1 if it is -Infinity. */ extern int __isinff (float __value) ; /* Return nonzero if VALUE is finite and not NaN. */ extern int __finitef (float __value) ; /* Return 0 if VALUE is finite or NaN, +1 if it is +Infinity, -1 if it is -Infinity. */ extern int isinff (float __value) ; /* Return nonzero if VALUE is finite and not NaN. */ extern int finitef (float __value) ; /* Return the remainder of X/Y. */ extern float dremf (float __x, float __y) ; extern float __dremf (float __x, float __y) ; /* Return the fractional part of X after dividing out `ilogb (X)'. */ extern float significandf (float __x) ; extern float __significandf (float __x) ; /* Return X with its signed changed to Y's. */ extern float copysignf (float __x, float __y) ; extern float __copysignf (float __x, float __y) ; /* Return nonzero if VALUE is not a number. */ extern int __isnanf (float __value) ; /* Return nonzero if VALUE is not a number. */ extern int isnanf (float __value) ; /* Bessel functions. */ extern float j0f (float) ; extern float __j0f (float) ; extern float j1f (float) ; extern float __j1f (float) ; extern float jnf (int, float) ; extern float __jnf (int, float) ; extern float y0f (float) ; extern float __y0f (float) ; extern float y1f (float) ; extern float __y1f (float) ; extern float ynf (int, float) ; extern float __ynf (int, float) ; /* Error and gamma functions. */ extern float erff (float) ; extern float __erff (float) ; extern float erfcf (float) ; extern float __erfcf (float) ; extern float lgammaf (float) ; extern float __lgammaf (float) ; /* Obsolete alias for `lgamma'. */ extern float gammaf (float) ; extern float __gammaf (float) ; /* Reentrant version of lgamma. This function uses the global variable `signgam'. The reentrant version instead takes a pointer and stores the value through it. */ extern float lgammaf_r (float, int *__signgamp) ; extern float __lgammaf_r (float, int *__signgamp) ; /* Return the integer nearest X in the direction of the prevailing rounding mode. */ extern float rintf (float __x) ; extern float __rintf (float __x) ; /* Return X + epsilon if X < Y, X - epsilon if X > Y. */ extern float nextafterf (float __x, float __y) ; extern float __nextafterf (float __x, float __y) ; /* Return the remainder of integer divison X / Y with infinite precision. */ extern float remainderf (float __x, float __y) ; extern float __remainderf (float __x, float __y) ; /* Return X times (2 to the Nth power). */ extern float scalbnf (float __x, int __n) ; extern float __scalbnf (float __x, int __n) ; /* Return the binary exponent of X, which must be nonzero. */ extern int ilogbf (float __x) ; extern int __ilogbf (float __x) ; /* Include the file of declarations again, this time using `long double' instead of `double' and appending l to each function name. */ /* Prototype declarations for math functions; helper file for <math.h>. Copyright (C) 1996-2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. 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. */ /* NOTE: Because of the special way this file is used by <math.h>, this file must NOT be protected from multiple inclusion as header files usually are. This file provides prototype declarations for the math functions. Most functions are declared using the macro: __MATHCALL (NAME,[_r], (ARGS...)); This means there is a function `NAME' returning `double' and a function `NAMEf' returning `float'. Each place `_Mdouble_' appears in the prototype, that is actually `double' in the prototype for `NAME' and `float' in the prototype for `NAMEf'. Reentrant variant functions are called `NAME_r' and `NAMEf_r'. Functions returning other types like `int' are declared using the macro: __MATHDECL (TYPE, NAME,[_r], (ARGS...)); This is just like __MATHCALL but for a function returning `TYPE' instead of `_Mdouble_'. In all of these cases, there is still both a `NAME' and a `NAMEf' that takes `float' arguments. Note that there must be no whitespace before the argument passed for NAME, to make token pasting work with -traditional. */ /* Trigonometric functions. */ /* Arc cosine of X. */ extern long double acosl (long double __x) ; extern long double __acosl (long double __x) ; /* Arc sine of X. */ extern long double asinl (long double __x) ; extern long double __asinl (long double __x) ; /* Arc tangent of X. */ extern long double atanl (long double __x) ; extern long double __atanl (long double __x) ; /* Arc tangent of Y/X. */ extern long double atan2l (long double __y, long double __x) ; extern long double __atan2l (long double __y, long double __x) ; /* Cosine of X. */ extern long double cosl (long double __x) ; extern long double __cosl (long double __x) ; /* Sine of X. */ extern long double sinl (long double __x) ; extern long double __sinl (long double __x) ; /* Tangent of X. */ extern long double tanl (long double __x) ; extern long double __tanl (long double __x) ; /* Hyperbolic functions. */ /* Hyperbolic cosine of X. */ extern long double coshl (long double __x) ; extern long double __coshl (long double __x) ; /* Hyperbolic sine of X. */ extern long double sinhl (long double __x) ; extern long double __sinhl (long double __x) ; /* Hyperbolic tangent of X. */ extern long double tanhl (long double __x) ; extern long double __tanhl (long double __x) ; /* Hyperbolic arc cosine of X. */ extern long double acoshl (long double __x) ; extern long double __acoshl (long double __x) ; /* Hyperbolic arc sine of X. */ extern long double asinhl (long double __x) ; extern long double __asinhl (long double __x) ; /* Hyperbolic arc tangent of X. */ extern long double atanhl (long double __x) ; extern long double __atanhl (long double __x) ; /* Exponential and logarithmic functions. */ /* Exponential function of X. */ extern long double expl (long double __x) ; extern long double __expl (long double __x) ; /* Break VALUE into a normalized fraction and an integral power of 2. */ extern long double frexpl (long double __x, int *__exponent) ; extern long double __frexpl (long double __x, int *__exponent) ; /* X times (two to the EXP power). */ extern long double ldexpl (long double __x, int __exponent) ; extern long double __ldexpl (long double __x, int __exponent) ; /* Natural logarithm of X. */ extern long double logl (long double __x) ; extern long double __logl (long double __x) ; /* Base-ten logarithm of X. */ extern long double log10l (long double __x) ; extern long double __log10l (long double __x) ; /* Break VALUE into integral and fractional parts. */ extern long double modfl (long double __x, long double *__iptr) ; extern long double __modfl (long double __x, long double *__iptr) ; /* Return exp(X) - 1. */ extern long double expm1l (long double __x) ; extern long double __expm1l (long double __x) ; /* Return log(1 + X). */ extern long double log1pl (long double __x) ; extern long double __log1pl (long double __x) ; /* Return the base 2 signed integral exponent of X. */ extern long double logbl (long double __x) ; extern long double __logbl (long double __x) ; /* Power functions. */ /* Return X to the Y power. */ extern long double powl (long double __x, long double __y) ; extern long double __powl (long double __x, long double __y) ; /* Return the square root of X. */ extern long double sqrtl (long double __x) ; extern long double __sqrtl (long double __x) ; /* Return `sqrt(X*X + Y*Y)'. */ extern long double hypotl (long double __x, long double __y) ; extern long double __hypotl (long double __x, long double __y) ; /* Return the cube root of X. */ extern long double cbrtl (long double __x) ; extern long double __cbrtl (long double __x) ; /* Nearest integer, absolute value, and remainder functions. */ /* Smallest integral value not less than X. */ extern long double ceill (long double __x) ; extern long double __ceill (long double __x) ; /* Absolute value of X. */ extern long double fabsl (long double __x) ; extern long double __fabsl (long double __x) ; /* Largest integer not greater than X. */ extern long double floorl (long double __x) ; extern long double __floorl (long double __x) ; /* Floating-point modulo remainder of X/Y. */ extern long double fmodl (long double __x, long double __y) ; extern long double __fmodl (long double __x, long double __y) ; /* Return 0 if VALUE is finite or NaN, +1 if it is +Infinity, -1 if it is -Infinity. */ extern int __isinfl (long double __value) ; /* Return nonzero if VALUE is finite and not NaN. */ extern int __finitel (long double __value) ; /* Return 0 if VALUE is finite or NaN, +1 if it is +Infinity, -1 if it is -Infinity. */ extern int isinfl (long double __value) ; /* Return nonzero if VALUE is finite and not NaN. */ extern int finitel (long double __value) ; /* Return the remainder of X/Y. */ extern long double dreml (long double __x, long double __y) ; extern long double __dreml (long double __x, long double __y) ; /* Return the fractional part of X after dividing out `ilogb (X)'. */ extern long double significandl (long double __x) ; extern long double __significandl (long double __x) ; /* Return X with its signed changed to Y's. */ extern long double copysignl (long double __x, long double __y) ; extern long double __copysignl (long double __x, long double __y) ; /* Return nonzero if VALUE is not a number. */ extern int __isnanl (long double __value) ; /* Return nonzero if VALUE is not a number. */ extern int isnanl (long double __value) ; /* Bessel functions. */ extern long double j0l (long double) ; extern long double __j0l (long double) ; extern long double j1l (long double) ; extern long double __j1l (long double) ; extern long double jnl (int, long double) ; extern long double __jnl (int, long double) ; extern long double y0l (long double) ; extern long double __y0l (long double) ; extern long double y1l (long double) ; extern long double __y1l (long double) ; extern long double ynl (int, long double) ; extern long double __ynl (int, long double) ; /* Error and gamma functions. */ extern long double erfl (long double) ; extern long double __erfl (long double) ; extern long double erfcl (long double) ; extern long double __erfcl (long double) ; extern long double lgammal (long double) ; extern long double __lgammal (long double) ; /* Obsolete alias for `lgamma'. */ extern long double gammal (long double) ; extern long double __gammal (long double) ; /* Reentrant version of lgamma. This function uses the global variable `signgam'. The reentrant version instead takes a pointer and stores the value through it. */ extern long double lgammal_r (long double, int *__signgamp) ; extern long double __lgammal_r (long double, int *__signgamp) ; /* Return the integer nearest X in the direction of the prevailing rounding mode. */ extern long double rintl (long double __x) ; extern long double __rintl (long double __x) ; /* Return X + epsilon if X < Y, X - epsilon if X > Y. */ extern long double nextafterl (long double __x, long double __y) ; extern long double __nextafterl (long double __x, long double __y) ; /* Return the remainder of integer divison X / Y with infinite precision. */ extern long double remainderl (long double __x, long double __y) ; extern long double __remainderl (long double __x, long double __y) ; /* Return X times (2 to the Nth power). */ extern long double scalbnl (long double __x, int __n) ; extern long double __scalbnl (long double __x, int __n) ; /* Return the binary exponent of X, which must be nonzero. */ extern int ilogbl (long double __x) ; extern int __ilogbl (long double __x) ; /* This variable is used by `gamma' and `lgamma'. */ extern int signgam; /* ISO C99 defines some generic macros which work on any data type. */ /* Support for various different standard error handling behaviors. */ typedef enum { _IEEE_ = -1, /* According to IEEE 754/IEEE 854. */ _SVID_, /* According to System V, release 4. */ _XOPEN_, /* Nowadays also Unix98. */ _POSIX_, _ISOC_ /* Actually this is ISO C99. */ } _LIB_VERSION_TYPE; /* This variable can be changed at run-time to any of the values above to affect floating point error handling behavior (it may also be necessary to change the hardware FPU exception settings). */ extern _LIB_VERSION_TYPE _LIB_VERSION; /* In SVID error handling, `matherr' is called with this description of the exceptional condition. We have a problem when using C++ since `exception' is a reserved name in C++. */ struct exception { int type; char *name; double arg1; double arg2; double retval; }; extern int matherr (struct exception *__exc); /* Types of exceptions in the `type' field. */ /* SVID mode specifies returning this large value instead of infinity. */ /* Some useful constants. */ /* The above constants are not adequate for computation using `long double's. Therefore we provide as an extension constants with similar names as a GNU extension. Provide enough digits for the 128-bit IEEE quad. */ /* When compiling in strict ISO C compatible mode we must not use the inline functions since they, among other things, do not set the `errno' variable correctly. */ /* Get machine-dependent inline versions (if there are any). */ float poidev(xm,idum) float xm; int *idum; { static float sq,alxm,g,oldm=(-1.0); float em,t,y; float ran1(),gammln(); if (xm < 12.0) { if (xm != oldm) { oldm=xm; g=exp(-xm); } em = -1; t=1.0; do { em += 1.0; t *= ran1(idum); } while (t > g); } else { if (xm != oldm) { oldm=xm; sq=sqrt(2.0*xm); alxm=log(xm); g=xm*alxm-gammln(xm+1.0); } do { do { y=tan(3.141592654*ran1(idum)); em=sq*y+xm; } while (em < 0.0); em=floor(em); t=0.9*(1.0+y*y)*exp(em*alxm-gammln(em+1.0)-g); } while (ran1(idum) > t); } return em; }
the_stack_data/22011502.c
#include <stdio.h> struct list_el { int val; struct list_el *next; }; typedef struct list_el item; int main() { item *curr, *head; head = NULL; curr = (item *)malloc(sizeof(item)); __ESBMC_assume(curr); curr->val = 1; curr->next = head; head = curr; curr = (item *)malloc(sizeof(item)); __ESBMC_assume(curr); curr->val = 2; curr->next = head; head = curr; assert(head->val==1); }
the_stack_data/1013499.c
#include <stdio.h> int main() { int a; int b; int c; int d; int e; int f; int x; int y; a = 12; b = 34; c = 56; d = 78; e = 0; f = 1; printf("%d\n", c + d); printf("%d\n", (y = c + d)); printf("%d\n", e || e && f); printf("%d\n", e || f && f); printf("%d\n", e && e || f); printf("%d\n", e && f || f); printf("%d\n", a && f | f); printf("%d\n", a | b ^ c & d); printf("%d, %d\n", a == a, a == b); printf("%d, %d\n", a != a, a != b); printf("%d\n", a != b && c != d); printf("%d\n", a + b * c / f); printf("%d\n", a + b * c / f); printf("%d\n", (4 << 4)); printf("%d\n", (64 >> 4)); return 0; }
the_stack_data/234518735.c
/* { dg-options "-O3 -mcpu=v6.00.a -mhard-float" } */ volatile float f1, f2, f3; void float_func () { /* { dg-final { scan-assembler "fcmp\.(le|gt)\tr(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1]),r(\[0-9]\|\[1-2]\[0-9]\|3\[0-1])\[^0-9]" } } */ if (f2 <= f3) print ("le"); }
the_stack_data/20153.c
#include <stdio.h> int main() { int t; scanf("%d", &t); while (t--) { int a, b; scanf("%d %d", &a, &b); int ans = a + b; printf("%d\n", ans); } return 0; }
the_stack_data/49899.c
/*! * @file main.c * @brief 12. Strings - 05. Uso de strcmp() * @author Javier Balloffet <[email protected]> * @date Mar 6, 2019 */ #include <stdio.h> #include <string.h> int main(void) { // Declaro dos strings sin inicializar. char word1[20]; char word2[20]; int diff; // Ingreso el contenido de los strings por consola. printf("Ingrese una palabra: "); scanf("%s", word1); printf("Ingrese otra palabra: "); scanf("%s", word2); // Imprimo el contenido de los strings. printf("Primera palabra ingresada: %s\n", word1); printf("Segunda palabra ingresada: %s\n", word2); // Comparo ambos strings (lexicográficamente). diff = strcmp(word1, word2); // Imprimo el resultado de la comparación. if (diff == 0) { printf("Los strings ingresados son iguales\n"); } else { printf( "Los strings ingresados son distintos: el primer caracter " "diferente difiere por un valor (en codigo " "ascii en decimal) de: %d\n", diff); } return 0; }
the_stack_data/125139303.c
#include <stdio.h> #define MAXLINE 1000 // Strategy: Save line from input and its length. Then iterate backwards to // trim trailing whitespace by inserting the null character at the first non- // whitespace character encountered. // [A][ ][B][ ][ ][\0][?][?] // 0 1 2 3 4 5 6 7 int setline_getlen(char line[], int maxline); int trim(char line[], int to); int main() { int len; char line[MAXLINE]; while ((len = setline_getlen(line, MAXLINE)) > 0) { len = trim(line, len); if (len > 0) printf("\nLength: %d\nString:\n%s\n\n", len, line); } return 0; } int trim(char s[], int s_length) { int i; // Assumes length supplied doesn't factor in null character. for (i = s_length-1; i >= 0; --i) { if (s[i] != ' ' && s[i] != '\t' && s[i] != '\n') { // Increment i to add null character after last non-whitespace char. ++i; s[i] = '\0'; return i; // This is the trimmed length. } } return 0; // Or i, which is also zero here. } // Unchanged. int setline_getlen(char s[], int lim) { int c, i; for (i = 0; i < lim - 1 && (c = getchar()) != EOF && c != '\n'; ++i) s[i] = c; if (c == '\n') { s[i] = c; ++i; } s[i] = '\0'; return i; }
the_stack_data/22013851.c
#include <stdio.h> void main(){ float cels; printf("Enter tempurature in celcius..."); scanf("%f",cels); float fahr = (cels * 9.0/5.0) + 32.0; float kelvin = cels + 273.15; printf("In Faranhiet %f", fahr); printf("In Kelvin %f", kelvin); }
the_stack_data/225141996.c
// This file auto-generated by h3mtools' passabilitytool by John AAkerblom static const int _1x1[] = { 544, 547, 429, 430, 549, 550, 551, 552, 555, 556, 557, 558, 583, 584, 585, 586, 588, 590, 591, 592, 593, 595, 596, 597, 598, 599, 660, 661, 662 }; static const int _1x2[] = { 545, 566, 658 }; static const int _1x3[] = { -1 }; static const int _1x4[] = { -1 }; static const int _1x5[] = { -1 }; static const int _1x6[] = { -1 }; static const int _2x1[] = { 543, 548, 553, 554, 559, 562, 567, 574, 575, 576, 577, 578, 579, 580, 581, 582, 587, 589, 594, 657, 659 }; static const int _2x2[] = { 546, 564, 565, 655, 656 }; static const int _2x3[] = { -1 }; static const int _2x4[] = { -1 }; static const int _2x5[] = { -1 }; static const int _2x6[] = { -1 }; static const int _3x1[] = { -1 }; static const int _3x2[] = { 431, 432, 433, 434, 563, 570, 571, 572, 573 }; static const int _3x3[] = { 435, 436, 653, 654 }; static const int _3x4[] = { -1 }; static const int _3x5[] = { -1 }; static const int _3x6[] = { -1 }; static const int _4x1[] = { -1 }; static const int _4x2[] = { 561 }; static const int _4x3[] = { -1 }; static const int _4x4[] = { -1 }; static const int _4x5[] = { -1 }; static const int _4x6[] = { -1 }; static const int _5x1[] = { -1 }; static const int _5x2[] = { -1 }; static const int _5x3[] = { 568, 569 }; static const int _5x4[] = { -1 }; static const int _5x5[] = { -1 }; static const int _5x6[] = { -1 }; static const int _6x1[] = { -1 }; static const int _6x2[] = { -1 }; static const int _6x3[] = { -1 }; static const int _6x4[] = { -1 }; static const int _6x5[] = { -1 }; static const int _6x6[] = { -1 }; static const int _7x1[] = { -1 }; static const int _7x2[] = { -1 }; static const int _7x3[] = { 560 }; static const int _7x4[] = { -1 }; static const int _7x5[] = { -1 }; static const int _7x6[] = { -1 }; static const int _8x1[] = { -1 }; static const int _8x2[] = { -1 }; static const int _8x3[] = { -1 }; static const int _8x4[] = { -1 }; static const int _8x5[] = { -1 }; static const int _8x6[] = { -1 }; static const int table_sizes[6][8] = { { 29, 21, -1, -1, -1, -1, -1, -1 }, { 3, 5, 9, 1, -1, -1, -1, -1 }, { -1, -1, 4, -1, 2, -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 const int *table[6][8] = { { _1x1, _2x1, _3x1, _4x1, _5x1, _6x1, _7x1, _8x1 }, { _1x2, _2x2, _3x2, _4x2, _5x2, _6x2, _7x2, _8x2 }, { _1x3, _2x3, _3x3, _4x3, _5x3, _6x3, _7x3, _8x3 }, { _1x4, _2x4, _3x4, _4x4, _5x4, _6x4, _7x4, _8x4 }, { _1x5, _2x5, _3x5, _4x5, _5x5, _6x5, _7x5, _8x5 }, { _1x6, _2x6, _3x6, _4x6, _5x6, _6x6, _7x6, _8x6 }, }; #include <stdlib.h> int rand_impassable_SUBTERRANEAN(int x_dim, int y_dim) { int size = table_sizes[y_dim - 1][x_dim - 1]; return (-1 == size)? -1 : table[y_dim - 1][x_dim - 1][(rand()+1) % size]; }
the_stack_data/7950626.c
/* Example code for Exercises in C. Copyright 2016 Allen Downey License: Creative Commons Attribution-ShareAlike 3.0 */ #include <stdio.h> #include <stdlib.h> #include <string.h> // VALUE: represents a value in a key-value pair /* Here's one way of making a polymorphic object in C */ typedef struct { enum Type {INT, STRING} type; union { int i; char *s; }; } Value; /* Makes a Value object that contains an int. * * i: value to store. * * returns: pointer to a new Value */ Value *make_int_value(int i) { Value *value = (Value *) malloc (sizeof (Value)); value->type = INT; value->i = i; return value; } /* Makes a Value object that contains a string. * * s: value to store. * * returns: pointer to a new Value */ Value *make_string_value(char *s) { Value *value = (Value *) malloc (sizeof (Value)); value->type = STRING; value->s = s; return value; } /* Prints a value object. * * value: pointer to Value * */ void print_value (Value *value) { if (value == NULL) { printf ("%p", value); return; } switch (value->type) { case INT: printf ("%d", value->i); break; case STRING: printf ("%s", value->s); break; } } // HASHABLE: Represents a key in a key-value pair. /* Here's another way to make a polymorphic object. The key can be any pointer type. It's stored as a (void *), so when you extract it, you have to cast it back to whatever it is. `hash` is a pointer to a function that knows how to hash the key. `equal` is a pointer to a function that knows how to compare keys. */ typedef struct { void *key; int (*hash) (void *); int (*equal) (void *, void *); } Hashable; /* Makes a Hashable object. * * key: pointer to anything * hash: function that can hash keys * equal: function that compares keys * * returns: pointer to Hashable * */ Hashable *make_hashable(void *key, int (*hash) (void *), int (*equal) (void *, void *)) { Hashable *hashable = (Hashable *) malloc (sizeof (Hashable)); hashable->key = key; hashable->hash = hash; hashable->equal = equal; return hashable; } /* Prints a Hashable object. * * hashable: pointer to hashable */ void print_hashable(Hashable *hashable) { printf ("key %p\n", hashable->key); printf ("hash %p\n", hashable->hash); } /* Hashes an integer. * * p: pointer to integer * * returns: integer hash value */ int hash_int(void *p) { return *(int *)p; } /* Hashes a string. * * p: pointer to first char of a string * * returns: integer hash value */ int hash_string(void *p) { char *s = (char *) p; int total = 0; int i = 0; while (s[i] != 0) { total += s[i]; i++; } return total; } /* Hashes any Hashable. * * hashable: Hashable object * * returns: int hash value */ int hash_hashable(Hashable *hashable) { return hashable->hash (hashable->key); } /* Compares integers. * * ip: pointer to int * jp: pointer to int * * returns: 1 if equal, 0 otherwise */ int equal_int (void *ip, void *jp) { int val1 = *(int*) ip; int val2 = *(int*) jp; if (val1 == val2) { return 1; } return 0; } /* Compares strings. * * s1: pointer to first char of a string * s2: pointer to first char of a string * * returns: 1 if equal, 0 otherwise */ int equal_string (void *s1, void *s2) { char** string1 = (char**)s1; char** string2 = (char**)s2; int cmp = strcmp(*string1, *string2); if (cmp == 0) { return 1; } return 0; } /* Compares Hashables. * * h1: Hashable * h2: Hashable of the same type * * returns: 1 if equal, 0 otherwise * */ int equal_hashable(Hashable *h1, Hashable *h2) { return h1->equal(h1->key, h2->key); } /* Makes a Hashable int. * * Allocates space and copies the int. * * x: integer to store * * returns: Hashable */ Hashable *make_hashable_int (int x) { int *p = (int *) malloc (sizeof (int)); *p = x; return make_hashable((void *) p, hash_int, equal_int); } /* Makes a Hashable int. * * Stores a reference to the string (not a copy). * * s: string to store * * returns: Hashable */ Hashable *make_hashable_string (char *s) { return make_hashable((void *) s, hash_string, equal_string); } // NODE: a node in a list of key-value pairs typedef struct node { Hashable *key; Value *value; struct node *next; } Node; /* Makes a Node. */ Node *make_node(Hashable *key, Value *value, Node *next) { Node *node = (Node *) malloc (sizeof (Node)); node->key = key; node->value = value; node->next = next; return node; } /* Prints a Node. */ void print_node(Node *node) { print_hashable(node->key); printf ("value %p\n", node->value); printf ("next %p\n", node->next); } /* Prints all the Nodes in a list. */ void print_list(Node *node) { if (node == NULL) { return; } print_hashable(node->key); printf ("value %p\n", node->value); print_list(node->next); } /* Prepends a new key-value pair onto a list. This is actually a synonym for make_node. */ Node *prepend(Hashable *key, Value *value, Node *rest) { return make_node(key, value, rest); } /* Looks up a key and returns the corresponding value, or NULL */ Value *list_lookup(Node *list, Hashable *key) { while(list != NULL) { if(list->key == key) { return list->value; } list = list->next; } return NULL; } // MAP: a map is an array of lists of key-value pairs typedef struct map { int n; Node **lists; } Map; /* Makes a Map with n lists. */ Map *make_map(int n) { int i; Map *map = (Map *) malloc (sizeof (Map)); map->n = n; map->lists = (Node **) malloc (sizeof (Node *) * n); for (i=0; i<n; i++) { map->lists[i] = NULL; } return map; } /* Prints a Map. */ void print_map(Map *map) { int i; for (i=0; i<map->n; i++) { if (map->lists[i] != NULL) { printf ("%d\n", i); print_list (map->lists[i]); } } } /* Adds a key-value pair to a map. */ void map_add(Map *map, Hashable *key, Value *value) { Node* addition; int pos = hash_hashable(key) % map->n; if(map->lists[pos]) { addition = prepend(key, value, map->lists[pos]); } else { addition = make_node(key, value, NULL); } map->lists[pos] = addition; } /* Looks up a key and returns the corresponding value, or NULL. */ Value *map_lookup(Map *map, Hashable *key) { int pos = hash_hashable(key) % map->n; return list_lookup(map->lists[pos], key); } /* Prints the results of a test lookup. */ void print_lookup(Value *value) { printf ("Lookup returned "); print_value (value); printf ("\n"); } int main () { Hashable *hashable1 = make_hashable_int (1); Hashable *hashable2 = make_hashable_string ("Apple"); Hashable *hashable3 = make_hashable_int (2); // make a list by hand Value *value1 = make_int_value (17); Node *node1 = make_node(hashable1, value1, NULL); print_node (node1); Value *value2 = make_string_value ("Orange"); Node *list = prepend(hashable2, value2, node1); print_list (list); // run some test lookups Value *value = list_lookup (list, hashable1); print_lookup(value); value = list_lookup (list, hashable2); print_lookup(value); value = list_lookup (list, hashable3); print_lookup(value); // make a map Map *map = make_map(10); map_add(map, hashable1, value1); map_add(map, hashable2, value2); printf ("Map\n"); print_map(map); // run some test lookups value = map_lookup(map, hashable1); print_lookup(value); value = map_lookup(map, hashable2); print_lookup(value); value = map_lookup(map, hashable3); print_lookup(value); return 0; }
the_stack_data/626061.c
#include <stdio.h> #include <stdlib.h> int main(void) { puts("Hello Class"); return EXIT_SUCCESS; }
the_stack_data/151705114.c
////////////////////////////////////////////////////////////////////////////////// /* CE1007/CZ1007 Data Structures 2016/17 S1 Author and Lab Group: ALVIN LEE YONG TECK / FSP7 Program name: FSP7_ALVIN_LEE_YONG_TECK Date: 03 November 2016 Purpose: Implementing the required functions for Assignment 1 (Question 3)*/ ////////////////////////////////////////////////////////////////////////////////// #include <stdio.h> #include <stdlib.h> ////////////////////////////////////////////////////////////////////////////////// typedef struct _listnode { int item; struct _listnode *next; } ListNode; // You should not change the definition of ListNode typedef struct _linkedlist { int size; ListNode *head; } LinkedList; // You should not change the definition of LinkedList typedef struct _queue { LinkedList ll; } Queue; // You should not change the definition of Queue ///////////////////////// function prototypes //////////////////////////////////// // This is for question 3. You should not change the prototypes of these functions void createQueueFromLinkedList(LinkedList *ll, Queue *q); void removeOddValues(Queue *q); void enqueue(Queue *q, int item); int dequeue(Queue *q); int isEmptyQueue(Queue *q); void removeAllItemsFromQueue(Queue *q); // You may use the following functions or you may write your own void printList(LinkedList *ll); void removeAllItems(LinkedList *ll); ListNode * findNode(LinkedList *ll, int index); int insertNode(LinkedList *ll, int index, int value); int removeNode(LinkedList *ll, int index); //////////////////////////// main() ////////////////////////////////////////////// int main() { int c, i; LinkedList ll; Queue q; c = 1; // Initialize the linked list as an empty linked list ll.head = NULL; ll.size = 0; // Initialize the Queue as an empty queue q.ll.head = NULL; q.ll.size = 0; printf("1: Insert an integer into the linked list:\n"); printf("2: Create the queue from the linked list:\n"); printf("3: Remove odd numbers from the queue:\n"); printf("0: Quit:\n"); while (c != 0) { printf("Please input your choice(1/2/3/0): "); scanf("%d", &c); switch (c) { case 1: printf("Input an integer that you want insert into the List: "); scanf("%d", &i); insertNode(&ll, ll.size, i); printf("The resulting linked list is: "); printList(&ll); break; case 2: createQueueFromLinkedList(&ll, &q); // You need to code this function printf("The resulting queue is: "); printList(&q.ll); break; case 3: removeOddValues(&q); // You need to code this function printf("The resulting queue after removing odd integers is: "); printList(&q.ll); removeAllItemsFromQueue(&q); removeAllItems(&ll); break; case 0: removeAllItemsFromQueue(&q); removeAllItems(&ll); break; default: printf("Choice unknown;\n"); break; } } return 0; } ////////////////////////////////////////////////////////////////////////////////// void createQueueFromLinkedList(LinkedList *ll, Queue *q) { ListNode *cur; // Declare ListNote cur (a.k.a current) to navigate the LinkedList int i; // Declare 'for' loop index i for looping // If the Queue q is not empty... if (!isEmptyQueue(q)) { removeAllItemsFromQueue(q); // Remove all the items from Queue q } cur = ll->head; // Let ListNode cur be the first ll's head (ll->head) // Loop through the LinkedList ll from index 0 to the size of ll for (i = 0; i < ll->size; i++) { enqueue(q, cur->item); // Enqueue the current item into Queue q cur = cur->next; // Navigate ListNode cur to the next listnode } } void removeOddValues(Queue *q) { int i; // Declare 'for' loop index i for looping int output; // Declare the 'output' to store the dequeue's output int size; // Declare the 'size' for Queue size = q->ll.size; // Set the 'size' to be the size of Queue q (q->ll.size) // Loop from index 0 to the size of Queue q (Number of times to dequeue) for (i = 0; i < size; i++) { output = dequeue(q); // Store the dequeue's output into 'output' // If output divided by 2 has a remainder of 0... // *Even number* if (output % 2 == 0) { enqueue(q, output); // Enqueue the EVEN number output into the back of Queue q } } } ////////////////////////////////////////////////////////////////////////////////// void enqueue(Queue *q, int item) { insertNode(&(q->ll), q->ll.size, item); } int dequeue(Queue *q) { int item; if (!isEmptyQueue(q)) { item = ((q->ll).head)->item; removeNode(&(q->ll), 0); return item; } return -1; } int isEmptyQueue(Queue *q) { if ((q->ll).size == 0) return 1; return 0; } void removeAllItemsFromQueue(Queue *q) { int count, i; if (q == NULL) return; count = q->ll.size; for (i = 0; i < count; i++) dequeue(q); } void printList(LinkedList *ll) { ListNode *cur; if (ll == NULL) return; cur = ll->head; if (cur == NULL) printf("Empty"); while (cur != NULL) { printf("%d ", cur->item); cur = cur->next; } printf("\n"); } void removeAllItems(LinkedList *ll) { ListNode *cur = ll->head; ListNode *tmp; while (cur != NULL) { tmp = cur->next; free(cur); cur = tmp; } ll->head = NULL; ll->size = 0; } ListNode * findNode(LinkedList *ll, int index) { ListNode *temp; if (ll == NULL || index < 0 || index >= ll->size) return NULL; temp = ll->head; if (temp == NULL || index < 0) return NULL; while (index > 0) { temp = temp->next; if (temp == NULL) return NULL; index--; } return temp; } int insertNode(LinkedList *ll, int index, int value) { ListNode *pre, *cur; if (ll == NULL || index < 0 || index > ll->size + 1) return -1; // If empty list or inserting first node, need to update head pointer if (ll->head == NULL || index == 0) { cur = ll->head; ll->head = malloc(sizeof(ListNode)); if (ll->head == NULL) { exit(0); } ll->head->item = value; ll->head->next = cur; ll->size++; return 0; } // Find the nodes before and at the target position // Create a new node and reconnect the links if ((pre = findNode(ll, index - 1)) != NULL) { cur = pre->next; pre->next = malloc(sizeof(ListNode)); if (pre->next == NULL) { exit(0); } pre->next->item = value; pre->next->next = cur; ll->size++; return 0; } return -1; } int removeNode(LinkedList *ll, int index) { ListNode *pre, *cur; // Highest index we can remove is size-1 if (ll == NULL || index < 0 || index >= ll->size) return -1; // If removing first node, need to update head pointer if (index == 0) { cur = ll->head->next; free(ll->head); ll->head = cur; ll->size--; return 0; } // Find the nodes before and after the target position // Free the target node and reconnect the links if ((pre = findNode(ll, index - 1)) != NULL) { if (pre->next == NULL) return -1; cur = pre->next; pre->next = cur->next; free(cur); ll->size--; return 0; } return -1; }
the_stack_data/14200037.c
int testswitch(int i) { switch (i) { case 0: i = i + 1; break; case 1: i = i - 4; break; case 4: case 2: i = i + 5; break; default: i++; break; } return i; } int TestNano(void) { if (testswitch(0) == 1 && testswitch(1) == -3 && testswitch(2) == 7 && testswitch(4) == 9 && testswitch(7) == 8) return 0; return 1; }
the_stack_data/18759.c
#include <stdio.h> int max(int num1, int num2) { int result; if (num1 > num2) result = num1; else result = num2; return result; } int main() { printf("%d", max(3, 32)); return 0; }
the_stack_data/150144535.c
#include <unistd.h> void mx_printchar(char c); void mx_printint(int num) { if (num == -2147483648) { write(1, "-2147483648", 11); return; } if (num < 0) { mx_printchar('-'); num *= -1; } if (num > 9) mx_printint(num / 10); mx_printchar(num % 10 + 48); }
the_stack_data/212644532.c
#include <stdio.h> #include <string.h> #include <stdlib.h> typedef struct { char titulo[30]; char autor[15]; int ano; }livros; int main(){ int N,i; printf("Quantos livros?"); scanf("%d",&N); livros p[N]; for(i=0;i<N;i++){ printf("Qual o titulo do livro:"); scanf(" %[^\n]s",p[i].titulo); printf("Qual o nome do autor:"); scanf(" %[^\n]s",p[i].autor); printf("Qual ano foi publicado:"); scanf("%d",&p[i].ano); } char titulo[30]; printf("Digite o livro pra consultar?"); scanf(" %[^\n]s",titulo); printf("Resultao da consulta: %s\n",titulo); for(i=0;i<N;i++){ if(strstr(p[i].titulo,titulo)!=NULL) printf("Resultado(%d)=%s\n",(i+1),p[i].titulo); } }
the_stack_data/206393993.c
#include <stdio.h> int main () { int var1, var2 ; int *ptr1, *ptr2 ; int **pPtr; // A Pointer to a Pointer var1 = 1000; var2 = 2000; /* take the address of var */ ptr1 = &var1; ptr2 = &var2; /* take the address of ptr1 using address of operator & */ pPtr = &ptr1; /* take the value using pptr */ printf("Value of var1 = %d\n", var2 ); printf("Value available at *ptr1 = %d\n", *ptr1 ); printf("Value available at **pPtr = %d\n", **pPtr); /* change to the address of ptr2 using address of operator & */ pPtr = &ptr2; /* take the value using pptr */ printf("Value of var2 = %d\n", var2 ); printf("Value available at *ptr2 = %d\n", *ptr2 ); printf("Value available at **pPtr = %d\n", **pPtr); return 0; }