file
stringlengths
18
26
data
stringlengths
3
1.04M
the_stack_data/192331117.c
#include <stdio.h> void up_down(int); int main(void) { up_down(1); return 0; } void up_down(int n) { printf("level %d: n location %p\n", n, &n); if (n < 4) up_down(n+1); printf("LEVEL %d: n location %p\n", n, &n); }
the_stack_data/33586.c
int mx_factorial_iter(int n); int mx_factorial_iter(int n){ if(n < 1) return 0; int r = 1; for(int i = 1; i <= n; i++) if(r * i > 2147483647) return 0; else r *= i; return r; }
the_stack_data/70450963.c
void kernel(int* in, int** out, int width, int height) { int* results = (int*)calloc(width * height, sizeof(int*)); for(int i=0; i<height; i++) { for(int j=0; j<width; j++){ // do something here } } out = results; }
the_stack_data/1163728.c
#include <stdio.h> int main(int argc, char **argv) { if (argc!=2) { printf("Usage : strlen <string>\n"); } else { printf("Size: %d \"%s\"\n\n", strlen(argv[1]), argv[1]); } return 0 ; }
the_stack_data/1390.c
#include <stdio.h> /* *这是最简单的Hello程序 * 一切都从这个开始! * */ int main(int argc, char **argv) { printf("Hello world!\n"); return 0; }
the_stack_data/59297.c
/* * GRUB -- GRand Unified Bootloader * Copyright (C) 2001 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 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifdef FSYS_VSTAFS #include "shared.h" #include "filesys.h" #include "vstafs.h" static void get_file_info (int sector); static struct dir_entry *vstafs_readdir (long sector); static struct dir_entry *vstafs_nextdir (void); #define FIRST_SECTOR ((struct first_sector *) FSYS_BUF) #define FILE_INFO ((struct fs_file *) (int) FIRST_SECTOR + 8192) #define DIRECTORY_BUF ((struct dir_entry *) (int) FILE_INFO + 512) #define ROOT_SECTOR 1 /* * In f_sector we store the sector number in which the information about * the found file is. */ extern int filepos; static int f_sector; int vstafs_mount (void) { int retval = 1; if( (((current_drive & 0x80) || (current_slice != 0)) && current_slice != PC_SLICE_TYPE_VSTAFS) || ! devread (0, 0, BLOCK_SIZE, (char *) FSYS_BUF) || FIRST_SECTOR->fs_magic != 0xDEADFACE) retval = 0; return retval; } static void get_file_info (int sector) { devread (sector, 0, BLOCK_SIZE, (char *) FILE_INFO); } static int curr_ext, current_direntry, current_blockpos; static struct alloc *a; static struct dir_entry * vstafs_readdir (long sector) { /* * Get some information from the current directory */ get_file_info (sector); if (FILE_INFO->type != 2) { errnum = ERR_FILE_NOT_FOUND; return 0; } a = FILE_INFO->blocks; curr_ext = 0; devread (a[curr_ext].a_start, 0, 512, (char *) DIRECTORY_BUF); current_direntry = 11; current_blockpos = 0; return &DIRECTORY_BUF[10]; } static struct dir_entry * vstafs_nextdir (void) { if (current_direntry > 15) { current_direntry = 0; if (++current_blockpos > (a[curr_ext].a_len - 1)) { current_blockpos = 0; curr_ext++; } if (curr_ext < FILE_INFO->extents) { devread (a[curr_ext].a_start + current_blockpos, 0, 512, (char *) DIRECTORY_BUF); } else { /* errnum =ERR_FILE_NOT_FOUND; */ return 0; } } return &DIRECTORY_BUF[current_direntry++]; } int vstafs_dir (char *dirname) { char *fn, ch; struct dir_entry *d; /* int l, i, s; */ /* * Read in the entries of the current directory. */ f_sector = ROOT_SECTOR; do { if (! (d = vstafs_readdir (f_sector))) { return 0; } /* * Find the file in the path */ while (*dirname == '/') dirname++; fn = dirname; while ((ch = *fn) && ch != '/' && ! isspace (ch)) fn++; *fn = 0; do { if (d->name[0] == 0 || d->name[0] & 0x80) continue; #ifndef STAGE1_5 if (print_possibilities && ch != '/' && (! *dirname || strcmp (dirname, d->name) <= 0)) { if (print_possibilities > 0) print_possibilities = -print_possibilities; printf (" %s", d->name); } #endif if (! grub_strcmp (dirname, d->name)) { f_sector = d->start; get_file_info (f_sector); filemax = FILE_INFO->len; break; } } while ((d =vstafs_nextdir ())); *(dirname = fn) = ch; if (! d) { if (print_possibilities < 0) { putchar ('\n'); return 1; } errnum = ERR_FILE_NOT_FOUND; return 0; } } while (*dirname && ! isspace (ch)); return 1; } int vstafs_read (char *addr, int len) { struct alloc *a; int size, ret = 0, offset, curr_len = 0; int curr_ext; char extent; int ext_size; char *curr_pos; get_file_info (f_sector); size = FILE_INFO->len-VSTAFS_START_DATA; a = FILE_INFO->blocks; if (filepos > 0) { if (filepos < a[0].a_len * 512 - VSTAFS_START_DATA) { offset = filepos + VSTAFS_START_DATA; extent = 0; curr_len = a[0].a_len * 512 - offset - filepos; } else { ext_size = a[0].a_len * 512 - VSTAFS_START_DATA; offset = filepos - ext_size; extent = 1; do { curr_len -= ext_size; offset -= ext_size; ext_size = a[extent+1].a_len * 512; } while (extent < FILE_INFO->extents && offset>ext_size); } } else { offset = VSTAFS_START_DATA; extent = 0; curr_len = a[0].a_len * 512 - offset; } curr_pos = addr; if (curr_len > len) curr_len = len; for (curr_ext=extent; curr_ext < FILE_INFO->extents; curr_len = a[curr_ext].a_len * 512, curr_pos += curr_len, curr_ext++) { ret += curr_len; size -= curr_len; if (size < 0) { ret += size; curr_len += size; } devread (a[curr_ext].a_start,offset, curr_len, curr_pos); offset = 0; } return ret; } #endif /* FSYS_VSTAFS */
the_stack_data/151726.c
#include <stdio.h> #include <stdlib.h> #include <string.h> #define SEPARATORS " .,;:+*-/!?'()\t\n\"\\<>" /* L'indice si costruisce in memoriasotto forma di una lista di parole che conserva anche il numero di occorrenze trovate di ogni parola */ typedef struct st_Elem { char wor[30]; /* La parola */ int occ; /* Il numero di occorrenze */ struct st_Elem* next; } Node; Node* ins_ord( Node*, char*); /* Inserimento ordinato "condizionato" nell'indice di parole */ int isSep(char); void writeToFile(Node*, FILE*); void dealloca(Node*); int mf = 0; /* Misura la massima frequenza di una parola nel file - Può servire a qualcosa conoscerla? */ int leggiParola(FILE* fp, char* s) { int i = 0; char c; while ((c = fgetc(fp)) != EOF && !isSep(c)) { s[i] = c; i++; } s[i] = '\0'; return c == EOF ? EOF : 1; } Node* costruisciIndice(FILE* fp) { Node* index = NULL; char* s = malloc(30 * sizeof(char)); while (leggiParola(fp, s) != EOF) { if (strlen(s) > 3) { index = ins_ord(index, s); } } return index; } int main() { FILE* fp; // char * filein = "divinacommedia_input.txt"; char* filein = "dolcenera_tutta.txt"; // char* filein = "dolcenera_incipit.txt"; char* fileout = "Indice_Parole_output.txt"; if ((fp = fopen(filein, "r")) == NULL) { printf("\n\n ERRORE APERTURA FILE %s IN LETTURA\n\n", filein); return -1; } // costruisco indice Node* index = costruisciIndice(fp); fclose(fp); /* riuso fp */ if (!(fp = fopen(fileout, "w"))) { printf("Errore aprendo %s in scrittura", fileout); return -2; } writeToFile(index, fp); /* Stampa l'indice, inizialmente vuoto */ fclose(fp); /* posso già chiudere il file */ printf("\n\n"); writeToFile(index, stdout); /* Stampa l'indice... anche a schermo! Barbatrucco! */ printf("\n\n (max freq: %d)\n", mf); dealloca(index); return 0; } /*** Ben tre funzioni omaggio - ben più di un qualsiasi Cashback! ***/ Node* ins_ord(Node* head, char w[]) { Node *cur = head, *prev = NULL; /* Due puntatori di supporto */ Node* t; while (cur != NULL && strcmp(cur->wor, w) <= 0) { prev = cur; cur = cur->next; } if (prev != NULL && strcmp(prev->wor, w) == 0) { prev->occ += 1; if (prev->occ > mf) /* PER TROVARE LA MASSIMA FREQUENZQA, che è una variabile globale */ mf = prev->occ; return head; } t = (Node*)malloc(sizeof(Node)); strcpy(t->wor, w); t->occ = 1; t->next = cur; if (prev == NULL) return t; else { prev->next = t; return head; } } /* returns 1 if c is in SEPARATORS, 0 otherwise */ int isSep(char c) { char* s = SEPARATORS; while (*s != '\0') if (*(s++) == c) return 1; return 0; } void writeToFile(Node* h, FILE* fp) { if (h == NULL) fprintf(fp, "INDICE VUOTO\n"); while (h != NULL) { fprintf(fp, "%s (%d)\n", h->wor, h->occ); h = h->next; } return; } void dealloca(Node* p) { if (p != NULL) { dealloca(p->next); free(p); } return; }
the_stack_data/76700423.c
/**************************************************************************** **************************************************************************** * * * Copyright (C) 2018 Genome Research Ltd. * * * * Author: Zemin Ning ([email protected]) * * * * This file is part of ScaffHiC pipeline. * * * * ScaffHiC is a 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 3 of the License, or (at your * * option) any later version. * * * * This program is distributed in the hope that it will be useful, but * * WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * * General Public License for more details. * * * * You should have received a copy of the GNU General Public License along * * with this program. If not, see <http://www.gnu.org/licenses/>. * * * **************************************************************************** ****************************************************************************/ /****************************************************************************/ #include <math.h> #include <values.h> #include <stdio.h> #include <netinet/in.h> #include <stdlib.h> #include <dirent.h> #include <string.h> #include <ctype.h> #define PADCHAR '-' #define Max_N_NameBase 60 static char **S_Name,**R_Name; static int *hit_rddex,*hit_score,*hit_rcdex,*hit_locus1,*superlength,*hit_matlocu1,*hit_matlocu2,*hit_matindex; static int *ctg_length,*hit_index; static int *hic_order,*hic_sfdex,*hic_index,*hic_length,*hic_rcdex,*hic_mscore,*hic_list,*hic_head; /* SSAS default parameters */ static int IMOD=0; static int nContig=0; static int file_flag = 1; static int min_len = 100000; static int max_ctg = 1000000; static int n_depth = 60; static float m_score = 200.0; static float d_score = 0.8; static float c_score = 1.0; static int i_getindex = 742; static int j_getindex = 788; int main(int argc, char **argv) { FILE *namef; int i,nSeq,args,idt; int n_contig,n_reads,nseq,num_hics; int num_hit,stopflag,j; void Matrix_Process(char **argv,int args,int nSeq,int nRead); char *st,*ed; char line[2000]={0},tempc1[60],rdname[60],tmptext[60]; char **cmatrix(long nrl,long nrh,long ncl,long nch); if(argc < 2) { printf("Usage: %s -depth 60 -score 200 <Input_HiC-alignment> <Output_matrix_agp>\n",argv[0]); exit(1); } nSeq=0; args=1; for(i=1;i<argc;i++) { if(!strcmp(argv[i],"-mod")) { sscanf(argv[++i],"%d",&IMOD); args=args+2; } else if(!strcmp(argv[i],"-depth")) { sscanf(argv[++i],"%d",&n_depth); args=args+2; } else if(!strcmp(argv[i],"-len")) { sscanf(argv[++i],"%d",&min_len); args=args+2; } else if(!strcmp(argv[i],"-score")) { sscanf(argv[++i],"%f",&m_score); args=args+2; } else if(!strcmp(argv[i],"-index")) { sscanf(argv[++i],"%d",&i_getindex); args=args+2; } else if(!strcmp(argv[i],"-file")) { sscanf(argv[++i],"%d",&file_flag); args=args+2; } } fflush(stdout); if(system("ps aux | grep scaffHiC_ori; date") == -1) { // printf("System command error:\n); } nseq=0; if((namef = fopen(argv[args],"r")) == NULL) { printf("ERROR main:: args \n"); exit(1); } while(!feof(namef)) { if(fgets(line,2000,namef) == NULL) { // printf("fgets command error:\n); } if(feof(namef)) break; nseq++; } fclose(namef); if((hit_rddex = (int *)calloc(nseq,sizeof(int))) == NULL) { printf("fmate: calloc - insert\n"); exit(1); } if((hit_score = (int *)calloc(nseq,sizeof(int))) == NULL) { printf("fmate: calloc - hit_score\n"); exit(1); } if((hit_rcdex = (int *)calloc(nseq,sizeof(int))) == NULL) { printf("fmate: calloc - hit_rcdex\n"); exit(1); } if((hit_locus1 = (int *)calloc(nseq,sizeof(int))) == NULL) { printf("fmate: calloc - hit_locus1\n"); exit(1); } if((ctg_length = (int *)calloc(nseq,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_length\n"); exit(1); } if((superlength = (int *)calloc(nseq,sizeof(int))) == NULL) { printf("fmate: calloc - superlength\n"); exit(1); } if((hit_index = (int *)calloc(nseq,sizeof(int))) == NULL) { printf("fmate: calloc - hit_index\n"); exit(1); } nSeq=nseq; R_Name=cmatrix(0,nseq+10,0,Max_N_NameBase); n_contig=0; n_reads=0; printf("reads: %d %s\n",nseq,argv[args]); if((namef = fopen(argv[args],"r")) == NULL) { printf("ERROR main:: reads group file \n"); exit(1); } /* read the alignment files */ i=0; max_ctg = 0; while(fscanf(namef,"%s %s %d %d %s %d",R_Name[i],rdname,&hit_locus1[i],&hit_score[i],tempc1,&superlength[i])!=EOF) { st = rdname; ed = strrchr(rdname,'_'); idt = atoi(ed+1); if(idt > max_ctg) max_ctg = idt; ctg_length[idt] = superlength[i]; hit_index[i] = idt; i++; } fclose(namef); n_reads=i; nseq=0; if((namef = fopen(argv[args+1],"r")) == NULL) { printf("ERROR main:: args \n"); exit(1); } while(!feof(namef)) { if(fgets(line,2000,namef) == NULL) { // printf("fgets command error:\n); } if(feof(namef)) break; nseq++; } fclose(namef); if((hic_order= (int *)calloc(nseq,sizeof(int))) == NULL) { printf("ERROR Memory_Allocate: Align_Process - hic_order\n"); exit(1); } if((hic_sfdex= (int *)calloc(nseq,sizeof(int))) == NULL) { printf("ERROR Memory_Allocate: Align_Process - hic_sfdex\n"); exit(1); } if((hic_index= (int *)calloc(nseq,sizeof(int))) == NULL) { printf("ERROR Memory_Allocate: Align_Process - hic_index\n"); exit(1); } if((hic_length= (int *)calloc(nseq,sizeof(int))) == NULL) { printf("ERROR Memory_Allocate: Align_Process - hic_length\n"); exit(1); } if((hic_rcdex= (int *)calloc(nseq,sizeof(int))) == NULL) { printf("ERROR Memory_Allocate: Align_Process - hic_rcdex\n"); exit(1); } if((hic_mscore= (int *)calloc(nseq,sizeof(int))) == NULL) { printf("ERROR Memory_Allocate: Align_Process - hic_mscore\n"); exit(1); } if((hic_list= (int *)calloc(nseq,sizeof(int))) == NULL) { printf("ERROR Memory_Allocate: Align_Process - hic_list\n"); exit(1); } if((hic_head= (int *)calloc(nseq,sizeof(int))) == NULL) { printf("ERROR Memory_Allocate: Align_Process - hic_head\n"); exit(1); } if((namef = fopen(argv[args+1],"r")) == NULL) { printf("ERROR main:: reads group file \n"); exit(1); } i = 0; while(fscanf(namef,"%s %d %d %d %d %d",tmptext,&hic_sfdex[i],&hic_index[i],&hic_length[i],&hic_rcdex[i],&hic_order[i])!=EOF) { st = strrchr(tmptext,':'); hic_mscore[i] = atoi(st+1); i++; } fclose(namef); num_hics = i; num_hit = 0; for(i=0;i<num_hics;i++) { stopflag=0; j=i+1; while((j<num_hics)&&(stopflag==0)) { if(hic_sfdex[j]==hic_sfdex[i]) { j++; } else stopflag=1; } hic_list[num_hit] = j-i; num_hit++; i=j-1; } hic_head[0] = 0; for(i=1;i<=num_hit;i++) { hic_head[i] = hic_head[i-1] + hic_list[i-1]; } num_hics = num_hit; Matrix_Process(argv,args,n_reads,num_hics); printf("Job finished for %d reads!\n",n_reads); return EXIT_SUCCESS; } /* end of the main */ /* subroutine to sort out read pairs */ /* =============================== */ void Matrix_Process(char **argv,int args,int nSeq, int num_hics) /* =============================== */ { int i,j,k,m,n,n_scaff,n_blocks; FILE *namef; int *ctg_list,*ptp_list,*ptn_list,*ctg_print; long num_cells,n_Bases; int num_hits,num_hit1,num_hit2,rcdex,rsize,rsize2,size_row; int stopflag,offset,*ray,*dex; void ArraySort_Mix(int n, long *arr, int *brr); void ArraySort_float2(int n, float *arr, int *brr); char **DBname,*st,*ed; int **p_matrix,**PP_matrix,**PN_matrix,**PO_matrix,**s_matrix,**s2_matrix,**o_matrix,**r_matrix,**rc0_matrix,**rc1_matrix,**rc2_matrix,**rc3_matrix,**rc_matrix,**rcdex_matrix,**ono_matrix; float rate,c_score1,c_score2,*Dis_index,*Dis_ratia1,*Dis_ratia2,*Dis_score1,*Dis_score2; int **imatrix(long nrl,long nrh,long ncl,long nch); float **fmatrix(long nrl,long nrh,long ncl,long nch); void ArraySort2_Int2(int n, int *arr, int *brr); void ArraySort_Int2(int n, int *arr, int *brr); void Reads_Distribution(int n, int m, int *arr, int *brr); int *ctg_score1,*ctg_score2,*ctg_mapp1,*ctg_mapp2,*ctg_join1,*ctg_join2,*ctg_idex1,*ctg_idex2,*ctg_mask,*ctg_rcdex1; int *p_index,*p_rcdex,*p_masks,*p_score,*p_lists; int *ctg_rcoo1,*ctg_rcoo2,*ctg_part1,*ctg_part2,*ctg_patnum; int *ctg_output,*ctg_hitnum,*ctg_used,*ctg_links,*ctg_oodex1,*ctg_oodex2,*ctg_rcindex,*ctg_mpindex,*ctg_outrc; int *hit_linksdex,*link_locus,*link_locu2,*link_locu3,*head_locus; int n_length = min_len; rsize = max_ctg+10; n_blocks = rsize*rsize; if((ctg_idex1 = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_idex1\n"); exit(1); } if((ctg_idex2 = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_idex2\n"); exit(1); } if((ctg_rcdex1 = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_mapp1\n"); exit(1); } if((ctg_mapp1 = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_mapp1\n"); exit(1); } if((ctg_mapp2 = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_mapp2\n"); exit(1); } if((ctg_part1 = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_part1\n"); exit(1); } if((ctg_part2 = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_part2\n"); exit(1); } if((ctg_score1 = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_score1\n"); exit(1); } if((ctg_score2 = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_score2\n"); exit(1); } if((ctg_join1 = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_join1\n"); exit(1); } if((ctg_join2 = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_join2\n"); exit(1); } if((ctg_mask = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_mask\n"); exit(1); } if((ctg_oodex1 = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_oodex1\n"); exit(1); } if((ctg_oodex2 = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_oodex2\n"); exit(1); } if((ctg_rcoo1 = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_rcoo1\n"); exit(1); } if((ctg_rcoo2 = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_rcoo2\n"); exit(1); } if((ctg_hitnum = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_hitnum\n"); exit(1); } if((ctg_patnum = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_pattnum\n"); exit(1); } if((ctg_output = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_output\n"); exit(1); } if((ctg_used = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_used\n"); exit(1); } if((ctg_links = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_links\n"); exit(1); } if((ctg_rcindex = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_rcindex\n"); exit(1); } if((ctg_outrc = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_outrc\n"); exit(1); } if((ctg_list = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_list\n"); exit(1); } if((ptp_list = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - ptp_list\n"); exit(1); } if((ptn_list = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - ptn_list\n"); exit(1); } if((ctg_print = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_print\n"); exit(1); } if((ctg_mpindex = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_mpindex\n"); exit(1); } if((Dis_index = (float *)calloc(rsize,sizeof(float))) == NULL) { printf("fmate: calloc - Dis_index\n"); exit(1); } if((Dis_ratia1 = (float *)calloc(rsize,sizeof(float))) == NULL) { printf("fmate: calloc - Dis_index\n"); exit(1); } if((Dis_ratia2 = (float *)calloc(rsize,sizeof(float))) == NULL) { printf("fmate: calloc - Dis_index\n"); exit(1); } if((Dis_score1 = (float *)calloc(rsize,sizeof(float))) == NULL) { printf("fmate: calloc - Dis_score1\n"); exit(1); } if((Dis_score2 = (float *)calloc(rsize,sizeof(float))) == NULL) { printf("fmate: calloc - Dis_score2\n"); exit(1); } if((p_index = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - p_index\n"); exit(1); } if((p_rcdex = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - p_rcdex\n"); exit(1); } if((p_score = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - p_score\n"); exit(1); } if((p_masks = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - p_mask\n"); exit(1); } if((p_lists = (int *)calloc(rsize,sizeof(int))) == NULL) { printf("fmate: calloc - p_lists\n"); exit(1); } if((link_locus = (int *)calloc(n_blocks,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_links\n"); exit(1); } if((head_locus = (int *)calloc(n_blocks,sizeof(int))) == NULL) { printf("fmate: calloc - head_locus\n"); exit(1); } if((link_locu2 = (int *)calloc(n_blocks,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_links\n"); exit(1); } if((link_locu3 = (int *)calloc(n_blocks,sizeof(int))) == NULL) { printf("fmate: calloc - ctg_links\n"); exit(1); } printf("contigs: %d %d %d\n",rsize,max_ctg,nSeq); size_row = n_depth; p_matrix=imatrix(0,rsize,0,rsize); PP_matrix=imatrix(0,rsize,0,100); PN_matrix=imatrix(0,rsize,0,100); PO_matrix=imatrix(0,rsize,0,100); s_matrix=imatrix(0,rsize,0,rsize); s2_matrix=imatrix(0,rsize,0,rsize); o_matrix=imatrix(0,rsize,0,rsize); r_matrix=imatrix(0,rsize,0,rsize); rc0_matrix=imatrix(0,rsize,0,rsize); rc1_matrix=imatrix(0,rsize,0,rsize); rc2_matrix=imatrix(0,rsize,0,rsize); rc3_matrix=imatrix(0,rsize,0,rsize); rc_matrix=imatrix(0,rsize,0,rsize); ono_matrix=imatrix(0,rsize,0,rsize); rcdex_matrix=imatrix(0,rsize,0,rsize); num_hits =0; k = 0; offset = 0; for(i=0;i<nSeq;i++) { stopflag=0; j=i+1; while((j<nSeq)&&(stopflag==0)) { if(strcmp(R_Name[i],R_Name[j])==0) { j++; } else stopflag=1; } if((j-i)>=2) { int idi,idt,len1,len2,loci1,loci2; if(hit_index[i] < hit_index[i+1]) { idi = hit_index[i]; idt = hit_index[i+1]; len1 = superlength[i]/2; len2 = superlength[i+1]/2; loci1 = hit_locus1[i]; loci2 = hit_locus1[i+1]; } else { idi = hit_index[i+1]; idt = hit_index[i]; len2 = superlength[i]/2; len1 = superlength[i+1]/2; loci2 = hit_locus1[i]; loci1 = hit_locus1[i+1]; } if(loci1 < len1) { if(loci2 < len2) { rc0_matrix[idi][idt]++; } else { rc2_matrix[idi][idt]++; } } else { if(loci2 < len2) { rc1_matrix[idi][idt]++; } else { rc3_matrix[idi][idt]++; } } } else { printf("www: %s %d\n",R_Name[i],superlength[i]); } i=j-1; } for(i=0;i<max_ctg;i++) { for(j=0;j<max_ctg;j++) { if(j>i) { rc0_matrix[j][i] = rc0_matrix[i][j]; rc1_matrix[j][i] = rc2_matrix[i][j]; rc2_matrix[j][i] = rc1_matrix[i][j]; rc3_matrix[j][i] = rc3_matrix[i][j]; } } } for(i=0;i<max_ctg;i++) { for(j=0;j<max_ctg;j++) { r_matrix[i][j] = rc0_matrix[i][j]+rc1_matrix[i][j]+rc2_matrix[i][j]+rc3_matrix[i][j]; } } num_cells = 0; for(i=0;i<max_ctg;i++) { for(j=0;j<max_ctg;j++) { int idh = i*max_ctg; hit_rddex[j] = j; num_cells = num_cells+r_matrix[i][j]; link_locu3[idh+j] = r_matrix[i][j]; } } for(i=0;i<max_ctg;i++) { ctg_part1[i] = -1; ctg_part2[i] = -1; ctg_mapp1[i] = -1; ctg_mapp2[i] = -1; ctg_rcdex1[i] = -1; } head_locus[0] = 0; for(i=1;i<n_blocks;i++) { head_locus[i] = head_locus[i-1] + link_locu3[i-1]; } if((hit_matlocu1 = (int *)calloc(num_cells,sizeof(int))) == NULL) { printf("fmate: calloc - hit_matlocus\n"); exit(1); } if((hit_matlocu2 = (int *)calloc(num_cells,sizeof(int))) == NULL) { printf("fmate: calloc - hit_matlocus\n"); exit(1); } if((hit_matindex = (int *)calloc(num_cells,sizeof(int))) == NULL) { printf("fmate: calloc - hit_matindex\n"); exit(1); } if((hit_linksdex = (int *)calloc(num_cells,sizeof(int))) == NULL) { printf("fmate: calloc - hit_linksdex\n"); exit(1); } for(i=0;i<num_cells;i++) hit_linksdex[i] = i; for(i=0;i<nSeq;i++) { stopflag=0; j=i+1; while((j<nSeq)&&(stopflag==0)) { if(strcmp(R_Name[i],R_Name[j])==0) { j++; } else stopflag=1; } if((j-i)>=2) { int idi,idt,ikk,len1,len2,loci1,loci2; int idh1,idh2; if(hit_index[i] < hit_index[i+1]) { idi = hit_index[i]; idt = hit_index[i+1]; len1 = superlength[i]/2; len2 = superlength[i+1]/2; loci1 = hit_locus1[i]; loci2 = hit_locus1[i+1]; } else { idi = hit_index[i+1]; idt = hit_index[i]; len2 = superlength[i]/2; len1 = superlength[i+1]/2; loci2 = hit_locus1[i]; loci1 = hit_locus1[i+1]; } idh1 = idi*max_ctg+idt; idh2 = idt*max_ctg+idi; hit_matlocu1[head_locus[idh1]+link_locus[idh1]] = loci1; hit_matlocu1[head_locus[idh2]+link_locu2[idh2]] = loci2; link_locus[idh1]++; link_locu2[idh2]++; } else { printf("www: %s %d\n",R_Name[i],superlength[i]); } i=j-1; } n_Bases = 0; for(i=0;i<max_ctg;i++) n_Bases = n_Bases + ctg_length[i]; for(i=0;i<max_ctg;i++) { for(j=0;j<max_ctg;j++) hit_rddex[j] = j; Dis_index[i] = 0.0; ArraySort2_Int2(max_ctg,r_matrix[i],hit_rddex); memset(ctg_rcindex,0,4*max_ctg); printf("scaffold: %d %d %d\n",i,max_ctg,ctg_length[i]); printf("matrix: %d %d\n",i,ctg_length[i]); for(j=0;j<size_row;j++) { int idi,idj,offset1,offset2; int idd = hit_rddex[j]; int n_pairs = r_matrix[i][j]; int n_pairs_half = n_pairs/2; float rr1,rr2,rat1,rat2,sq1,sq2; int halflen_1,halflen_2,half_len1,half_len2; int rcindex1,rcindex2,rcindex; rcindex1 = 1; rcindex2 = 1; idi = i; idj = hit_rddex[j]; offset1 = head_locus[idi*max_ctg+idj]; offset2 = head_locus[idj*max_ctg+idi]; ray = hit_matlocu1; dex = hit_linksdex; ArraySort_Int2(n_pairs,ray+offset1,dex+offset1); ArraySort_Int2(n_pairs,ray+offset2,dex+offset2); halflen_1 = hit_matlocu1[offset1+n_pairs_half]; halflen_2 = hit_matlocu1[offset2+n_pairs_half]; half_len1 = ctg_length[idi]/2; half_len2 = ctg_length[idj]/2; if(halflen_1 > ctg_length[idi]/2) { rcindex1 = 0; halflen_1 = ctg_length[idi]-halflen_1; } if(halflen_2 > ctg_length[idj]/2) { rcindex2 = 0; halflen_2 = ctg_length[idj]-halflen_2; } if(rcindex1 == 0) { if(rcindex2 == 0) rcindex = 0; else rcindex = 1; } else { if(rcindex2 == 0) rcindex = 2; else rcindex = 3; } ctg_rcindex[j] = rcindex; rat1 = half_len1; rat1 = rat1/halflen_1; rat2 = half_len2; rat2 = rat2/halflen_2; if(rat1 > 10.0) rat1 = 1.0; if(rat2 > 10.0) rat2 = 1.00; rr1 = n_Bases; rr1 = rr1/nSeq; rr1 = rr1*n_pairs*1000.0; rr1 = rr1/half_len1; rr1 = rr1*(rat1 - 1.0); // rr1 = rr1/half_len1; rr2 = n_Bases; rr2 = rr2/nSeq; rr2 = rr2*n_pairs*1000.0; rr2 = rr2/half_len2; rr2 = rr2*(rat2 - 1.0); // rr2 = rr2/half_len2; c_score1 = 1.0; // if((rat1 > 2.0)||(rat2 > 2.0)) if((rat1 > 1.8)||(rat2 > 1.8)||(ctg_length[idi] < 1000000)) { i_getindex = idi; j_getindex = idj; Reads_Distribution(n_pairs,ctg_length[idi],ray+offset1,dex+offset1); // printf("Distribute: %d %d %d %d %f %f\n",halflen_1,halflen_2,half_len1,half_len2,d_score,c_score); c_score1 = c_score; } c_score2 = 1.0; // if((rat1 > 2.0)||(rat2 > 2.0)) if((rat1 > 1.8)||(rat2 > 1.8)||(ctg_length[idj] < 1000000)) { i_getindex = idj; j_getindex = idi; Reads_Distribution(n_pairs,ctg_length[idj],ray+offset2,dex+offset2); // printf("Distribute: %d %d %d %d %f %f\n",halflen_1,halflen_2,half_len1,half_len2,d_score,c_score); c_score2 = c_score; } if(i==1) { // printf("mmm: %d %ld %d %d %d %d %d %f %f %f %f\n",n_pairs,n_Bases,nSeq,halflen_2,ctg_length[idj]/2,idi,idj,rr1,rr2,sq1,sq2); } Dis_score1[j] = c_score1; Dis_score2[j] = c_score2; Dis_ratia1[j] = rat1; Dis_ratia2[j] = rat2; Dis_index[j] = rr1*rr2; printf("%6d | %6d %d %d | %d %d %f %f %f %f | %f %f %f %4d %4d %4d %4d\n",ctg_length[idd],r_matrix[i][j],hit_rddex[j],rcindex,halflen_1,halflen_2,rat1,rat2,c_score1,c_score2,rr1,rr2,rr1*rr2,rc0_matrix[i][idd],rc1_matrix[i][idd],rc2_matrix[i][idd],rc3_matrix[i][idd]); } if((ctg_length[i]>=n_length)) { int OO_index1 = 0; int OO_index2 = 0; int hitmax1 = 0; int hitmax2 = 0; int ctgmax1 = 0; int ctgmax2 = 0; int idi,idj,disidd; float disdex = 0.0; float disdex2 = 0.0; float rr,rr2,rr3; OO_index1 = 0; for(k=0;k<max_ctg;k++) { if((ctg_length[hit_rddex[k]]>=n_length)&&(disdex < Dis_index[k])&&(ctg_rcindex[k]<2)&&(Dis_ratia1[k] > 1.02)&&(Dis_ratia2[k] > 1.02)&&(Dis_score1[k] >= d_score)&&(Dis_score2[k] >= d_score)) { disdex = Dis_index[k]; OO_index1 = ctg_rcindex[k]; disidd = k; } } if(disdex > m_score) { if(rc0_matrix[i][hit_rddex[disidd]] >= rc1_matrix[i][hit_rddex[disidd]]) { if(rc0_matrix[i][hit_rddex[disidd]] >= rc2_matrix[i][hit_rddex[disidd]]) { if(rc0_matrix[i][hit_rddex[disidd]] >= rc3_matrix[i][hit_rddex[disidd]]) { rcdex_matrix[i][hit_rddex[disidd]] = 1; rcdex_matrix[hit_rddex[disidd]][i] = 1; } } } if(rc1_matrix[i][hit_rddex[disidd]] >= rc0_matrix[i][hit_rddex[disidd]]) { if(rc1_matrix[i][hit_rddex[disidd]] >= rc2_matrix[i][hit_rddex[disidd]]) { if(rc1_matrix[i][hit_rddex[disidd]] >= rc3_matrix[i][hit_rddex[disidd]]) { rcdex_matrix[i][hit_rddex[disidd]] = 2; rcdex_matrix[hit_rddex[disidd]][i] = 3; } } } if(rc2_matrix[i][hit_rddex[disidd]] >= rc1_matrix[i][hit_rddex[disidd]]) { if(rc2_matrix[i][hit_rddex[disidd]] >= rc0_matrix[i][hit_rddex[disidd]]) { if(rc2_matrix[i][hit_rddex[disidd]] >= rc3_matrix[i][hit_rddex[disidd]]) { rcdex_matrix[i][hit_rddex[disidd]] = 3; rcdex_matrix[hit_rddex[disidd]][i] = 2; } } } if(rc3_matrix[i][hit_rddex[disidd]] >= rc1_matrix[i][hit_rddex[disidd]]) { if(rc3_matrix[i][hit_rddex[disidd]] >= rc2_matrix[i][hit_rddex[disidd]]) { if(rc3_matrix[i][hit_rddex[disidd]] >= rc0_matrix[i][hit_rddex[disidd]]) { rcdex_matrix[i][hit_rddex[disidd]] = 4; rcdex_matrix[hit_rddex[disidd]][i] = 4; } } } printf("mapp: 1 %d %d %d || %f %d %d %f %f || %d %d %d\n",i,hit_rddex[disidd],r_matrix[i][disidd],disdex,OO_index1,ctg_oodex1[i],Dis_ratia1[disidd],Dis_ratia2[disidd],ctg_length[i],ctg_length[hit_rddex[disidd]],rcdex_matrix[i][hit_rddex[disidd]]); ctg_mapp1[i] = hit_rddex[disidd]; ctg_score1[i] = disdex; ctg_rcoo1[i] = OO_index1; PP_matrix[i][ptp_list[i]] = hit_rddex[disidd]; ptp_list[i]++; PN_matrix[hit_rddex[disidd]][ptn_list[hit_rddex[disidd]]] = i; if((hit_rddex[disidd] == 257)||(i == 257)) printf("order: 1 %d %d %d %d\n",i,ptn_list[hit_rddex[disidd]],rcdex_matrix[i][hit_rddex[disidd]],rcdex_matrix[hit_rddex[disidd]][i]); PO_matrix[hit_rddex[disidd]][ptn_list[hit_rddex[disidd]]] = rcdex_matrix[hit_rddex[disidd]][i]; ptn_list[hit_rddex[disidd]]++; ctg_hitnum[i]++; } OO_index2 = 0; for(k=0;k<max_ctg;k++) { if((ctg_length[hit_rddex[k]]>=n_length)&&(disdex2 < Dis_index[k])&&(ctg_rcindex[k]>=2)&&(Dis_ratia1[k] > 1.02)&&(Dis_ratia2[k] > 1.02)&&(Dis_score1[k] >= d_score)&&(Dis_score2[k] >= d_score)) { disdex2 = Dis_index[k]; OO_index2 = ctg_rcindex[k]; disidd = k; } } if(disdex2 > m_score) { if(rc0_matrix[i][hit_rddex[disidd]] >= rc1_matrix[i][hit_rddex[disidd]]) { if(rc0_matrix[i][hit_rddex[disidd]] >= rc2_matrix[i][hit_rddex[disidd]]) { if(rc0_matrix[i][hit_rddex[disidd]] >= rc3_matrix[i][hit_rddex[disidd]]) { rcdex_matrix[i][hit_rddex[disidd]] = 1; rcdex_matrix[hit_rddex[disidd]][i] = 1; } } } if(rc1_matrix[i][hit_rddex[disidd]] >= rc0_matrix[i][hit_rddex[disidd]]) { if(rc1_matrix[i][hit_rddex[disidd]] >= rc2_matrix[i][hit_rddex[disidd]]) { if(rc1_matrix[i][hit_rddex[disidd]] >= rc3_matrix[i][hit_rddex[disidd]]) { rcdex_matrix[i][hit_rddex[disidd]] = 2; rcdex_matrix[hit_rddex[disidd]][i] = 3; } } } if(rc2_matrix[i][hit_rddex[disidd]] >= rc1_matrix[i][hit_rddex[disidd]]) { if(rc2_matrix[i][hit_rddex[disidd]] >= rc0_matrix[i][hit_rddex[disidd]]) { if(rc2_matrix[i][hit_rddex[disidd]] >= rc3_matrix[i][hit_rddex[disidd]]) { rcdex_matrix[i][hit_rddex[disidd]] = 3; rcdex_matrix[hit_rddex[disidd]][i] = 2; } } } if(rc3_matrix[i][hit_rddex[disidd]] >= rc1_matrix[i][hit_rddex[disidd]]) { if(rc3_matrix[i][hit_rddex[disidd]] >= rc2_matrix[i][hit_rddex[disidd]]) { if(rc3_matrix[i][hit_rddex[disidd]] >= rc0_matrix[i][hit_rddex[disidd]]) { rcdex_matrix[i][hit_rddex[disidd]] = 4; rcdex_matrix[hit_rddex[disidd]][i] = 4; } } } printf("mapp: 2 %d %d %d || %f %d %d %f %f || %d %d %d\n",i,hit_rddex[disidd],r_matrix[i][disidd],disdex2,OO_index2,ctg_oodex2[i],Dis_ratia1[disidd],Dis_ratia2[disidd],ctg_length[i],ctg_length[hit_rddex[disidd]],rcdex_matrix[i][hit_rddex[disidd]]); ctg_mapp2[i] = hit_rddex[disidd]; ctg_score2[i] = disdex2; ctg_rcoo2[i] = OO_index2; ctg_rcdex1[i] = OO_index2; PP_matrix[i][ptp_list[i]] = hit_rddex[disidd]; ptp_list[i]++; PN_matrix[hit_rddex[disidd]][ptn_list[hit_rddex[disidd]]] = i; if((hit_rddex[disidd] == 257)||(i == 257)) printf("order: 2 %d %d %d %d\n",i,ptn_list[hit_rddex[disidd]],rcdex_matrix[i][hit_rddex[disidd]],rcdex_matrix[hit_rddex[disidd]][i]); PO_matrix[hit_rddex[disidd]][ptn_list[hit_rddex[disidd]]] = rcdex_matrix[hit_rddex[disidd]][i]; ptn_list[hit_rddex[disidd]]++; ctg_hitnum[i]++; } } } for(i=0;i<max_ctg;i++) { for(j=0;j<max_ctg;j++) { if((rcdex_matrix[j][i] > 0)&&(rcdex_matrix[i][j] == 0)) { if(rcdex_matrix[j][i] == 1) rcdex_matrix[i][j] = 4; else if(rcdex_matrix[j][i] == 2) rcdex_matrix[i][j] = 3; else if(rcdex_matrix[j][i] == 3) rcdex_matrix[i][j] = 2; else if(rcdex_matrix[j][i] == 4) rcdex_matrix[i][j] = 1; } if((rcdex_matrix[j][i] == 0)&&(rcdex_matrix[i][j] > 0)) { if(rcdex_matrix[i][j] == 1) rcdex_matrix[j][i] = 4; else if(rcdex_matrix[i][j] == 2) rcdex_matrix[j][i] = 3; else if(rcdex_matrix[i][j] == 3) rcdex_matrix[j][i] = 2; else if(rcdex_matrix[i][j] == 4) rcdex_matrix[j][i] = 1; } } } for(i=0;i<max_ctg;i++) { for(j=0;j<max_ctg;j++) { if(rc0_matrix[i][j] >= rc1_matrix[i][j]) { if(rc0_matrix[i][j] >= rc2_matrix[i][j]) { if(rc0_matrix[i][j] >= rc3_matrix[i][j]) { ono_matrix[i][j] = 1; ono_matrix[j][i] = 1; } } } if(rc1_matrix[i][j] >= rc0_matrix[i][j]) { if(rc1_matrix[i][j] >= rc2_matrix[i][j]) { if(rc1_matrix[i][j] >= rc3_matrix[i][j]) { ono_matrix[i][j] = 2; ono_matrix[j][i] = 3; } } } if(rc2_matrix[i][j] >= rc1_matrix[i][j]) { if(rc2_matrix[i][j] >= rc0_matrix[i][j]) { if(rc2_matrix[i][j] >= rc3_matrix[i][j]) { ono_matrix[i][j] = 3; ono_matrix[j][i] = 2; } } } if(rc3_matrix[i][j] >= rc1_matrix[i][j]) { if(rc3_matrix[i][j] >= rc2_matrix[i][j]) { if(rc3_matrix[i][j] >= rc0_matrix[i][j]) { ono_matrix[i][j] = 4; ono_matrix[j][i] = 4; } } } } } for(k=0;k<max_ctg;k++) { if(ctg_hitnum[k] == 1) { int idi = ctg_mapp1[k]; if(ctg_mapp1[k] >= 0) { p_matrix[k][ctg_list[k]] = ctg_mapp1[k]; s_matrix[k][ctg_list[k]] = ctg_score1[k]; s2_matrix[k][ctg_mapp1[k]] = ctg_score1[k]; s2_matrix[ctg_mapp1[k]][k] = ctg_score1[k]; o_matrix[k][ctg_list[k]] = ctg_rcoo1[k]; ctg_list[k]++; } else if(ctg_mapp2[k] >= 0) { p_matrix[k][ctg_list[k]] = ctg_mapp2[k]; s_matrix[k][ctg_list[k]] = ctg_score2[k]; s2_matrix[k][ctg_mapp2[k]] = ctg_score2[k]; s2_matrix[ctg_mapp2[k]][k] = ctg_score2[k]; o_matrix[k][ctg_list[k]] = ctg_rcoo2[k]; ctg_list[k]++; } for(j=0;j<max_ctg;j++) { if((ctg_mapp1[j] == k)||(ctg_mapp2[j] == k)) { int idi = ctg_hitnum[ctg_mapp1[j]]; int idj = ctg_hitnum[ctg_mapp2[j]]; printf("find the missing link: %d %d %d %d %d %d\n",k,j,ctg_mapp1[j],ctg_mapp2[j],idi,idj); } } } else if(ctg_hitnum[k] == 2) { p_matrix[k][ctg_list[k]] = ctg_mapp1[k]; s_matrix[k][ctg_list[k]] = ctg_score1[k]; s2_matrix[k][ctg_mapp1[k]] = ctg_score1[k]; s2_matrix[ctg_mapp1[k]][k] = ctg_score1[k]; o_matrix[k][ctg_list[k]] = ctg_rcoo1[k]; ctg_list[k]++; p_matrix[k][ctg_list[k]] = ctg_mapp2[k]; s_matrix[k][ctg_list[k]] = ctg_score2[k]; s2_matrix[k][ctg_mapp2[k]] = ctg_score2[k]; s2_matrix[ctg_mapp2[k]][k] = ctg_score2[k]; o_matrix[k][ctg_list[k]] = ctg_rcoo2[k]; ctg_list[k]++; } } for(k=0;k<max_ctg;k++) { int num_partner = 0; int p_idi = -1; int p_idk = -1; int pscore1 = 0; int pscore2 = 0; int plists1 = 0; int plists2 = 0; for(j=0;j<max_ctg;j++) { for(i=0;i<ctg_list[j];i++) { if(p_matrix[j][i] == k) { p_index[num_partner] = j; p_rcdex[num_partner] = o_matrix[j][i]; p_score[num_partner] = s_matrix[j][i]; p_lists[num_partner] = i; num_partner++; } } for(i=0;i<ctg_list[j];i++) { if(p_matrix[j][i] == k) printf("Missing link: %d %d | %d %d %d %d | %d %d || %d %d %d %d || %d %d\n",k,j,i,p_matrix[j][i],s_matrix[j][i],o_matrix[j][i],ctg_length[k],ctg_length[j],rc0_matrix[k][j],rc1_matrix[k][j],rc2_matrix[k][j],rc3_matrix[k][j],ctg_mapp1[k],ctg_mapp2[k]); } } if(num_partner > 0) { if(k == 428) printf("partner: %d %d | %d %d\n",k,num_partner,ctg_mapp1[k],ctg_mapp2[k]); for(i=0;i<num_partner;i++) { if((p_rcdex[i]%2) == 0) { if(p_score[i] > pscore1) { p_idi = i; pscore1 = p_score[i]; plists1 = p_lists[i]; } } else { if(p_score[i] > pscore2) { p_idk = i; pscore2 = p_score[i]; plists2 = p_lists[i]; } } } } if(p_idi >= 0) { j = p_index[p_idi]; i = plists1; if((o_matrix[j][i] == 1)||(o_matrix[j][i] == 2)) ctg_oodex1[k] = 0; else ctg_oodex1[k] = 1; rc_matrix[k][j] = ctg_oodex1[k]; rc_matrix[j][k] = ctg_oodex1[k]; ctg_part1[k] = j; ctg_patnum[k]++; ctg_links[k]++; printf("Partner_1: %d %d %d | %d %d | %d %d || %d %d %d %d %d\n",k,j,i,s_matrix[j][i],o_matrix[j][i],ctg_length[k],ctg_length[j],rc0_matrix[k][i],rc1_matrix[k][i],rc2_matrix[k][i],rc3_matrix[k][i],ctg_mapp1[k]); } if(p_idk >= 0) { j = p_index[p_idk]; i = plists2; if((o_matrix[j][i] == 1)||(o_matrix[j][i] == 2)) ctg_oodex2[k] = 0; else ctg_oodex2[k] = 1; rc_matrix[k][j] = ctg_oodex2[k]; rc_matrix[j][k] = ctg_oodex2[k]; ctg_part2[k] = j; ctg_patnum[k]++; ctg_links[k]++; if(j != ctg_mapp2[k]) { ctg_part1[j] = ctg_mapp2[k]; printf("PPPpartner: %d %d | %d %d\n",k,j,ctg_mapp1[k],ctg_mapp2[k]); } printf("Partner_2: %d %d %d | %d %d | %d %d || %d %d %d %d %d\n",k,j,i,s_matrix[j][i],o_matrix[j][i],ctg_length[k],ctg_length[j],rc0_matrix[k][j],rc1_matrix[k][j],rc2_matrix[k][j],rc3_matrix[k][j],ctg_mapp2[k]); } for(i=0;i<ctg_list[k];i++) { printf("link: %d %d %d %d %d\n",k,i,ctg_list[k],p_matrix[k][i],s_matrix[k][i]); } } for(k=0;k<max_ctg;k++) { for(i=0;i<ctg_list[i];i++) printf("k-428: %d %d %d %d | %d %d | %d %d\n",k,i,ctg_list[k],p_matrix[k][i],ctg_mapp1[k],ctg_mapp2[k],ctg_part1[k],ctg_part2[k]); } for(k=0;k<max_ctg;k++) { if(ptp_list[k] == 2) { if(ptn_list[k] == 0) { ctg_print[k] = 1; ctg_print[PP_matrix[k][0]] = 1; ctg_print[PP_matrix[k][1]] = 1; printf("next: %d %d %d %d %d\n",k,ctg_part1[k],ctg_part2[k],PP_matrix[k][0],PP_matrix[k][1]); ctg_part1[k] = PP_matrix[k][0]; ctg_part2[k] = PP_matrix[k][1]; } else if(ptn_list[k] == 1) { if((PN_matrix[k][0] == PP_matrix[k][0])||(PN_matrix[k][0] == PP_matrix[k][1])) { ctg_print[k] = 1; ctg_print[PP_matrix[k][0]] = 1; ctg_print[PP_matrix[k][1]] = 1; printf("next: %d %d %d %d %d\n",k,ctg_part1[k],ctg_part2[k],PP_matrix[k][0],PP_matrix[k][1]); ctg_part1[k] = PP_matrix[k][0]; ctg_part2[k] = PP_matrix[k][1]; } } else if(ptn_list[k] == 2) { if((PN_matrix[k][0] == PP_matrix[k][0])&&(PN_matrix[k][1] == PP_matrix[k][1])) { ctg_print[k] = 1; ctg_print[PP_matrix[k][0]] = 1; ctg_print[PP_matrix[k][1]] = 1; printf("next: %d %d %d %d %d\n",k,ctg_part1[k],ctg_part2[k],PP_matrix[k][0],PP_matrix[k][1]); ctg_part1[k] = PP_matrix[k][0]; ctg_part2[k] = PP_matrix[k][1]; } else if((PN_matrix[k][0] == PP_matrix[k][1])&&(PN_matrix[k][1] == PP_matrix[k][0])) { ctg_print[k] = 1; ctg_print[PP_matrix[k][0]] = 1; ctg_print[PP_matrix[k][1]] = 1; printf("next: %d %d %d %d %d\n",k,ctg_part1[k],ctg_part2[k],PP_matrix[k][0],PP_matrix[k][1]); ctg_part1[k] = PP_matrix[k][0]; ctg_part2[k] = PP_matrix[k][1]; } } } else if(ptp_list[k] == 1) { if(ptn_list[k] == 1) { if((ptn_list[k] == 1)&&(PP_matrix[k][0]==PN_matrix[k][0])) { ctg_print[k] = 1; ctg_print[PP_matrix[k][0]] = 1; printf("next: %d %d %d %d %d\n",k,ctg_part1[k],ctg_part2[k],PP_matrix[k][0],100); ctg_part1[k] = PP_matrix[k][0]; } } } } for(k=0;k<max_ctg;k++) { printf("PPmatrix: %d %d | %d %d | %d %d %d || ",k,ptp_list[k],ctg_part1[k],ctg_part2[k],ptn_list[k],ctg_patnum[k],ctg_print[k]); // printf("PPmatrix: %d %d | %d %d %d || ",k,ptp_list[k],ptn_list[k],ctg_patnum[k],ctg_print[k]); for(i=0;i<ptp_list[k];i++) printf("%d ",PP_matrix[k][i]); printf("|| "); for(i=0;i<ptn_list[k];i++) printf("%d ",PN_matrix[k][i]); printf("& "); for(i=0;i<ptn_list[k];i++) printf("%d ",PO_matrix[k][i]); printf("\n"); } for(i=0;i<num_hics;i++) { int idd = hic_head[i]; int idi = hic_index[idd]; for(j=0;j<hic_list[i];j++) { int idk = hic_head[i]+j; int ikk = hic_index[idk]; printf("contigg1:%08d %d %d %d %d ",hic_mscore[idk],hic_sfdex[idk],hic_index[idk],hic_length[idk],hic_rcdex[idk]); for(k=0;k<hic_list[i];k++) { int idt = hic_head[i]+k; int ikt = hic_index[idt]; printf(" || %d %d | %d %d %d %d",ikt,ono_matrix[ikk][ikt],rc0_matrix[ikk][ikt],rc1_matrix[ikk][ikt],rc2_matrix[ikk][ikt],rc3_matrix[ikk][ikt]); } printf("\n"); // fprintf(fpOutfast2,"contigg1:%08d %d %d %d %d\n",hic_mscore[idk],hic_sfdex[idk],hic_index[idk],hic_length[idk],hic_rcdex[idk]); } } exit(1); if((namef = fopen(argv[args+1],"w")) == NULL) { printf("ERROR main:: alignment file 2 \n"); exit(1); } n_scaff = 0; for(k=0;k<max_ctg;k++) { int tbase = 0; int print_tag = 0; if(ptp_list[k] == 1) { if(ptn_list[k] == 1) { if((ptn_list[k] == 1)&&(PP_matrix[k][0]==PN_matrix[k][0])) print_tag = 1; } } // if(k==i_getindex) printf("===========\n"); printf("hhh: %d %d %d\n",k,ctg_patnum[k],ctg_output[k]); if((ctg_patnum[k]==0)&&(ctg_output[k]==0)) { printf("supercontig1: tarseq_%d %d %d\n",k,k,ctg_patnum[k]); fprintf(namef,"contig-1:%08d %d %d %d 0 0\n",6000,n_scaff,k,ctg_length[k]); printf("contig-1: %d %d %d 0 0\n",n_scaff,k,ctg_length[k]); tbase = ctg_length[k]; printf("bases: %d %d %d\n",k,n_scaff,tbase); ctg_output[k] = 1; n_scaff++; } else if((print_tag==1)&&(ctg_patnum[k]==1)&&(ctg_output[k]==0)) { int idd = k; int idk = k; int stopflag=0; int num_loops=0; // if(k==i_getindex) // while(((ctg_part1[idd] >= 0)||(ctg_part2[idd] >= 0))&&((stopflag == 0)&&(ctg_links[idk]>0)&&(ctg_mask[idk]==0)&&(idk >= 0)&&(idd >= 0))) while((ctg_print[idd] == 1)&&((stopflag == 0)&&(ctg_links[idk]>0)&&(ctg_mask[idk]==0)&&(idk >= 0)&&(idd >= 0))) { int rc_idk = -1; int rc_idi = 0; printf("xxx: %d %d %d %d %d %d %d %d\n",k,idd,idk,ctg_patnum[k],ctg_used[k],ctg_used[idd],ctg_part1[idd],ctg_part2[idd]); if(ctg_used[idk] == 0) { printf("hits: %d %d %d %d %d %d %d %d\n",k,idd,idk,ctg_patnum[k],ctg_used[k],ctg_used[idd],ctg_part1[idd],ctg_part2[idd]); if(ctg_used[ctg_part1[idk]] == 0) { printf("hhh0: %d %d %d\n",k,idd,ctg_part1[idd]); if(ctg_part1[idd] >= 0) { idk = ctg_part1[idd]; rc_idk = ctg_oodex1[idd]; } else { idk = ctg_part2[idd]; rc_idk = ctg_oodex2[idd]; } printf("hhh1: %d %d %d\n",k,idd,idk); } else if(ctg_used[ctg_part2[idk]] == 0) { idk = ctg_part2[idd]; rc_idk = ctg_oodex2[idd]; printf("hhh2: %d %d %d\n",k,idd,idk); } printf("hhhx: %d %d %d %d %d %d | %d %d\n",k,idd,idk,ctg_part1[idd],ctg_part2[idd],rc_idk,ctg_used[idd],ctg_used[idk]); if((ctg_patnum[k]==1)&&(ctg_used[k]==0)&&(ctg_print[k] == 1)) { printf("supercontig2: tarseq_%d %d %d %d %d %d\n",k,idd,idk,rc_idk,ctg_rcdex1[k],ctg_patnum[k]); if(rc_idk==0) { if(rcdex_matrix[k][idk] == 1) { fprintf(namef,"contigg1:%08d %d %d %d 1 2\n",6000,n_scaff,k,ctg_length[k]); /* fprintf(namef," PP: %d %d %d | ",n_scaff,k,ptn_list[k]); for(m=0;m<ptn_list[k];m++) fprintf(namef,"%d ",PN_matrix[k][m]); fprintf(namef,"|| "); for(m=0;m<ptn_list[k];m++) fprintf(namef,"%d ",PO_matrix[k][m]); fprintf(namef,"\n"); */ printf("contigg1: %d %d %d 0 %d\n",n_scaff,k,ctg_length[k],rcdex_matrix[k][idk]); } else { fprintf(namef,"contigg1:%08d %d %d %d 0 %d\n",6000,n_scaff,k,ctg_length[k],rcdex_matrix[k][idk]); /* fprintf(namef," PP: %d %d %d | ",n_scaff,k,ptn_list[k]); for(m=0;m<ptn_list[k];m++) fprintf(namef,"%d ",PN_matrix[k][m]); fprintf(namef,"|| "); for(m=0;m<ptn_list[k];m++) fprintf(namef,"%d ",PO_matrix[k][m]); fprintf(namef,"\n"); */ printf("contigg1: %d %d %d 0 %d\n",n_scaff,k,ctg_length[k],rcdex_matrix[k][idk]); } ctg_output[k] = 1; ctg_outrc[k] = 0; if(idk!=k) { if((ctg_output[idk] == 0)&&(idk >= 0)) { fprintf(namef,"contigg2:%08d %d %d %d 0 0\n",s2_matrix[k][idk],n_scaff,idk,ctg_length[idk]); /* fprintf(namef," PP: %d %d %d | ",n_scaff,idk,ptn_list[idk]); for(m=0;m<ptn_list[idk];m++) fprintf(namef,"%d ",PN_matrix[idk][m]); fprintf(namef,"|| "); for(m=0;m<ptn_list[idk];m++) fprintf(namef,"%d ",PO_matrix[idk][m]); fprintf(namef,"\n"); */ printf("contigg2: %d %d %d 0 0\n",n_scaff,idk,ctg_length[idk]); ctg_outrc[idk] = 0; } ctg_output[idk] = 1; } } else if(rc_idk==1) { fprintf(namef,"contigg1:%08d %d %d %d 0 %d\n",6000,n_scaff,k,ctg_length[k],rcdex_matrix[k][idk]); /* fprintf(namef," PP: %d %d %d | ",n_scaff,k,ptn_list[k]); for(m=0;m<ptn_list[k];m++) fprintf(namef,"%d ",PN_matrix[k][m]); fprintf(namef,"|| "); for(m=0;m<ptn_list[k];m++) fprintf(namef,"%d ",PO_matrix[k][m]); fprintf(namef,"\n"); */ printf("contigg1: %d %d %d 0 %d\n",n_scaff,k,ctg_length[k],rcdex_matrix[k][idk]); ctg_output[k] = 1; ctg_outrc[k] = 0; if(idk!=k) { if((ctg_output[idk] == 0)&&(idk >= 0)) { fprintf(namef,"contigg2:%08d %d %d %d 1 0\n",s2_matrix[k][idk],n_scaff,idk,ctg_length[idk]); /* fprintf(namef," PP: %d %d %d | ",n_scaff,idk,ptn_list[idk]); for(m=0;m<ptn_list[idk];m++) fprintf(namef,"%d ",PN_matrix[idk][m]); fprintf(namef,"|| "); for(m=0;m<ptn_list[idk];m++) fprintf(namef,"%d ",PO_matrix[idk][m]); fprintf(namef,"\n"); */ printf("contigg2: %d %d %d 1 0\n",n_scaff,idk,ctg_length[idk]); ctg_outrc[idk] = 1; } ctg_output[idk] = 1; } } else if(rc_idk==2) { fprintf(namef,"contigg1:%08d %d %d %d 0 2\n",6000,n_scaff,k,ctg_length[k]); printf("contigg1: %d %d %d 0 0\n",n_scaff,k,ctg_length[k]); ctg_output[k] = 1; if(idk!=k) { if(ctg_output[idk] == 0) { fprintf(namef,"contigg2:%08d %d %d %d 0 0\n",s2_matrix[k][idk],n_scaff,idk,ctg_length[idk]); printf("contigg2: %d %d %d 0 0\n",n_scaff,idk,ctg_length[idk]); ctg_outrc[idk] = 0; } ctg_output[idk] = 1; } } else if(rc_idk==3) { fprintf(namef,"contigg1:%08d %d %d %d 0 3\n",6000,n_scaff,k,ctg_length[k]); printf("contigg1: %d %d %d 0 0\n",n_scaff,k,ctg_length[k]); ctg_output[k] = 1; if(idk!=k) { if(ctg_output[idk] == 0) { fprintf(namef,"contigg2:%08d %d %d %d 1 0\n",s2_matrix[k][idk],n_scaff,idk,ctg_length[idk]); printf("contigg2: %d %d %d 1\n",n_scaff,idk,ctg_length[idk]); ctg_outrc[k] = 1; } ctg_output[idk] = 1; } } else { fprintf(namef,"contigg1:%08d %d %d %d 0 4\n",6000,n_scaff,k,ctg_length[k]); printf("contigg1: %d %d %d 0 0\n",n_scaff,k,ctg_length[k]); ctg_output[k] = 1; } tbase = tbase + ctg_length[k]; if(idk!=k) tbase = tbase + ctg_length[idk]; ctg_used[k] = 0; num_loops++; } // else if((ctg_print[idd]==1)&&(ctg_part1[idd]>=0)&&(ctg_part2[idd]>=0)&&(idd!=idk)) else if((ctg_print[idd]==1)&&(idd!=idk)) { int rc_idd = 0; int rc_ide = 0; // if(idk>=0) tbase = tbase + ctg_length[idk]; if(rc_idk==0) rc_idd = 0; else if(rc_idk==1) rc_idd = 1; else if(rc_idk==2) rc_idd = 0; else if(rc_idk==3) rc_idd = 1; if(rc_idd!=rc_idi) rc_ide = 1; else rc_ide = 0; if(ctg_output[idk] == 0) { int outrc = 0; if(ctg_outrc[idd] == 0) outrc = rc_matrix[idd][idk]; else { if(rc_matrix[idd][idk] == 0) outrc = 1; else outrc = 0; } ctg_outrc[idk] = outrc; if(idk >= 0) { fprintf(namef,"contig-0:%08d %d %d %d %d 0\n",s2_matrix[idd][idk],n_scaff,idk,ctg_length[idk],outrc); /* fprintf(namef," PP: %d %d %d ",n_scaff,idk,ptn_list[idk]); for(m=0;m<ptn_list[idk];m++) fprintf(namef,"%d ",PN_matrix[idk][m]); fprintf(namef,"|| "); for(m=0;m<ptn_list[idk];m++) fprintf(namef,"%d ",PO_matrix[idk][m]); fprintf(namef,"\n"); */ printf("contig-0: %d %d %d %d 0\n",n_scaff,idk,ctg_length[idk],outrc); } } ctg_output[idk] = 1; rc_idi = rc_ide; num_loops++; } else if(ctg_part1[idd]>0) { } // if(idd==i_getindex) printf("hhh3: %d %d %d\n",k,idd,idk); ctg_used[idd] = 1; idd = idk; } else stopflag=1; if(stopflag == 1) break; printf("hhh-xxx: %d %d %d\n",k,idd,idk); } if(tbase == 0) tbase = ctg_length[idk]; if(num_loops != 0) printf("bases: %d %d %d\n",idk,n_scaff,tbase); n_scaff++; } } for(k=0;k<max_ctg;k++) { int tbase = 0; if(ctg_output[k] == 0) { printf("supercontig3: tarseq_%d %d %d\n",k,k,ctg_patnum[k]); fprintf(namef,"contig-n:%08d %d %d %d 0 0\n",6000,n_scaff,k,ctg_length[k]); printf("contig-n: %d %d %d 0 0\n",n_scaff,k,ctg_length[k]); tbase = ctg_length[k]; printf("bases: %d %d %d\n",k,n_scaff,tbase); n_scaff++; } } fclose(namef); } /* ========================================================= */ void Reads_Distribution(int nSeq, int R_len, int *rd_locus, int *rd_index) /* ========================================================= */ { int i,j,k,stopflag,num_steps; int BAR = 5000; int nstep = 20000; double rate,rate2; num_steps = 0; for(i=0;i<nSeq;i++) { /* search reads with an index < i */ /* search reads with an index > i */ stopflag=0; j=i+1; while((j<nSeq)&&(stopflag==0)) { if((rd_locus[j]<(BAR+nstep))&&(rd_locus[i]>=BAR)) { j++; } else stopflag=1; } if((j-i)>=3) { rate = (j-i)*100; rate = rate/nSeq; if((i_getindex == 742)&&(j_getindex == 788)) printf("frequency:%d %d %f\n",j-i,BAR,rate); BAR = BAR+nstep; num_steps++; } else if((j-i)<=2) { rate = 100; rate = rate/nSeq; BAR = rd_locus[i]; // num_steps++; } i=j-1; } rate2 = 0.0; rate = R_len; rate = rate/nstep; if(num_steps > 0) { rate2 = num_steps; rate2 = rate2/rate; } else rate2 = 0.0; c_score = rate2; printf("Num_steps: %d %lf %lf %d\n",num_steps,rate,rate2,R_len); } #define SWAP(a,b) temp=(a);(a)=b;(b)=temp; /* Subroutine to sort an array arr[0,...,n-1] into ascending order while making the corresponding reaarangement of the array brr[0,...,n-1] by the use of Quicksort (Sedgwick, R. 1978, Communications o fthe ACM, vol. 21, pp. 847-857) also see Numerical Recipes in C */ /* =============================== */ void ArraySort_Long(int n, long *arr) /* =============================== */ { int i,ir=n-1,j,k,m=0,jstack=0,NSTACK=50,istack[NSTACK]; long a,temp,MIN=7; for(;;) { /* Insertion sort when subarray is small enough */ if(ir-m<MIN) { for(j=m+1;j<=ir;j++) { a=arr[j]; for(i=j-1;i>=m;i--) { if(arr[i]<=a) break; arr[i+1]=arr[i]; } arr[i+1]=a; } if(!jstack) return; ir=istack[jstack--]; m=istack[jstack--]; } else { k=(m+ir)>>1; SWAP(arr[k],arr[m+1]); if(arr[m]>arr[ir]) { SWAP(arr[m],arr[ir]); } if(arr[m+1]>arr[ir]) { SWAP(arr[m+1],arr[ir]); } if(arr[m]>arr[m+1]) { SWAP(arr[m],arr[m+1]); } i=m+1; j=ir; a=arr[m+1]; for(;;) { do i++; while (arr[i]<a); do j--; while (arr[j]>a); if(j<i) break; SWAP(arr[i],arr[j]); } arr[m+1]=arr[j]; arr[j]=a; jstack+=2; /* Push pointers to larger subarray on stack */ /* process smaller subarray immediately */ if(jstack>NSTACK) { printf("Stack error: NSTACK too small\n"); exit(0); } if(ir-i+1>=j-m) { istack[jstack]=ir; istack[jstack-1]=i; ir=j-1; } else { istack[jstack]=j-1; istack[jstack-1]=m; m=i; } } } } /* =============================== */ void ArraySort_Int(int n, int *arr) /* =============================== */ { int i,ir=n-1,j,k,m=0,jstack=0,NSTACK=50,istack[NSTACK]; int a,temp,MIN=7; for(;;) { /* Insertion sort when subarray is small enough */ if(ir-m<MIN) { for(j=m+1;j<=ir;j++) { a=arr[j]; for(i=j-1;i>=m;i--) { if(arr[i]<=a) break; arr[i+1]=arr[i]; } arr[i+1]=a; } if(!jstack) return; ir=istack[jstack--]; m=istack[jstack--]; } else { k=(m+ir)>>1; SWAP(arr[k],arr[m+1]); if(arr[m]>arr[ir]) { SWAP(arr[m],arr[ir]); } if(arr[m+1]>arr[ir]) { SWAP(arr[m+1],arr[ir]); } if(arr[m]>arr[m+1]) { SWAP(arr[m],arr[m+1]); } i=m+1; j=ir; a=arr[m+1]; for(;;) { do i++; while (arr[i]<a); do j--; while (arr[j]>a); if(j<i) break; SWAP(arr[i],arr[j]); } arr[m+1]=arr[j]; arr[j]=a; jstack+=2; /* Push pointers to larger subarray on stack */ /* process smaller subarray immediately */ if(jstack>NSTACK) { printf("Stack error: NSTACK too small\n"); exit(0); } if(ir-i+1>=j-m) { istack[jstack]=ir; istack[jstack-1]=i; ir=j-1; } else { istack[jstack]=j-1; istack[jstack-1]=m; m=i; } } } } /* =============================== */ void ArraySort_Mix(int n, long *arr, int *brr) /* =============================== */ { int i,ir=n-1,j,k,m=0,jstack=0,b,NSTACK=50,istack[NSTACK]; long a,temp,MIN=7; for(;;) { /* Insertion sort when subarray is small enough */ if(ir-m<MIN) { for(j=m+1;j<=ir;j++) { a=arr[j]; b=brr[j]; for(i=j-1;i>=m;i--) { if(arr[i]<=a) break; arr[i+1]=arr[i]; brr[i+1]=brr[i]; } arr[i+1]=a; brr[i+1]=b; } if(!jstack) return; ir=istack[jstack--]; m=istack[jstack--]; } else { k=(m+ir)>>1; SWAP(arr[k],arr[m+1]); SWAP(brr[k],brr[m+1]); if(arr[m]>arr[ir]) { SWAP(arr[m],arr[ir]); SWAP(brr[m],brr[ir]); } if(arr[m+1]>arr[ir]) { SWAP(arr[m+1],arr[ir]); SWAP(brr[m+1],brr[ir]); } if(arr[m]>arr[m+1]) { SWAP(arr[m],arr[m+1]); SWAP(brr[m],brr[m+1]); } i=m+1; j=ir; a=arr[m+1]; b=brr[m+1]; for(;;) { do i++; while (arr[i]<a); do j--; while (arr[j]>a); if(j<i) break; SWAP(arr[i],arr[j]); SWAP(brr[i],brr[j]); } arr[m+1]=arr[j]; arr[j]=a; brr[m+1]=brr[j]; brr[j]=b; jstack+=2; /* Push pointers to larger subarray on stack */ /* process smaller subarray immediately */ if(jstack>NSTACK) { printf("Stack error: NSTACK too small\n"); exit(0); } if(ir-i+1>=j-m) { istack[jstack]=ir; istack[jstack-1]=i; ir=j-1; } else { istack[jstack]=j-1; istack[jstack-1]=m; m=i; } } } } /* =============================== */ void ArraySort_Int2(int n, int *arr, int *brr) /* =============================== */ { int i,ir=n-1,j,k,m=0,jstack=0,b,NSTACK=50,istack[NSTACK]; int a,temp,MIN=7; for(;;) { /* Insertion sort when subarray is small enough */ if(ir-m<MIN) { for(j=m+1;j<=ir;j++) { a=arr[j]; b=brr[j]; for(i=j-1;i>=m;i--) { if(arr[i]<=a) break; arr[i+1]=arr[i]; brr[i+1]=brr[i]; } arr[i+1]=a; brr[i+1]=b; } if(!jstack) return; ir=istack[jstack--]; m=istack[jstack--]; } else { k=(m+ir)>>1; SWAP(arr[k],arr[m+1]); SWAP(brr[k],brr[m+1]); if(arr[m]>arr[ir]) { SWAP(arr[m],arr[ir]); SWAP(brr[m],brr[ir]); } if(arr[m+1]>arr[ir]) { SWAP(arr[m+1],arr[ir]); SWAP(brr[m+1],brr[ir]); } if(arr[m]>arr[m+1]) { SWAP(arr[m],arr[m+1]); SWAP(brr[m],brr[m+1]); } i=m+1; j=ir; a=arr[m+1]; b=brr[m+1]; for(;;) { do i++; while (arr[i]<a); do j--; while (arr[j]>a); if(j<i) break; SWAP(arr[i],arr[j]); SWAP(brr[i],brr[j]); } arr[m+1]=arr[j]; arr[j]=a; brr[m+1]=brr[j]; brr[j]=b; jstack+=2; /* Push pointers to larger subarray on stack */ /* process smaller subarray immediately */ if(jstack>NSTACK) { printf("Stack error: NSTACK too small\n"); exit(0); } if(ir-i+1>=j-m) { istack[jstack]=ir; istack[jstack-1]=i; ir=j-1; } else { istack[jstack]=j-1; istack[jstack-1]=m; m=i; } } } } /* =============================== */ void ArraySort_float(int n, float *arr, int *brr) /* =============================== */ { int i,ir=n-1,j,k,m=0,b,jstack=0,NSTACK=50,istack[NSTACK],MIN=7; float a,temp; for(;;) { /* Insertion sort when subarray is small enough */ if(ir-m<MIN) { for(j=m+1;j<=ir;j++) { a=arr[j]; b=brr[j]; for(i=j-1;i>=m;i--) { if(arr[i]<=a) break; arr[i+1]=arr[i]; brr[i+1]=brr[i]; } arr[i+1]=a; brr[i+1]=b; } if(!jstack) return; ir=istack[jstack--]; m=istack[jstack--]; } else { k=(m+ir)>>1; SWAP(arr[k],arr[m+1]); SWAP(brr[k],brr[m+1]); if(arr[m]>arr[ir]) { SWAP(arr[m],arr[ir]); SWAP(brr[m],brr[ir]); } if(arr[m+1]>arr[ir]) { SWAP(arr[m+1],arr[ir]); SWAP(brr[m+1],brr[ir]); } if(arr[m]>arr[m+1]) { SWAP(arr[m],arr[m+1]); SWAP(brr[m],brr[m+1]); } i=m+1; j=ir; a=arr[m+1]; b=brr[m+1]; for(;;) { do i++; while (arr[i]<a); do j--; while (arr[j]>a); if(j<i) break; SWAP(arr[i],arr[j]); SWAP(brr[i],brr[j]); } arr[m+1]=arr[j]; arr[j]=a; brr[m+1]=brr[j]; brr[j]=b; jstack+=2; /* Push pointers to larger subarray on stack */ /* process smaller subarray immediately */ if(jstack>NSTACK) { printf("Stack error: NSTACK too small\n"); exit(0); } if(ir-i+1>=j-m) { istack[jstack]=ir; istack[jstack-1]=i; ir=j-1; } else { istack[jstack]=j-1; istack[jstack-1]=m; m=i; } } } } /* function to sort an array into a decreasing order: a>b>c>.... */ /* =============================== */ void ArraySort2_Int2(int n, int *arr, int *brr) /* =============================== */ { int i,ir=n-1,j,k,m=0,jstack=0,b,NSTACK=50,istack[NSTACK]; int a,temp,MIN=7; for(;;) { /* Insertion sort when subarray is small enough */ if(ir-m<MIN) { for(j=m+1;j<=ir;j++) { a=arr[j]; b=brr[j]; for(i=j-1;i>=m;i--) { if(arr[i]>=a) break; arr[i+1]=arr[i]; brr[i+1]=brr[i]; } arr[i+1]=a; brr[i+1]=b; } if(!jstack) return; ir=istack[jstack--]; m=istack[jstack--]; } else { k=(m+ir)>>1; SWAP(arr[k],arr[m+1]); SWAP(brr[k],brr[m+1]); if(arr[m]<arr[ir]) { SWAP(arr[m],arr[ir]); SWAP(brr[m],brr[ir]); } if(arr[m+1]<arr[ir]) { SWAP(arr[m+1],arr[ir]); SWAP(brr[m+1],brr[ir]); } if(arr[m]<arr[m+1]) { SWAP(arr[m],arr[m+1]); SWAP(brr[m],brr[m+1]); } i=m+1; j=ir; a=arr[m+1]; b=brr[m+1]; for(;;) { do i++; while (arr[i]>a); do j--; while (arr[j]<a); if(j<i) break; SWAP(arr[i],arr[j]); SWAP(brr[i],brr[j]); } arr[m+1]=arr[j]; arr[j]=a; brr[m+1]=brr[j]; brr[j]=b; jstack+=2; /* Push pointers to larger subarray on stack */ /* process smaller subarray immediately */ if(jstack>NSTACK) { printf("Stack error: NSTACK too small\n"); exit(0); } if(ir-i+1>=j-m) { istack[jstack]=ir; istack[jstack-1]=i; ir=j-1; } else { istack[jstack]=j-1; istack[jstack-1]=m; m=i; } } } } /* function to sort an array into a decreasing order: a>b>c>.... */ /* =============================== */ void ArraySort_float2(int n, float *arr, int *brr) /* =============================== */ { int i,ir=n-1,j,k,m=0,b,jstack=0,NSTACK=50,istack[NSTACK],MIN=7; float a,temp; for(;;) { /* Insertion sort when subarray is small enough */ if(ir-m<MIN) { for(j=m+1;j<=ir;j++) { a=arr[j]; b=brr[j]; for(i=j-1;i>=m;i--) { if(arr[i]>=a) break; arr[i+1]=arr[i]; brr[i+1]=brr[i]; } arr[i+1]=a; brr[i+1]=b; } if(!jstack) return; ir=istack[jstack--]; m=istack[jstack--]; } else { k=(m+ir)>>1; SWAP(arr[k],arr[m+1]); SWAP(brr[k],brr[m+1]); if(arr[m]<arr[ir]) { SWAP(arr[m],arr[ir]); SWAP(brr[m],brr[ir]); } if(arr[m+1]<arr[ir]) { SWAP(arr[m+1],arr[ir]); SWAP(brr[m+1],brr[ir]); } if(arr[m]<arr[m+1]) { SWAP(arr[m],arr[m+1]); SWAP(brr[m],brr[m+1]); } i=m+1; j=ir; a=arr[m+1]; b=brr[m+1]; for(;;) { do i++; while (arr[i]>a); do j--; while (arr[j]<a); if(j<i) break; SWAP(arr[i],arr[j]); SWAP(brr[i],brr[j]); } arr[m+1]=arr[j]; arr[j]=a; brr[m+1]=brr[j]; brr[j]=b; jstack+=2; /* Push pointers to larger subarray on stack */ /* process smaller subarray immediately */ if(jstack>NSTACK) { printf("Stack error: NSTACK too small\n"); exit(0); } if(ir-i+1>=j-m) { istack[jstack]=ir; istack[jstack-1]=i; ir=j-1; } else { istack[jstack]=j-1; istack[jstack-1]=m; m=i; } } } } /* =============================== */ void ArraySort_Mix3(int n, long *arr, int *brr, int *crr) /* =============================== */ { int i,ir=n-1,j,k,m=0,jstack=0,b,c,NSTACK=50,istack[NSTACK]; long a,temp,MIN=7; for(;;) { /* Insertion sort when subarray is small enough */ if(ir-m<MIN) { for(j=m+1;j<=ir;j++) { a=arr[j]; b=brr[j]; c=crr[j]; for(i=j-1;i>=m;i--) { if(arr[i]<=a) break; arr[i+1]=arr[i]; brr[i+1]=brr[i]; crr[i+1]=crr[i]; } arr[i+1]=a; brr[i+1]=b; crr[i+1]=c; } if(!jstack) return; ir=istack[jstack--]; m=istack[jstack--]; } else { k=(m+ir)>>1; SWAP(arr[k],arr[m+1]); SWAP(brr[k],brr[m+1]); SWAP(crr[k],crr[m+1]); if(arr[m]>arr[ir]) { SWAP(arr[m],arr[ir]); SWAP(brr[m],brr[ir]); SWAP(crr[m],crr[ir]); } if(arr[m+1]>arr[ir]) { SWAP(arr[m+1],arr[ir]); SWAP(brr[m+1],brr[ir]); SWAP(crr[m+1],crr[ir]); } if(arr[m]>arr[m+1]) { SWAP(arr[m],arr[m+1]); SWAP(brr[m],brr[m+1]); SWAP(crr[m],crr[m+1]); } i=m+1; j=ir; a=arr[m+1]; b=brr[m+1]; c=crr[m+1]; for(;;) { do i++; while (arr[i]<a); do j--; while (arr[j]>a); if(j<i) break; SWAP(arr[i],arr[j]); SWAP(brr[i],brr[j]); SWAP(crr[i],crr[j]); } arr[m+1]=arr[j]; arr[j]=a; brr[m+1]=brr[j]; brr[j]=b; crr[m+1]=crr[j]; crr[j]=c; jstack+=2; /* Push pointers to larger subarray on stack */ /* process smaller subarray immediately */ if(jstack>NSTACK) { printf("Stack error: NSTACK too small\n"); exit(0); } if(ir-i+1>=j-m) { istack[jstack]=ir; istack[jstack-1]=i; ir=j-1; } else { istack[jstack]=j-1; istack[jstack-1]=m; m=i; } } } } /* to swap the string arrays */ /* ============================================= */ void s_swap(char **Pair_Name, int i, int j) /* ============================================= */ { char temp[Max_N_NameBase]; strcpy(temp,Pair_Name[i]); strcpy(Pair_Name[i],Pair_Name[j]); strcpy(Pair_Name[j],temp); } /* to sort the string array in order */ /* ============================================= */ void ArraySort_String(int n, char **Pair_Name, int *brr) /* ============================================= */ { int i,ir=n-1,j,k,m=0,jstack=0,b,NSTACK=50,istack[NSTACK]; int temp,MIN=7; char p[Max_N_NameBase]; for(;;) { /* Insertion sort when subarray is small enough */ if(ir-m<MIN) { for(j=m+1;j<=ir;j++) { strcpy(p,Pair_Name[j]); b=brr[j]; for(i=j-1;i>=m;i--) { if(strcmp(Pair_Name[i],p)<=0) break; strcpy(Pair_Name[i+1],Pair_Name[i]); brr[i+1]=brr[i]; } strcpy(Pair_Name[i+1],p); brr[i+1]=b; } if(!jstack) return; ir=istack[jstack--]; m=istack[jstack--]; } else { k=(m+ir)>>1; s_swap(Pair_Name,k,m+1); SWAP(brr[k],brr[m+1]); if(strcmp(Pair_Name[m],Pair_Name[ir])>0) { s_swap(Pair_Name,m,ir); SWAP(brr[m],brr[ir]); } if(strcmp(Pair_Name[m+1],Pair_Name[ir])>0) { s_swap(Pair_Name,m+1,ir); SWAP(brr[m+1],brr[ir]); } if(strcmp(Pair_Name[m],Pair_Name[m+1])>0) { s_swap(Pair_Name,m,m+1); SWAP(brr[m],brr[m+1]); } i=m+1; j=ir; strcpy(p,Pair_Name[m+1]); b=brr[m+1]; for(;;) { do i++; while (strcmp(Pair_Name[i],p)<0); do j--; while (strcmp(Pair_Name[j],p)>0); if(j<i) break; s_swap(Pair_Name,i,j); SWAP(brr[i],brr[j]); } strcpy(Pair_Name[m+1],Pair_Name[j]); strcpy(Pair_Name[j],p); brr[m+1]=brr[j]; brr[j]=b; jstack+=2; /* Push pointers to larger subarray on stack */ /* process smaller subarray immediately */ if(jstack>NSTACK) { printf("Stack error: NSTACK too small\n"); exit(0); } if(ir-i+1>=j-m) { istack[jstack]=ir; istack[jstack-1]=i; ir=j-1; } else { istack[jstack]=j-1; istack[jstack-1]=m; m=i; } } } } /* creat an int matrix with subscript ange m[nrl...nrh][ncl...nch] */ int **imatrix(long nrl,long nrh,long ncl,long nch) { long i, nrow=nrh-nrl+1,ncol=nch-ncl+1; int **m; /* allocate pointers to rows */ if((m=(int **)calloc(nrow,sizeof(int*)))==NULL) { printf("error imatrix: calloc error No. 1 \n"); return(NULL); } m+=0; m-=nrl; /* allocate rows and set pointers to them */ if((m[nrl]=(int *)calloc(nrow*ncol,sizeof(int)))==NULL) { printf("error imatrix: calloc error No. 2 \n"); return(NULL); } m[nrl]+=0; m[nrl]-=nrl; for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; /* return pointer to array of pointers to rows */ return m; } /* creat char matrix with subscript ange cm[nrl...nrh][ncl...nch] */ char **cmatrix(long nrl,long nrh,long ncl,long nch) { long i, nrow=nrh-nrl+1,ncol=nch-ncl+1; char **cm; /* allocate pointers to rows */ if((cm=(char **)calloc(nrow,sizeof(char*)))==NULL) { printf("error cmatrix: calloc error No. 1 \n"); return(NULL); } cm+=0; cm-=nrl; /* allocate rows and set pointers to them */ if((cm[nrl]=(char *)calloc(nrow*ncol,sizeof(char)))==NULL) { printf("error cmatrix: calloc error No. 2 \n"); return(NULL); } cm[nrl]+=0; cm[nrl]-=nrl; for(i=nrl+1;i<=nrh;i++) cm[i]=cm[i-1]+ncol; /* return pointer to array of pointers to rows */ return cm; } /* creat char matrix with subscript ange fm[nrl...nrh][ncl...nch] */ float **fmatrix(long nrl,long nrh,long ncl,long nch) { long i, nrow=nrh-nrl+1,ncol=nch-ncl+1; float **fm; /* allocate pointers to rows */ if((fm=(float **)calloc(nrow,sizeof(float*)))==NULL) { printf("error fmatrix: calloc error No. 1 \n"); return(NULL); } fm+=0; fm-=nrl; /* allocate rows and set pointers to them */ if((fm[nrl]=(float *)calloc(nrow*ncol,sizeof(float)))==NULL) { printf("error fmatrix: calloc error No. 2 \n"); return(NULL); } fm[nrl]+=0; fm[nrl]-=nrl; for(i=nrl+1;i<=nrh;i++) fm[i]=fm[i-1]+ncol; /* return pointer to array of pointers to rows */ return fm; }
the_stack_data/215769460.c
// // Texture images (16x16 24 bit RGB) // unsigned int texGrass[] = { 0x76a559, 0x669b44, 0x78a354, 0x598a38, 0x6ca04a, 0x6da34d, 0x5d8d3c, 0x619441, 0x5d8f3c, 0x679a46, 0x6ca24c, 0x639542, 0x84b261, 0x8db867, 0x7da455, 0x69984a, 0x6fa152, 0x5e943a, 0x7ead58, 0x5c9037, 0x558b32, 0x60963d, 0x6b9745, 0x5c8f38, 0x699642, 0x5c8e37, 0x6b9844, 0x75a34f, 0x679c43, 0x73a04c, 0x729d4a, 0x6b9d4a, 0x6c9e4f, 0x6c9946, 0x7ca854, 0x60953c, 0x6f9e49, 0x568932, 0x6d9a46, 0x709a47, 0x80ac58, 0x7fae58, 0x699d45, 0x5c9038, 0x52872f, 0x4b8028, 0x558a32, 0x5f923f, 0x669648, 0x679240, 0x5a8d37, 0x5e963c, 0x5b9037, 0x6c9946, 0x62963e, 0x5d9239, 0x77a44f, 0x639740, 0x6e9c47, 0x719d4a, 0x5b8f37, 0x487e26, 0x4d832a, 0x528332, 0x669648, 0x65913d, 0x598d35, 0x5e963c, 0x74a34e, 0x5b8e37, 0x5a9137, 0x5c9339, 0x73a04c, 0x5e933b, 0x588c35, 0x62973e, 0x639a40, 0x52872f, 0x76a44f, 0x75a854, 0x699a4b, 0x52882e, 0x568c33, 0x62983e, 0x77a550, 0x639940, 0x548b32, 0x50862e, 0x568b32, 0x6b9643, 0x7aa853, 0x5b9037, 0x5a9137, 0x538830, 0x74a14d, 0x71a44f, 0x619043, 0x538a30, 0x5a9137, 0x51862e, 0x5f8a38, 0x63963f, 0x598f36, 0x669d43, 0x77a44f, 0x77a24f, 0x63963e, 0x5c9339, 0x548b32, 0x558b32, 0x61963d, 0x6c9f4a, 0x68994a, 0x51882e, 0x599037, 0x4f852d, 0x74a04d, 0x6e9946, 0x53872f, 0x558b32, 0x6d9946, 0x598b35, 0x65923f, 0x5a8f37, 0x4d832a, 0x7dad56, 0x679c43, 0x80ae5c, 0x74a756, 0x548b31, 0x5c9339, 0x548931, 0x7aa953, 0x60933c, 0x52882f, 0x62983f, 0x7ba954, 0x5e923a, 0x7cac55, 0x679c43, 0x447821, 0x6d9a46, 0x598c35, 0x679a46, 0x71a253, 0x73a04b, 0x6ca147, 0x548b32, 0x4c8129, 0x5b9238, 0x5b9138, 0x74a24e, 0x78a551, 0x60963c, 0x548930, 0x5c9339, 0x5e943a, 0x85b65e, 0x689e45, 0x83b35f, 0x68984a, 0x719e4a, 0x79a551, 0x5e943b, 0x50862e, 0x588d34, 0x7aa853, 0x5e933b, 0x548b31, 0x5f963c, 0x67a146, 0x5b9238, 0x598e36, 0x74a24e, 0x649941, 0x5d8d3c, 0x659647, 0x5e943a, 0x77a44f, 0x679c43, 0x719f4a, 0x598c35, 0x72a14c, 0x588c34, 0x599137, 0x6ba448, 0x599037, 0x4c8229, 0x50852d, 0x649b41, 0x5b9138, 0x598b38, 0x669749, 0x51882e, 0x568b33, 0x5d933a, 0x73a04c, 0x53862f, 0x5d9239, 0x5e943b, 0x588c34, 0x5f953c, 0x5b9138, 0x50862e, 0x6a9643, 0x6ba046, 0x73a14d, 0x629341, 0x619042, 0x548b31, 0x4b8129, 0x568c33, 0x538830, 0x558b32, 0x709e49, 0x6f9a47, 0x679140, 0x77a650, 0x5c9138, 0x4f852d, 0x6c9946, 0x60923c, 0x6b9744, 0x679846, 0x578639, 0x52882e, 0x548931, 0x598f36, 0x568c33, 0x5a9137, 0x639840, 0x578b33, 0x51852e, 0x5c9239, 0x578d34, 0x4e832b, 0x4f832b, 0x709c49, 0x61953c, 0x619440, 0x6f9d54, 0x5f943e, 0x81ad5c, 0x60903f, 0x609440, 0x679b47, 0x6c9648, 0x78a254, 0x5d8d3c, 0x588b38, 0x629641, 0x609340, 0x5d8f3c, 0x7ea859, 0x78a152, 0x77a758 }; unsigned int texDirt[] = { 0x916848, 0x5f432d, 0x916848, 0x76553a, 0x76553a, 0x5f432d, 0x916848, 0x5f432d, 0x76553a, 0x5f432d, 0x5f432d, 0x76553a, 0x5f432d, 0x5f432d, 0x76553a, 0x76553a, 0x76553a, 0x76553a, 0x5f432d, 0x555555, 0x5f432d, 0x463020, 0x5f432d, 0x5f432d, 0x5f432d, 0x76553a, 0x76553a, 0x5f432d, 0x463020, 0x76553a, 0x5f432d, 0x5f432d, 0x76553a, 0x463020, 0x5f432d, 0x916848, 0x76553a, 0x76553a, 0x5f432d, 0x916848, 0x5f432d, 0x463020, 0x5f432d, 0x5f432d, 0x76553a, 0x5f432d, 0x463020, 0x916848, 0x5f432d, 0x5f432d, 0x463020, 0x5f432d, 0x916848, 0x76553a, 0x5f432d, 0x916848, 0x76553a, 0x5f432d, 0x916848, 0x76553a, 0x5f432d, 0x5f432d, 0x916848, 0x76553a, 0x5f432d, 0x5f432d, 0x916848, 0x76553a, 0x463020, 0x5f432d, 0x6a6a6a, 0x76553a, 0x5f432d, 0x5f432d, 0x916848, 0x76553a, 0x76553a, 0x5b4535, 0x5f432d, 0x76553a, 0x916848, 0x76553a, 0x5f432d, 0x463020, 0x76553a, 0x76553a, 0x5f432d, 0x76553a, 0x76553a, 0x463020, 0x5f432d, 0x916848, 0x76553a, 0x5f432d, 0x463020, 0x5f432d, 0x76553a, 0x6a6a6a, 0x5f432d, 0x5f432d, 0x5f432d, 0x463020, 0x5f432d, 0x5f432d, 0x5f432d, 0x463020, 0x916848, 0x5f432d, 0x916848, 0x76553a, 0x5f432d, 0x6a6a6a, 0x76553a, 0x463020, 0x5f432d, 0x916848, 0x5f432d, 0x463020, 0x916848, 0x5f432d, 0x463020, 0x5f432d, 0x76553a, 0x76553a, 0x5f432d, 0x76553a, 0x463020, 0x5f432d, 0x5f432d, 0x5f432d, 0x916848, 0x76553a, 0x76553a, 0x463020, 0x916848, 0x76553a, 0x5f432d, 0x5f432d, 0x463020, 0x555555, 0x5f432d, 0x5f432d, 0x916848, 0x76553a, 0x5f432d, 0x916848, 0x5f432d, 0x76553a, 0x463020, 0x5f432d, 0x5f432d, 0x463020, 0x76553a, 0x5f432d, 0x916848, 0x76553a, 0x5f432d, 0x463020, 0x916848, 0x76553a, 0x463020, 0x76553a, 0x5f432d, 0x5f432d, 0x5f432d, 0x5f432d, 0x916848, 0x76553a, 0x76553a, 0x5f432d, 0x916848, 0x76553a, 0x5f432d, 0x916848, 0x5f432d, 0x5f432d, 0x5f432d, 0x5f432d, 0x5f432d, 0x76553a, 0x555555, 0x463020, 0x916848, 0x76553a, 0x5f432d, 0x5f432d, 0x463020, 0x5f432d, 0x5f432d, 0x463020, 0x76553a, 0x5f432d, 0x5f432d, 0x916848, 0x463020, 0x5f432d, 0x5f432d, 0x5f432d, 0x5f432d, 0x5f432d, 0x5f432d, 0x916848, 0x76553a, 0x463020, 0x5f432d, 0x5f432d, 0x5f432d, 0x76553a, 0x916848, 0x76553a, 0x463020, 0x916848, 0x76553a, 0x5f432d, 0x76553a, 0x5f432d, 0x5f432d, 0x916848, 0x76553a, 0x76553a, 0x5f432d, 0x916848, 0x5f432d, 0x76553a, 0x5f432d, 0x463020, 0x916848, 0x76553a, 0x463020, 0x5f432d, 0x5f432d, 0x76553a, 0x463020, 0x5f432d, 0x6a6a6a, 0x5f432d, 0x916848, 0x76553a, 0x76553a, 0x5f432d, 0x916848, 0x463020, 0x5f432d, 0x5f432d, 0x5f432d, 0x916848, 0x76553a, 0x76553a, 0x5f432d, 0x76553a, 0x5f432d, 0x463020, 0x916848, 0x76553a, 0x76553a, 0x463020 }; unsigned int texGrassSide[] = { 0x5b8d3a, 0x5c8e3b, 0x6f9349, 0x463020, 0x76553a, 0x5f432d, 0x916848, 0x5f432d, 0x76553a, 0x5f432d, 0x5f432d, 0x76553a, 0x5f432d, 0x5f432d, 0x76553a, 0x76553a, 0x5d8f3c, 0x558734, 0x463020, 0x555555, 0x5f432d, 0x463020, 0x5f432d, 0x5f432d, 0x5f432d, 0x76553a, 0x76553a, 0x5f432d, 0x463020, 0x76553a, 0x5f432d, 0x5f432d, 0x5a8c39, 0x6c9147, 0x7a9f55, 0x463020, 0x76553a, 0x76553a, 0x5f432d, 0x916848, 0x5f432d, 0x463020, 0x5f432d, 0x5f432d, 0x76553a, 0x5f432d, 0x463020, 0x916848, 0x50822f, 0x658a40, 0x4e812d, 0x463020, 0x916848, 0x76553a, 0x5f432d, 0x916848, 0x76553a, 0x5f432d, 0x916848, 0x76553a, 0x5f432d, 0x5f432d, 0x916848, 0x76553a, 0x50822f, 0x678c41, 0x528531, 0x598b38, 0x463020, 0x5f432d, 0x6a6a6a, 0x76553a, 0x5f432d, 0x5f432d, 0x916848, 0x76553a, 0x76553a, 0x5b4535, 0x5f432d, 0x76553a, 0x578936, 0x463020, 0x463020, 0x463020, 0x76553a, 0x76553a, 0x5f432d, 0x76553a, 0x76553a, 0x463020, 0x5f432d, 0x916848, 0x76553a, 0x5f432d, 0x463020, 0x5f432d, 0x4a7d2a, 0x528431, 0x588a37, 0x463020, 0x5f432d, 0x463020, 0x5f432d, 0x5f432d, 0x5f432d, 0x463020, 0x916848, 0x5f432d, 0x916848, 0x76553a, 0x5f432d, 0x6a6a6a, 0x558734, 0x4d7f2c, 0x463020, 0x463020, 0x5f432d, 0x463020, 0x916848, 0x5f432d, 0x463020, 0x5f432d, 0x76553a, 0x76553a, 0x5f432d, 0x76553a, 0x463020, 0x5f432d, 0x639542, 0x4a7d2a, 0x5b8d3a, 0x4a7d2a, 0x463020, 0x463020, 0x916848, 0x76553a, 0x5f432d, 0x5f432d, 0x463020, 0x555555, 0x5f432d, 0x5f432d, 0x916848, 0x76553a, 0x5d8f3c, 0x73984e, 0x649643, 0x463020, 0x463020, 0x5f432d, 0x5f432d, 0x463020, 0x76553a, 0x5f432d, 0x916848, 0x76553a, 0x5f432d, 0x463020, 0x916848, 0x76553a, 0x538532, 0x71964b, 0x72974d, 0x558835, 0x463020, 0x5f432d, 0x916848, 0x76553a, 0x76553a, 0x5f432d, 0x916848, 0x76553a, 0x5f432d, 0x916848, 0x5f432d, 0x5f432d, 0x518330, 0x5a8c39, 0x769b51, 0x463020, 0x555555, 0x463020, 0x916848, 0x76553a, 0x5f432d, 0x5f432d, 0x463020, 0x5f432d, 0x5f432d, 0x463020, 0x76553a, 0x5f432d, 0x528531, 0x4c7e2b, 0x463020, 0x5f432d, 0x5f432d, 0x5f432d, 0x5f432d, 0x5f432d, 0x5f432d, 0x916848, 0x76553a, 0x463020, 0x5f432d, 0x5f432d, 0x5f432d, 0x76553a, 0x4c7e2b, 0x558734, 0x447623, 0x463020, 0x76553a, 0x5f432d, 0x76553a, 0x5f432d, 0x5f432d, 0x916848, 0x76553a, 0x76553a, 0x5f432d, 0x916848, 0x5f432d, 0x76553a, 0x3f711e, 0x518330, 0x4b7d2a, 0x463020, 0x463020, 0x5f432d, 0x5f432d, 0x76553a, 0x463020, 0x5f432d, 0x6a6a6a, 0x5f432d, 0x916848, 0x76553a, 0x76553a, 0x5f432d, 0x558835, 0x548633, 0x463020, 0x5f432d, 0x5f432d, 0x916848, 0x76553a, 0x76553a, 0x5f432d, 0x76553a, 0x5f432d, 0x463020, 0x916848, 0x76553a, 0x76553a, 0x463020 };
the_stack_data/18887650.c
#include <stdio.h> #include <math.h> #include <complex.h> #include <sys/time.h> #include <omp.h> #define M_PI 3.14159265358979323846 /************************************* image variables ********************************************/ int pX, pY; const int pXmax = 1280; // 2 billion+ px each side should be enough resolution right??????? const int pYmax = 1280; // for main antenna const int iterationMax = 1000; /**************************************************************************************************/ /****************************** coordinate plane to be rendered ***********************************/ const double CxMin = -2.2; const double CxMax = 0.8; const double CyMin = -1.5; const double CyMax = 1.5; /**************************************************************************************************/ /**************************************** file stuff **********************************************/ double pixelWidth; //=(CxMax-CxMin)/pXmax; double pixelHeight; // =(CyMax-CyMin)/pYmax; const int maxColorComponentValue = 255; // rgb - SDR colorspace (8 bits per color) FILE * fp; char * filename = "..\\..\\output\\mandelbrotC.ppm"; // char * comment = "# "; // comment should start with # /**************************************************************************************************/ /************************************* render parameters ******************************************/ unsigned char stripeDensity = 7; // higher is more dense int i_skip = 1; // exclude (i_skip+1) elements from average const double escapeRadius = 1000000; // big! (bail-out value) double lnER; /**************************************************************************************************/ /** * Function: get_c * --------------- * Gets the corresponding coordinate point for the location of a pixel. * * Inputs: * iX: number of x-iteration * iY: number of y-iteration * * Returns: * Complex double form of the coordinate. */ double _Complex get_c(int iX, int iY) { double Cx, Cy; Cy = CyMax - iY * pixelHeight; //if (fabs(Cy)< pixelHeight/3.0) Cy=0.0; // main antenna Cx = CxMin + iX * pixelWidth; return Cx + Cy * I; } /** * Function: c_dot * --------------- * Computes the dot product of 2 complex double vectors. * * Inputs: * a: vector 1 * b: vector 2 * * Returns: * The dot product in double form. */ double c_dot(double _Complex a, double _Complex b) { return creal(a) * creal(b) + cimag(a) * cimag(b); } /** * Function: get_t * --------------- * Addend function used to get the value of A for stripe-average coloring method. * https://en.wikibooks.org/wiki/Fractals/Iterations_in_the_complex_plane/stripeAC * * Inputs: * z: complex number * * Returns: * Double number */ double getT(double _Complex z){ return 0.5+0.5*sin(stripeDensity*carg(z)); } /** * Function: colorize * ------------------ * The bread and butter of this program; determines if point is within set by escape-time * algorithm and performs the colorization of the corresponding pixel. * * Inputs: * c: the current coordinate point * *row: the array of 1 row's pixel data * iX: current pixel within the row * iMax: maximum number of iterations * * Returns: * 0 if completed. */ int colorize(double _Complex c, unsigned char *row, int iX, int iMax) { /** global **/ unsigned char b; // color int i; // iteration /** normal map **/ double _Complex Z = 0.0; // initial value for iteration Z0 double _Complex dC = 0.0; // derivative with respect to c double reflection = FP_ZERO; // inside double h2 = 1.5; // height factor of the incoming light double angle = 45.0 / 360.0; // incoming direction of light in turns (change 1st #) double _Complex v = cexp(2.0 * angle * M_PI * I); // unit 2D vector in this direction double _Complex u; // normal /** arg vars **/ double A = 0.0; // A(n) double prevA = 0.0; // A(n-1) double R; double d; // smooth iteration count double de; // boundary descriptor /** do the compute **/ for (i = 0; i < iMax; i++) { dC = 2.0 * dC * Z + 1.0; Z = Z * Z + c; if (i>i_skip) A += getT(Z); R = cabs(Z); /* shape checking algorithm skips iterating points within the main cardioid and secondary bulb, otherwise these would all hit the max iterations removes about 91% of the set from iteration REMOVE THIS IF NOT RENDERING THE ENTIRE SET - more computation per iteration if the main cardioid and secondary bulb are not shown onscreen */ double q = ((creal(c) - 0.25) * (creal(c) - 0.25)) + (cimag(c) * cimag(c)); double cardioid = 0.25 * cimag(c) * cimag(c); double bulb = 0.0625; if ((creal(c) * creal(c) + 2 * creal(c) + 1 + cimag(c) * cimag(c)) < bulb || (q * (q + (creal(c) - 0.25)) < cardioid)) { break; } /** get normal map **/ if (R > escapeRadius) { // exterior of M set u = Z / dC; u = u / cabs(u); reflection = c_dot(u, v) + h2; reflection = reflection / (1.0 + h2); // rescale so that t does not get bigger than 1 if (reflection < 0.0) reflection = 0.0; break; } prevA = A; // save value for interpolation } /** get striping **/ if (i == iMax) A = -1.0; // interior else { // exterior de = 2 * R * log(R) / cabs(dC); int thin = 3; // thinness of the border if (de < (pixelWidth / thin)) A = FP_ZERO; // boundary else { // computing interpolated average A /= (i - i_skip) ; // A(n) prevA /= (i - i_skip - 1) ; // A(n-1) // smooth iteration count d = i + 1 + log(lnER/log(R))/M_LN2; d = d - (int)d; // only fractional part = interpolation coefficient // linear interpolation A = d*A + (1.0-d)*prevA; } } /** assign pixel color values **/ int subPixel = 3 * iX; if (reflection == FP_ZERO) { // interior of Mandelbrot set = black /* ppm files have pixels situated as groups of 3 ASCII chars in a row; the columns of the image file will be 3x as numerous as the rows attempting to store the image rows as a vector in memory and write to the file 1 row at a time */ row[subPixel] = 0; row[subPixel+1] = 0; row[subPixel+2] = 0; } // exterior of Mandelbrot set -> normal else { // multiply the underlying stripe gradient by the reflectivity map if (A == FP_ZERO) b = 255; // boundary else b = (unsigned char) ((254-(100*A)) * reflection); // set color bounds for striping row[subPixel] = b; row[subPixel+1] = b; row[subPixel+2] = b; } return 0; } /** * Function: setup * --------------- * Sets up the .ppm file stream and parameters. * * Inputs: * NULL * * Returns: * NULL */ void setup() { pixelWidth = (CxMax - CxMin) / pXmax; pixelHeight = (CyMax - CyMin) / pYmax; lnER = log(escapeRadius); // create new ppm6 file, give it a name, and open it in binary mode fp = fopen(filename, "wb"); // write ASCII header to the file fprintf(fp, "P6\n %d\n %d\n %d\n", pXmax, pYmax, maxColorComponentValue); } /** * Function: info * -------------- * Provides debugging information from the file. * * Inputs: * NULL * * Returns: * NULL */ void info() { double distortion; // width/height double pixelsAspectRatio = (double) pXmax / pYmax; double worldAspectRatio = (CxMax - CxMin) / (CyMax - CyMin); // printf("pixelsAspectRatio = %.16f \n", pixelsAspectRatio); // printf("worldAspectRatio = %.16f \n", worldAspectRatio); distortion = pixelsAspectRatio - worldAspectRatio; printf("distortion = %.16f (should be zero!)\n", distortion); // printf("bailout value = Escape Radius = %.0f \n", escapeRadius); // printf("iterationMax = %d \n", iterationMax); // printf("i_skip = %d = number of skipped elements ( including t0 )= %d \n", i_skip, i_skip+1); printf("file %s saved.\n", filename); } /** * Function: close * --------------- * Closes file stream and calls debugging info function. * * Inputs: * NULL * * Returns: * NULL */ void close() { fclose(fp); info(); } /********************************************** main **********************************************/ int main() { struct timeval begin, end; gettimeofday(&begin, 0); double _Complex c; unsigned char row[pXmax * 3]; setup(); printf("Rendering row by row:\n"); for (pY = 0; pY < pYmax; pY++) { //#pragma omp parallel for schedule(dynamic) for (pX = 0; pX < pXmax; pX++) { // compute pixel coordinate c = get_c(pX, pY); // compute pixel color (24 bit = 3 bytes) colorize(c, row, pX, iterationMax); } // write the cached row of pixels fwrite(row, 1, (size_t)sizeof(row), fp); //fwrite("\n", 1, 1, fp); // unnecessary } close(); gettimeofday(&end, 0); long seconds = end.tv_sec - begin.tv_sec; long microseconds = end.tv_usec - begin.tv_usec; double execTime = seconds + microseconds*1e-6; printf("Time elapsed: %f seconds", execTime); return 0; }
the_stack_data/32950897.c
// RUN: %clang_cc1 -triple mips64-none-linux-gnu -emit-pch -o %t %s // RUN: %clang_cc1 -x ast -ast-print %t | FileCheck %s // Make sure the semantics of FloatingLiterals are stored correctly in // the AST. Previously, the ASTWriter didn't store anything and the // reader assumed PPC 128-bit float semantics, which is incorrect for // targets with 128-bit IEEE long doubles. long double foo = 1.0E4000L; // CHECK: long double foo = 1.0E+4000L; // Just as well check the others are still sane while we're here... double bar = 1.0E300; // CHECK: double bar = 1.0E+300; float wibble = 1.0E40; // CHECK: float wibble = 1.0E+40;
the_stack_data/1241196.c
#include<stdio.h> int main () { int num, rem, sum = 0, i; char ch; do { printf("Enter The Number : "); scanf("%d", &num); for(i = 1; i < num; i++) { rem = num % i; if (rem == 0) { sum = sum + i; } } if (sum == num) printf("%d Is A Perfect Number\n", num); else printf("\n%d Isn't a Perfect Number\n"); printf ("\nDo You Want To Repeat The Operation Y/N : "); scanf (" %c", &ch); } while (ch == 'y' || ch == 'Y'); }
the_stack_data/845472.c
/* Copyright (c) 2017 Dennis Wölfing * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* libc/src/unistd/getcwd.c * Gets the current working directory. */ #include <errno.h> #include <stdlib.h> #include <string.h> #include <unistd.h> char* getcwd(char* buffer, size_t size) { if (buffer && size == 0) { errno = EINVAL; return NULL; } char* result = canonicalize_file_name("."); if (!result) return NULL; if (!buffer) { // As an extension we allocate the buffer for the caller. return result; } if (strlcpy(buffer, result, size) >= size) { free(result); errno = ERANGE; return NULL; } free(result); return buffer; }
the_stack_data/80253.c
// EXPECT: 0 int main() { return 0 > 0; }
the_stack_data/93886495.c
extern void __VERIFIER_error() __attribute__ ((__noreturn__)); extern int __VERIFIER_nondet_int(void); /* Generated by CIL v. 1.3.7 */ /* print_CIL_Input is true */ #line 2 "libacc.c" struct JoinPoint { void **(*fp)(struct JoinPoint * ) ; void **args ; int argsCount ; char const **argsType ; void *(*arg)(int , struct JoinPoint * ) ; char const *(*argType)(int , struct JoinPoint * ) ; void **retValue ; char const *retType ; char const *funcName ; char const *targetName ; char const *fileName ; char const *kind ; void *excep_return ; }; #line 18 "libacc.c" struct __UTAC__CFLOW_FUNC { int (*func)(int , int ) ; int val ; struct __UTAC__CFLOW_FUNC *next ; }; #line 18 "libacc.c" struct __UTAC__EXCEPTION { void *jumpbuf ; unsigned long long prtValue ; int pops ; struct __UTAC__CFLOW_FUNC *cflowfuncs ; }; #line 211 "/usr/lib/gcc/x86_64-linux-gnu/4.4.5/include/stddef.h" typedef unsigned long size_t; #line 76 "libacc.c" struct __ACC__ERR { void *v ; struct __ACC__ERR *next ; }; #line 1 "Test.o" #pragma merger(0,"Test.i","") #line 359 "/usr/include/stdio.h" extern int printf(char const * __restrict __format , ...) ; #line 688 extern int puts(char const *__s ) ; #line 51 "ClientLib.h" void setClientForwardReceiver(int handle , int value ) ; #line 55 void setClientId(int handle , int value ) ; #line 8 "featureselect.h" int __SELECTED_FEATURE_Base ; #line 11 "featureselect.h" int __SELECTED_FEATURE_Keys ; #line 14 "featureselect.h" int __SELECTED_FEATURE_Encrypt ; #line 17 "featureselect.h" int __SELECTED_FEATURE_AutoResponder ; #line 20 "featureselect.h" int __SELECTED_FEATURE_AddressBook ; #line 23 "featureselect.h" int __SELECTED_FEATURE_Sign ; #line 26 "featureselect.h" int __SELECTED_FEATURE_Forward ; #line 29 "featureselect.h" int __SELECTED_FEATURE_Verify ; #line 32 "featureselect.h" int __SELECTED_FEATURE_Decrypt ; #line 35 "featureselect.h" int __GUIDSL_ROOT_PRODUCTION ; #line 37 "featureselect.h" int __GUIDSL_NON_TERMINAL_main ; #line 43 void select_features(void) ; #line 45 void select_helpers(void) ; #line 47 int valid_product(void) ; #line 17 "Client.h" int is_queue_empty(void) ; #line 19 int get_queued_client(void) ; #line 21 int get_queued_email(void) ; #line 26 void outgoing(int client , int msg ) ; #line 35 void sendEmail(int sender , int receiver ) ; #line 2 "Test.h" int bob ; #line 5 "Test.h" int rjh ; #line 8 "Test.h" int chuck ; #line 11 void setup_bob(int bob___0 ) ; #line 14 void setup_rjh(int rjh___0 ) ; #line 17 void setup_chuck(int chuck___0 ) ; #line 23 void bobToRjh(void) ; #line 26 void rjhToBob(void) ; #line 29 void test(void) ; #line 32 void setup(void) ; #line 35 int main(void) ; #line 36 void rjhEnableForwarding(void) ; #line 18 "Test.c" void setup_bob(int bob___0 ) { { { #line 19 setClientId(bob___0, bob___0); } #line 1304 "Test.c" return; } } #line 26 "Test.c" void setup_rjh(int rjh___0 ) { { { #line 27 setClientId(rjh___0, rjh___0); } #line 1324 "Test.c" return; } } #line 33 "Test.c" void setup_chuck(int chuck___0 ) { { { #line 34 setClientId(chuck___0, chuck___0); } #line 1344 "Test.c" return; } } #line 44 "Test.c" void bobToRjh(void) { int tmp ; int tmp___0 ; int tmp___1 ; { { #line 46 puts("Please enter a subject and a message body.\n"); #line 47 sendEmail(bob, rjh); #line 48 tmp___1 = is_queue_empty(); } #line 48 if (tmp___1) { } else { { #line 49 tmp = get_queued_email(); #line 49 tmp___0 = get_queued_client(); #line 49 outgoing(tmp___0, tmp); } } #line 1371 "Test.c" return; } } #line 56 "Test.c" void rjhToBob(void) { { { #line 58 puts("Please enter a subject and a message body.\n"); #line 59 sendEmail(rjh, bob); } #line 1393 "Test.c" return; } } #line 63 "Test.c" #line 70 "Test.c" void setup(void) { char const * __restrict __cil_tmp1 ; char const * __restrict __cil_tmp2 ; char const * __restrict __cil_tmp3 ; { { #line 71 bob = 1; #line 72 setup_bob(bob); #line 73 __cil_tmp1 = (char const * __restrict )"bob: %d\n"; #line 73 printf(__cil_tmp1, bob); #line 75 rjh = 2; #line 76 setup_rjh(rjh); #line 77 __cil_tmp2 = (char const * __restrict )"rjh: %d\n"; #line 77 printf(__cil_tmp2, rjh); #line 79 chuck = 3; #line 80 setup_chuck(chuck); #line 81 __cil_tmp3 = (char const * __restrict )"chuck: %d\n"; #line 81 printf(__cil_tmp3, chuck); } #line 1464 "Test.c" return; } } #line 87 "Test.c" int main(void) { int retValue_acc ; int tmp ; { { #line 88 select_helpers(); #line 89 select_features(); #line 90 tmp = valid_product(); } #line 90 if (tmp) { { #line 91 setup(); #line 92 test(); } } else { } #line 1495 "Test.c" return (retValue_acc); } } #line 100 "Test.c" void rjhEnableForwarding(void) { { { #line 101 setClientForwardReceiver(rjh, chuck); } #line 1519 "Test.c" return; } } #line 1 "wsllib_check.o" #pragma merger(0,"wsllib_check.i","") #line 3 "wsllib_check.c" void __automaton_fail(void) { { ERROR: __VERIFIER_error(); #line 53 "wsllib_check.c" return; } } #line 1 "scenario.o" #pragma merger(0,"scenario.i","") #line 1 "scenario.c" void test(void) { int op1 ; int op2 ; int op3 ; int op4 ; int op5 ; int op6 ; int op7 ; int op8 ; int op9 ; int op10 ; int op11 ; int splverifierCounter ; int tmp ; int tmp___0 ; int tmp___1 ; int tmp___2 ; int tmp___3 ; int tmp___4 ; int tmp___5 ; int tmp___6 ; int tmp___7 ; int tmp___8 ; int tmp___9 ; { #line 2 op1 = 0; #line 3 op2 = 0; #line 4 op3 = 0; #line 5 op4 = 0; #line 6 op5 = 0; #line 7 op6 = 0; #line 8 op7 = 0; #line 9 op8 = 0; #line 10 op9 = 0; #line 11 op10 = 0; #line 12 op11 = 0; #line 13 splverifierCounter = 0; { #line 14 while (1) { while_0_continue: /* CIL Label */ ; #line 14 if (splverifierCounter < 4) { } else { goto while_0_break; } #line 15 splverifierCounter = splverifierCounter + 1; #line 16 if (! op1) { { #line 16 tmp___9 = __VERIFIER_nondet_int(); } #line 16 if (tmp___9) { #line 17 op1 = 1; } else { goto _L___8; } } else { _L___8: /* CIL Label */ #line 18 if (! op2) { { #line 18 tmp___8 = __VERIFIER_nondet_int(); } #line 18 if (tmp___8) { #line 20 op2 = 1; } else { goto _L___7; } } else { _L___7: /* CIL Label */ #line 21 if (! op3) { { #line 21 tmp___7 = __VERIFIER_nondet_int(); } #line 21 if (tmp___7) { #line 23 op3 = 1; } else { goto _L___6; } } else { _L___6: /* CIL Label */ #line 24 if (! op4) { { #line 24 tmp___6 = __VERIFIER_nondet_int(); } #line 24 if (tmp___6) { #line 26 op4 = 1; } else { goto _L___5; } } else { _L___5: /* CIL Label */ #line 27 if (! op5) { { #line 27 tmp___5 = __VERIFIER_nondet_int(); } #line 27 if (tmp___5) { #line 29 op5 = 1; } else { goto _L___4; } } else { _L___4: /* CIL Label */ #line 30 if (! op6) { { #line 30 tmp___4 = __VERIFIER_nondet_int(); } #line 30 if (tmp___4) { { #line 32 rjhEnableForwarding(); #line 33 op6 = 1; } } else { goto _L___3; } } else { _L___3: /* CIL Label */ #line 34 if (! op7) { { #line 34 tmp___3 = __VERIFIER_nondet_int(); } #line 34 if (tmp___3) { #line 36 op7 = 1; } else { goto _L___2; } } else { _L___2: /* CIL Label */ #line 37 if (! op8) { { #line 37 tmp___2 = __VERIFIER_nondet_int(); } #line 37 if (tmp___2) { #line 39 op8 = 1; } else { goto _L___1; } } else { _L___1: /* CIL Label */ #line 40 if (! op9) { { #line 40 tmp___1 = __VERIFIER_nondet_int(); } #line 40 if (tmp___1) { #line 42 op9 = 1; } else { goto _L___0; } } else { _L___0: /* CIL Label */ #line 43 if (! op10) { { #line 43 tmp___0 = __VERIFIER_nondet_int(); } #line 43 if (tmp___0) { #line 45 op10 = 1; } else { goto _L; } } else { _L: /* CIL Label */ #line 46 if (! op11) { { #line 46 tmp = __VERIFIER_nondet_int(); } #line 46 if (tmp) { #line 48 op11 = 1; } else { goto while_0_break; } } else { goto while_0_break; } } } } } } } } } } } } while_0_break: /* CIL Label */ ; } { #line 52 bobToRjh(); } #line 151 "scenario.c" return; } } #line 1 "EmailLib.o" #pragma merger(0,"EmailLib.i","") #line 4 "EmailLib.h" int initEmail(void) ; #line 6 int getEmailId(int handle ) ; #line 8 void setEmailId(int handle , int value ) ; #line 10 int getEmailFrom(int handle ) ; #line 12 void setEmailFrom(int handle , int value ) ; #line 14 int getEmailTo(int handle ) ; #line 16 void setEmailTo(int handle , int value ) ; #line 18 char *getEmailSubject(int handle ) ; #line 20 void setEmailSubject(int handle , char *value ) ; #line 22 char *getEmailBody(int handle ) ; #line 24 void setEmailBody(int handle , char *value ) ; #line 26 int isEncrypted(int handle ) ; #line 28 void setEmailIsEncrypted(int handle , int value ) ; #line 30 int getEmailEncryptionKey(int handle ) ; #line 32 void setEmailEncryptionKey(int handle , int value ) ; #line 34 int isSigned(int handle ) ; #line 36 void setEmailIsSigned(int handle , int value ) ; #line 38 int getEmailSignKey(int handle ) ; #line 40 void setEmailSignKey(int handle , int value ) ; #line 42 int isVerified(int handle ) ; #line 44 void setEmailIsSignatureVerified(int handle , int value ) ; #line 5 "EmailLib.c" int __ste_Email_counter = 0; #line 7 "EmailLib.c" int initEmail(void) { int retValue_acc ; { #line 12 "EmailLib.c" if (__ste_Email_counter < 2) { #line 670 __ste_Email_counter = __ste_Email_counter + 1; #line 670 retValue_acc = __ste_Email_counter; #line 672 return (retValue_acc); } else { #line 678 "EmailLib.c" retValue_acc = -1; #line 680 return (retValue_acc); } #line 687 "EmailLib.c" return (retValue_acc); } } #line 15 "EmailLib.c" int __ste_email_id0 = 0; #line 17 "EmailLib.c" int __ste_email_id1 = 0; #line 19 "EmailLib.c" int getEmailId(int handle ) { int retValue_acc ; { #line 26 "EmailLib.c" if (handle == 1) { #line 716 retValue_acc = __ste_email_id0; #line 718 return (retValue_acc); } else { #line 720 if (handle == 2) { #line 725 retValue_acc = __ste_email_id1; #line 727 return (retValue_acc); } else { #line 733 "EmailLib.c" retValue_acc = 0; #line 735 return (retValue_acc); } } #line 742 "EmailLib.c" return (retValue_acc); } } #line 29 "EmailLib.c" void setEmailId(int handle , int value ) { { #line 35 if (handle == 1) { #line 31 __ste_email_id0 = value; } else { #line 32 if (handle == 2) { #line 33 __ste_email_id1 = value; } else { } } #line 773 "EmailLib.c" return; } } #line 37 "EmailLib.c" int __ste_email_from0 = 0; #line 39 "EmailLib.c" int __ste_email_from1 = 0; #line 41 "EmailLib.c" int getEmailFrom(int handle ) { int retValue_acc ; { #line 48 "EmailLib.c" if (handle == 1) { #line 798 retValue_acc = __ste_email_from0; #line 800 return (retValue_acc); } else { #line 802 if (handle == 2) { #line 807 retValue_acc = __ste_email_from1; #line 809 return (retValue_acc); } else { #line 815 "EmailLib.c" retValue_acc = 0; #line 817 return (retValue_acc); } } #line 824 "EmailLib.c" return (retValue_acc); } } #line 51 "EmailLib.c" void setEmailFrom(int handle , int value ) { { #line 57 if (handle == 1) { #line 53 __ste_email_from0 = value; } else { #line 54 if (handle == 2) { #line 55 __ste_email_from1 = value; } else { } } #line 855 "EmailLib.c" return; } } #line 59 "EmailLib.c" int __ste_email_to0 = 0; #line 61 "EmailLib.c" int __ste_email_to1 = 0; #line 63 "EmailLib.c" int getEmailTo(int handle ) { int retValue_acc ; { #line 70 "EmailLib.c" if (handle == 1) { #line 880 retValue_acc = __ste_email_to0; #line 882 return (retValue_acc); } else { #line 884 if (handle == 2) { #line 889 retValue_acc = __ste_email_to1; #line 891 return (retValue_acc); } else { #line 897 "EmailLib.c" retValue_acc = 0; #line 899 return (retValue_acc); } } #line 906 "EmailLib.c" return (retValue_acc); } } #line 73 "EmailLib.c" void setEmailTo(int handle , int value ) { { #line 79 if (handle == 1) { #line 75 __ste_email_to0 = value; } else { #line 76 if (handle == 2) { #line 77 __ste_email_to1 = value; } else { } } #line 937 "EmailLib.c" return; } } #line 81 "EmailLib.c" char *__ste_email_subject0 ; #line 83 "EmailLib.c" char *__ste_email_subject1 ; #line 85 "EmailLib.c" char *getEmailSubject(int handle ) { char *retValue_acc ; void *__cil_tmp3 ; { #line 92 "EmailLib.c" if (handle == 1) { #line 962 retValue_acc = __ste_email_subject0; #line 964 return (retValue_acc); } else { #line 966 if (handle == 2) { #line 971 retValue_acc = __ste_email_subject1; #line 973 return (retValue_acc); } else { #line 979 "EmailLib.c" __cil_tmp3 = (void *)0; #line 979 retValue_acc = (char *)__cil_tmp3; #line 981 return (retValue_acc); } } #line 988 "EmailLib.c" return (retValue_acc); } } #line 95 "EmailLib.c" void setEmailSubject(int handle , char *value ) { { #line 101 if (handle == 1) { #line 97 __ste_email_subject0 = value; } else { #line 98 if (handle == 2) { #line 99 __ste_email_subject1 = value; } else { } } #line 1019 "EmailLib.c" return; } } #line 103 "EmailLib.c" char *__ste_email_body0 = (char *)0; #line 105 "EmailLib.c" char *__ste_email_body1 = (char *)0; #line 107 "EmailLib.c" char *getEmailBody(int handle ) { char *retValue_acc ; void *__cil_tmp3 ; { #line 114 "EmailLib.c" if (handle == 1) { #line 1044 retValue_acc = __ste_email_body0; #line 1046 return (retValue_acc); } else { #line 1048 if (handle == 2) { #line 1053 retValue_acc = __ste_email_body1; #line 1055 return (retValue_acc); } else { #line 1061 "EmailLib.c" __cil_tmp3 = (void *)0; #line 1061 retValue_acc = (char *)__cil_tmp3; #line 1063 return (retValue_acc); } } #line 1070 "EmailLib.c" return (retValue_acc); } } #line 117 "EmailLib.c" void setEmailBody(int handle , char *value ) { { #line 123 if (handle == 1) { #line 119 __ste_email_body0 = value; } else { #line 120 if (handle == 2) { #line 121 __ste_email_body1 = value; } else { } } #line 1101 "EmailLib.c" return; } } #line 125 "EmailLib.c" int __ste_email_isEncrypted0 = 0; #line 127 "EmailLib.c" int __ste_email_isEncrypted1 = 0; #line 129 "EmailLib.c" int isEncrypted(int handle ) { int retValue_acc ; { #line 136 "EmailLib.c" if (handle == 1) { #line 1126 retValue_acc = __ste_email_isEncrypted0; #line 1128 return (retValue_acc); } else { #line 1130 if (handle == 2) { #line 1135 retValue_acc = __ste_email_isEncrypted1; #line 1137 return (retValue_acc); } else { #line 1143 "EmailLib.c" retValue_acc = 0; #line 1145 return (retValue_acc); } } #line 1152 "EmailLib.c" return (retValue_acc); } } #line 139 "EmailLib.c" void setEmailIsEncrypted(int handle , int value ) { { #line 145 if (handle == 1) { #line 141 __ste_email_isEncrypted0 = value; } else { #line 142 if (handle == 2) { #line 143 __ste_email_isEncrypted1 = value; } else { } } #line 1183 "EmailLib.c" return; } } #line 147 "EmailLib.c" int __ste_email_encryptionKey0 = 0; #line 149 "EmailLib.c" int __ste_email_encryptionKey1 = 0; #line 151 "EmailLib.c" int getEmailEncryptionKey(int handle ) { int retValue_acc ; { #line 158 "EmailLib.c" if (handle == 1) { #line 1208 retValue_acc = __ste_email_encryptionKey0; #line 1210 return (retValue_acc); } else { #line 1212 if (handle == 2) { #line 1217 retValue_acc = __ste_email_encryptionKey1; #line 1219 return (retValue_acc); } else { #line 1225 "EmailLib.c" retValue_acc = 0; #line 1227 return (retValue_acc); } } #line 1234 "EmailLib.c" return (retValue_acc); } } #line 161 "EmailLib.c" void setEmailEncryptionKey(int handle , int value ) { { #line 167 if (handle == 1) { #line 163 __ste_email_encryptionKey0 = value; } else { #line 164 if (handle == 2) { #line 165 __ste_email_encryptionKey1 = value; } else { } } #line 1265 "EmailLib.c" return; } } #line 169 "EmailLib.c" int __ste_email_isSigned0 = 0; #line 171 "EmailLib.c" int __ste_email_isSigned1 = 0; #line 173 "EmailLib.c" int isSigned(int handle ) { int retValue_acc ; { #line 180 "EmailLib.c" if (handle == 1) { #line 1290 retValue_acc = __ste_email_isSigned0; #line 1292 return (retValue_acc); } else { #line 1294 if (handle == 2) { #line 1299 retValue_acc = __ste_email_isSigned1; #line 1301 return (retValue_acc); } else { #line 1307 "EmailLib.c" retValue_acc = 0; #line 1309 return (retValue_acc); } } #line 1316 "EmailLib.c" return (retValue_acc); } } #line 183 "EmailLib.c" void setEmailIsSigned(int handle , int value ) { { #line 189 if (handle == 1) { #line 185 __ste_email_isSigned0 = value; } else { #line 186 if (handle == 2) { #line 187 __ste_email_isSigned1 = value; } else { } } #line 1347 "EmailLib.c" return; } } #line 191 "EmailLib.c" int __ste_email_signKey0 = 0; #line 193 "EmailLib.c" int __ste_email_signKey1 = 0; #line 195 "EmailLib.c" int getEmailSignKey(int handle ) { int retValue_acc ; { #line 202 "EmailLib.c" if (handle == 1) { #line 1372 retValue_acc = __ste_email_signKey0; #line 1374 return (retValue_acc); } else { #line 1376 if (handle == 2) { #line 1381 retValue_acc = __ste_email_signKey1; #line 1383 return (retValue_acc); } else { #line 1389 "EmailLib.c" retValue_acc = 0; #line 1391 return (retValue_acc); } } #line 1398 "EmailLib.c" return (retValue_acc); } } #line 205 "EmailLib.c" void setEmailSignKey(int handle , int value ) { { #line 211 if (handle == 1) { #line 207 __ste_email_signKey0 = value; } else { #line 208 if (handle == 2) { #line 209 __ste_email_signKey1 = value; } else { } } #line 1429 "EmailLib.c" return; } } #line 213 "EmailLib.c" int __ste_email_isSignatureVerified0 ; #line 215 "EmailLib.c" int __ste_email_isSignatureVerified1 ; #line 217 "EmailLib.c" int isVerified(int handle ) { int retValue_acc ; { #line 224 "EmailLib.c" if (handle == 1) { #line 1454 retValue_acc = __ste_email_isSignatureVerified0; #line 1456 return (retValue_acc); } else { #line 1458 if (handle == 2) { #line 1463 retValue_acc = __ste_email_isSignatureVerified1; #line 1465 return (retValue_acc); } else { #line 1471 "EmailLib.c" retValue_acc = 0; #line 1473 return (retValue_acc); } } #line 1480 "EmailLib.c" return (retValue_acc); } } #line 227 "EmailLib.c" void setEmailIsSignatureVerified(int handle , int value ) { { #line 233 if (handle == 1) { #line 229 __ste_email_isSignatureVerified0 = value; } else { #line 230 if (handle == 2) { #line 231 __ste_email_isSignatureVerified1 = value; } else { } } #line 1511 "EmailLib.c" return; } } #line 1 "libacc.o" #pragma merger(0,"libacc.i","") #line 73 "/usr/include/assert.h" extern __attribute__((__nothrow__, __noreturn__)) void __assert_fail(char const *__assertion , char const *__file , unsigned int __line , char const *__function ) ; #line 471 "/usr/include/stdlib.h" extern __attribute__((__nothrow__)) void *malloc(size_t __size ) __attribute__((__malloc__)) ; #line 488 extern __attribute__((__nothrow__)) void free(void *__ptr ) ; #line 32 "libacc.c" void __utac__exception__cf_handler_set(void *exception , int (*cflow_func)(int , int ) , int val ) { struct __UTAC__EXCEPTION *excep ; struct __UTAC__CFLOW_FUNC *cf ; void *tmp ; unsigned long __cil_tmp7 ; unsigned long __cil_tmp8 ; unsigned long __cil_tmp9 ; unsigned long __cil_tmp10 ; unsigned long __cil_tmp11 ; unsigned long __cil_tmp12 ; unsigned long __cil_tmp13 ; unsigned long __cil_tmp14 ; int (**mem_15)(int , int ) ; int *mem_16 ; struct __UTAC__CFLOW_FUNC **mem_17 ; struct __UTAC__CFLOW_FUNC **mem_18 ; struct __UTAC__CFLOW_FUNC **mem_19 ; { { #line 33 excep = (struct __UTAC__EXCEPTION *)exception; #line 34 tmp = malloc(24UL); #line 34 cf = (struct __UTAC__CFLOW_FUNC *)tmp; #line 36 mem_15 = (int (**)(int , int ))cf; #line 36 *mem_15 = cflow_func; #line 37 __cil_tmp7 = (unsigned long )cf; #line 37 __cil_tmp8 = __cil_tmp7 + 8; #line 37 mem_16 = (int *)__cil_tmp8; #line 37 *mem_16 = val; #line 38 __cil_tmp9 = (unsigned long )cf; #line 38 __cil_tmp10 = __cil_tmp9 + 16; #line 38 __cil_tmp11 = (unsigned long )excep; #line 38 __cil_tmp12 = __cil_tmp11 + 24; #line 38 mem_17 = (struct __UTAC__CFLOW_FUNC **)__cil_tmp10; #line 38 mem_18 = (struct __UTAC__CFLOW_FUNC **)__cil_tmp12; #line 38 *mem_17 = *mem_18; #line 39 __cil_tmp13 = (unsigned long )excep; #line 39 __cil_tmp14 = __cil_tmp13 + 24; #line 39 mem_19 = (struct __UTAC__CFLOW_FUNC **)__cil_tmp14; #line 39 *mem_19 = cf; } #line 654 "libacc.c" return; } } #line 44 "libacc.c" void __utac__exception__cf_handler_free(void *exception ) { struct __UTAC__EXCEPTION *excep ; struct __UTAC__CFLOW_FUNC *cf ; struct __UTAC__CFLOW_FUNC *tmp ; unsigned long __cil_tmp5 ; unsigned long __cil_tmp6 ; struct __UTAC__CFLOW_FUNC *__cil_tmp7 ; unsigned long __cil_tmp8 ; unsigned long __cil_tmp9 ; unsigned long __cil_tmp10 ; unsigned long __cil_tmp11 ; void *__cil_tmp12 ; unsigned long __cil_tmp13 ; unsigned long __cil_tmp14 ; struct __UTAC__CFLOW_FUNC **mem_15 ; struct __UTAC__CFLOW_FUNC **mem_16 ; struct __UTAC__CFLOW_FUNC **mem_17 ; { #line 45 excep = (struct __UTAC__EXCEPTION *)exception; #line 46 __cil_tmp5 = (unsigned long )excep; #line 46 __cil_tmp6 = __cil_tmp5 + 24; #line 46 mem_15 = (struct __UTAC__CFLOW_FUNC **)__cil_tmp6; #line 46 cf = *mem_15; { #line 49 while (1) { while_1_continue: /* CIL Label */ ; { #line 49 __cil_tmp7 = (struct __UTAC__CFLOW_FUNC *)0; #line 49 __cil_tmp8 = (unsigned long )__cil_tmp7; #line 49 __cil_tmp9 = (unsigned long )cf; #line 49 if (__cil_tmp9 != __cil_tmp8) { } else { goto while_1_break; } } { #line 50 tmp = cf; #line 51 __cil_tmp10 = (unsigned long )cf; #line 51 __cil_tmp11 = __cil_tmp10 + 16; #line 51 mem_16 = (struct __UTAC__CFLOW_FUNC **)__cil_tmp11; #line 51 cf = *mem_16; #line 52 __cil_tmp12 = (void *)tmp; #line 52 free(__cil_tmp12); } } while_1_break: /* CIL Label */ ; } #line 55 __cil_tmp13 = (unsigned long )excep; #line 55 __cil_tmp14 = __cil_tmp13 + 24; #line 55 mem_17 = (struct __UTAC__CFLOW_FUNC **)__cil_tmp14; #line 55 *mem_17 = (struct __UTAC__CFLOW_FUNC *)0; #line 694 "libacc.c" return; } } #line 59 "libacc.c" void __utac__exception__cf_handler_reset(void *exception ) { struct __UTAC__EXCEPTION *excep ; struct __UTAC__CFLOW_FUNC *cf ; unsigned long __cil_tmp5 ; unsigned long __cil_tmp6 ; struct __UTAC__CFLOW_FUNC *__cil_tmp7 ; unsigned long __cil_tmp8 ; unsigned long __cil_tmp9 ; int (*__cil_tmp10)(int , int ) ; unsigned long __cil_tmp11 ; unsigned long __cil_tmp12 ; int __cil_tmp13 ; unsigned long __cil_tmp14 ; unsigned long __cil_tmp15 ; struct __UTAC__CFLOW_FUNC **mem_16 ; int (**mem_17)(int , int ) ; int *mem_18 ; struct __UTAC__CFLOW_FUNC **mem_19 ; { #line 60 excep = (struct __UTAC__EXCEPTION *)exception; #line 61 __cil_tmp5 = (unsigned long )excep; #line 61 __cil_tmp6 = __cil_tmp5 + 24; #line 61 mem_16 = (struct __UTAC__CFLOW_FUNC **)__cil_tmp6; #line 61 cf = *mem_16; { #line 64 while (1) { while_2_continue: /* CIL Label */ ; { #line 64 __cil_tmp7 = (struct __UTAC__CFLOW_FUNC *)0; #line 64 __cil_tmp8 = (unsigned long )__cil_tmp7; #line 64 __cil_tmp9 = (unsigned long )cf; #line 64 if (__cil_tmp9 != __cil_tmp8) { } else { goto while_2_break; } } { #line 65 mem_17 = (int (**)(int , int ))cf; #line 65 __cil_tmp10 = *mem_17; #line 65 __cil_tmp11 = (unsigned long )cf; #line 65 __cil_tmp12 = __cil_tmp11 + 8; #line 65 mem_18 = (int *)__cil_tmp12; #line 65 __cil_tmp13 = *mem_18; #line 65 (*__cil_tmp10)(4, __cil_tmp13); #line 66 __cil_tmp14 = (unsigned long )cf; #line 66 __cil_tmp15 = __cil_tmp14 + 16; #line 66 mem_19 = (struct __UTAC__CFLOW_FUNC **)__cil_tmp15; #line 66 cf = *mem_19; } } while_2_break: /* CIL Label */ ; } { #line 69 __utac__exception__cf_handler_free(exception); } #line 732 "libacc.c" return; } } #line 80 "libacc.c" void *__utac__error_stack_mgt(void *env , int mode , int count ) ; #line 80 "libacc.c" static struct __ACC__ERR *head = (struct __ACC__ERR *)0; #line 79 "libacc.c" void *__utac__error_stack_mgt(void *env , int mode , int count ) { void *retValue_acc ; struct __ACC__ERR *new ; void *tmp ; struct __ACC__ERR *temp ; struct __ACC__ERR *next ; void *excep ; unsigned long __cil_tmp10 ; unsigned long __cil_tmp11 ; unsigned long __cil_tmp12 ; unsigned long __cil_tmp13 ; void *__cil_tmp14 ; unsigned long __cil_tmp15 ; unsigned long __cil_tmp16 ; void *__cil_tmp17 ; void **mem_18 ; struct __ACC__ERR **mem_19 ; struct __ACC__ERR **mem_20 ; void **mem_21 ; struct __ACC__ERR **mem_22 ; void **mem_23 ; void **mem_24 ; { #line 82 "libacc.c" if (count == 0) { #line 758 "libacc.c" return (retValue_acc); } else { } #line 86 "libacc.c" if (mode == 0) { { #line 87 tmp = malloc(16UL); #line 87 new = (struct __ACC__ERR *)tmp; #line 88 mem_18 = (void **)new; #line 88 *mem_18 = env; #line 89 __cil_tmp10 = (unsigned long )new; #line 89 __cil_tmp11 = __cil_tmp10 + 8; #line 89 mem_19 = (struct __ACC__ERR **)__cil_tmp11; #line 89 *mem_19 = head; #line 90 head = new; #line 776 "libacc.c" retValue_acc = (void *)new; } #line 778 return (retValue_acc); } else { } #line 94 "libacc.c" if (mode == 1) { #line 95 temp = head; { #line 98 while (1) { while_3_continue: /* CIL Label */ ; #line 98 if (count > 1) { } else { goto while_3_break; } { #line 99 __cil_tmp12 = (unsigned long )temp; #line 99 __cil_tmp13 = __cil_tmp12 + 8; #line 99 mem_20 = (struct __ACC__ERR **)__cil_tmp13; #line 99 next = *mem_20; #line 100 mem_21 = (void **)temp; #line 100 excep = *mem_21; #line 101 __cil_tmp14 = (void *)temp; #line 101 free(__cil_tmp14); #line 102 __utac__exception__cf_handler_reset(excep); #line 103 temp = next; #line 104 count = count - 1; } } while_3_break: /* CIL Label */ ; } { #line 107 __cil_tmp15 = (unsigned long )temp; #line 107 __cil_tmp16 = __cil_tmp15 + 8; #line 107 mem_22 = (struct __ACC__ERR **)__cil_tmp16; #line 107 head = *mem_22; #line 108 mem_23 = (void **)temp; #line 108 excep = *mem_23; #line 109 __cil_tmp17 = (void *)temp; #line 109 free(__cil_tmp17); #line 110 __utac__exception__cf_handler_reset(excep); #line 820 "libacc.c" retValue_acc = excep; } #line 822 return (retValue_acc); } else { } #line 114 if (mode == 2) { #line 118 "libacc.c" if (head) { #line 831 mem_24 = (void **)head; #line 831 retValue_acc = *mem_24; #line 833 return (retValue_acc); } else { #line 837 "libacc.c" retValue_acc = (void *)0; #line 839 return (retValue_acc); } } else { } #line 846 "libacc.c" return (retValue_acc); } } #line 122 "libacc.c" void *__utac__get_this_arg(int i , struct JoinPoint *this ) { void *retValue_acc ; unsigned long __cil_tmp4 ; unsigned long __cil_tmp5 ; int __cil_tmp6 ; int __cil_tmp7 ; unsigned long __cil_tmp8 ; unsigned long __cil_tmp9 ; void **__cil_tmp10 ; void **__cil_tmp11 ; int *mem_12 ; void ***mem_13 ; { #line 123 if (i > 0) { { #line 123 __cil_tmp4 = (unsigned long )this; #line 123 __cil_tmp5 = __cil_tmp4 + 16; #line 123 mem_12 = (int *)__cil_tmp5; #line 123 __cil_tmp6 = *mem_12; #line 123 if (i <= __cil_tmp6) { } else { { #line 123 __assert_fail("i > 0 && i <= this->argsCount", "libacc.c", 123U, "__utac__get_this_arg"); } } } } else { { #line 123 __assert_fail("i > 0 && i <= this->argsCount", "libacc.c", 123U, "__utac__get_this_arg"); } } #line 870 "libacc.c" __cil_tmp7 = i - 1; #line 870 __cil_tmp8 = (unsigned long )this; #line 870 __cil_tmp9 = __cil_tmp8 + 8; #line 870 mem_13 = (void ***)__cil_tmp9; #line 870 __cil_tmp10 = *mem_13; #line 870 __cil_tmp11 = __cil_tmp10 + __cil_tmp7; #line 870 retValue_acc = *__cil_tmp11; #line 872 return (retValue_acc); #line 879 return (retValue_acc); } } #line 129 "libacc.c" char const *__utac__get_this_argtype(int i , struct JoinPoint *this ) { char const *retValue_acc ; unsigned long __cil_tmp4 ; unsigned long __cil_tmp5 ; int __cil_tmp6 ; int __cil_tmp7 ; unsigned long __cil_tmp8 ; unsigned long __cil_tmp9 ; char const **__cil_tmp10 ; char const **__cil_tmp11 ; int *mem_12 ; char const ***mem_13 ; { #line 131 if (i > 0) { { #line 131 __cil_tmp4 = (unsigned long )this; #line 131 __cil_tmp5 = __cil_tmp4 + 16; #line 131 mem_12 = (int *)__cil_tmp5; #line 131 __cil_tmp6 = *mem_12; #line 131 if (i <= __cil_tmp6) { } else { { #line 131 __assert_fail("i > 0 && i <= this->argsCount", "libacc.c", 131U, "__utac__get_this_argtype"); } } } } else { { #line 131 __assert_fail("i > 0 && i <= this->argsCount", "libacc.c", 131U, "__utac__get_this_argtype"); } } #line 903 "libacc.c" __cil_tmp7 = i - 1; #line 903 __cil_tmp8 = (unsigned long )this; #line 903 __cil_tmp9 = __cil_tmp8 + 24; #line 903 mem_13 = (char const ***)__cil_tmp9; #line 903 __cil_tmp10 = *mem_13; #line 903 __cil_tmp11 = __cil_tmp10 + __cil_tmp7; #line 903 retValue_acc = *__cil_tmp11; #line 905 return (retValue_acc); #line 912 return (retValue_acc); } } #line 1 "DecryptForward_spec.o" #pragma merger(0,"DecryptForward_spec.i","") #line 9 "Email.h" int isReadable(int msg ) ; #line 11 "DecryptForward_spec.c" __inline void __utac_acc__DecryptForward_spec__1(int msg ) { int tmp ; { { #line 13 puts("before forward\n"); #line 14 tmp = isReadable(msg); } #line 14 if (tmp) { } else { { #line 15 __automaton_fail(); } } #line 15 return; } } #line 1 "ClientLib.o" #pragma merger(0,"ClientLib.i","") #line 4 "ClientLib.h" int initClient(void) ; #line 6 char *getClientName(int handle ) ; #line 8 void setClientName(int handle , char *value ) ; #line 10 int getClientOutbuffer(int handle ) ; #line 12 void setClientOutbuffer(int handle , int value ) ; #line 14 int getClientAddressBookSize(int handle ) ; #line 16 void setClientAddressBookSize(int handle , int value ) ; #line 18 int createClientAddressBookEntry(int handle ) ; #line 20 int getClientAddressBookAlias(int handle , int index ) ; #line 22 void setClientAddressBookAlias(int handle , int index , int value ) ; #line 24 int getClientAddressBookAddress(int handle , int index ) ; #line 26 void setClientAddressBookAddress(int handle , int index , int value ) ; #line 29 int getClientAutoResponse(int handle ) ; #line 31 void setClientAutoResponse(int handle , int value ) ; #line 33 int getClientPrivateKey(int handle ) ; #line 35 void setClientPrivateKey(int handle , int value ) ; #line 37 int getClientKeyringSize(int handle ) ; #line 39 int createClientKeyringEntry(int handle ) ; #line 41 int getClientKeyringUser(int handle , int index ) ; #line 43 void setClientKeyringUser(int handle , int index , int value ) ; #line 45 int getClientKeyringPublicKey(int handle , int index ) ; #line 47 void setClientKeyringPublicKey(int handle , int index , int value ) ; #line 49 int getClientForwardReceiver(int handle ) ; #line 53 int getClientId(int handle ) ; #line 57 int findPublicKey(int handle , int userid ) ; #line 59 int findClientAddressBookAlias(int handle , int userid ) ; #line 5 "ClientLib.c" int __ste_Client_counter = 0; #line 7 "ClientLib.c" int initClient(void) { int retValue_acc ; { #line 12 "ClientLib.c" if (__ste_Client_counter < 3) { #line 684 __ste_Client_counter = __ste_Client_counter + 1; #line 684 retValue_acc = __ste_Client_counter; #line 686 return (retValue_acc); } else { #line 692 "ClientLib.c" retValue_acc = -1; #line 694 return (retValue_acc); } #line 701 "ClientLib.c" return (retValue_acc); } } #line 15 "ClientLib.c" char *__ste_client_name0 = (char *)0; #line 17 "ClientLib.c" char *__ste_client_name1 = (char *)0; #line 19 "ClientLib.c" char *__ste_client_name2 = (char *)0; #line 22 "ClientLib.c" char *getClientName(int handle ) { char *retValue_acc ; void *__cil_tmp3 ; { #line 31 "ClientLib.c" if (handle == 1) { #line 732 retValue_acc = __ste_client_name0; #line 734 return (retValue_acc); } else { #line 736 if (handle == 2) { #line 741 retValue_acc = __ste_client_name1; #line 743 return (retValue_acc); } else { #line 745 if (handle == 3) { #line 750 retValue_acc = __ste_client_name2; #line 752 return (retValue_acc); } else { #line 758 "ClientLib.c" __cil_tmp3 = (void *)0; #line 758 retValue_acc = (char *)__cil_tmp3; #line 760 return (retValue_acc); } } } #line 767 "ClientLib.c" return (retValue_acc); } } #line 34 "ClientLib.c" void setClientName(int handle , char *value ) { { #line 42 if (handle == 1) { #line 36 __ste_client_name0 = value; } else { #line 37 if (handle == 2) { #line 38 __ste_client_name1 = value; } else { #line 39 if (handle == 3) { #line 40 __ste_client_name2 = value; } else { } } } #line 802 "ClientLib.c" return; } } #line 44 "ClientLib.c" int __ste_client_outbuffer0 = 0; #line 46 "ClientLib.c" int __ste_client_outbuffer1 = 0; #line 48 "ClientLib.c" int __ste_client_outbuffer2 = 0; #line 50 "ClientLib.c" int __ste_client_outbuffer3 = 0; #line 53 "ClientLib.c" int getClientOutbuffer(int handle ) { int retValue_acc ; { #line 62 "ClientLib.c" if (handle == 1) { #line 831 retValue_acc = __ste_client_outbuffer0; #line 833 return (retValue_acc); } else { #line 835 if (handle == 2) { #line 840 retValue_acc = __ste_client_outbuffer1; #line 842 return (retValue_acc); } else { #line 844 if (handle == 3) { #line 849 retValue_acc = __ste_client_outbuffer2; #line 851 return (retValue_acc); } else { #line 857 "ClientLib.c" retValue_acc = 0; #line 859 return (retValue_acc); } } } #line 866 "ClientLib.c" return (retValue_acc); } } #line 65 "ClientLib.c" void setClientOutbuffer(int handle , int value ) { { #line 73 if (handle == 1) { #line 67 __ste_client_outbuffer0 = value; } else { #line 68 if (handle == 2) { #line 69 __ste_client_outbuffer1 = value; } else { #line 70 if (handle == 3) { #line 71 __ste_client_outbuffer2 = value; } else { } } } #line 901 "ClientLib.c" return; } } #line 77 "ClientLib.c" int __ste_ClientAddressBook_size0 = 0; #line 79 "ClientLib.c" int __ste_ClientAddressBook_size1 = 0; #line 81 "ClientLib.c" int __ste_ClientAddressBook_size2 = 0; #line 84 "ClientLib.c" int getClientAddressBookSize(int handle ) { int retValue_acc ; { #line 93 "ClientLib.c" if (handle == 1) { #line 928 retValue_acc = __ste_ClientAddressBook_size0; #line 930 return (retValue_acc); } else { #line 932 if (handle == 2) { #line 937 retValue_acc = __ste_ClientAddressBook_size1; #line 939 return (retValue_acc); } else { #line 941 if (handle == 3) { #line 946 retValue_acc = __ste_ClientAddressBook_size2; #line 948 return (retValue_acc); } else { #line 954 "ClientLib.c" retValue_acc = 0; #line 956 return (retValue_acc); } } } #line 963 "ClientLib.c" return (retValue_acc); } } #line 96 "ClientLib.c" void setClientAddressBookSize(int handle , int value ) { { #line 104 if (handle == 1) { #line 98 __ste_ClientAddressBook_size0 = value; } else { #line 99 if (handle == 2) { #line 100 __ste_ClientAddressBook_size1 = value; } else { #line 101 if (handle == 3) { #line 102 __ste_ClientAddressBook_size2 = value; } else { } } } #line 998 "ClientLib.c" return; } } #line 106 "ClientLib.c" int createClientAddressBookEntry(int handle ) { int retValue_acc ; int size ; int tmp ; int __cil_tmp5 ; { { #line 107 tmp = getClientAddressBookSize(handle); #line 107 size = tmp; } #line 108 "ClientLib.c" if (size < 3) { { #line 109 "ClientLib.c" __cil_tmp5 = size + 1; #line 109 setClientAddressBookSize(handle, __cil_tmp5); #line 1025 "ClientLib.c" retValue_acc = size + 1; } #line 1027 return (retValue_acc); } else { #line 1031 "ClientLib.c" retValue_acc = -1; #line 1033 return (retValue_acc); } #line 1040 "ClientLib.c" return (retValue_acc); } } #line 115 "ClientLib.c" int __ste_Client_AddressBook0_Alias0 = 0; #line 117 "ClientLib.c" int __ste_Client_AddressBook0_Alias1 = 0; #line 119 "ClientLib.c" int __ste_Client_AddressBook0_Alias2 = 0; #line 121 "ClientLib.c" int __ste_Client_AddressBook1_Alias0 = 0; #line 123 "ClientLib.c" int __ste_Client_AddressBook1_Alias1 = 0; #line 125 "ClientLib.c" int __ste_Client_AddressBook1_Alias2 = 0; #line 127 "ClientLib.c" int __ste_Client_AddressBook2_Alias0 = 0; #line 129 "ClientLib.c" int __ste_Client_AddressBook2_Alias1 = 0; #line 131 "ClientLib.c" int __ste_Client_AddressBook2_Alias2 = 0; #line 134 "ClientLib.c" int getClientAddressBookAlias(int handle , int index ) { int retValue_acc ; { #line 167 if (handle == 1) { #line 144 "ClientLib.c" if (index == 0) { #line 1086 retValue_acc = __ste_Client_AddressBook0_Alias0; #line 1088 return (retValue_acc); } else { #line 1090 if (index == 1) { #line 1095 retValue_acc = __ste_Client_AddressBook0_Alias1; #line 1097 return (retValue_acc); } else { #line 1099 if (index == 2) { #line 1104 retValue_acc = __ste_Client_AddressBook0_Alias2; #line 1106 return (retValue_acc); } else { #line 1112 retValue_acc = 0; #line 1114 return (retValue_acc); } } } } else { #line 1116 "ClientLib.c" if (handle == 2) { #line 154 "ClientLib.c" if (index == 0) { #line 1124 retValue_acc = __ste_Client_AddressBook1_Alias0; #line 1126 return (retValue_acc); } else { #line 1128 if (index == 1) { #line 1133 retValue_acc = __ste_Client_AddressBook1_Alias1; #line 1135 return (retValue_acc); } else { #line 1137 if (index == 2) { #line 1142 retValue_acc = __ste_Client_AddressBook1_Alias2; #line 1144 return (retValue_acc); } else { #line 1150 retValue_acc = 0; #line 1152 return (retValue_acc); } } } } else { #line 1154 "ClientLib.c" if (handle == 3) { #line 164 "ClientLib.c" if (index == 0) { #line 1162 retValue_acc = __ste_Client_AddressBook2_Alias0; #line 1164 return (retValue_acc); } else { #line 1166 if (index == 1) { #line 1171 retValue_acc = __ste_Client_AddressBook2_Alias1; #line 1173 return (retValue_acc); } else { #line 1175 if (index == 2) { #line 1180 retValue_acc = __ste_Client_AddressBook2_Alias2; #line 1182 return (retValue_acc); } else { #line 1188 retValue_acc = 0; #line 1190 return (retValue_acc); } } } } else { #line 1196 "ClientLib.c" retValue_acc = 0; #line 1198 return (retValue_acc); } } } #line 1205 "ClientLib.c" return (retValue_acc); } } #line 171 "ClientLib.c" int findClientAddressBookAlias(int handle , int userid ) { int retValue_acc ; { #line 204 if (handle == 1) { #line 181 "ClientLib.c" if (userid == __ste_Client_AddressBook0_Alias0) { #line 1233 retValue_acc = 0; #line 1235 return (retValue_acc); } else { #line 1237 if (userid == __ste_Client_AddressBook0_Alias1) { #line 1242 retValue_acc = 1; #line 1244 return (retValue_acc); } else { #line 1246 if (userid == __ste_Client_AddressBook0_Alias2) { #line 1251 retValue_acc = 2; #line 1253 return (retValue_acc); } else { #line 1259 retValue_acc = -1; #line 1261 return (retValue_acc); } } } } else { #line 1263 "ClientLib.c" if (handle == 2) { #line 191 "ClientLib.c" if (userid == __ste_Client_AddressBook1_Alias0) { #line 1271 retValue_acc = 0; #line 1273 return (retValue_acc); } else { #line 1275 if (userid == __ste_Client_AddressBook1_Alias1) { #line 1280 retValue_acc = 1; #line 1282 return (retValue_acc); } else { #line 1284 if (userid == __ste_Client_AddressBook1_Alias2) { #line 1289 retValue_acc = 2; #line 1291 return (retValue_acc); } else { #line 1297 retValue_acc = -1; #line 1299 return (retValue_acc); } } } } else { #line 1301 "ClientLib.c" if (handle == 3) { #line 201 "ClientLib.c" if (userid == __ste_Client_AddressBook2_Alias0) { #line 1309 retValue_acc = 0; #line 1311 return (retValue_acc); } else { #line 1313 if (userid == __ste_Client_AddressBook2_Alias1) { #line 1318 retValue_acc = 1; #line 1320 return (retValue_acc); } else { #line 1322 if (userid == __ste_Client_AddressBook2_Alias2) { #line 1327 retValue_acc = 2; #line 1329 return (retValue_acc); } else { #line 1335 retValue_acc = -1; #line 1337 return (retValue_acc); } } } } else { #line 1343 "ClientLib.c" retValue_acc = -1; #line 1345 return (retValue_acc); } } } #line 1352 "ClientLib.c" return (retValue_acc); } } #line 208 "ClientLib.c" void setClientAddressBookAlias(int handle , int index , int value ) { { #line 234 if (handle == 1) { #line 217 if (index == 0) { #line 211 __ste_Client_AddressBook0_Alias0 = value; } else { #line 212 if (index == 1) { #line 213 __ste_Client_AddressBook0_Alias1 = value; } else { #line 214 if (index == 2) { #line 215 __ste_Client_AddressBook0_Alias2 = value; } else { } } } } else { #line 216 if (handle == 2) { #line 225 if (index == 0) { #line 219 __ste_Client_AddressBook1_Alias0 = value; } else { #line 220 if (index == 1) { #line 221 __ste_Client_AddressBook1_Alias1 = value; } else { #line 222 if (index == 2) { #line 223 __ste_Client_AddressBook1_Alias2 = value; } else { } } } } else { #line 224 if (handle == 3) { #line 233 if (index == 0) { #line 227 __ste_Client_AddressBook2_Alias0 = value; } else { #line 228 if (index == 1) { #line 229 __ste_Client_AddressBook2_Alias1 = value; } else { #line 230 if (index == 2) { #line 231 __ste_Client_AddressBook2_Alias2 = value; } else { } } } } else { } } } #line 1420 "ClientLib.c" return; } } #line 236 "ClientLib.c" int __ste_Client_AddressBook0_Address0 = 0; #line 238 "ClientLib.c" int __ste_Client_AddressBook0_Address1 = 0; #line 240 "ClientLib.c" int __ste_Client_AddressBook0_Address2 = 0; #line 242 "ClientLib.c" int __ste_Client_AddressBook1_Address0 = 0; #line 244 "ClientLib.c" int __ste_Client_AddressBook1_Address1 = 0; #line 246 "ClientLib.c" int __ste_Client_AddressBook1_Address2 = 0; #line 248 "ClientLib.c" int __ste_Client_AddressBook2_Address0 = 0; #line 250 "ClientLib.c" int __ste_Client_AddressBook2_Address1 = 0; #line 252 "ClientLib.c" int __ste_Client_AddressBook2_Address2 = 0; #line 255 "ClientLib.c" int getClientAddressBookAddress(int handle , int index ) { int retValue_acc ; { #line 288 if (handle == 1) { #line 265 "ClientLib.c" if (index == 0) { #line 1462 retValue_acc = __ste_Client_AddressBook0_Address0; #line 1464 return (retValue_acc); } else { #line 1466 if (index == 1) { #line 1471 retValue_acc = __ste_Client_AddressBook0_Address1; #line 1473 return (retValue_acc); } else { #line 1475 if (index == 2) { #line 1480 retValue_acc = __ste_Client_AddressBook0_Address2; #line 1482 return (retValue_acc); } else { #line 1488 retValue_acc = 0; #line 1490 return (retValue_acc); } } } } else { #line 1492 "ClientLib.c" if (handle == 2) { #line 275 "ClientLib.c" if (index == 0) { #line 1500 retValue_acc = __ste_Client_AddressBook1_Address0; #line 1502 return (retValue_acc); } else { #line 1504 if (index == 1) { #line 1509 retValue_acc = __ste_Client_AddressBook1_Address1; #line 1511 return (retValue_acc); } else { #line 1513 if (index == 2) { #line 1518 retValue_acc = __ste_Client_AddressBook1_Address2; #line 1520 return (retValue_acc); } else { #line 1526 retValue_acc = 0; #line 1528 return (retValue_acc); } } } } else { #line 1530 "ClientLib.c" if (handle == 3) { #line 285 "ClientLib.c" if (index == 0) { #line 1538 retValue_acc = __ste_Client_AddressBook2_Address0; #line 1540 return (retValue_acc); } else { #line 1542 if (index == 1) { #line 1547 retValue_acc = __ste_Client_AddressBook2_Address1; #line 1549 return (retValue_acc); } else { #line 1551 if (index == 2) { #line 1556 retValue_acc = __ste_Client_AddressBook2_Address2; #line 1558 return (retValue_acc); } else { #line 1564 retValue_acc = 0; #line 1566 return (retValue_acc); } } } } else { #line 1572 "ClientLib.c" retValue_acc = 0; #line 1574 return (retValue_acc); } } } #line 1581 "ClientLib.c" return (retValue_acc); } } #line 291 "ClientLib.c" void setClientAddressBookAddress(int handle , int index , int value ) { { #line 317 if (handle == 1) { #line 300 if (index == 0) { #line 294 __ste_Client_AddressBook0_Address0 = value; } else { #line 295 if (index == 1) { #line 296 __ste_Client_AddressBook0_Address1 = value; } else { #line 297 if (index == 2) { #line 298 __ste_Client_AddressBook0_Address2 = value; } else { } } } } else { #line 299 if (handle == 2) { #line 308 if (index == 0) { #line 302 __ste_Client_AddressBook1_Address0 = value; } else { #line 303 if (index == 1) { #line 304 __ste_Client_AddressBook1_Address1 = value; } else { #line 305 if (index == 2) { #line 306 __ste_Client_AddressBook1_Address2 = value; } else { } } } } else { #line 307 if (handle == 3) { #line 316 if (index == 0) { #line 310 __ste_Client_AddressBook2_Address0 = value; } else { #line 311 if (index == 1) { #line 312 __ste_Client_AddressBook2_Address1 = value; } else { #line 313 if (index == 2) { #line 314 __ste_Client_AddressBook2_Address2 = value; } else { } } } } else { } } } #line 1649 "ClientLib.c" return; } } #line 319 "ClientLib.c" int __ste_client_autoResponse0 = 0; #line 321 "ClientLib.c" int __ste_client_autoResponse1 = 0; #line 323 "ClientLib.c" int __ste_client_autoResponse2 = 0; #line 326 "ClientLib.c" int getClientAutoResponse(int handle ) { int retValue_acc ; { #line 335 "ClientLib.c" if (handle == 1) { #line 1676 retValue_acc = __ste_client_autoResponse0; #line 1678 return (retValue_acc); } else { #line 1680 if (handle == 2) { #line 1685 retValue_acc = __ste_client_autoResponse1; #line 1687 return (retValue_acc); } else { #line 1689 if (handle == 3) { #line 1694 retValue_acc = __ste_client_autoResponse2; #line 1696 return (retValue_acc); } else { #line 1702 "ClientLib.c" retValue_acc = -1; #line 1704 return (retValue_acc); } } } #line 1711 "ClientLib.c" return (retValue_acc); } } #line 338 "ClientLib.c" void setClientAutoResponse(int handle , int value ) { { #line 346 if (handle == 1) { #line 340 __ste_client_autoResponse0 = value; } else { #line 341 if (handle == 2) { #line 342 __ste_client_autoResponse1 = value; } else { #line 343 if (handle == 3) { #line 344 __ste_client_autoResponse2 = value; } else { } } } #line 1746 "ClientLib.c" return; } } #line 348 "ClientLib.c" int __ste_client_privateKey0 = 0; #line 350 "ClientLib.c" int __ste_client_privateKey1 = 0; #line 352 "ClientLib.c" int __ste_client_privateKey2 = 0; #line 355 "ClientLib.c" int getClientPrivateKey(int handle ) { int retValue_acc ; { #line 364 "ClientLib.c" if (handle == 1) { #line 1773 retValue_acc = __ste_client_privateKey0; #line 1775 return (retValue_acc); } else { #line 1777 if (handle == 2) { #line 1782 retValue_acc = __ste_client_privateKey1; #line 1784 return (retValue_acc); } else { #line 1786 if (handle == 3) { #line 1791 retValue_acc = __ste_client_privateKey2; #line 1793 return (retValue_acc); } else { #line 1799 "ClientLib.c" retValue_acc = 0; #line 1801 return (retValue_acc); } } } #line 1808 "ClientLib.c" return (retValue_acc); } } #line 367 "ClientLib.c" void setClientPrivateKey(int handle , int value ) { { #line 375 if (handle == 1) { #line 369 __ste_client_privateKey0 = value; } else { #line 370 if (handle == 2) { #line 371 __ste_client_privateKey1 = value; } else { #line 372 if (handle == 3) { #line 373 __ste_client_privateKey2 = value; } else { } } } #line 1843 "ClientLib.c" return; } } #line 377 "ClientLib.c" int __ste_ClientKeyring_size0 = 0; #line 379 "ClientLib.c" int __ste_ClientKeyring_size1 = 0; #line 381 "ClientLib.c" int __ste_ClientKeyring_size2 = 0; #line 384 "ClientLib.c" int getClientKeyringSize(int handle ) { int retValue_acc ; { #line 393 "ClientLib.c" if (handle == 1) { #line 1870 retValue_acc = __ste_ClientKeyring_size0; #line 1872 return (retValue_acc); } else { #line 1874 if (handle == 2) { #line 1879 retValue_acc = __ste_ClientKeyring_size1; #line 1881 return (retValue_acc); } else { #line 1883 if (handle == 3) { #line 1888 retValue_acc = __ste_ClientKeyring_size2; #line 1890 return (retValue_acc); } else { #line 1896 "ClientLib.c" retValue_acc = 0; #line 1898 return (retValue_acc); } } } #line 1905 "ClientLib.c" return (retValue_acc); } } #line 396 "ClientLib.c" void setClientKeyringSize(int handle , int value ) { { #line 404 if (handle == 1) { #line 398 __ste_ClientKeyring_size0 = value; } else { #line 399 if (handle == 2) { #line 400 __ste_ClientKeyring_size1 = value; } else { #line 401 if (handle == 3) { #line 402 __ste_ClientKeyring_size2 = value; } else { } } } #line 1940 "ClientLib.c" return; } } #line 406 "ClientLib.c" int createClientKeyringEntry(int handle ) { int retValue_acc ; int size ; int tmp ; int __cil_tmp5 ; { { #line 407 tmp = getClientKeyringSize(handle); #line 407 size = tmp; } #line 408 "ClientLib.c" if (size < 2) { { #line 409 "ClientLib.c" __cil_tmp5 = size + 1; #line 409 setClientKeyringSize(handle, __cil_tmp5); #line 1967 "ClientLib.c" retValue_acc = size + 1; } #line 1969 return (retValue_acc); } else { #line 1973 "ClientLib.c" retValue_acc = -1; #line 1975 return (retValue_acc); } #line 1982 "ClientLib.c" return (retValue_acc); } } #line 414 "ClientLib.c" int __ste_Client_Keyring0_User0 = 0; #line 416 "ClientLib.c" int __ste_Client_Keyring0_User1 = 0; #line 418 "ClientLib.c" int __ste_Client_Keyring0_User2 = 0; #line 420 "ClientLib.c" int __ste_Client_Keyring1_User0 = 0; #line 422 "ClientLib.c" int __ste_Client_Keyring1_User1 = 0; #line 424 "ClientLib.c" int __ste_Client_Keyring1_User2 = 0; #line 426 "ClientLib.c" int __ste_Client_Keyring2_User0 = 0; #line 428 "ClientLib.c" int __ste_Client_Keyring2_User1 = 0; #line 430 "ClientLib.c" int __ste_Client_Keyring2_User2 = 0; #line 433 "ClientLib.c" int getClientKeyringUser(int handle , int index ) { int retValue_acc ; { #line 466 if (handle == 1) { #line 443 "ClientLib.c" if (index == 0) { #line 2028 retValue_acc = __ste_Client_Keyring0_User0; #line 2030 return (retValue_acc); } else { #line 2032 if (index == 1) { #line 2037 retValue_acc = __ste_Client_Keyring0_User1; #line 2039 return (retValue_acc); } else { #line 2045 retValue_acc = 0; #line 2047 return (retValue_acc); } } } else { #line 2049 "ClientLib.c" if (handle == 2) { #line 453 "ClientLib.c" if (index == 0) { #line 2057 retValue_acc = __ste_Client_Keyring1_User0; #line 2059 return (retValue_acc); } else { #line 2061 if (index == 1) { #line 2066 retValue_acc = __ste_Client_Keyring1_User1; #line 2068 return (retValue_acc); } else { #line 2074 retValue_acc = 0; #line 2076 return (retValue_acc); } } } else { #line 2078 "ClientLib.c" if (handle == 3) { #line 463 "ClientLib.c" if (index == 0) { #line 2086 retValue_acc = __ste_Client_Keyring2_User0; #line 2088 return (retValue_acc); } else { #line 2090 if (index == 1) { #line 2095 retValue_acc = __ste_Client_Keyring2_User1; #line 2097 return (retValue_acc); } else { #line 2103 retValue_acc = 0; #line 2105 return (retValue_acc); } } } else { #line 2111 "ClientLib.c" retValue_acc = 0; #line 2113 return (retValue_acc); } } } #line 2120 "ClientLib.c" return (retValue_acc); } } #line 473 "ClientLib.c" void setClientKeyringUser(int handle , int index , int value ) { { #line 499 if (handle == 1) { #line 482 if (index == 0) { #line 476 __ste_Client_Keyring0_User0 = value; } else { #line 477 if (index == 1) { #line 478 __ste_Client_Keyring0_User1 = value; } else { } } } else { #line 479 if (handle == 2) { #line 490 if (index == 0) { #line 484 __ste_Client_Keyring1_User0 = value; } else { #line 485 if (index == 1) { #line 486 __ste_Client_Keyring1_User1 = value; } else { } } } else { #line 487 if (handle == 3) { #line 498 if (index == 0) { #line 492 __ste_Client_Keyring2_User0 = value; } else { #line 493 if (index == 1) { #line 494 __ste_Client_Keyring2_User1 = value; } else { } } } else { } } } #line 2176 "ClientLib.c" return; } } #line 501 "ClientLib.c" int __ste_Client_Keyring0_PublicKey0 = 0; #line 503 "ClientLib.c" int __ste_Client_Keyring0_PublicKey1 = 0; #line 505 "ClientLib.c" int __ste_Client_Keyring0_PublicKey2 = 0; #line 507 "ClientLib.c" int __ste_Client_Keyring1_PublicKey0 = 0; #line 509 "ClientLib.c" int __ste_Client_Keyring1_PublicKey1 = 0; #line 511 "ClientLib.c" int __ste_Client_Keyring1_PublicKey2 = 0; #line 513 "ClientLib.c" int __ste_Client_Keyring2_PublicKey0 = 0; #line 515 "ClientLib.c" int __ste_Client_Keyring2_PublicKey1 = 0; #line 517 "ClientLib.c" int __ste_Client_Keyring2_PublicKey2 = 0; #line 520 "ClientLib.c" int getClientKeyringPublicKey(int handle , int index ) { int retValue_acc ; { #line 553 if (handle == 1) { #line 530 "ClientLib.c" if (index == 0) { #line 2218 retValue_acc = __ste_Client_Keyring0_PublicKey0; #line 2220 return (retValue_acc); } else { #line 2222 if (index == 1) { #line 2227 retValue_acc = __ste_Client_Keyring0_PublicKey1; #line 2229 return (retValue_acc); } else { #line 2235 retValue_acc = 0; #line 2237 return (retValue_acc); } } } else { #line 2239 "ClientLib.c" if (handle == 2) { #line 540 "ClientLib.c" if (index == 0) { #line 2247 retValue_acc = __ste_Client_Keyring1_PublicKey0; #line 2249 return (retValue_acc); } else { #line 2251 if (index == 1) { #line 2256 retValue_acc = __ste_Client_Keyring1_PublicKey1; #line 2258 return (retValue_acc); } else { #line 2264 retValue_acc = 0; #line 2266 return (retValue_acc); } } } else { #line 2268 "ClientLib.c" if (handle == 3) { #line 550 "ClientLib.c" if (index == 0) { #line 2276 retValue_acc = __ste_Client_Keyring2_PublicKey0; #line 2278 return (retValue_acc); } else { #line 2280 if (index == 1) { #line 2285 retValue_acc = __ste_Client_Keyring2_PublicKey1; #line 2287 return (retValue_acc); } else { #line 2293 retValue_acc = 0; #line 2295 return (retValue_acc); } } } else { #line 2301 "ClientLib.c" retValue_acc = 0; #line 2303 return (retValue_acc); } } } #line 2310 "ClientLib.c" return (retValue_acc); } } #line 557 "ClientLib.c" int findPublicKey(int handle , int userid ) { int retValue_acc ; { #line 591 if (handle == 1) { #line 568 "ClientLib.c" if (userid == __ste_Client_Keyring0_User0) { #line 2338 retValue_acc = __ste_Client_Keyring0_PublicKey0; #line 2340 return (retValue_acc); } else { #line 2342 if (userid == __ste_Client_Keyring0_User1) { #line 2347 retValue_acc = __ste_Client_Keyring0_PublicKey1; #line 2349 return (retValue_acc); } else { #line 2355 retValue_acc = 0; #line 2357 return (retValue_acc); } } } else { #line 2359 "ClientLib.c" if (handle == 2) { #line 578 "ClientLib.c" if (userid == __ste_Client_Keyring1_User0) { #line 2367 retValue_acc = __ste_Client_Keyring1_PublicKey0; #line 2369 return (retValue_acc); } else { #line 2371 if (userid == __ste_Client_Keyring1_User1) { #line 2376 retValue_acc = __ste_Client_Keyring1_PublicKey1; #line 2378 return (retValue_acc); } else { #line 2384 retValue_acc = 0; #line 2386 return (retValue_acc); } } } else { #line 2388 "ClientLib.c" if (handle == 3) { #line 588 "ClientLib.c" if (userid == __ste_Client_Keyring2_User0) { #line 2396 retValue_acc = __ste_Client_Keyring2_PublicKey0; #line 2398 return (retValue_acc); } else { #line 2400 if (userid == __ste_Client_Keyring2_User1) { #line 2405 retValue_acc = __ste_Client_Keyring2_PublicKey1; #line 2407 return (retValue_acc); } else { #line 2413 retValue_acc = 0; #line 2415 return (retValue_acc); } } } else { #line 2421 "ClientLib.c" retValue_acc = 0; #line 2423 return (retValue_acc); } } } #line 2430 "ClientLib.c" return (retValue_acc); } } #line 595 "ClientLib.c" void setClientKeyringPublicKey(int handle , int index , int value ) { { #line 621 if (handle == 1) { #line 604 if (index == 0) { #line 598 __ste_Client_Keyring0_PublicKey0 = value; } else { #line 599 if (index == 1) { #line 600 __ste_Client_Keyring0_PublicKey1 = value; } else { } } } else { #line 601 if (handle == 2) { #line 612 if (index == 0) { #line 606 __ste_Client_Keyring1_PublicKey0 = value; } else { #line 607 if (index == 1) { #line 608 __ste_Client_Keyring1_PublicKey1 = value; } else { } } } else { #line 609 if (handle == 3) { #line 620 if (index == 0) { #line 614 __ste_Client_Keyring2_PublicKey0 = value; } else { #line 615 if (index == 1) { #line 616 __ste_Client_Keyring2_PublicKey1 = value; } else { } } } else { } } } #line 2486 "ClientLib.c" return; } } #line 623 "ClientLib.c" int __ste_client_forwardReceiver0 = 0; #line 625 "ClientLib.c" int __ste_client_forwardReceiver1 = 0; #line 627 "ClientLib.c" int __ste_client_forwardReceiver2 = 0; #line 629 "ClientLib.c" int __ste_client_forwardReceiver3 = 0; #line 631 "ClientLib.c" int getClientForwardReceiver(int handle ) { int retValue_acc ; { #line 640 "ClientLib.c" if (handle == 1) { #line 2515 retValue_acc = __ste_client_forwardReceiver0; #line 2517 return (retValue_acc); } else { #line 2519 if (handle == 2) { #line 2524 retValue_acc = __ste_client_forwardReceiver1; #line 2526 return (retValue_acc); } else { #line 2528 if (handle == 3) { #line 2533 retValue_acc = __ste_client_forwardReceiver2; #line 2535 return (retValue_acc); } else { #line 2541 "ClientLib.c" retValue_acc = 0; #line 2543 return (retValue_acc); } } } #line 2550 "ClientLib.c" return (retValue_acc); } } #line 643 "ClientLib.c" void setClientForwardReceiver(int handle , int value ) { { #line 651 if (handle == 1) { #line 645 __ste_client_forwardReceiver0 = value; } else { #line 646 if (handle == 2) { #line 647 __ste_client_forwardReceiver1 = value; } else { #line 648 if (handle == 3) { #line 649 __ste_client_forwardReceiver2 = value; } else { } } } #line 2585 "ClientLib.c" return; } } #line 653 "ClientLib.c" int __ste_client_idCounter0 = 0; #line 655 "ClientLib.c" int __ste_client_idCounter1 = 0; #line 657 "ClientLib.c" int __ste_client_idCounter2 = 0; #line 660 "ClientLib.c" int getClientId(int handle ) { int retValue_acc ; { #line 669 "ClientLib.c" if (handle == 1) { #line 2612 retValue_acc = __ste_client_idCounter0; #line 2614 return (retValue_acc); } else { #line 2616 if (handle == 2) { #line 2621 retValue_acc = __ste_client_idCounter1; #line 2623 return (retValue_acc); } else { #line 2625 if (handle == 3) { #line 2630 retValue_acc = __ste_client_idCounter2; #line 2632 return (retValue_acc); } else { #line 2638 "ClientLib.c" retValue_acc = 0; #line 2640 return (retValue_acc); } } } #line 2647 "ClientLib.c" return (retValue_acc); } } #line 672 "ClientLib.c" void setClientId(int handle , int value ) { { #line 680 if (handle == 1) { #line 674 __ste_client_idCounter0 = value; } else { #line 675 if (handle == 2) { #line 676 __ste_client_idCounter1 = value; } else { #line 677 if (handle == 3) { #line 678 __ste_client_idCounter2 = value; } else { } } } #line 2682 "ClientLib.c" return; } } #line 1 "Client.o" #pragma merger(0,"Client.i","") #line 6 "Email.h" void printMail(int msg ) ; #line 12 int createEmail(int from , int to ) ; #line 14 "Client.h" void queue(int client , int msg ) ; #line 24 void mail(int client , int msg ) ; #line 28 void deliver(int client , int msg ) ; #line 30 void incoming(int client , int msg ) ; #line 32 int createClient(char *name ) ; #line 37 void forward(int client , int msg ) ; #line 6 "Client.c" int queue_empty = 1; #line 9 "Client.c" int queued_message ; #line 12 "Client.c" int queued_client ; #line 18 "Client.c" void mail(int client , int msg ) { int tmp ; { { #line 19 puts("mail sent"); #line 20 tmp = getEmailTo(msg); #line 20 incoming(tmp, msg); } #line 727 "Client.c" return; } } #line 27 "Client.c" void outgoing(int client , int msg ) { int tmp ; { { #line 28 tmp = getClientId(client); #line 28 setEmailFrom(msg, tmp); #line 29 mail(client, msg); } #line 749 "Client.c" return; } } #line 36 "Client.c" void deliver(int client , int msg ) { { { #line 37 puts("mail delivered\n"); } #line 769 "Client.c" return; } } #line 44 "Client.c" void incoming__wrappee__Base(int client , int msg ) { { { #line 45 deliver(client, msg); } #line 789 "Client.c" return; } } #line 51 "Client.c" void incoming(int client , int msg ) { int fwreceiver ; int tmp ; { { #line 52 incoming__wrappee__Base(client, msg); #line 53 tmp = getClientForwardReceiver(client); #line 53 fwreceiver = tmp; } #line 54 if (fwreceiver) { { #line 56 setEmailTo(msg, fwreceiver); #line 57 forward(client, msg); } } else { } #line 820 "Client.c" return; } } #line 63 "Client.c" int createClient(char *name ) { int retValue_acc ; int client ; int tmp ; { { #line 64 tmp = initClient(); #line 64 client = tmp; #line 842 "Client.c" retValue_acc = client; } #line 844 return (retValue_acc); #line 851 return (retValue_acc); } } #line 71 "Client.c" void sendEmail(int sender , int receiver ) { int email ; int tmp ; { { #line 72 tmp = createEmail(0, receiver); #line 72 email = tmp; #line 73 outgoing(sender, email); } #line 879 "Client.c" return; } } #line 81 "Client.c" void queue(int client , int msg ) { { #line 82 queue_empty = 0; #line 83 queued_message = msg; #line 84 queued_client = client; #line 903 "Client.c" return; } } #line 90 "Client.c" int is_queue_empty(void) { int retValue_acc ; { #line 921 "Client.c" retValue_acc = queue_empty; #line 923 return (retValue_acc); #line 930 return (retValue_acc); } } #line 97 "Client.c" int get_queued_client(void) { int retValue_acc ; { #line 952 "Client.c" retValue_acc = queued_client; #line 954 return (retValue_acc); #line 961 return (retValue_acc); } } #line 104 "Client.c" int get_queued_email(void) { int retValue_acc ; { #line 983 "Client.c" retValue_acc = queued_message; #line 985 return (retValue_acc); #line 992 return (retValue_acc); } } #line 110 "Client.c" void forward(int client , int msg ) { int __utac__ad__arg1 ; { { #line 1009 "Client.c" __utac__ad__arg1 = msg; #line 1010 __utac_acc__DecryptForward_spec__1(__utac__ad__arg1); #line 111 "Client.c" puts("Forwarding message.\n"); #line 112 printMail(msg); #line 113 queue(client, msg); } #line 1029 "Client.c" return; } } #line 1 "Util.o" #pragma merger(0,"Util.i","") #line 1 "Util.h" int prompt(char *msg ) ; #line 9 "Util.c" int prompt(char *msg ) { int retValue_acc ; int retval ; char const * __restrict __cil_tmp4 ; { { #line 10 __cil_tmp4 = (char const * __restrict )"%s\n"; #line 10 printf(__cil_tmp4, msg); #line 518 "Util.c" retValue_acc = retval; } #line 520 return (retValue_acc); #line 527 return (retValue_acc); } } #line 1 "Email.o" #pragma merger(0,"Email.i","") #line 15 "Email.h" int cloneEmail(int msg ) ; #line 9 "Email.c" void printMail(int msg ) { int tmp ; int tmp___0 ; int tmp___1 ; int tmp___2 ; char const * __restrict __cil_tmp6 ; char const * __restrict __cil_tmp7 ; char const * __restrict __cil_tmp8 ; char const * __restrict __cil_tmp9 ; { { #line 10 tmp = getEmailId(msg); #line 10 __cil_tmp6 = (char const * __restrict )"ID:\n %i\n"; #line 10 printf(__cil_tmp6, tmp); #line 11 tmp___0 = getEmailFrom(msg); #line 11 __cil_tmp7 = (char const * __restrict )"FROM:\n %i\n"; #line 11 printf(__cil_tmp7, tmp___0); #line 12 tmp___1 = getEmailTo(msg); #line 12 __cil_tmp8 = (char const * __restrict )"TO:\n %i\n"; #line 12 printf(__cil_tmp8, tmp___1); #line 13 tmp___2 = isReadable(msg); #line 13 __cil_tmp9 = (char const * __restrict )"IS_READABLE\n %i\n"; #line 13 printf(__cil_tmp9, tmp___2); } #line 601 "Email.c" return; } } #line 19 "Email.c" int isReadable(int msg ) { int retValue_acc ; { #line 619 "Email.c" retValue_acc = 1; #line 621 return (retValue_acc); #line 628 return (retValue_acc); } } #line 24 "Email.c" int cloneEmail(int msg ) { int retValue_acc ; { #line 650 "Email.c" retValue_acc = msg; #line 652 return (retValue_acc); #line 659 return (retValue_acc); } } #line 29 "Email.c" int createEmail(int from , int to ) { int retValue_acc ; int msg ; { { #line 30 msg = 1; #line 31 setEmailFrom(msg, from); #line 32 setEmailTo(msg, to); #line 689 "Email.c" retValue_acc = msg; } #line 691 return (retValue_acc); #line 698 return (retValue_acc); } } #line 1 "featureselect.o" #pragma merger(0,"featureselect.i","") #line 41 "featureselect.h" int select_one(void) ; #line 8 "featureselect.c" int select_one(void) { int retValue_acc ; int choice = __VERIFIER_nondet_int(); { #line 84 "featureselect.c" retValue_acc = choice; #line 86 return (retValue_acc); #line 93 return (retValue_acc); } } #line 14 "featureselect.c" void select_features(void) { { #line 115 "featureselect.c" return; } } #line 20 "featureselect.c" void select_helpers(void) { { #line 133 "featureselect.c" return; } } #line 25 "featureselect.c" int valid_product(void) { int retValue_acc ; { #line 151 "featureselect.c" retValue_acc = 1; #line 153 return (retValue_acc); #line 160 return (retValue_acc); } }
the_stack_data/748114.c
#include <stdlib.h> #include <stdio.h> #include <sys/types.h> #include <unistd.h> #include <pwd.h> static void errorexit() { perror("sussh"); exit(1); } int main(int argc, char** argv) { const char* user; const char* host; const char* command; struct passwd* entry; if (argc < 4){ fprintf(stderr, "usage: sussh user host command\n"); exit(1); } user = argv[1]; host = argv[2]; command = argv[3]; if (!(entry = getpwnam(user))){ errorexit(); } setenv("HOME", entry->pw_dir, 1); if (setuid(entry->pw_uid) != 0 || seteuid(entry->pw_uid) != 0){ errorexit(); } execl("/usr/bin/ssh", "ssh", host, command, NULL); errorexit(); return -1; }
the_stack_data/122014251.c
/* Generated automatically by H5make_libsettings -- do not edit */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * * the files COPYING and Copyright.html. COPYING can be found at the root * * of the source code distribution tree; Copyright.html can be found at the * * root level of an installed copy of the electronic HDF5 document set and * * is linked from the top-level documents page. It can also be found at * * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * * access to either file, you may request a copy from [email protected]. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Created: Oct 5, 2015 * root <root@edison> * * Purpose: This machine-generated source code contains * information about the library build configuration * * Modifications: * * DO NOT MAKE MODIFICATIONS TO THIS FILE! * It was generated by code in `H5make_libsettings.c'. * *------------------------------------------------------------------------- */ char H5libhdf5_settings[]= " SUMMARY OF THE HDF5 CONFIGURATION\n" " =================================\n" "\n" "General Information:\n" "-------------------\n" " HDF5 Version: \n" " Configured on: Mon Oct 5 19:41:44 UTC 2015\n" " Configured by: root@edison\n" " Configure mode: production\n" " Host system: i686-pc-linux-gnu\n" " Uname information: Linux edison 3.10.17-poky-edison+ #1 SMP PREEMPT Fri Jun 19 12:06:40 CEST 2015 i686 GNU/Linux\n" " Byte sex: little-endian\n" " Libraries: static, shared\n" " Installation point: /home/root/hdf5-1.8.15-patch1/hdf5\n" "\n" "Compiling Options:\n" "------------------\n" " Compilation Mode: production\n" " C Compiler: /usr/bin/gcc ( gcc (GCC) 4.9.1)\n" " CFLAGS: \n" " H5_CFLAGS: -std=c99 -pedantic -Wall -Wextra -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -Wfloat-equal -Wmissing-format-attribute -Wmissing-noreturn -Wpacked -Wdisabled-optimization -Wformat=2 -Wunreachable-code -Wendif-labels -Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros -Wunsafe-loop-optimizations -Wc++-compat -Wstrict-overflow -Wlogical-op -Wlarger-than=2048 -Wvla -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines -Wstack-usage=8192 -Wvector-operation-performance -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Wdate-time -Wopenmp-simd -O3 -fomit-frame-pointer -finline-functions\n" " AM_CFLAGS: \n" " CPPFLAGS: \n" " H5_CPPFLAGS: -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -D_POSIX_C_SOURCE=200112L -DNDEBUG -UH5_DEBUG_API\n" " AM_CPPFLAGS: -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 \n" " Shared C Library: yes\n" " Static C Library: yes\n" " Statically Linked Executables: no\n" " LDFLAGS: \n" " H5_LDFLAGS: \n" " AM_LDFLAGS: \n" " Extra libraries: -lz -ldl -lm \n" " Archiver: ar\n" " Ranlib: ranlib\n" " Debugged Packages: \n" " API Tracing: no\n" "\n" "Languages:\n" "----------\n" " Fortran: no\n" "\n" " C++: no\n" "\n" "Features:\n" "---------\n" " Parallel HDF5: no\n" " High Level library: yes\n" " Threadsafety: no\n" " Default API Mapping: v18\n" " With Deprecated Public Symbols: yes\n" " I/O filters (external): deflate(zlib)\n" " MPE: no\n" " Direct VFD: no\n" " dmalloc: no\n" "Clear file buffers before write: yes\n" " Using memory checker: no\n" " Function Stack Tracing: no\n" " Strict File Format Checks: no\n" " Optimization Instrumentation: no\n" ;
the_stack_data/211081505.c
extern void fun_a2x(void); extern void fun_a2y(void); void fun_a2(void) { fun_a2x(); fun_a2y(); }
the_stack_data/60715.c
/** * BOJ 1654번 C언어 소스 코드 * 작성자 : 동동매니저 (DDManager) * * ※ 실행 결과 * 사용 메모리 : 1,112 KB / 131,072 KB * 소요 시간 : 4 ms / 2,000 ms * * Copyright 2020. DDManager all rights reserved. */ #include <stdio.h> #include <stdlib.h> long long calc(int *arr,int K,long long len){ long long sum=0; int i; for(i=0;i<K;i++) sum+=arr[i]/len; return sum; } int main(void){ int K,N; int *A; int M=0; long long left,right,mid; long long answer=0; int i; scanf("%d %d",&K,&N); A=(int*)calloc(K,sizeof(int)); for(i=0;i<K;i++){ scanf("%d",&A[i]); if(A[i]>M) M=A[i]; } left=1;right=M; while(left<=right){ mid=(left+right)/2; if(calc(A,K,mid)<N) right=mid-1; else{ left=mid+1; answer=mid; } } printf("%lld\n",answer); return 0; }
the_stack_data/47053.c
/* 9x9 multiplication table in C CC0, Wei-Lun Chao <[email protected]>, 2018. */ // gcc mt9x9.c -o mt9x9 && ./mt9x9 #include <stdio.h> int main(int argc, char *argv[]) { int i, j, k; for(i = 1; i <= 9; i += 3) { for(j = 1; j <= 9; j++) { for(k = i; k <= i+2; k++) printf("%dx%d=%2d\t", k, j, k*j); putchar(10); } printf("\n"); } }
the_stack_data/187642574.c
/* Combining multiple conditions in a single condition Three logical operators: AND: && (all conditons to be true separately) OR: || (any one of the condition to be true) NOT: ! (opposite of the given cobditon is true) */ #include <stdio.h> #include <ctype.h> int main() { char dummy; printf("Enter value for dummy:"); scanf("%c", &dummy); if (isalpha(dummy) && dummy == 'a') //condition-1 (logical AND: &&) printf("You entered an alphabet with value a"); //executes if condition at line 13 is true. Notice we can skip {} in case there is single statmenet after if or else else if (isalpha(dummy) || isdigit(dummy)) //condition-2 (logical OR: ||) { printf("You entered a digit or aplhabet"); //executes if condition in line 13 is false and line 15 is true } if (! ispunct(dummy)) //conditon-3 (logical NOT) printf("\n Executes if dummy is not a punctutation mark. Notice if at line 24 is independt of if-else at line 17 and 19"); return 0; }
the_stack_data/90761936.c
#include <stdio.h> #include <stdlib.h> #include <string.h> struct Student { char name[20]; char id[20]; int score; struct Student *next; }; struct Student *ListA = NULL; struct Student *creat( struct Student *List) //创建一个链表,获取输入的数据 { struct Student *newPtr, *currentPtr; currentPtr = newPtr = malloc(sizeof(struct Student)); printf("Please input the information of the students:\n"); scanf("%s", &newPtr->name); while( strcmp(newPtr->name, "#####") ){ if( List == NULL) List = currentPtr; else currentPtr->next = newPtr; currentPtr = newPtr; scanf("%s""%d", &newPtr->id, &newPtr->score); newPtr = malloc(sizeof(struct Student)); scanf("%s", &newPtr->name); currentPtr->next = NULL; } return List; } struct Student *cut_and_paste(struct Student *ListB) //将A链表中满足条件的节点切下连接到B链表后 { struct Student *newPtr_A, *prePtr_A, *currentPtr_B = NULL, *newPtr_B = NULL; prePtr_A = ListA; newPtr_A = ListA->next; //第一个成绩就大于等于1400的情况 while( newPtr_A->next != NULL && prePtr_A->score >= 1400){ printf("1\n"); newPtr_B = prePtr_A; //先将B的new指向该节点 newPtr_A = newPtr_A->next; //将A的new向前移动一格 prePtr_A = prePtr_A->next; //A的pre也向前移动一格 if( currentPtr_B == NULL) //判断B是否为第一个节点,若是,则连上头指针,若不是,则将之前的链表连接到新的节点上 ListB = currentPtr_B = newPtr_B; else{ currentPtr_B->next = newPtr_B; currentPtr_B = newPtr_B; } newPtr_B->next = NULL; //将B新的节点指向NULL } ListA = prePtr_A; //当前第一个成绩不大于1400的情况 while( newPtr_A->next != NULL){ printf("2\n"); if( newPtr_A->score >= 1400){ //满足条件的节点的剪切与粘贴 printf("2.1\n"); newPtr_B = newPtr_A; //先将B的new指向该节点 newPtr_A = newPtr_A->next; //A的new指针向前移动一个节点 prePtr_A->next = newPtr_A; //将A的之前一个节点连接到new指针所指的节点,此时满足条件的节点已经被跳过 if( currentPtr_B == NULL) //判断B是否为第一个节点,若是,则连上头指针,若不是,则将之前的链表连接到新的节点上 ListB = currentPtr_B = newPtr_B; else{ currentPtr_B->next = newPtr_B; currentPtr_B = newPtr_B; } newPtr_B->next = NULL; //将新的节点指向NULL } else{ //若不满足条件,则将A的前后两个指针都向前移动一个节点 printf("2.2\n"); newPtr_A = newPtr_A->next; prePtr_A = prePtr_A->next; } } //最后一个节点 if( newPtr_A->score >= 1400) { printf("3\n"); newPtr_B = newPtr_A; if( currentPtr_B == NULL) //判断B是否为第一个节点,若是,则连上头指针,若不是,则将之前的链表连接到新的节点上 ListB = currentPtr_B = newPtr_B; else{ currentPtr_B->next = newPtr_B; currentPtr_B = newPtr_B; } prePtr_A->next = NULL; } else; return ListB; } void print(struct Student *ListB, char property[]) //打印目标链表的数据 { if( ListB == NULL) printf("There is no student with a score higher than 1400\n"); else{ int x = 0; struct Student *p = ListB; while( p != NULL){ x++; p = p->next; } p = ListB; printf("There are %d students' score %s than 1400. They are:\n", x, property); while( p != NULL){ printf("Name:%s ID:%s Score:%d\n", p->name, p->id, p->score); p = p->next; }; } } int main() { struct Student *ListB = NULL; ListA = creat(ListA); ListB = cut_and_paste(ListB); print(ListB, "higher"); print(ListA, "lower"); free(ListA); free(ListB); }
the_stack_data/154830449.c
#include <stdio.h> int main(void){ int guess = 1; printf("Pick an integer from 1 to 100. I will try to guess "); printf("it.\n Respond with a y if mu guess is right and with a n if it is wrong.\n"); printf("Uh.. is your number %d?\n", guess); while (getchar() != 'y') printf("Well, then, is it %d?\n", ++guess); printf("I knew I could do it!\n"); return 0; }
the_stack_data/689377.c
#include<stdio.h> int main() { int a = 9, b = 4, c; c = a+b; printf("a+b = %d \n",c); c = a-b; printf("a-b = %d \n",c); c = a*b; printf("a*b = %d \n",c); c = a/b; printf("a/b = %d \n",c); c = a%b; printf("Remainder when a divided by b = %d \n",c); return 0; }
the_stack_data/48045.c
#include <stdio.h> int main(void) { int i, j; for (i = 5, j = i - 1; i > 0, j > 0; --i, j = i - 1) printf("%d ", i); printf("\n\n"); for (int i = 10; i >= 1; i /= 2) printf("%d ", i++); return 0; }
the_stack_data/22013305.c
/* Test diagnostic for extra semicolon outside a function. Test with -pedantic. */ /* Origin: Joseph Myers <[email protected]> */ /* { dg-do compile } */ /* { dg-options "-pedantic" } */ ; /* { dg-warning "ISO C does not allow extra ';' outside of a function" } */
the_stack_data/237644289.c
// Bubble Sort; Daniel S. Wilkerson // see License.txt for copyright and terms of use #include <stdlib.h> // atoi, getenv #include <stdio.h> // scanf, printf #include <assert.h> // assert int capacity = 0; // size of 'data' array int size = 0; // amount of 'data' that has real data in it int *data = NULL; // the data we sort void bubble_sort(int size, int *data) { int *a; int *b; for(a=data; a<data+size; ++a) { // put the smallest element to the right of a into *a for(b=a+1; b<data+size; ++b) { // move the smaller element to a if (*a > *b) { // swap without a temporary *a ^= *b; *b ^= *a; *a ^= *b; } } } } // ensure we have space for at least new_size elements void ensure_size(int new_size) { if (new_size <= capacity) return; int new_capacity = 2*capacity; if (new_capacity < 16) new_capacity = 16; data = (int *) realloc(data, new_capacity * sizeof *data); if (!data) exit(1); // out of memory capacity = new_capacity; } int main(int argc, char **argv) { // populate the data array // // Ah, this is an error. The last time through we are going to // make space in the array for the next number, but it is not // going to get filled in. Therefor the sorted array will contain // one datum of garbage. Trend-prof found this bug because the // number of iterations of the loop wasn't n*(n-1)/2, but instead // [n+1]*([n+1]-1)/2. // for (size=1; 1; ++size) { // ensure_size(size); // int num_scanned = scanf("%d", &(data[size-1])); // data + size - 1 while(1) { int temp; int num_scanned = scanf("%d", &temp); if (num_scanned == -1) break; // done if (num_scanned != 1) exit(1); // scan error ++size; ensure_size(size); data[size-1] = temp; } // sort it bubble_sort(size, data); // print it out if (getenv("BUBBLE_PRINT")) { printf("size=%d\n", size); int *start; for (start=data; start<data+size; ++start) { printf("%d\n", *start); } } return 0; }
the_stack_data/125139857.c
/* This testcase is part of GDB, the GNU debugger. Copyright 2011-2020 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <pthread.h> int main (void) { /* Ensure we link against pthreads even with --as-needed. */ pthread_testcancel(); return 0; }
the_stack_data/190766862.c
#include <stdio.h> int main(void){ printf("My first C program\n"); return 0; }
the_stack_data/91081.c
#include <stdio.h> int isPowerOfTwo(int n){ int count = 0; while(n > 0){ count += (n&1); n = n>>1; } if(count == 1) return 1; else return 0; } int main(){ printf("%d\n", isPowerOfTwo(5)); }
the_stack_data/739.c
// Modified by Yen-Ju Chen <yjchenx @ gmail DOT_ com> /* This is the Porter stemming algorithm, coded up as thread-safe ANSI C by the author. It may be be regarded as cononical, in that it follows the algorithm presented in Porter, 1980, An algorithm for suffix stripping, Program, Vol. 14, no. 3, pp 130-137, only differing from it at the points maked --DEPARTURE-- below. See also http://www.tartarus.org/~martin/PorterStemmer The algorithm as described in the paper could be exactly replicated by adjusting the points of DEPARTURE, but this is barely necessary, because (a) the points of DEPARTURE are definitely improvements, and (b) no encoding of the Porter stemmer I have seen is anything like as exact as this version, even with the points of DEPARTURE! You can compile it on Unix with 'gcc -O3 -o stem stem.c' after which 'stem' takes a list of inputs and sends the stemmed equivalent to stdout. The algorithm as encoded here is particularly fast. Release 2 (the more old-fashioned, non-thread-safe version may be regarded as release 1.) */ #import <stdlib.h> /* for malloc, free */ #import <string.h> /* for memcmp, memmove */ #if 0 /* You will probably want to move the following declarations to a central header file. */ struct stemmer; extern struct stemmer * create_stemmer(void); extern void free_stemmer(struct stemmer * z); extern int stem(struct stemmer * z, char * b, int k); #endif /* The main part of the stemming algorithm starts here. */ #define TRUE 1 #define FALSE 0 /* stemmer is a structure for a few local bits of data, */ struct stemmer { char * b; /* buffer for word to be stemmed */ int k; /* offset to the end of the string */ int j; /* a general offset into the string */ }; /* Member b is a buffer holding a word to be stemmed. The letters are in b[0], b[1] ... ending at b[z->k]. Member k is readjusted downwards as the stemming progresses. Zero termination is not in fact used in the algorithm. Note that only lower case sequences are stemmed. Forcing to lower case should be done before stem(...) is called. Typical usage is: struct stemmer * z = create_stemmer(); char b[] = "pencils"; int res = stem(z, b, 6); /- stem the 7 characters of b[0] to b[6]. The result, res, will be 5 (the 's' is removed). -/ free_stemmer(z); */ extern struct stemmer * create_stemmer(void) { return (struct stemmer *) malloc(sizeof(struct stemmer)); /* assume malloc succeeds */ } extern void free_stemmer(struct stemmer * z) { free(z); } /* cons(z, i) is TRUE <=> b[i] is a consonant. ('b' means 'z->b', but here and below we drop 'z->' in comments. */ static int cons(struct stemmer * z, int i) { switch (z->b[i]) { case 'a': case 'e': case 'i': case 'o': case 'u': return FALSE; case 'y': return (i == 0) ? TRUE : !cons(z, i - 1); default: return TRUE; } } /* m(z) measures the number of consonant sequences between 0 and j. if c is a consonant sequence and v a vowel sequence, and <..> indicates arbitrary presence, <c><v> gives 0 <c>vc<v> gives 1 <c>vcvc<v> gives 2 <c>vcvcvc<v> gives 3 .... */ static int m(struct stemmer * z) { int n = 0; int i = 0; int j = z->j; while(TRUE) { if (i > j) return n; if (! cons(z, i)) break; i++; } i++; while(TRUE) { while(TRUE) { if (i > j) return n; if (cons(z, i)) break; i++; } i++; n++; while(TRUE) { if (i > j) return n; if (! cons(z, i)) break; i++; } i++; } } /* vowelinstem(z) is TRUE <=> 0,...j contains a vowel */ static int vowelinstem(struct stemmer * z) { int j = z->j; int i; for (i = 0; i <= j; i++) if (! cons(z, i)) return TRUE; return FALSE; } /* doublec(z, j) is TRUE <=> j,(j-1) contain a double consonant. */ static int doublec(struct stemmer * z, int j) { char * b = z->b; if (j < 1) return FALSE; if (b[j] != b[j - 1]) return FALSE; return cons(z, j); } /* cvc(z, i) is TRUE <=> i-2,i-1,i has the form consonant - vowel - consonant and also if the second c is not w,x or y. this is used when trying to restore an e at the end of a short word. e.g. cav(e), lov(e), hop(e), crim(e), but snow, box, tray. */ static int cvc(struct stemmer * z, int i) { if (i < 2 || !cons(z, i) || cons(z, i - 1) || !cons(z, i - 2)) return FALSE; { int ch = z->b[i]; if (ch == 'w' || ch == 'x' || ch == 'y') return FALSE; } return TRUE; } /* ends(z, s) is TRUE <=> 0,...k ends with the string s. */ static int ends(struct stemmer * z, char * s) { int length = s[0]; char * b = z->b; int k = z->k; if (s[length] != b[k]) return FALSE; /* tiny speed-up */ if (length > k + 1) return FALSE; if (memcmp(b + k - length + 1, s + 1, length) != 0) return FALSE; z->j = k-length; return TRUE; } /* setto(z, s) sets (j+1),...k to the characters in the string s, readjusting k. */ static void setto(struct stemmer * z, char * s) { int length = s[0]; int j = z->j; memmove(z->b + j + 1, s + 1, length); z->k = j+length; } /* r(z, s) is used further down. */ static void r(struct stemmer * z, char * s) { if (m(z) > 0) setto(z, s); } /* step1ab(z) gets rid of plurals and -ed or -ing. e.g. caresses -> caress ponies -> poni ties -> ti caress -> caress cats -> cat feed -> feed agreed -> agree disabled -> disable matting -> mat mating -> mate meeting -> meet milling -> mill messing -> mess meetings -> meet */ static void step1ab(struct stemmer * z) { char * b = z->b; if (b[z->k] == 's') { if (ends(z, "\04" "sses")) z->k -= 2; else if (ends(z, "\03" "ies")) setto(z, "\01" "i"); else if (b[z->k - 1] != 's') z->k--; } if (ends(z, "\03" "eed")) { if (m(z) > 0) z->k--; } else if ((ends(z, "\02" "ed") || ends(z, "\03" "ing")) && vowelinstem(z)) { z->k = z->j; if (ends(z, "\02" "at")) setto(z, "\03" "ate"); else if (ends(z, "\02" "bl")) setto(z, "\03" "ble"); else if (ends(z, "\02" "iz")) setto(z, "\03" "ize"); else if (doublec(z, z->k)) { z->k--; { int ch = b[z->k]; if (ch == 'l' || ch == 's' || ch == 'z') z->k++; } } else if (m(z) == 1 && cvc(z, z->k)) setto(z, "\01" "e"); } } /* step1c(z) turns terminal y to i when there is another vowel in the stem. */ static void step1c(struct stemmer * z) { if (ends(z, "\01" "y") && vowelinstem(z)) z->b[z->k] = 'i'; } /* step2(z) maps double suffices to single ones. so -ization ( = -ize plus -ation) maps to -ize etc. note that the string before the suffix must give m(z) > 0. */ static void step2(struct stemmer * z) { switch (z->b[z->k-1]) { case 'a': if (ends(z, "\07" "ational")) { r(z, "\03" "ate"); break; } if (ends(z, "\06" "tional")) { r(z, "\04" "tion"); break; } break; case 'c': if (ends(z, "\04" "enci")) { r(z, "\04" "ence"); break; } if (ends(z, "\04" "anci")) { r(z, "\04" "ance"); break; } break; case 'e': if (ends(z, "\04" "izer")) { r(z, "\03" "ize"); break; } break; case 'l': if (ends(z, "\03" "bli")) { r(z, "\03" "ble"); break; } /*-DEPARTURE-*/ /* To match the published algorithm, replace this line with case 'l': if (ends(z, "\04" "abli")) { r(z, "\04" "able"); break; } */ if (ends(z, "\04" "alli")) { r(z, "\02" "al"); break; } if (ends(z, "\05" "entli")) { r(z, "\03" "ent"); break; } if (ends(z, "\03" "eli")) { r(z, "\01" "e"); break; } if (ends(z, "\05" "ousli")) { r(z, "\03" "ous"); break; } break; case 'o': if (ends(z, "\07" "ization")) { r(z, "\03" "ize"); break; } if (ends(z, "\05" "ation")) { r(z, "\03" "ate"); break; } if (ends(z, "\04" "ator")) { r(z, "\03" "ate"); break; } break; case 's': if (ends(z, "\05" "alism")) { r(z, "\02" "al"); break; } if (ends(z, "\07" "iveness")) { r(z, "\03" "ive"); break; } if (ends(z, "\07" "fulness")) { r(z, "\03" "ful"); break; } if (ends(z, "\07" "ousness")) { r(z, "\03" "ous"); break; } break; case 't': if (ends(z, "\05" "aliti")) { r(z, "\02" "al"); break; } if (ends(z, "\05" "iviti")) { r(z, "\03" "ive"); break; } if (ends(z, "\06" "biliti")) { r(z, "\03" "ble"); break; } break; case 'g': if (ends(z, "\04" "logi")) { r(z, "\03" "log"); break; } /*-DEPARTURE-*/ /* To match the published algorithm, delete this line */ } } /* step3(z) deals with -ic-, -full, -ness etc. similar strategy to step2. */ static void step3(struct stemmer * z) { switch (z->b[z->k]) { case 'e': if (ends(z, "\05" "icate")) { r(z, "\02" "ic"); break; } if (ends(z, "\05" "ative")) { r(z, "\00" ""); break; } if (ends(z, "\05" "alize")) { r(z, "\02" "al"); break; } break; case 'i': if (ends(z, "\05" "iciti")) { r(z, "\02" "ic"); break; } break; case 'l': if (ends(z, "\04" "ical")) { r(z, "\02" "ic"); break; } if (ends(z, "\03" "ful")) { r(z, "\00" ""); break; } break; case 's': if (ends(z, "\04" "ness")) { r(z, "\00" ""); break; } break; } } /* step4(z) takes off -ant, -ence etc., in context <c>vcvc<v>. */ static void step4(struct stemmer * z) { switch (z->b[z->k-1]) { case 'a': if (ends(z, "\02" "al")) break; return; case 'c': if (ends(z, "\04" "ance")) break; if (ends(z, "\04" "ence")) break; return; case 'e': if (ends(z, "\02" "er")) break; return; case 'i': if (ends(z, "\02" "ic")) break; return; case 'l': if (ends(z, "\04" "able")) break; if (ends(z, "\04" "ible")) break; return; case 'n': if (ends(z, "\03" "ant")) break; if (ends(z, "\05" "ement")) break; if (ends(z, "\04" "ment")) break; if (ends(z, "\03" "ent")) break; return; case 'o': if (ends(z, "\03" "ion") && (z->b[z->j] == 's' || z->b[z->j] == 't')) break; if (ends(z, "\02" "ou")) break; return; /* takes care of -ous */ case 's': if (ends(z, "\03" "ism")) break; return; case 't': if (ends(z, "\03" "ate")) break; if (ends(z, "\03" "iti")) break; return; case 'u': if (ends(z, "\03" "ous")) break; return; case 'v': if (ends(z, "\03" "ive")) break; return; case 'z': if (ends(z, "\03" "ize")) break; return; default: return; } if (m(z) > 1) z->k = z->j; } /* step5(z) removes a final -e if m(z) > 1, and changes -ll to -l if m(z) > 1. */ static void step5(struct stemmer * z) { char * b = z->b; z->j = z->k; if (b[z->k] == 'e') { int a = m(z); if (a > 1 || (a == 1 && !cvc(z, z->k - 1))) z->k--; } if (b[z->k] == 'l' && doublec(z, z->k) && m(z) > 1) z->k--; } /* In stem(z, b, k), b is a char pointer, and the string to be stemmed is from b[0] to b[k] inclusive. Possibly b[k+1] == '\0', but it is not important. The stemmer adjusts the characters b[0] ... b[k] and returns the new end-point of the string, k'. Stemming never increases word length, so 0 <= k' <= k. */ extern int stem(struct stemmer * z, char * b, int k) { if (k <= 1) return k; /*-DEPARTURE-*/ z->b = b; z->k = k; /* copy the parameters into z */ /* With this line, strings of length 1 or 2 don't go through the stemming process, although no mention is made of this in the published algorithm. Remove the line to match the published algorithm. */ step1ab(z); step1c(z); step2(z); step3(z); step4(z); step5(z); return z->k; } /*--------------------stemmer definition ends here------------------------*/ #if 0 #import <stdio.h> #import <stdlib.h> /* for malloc, free */ #import <ctype.h> /* for isupper, islower, tolower */ static char * s; /* buffer for words tobe stemmed */ #define INC 50 /* size units in which s is increased */ static int i_max = INC; /* maximum offset in s */ #define LETTER(ch) (isupper(ch) || islower(ch)) void stemfile(struct stemmer * z, FILE * f) { while(TRUE) { int ch = getc(f); if (ch == EOF) return; if (LETTER(ch)) { int i = 0; while(TRUE) { if (i == i_max) { i_max += INC; s = realloc(s, i_max + 1); } ch = tolower(ch); /* forces lower case */ s[i] = ch; i++; ch = getc(f); if (!LETTER(ch)) { ungetc(ch,f); break; } } s[stem(z, s, i - 1) + 1] = 0; /* the previous line calls the stemmer and uses its result to zero-terminate the string in s */ printf("%s",s); } else putchar(ch); } } int main(int argc, char * argv[]) { int i; struct stemmer * z = create_stemmer(); s = (char *) malloc(i_max + 1); for (i = 1; i < argc; i++) { FILE * f = fopen(argv[i],"r"); if (f == 0) { fprintf(stderr,"File %s not found\n",argv[i]); exit(1); } stemfile(z, f); } free(s); free_stemmer(z); return 0; } #endif
the_stack_data/57109.c
#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int i; double d; long l; i = atoi(argv[1]); l = atol(argv[2]); d = atof(argv[3]); printf("%d %ld %f", i, l, d); }
the_stack_data/18888646.c
#include <stdio.h> void hello(char *name, unsigned int name_len) { *name = 'D'; name[name_len-1] = 'd'; } #define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> void alphabet() { // Input file. FILE *rp; rp = fopen("~/input", "r+"); if (rp == NULL) exit(EXIT_FAILURE); // Output file. FILE *op; op = fopen("~/output", "w"); if (op == NULL) exit(EXIT_FAILURE); char *line = NULL; // The buffer we will be reading each line into. size_t len = 0; // The length of each line. size_t read; // The number of characters read from the file. while ( (read = getline(&line, &len, rp)) != -1 ) { fputs(line, op); } // Close the file pointers. fclose(rp); fclose(op); // Free buffer. if (line) free(line); }
the_stack_data/1029494.c
#ifndef TH_GENERIC_FILE #define TH_GENERIC_FILE "generic/ClassNLLCriterion.c" #else void THNN_(ClassNLLCriterion_updateOutput)( THNNState *state, THTensor *input, THIndexTensor *target, THTensor *output, bool sizeAverage, THTensor *weights, THTensor *total_weight, int64_t ignore_index, bool reduce) { THTensor_(resize1d)(total_weight, 1); int n_dims = THTensor_(nDimension)(input); int n_classes = THTensor_(size)(input, n_dims - 1); ignore_index -= TH_INDEX_BASE; if (THIndexTensor_(nDimension)(target) > 1) { THError("multi-target not supported"); } if (THTensor_(nDimension)(input) > 2) { THError("input tensor should be 1D or 2D"); } if (weights && THTensor_(nElement)(weights) != n_classes) { THDescBuff s1 = THTensor_(sizeDesc)(weights); THError("weight tensor should be defined either for all %d classes or no classes" " but got weight tensor of shape: %s", n_classes, s1.str); } if (!reduce && n_dims == 2) { int batch_size = THTensor_(size)(input, 0); THTensor_(resize1d)(output, batch_size); int i; #pragma omp parallel for private(i) for (i = 0; i < batch_size; i++) { int cur_target = THTensor_fastGet1d(target, i) - TH_INDEX_BASE; if (cur_target == ignore_index) { THTensor_fastSet1d(output, i, 0.0f); continue; } real cur_weight = weights ? THTensor_fastGet1d(weights, cur_target) : 1.0f; THTensor_fastSet1d(output, i, -THTensor_fastGet2d(input, i, cur_target) * cur_weight); } return; } if (!reduce && n_dims <= 1) { sizeAverage = false; } THTensor_(resize1d)(output, 1); input = THTensor_(newContiguous)(input); target = THIndexTensor_(newContiguous)(target); weights = weights ? THTensor_(newContiguous)(weights) : NULL; real *input_data = THTensor_(data)(input); THIndex_t *target_data = THIndexTensor_(data)(target); real *weights_data = weights ? THTensor_(data)(weights) : NULL; real *output_data = THTensor_(data)(output); real *total_weight_data = THTensor_(data)(total_weight); output_data[0] = total_weight_data[0] = 0.0; if (THTensor_(nDimension)(input) == 1) { int cur_target = target_data[0] - TH_INDEX_BASE; if (cur_target != ignore_index) { THAssert(cur_target >= 0 && cur_target < n_classes); total_weight_data[0] = weights ? weights_data[cur_target] : 1.0f; output_data[0] = -input_data[cur_target] * total_weight_data[0]; } } else if (THTensor_(nDimension)(input) == 2) { int batch_size = THTensor_(size)(input, 0); THAssert(THIndexTensor_(size)(target, 0) == batch_size); int n_target = THTensor_(size)(input, 1); int i; for (i = 0; i < batch_size; i++) { int cur_target = target_data[i] - TH_INDEX_BASE; if (cur_target != ignore_index) { THAssert(cur_target >= 0 && cur_target < n_classes); real cur_weight = weights ? weights_data[cur_target] : 1.0f; total_weight_data[0] += cur_weight; output_data[0] -= input_data[i * n_target + cur_target] * cur_weight; } } } if (sizeAverage && total_weight_data[0]) { output_data[0] /= total_weight_data[0]; } if (weights) { THTensor_(free)(weights); } THTensor_(free)(input); THIndexTensor_(free)(target); } void THNN_(ClassNLLCriterion_updateGradInput)( THNNState *state, THTensor *input, THIndexTensor *target, THTensor *gradOutput, THTensor *gradInput, bool sizeAverage, THTensor *weights, THTensor *total_weight, int64_t ignore_index, bool reduce) { THTensor_(resizeAs)(gradInput, input); THTensor_(zero)(gradInput); int n_dims = THTensor_(nDimension)(input); int n_classes = THTensor_(size)(input, n_dims - 1); ignore_index -= TH_INDEX_BASE; if (!THTensor_(isContiguous)(gradInput)) { THError("gradInput must be contiguous"); } if (THIndexTensor_(nDimension)(target) > 1) { THError("multi-target not supported"); } if (THTensor_(nDimension)(input) > 2) { THError("input tensor should be 1D or 2D"); } if (weights && THTensor_(nElement)(weights) != n_classes) { THError("weight tensor should be defined either for all or no classes"); } if (!reduce && n_dims == 2) { int batch_size = THTensor_(size)(input, 0); THNN_CHECK_DIM_SIZE(gradOutput, 1, 0, batch_size); int i; #pragma omp parallel for private(i) for (i = 0; i < batch_size; i++) { int cur_target = THTensor_fastGet1d(target, i) - TH_INDEX_BASE; if (cur_target == ignore_index) { continue; } real weight = weights ? THTensor_fastGet1d(weights, cur_target) : 1.0f; THTensor_fastSet2d(gradInput, i, cur_target, -weight * THTensor_fastGet1d(gradOutput, i)); } return; } if (!reduce && n_dims <= 1) { sizeAverage = false; } real *total_weight_data = THTensor_(data)(total_weight); if (*total_weight_data <= 0) { return; } THNN_CHECK_DIM_SIZE(gradOutput, 1, 0, 1); target = THIndexTensor_(newContiguous)(target); weights = weights ? THTensor_(newContiguous)(weights) : NULL; THIndex_t *target_data = THIndexTensor_(data)(target); real *weights_data = weights ? THTensor_(data)(weights) : NULL; real *gradInput_data = THTensor_(data)(gradInput); real gradOutput_value = THTensor_(get1d)(gradOutput, 0); if (THTensor_(nDimension)(input) == 1) { int cur_target = target_data[0] - TH_INDEX_BASE; if (cur_target != ignore_index) { THAssert(cur_target >= 0 && cur_target < n_classes); gradInput_data[cur_target] = (!sizeAverage && weights) ? -weights_data[cur_target] : -1; gradInput_data[cur_target] *= gradOutput_value; } } else if (THTensor_(nDimension)(input) == 2) { int batch_size = THTensor_(size)(input, 0); THAssert(THIndexTensor_(size)(target, 0) == batch_size); int n_target = THTensor_(size)(input, 1); int i; for (i = 0; i < batch_size; i++){ int cur_target = target_data[i] - TH_INDEX_BASE; if (cur_target != ignore_index) { THAssert(cur_target >= 0 && cur_target < n_classes); gradInput_data[i * n_target + cur_target] = -(weights ? weights_data[cur_target] : 1.0f) * gradOutput_value; if (sizeAverage && *total_weight_data) { gradInput_data[i * n_target + cur_target] /= *total_weight_data; } } } } THIndexTensor_(free)(target); if (weights) { THTensor_(free)(weights); } } #endif
the_stack_data/56281.c
/* * Copyright 2008-2012 Niels Provos and Nick Mathewson * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #include <sys/types.h> #include <sys/stat.h> #ifdef _WIN32 #include <winsock2.h> #else #include <sys/socket.h> #include <sys/resource.h> #include <sys/time.h> #include <unistd.h> #endif #include <fcntl.h> #include <signal.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <errno.h> #include "event2/event.h" #include "event2/buffer.h" #include "event2/util.h" #include "event2/http.h" #include "event2/thread.h" static void http_basic_cb(struct evhttp_request *req, void *arg); static char *content; static size_t content_len = 0; static void http_basic_cb(struct evhttp_request *req, void *arg) { struct evbuffer *evb = evbuffer_new(); evbuffer_add(evb, content, content_len); /* allow sending of an empty reply */ evhttp_send_reply(req, HTTP_OK, "Everything is fine", evb); evbuffer_free(evb); } #if LIBEVENT_VERSION_NUMBER >= 0x02000200 static void http_ref_cb(struct evhttp_request *req, void *arg) { struct evbuffer *evb = evbuffer_new(); evbuffer_add_reference(evb, content, content_len, NULL, NULL); /* allow sending of an empty reply */ evhttp_send_reply(req, HTTP_OK, "Everything is fine", evb); evbuffer_free(evb); } #endif int main(int argc, char **argv) { struct event_config *cfg = event_config_new(); struct event_base *base; struct evhttp *http; int i; int c; int use_iocp = 0; ev_uint16_t port = 8080; char *endptr = NULL; #ifdef _WIN32 WSADATA WSAData; WSAStartup(0x101, &WSAData); #else if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) return (1); #endif for (i = 1; i < argc; ++i) { if (*argv[i] != '-') continue; c = argv[i][1]; if ((c == 'p' || c == 'l') && i + 1 >= argc) { fprintf(stderr, "-%c requires argument.\n", c); exit(1); } switch (c) { case 'p': if (i+1 >= argc || !argv[i+1]) { fprintf(stderr, "Missing port\n"); exit(1); } port = (int)strtol(argv[i+1], &endptr, 10); if (*endptr != '\0') { fprintf(stderr, "Bad port\n"); exit(1); } break; case 'l': if (i+1 >= argc || !argv[i+1]) { fprintf(stderr, "Missing content length\n"); exit(1); } content_len = (size_t)strtol(argv[i+1], &endptr, 10); if (*endptr != '\0' || content_len == 0) { fprintf(stderr, "Bad content length\n"); exit(1); } break; #ifdef _WIN32 case 'i': use_iocp = 1; #ifdef EVTHREAD_USE_WINDOWS_THREADS_IMPLEMENTED evthread_use_windows_threads(); #endif event_config_set_flag(cfg,EVENT_BASE_FLAG_STARTUP_IOCP); break; #endif default: fprintf(stderr, "Illegal argument \"%c\"\n", c); exit(1); } } base = event_base_new_with_config(cfg); if (!base) { fprintf(stderr, "creating event_base failed. Exiting.\n"); return 1; } http = evhttp_new(base); content = malloc(content_len); if (content == NULL) { fprintf(stderr, "Cannot allocate content\n"); exit(1); } else { int i = 0; for (i = 0; i < (int)content_len; ++i) content[i] = (i & 255); } evhttp_set_cb(http, "/ind", http_basic_cb, NULL); fprintf(stderr, "/ind - basic content (memory copy)\n"); evhttp_set_cb(http, "/ref", http_ref_cb, NULL); fprintf(stderr, "/ref - basic content (reference)\n"); fprintf(stderr, "Serving %d bytes on port %d using %s\n", (int)content_len, port, use_iocp? "IOCP" : event_base_get_method(base)); evhttp_bind_socket(http, "0.0.0.0", port); #ifdef _WIN32 if (use_iocp) { struct timeval tv={99999999,0}; event_base_loopexit(base, &tv); } #endif event_base_dispatch(base); #ifdef _WIN32 WSACleanup(); #endif /* NOTREACHED */ return (0); }
the_stack_data/90309.c
void foo() { int a; #pragma scop a = 5; a++; #pragma endscop }
the_stack_data/98575880.c
#include<stdio.h> int foo() { printf("Hello\n"); return 0; } int bar() { printf("Called bar\n"); return 0; } int main(){ int a[2][3]; a[bar()][1 && foo()] = 0; }
the_stack_data/20449735.c
#include <assert.h> void f1() { // goes into global name space! extern int i; assert(i==1); // and might have an incomplete type extern struct unknown_tag some_struct; extern char some_array[]; typedef int some_incomplete_type[]; extern some_incomplete_type some_other; } int i; int main() { i=1; f1(); }
the_stack_data/176705824.c
#include <stdlib.h> #include <stdio.h> #include <string.h> char* charset = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; typedef struct ll_node { void* payload; struct ll_node* next; } ll_node_t; typedef struct ll_head { ll_node_t* head; int size; } ll; ll* ll_construct() { ll* head = (ll*) malloc(sizeof(ll)); head->head = NULL; head->size = 0; return head; } int ll_destroy(ll* head) { ll_node_t* curr = head->head; ll_node_t* next = curr->next; while (curr != NULL) { ll_node_t* temp = curr; curr = curr->next; free(temp); } free(head); return 1; } int ll_deep_destroy(ll* head) { ll_node_t* curr = head->head; ll_node_t* next = curr->next; while (curr != NULL) { free(curr->payload); ll_node_t* temp = curr; curr = curr->next; free(temp); } free(head); return 1; } int ll_insert(ll* head, void* payload) { ll_node_t* curr = head->head; head->size++; // empty LL if (curr == NULL) { head->head = (ll_node_t*) malloc(sizeof(ll_node_t)); head->head->payload = payload; head->head->next = NULL; return 1; } while (curr->next != NULL) { curr = curr->next; } curr->next = (ll_node_t*) malloc(sizeof(ll_node_t)); curr->next->next = NULL; curr->next->payload = payload; return 1; } int ll_insert_posn(ll* head, void* payload, int posn) { if (posn > head->size - 1) return -1; ll_node_t* curr = head->head; int counter; for (counter = 0; counter < posn-1; counter++) { curr = curr->next; } // time to insert here ll_node_t* old_next = curr->next; curr->next = (ll_node_t*) malloc(sizeof(ll_node_t)); curr->next->payload = payload; curr->next->next = old_next; head->size++; return 1; } int ll_find(ll* head, void* payload) { ll_node_t* curr = head->head; int counter = 0; while (curr != NULL) { if (curr->payload == payload) return counter; curr = curr->next; counter++; } return -1; } void* ll_get(ll* head, int posn) { ll_node_t* curr = head->head; if (posn > head->size - 1) return NULL; int i; for (i = 0; i < posn; i++) { curr = curr->next; } return curr->payload; } int ll_delete(ll* head, int posn) { ll_node_t* curr = head->head; ll_node_t* prev = NULL; if (posn > head->size - 1) return -1; if (posn == 0) { ll_node_t* shunned = head->head; head->head = head->head->next; free(shunned); head->size--; return 1; } int i; for (i = 0; i < posn; i++) { prev = curr; curr = curr->next; } ll_node_t* link = curr->next; free(curr); prev->next = link; head->size--; return 1; } void* ll_peek(ll* head) { return head->head->payload; } void* ll_pop(ll* head) { void* payload = head->head->payload; ll_delete(head, 0); return payload; } int ll_reverse(ll* head) { ll_node_t* curr = head->head; ll_node_t* prev = NULL; ll_node_t* next = NULL; while(curr != NULL) { next = curr->next; curr->next = prev; prev = curr; curr = next; } head->head = prev; return 1; } int ll_print(ll* head) { ll_node_t* curr = head->head; while (curr != NULL) { printf("%d\n", *(int*) curr->payload); curr = curr->next; } return 1; } char* gimme_string(int len) { char* str = (char*) malloc(sizeof(char) * (len+1)); str[len] = '\0'; while (len-- > 0) { int index = rand() % strlen(charset); str[len] = charset[index]; } printf("%c\n", str); return str; } int main(int argc, int* argv) { // FULL TEST ll* ll1 = ll_construct(); // STANDARD INSERT int i; for (i = 0; i < 100; i++) { int* hey = (int*) malloc(sizeof(int)); hey[0] = i; ll_insert(ll1, hey); } // POSITIONAL INSERT int* hey = (int*) malloc(sizeof(int)); hey[0] = 420; ll_insert_posn(ll1, hey, 50); // FIND POSITION printf("Found: %d\n", ll_find(ll1, hey)); // GET printf("Get: %d\n", *(int*) ll_get(ll1, 50)); // DELETE ll_delete(ll1, 50); // GET AGAIN printf("Get again: %d\n", *(int*) ll_get(ll1, 50)); printf("\n\nReverse and print:\n\n", ll_reverse(ll1)); // PEEK / POP printf("Peek: %d\n", *(int*) ll_peek(ll1)); printf("Popped: %d\n", *(int*) ll_pop(ll1)); printf("Peek: %d\n", *(int*) ll_peek(ll1)); ll_print(ll1); ll_deep_destroy(ll1); printf("STRING TIME"); printf("%c\n", gimme_string(50)); ll* ll2 = ll_construct(); return 0; }
the_stack_data/218893908.c
#include <math.h> #include <stdlib.h> typedef struct complex_t { double re; double im; } complex; complex conv_from_polar(double r, double radians) { complex result; result.re = r * cos(radians); result.im = r * sin(radians); return result; } complex add(complex left, complex right) { complex result; result.re = left.re + right.re; result.im = left.im + right.im; return result; } complex multiply(complex left, complex right) { complex result; result.re = left.re*right.re - left.im*right.im; result.im = left.re*right.im + left.im*right.re; return result; } #define PI 3.1415926535897932384626434 complex* DFT_naive(complex* x, int N) { complex* X = (complex*) malloc(sizeof(struct complex_t) * N); int k, n; for(k = 0; k < N; k++) { X[k].re = 0.0; X[k].im = 0.0; for(n = 0; n < N; n++) { X[k] = add(X[k], multiply(x[n], conv_from_polar(1, -2*PI*n*k/N))); } } return X; }
the_stack_data/113767.c
/* some attributes 1. on i_th level, number of nodes <= 2^(i-1) 2. if bitree depth == k, number of nodes <= 2^k-1 3. for any bitree, if leaf node is n0, number of nodes whose degree is 2 is n2 then, n0 == n2 + 1 3.1 -> for any bitree, the number of nodes is n = n0 + n1 + n2 (n0 means degree of node is 0) 3.2 -> for any bitree, the number of lines is lines = n - 1 = n1 + 2n2, so n0 + n1 + n2 - 1 = n1 + 2n2 => n0 = n2 + 1 4. the depth of a complete binary tree with n nodes is floor(log(2, n))+1 to certify, using attributes of full binary tree 5. for a complete binary tree with n nodes 5.1 if i = 1, then i is root; if i > 1, then i's parent node is floor(i/2) 5.2 if 2i>n, then i has no lchild, else i's lchild is 2i 5.3 if 2i+1>n, then i has no rchild, else i's rchild is 2i+1 */ #include <stdio.h> #include <stdlib.h> typedef struct BiTNode{ int data; struct BiTNode *lchild, *rchild; }BiTNode, *BiTree; void PreOrderTraverse(BiTree T){ if (T == NULL){ return; } printf("%d ", T->data); PreOrderTraverse(T->lchild); PreOrderTraverse(T->rchild); } void InOrderTraverse(BiTree T){ if (T == NULL){ return; } InOrderTraverse(T->lchild); printf("%-3d", T->data); InOrderTraverse(T->rchild); } void PostOrderTraverse(BiTree T){ if (T == NULL){ return; } PostOrderTraverse(T->lchild); PostOrderTraverse(T->rchild); printf("%-3d", T->data); } BiTree createBiTree(BiTree T){ int e; BiTNode *node; printf("input a number, -1 to exit: "); scanf("%d", &e); if (e == -1){ T = NULL; } else { T = (BiTNode *)malloc(sizeof(BiTNode)); T->data = e; printf("create left tree: "); T->lchild = createBiTree(T->lchild); printf("create right tree: "); T->rchild = createBiTree(T->rchild); } return T; } void destroyBiTree(BiTree T){ if (T != NULL){ destroyBiTree(T->lchild); destroyBiTree(T->rchild); free(T); } } void main(){ BiTree t; t = createBiTree(t); printf("PreOrder: "); PreOrderTraverse(t); puts(""); printf("InOrder: "); InOrderTraverse(t); puts(""); printf("PostOrder: "); PostOrderTraverse(t); puts(""); destroyBiTree(t); }
the_stack_data/134021.c
#include<stdio.h> struct info { int s; int e; int t; }; struct info edge[5602]; int n, m, dist[600]; int bf() { int i, j, k, u, v, w; for (i = 2; i <= n; i++) dist[i] = 99999; for (i = 1; i < n; i++) { k = 1; for (j = 1; j <= m; j++) { u = edge[j].s; v = edge[j].e; w = edge[j].t; if (dist[u] + w < dist[v]) { dist[v] = dist[u] + w; k = 0; } } if (k) break; } for (i = 1; i <= m; i++) { u = edge[i].s; v = edge[i].e; w = edge[i].t; if (dist[u] + w < dist[v]) return (0); } return (1); } int main() { int i, j, F, w, ki, st, en, ti; scanf("%d", &F); for (i = 1; i <= F; i++) { ki = 0; scanf("%d%d%d", &n, &m, &w); for (j = 1; j <= m; j++) { scanf("%d%d%d", &st, &en, &ti); ki++; edge[ki].s = st; edge[ki].e = en; edge[ki].t = ti; ki++; edge[ki].s = en; edge[ki].e = st; edge[ki].t = ti; } for (j = 1; j <= w; j++) { ki++; scanf("%d%d%d", &st, &en, &ti); edge[ki].s = st; edge[ki].e = en; edge[ki].t = -ti; } m = ki; if (bf() == 0) printf("YES\n"); else printf("NO\n"); } return 0; }
the_stack_data/75138619.c
//------------------------------------------------------------------------- // // The MIT License (MIT) // // Copyright (c) 2015 Andrew Duncan // // 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 <fcntl.h> #include <inttypes.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/ioctl.h> //------------------------------------------------------------------------- int main(void) { int fd = open("/dev/vcio", 0); if (fd == -1) { perror("open /dev/vcio"); exit(EXIT_FAILURE); } uint32_t property[32] = { 0x00000000, 0x00000000, 0x00010004, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; property[0] = 10 * sizeof(property[0]); if (ioctl(fd, _IOWR(100, 0, char *), property) == -1) { perror("ioctl"); exit(EXIT_FAILURE); } close(fd); uint32_t serial = property[5]; printf("serial: %016"PRIx32"\n", serial); return 0; }
the_stack_data/807433.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_range.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: tulenius <[email protected]> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/11/01 11:21:23 by tulenius #+# #+# */ /* Updated: 2021/11/01 11:41:37 by tulenius ### ########.fr */ /* */ /* ************************************************************************** */ #include <stdlib.h> int *ft_range(int min, int max) { int array_size; int *ptr; int i; if (min >= max) return (NULL); i = 0; array_size = max - min; ptr = malloc(array_size * sizeof(int)); if (ptr == NULL) return (NULL); while (min < max) { ptr[i] = min; i++; min++; } return (ptr); }
the_stack_data/73894.c
//@ ltl invariant negative: (([] AP(x_30 - x_19 > 12)) || (<> AP(x_17 - x_27 >= -8))); 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; float x_20; float x_21; float x_22; float x_23; float x_24; float x_25; float x_26; float x_27; float x_28; float x_29; float x_30; float x_31; 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_; float x_20_; float x_21_; float x_22_; float x_23_; float x_24_; float x_25_; float x_26_; float x_27_; float x_28_; float x_29_; float x_30_; float x_31_; while(1) { x_0_ = (((((4.0 + x_0) > (6.0 + x_1)? (4.0 + x_0) : (6.0 + x_1)) > ((11.0 + x_2) > (10.0 + x_5)? (11.0 + x_2) : (10.0 + x_5))? ((4.0 + x_0) > (6.0 + x_1)? (4.0 + x_0) : (6.0 + x_1)) : ((11.0 + x_2) > (10.0 + x_5)? (11.0 + x_2) : (10.0 + x_5))) > (((7.0 + x_6) > (5.0 + x_10)? (7.0 + x_6) : (5.0 + x_10)) > ((7.0 + x_12) > (18.0 + x_13)? (7.0 + x_12) : (18.0 + x_13))? ((7.0 + x_6) > (5.0 + x_10)? (7.0 + x_6) : (5.0 + x_10)) : ((7.0 + x_12) > (18.0 + x_13)? (7.0 + x_12) : (18.0 + x_13)))? (((4.0 + x_0) > (6.0 + x_1)? (4.0 + x_0) : (6.0 + x_1)) > ((11.0 + x_2) > (10.0 + x_5)? (11.0 + x_2) : (10.0 + x_5))? ((4.0 + x_0) > (6.0 + x_1)? (4.0 + x_0) : (6.0 + x_1)) : ((11.0 + x_2) > (10.0 + x_5)? (11.0 + x_2) : (10.0 + x_5))) : (((7.0 + x_6) > (5.0 + x_10)? (7.0 + x_6) : (5.0 + x_10)) > ((7.0 + x_12) > (18.0 + x_13)? (7.0 + x_12) : (18.0 + x_13))? ((7.0 + x_6) > (5.0 + x_10)? (7.0 + x_6) : (5.0 + x_10)) : ((7.0 + x_12) > (18.0 + x_13)? (7.0 + x_12) : (18.0 + x_13)))) > ((((4.0 + x_14) > (4.0 + x_15)? (4.0 + x_14) : (4.0 + x_15)) > ((9.0 + x_16) > (20.0 + x_19)? (9.0 + x_16) : (20.0 + x_19))? ((4.0 + x_14) > (4.0 + x_15)? (4.0 + x_14) : (4.0 + x_15)) : ((9.0 + x_16) > (20.0 + x_19)? (9.0 + x_16) : (20.0 + x_19))) > (((13.0 + x_21) > (7.0 + x_23)? (13.0 + x_21) : (7.0 + x_23)) > ((11.0 + x_27) > (3.0 + x_31)? (11.0 + x_27) : (3.0 + x_31))? ((13.0 + x_21) > (7.0 + x_23)? (13.0 + x_21) : (7.0 + x_23)) : ((11.0 + x_27) > (3.0 + x_31)? (11.0 + x_27) : (3.0 + x_31)))? (((4.0 + x_14) > (4.0 + x_15)? (4.0 + x_14) : (4.0 + x_15)) > ((9.0 + x_16) > (20.0 + x_19)? (9.0 + x_16) : (20.0 + x_19))? ((4.0 + x_14) > (4.0 + x_15)? (4.0 + x_14) : (4.0 + x_15)) : ((9.0 + x_16) > (20.0 + x_19)? (9.0 + x_16) : (20.0 + x_19))) : (((13.0 + x_21) > (7.0 + x_23)? (13.0 + x_21) : (7.0 + x_23)) > ((11.0 + x_27) > (3.0 + x_31)? (11.0 + x_27) : (3.0 + x_31))? ((13.0 + x_21) > (7.0 + x_23)? (13.0 + x_21) : (7.0 + x_23)) : ((11.0 + x_27) > (3.0 + x_31)? (11.0 + x_27) : (3.0 + x_31))))? ((((4.0 + x_0) > (6.0 + x_1)? (4.0 + x_0) : (6.0 + x_1)) > ((11.0 + x_2) > (10.0 + x_5)? (11.0 + x_2) : (10.0 + x_5))? ((4.0 + x_0) > (6.0 + x_1)? (4.0 + x_0) : (6.0 + x_1)) : ((11.0 + x_2) > (10.0 + x_5)? (11.0 + x_2) : (10.0 + x_5))) > (((7.0 + x_6) > (5.0 + x_10)? (7.0 + x_6) : (5.0 + x_10)) > ((7.0 + x_12) > (18.0 + x_13)? (7.0 + x_12) : (18.0 + x_13))? ((7.0 + x_6) > (5.0 + x_10)? (7.0 + x_6) : (5.0 + x_10)) : ((7.0 + x_12) > (18.0 + x_13)? (7.0 + x_12) : (18.0 + x_13)))? (((4.0 + x_0) > (6.0 + x_1)? (4.0 + x_0) : (6.0 + x_1)) > ((11.0 + x_2) > (10.0 + x_5)? (11.0 + x_2) : (10.0 + x_5))? ((4.0 + x_0) > (6.0 + x_1)? (4.0 + x_0) : (6.0 + x_1)) : ((11.0 + x_2) > (10.0 + x_5)? (11.0 + x_2) : (10.0 + x_5))) : (((7.0 + x_6) > (5.0 + x_10)? (7.0 + x_6) : (5.0 + x_10)) > ((7.0 + x_12) > (18.0 + x_13)? (7.0 + x_12) : (18.0 + x_13))? ((7.0 + x_6) > (5.0 + x_10)? (7.0 + x_6) : (5.0 + x_10)) : ((7.0 + x_12) > (18.0 + x_13)? (7.0 + x_12) : (18.0 + x_13)))) : ((((4.0 + x_14) > (4.0 + x_15)? (4.0 + x_14) : (4.0 + x_15)) > ((9.0 + x_16) > (20.0 + x_19)? (9.0 + x_16) : (20.0 + x_19))? ((4.0 + x_14) > (4.0 + x_15)? (4.0 + x_14) : (4.0 + x_15)) : ((9.0 + x_16) > (20.0 + x_19)? (9.0 + x_16) : (20.0 + x_19))) > (((13.0 + x_21) > (7.0 + x_23)? (13.0 + x_21) : (7.0 + x_23)) > ((11.0 + x_27) > (3.0 + x_31)? (11.0 + x_27) : (3.0 + x_31))? ((13.0 + x_21) > (7.0 + x_23)? (13.0 + x_21) : (7.0 + x_23)) : ((11.0 + x_27) > (3.0 + x_31)? (11.0 + x_27) : (3.0 + x_31)))? (((4.0 + x_14) > (4.0 + x_15)? (4.0 + x_14) : (4.0 + x_15)) > ((9.0 + x_16) > (20.0 + x_19)? (9.0 + x_16) : (20.0 + x_19))? ((4.0 + x_14) > (4.0 + x_15)? (4.0 + x_14) : (4.0 + x_15)) : ((9.0 + x_16) > (20.0 + x_19)? (9.0 + x_16) : (20.0 + x_19))) : (((13.0 + x_21) > (7.0 + x_23)? (13.0 + x_21) : (7.0 + x_23)) > ((11.0 + x_27) > (3.0 + x_31)? (11.0 + x_27) : (3.0 + x_31))? ((13.0 + x_21) > (7.0 + x_23)? (13.0 + x_21) : (7.0 + x_23)) : ((11.0 + x_27) > (3.0 + x_31)? (11.0 + x_27) : (3.0 + x_31))))); x_1_ = (((((20.0 + x_2) > (10.0 + x_3)? (20.0 + x_2) : (10.0 + x_3)) > ((2.0 + x_4) > (10.0 + x_5)? (2.0 + x_4) : (10.0 + x_5))? ((20.0 + x_2) > (10.0 + x_3)? (20.0 + x_2) : (10.0 + x_3)) : ((2.0 + x_4) > (10.0 + x_5)? (2.0 + x_4) : (10.0 + x_5))) > (((15.0 + x_8) > (3.0 + x_9)? (15.0 + x_8) : (3.0 + x_9)) > ((16.0 + x_11) > (1.0 + x_15)? (16.0 + x_11) : (1.0 + x_15))? ((15.0 + x_8) > (3.0 + x_9)? (15.0 + x_8) : (3.0 + x_9)) : ((16.0 + x_11) > (1.0 + x_15)? (16.0 + x_11) : (1.0 + x_15)))? (((20.0 + x_2) > (10.0 + x_3)? (20.0 + x_2) : (10.0 + x_3)) > ((2.0 + x_4) > (10.0 + x_5)? (2.0 + x_4) : (10.0 + x_5))? ((20.0 + x_2) > (10.0 + x_3)? (20.0 + x_2) : (10.0 + x_3)) : ((2.0 + x_4) > (10.0 + x_5)? (2.0 + x_4) : (10.0 + x_5))) : (((15.0 + x_8) > (3.0 + x_9)? (15.0 + x_8) : (3.0 + x_9)) > ((16.0 + x_11) > (1.0 + x_15)? (16.0 + x_11) : (1.0 + x_15))? ((15.0 + x_8) > (3.0 + x_9)? (15.0 + x_8) : (3.0 + x_9)) : ((16.0 + x_11) > (1.0 + x_15)? (16.0 + x_11) : (1.0 + x_15)))) > ((((18.0 + x_17) > (18.0 + x_18)? (18.0 + x_17) : (18.0 + x_18)) > ((20.0 + x_20) > (6.0 + x_23)? (20.0 + x_20) : (6.0 + x_23))? ((18.0 + x_17) > (18.0 + x_18)? (18.0 + x_17) : (18.0 + x_18)) : ((20.0 + x_20) > (6.0 + x_23)? (20.0 + x_20) : (6.0 + x_23))) > (((12.0 + x_27) > (12.0 + x_28)? (12.0 + x_27) : (12.0 + x_28)) > ((12.0 + x_30) > (14.0 + x_31)? (12.0 + x_30) : (14.0 + x_31))? ((12.0 + x_27) > (12.0 + x_28)? (12.0 + x_27) : (12.0 + x_28)) : ((12.0 + x_30) > (14.0 + x_31)? (12.0 + x_30) : (14.0 + x_31)))? (((18.0 + x_17) > (18.0 + x_18)? (18.0 + x_17) : (18.0 + x_18)) > ((20.0 + x_20) > (6.0 + x_23)? (20.0 + x_20) : (6.0 + x_23))? ((18.0 + x_17) > (18.0 + x_18)? (18.0 + x_17) : (18.0 + x_18)) : ((20.0 + x_20) > (6.0 + x_23)? (20.0 + x_20) : (6.0 + x_23))) : (((12.0 + x_27) > (12.0 + x_28)? (12.0 + x_27) : (12.0 + x_28)) > ((12.0 + x_30) > (14.0 + x_31)? (12.0 + x_30) : (14.0 + x_31))? ((12.0 + x_27) > (12.0 + x_28)? (12.0 + x_27) : (12.0 + x_28)) : ((12.0 + x_30) > (14.0 + x_31)? (12.0 + x_30) : (14.0 + x_31))))? ((((20.0 + x_2) > (10.0 + x_3)? (20.0 + x_2) : (10.0 + x_3)) > ((2.0 + x_4) > (10.0 + x_5)? (2.0 + x_4) : (10.0 + x_5))? ((20.0 + x_2) > (10.0 + x_3)? (20.0 + x_2) : (10.0 + x_3)) : ((2.0 + x_4) > (10.0 + x_5)? (2.0 + x_4) : (10.0 + x_5))) > (((15.0 + x_8) > (3.0 + x_9)? (15.0 + x_8) : (3.0 + x_9)) > ((16.0 + x_11) > (1.0 + x_15)? (16.0 + x_11) : (1.0 + x_15))? ((15.0 + x_8) > (3.0 + x_9)? (15.0 + x_8) : (3.0 + x_9)) : ((16.0 + x_11) > (1.0 + x_15)? (16.0 + x_11) : (1.0 + x_15)))? (((20.0 + x_2) > (10.0 + x_3)? (20.0 + x_2) : (10.0 + x_3)) > ((2.0 + x_4) > (10.0 + x_5)? (2.0 + x_4) : (10.0 + x_5))? ((20.0 + x_2) > (10.0 + x_3)? (20.0 + x_2) : (10.0 + x_3)) : ((2.0 + x_4) > (10.0 + x_5)? (2.0 + x_4) : (10.0 + x_5))) : (((15.0 + x_8) > (3.0 + x_9)? (15.0 + x_8) : (3.0 + x_9)) > ((16.0 + x_11) > (1.0 + x_15)? (16.0 + x_11) : (1.0 + x_15))? ((15.0 + x_8) > (3.0 + x_9)? (15.0 + x_8) : (3.0 + x_9)) : ((16.0 + x_11) > (1.0 + x_15)? (16.0 + x_11) : (1.0 + x_15)))) : ((((18.0 + x_17) > (18.0 + x_18)? (18.0 + x_17) : (18.0 + x_18)) > ((20.0 + x_20) > (6.0 + x_23)? (20.0 + x_20) : (6.0 + x_23))? ((18.0 + x_17) > (18.0 + x_18)? (18.0 + x_17) : (18.0 + x_18)) : ((20.0 + x_20) > (6.0 + x_23)? (20.0 + x_20) : (6.0 + x_23))) > (((12.0 + x_27) > (12.0 + x_28)? (12.0 + x_27) : (12.0 + x_28)) > ((12.0 + x_30) > (14.0 + x_31)? (12.0 + x_30) : (14.0 + x_31))? ((12.0 + x_27) > (12.0 + x_28)? (12.0 + x_27) : (12.0 + x_28)) : ((12.0 + x_30) > (14.0 + x_31)? (12.0 + x_30) : (14.0 + x_31)))? (((18.0 + x_17) > (18.0 + x_18)? (18.0 + x_17) : (18.0 + x_18)) > ((20.0 + x_20) > (6.0 + x_23)? (20.0 + x_20) : (6.0 + x_23))? ((18.0 + x_17) > (18.0 + x_18)? (18.0 + x_17) : (18.0 + x_18)) : ((20.0 + x_20) > (6.0 + x_23)? (20.0 + x_20) : (6.0 + x_23))) : (((12.0 + x_27) > (12.0 + x_28)? (12.0 + x_27) : (12.0 + x_28)) > ((12.0 + x_30) > (14.0 + x_31)? (12.0 + x_30) : (14.0 + x_31))? ((12.0 + x_27) > (12.0 + x_28)? (12.0 + x_27) : (12.0 + x_28)) : ((12.0 + x_30) > (14.0 + x_31)? (12.0 + x_30) : (14.0 + x_31))))); x_2_ = (((((3.0 + x_2) > (2.0 + x_3)? (3.0 + x_2) : (2.0 + x_3)) > ((12.0 + x_4) > (9.0 + x_6)? (12.0 + x_4) : (9.0 + x_6))? ((3.0 + x_2) > (2.0 + x_3)? (3.0 + x_2) : (2.0 + x_3)) : ((12.0 + x_4) > (9.0 + x_6)? (12.0 + x_4) : (9.0 + x_6))) > (((8.0 + x_9) > (17.0 + x_11)? (8.0 + x_9) : (17.0 + x_11)) > ((4.0 + x_13) > (10.0 + x_15)? (4.0 + x_13) : (10.0 + x_15))? ((8.0 + x_9) > (17.0 + x_11)? (8.0 + x_9) : (17.0 + x_11)) : ((4.0 + x_13) > (10.0 + x_15)? (4.0 + x_13) : (10.0 + x_15)))? (((3.0 + x_2) > (2.0 + x_3)? (3.0 + x_2) : (2.0 + x_3)) > ((12.0 + x_4) > (9.0 + x_6)? (12.0 + x_4) : (9.0 + x_6))? ((3.0 + x_2) > (2.0 + x_3)? (3.0 + x_2) : (2.0 + x_3)) : ((12.0 + x_4) > (9.0 + x_6)? (12.0 + x_4) : (9.0 + x_6))) : (((8.0 + x_9) > (17.0 + x_11)? (8.0 + x_9) : (17.0 + x_11)) > ((4.0 + x_13) > (10.0 + x_15)? (4.0 + x_13) : (10.0 + x_15))? ((8.0 + x_9) > (17.0 + x_11)? (8.0 + x_9) : (17.0 + x_11)) : ((4.0 + x_13) > (10.0 + x_15)? (4.0 + x_13) : (10.0 + x_15)))) > ((((20.0 + x_17) > (12.0 + x_18)? (20.0 + x_17) : (12.0 + x_18)) > ((14.0 + x_21) > (12.0 + x_24)? (14.0 + x_21) : (12.0 + x_24))? ((20.0 + x_17) > (12.0 + x_18)? (20.0 + x_17) : (12.0 + x_18)) : ((14.0 + x_21) > (12.0 + x_24)? (14.0 + x_21) : (12.0 + x_24))) > (((1.0 + x_25) > (9.0 + x_28)? (1.0 + x_25) : (9.0 + x_28)) > ((2.0 + x_29) > (14.0 + x_31)? (2.0 + x_29) : (14.0 + x_31))? ((1.0 + x_25) > (9.0 + x_28)? (1.0 + x_25) : (9.0 + x_28)) : ((2.0 + x_29) > (14.0 + x_31)? (2.0 + x_29) : (14.0 + x_31)))? (((20.0 + x_17) > (12.0 + x_18)? (20.0 + x_17) : (12.0 + x_18)) > ((14.0 + x_21) > (12.0 + x_24)? (14.0 + x_21) : (12.0 + x_24))? ((20.0 + x_17) > (12.0 + x_18)? (20.0 + x_17) : (12.0 + x_18)) : ((14.0 + x_21) > (12.0 + x_24)? (14.0 + x_21) : (12.0 + x_24))) : (((1.0 + x_25) > (9.0 + x_28)? (1.0 + x_25) : (9.0 + x_28)) > ((2.0 + x_29) > (14.0 + x_31)? (2.0 + x_29) : (14.0 + x_31))? ((1.0 + x_25) > (9.0 + x_28)? (1.0 + x_25) : (9.0 + x_28)) : ((2.0 + x_29) > (14.0 + x_31)? (2.0 + x_29) : (14.0 + x_31))))? ((((3.0 + x_2) > (2.0 + x_3)? (3.0 + x_2) : (2.0 + x_3)) > ((12.0 + x_4) > (9.0 + x_6)? (12.0 + x_4) : (9.0 + x_6))? ((3.0 + x_2) > (2.0 + x_3)? (3.0 + x_2) : (2.0 + x_3)) : ((12.0 + x_4) > (9.0 + x_6)? (12.0 + x_4) : (9.0 + x_6))) > (((8.0 + x_9) > (17.0 + x_11)? (8.0 + x_9) : (17.0 + x_11)) > ((4.0 + x_13) > (10.0 + x_15)? (4.0 + x_13) : (10.0 + x_15))? ((8.0 + x_9) > (17.0 + x_11)? (8.0 + x_9) : (17.0 + x_11)) : ((4.0 + x_13) > (10.0 + x_15)? (4.0 + x_13) : (10.0 + x_15)))? (((3.0 + x_2) > (2.0 + x_3)? (3.0 + x_2) : (2.0 + x_3)) > ((12.0 + x_4) > (9.0 + x_6)? (12.0 + x_4) : (9.0 + x_6))? ((3.0 + x_2) > (2.0 + x_3)? (3.0 + x_2) : (2.0 + x_3)) : ((12.0 + x_4) > (9.0 + x_6)? (12.0 + x_4) : (9.0 + x_6))) : (((8.0 + x_9) > (17.0 + x_11)? (8.0 + x_9) : (17.0 + x_11)) > ((4.0 + x_13) > (10.0 + x_15)? (4.0 + x_13) : (10.0 + x_15))? ((8.0 + x_9) > (17.0 + x_11)? (8.0 + x_9) : (17.0 + x_11)) : ((4.0 + x_13) > (10.0 + x_15)? (4.0 + x_13) : (10.0 + x_15)))) : ((((20.0 + x_17) > (12.0 + x_18)? (20.0 + x_17) : (12.0 + x_18)) > ((14.0 + x_21) > (12.0 + x_24)? (14.0 + x_21) : (12.0 + x_24))? ((20.0 + x_17) > (12.0 + x_18)? (20.0 + x_17) : (12.0 + x_18)) : ((14.0 + x_21) > (12.0 + x_24)? (14.0 + x_21) : (12.0 + x_24))) > (((1.0 + x_25) > (9.0 + x_28)? (1.0 + x_25) : (9.0 + x_28)) > ((2.0 + x_29) > (14.0 + x_31)? (2.0 + x_29) : (14.0 + x_31))? ((1.0 + x_25) > (9.0 + x_28)? (1.0 + x_25) : (9.0 + x_28)) : ((2.0 + x_29) > (14.0 + x_31)? (2.0 + x_29) : (14.0 + x_31)))? (((20.0 + x_17) > (12.0 + x_18)? (20.0 + x_17) : (12.0 + x_18)) > ((14.0 + x_21) > (12.0 + x_24)? (14.0 + x_21) : (12.0 + x_24))? ((20.0 + x_17) > (12.0 + x_18)? (20.0 + x_17) : (12.0 + x_18)) : ((14.0 + x_21) > (12.0 + x_24)? (14.0 + x_21) : (12.0 + x_24))) : (((1.0 + x_25) > (9.0 + x_28)? (1.0 + x_25) : (9.0 + x_28)) > ((2.0 + x_29) > (14.0 + x_31)? (2.0 + x_29) : (14.0 + x_31))? ((1.0 + x_25) > (9.0 + x_28)? (1.0 + x_25) : (9.0 + x_28)) : ((2.0 + x_29) > (14.0 + x_31)? (2.0 + x_29) : (14.0 + x_31))))); x_3_ = (((((5.0 + x_1) > (3.0 + x_2)? (5.0 + x_1) : (3.0 + x_2)) > ((9.0 + x_3) > (20.0 + x_5)? (9.0 + x_3) : (20.0 + x_5))? ((5.0 + x_1) > (3.0 + x_2)? (5.0 + x_1) : (3.0 + x_2)) : ((9.0 + x_3) > (20.0 + x_5)? (9.0 + x_3) : (20.0 + x_5))) > (((11.0 + x_7) > (7.0 + x_8)? (11.0 + x_7) : (7.0 + x_8)) > ((3.0 + x_9) > (3.0 + x_12)? (3.0 + x_9) : (3.0 + x_12))? ((11.0 + x_7) > (7.0 + x_8)? (11.0 + x_7) : (7.0 + x_8)) : ((3.0 + x_9) > (3.0 + x_12)? (3.0 + x_9) : (3.0 + x_12)))? (((5.0 + x_1) > (3.0 + x_2)? (5.0 + x_1) : (3.0 + x_2)) > ((9.0 + x_3) > (20.0 + x_5)? (9.0 + x_3) : (20.0 + x_5))? ((5.0 + x_1) > (3.0 + x_2)? (5.0 + x_1) : (3.0 + x_2)) : ((9.0 + x_3) > (20.0 + x_5)? (9.0 + x_3) : (20.0 + x_5))) : (((11.0 + x_7) > (7.0 + x_8)? (11.0 + x_7) : (7.0 + x_8)) > ((3.0 + x_9) > (3.0 + x_12)? (3.0 + x_9) : (3.0 + x_12))? ((11.0 + x_7) > (7.0 + x_8)? (11.0 + x_7) : (7.0 + x_8)) : ((3.0 + x_9) > (3.0 + x_12)? (3.0 + x_9) : (3.0 + x_12)))) > ((((13.0 + x_13) > (5.0 + x_14)? (13.0 + x_13) : (5.0 + x_14)) > ((2.0 + x_15) > (14.0 + x_19)? (2.0 + x_15) : (14.0 + x_19))? ((13.0 + x_13) > (5.0 + x_14)? (13.0 + x_13) : (5.0 + x_14)) : ((2.0 + x_15) > (14.0 + x_19)? (2.0 + x_15) : (14.0 + x_19))) > (((16.0 + x_21) > (2.0 + x_25)? (16.0 + x_21) : (2.0 + x_25)) > ((3.0 + x_27) > (19.0 + x_28)? (3.0 + x_27) : (19.0 + x_28))? ((16.0 + x_21) > (2.0 + x_25)? (16.0 + x_21) : (2.0 + x_25)) : ((3.0 + x_27) > (19.0 + x_28)? (3.0 + x_27) : (19.0 + x_28)))? (((13.0 + x_13) > (5.0 + x_14)? (13.0 + x_13) : (5.0 + x_14)) > ((2.0 + x_15) > (14.0 + x_19)? (2.0 + x_15) : (14.0 + x_19))? ((13.0 + x_13) > (5.0 + x_14)? (13.0 + x_13) : (5.0 + x_14)) : ((2.0 + x_15) > (14.0 + x_19)? (2.0 + x_15) : (14.0 + x_19))) : (((16.0 + x_21) > (2.0 + x_25)? (16.0 + x_21) : (2.0 + x_25)) > ((3.0 + x_27) > (19.0 + x_28)? (3.0 + x_27) : (19.0 + x_28))? ((16.0 + x_21) > (2.0 + x_25)? (16.0 + x_21) : (2.0 + x_25)) : ((3.0 + x_27) > (19.0 + x_28)? (3.0 + x_27) : (19.0 + x_28))))? ((((5.0 + x_1) > (3.0 + x_2)? (5.0 + x_1) : (3.0 + x_2)) > ((9.0 + x_3) > (20.0 + x_5)? (9.0 + x_3) : (20.0 + x_5))? ((5.0 + x_1) > (3.0 + x_2)? (5.0 + x_1) : (3.0 + x_2)) : ((9.0 + x_3) > (20.0 + x_5)? (9.0 + x_3) : (20.0 + x_5))) > (((11.0 + x_7) > (7.0 + x_8)? (11.0 + x_7) : (7.0 + x_8)) > ((3.0 + x_9) > (3.0 + x_12)? (3.0 + x_9) : (3.0 + x_12))? ((11.0 + x_7) > (7.0 + x_8)? (11.0 + x_7) : (7.0 + x_8)) : ((3.0 + x_9) > (3.0 + x_12)? (3.0 + x_9) : (3.0 + x_12)))? (((5.0 + x_1) > (3.0 + x_2)? (5.0 + x_1) : (3.0 + x_2)) > ((9.0 + x_3) > (20.0 + x_5)? (9.0 + x_3) : (20.0 + x_5))? ((5.0 + x_1) > (3.0 + x_2)? (5.0 + x_1) : (3.0 + x_2)) : ((9.0 + x_3) > (20.0 + x_5)? (9.0 + x_3) : (20.0 + x_5))) : (((11.0 + x_7) > (7.0 + x_8)? (11.0 + x_7) : (7.0 + x_8)) > ((3.0 + x_9) > (3.0 + x_12)? (3.0 + x_9) : (3.0 + x_12))? ((11.0 + x_7) > (7.0 + x_8)? (11.0 + x_7) : (7.0 + x_8)) : ((3.0 + x_9) > (3.0 + x_12)? (3.0 + x_9) : (3.0 + x_12)))) : ((((13.0 + x_13) > (5.0 + x_14)? (13.0 + x_13) : (5.0 + x_14)) > ((2.0 + x_15) > (14.0 + x_19)? (2.0 + x_15) : (14.0 + x_19))? ((13.0 + x_13) > (5.0 + x_14)? (13.0 + x_13) : (5.0 + x_14)) : ((2.0 + x_15) > (14.0 + x_19)? (2.0 + x_15) : (14.0 + x_19))) > (((16.0 + x_21) > (2.0 + x_25)? (16.0 + x_21) : (2.0 + x_25)) > ((3.0 + x_27) > (19.0 + x_28)? (3.0 + x_27) : (19.0 + x_28))? ((16.0 + x_21) > (2.0 + x_25)? (16.0 + x_21) : (2.0 + x_25)) : ((3.0 + x_27) > (19.0 + x_28)? (3.0 + x_27) : (19.0 + x_28)))? (((13.0 + x_13) > (5.0 + x_14)? (13.0 + x_13) : (5.0 + x_14)) > ((2.0 + x_15) > (14.0 + x_19)? (2.0 + x_15) : (14.0 + x_19))? ((13.0 + x_13) > (5.0 + x_14)? (13.0 + x_13) : (5.0 + x_14)) : ((2.0 + x_15) > (14.0 + x_19)? (2.0 + x_15) : (14.0 + x_19))) : (((16.0 + x_21) > (2.0 + x_25)? (16.0 + x_21) : (2.0 + x_25)) > ((3.0 + x_27) > (19.0 + x_28)? (3.0 + x_27) : (19.0 + x_28))? ((16.0 + x_21) > (2.0 + x_25)? (16.0 + x_21) : (2.0 + x_25)) : ((3.0 + x_27) > (19.0 + x_28)? (3.0 + x_27) : (19.0 + x_28))))); x_4_ = (((((11.0 + x_0) > (9.0 + x_1)? (11.0 + x_0) : (9.0 + x_1)) > ((16.0 + x_2) > (15.0 + x_4)? (16.0 + x_2) : (15.0 + x_4))? ((11.0 + x_0) > (9.0 + x_1)? (11.0 + x_0) : (9.0 + x_1)) : ((16.0 + x_2) > (15.0 + x_4)? (16.0 + x_2) : (15.0 + x_4))) > (((2.0 + x_6) > (2.0 + x_8)? (2.0 + x_6) : (2.0 + x_8)) > ((5.0 + x_9) > (14.0 + x_16)? (5.0 + x_9) : (14.0 + x_16))? ((2.0 + x_6) > (2.0 + x_8)? (2.0 + x_6) : (2.0 + x_8)) : ((5.0 + x_9) > (14.0 + x_16)? (5.0 + x_9) : (14.0 + x_16)))? (((11.0 + x_0) > (9.0 + x_1)? (11.0 + x_0) : (9.0 + x_1)) > ((16.0 + x_2) > (15.0 + x_4)? (16.0 + x_2) : (15.0 + x_4))? ((11.0 + x_0) > (9.0 + x_1)? (11.0 + x_0) : (9.0 + x_1)) : ((16.0 + x_2) > (15.0 + x_4)? (16.0 + x_2) : (15.0 + x_4))) : (((2.0 + x_6) > (2.0 + x_8)? (2.0 + x_6) : (2.0 + x_8)) > ((5.0 + x_9) > (14.0 + x_16)? (5.0 + x_9) : (14.0 + x_16))? ((2.0 + x_6) > (2.0 + x_8)? (2.0 + x_6) : (2.0 + x_8)) : ((5.0 + x_9) > (14.0 + x_16)? (5.0 + x_9) : (14.0 + x_16)))) > ((((19.0 + x_17) > (17.0 + x_18)? (19.0 + x_17) : (17.0 + x_18)) > ((8.0 + x_21) > (6.0 + x_23)? (8.0 + x_21) : (6.0 + x_23))? ((19.0 + x_17) > (17.0 + x_18)? (19.0 + x_17) : (17.0 + x_18)) : ((8.0 + x_21) > (6.0 + x_23)? (8.0 + x_21) : (6.0 + x_23))) > (((3.0 + x_24) > (12.0 + x_25)? (3.0 + x_24) : (12.0 + x_25)) > ((16.0 + x_27) > (12.0 + x_30)? (16.0 + x_27) : (12.0 + x_30))? ((3.0 + x_24) > (12.0 + x_25)? (3.0 + x_24) : (12.0 + x_25)) : ((16.0 + x_27) > (12.0 + x_30)? (16.0 + x_27) : (12.0 + x_30)))? (((19.0 + x_17) > (17.0 + x_18)? (19.0 + x_17) : (17.0 + x_18)) > ((8.0 + x_21) > (6.0 + x_23)? (8.0 + x_21) : (6.0 + x_23))? ((19.0 + x_17) > (17.0 + x_18)? (19.0 + x_17) : (17.0 + x_18)) : ((8.0 + x_21) > (6.0 + x_23)? (8.0 + x_21) : (6.0 + x_23))) : (((3.0 + x_24) > (12.0 + x_25)? (3.0 + x_24) : (12.0 + x_25)) > ((16.0 + x_27) > (12.0 + x_30)? (16.0 + x_27) : (12.0 + x_30))? ((3.0 + x_24) > (12.0 + x_25)? (3.0 + x_24) : (12.0 + x_25)) : ((16.0 + x_27) > (12.0 + x_30)? (16.0 + x_27) : (12.0 + x_30))))? ((((11.0 + x_0) > (9.0 + x_1)? (11.0 + x_0) : (9.0 + x_1)) > ((16.0 + x_2) > (15.0 + x_4)? (16.0 + x_2) : (15.0 + x_4))? ((11.0 + x_0) > (9.0 + x_1)? (11.0 + x_0) : (9.0 + x_1)) : ((16.0 + x_2) > (15.0 + x_4)? (16.0 + x_2) : (15.0 + x_4))) > (((2.0 + x_6) > (2.0 + x_8)? (2.0 + x_6) : (2.0 + x_8)) > ((5.0 + x_9) > (14.0 + x_16)? (5.0 + x_9) : (14.0 + x_16))? ((2.0 + x_6) > (2.0 + x_8)? (2.0 + x_6) : (2.0 + x_8)) : ((5.0 + x_9) > (14.0 + x_16)? (5.0 + x_9) : (14.0 + x_16)))? (((11.0 + x_0) > (9.0 + x_1)? (11.0 + x_0) : (9.0 + x_1)) > ((16.0 + x_2) > (15.0 + x_4)? (16.0 + x_2) : (15.0 + x_4))? ((11.0 + x_0) > (9.0 + x_1)? (11.0 + x_0) : (9.0 + x_1)) : ((16.0 + x_2) > (15.0 + x_4)? (16.0 + x_2) : (15.0 + x_4))) : (((2.0 + x_6) > (2.0 + x_8)? (2.0 + x_6) : (2.0 + x_8)) > ((5.0 + x_9) > (14.0 + x_16)? (5.0 + x_9) : (14.0 + x_16))? ((2.0 + x_6) > (2.0 + x_8)? (2.0 + x_6) : (2.0 + x_8)) : ((5.0 + x_9) > (14.0 + x_16)? (5.0 + x_9) : (14.0 + x_16)))) : ((((19.0 + x_17) > (17.0 + x_18)? (19.0 + x_17) : (17.0 + x_18)) > ((8.0 + x_21) > (6.0 + x_23)? (8.0 + x_21) : (6.0 + x_23))? ((19.0 + x_17) > (17.0 + x_18)? (19.0 + x_17) : (17.0 + x_18)) : ((8.0 + x_21) > (6.0 + x_23)? (8.0 + x_21) : (6.0 + x_23))) > (((3.0 + x_24) > (12.0 + x_25)? (3.0 + x_24) : (12.0 + x_25)) > ((16.0 + x_27) > (12.0 + x_30)? (16.0 + x_27) : (12.0 + x_30))? ((3.0 + x_24) > (12.0 + x_25)? (3.0 + x_24) : (12.0 + x_25)) : ((16.0 + x_27) > (12.0 + x_30)? (16.0 + x_27) : (12.0 + x_30)))? (((19.0 + x_17) > (17.0 + x_18)? (19.0 + x_17) : (17.0 + x_18)) > ((8.0 + x_21) > (6.0 + x_23)? (8.0 + x_21) : (6.0 + x_23))? ((19.0 + x_17) > (17.0 + x_18)? (19.0 + x_17) : (17.0 + x_18)) : ((8.0 + x_21) > (6.0 + x_23)? (8.0 + x_21) : (6.0 + x_23))) : (((3.0 + x_24) > (12.0 + x_25)? (3.0 + x_24) : (12.0 + x_25)) > ((16.0 + x_27) > (12.0 + x_30)? (16.0 + x_27) : (12.0 + x_30))? ((3.0 + x_24) > (12.0 + x_25)? (3.0 + x_24) : (12.0 + x_25)) : ((16.0 + x_27) > (12.0 + x_30)? (16.0 + x_27) : (12.0 + x_30))))); x_5_ = (((((8.0 + x_0) > (9.0 + x_3)? (8.0 + x_0) : (9.0 + x_3)) > ((2.0 + x_7) > (10.0 + x_9)? (2.0 + x_7) : (10.0 + x_9))? ((8.0 + x_0) > (9.0 + x_3)? (8.0 + x_0) : (9.0 + x_3)) : ((2.0 + x_7) > (10.0 + x_9)? (2.0 + x_7) : (10.0 + x_9))) > (((16.0 + x_10) > (18.0 + x_11)? (16.0 + x_10) : (18.0 + x_11)) > ((14.0 + x_12) > (6.0 + x_14)? (14.0 + x_12) : (6.0 + x_14))? ((16.0 + x_10) > (18.0 + x_11)? (16.0 + x_10) : (18.0 + x_11)) : ((14.0 + x_12) > (6.0 + x_14)? (14.0 + x_12) : (6.0 + x_14)))? (((8.0 + x_0) > (9.0 + x_3)? (8.0 + x_0) : (9.0 + x_3)) > ((2.0 + x_7) > (10.0 + x_9)? (2.0 + x_7) : (10.0 + x_9))? ((8.0 + x_0) > (9.0 + x_3)? (8.0 + x_0) : (9.0 + x_3)) : ((2.0 + x_7) > (10.0 + x_9)? (2.0 + x_7) : (10.0 + x_9))) : (((16.0 + x_10) > (18.0 + x_11)? (16.0 + x_10) : (18.0 + x_11)) > ((14.0 + x_12) > (6.0 + x_14)? (14.0 + x_12) : (6.0 + x_14))? ((16.0 + x_10) > (18.0 + x_11)? (16.0 + x_10) : (18.0 + x_11)) : ((14.0 + x_12) > (6.0 + x_14)? (14.0 + x_12) : (6.0 + x_14)))) > ((((13.0 + x_15) > (6.0 + x_16)? (13.0 + x_15) : (6.0 + x_16)) > ((10.0 + x_17) > (11.0 + x_20)? (10.0 + x_17) : (11.0 + x_20))? ((13.0 + x_15) > (6.0 + x_16)? (13.0 + x_15) : (6.0 + x_16)) : ((10.0 + x_17) > (11.0 + x_20)? (10.0 + x_17) : (11.0 + x_20))) > (((10.0 + x_21) > (11.0 + x_24)? (10.0 + x_21) : (11.0 + x_24)) > ((2.0 + x_30) > (19.0 + x_31)? (2.0 + x_30) : (19.0 + x_31))? ((10.0 + x_21) > (11.0 + x_24)? (10.0 + x_21) : (11.0 + x_24)) : ((2.0 + x_30) > (19.0 + x_31)? (2.0 + x_30) : (19.0 + x_31)))? (((13.0 + x_15) > (6.0 + x_16)? (13.0 + x_15) : (6.0 + x_16)) > ((10.0 + x_17) > (11.0 + x_20)? (10.0 + x_17) : (11.0 + x_20))? ((13.0 + x_15) > (6.0 + x_16)? (13.0 + x_15) : (6.0 + x_16)) : ((10.0 + x_17) > (11.0 + x_20)? (10.0 + x_17) : (11.0 + x_20))) : (((10.0 + x_21) > (11.0 + x_24)? (10.0 + x_21) : (11.0 + x_24)) > ((2.0 + x_30) > (19.0 + x_31)? (2.0 + x_30) : (19.0 + x_31))? ((10.0 + x_21) > (11.0 + x_24)? (10.0 + x_21) : (11.0 + x_24)) : ((2.0 + x_30) > (19.0 + x_31)? (2.0 + x_30) : (19.0 + x_31))))? ((((8.0 + x_0) > (9.0 + x_3)? (8.0 + x_0) : (9.0 + x_3)) > ((2.0 + x_7) > (10.0 + x_9)? (2.0 + x_7) : (10.0 + x_9))? ((8.0 + x_0) > (9.0 + x_3)? (8.0 + x_0) : (9.0 + x_3)) : ((2.0 + x_7) > (10.0 + x_9)? (2.0 + x_7) : (10.0 + x_9))) > (((16.0 + x_10) > (18.0 + x_11)? (16.0 + x_10) : (18.0 + x_11)) > ((14.0 + x_12) > (6.0 + x_14)? (14.0 + x_12) : (6.0 + x_14))? ((16.0 + x_10) > (18.0 + x_11)? (16.0 + x_10) : (18.0 + x_11)) : ((14.0 + x_12) > (6.0 + x_14)? (14.0 + x_12) : (6.0 + x_14)))? (((8.0 + x_0) > (9.0 + x_3)? (8.0 + x_0) : (9.0 + x_3)) > ((2.0 + x_7) > (10.0 + x_9)? (2.0 + x_7) : (10.0 + x_9))? ((8.0 + x_0) > (9.0 + x_3)? (8.0 + x_0) : (9.0 + x_3)) : ((2.0 + x_7) > (10.0 + x_9)? (2.0 + x_7) : (10.0 + x_9))) : (((16.0 + x_10) > (18.0 + x_11)? (16.0 + x_10) : (18.0 + x_11)) > ((14.0 + x_12) > (6.0 + x_14)? (14.0 + x_12) : (6.0 + x_14))? ((16.0 + x_10) > (18.0 + x_11)? (16.0 + x_10) : (18.0 + x_11)) : ((14.0 + x_12) > (6.0 + x_14)? (14.0 + x_12) : (6.0 + x_14)))) : ((((13.0 + x_15) > (6.0 + x_16)? (13.0 + x_15) : (6.0 + x_16)) > ((10.0 + x_17) > (11.0 + x_20)? (10.0 + x_17) : (11.0 + x_20))? ((13.0 + x_15) > (6.0 + x_16)? (13.0 + x_15) : (6.0 + x_16)) : ((10.0 + x_17) > (11.0 + x_20)? (10.0 + x_17) : (11.0 + x_20))) > (((10.0 + x_21) > (11.0 + x_24)? (10.0 + x_21) : (11.0 + x_24)) > ((2.0 + x_30) > (19.0 + x_31)? (2.0 + x_30) : (19.0 + x_31))? ((10.0 + x_21) > (11.0 + x_24)? (10.0 + x_21) : (11.0 + x_24)) : ((2.0 + x_30) > (19.0 + x_31)? (2.0 + x_30) : (19.0 + x_31)))? (((13.0 + x_15) > (6.0 + x_16)? (13.0 + x_15) : (6.0 + x_16)) > ((10.0 + x_17) > (11.0 + x_20)? (10.0 + x_17) : (11.0 + x_20))? ((13.0 + x_15) > (6.0 + x_16)? (13.0 + x_15) : (6.0 + x_16)) : ((10.0 + x_17) > (11.0 + x_20)? (10.0 + x_17) : (11.0 + x_20))) : (((10.0 + x_21) > (11.0 + x_24)? (10.0 + x_21) : (11.0 + x_24)) > ((2.0 + x_30) > (19.0 + x_31)? (2.0 + x_30) : (19.0 + x_31))? ((10.0 + x_21) > (11.0 + x_24)? (10.0 + x_21) : (11.0 + x_24)) : ((2.0 + x_30) > (19.0 + x_31)? (2.0 + x_30) : (19.0 + x_31))))); x_6_ = (((((20.0 + x_0) > (20.0 + x_1)? (20.0 + x_0) : (20.0 + x_1)) > ((14.0 + x_2) > (14.0 + x_3)? (14.0 + x_2) : (14.0 + x_3))? ((20.0 + x_0) > (20.0 + x_1)? (20.0 + x_0) : (20.0 + x_1)) : ((14.0 + x_2) > (14.0 + x_3)? (14.0 + x_2) : (14.0 + x_3))) > (((14.0 + x_4) > (10.0 + x_5)? (14.0 + x_4) : (10.0 + x_5)) > ((5.0 + x_7) > (11.0 + x_11)? (5.0 + x_7) : (11.0 + x_11))? ((14.0 + x_4) > (10.0 + x_5)? (14.0 + x_4) : (10.0 + x_5)) : ((5.0 + x_7) > (11.0 + x_11)? (5.0 + x_7) : (11.0 + x_11)))? (((20.0 + x_0) > (20.0 + x_1)? (20.0 + x_0) : (20.0 + x_1)) > ((14.0 + x_2) > (14.0 + x_3)? (14.0 + x_2) : (14.0 + x_3))? ((20.0 + x_0) > (20.0 + x_1)? (20.0 + x_0) : (20.0 + x_1)) : ((14.0 + x_2) > (14.0 + x_3)? (14.0 + x_2) : (14.0 + x_3))) : (((14.0 + x_4) > (10.0 + x_5)? (14.0 + x_4) : (10.0 + x_5)) > ((5.0 + x_7) > (11.0 + x_11)? (5.0 + x_7) : (11.0 + x_11))? ((14.0 + x_4) > (10.0 + x_5)? (14.0 + x_4) : (10.0 + x_5)) : ((5.0 + x_7) > (11.0 + x_11)? (5.0 + x_7) : (11.0 + x_11)))) > ((((17.0 + x_13) > (4.0 + x_20)? (17.0 + x_13) : (4.0 + x_20)) > ((10.0 + x_21) > (1.0 + x_22)? (10.0 + x_21) : (1.0 + x_22))? ((17.0 + x_13) > (4.0 + x_20)? (17.0 + x_13) : (4.0 + x_20)) : ((10.0 + x_21) > (1.0 + x_22)? (10.0 + x_21) : (1.0 + x_22))) > (((20.0 + x_26) > (14.0 + x_27)? (20.0 + x_26) : (14.0 + x_27)) > ((2.0 + x_28) > (8.0 + x_31)? (2.0 + x_28) : (8.0 + x_31))? ((20.0 + x_26) > (14.0 + x_27)? (20.0 + x_26) : (14.0 + x_27)) : ((2.0 + x_28) > (8.0 + x_31)? (2.0 + x_28) : (8.0 + x_31)))? (((17.0 + x_13) > (4.0 + x_20)? (17.0 + x_13) : (4.0 + x_20)) > ((10.0 + x_21) > (1.0 + x_22)? (10.0 + x_21) : (1.0 + x_22))? ((17.0 + x_13) > (4.0 + x_20)? (17.0 + x_13) : (4.0 + x_20)) : ((10.0 + x_21) > (1.0 + x_22)? (10.0 + x_21) : (1.0 + x_22))) : (((20.0 + x_26) > (14.0 + x_27)? (20.0 + x_26) : (14.0 + x_27)) > ((2.0 + x_28) > (8.0 + x_31)? (2.0 + x_28) : (8.0 + x_31))? ((20.0 + x_26) > (14.0 + x_27)? (20.0 + x_26) : (14.0 + x_27)) : ((2.0 + x_28) > (8.0 + x_31)? (2.0 + x_28) : (8.0 + x_31))))? ((((20.0 + x_0) > (20.0 + x_1)? (20.0 + x_0) : (20.0 + x_1)) > ((14.0 + x_2) > (14.0 + x_3)? (14.0 + x_2) : (14.0 + x_3))? ((20.0 + x_0) > (20.0 + x_1)? (20.0 + x_0) : (20.0 + x_1)) : ((14.0 + x_2) > (14.0 + x_3)? (14.0 + x_2) : (14.0 + x_3))) > (((14.0 + x_4) > (10.0 + x_5)? (14.0 + x_4) : (10.0 + x_5)) > ((5.0 + x_7) > (11.0 + x_11)? (5.0 + x_7) : (11.0 + x_11))? ((14.0 + x_4) > (10.0 + x_5)? (14.0 + x_4) : (10.0 + x_5)) : ((5.0 + x_7) > (11.0 + x_11)? (5.0 + x_7) : (11.0 + x_11)))? (((20.0 + x_0) > (20.0 + x_1)? (20.0 + x_0) : (20.0 + x_1)) > ((14.0 + x_2) > (14.0 + x_3)? (14.0 + x_2) : (14.0 + x_3))? ((20.0 + x_0) > (20.0 + x_1)? (20.0 + x_0) : (20.0 + x_1)) : ((14.0 + x_2) > (14.0 + x_3)? (14.0 + x_2) : (14.0 + x_3))) : (((14.0 + x_4) > (10.0 + x_5)? (14.0 + x_4) : (10.0 + x_5)) > ((5.0 + x_7) > (11.0 + x_11)? (5.0 + x_7) : (11.0 + x_11))? ((14.0 + x_4) > (10.0 + x_5)? (14.0 + x_4) : (10.0 + x_5)) : ((5.0 + x_7) > (11.0 + x_11)? (5.0 + x_7) : (11.0 + x_11)))) : ((((17.0 + x_13) > (4.0 + x_20)? (17.0 + x_13) : (4.0 + x_20)) > ((10.0 + x_21) > (1.0 + x_22)? (10.0 + x_21) : (1.0 + x_22))? ((17.0 + x_13) > (4.0 + x_20)? (17.0 + x_13) : (4.0 + x_20)) : ((10.0 + x_21) > (1.0 + x_22)? (10.0 + x_21) : (1.0 + x_22))) > (((20.0 + x_26) > (14.0 + x_27)? (20.0 + x_26) : (14.0 + x_27)) > ((2.0 + x_28) > (8.0 + x_31)? (2.0 + x_28) : (8.0 + x_31))? ((20.0 + x_26) > (14.0 + x_27)? (20.0 + x_26) : (14.0 + x_27)) : ((2.0 + x_28) > (8.0 + x_31)? (2.0 + x_28) : (8.0 + x_31)))? (((17.0 + x_13) > (4.0 + x_20)? (17.0 + x_13) : (4.0 + x_20)) > ((10.0 + x_21) > (1.0 + x_22)? (10.0 + x_21) : (1.0 + x_22))? ((17.0 + x_13) > (4.0 + x_20)? (17.0 + x_13) : (4.0 + x_20)) : ((10.0 + x_21) > (1.0 + x_22)? (10.0 + x_21) : (1.0 + x_22))) : (((20.0 + x_26) > (14.0 + x_27)? (20.0 + x_26) : (14.0 + x_27)) > ((2.0 + x_28) > (8.0 + x_31)? (2.0 + x_28) : (8.0 + x_31))? ((20.0 + x_26) > (14.0 + x_27)? (20.0 + x_26) : (14.0 + x_27)) : ((2.0 + x_28) > (8.0 + x_31)? (2.0 + x_28) : (8.0 + x_31))))); x_7_ = (((((16.0 + x_3) > (2.0 + x_6)? (16.0 + x_3) : (2.0 + x_6)) > ((10.0 + x_7) > (12.0 + x_9)? (10.0 + x_7) : (12.0 + x_9))? ((16.0 + x_3) > (2.0 + x_6)? (16.0 + x_3) : (2.0 + x_6)) : ((10.0 + x_7) > (12.0 + x_9)? (10.0 + x_7) : (12.0 + x_9))) > (((7.0 + x_10) > (15.0 + x_14)? (7.0 + x_10) : (15.0 + x_14)) > ((6.0 + x_15) > (12.0 + x_16)? (6.0 + x_15) : (12.0 + x_16))? ((7.0 + x_10) > (15.0 + x_14)? (7.0 + x_10) : (15.0 + x_14)) : ((6.0 + x_15) > (12.0 + x_16)? (6.0 + x_15) : (12.0 + x_16)))? (((16.0 + x_3) > (2.0 + x_6)? (16.0 + x_3) : (2.0 + x_6)) > ((10.0 + x_7) > (12.0 + x_9)? (10.0 + x_7) : (12.0 + x_9))? ((16.0 + x_3) > (2.0 + x_6)? (16.0 + x_3) : (2.0 + x_6)) : ((10.0 + x_7) > (12.0 + x_9)? (10.0 + x_7) : (12.0 + x_9))) : (((7.0 + x_10) > (15.0 + x_14)? (7.0 + x_10) : (15.0 + x_14)) > ((6.0 + x_15) > (12.0 + x_16)? (6.0 + x_15) : (12.0 + x_16))? ((7.0 + x_10) > (15.0 + x_14)? (7.0 + x_10) : (15.0 + x_14)) : ((6.0 + x_15) > (12.0 + x_16)? (6.0 + x_15) : (12.0 + x_16)))) > ((((14.0 + x_19) > (16.0 + x_21)? (14.0 + x_19) : (16.0 + x_21)) > ((1.0 + x_23) > (19.0 + x_24)? (1.0 + x_23) : (19.0 + x_24))? ((14.0 + x_19) > (16.0 + x_21)? (14.0 + x_19) : (16.0 + x_21)) : ((1.0 + x_23) > (19.0 + x_24)? (1.0 + x_23) : (19.0 + x_24))) > (((9.0 + x_25) > (17.0 + x_27)? (9.0 + x_25) : (17.0 + x_27)) > ((20.0 + x_28) > (4.0 + x_29)? (20.0 + x_28) : (4.0 + x_29))? ((9.0 + x_25) > (17.0 + x_27)? (9.0 + x_25) : (17.0 + x_27)) : ((20.0 + x_28) > (4.0 + x_29)? (20.0 + x_28) : (4.0 + x_29)))? (((14.0 + x_19) > (16.0 + x_21)? (14.0 + x_19) : (16.0 + x_21)) > ((1.0 + x_23) > (19.0 + x_24)? (1.0 + x_23) : (19.0 + x_24))? ((14.0 + x_19) > (16.0 + x_21)? (14.0 + x_19) : (16.0 + x_21)) : ((1.0 + x_23) > (19.0 + x_24)? (1.0 + x_23) : (19.0 + x_24))) : (((9.0 + x_25) > (17.0 + x_27)? (9.0 + x_25) : (17.0 + x_27)) > ((20.0 + x_28) > (4.0 + x_29)? (20.0 + x_28) : (4.0 + x_29))? ((9.0 + x_25) > (17.0 + x_27)? (9.0 + x_25) : (17.0 + x_27)) : ((20.0 + x_28) > (4.0 + x_29)? (20.0 + x_28) : (4.0 + x_29))))? ((((16.0 + x_3) > (2.0 + x_6)? (16.0 + x_3) : (2.0 + x_6)) > ((10.0 + x_7) > (12.0 + x_9)? (10.0 + x_7) : (12.0 + x_9))? ((16.0 + x_3) > (2.0 + x_6)? (16.0 + x_3) : (2.0 + x_6)) : ((10.0 + x_7) > (12.0 + x_9)? (10.0 + x_7) : (12.0 + x_9))) > (((7.0 + x_10) > (15.0 + x_14)? (7.0 + x_10) : (15.0 + x_14)) > ((6.0 + x_15) > (12.0 + x_16)? (6.0 + x_15) : (12.0 + x_16))? ((7.0 + x_10) > (15.0 + x_14)? (7.0 + x_10) : (15.0 + x_14)) : ((6.0 + x_15) > (12.0 + x_16)? (6.0 + x_15) : (12.0 + x_16)))? (((16.0 + x_3) > (2.0 + x_6)? (16.0 + x_3) : (2.0 + x_6)) > ((10.0 + x_7) > (12.0 + x_9)? (10.0 + x_7) : (12.0 + x_9))? ((16.0 + x_3) > (2.0 + x_6)? (16.0 + x_3) : (2.0 + x_6)) : ((10.0 + x_7) > (12.0 + x_9)? (10.0 + x_7) : (12.0 + x_9))) : (((7.0 + x_10) > (15.0 + x_14)? (7.0 + x_10) : (15.0 + x_14)) > ((6.0 + x_15) > (12.0 + x_16)? (6.0 + x_15) : (12.0 + x_16))? ((7.0 + x_10) > (15.0 + x_14)? (7.0 + x_10) : (15.0 + x_14)) : ((6.0 + x_15) > (12.0 + x_16)? (6.0 + x_15) : (12.0 + x_16)))) : ((((14.0 + x_19) > (16.0 + x_21)? (14.0 + x_19) : (16.0 + x_21)) > ((1.0 + x_23) > (19.0 + x_24)? (1.0 + x_23) : (19.0 + x_24))? ((14.0 + x_19) > (16.0 + x_21)? (14.0 + x_19) : (16.0 + x_21)) : ((1.0 + x_23) > (19.0 + x_24)? (1.0 + x_23) : (19.0 + x_24))) > (((9.0 + x_25) > (17.0 + x_27)? (9.0 + x_25) : (17.0 + x_27)) > ((20.0 + x_28) > (4.0 + x_29)? (20.0 + x_28) : (4.0 + x_29))? ((9.0 + x_25) > (17.0 + x_27)? (9.0 + x_25) : (17.0 + x_27)) : ((20.0 + x_28) > (4.0 + x_29)? (20.0 + x_28) : (4.0 + x_29)))? (((14.0 + x_19) > (16.0 + x_21)? (14.0 + x_19) : (16.0 + x_21)) > ((1.0 + x_23) > (19.0 + x_24)? (1.0 + x_23) : (19.0 + x_24))? ((14.0 + x_19) > (16.0 + x_21)? (14.0 + x_19) : (16.0 + x_21)) : ((1.0 + x_23) > (19.0 + x_24)? (1.0 + x_23) : (19.0 + x_24))) : (((9.0 + x_25) > (17.0 + x_27)? (9.0 + x_25) : (17.0 + x_27)) > ((20.0 + x_28) > (4.0 + x_29)? (20.0 + x_28) : (4.0 + x_29))? ((9.0 + x_25) > (17.0 + x_27)? (9.0 + x_25) : (17.0 + x_27)) : ((20.0 + x_28) > (4.0 + x_29)? (20.0 + x_28) : (4.0 + x_29))))); x_8_ = (((((20.0 + x_0) > (9.0 + x_2)? (20.0 + x_0) : (9.0 + x_2)) > ((14.0 + x_4) > (2.0 + x_7)? (14.0 + x_4) : (2.0 + x_7))? ((20.0 + x_0) > (9.0 + x_2)? (20.0 + x_0) : (9.0 + x_2)) : ((14.0 + x_4) > (2.0 + x_7)? (14.0 + x_4) : (2.0 + x_7))) > (((19.0 + x_8) > (5.0 + x_10)? (19.0 + x_8) : (5.0 + x_10)) > ((3.0 + x_11) > (14.0 + x_14)? (3.0 + x_11) : (14.0 + x_14))? ((19.0 + x_8) > (5.0 + x_10)? (19.0 + x_8) : (5.0 + x_10)) : ((3.0 + x_11) > (14.0 + x_14)? (3.0 + x_11) : (14.0 + x_14)))? (((20.0 + x_0) > (9.0 + x_2)? (20.0 + x_0) : (9.0 + x_2)) > ((14.0 + x_4) > (2.0 + x_7)? (14.0 + x_4) : (2.0 + x_7))? ((20.0 + x_0) > (9.0 + x_2)? (20.0 + x_0) : (9.0 + x_2)) : ((14.0 + x_4) > (2.0 + x_7)? (14.0 + x_4) : (2.0 + x_7))) : (((19.0 + x_8) > (5.0 + x_10)? (19.0 + x_8) : (5.0 + x_10)) > ((3.0 + x_11) > (14.0 + x_14)? (3.0 + x_11) : (14.0 + x_14))? ((19.0 + x_8) > (5.0 + x_10)? (19.0 + x_8) : (5.0 + x_10)) : ((3.0 + x_11) > (14.0 + x_14)? (3.0 + x_11) : (14.0 + x_14)))) > ((((20.0 + x_15) > (9.0 + x_17)? (20.0 + x_15) : (9.0 + x_17)) > ((10.0 + x_20) > (5.0 + x_23)? (10.0 + x_20) : (5.0 + x_23))? ((20.0 + x_15) > (9.0 + x_17)? (20.0 + x_15) : (9.0 + x_17)) : ((10.0 + x_20) > (5.0 + x_23)? (10.0 + x_20) : (5.0 + x_23))) > (((13.0 + x_28) > (8.0 + x_29)? (13.0 + x_28) : (8.0 + x_29)) > ((17.0 + x_30) > (7.0 + x_31)? (17.0 + x_30) : (7.0 + x_31))? ((13.0 + x_28) > (8.0 + x_29)? (13.0 + x_28) : (8.0 + x_29)) : ((17.0 + x_30) > (7.0 + x_31)? (17.0 + x_30) : (7.0 + x_31)))? (((20.0 + x_15) > (9.0 + x_17)? (20.0 + x_15) : (9.0 + x_17)) > ((10.0 + x_20) > (5.0 + x_23)? (10.0 + x_20) : (5.0 + x_23))? ((20.0 + x_15) > (9.0 + x_17)? (20.0 + x_15) : (9.0 + x_17)) : ((10.0 + x_20) > (5.0 + x_23)? (10.0 + x_20) : (5.0 + x_23))) : (((13.0 + x_28) > (8.0 + x_29)? (13.0 + x_28) : (8.0 + x_29)) > ((17.0 + x_30) > (7.0 + x_31)? (17.0 + x_30) : (7.0 + x_31))? ((13.0 + x_28) > (8.0 + x_29)? (13.0 + x_28) : (8.0 + x_29)) : ((17.0 + x_30) > (7.0 + x_31)? (17.0 + x_30) : (7.0 + x_31))))? ((((20.0 + x_0) > (9.0 + x_2)? (20.0 + x_0) : (9.0 + x_2)) > ((14.0 + x_4) > (2.0 + x_7)? (14.0 + x_4) : (2.0 + x_7))? ((20.0 + x_0) > (9.0 + x_2)? (20.0 + x_0) : (9.0 + x_2)) : ((14.0 + x_4) > (2.0 + x_7)? (14.0 + x_4) : (2.0 + x_7))) > (((19.0 + x_8) > (5.0 + x_10)? (19.0 + x_8) : (5.0 + x_10)) > ((3.0 + x_11) > (14.0 + x_14)? (3.0 + x_11) : (14.0 + x_14))? ((19.0 + x_8) > (5.0 + x_10)? (19.0 + x_8) : (5.0 + x_10)) : ((3.0 + x_11) > (14.0 + x_14)? (3.0 + x_11) : (14.0 + x_14)))? (((20.0 + x_0) > (9.0 + x_2)? (20.0 + x_0) : (9.0 + x_2)) > ((14.0 + x_4) > (2.0 + x_7)? (14.0 + x_4) : (2.0 + x_7))? ((20.0 + x_0) > (9.0 + x_2)? (20.0 + x_0) : (9.0 + x_2)) : ((14.0 + x_4) > (2.0 + x_7)? (14.0 + x_4) : (2.0 + x_7))) : (((19.0 + x_8) > (5.0 + x_10)? (19.0 + x_8) : (5.0 + x_10)) > ((3.0 + x_11) > (14.0 + x_14)? (3.0 + x_11) : (14.0 + x_14))? ((19.0 + x_8) > (5.0 + x_10)? (19.0 + x_8) : (5.0 + x_10)) : ((3.0 + x_11) > (14.0 + x_14)? (3.0 + x_11) : (14.0 + x_14)))) : ((((20.0 + x_15) > (9.0 + x_17)? (20.0 + x_15) : (9.0 + x_17)) > ((10.0 + x_20) > (5.0 + x_23)? (10.0 + x_20) : (5.0 + x_23))? ((20.0 + x_15) > (9.0 + x_17)? (20.0 + x_15) : (9.0 + x_17)) : ((10.0 + x_20) > (5.0 + x_23)? (10.0 + x_20) : (5.0 + x_23))) > (((13.0 + x_28) > (8.0 + x_29)? (13.0 + x_28) : (8.0 + x_29)) > ((17.0 + x_30) > (7.0 + x_31)? (17.0 + x_30) : (7.0 + x_31))? ((13.0 + x_28) > (8.0 + x_29)? (13.0 + x_28) : (8.0 + x_29)) : ((17.0 + x_30) > (7.0 + x_31)? (17.0 + x_30) : (7.0 + x_31)))? (((20.0 + x_15) > (9.0 + x_17)? (20.0 + x_15) : (9.0 + x_17)) > ((10.0 + x_20) > (5.0 + x_23)? (10.0 + x_20) : (5.0 + x_23))? ((20.0 + x_15) > (9.0 + x_17)? (20.0 + x_15) : (9.0 + x_17)) : ((10.0 + x_20) > (5.0 + x_23)? (10.0 + x_20) : (5.0 + x_23))) : (((13.0 + x_28) > (8.0 + x_29)? (13.0 + x_28) : (8.0 + x_29)) > ((17.0 + x_30) > (7.0 + x_31)? (17.0 + x_30) : (7.0 + x_31))? ((13.0 + x_28) > (8.0 + x_29)? (13.0 + x_28) : (8.0 + x_29)) : ((17.0 + x_30) > (7.0 + x_31)? (17.0 + x_30) : (7.0 + x_31))))); x_9_ = (((((1.0 + x_0) > (20.0 + x_1)? (1.0 + x_0) : (20.0 + x_1)) > ((2.0 + x_3) > (12.0 + x_8)? (2.0 + x_3) : (12.0 + x_8))? ((1.0 + x_0) > (20.0 + x_1)? (1.0 + x_0) : (20.0 + x_1)) : ((2.0 + x_3) > (12.0 + x_8)? (2.0 + x_3) : (12.0 + x_8))) > (((19.0 + x_10) > (18.0 + x_12)? (19.0 + x_10) : (18.0 + x_12)) > ((3.0 + x_14) > (5.0 + x_18)? (3.0 + x_14) : (5.0 + x_18))? ((19.0 + x_10) > (18.0 + x_12)? (19.0 + x_10) : (18.0 + x_12)) : ((3.0 + x_14) > (5.0 + x_18)? (3.0 + x_14) : (5.0 + x_18)))? (((1.0 + x_0) > (20.0 + x_1)? (1.0 + x_0) : (20.0 + x_1)) > ((2.0 + x_3) > (12.0 + x_8)? (2.0 + x_3) : (12.0 + x_8))? ((1.0 + x_0) > (20.0 + x_1)? (1.0 + x_0) : (20.0 + x_1)) : ((2.0 + x_3) > (12.0 + x_8)? (2.0 + x_3) : (12.0 + x_8))) : (((19.0 + x_10) > (18.0 + x_12)? (19.0 + x_10) : (18.0 + x_12)) > ((3.0 + x_14) > (5.0 + x_18)? (3.0 + x_14) : (5.0 + x_18))? ((19.0 + x_10) > (18.0 + x_12)? (19.0 + x_10) : (18.0 + x_12)) : ((3.0 + x_14) > (5.0 + x_18)? (3.0 + x_14) : (5.0 + x_18)))) > ((((18.0 + x_19) > (11.0 + x_20)? (18.0 + x_19) : (11.0 + x_20)) > ((10.0 + x_22) > (9.0 + x_23)? (10.0 + x_22) : (9.0 + x_23))? ((18.0 + x_19) > (11.0 + x_20)? (18.0 + x_19) : (11.0 + x_20)) : ((10.0 + x_22) > (9.0 + x_23)? (10.0 + x_22) : (9.0 + x_23))) > (((13.0 + x_25) > (14.0 + x_27)? (13.0 + x_25) : (14.0 + x_27)) > ((1.0 + x_30) > (4.0 + x_31)? (1.0 + x_30) : (4.0 + x_31))? ((13.0 + x_25) > (14.0 + x_27)? (13.0 + x_25) : (14.0 + x_27)) : ((1.0 + x_30) > (4.0 + x_31)? (1.0 + x_30) : (4.0 + x_31)))? (((18.0 + x_19) > (11.0 + x_20)? (18.0 + x_19) : (11.0 + x_20)) > ((10.0 + x_22) > (9.0 + x_23)? (10.0 + x_22) : (9.0 + x_23))? ((18.0 + x_19) > (11.0 + x_20)? (18.0 + x_19) : (11.0 + x_20)) : ((10.0 + x_22) > (9.0 + x_23)? (10.0 + x_22) : (9.0 + x_23))) : (((13.0 + x_25) > (14.0 + x_27)? (13.0 + x_25) : (14.0 + x_27)) > ((1.0 + x_30) > (4.0 + x_31)? (1.0 + x_30) : (4.0 + x_31))? ((13.0 + x_25) > (14.0 + x_27)? (13.0 + x_25) : (14.0 + x_27)) : ((1.0 + x_30) > (4.0 + x_31)? (1.0 + x_30) : (4.0 + x_31))))? ((((1.0 + x_0) > (20.0 + x_1)? (1.0 + x_0) : (20.0 + x_1)) > ((2.0 + x_3) > (12.0 + x_8)? (2.0 + x_3) : (12.0 + x_8))? ((1.0 + x_0) > (20.0 + x_1)? (1.0 + x_0) : (20.0 + x_1)) : ((2.0 + x_3) > (12.0 + x_8)? (2.0 + x_3) : (12.0 + x_8))) > (((19.0 + x_10) > (18.0 + x_12)? (19.0 + x_10) : (18.0 + x_12)) > ((3.0 + x_14) > (5.0 + x_18)? (3.0 + x_14) : (5.0 + x_18))? ((19.0 + x_10) > (18.0 + x_12)? (19.0 + x_10) : (18.0 + x_12)) : ((3.0 + x_14) > (5.0 + x_18)? (3.0 + x_14) : (5.0 + x_18)))? (((1.0 + x_0) > (20.0 + x_1)? (1.0 + x_0) : (20.0 + x_1)) > ((2.0 + x_3) > (12.0 + x_8)? (2.0 + x_3) : (12.0 + x_8))? ((1.0 + x_0) > (20.0 + x_1)? (1.0 + x_0) : (20.0 + x_1)) : ((2.0 + x_3) > (12.0 + x_8)? (2.0 + x_3) : (12.0 + x_8))) : (((19.0 + x_10) > (18.0 + x_12)? (19.0 + x_10) : (18.0 + x_12)) > ((3.0 + x_14) > (5.0 + x_18)? (3.0 + x_14) : (5.0 + x_18))? ((19.0 + x_10) > (18.0 + x_12)? (19.0 + x_10) : (18.0 + x_12)) : ((3.0 + x_14) > (5.0 + x_18)? (3.0 + x_14) : (5.0 + x_18)))) : ((((18.0 + x_19) > (11.0 + x_20)? (18.0 + x_19) : (11.0 + x_20)) > ((10.0 + x_22) > (9.0 + x_23)? (10.0 + x_22) : (9.0 + x_23))? ((18.0 + x_19) > (11.0 + x_20)? (18.0 + x_19) : (11.0 + x_20)) : ((10.0 + x_22) > (9.0 + x_23)? (10.0 + x_22) : (9.0 + x_23))) > (((13.0 + x_25) > (14.0 + x_27)? (13.0 + x_25) : (14.0 + x_27)) > ((1.0 + x_30) > (4.0 + x_31)? (1.0 + x_30) : (4.0 + x_31))? ((13.0 + x_25) > (14.0 + x_27)? (13.0 + x_25) : (14.0 + x_27)) : ((1.0 + x_30) > (4.0 + x_31)? (1.0 + x_30) : (4.0 + x_31)))? (((18.0 + x_19) > (11.0 + x_20)? (18.0 + x_19) : (11.0 + x_20)) > ((10.0 + x_22) > (9.0 + x_23)? (10.0 + x_22) : (9.0 + x_23))? ((18.0 + x_19) > (11.0 + x_20)? (18.0 + x_19) : (11.0 + x_20)) : ((10.0 + x_22) > (9.0 + x_23)? (10.0 + x_22) : (9.0 + x_23))) : (((13.0 + x_25) > (14.0 + x_27)? (13.0 + x_25) : (14.0 + x_27)) > ((1.0 + x_30) > (4.0 + x_31)? (1.0 + x_30) : (4.0 + x_31))? ((13.0 + x_25) > (14.0 + x_27)? (13.0 + x_25) : (14.0 + x_27)) : ((1.0 + x_30) > (4.0 + x_31)? (1.0 + x_30) : (4.0 + x_31))))); x_10_ = (((((20.0 + x_6) > (5.0 + x_7)? (20.0 + x_6) : (5.0 + x_7)) > ((11.0 + x_9) > (1.0 + x_10)? (11.0 + x_9) : (1.0 + x_10))? ((20.0 + x_6) > (5.0 + x_7)? (20.0 + x_6) : (5.0 + x_7)) : ((11.0 + x_9) > (1.0 + x_10)? (11.0 + x_9) : (1.0 + x_10))) > (((9.0 + x_11) > (9.0 + x_15)? (9.0 + x_11) : (9.0 + x_15)) > ((13.0 + x_16) > (1.0 + x_19)? (13.0 + x_16) : (1.0 + x_19))? ((9.0 + x_11) > (9.0 + x_15)? (9.0 + x_11) : (9.0 + x_15)) : ((13.0 + x_16) > (1.0 + x_19)? (13.0 + x_16) : (1.0 + x_19)))? (((20.0 + x_6) > (5.0 + x_7)? (20.0 + x_6) : (5.0 + x_7)) > ((11.0 + x_9) > (1.0 + x_10)? (11.0 + x_9) : (1.0 + x_10))? ((20.0 + x_6) > (5.0 + x_7)? (20.0 + x_6) : (5.0 + x_7)) : ((11.0 + x_9) > (1.0 + x_10)? (11.0 + x_9) : (1.0 + x_10))) : (((9.0 + x_11) > (9.0 + x_15)? (9.0 + x_11) : (9.0 + x_15)) > ((13.0 + x_16) > (1.0 + x_19)? (13.0 + x_16) : (1.0 + x_19))? ((9.0 + x_11) > (9.0 + x_15)? (9.0 + x_11) : (9.0 + x_15)) : ((13.0 + x_16) > (1.0 + x_19)? (13.0 + x_16) : (1.0 + x_19)))) > ((((11.0 + x_20) > (13.0 + x_22)? (11.0 + x_20) : (13.0 + x_22)) > ((8.0 + x_23) > (6.0 + x_25)? (8.0 + x_23) : (6.0 + x_25))? ((11.0 + x_20) > (13.0 + x_22)? (11.0 + x_20) : (13.0 + x_22)) : ((8.0 + x_23) > (6.0 + x_25)? (8.0 + x_23) : (6.0 + x_25))) > (((2.0 + x_26) > (15.0 + x_27)? (2.0 + x_26) : (15.0 + x_27)) > ((19.0 + x_30) > (20.0 + x_31)? (19.0 + x_30) : (20.0 + x_31))? ((2.0 + x_26) > (15.0 + x_27)? (2.0 + x_26) : (15.0 + x_27)) : ((19.0 + x_30) > (20.0 + x_31)? (19.0 + x_30) : (20.0 + x_31)))? (((11.0 + x_20) > (13.0 + x_22)? (11.0 + x_20) : (13.0 + x_22)) > ((8.0 + x_23) > (6.0 + x_25)? (8.0 + x_23) : (6.0 + x_25))? ((11.0 + x_20) > (13.0 + x_22)? (11.0 + x_20) : (13.0 + x_22)) : ((8.0 + x_23) > (6.0 + x_25)? (8.0 + x_23) : (6.0 + x_25))) : (((2.0 + x_26) > (15.0 + x_27)? (2.0 + x_26) : (15.0 + x_27)) > ((19.0 + x_30) > (20.0 + x_31)? (19.0 + x_30) : (20.0 + x_31))? ((2.0 + x_26) > (15.0 + x_27)? (2.0 + x_26) : (15.0 + x_27)) : ((19.0 + x_30) > (20.0 + x_31)? (19.0 + x_30) : (20.0 + x_31))))? ((((20.0 + x_6) > (5.0 + x_7)? (20.0 + x_6) : (5.0 + x_7)) > ((11.0 + x_9) > (1.0 + x_10)? (11.0 + x_9) : (1.0 + x_10))? ((20.0 + x_6) > (5.0 + x_7)? (20.0 + x_6) : (5.0 + x_7)) : ((11.0 + x_9) > (1.0 + x_10)? (11.0 + x_9) : (1.0 + x_10))) > (((9.0 + x_11) > (9.0 + x_15)? (9.0 + x_11) : (9.0 + x_15)) > ((13.0 + x_16) > (1.0 + x_19)? (13.0 + x_16) : (1.0 + x_19))? ((9.0 + x_11) > (9.0 + x_15)? (9.0 + x_11) : (9.0 + x_15)) : ((13.0 + x_16) > (1.0 + x_19)? (13.0 + x_16) : (1.0 + x_19)))? (((20.0 + x_6) > (5.0 + x_7)? (20.0 + x_6) : (5.0 + x_7)) > ((11.0 + x_9) > (1.0 + x_10)? (11.0 + x_9) : (1.0 + x_10))? ((20.0 + x_6) > (5.0 + x_7)? (20.0 + x_6) : (5.0 + x_7)) : ((11.0 + x_9) > (1.0 + x_10)? (11.0 + x_9) : (1.0 + x_10))) : (((9.0 + x_11) > (9.0 + x_15)? (9.0 + x_11) : (9.0 + x_15)) > ((13.0 + x_16) > (1.0 + x_19)? (13.0 + x_16) : (1.0 + x_19))? ((9.0 + x_11) > (9.0 + x_15)? (9.0 + x_11) : (9.0 + x_15)) : ((13.0 + x_16) > (1.0 + x_19)? (13.0 + x_16) : (1.0 + x_19)))) : ((((11.0 + x_20) > (13.0 + x_22)? (11.0 + x_20) : (13.0 + x_22)) > ((8.0 + x_23) > (6.0 + x_25)? (8.0 + x_23) : (6.0 + x_25))? ((11.0 + x_20) > (13.0 + x_22)? (11.0 + x_20) : (13.0 + x_22)) : ((8.0 + x_23) > (6.0 + x_25)? (8.0 + x_23) : (6.0 + x_25))) > (((2.0 + x_26) > (15.0 + x_27)? (2.0 + x_26) : (15.0 + x_27)) > ((19.0 + x_30) > (20.0 + x_31)? (19.0 + x_30) : (20.0 + x_31))? ((2.0 + x_26) > (15.0 + x_27)? (2.0 + x_26) : (15.0 + x_27)) : ((19.0 + x_30) > (20.0 + x_31)? (19.0 + x_30) : (20.0 + x_31)))? (((11.0 + x_20) > (13.0 + x_22)? (11.0 + x_20) : (13.0 + x_22)) > ((8.0 + x_23) > (6.0 + x_25)? (8.0 + x_23) : (6.0 + x_25))? ((11.0 + x_20) > (13.0 + x_22)? (11.0 + x_20) : (13.0 + x_22)) : ((8.0 + x_23) > (6.0 + x_25)? (8.0 + x_23) : (6.0 + x_25))) : (((2.0 + x_26) > (15.0 + x_27)? (2.0 + x_26) : (15.0 + x_27)) > ((19.0 + x_30) > (20.0 + x_31)? (19.0 + x_30) : (20.0 + x_31))? ((2.0 + x_26) > (15.0 + x_27)? (2.0 + x_26) : (15.0 + x_27)) : ((19.0 + x_30) > (20.0 + x_31)? (19.0 + x_30) : (20.0 + x_31))))); x_11_ = (((((6.0 + x_6) > (19.0 + x_8)? (6.0 + x_6) : (19.0 + x_8)) > ((8.0 + x_12) > (11.0 + x_13)? (8.0 + x_12) : (11.0 + x_13))? ((6.0 + x_6) > (19.0 + x_8)? (6.0 + x_6) : (19.0 + x_8)) : ((8.0 + x_12) > (11.0 + x_13)? (8.0 + x_12) : (11.0 + x_13))) > (((7.0 + x_14) > (2.0 + x_15)? (7.0 + x_14) : (2.0 + x_15)) > ((8.0 + x_16) > (7.0 + x_19)? (8.0 + x_16) : (7.0 + x_19))? ((7.0 + x_14) > (2.0 + x_15)? (7.0 + x_14) : (2.0 + x_15)) : ((8.0 + x_16) > (7.0 + x_19)? (8.0 + x_16) : (7.0 + x_19)))? (((6.0 + x_6) > (19.0 + x_8)? (6.0 + x_6) : (19.0 + x_8)) > ((8.0 + x_12) > (11.0 + x_13)? (8.0 + x_12) : (11.0 + x_13))? ((6.0 + x_6) > (19.0 + x_8)? (6.0 + x_6) : (19.0 + x_8)) : ((8.0 + x_12) > (11.0 + x_13)? (8.0 + x_12) : (11.0 + x_13))) : (((7.0 + x_14) > (2.0 + x_15)? (7.0 + x_14) : (2.0 + x_15)) > ((8.0 + x_16) > (7.0 + x_19)? (8.0 + x_16) : (7.0 + x_19))? ((7.0 + x_14) > (2.0 + x_15)? (7.0 + x_14) : (2.0 + x_15)) : ((8.0 + x_16) > (7.0 + x_19)? (8.0 + x_16) : (7.0 + x_19)))) > ((((15.0 + x_20) > (5.0 + x_22)? (15.0 + x_20) : (5.0 + x_22)) > ((10.0 + x_23) > (13.0 + x_24)? (10.0 + x_23) : (13.0 + x_24))? ((15.0 + x_20) > (5.0 + x_22)? (15.0 + x_20) : (5.0 + x_22)) : ((10.0 + x_23) > (13.0 + x_24)? (10.0 + x_23) : (13.0 + x_24))) > (((13.0 + x_25) > (15.0 + x_26)? (13.0 + x_25) : (15.0 + x_26)) > ((20.0 + x_29) > (5.0 + x_31)? (20.0 + x_29) : (5.0 + x_31))? ((13.0 + x_25) > (15.0 + x_26)? (13.0 + x_25) : (15.0 + x_26)) : ((20.0 + x_29) > (5.0 + x_31)? (20.0 + x_29) : (5.0 + x_31)))? (((15.0 + x_20) > (5.0 + x_22)? (15.0 + x_20) : (5.0 + x_22)) > ((10.0 + x_23) > (13.0 + x_24)? (10.0 + x_23) : (13.0 + x_24))? ((15.0 + x_20) > (5.0 + x_22)? (15.0 + x_20) : (5.0 + x_22)) : ((10.0 + x_23) > (13.0 + x_24)? (10.0 + x_23) : (13.0 + x_24))) : (((13.0 + x_25) > (15.0 + x_26)? (13.0 + x_25) : (15.0 + x_26)) > ((20.0 + x_29) > (5.0 + x_31)? (20.0 + x_29) : (5.0 + x_31))? ((13.0 + x_25) > (15.0 + x_26)? (13.0 + x_25) : (15.0 + x_26)) : ((20.0 + x_29) > (5.0 + x_31)? (20.0 + x_29) : (5.0 + x_31))))? ((((6.0 + x_6) > (19.0 + x_8)? (6.0 + x_6) : (19.0 + x_8)) > ((8.0 + x_12) > (11.0 + x_13)? (8.0 + x_12) : (11.0 + x_13))? ((6.0 + x_6) > (19.0 + x_8)? (6.0 + x_6) : (19.0 + x_8)) : ((8.0 + x_12) > (11.0 + x_13)? (8.0 + x_12) : (11.0 + x_13))) > (((7.0 + x_14) > (2.0 + x_15)? (7.0 + x_14) : (2.0 + x_15)) > ((8.0 + x_16) > (7.0 + x_19)? (8.0 + x_16) : (7.0 + x_19))? ((7.0 + x_14) > (2.0 + x_15)? (7.0 + x_14) : (2.0 + x_15)) : ((8.0 + x_16) > (7.0 + x_19)? (8.0 + x_16) : (7.0 + x_19)))? (((6.0 + x_6) > (19.0 + x_8)? (6.0 + x_6) : (19.0 + x_8)) > ((8.0 + x_12) > (11.0 + x_13)? (8.0 + x_12) : (11.0 + x_13))? ((6.0 + x_6) > (19.0 + x_8)? (6.0 + x_6) : (19.0 + x_8)) : ((8.0 + x_12) > (11.0 + x_13)? (8.0 + x_12) : (11.0 + x_13))) : (((7.0 + x_14) > (2.0 + x_15)? (7.0 + x_14) : (2.0 + x_15)) > ((8.0 + x_16) > (7.0 + x_19)? (8.0 + x_16) : (7.0 + x_19))? ((7.0 + x_14) > (2.0 + x_15)? (7.0 + x_14) : (2.0 + x_15)) : ((8.0 + x_16) > (7.0 + x_19)? (8.0 + x_16) : (7.0 + x_19)))) : ((((15.0 + x_20) > (5.0 + x_22)? (15.0 + x_20) : (5.0 + x_22)) > ((10.0 + x_23) > (13.0 + x_24)? (10.0 + x_23) : (13.0 + x_24))? ((15.0 + x_20) > (5.0 + x_22)? (15.0 + x_20) : (5.0 + x_22)) : ((10.0 + x_23) > (13.0 + x_24)? (10.0 + x_23) : (13.0 + x_24))) > (((13.0 + x_25) > (15.0 + x_26)? (13.0 + x_25) : (15.0 + x_26)) > ((20.0 + x_29) > (5.0 + x_31)? (20.0 + x_29) : (5.0 + x_31))? ((13.0 + x_25) > (15.0 + x_26)? (13.0 + x_25) : (15.0 + x_26)) : ((20.0 + x_29) > (5.0 + x_31)? (20.0 + x_29) : (5.0 + x_31)))? (((15.0 + x_20) > (5.0 + x_22)? (15.0 + x_20) : (5.0 + x_22)) > ((10.0 + x_23) > (13.0 + x_24)? (10.0 + x_23) : (13.0 + x_24))? ((15.0 + x_20) > (5.0 + x_22)? (15.0 + x_20) : (5.0 + x_22)) : ((10.0 + x_23) > (13.0 + x_24)? (10.0 + x_23) : (13.0 + x_24))) : (((13.0 + x_25) > (15.0 + x_26)? (13.0 + x_25) : (15.0 + x_26)) > ((20.0 + x_29) > (5.0 + x_31)? (20.0 + x_29) : (5.0 + x_31))? ((13.0 + x_25) > (15.0 + x_26)? (13.0 + x_25) : (15.0 + x_26)) : ((20.0 + x_29) > (5.0 + x_31)? (20.0 + x_29) : (5.0 + x_31))))); x_12_ = (((((16.0 + x_0) > (3.0 + x_1)? (16.0 + x_0) : (3.0 + x_1)) > ((14.0 + x_7) > (9.0 + x_8)? (14.0 + x_7) : (9.0 + x_8))? ((16.0 + x_0) > (3.0 + x_1)? (16.0 + x_0) : (3.0 + x_1)) : ((14.0 + x_7) > (9.0 + x_8)? (14.0 + x_7) : (9.0 + x_8))) > (((3.0 + x_10) > (11.0 + x_11)? (3.0 + x_10) : (11.0 + x_11)) > ((5.0 + x_13) > (6.0 + x_14)? (5.0 + x_13) : (6.0 + x_14))? ((3.0 + x_10) > (11.0 + x_11)? (3.0 + x_10) : (11.0 + x_11)) : ((5.0 + x_13) > (6.0 + x_14)? (5.0 + x_13) : (6.0 + x_14)))? (((16.0 + x_0) > (3.0 + x_1)? (16.0 + x_0) : (3.0 + x_1)) > ((14.0 + x_7) > (9.0 + x_8)? (14.0 + x_7) : (9.0 + x_8))? ((16.0 + x_0) > (3.0 + x_1)? (16.0 + x_0) : (3.0 + x_1)) : ((14.0 + x_7) > (9.0 + x_8)? (14.0 + x_7) : (9.0 + x_8))) : (((3.0 + x_10) > (11.0 + x_11)? (3.0 + x_10) : (11.0 + x_11)) > ((5.0 + x_13) > (6.0 + x_14)? (5.0 + x_13) : (6.0 + x_14))? ((3.0 + x_10) > (11.0 + x_11)? (3.0 + x_10) : (11.0 + x_11)) : ((5.0 + x_13) > (6.0 + x_14)? (5.0 + x_13) : (6.0 + x_14)))) > ((((13.0 + x_16) > (2.0 + x_21)? (13.0 + x_16) : (2.0 + x_21)) > ((11.0 + x_22) > (5.0 + x_23)? (11.0 + x_22) : (5.0 + x_23))? ((13.0 + x_16) > (2.0 + x_21)? (13.0 + x_16) : (2.0 + x_21)) : ((11.0 + x_22) > (5.0 + x_23)? (11.0 + x_22) : (5.0 + x_23))) > (((2.0 + x_25) > (10.0 + x_29)? (2.0 + x_25) : (10.0 + x_29)) > ((2.0 + x_30) > (20.0 + x_31)? (2.0 + x_30) : (20.0 + x_31))? ((2.0 + x_25) > (10.0 + x_29)? (2.0 + x_25) : (10.0 + x_29)) : ((2.0 + x_30) > (20.0 + x_31)? (2.0 + x_30) : (20.0 + x_31)))? (((13.0 + x_16) > (2.0 + x_21)? (13.0 + x_16) : (2.0 + x_21)) > ((11.0 + x_22) > (5.0 + x_23)? (11.0 + x_22) : (5.0 + x_23))? ((13.0 + x_16) > (2.0 + x_21)? (13.0 + x_16) : (2.0 + x_21)) : ((11.0 + x_22) > (5.0 + x_23)? (11.0 + x_22) : (5.0 + x_23))) : (((2.0 + x_25) > (10.0 + x_29)? (2.0 + x_25) : (10.0 + x_29)) > ((2.0 + x_30) > (20.0 + x_31)? (2.0 + x_30) : (20.0 + x_31))? ((2.0 + x_25) > (10.0 + x_29)? (2.0 + x_25) : (10.0 + x_29)) : ((2.0 + x_30) > (20.0 + x_31)? (2.0 + x_30) : (20.0 + x_31))))? ((((16.0 + x_0) > (3.0 + x_1)? (16.0 + x_0) : (3.0 + x_1)) > ((14.0 + x_7) > (9.0 + x_8)? (14.0 + x_7) : (9.0 + x_8))? ((16.0 + x_0) > (3.0 + x_1)? (16.0 + x_0) : (3.0 + x_1)) : ((14.0 + x_7) > (9.0 + x_8)? (14.0 + x_7) : (9.0 + x_8))) > (((3.0 + x_10) > (11.0 + x_11)? (3.0 + x_10) : (11.0 + x_11)) > ((5.0 + x_13) > (6.0 + x_14)? (5.0 + x_13) : (6.0 + x_14))? ((3.0 + x_10) > (11.0 + x_11)? (3.0 + x_10) : (11.0 + x_11)) : ((5.0 + x_13) > (6.0 + x_14)? (5.0 + x_13) : (6.0 + x_14)))? (((16.0 + x_0) > (3.0 + x_1)? (16.0 + x_0) : (3.0 + x_1)) > ((14.0 + x_7) > (9.0 + x_8)? (14.0 + x_7) : (9.0 + x_8))? ((16.0 + x_0) > (3.0 + x_1)? (16.0 + x_0) : (3.0 + x_1)) : ((14.0 + x_7) > (9.0 + x_8)? (14.0 + x_7) : (9.0 + x_8))) : (((3.0 + x_10) > (11.0 + x_11)? (3.0 + x_10) : (11.0 + x_11)) > ((5.0 + x_13) > (6.0 + x_14)? (5.0 + x_13) : (6.0 + x_14))? ((3.0 + x_10) > (11.0 + x_11)? (3.0 + x_10) : (11.0 + x_11)) : ((5.0 + x_13) > (6.0 + x_14)? (5.0 + x_13) : (6.0 + x_14)))) : ((((13.0 + x_16) > (2.0 + x_21)? (13.0 + x_16) : (2.0 + x_21)) > ((11.0 + x_22) > (5.0 + x_23)? (11.0 + x_22) : (5.0 + x_23))? ((13.0 + x_16) > (2.0 + x_21)? (13.0 + x_16) : (2.0 + x_21)) : ((11.0 + x_22) > (5.0 + x_23)? (11.0 + x_22) : (5.0 + x_23))) > (((2.0 + x_25) > (10.0 + x_29)? (2.0 + x_25) : (10.0 + x_29)) > ((2.0 + x_30) > (20.0 + x_31)? (2.0 + x_30) : (20.0 + x_31))? ((2.0 + x_25) > (10.0 + x_29)? (2.0 + x_25) : (10.0 + x_29)) : ((2.0 + x_30) > (20.0 + x_31)? (2.0 + x_30) : (20.0 + x_31)))? (((13.0 + x_16) > (2.0 + x_21)? (13.0 + x_16) : (2.0 + x_21)) > ((11.0 + x_22) > (5.0 + x_23)? (11.0 + x_22) : (5.0 + x_23))? ((13.0 + x_16) > (2.0 + x_21)? (13.0 + x_16) : (2.0 + x_21)) : ((11.0 + x_22) > (5.0 + x_23)? (11.0 + x_22) : (5.0 + x_23))) : (((2.0 + x_25) > (10.0 + x_29)? (2.0 + x_25) : (10.0 + x_29)) > ((2.0 + x_30) > (20.0 + x_31)? (2.0 + x_30) : (20.0 + x_31))? ((2.0 + x_25) > (10.0 + x_29)? (2.0 + x_25) : (10.0 + x_29)) : ((2.0 + x_30) > (20.0 + x_31)? (2.0 + x_30) : (20.0 + x_31))))); x_13_ = (((((8.0 + x_0) > (20.0 + x_2)? (8.0 + x_0) : (20.0 + x_2)) > ((18.0 + x_5) > (7.0 + x_6)? (18.0 + x_5) : (7.0 + x_6))? ((8.0 + x_0) > (20.0 + x_2)? (8.0 + x_0) : (20.0 + x_2)) : ((18.0 + x_5) > (7.0 + x_6)? (18.0 + x_5) : (7.0 + x_6))) > (((5.0 + x_8) > (4.0 + x_9)? (5.0 + x_8) : (4.0 + x_9)) > ((12.0 + x_11) > (2.0 + x_12)? (12.0 + x_11) : (2.0 + x_12))? ((5.0 + x_8) > (4.0 + x_9)? (5.0 + x_8) : (4.0 + x_9)) : ((12.0 + x_11) > (2.0 + x_12)? (12.0 + x_11) : (2.0 + x_12)))? (((8.0 + x_0) > (20.0 + x_2)? (8.0 + x_0) : (20.0 + x_2)) > ((18.0 + x_5) > (7.0 + x_6)? (18.0 + x_5) : (7.0 + x_6))? ((8.0 + x_0) > (20.0 + x_2)? (8.0 + x_0) : (20.0 + x_2)) : ((18.0 + x_5) > (7.0 + x_6)? (18.0 + x_5) : (7.0 + x_6))) : (((5.0 + x_8) > (4.0 + x_9)? (5.0 + x_8) : (4.0 + x_9)) > ((12.0 + x_11) > (2.0 + x_12)? (12.0 + x_11) : (2.0 + x_12))? ((5.0 + x_8) > (4.0 + x_9)? (5.0 + x_8) : (4.0 + x_9)) : ((12.0 + x_11) > (2.0 + x_12)? (12.0 + x_11) : (2.0 + x_12)))) > ((((13.0 + x_14) > (15.0 + x_17)? (13.0 + x_14) : (15.0 + x_17)) > ((1.0 + x_20) > (1.0 + x_22)? (1.0 + x_20) : (1.0 + x_22))? ((13.0 + x_14) > (15.0 + x_17)? (13.0 + x_14) : (15.0 + x_17)) : ((1.0 + x_20) > (1.0 + x_22)? (1.0 + x_20) : (1.0 + x_22))) > (((10.0 + x_24) > (15.0 + x_27)? (10.0 + x_24) : (15.0 + x_27)) > ((2.0 + x_28) > (4.0 + x_31)? (2.0 + x_28) : (4.0 + x_31))? ((10.0 + x_24) > (15.0 + x_27)? (10.0 + x_24) : (15.0 + x_27)) : ((2.0 + x_28) > (4.0 + x_31)? (2.0 + x_28) : (4.0 + x_31)))? (((13.0 + x_14) > (15.0 + x_17)? (13.0 + x_14) : (15.0 + x_17)) > ((1.0 + x_20) > (1.0 + x_22)? (1.0 + x_20) : (1.0 + x_22))? ((13.0 + x_14) > (15.0 + x_17)? (13.0 + x_14) : (15.0 + x_17)) : ((1.0 + x_20) > (1.0 + x_22)? (1.0 + x_20) : (1.0 + x_22))) : (((10.0 + x_24) > (15.0 + x_27)? (10.0 + x_24) : (15.0 + x_27)) > ((2.0 + x_28) > (4.0 + x_31)? (2.0 + x_28) : (4.0 + x_31))? ((10.0 + x_24) > (15.0 + x_27)? (10.0 + x_24) : (15.0 + x_27)) : ((2.0 + x_28) > (4.0 + x_31)? (2.0 + x_28) : (4.0 + x_31))))? ((((8.0 + x_0) > (20.0 + x_2)? (8.0 + x_0) : (20.0 + x_2)) > ((18.0 + x_5) > (7.0 + x_6)? (18.0 + x_5) : (7.0 + x_6))? ((8.0 + x_0) > (20.0 + x_2)? (8.0 + x_0) : (20.0 + x_2)) : ((18.0 + x_5) > (7.0 + x_6)? (18.0 + x_5) : (7.0 + x_6))) > (((5.0 + x_8) > (4.0 + x_9)? (5.0 + x_8) : (4.0 + x_9)) > ((12.0 + x_11) > (2.0 + x_12)? (12.0 + x_11) : (2.0 + x_12))? ((5.0 + x_8) > (4.0 + x_9)? (5.0 + x_8) : (4.0 + x_9)) : ((12.0 + x_11) > (2.0 + x_12)? (12.0 + x_11) : (2.0 + x_12)))? (((8.0 + x_0) > (20.0 + x_2)? (8.0 + x_0) : (20.0 + x_2)) > ((18.0 + x_5) > (7.0 + x_6)? (18.0 + x_5) : (7.0 + x_6))? ((8.0 + x_0) > (20.0 + x_2)? (8.0 + x_0) : (20.0 + x_2)) : ((18.0 + x_5) > (7.0 + x_6)? (18.0 + x_5) : (7.0 + x_6))) : (((5.0 + x_8) > (4.0 + x_9)? (5.0 + x_8) : (4.0 + x_9)) > ((12.0 + x_11) > (2.0 + x_12)? (12.0 + x_11) : (2.0 + x_12))? ((5.0 + x_8) > (4.0 + x_9)? (5.0 + x_8) : (4.0 + x_9)) : ((12.0 + x_11) > (2.0 + x_12)? (12.0 + x_11) : (2.0 + x_12)))) : ((((13.0 + x_14) > (15.0 + x_17)? (13.0 + x_14) : (15.0 + x_17)) > ((1.0 + x_20) > (1.0 + x_22)? (1.0 + x_20) : (1.0 + x_22))? ((13.0 + x_14) > (15.0 + x_17)? (13.0 + x_14) : (15.0 + x_17)) : ((1.0 + x_20) > (1.0 + x_22)? (1.0 + x_20) : (1.0 + x_22))) > (((10.0 + x_24) > (15.0 + x_27)? (10.0 + x_24) : (15.0 + x_27)) > ((2.0 + x_28) > (4.0 + x_31)? (2.0 + x_28) : (4.0 + x_31))? ((10.0 + x_24) > (15.0 + x_27)? (10.0 + x_24) : (15.0 + x_27)) : ((2.0 + x_28) > (4.0 + x_31)? (2.0 + x_28) : (4.0 + x_31)))? (((13.0 + x_14) > (15.0 + x_17)? (13.0 + x_14) : (15.0 + x_17)) > ((1.0 + x_20) > (1.0 + x_22)? (1.0 + x_20) : (1.0 + x_22))? ((13.0 + x_14) > (15.0 + x_17)? (13.0 + x_14) : (15.0 + x_17)) : ((1.0 + x_20) > (1.0 + x_22)? (1.0 + x_20) : (1.0 + x_22))) : (((10.0 + x_24) > (15.0 + x_27)? (10.0 + x_24) : (15.0 + x_27)) > ((2.0 + x_28) > (4.0 + x_31)? (2.0 + x_28) : (4.0 + x_31))? ((10.0 + x_24) > (15.0 + x_27)? (10.0 + x_24) : (15.0 + x_27)) : ((2.0 + x_28) > (4.0 + x_31)? (2.0 + x_28) : (4.0 + x_31))))); x_14_ = (((((5.0 + x_0) > (9.0 + x_1)? (5.0 + x_0) : (9.0 + x_1)) > ((18.0 + x_2) > (11.0 + x_7)? (18.0 + x_2) : (11.0 + x_7))? ((5.0 + x_0) > (9.0 + x_1)? (5.0 + x_0) : (9.0 + x_1)) : ((18.0 + x_2) > (11.0 + x_7)? (18.0 + x_2) : (11.0 + x_7))) > (((7.0 + x_8) > (5.0 + x_9)? (7.0 + x_8) : (5.0 + x_9)) > ((9.0 + x_14) > (3.0 + x_16)? (9.0 + x_14) : (3.0 + x_16))? ((7.0 + x_8) > (5.0 + x_9)? (7.0 + x_8) : (5.0 + x_9)) : ((9.0 + x_14) > (3.0 + x_16)? (9.0 + x_14) : (3.0 + x_16)))? (((5.0 + x_0) > (9.0 + x_1)? (5.0 + x_0) : (9.0 + x_1)) > ((18.0 + x_2) > (11.0 + x_7)? (18.0 + x_2) : (11.0 + x_7))? ((5.0 + x_0) > (9.0 + x_1)? (5.0 + x_0) : (9.0 + x_1)) : ((18.0 + x_2) > (11.0 + x_7)? (18.0 + x_2) : (11.0 + x_7))) : (((7.0 + x_8) > (5.0 + x_9)? (7.0 + x_8) : (5.0 + x_9)) > ((9.0 + x_14) > (3.0 + x_16)? (9.0 + x_14) : (3.0 + x_16))? ((7.0 + x_8) > (5.0 + x_9)? (7.0 + x_8) : (5.0 + x_9)) : ((9.0 + x_14) > (3.0 + x_16)? (9.0 + x_14) : (3.0 + x_16)))) > ((((1.0 + x_18) > (1.0 + x_19)? (1.0 + x_18) : (1.0 + x_19)) > ((15.0 + x_21) > (18.0 + x_22)? (15.0 + x_21) : (18.0 + x_22))? ((1.0 + x_18) > (1.0 + x_19)? (1.0 + x_18) : (1.0 + x_19)) : ((15.0 + x_21) > (18.0 + x_22)? (15.0 + x_21) : (18.0 + x_22))) > (((15.0 + x_24) > (7.0 + x_25)? (15.0 + x_24) : (7.0 + x_25)) > ((3.0 + x_27) > (20.0 + x_30)? (3.0 + x_27) : (20.0 + x_30))? ((15.0 + x_24) > (7.0 + x_25)? (15.0 + x_24) : (7.0 + x_25)) : ((3.0 + x_27) > (20.0 + x_30)? (3.0 + x_27) : (20.0 + x_30)))? (((1.0 + x_18) > (1.0 + x_19)? (1.0 + x_18) : (1.0 + x_19)) > ((15.0 + x_21) > (18.0 + x_22)? (15.0 + x_21) : (18.0 + x_22))? ((1.0 + x_18) > (1.0 + x_19)? (1.0 + x_18) : (1.0 + x_19)) : ((15.0 + x_21) > (18.0 + x_22)? (15.0 + x_21) : (18.0 + x_22))) : (((15.0 + x_24) > (7.0 + x_25)? (15.0 + x_24) : (7.0 + x_25)) > ((3.0 + x_27) > (20.0 + x_30)? (3.0 + x_27) : (20.0 + x_30))? ((15.0 + x_24) > (7.0 + x_25)? (15.0 + x_24) : (7.0 + x_25)) : ((3.0 + x_27) > (20.0 + x_30)? (3.0 + x_27) : (20.0 + x_30))))? ((((5.0 + x_0) > (9.0 + x_1)? (5.0 + x_0) : (9.0 + x_1)) > ((18.0 + x_2) > (11.0 + x_7)? (18.0 + x_2) : (11.0 + x_7))? ((5.0 + x_0) > (9.0 + x_1)? (5.0 + x_0) : (9.0 + x_1)) : ((18.0 + x_2) > (11.0 + x_7)? (18.0 + x_2) : (11.0 + x_7))) > (((7.0 + x_8) > (5.0 + x_9)? (7.0 + x_8) : (5.0 + x_9)) > ((9.0 + x_14) > (3.0 + x_16)? (9.0 + x_14) : (3.0 + x_16))? ((7.0 + x_8) > (5.0 + x_9)? (7.0 + x_8) : (5.0 + x_9)) : ((9.0 + x_14) > (3.0 + x_16)? (9.0 + x_14) : (3.0 + x_16)))? (((5.0 + x_0) > (9.0 + x_1)? (5.0 + x_0) : (9.0 + x_1)) > ((18.0 + x_2) > (11.0 + x_7)? (18.0 + x_2) : (11.0 + x_7))? ((5.0 + x_0) > (9.0 + x_1)? (5.0 + x_0) : (9.0 + x_1)) : ((18.0 + x_2) > (11.0 + x_7)? (18.0 + x_2) : (11.0 + x_7))) : (((7.0 + x_8) > (5.0 + x_9)? (7.0 + x_8) : (5.0 + x_9)) > ((9.0 + x_14) > (3.0 + x_16)? (9.0 + x_14) : (3.0 + x_16))? ((7.0 + x_8) > (5.0 + x_9)? (7.0 + x_8) : (5.0 + x_9)) : ((9.0 + x_14) > (3.0 + x_16)? (9.0 + x_14) : (3.0 + x_16)))) : ((((1.0 + x_18) > (1.0 + x_19)? (1.0 + x_18) : (1.0 + x_19)) > ((15.0 + x_21) > (18.0 + x_22)? (15.0 + x_21) : (18.0 + x_22))? ((1.0 + x_18) > (1.0 + x_19)? (1.0 + x_18) : (1.0 + x_19)) : ((15.0 + x_21) > (18.0 + x_22)? (15.0 + x_21) : (18.0 + x_22))) > (((15.0 + x_24) > (7.0 + x_25)? (15.0 + x_24) : (7.0 + x_25)) > ((3.0 + x_27) > (20.0 + x_30)? (3.0 + x_27) : (20.0 + x_30))? ((15.0 + x_24) > (7.0 + x_25)? (15.0 + x_24) : (7.0 + x_25)) : ((3.0 + x_27) > (20.0 + x_30)? (3.0 + x_27) : (20.0 + x_30)))? (((1.0 + x_18) > (1.0 + x_19)? (1.0 + x_18) : (1.0 + x_19)) > ((15.0 + x_21) > (18.0 + x_22)? (15.0 + x_21) : (18.0 + x_22))? ((1.0 + x_18) > (1.0 + x_19)? (1.0 + x_18) : (1.0 + x_19)) : ((15.0 + x_21) > (18.0 + x_22)? (15.0 + x_21) : (18.0 + x_22))) : (((15.0 + x_24) > (7.0 + x_25)? (15.0 + x_24) : (7.0 + x_25)) > ((3.0 + x_27) > (20.0 + x_30)? (3.0 + x_27) : (20.0 + x_30))? ((15.0 + x_24) > (7.0 + x_25)? (15.0 + x_24) : (7.0 + x_25)) : ((3.0 + x_27) > (20.0 + x_30)? (3.0 + x_27) : (20.0 + x_30))))); x_15_ = (((((2.0 + x_1) > (5.0 + x_3)? (2.0 + x_1) : (5.0 + x_3)) > ((9.0 + x_6) > (8.0 + x_8)? (9.0 + x_6) : (8.0 + x_8))? ((2.0 + x_1) > (5.0 + x_3)? (2.0 + x_1) : (5.0 + x_3)) : ((9.0 + x_6) > (8.0 + x_8)? (9.0 + x_6) : (8.0 + x_8))) > (((2.0 + x_11) > (6.0 + x_13)? (2.0 + x_11) : (6.0 + x_13)) > ((9.0 + x_14) > (12.0 + x_16)? (9.0 + x_14) : (12.0 + x_16))? ((2.0 + x_11) > (6.0 + x_13)? (2.0 + x_11) : (6.0 + x_13)) : ((9.0 + x_14) > (12.0 + x_16)? (9.0 + x_14) : (12.0 + x_16)))? (((2.0 + x_1) > (5.0 + x_3)? (2.0 + x_1) : (5.0 + x_3)) > ((9.0 + x_6) > (8.0 + x_8)? (9.0 + x_6) : (8.0 + x_8))? ((2.0 + x_1) > (5.0 + x_3)? (2.0 + x_1) : (5.0 + x_3)) : ((9.0 + x_6) > (8.0 + x_8)? (9.0 + x_6) : (8.0 + x_8))) : (((2.0 + x_11) > (6.0 + x_13)? (2.0 + x_11) : (6.0 + x_13)) > ((9.0 + x_14) > (12.0 + x_16)? (9.0 + x_14) : (12.0 + x_16))? ((2.0 + x_11) > (6.0 + x_13)? (2.0 + x_11) : (6.0 + x_13)) : ((9.0 + x_14) > (12.0 + x_16)? (9.0 + x_14) : (12.0 + x_16)))) > ((((4.0 + x_18) > (19.0 + x_20)? (4.0 + x_18) : (19.0 + x_20)) > ((19.0 + x_22) > (18.0 + x_23)? (19.0 + x_22) : (18.0 + x_23))? ((4.0 + x_18) > (19.0 + x_20)? (4.0 + x_18) : (19.0 + x_20)) : ((19.0 + x_22) > (18.0 + x_23)? (19.0 + x_22) : (18.0 + x_23))) > (((4.0 + x_24) > (11.0 + x_25)? (4.0 + x_24) : (11.0 + x_25)) > ((6.0 + x_27) > (9.0 + x_28)? (6.0 + x_27) : (9.0 + x_28))? ((4.0 + x_24) > (11.0 + x_25)? (4.0 + x_24) : (11.0 + x_25)) : ((6.0 + x_27) > (9.0 + x_28)? (6.0 + x_27) : (9.0 + x_28)))? (((4.0 + x_18) > (19.0 + x_20)? (4.0 + x_18) : (19.0 + x_20)) > ((19.0 + x_22) > (18.0 + x_23)? (19.0 + x_22) : (18.0 + x_23))? ((4.0 + x_18) > (19.0 + x_20)? (4.0 + x_18) : (19.0 + x_20)) : ((19.0 + x_22) > (18.0 + x_23)? (19.0 + x_22) : (18.0 + x_23))) : (((4.0 + x_24) > (11.0 + x_25)? (4.0 + x_24) : (11.0 + x_25)) > ((6.0 + x_27) > (9.0 + x_28)? (6.0 + x_27) : (9.0 + x_28))? ((4.0 + x_24) > (11.0 + x_25)? (4.0 + x_24) : (11.0 + x_25)) : ((6.0 + x_27) > (9.0 + x_28)? (6.0 + x_27) : (9.0 + x_28))))? ((((2.0 + x_1) > (5.0 + x_3)? (2.0 + x_1) : (5.0 + x_3)) > ((9.0 + x_6) > (8.0 + x_8)? (9.0 + x_6) : (8.0 + x_8))? ((2.0 + x_1) > (5.0 + x_3)? (2.0 + x_1) : (5.0 + x_3)) : ((9.0 + x_6) > (8.0 + x_8)? (9.0 + x_6) : (8.0 + x_8))) > (((2.0 + x_11) > (6.0 + x_13)? (2.0 + x_11) : (6.0 + x_13)) > ((9.0 + x_14) > (12.0 + x_16)? (9.0 + x_14) : (12.0 + x_16))? ((2.0 + x_11) > (6.0 + x_13)? (2.0 + x_11) : (6.0 + x_13)) : ((9.0 + x_14) > (12.0 + x_16)? (9.0 + x_14) : (12.0 + x_16)))? (((2.0 + x_1) > (5.0 + x_3)? (2.0 + x_1) : (5.0 + x_3)) > ((9.0 + x_6) > (8.0 + x_8)? (9.0 + x_6) : (8.0 + x_8))? ((2.0 + x_1) > (5.0 + x_3)? (2.0 + x_1) : (5.0 + x_3)) : ((9.0 + x_6) > (8.0 + x_8)? (9.0 + x_6) : (8.0 + x_8))) : (((2.0 + x_11) > (6.0 + x_13)? (2.0 + x_11) : (6.0 + x_13)) > ((9.0 + x_14) > (12.0 + x_16)? (9.0 + x_14) : (12.0 + x_16))? ((2.0 + x_11) > (6.0 + x_13)? (2.0 + x_11) : (6.0 + x_13)) : ((9.0 + x_14) > (12.0 + x_16)? (9.0 + x_14) : (12.0 + x_16)))) : ((((4.0 + x_18) > (19.0 + x_20)? (4.0 + x_18) : (19.0 + x_20)) > ((19.0 + x_22) > (18.0 + x_23)? (19.0 + x_22) : (18.0 + x_23))? ((4.0 + x_18) > (19.0 + x_20)? (4.0 + x_18) : (19.0 + x_20)) : ((19.0 + x_22) > (18.0 + x_23)? (19.0 + x_22) : (18.0 + x_23))) > (((4.0 + x_24) > (11.0 + x_25)? (4.0 + x_24) : (11.0 + x_25)) > ((6.0 + x_27) > (9.0 + x_28)? (6.0 + x_27) : (9.0 + x_28))? ((4.0 + x_24) > (11.0 + x_25)? (4.0 + x_24) : (11.0 + x_25)) : ((6.0 + x_27) > (9.0 + x_28)? (6.0 + x_27) : (9.0 + x_28)))? (((4.0 + x_18) > (19.0 + x_20)? (4.0 + x_18) : (19.0 + x_20)) > ((19.0 + x_22) > (18.0 + x_23)? (19.0 + x_22) : (18.0 + x_23))? ((4.0 + x_18) > (19.0 + x_20)? (4.0 + x_18) : (19.0 + x_20)) : ((19.0 + x_22) > (18.0 + x_23)? (19.0 + x_22) : (18.0 + x_23))) : (((4.0 + x_24) > (11.0 + x_25)? (4.0 + x_24) : (11.0 + x_25)) > ((6.0 + x_27) > (9.0 + x_28)? (6.0 + x_27) : (9.0 + x_28))? ((4.0 + x_24) > (11.0 + x_25)? (4.0 + x_24) : (11.0 + x_25)) : ((6.0 + x_27) > (9.0 + x_28)? (6.0 + x_27) : (9.0 + x_28))))); x_16_ = (((((1.0 + x_0) > (20.0 + x_1)? (1.0 + x_0) : (20.0 + x_1)) > ((7.0 + x_2) > (18.0 + x_5)? (7.0 + x_2) : (18.0 + x_5))? ((1.0 + x_0) > (20.0 + x_1)? (1.0 + x_0) : (20.0 + x_1)) : ((7.0 + x_2) > (18.0 + x_5)? (7.0 + x_2) : (18.0 + x_5))) > (((1.0 + x_7) > (16.0 + x_8)? (1.0 + x_7) : (16.0 + x_8)) > ((16.0 + x_10) > (16.0 + x_14)? (16.0 + x_10) : (16.0 + x_14))? ((1.0 + x_7) > (16.0 + x_8)? (1.0 + x_7) : (16.0 + x_8)) : ((16.0 + x_10) > (16.0 + x_14)? (16.0 + x_10) : (16.0 + x_14)))? (((1.0 + x_0) > (20.0 + x_1)? (1.0 + x_0) : (20.0 + x_1)) > ((7.0 + x_2) > (18.0 + x_5)? (7.0 + x_2) : (18.0 + x_5))? ((1.0 + x_0) > (20.0 + x_1)? (1.0 + x_0) : (20.0 + x_1)) : ((7.0 + x_2) > (18.0 + x_5)? (7.0 + x_2) : (18.0 + x_5))) : (((1.0 + x_7) > (16.0 + x_8)? (1.0 + x_7) : (16.0 + x_8)) > ((16.0 + x_10) > (16.0 + x_14)? (16.0 + x_10) : (16.0 + x_14))? ((1.0 + x_7) > (16.0 + x_8)? (1.0 + x_7) : (16.0 + x_8)) : ((16.0 + x_10) > (16.0 + x_14)? (16.0 + x_10) : (16.0 + x_14)))) > ((((2.0 + x_16) > (3.0 + x_17)? (2.0 + x_16) : (3.0 + x_17)) > ((15.0 + x_20) > (18.0 + x_23)? (15.0 + x_20) : (18.0 + x_23))? ((2.0 + x_16) > (3.0 + x_17)? (2.0 + x_16) : (3.0 + x_17)) : ((15.0 + x_20) > (18.0 + x_23)? (15.0 + x_20) : (18.0 + x_23))) > (((17.0 + x_24) > (1.0 + x_28)? (17.0 + x_24) : (1.0 + x_28)) > ((12.0 + x_30) > (6.0 + x_31)? (12.0 + x_30) : (6.0 + x_31))? ((17.0 + x_24) > (1.0 + x_28)? (17.0 + x_24) : (1.0 + x_28)) : ((12.0 + x_30) > (6.0 + x_31)? (12.0 + x_30) : (6.0 + x_31)))? (((2.0 + x_16) > (3.0 + x_17)? (2.0 + x_16) : (3.0 + x_17)) > ((15.0 + x_20) > (18.0 + x_23)? (15.0 + x_20) : (18.0 + x_23))? ((2.0 + x_16) > (3.0 + x_17)? (2.0 + x_16) : (3.0 + x_17)) : ((15.0 + x_20) > (18.0 + x_23)? (15.0 + x_20) : (18.0 + x_23))) : (((17.0 + x_24) > (1.0 + x_28)? (17.0 + x_24) : (1.0 + x_28)) > ((12.0 + x_30) > (6.0 + x_31)? (12.0 + x_30) : (6.0 + x_31))? ((17.0 + x_24) > (1.0 + x_28)? (17.0 + x_24) : (1.0 + x_28)) : ((12.0 + x_30) > (6.0 + x_31)? (12.0 + x_30) : (6.0 + x_31))))? ((((1.0 + x_0) > (20.0 + x_1)? (1.0 + x_0) : (20.0 + x_1)) > ((7.0 + x_2) > (18.0 + x_5)? (7.0 + x_2) : (18.0 + x_5))? ((1.0 + x_0) > (20.0 + x_1)? (1.0 + x_0) : (20.0 + x_1)) : ((7.0 + x_2) > (18.0 + x_5)? (7.0 + x_2) : (18.0 + x_5))) > (((1.0 + x_7) > (16.0 + x_8)? (1.0 + x_7) : (16.0 + x_8)) > ((16.0 + x_10) > (16.0 + x_14)? (16.0 + x_10) : (16.0 + x_14))? ((1.0 + x_7) > (16.0 + x_8)? (1.0 + x_7) : (16.0 + x_8)) : ((16.0 + x_10) > (16.0 + x_14)? (16.0 + x_10) : (16.0 + x_14)))? (((1.0 + x_0) > (20.0 + x_1)? (1.0 + x_0) : (20.0 + x_1)) > ((7.0 + x_2) > (18.0 + x_5)? (7.0 + x_2) : (18.0 + x_5))? ((1.0 + x_0) > (20.0 + x_1)? (1.0 + x_0) : (20.0 + x_1)) : ((7.0 + x_2) > (18.0 + x_5)? (7.0 + x_2) : (18.0 + x_5))) : (((1.0 + x_7) > (16.0 + x_8)? (1.0 + x_7) : (16.0 + x_8)) > ((16.0 + x_10) > (16.0 + x_14)? (16.0 + x_10) : (16.0 + x_14))? ((1.0 + x_7) > (16.0 + x_8)? (1.0 + x_7) : (16.0 + x_8)) : ((16.0 + x_10) > (16.0 + x_14)? (16.0 + x_10) : (16.0 + x_14)))) : ((((2.0 + x_16) > (3.0 + x_17)? (2.0 + x_16) : (3.0 + x_17)) > ((15.0 + x_20) > (18.0 + x_23)? (15.0 + x_20) : (18.0 + x_23))? ((2.0 + x_16) > (3.0 + x_17)? (2.0 + x_16) : (3.0 + x_17)) : ((15.0 + x_20) > (18.0 + x_23)? (15.0 + x_20) : (18.0 + x_23))) > (((17.0 + x_24) > (1.0 + x_28)? (17.0 + x_24) : (1.0 + x_28)) > ((12.0 + x_30) > (6.0 + x_31)? (12.0 + x_30) : (6.0 + x_31))? ((17.0 + x_24) > (1.0 + x_28)? (17.0 + x_24) : (1.0 + x_28)) : ((12.0 + x_30) > (6.0 + x_31)? (12.0 + x_30) : (6.0 + x_31)))? (((2.0 + x_16) > (3.0 + x_17)? (2.0 + x_16) : (3.0 + x_17)) > ((15.0 + x_20) > (18.0 + x_23)? (15.0 + x_20) : (18.0 + x_23))? ((2.0 + x_16) > (3.0 + x_17)? (2.0 + x_16) : (3.0 + x_17)) : ((15.0 + x_20) > (18.0 + x_23)? (15.0 + x_20) : (18.0 + x_23))) : (((17.0 + x_24) > (1.0 + x_28)? (17.0 + x_24) : (1.0 + x_28)) > ((12.0 + x_30) > (6.0 + x_31)? (12.0 + x_30) : (6.0 + x_31))? ((17.0 + x_24) > (1.0 + x_28)? (17.0 + x_24) : (1.0 + x_28)) : ((12.0 + x_30) > (6.0 + x_31)? (12.0 + x_30) : (6.0 + x_31))))); x_17_ = (((((10.0 + x_0) > (20.0 + x_2)? (10.0 + x_0) : (20.0 + x_2)) > ((7.0 + x_5) > (17.0 + x_6)? (7.0 + x_5) : (17.0 + x_6))? ((10.0 + x_0) > (20.0 + x_2)? (10.0 + x_0) : (20.0 + x_2)) : ((7.0 + x_5) > (17.0 + x_6)? (7.0 + x_5) : (17.0 + x_6))) > (((7.0 + x_7) > (13.0 + x_8)? (7.0 + x_7) : (13.0 + x_8)) > ((9.0 + x_12) > (13.0 + x_14)? (9.0 + x_12) : (13.0 + x_14))? ((7.0 + x_7) > (13.0 + x_8)? (7.0 + x_7) : (13.0 + x_8)) : ((9.0 + x_12) > (13.0 + x_14)? (9.0 + x_12) : (13.0 + x_14)))? (((10.0 + x_0) > (20.0 + x_2)? (10.0 + x_0) : (20.0 + x_2)) > ((7.0 + x_5) > (17.0 + x_6)? (7.0 + x_5) : (17.0 + x_6))? ((10.0 + x_0) > (20.0 + x_2)? (10.0 + x_0) : (20.0 + x_2)) : ((7.0 + x_5) > (17.0 + x_6)? (7.0 + x_5) : (17.0 + x_6))) : (((7.0 + x_7) > (13.0 + x_8)? (7.0 + x_7) : (13.0 + x_8)) > ((9.0 + x_12) > (13.0 + x_14)? (9.0 + x_12) : (13.0 + x_14))? ((7.0 + x_7) > (13.0 + x_8)? (7.0 + x_7) : (13.0 + x_8)) : ((9.0 + x_12) > (13.0 + x_14)? (9.0 + x_12) : (13.0 + x_14)))) > ((((6.0 + x_16) > (19.0 + x_18)? (6.0 + x_16) : (19.0 + x_18)) > ((17.0 + x_19) > (13.0 + x_20)? (17.0 + x_19) : (13.0 + x_20))? ((6.0 + x_16) > (19.0 + x_18)? (6.0 + x_16) : (19.0 + x_18)) : ((17.0 + x_19) > (13.0 + x_20)? (17.0 + x_19) : (13.0 + x_20))) > (((19.0 + x_21) > (8.0 + x_22)? (19.0 + x_21) : (8.0 + x_22)) > ((1.0 + x_30) > (1.0 + x_31)? (1.0 + x_30) : (1.0 + x_31))? ((19.0 + x_21) > (8.0 + x_22)? (19.0 + x_21) : (8.0 + x_22)) : ((1.0 + x_30) > (1.0 + x_31)? (1.0 + x_30) : (1.0 + x_31)))? (((6.0 + x_16) > (19.0 + x_18)? (6.0 + x_16) : (19.0 + x_18)) > ((17.0 + x_19) > (13.0 + x_20)? (17.0 + x_19) : (13.0 + x_20))? ((6.0 + x_16) > (19.0 + x_18)? (6.0 + x_16) : (19.0 + x_18)) : ((17.0 + x_19) > (13.0 + x_20)? (17.0 + x_19) : (13.0 + x_20))) : (((19.0 + x_21) > (8.0 + x_22)? (19.0 + x_21) : (8.0 + x_22)) > ((1.0 + x_30) > (1.0 + x_31)? (1.0 + x_30) : (1.0 + x_31))? ((19.0 + x_21) > (8.0 + x_22)? (19.0 + x_21) : (8.0 + x_22)) : ((1.0 + x_30) > (1.0 + x_31)? (1.0 + x_30) : (1.0 + x_31))))? ((((10.0 + x_0) > (20.0 + x_2)? (10.0 + x_0) : (20.0 + x_2)) > ((7.0 + x_5) > (17.0 + x_6)? (7.0 + x_5) : (17.0 + x_6))? ((10.0 + x_0) > (20.0 + x_2)? (10.0 + x_0) : (20.0 + x_2)) : ((7.0 + x_5) > (17.0 + x_6)? (7.0 + x_5) : (17.0 + x_6))) > (((7.0 + x_7) > (13.0 + x_8)? (7.0 + x_7) : (13.0 + x_8)) > ((9.0 + x_12) > (13.0 + x_14)? (9.0 + x_12) : (13.0 + x_14))? ((7.0 + x_7) > (13.0 + x_8)? (7.0 + x_7) : (13.0 + x_8)) : ((9.0 + x_12) > (13.0 + x_14)? (9.0 + x_12) : (13.0 + x_14)))? (((10.0 + x_0) > (20.0 + x_2)? (10.0 + x_0) : (20.0 + x_2)) > ((7.0 + x_5) > (17.0 + x_6)? (7.0 + x_5) : (17.0 + x_6))? ((10.0 + x_0) > (20.0 + x_2)? (10.0 + x_0) : (20.0 + x_2)) : ((7.0 + x_5) > (17.0 + x_6)? (7.0 + x_5) : (17.0 + x_6))) : (((7.0 + x_7) > (13.0 + x_8)? (7.0 + x_7) : (13.0 + x_8)) > ((9.0 + x_12) > (13.0 + x_14)? (9.0 + x_12) : (13.0 + x_14))? ((7.0 + x_7) > (13.0 + x_8)? (7.0 + x_7) : (13.0 + x_8)) : ((9.0 + x_12) > (13.0 + x_14)? (9.0 + x_12) : (13.0 + x_14)))) : ((((6.0 + x_16) > (19.0 + x_18)? (6.0 + x_16) : (19.0 + x_18)) > ((17.0 + x_19) > (13.0 + x_20)? (17.0 + x_19) : (13.0 + x_20))? ((6.0 + x_16) > (19.0 + x_18)? (6.0 + x_16) : (19.0 + x_18)) : ((17.0 + x_19) > (13.0 + x_20)? (17.0 + x_19) : (13.0 + x_20))) > (((19.0 + x_21) > (8.0 + x_22)? (19.0 + x_21) : (8.0 + x_22)) > ((1.0 + x_30) > (1.0 + x_31)? (1.0 + x_30) : (1.0 + x_31))? ((19.0 + x_21) > (8.0 + x_22)? (19.0 + x_21) : (8.0 + x_22)) : ((1.0 + x_30) > (1.0 + x_31)? (1.0 + x_30) : (1.0 + x_31)))? (((6.0 + x_16) > (19.0 + x_18)? (6.0 + x_16) : (19.0 + x_18)) > ((17.0 + x_19) > (13.0 + x_20)? (17.0 + x_19) : (13.0 + x_20))? ((6.0 + x_16) > (19.0 + x_18)? (6.0 + x_16) : (19.0 + x_18)) : ((17.0 + x_19) > (13.0 + x_20)? (17.0 + x_19) : (13.0 + x_20))) : (((19.0 + x_21) > (8.0 + x_22)? (19.0 + x_21) : (8.0 + x_22)) > ((1.0 + x_30) > (1.0 + x_31)? (1.0 + x_30) : (1.0 + x_31))? ((19.0 + x_21) > (8.0 + x_22)? (19.0 + x_21) : (8.0 + x_22)) : ((1.0 + x_30) > (1.0 + x_31)? (1.0 + x_30) : (1.0 + x_31))))); x_18_ = (((((3.0 + x_2) > (11.0 + x_4)? (3.0 + x_2) : (11.0 + x_4)) > ((17.0 + x_5) > (11.0 + x_6)? (17.0 + x_5) : (11.0 + x_6))? ((3.0 + x_2) > (11.0 + x_4)? (3.0 + x_2) : (11.0 + x_4)) : ((17.0 + x_5) > (11.0 + x_6)? (17.0 + x_5) : (11.0 + x_6))) > (((16.0 + x_7) > (10.0 + x_8)? (16.0 + x_7) : (10.0 + x_8)) > ((2.0 + x_10) > (1.0 + x_11)? (2.0 + x_10) : (1.0 + x_11))? ((16.0 + x_7) > (10.0 + x_8)? (16.0 + x_7) : (10.0 + x_8)) : ((2.0 + x_10) > (1.0 + x_11)? (2.0 + x_10) : (1.0 + x_11)))? (((3.0 + x_2) > (11.0 + x_4)? (3.0 + x_2) : (11.0 + x_4)) > ((17.0 + x_5) > (11.0 + x_6)? (17.0 + x_5) : (11.0 + x_6))? ((3.0 + x_2) > (11.0 + x_4)? (3.0 + x_2) : (11.0 + x_4)) : ((17.0 + x_5) > (11.0 + x_6)? (17.0 + x_5) : (11.0 + x_6))) : (((16.0 + x_7) > (10.0 + x_8)? (16.0 + x_7) : (10.0 + x_8)) > ((2.0 + x_10) > (1.0 + x_11)? (2.0 + x_10) : (1.0 + x_11))? ((16.0 + x_7) > (10.0 + x_8)? (16.0 + x_7) : (10.0 + x_8)) : ((2.0 + x_10) > (1.0 + x_11)? (2.0 + x_10) : (1.0 + x_11)))) > ((((4.0 + x_13) > (4.0 + x_14)? (4.0 + x_13) : (4.0 + x_14)) > ((3.0 + x_18) > (18.0 + x_19)? (3.0 + x_18) : (18.0 + x_19))? ((4.0 + x_13) > (4.0 + x_14)? (4.0 + x_13) : (4.0 + x_14)) : ((3.0 + x_18) > (18.0 + x_19)? (3.0 + x_18) : (18.0 + x_19))) > (((6.0 + x_20) > (10.0 + x_28)? (6.0 + x_20) : (10.0 + x_28)) > ((19.0 + x_30) > (17.0 + x_31)? (19.0 + x_30) : (17.0 + x_31))? ((6.0 + x_20) > (10.0 + x_28)? (6.0 + x_20) : (10.0 + x_28)) : ((19.0 + x_30) > (17.0 + x_31)? (19.0 + x_30) : (17.0 + x_31)))? (((4.0 + x_13) > (4.0 + x_14)? (4.0 + x_13) : (4.0 + x_14)) > ((3.0 + x_18) > (18.0 + x_19)? (3.0 + x_18) : (18.0 + x_19))? ((4.0 + x_13) > (4.0 + x_14)? (4.0 + x_13) : (4.0 + x_14)) : ((3.0 + x_18) > (18.0 + x_19)? (3.0 + x_18) : (18.0 + x_19))) : (((6.0 + x_20) > (10.0 + x_28)? (6.0 + x_20) : (10.0 + x_28)) > ((19.0 + x_30) > (17.0 + x_31)? (19.0 + x_30) : (17.0 + x_31))? ((6.0 + x_20) > (10.0 + x_28)? (6.0 + x_20) : (10.0 + x_28)) : ((19.0 + x_30) > (17.0 + x_31)? (19.0 + x_30) : (17.0 + x_31))))? ((((3.0 + x_2) > (11.0 + x_4)? (3.0 + x_2) : (11.0 + x_4)) > ((17.0 + x_5) > (11.0 + x_6)? (17.0 + x_5) : (11.0 + x_6))? ((3.0 + x_2) > (11.0 + x_4)? (3.0 + x_2) : (11.0 + x_4)) : ((17.0 + x_5) > (11.0 + x_6)? (17.0 + x_5) : (11.0 + x_6))) > (((16.0 + x_7) > (10.0 + x_8)? (16.0 + x_7) : (10.0 + x_8)) > ((2.0 + x_10) > (1.0 + x_11)? (2.0 + x_10) : (1.0 + x_11))? ((16.0 + x_7) > (10.0 + x_8)? (16.0 + x_7) : (10.0 + x_8)) : ((2.0 + x_10) > (1.0 + x_11)? (2.0 + x_10) : (1.0 + x_11)))? (((3.0 + x_2) > (11.0 + x_4)? (3.0 + x_2) : (11.0 + x_4)) > ((17.0 + x_5) > (11.0 + x_6)? (17.0 + x_5) : (11.0 + x_6))? ((3.0 + x_2) > (11.0 + x_4)? (3.0 + x_2) : (11.0 + x_4)) : ((17.0 + x_5) > (11.0 + x_6)? (17.0 + x_5) : (11.0 + x_6))) : (((16.0 + x_7) > (10.0 + x_8)? (16.0 + x_7) : (10.0 + x_8)) > ((2.0 + x_10) > (1.0 + x_11)? (2.0 + x_10) : (1.0 + x_11))? ((16.0 + x_7) > (10.0 + x_8)? (16.0 + x_7) : (10.0 + x_8)) : ((2.0 + x_10) > (1.0 + x_11)? (2.0 + x_10) : (1.0 + x_11)))) : ((((4.0 + x_13) > (4.0 + x_14)? (4.0 + x_13) : (4.0 + x_14)) > ((3.0 + x_18) > (18.0 + x_19)? (3.0 + x_18) : (18.0 + x_19))? ((4.0 + x_13) > (4.0 + x_14)? (4.0 + x_13) : (4.0 + x_14)) : ((3.0 + x_18) > (18.0 + x_19)? (3.0 + x_18) : (18.0 + x_19))) > (((6.0 + x_20) > (10.0 + x_28)? (6.0 + x_20) : (10.0 + x_28)) > ((19.0 + x_30) > (17.0 + x_31)? (19.0 + x_30) : (17.0 + x_31))? ((6.0 + x_20) > (10.0 + x_28)? (6.0 + x_20) : (10.0 + x_28)) : ((19.0 + x_30) > (17.0 + x_31)? (19.0 + x_30) : (17.0 + x_31)))? (((4.0 + x_13) > (4.0 + x_14)? (4.0 + x_13) : (4.0 + x_14)) > ((3.0 + x_18) > (18.0 + x_19)? (3.0 + x_18) : (18.0 + x_19))? ((4.0 + x_13) > (4.0 + x_14)? (4.0 + x_13) : (4.0 + x_14)) : ((3.0 + x_18) > (18.0 + x_19)? (3.0 + x_18) : (18.0 + x_19))) : (((6.0 + x_20) > (10.0 + x_28)? (6.0 + x_20) : (10.0 + x_28)) > ((19.0 + x_30) > (17.0 + x_31)? (19.0 + x_30) : (17.0 + x_31))? ((6.0 + x_20) > (10.0 + x_28)? (6.0 + x_20) : (10.0 + x_28)) : ((19.0 + x_30) > (17.0 + x_31)? (19.0 + x_30) : (17.0 + x_31))))); x_19_ = (((((7.0 + x_1) > (1.0 + x_2)? (7.0 + x_1) : (1.0 + x_2)) > ((5.0 + x_4) > (1.0 + x_7)? (5.0 + x_4) : (1.0 + x_7))? ((7.0 + x_1) > (1.0 + x_2)? (7.0 + x_1) : (1.0 + x_2)) : ((5.0 + x_4) > (1.0 + x_7)? (5.0 + x_4) : (1.0 + x_7))) > (((18.0 + x_9) > (15.0 + x_12)? (18.0 + x_9) : (15.0 + x_12)) > ((9.0 + x_13) > (16.0 + x_15)? (9.0 + x_13) : (16.0 + x_15))? ((18.0 + x_9) > (15.0 + x_12)? (18.0 + x_9) : (15.0 + x_12)) : ((9.0 + x_13) > (16.0 + x_15)? (9.0 + x_13) : (16.0 + x_15)))? (((7.0 + x_1) > (1.0 + x_2)? (7.0 + x_1) : (1.0 + x_2)) > ((5.0 + x_4) > (1.0 + x_7)? (5.0 + x_4) : (1.0 + x_7))? ((7.0 + x_1) > (1.0 + x_2)? (7.0 + x_1) : (1.0 + x_2)) : ((5.0 + x_4) > (1.0 + x_7)? (5.0 + x_4) : (1.0 + x_7))) : (((18.0 + x_9) > (15.0 + x_12)? (18.0 + x_9) : (15.0 + x_12)) > ((9.0 + x_13) > (16.0 + x_15)? (9.0 + x_13) : (16.0 + x_15))? ((18.0 + x_9) > (15.0 + x_12)? (18.0 + x_9) : (15.0 + x_12)) : ((9.0 + x_13) > (16.0 + x_15)? (9.0 + x_13) : (16.0 + x_15)))) > ((((5.0 + x_18) > (19.0 + x_20)? (5.0 + x_18) : (19.0 + x_20)) > ((11.0 + x_21) > (5.0 + x_26)? (11.0 + x_21) : (5.0 + x_26))? ((5.0 + x_18) > (19.0 + x_20)? (5.0 + x_18) : (19.0 + x_20)) : ((11.0 + x_21) > (5.0 + x_26)? (11.0 + x_21) : (5.0 + x_26))) > (((12.0 + x_27) > (17.0 + x_28)? (12.0 + x_27) : (17.0 + x_28)) > ((10.0 + x_30) > (16.0 + x_31)? (10.0 + x_30) : (16.0 + x_31))? ((12.0 + x_27) > (17.0 + x_28)? (12.0 + x_27) : (17.0 + x_28)) : ((10.0 + x_30) > (16.0 + x_31)? (10.0 + x_30) : (16.0 + x_31)))? (((5.0 + x_18) > (19.0 + x_20)? (5.0 + x_18) : (19.0 + x_20)) > ((11.0 + x_21) > (5.0 + x_26)? (11.0 + x_21) : (5.0 + x_26))? ((5.0 + x_18) > (19.0 + x_20)? (5.0 + x_18) : (19.0 + x_20)) : ((11.0 + x_21) > (5.0 + x_26)? (11.0 + x_21) : (5.0 + x_26))) : (((12.0 + x_27) > (17.0 + x_28)? (12.0 + x_27) : (17.0 + x_28)) > ((10.0 + x_30) > (16.0 + x_31)? (10.0 + x_30) : (16.0 + x_31))? ((12.0 + x_27) > (17.0 + x_28)? (12.0 + x_27) : (17.0 + x_28)) : ((10.0 + x_30) > (16.0 + x_31)? (10.0 + x_30) : (16.0 + x_31))))? ((((7.0 + x_1) > (1.0 + x_2)? (7.0 + x_1) : (1.0 + x_2)) > ((5.0 + x_4) > (1.0 + x_7)? (5.0 + x_4) : (1.0 + x_7))? ((7.0 + x_1) > (1.0 + x_2)? (7.0 + x_1) : (1.0 + x_2)) : ((5.0 + x_4) > (1.0 + x_7)? (5.0 + x_4) : (1.0 + x_7))) > (((18.0 + x_9) > (15.0 + x_12)? (18.0 + x_9) : (15.0 + x_12)) > ((9.0 + x_13) > (16.0 + x_15)? (9.0 + x_13) : (16.0 + x_15))? ((18.0 + x_9) > (15.0 + x_12)? (18.0 + x_9) : (15.0 + x_12)) : ((9.0 + x_13) > (16.0 + x_15)? (9.0 + x_13) : (16.0 + x_15)))? (((7.0 + x_1) > (1.0 + x_2)? (7.0 + x_1) : (1.0 + x_2)) > ((5.0 + x_4) > (1.0 + x_7)? (5.0 + x_4) : (1.0 + x_7))? ((7.0 + x_1) > (1.0 + x_2)? (7.0 + x_1) : (1.0 + x_2)) : ((5.0 + x_4) > (1.0 + x_7)? (5.0 + x_4) : (1.0 + x_7))) : (((18.0 + x_9) > (15.0 + x_12)? (18.0 + x_9) : (15.0 + x_12)) > ((9.0 + x_13) > (16.0 + x_15)? (9.0 + x_13) : (16.0 + x_15))? ((18.0 + x_9) > (15.0 + x_12)? (18.0 + x_9) : (15.0 + x_12)) : ((9.0 + x_13) > (16.0 + x_15)? (9.0 + x_13) : (16.0 + x_15)))) : ((((5.0 + x_18) > (19.0 + x_20)? (5.0 + x_18) : (19.0 + x_20)) > ((11.0 + x_21) > (5.0 + x_26)? (11.0 + x_21) : (5.0 + x_26))? ((5.0 + x_18) > (19.0 + x_20)? (5.0 + x_18) : (19.0 + x_20)) : ((11.0 + x_21) > (5.0 + x_26)? (11.0 + x_21) : (5.0 + x_26))) > (((12.0 + x_27) > (17.0 + x_28)? (12.0 + x_27) : (17.0 + x_28)) > ((10.0 + x_30) > (16.0 + x_31)? (10.0 + x_30) : (16.0 + x_31))? ((12.0 + x_27) > (17.0 + x_28)? (12.0 + x_27) : (17.0 + x_28)) : ((10.0 + x_30) > (16.0 + x_31)? (10.0 + x_30) : (16.0 + x_31)))? (((5.0 + x_18) > (19.0 + x_20)? (5.0 + x_18) : (19.0 + x_20)) > ((11.0 + x_21) > (5.0 + x_26)? (11.0 + x_21) : (5.0 + x_26))? ((5.0 + x_18) > (19.0 + x_20)? (5.0 + x_18) : (19.0 + x_20)) : ((11.0 + x_21) > (5.0 + x_26)? (11.0 + x_21) : (5.0 + x_26))) : (((12.0 + x_27) > (17.0 + x_28)? (12.0 + x_27) : (17.0 + x_28)) > ((10.0 + x_30) > (16.0 + x_31)? (10.0 + x_30) : (16.0 + x_31))? ((12.0 + x_27) > (17.0 + x_28)? (12.0 + x_27) : (17.0 + x_28)) : ((10.0 + x_30) > (16.0 + x_31)? (10.0 + x_30) : (16.0 + x_31))))); x_20_ = (((((13.0 + x_0) > (5.0 + x_1)? (13.0 + x_0) : (5.0 + x_1)) > ((7.0 + x_2) > (19.0 + x_7)? (7.0 + x_2) : (19.0 + x_7))? ((13.0 + x_0) > (5.0 + x_1)? (13.0 + x_0) : (5.0 + x_1)) : ((7.0 + x_2) > (19.0 + x_7)? (7.0 + x_2) : (19.0 + x_7))) > (((3.0 + x_8) > (10.0 + x_9)? (3.0 + x_8) : (10.0 + x_9)) > ((8.0 + x_10) > (13.0 + x_12)? (8.0 + x_10) : (13.0 + x_12))? ((3.0 + x_8) > (10.0 + x_9)? (3.0 + x_8) : (10.0 + x_9)) : ((8.0 + x_10) > (13.0 + x_12)? (8.0 + x_10) : (13.0 + x_12)))? (((13.0 + x_0) > (5.0 + x_1)? (13.0 + x_0) : (5.0 + x_1)) > ((7.0 + x_2) > (19.0 + x_7)? (7.0 + x_2) : (19.0 + x_7))? ((13.0 + x_0) > (5.0 + x_1)? (13.0 + x_0) : (5.0 + x_1)) : ((7.0 + x_2) > (19.0 + x_7)? (7.0 + x_2) : (19.0 + x_7))) : (((3.0 + x_8) > (10.0 + x_9)? (3.0 + x_8) : (10.0 + x_9)) > ((8.0 + x_10) > (13.0 + x_12)? (8.0 + x_10) : (13.0 + x_12))? ((3.0 + x_8) > (10.0 + x_9)? (3.0 + x_8) : (10.0 + x_9)) : ((8.0 + x_10) > (13.0 + x_12)? (8.0 + x_10) : (13.0 + x_12)))) > ((((1.0 + x_13) > (7.0 + x_17)? (1.0 + x_13) : (7.0 + x_17)) > ((8.0 + x_19) > (1.0 + x_21)? (8.0 + x_19) : (1.0 + x_21))? ((1.0 + x_13) > (7.0 + x_17)? (1.0 + x_13) : (7.0 + x_17)) : ((8.0 + x_19) > (1.0 + x_21)? (8.0 + x_19) : (1.0 + x_21))) > (((8.0 + x_23) > (1.0 + x_26)? (8.0 + x_23) : (1.0 + x_26)) > ((17.0 + x_29) > (20.0 + x_30)? (17.0 + x_29) : (20.0 + x_30))? ((8.0 + x_23) > (1.0 + x_26)? (8.0 + x_23) : (1.0 + x_26)) : ((17.0 + x_29) > (20.0 + x_30)? (17.0 + x_29) : (20.0 + x_30)))? (((1.0 + x_13) > (7.0 + x_17)? (1.0 + x_13) : (7.0 + x_17)) > ((8.0 + x_19) > (1.0 + x_21)? (8.0 + x_19) : (1.0 + x_21))? ((1.0 + x_13) > (7.0 + x_17)? (1.0 + x_13) : (7.0 + x_17)) : ((8.0 + x_19) > (1.0 + x_21)? (8.0 + x_19) : (1.0 + x_21))) : (((8.0 + x_23) > (1.0 + x_26)? (8.0 + x_23) : (1.0 + x_26)) > ((17.0 + x_29) > (20.0 + x_30)? (17.0 + x_29) : (20.0 + x_30))? ((8.0 + x_23) > (1.0 + x_26)? (8.0 + x_23) : (1.0 + x_26)) : ((17.0 + x_29) > (20.0 + x_30)? (17.0 + x_29) : (20.0 + x_30))))? ((((13.0 + x_0) > (5.0 + x_1)? (13.0 + x_0) : (5.0 + x_1)) > ((7.0 + x_2) > (19.0 + x_7)? (7.0 + x_2) : (19.0 + x_7))? ((13.0 + x_0) > (5.0 + x_1)? (13.0 + x_0) : (5.0 + x_1)) : ((7.0 + x_2) > (19.0 + x_7)? (7.0 + x_2) : (19.0 + x_7))) > (((3.0 + x_8) > (10.0 + x_9)? (3.0 + x_8) : (10.0 + x_9)) > ((8.0 + x_10) > (13.0 + x_12)? (8.0 + x_10) : (13.0 + x_12))? ((3.0 + x_8) > (10.0 + x_9)? (3.0 + x_8) : (10.0 + x_9)) : ((8.0 + x_10) > (13.0 + x_12)? (8.0 + x_10) : (13.0 + x_12)))? (((13.0 + x_0) > (5.0 + x_1)? (13.0 + x_0) : (5.0 + x_1)) > ((7.0 + x_2) > (19.0 + x_7)? (7.0 + x_2) : (19.0 + x_7))? ((13.0 + x_0) > (5.0 + x_1)? (13.0 + x_0) : (5.0 + x_1)) : ((7.0 + x_2) > (19.0 + x_7)? (7.0 + x_2) : (19.0 + x_7))) : (((3.0 + x_8) > (10.0 + x_9)? (3.0 + x_8) : (10.0 + x_9)) > ((8.0 + x_10) > (13.0 + x_12)? (8.0 + x_10) : (13.0 + x_12))? ((3.0 + x_8) > (10.0 + x_9)? (3.0 + x_8) : (10.0 + x_9)) : ((8.0 + x_10) > (13.0 + x_12)? (8.0 + x_10) : (13.0 + x_12)))) : ((((1.0 + x_13) > (7.0 + x_17)? (1.0 + x_13) : (7.0 + x_17)) > ((8.0 + x_19) > (1.0 + x_21)? (8.0 + x_19) : (1.0 + x_21))? ((1.0 + x_13) > (7.0 + x_17)? (1.0 + x_13) : (7.0 + x_17)) : ((8.0 + x_19) > (1.0 + x_21)? (8.0 + x_19) : (1.0 + x_21))) > (((8.0 + x_23) > (1.0 + x_26)? (8.0 + x_23) : (1.0 + x_26)) > ((17.0 + x_29) > (20.0 + x_30)? (17.0 + x_29) : (20.0 + x_30))? ((8.0 + x_23) > (1.0 + x_26)? (8.0 + x_23) : (1.0 + x_26)) : ((17.0 + x_29) > (20.0 + x_30)? (17.0 + x_29) : (20.0 + x_30)))? (((1.0 + x_13) > (7.0 + x_17)? (1.0 + x_13) : (7.0 + x_17)) > ((8.0 + x_19) > (1.0 + x_21)? (8.0 + x_19) : (1.0 + x_21))? ((1.0 + x_13) > (7.0 + x_17)? (1.0 + x_13) : (7.0 + x_17)) : ((8.0 + x_19) > (1.0 + x_21)? (8.0 + x_19) : (1.0 + x_21))) : (((8.0 + x_23) > (1.0 + x_26)? (8.0 + x_23) : (1.0 + x_26)) > ((17.0 + x_29) > (20.0 + x_30)? (17.0 + x_29) : (20.0 + x_30))? ((8.0 + x_23) > (1.0 + x_26)? (8.0 + x_23) : (1.0 + x_26)) : ((17.0 + x_29) > (20.0 + x_30)? (17.0 + x_29) : (20.0 + x_30))))); x_21_ = (((((11.0 + x_0) > (10.0 + x_1)? (11.0 + x_0) : (10.0 + x_1)) > ((9.0 + x_5) > (8.0 + x_8)? (9.0 + x_5) : (8.0 + x_8))? ((11.0 + x_0) > (10.0 + x_1)? (11.0 + x_0) : (10.0 + x_1)) : ((9.0 + x_5) > (8.0 + x_8)? (9.0 + x_5) : (8.0 + x_8))) > (((16.0 + x_12) > (1.0 + x_15)? (16.0 + x_12) : (1.0 + x_15)) > ((3.0 + x_17) > (11.0 + x_19)? (3.0 + x_17) : (11.0 + x_19))? ((16.0 + x_12) > (1.0 + x_15)? (16.0 + x_12) : (1.0 + x_15)) : ((3.0 + x_17) > (11.0 + x_19)? (3.0 + x_17) : (11.0 + x_19)))? (((11.0 + x_0) > (10.0 + x_1)? (11.0 + x_0) : (10.0 + x_1)) > ((9.0 + x_5) > (8.0 + x_8)? (9.0 + x_5) : (8.0 + x_8))? ((11.0 + x_0) > (10.0 + x_1)? (11.0 + x_0) : (10.0 + x_1)) : ((9.0 + x_5) > (8.0 + x_8)? (9.0 + x_5) : (8.0 + x_8))) : (((16.0 + x_12) > (1.0 + x_15)? (16.0 + x_12) : (1.0 + x_15)) > ((3.0 + x_17) > (11.0 + x_19)? (3.0 + x_17) : (11.0 + x_19))? ((16.0 + x_12) > (1.0 + x_15)? (16.0 + x_12) : (1.0 + x_15)) : ((3.0 + x_17) > (11.0 + x_19)? (3.0 + x_17) : (11.0 + x_19)))) > ((((11.0 + x_20) > (14.0 + x_22)? (11.0 + x_20) : (14.0 + x_22)) > ((20.0 + x_24) > (6.0 + x_26)? (20.0 + x_24) : (6.0 + x_26))? ((11.0 + x_20) > (14.0 + x_22)? (11.0 + x_20) : (14.0 + x_22)) : ((20.0 + x_24) > (6.0 + x_26)? (20.0 + x_24) : (6.0 + x_26))) > (((5.0 + x_27) > (2.0 + x_28)? (5.0 + x_27) : (2.0 + x_28)) > ((2.0 + x_30) > (19.0 + x_31)? (2.0 + x_30) : (19.0 + x_31))? ((5.0 + x_27) > (2.0 + x_28)? (5.0 + x_27) : (2.0 + x_28)) : ((2.0 + x_30) > (19.0 + x_31)? (2.0 + x_30) : (19.0 + x_31)))? (((11.0 + x_20) > (14.0 + x_22)? (11.0 + x_20) : (14.0 + x_22)) > ((20.0 + x_24) > (6.0 + x_26)? (20.0 + x_24) : (6.0 + x_26))? ((11.0 + x_20) > (14.0 + x_22)? (11.0 + x_20) : (14.0 + x_22)) : ((20.0 + x_24) > (6.0 + x_26)? (20.0 + x_24) : (6.0 + x_26))) : (((5.0 + x_27) > (2.0 + x_28)? (5.0 + x_27) : (2.0 + x_28)) > ((2.0 + x_30) > (19.0 + x_31)? (2.0 + x_30) : (19.0 + x_31))? ((5.0 + x_27) > (2.0 + x_28)? (5.0 + x_27) : (2.0 + x_28)) : ((2.0 + x_30) > (19.0 + x_31)? (2.0 + x_30) : (19.0 + x_31))))? ((((11.0 + x_0) > (10.0 + x_1)? (11.0 + x_0) : (10.0 + x_1)) > ((9.0 + x_5) > (8.0 + x_8)? (9.0 + x_5) : (8.0 + x_8))? ((11.0 + x_0) > (10.0 + x_1)? (11.0 + x_0) : (10.0 + x_1)) : ((9.0 + x_5) > (8.0 + x_8)? (9.0 + x_5) : (8.0 + x_8))) > (((16.0 + x_12) > (1.0 + x_15)? (16.0 + x_12) : (1.0 + x_15)) > ((3.0 + x_17) > (11.0 + x_19)? (3.0 + x_17) : (11.0 + x_19))? ((16.0 + x_12) > (1.0 + x_15)? (16.0 + x_12) : (1.0 + x_15)) : ((3.0 + x_17) > (11.0 + x_19)? (3.0 + x_17) : (11.0 + x_19)))? (((11.0 + x_0) > (10.0 + x_1)? (11.0 + x_0) : (10.0 + x_1)) > ((9.0 + x_5) > (8.0 + x_8)? (9.0 + x_5) : (8.0 + x_8))? ((11.0 + x_0) > (10.0 + x_1)? (11.0 + x_0) : (10.0 + x_1)) : ((9.0 + x_5) > (8.0 + x_8)? (9.0 + x_5) : (8.0 + x_8))) : (((16.0 + x_12) > (1.0 + x_15)? (16.0 + x_12) : (1.0 + x_15)) > ((3.0 + x_17) > (11.0 + x_19)? (3.0 + x_17) : (11.0 + x_19))? ((16.0 + x_12) > (1.0 + x_15)? (16.0 + x_12) : (1.0 + x_15)) : ((3.0 + x_17) > (11.0 + x_19)? (3.0 + x_17) : (11.0 + x_19)))) : ((((11.0 + x_20) > (14.0 + x_22)? (11.0 + x_20) : (14.0 + x_22)) > ((20.0 + x_24) > (6.0 + x_26)? (20.0 + x_24) : (6.0 + x_26))? ((11.0 + x_20) > (14.0 + x_22)? (11.0 + x_20) : (14.0 + x_22)) : ((20.0 + x_24) > (6.0 + x_26)? (20.0 + x_24) : (6.0 + x_26))) > (((5.0 + x_27) > (2.0 + x_28)? (5.0 + x_27) : (2.0 + x_28)) > ((2.0 + x_30) > (19.0 + x_31)? (2.0 + x_30) : (19.0 + x_31))? ((5.0 + x_27) > (2.0 + x_28)? (5.0 + x_27) : (2.0 + x_28)) : ((2.0 + x_30) > (19.0 + x_31)? (2.0 + x_30) : (19.0 + x_31)))? (((11.0 + x_20) > (14.0 + x_22)? (11.0 + x_20) : (14.0 + x_22)) > ((20.0 + x_24) > (6.0 + x_26)? (20.0 + x_24) : (6.0 + x_26))? ((11.0 + x_20) > (14.0 + x_22)? (11.0 + x_20) : (14.0 + x_22)) : ((20.0 + x_24) > (6.0 + x_26)? (20.0 + x_24) : (6.0 + x_26))) : (((5.0 + x_27) > (2.0 + x_28)? (5.0 + x_27) : (2.0 + x_28)) > ((2.0 + x_30) > (19.0 + x_31)? (2.0 + x_30) : (19.0 + x_31))? ((5.0 + x_27) > (2.0 + x_28)? (5.0 + x_27) : (2.0 + x_28)) : ((2.0 + x_30) > (19.0 + x_31)? (2.0 + x_30) : (19.0 + x_31))))); x_22_ = (((((9.0 + x_0) > (16.0 + x_3)? (9.0 + x_0) : (16.0 + x_3)) > ((17.0 + x_4) > (1.0 + x_5)? (17.0 + x_4) : (1.0 + x_5))? ((9.0 + x_0) > (16.0 + x_3)? (9.0 + x_0) : (16.0 + x_3)) : ((17.0 + x_4) > (1.0 + x_5)? (17.0 + x_4) : (1.0 + x_5))) > (((18.0 + x_9) > (5.0 + x_10)? (18.0 + x_9) : (5.0 + x_10)) > ((15.0 + x_12) > (9.0 + x_13)? (15.0 + x_12) : (9.0 + x_13))? ((18.0 + x_9) > (5.0 + x_10)? (18.0 + x_9) : (5.0 + x_10)) : ((15.0 + x_12) > (9.0 + x_13)? (15.0 + x_12) : (9.0 + x_13)))? (((9.0 + x_0) > (16.0 + x_3)? (9.0 + x_0) : (16.0 + x_3)) > ((17.0 + x_4) > (1.0 + x_5)? (17.0 + x_4) : (1.0 + x_5))? ((9.0 + x_0) > (16.0 + x_3)? (9.0 + x_0) : (16.0 + x_3)) : ((17.0 + x_4) > (1.0 + x_5)? (17.0 + x_4) : (1.0 + x_5))) : (((18.0 + x_9) > (5.0 + x_10)? (18.0 + x_9) : (5.0 + x_10)) > ((15.0 + x_12) > (9.0 + x_13)? (15.0 + x_12) : (9.0 + x_13))? ((18.0 + x_9) > (5.0 + x_10)? (18.0 + x_9) : (5.0 + x_10)) : ((15.0 + x_12) > (9.0 + x_13)? (15.0 + x_12) : (9.0 + x_13)))) > ((((14.0 + x_17) > (12.0 + x_18)? (14.0 + x_17) : (12.0 + x_18)) > ((2.0 + x_19) > (18.0 + x_22)? (2.0 + x_19) : (18.0 + x_22))? ((14.0 + x_17) > (12.0 + x_18)? (14.0 + x_17) : (12.0 + x_18)) : ((2.0 + x_19) > (18.0 + x_22)? (2.0 + x_19) : (18.0 + x_22))) > (((17.0 + x_23) > (10.0 + x_27)? (17.0 + x_23) : (10.0 + x_27)) > ((20.0 + x_30) > (14.0 + x_31)? (20.0 + x_30) : (14.0 + x_31))? ((17.0 + x_23) > (10.0 + x_27)? (17.0 + x_23) : (10.0 + x_27)) : ((20.0 + x_30) > (14.0 + x_31)? (20.0 + x_30) : (14.0 + x_31)))? (((14.0 + x_17) > (12.0 + x_18)? (14.0 + x_17) : (12.0 + x_18)) > ((2.0 + x_19) > (18.0 + x_22)? (2.0 + x_19) : (18.0 + x_22))? ((14.0 + x_17) > (12.0 + x_18)? (14.0 + x_17) : (12.0 + x_18)) : ((2.0 + x_19) > (18.0 + x_22)? (2.0 + x_19) : (18.0 + x_22))) : (((17.0 + x_23) > (10.0 + x_27)? (17.0 + x_23) : (10.0 + x_27)) > ((20.0 + x_30) > (14.0 + x_31)? (20.0 + x_30) : (14.0 + x_31))? ((17.0 + x_23) > (10.0 + x_27)? (17.0 + x_23) : (10.0 + x_27)) : ((20.0 + x_30) > (14.0 + x_31)? (20.0 + x_30) : (14.0 + x_31))))? ((((9.0 + x_0) > (16.0 + x_3)? (9.0 + x_0) : (16.0 + x_3)) > ((17.0 + x_4) > (1.0 + x_5)? (17.0 + x_4) : (1.0 + x_5))? ((9.0 + x_0) > (16.0 + x_3)? (9.0 + x_0) : (16.0 + x_3)) : ((17.0 + x_4) > (1.0 + x_5)? (17.0 + x_4) : (1.0 + x_5))) > (((18.0 + x_9) > (5.0 + x_10)? (18.0 + x_9) : (5.0 + x_10)) > ((15.0 + x_12) > (9.0 + x_13)? (15.0 + x_12) : (9.0 + x_13))? ((18.0 + x_9) > (5.0 + x_10)? (18.0 + x_9) : (5.0 + x_10)) : ((15.0 + x_12) > (9.0 + x_13)? (15.0 + x_12) : (9.0 + x_13)))? (((9.0 + x_0) > (16.0 + x_3)? (9.0 + x_0) : (16.0 + x_3)) > ((17.0 + x_4) > (1.0 + x_5)? (17.0 + x_4) : (1.0 + x_5))? ((9.0 + x_0) > (16.0 + x_3)? (9.0 + x_0) : (16.0 + x_3)) : ((17.0 + x_4) > (1.0 + x_5)? (17.0 + x_4) : (1.0 + x_5))) : (((18.0 + x_9) > (5.0 + x_10)? (18.0 + x_9) : (5.0 + x_10)) > ((15.0 + x_12) > (9.0 + x_13)? (15.0 + x_12) : (9.0 + x_13))? ((18.0 + x_9) > (5.0 + x_10)? (18.0 + x_9) : (5.0 + x_10)) : ((15.0 + x_12) > (9.0 + x_13)? (15.0 + x_12) : (9.0 + x_13)))) : ((((14.0 + x_17) > (12.0 + x_18)? (14.0 + x_17) : (12.0 + x_18)) > ((2.0 + x_19) > (18.0 + x_22)? (2.0 + x_19) : (18.0 + x_22))? ((14.0 + x_17) > (12.0 + x_18)? (14.0 + x_17) : (12.0 + x_18)) : ((2.0 + x_19) > (18.0 + x_22)? (2.0 + x_19) : (18.0 + x_22))) > (((17.0 + x_23) > (10.0 + x_27)? (17.0 + x_23) : (10.0 + x_27)) > ((20.0 + x_30) > (14.0 + x_31)? (20.0 + x_30) : (14.0 + x_31))? ((17.0 + x_23) > (10.0 + x_27)? (17.0 + x_23) : (10.0 + x_27)) : ((20.0 + x_30) > (14.0 + x_31)? (20.0 + x_30) : (14.0 + x_31)))? (((14.0 + x_17) > (12.0 + x_18)? (14.0 + x_17) : (12.0 + x_18)) > ((2.0 + x_19) > (18.0 + x_22)? (2.0 + x_19) : (18.0 + x_22))? ((14.0 + x_17) > (12.0 + x_18)? (14.0 + x_17) : (12.0 + x_18)) : ((2.0 + x_19) > (18.0 + x_22)? (2.0 + x_19) : (18.0 + x_22))) : (((17.0 + x_23) > (10.0 + x_27)? (17.0 + x_23) : (10.0 + x_27)) > ((20.0 + x_30) > (14.0 + x_31)? (20.0 + x_30) : (14.0 + x_31))? ((17.0 + x_23) > (10.0 + x_27)? (17.0 + x_23) : (10.0 + x_27)) : ((20.0 + x_30) > (14.0 + x_31)? (20.0 + x_30) : (14.0 + x_31))))); x_23_ = (((((15.0 + x_1) > (10.0 + x_2)? (15.0 + x_1) : (10.0 + x_2)) > ((17.0 + x_3) > (3.0 + x_4)? (17.0 + x_3) : (3.0 + x_4))? ((15.0 + x_1) > (10.0 + x_2)? (15.0 + x_1) : (10.0 + x_2)) : ((17.0 + x_3) > (3.0 + x_4)? (17.0 + x_3) : (3.0 + x_4))) > (((2.0 + x_6) > (15.0 + x_8)? (2.0 + x_6) : (15.0 + x_8)) > ((7.0 + x_13) > (3.0 + x_18)? (7.0 + x_13) : (3.0 + x_18))? ((2.0 + x_6) > (15.0 + x_8)? (2.0 + x_6) : (15.0 + x_8)) : ((7.0 + x_13) > (3.0 + x_18)? (7.0 + x_13) : (3.0 + x_18)))? (((15.0 + x_1) > (10.0 + x_2)? (15.0 + x_1) : (10.0 + x_2)) > ((17.0 + x_3) > (3.0 + x_4)? (17.0 + x_3) : (3.0 + x_4))? ((15.0 + x_1) > (10.0 + x_2)? (15.0 + x_1) : (10.0 + x_2)) : ((17.0 + x_3) > (3.0 + x_4)? (17.0 + x_3) : (3.0 + x_4))) : (((2.0 + x_6) > (15.0 + x_8)? (2.0 + x_6) : (15.0 + x_8)) > ((7.0 + x_13) > (3.0 + x_18)? (7.0 + x_13) : (3.0 + x_18))? ((2.0 + x_6) > (15.0 + x_8)? (2.0 + x_6) : (15.0 + x_8)) : ((7.0 + x_13) > (3.0 + x_18)? (7.0 + x_13) : (3.0 + x_18)))) > ((((1.0 + x_19) > (13.0 + x_20)? (1.0 + x_19) : (13.0 + x_20)) > ((20.0 + x_21) > (3.0 + x_23)? (20.0 + x_21) : (3.0 + x_23))? ((1.0 + x_19) > (13.0 + x_20)? (1.0 + x_19) : (13.0 + x_20)) : ((20.0 + x_21) > (3.0 + x_23)? (20.0 + x_21) : (3.0 + x_23))) > (((3.0 + x_24) > (5.0 + x_25)? (3.0 + x_24) : (5.0 + x_25)) > ((6.0 + x_28) > (7.0 + x_31)? (6.0 + x_28) : (7.0 + x_31))? ((3.0 + x_24) > (5.0 + x_25)? (3.0 + x_24) : (5.0 + x_25)) : ((6.0 + x_28) > (7.0 + x_31)? (6.0 + x_28) : (7.0 + x_31)))? (((1.0 + x_19) > (13.0 + x_20)? (1.0 + x_19) : (13.0 + x_20)) > ((20.0 + x_21) > (3.0 + x_23)? (20.0 + x_21) : (3.0 + x_23))? ((1.0 + x_19) > (13.0 + x_20)? (1.0 + x_19) : (13.0 + x_20)) : ((20.0 + x_21) > (3.0 + x_23)? (20.0 + x_21) : (3.0 + x_23))) : (((3.0 + x_24) > (5.0 + x_25)? (3.0 + x_24) : (5.0 + x_25)) > ((6.0 + x_28) > (7.0 + x_31)? (6.0 + x_28) : (7.0 + x_31))? ((3.0 + x_24) > (5.0 + x_25)? (3.0 + x_24) : (5.0 + x_25)) : ((6.0 + x_28) > (7.0 + x_31)? (6.0 + x_28) : (7.0 + x_31))))? ((((15.0 + x_1) > (10.0 + x_2)? (15.0 + x_1) : (10.0 + x_2)) > ((17.0 + x_3) > (3.0 + x_4)? (17.0 + x_3) : (3.0 + x_4))? ((15.0 + x_1) > (10.0 + x_2)? (15.0 + x_1) : (10.0 + x_2)) : ((17.0 + x_3) > (3.0 + x_4)? (17.0 + x_3) : (3.0 + x_4))) > (((2.0 + x_6) > (15.0 + x_8)? (2.0 + x_6) : (15.0 + x_8)) > ((7.0 + x_13) > (3.0 + x_18)? (7.0 + x_13) : (3.0 + x_18))? ((2.0 + x_6) > (15.0 + x_8)? (2.0 + x_6) : (15.0 + x_8)) : ((7.0 + x_13) > (3.0 + x_18)? (7.0 + x_13) : (3.0 + x_18)))? (((15.0 + x_1) > (10.0 + x_2)? (15.0 + x_1) : (10.0 + x_2)) > ((17.0 + x_3) > (3.0 + x_4)? (17.0 + x_3) : (3.0 + x_4))? ((15.0 + x_1) > (10.0 + x_2)? (15.0 + x_1) : (10.0 + x_2)) : ((17.0 + x_3) > (3.0 + x_4)? (17.0 + x_3) : (3.0 + x_4))) : (((2.0 + x_6) > (15.0 + x_8)? (2.0 + x_6) : (15.0 + x_8)) > ((7.0 + x_13) > (3.0 + x_18)? (7.0 + x_13) : (3.0 + x_18))? ((2.0 + x_6) > (15.0 + x_8)? (2.0 + x_6) : (15.0 + x_8)) : ((7.0 + x_13) > (3.0 + x_18)? (7.0 + x_13) : (3.0 + x_18)))) : ((((1.0 + x_19) > (13.0 + x_20)? (1.0 + x_19) : (13.0 + x_20)) > ((20.0 + x_21) > (3.0 + x_23)? (20.0 + x_21) : (3.0 + x_23))? ((1.0 + x_19) > (13.0 + x_20)? (1.0 + x_19) : (13.0 + x_20)) : ((20.0 + x_21) > (3.0 + x_23)? (20.0 + x_21) : (3.0 + x_23))) > (((3.0 + x_24) > (5.0 + x_25)? (3.0 + x_24) : (5.0 + x_25)) > ((6.0 + x_28) > (7.0 + x_31)? (6.0 + x_28) : (7.0 + x_31))? ((3.0 + x_24) > (5.0 + x_25)? (3.0 + x_24) : (5.0 + x_25)) : ((6.0 + x_28) > (7.0 + x_31)? (6.0 + x_28) : (7.0 + x_31)))? (((1.0 + x_19) > (13.0 + x_20)? (1.0 + x_19) : (13.0 + x_20)) > ((20.0 + x_21) > (3.0 + x_23)? (20.0 + x_21) : (3.0 + x_23))? ((1.0 + x_19) > (13.0 + x_20)? (1.0 + x_19) : (13.0 + x_20)) : ((20.0 + x_21) > (3.0 + x_23)? (20.0 + x_21) : (3.0 + x_23))) : (((3.0 + x_24) > (5.0 + x_25)? (3.0 + x_24) : (5.0 + x_25)) > ((6.0 + x_28) > (7.0 + x_31)? (6.0 + x_28) : (7.0 + x_31))? ((3.0 + x_24) > (5.0 + x_25)? (3.0 + x_24) : (5.0 + x_25)) : ((6.0 + x_28) > (7.0 + x_31)? (6.0 + x_28) : (7.0 + x_31))))); x_24_ = (((((12.0 + x_0) > (6.0 + x_1)? (12.0 + x_0) : (6.0 + x_1)) > ((8.0 + x_3) > (10.0 + x_5)? (8.0 + x_3) : (10.0 + x_5))? ((12.0 + x_0) > (6.0 + x_1)? (12.0 + x_0) : (6.0 + x_1)) : ((8.0 + x_3) > (10.0 + x_5)? (8.0 + x_3) : (10.0 + x_5))) > (((8.0 + x_8) > (1.0 + x_9)? (8.0 + x_8) : (1.0 + x_9)) > ((5.0 + x_13) > (2.0 + x_14)? (5.0 + x_13) : (2.0 + x_14))? ((8.0 + x_8) > (1.0 + x_9)? (8.0 + x_8) : (1.0 + x_9)) : ((5.0 + x_13) > (2.0 + x_14)? (5.0 + x_13) : (2.0 + x_14)))? (((12.0 + x_0) > (6.0 + x_1)? (12.0 + x_0) : (6.0 + x_1)) > ((8.0 + x_3) > (10.0 + x_5)? (8.0 + x_3) : (10.0 + x_5))? ((12.0 + x_0) > (6.0 + x_1)? (12.0 + x_0) : (6.0 + x_1)) : ((8.0 + x_3) > (10.0 + x_5)? (8.0 + x_3) : (10.0 + x_5))) : (((8.0 + x_8) > (1.0 + x_9)? (8.0 + x_8) : (1.0 + x_9)) > ((5.0 + x_13) > (2.0 + x_14)? (5.0 + x_13) : (2.0 + x_14))? ((8.0 + x_8) > (1.0 + x_9)? (8.0 + x_8) : (1.0 + x_9)) : ((5.0 + x_13) > (2.0 + x_14)? (5.0 + x_13) : (2.0 + x_14)))) > ((((6.0 + x_19) > (14.0 + x_20)? (6.0 + x_19) : (14.0 + x_20)) > ((20.0 + x_22) > (4.0 + x_24)? (20.0 + x_22) : (4.0 + x_24))? ((6.0 + x_19) > (14.0 + x_20)? (6.0 + x_19) : (14.0 + x_20)) : ((20.0 + x_22) > (4.0 + x_24)? (20.0 + x_22) : (4.0 + x_24))) > (((15.0 + x_27) > (12.0 + x_29)? (15.0 + x_27) : (12.0 + x_29)) > ((7.0 + x_30) > (12.0 + x_31)? (7.0 + x_30) : (12.0 + x_31))? ((15.0 + x_27) > (12.0 + x_29)? (15.0 + x_27) : (12.0 + x_29)) : ((7.0 + x_30) > (12.0 + x_31)? (7.0 + x_30) : (12.0 + x_31)))? (((6.0 + x_19) > (14.0 + x_20)? (6.0 + x_19) : (14.0 + x_20)) > ((20.0 + x_22) > (4.0 + x_24)? (20.0 + x_22) : (4.0 + x_24))? ((6.0 + x_19) > (14.0 + x_20)? (6.0 + x_19) : (14.0 + x_20)) : ((20.0 + x_22) > (4.0 + x_24)? (20.0 + x_22) : (4.0 + x_24))) : (((15.0 + x_27) > (12.0 + x_29)? (15.0 + x_27) : (12.0 + x_29)) > ((7.0 + x_30) > (12.0 + x_31)? (7.0 + x_30) : (12.0 + x_31))? ((15.0 + x_27) > (12.0 + x_29)? (15.0 + x_27) : (12.0 + x_29)) : ((7.0 + x_30) > (12.0 + x_31)? (7.0 + x_30) : (12.0 + x_31))))? ((((12.0 + x_0) > (6.0 + x_1)? (12.0 + x_0) : (6.0 + x_1)) > ((8.0 + x_3) > (10.0 + x_5)? (8.0 + x_3) : (10.0 + x_5))? ((12.0 + x_0) > (6.0 + x_1)? (12.0 + x_0) : (6.0 + x_1)) : ((8.0 + x_3) > (10.0 + x_5)? (8.0 + x_3) : (10.0 + x_5))) > (((8.0 + x_8) > (1.0 + x_9)? (8.0 + x_8) : (1.0 + x_9)) > ((5.0 + x_13) > (2.0 + x_14)? (5.0 + x_13) : (2.0 + x_14))? ((8.0 + x_8) > (1.0 + x_9)? (8.0 + x_8) : (1.0 + x_9)) : ((5.0 + x_13) > (2.0 + x_14)? (5.0 + x_13) : (2.0 + x_14)))? (((12.0 + x_0) > (6.0 + x_1)? (12.0 + x_0) : (6.0 + x_1)) > ((8.0 + x_3) > (10.0 + x_5)? (8.0 + x_3) : (10.0 + x_5))? ((12.0 + x_0) > (6.0 + x_1)? (12.0 + x_0) : (6.0 + x_1)) : ((8.0 + x_3) > (10.0 + x_5)? (8.0 + x_3) : (10.0 + x_5))) : (((8.0 + x_8) > (1.0 + x_9)? (8.0 + x_8) : (1.0 + x_9)) > ((5.0 + x_13) > (2.0 + x_14)? (5.0 + x_13) : (2.0 + x_14))? ((8.0 + x_8) > (1.0 + x_9)? (8.0 + x_8) : (1.0 + x_9)) : ((5.0 + x_13) > (2.0 + x_14)? (5.0 + x_13) : (2.0 + x_14)))) : ((((6.0 + x_19) > (14.0 + x_20)? (6.0 + x_19) : (14.0 + x_20)) > ((20.0 + x_22) > (4.0 + x_24)? (20.0 + x_22) : (4.0 + x_24))? ((6.0 + x_19) > (14.0 + x_20)? (6.0 + x_19) : (14.0 + x_20)) : ((20.0 + x_22) > (4.0 + x_24)? (20.0 + x_22) : (4.0 + x_24))) > (((15.0 + x_27) > (12.0 + x_29)? (15.0 + x_27) : (12.0 + x_29)) > ((7.0 + x_30) > (12.0 + x_31)? (7.0 + x_30) : (12.0 + x_31))? ((15.0 + x_27) > (12.0 + x_29)? (15.0 + x_27) : (12.0 + x_29)) : ((7.0 + x_30) > (12.0 + x_31)? (7.0 + x_30) : (12.0 + x_31)))? (((6.0 + x_19) > (14.0 + x_20)? (6.0 + x_19) : (14.0 + x_20)) > ((20.0 + x_22) > (4.0 + x_24)? (20.0 + x_22) : (4.0 + x_24))? ((6.0 + x_19) > (14.0 + x_20)? (6.0 + x_19) : (14.0 + x_20)) : ((20.0 + x_22) > (4.0 + x_24)? (20.0 + x_22) : (4.0 + x_24))) : (((15.0 + x_27) > (12.0 + x_29)? (15.0 + x_27) : (12.0 + x_29)) > ((7.0 + x_30) > (12.0 + x_31)? (7.0 + x_30) : (12.0 + x_31))? ((15.0 + x_27) > (12.0 + x_29)? (15.0 + x_27) : (12.0 + x_29)) : ((7.0 + x_30) > (12.0 + x_31)? (7.0 + x_30) : (12.0 + x_31))))); x_25_ = (((((20.0 + x_0) > (20.0 + x_1)? (20.0 + x_0) : (20.0 + x_1)) > ((3.0 + x_3) > (11.0 + x_4)? (3.0 + x_3) : (11.0 + x_4))? ((20.0 + x_0) > (20.0 + x_1)? (20.0 + x_0) : (20.0 + x_1)) : ((3.0 + x_3) > (11.0 + x_4)? (3.0 + x_3) : (11.0 + x_4))) > (((13.0 + x_8) > (1.0 + x_9)? (13.0 + x_8) : (1.0 + x_9)) > ((20.0 + x_10) > (10.0 + x_12)? (20.0 + x_10) : (10.0 + x_12))? ((13.0 + x_8) > (1.0 + x_9)? (13.0 + x_8) : (1.0 + x_9)) : ((20.0 + x_10) > (10.0 + x_12)? (20.0 + x_10) : (10.0 + x_12)))? (((20.0 + x_0) > (20.0 + x_1)? (20.0 + x_0) : (20.0 + x_1)) > ((3.0 + x_3) > (11.0 + x_4)? (3.0 + x_3) : (11.0 + x_4))? ((20.0 + x_0) > (20.0 + x_1)? (20.0 + x_0) : (20.0 + x_1)) : ((3.0 + x_3) > (11.0 + x_4)? (3.0 + x_3) : (11.0 + x_4))) : (((13.0 + x_8) > (1.0 + x_9)? (13.0 + x_8) : (1.0 + x_9)) > ((20.0 + x_10) > (10.0 + x_12)? (20.0 + x_10) : (10.0 + x_12))? ((13.0 + x_8) > (1.0 + x_9)? (13.0 + x_8) : (1.0 + x_9)) : ((20.0 + x_10) > (10.0 + x_12)? (20.0 + x_10) : (10.0 + x_12)))) > ((((16.0 + x_13) > (13.0 + x_16)? (16.0 + x_13) : (13.0 + x_16)) > ((20.0 + x_19) > (1.0 + x_20)? (20.0 + x_19) : (1.0 + x_20))? ((16.0 + x_13) > (13.0 + x_16)? (16.0 + x_13) : (13.0 + x_16)) : ((20.0 + x_19) > (1.0 + x_20)? (20.0 + x_19) : (1.0 + x_20))) > (((16.0 + x_23) > (11.0 + x_26)? (16.0 + x_23) : (11.0 + x_26)) > ((20.0 + x_27) > (14.0 + x_30)? (20.0 + x_27) : (14.0 + x_30))? ((16.0 + x_23) > (11.0 + x_26)? (16.0 + x_23) : (11.0 + x_26)) : ((20.0 + x_27) > (14.0 + x_30)? (20.0 + x_27) : (14.0 + x_30)))? (((16.0 + x_13) > (13.0 + x_16)? (16.0 + x_13) : (13.0 + x_16)) > ((20.0 + x_19) > (1.0 + x_20)? (20.0 + x_19) : (1.0 + x_20))? ((16.0 + x_13) > (13.0 + x_16)? (16.0 + x_13) : (13.0 + x_16)) : ((20.0 + x_19) > (1.0 + x_20)? (20.0 + x_19) : (1.0 + x_20))) : (((16.0 + x_23) > (11.0 + x_26)? (16.0 + x_23) : (11.0 + x_26)) > ((20.0 + x_27) > (14.0 + x_30)? (20.0 + x_27) : (14.0 + x_30))? ((16.0 + x_23) > (11.0 + x_26)? (16.0 + x_23) : (11.0 + x_26)) : ((20.0 + x_27) > (14.0 + x_30)? (20.0 + x_27) : (14.0 + x_30))))? ((((20.0 + x_0) > (20.0 + x_1)? (20.0 + x_0) : (20.0 + x_1)) > ((3.0 + x_3) > (11.0 + x_4)? (3.0 + x_3) : (11.0 + x_4))? ((20.0 + x_0) > (20.0 + x_1)? (20.0 + x_0) : (20.0 + x_1)) : ((3.0 + x_3) > (11.0 + x_4)? (3.0 + x_3) : (11.0 + x_4))) > (((13.0 + x_8) > (1.0 + x_9)? (13.0 + x_8) : (1.0 + x_9)) > ((20.0 + x_10) > (10.0 + x_12)? (20.0 + x_10) : (10.0 + x_12))? ((13.0 + x_8) > (1.0 + x_9)? (13.0 + x_8) : (1.0 + x_9)) : ((20.0 + x_10) > (10.0 + x_12)? (20.0 + x_10) : (10.0 + x_12)))? (((20.0 + x_0) > (20.0 + x_1)? (20.0 + x_0) : (20.0 + x_1)) > ((3.0 + x_3) > (11.0 + x_4)? (3.0 + x_3) : (11.0 + x_4))? ((20.0 + x_0) > (20.0 + x_1)? (20.0 + x_0) : (20.0 + x_1)) : ((3.0 + x_3) > (11.0 + x_4)? (3.0 + x_3) : (11.0 + x_4))) : (((13.0 + x_8) > (1.0 + x_9)? (13.0 + x_8) : (1.0 + x_9)) > ((20.0 + x_10) > (10.0 + x_12)? (20.0 + x_10) : (10.0 + x_12))? ((13.0 + x_8) > (1.0 + x_9)? (13.0 + x_8) : (1.0 + x_9)) : ((20.0 + x_10) > (10.0 + x_12)? (20.0 + x_10) : (10.0 + x_12)))) : ((((16.0 + x_13) > (13.0 + x_16)? (16.0 + x_13) : (13.0 + x_16)) > ((20.0 + x_19) > (1.0 + x_20)? (20.0 + x_19) : (1.0 + x_20))? ((16.0 + x_13) > (13.0 + x_16)? (16.0 + x_13) : (13.0 + x_16)) : ((20.0 + x_19) > (1.0 + x_20)? (20.0 + x_19) : (1.0 + x_20))) > (((16.0 + x_23) > (11.0 + x_26)? (16.0 + x_23) : (11.0 + x_26)) > ((20.0 + x_27) > (14.0 + x_30)? (20.0 + x_27) : (14.0 + x_30))? ((16.0 + x_23) > (11.0 + x_26)? (16.0 + x_23) : (11.0 + x_26)) : ((20.0 + x_27) > (14.0 + x_30)? (20.0 + x_27) : (14.0 + x_30)))? (((16.0 + x_13) > (13.0 + x_16)? (16.0 + x_13) : (13.0 + x_16)) > ((20.0 + x_19) > (1.0 + x_20)? (20.0 + x_19) : (1.0 + x_20))? ((16.0 + x_13) > (13.0 + x_16)? (16.0 + x_13) : (13.0 + x_16)) : ((20.0 + x_19) > (1.0 + x_20)? (20.0 + x_19) : (1.0 + x_20))) : (((16.0 + x_23) > (11.0 + x_26)? (16.0 + x_23) : (11.0 + x_26)) > ((20.0 + x_27) > (14.0 + x_30)? (20.0 + x_27) : (14.0 + x_30))? ((16.0 + x_23) > (11.0 + x_26)? (16.0 + x_23) : (11.0 + x_26)) : ((20.0 + x_27) > (14.0 + x_30)? (20.0 + x_27) : (14.0 + x_30))))); x_26_ = (((((11.0 + x_0) > (7.0 + x_2)? (11.0 + x_0) : (7.0 + x_2)) > ((5.0 + x_4) > (3.0 + x_6)? (5.0 + x_4) : (3.0 + x_6))? ((11.0 + x_0) > (7.0 + x_2)? (11.0 + x_0) : (7.0 + x_2)) : ((5.0 + x_4) > (3.0 + x_6)? (5.0 + x_4) : (3.0 + x_6))) > (((16.0 + x_7) > (6.0 + x_9)? (16.0 + x_7) : (6.0 + x_9)) > ((3.0 + x_10) > (15.0 + x_14)? (3.0 + x_10) : (15.0 + x_14))? ((16.0 + x_7) > (6.0 + x_9)? (16.0 + x_7) : (6.0 + x_9)) : ((3.0 + x_10) > (15.0 + x_14)? (3.0 + x_10) : (15.0 + x_14)))? (((11.0 + x_0) > (7.0 + x_2)? (11.0 + x_0) : (7.0 + x_2)) > ((5.0 + x_4) > (3.0 + x_6)? (5.0 + x_4) : (3.0 + x_6))? ((11.0 + x_0) > (7.0 + x_2)? (11.0 + x_0) : (7.0 + x_2)) : ((5.0 + x_4) > (3.0 + x_6)? (5.0 + x_4) : (3.0 + x_6))) : (((16.0 + x_7) > (6.0 + x_9)? (16.0 + x_7) : (6.0 + x_9)) > ((3.0 + x_10) > (15.0 + x_14)? (3.0 + x_10) : (15.0 + x_14))? ((16.0 + x_7) > (6.0 + x_9)? (16.0 + x_7) : (6.0 + x_9)) : ((3.0 + x_10) > (15.0 + x_14)? (3.0 + x_10) : (15.0 + x_14)))) > ((((6.0 + x_16) > (18.0 + x_18)? (6.0 + x_16) : (18.0 + x_18)) > ((14.0 + x_23) > (8.0 + x_24)? (14.0 + x_23) : (8.0 + x_24))? ((6.0 + x_16) > (18.0 + x_18)? (6.0 + x_16) : (18.0 + x_18)) : ((14.0 + x_23) > (8.0 + x_24)? (14.0 + x_23) : (8.0 + x_24))) > (((1.0 + x_25) > (2.0 + x_26)? (1.0 + x_25) : (2.0 + x_26)) > ((9.0 + x_27) > (6.0 + x_30)? (9.0 + x_27) : (6.0 + x_30))? ((1.0 + x_25) > (2.0 + x_26)? (1.0 + x_25) : (2.0 + x_26)) : ((9.0 + x_27) > (6.0 + x_30)? (9.0 + x_27) : (6.0 + x_30)))? (((6.0 + x_16) > (18.0 + x_18)? (6.0 + x_16) : (18.0 + x_18)) > ((14.0 + x_23) > (8.0 + x_24)? (14.0 + x_23) : (8.0 + x_24))? ((6.0 + x_16) > (18.0 + x_18)? (6.0 + x_16) : (18.0 + x_18)) : ((14.0 + x_23) > (8.0 + x_24)? (14.0 + x_23) : (8.0 + x_24))) : (((1.0 + x_25) > (2.0 + x_26)? (1.0 + x_25) : (2.0 + x_26)) > ((9.0 + x_27) > (6.0 + x_30)? (9.0 + x_27) : (6.0 + x_30))? ((1.0 + x_25) > (2.0 + x_26)? (1.0 + x_25) : (2.0 + x_26)) : ((9.0 + x_27) > (6.0 + x_30)? (9.0 + x_27) : (6.0 + x_30))))? ((((11.0 + x_0) > (7.0 + x_2)? (11.0 + x_0) : (7.0 + x_2)) > ((5.0 + x_4) > (3.0 + x_6)? (5.0 + x_4) : (3.0 + x_6))? ((11.0 + x_0) > (7.0 + x_2)? (11.0 + x_0) : (7.0 + x_2)) : ((5.0 + x_4) > (3.0 + x_6)? (5.0 + x_4) : (3.0 + x_6))) > (((16.0 + x_7) > (6.0 + x_9)? (16.0 + x_7) : (6.0 + x_9)) > ((3.0 + x_10) > (15.0 + x_14)? (3.0 + x_10) : (15.0 + x_14))? ((16.0 + x_7) > (6.0 + x_9)? (16.0 + x_7) : (6.0 + x_9)) : ((3.0 + x_10) > (15.0 + x_14)? (3.0 + x_10) : (15.0 + x_14)))? (((11.0 + x_0) > (7.0 + x_2)? (11.0 + x_0) : (7.0 + x_2)) > ((5.0 + x_4) > (3.0 + x_6)? (5.0 + x_4) : (3.0 + x_6))? ((11.0 + x_0) > (7.0 + x_2)? (11.0 + x_0) : (7.0 + x_2)) : ((5.0 + x_4) > (3.0 + x_6)? (5.0 + x_4) : (3.0 + x_6))) : (((16.0 + x_7) > (6.0 + x_9)? (16.0 + x_7) : (6.0 + x_9)) > ((3.0 + x_10) > (15.0 + x_14)? (3.0 + x_10) : (15.0 + x_14))? ((16.0 + x_7) > (6.0 + x_9)? (16.0 + x_7) : (6.0 + x_9)) : ((3.0 + x_10) > (15.0 + x_14)? (3.0 + x_10) : (15.0 + x_14)))) : ((((6.0 + x_16) > (18.0 + x_18)? (6.0 + x_16) : (18.0 + x_18)) > ((14.0 + x_23) > (8.0 + x_24)? (14.0 + x_23) : (8.0 + x_24))? ((6.0 + x_16) > (18.0 + x_18)? (6.0 + x_16) : (18.0 + x_18)) : ((14.0 + x_23) > (8.0 + x_24)? (14.0 + x_23) : (8.0 + x_24))) > (((1.0 + x_25) > (2.0 + x_26)? (1.0 + x_25) : (2.0 + x_26)) > ((9.0 + x_27) > (6.0 + x_30)? (9.0 + x_27) : (6.0 + x_30))? ((1.0 + x_25) > (2.0 + x_26)? (1.0 + x_25) : (2.0 + x_26)) : ((9.0 + x_27) > (6.0 + x_30)? (9.0 + x_27) : (6.0 + x_30)))? (((6.0 + x_16) > (18.0 + x_18)? (6.0 + x_16) : (18.0 + x_18)) > ((14.0 + x_23) > (8.0 + x_24)? (14.0 + x_23) : (8.0 + x_24))? ((6.0 + x_16) > (18.0 + x_18)? (6.0 + x_16) : (18.0 + x_18)) : ((14.0 + x_23) > (8.0 + x_24)? (14.0 + x_23) : (8.0 + x_24))) : (((1.0 + x_25) > (2.0 + x_26)? (1.0 + x_25) : (2.0 + x_26)) > ((9.0 + x_27) > (6.0 + x_30)? (9.0 + x_27) : (6.0 + x_30))? ((1.0 + x_25) > (2.0 + x_26)? (1.0 + x_25) : (2.0 + x_26)) : ((9.0 + x_27) > (6.0 + x_30)? (9.0 + x_27) : (6.0 + x_30))))); x_27_ = (((((7.0 + x_1) > (14.0 + x_5)? (7.0 + x_1) : (14.0 + x_5)) > ((3.0 + x_8) > (2.0 + x_10)? (3.0 + x_8) : (2.0 + x_10))? ((7.0 + x_1) > (14.0 + x_5)? (7.0 + x_1) : (14.0 + x_5)) : ((3.0 + x_8) > (2.0 + x_10)? (3.0 + x_8) : (2.0 + x_10))) > (((2.0 + x_14) > (13.0 + x_15)? (2.0 + x_14) : (13.0 + x_15)) > ((12.0 + x_17) > (10.0 + x_18)? (12.0 + x_17) : (10.0 + x_18))? ((2.0 + x_14) > (13.0 + x_15)? (2.0 + x_14) : (13.0 + x_15)) : ((12.0 + x_17) > (10.0 + x_18)? (12.0 + x_17) : (10.0 + x_18)))? (((7.0 + x_1) > (14.0 + x_5)? (7.0 + x_1) : (14.0 + x_5)) > ((3.0 + x_8) > (2.0 + x_10)? (3.0 + x_8) : (2.0 + x_10))? ((7.0 + x_1) > (14.0 + x_5)? (7.0 + x_1) : (14.0 + x_5)) : ((3.0 + x_8) > (2.0 + x_10)? (3.0 + x_8) : (2.0 + x_10))) : (((2.0 + x_14) > (13.0 + x_15)? (2.0 + x_14) : (13.0 + x_15)) > ((12.0 + x_17) > (10.0 + x_18)? (12.0 + x_17) : (10.0 + x_18))? ((2.0 + x_14) > (13.0 + x_15)? (2.0 + x_14) : (13.0 + x_15)) : ((12.0 + x_17) > (10.0 + x_18)? (12.0 + x_17) : (10.0 + x_18)))) > ((((6.0 + x_20) > (2.0 + x_23)? (6.0 + x_20) : (2.0 + x_23)) > ((7.0 + x_24) > (4.0 + x_27)? (7.0 + x_24) : (4.0 + x_27))? ((6.0 + x_20) > (2.0 + x_23)? (6.0 + x_20) : (2.0 + x_23)) : ((7.0 + x_24) > (4.0 + x_27)? (7.0 + x_24) : (4.0 + x_27))) > (((18.0 + x_28) > (17.0 + x_29)? (18.0 + x_28) : (17.0 + x_29)) > ((13.0 + x_30) > (20.0 + x_31)? (13.0 + x_30) : (20.0 + x_31))? ((18.0 + x_28) > (17.0 + x_29)? (18.0 + x_28) : (17.0 + x_29)) : ((13.0 + x_30) > (20.0 + x_31)? (13.0 + x_30) : (20.0 + x_31)))? (((6.0 + x_20) > (2.0 + x_23)? (6.0 + x_20) : (2.0 + x_23)) > ((7.0 + x_24) > (4.0 + x_27)? (7.0 + x_24) : (4.0 + x_27))? ((6.0 + x_20) > (2.0 + x_23)? (6.0 + x_20) : (2.0 + x_23)) : ((7.0 + x_24) > (4.0 + x_27)? (7.0 + x_24) : (4.0 + x_27))) : (((18.0 + x_28) > (17.0 + x_29)? (18.0 + x_28) : (17.0 + x_29)) > ((13.0 + x_30) > (20.0 + x_31)? (13.0 + x_30) : (20.0 + x_31))? ((18.0 + x_28) > (17.0 + x_29)? (18.0 + x_28) : (17.0 + x_29)) : ((13.0 + x_30) > (20.0 + x_31)? (13.0 + x_30) : (20.0 + x_31))))? ((((7.0 + x_1) > (14.0 + x_5)? (7.0 + x_1) : (14.0 + x_5)) > ((3.0 + x_8) > (2.0 + x_10)? (3.0 + x_8) : (2.0 + x_10))? ((7.0 + x_1) > (14.0 + x_5)? (7.0 + x_1) : (14.0 + x_5)) : ((3.0 + x_8) > (2.0 + x_10)? (3.0 + x_8) : (2.0 + x_10))) > (((2.0 + x_14) > (13.0 + x_15)? (2.0 + x_14) : (13.0 + x_15)) > ((12.0 + x_17) > (10.0 + x_18)? (12.0 + x_17) : (10.0 + x_18))? ((2.0 + x_14) > (13.0 + x_15)? (2.0 + x_14) : (13.0 + x_15)) : ((12.0 + x_17) > (10.0 + x_18)? (12.0 + x_17) : (10.0 + x_18)))? (((7.0 + x_1) > (14.0 + x_5)? (7.0 + x_1) : (14.0 + x_5)) > ((3.0 + x_8) > (2.0 + x_10)? (3.0 + x_8) : (2.0 + x_10))? ((7.0 + x_1) > (14.0 + x_5)? (7.0 + x_1) : (14.0 + x_5)) : ((3.0 + x_8) > (2.0 + x_10)? (3.0 + x_8) : (2.0 + x_10))) : (((2.0 + x_14) > (13.0 + x_15)? (2.0 + x_14) : (13.0 + x_15)) > ((12.0 + x_17) > (10.0 + x_18)? (12.0 + x_17) : (10.0 + x_18))? ((2.0 + x_14) > (13.0 + x_15)? (2.0 + x_14) : (13.0 + x_15)) : ((12.0 + x_17) > (10.0 + x_18)? (12.0 + x_17) : (10.0 + x_18)))) : ((((6.0 + x_20) > (2.0 + x_23)? (6.0 + x_20) : (2.0 + x_23)) > ((7.0 + x_24) > (4.0 + x_27)? (7.0 + x_24) : (4.0 + x_27))? ((6.0 + x_20) > (2.0 + x_23)? (6.0 + x_20) : (2.0 + x_23)) : ((7.0 + x_24) > (4.0 + x_27)? (7.0 + x_24) : (4.0 + x_27))) > (((18.0 + x_28) > (17.0 + x_29)? (18.0 + x_28) : (17.0 + x_29)) > ((13.0 + x_30) > (20.0 + x_31)? (13.0 + x_30) : (20.0 + x_31))? ((18.0 + x_28) > (17.0 + x_29)? (18.0 + x_28) : (17.0 + x_29)) : ((13.0 + x_30) > (20.0 + x_31)? (13.0 + x_30) : (20.0 + x_31)))? (((6.0 + x_20) > (2.0 + x_23)? (6.0 + x_20) : (2.0 + x_23)) > ((7.0 + x_24) > (4.0 + x_27)? (7.0 + x_24) : (4.0 + x_27))? ((6.0 + x_20) > (2.0 + x_23)? (6.0 + x_20) : (2.0 + x_23)) : ((7.0 + x_24) > (4.0 + x_27)? (7.0 + x_24) : (4.0 + x_27))) : (((18.0 + x_28) > (17.0 + x_29)? (18.0 + x_28) : (17.0 + x_29)) > ((13.0 + x_30) > (20.0 + x_31)? (13.0 + x_30) : (20.0 + x_31))? ((18.0 + x_28) > (17.0 + x_29)? (18.0 + x_28) : (17.0 + x_29)) : ((13.0 + x_30) > (20.0 + x_31)? (13.0 + x_30) : (20.0 + x_31))))); x_28_ = (((((7.0 + x_1) > (7.0 + x_4)? (7.0 + x_1) : (7.0 + x_4)) > ((12.0 + x_5) > (15.0 + x_8)? (12.0 + x_5) : (15.0 + x_8))? ((7.0 + x_1) > (7.0 + x_4)? (7.0 + x_1) : (7.0 + x_4)) : ((12.0 + x_5) > (15.0 + x_8)? (12.0 + x_5) : (15.0 + x_8))) > (((2.0 + x_9) > (15.0 + x_10)? (2.0 + x_9) : (15.0 + x_10)) > ((16.0 + x_13) > (11.0 + x_14)? (16.0 + x_13) : (11.0 + x_14))? ((2.0 + x_9) > (15.0 + x_10)? (2.0 + x_9) : (15.0 + x_10)) : ((16.0 + x_13) > (11.0 + x_14)? (16.0 + x_13) : (11.0 + x_14)))? (((7.0 + x_1) > (7.0 + x_4)? (7.0 + x_1) : (7.0 + x_4)) > ((12.0 + x_5) > (15.0 + x_8)? (12.0 + x_5) : (15.0 + x_8))? ((7.0 + x_1) > (7.0 + x_4)? (7.0 + x_1) : (7.0 + x_4)) : ((12.0 + x_5) > (15.0 + x_8)? (12.0 + x_5) : (15.0 + x_8))) : (((2.0 + x_9) > (15.0 + x_10)? (2.0 + x_9) : (15.0 + x_10)) > ((16.0 + x_13) > (11.0 + x_14)? (16.0 + x_13) : (11.0 + x_14))? ((2.0 + x_9) > (15.0 + x_10)? (2.0 + x_9) : (15.0 + x_10)) : ((16.0 + x_13) > (11.0 + x_14)? (16.0 + x_13) : (11.0 + x_14)))) > ((((15.0 + x_15) > (16.0 + x_19)? (15.0 + x_15) : (16.0 + x_19)) > ((13.0 + x_22) > (1.0 + x_23)? (13.0 + x_22) : (1.0 + x_23))? ((15.0 + x_15) > (16.0 + x_19)? (15.0 + x_15) : (16.0 + x_19)) : ((13.0 + x_22) > (1.0 + x_23)? (13.0 + x_22) : (1.0 + x_23))) > (((8.0 + x_25) > (3.0 + x_26)? (8.0 + x_25) : (3.0 + x_26)) > ((13.0 + x_27) > (5.0 + x_30)? (13.0 + x_27) : (5.0 + x_30))? ((8.0 + x_25) > (3.0 + x_26)? (8.0 + x_25) : (3.0 + x_26)) : ((13.0 + x_27) > (5.0 + x_30)? (13.0 + x_27) : (5.0 + x_30)))? (((15.0 + x_15) > (16.0 + x_19)? (15.0 + x_15) : (16.0 + x_19)) > ((13.0 + x_22) > (1.0 + x_23)? (13.0 + x_22) : (1.0 + x_23))? ((15.0 + x_15) > (16.0 + x_19)? (15.0 + x_15) : (16.0 + x_19)) : ((13.0 + x_22) > (1.0 + x_23)? (13.0 + x_22) : (1.0 + x_23))) : (((8.0 + x_25) > (3.0 + x_26)? (8.0 + x_25) : (3.0 + x_26)) > ((13.0 + x_27) > (5.0 + x_30)? (13.0 + x_27) : (5.0 + x_30))? ((8.0 + x_25) > (3.0 + x_26)? (8.0 + x_25) : (3.0 + x_26)) : ((13.0 + x_27) > (5.0 + x_30)? (13.0 + x_27) : (5.0 + x_30))))? ((((7.0 + x_1) > (7.0 + x_4)? (7.0 + x_1) : (7.0 + x_4)) > ((12.0 + x_5) > (15.0 + x_8)? (12.0 + x_5) : (15.0 + x_8))? ((7.0 + x_1) > (7.0 + x_4)? (7.0 + x_1) : (7.0 + x_4)) : ((12.0 + x_5) > (15.0 + x_8)? (12.0 + x_5) : (15.0 + x_8))) > (((2.0 + x_9) > (15.0 + x_10)? (2.0 + x_9) : (15.0 + x_10)) > ((16.0 + x_13) > (11.0 + x_14)? (16.0 + x_13) : (11.0 + x_14))? ((2.0 + x_9) > (15.0 + x_10)? (2.0 + x_9) : (15.0 + x_10)) : ((16.0 + x_13) > (11.0 + x_14)? (16.0 + x_13) : (11.0 + x_14)))? (((7.0 + x_1) > (7.0 + x_4)? (7.0 + x_1) : (7.0 + x_4)) > ((12.0 + x_5) > (15.0 + x_8)? (12.0 + x_5) : (15.0 + x_8))? ((7.0 + x_1) > (7.0 + x_4)? (7.0 + x_1) : (7.0 + x_4)) : ((12.0 + x_5) > (15.0 + x_8)? (12.0 + x_5) : (15.0 + x_8))) : (((2.0 + x_9) > (15.0 + x_10)? (2.0 + x_9) : (15.0 + x_10)) > ((16.0 + x_13) > (11.0 + x_14)? (16.0 + x_13) : (11.0 + x_14))? ((2.0 + x_9) > (15.0 + x_10)? (2.0 + x_9) : (15.0 + x_10)) : ((16.0 + x_13) > (11.0 + x_14)? (16.0 + x_13) : (11.0 + x_14)))) : ((((15.0 + x_15) > (16.0 + x_19)? (15.0 + x_15) : (16.0 + x_19)) > ((13.0 + x_22) > (1.0 + x_23)? (13.0 + x_22) : (1.0 + x_23))? ((15.0 + x_15) > (16.0 + x_19)? (15.0 + x_15) : (16.0 + x_19)) : ((13.0 + x_22) > (1.0 + x_23)? (13.0 + x_22) : (1.0 + x_23))) > (((8.0 + x_25) > (3.0 + x_26)? (8.0 + x_25) : (3.0 + x_26)) > ((13.0 + x_27) > (5.0 + x_30)? (13.0 + x_27) : (5.0 + x_30))? ((8.0 + x_25) > (3.0 + x_26)? (8.0 + x_25) : (3.0 + x_26)) : ((13.0 + x_27) > (5.0 + x_30)? (13.0 + x_27) : (5.0 + x_30)))? (((15.0 + x_15) > (16.0 + x_19)? (15.0 + x_15) : (16.0 + x_19)) > ((13.0 + x_22) > (1.0 + x_23)? (13.0 + x_22) : (1.0 + x_23))? ((15.0 + x_15) > (16.0 + x_19)? (15.0 + x_15) : (16.0 + x_19)) : ((13.0 + x_22) > (1.0 + x_23)? (13.0 + x_22) : (1.0 + x_23))) : (((8.0 + x_25) > (3.0 + x_26)? (8.0 + x_25) : (3.0 + x_26)) > ((13.0 + x_27) > (5.0 + x_30)? (13.0 + x_27) : (5.0 + x_30))? ((8.0 + x_25) > (3.0 + x_26)? (8.0 + x_25) : (3.0 + x_26)) : ((13.0 + x_27) > (5.0 + x_30)? (13.0 + x_27) : (5.0 + x_30))))); x_29_ = (((((15.0 + x_0) > (19.0 + x_1)? (15.0 + x_0) : (19.0 + x_1)) > ((17.0 + x_2) > (16.0 + x_5)? (17.0 + x_2) : (16.0 + x_5))? ((15.0 + x_0) > (19.0 + x_1)? (15.0 + x_0) : (19.0 + x_1)) : ((17.0 + x_2) > (16.0 + x_5)? (17.0 + x_2) : (16.0 + x_5))) > (((16.0 + x_6) > (6.0 + x_7)? (16.0 + x_6) : (6.0 + x_7)) > ((2.0 + x_9) > (8.0 + x_10)? (2.0 + x_9) : (8.0 + x_10))? ((16.0 + x_6) > (6.0 + x_7)? (16.0 + x_6) : (6.0 + x_7)) : ((2.0 + x_9) > (8.0 + x_10)? (2.0 + x_9) : (8.0 + x_10)))? (((15.0 + x_0) > (19.0 + x_1)? (15.0 + x_0) : (19.0 + x_1)) > ((17.0 + x_2) > (16.0 + x_5)? (17.0 + x_2) : (16.0 + x_5))? ((15.0 + x_0) > (19.0 + x_1)? (15.0 + x_0) : (19.0 + x_1)) : ((17.0 + x_2) > (16.0 + x_5)? (17.0 + x_2) : (16.0 + x_5))) : (((16.0 + x_6) > (6.0 + x_7)? (16.0 + x_6) : (6.0 + x_7)) > ((2.0 + x_9) > (8.0 + x_10)? (2.0 + x_9) : (8.0 + x_10))? ((16.0 + x_6) > (6.0 + x_7)? (16.0 + x_6) : (6.0 + x_7)) : ((2.0 + x_9) > (8.0 + x_10)? (2.0 + x_9) : (8.0 + x_10)))) > ((((6.0 + x_12) > (2.0 + x_13)? (6.0 + x_12) : (2.0 + x_13)) > ((16.0 + x_15) > (4.0 + x_17)? (16.0 + x_15) : (4.0 + x_17))? ((6.0 + x_12) > (2.0 + x_13)? (6.0 + x_12) : (2.0 + x_13)) : ((16.0 + x_15) > (4.0 + x_17)? (16.0 + x_15) : (4.0 + x_17))) > (((20.0 + x_19) > (10.0 + x_26)? (20.0 + x_19) : (10.0 + x_26)) > ((1.0 + x_28) > (14.0 + x_31)? (1.0 + x_28) : (14.0 + x_31))? ((20.0 + x_19) > (10.0 + x_26)? (20.0 + x_19) : (10.0 + x_26)) : ((1.0 + x_28) > (14.0 + x_31)? (1.0 + x_28) : (14.0 + x_31)))? (((6.0 + x_12) > (2.0 + x_13)? (6.0 + x_12) : (2.0 + x_13)) > ((16.0 + x_15) > (4.0 + x_17)? (16.0 + x_15) : (4.0 + x_17))? ((6.0 + x_12) > (2.0 + x_13)? (6.0 + x_12) : (2.0 + x_13)) : ((16.0 + x_15) > (4.0 + x_17)? (16.0 + x_15) : (4.0 + x_17))) : (((20.0 + x_19) > (10.0 + x_26)? (20.0 + x_19) : (10.0 + x_26)) > ((1.0 + x_28) > (14.0 + x_31)? (1.0 + x_28) : (14.0 + x_31))? ((20.0 + x_19) > (10.0 + x_26)? (20.0 + x_19) : (10.0 + x_26)) : ((1.0 + x_28) > (14.0 + x_31)? (1.0 + x_28) : (14.0 + x_31))))? ((((15.0 + x_0) > (19.0 + x_1)? (15.0 + x_0) : (19.0 + x_1)) > ((17.0 + x_2) > (16.0 + x_5)? (17.0 + x_2) : (16.0 + x_5))? ((15.0 + x_0) > (19.0 + x_1)? (15.0 + x_0) : (19.0 + x_1)) : ((17.0 + x_2) > (16.0 + x_5)? (17.0 + x_2) : (16.0 + x_5))) > (((16.0 + x_6) > (6.0 + x_7)? (16.0 + x_6) : (6.0 + x_7)) > ((2.0 + x_9) > (8.0 + x_10)? (2.0 + x_9) : (8.0 + x_10))? ((16.0 + x_6) > (6.0 + x_7)? (16.0 + x_6) : (6.0 + x_7)) : ((2.0 + x_9) > (8.0 + x_10)? (2.0 + x_9) : (8.0 + x_10)))? (((15.0 + x_0) > (19.0 + x_1)? (15.0 + x_0) : (19.0 + x_1)) > ((17.0 + x_2) > (16.0 + x_5)? (17.0 + x_2) : (16.0 + x_5))? ((15.0 + x_0) > (19.0 + x_1)? (15.0 + x_0) : (19.0 + x_1)) : ((17.0 + x_2) > (16.0 + x_5)? (17.0 + x_2) : (16.0 + x_5))) : (((16.0 + x_6) > (6.0 + x_7)? (16.0 + x_6) : (6.0 + x_7)) > ((2.0 + x_9) > (8.0 + x_10)? (2.0 + x_9) : (8.0 + x_10))? ((16.0 + x_6) > (6.0 + x_7)? (16.0 + x_6) : (6.0 + x_7)) : ((2.0 + x_9) > (8.0 + x_10)? (2.0 + x_9) : (8.0 + x_10)))) : ((((6.0 + x_12) > (2.0 + x_13)? (6.0 + x_12) : (2.0 + x_13)) > ((16.0 + x_15) > (4.0 + x_17)? (16.0 + x_15) : (4.0 + x_17))? ((6.0 + x_12) > (2.0 + x_13)? (6.0 + x_12) : (2.0 + x_13)) : ((16.0 + x_15) > (4.0 + x_17)? (16.0 + x_15) : (4.0 + x_17))) > (((20.0 + x_19) > (10.0 + x_26)? (20.0 + x_19) : (10.0 + x_26)) > ((1.0 + x_28) > (14.0 + x_31)? (1.0 + x_28) : (14.0 + x_31))? ((20.0 + x_19) > (10.0 + x_26)? (20.0 + x_19) : (10.0 + x_26)) : ((1.0 + x_28) > (14.0 + x_31)? (1.0 + x_28) : (14.0 + x_31)))? (((6.0 + x_12) > (2.0 + x_13)? (6.0 + x_12) : (2.0 + x_13)) > ((16.0 + x_15) > (4.0 + x_17)? (16.0 + x_15) : (4.0 + x_17))? ((6.0 + x_12) > (2.0 + x_13)? (6.0 + x_12) : (2.0 + x_13)) : ((16.0 + x_15) > (4.0 + x_17)? (16.0 + x_15) : (4.0 + x_17))) : (((20.0 + x_19) > (10.0 + x_26)? (20.0 + x_19) : (10.0 + x_26)) > ((1.0 + x_28) > (14.0 + x_31)? (1.0 + x_28) : (14.0 + x_31))? ((20.0 + x_19) > (10.0 + x_26)? (20.0 + x_19) : (10.0 + x_26)) : ((1.0 + x_28) > (14.0 + x_31)? (1.0 + x_28) : (14.0 + x_31))))); x_30_ = (((((6.0 + x_0) > (11.0 + x_5)? (6.0 + x_0) : (11.0 + x_5)) > ((8.0 + x_6) > (20.0 + x_7)? (8.0 + x_6) : (20.0 + x_7))? ((6.0 + x_0) > (11.0 + x_5)? (6.0 + x_0) : (11.0 + x_5)) : ((8.0 + x_6) > (20.0 + x_7)? (8.0 + x_6) : (20.0 + x_7))) > (((8.0 + x_10) > (18.0 + x_13)? (8.0 + x_10) : (18.0 + x_13)) > ((15.0 + x_14) > (10.0 + x_15)? (15.0 + x_14) : (10.0 + x_15))? ((8.0 + x_10) > (18.0 + x_13)? (8.0 + x_10) : (18.0 + x_13)) : ((15.0 + x_14) > (10.0 + x_15)? (15.0 + x_14) : (10.0 + x_15)))? (((6.0 + x_0) > (11.0 + x_5)? (6.0 + x_0) : (11.0 + x_5)) > ((8.0 + x_6) > (20.0 + x_7)? (8.0 + x_6) : (20.0 + x_7))? ((6.0 + x_0) > (11.0 + x_5)? (6.0 + x_0) : (11.0 + x_5)) : ((8.0 + x_6) > (20.0 + x_7)? (8.0 + x_6) : (20.0 + x_7))) : (((8.0 + x_10) > (18.0 + x_13)? (8.0 + x_10) : (18.0 + x_13)) > ((15.0 + x_14) > (10.0 + x_15)? (15.0 + x_14) : (10.0 + x_15))? ((8.0 + x_10) > (18.0 + x_13)? (8.0 + x_10) : (18.0 + x_13)) : ((15.0 + x_14) > (10.0 + x_15)? (15.0 + x_14) : (10.0 + x_15)))) > ((((18.0 + x_17) > (18.0 + x_18)? (18.0 + x_17) : (18.0 + x_18)) > ((7.0 + x_20) > (1.0 + x_22)? (7.0 + x_20) : (1.0 + x_22))? ((18.0 + x_17) > (18.0 + x_18)? (18.0 + x_17) : (18.0 + x_18)) : ((7.0 + x_20) > (1.0 + x_22)? (7.0 + x_20) : (1.0 + x_22))) > (((3.0 + x_23) > (20.0 + x_24)? (3.0 + x_23) : (20.0 + x_24)) > ((14.0 + x_28) > (3.0 + x_31)? (14.0 + x_28) : (3.0 + x_31))? ((3.0 + x_23) > (20.0 + x_24)? (3.0 + x_23) : (20.0 + x_24)) : ((14.0 + x_28) > (3.0 + x_31)? (14.0 + x_28) : (3.0 + x_31)))? (((18.0 + x_17) > (18.0 + x_18)? (18.0 + x_17) : (18.0 + x_18)) > ((7.0 + x_20) > (1.0 + x_22)? (7.0 + x_20) : (1.0 + x_22))? ((18.0 + x_17) > (18.0 + x_18)? (18.0 + x_17) : (18.0 + x_18)) : ((7.0 + x_20) > (1.0 + x_22)? (7.0 + x_20) : (1.0 + x_22))) : (((3.0 + x_23) > (20.0 + x_24)? (3.0 + x_23) : (20.0 + x_24)) > ((14.0 + x_28) > (3.0 + x_31)? (14.0 + x_28) : (3.0 + x_31))? ((3.0 + x_23) > (20.0 + x_24)? (3.0 + x_23) : (20.0 + x_24)) : ((14.0 + x_28) > (3.0 + x_31)? (14.0 + x_28) : (3.0 + x_31))))? ((((6.0 + x_0) > (11.0 + x_5)? (6.0 + x_0) : (11.0 + x_5)) > ((8.0 + x_6) > (20.0 + x_7)? (8.0 + x_6) : (20.0 + x_7))? ((6.0 + x_0) > (11.0 + x_5)? (6.0 + x_0) : (11.0 + x_5)) : ((8.0 + x_6) > (20.0 + x_7)? (8.0 + x_6) : (20.0 + x_7))) > (((8.0 + x_10) > (18.0 + x_13)? (8.0 + x_10) : (18.0 + x_13)) > ((15.0 + x_14) > (10.0 + x_15)? (15.0 + x_14) : (10.0 + x_15))? ((8.0 + x_10) > (18.0 + x_13)? (8.0 + x_10) : (18.0 + x_13)) : ((15.0 + x_14) > (10.0 + x_15)? (15.0 + x_14) : (10.0 + x_15)))? (((6.0 + x_0) > (11.0 + x_5)? (6.0 + x_0) : (11.0 + x_5)) > ((8.0 + x_6) > (20.0 + x_7)? (8.0 + x_6) : (20.0 + x_7))? ((6.0 + x_0) > (11.0 + x_5)? (6.0 + x_0) : (11.0 + x_5)) : ((8.0 + x_6) > (20.0 + x_7)? (8.0 + x_6) : (20.0 + x_7))) : (((8.0 + x_10) > (18.0 + x_13)? (8.0 + x_10) : (18.0 + x_13)) > ((15.0 + x_14) > (10.0 + x_15)? (15.0 + x_14) : (10.0 + x_15))? ((8.0 + x_10) > (18.0 + x_13)? (8.0 + x_10) : (18.0 + x_13)) : ((15.0 + x_14) > (10.0 + x_15)? (15.0 + x_14) : (10.0 + x_15)))) : ((((18.0 + x_17) > (18.0 + x_18)? (18.0 + x_17) : (18.0 + x_18)) > ((7.0 + x_20) > (1.0 + x_22)? (7.0 + x_20) : (1.0 + x_22))? ((18.0 + x_17) > (18.0 + x_18)? (18.0 + x_17) : (18.0 + x_18)) : ((7.0 + x_20) > (1.0 + x_22)? (7.0 + x_20) : (1.0 + x_22))) > (((3.0 + x_23) > (20.0 + x_24)? (3.0 + x_23) : (20.0 + x_24)) > ((14.0 + x_28) > (3.0 + x_31)? (14.0 + x_28) : (3.0 + x_31))? ((3.0 + x_23) > (20.0 + x_24)? (3.0 + x_23) : (20.0 + x_24)) : ((14.0 + x_28) > (3.0 + x_31)? (14.0 + x_28) : (3.0 + x_31)))? (((18.0 + x_17) > (18.0 + x_18)? (18.0 + x_17) : (18.0 + x_18)) > ((7.0 + x_20) > (1.0 + x_22)? (7.0 + x_20) : (1.0 + x_22))? ((18.0 + x_17) > (18.0 + x_18)? (18.0 + x_17) : (18.0 + x_18)) : ((7.0 + x_20) > (1.0 + x_22)? (7.0 + x_20) : (1.0 + x_22))) : (((3.0 + x_23) > (20.0 + x_24)? (3.0 + x_23) : (20.0 + x_24)) > ((14.0 + x_28) > (3.0 + x_31)? (14.0 + x_28) : (3.0 + x_31))? ((3.0 + x_23) > (20.0 + x_24)? (3.0 + x_23) : (20.0 + x_24)) : ((14.0 + x_28) > (3.0 + x_31)? (14.0 + x_28) : (3.0 + x_31))))); x_31_ = (((((10.0 + x_0) > (13.0 + x_3)? (10.0 + x_0) : (13.0 + x_3)) > ((8.0 + x_4) > (19.0 + x_7)? (8.0 + x_4) : (19.0 + x_7))? ((10.0 + x_0) > (13.0 + x_3)? (10.0 + x_0) : (13.0 + x_3)) : ((8.0 + x_4) > (19.0 + x_7)? (8.0 + x_4) : (19.0 + x_7))) > (((19.0 + x_10) > (4.0 + x_12)? (19.0 + x_10) : (4.0 + x_12)) > ((4.0 + x_14) > (16.0 + x_16)? (4.0 + x_14) : (16.0 + x_16))? ((19.0 + x_10) > (4.0 + x_12)? (19.0 + x_10) : (4.0 + x_12)) : ((4.0 + x_14) > (16.0 + x_16)? (4.0 + x_14) : (16.0 + x_16)))? (((10.0 + x_0) > (13.0 + x_3)? (10.0 + x_0) : (13.0 + x_3)) > ((8.0 + x_4) > (19.0 + x_7)? (8.0 + x_4) : (19.0 + x_7))? ((10.0 + x_0) > (13.0 + x_3)? (10.0 + x_0) : (13.0 + x_3)) : ((8.0 + x_4) > (19.0 + x_7)? (8.0 + x_4) : (19.0 + x_7))) : (((19.0 + x_10) > (4.0 + x_12)? (19.0 + x_10) : (4.0 + x_12)) > ((4.0 + x_14) > (16.0 + x_16)? (4.0 + x_14) : (16.0 + x_16))? ((19.0 + x_10) > (4.0 + x_12)? (19.0 + x_10) : (4.0 + x_12)) : ((4.0 + x_14) > (16.0 + x_16)? (4.0 + x_14) : (16.0 + x_16)))) > ((((6.0 + x_18) > (10.0 + x_20)? (6.0 + x_18) : (10.0 + x_20)) > ((12.0 + x_21) > (7.0 + x_22)? (12.0 + x_21) : (7.0 + x_22))? ((6.0 + x_18) > (10.0 + x_20)? (6.0 + x_18) : (10.0 + x_20)) : ((12.0 + x_21) > (7.0 + x_22)? (12.0 + x_21) : (7.0 + x_22))) > (((14.0 + x_24) > (14.0 + x_27)? (14.0 + x_24) : (14.0 + x_27)) > ((9.0 + x_28) > (10.0 + x_31)? (9.0 + x_28) : (10.0 + x_31))? ((14.0 + x_24) > (14.0 + x_27)? (14.0 + x_24) : (14.0 + x_27)) : ((9.0 + x_28) > (10.0 + x_31)? (9.0 + x_28) : (10.0 + x_31)))? (((6.0 + x_18) > (10.0 + x_20)? (6.0 + x_18) : (10.0 + x_20)) > ((12.0 + x_21) > (7.0 + x_22)? (12.0 + x_21) : (7.0 + x_22))? ((6.0 + x_18) > (10.0 + x_20)? (6.0 + x_18) : (10.0 + x_20)) : ((12.0 + x_21) > (7.0 + x_22)? (12.0 + x_21) : (7.0 + x_22))) : (((14.0 + x_24) > (14.0 + x_27)? (14.0 + x_24) : (14.0 + x_27)) > ((9.0 + x_28) > (10.0 + x_31)? (9.0 + x_28) : (10.0 + x_31))? ((14.0 + x_24) > (14.0 + x_27)? (14.0 + x_24) : (14.0 + x_27)) : ((9.0 + x_28) > (10.0 + x_31)? (9.0 + x_28) : (10.0 + x_31))))? ((((10.0 + x_0) > (13.0 + x_3)? (10.0 + x_0) : (13.0 + x_3)) > ((8.0 + x_4) > (19.0 + x_7)? (8.0 + x_4) : (19.0 + x_7))? ((10.0 + x_0) > (13.0 + x_3)? (10.0 + x_0) : (13.0 + x_3)) : ((8.0 + x_4) > (19.0 + x_7)? (8.0 + x_4) : (19.0 + x_7))) > (((19.0 + x_10) > (4.0 + x_12)? (19.0 + x_10) : (4.0 + x_12)) > ((4.0 + x_14) > (16.0 + x_16)? (4.0 + x_14) : (16.0 + x_16))? ((19.0 + x_10) > (4.0 + x_12)? (19.0 + x_10) : (4.0 + x_12)) : ((4.0 + x_14) > (16.0 + x_16)? (4.0 + x_14) : (16.0 + x_16)))? (((10.0 + x_0) > (13.0 + x_3)? (10.0 + x_0) : (13.0 + x_3)) > ((8.0 + x_4) > (19.0 + x_7)? (8.0 + x_4) : (19.0 + x_7))? ((10.0 + x_0) > (13.0 + x_3)? (10.0 + x_0) : (13.0 + x_3)) : ((8.0 + x_4) > (19.0 + x_7)? (8.0 + x_4) : (19.0 + x_7))) : (((19.0 + x_10) > (4.0 + x_12)? (19.0 + x_10) : (4.0 + x_12)) > ((4.0 + x_14) > (16.0 + x_16)? (4.0 + x_14) : (16.0 + x_16))? ((19.0 + x_10) > (4.0 + x_12)? (19.0 + x_10) : (4.0 + x_12)) : ((4.0 + x_14) > (16.0 + x_16)? (4.0 + x_14) : (16.0 + x_16)))) : ((((6.0 + x_18) > (10.0 + x_20)? (6.0 + x_18) : (10.0 + x_20)) > ((12.0 + x_21) > (7.0 + x_22)? (12.0 + x_21) : (7.0 + x_22))? ((6.0 + x_18) > (10.0 + x_20)? (6.0 + x_18) : (10.0 + x_20)) : ((12.0 + x_21) > (7.0 + x_22)? (12.0 + x_21) : (7.0 + x_22))) > (((14.0 + x_24) > (14.0 + x_27)? (14.0 + x_24) : (14.0 + x_27)) > ((9.0 + x_28) > (10.0 + x_31)? (9.0 + x_28) : (10.0 + x_31))? ((14.0 + x_24) > (14.0 + x_27)? (14.0 + x_24) : (14.0 + x_27)) : ((9.0 + x_28) > (10.0 + x_31)? (9.0 + x_28) : (10.0 + x_31)))? (((6.0 + x_18) > (10.0 + x_20)? (6.0 + x_18) : (10.0 + x_20)) > ((12.0 + x_21) > (7.0 + x_22)? (12.0 + x_21) : (7.0 + x_22))? ((6.0 + x_18) > (10.0 + x_20)? (6.0 + x_18) : (10.0 + x_20)) : ((12.0 + x_21) > (7.0 + x_22)? (12.0 + x_21) : (7.0 + x_22))) : (((14.0 + x_24) > (14.0 + x_27)? (14.0 + x_24) : (14.0 + x_27)) > ((9.0 + x_28) > (10.0 + x_31)? (9.0 + x_28) : (10.0 + x_31))? ((14.0 + x_24) > (14.0 + x_27)? (14.0 + x_24) : (14.0 + x_27)) : ((9.0 + x_28) > (10.0 + x_31)? (9.0 + x_28) : (10.0 + x_31))))); 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_; x_20 = x_20_; x_21 = x_21_; x_22 = x_22_; x_23 = x_23_; x_24 = x_24_; x_25 = x_25_; x_26 = x_26_; x_27 = x_27_; x_28 = x_28_; x_29 = x_29_; x_30 = x_30_; x_31 = x_31_; } return 0; }
the_stack_data/283584.c
#include <stdio.h> #include <math.h> #define pi acos(-1.) int main() { int T, i; double r, R, n, s; scanf("%d", &T); for(i = 1; i <= T; i++) { scanf("%lf %lf", &R, &n); s = sin(pi / n); r = (R * s) / (1 + s); if(r - (int)r > 0) printf("Case %d: %0.10lf\n", i, r); else printf("Case %d: %0.0lf\n", i, r); } return 0; }
the_stack_data/182952168.c
#include <stdio.h> int main () { printf("hello world\n"); printf("cxzcxz"); return 0; }
the_stack_data/198581313.c
#define R_NO_REMAP void min_c( double *input, // Input vector int *n, // Length of 'input' double *na_flag, // 'NA' flag double *result // Result (length 1) ) { int i; int any_valid = 0; result[0] = *na_flag; for(i = 0; i < *n; i++) { if(input[i] != *na_flag) { if(any_valid == 0) { result[0] = input[i]; any_valid = 1; } else { if(input[i] < result[0]) { result[0] = input[i]; } } } } }
the_stack_data/104828997.c
#include <stdio.h> int main() { int sum = 0; int n; while (1) { scanf("%d", &n); if (feof(stdin)) { break; } sum += n / 3 - 2; } printf("%d\n", sum); return 0; }
the_stack_data/464434.c
#include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <strings.h> int main(int argc, char *argv[]) { int meusocket = socket(AF_INET,SOCK_STREAM,6); int conector; typedef struct { short int family; unsigned short int porta; struct in_addr sin_addr; unsigned char zero[8]; } sockaddr_in; sockaddr_in servidor; if(argc < 2){ fprintf(stderr,"No port provided\n"); exit(1); } int portnum = atoi(argv[1]); if(meusocket < 0){ perror("Socket"); exit(1); } servidor.family = AF_INET; servidor.porta = htons(portnum); servidor.sin_addr.s_addr = INADDR_ANY; bzero(&(servidor.zero),8); conector = connect(meusocket,(struct sockaddr * )&servidor, sizeof(servidor)); if(conector < 0){ perror("Connect"); exit(1); } return 0; }
the_stack_data/92328287.c
/* { dg-do compile } */ /* { dg-options "-O2 -fcheck-pointer-bounds -mmpx -fno-tree-ccp" } */ extern int vfork (void) __attribute__ ((__nothrow__ , __leaf__)); void test1 (void); void test2 (void); void test3 (int *); void test (int *p) { test1 (); p++; test2 (); p++; vfork (); test3 (p); }
the_stack_data/37637785.c
/** * BOJ 1158번 C언어 소스 코드 * 작성자 : 동동매니저 (DDManager) * * ※ 실행 결과 * 사용 메모리 : 1,116 KB / 262,144 KB * 소요 시간 : 60 ms / 2,000 ms * * Copyright 2019. DDManager all rights reserved. */ #include <stdio.h> #include <stdlib.h> typedef struct NODE{ short data; struct NODE *pre,*link; }NODE; int main(void){ short n,m,d,c=0,l,t; NODE *p,*tmp; scanf("%hd %hd",&n,&m); p=(NODE*)malloc(n*sizeof(NODE)); for(l=0;l<n;l++){ p[l].data=l+1; p[l].link=(l+1)<n?&p[l+1]:&p[0]; p[l].pre=(l-1)>=0?&p[l-1]:&p[n-1]; } printf("<"); tmp=&p[n-1]; while(c<n){ t=m; while(t--) tmp=tmp->link; d=tmp->data; if(!c++) printf("%d",d); else printf(", %d",d); tmp->pre->link=tmp->link; tmp->link->pre=tmp->pre; } puts(">"); free(p); return 0; }
the_stack_data/484172.c
/* Copyright (c) 2019, Google Inc. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include <stdint.h> #if defined(BORINGSSL_FIPS) && defined(BORINGSSL_SHARED_LIBRARY) // BORINGSSL_bcm_text_hash is is default hash value for the FIPS integrity check // that must be replaced with the real value during the build process. This // value need only be distinct, i.e. so that we can safely search-and-replace it // in an object file. const uint8_t BORINGSSL_bcm_text_hash[64]; const uint8_t BORINGSSL_bcm_text_hash[64] = { 0xae, 0x2c, 0xea, 0x2a, 0xbd, 0xa6, 0xf3, 0xec, 0x97, 0x7f, 0x9b, 0xf6, 0x94, 0x9a, 0xfc, 0x83, 0x68, 0x27, 0xcb, 0xa0, 0xa0, 0x9f, 0x6b, 0x6f, 0xde, 0x52, 0xcd, 0xe2, 0xcd, 0xff, 0x31, 0x80, 0xa2, 0xd4, 0xc3, 0x66, 0x0f, 0xc2, 0x6a, 0x7b, 0xf4, 0xbe, 0x39, 0xa2, 0xd7, 0x25, 0xdb, 0x21, 0x98, 0xe9, 0xd5, 0x53, 0xbf, 0x5c, 0x32, 0x06, 0x83, 0x34, 0x0c, 0x65, 0x89, 0x52, 0xbd, 0x1f, }; #endif // FIPS && SHARED_LIBRARY
the_stack_data/181393058.c
/* ============================================================================ Name :תרגיל בית HW3.1 Author : ID.Number : Version : 0.1 Description :שאלה 1 - HW03 ============================================================================ */ #include <stdio.h> #include <limits.h> void main () { int input1, min1, min, check; min = INT_MAX; min1 = INT_MAX; printf ("PLEASE ENTER A SERIE OF NUMBERS, TO FISNISH ENTER 0:\n"); do { check = scanf ("%d", &input1); if (input1 > 0 && input1 < min) { min = input1; } else if (input1 > min && input1 < min1) { min1 = input1; } if (check == 0) { break; } //printf("%d", INT_MAX); } while (input1 != 0); if (check == 0) { printf ("ERROR! Please enter only a series of numbers! Try again\n"); } else { printf ("The two smallest positive (not including 0) digits supplied were: %d and %d !!!\nBye bye!! Exiting...\n", min, min1); } while (1); } /* ============================================================================ Correct Output==>__________________________________________________________ PLEASE ENTER A SERIE OF NUMBERS, TO FISNISH ENTER 0: -1 2 33 -5 65 33 2 3 0 The two smallest positive (not including 0) digits supplied were: 2 and 3 !!! Bye bye!! Exiting... ============================================================================ ERROR Output==>__________________________________________________________ PLEASE ENTER A SERIE OF NUMBERS, TO FISNISH ENTER 0: f ERROR! Please enter only a series of numbers! Try again ====>> Bye Bye!<<==== ============================================================================ */
the_stack_data/22754.c
#include <stdio.h> int firstOcc(); int main() { int arr[40], n, i, x; printf(" Enter the size of array: "); scanf("%d", &n); printf(" Enter the array elements: "); for (i = 0; i < n; i++) { scanf("%d", &arr[i]); } printf(" Enter the number to be searched: "); scanf("%d", &x); int low = 0, high = n - 1; printf(" The number is present at the index %d. ", firstOcc(arr, x, low, high)); } int firstOcc(int arr[], int x, int low, int high) { if (low > high) return -1; int mid = (low + high) / 2; if (arr[mid] == x) return mid; else if (arr[mid] > x) return firstOcc(arr, x, low, mid - 1); else if (arr[mid] < x) return firstOcc(arr, x, mid + 1, high); else { if (mid == 0 || arr[mid] != arr[mid - 1]) return mid; else return firstOcc(arr, x, low, mid - 1); } }
the_stack_data/225877.c
#include <assert.h> /** * Calculate the greatest common divisor of two numbers. * @param a the first number. * @param b the second number. * @return the greatest common divisor of given two numbers. */ int gcd(int a, int b) { if (a == 0 || b == 0) { return 0; } int t = 1; while (t != 0) { t = a % b; a = b; b = t; } return a; } /** * Calculate the least common multiple of two numbers. * @param a the first number. * @param b the second number. * @return the least common multiple of given two numbers. */ int lcm(int a, int b) { return a * b / gcd(a, b); } void test() { assert(lcm(15, 25) == 75); assert(lcm(15, 45) == 45); } int main() { test(); return 0; }
the_stack_data/878904.c
// BUG: spinlock bad magic in __wake_up // https://syzkaller.appspot.com/bug?id=1eb4382133c98f4e92299adffd13dcc76c874f74 // status:invalid // autogenerated by syzkaller (http://github.com/google/syzkaller) #define _GNU_SOURCE #include <endian.h> #include <fcntl.h> #include <linux/futex.h> #include <pthread.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string.h> #include <sys/stat.h> #include <sys/syscall.h> #include <unistd.h> static uintptr_t syz_open_dev(uintptr_t a0, uintptr_t a1, uintptr_t a2) { if (a0 == 0xc || a0 == 0xb) { char buf[128]; sprintf(buf, "/dev/%s/%d:%d", a0 == 0xc ? "char" : "block", (uint8_t)a1, (uint8_t)a2); return open(buf, O_RDWR, 0); } else { char buf[1024]; char* hash; strncpy(buf, (char*)a0, sizeof(buf)); buf[sizeof(buf) - 1] = 0; while ((hash = strchr(buf, '#'))) { *hash = '0' + (char)(a1 % 10); a1 /= 10; } return open(buf, a2, 0); } } static void test(); void loop() { while (1) { test(); } } struct thread_t { int created, running, call; pthread_t th; }; static struct thread_t threads[16]; static void execute_call(int call); static int running; static void* thr(void* arg) { struct thread_t* th = (struct thread_t*)arg; for (;;) { while (!__atomic_load_n(&th->running, __ATOMIC_ACQUIRE)) syscall(SYS_futex, &th->running, FUTEX_WAIT, 0, 0); execute_call(th->call); __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); __atomic_store_n(&th->running, 0, __ATOMIC_RELEASE); syscall(SYS_futex, &th->running, FUTEX_WAKE); } return 0; } static void execute(int num_calls) { int call, thread; running = 0; for (call = 0; call < num_calls; call++) { for (thread = 0; thread < sizeof(threads) / sizeof(threads[0]); thread++) { struct thread_t* th = &threads[thread]; if (!th->created) { th->created = 1; pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 128 << 10); pthread_create(&th->th, &attr, thr, th); } if (!__atomic_load_n(&th->running, __ATOMIC_ACQUIRE)) { th->call = call; __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); __atomic_store_n(&th->running, 1, __ATOMIC_RELEASE); syscall(SYS_futex, &th->running, FUTEX_WAKE); struct timespec ts; ts.tv_sec = 0; ts.tv_nsec = 20 * 1000 * 1000; syscall(SYS_futex, &th->running, FUTEX_WAIT, 1, &ts); if (running) usleep((call == num_calls - 1) ? 10000 : 1000); break; } } } } uint64_t r[1] = {0xffffffffffffffff}; uint64_t procid; void execute_call(int call) { long res; switch (call) { case 0: memcpy((void*)0x20005000, "/dev/sg#", 9); res = syz_open_dev(0x20005000, 0, 0x8002); if (res != -1) r[0] = res; break; case 1: memcpy((void*)0x20a2afe3, "\xb6\x3d\xb8\x5e\x1e\x8d\x02\x00\x00\x00\x00\x00\x00\x3e\xf0\x01" "\x1d\xcc\x60\x6a\xed\x5e\xd2\xbc\x70\x18\xce\xbc\x9b\x97\xae\x21" "\xb1\x4d\x87\x2c\x67\x8c\xe2\x2c\x9b\x16\x00\x96\xaa\x1f\xae\x1a", 48); syscall(__NR_write, r[0], 0x20a2afe3, 0x30); break; case 2: *(uint64_t*)0x2085dff0 = 0x20e94000; *(uint64_t*)0x2085dff8 = 0xffbd; syscall(__NR_readv, r[0], 0x2085dff0, 1); break; } } void test() { execute(3); } int main() { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); for (procid = 0; procid < 8; procid++) { if (fork() == 0) { for (;;) { loop(); } } } sleep(1000000); return 0; }
the_stack_data/231393202.c
/* { dg-do compile } */ /* { dg-require-effective-target arm_v8_vfp_ok } */ /* { dg-options "-O2" } */ /* { dg-add-options arm_v8_vfp } */ double foo (double x) { return __builtin_nearbyint (x); } /* { dg-final { scan-assembler-times "vrintr.f64\td\[0-9\]+" 1 } } */
the_stack_data/117327873.c
// factor.c -- uses loops and recursion to calculate factorials #include <stdio.h> long fact(int n); long rfact(int n); int main(void) { int num; printf("This program calculates factorials.\n"); printf("Enter a value in the range 0-12 (q to quit):\n"); while (scanf("%d", &num) == 1) { if (num < 0) printf("No negative numbers, please.\n"); else if (num > 12) printf("Keep input under 13.\n"); else { printf("loop: %d factorial = %ld\n", num, fact(num)); printf("recursion: %d factorial = %ld\n", num, rfact(num)); } printf("Enter a value in the range 0-12 (q to quit):\n"); } printf("Bye.\n"); return 0; } long fact(int n) // loop-based function { long ans; for (ans = 1; n > 1; n--) ans *= n; return ans; } long rfact(int n) // recursive version { long ans; if (n > 0) ans= n * rfact(n-1); else ans = 1; return ans; }
the_stack_data/123754.c
typedef struct X{ struct X* next; int a; } X; int cyclic_with_single_struct(X* x){ return x->next->next->a; }
the_stack_data/48574149.c
/****************************************************************************** ** COPYRIGHT NOTICE ** (c) 2012 The Johns Hopkins University Applied Physics Laboratory ** All rights reserved. ******************************************************************************/ /***************************************************************************** ** \file nm_mgr_sql.c ** ** File Name: nm_mgr_sql.c ** ** ** Subsystem: ** Network Manager Daemon: Database Utilities ** ** Description: This file implements a SQL interface to the ION AMP manager. ** ** Notes: ** This software assumes that there are no other applications modifying ** the AMP database tables. ** ** These functions do not, generally, rollback DB writes on error. ** \todo: Add transactions. ** ** Assumptions: ** ** Modification History: ** MM/DD/YY AUTHOR DESCRIPTION ** -------- ------------ --------------------------------------------- ** 07/10/13 S. Jacobs Initial Implementation (JHU/APL) ** 08/19/13 E. Birrane Documentation clean up and code review comments. (JHU/APL) ** 08/22/15 E. Birrane Updates for new schema and dynamic user permissions. (Secure DTN - NASA: NNX14CS58P) ** 01/24/17 E. Birrane Updates to latest AMP IOS 3.5.0 (JHU/APL) ** 10/20/18 E. Birrane Updates for AMPv0.5 (JHU/APL) *****************************************************************************/ #ifdef HAVE_MYSQL #include <string.h> #include "ion.h" #include "nm_mgr.h" #include "nm_mgr_sql.h" /* Global connection to the MYSQL Server. */ static MYSQL *gConn; static sql_db_t gParms; static uint8_t gInTxn; /****************************************************************************** * * \par Function Name: db_add_agent() * * \par Adds a Registered Agent to the dbtRegisteredAgents table. * * * \return AMP_SYSERR - System Error * AMP_FAIL - Non-fatal issue. * >0 - The index of the inserted item. * * \param[in] agent_eid - The Agent EID being added to the DB. * * \par Notes: * - Only the agent EID is kept in the database, and used as a recipient * ID. No other agent information is persisted at this time. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 07/12/13 S. Jacobs Initial implementation, * 08/22/15 E. Birrane Updated to new database schema. * 01/24/17 E. Birrane Update to AMP IOS 3.5.0. (JHU/APL) * 10/20/18 E. Birrane Update to AMPv0.5 (JHU/APL) *****************************************************************************/ int32_t db_add_agent(eid_t agent_eid) { uint32_t row_idx = 0; AMP_DEBUG_WARN("db_add_agent","Not implemented.", NULL); return 0; } /****************************************************************************** * * \par Function Name: db_incoming_initialize * * \par Returns the id of the last insert into dbtIncoming. * * \return AMP_SYSERR - System Error * AMP_FAIL - Non-fatal issue. * >0 - The index of the inserted item. * * \param[in] timestamp - the generated timestamp * \param[in] sender_eid - Who sent the messages. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 08/07/13 S. Jacobs Initial implementation, * 08/29/15 E. Birrane Added sender EID. * 01/25/17 E. Birrane Update to AMP 3.5.0 (JHU/APL) *****************************************************************************/ int32_t db_incoming_initialize(time_t timestamp, eid_t sender_eid) { MYSQL_RES *res = NULL; MYSQL_ROW row; char timebuf[256]; uint32_t result = 0; uint32_t agent_idx = 0; AMP_DEBUG_ENTRY("db_incoming_initialize","("ADDR_FIELDSPEC",%s)", (uaddr)timestamp, sender_eid.name); db_mgt_txn_start(); /* Step 1: Find the agent ID, or try to add it. */ if((agent_idx = db_add_agent(sender_eid)) <= 0) { AMP_DEBUG_ERR("db_incoming_initialize","Can't find agent id.", NULL); db_mgt_txn_rollback(); AMP_DEBUG_EXIT("db_incoming_initialize", "-->%d", agent_idx); return agent_idx; } /* Step 2: Create a SQL time */ struct tm tminfo; localtime_r(&timestamp, &tminfo); isprintf(timebuf, 256, "%d-%d-%d %d:%d:%d", tminfo.tm_year+1900, tminfo.tm_mon, tminfo.tm_mday, tminfo.tm_hour, tminfo.tm_min, tminfo.tm_sec); /* Step 2: Insert the TS. */ if(db_mgt_query_insert(&result, "INSERT INTO dbtIncomingMessageGroup" "(ReceivedTS,GeneratedTS,State,AgentID) " "VALUES(NOW(),'%s',0,%d)", timebuf, agent_idx) != AMP_OK) { AMP_DEBUG_ERR("db_incoming_initialize","Can't insert Timestamp", NULL); db_mgt_txn_rollback(); AMP_DEBUG_EXIT("db_incoming_initialize","-->%d", AMP_FAIL); return AMP_FAIL; } db_mgt_txn_commit(); AMP_DEBUG_EXIT("db_incoming_initialize","-->%d", result); return result; } /****************************************************************************** * * \par Function Name: db_incoming_finalize * * \par Finalize processing of the incoming messages. * * \return AMP_SYSERR - System Error * AMP_FAIL - Non-fatal issue. * >0 - The index of the inserted item. * * \param[in] id - The incoming message group ID. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 08/07/13 S. Jacobs Initial implementation, * 01/25/17 E. Birrane Update to AMP 3.5.0 (JHU/APL) *****************************************************************************/ int32_t db_incoming_finalize(uint32_t id) { db_mgt_txn_start(); /* Step 2: Insert the TS. */ if(db_mgt_query_insert(NULL, "UPDATE dbtIncomingMessageGroup SET State = State + 1 WHERE ID = %d", id) != AMP_OK) { AMP_DEBUG_ERR("db_incoming_finalize","Can't insert Timestamp", NULL); db_mgt_txn_rollback(); AMP_DEBUG_EXIT("db_incoming_finalize","-->%d", AMP_FAIL); return AMP_FAIL; } db_mgt_txn_commit(); AMP_DEBUG_EXIT("db_incoming_finalize","-->%d", AMP_OK); return AMP_OK; } /****************************************************************************** * * \par Function Name: db_incoming_process_message * * \par Returns number of incoming message groups. * * \return # groups. -1 on error. * * \param[in] id - The ID for the incoming message. * \param[in] cursor - Cursor pointing to start of message. * \param[in] size - The size of the incoming message. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 08/07/13 S. Jacobs Initial implementation, * 01/26/17 E. Birrane Update to AMP 3.5.0 (JHU/APL) *****************************************************************************/ int32_t db_incoming_process_message(int32_t id, blob_t *data) { char *query = NULL; char *result_data = NULL; int32_t result_size = 0; AMP_DEBUG_ENTRY("db_incoming_process_message","(%d,"ADDR_FIELDSPEC")", id, (uaddr)data); /* Step 0: Sanity Check. */ if(data == NULL) { AMP_DEBUG_ERR("db_incoming_process_message","Bad args.",NULL); AMP_DEBUG_EXIT("db_incoming_process_message", "-->-1", NULL); return -1; } /* Step 1: Convert the incoming message to a string for processing.*/ if((result_data = utils_hex_to_string(data->value, data->length)) == NULL) { AMP_DEBUG_ERR("db_incoming_process_message","Can't cvt %d bytes to hex str.", data->length); AMP_DEBUG_EXIT("db_incoming_process_message", "-->-1", NULL); return -1; } result_size = strlen(result_data); db_mgt_txn_start(); /* * Step 2: Allocate a query for inserting into the DB. We allocate our own * because this could be large. */ if((query = (char *) STAKE(result_size + 256)) == NULL) { AMP_DEBUG_ERR("db_incoming_process_message","Can't alloc %d bytes.", result_size + 256); SRELEASE(result_data); db_mgt_txn_rollback(); AMP_DEBUG_EXIT("db_incoming_process_message", "-->0", NULL); return 0; } /* Step 3: Convert the query using allocated query structure. */ snprintf(query,result_size + 255,"INSERT INTO dbtIncomingMessages(IncomingID,Content)" "VALUES(%d,'%s')",id, result_data+2); SRELEASE(result_data); /* Step 4: Run the query. */ if(db_mgt_query_insert(NULL, query) != AMP_OK) { AMP_DEBUG_ERR("db_incoming_process_message","Can't insert Timestamp", NULL); SRELEASE(query); db_mgt_txn_rollback(); AMP_DEBUG_EXIT("db_incoming_process_message","-->%d", AMP_FAIL); return AMP_FAIL; } SRELEASE(query); db_mgt_txn_commit(); AMP_DEBUG_EXIT("db_incoming_process_message", "-->1", NULL); return 1; } /****************************************************************************** * * \par Function Name: db_mgt_daemon * * \par Returns number of outgoing message groups ready to be sent. * * \return . * * \param[in] threadId - The POSIX thread. * * \par Notes: * - We are being very inefficient here, as we grab the full result and * then ignore it, presumably to query it again later. We should * optimize this. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 07/13/13 S. Jacobs Initial implementation, * 08/29/15 E. Birrane Only query DB if we have an active connection. * 04/24/16 E. Birrane Accept global "running" flag. * 01/26/17 E. Birrane Update to AMP 3.5.0 (JHU/APL) *****************************************************************************/ void *db_mgt_daemon(int *running) { MYSQL_RES *sql_res; struct timeval start_time; vast delta = 0; AMP_DEBUG_ALWAYS("db_mgt_daemon","Starting Manager Database Daemon",NULL); while (*running) { getCurrentTime(&start_time); if(db_mgt_connected() == 0) { if (db_outgoing_ready(&sql_res)) { db_tx_msg_groups(sql_res); } mysql_free_result(sql_res); sql_res = NULL; } delta = utils_time_cur_delta(&start_time); // Sleep for 1 second (10^6 microsec) subtracting the processing time. if((delta < 2000000) && (delta > 0)) { microsnooze((unsigned int)(2000000 - delta)); } } AMP_DEBUG_ALWAYS("db_mgt_daemon","Cleaning up Manager Database Daemon", NULL); db_mgt_close(); AMP_DEBUG_ALWAYS("db_mgt_daemon","Manager Database Daemon Finished.",NULL); pthread_exit(NULL); } /****************************************************************************** * * \par Function Name: db_mgt_init * * \par Initializes the gConnection to the database. * * \retval 0 Failure * !0 Success * * \param[in] server - The machine hosting the SQL database. * \param[in] user - The username for the SQL database. * \param[in] pwd - The password for this user. * \param[in] database - The database housing the DTNMP tables. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 07/12/13 S. Jacobs Initial implementation, * 01/26/17 E. Birrane Update to AMP 3.5.0 (JHU/APL) *****************************************************************************/ uint32_t db_mgt_init(sql_db_t parms, uint32_t clear, uint32_t log) { AMP_DEBUG_ENTRY("db_mgt_init","(parms, %d)", clear); if(gConn == NULL) { gConn = mysql_init(NULL); gParms = parms; gInTxn = 0; AMP_DEBUG_ENTRY("db_mgt_init", "(%s,%s,%s,%s)", parms.server, parms.username, parms.password, parms.database); if (!mysql_real_connect(gConn, parms.server, parms.username, parms.password, parms.database, 0, NULL, 0)) { if(log > 0) { AMP_DEBUG_WARN("db_mgt_init", "SQL Error: %s", mysql_error(gConn)); } AMP_DEBUG_EXIT("db_mgt_init", "-->0", NULL); return 0; } AMP_DEBUG_INFO("db_mgt_init", "Connected to Database.", NULL); } if(clear != 0) { db_mgt_clear(); } AMP_DEBUG_EXIT("db_mgt_init", "-->1", NULL); return 1; } /****************************************************************************** * * \par Function Name: db_mgt_clear * * \par Clears all of the database tables used by the DTNMP Management Daemon. * * \retval 0 Failure * !0 Success * * * \todo Add support to clear all tables. Maybe add a parm to select a * table to clear (perhaps a string?) * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 07/12/13 S. Jacobs Initial implementation, * 08/27/15 E. Birrane Updated to latest schema *****************************************************************************/ int db_mgt_clear() { AMP_DEBUG_ENTRY("db_mgt_clear", "()", NULL); if( db_mgt_clear_table("dbtMIDs") || db_mgt_clear_table("dbtIncomingMessages") || db_mgt_clear_table("dbtOIDs") || db_mgt_clear_table("dbtADMs") || db_mgt_clear_table("dbtADMNicknames") || db_mgt_clear_table("dbtIncomingMessageGroup") || db_mgt_clear_table("dbtOutgoingMessageGroup") || db_mgt_clear_table("dbtRegisteredAgents") || db_mgt_clear_table("dbtDataCollections") || db_mgt_clear_table("dbtDataCollection") || db_mgt_clear_table("dbtMIDCollections") || db_mgt_clear_table("dbtMIDCollection") || db_mgt_clear_table("dbtMIDParameters") || db_mgt_clear_table("dbtMIDParameter")) { AMP_DEBUG_ERR("db_mgt_clear", "SQL Error: %s", mysql_error(gConn)); AMP_DEBUG_EXIT("db_mgt_clear", "--> 0", NULL); return 0; } AMP_DEBUG_EXIT("db_mgt_clear", "--> 1", NULL); return 1; } /****************************************************************************** * * \par Function Name: db_mgt_clear_table * * \par Clears a database table used by the DTNMP Management Daemon. * * Note: * We don't use truncate here because of foreign key constraints. Delete * is able to remove items from a table, but does not reseed the * auto-incrementing for the table, so an alter table command is also * used. * * \retval !0 Failure * 0 Success * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 08/29/15 E. Birrane Initial implementation, *****************************************************************************/ int db_mgt_clear_table(char *table) { if(table == NULL) { return 1; } if (db_mgt_query_insert(NULL,"SET FOREIGN_KEY_CHECKS=0",NULL) != AMP_OK) { AMP_DEBUG_ERR("db_mgt_clear_table", "SQL Error: %s", mysql_error(gConn)); AMP_DEBUG_EXIT("db_mgt_clear_table", "--> 0", NULL); return 1; } if (db_mgt_query_insert(NULL,"TRUNCATE %s", table) != AMP_OK) { AMP_DEBUG_ERR("db_mgt_clear_table", "SQL Error: %s", mysql_error(gConn)); AMP_DEBUG_EXIT("db_mgt_clear_table", "--> 0", NULL); return 1; } if (db_mgt_query_insert(NULL,"SET FOREIGN_KEY_CHECKS=1", NULL) != AMP_OK) { AMP_DEBUG_ERR("db_mgt_clear_table", "SQL Error: %s", mysql_error(gConn)); AMP_DEBUG_EXIT("db_mgt_clear_table", "--> 0", NULL); return 1; } AMP_DEBUG_EXIT("db_mgt_clear_table", "--> 0", NULL); return 0; } /****************************************************************************** * * \par Function Name: db_mgt_close * * \par Close the database gConnection. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 07/12/13 S. Jacobs Initial implementation, *****************************************************************************/ void db_mgt_close() { AMP_DEBUG_ENTRY("db_mgt_close","()",NULL); if(gConn != NULL) { mysql_close(gConn); mysql_library_end(); gConn = NULL; } AMP_DEBUG_EXIT("db_mgt_close","-->.", NULL); } /****************************************************************************** * * \par Function Name: db_mgt_connected * * \par Checks to see if the database connection is still active and, if not, * try to reconnect up to some configured number of times. * * \par Notes: * * \retval !0 Error * 0 Success * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 08/27/15 E. Birrane Updated to try and reconnect to DB. *****************************************************************************/ int db_mgt_connected() { int result = -1; uint8_t num_tries = 0; if(gConn == NULL) { return -1; } result = mysql_ping(gConn); if(result != 0) { while(num_tries < SQL_CONN_TRIES) { db_mgt_init(gParms, 0, 0); if((result = mysql_ping(gConn)) == 0) { return 0; } microsnooze(SQL_RECONN_TIME_MSEC); num_tries++; } } return result; } int db_mgr_sql_persist() { int success = AMP_OK; Sdr sdr = getIonsdr(); if(gMgrDB.sql_info.desc.descObj == 0) { gMgrDB.sql_info.desc.descObj = sdr_malloc(sdr, sizeof(gMgrDB.sql_info.desc)); } blob_t *data = db_mgr_sql_info_serialize(&(gMgrDB.sql_info)); CHKERR(sdr_begin_xn(sdr)); if(gMgrDB.sql_info.desc.itemObj != 0) { sdr_free(sdr, gMgrDB.sql_info.desc.itemObj); } gMgrDB.sql_info.desc.itemObj = sdr_malloc(sdr, data->length); gMgrDB.sql_info.desc.itemSize = data->length; sdr_write(sdr, gMgrDB.sql_info.desc.itemObj, (char *) data->value, data->length); sdr_write(sdr, gMgrDB.sql_info.desc.descObj, (char *) &(gMgrDB.sql_info.desc), sizeof(gMgrDB.sql_info.desc)); sdr_end_xn(sdr); blob_release(data, 1); return success; } void db_mgr_sql_info_deserialize(blob_t *data) { CborError err = CborNoError; CborValue array_it; CborValue it; CborParser parser; size_t length; cbor_parser_init(data->value, data->length, 0, &parser, &it); if((!cbor_value_is_container(&it)) || ((err = cbor_value_enter_container(&it, &array_it)) != CborNoError)) { AMP_DEBUG_ERR("mgr_sql_info_deserialize","Not a container. Error is %d", err); return; } if((err = cbor_value_get_array_length(&it, &length)) != CborNoError) { AMP_DEBUG_ERR("mgr_sql_info_deserialize","Can't get array length. Err is %d", err); return; } if(length != 4) { AMP_DEBUG_ERR("mgr_sql_info_deserialize","Bad length. %d not 4", length); return; } length = UI_SQL_SERVERLEN; cbor_value_copy_text_string(&array_it, gMgrDB.sql_info.server, &length, &array_it); length = UI_SQL_ACCTLEN; cbor_value_copy_text_string(&array_it, gMgrDB.sql_info.username, &length, &array_it); length = UI_SQL_ACCTLEN; cbor_value_copy_text_string(&array_it, gMgrDB.sql_info.password, &length, &array_it); length = UI_SQL_DBLEN; cbor_value_copy_text_string(&array_it, gMgrDB.sql_info.database, &length, &array_it); return; } blob_t* db_mgr_sql_info_serialize(sql_db_t *item) { CborEncoder encoder; CborEncoder array_enc; blob_t *result = blob_create(NULL, 0, 2 * sizeof(sql_db_t)); cbor_encoder_init(&encoder, result->value, result->alloc, 0); cbor_encoder_create_array(&encoder, &array_enc, 4); cbor_encode_text_stringz(&array_enc, item->server); cbor_encode_text_stringz(&array_enc, item->username); cbor_encode_text_stringz(&array_enc, item->password); cbor_encode_text_stringz(&array_enc, item->database); cbor_encoder_close_container(&encoder, &array_enc); result->length = cbor_encoder_get_buffer_size(&encoder, result->value); return result; } int db_mgr_sql_init() { Sdr sdr = getIonsdr(); char *name = "mgr_sql"; // * Initialize the non-volatile database. * / memset((char*) &(gMgrDB.sql_info), 0, sizeof(gMgrDB.sql_info)); initResourceLock(&(gMgrDB.sql_info.lock)); /* Recover the Agent database, creating it if necessary. */ CHKERR(sdr_begin_xn(sdr)); gMgrDB.sql_info.desc.descObj = sdr_find(sdr, name, NULL); switch(gMgrDB.sql_info.desc.descObj) { case -1: // SDR error. * / sdr_cancel_xn(sdr); AMP_DEBUG_ERR("db_mgr_sql_init", "Can't search for DB in SDR.", NULL); return -1; case 0: // Not found; Must create new DB. * / if((gMgrDB.sql_info.desc.descObj = sdr_malloc(sdr, sizeof(gMgrDB.sql_info.desc))) == 0) { sdr_cancel_xn(sdr); AMP_DEBUG_ERR("db_mgr_sql_init", "No space for database.", NULL); return -1; } AMP_DEBUG_ALWAYS("db_mgr_sql_init", "Creating DB: %s", name); sdr_write(sdr, gMgrDB.sql_info.desc.descObj, (char *) &(gMgrDB.sql_info.desc), sizeof(gMgrDB.sql_info.desc)); sdr_catlg(sdr, name, 0, gMgrDB.sql_info.desc.descObj); break; default: /* Found DB in the SDR */ /* Read in the Database. */ sdr_read(sdr, (char *) &(gMgrDB.sql_info.desc), gMgrDB.sql_info.desc.descObj, sizeof(gMgrDB.sql_info.desc)); AMP_DEBUG_ALWAYS("db_mgr_sql_init", "Found DB", NULL); if(gMgrDB.sql_info.desc.itemSize > 0) { blob_t *data = blob_create(NULL, 0, gMgrDB.sql_info.desc.itemSize); if(data != NULL) { sdr_read(sdr, (char *) data->value, gMgrDB.sql_info.desc.itemObj, gMgrDB.sql_info.desc.itemSize); data->length = gMgrDB.sql_info.desc.itemSize; db_mgr_sql_info_deserialize(data); blob_release(data, 1); } } } if(sdr_end_xn(sdr)) { AMP_DEBUG_ERR("db_mgr_sql_init", "Can't create Agent database.", NULL); return -1; } return 1; } /****************************************************************************** * * \par Function Name: db_mgt_query_fetch * * \par Runs a fetch in the database given a query and returns the result, if * a result field is provided.. * * \return AMP_SYSERR - System Error * AMP_FAIL - Non-fatal issue. * >0 - The index of the inserted item. * * \param[out] res - The result. * \param[in] format - Format to build query * \param[in] ... - Var args to build query given format string. * * \par Notes: * - The res structure should be a pointer but without being allocated. This * function will create the storage. * - If res is NULL that's ok, but no result will be returned. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 01/26/17 E. Birrane Initial implementation (JHU/APL). *****************************************************************************/ int32_t db_mgt_query_fetch(MYSQL_RES **res, char *format, ...) { char query[1024]; AMP_DEBUG_ENTRY("db_mgt_query_fetch","("ADDR_FIELDSPEC","ADDR_FIELDSPEC")", (uaddr)res, (uaddr)format); /* Step 0: Sanity check. */ if(format == NULL) { AMP_DEBUG_ERR("db_mgt_query_fetch", "Bad Args.", NULL); AMP_DEBUG_EXIT("db_mgt_query_fetch", "-->%d", AMP_FAIL); return AMP_FAIL; } /* * Step 1: Assert the DB connection. This should not only check * the connection as well as try and re-establish it. */ if(db_mgt_connected() == 0) { va_list args; va_start(args, format); // format is last parameter before "..." vsnprintf(query, 1024, format, args); va_end(args); if (mysql_query(gConn, query)) { AMP_DEBUG_ERR("db_mgt_query_fetch", "Database Error: %s", mysql_error(gConn)); AMP_DEBUG_EXIT("db_mgt_query_fetch", "-->%d", AMP_FAIL); return AMP_FAIL; } if((*res = mysql_store_result(gConn)) == NULL) { AMP_DEBUG_ERR("db_mgt_query_fetch", "Can't get result.", NULL); AMP_DEBUG_EXIT("db_mgt_query_fetch", "-->%d", AMP_FAIL); return AMP_FAIL; } } else { AMP_DEBUG_ERR("db_mgt_query_fetch", "DB not connected.", NULL); AMP_DEBUG_EXIT("db_mgt_query_fetch", "-->%d", AMP_SYSERR); return AMP_SYSERR; } AMP_DEBUG_EXIT("db_mgt_query_fetch", "-->%d", AMP_OK); return AMP_OK; } /****************************************************************************** * * \par Function Name: db_mgt_query_insert * * \par Runs an insert in the database given a query and returns the * index of the inserted item. * * \return AMP_SYSERR - System Error * AMP_FAIL - Non-fatal issue. * >0 - The index of the inserted item. * * \param[out] idx - The index of the inserted row. * \param[in] format - Format to build query * \param[in] ... - Var args to build query given format string. * * \par Notes: * - The idx may be NULL if the insert index is not needed. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 01/26/17 E. Birrane Initial implementation (JHU/APL). *****************************************************************************/ int32_t db_mgt_query_insert(uint32_t *idx, char *format, ...) { char query[SQL_MAX_QUERY]; AMP_DEBUG_ENTRY("db_mgt_query_insert","("ADDR_FIELDSPEC","ADDR_FIELDSPEC")",(uaddr)idx, (uaddr)format); /*EJB if(idx == NULL) { AMP_DEBUG_ERR("db_mgt_query_insert", "Bad Args.", NULL); AMP_DEBUG_EXIT("db_mgt_query_insert", "-->%d", AMP_FAIL); return AMP_FAIL; } */ if(db_mgt_connected() == 0) { va_list args; va_start(args, format); // format is last parameter before "..." if(vsnprintf(query, SQL_MAX_QUERY, format, args) == SQL_MAX_QUERY) { AMP_DEBUG_ERR("db_mgt_query_insert", "query is too long. Maximum length is %d", SQL_MAX_QUERY); } va_end(args); if (mysql_query(gConn, query)) { AMP_DEBUG_ERR("db_mgt_query_insert", "Database Error: %s", mysql_error(gConn)); AMP_DEBUG_EXIT("db_mgt_query_insert", "-->%d", AMP_FAIL); return AMP_FAIL; } if(idx != NULL) { if((*idx = (uint32_t) mysql_insert_id(gConn)) == 0) { AMP_DEBUG_ERR("db_mgt_query_insert", "Unknown last inserted row.", NULL); AMP_DEBUG_EXIT("db_mgt_query_insert", "-->%d", AMP_FAIL); return AMP_FAIL; } } } else { AMP_DEBUG_ERR("db_mgt_query_fetch", "DB not connected.", NULL); AMP_DEBUG_EXIT("db_mgt_query_fetch", "-->%d", AMP_SYSERR); return AMP_SYSERR; } AMP_DEBUG_EXIT("db_mgt_query_fetch", "-->%d", AMP_OK); return AMP_OK; } /****************************************************************************** * * \par Function Name: db_mgt_txn_start * * \par Starts a transaction in the database, if we are not already in a txn. * * \par Notes: * - This function is not multi-threaded. We assume that we are the only * input into the database and that there is only one "active" transaction * at a time. * - This function does not support nested transactions. * - If a transaction is already open, this function assumes that is the * transaction to use. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 01/26/17 E. Birrane Initial implementation (JHU/APL). *****************************************************************************/ void db_mgt_txn_start() { if(gInTxn == 0) { if(db_mgt_query_insert(NULL,"START TRANSACTION",NULL) == AMP_OK) { gInTxn = 1; } } } /****************************************************************************** * * \par Function Name: db_mgt_txn_commit * * \par Commits a transaction in the database, if we are in a txn. * * \par Notes: * - This function is not multi-threaded. We assume that we are the only * input into the database and that there is only one "active" transaction * at a time. * - This function does not support nested transactions. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 01/26/17 E. Birrane Initial implementation (JHU/APL). *****************************************************************************/ void db_mgt_txn_commit() { if(gInTxn == 1) { if(db_mgt_query_insert(NULL,"COMMIT",NULL) == AMP_OK) { gInTxn = 0; } } } /****************************************************************************** * * \par Function Name: db_mgt_txn_rollback * * \par Rolls back a transaction in the database, if we are in a txn. * * \par Notes: * - This function is not multi-threaded. We assume that we are the only * input into the database and that there is only one "active" transaction * at a time. * - This function does not support nested transactions. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 01/26/17 E. Birrane Initial implementation (JHU/APL). *****************************************************************************/ void db_mgt_txn_rollback() { if(gInTxn == 1) { if(db_mgt_query_insert(NULL,"ROLLBACK",NULL) == AMP_OK) { gInTxn = 0; } } } /****************************************************************************** * * \par Function Name: db_tx_msg_groups * * \par Returns 1 if the message is ready to be sent * * \retval AMP_SYSERR on system error * AMP_FAIL if no message groups ready. * AMP_OK If there are message groups ready to be sent. * * \param[out] sql_res - The outgoing messages. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 07/13/13 E. Birrane Initial implementation, * 07/18/13 S. Jacobs Added outgoing agents * 09/27/13 E. Birrane Configure each agent with custom rpt, if applicable. * 08/27/15 E. Birrane Update to new data model, schema * 01/26/17 E. Birrane Update to AMP 3.5.0 (JHU/APL) *****************************************************************************/ int32_t db_tx_msg_groups(MYSQL_RES *sql_res) { MYSQL_ROW row; msg_grp_t *msg_group = NULL; int32_t idx = 0; int32_t agent_idx = 0; int32_t result = AMP_SYSERR; agent_t *agent = NULL; AMP_DEBUG_ENTRY("db_tx_msg_groups","("ADDR_FIELDSPEC")",(uaddr) sql_res); /* Step 0: Sanity Check. */ if(sql_res == NULL) { AMP_DEBUG_ERR("db_tx_msg_groups","Bad args.", NULL); AMP_DEBUG_EXIT("db_tx_msg_groups","-->%d",AMP_FAIL); return AMP_FAIL; } /* Step 1: For each message group that is ready to go... */ while ((row = mysql_fetch_row(sql_res)) != NULL) { /* Step 1.1 Create and populate the message group. */ idx = atoi(row[0]); agent_idx = atoi(row[4]); /* Step 1.2: Create an AMP PDU for this outgoing message. */ if((msg_group = msg_grp_create(1)) == NULL) { AMP_DEBUG_ERR("db_tx_msg_groups","Cannot create group.", NULL); AMP_DEBUG_EXIT("db_tx_msg_groups","-->%d",AMP_SYSERR); return AMP_SYSERR; } /* * Step 1.3: Populate the message group with outgoing messages. * If there are no message groups, Quietly go home, * it isn't an error, it's just disappointing. */ if((result = db_tx_build_group(idx, msg_group)) != AMP_OK) { msg_grp_release(msg_group, 1); AMP_DEBUG_EXIT("db_tx_msg_groups","-->%d",result); return result; } /* Step 1.4: Figure out the agent receiving this message. */ if((agent = db_fetch_agent(agent_idx)) == NULL) { AMP_DEBUG_ERR("db_tx_msg_groups","Can't get agent for idx %d", agent_idx); msg_grp_release(msg_group, 1); AMP_DEBUG_EXIT("db_tx_msg_groups","-->%d",AMP_FAIL); return AMP_FAIL; } /* * Step 1.5: The database knows about the agent but the management * daemon might not. Make sure that the management daemon * knows about this agent so that it isn't a surprise when * the agent starts sending data back. * * If we can't add the agent to the manager daemon (which * would be very odd) we send the message group along and * accept that there might be confusion when the agent * sends information back. */ if(agent_get(&(agent->eid)) == NULL) { if(agent_add(agent->eid) == -1) { AMP_DEBUG_WARN("db_tx_msg_groups","Sending to unknown agent.", NULL); } } /* Step 1.6: Send the message group.*/ AMP_DEBUG_INFO("db_tx_msg_groups", "Sending to name %s", agent->eid.name); iif_send_grp(&ion_ptr, msg_group, agent->eid.name); /* Step 1.7: Release resources. */ agent_release(agent, 1); msg_grp_release(msg_group, 1); msg_group = NULL; /* * Step 1.8: Update the state of the message group in the database. * \todo: Consider aborting message group if this happens. */ if(db_mgt_query_insert(NULL, "UPDATE dbtOutgoingMessageGroup SET State=2 WHERE ID=%d", idx)!= AMP_OK) { AMP_DEBUG_WARN("db_tx_msg_groups","Could not update DB send status.", NULL); } } AMP_DEBUG_EXIT("db_tx_msg_groups", "-->%d", AMP_OK); return AMP_OK; } /****************************************************************************** * * \par Function Name: db_tx_build_group * * \par This function populates an AMP message group with messages * for this group from the database. * * \retval AMP_SYSERR on system error * AMP_FAIL if no message groups ready. * AMP_OK If there are message groups ready to be sent. * * \param[in] grp_idx - The DB identifier of the message group * \param[out] msg_group - The message group being populated * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 07/13/13 E. Birrane Initial implementation, * 09/27/13 E. Birrane Collect any rpt defs from this message. * 08/27/15 E. Birrane Update to latest data model and schema. * 01/26/17 E. Birrane Update to AMP 3.5.0 (JHU/APL) *****************************************************************************/ int32_t db_tx_build_group(int32_t grp_idx, msg_grp_t *msg_group) { int32_t result = 0; MYSQL_RES *res = NULL; MYSQL_ROW row; AMP_DEBUG_ENTRY("db_tx_build_group", "(%d, "ADDR_FIELDSPEC")", grp_idx, (uaddr) msg_group); /* Step 0: Sanity check. */ if(msg_group == NULL) { AMP_DEBUG_ERR("db_tx_build_group","Bad args.", NULL); AMP_DEBUG_EXIT("db_tx_build_group","-->%d", AMP_FAIL); return AMP_FAIL; } /* Step 1: Find all messages for this outgoing group. */ if(db_mgt_query_fetch(&res, "SELECT MidCollID FROM dbtOutgoingMessages WHERE OutgoingID=%d", grp_idx) != AMP_OK) { AMP_DEBUG_ERR("db_tx_build_group", "Can't find messages for %d", grp_idx); AMP_DEBUG_EXIT("db_tx_build_group","-->%d", AMP_FAIL); return AMP_FAIL; } /* Step 2: For each message that belongs in this group....*/ while((res != NULL) && ((row = mysql_fetch_row(res)) != NULL)) { int32_t ac_idx = atoi(row[0]); ac_t *ac; /* * Step 2.1: An outgoing message in AMP is a "run controls" * message, which accepts a series of controls to * run. This series is stored as a * MID Collection (MC). So, grab the MC. */ if((ac = db_fetch_ari_col(ac_idx)) == NULL) { AMP_DEBUG_ERR("db_tx_build_group", "Can't grab AC for idx %d", ac_idx); result = AMP_FAIL; break; } /* * Step 2.2: Create the "run controls" message, passing in * the MC of controls to run. * \todo: SQL currently has no place to store a * time offset associated with a control. We * currently jam that to 0 (which means run * immediately). */ msg_ctrl_t *ctrl = msg_ctrl_create(); ctrl->ac = ac; result = msg_grp_add_msg_ctrl(msg_group, ctrl); } mysql_free_result(res); AMP_DEBUG_EXIT("db_tx_build_group","-->%d", result); return result; } /****************************************************************************** * * \par Function Name: db_tx_collect_agents * * \par Returns a vector of the agents to send a message to * * \retval NULL no recipients. * !NULL There are recipients to be sent to. * * \param[in] grp_idx - The index of the message group being sent. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 07/18/13 S. Jacobs Initial Implementation * 01/26/17 E. Birrane Update to AMP 3.5.0 (JHU/APL) *****************************************************************************/ int db_tx_collect_agents(int32_t grp_idx, vector_t *vec) { MYSQL_RES *res = NULL; MYSQL_ROW row; agent_t *agent = NULL; int cur_row = 0; int max_row = 0; int success; AMP_DEBUG_ENTRY("db_tx_collect_agents","(%d)", grp_idx); /* * Step 1: Grab the list of agents from the DB for this * message group. */ if(db_mgt_query_fetch(&res, "SELECT AgentID FROM dbtOutgoingRecipients " "WHERE OutgoingID=%d", grp_idx) != AMP_OK) { AMP_DEBUG_ERR("db_tx_collect_agents", "Can't get agents for grp: %d", grp_idx); AMP_DEBUG_EXIT("db_tx_collect_agents","-->%d", AMP_FAIL); return AMP_FAIL; } /* Step 3: For each row returned.... */ max_row = mysql_num_rows(res); *vec = vec_create(1, NULL, NULL, NULL, 0, &success); for(cur_row = 0; cur_row < max_row; cur_row++) { if ((row = mysql_fetch_row(res)) != NULL) { /* Step 3.1: Grab the agent information.. */ if((agent = db_fetch_agent(atoi(row[0]))) != NULL) { AMP_DEBUG_INFO("db_outgoing_process_recipients", "Adding agent name %s.", agent->eid.name); vec_push(vec, agent); } else { AMP_DEBUG_ERR("db_outgoing_process_recipients", "Cannot fetch registered agent",NULL); } } } mysql_free_result(res); AMP_DEBUG_EXIT("db_outgoing_process_recipients","-->0x%#llx", vec_num_entries(*vec)); return AMP_OK; } /****************************************************************************** * * \par Function Name: db_outgoing_ready * * \par Returns number of outgoing message groups ready to be sent. * * \retval 0 no message groups ready. * !0 There are message groups ready to be sent. * * \param[out] sql_res - The outgoing messages. * * \par Notes: * - We are being very inefficient here, as we grab the full result and * then ignore it, presumably to query it again later. We should * optimize this. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 07/13/13 E. Birrane Initial implementation, * 08/27/15 E. Birrane Updated to newer schema *****************************************************************************/ int db_outgoing_ready(MYSQL_RES **sql_res) { int result = 0; char query[1024]; *sql_res = NULL; AMP_DEBUG_ENTRY("db_outgoing_ready","("ADDR_FIELDSPEC")", (uaddr) sql_res); CHKCONN /* Step 0: Sanity check. */ if(sql_res == NULL) { AMP_DEBUG_ERR("db_outgoing_ready", "Bad Parms.", NULL); AMP_DEBUG_EXIT("db_outgoing_ready","-->0",NULL); return 0; } /* Step 1: Build and execute query. */ sprintf(query, "SELECT * FROM dbtOutgoingMessageGroup WHERE State=%d", TX_READY); if (mysql_query(gConn, query)) { AMP_DEBUG_ERR("db_outgoing_ready", "Database Error: %s", mysql_error(gConn)); AMP_DEBUG_EXIT("db_outgoing_ready", "-->%d", result); return result; } /* Step 2: Parse the row and populate the structure. */ if ((*sql_res = mysql_store_result(gConn)) != NULL) { result = mysql_num_rows(*sql_res); } else { AMP_DEBUG_ERR("db_outgoing_ready", "Database Error: %s", mysql_error(gConn)); } //EJB if(result > 0) { AMP_DEBUG_ERR("db_outgoing_ready","There are %d rows ready.", result); } /* Step 3: Return whether we have results waiting. */ AMP_DEBUG_EXIT("db_outgoing_ready", "-->%d", result); return result; } /****************************************************************************** * * \par Function Name: db_fetch_reg_agent * * \par Creates an adm_reg_agent_t structure from the database. * * \retval NULL Failure * !NULL The built adm_reg_agent_t structure. * * \param[in] id - The Primary Key of the desired registered agent. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 07/12/13 S. Jacobs Initial implementation, * 01/25/17 E. Birrane Update to AMP 3.5.0 (JHU/APL) *****************************************************************************/ agent_t *db_fetch_agent(int32_t id) { agent_t *result = NULL; MYSQL_RES *res = NULL; MYSQL_ROW row; AMP_DEBUG_ENTRY("db_fetch_agent","(%d)", id); /* Step 1: Grab the OID row. */ if(db_mgt_query_fetch(&res, "SELECT * FROM dbtRegisteredAgents WHERE ID=%d", id) != AMP_OK) { AMP_DEBUG_ERR("db_fetch_agent","Can't fetch", NULL); AMP_DEBUG_EXIT("db_fetch_agent","-->NULL", NULL); return NULL; } if ((row = mysql_fetch_row(res)) != NULL) { eid_t eid; strncpy(eid.name, row[1], AMP_MAX_EID_LEN); /* Step 3: Create structure for agent */ if((result = agent_create(&eid)) == NULL) { AMP_DEBUG_ERR("db_fetch_agent","Cannot create a registered agent",NULL); mysql_free_result(res); AMP_DEBUG_EXIT("db_fetch_agent","-->NULL", NULL); return NULL; } } mysql_free_result(res); AMP_DEBUG_EXIT("db_fetch_agent", "-->"ADDR_FIELDSPEC, (uaddr) result); return result; } /****************************************************************************** * * \par Function Name: db_fetch_reg_agent_idx * * \par Retrieves the index associated with an agent's EID. * * \retval 0 Failure * !0 The index of the agent. * * \param[in] eid - The EID of the agent being queried. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 08/29/15 E. Birrane Initial implementation, * 01/25/17 E. Birrane Update to AMP 3.5.0 (JHU/APL) *****************************************************************************/ int32_t db_fetch_agent_idx(eid_t *eid) { int32_t result = AMP_FAIL; MYSQL_RES *res = NULL; MYSQL_ROW row; AMP_DEBUG_ENTRY("db_fetch_agent_idx","("ADDR_FIELDSPEC")", (uaddr) eid); /* Step 0: Sanity Check.*/ if(eid == NULL) { AMP_DEBUG_ERR("db_fetch_agent_idx","Bad Args.", NULL); AMP_DEBUG_EXIT("db_fetch_agent_idx","-->%d", AMP_FAIL); return AMP_FAIL; } /* Step 1: Grab the OID row. */ if(db_mgt_query_fetch(&res, "SELECT * FROM dbtRegisteredAgents WHERE AgentId='%s'", eid->name) != AMP_OK) { AMP_DEBUG_ERR("db_fetch_agent_idx","Can't fetch", NULL); AMP_DEBUG_EXIT("db_fetch_agent_idx","-->%d", AMP_FAIL); return AMP_FAIL; } /* Step 2: Parse information out of the returned row. */ if ((row = mysql_fetch_row(res)) != NULL) { result = atoi(row[0]); } else { AMP_DEBUG_ERR("db_fetch_agent_idx", "Did not find EID with ID of %s\n", eid->name); } /* Step 3: Free database resources. */ mysql_free_result(res); AMP_DEBUG_EXIT("db_fetch_agent_idx","-->%d", result); return result; } ac_t* db_fetch_ari_col(int idx) { AMP_DEBUG_ERR("db_fetch_ari_col","Not Implemented.", NULL); return NULL; } #if 0 //TODO - Add transactions //TODO - Make -1 the system error return and 0 the non-system-error return. //TODO - Update the comments. /****************************************************************************** * * \par Function Name: db_add_adm() * * \par Adds an ADM to the DB list of supported ADMs. * * Tables Effected: * 1. dbtADMs * * +---------+------------------+------+-----+---------+----------------+ * | Field | Type | Null | Key | Default | Extra | * +---------+------------------+------+-----+---------+----------------+ * | ID | int(10) unsigned | NO | PRI | NULL | auto_increment | * | Label | varchar(255) | NO | UNI | | | * | Version | varchar(255) | NO | | | | * | OID | int(10) unsigned | NO | MUL | NULL | | * +---------+------------------+------+-----+---------+----------------+ * * \return AMP_SYSERR - System Error * AMP_FAIL - Non-fatal issue. * >0 - The index of the inserted item. * * \param[in] name - The name of the ADM. * \param[in] version - Version of the ADM. * \param[in] oid_root - ADM root OID. * * \par Notes: * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 08/29/15 E. Birrane Initial implementation, * 04/02/16 E. Birrane Check connection * 01/24/17 E. Birrane Update to AMP IOS 3.5.0. (JHU/APL) *****************************************************************************/ int32_t db_add_adm(char *name, char *version, char *oid_root) { uint32_t oid_idx = 0; uint32_t row_idx = 0; AMP_DEBUG_ENTRY("db_add_adm,"ADDR_FIELDSPEC","ADDR_FIELDSPEC","ADDR_FIELDSPEC")", (uaddr)name, (uaddr)version, (uaddr)oid_root); /* Step 0: Sanity check. */ if((name == NULL) || (version == NULL) || (oid_root == NULL)) { AMP_DEBUG_ERR("db_add_adm","Bad Args.", NULL); AMP_DEBUG_EXIT("db_add_adm","-->0",NULL); return AMP_FAIL; } /* * Step 1: If the adm is already in the DB, return the index. * If there was a system error, return that. */ if((row_idx = db_fetch_adm_idx(name, version)) != 0) { return row_idx; } db_mgt_txn_start(); /* Step 2 - Put the OID in the Database and save the index. */ if((oid_idx = db_add_oid_str(oid_root)) <= 0) { AMP_DEBUG_ERR("db_add_adm","Can't add ADM OID to DB.",NULL); db_mgt_txn_rollback(); AMP_DEBUG_EXIT("db_add_adm","-->%d",oid_idx); return oid_idx; } /* Step 3: Write the ADM entry into the DB. */ if(db_mgt_query_insert(&row_idx, "INSERT INTO dbtADMs(Label, Version, OID) " "VALUES('%s','%s',%d)", name, version, oid_idx) != AMP_OK) { AMP_DEBUG_ERR("db_add_adm","Can't add ADM to DB.",NULL); db_mgt_txn_rollback(); AMP_DEBUG_EXIT("db_add_adm","-->%d",AMP_FAIL); return AMP_FAIL; } db_mgt_txn_commit(); AMP_DEBUG_EXIT("db_add_adm", "-->%d", row_idx); return row_idx; } /****************************************************************************** * * \par Function Name: db_add_tdc * * \par Adds a TDC to the database and returns the index of the * parameters table. * * Tables Effected: * 1. dbtDataCollections * * +-------+------------------+------+-----+-------------------------+----------------+ * | Field | Type | Null | Key | Default | Extra | * +-------+------------------+------+-----+-------------------------+----------------+ * | ID | int(10) unsigned | NO | PRI | NULL | auto_increment | * | Label | varchar(255) | NO | | Unnamed Data Collection | | * +-------+------------------+------+-----+-------------------------+----------------+ * * * 2. dbtDataCollection * * +--------------+------------------+------+-----+---------+-------+ * | Field | Type | Null | Key | Default | Extra | * +--------------+------------------+------+-----+---------+-------+ * | CollectionID | int(10) unsigned | NO | PRI | NULL | | * | DataOrder | int(10) unsigned | NO | PRI | 0 | | * | DataType | int(10) unsigned | NO | MUL | NULL | | * | DataBlob | blob | YES | | NULL | | * +--------------+------------------+------+-----+---------+-------+ * * \return AMP_SYSERR - System Error * AMP_FAIL - Non-fatal issue. * >0 - The index of the inserted item. * * \param[in] tdc - The TDC being added to the DB. * * \par Notes: * - Comments for the dc are not included. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 08/22/15 E. Birrane Initial Implementation * 09/10/15 E. Birrane Update to to db spec. * 11/12/16 E. Birrane Update to new schema. Optimizations. (JHU/APL) * 01/24/17 E. Birrane Update to AMP IOS 3.5.0. (JHU/APL) *****************************************************************************/ int32_t db_add_tdc(tdc_t tdc) { uint32_t tdc_idx = 0; LystElt elt; AMP_DEBUG_ENTRY("db_add_tdc", "(%d)", tdc.hdr.length); /* Step 0: Sanity check arguments. */ if(tdc.hdr.length == 0) { AMP_DEBUG_WARN("db_add_tdc","Not persisting empty TDC",NULL); AMP_DEBUG_EXIT("db_add_tdc","-->0",NULL); return AMP_FAIL; } db_mgt_txn_start(); /* * Step 1: Build and execute query to add row to dbtDataCollections. Also, store the * new DC index. */ if(db_mgt_query_insert(&tdc_idx, "INSERT INTO dbtDataCollections (Label) " "VALUE(NULL)") != AMP_OK) { AMP_DEBUG_WARN("db_add_tdc","Can't insert TDC",NULL); db_mgt_txn_rollback(); AMP_DEBUG_EXIT("db_add_tdc","-->%d",AMP_FAIL); return AMP_FAIL; } /* * Step 2: For each BLOB in the data collection, add it to the data collection * entries table. */ for(elt = lyst_first(tdc.datacol); elt; elt = lyst_next(elt)) { blob_t *entry = (blob_t *) lyst_data(elt); int i = 0; char *content = NULL; uint32_t content_len = 0; uint32_t dc_idx = 0; /* Step 2.1: Built sting version of the BLOB data. */ if((content = utils_hex_to_string(entry->value, entry->length)) == NULL) { AMP_DEBUG_ERR("db_add_tdc","Can't cvt %d bytes to hex str.", entry->length); db_mgt_txn_rollback(); AMP_DEBUG_EXIT("db_add_tdc", "-->%d", AMP_FAIL); return AMP_FAIL; } /* Step 2.2: Write the data into the DC collections table and associated * the entry with the data collection idx. * NOTE: content+2 is used to "skip over" the leading "0x" * characters that preface the contents information. */ if(db_mgt_query_insert(&dc_idx, "INSERT INTO dbtDataCollection(CollectionID, DataOrder, DataType,DataBlob)" "VALUES(%d,1,%d,'%s')", tdc_idx, tdc.hdr.data[i], content+2) != AMP_OK) { AMP_DEBUG_ERR("db_add_tdc","Can't insert entry %d.", i); SRELEASE(content); db_mgt_txn_rollback(); AMP_DEBUG_EXIT("db_add_tdc", "-->%d", AMP_FAIL); return AMP_FAIL; } i++; SRELEASE(content); } db_mgt_txn_commit(); AMP_DEBUG_EXIT("db_add_tdc", "-->%d", tdc_idx); return tdc_idx; } /****************************************************************************** * * \par Function Name: db_add_mid * * \par Creates a MID in the database. * * Tables Effected: * 1. dbtMIDs * * +--------------+---------------------+------+-----+--------------------+----------------+ * | Field | Type | Null | Key | Default | Extra | * +--------------+---------------------+------+-----+--------------------+----------------+ * | ID | int(10) unsigned | NO | PRI | NULL | auto_increment | * | NicknameID | int(10) unsigned | YES | MUL | NULL | | * | OID | int(10) unsigned | NO | MUL | NULL | | * | ParametersID | int(10) unsigned | YES | MUL | NULL | | * | Type | int(10) unsigned | NO | MUL | NULL | | * | Category | int(10) unsigned | NO | MUL | NULL | | * | IssuerFlag | bit(1) | NO | | b'0' | | * | TagFlag | bit(1) | NO | | b'0' | | * | OIDType | int(10) unsigned | YES | MUL | NULL | | * | IssuerID | bigint(20) unsigned | NO | | 0 | | * | TagValue | bigint(20) unsigned | NO | | 0 | | * | DataType | int(10) unsigned | NO | MUL | NULL | | * | Name | varchar(50) | NO | | Unnamed MID | | * | Description | varchar(255) | NO | | No MID Description | | * +--------------+---------------------+------+-----+--------------------+----------------+ * * * \return AMP_SYSERR - System Error * AMP_FAIL - Non-fatal issue. * >0 - The index of the inserted item. * * \param[in] mid - The MID to be persisted in the DB. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 07/12/13 S. Jacobs Initial implementation, * 08/23/15 E. Birrane Update to new DB Schema. * 01/24/17 E. Birrane Update to AMP IOS 3.5.0. (JHU/APL) *****************************************************************************/ int32_t db_add_mid(mid_t *mid) { int32_t nn_idx = 0; int32_t oid_idx = 0; int32_t parm_idx = 0; int32_t num_parms = 0; uint32_t mid_idx = 0; AMP_DEBUG_ENTRY("db_add_mid", "("ADDR_FIELDSPEC",%d)", (uaddr)mid); /* Step 0: Sanity check arguments. */ if(mid == NULL) { AMP_DEBUG_ERR("db_add_mid","Bad args",NULL); AMP_DEBUG_EXIT("db_add_mid","-->%d", AMP_FAIL); return AMP_FAIL; } /* Step 1: Make sure the ID is not already in the DB (or not failure). */ if ((mid_idx = db_fetch_mid_idx(mid)) != 0) { AMP_DEBUG_WARN("db_add_mid","MID already exists.",NULL); AMP_DEBUG_EXIT("db_add_mid", "-->%d", mid_idx); return mid_idx; } /* Step 2: If this MID has a nickname, grab the index. */ if((MID_GET_FLAG_OID(mid->flags) == OID_TYPE_COMP_FULL) || (MID_GET_FLAG_OID(mid->flags) == OID_TYPE_COMP_PARAM)) { if((nn_idx = db_fetch_nn_idx(mid->oid.nn_id)) <= 0) { AMP_DEBUG_ERR("db_add_mid","MID references unknown Nickname %d", mid->oid.nn_id); AMP_DEBUG_EXIT("db_add_mid", "-->%d", nn_idx); return nn_idx; } } db_mgt_txn_start(); /* Step 3: Get the index for the OID. */ if((oid_idx = db_add_oid(mid->oid)) <= 0) { AMP_DEBUG_ERR("db_add_mid", "Can't add OID.", NULL); AMP_DEBUG_EXIT("db_add_mid", "-->%d", oid_idx); return oid_idx; } /* Step 4: Get the index for parameters, if any. */ if((num_parms = oid_get_num_parms(mid->oid)) > 0) { if((parm_idx = db_add_parms(mid->oid)) <= 0) { AMP_DEBUG_ERR("db_add_mid", "Can't add PARMS.", NULL); db_mgt_txn_rollback(); AMP_DEBUG_EXIT("db_add_mid", "-->%d", parm_idx); return parm_idx; } } /* * Step 5: Build and execute query to add row to dbtMIDs. Also, store the * row ID of the inserted row. */ if(db_mgt_query_insert(&mid_idx, "INSERT INTO dbtMIDs(NicknameID,OID,ParametersID,Type,Category,IssuerFlag,TagFlag," "OIDType,IssuerID,TagValue,DataType,Name,Description)" "VALUES (%s, %d, %s, %d, %d, %d, %d, %d, "UVAST_FIELDSPEC","UVAST_FIELDSPEC",%d,'%s','%s')", (nn_idx == 0) ? "NULL" : itoa(nn_idx), oid_idx, (parm_idx == 0) ? "NULL" : itoa(parm_idx), 0, MID_GET_FLAG_ID(mid->flags), (MID_GET_FLAG_ISS(mid->flags)) ? 1 : 0, (MID_GET_FLAG_TAG(mid->flags)) ? 1 : 0, MID_GET_FLAG_OID(mid->flags), mid->issuer, mid->tag, AMP_TYPE_MID, "No Name", "No Descr") != AMP_OK) { AMP_DEBUG_ERR("db_add_mid", "Can't add MID.", NULL); db_mgt_txn_rollback(); AMP_DEBUG_EXIT("db_add_mid", "-->%d", AMP_FAIL); return AMP_FAIL; } db_mgt_txn_commit(); AMP_DEBUG_EXIT("db_add_mid", "-->%d", mid_idx); return mid_idx; } /****************************************************************************** * * \par Function Name: db_add_mc * * \par Creates a MID Collection in the database. * * Tables Effected: * 1. dbtMIDCollections * * +---------+------------------+------+-----+---------+----------------+ * | Field | Type | Null | Key | Default | Extra | * +---------+------------------+------+-----+---------+----------------+ * | ID | int(10) unsigned | NO | PRI | NULL | auto_increment | * | Comment | varchar(255) | YES | | NULL | | * +---------+------------------+------+-----+---------+----------------+ * +---------------+------------+---------------+-----------------------+ * | Column Object | Type | Default Value | Comment | * +---------------+------------+---------------+-----------------------+ * | ID* | Int32 | auto- | Used as primary key | * | |(unsigned) | incrementing | | * +---------------+------------+---------------+-----------------------+ * | Comment |VARCHAR(255)| '' | Optional Comment | * +---------------+------------+---------------+-----------------------+ * * 2. dbtMIDCollection * +---------------+------------+---------------+-----------------------+ * | Column Object | Type | Default Value | Comment | * +---------------+------------+---------------+-----------------------+ * | CollectionID | Int32 | 0 | Foreign key into | * | |(unsigned) | | dbtMIDCollection.ID | * +---------------+------------+---------------+-----------------------+ * | MIDID | Int32 | 0 | Foreign key into | * | | (unsigned) | | dbtMIDs.ID | * +---------------+------------+---------------+-----------------------+ * | MIDOrder | Int32 | 0 | Order of MID in the | * | | (unsigned) | | Collection. | * +---------------+------------+---------------+-----------------------+ * * * \return AMP_SYSERR - System Error * AMP_FAIL - Non-fatal issue. * >0 - The index of the inserted item. * * \param[in] mc - The MC being added to the DB. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 08/23/15 E. Birrane Initial Implementation * 01/25/17 E. Birrane Update to AMP IOS 3.5.0. (JHU/APL) *****************************************************************************/ int32_t db_add_mc(Lyst mc) { uint32_t mc_idx = 0; LystElt elt = NULL; mid_t *mid = NULL; uint32_t i = 0; int32_t mid_idx = 0; AMP_DEBUG_ENTRY("db_add_mc", "("ADDR_FIELDSPEC")", (uaddr)mc); /* Step 0 - Sanity check arguments. */ if(mc == NULL) { AMP_DEBUG_ERR("db_add_mc","Bad args",NULL); AMP_DEBUG_EXIT("db_add_mc","-->%d", AMP_SYSERR); return AMP_SYSERR; } db_mgt_txn_start(); /* Step 1 - Create a new entry in the dbtMIDCollections DB. */ if(db_mgt_query_insert(&mc_idx, "INSERT INTO dbtMIDCollections (Comment) VALUES ('No Comment')") != AMP_OK) { AMP_DEBUG_ERR("db_add_mc","Can't insert MC",NULL); db_mgt_txn_rollback(); AMP_DEBUG_EXIT("db_add_mc","-->%d", AMP_FAIL); return AMP_FAIL; } /* Step 2 - For each MID in the MC, add the MID into the dbtMIDCollection. */ for(elt = lyst_first(mc); elt; elt = lyst_next(elt)) { /* Step 2a: Extract nth MID from MC. */ if((mid = (mid_t *) lyst_data(elt)) == NULL) { AMP_DEBUG_ERR("db_add_mc","Can't get MID.", NULL); db_mgt_txn_rollback(); AMP_DEBUG_EXIT("db_add_mc", "-->%d", AMP_SYSERR); return AMP_SYSERR; } /* Step 2b: Make sure MID is in the DB. */ if((mid_idx = db_add_mid(mid)) > 0) { AMP_DEBUG_ERR("db_add_mc","MID not there and can't insert.", NULL); db_mgt_txn_rollback(); AMP_DEBUG_EXIT("db_add_mc", "-->%d", mid_idx); return mid_idx; } /* Step 2c - Insert entry into DB MC list from this MC. */ if(db_mgt_query_insert(NULL, "INSERT INTO dbtMIDCollection" "(CollectionID, MIDID, MIDOrder)" "VALUES (%d, %d, %d", mc_idx, mid_idx, i) != AMP_OK) { AMP_DEBUG_ERR("db_add_mc","Can't insert MID %d", i); db_mgt_txn_rollback(); AMP_DEBUG_EXIT("db_add_mc","-->%d", AMP_FAIL); return AMP_FAIL; } i++; } db_mgt_txn_commit(); AMP_DEBUG_EXIT("db_add_mc", "-->%d", mc_idx); return mc_idx; } /****************************************************************************** * * \par Function Name: db_add_nn * * \par Creates a Nickname in the database. * * Tables Effected: * * 1. dbtMIDCollections * * +----------------+------------------+------+-----+--------------------------+----------------+ * | Field | Type | Null | Key | Default | Extra | * +----------------+------------------+------+-----+--------------------------+----------------+ * | ID | int(10) unsigned | NO | PRI | NULL | auto_increment | * | ADM_ID | int(10) unsigned | NO | MUL | NULL | | * | Nickname_UID | int(10) unsigned | NO | | NULL | | * | Nickname_Label | varchar(25) | NO | | Undefined ADM Tree Value | | * | OID | int(10) unsigned | NO | MUL | NULL | | * +----------------+------------------+------+-----+--------------------------+----------------+ * * * \return AMP_SYSERR - System Error * AMP_FAIL - Non-fatal issue. * >0 - The index of the inserted item. * * \param[in] nn - The Nickname being added to the DB. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 08/29/15 E. Birrane Initial Implementation * 01/25/17 E. Birrane Update to AMP IOS 3.5.0. (JHU/APL) *****************************************************************************/ int32_t db_add_nn(oid_nn_t *nn) { uint32_t nn_idx = 0; oid_t oid; int32_t oid_idx = 0; int32_t adm_idx = 0; AMP_DEBUG_ENTRY("db_add_nn", "("ADDR_FIELDSPEC")", (uaddr)nn); /* Step 0 - Sanity check arguments. */ if(nn == NULL) { AMP_DEBUG_ERR("db_add_nn","Bad args",NULL); AMP_DEBUG_EXIT("db_add_nn","-->%d",AMP_FAIL); return AMP_FAIL; } /* * Step 1 - Duplicate check. */ if((nn_idx = db_fetch_nn_idx(nn->id)) > 0) { AMP_DEBUG_EXIT("db_add_nn","-->%d", nn_idx); return nn_idx; } db_mgt_txn_start(); /* Step 2 - Ensure OID. */ oid = oid_construct(OID_TYPE_FULL, NULL, 0, nn->raw, nn->raw_size); if( (oid.type == OID_TYPE_UNK) || ((oid_idx = db_add_oid(oid)) <= 0)) { AMP_DEBUG_ERR("db_add_nn","Can't create OID.",NULL); oid_release(&oid); db_mgt_txn_rollback(); AMP_DEBUG_EXIT("db_add_nn","-->%d",oid_idx); return oid_idx; } oid_release(&oid); /* Step 3 - Add the ADM. */ if((adm_idx = db_fetch_adm_idx(nn->adm_name, nn->adm_ver)) <= 0) { AMP_DEBUG_ERR("db_add_nn","Can't Find ADM.",NULL); db_mgt_txn_rollback(); AMP_DEBUG_EXIT("db_add_nn","-->%d",adm_idx); return adm_idx; } /* Step 3 - Create a new entry in the dbtADMNicknames DB. */ if(db_mgt_query_insert(&nn_idx, "INSERT INTO dbtADMNicknames (ADM_ID, Nickname_UID, Nickname_Label, OID)" "VALUES (%d, "UVAST_FIELDSPEC", 'No Comment', %d)", adm_idx, nn->id, oid_idx) != AMP_OK) { AMP_DEBUG_ERR("db_add_nn","Can't insert Nickname", NULL); db_mgt_txn_rollback(); AMP_DEBUG_EXIT("db_add_nn","-->%d", AMP_SYSERR); return AMP_SYSERR; } db_mgt_txn_commit(); AMP_DEBUG_EXIT("db_add_nn", "-->%d", nn_idx); return nn_idx; } /****************************************************************************** * * \par Function Name: db_add_oid_str * * \par Adds an OID to the database given a serialized string rep of the OID. * * \return AMP_SYSERR - System Error * AMP_FAIL - Non-fatal issue. * >0 - The index of the inserted item. * * \param[in] oid_str - The string representation of the OID. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 08/29/15 E. Birrane Initial Implementation * 01/25/17 E. Birrane Update to AMP IOS 3.5.0. (JHU/APL) *****************************************************************************/ int32_t db_add_oid_str(char *oid_str) { uint8_t *data = NULL; uint32_t datasize = 0; int32_t result = 0; oid_t oid; AMP_DEBUG_ENTRY("db_add_oid_str", "("ADDR_FIELDSPEC")", (uaddr)oid_str); /* Step 1: Sanity checks. */ if(oid_str == NULL) { AMP_DEBUG_ERR("db_add_oid_str","Bad args", NULL); AMP_DEBUG_EXIT("db_add_oid_str","-->%d", AMP_SYSERR); return AMP_FAIL; } /* Step 2: Assume input is not in hex and convert to hex string. */ if((data = utils_string_to_hex(oid_str,&datasize)) == NULL) { AMP_DEBUG_ERR("db_add_oid_str","Can't convert OID of %s.", oid_str); return AMP_FAIL; } /* Step 3: Build an OID. */ oid = oid_construct(OID_TYPE_FULL, NULL, 0, data, datasize); SRELEASE(data); if(oid.type == OID_TYPE_UNK) { AMP_DEBUG_ERR("db_add_oid_str","Can't create OID.",NULL); SRELEASE(data); AMP_DEBUG_EXIT("db_add_oid_str","-->%d",AMP_FAIL); return AMP_FAIL; } result = db_add_oid(oid); oid_release(&oid); AMP_DEBUG_EXIT("db_add_oid_str", "-->%d", result); return result; } /****************************************************************************** * * \par Function Name: db_add_oid() * * \par Adds an Object Identifier to the database, or returns the index of * a matching object identifier. * * Tables Effected: * 1. dbtOIDs * +-------------+------------------+------+-----+---------------------+----------------+ * | Field | Type | Null | Key | Default | Extra | * +-------------+------------------+------+-----+---------------------+----------------+ * | ID | int(10) unsigned | NO | PRI | NULL | auto_increment | * | IRI_Label | varchar(255) | NO | MUL | Undefined IRI value | | * | Dot_Label | varchar(255) | NO | | 190.239.254.237 | | * | Encoded | varchar(255) | NO | | BEEFFEED | | * | Description | varchar(255) | NO | | | | * +-------------+------------------+------+-----+---------------------+----------------+ * * \return AMP_SYSERR - System Error * AMP_FAIL - Non-fatal issue. * >0 - The index of the inserted item. * * \param[in] oid - The OID being added to the DB. * \param[in] spec - Listing of types of oid parms, if they exist. * \par Notes: * - Only the encoded OID is persisted in the database. * No other OID information is persisted at this time. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 08/22/15 E. Birrane Initial Implementation * 01/25/17 E. Birrane Update to AMP IOS 3.5.0. (JHU/APL) *****************************************************************************/ int32_t db_add_oid(oid_t oid) { uint32_t oid_idx = 0; int32_t num_parms = 0; char *oid_str = NULL; AMP_DEBUG_ENTRY("db_add_oid", "(%d)", oid.type); /* Step 0: Sanity check arguments. */ if(oid.type == OID_TYPE_UNK) { AMP_DEBUG_ERR("db_add_oid","Bad args",NULL); AMP_DEBUG_EXIT("db_add_oid","-->%d",AMP_FAIL); return AMP_FAIL; } /* * Step 1: Return existing ID, or failure code. */ if ((oid_idx = db_fetch_oid_idx(oid)) != 0) { AMP_DEBUG_EXIT("db_add_oid","-->%d", oid_idx); return oid_idx; } /* Step 2: Convert OID to string for storage. */ if((oid_str = oid_to_string(oid)) == NULL) { AMP_DEBUG_ERR("db_add_oid","Can't get string rep of OID.", NULL); AMP_DEBUG_EXIT("db_add_oid","-->%d", AMP_SYSERR); return AMP_SYSERR; } db_mgt_txn_start(); /* Step 3: Build and execute query to add row to dbtOIDs. */ if(db_mgt_query_insert(&oid_idx, "INSERT INTO dbtOIDs" "(IRI_Label, Dot_Label, Encoded, Description)" "VALUES ('empty','empty','%s','empty')", oid_str) != AMP_OK) { AMP_DEBUG_ERR("db_add_oid","Can't insert Nickname", NULL); SRELEASE(oid_str); db_mgt_txn_rollback(); AMP_DEBUG_EXIT("db_add_oid","-->%d", AMP_FAIL); return AMP_FAIL; } SRELEASE(oid_str); db_mgt_txn_commit(); AMP_DEBUG_EXIT("db_add_oid", "-->%d", oid_idx); return oid_idx; } /****************************************************************************** * * \par Function Name: db_add_parms * * \par Adds OID parameters to the database and returns the index of the * parameters table. * * Tables Effected: * * \return AMP_SYSERR - System Error * AMP_FAIL - Non-fatal issue. * >0 - The index of the inserted item. * * \param[in] oid - The OID whose parameters are being added to the DB. * * \par Notes: * - Comments for the parameters are not included. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 08/22/15 E. Birrane Initial Implementation * 09/10/15 E. Birrane Removed dbtMIDParameters * 01/24/17 E. Birrane Updated to new AMP implementation for ION 3.5.0 (JHU/APL) *****************************************************************************/ int32_t db_add_parms(oid_t oid) { int32_t result = 0; AMP_DEBUG_ENTRY("db_add_parms", "(%d)", oid.type); /* Step 0: Sanity check arguments. */ if(oid.type == OID_TYPE_UNK) { AMP_DEBUG_ERR("db_add_parms","Bad args",NULL); AMP_DEBUG_EXIT("db_add_parms","-->%d",AMP_FAIL); return AMP_FAIL; } result = db_add_tdc(oid.params); AMP_DEBUG_EXIT("db_add_parms", "-->%d", result); return result; } /****************************************************************************** * * \par Function Name: db_add_protomid * * \par Creates a MID template in the database. * * Tables Effected: * 1. dbtProtoMIDs * * +--------------+------------------+------+-----+--------------------+----------------+ * | Field | Type | Null | Key | Default | Extra | * +--------------+------------------+------+-----+--------------------+----------------+ * | ID | int(10) unsigned | NO | PRI | NULL | auto_increment | * | NicknameID | int(10) unsigned | YES | MUL | NULL | | * | OID | int(10) unsigned | NO | MUL | NULL | | * | ParametersID | int(10) unsigned | YES | MUL | NULL | | * | DataType | int(10) unsigned | NO | MUL | 0 | | * | OIDType | int(10) unsigned | NO | MUL | 0 | | * | Type | int(10) unsigned | NO | MUL | 0 | | * | Category | int(10) unsigned | NO | MUL | 0 | | * | Name | varchar(50) | NO | | Unnamed MID | | * | Description | varchar(255) | NO | | No MID Description | | * +--------------+------------------+------+-----+--------------------+----------------+ * * * \return AMP_SYSERR - System Error * AMP_FAIL - Non-fatal issue. * >0 - The index of the inserted item. * * \param[in] mid - The MID to be persisted in the DB. * \param[in] spec - The parameter spec for this protomid. * \param[in] type - The type of the MID. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 08/28/15 E. Birrane Initial implementation, * 01/24/17 E. Birrane Update to latest version of AMP 3.5.0 (JHU/APL) *****************************************************************************/ int32_t db_add_protomid(mid_t *mid, ui_parm_spec_t *spec, amp_type_e type) { int32_t result = 0; uint32_t nn_idx = 0; uint32_t oid_idx = 0; uint32_t parm_idx = 0; uint32_t num_parms = 0; AMP_DEBUG_ENTRY("db_add_protomid", "("ADDR_FIELDSPEC","ADDR_FIELDSPEC",%d)", (uaddr)mid, (uaddr)spec, type); /* Step 0: Sanity check arguments. */ if((mid == NULL) || (spec==NULL)) { AMP_DEBUG_ERR("db_add_protomid","Bad args",NULL); AMP_DEBUG_EXIT("db_add_protomid","-->%d",AMP_FAIL); return AMP_FAIL; } /* Step 1: Make sure the ID is not already in the DB. */ if ((result = db_fetch_protomid_idx(mid)) != 0) { AMP_DEBUG_EXIT("db_add_protomid", "-->%d", result); return result; } /* Step 2: If this MID has a nickname, grab the index. */ if((MID_GET_FLAG_OID(mid->flags) == OID_TYPE_COMP_FULL) || (MID_GET_FLAG_OID(mid->flags) == OID_TYPE_COMP_PARAM)) { if((nn_idx = db_fetch_nn_idx(mid->oid.nn_id)) <= 0) { AMP_DEBUG_ERR("db_add_protomid","MID references unknown Nickname %d", mid->oid.nn_id); AMP_DEBUG_EXIT("db_add_protomid", "-->%d", nn_idx); return nn_idx; } } db_mgt_txn_start(); /* Step 3: Get the index for the OID. */ if((oid_idx = db_add_oid(mid->oid)) <= 0) { AMP_DEBUG_ERR("db_add_protomid", "Can't add OID.", NULL); db_mgt_txn_rollback(); AMP_DEBUG_EXIT("db_add_protomid", "-->%d", oid_idx); return oid_idx; } /* Step 4: Get the index for parameters, if any. */ if((parm_idx = db_add_protoparms(spec)) <= 0) { AMP_DEBUG_ERR("db_add_protomid", "Can't add protoparms.", NULL); db_mgt_txn_rollback(); AMP_DEBUG_EXIT("db_add_protomid", "-->%d", parm_idx); return parm_idx; } if(db_mgt_query_insert((uint32_t*)&result, "INSERT INTO dbtProtoMIDs" "(NicknameID,OID,ParametersID,Type,Category," "OIDType,DataType,Name,Description)" "VALUES (%s, %d, %d, %d, %d, %d, %d, '%s','%s')", (nn_idx == 0) ? "NULL" : itoa(nn_idx), oid_idx, parm_idx, 0, MID_GET_FLAG_ID(mid->flags), MID_GET_FLAG_OID(mid->flags), type, "No Name", "No Descr") != AMP_OK) { AMP_DEBUG_ERR("db_add_protomid", "Can't add protomid.", NULL); db_mgt_txn_rollback(); AMP_DEBUG_EXIT("db_add_protomid", "-->%d", AMP_FAIL); return AMP_FAIL; } db_mgt_txn_commit(); AMP_DEBUG_EXIT("db_add_protomid", "-->%d", result); return result; } /****************************************************************************** * * \par Function Name: db_add_protoparms * * \par Adds parameter specs to the database and returns the index of the * parameters table. * * Tables Effected: * 1. dbtProtoMIDParameters * * +---------+------------------+------+-----+------------+----------------+ * | Field | Type | Null | Key | Default | Extra | * +---------+------------------+------+-----+------------+----------------+ * | ID | int(10) unsigned | NO | PRI | NULL | auto_increment | * | Comment | varchar(255) | NO | | No Comment | | * +---------+------------------+------+-----+------------+----------------+ * * * 2. dbtProtoMIDParameter * * +-----------------+------------------+------+-----+---------+----------------+ * | Field | Type | Null | Key | Default | Extra | * +-----------------+------------------+------+-----+---------+----------------+ * | ID | int(10) unsigned | NO | PRI | NULL | auto_increment | * | CollectionID | int(10) unsigned | YES | MUL | NULL | | * | ParameterOrder | int(10) unsigned | NO | | 0 | | * | ParameterTypeID | int(10) unsigned | YES | MUL | NULL | | * +-----------------+------------------+------+-----+---------+----------------+ * * \return AMP_SYSERR - System Error * AMP_FAIL - Non-fatal issue. * >0 - The index of the inserted item. * * \param[in] spec - The parm spec that gives the types of OID parms. * * \par Notes: * - Comments for the parameters are not included. * - A return of AMP_FAIL is only an error if the oid has parameters. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 08/28/15 E. Birrane Initial Implementation * 01/25/17 E. Birrane Update to latest version of AMP 3.5.0 (JHU/APL) *****************************************************************************/ int32_t db_add_protoparms(ui_parm_spec_t *spec) { int32_t i = 0; int32_t num_parms = 0; uint32_t result = 0; uint32_t parm_idx = 0; AMP_DEBUG_ENTRY("db_add_protoparms", "("ADDR_FIELDSPEC")", (uaddr) spec); /* Step 0: Sanity check arguments. */ if(spec == NULL) { AMP_DEBUG_ERR("db_add_protoparms","Bad args",NULL); AMP_DEBUG_EXIT("db_add_protoparms","-->%d",AMP_FAIL); return AMP_FAIL; } if((spec->num_parms == 0) || (spec->num_parms >= MAX_PARMS)) { AMP_DEBUG_ERR("db_add_protoparms","Bad # parms.",NULL); AMP_DEBUG_EXIT("db_add_protoparms","-->%d",AMP_FAIL); return AMP_FAIL; } db_mgt_txn_start(); /* Step 1: Add an entry in the parameters table. */ if(db_mgt_query_insert(&result, "INSERT INTO dbtProtoMIDParameters (Comment) " "VALUES ('No comment')") != AMP_OK) { AMP_DEBUG_ERR("db_add_protoparms","Can't insert Protoparm", NULL); db_mgt_txn_rollback(); AMP_DEBUG_EXIT("db_add_protoparms","-->%d", AMP_FAIL); return AMP_FAIL; } /* Step 2: For each parameter, get the DC, add the DC into the DB, * and then add an entry into dbtMIDParameter */ for(i = 0; i < spec->num_parms; i++) { if(db_mgt_query_insert(&parm_idx, "INSERT INTO dbtProtoMIDParameter " "(CollectionID, ParameterOrder, ParameterTypeID) " "VALUES (%d, %d, %d)", result, i, spec->parm_type[i]) != AMP_OK) { AMP_DEBUG_ERR("db_add_protoparms","Can't insert Parm", NULL); db_mgt_txn_rollback(); AMP_DEBUG_EXIT("db_add_protoparms","-->%d", AMP_FAIL); return AMP_FAIL; } } db_mgt_txn_commit(); AMP_DEBUG_EXIT("db_add_protoparms", "-->%d", result); return result; } /****************************************************************************** * \par Function Name: db_fetch_adm_idx * * \par Gets the ADM index given an ADM description * * \return AMP_SYSERR - System Error * AMP_FAIL - Non-fatal issue. * >0 - The fetched idx. * * \param[in] name - The ADM name. * \param[in] version - The ADM version. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 08/29/15 E. Birrane Initial implementation, * 01/25/17 E. Birrane Update to latest version of AMP 3.5.0 (JHU/APL) *****************************************************************************/ int32_t db_fetch_adm_idx(char *name, char *version) { int32_t result = 0; MYSQL_RES *res = NULL; MYSQL_ROW row; AMP_DEBUG_ENTRY("db_fetch_adm_idx","("ADDR_FIELDSPEC","ADDR_FIELDSPEC")", (uaddr)name, (uaddr) version); if((name == NULL) || (version == NULL)) { AMP_DEBUG_ERR("db_fetch_adm_idx","Bad Args.", NULL); AMP_DEBUG_EXIT("db_fetch_adm_idx","-->%d", AMP_FAIL); return AMP_FAIL; } if(db_mgt_query_fetch(&res, "SELECT * FROM dbtADMs WHERE Label='%s' AND Version='%s'", name, version) != AMP_OK) { AMP_DEBUG_ERR("db_fetch_adm_idx","Can't fetch", NULL); AMP_DEBUG_EXIT("db_fetch_adm_idx","-->%d", AMP_FAIL); return AMP_FAIL; } /* Step 2: Parse information out of the returned row. */ if ((row = mysql_fetch_row(res)) != NULL) { result = atoi(row[0]); } /* Step 3: Free database resources. */ mysql_free_result(res); AMP_DEBUG_EXIT("db_fetch_adm_idx","-->%d", result); return result; } /****************************************************************************** * * \par Function Name: db_fetch_tdc * * \par Creates a typed data collection from dbtDataCollections in the database * * \retval a TDC object (with type UNKNOWN on error). * * \param[in] id - The Primary Key in the dbtDataCollections table. * * \par Notes: * - A TDC with a length of 0 indicates an error retrieving the TDC. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 07/23/13 S. Jacobs Initial implementation, * 08/23/15 E. Birrane Update to new schema. * 01/25/17 E. Birrane Update to AMP 3.5.0 (JHU/APL) *****************************************************************************/ tdc_t db_fetch_tdc(int32_t tdc_idx) { MYSQL_RES *res = NULL; MYSQL_ROW row; tdc_t result; blob_t *entry; AMP_DEBUG_ENTRY("db_fetch_tdc", "(%d)", tdc_idx); tdc_init(&result); /* Step 1: Construct/run the Query and capture results. */ if(db_mgt_query_fetch(&res, "SELECT * FROM dbtDataCollection " "WHERE CollectionID=%d " "ORDER BY DataOrder", tdc_idx) != AMP_OK) { AMP_DEBUG_ERR("db_fetch_tdc","Can't fetch", NULL); AMP_DEBUG_EXIT("db_fetch_tdc","-->NULL", NULL); return result; } /* Step 2: For each entry returned as part of the collection. */ while ((row = mysql_fetch_row(res)) != NULL) { amp_type_e type; if((entry = db_fetch_tdc_entry_from_row(row, &type)) == NULL) { AMP_DEBUG_ERR("db_fetch_tdc", "Can't get entry.", NULL); tdc_clear(&result); mysql_free_result(res); tdc_init(&result); AMP_DEBUG_EXIT("db_fetch_tdc","-->NULL", NULL); return result; } tdc_insert(&result, type, entry->value, entry->length); } /* Step 4: Free results. */ mysql_free_result(res); AMP_DEBUG_EXIT("db_fetch_dc", "-->%d", result.hdr.length); return result; } /******************************************************************************* * * \par Function Name: db_fetch_data_col_entry_from_row * * \par Parses a data collection entry from a database row from the * dbtataCollection table. * * \retval NULL The entry could not be retrieved * !NULL The created data collection entry. * * \param[in] row - The row containing the data col entry information. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 08/19/13 E. Birrane Initial implementation, * 01/25/17 E. Birrane Update to AMP 3.5.0 (JHU/APL) ******************************************************************************/ blob_t* db_fetch_tdc_entry_from_row(MYSQL_ROW row, amp_type_e *type) { blob_t *result = NULL; uint8_t *value = NULL; uint32_t length = 0; AMP_DEBUG_ENTRY("db_fetch_tdc_entry_from_row","("ADDR_FIELDSPEC","ADDR_FIELDSPEC")", (uaddr)row, (uaddr)type); /* Step 1: grab data from the row. */ value = utils_string_to_hex(row[3], &length); if((value == NULL) || (length == 0)) { AMP_DEBUG_ERR("db_fetch_tdc_entry_from_row", "Can't grab value for %s", row[3]); AMP_DEBUG_EXIT("db_fetch_tdc_entry_from_row", "-->NULL", NULL); return NULL; } /* Step 2: Create the blob representing the entry. */ if((result = blob_create(value,length)) == NULL) { AMP_DEBUG_ERR("db_fetch_tdc_entry_from_row", "Can't make blob", NULL); SRELEASE(value); AMP_DEBUG_EXIT("db_fetch_tdc_entry_from_row", "-->NULL", NULL); return NULL; } /* Step 3: Store the type. */ *type = atoi(row[2]); AMP_DEBUG_EXIT("db_fetch_tdc_entry_from_row", "-->"ADDR_FIELDSPEC, (uaddr) result); return result; } /****************************************************************************** * * \par Function Name: db_fetch_mid * * \par Creates a MID structure from a row in the dbtMIDs database. * * \retval NULL Failure * !NULL The built MID structure. * * \param[in] idx - The Primary Key of the desired MID in the dbtMIDs table. * * \par Notes: * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 07/12/13 S. Jacobs Initial implementation, * 08/23/15 E. Birrane Update to new schema. * 01/25/17 E. Birrane Update to AMP 3.5.0 (JHU/APL) *****************************************************************************/ mid_t *db_fetch_mid(int32_t idx) { MYSQL_RES *res = NULL; MYSQL_ROW row; mid_t *result = NULL; AMP_DEBUG_ENTRY("db_fetch_mid", "(%d)", idx); /* Step 1: Construct and run the query to get the MID information. */ if(db_mgt_query_fetch(&res, "SELECT * FROM dbtMIDs WHERE ID=%d", idx) != AMP_OK) { AMP_DEBUG_ERR("db_fetch_mid","Can't fetch", NULL); AMP_DEBUG_EXIT("db_fetch_mid","-->%d", AMP_FAIL); return AMP_FAIL; } /* Step 2: Parse information out of the returned row. */ if ((row = mysql_fetch_row(res)) == NULL) { AMP_DEBUG_ERR("db_fetch_mid","Can't grab row", NULL); mysql_free_result(res); AMP_DEBUG_EXIT("db_fetch_mid","-->%d", AMP_FAIL); return AMP_FAIL; } /* Step 3: Build MID from the row. */ if((result = db_fetch_mid_from_row(row)) == NULL) { AMP_DEBUG_ERR("db_fetch_mid","Can't build MID from row", NULL); mysql_free_result(res); AMP_DEBUG_EXIT("db_fetch_mid","-->%d", AMP_FAIL); return AMP_FAIL; } mysql_free_result(res); AMP_DEBUG_EXIT("db_fetch_mid", "-->"ADDR_FIELDSPEC, (uaddr) result); return result; } /****************************************************************************** * * \par Function Name: db_fetch_mid_col * * \par Creates a MID collection from a row in the dbtMIDCollection database. * * \retval NULL Failure * !NULL The built MID collection. * * \param[in] idx - The Primary Key in the dbtMIDCollection table. * * \par Notes: * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 07/12/13 S. Jacobs Initial implementation * 08/23/15 E. Birrane Update to new database schema * 01/25/17 E. Birrane Update to AMP 3.5.0 (JHU/APL) *****************************************************************************/ Lyst db_fetch_mid_col(int idx) { Lyst result = lyst_create(); mid_t *new_mid = NULL; char query[1024]; MYSQL_RES *res = NULL; MYSQL_ROW row; AMP_DEBUG_ENTRY("db_fetch_mid_col","(%d)", idx); /* Step 1: Construct and run the query to get the MID information. */ if(db_mgt_query_fetch(&res, "SELECT MIDID FROM dbtMIDCollection WHERE CollectionID=%d ORDER BY MIDOrder", idx) != AMP_OK) { AMP_DEBUG_ERR("db_fetch_mid_col","Can't fetch", NULL); AMP_DEBUG_EXIT("db_fetch_mid_col","-->%d", AMP_FAIL); return AMP_FAIL; } /* Step 2: For each MID in the collection... */ while ((row = mysql_fetch_row(res)) != NULL) { /* Step 2.1: For each row, build a MID and add it to the collection. */ if((new_mid = db_fetch_mid(atoi(row[0]))) == NULL) { AMP_DEBUG_ERR("db_fetch_mid_col", "Can't grab MID with ID %d.", atoi(row[0])); midcol_destroy(&result); mysql_free_result(res); AMP_DEBUG_EXIT("db_fetch_mid_col", "-->NULL", NULL); return NULL; } lyst_insert_last(result, new_mid); } /* Step 3: Free database resources. */ mysql_free_result(res); AMP_DEBUG_EXIT("db_fetch_mid_col", "-->"ADDR_FIELDSPEC, (uaddr) result); return result; } /****************************************************************************** * \par Function Name: db_fetch_mid_from_row * * \par Gets a MID from the MID table. * * \retval NULL Failure * !NULL The fetched MID * * \param[in] row - The row containing the data col entry information. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 01/25/17 E. Birrane Initial implementation, (JHU/APL) *****************************************************************************/ mid_t* db_fetch_mid_from_row(MYSQL_ROW row) { oid_t oid; mid_t *result = NULL; AMP_DEBUG_ENTRY("db_fetch_mid_from_row", "("ADDR_FIELDSPEC")", (uaddr)row); /* Step 0: Sanity check. */ if(row == NULL) { AMP_DEBUG_ERR("db_fetch_mid_from_row","Bad args", NULL); AMP_DEBUG_EXIT("db_fetch_mid_from_row","-->NULL", NULL); return NULL; } /* Step 1: Build parametrs from row. */ uint32_t nn_idx = (row[1] == NULL) ? 0 : atoi(row[1]); uint32_t oid_idx = (row[2] == NULL) ? 0 : atoi(row[2]); uint32_t parm_idx = (row[3] == NULL) ? 0 : atoi(row[3]); uint8_t type = (row[4] == NULL) ? 0 : atoi(row[4]); uint8_t cat = (row[5] == NULL) ? 0 : atoi(row[5]); uint8_t issFlag = (row[6] == NULL) ? 0 : atoi(row[6]); uint8_t tagFlag = (row[7] == NULL) ? 0 : atoi(row[7]); uint8_t oidType = (row[8] == NULL) ? 0 : atoi(row[8]); uvast issuer = (uvast) (row[9] == NULL) ? 0 : atoll(row[9]); uvast tag = (uvast) (row[10] == NULL) ? 0 : atoll(row[10]); uint32_t dtype = (row[11] == NULL) ? 0 : atoi(row[11]); uint32_t mid_type = 0; /* Step 2: Create the OID. */ oid = db_fetch_oid(nn_idx, parm_idx, oid_idx); if(oid.type == OID_TYPE_UNK) { AMP_DEBUG_ERR("db_fetch_mid_from_row","Cannot fetch the oid: %d", oid_idx); oid_release(&oid); AMP_DEBUG_EXIT("db_fetch_mid_from_row","-->NULL", NULL); return NULL; } oid.type = oidType; switch(cat) { case 0: mid_type = MID_ATOMIC; break; case 1: mid_type = MID_COMPUTED; break; case 2: mid_type = MID_REPORT; break; case 3: mid_type = MID_CONTROL; break; case 4: mid_type = MID_SRL; break; case 5: mid_type = MID_TRL; break; case 6: mid_type = MID_MACRO; break; case 7: mid_type = MID_LITERAL; break; case 8: mid_type = MID_OPERATOR; break; default: mid_type = MID_ANY; } if ((result = mid_construct(mid_type, issFlag ? &issuer : NULL, tagFlag ? &tag : NULL, oid)) == NULL) { AMP_DEBUG_ERR("db_fetch_mid_from_row", "Cannot construct MID", NULL); oid_release(&oid); AMP_DEBUG_EXIT("db_fetch_mid_from_row","-->NULL", NULL); return NULL; } oid_release(&oid); if (mid_sanity_check(result) == 0) { char *data = mid_pretty_print(result); AMP_DEBUG_ERR("db_fetch_mid_from_row", "Failed MID sanity check. %s", data); SRELEASE(data); mid_release(result); result = NULL; } AMP_DEBUG_EXIT("db_fetch_mid_from_row","-->"ADDR_FIELDSPEC, (uaddr)result); return result; } /****************************************************************************** * \par Function Name: db_fetch_mid_idx * * \par Gets a MID and returns the index of the MID * * \retval 0 Failure * !0 The index of the MID * * \param[in] mid - the MID whose index is being queried * * Note: There is probably a much better way to do this. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 07/23/13 S. Jacobs Initial implementation, * 08/24/15 E. Birrane Update to latest schema * 01/25/17 E. Birrane Update to AMP 3.5.0 (JHU/APL) *****************************************************************************/ int32_t db_fetch_mid_idx(mid_t *mid) { int32_t result = 0; int32_t cur_idx = 0; MYSQL_RES *res = NULL; MYSQL_ROW row; AMP_DEBUG_ENTRY("db_fetch_mid_idx","("ADDR_FIELDSPEC")", (uaddr)mid); /* Step 0: Sanity check arguments. */ if(mid == NULL) { AMP_DEBUG_ERR("db_fetch_mid_idx","Bad args",NULL); AMP_DEBUG_EXIT("db_fetch_mid_idx","-->NULL", NULL); return AMP_FAIL; } if(db_mgt_query_fetch(&res, "SELECT * FROM dbtMIDs WHERE " "Type=%d AND Category=%d AND IssuerFlag=%d AND TagFlag=%d " "AND OIDType=%d AND IssuerID="UVAST_FIELDSPEC" " "AND TagValue="UVAST_FIELDSPEC, 0, MID_GET_FLAG_ID(mid->flags), (MID_GET_FLAG_ISS(mid->flags)) ? 1 : 0, (MID_GET_FLAG_TAG(mid->flags)) ? 1 : 0, MID_GET_FLAG_OID(mid->flags), mid->issuer, mid->tag) != AMP_OK) { AMP_DEBUG_ERR("db_fetch_mid_col","Can't fetch", NULL); AMP_DEBUG_EXIT("db_fetch_mid_col","-->%d", AMP_FAIL); return AMP_FAIL; } /* Step 2: For each matching MID, check other items... */ result = AMP_FAIL; while ((row = mysql_fetch_row(res)) != NULL) { cur_idx = (row[0] == NULL) ? 0 : atoi(row[0]); int32_t nn_idx = (row[1] == NULL) ? 0 : atoi(row[1]); int32_t oid_idx = (row[2] == NULL) ? 0 : atoi(row[2]); int32_t parm_idx = (row[3] == NULL) ? 0 : atoi(row[3]); oid_t oid = db_fetch_oid(nn_idx, parm_idx, oid_idx); if((oid.type != OID_TYPE_UNK) && (oid_compare(oid, mid->oid, 1) == 0)) { oid_release(&oid); result = cur_idx; break; } oid_release(&oid); } /* Step 3: Free database resources. */ mysql_free_result(res); /* Step 4: Return the IDX. */ AMP_DEBUG_EXIT("db_fetch_mid_idx", "-->%d", result); return result; } /****************************************************************************** * \par Function Name: db_fetch_nn * * \par Gets the nickname UID given a primary key index into the Nickname table. * * \retval -1 system error * 0 non-fatal error * >0 The nickname UID. * * \param[in] idx - Index of the nickname UID being queried. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 08/24/15 E. Birrane Initial implementation, * 01/25/17 E. Birrane Update to AMP 3.5.0 (JHU/APL) *****************************************************************************/ int32_t db_fetch_nn(uint32_t idx) { int32_t result = AMP_FAIL; MYSQL_RES *res = NULL; MYSQL_ROW row; AMP_DEBUG_ENTRY("db_fetch_nn","(%d)", idx); /* Step 0: Sanity checks. */ if(idx == 0) { AMP_DEBUG_ERR("db_fetch_nn","Bad Args.", NULL); AMP_DEBUG_EXIT("db_fetch_nn","-->AMP_FAIL", NULL); return AMP_FAIL; } /* Step 1: Grab the NN row */ if(db_mgt_query_fetch(&res, "SELECT * FROM dbtADMNicknames WHERE ID=%d", idx) != AMP_OK) { AMP_DEBUG_ERR("db_fetch_nn","Can't fetch", NULL); AMP_DEBUG_EXIT("db_fetch_nn","-->%d", AMP_FAIL); return AMP_FAIL; } /* Step 2: Parse information out of the returned row. */ if ((row = mysql_fetch_row(res)) != NULL) { result = atoi(row[2]); } else { AMP_DEBUG_ERR("db_fetch_nn", "Did not find NN with ID of %d\n", idx); } /* Step 3: Free database resources. */ mysql_free_result(res); AMP_DEBUG_EXIT("db_fetch_nn","-->%d", result); return result; } /****************************************************************************** * \par Function Name: db_fetch_nn_idx * * \par Gets the index of a nickname UID. * * \retval -1 system error * 0 non-fatal error * >0 The nickname index. * * \param[in] nn - The nickname UID whose index is being queried. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 08/24/15 E. Birrane Initial implementation, * 01/25/17 E. Birrane Update to AMP 3.5.0 (JHU/APL) *****************************************************************************/ int32_t db_fetch_nn_idx(uint32_t nn) { int32_t result = AMP_FAIL; MYSQL_RES *res = NULL; MYSQL_ROW row; AMP_DEBUG_ENTRY("db_fetch_nn_idx","(%d)", nn); if(db_mgt_query_fetch(&res, "SELECT * FROM dbtADMNicknames WHERE Nickname_UID=%d", nn) != AMP_OK) { AMP_DEBUG_ERR("db_fetch_nn_idx","Can't fetch", NULL); AMP_DEBUG_EXIT("db_fetch_nn_idx","-->%d", AMP_FAIL); return AMP_FAIL; } /* Step 2: Parse information out of the returned row. */ if ((row = mysql_fetch_row(res)) != NULL) { result = atoi(row[0]); } /* Step 3: Free database resources. */ mysql_free_result(res); AMP_DEBUG_EXIT("db_fetch_nn_idx","-->%d", result); return result; } /****************************************************************************** * \par Function Name: db_fetch_oid_val * * \par Gets OID encoded value of an OID from the database. * * \retval NULL Failure * !NULL The encoded value as a series of bytes. * * \param[in] idx - Index of the OID being queried. * \param[out] size - Size of the returned encoded value. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 08/24/15 E. Birrane Initial implementation, * 01/25/17 E. Birrane Update to AMP 3.5.0 (JHU/APL) *****************************************************************************/ uint8_t* db_fetch_oid_val(uint32_t idx, uint32_t *size) { uint8_t *result = NULL; MYSQL_RES *res = NULL; MYSQL_ROW row; AMP_DEBUG_ENTRY("db_fetch_oid_val","(%d,"ADDR_FIELDSPEC")", idx, (uaddr)size); /* Step 0: Sanity check. */ if((idx == 0) || (size == NULL)) { AMP_DEBUG_ERR("db_fetch_oid_val","Bad Args.", NULL); AMP_DEBUG_EXIT("db_fetch_oid_val","-->NULL", NULL); return NULL; } if(db_mgt_query_fetch(&res, "SELECT Encoded FROM dbtOIDs WHERE ID=%d", idx) != AMP_OK) { AMP_DEBUG_ERR("db_fetch_oid_val","Can't fetch", NULL); AMP_DEBUG_EXIT("db_fetch_oid_val","-->NULL", NULL); return NULL; } /* Step 2: Parse information out of the returned row. */ if ((row = mysql_fetch_row(res)) != NULL) { result = utils_string_to_hex(row[0],size); } else { AMP_DEBUG_ERR("db_fetch_oid_val", "Did not find OID with ID of %d\n", idx); } /* Step 3: Free database resources. */ mysql_free_result(res); AMP_DEBUG_EXIT("db_fetch_oid_val","-->%d", result); return result; } /***************************************************************************** * * \par Function Name: db_fetch_oid * * \par Grabs an OID from the database, querying from the nickname and * parameter tables as well to create a full OID structure. * * \retval NULL OID could not be fetched * !NULL The OID * * \param[in] nn_idx - The index for the OID nickname, or 0. * \param[in] parm_idx - The index for the OIDParms, or 0. * \param[out] oid_idx - The index for the OID value. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 07/25/13 S. Jacobs Initial implementation, * 08/24/15 E. Birrane Updated to new schema. * 01/25/17 E. Birrane Update to AMP 3.5.0 (JHU/APL) ******************************************************************************/ oid_t db_fetch_oid(uint32_t nn_idx, uint32_t parm_idx, uint32_t oid_idx) { oid_t result; tdc_t parms; uint32_t nn_id = 0; uint32_t val_size = 0; uint8_t *val = NULL; uint32_t oid_type = OID_TYPE_FULL; AMP_DEBUG_ENTRY("db_fetch_oid","(%d, %d, %d)", nn_idx, parm_idx, oid_idx); oid_init(&result); tdc_init(&parms); /* Step 0: Sanity Check. */ if(oid_idx == 0) { AMP_DEBUG_ERR("db_fetch_oid","Bad Args.", NULL); AMP_DEBUG_EXIT("db_fetch_oid","-->OID_TYPE_UNK", NULL); return result; } /* Step 1: Grab the OID value string. */ if((val = db_fetch_oid_val(oid_idx, &val_size)) == NULL) { AMP_DEBUG_ERR("db_fetch_oid","Can't get OID for idx %d.", oid_idx); AMP_DEBUG_EXIT("db_fetch_oid","-->OID_TYPE_UNK", NULL); return result; } /* Step 2: Grab parameters, if the OID has them. */ if(parm_idx > 0) { parms = db_fetch_tdc(parm_idx); if(nn_idx == 0) { oid_type = OID_TYPE_PARAM; } } /* Step 3: Grab the nickname, if the OID has one. */ if(nn_idx > 0) { nn_id = db_fetch_nn(nn_idx); oid_type = (parm_idx == 0) ? OID_TYPE_COMP_FULL : OID_TYPE_COMP_PARAM; } /* * Step 4: Construct the OID. This deep-copies parameters so we can * release the parms and value afterwards. */ result = oid_construct(oid_type, &parms, nn_id, val, val_size); SRELEASE(val); tdc_clear(&parms); AMP_DEBUG_EXIT("db_fetch_oid","-->%d", result.type); return result; } /***************************************************************************** * * \par Function Name: db_fetch_oid_idx * * \par Retrieves the index of an OID value in the OID table. * * \retval 0 The OID is not found in the DB. * !0 The index of the OID value. * * \param[in] oid - The OID whose index is being queried. * * Note: This function only matches on the OID value and ignores * nicknames and parameters. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 08/24/15 E. Birrane Initial implementation, * 01/25/17 E. Birrane Update to newest AMP implementation ******************************************************************************/ int32_t db_fetch_oid_idx(oid_t oid) { int32_t result = AMP_FAIL; char *oid_str = NULL; MYSQL_RES *res = NULL; MYSQL_ROW row; AMP_DEBUG_ENTRY("db_fetch_oid_idx","(%d)", oid.type); /* Step 0: Sanity checks. */ if(oid.type == OID_TYPE_UNK) { AMP_DEBUG_ERR("db_fetch_oid_idx","Bad Args.", NULL); AMP_DEBUG_EXIT("db_fetch_oid_idx","-->%d", AMP_FAIL); return AMP_FAIL; } /* Step 1: Build string version of OID for searching. */ if((oid_str = oid_to_string(oid)) == NULL) { AMP_DEBUG_ERR("db_fetch_oid_idx","Can't get string rep of OID.", NULL); AMP_DEBUG_EXIT("db_fetch_oid_idx","-->%d",AMP_FAIL); return AMP_FAIL; } /* Step 2: Grab the OID row. */ if(db_mgt_query_fetch(&res, "SELECT * FROM dbtOIDs WHERE Encoded='%s'", oid_str) != AMP_OK) { AMP_DEBUG_ERR("db_fetch_oid_idx","Can't fetch", NULL); SRELEASE(oid_str); AMP_DEBUG_EXIT("db_fetch_oid_idx","-->%d", AMP_FAIL); return AMP_FAIL; } /* Step 3: Grab the row idx. */ if ((row = mysql_fetch_row(res)) != NULL) { result = atoi(row[0]); } mysql_free_result(res); SRELEASE(oid_str); AMP_DEBUG_EXIT("db_fetch_oid_idx","-->%d", result); return result; } /****************************************************************************** * * \par Function Name: db_fetch_parms * * \par Retrieves the set of parameters associated with a parameter index. * * Tables Effected: * * \return NULL Failure * !NULL The parameters. * * \param[in] idx - The index of the parameters * * \par Notes: * - If there are no parameters, but no error, then a Lyst with no entries * is returned. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 08/24/15 E. Birrane Initial Implementation * 01/25/17 E. Birrane Update to AMP 3.5.0 (JHU/APL) *****************************************************************************/ Lyst db_fetch_parms(uint32_t idx) { Lyst result = 0; MYSQL_RES *res = NULL; MYSQL_ROW row; uint32_t dc_idx = 0; blob_t* entry = NULL; AMP_DEBUG_ENTRY("db_fetch_parms", "(%d)", idx); /* Step 0: Sanity check arguments. */ if(idx == 0) { AMP_DEBUG_ERR("db_fetch_parms","Bad args",NULL); AMP_DEBUG_EXIT("db_fetch_parms","-->NULL",NULL); return NULL; } /* Step 1: Grab the OID row. */ if(db_mgt_query_fetch(&res, "SELECT DataCollectionID FROM dbtMIDParameter " "WHERE CollectionID=%d ORDER BY ItemOrder", idx) != AMP_OK) { AMP_DEBUG_ERR("db_fetch_parms","Can't fetch", NULL); AMP_DEBUG_EXIT("db_fetch_parms","-->NULL", NULL); return NULL; } /* Step 2: Allocate the return lyst. */ if((result = lyst_create()) == NULL) { AMP_DEBUG_ERR("db_fetch_parms","Can't allocate lyst",NULL); mysql_free_result(res); AMP_DEBUG_EXIT("db_fetch_parms","-->NULL",NULL); return NULL; } /* Step 3: For each matching parameter... */ while ((row = mysql_fetch_row(res)) != NULL) { amp_type_e type; if((entry = db_fetch_tdc_entry_from_row(row, &type)) == NULL) { AMP_DEBUG_ERR("db_fetch_parms", "Can't get entry.", NULL); dc_destroy(&result); mysql_free_result(res); AMP_DEBUG_EXIT("db_fetch_parms","-->NULL",NULL); return NULL; } lyst_insert_last(result, entry); } /* Step 4: Free results. */ mysql_free_result(res); AMP_DEBUG_EXIT("db_fetch_parms", "-->"ADDR_FIELDSPEC, (uaddr)result); return result; } /****************************************************************************** * \par Function Name: db_fetch_protomid_idx * * \par Gets a MID and returns the index of the matching proto mid. * * \retval 0 Failure finding index. * !0 The index of the MID * * \param[in] mid - the MID whose proto index is being queried * * Note: There is probably a much better way to do this. * * Modification History: * MM/DD/YY AUTHOR DESCRIPTION * -------- ------------ --------------------------------------------- * 08/28/15 E. Birrane Initial implementation, * 01/25/17 E. Birrane Update to AMP 3.5.0 (JHU/APL) *****************************************************************************/ int32_t db_fetch_protomid_idx(mid_t *mid) { int32_t result = AMP_FAIL; int32_t cur_idx = 0; MYSQL_RES *res = NULL; MYSQL_ROW row; AMP_DEBUG_ENTRY("db_fetch_protomid_idx","("ADDR_FIELDSPEC")", (uaddr)mid); /* Step 0: Sanity check arguments. */ if(mid == NULL) { AMP_DEBUG_ERR("db_fetch_protomid_idx","Bad args",NULL); AMP_DEBUG_EXIT("db_fetch_parms", "-->%d", AMP_FAIL); return AMP_FAIL; } /* Step 1: Grab the OID row. */ if(db_mgt_query_fetch(&res, "SELECT * FROM dbtProtoMIDs WHERE " "Type=%d AND Category=%d AND OIDType=%d", 0, MID_GET_FLAG_ID(mid->flags), MID_GET_FLAG_OID(mid->flags)) != AMP_OK) { AMP_DEBUG_ERR("db_fetch_parms","Can't fetch", NULL); AMP_DEBUG_EXIT("db_fetch_parms","-->%d", AMP_FAIL); return AMP_FAIL; } /* Step 2: For each matching MID, check other items... */ while ((row = mysql_fetch_row(res)) != NULL) { cur_idx = atoi(row[0]); int32_t nn_idx = atoi(row[1]); int32_t oid_idx = atoi(row[2]); oid_t oid = db_fetch_oid(nn_idx, 0, oid_idx); if(oid_compare(oid, mid->oid, 0) == 0) { oid_release(&oid); result = cur_idx; break; } oid_release(&oid); } mysql_free_result(res); AMP_DEBUG_EXIT("db_fetch_protomid_idx", "-->%d", result); return result; } #endif #endif //#endif // HAVE_MYSQL
the_stack_data/192329674.c
/* $OpenBSD: ruptime.c,v 1.16 2009/10/27 23:59:43 deraadt Exp $ */ /* * Copyright (c) 1983 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/param.h> #include <sys/file.h> #include <dirent.h> #include <protocols/rwhod.h> #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <err.h> size_t nhosts, hspace = 20; struct hs { struct whod *hs_wd; int hs_nusers; } *hs; struct whod awhod; #define ISDOWN(h) (now - (h)->hs_wd->wd_recvtime > 11 * 60) #define WHDRSIZE (sizeof (awhod) - sizeof (awhod.wd_we)) time_t now; int rflg = 1; int hscmp(const void *, const void *); int ucmp(const void *, const void *); int lcmp(const void *, const void *); int tcmp(const void *, const void *); char *interval(time_t, char *); void morehosts(void); int main(int argc, char *argv[]) { extern char *__progname; struct hs *hsp; struct whod *wd; struct whoent *we; DIR *dirp; struct dirent *dp; int aflg, cc, ch, f, i, maxloadav; char buf[sizeof(struct whod)]; int (*cmp)(const void *, const void *) = hscmp; aflg = 0; while ((ch = getopt(argc, argv, "alrut")) != -1) switch((char)ch) { case 'a': aflg = 1; break; case 'l': cmp = lcmp; break; case 'r': rflg = -1; break; case 't': cmp = tcmp; break; case 'u': cmp = ucmp; break; default: fprintf(stderr, "usage: %s [-alrtu]\n", __progname); exit(1); } if (chdir(_PATH_RWHODIR) || (dirp = opendir(".")) == NULL) err(1, "%s", _PATH_RWHODIR); morehosts(); hsp = hs; maxloadav = -1; while ((dp = readdir(dirp))) { if (dp->d_ino == 0 || strncmp(dp->d_name, "whod.", 5)) continue; if ((f = open(dp->d_name, O_RDONLY, 0)) < 0) { warn("%s", dp->d_name); continue; } cc = read(f, buf, sizeof(struct whod)); (void)close(f); if (cc < WHDRSIZE) continue; if (nhosts == hspace) { morehosts(); hsp = hs + nhosts; } /* NOSTRICT */ hsp->hs_wd = malloc((size_t)WHDRSIZE); wd = (struct whod *)buf; bcopy((char *)wd, (char *)hsp->hs_wd, (size_t)WHDRSIZE); hsp->hs_nusers = 0; for (i = 0; i < 2; i++) if (wd->wd_loadav[i] > maxloadav) maxloadav = wd->wd_loadav[i]; we = (struct whoent *)(buf+cc); while (--we >= wd->wd_we) if (aflg || we->we_idle < 3600) hsp->hs_nusers++; nhosts++; hsp++; } if (!nhosts) errx(1, "no hosts in %s.", _PATH_RWHODIR); (void)time(&now); qsort((char *)hs, nhosts, sizeof (hs[0]), cmp); for (i = 0; i < nhosts; i++) { hsp = &hs[i]; if (ISDOWN(hsp)) { (void)printf("%-12.12s%s\n", hsp->hs_wd->wd_hostname, interval(now - hsp->hs_wd->wd_recvtime, "down")); continue; } (void)printf( "%-12.12s%s, %4d user%s load %*.2f, %*.2f, %*.2f\n", hsp->hs_wd->wd_hostname, interval((time_t)hsp->hs_wd->wd_sendtime - (time_t)hsp->hs_wd->wd_boottime, " up"), hsp->hs_nusers, hsp->hs_nusers == 1 ? ", " : "s,", maxloadav >= 1000 ? 5 : 4, hsp->hs_wd->wd_loadav[0] / 100.0, maxloadav >= 1000 ? 5 : 4, hsp->hs_wd->wd_loadav[1] / 100.0, maxloadav >= 1000 ? 5 : 4, hsp->hs_wd->wd_loadav[2] / 100.0); free((void *)hsp->hs_wd); } exit(0); } char * interval(time_t tval, char *updown) { static char resbuf[32]; int days, hours, minutes; if (tval < 0 || tval > 999*24*60*60) { (void)snprintf(resbuf, sizeof resbuf, "%s ??:??", updown); return(resbuf); } minutes = (tval + 59) / 60; /* round to minutes */ hours = minutes / 60; minutes %= 60; days = hours / 24; hours %= 24; if (days) (void)snprintf(resbuf, sizeof resbuf, "%s %3d+%02d:%02d", updown, days, hours, minutes); else (void)snprintf(resbuf, sizeof resbuf, "%s %2d:%02d", updown, hours, minutes); return(resbuf); } /* alphabetical comparison */ int hscmp(const void *a1, const void *a2) { const struct hs *h1 = a1, *h2 = a2; return(rflg * strcmp(h1->hs_wd->wd_hostname, h2->hs_wd->wd_hostname)); } /* load average comparison */ int lcmp(const void *a1, const void *a2) { const struct hs *h1 = a1, *h2 = a2; if (ISDOWN(h1)) if (ISDOWN(h2)) return(tcmp(a1, a2)); else return(rflg); else if (ISDOWN(h2)) return(-rflg); else return(rflg * (h2->hs_wd->wd_loadav[0] - h1->hs_wd->wd_loadav[0])); } /* number of users comparison */ int ucmp(const void *a1, const void *a2) { const struct hs *h1 = a1, *h2 = a2; if (ISDOWN(h1)) if (ISDOWN(h2)) return(tcmp(a1, a2)); else return(rflg); else if (ISDOWN(h2)) return(-rflg); else return(rflg * (h2->hs_nusers - h1->hs_nusers)); } /* uptime comparison */ int tcmp(const void *a1, const void *a2) { const struct hs *h1 = a1, *h2 = a2; return(rflg * ( (ISDOWN(h2) ? h2->hs_wd->wd_recvtime - now : h2->hs_wd->wd_sendtime - h2->hs_wd->wd_boottime) - (ISDOWN(h1) ? h1->hs_wd->wd_recvtime - now : h1->hs_wd->wd_sendtime - h1->hs_wd->wd_boottime) )); } void morehosts(void) { hs = realloc((char *)hs, (hspace *= 2) * sizeof(*hs)); if (hs == NULL) err(1, "realloc"); }
the_stack_data/104012.c
#include <stdio.h> #define ADD_EPICENTRO 2 #define ADD_INTORNO 1 #define RAGGIO 1 #define NC 10 #define NR 10 void eruzione(int m[][NC], int col, int row, int x, int y); int main(){ int i, j, x, y, m[NR][NC]; for(i=0; i<NR; i++) for(j=0; j<NC; j++) scanf("%d", &m[i][j]); for(i=0; i<NR; i++){ for(j=0; j<NC; j++) printf("%d\t", m[i][j]); printf("\n"); } printf("Riga colonna: "); scanf("%d %d", &x, &y); eruzione(m, NC, NR, x, y); for(i=0; i<NR; i++){ for(j=0; j<NC; j++) printf("%d\t", m[i][j]); printf("\n"); } return 0; } void eruzione(int m[][NC], int col, int row, int x, int y){ int i, j; if(x <= col && y <= col){ for(i=RAGGIO*-1; i<=RAGGIO; i++) if(x+i >= 0 && x+i <= col) for(j=RAGGIO*-1; j <= RAGGIO; j++) if(y+j >= 0 && y+j <= row && m[x+i][j+y] < m[x][y]) m[i+x][y+j] += ADD_INTORNO; m[x][y] += ADD_EPICENTRO; } }
the_stack_data/971971.c
/* * $Id: sys_semget.c,v 1.00 2021-02-02 17:39:33 clib2devs Exp $ */ #ifdef HAVE_SYSV #ifndef _SHM_HEADERS_H #include "shm_headers.h" #endif /* _SHM_HEADERS_H */ int _semget(key_t key, int nsems, int flags) { DECLARE_SYSVYBASE(); int ret = -1; if (__global_clib2->haveShm) { ret = semget(key, nsems, flags); if (ret < 0) { __set_errno(GetIPCErr()); } return (ret); } else { __set_errno(ENOSYS); } return ret; } #endif
the_stack_data/140766223.c
int fibonacci(int x){ if (x<=1){ return 1; } else { return fibonacci(x-1) + fibonacci(x-2) + x * (x-1) - fibonacci(x-1); } } int f(){ int i; i = fibonacci(7); return i; }
the_stack_data/35021.c
#include <stdio.h> struct sss{ int i1:23; int i2:17; int i3:8; }; static union u{ struct sss sss; unsigned char a[sizeof (struct sss)]; } u; int main (void) { int i; for (i = 0; i < sizeof (struct sss); i++) u.a[i] = 0; u.sss.i1 = 8388607.0; for (i = 0; i < sizeof (struct sss); i++) printf ("%x ", u.a[i]); printf ("\n"); u.sss.i2 = 131071.0; for (i = 0; i < sizeof (struct sss); i++) printf ("%x ", u.a[i]); printf ("\n"); u.sss.i3 = 255.0; for (i = 0; i < sizeof (struct sss); i++) printf ("%x ", u.a[i]); printf ("\n"); return 0; }
the_stack_data/12767.c
// How to run: // // $ make // $ ./tinycc examples/nqueen.c > tmp.s // $ gcc -static -o tmp tmp.s // $ ./tmp int print_board(int (*board)[10]) { for (int i = 0; i < 10; i=i+1) { for (int j = 0; j < 10; j=j+1) if (board[i][j]) printf("Q "); else printf(". "); printf("\n"); } printf("\n\n"); } int conflict(int (*board)[10], int row, int col) { for (int i = 0; i < row; i=i+1) { if (board[i][col]) return 1; int j = row - i; if (0 < col - j + 1) if (board[i][col - j]) return 1; if (col + j < 10) if (board[i][col + j]) return 1; } return 0; } int solve(int (*board)[10], int row) { if (row > 9) { print_board(board); return 0; } for (int i = 0; i < 10; i=i+1) { if (conflict(board, row, i)) { } else { board[row][i] = 1; solve(board, row + 1); board[row][i] = 0; } } } int main() { int board[100]; for (int i = 0; i < 100; i=i+1) board[i] = 0; solve(board, 0); return 0; }
the_stack_data/1184441.c
/* Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at the Lawrence Livermore National Laboratory Written by Chunhua Liao, Pei-Hung Lin, Joshua Asplund, Markus Schordan, and Ian Karlin (email: [email protected], [email protected], [email protected], [email protected], [email protected]) LLNL-CODE-732144 All rights reserved. This file is part of DataRaceBench. For details, see https://github.com/LLNL/dataracebench. Please also see the LICENSE file for our additional BSD notice. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the disclaimer below. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the disclaimer (as noted below) in the documentation and/or other materials provided with the distribution. * Neither the name of the LLNS/LLNL 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 COPYRIGHT HOLDERS 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 LAWRENCE LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY 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. */ /* Two pointers have a distance of 12 (xa2 - xa1 = 12). They are used as base addresses for indirect array accesses using an index set (another array). The index set has two indices with distance of 12 : indexSet[1]- indexSet[0] = 533 - 521 = 12 So xa1[idx] and xa2[idx] may cause loop carried dependence for N=0 and N=3. We use the default loop scheduling (static even) in OpenMP. It is possible that two dependent iterations will be scheduled within a same chunk to a same thread. So there is no runtime data races. N is 180, two iteraions with N=0 and N= 1 have loop carried dependences. For static even scheduling, we must have at least 180 threads (180/180=1 iterations) so iteration 0 and 1 will be scheduled to two different threads. Data race pair: xa1[idx]@128:5 vs. xa2[idx]@129:5 */ #include <assert.h> #include <stdio.h> #include <stdlib.h> #define N 180 #include <omp.h> int indexSet[180] = {(521), (533), (525), (527), (529), (531), (547), (549), (551), (553), (555), (557), (573), (575), (577), (579), (581), (583), (599), (601), (603), (605), (607), (609), (625), (627), (629), (631), (633), (635), (651), (653), (655), (657), (659), (661), (859), (861), (863), (865), (867), (869), (885), (887), (889), (891), (893), (895), (911), (913), (915), (917), (919), (921), (937), (939), (941), (943), (945), (947), (963), (965), (967), (969), (971), (973), (989), (991), (993), (995), (997), (999), (1197), (1199), (1201), (1203), (1205), (1207), (1223), (1225), (1227), (1229), (1231), (1233), (1249), (1251), (1253), (1255), (1257), (1259), (1275), (1277), (1279), (1281), (1283), (1285), (1301), (1303), (1305), (1307), (1309), (1311), (1327), (1329), (1331), (1333), (1335), (1337), (1535), (1537), (1539), (1541), (1543), (1545), (1561), (1563), (1565), (1567), (1569), (1571), (1587), (1589), (1591), (1593), (1595), (1597), (1613), (1615), (1617), (1619), (1621), (1623), (1639), (1641), (1643), (1645), (1647), (1649), (1665), (1667), (1669), (1671), (1673), (1675), (1873), (1875), (1877), (1879), (1881), (1883), (1899), (1901), (1903), (1905), (1907), (1909), (1925), (1927), (1929), (1931), (1933), (1935), (1951), (1953), (1955), (1957), (1959), (1961), (1977), (1979), (1981), (1983), (1985), (1987), (2003), (2005), (2007), (2009), (2011), (2013) // 521+12=533 }; int main(int argc,char *argv[]) { double *base = (double *)(malloc(sizeof(double ) * (2013 + 12 + 1))); if (base == 0) { printf("Error in malloc(). Aborting ...\n"); return 1; } double *xa1 = base; double *xa2 = xa1 + 12; int i; // initialize segments touched by indexSet #pragma omp parallel for private (i) for (i = 521; i <= 2025; i += 1) { base[i] = 0.5 * i; } for (i = 0; i <= 179; i += 1) { int idx = indexSet[i]; xa1[idx] += 1.0; xa2[idx] += 3.0; } printf("x1[999]=%f xa2[1285]=%f\n",xa1[999],xa2[1285]); free(base); return 0; }
the_stack_data/159515302.c
// ---- begin global declarations ---- int RetVal; int Cur_Vertical_Sep; int High_Confidence; int Two_of_Three_Reports_Valid; int Own_Tracked_Alt; int Own_Tracked_Alt_Rate; int Other_Tracked_Alt; int Alt_Layer_Value; int Positive_RA_Alt_Thresh__0; int Positive_RA_Alt_Thresh__1; int Positive_RA_Alt_Thresh__2; int Positive_RA_Alt_Thresh__3; int Up_Separation; int Down_Separation; int Other_RAC; int Other_Capability; int Climb_Inhibit; // ---- end global declarations ---- int main() { // ---- begin local declarations ---- // ---- func_main ---- int func_main_Enabled; int func_main_Tcas_equipped; int func_main_Intent_not_known; int func_main_Need_upward_RA; int func_main_Need_downward_RA; int func_main_Alt_sep; int func_main_Alim; int func_main_Temp1; int func_main_Temp2; int func_main_Temp3; int func_main_Temp4; int func_main_Result_Non_Crossing_Biased_Climb; int func_main_Result_Non_Crossing_Biased_Descend; int func_main_Upward_preferred_1; int func_main_Alim_Non_Crossing_Biased_Climb; int func_main_Temp11; int func_main_Temp12; int func_main_Temp13; int func_main_Upward_preferred_2; int func_main_Alim_Non_Crossing_Biased_Descend; int func_main_Temp21; int func_main_Temp22; int func_main_Temp23; // ---- func___TRACER_INIT ---- // ---- end local declarations ---- RetVal = 0; ; Positive_RA_Alt_Thresh__0 = 400; Positive_RA_Alt_Thresh__1 = 500; Positive_RA_Alt_Thresh__2 = 640; Positive_RA_Alt_Thresh__3 = 740; func_main_Enabled = 0; func_main_Tcas_equipped = 0; func_main_Intent_not_known = 0; func_main_Need_upward_RA = 0; func_main_Need_downward_RA = 0; if((Alt_Layer_Value == 0)) { func_main_Alim = Positive_RA_Alt_Thresh__0; func_main_Alim = Positive_RA_Alt_Thresh__3; if((0 > High_Confidence) && (600 >= Own_Tracked_Alt_Rate) && (Cur_Vertical_Sep > 600)) { L1: func_main_Enabled = 1; if((Other_Capability == 0)) { func_main_Tcas_equipped = 1; if((0 > Two_of_Three_Reports_Valid) && (Other_RAC == 0)) { L2: func_main_Intent_not_known = 1; func_main_Alt_sep = 0; L3: func_main_Upward_preferred_1 = 0; func_main_Result_Non_Crossing_Biased_Climb = 0; func_main_Alim_Non_Crossing_Biased_Climb = Positive_RA_Alt_Thresh__0; func_main_Alim_Non_Crossing_Biased_Climb = Positive_RA_Alt_Thresh__3; if((Climb_Inhibit == 1)) { func_main_Temp11 = (Up_Separation + 100); if((func_main_Temp11 > Down_Separation)) { func_main_Upward_preferred_1 = 1; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp12 = 1; if((func_main_Temp12 > 0) && (func_main_Alim_Non_Crossing_Biased_Climb > Down_Separation)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Need_upward_RA = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__0; L4: func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__3; func_main_Temp21 = (Up_Separation + 100); L5: func_main_Upward_preferred_2 = 1; func_main_Temp22 = 1; func_main_Temp3 = func_main_Result_Non_Crossing_Biased_Descend; func_main_Temp4 = 0; if((func_main_Temp3 == 0)) { L6: func_main_Alt_sep = 1; L7: RetVal = 0; return RetVal; } else { goto L6; } } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__0; L8: func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__3; func_main_Temp21 = (Up_Separation + 100); L9: func_main_Upward_preferred_2 = 1; func_main_Temp22 = 1; func_main_Result_Non_Crossing_Biased_Descend = 1; L10: func_main_Temp3 = func_main_Result_Non_Crossing_Biased_Descend; L11: func_main_Temp4 = 0; L12: if((func_main_Need_upward_RA == 0)) { L13: func_main_Alt_sep = 0; goto L7; } else { goto L13; } } } else { func_main_Temp12 = 0; func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__0; L14: func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__3; func_main_Temp21 = (Up_Separation + 100); L15: func_main_Upward_preferred_2 = 1; func_main_Temp22 = 0; if((func_main_Temp22 == 0)) { L16:L17: func_main_Temp3 = func_main_Result_Non_Crossing_Biased_Descend; if((Own_Tracked_Alt > Other_Tracked_Alt)) { func_main_Temp4 = 1; goto L12; } else { func_main_Temp4 = 0; if((func_main_Temp3 == 0)) { goto L12; } else { goto L12; } } } else { goto L16; } } } else { if((Own_Tracked_Alt > Other_Tracked_Alt)) { func_main_Temp13 = 1; if((func_main_Temp13 > 0) && (Cur_Vertical_Sep >= 300) && (Up_Separation >= func_main_Alim_Non_Crossing_Biased_Climb)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__0; L18: func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__3; func_main_Temp21 = (Up_Separation + 100); L19: func_main_Temp23 = 1; func_main_Result_Non_Crossing_Biased_Descend = 1; func_main_Temp3 = func_main_Result_Non_Crossing_Biased_Descend; func_main_Temp4 = 1; func_main_Need_downward_RA = 1; if(((Up_Separation >= func_main_Alim) && (Down_Separation >= func_main_Alim) && (Own_Tracked_Alt > Other_Tracked_Alt))) ERROR: goto ERROR; func_main_Alt_sep = 2; goto L7; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L20: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__0; L21: func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__3; func_main_Temp21 = (Up_Separation + 100); L22: func_main_Temp23 = 1; goto L17; } else { goto L20; } } } else { func_main_Temp13 = 0; if((func_main_Temp13 == 0)) { L23: func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__0; L24: func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__3; func_main_Temp21 = (Up_Separation + 100); L25: func_main_Temp23 = 0; func_main_Result_Non_Crossing_Biased_Descend = 1; goto L10; } else { func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L26: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__0; L27: func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__3; func_main_Temp21 = (Up_Separation + 100); L28: func_main_Temp23 = 0; func_main_Result_Non_Crossing_Biased_Descend = 1; func_main_Temp3 = func_main_Result_Non_Crossing_Biased_Descend; goto L11; } else { goto L26; } } } else { goto L23; } } } } else if((1 > Climb_Inhibit)) { func_main_Temp11 = Up_Separation; if((func_main_Temp11 > Down_Separation)) { func_main_Upward_preferred_1 = 1; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp12 = 1; if((func_main_Temp12 > 0) && (func_main_Alim_Non_Crossing_Biased_Climb > Down_Separation)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Need_upward_RA = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__0; L29: func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__3; L30: func_main_Temp21 = Up_Separation; goto L5; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__0; L31: func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__3; L32: func_main_Temp21 = Up_Separation; goto L9; } } else { func_main_Temp12 = 0; func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__0; L33: func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__3; L34: func_main_Temp21 = Up_Separation; goto L15; } } else { if((Own_Tracked_Alt > Other_Tracked_Alt)) { func_main_Temp13 = 1; if((func_main_Temp13 > 0) && (Cur_Vertical_Sep >= 300) && (Up_Separation >= func_main_Alim_Non_Crossing_Biased_Climb)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__0; L35: func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__3; L36: func_main_Temp21 = Up_Separation; goto L19; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L37: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__0; L38: func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__3; L39: func_main_Temp21 = Up_Separation; goto L22; } else { goto L37; } } } else { func_main_Temp13 = 0; if((func_main_Temp13 == 0)) { L40: func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__0; L41: func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__3; L42: func_main_Temp21 = Up_Separation; goto L25; } else { func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L43: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__0; L44: func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__3; L45: func_main_Temp21 = Up_Separation; goto L28; } else { goto L43; } } } else { goto L40; } } } } else { func_main_Temp11 = Up_Separation; if((func_main_Temp11 > Down_Separation)) { func_main_Upward_preferred_1 = 1; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp12 = 1; if((func_main_Temp12 > 0) && (func_main_Alim_Non_Crossing_Biased_Climb > Down_Separation)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Need_upward_RA = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__0; L46: func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__3; goto L30; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__0; L47: func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__3; goto L32; } } else { func_main_Temp12 = 0; func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__0; L48: func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__3; goto L34; } } else { if((Own_Tracked_Alt > Other_Tracked_Alt)) { func_main_Temp13 = 1; if((func_main_Temp13 > 0) && (Cur_Vertical_Sep >= 300) && (Up_Separation >= func_main_Alim_Non_Crossing_Biased_Climb)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__0; L49: func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__3; goto L36; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L50: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__0; L51: func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__3; goto L39; } else { goto L50; } } } else { func_main_Temp13 = 0; if((func_main_Temp13 == 0)) { L52: func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__0; L53: func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__3; goto L42; } else { func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L54: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__0; L55: func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__3; goto L45; } else { goto L54; } } } else { goto L52; } } } } } else if((Two_of_Three_Reports_Valid > 0) && (Other_RAC == 0)) { goto L2; } else if((Two_of_Three_Reports_Valid == 0)) { L56: func_main_Alt_sep = 0; goto L7; } else if((0 > Other_RAC)) { goto L56; } else { goto L56; } } else if((0 > Other_Capability)) { L57: if((0 > Two_of_Three_Reports_Valid) && (Other_RAC == 0)) { L58: func_main_Intent_not_known = 1; func_main_Alt_sep = 0; goto L3; } else if((Two_of_Three_Reports_Valid > 0) && (Other_RAC == 0)) { goto L58; } else if((Two_of_Three_Reports_Valid == 0)) { L59: func_main_Alt_sep = 0; goto L3; } else if((0 > Other_RAC)) { goto L59; } else { goto L59; } } else { goto L57; } } else if((High_Confidence > 0) && (600 >= Own_Tracked_Alt_Rate) && (Cur_Vertical_Sep > 600)) { goto L1; } else if((High_Confidence == 0)) { L60: if((Other_Capability == 0)) { func_main_Tcas_equipped = 1; if((0 > Two_of_Three_Reports_Valid) && (Other_RAC == 0)) { L61: func_main_Intent_not_known = 1; func_main_Alt_sep = 0; goto L7; } else if((Two_of_Three_Reports_Valid > 0) && (Other_RAC == 0)) { goto L61; } else if((Two_of_Three_Reports_Valid == 0)) { L62: func_main_Alt_sep = 0; if((func_main_Enabled == 0)) { goto L7; } else { goto L7; } } else if((0 > Other_RAC)) { goto L62; } else { goto L62; } } else if((0 > Other_Capability)) { L63: if((0 > Two_of_Three_Reports_Valid) && (Other_RAC == 0)) { goto L61; } else if((Two_of_Three_Reports_Valid > 0) && (Other_RAC == 0)) { goto L61; } else if((Two_of_Three_Reports_Valid == 0)) { L64: func_main_Alt_sep = 0; goto L7; } else if((0 > Other_RAC)) { goto L64; } else { goto L64; } } else { goto L63; } } else if((Own_Tracked_Alt_Rate > 600)) { goto L60; } else { goto L60; } } else if((0 > Alt_Layer_Value)) { func_main_Alim = Positive_RA_Alt_Thresh__3; if((0 > High_Confidence) && (600 >= Own_Tracked_Alt_Rate) && (Cur_Vertical_Sep > 600)) { L65: func_main_Enabled = 1; if((Other_Capability == 0)) { func_main_Tcas_equipped = 1; if((0 > Two_of_Three_Reports_Valid) && (Other_RAC == 0)) { L66: func_main_Intent_not_known = 1; func_main_Alt_sep = 0; L67: func_main_Upward_preferred_1 = 0; func_main_Result_Non_Crossing_Biased_Climb = 0; func_main_Alim_Non_Crossing_Biased_Climb = Positive_RA_Alt_Thresh__3; if((Climb_Inhibit == 1)) { func_main_Temp11 = (Up_Separation + 100); if((func_main_Temp11 > Down_Separation)) { func_main_Upward_preferred_1 = 1; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp12 = 1; if((func_main_Temp12 > 0) && (func_main_Alim_Non_Crossing_Biased_Climb > Down_Separation)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Need_upward_RA = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L4; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L8; } } else { func_main_Temp12 = 0; func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L14; } } else { if((Own_Tracked_Alt > Other_Tracked_Alt)) { func_main_Temp13 = 1; if((func_main_Temp13 > 0) && (Cur_Vertical_Sep >= 300) && (Up_Separation >= func_main_Alim_Non_Crossing_Biased_Climb)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L18; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L68: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L21; } else { goto L68; } } } else { func_main_Temp13 = 0; if((func_main_Temp13 == 0)) { L69: func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L24; } else { func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L70: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L27; } else { goto L70; } } } else { goto L69; } } } } else if((1 > Climb_Inhibit)) { func_main_Temp11 = Up_Separation; if((func_main_Temp11 > Down_Separation)) { func_main_Upward_preferred_1 = 1; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp12 = 1; if((func_main_Temp12 > 0) && (func_main_Alim_Non_Crossing_Biased_Climb > Down_Separation)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Need_upward_RA = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L29; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L31; } } else { func_main_Temp12 = 0; func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L33; } } else { if((Own_Tracked_Alt > Other_Tracked_Alt)) { func_main_Temp13 = 1; if((func_main_Temp13 > 0) && (Cur_Vertical_Sep >= 300) && (Up_Separation >= func_main_Alim_Non_Crossing_Biased_Climb)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L35; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L71: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L38; } else { goto L71; } } } else { func_main_Temp13 = 0; if((func_main_Temp13 == 0)) { L72: func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L41; } else { func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L73: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L44; } else { goto L73; } } } else { goto L72; } } } } else { func_main_Temp11 = Up_Separation; if((func_main_Temp11 > Down_Separation)) { func_main_Upward_preferred_1 = 1; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp12 = 1; if((func_main_Temp12 > 0) && (func_main_Alim_Non_Crossing_Biased_Climb > Down_Separation)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Need_upward_RA = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L46; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L47; } } else { func_main_Temp12 = 0; func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L48; } } else { if((Own_Tracked_Alt > Other_Tracked_Alt)) { func_main_Temp13 = 1; if((func_main_Temp13 > 0) && (Cur_Vertical_Sep >= 300) && (Up_Separation >= func_main_Alim_Non_Crossing_Biased_Climb)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L49; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L74: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L51; } else { goto L74; } } } else { func_main_Temp13 = 0; if((func_main_Temp13 == 0)) { L75: func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L53; } else { func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L76: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L55; } else { goto L76; } } } else { goto L75; } } } } } else if((Two_of_Three_Reports_Valid > 0) && (Other_RAC == 0)) { goto L66; } else if((Two_of_Three_Reports_Valid == 0)) { goto L56; } else if((0 > Other_RAC)) { goto L56; } else { goto L56; } } else if((0 > Other_Capability)) { L77: if((0 > Two_of_Three_Reports_Valid) && (Other_RAC == 0)) { L78: func_main_Intent_not_known = 1; func_main_Alt_sep = 0; goto L67; } else if((Two_of_Three_Reports_Valid > 0) && (Other_RAC == 0)) { goto L78; } else if((Two_of_Three_Reports_Valid == 0)) { L79: func_main_Alt_sep = 0; goto L67; } else if((0 > Other_RAC)) { goto L79; } else { goto L79; } } else { goto L77; } } else if((High_Confidence > 0) && (600 >= Own_Tracked_Alt_Rate) && (Cur_Vertical_Sep > 600)) { goto L65; } else if((High_Confidence == 0)) { goto L60; } else if((Own_Tracked_Alt_Rate > 600)) { goto L60; } else { goto L60; } } else { if((Alt_Layer_Value == 1)) { func_main_Alim = Positive_RA_Alt_Thresh__1; func_main_Alim = Positive_RA_Alt_Thresh__3; if((0 > High_Confidence) && (600 >= Own_Tracked_Alt_Rate) && (Cur_Vertical_Sep > 600)) { L80: func_main_Enabled = 1; if((Other_Capability == 0)) { func_main_Tcas_equipped = 1; if((0 > Two_of_Three_Reports_Valid) && (Other_RAC == 0)) { L81: func_main_Intent_not_known = 1; func_main_Alt_sep = 0; L82: func_main_Upward_preferred_1 = 0; func_main_Result_Non_Crossing_Biased_Climb = 0; func_main_Alim_Non_Crossing_Biased_Climb = Positive_RA_Alt_Thresh__1; func_main_Alim_Non_Crossing_Biased_Climb = Positive_RA_Alt_Thresh__3; if((Climb_Inhibit == 1)) { func_main_Temp11 = (Up_Separation + 100); if((func_main_Temp11 > Down_Separation)) { func_main_Upward_preferred_1 = 1; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp12 = 1; if((func_main_Temp12 > 0) && (func_main_Alim_Non_Crossing_Biased_Climb > Down_Separation)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Need_upward_RA = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__1; goto L4; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__1; goto L8; } } else { func_main_Temp12 = 0; func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__1; goto L14; } } else { if((Own_Tracked_Alt > Other_Tracked_Alt)) { func_main_Temp13 = 1; if((func_main_Temp13 > 0) && (Cur_Vertical_Sep >= 300) && (Up_Separation >= func_main_Alim_Non_Crossing_Biased_Climb)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__1; goto L18; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L83: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__1; goto L21; } else { goto L83; } } } else { func_main_Temp13 = 0; if((func_main_Temp13 == 0)) { L84: func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__1; goto L24; } else { func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L85: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__1; goto L27; } else { goto L85; } } } else { goto L84; } } } } else if((1 > Climb_Inhibit)) { func_main_Temp11 = Up_Separation; if((func_main_Temp11 > Down_Separation)) { func_main_Upward_preferred_1 = 1; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp12 = 1; if((func_main_Temp12 > 0) && (func_main_Alim_Non_Crossing_Biased_Climb > Down_Separation)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Need_upward_RA = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__1; goto L29; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__1; goto L31; } } else { func_main_Temp12 = 0; func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__1; goto L33; } } else { if((Own_Tracked_Alt > Other_Tracked_Alt)) { func_main_Temp13 = 1; if((func_main_Temp13 > 0) && (Cur_Vertical_Sep >= 300) && (Up_Separation >= func_main_Alim_Non_Crossing_Biased_Climb)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__1; goto L35; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L86: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__1; goto L38; } else { goto L86; } } } else { func_main_Temp13 = 0; if((func_main_Temp13 == 0)) { L87: func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__1; goto L41; } else { func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L88: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__1; goto L44; } else { goto L88; } } } else { goto L87; } } } } else { func_main_Temp11 = Up_Separation; if((func_main_Temp11 > Down_Separation)) { func_main_Upward_preferred_1 = 1; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp12 = 1; if((func_main_Temp12 > 0) && (func_main_Alim_Non_Crossing_Biased_Climb > Down_Separation)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Need_upward_RA = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__1; goto L46; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__1; goto L47; } } else { func_main_Temp12 = 0; func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__1; goto L48; } } else { if((Own_Tracked_Alt > Other_Tracked_Alt)) { func_main_Temp13 = 1; if((func_main_Temp13 > 0) && (Cur_Vertical_Sep >= 300) && (Up_Separation >= func_main_Alim_Non_Crossing_Biased_Climb)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__1; goto L49; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L89: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__1; goto L51; } else { goto L89; } } } else { func_main_Temp13 = 0; if((func_main_Temp13 == 0)) { L90: func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__1; goto L53; } else { func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L91: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__1; goto L55; } else { goto L91; } } } else { goto L90; } } } } } else if((Two_of_Three_Reports_Valid > 0) && (Other_RAC == 0)) { goto L81; } else if((Two_of_Three_Reports_Valid == 0)) { goto L56; } else if((0 > Other_RAC)) { goto L56; } else { goto L56; } } else if((0 > Other_Capability)) { L92: if((0 > Two_of_Three_Reports_Valid) && (Other_RAC == 0)) { L93: func_main_Intent_not_known = 1; func_main_Alt_sep = 0; goto L82; } else if((Two_of_Three_Reports_Valid > 0) && (Other_RAC == 0)) { goto L93; } else if((Two_of_Three_Reports_Valid == 0)) { L94: func_main_Alt_sep = 0; goto L82; } else if((0 > Other_RAC)) { goto L94; } else { goto L94; } } else { goto L92; } } else if((High_Confidence > 0) && (600 >= Own_Tracked_Alt_Rate) && (Cur_Vertical_Sep > 600)) { goto L80; } else if((High_Confidence == 0)) { goto L60; } else if((Own_Tracked_Alt_Rate > 600)) { goto L60; } else { goto L60; } } else if((1 > Alt_Layer_Value)) { func_main_Alim = Positive_RA_Alt_Thresh__3; if((0 > High_Confidence) && (600 >= Own_Tracked_Alt_Rate) && (Cur_Vertical_Sep > 600)) { L95: func_main_Enabled = 1; if((Other_Capability == 0)) { func_main_Tcas_equipped = 1; if((0 > Two_of_Three_Reports_Valid) && (Other_RAC == 0)) { L96: func_main_Intent_not_known = 1; func_main_Alt_sep = 0; L97: func_main_Upward_preferred_1 = 0; func_main_Result_Non_Crossing_Biased_Climb = 0; func_main_Alim_Non_Crossing_Biased_Climb = Positive_RA_Alt_Thresh__3; if((Climb_Inhibit == 1)) { func_main_Temp11 = (Up_Separation + 100); if((func_main_Temp11 > Down_Separation)) { func_main_Upward_preferred_1 = 1; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp12 = 1; if((func_main_Temp12 > 0) && (func_main_Alim_Non_Crossing_Biased_Climb > Down_Separation)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Need_upward_RA = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L4; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L8; } } else { func_main_Temp12 = 0; func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L14; } } else { if((Own_Tracked_Alt > Other_Tracked_Alt)) { func_main_Temp13 = 1; if((func_main_Temp13 > 0) && (Cur_Vertical_Sep >= 300) && (Up_Separation >= func_main_Alim_Non_Crossing_Biased_Climb)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L18; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L98: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L21; } else { goto L98; } } } else { func_main_Temp13 = 0; if((func_main_Temp13 == 0)) { L99: func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L24; } else { func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L100: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L27; } else { goto L100; } } } else { goto L99; } } } } else if((1 > Climb_Inhibit)) { func_main_Temp11 = Up_Separation; if((func_main_Temp11 > Down_Separation)) { func_main_Upward_preferred_1 = 1; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp12 = 1; if((func_main_Temp12 > 0) && (func_main_Alim_Non_Crossing_Biased_Climb > Down_Separation)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Need_upward_RA = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L29; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L31; } } else { func_main_Temp12 = 0; func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L33; } } else { if((Own_Tracked_Alt > Other_Tracked_Alt)) { func_main_Temp13 = 1; if((func_main_Temp13 > 0) && (Cur_Vertical_Sep >= 300) && (Up_Separation >= func_main_Alim_Non_Crossing_Biased_Climb)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L35; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L101: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L38; } else { goto L101; } } } else { func_main_Temp13 = 0; if((func_main_Temp13 == 0)) { L102: func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L41; } else { func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L103: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L44; } else { goto L103; } } } else { goto L102; } } } } else { func_main_Temp11 = Up_Separation; if((func_main_Temp11 > Down_Separation)) { func_main_Upward_preferred_1 = 1; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp12 = 1; if((func_main_Temp12 > 0) && (func_main_Alim_Non_Crossing_Biased_Climb > Down_Separation)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Need_upward_RA = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L46; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L47; } } else { func_main_Temp12 = 0; func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L48; } } else { if((Own_Tracked_Alt > Other_Tracked_Alt)) { func_main_Temp13 = 1; if((func_main_Temp13 > 0) && (Cur_Vertical_Sep >= 300) && (Up_Separation >= func_main_Alim_Non_Crossing_Biased_Climb)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L49; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L104: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L51; } else { goto L104; } } } else { func_main_Temp13 = 0; if((func_main_Temp13 == 0)) { L105: func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L53; } else { func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L106: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L55; } else { goto L106; } } } else { goto L105; } } } } } else if((Two_of_Three_Reports_Valid > 0) && (Other_RAC == 0)) { goto L96; } else if((Two_of_Three_Reports_Valid == 0)) { goto L56; } else if((0 > Other_RAC)) { goto L56; } else { goto L56; } } else if((0 > Other_Capability)) { L107: if((0 > Two_of_Three_Reports_Valid) && (Other_RAC == 0)) { L108: func_main_Intent_not_known = 1; func_main_Alt_sep = 0; goto L97; } else if((Two_of_Three_Reports_Valid > 0) && (Other_RAC == 0)) { goto L108; } else if((Two_of_Three_Reports_Valid == 0)) { L109: func_main_Alt_sep = 0; goto L97; } else if((0 > Other_RAC)) { goto L109; } else { goto L109; } } else { goto L107; } } else if((High_Confidence > 0) && (600 >= Own_Tracked_Alt_Rate) && (Cur_Vertical_Sep > 600)) { goto L95; } else if((High_Confidence == 0)) { goto L60; } else if((Own_Tracked_Alt_Rate > 600)) { goto L60; } else { goto L60; } } else { if((Alt_Layer_Value == 2)) { func_main_Alim = Positive_RA_Alt_Thresh__2; func_main_Alim = Positive_RA_Alt_Thresh__3; if((0 > High_Confidence) && (600 >= Own_Tracked_Alt_Rate) && (Cur_Vertical_Sep > 600)) { L110: func_main_Enabled = 1; if((Other_Capability == 0)) { func_main_Tcas_equipped = 1; if((0 > Two_of_Three_Reports_Valid) && (Other_RAC == 0)) { L111: func_main_Intent_not_known = 1; func_main_Alt_sep = 0; L112: func_main_Upward_preferred_1 = 0; func_main_Result_Non_Crossing_Biased_Climb = 0; func_main_Alim_Non_Crossing_Biased_Climb = Positive_RA_Alt_Thresh__2; func_main_Alim_Non_Crossing_Biased_Climb = Positive_RA_Alt_Thresh__3; if((Climb_Inhibit == 1)) { func_main_Temp11 = (Up_Separation + 100); if((func_main_Temp11 > Down_Separation)) { func_main_Upward_preferred_1 = 1; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp12 = 1; if((func_main_Temp12 > 0) && (func_main_Alim_Non_Crossing_Biased_Climb > Down_Separation)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Need_upward_RA = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__2; goto L4; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__2; goto L8; } } else { func_main_Temp12 = 0; func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__2; goto L14; } } else { if((Own_Tracked_Alt > Other_Tracked_Alt)) { func_main_Temp13 = 1; if((func_main_Temp13 > 0) && (Cur_Vertical_Sep >= 300) && (Up_Separation >= func_main_Alim_Non_Crossing_Biased_Climb)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__2; goto L18; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L113: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__2; goto L21; } else { goto L113; } } } else { func_main_Temp13 = 0; if((func_main_Temp13 == 0)) { L114: func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__2; goto L24; } else { func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L115: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__2; goto L27; } else { goto L115; } } } else { goto L114; } } } } else if((1 > Climb_Inhibit)) { func_main_Temp11 = Up_Separation; if((func_main_Temp11 > Down_Separation)) { func_main_Upward_preferred_1 = 1; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp12 = 1; if((func_main_Temp12 > 0) && (func_main_Alim_Non_Crossing_Biased_Climb > Down_Separation)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Need_upward_RA = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__2; goto L29; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__2; goto L31; } } else { func_main_Temp12 = 0; func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__2; goto L33; } } else { if((Own_Tracked_Alt > Other_Tracked_Alt)) { func_main_Temp13 = 1; if((func_main_Temp13 > 0) && (Cur_Vertical_Sep >= 300) && (Up_Separation >= func_main_Alim_Non_Crossing_Biased_Climb)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__2; goto L35; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L116: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__2; goto L38; } else { goto L116; } } } else { func_main_Temp13 = 0; if((func_main_Temp13 == 0)) { L117: func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__2; goto L41; } else { func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L118: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__2; goto L44; } else { goto L118; } } } else { goto L117; } } } } else { func_main_Temp11 = Up_Separation; if((func_main_Temp11 > Down_Separation)) { func_main_Upward_preferred_1 = 1; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp12 = 1; if((func_main_Temp12 > 0) && (func_main_Alim_Non_Crossing_Biased_Climb > Down_Separation)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Need_upward_RA = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__2; goto L46; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__2; goto L47; } } else { func_main_Temp12 = 0; func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__2; goto L48; } } else { if((Own_Tracked_Alt > Other_Tracked_Alt)) { func_main_Temp13 = 1; if((func_main_Temp13 > 0) && (Cur_Vertical_Sep >= 300) && (Up_Separation >= func_main_Alim_Non_Crossing_Biased_Climb)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__2; goto L49; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L119: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__2; goto L51; } else { goto L119; } } } else { func_main_Temp13 = 0; if((func_main_Temp13 == 0)) { L120: func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__2; goto L53; } else { func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L121: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; func_main_Alim_Non_Crossing_Biased_Descend = Positive_RA_Alt_Thresh__2; goto L55; } else { goto L121; } } } else { goto L120; } } } } } else if((Two_of_Three_Reports_Valid > 0) && (Other_RAC == 0)) { goto L111; } else if((Two_of_Three_Reports_Valid == 0)) { goto L56; } else if((0 > Other_RAC)) { goto L56; } else { goto L56; } } else if((0 > Other_Capability)) { L122: if((0 > Two_of_Three_Reports_Valid) && (Other_RAC == 0)) { L123: func_main_Intent_not_known = 1; func_main_Alt_sep = 0; goto L112; } else if((Two_of_Three_Reports_Valid > 0) && (Other_RAC == 0)) { goto L123; } else if((Two_of_Three_Reports_Valid == 0)) { L124: func_main_Alt_sep = 0; goto L112; } else if((0 > Other_RAC)) { goto L124; } else { goto L124; } } else { goto L122; } } else if((High_Confidence > 0) && (600 >= Own_Tracked_Alt_Rate) && (Cur_Vertical_Sep > 600)) { goto L110; } else if((High_Confidence == 0)) { goto L60; } else if((Own_Tracked_Alt_Rate > 600)) { goto L60; } else { goto L60; } } else if((2 > Alt_Layer_Value)) { func_main_Alim = Positive_RA_Alt_Thresh__3; if((0 > High_Confidence) && (600 >= Own_Tracked_Alt_Rate) && (Cur_Vertical_Sep > 600)) { L125: func_main_Enabled = 1; if((Other_Capability == 0)) { func_main_Tcas_equipped = 1; if((0 > Two_of_Three_Reports_Valid) && (Other_RAC == 0)) { L126: func_main_Intent_not_known = 1; func_main_Alt_sep = 0; L127: func_main_Upward_preferred_1 = 0; func_main_Result_Non_Crossing_Biased_Climb = 0; func_main_Alim_Non_Crossing_Biased_Climb = Positive_RA_Alt_Thresh__3; if((Climb_Inhibit == 1)) { func_main_Temp11 = (Up_Separation + 100); if((func_main_Temp11 > Down_Separation)) { func_main_Upward_preferred_1 = 1; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp12 = 1; if((func_main_Temp12 > 0) && (func_main_Alim_Non_Crossing_Biased_Climb > Down_Separation)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Need_upward_RA = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L4; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L8; } } else { func_main_Temp12 = 0; func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L14; } } else { if((Own_Tracked_Alt > Other_Tracked_Alt)) { func_main_Temp13 = 1; if((func_main_Temp13 > 0) && (Cur_Vertical_Sep >= 300) && (Up_Separation >= func_main_Alim_Non_Crossing_Biased_Climb)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L18; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L128: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L21; } else { goto L128; } } } else { func_main_Temp13 = 0; if((func_main_Temp13 == 0)) { L129: func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L24; } else { func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L130: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L27; } else { goto L130; } } } else { goto L129; } } } } else if((1 > Climb_Inhibit)) { func_main_Temp11 = Up_Separation; if((func_main_Temp11 > Down_Separation)) { func_main_Upward_preferred_1 = 1; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp12 = 1; if((func_main_Temp12 > 0) && (func_main_Alim_Non_Crossing_Biased_Climb > Down_Separation)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Need_upward_RA = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L29; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L31; } } else { func_main_Temp12 = 0; func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L33; } } else { if((Own_Tracked_Alt > Other_Tracked_Alt)) { func_main_Temp13 = 1; if((func_main_Temp13 > 0) && (Cur_Vertical_Sep >= 300) && (Up_Separation >= func_main_Alim_Non_Crossing_Biased_Climb)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L35; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L131: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L38; } else { goto L131; } } } else { func_main_Temp13 = 0; if((func_main_Temp13 == 0)) { L132: func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L41; } else { func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L133: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L44; } else { goto L133; } } } else { goto L132; } } } } else { func_main_Temp11 = Up_Separation; if((func_main_Temp11 > Down_Separation)) { func_main_Upward_preferred_1 = 1; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp12 = 1; if((func_main_Temp12 > 0) && (func_main_Alim_Non_Crossing_Biased_Climb > Down_Separation)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Need_upward_RA = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L46; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L47; } } else { func_main_Temp12 = 0; func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L48; } } else { if((Own_Tracked_Alt > Other_Tracked_Alt)) { func_main_Temp13 = 1; if((func_main_Temp13 > 0) && (Cur_Vertical_Sep >= 300) && (Up_Separation >= func_main_Alim_Non_Crossing_Biased_Climb)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L49; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L134: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L51; } else { goto L134; } } } else { func_main_Temp13 = 0; if((func_main_Temp13 == 0)) { L135: func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L53; } else { func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L136: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L55; } else { goto L136; } } } else { goto L135; } } } } } else if((Two_of_Three_Reports_Valid > 0) && (Other_RAC == 0)) { goto L126; } else if((Two_of_Three_Reports_Valid == 0)) { goto L56; } else if((0 > Other_RAC)) { goto L56; } else { goto L56; } } else if((0 > Other_Capability)) { L137: if((0 > Two_of_Three_Reports_Valid) && (Other_RAC == 0)) { L138: func_main_Intent_not_known = 1; func_main_Alt_sep = 0; goto L127; } else if((Two_of_Three_Reports_Valid > 0) && (Other_RAC == 0)) { goto L138; } else if((Two_of_Three_Reports_Valid == 0)) { L139: func_main_Alt_sep = 0; goto L127; } else if((0 > Other_RAC)) { goto L139; } else { goto L139; } } else { goto L137; } } else if((High_Confidence > 0) && (600 >= Own_Tracked_Alt_Rate) && (Cur_Vertical_Sep > 600)) { goto L125; } else if((High_Confidence == 0)) { goto L60; } else if((Own_Tracked_Alt_Rate > 600)) { goto L60; } else { goto L60; } } else { func_main_Alim = Positive_RA_Alt_Thresh__3; if((0 > High_Confidence) && (600 >= Own_Tracked_Alt_Rate) && (Cur_Vertical_Sep > 600)) { L140: func_main_Enabled = 1; if((Other_Capability == 0)) { func_main_Tcas_equipped = 1; if((0 > Two_of_Three_Reports_Valid) && (Other_RAC == 0)) { L141: func_main_Intent_not_known = 1; func_main_Alt_sep = 0; L142: func_main_Upward_preferred_1 = 0; func_main_Result_Non_Crossing_Biased_Climb = 0; func_main_Alim_Non_Crossing_Biased_Climb = Positive_RA_Alt_Thresh__3; if((Climb_Inhibit == 1)) { func_main_Temp11 = (Up_Separation + 100); if((func_main_Temp11 > Down_Separation)) { func_main_Upward_preferred_1 = 1; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp12 = 1; if((func_main_Temp12 > 0) && (func_main_Alim_Non_Crossing_Biased_Climb > Down_Separation)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Need_upward_RA = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L4; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L8; } } else { func_main_Temp12 = 0; func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L14; } } else { if((Own_Tracked_Alt > Other_Tracked_Alt)) { func_main_Temp13 = 1; if((func_main_Temp13 > 0) && (Cur_Vertical_Sep >= 300) && (Up_Separation >= func_main_Alim_Non_Crossing_Biased_Climb)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L18; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L143: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L21; } else { goto L143; } } } else { func_main_Temp13 = 0; if((func_main_Temp13 == 0)) { L144: func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L24; } else { func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L145: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L27; } else { goto L145; } } } else { goto L144; } } } } else if((1 > Climb_Inhibit)) { func_main_Temp11 = Up_Separation; if((func_main_Temp11 > Down_Separation)) { func_main_Upward_preferred_1 = 1; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp12 = 1; if((func_main_Temp12 > 0) && (func_main_Alim_Non_Crossing_Biased_Climb > Down_Separation)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Need_upward_RA = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L29; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L31; } } else { func_main_Temp12 = 0; func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L33; } } else { if((Own_Tracked_Alt > Other_Tracked_Alt)) { func_main_Temp13 = 1; if((func_main_Temp13 > 0) && (Cur_Vertical_Sep >= 300) && (Up_Separation >= func_main_Alim_Non_Crossing_Biased_Climb)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L35; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L146: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L38; } else { goto L146; } } } else { func_main_Temp13 = 0; if((func_main_Temp13 == 0)) { L147: func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L41; } else { func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L148: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L44; } else { goto L148; } } } else { goto L147; } } } } else { func_main_Temp11 = Up_Separation; if((func_main_Temp11 > Down_Separation)) { func_main_Upward_preferred_1 = 1; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp12 = 1; if((func_main_Temp12 > 0) && (func_main_Alim_Non_Crossing_Biased_Climb > Down_Separation)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Need_upward_RA = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L46; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L47; } } else { func_main_Temp12 = 0; func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L48; } } else { if((Own_Tracked_Alt > Other_Tracked_Alt)) { func_main_Temp13 = 1; if((func_main_Temp13 > 0) && (Cur_Vertical_Sep >= 300) && (Up_Separation >= func_main_Alim_Non_Crossing_Biased_Climb)) { func_main_Result_Non_Crossing_Biased_Climb = 1; func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L49; } else { func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L149: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L51; } else { goto L149; } } } else { func_main_Temp13 = 0; if((func_main_Temp13 == 0)) { L150: func_main_Temp1 = func_main_Result_Non_Crossing_Biased_Climb; if((Other_Tracked_Alt > Own_Tracked_Alt)) { func_main_Temp2 = 1; func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L53; } else { func_main_Temp2 = 0; if((func_main_Temp1 == 0)) { L151: func_main_Upward_preferred_2 = 0; func_main_Result_Non_Crossing_Biased_Descend = 0; goto L55; } else { goto L151; } } } else { goto L150; } } } } } else if((Two_of_Three_Reports_Valid > 0) && (Other_RAC == 0)) { goto L141; } else if((Two_of_Three_Reports_Valid == 0)) { goto L56; } else if((0 > Other_RAC)) { goto L56; } else { goto L56; } } else if((0 > Other_Capability)) { L152: if((0 > Two_of_Three_Reports_Valid) && (Other_RAC == 0)) { L153: func_main_Intent_not_known = 1; func_main_Alt_sep = 0; goto L142; } else if((Two_of_Three_Reports_Valid > 0) && (Other_RAC == 0)) { goto L153; } else if((Two_of_Three_Reports_Valid == 0)) { L154: func_main_Alt_sep = 0; goto L142; } else if((0 > Other_RAC)) { goto L154; } else { goto L154; } } else { goto L152; } } else if((High_Confidence > 0) && (600 >= Own_Tracked_Alt_Rate) && (Cur_Vertical_Sep > 600)) { goto L140; } else if((High_Confidence == 0)) { goto L60; } else if((Own_Tracked_Alt_Rate > 600)) { goto L60; } else { goto L60; } } } } }
the_stack_data/87638444.c
#include <stdio.h> #include <string.h> int main(){ char a[100] = "happy "; char b[100] = "birthday to you"; printf("String append : %s\n",strcat(a,b)); return 0; }
the_stack_data/6387634.c
/* http://www.muppetlabs.com/~breadbox/software/elfkickers.html */ /* sstrip: Copyright (C) 1999-2001 by Brian Raiter, under the GNU * General Public License. No warranty. See COPYING for details. * * Aug 23, 2004 Hacked by Manuel Novoa III <[email protected]> to * handle targets of different endianness and/or elf class, making * it more useful in a cross-devel environment. * * Oct 2006, Frank Bergmann <[email protected]> * - set e_shentsize (default value of 40 on i386/32bit) * - don't use *printf and stdio: smaller code and dietlibc "friendly" */ /* ============== original README =================== * * sstrip is a small utility that removes the contents at the end of an * ELF file that are not part of the program's memory image. * * Most ELF executables are built with both a program header table and a * section header table. However, only the former is required in order * for the OS to load, link and execute a program. sstrip attempts to * extract the ELF header, the program header table, and its contents, * leaving everything else in the bit bucket. It can only remove parts of * the file that occur at the end, after the parts to be saved. However, * this almost always includes the section header table, and occasionally * a few random sections that are not used when running a program. * * It should be noted that the GNU bfd library is (understandably) * dependent on the section header table as an index to the file's * contents. Thus, an executable file that has no section header table * cannot be used with gdb, objdump, or any other program based upon the * bfd library, at all. In fact, the program will not even recognize the * file as a valid executable. (This limitation is noted in the source * code comments for bfd, and is marked "FIXME", so this may change at * some future date. However, I would imagine that it is a pretty * low-priority item, as executables without a section header table are * rare in the extreme.) This probably also explains why strip doesn't * offer the option to do this. * * Shared library files may also have their section header table removed. * Such a library will still function; however, it will no longer be * possible for a compiler to link a new program against it. * * As an added bonus, sstrip also tries to removes trailing zero bytes * from the end of the file. (This normally cannot be done with an * executable that has a section header table.) * * sstrip is a very simplistic program. It depends upon the common * practice of putting the parts of the file that contribute to the * memory image at the front, and the remaining material at the end. This * permits it to discard the latter material without affecting file * offsets and memory addresses in what remains. Of course, the ELF * standard permits files to be organized in almost any order, so if a * pathological linker decided to put its section headers at the top, * sstrip would be useless on such executables. */ /* #include <stdio.h> */ #include <stdlib.h> #include <string.h> #include <errno.h> #include <unistd.h> #include <fcntl.h> #include <elf.h> #include <endian.h> #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif /* The name of the program. */ static char const *progname; /* The name of the current file. */ static char const *filename; /** * bswap_* taken from dietlibc * <byteswap.h> is GNUish and not portable */ static inline unsigned short bswap_16(unsigned short x) { return (x>>8) | (x<<8); } static inline unsigned int bswap_32(unsigned int x) { return (bswap_16(x&0xffff)<<16) | (bswap_16(x>>16)); } static inline unsigned long long bswap_64(unsigned long long x) { return (((unsigned long long)bswap_32(x&0xffffffffull))<<32) | (bswap_32(x>>32)); } int str_len(const char* in) { register const char* t=in; for (;;) { if (!*t) break; ++t; if (!*t) break; ++t; if (!*t) break; ++t; if (!*t) break; ++t; } return (int)(t-in); } /* A simple error-handling function. FALSE is always returned for the * convenience of the caller. */ static int err(char const *errmsg) { /* fprintf(stderr, "%s: %s: %s\n", progname, filename, errmsg); */ return (write(2, errmsg, str_len(errmsg))==-1); } /* A flag to signal the need for endian reversal. */ static int do_reverse_endian; /* Get a value from the elf header, compensating for endianness. */ #define EGET(X) \ (__extension__ ({ \ uint64_t __res; \ if (!do_reverse_endian) { \ __res = (X); \ } else if (sizeof(X) == 1) { \ __res = (X); \ } else if (sizeof(X) == 2) { \ __res = bswap_16((X)); \ } else if (sizeof(X) == 4) { \ __res = bswap_32((X)); \ } else if (sizeof(X) == 8) { \ __res = bswap_64((X)); \ } else { \ err("EGET failed for size\n"); \ exit(EXIT_FAILURE); \ } \ __res; \ })) /* Set a value 'Y' in the elf header to 'X', compensating for endianness. */ #define ESET(Y,X) \ do if (!do_reverse_endian) { \ Y = (X); \ } else if (sizeof(Y) == 1) { \ Y = (X); \ } else if (sizeof(Y) == 2) { \ Y = bswap_16((uint16_t)(X)); \ } else if (sizeof(Y) == 4) { \ Y = bswap_32((uint32_t)(X)); \ } else if (sizeof(Y) == 8) { \ Y = bswap_64((uint64_t)(X)); \ } else { \ err("ESET failed for size\n"); \ exit(EXIT_FAILURE); \ } while (0) /* A macro for I/O errors: The given error message is used only when * errno is not set. */ #define ferr(msg) (err(errno ? strerror(errno) : (msg))) #define HEADER_FUNCTIONS(CLASS) \ \ /* readelfheader() reads the ELF header into our global variable, and \ * checks to make sure that this is in fact a file that we should be \ * munging. \ */ \ static int readelfheader ## CLASS (int fd, Elf ## CLASS ## _Ehdr *ehdr) \ { \ if (read(fd, ((char *)ehdr)+EI_NIDENT, sizeof(*ehdr) - EI_NIDENT) \ != (ssize_t)sizeof(*ehdr) - EI_NIDENT) \ return ferr("missing or incomplete ELF header.\n"); \ \ /* Verify the sizes of the ELF header and the program segment \ * header table entries. \ */ \ if (EGET(ehdr->e_ehsize) != sizeof(Elf ## CLASS ## _Ehdr)) \ return err("unrecognized ELF header size.\n"); \ if (EGET(ehdr->e_phentsize) != sizeof(Elf ## CLASS ## _Phdr)) \ return err("unrecognized program segment header size.\n"); \ \ /* Finally, check the file type. \ */ \ if (EGET(ehdr->e_type) != ET_EXEC && EGET(ehdr->e_type) != ET_DYN) \ return err("not an executable or shared-object library.\n"); \ \ return TRUE; \ } \ \ /* readphdrtable() loads the program segment header table into memory. \ */ \ static int readphdrtable ## CLASS (int fd, Elf ## CLASS ## _Ehdr const *ehdr, \ Elf ## CLASS ## _Phdr **phdrs) \ { \ size_t size; \ \ if (!EGET(ehdr->e_phoff) || !EGET(ehdr->e_phnum) \ ) return err("ELF file has no program header table.\n"); \ \ size = EGET(ehdr->e_phnum) * sizeof **phdrs; \ if (!(*phdrs = malloc(size))) \ return err("Out of memory!\n"); \ \ errno = 0; \ if (read(fd, *phdrs, size) != (ssize_t)size) \ return ferr("missing or incomplete program segment header table.\n"); \ \ return TRUE; \ } \ \ /* getmemorysize() determines the offset of the last byte of the file \ * that is referenced by an entry in the program segment header table. \ * (Anything in the file after that point is not used when the program \ * is executing, and thus can be safely discarded.) \ */ \ static int getmemorysize ## CLASS (Elf ## CLASS ## _Ehdr const *ehdr, \ Elf ## CLASS ## _Phdr const *phdrs, \ unsigned long *newsize) \ { \ Elf ## CLASS ## _Phdr const *phdr; \ unsigned long size, n; \ size_t i; \ \ /* Start by setting the size to include the ELF header and the \ * complete program segment header table. \ */ \ size = EGET(ehdr->e_phoff) + EGET(ehdr->e_phnum) * sizeof *phdrs; \ if (size < sizeof *ehdr) \ size = sizeof *ehdr; \ \ /* Then keep extending the size to include whatever data the \ * program segment header table references. \ */ \ for (i = 0, phdr = phdrs ; i < EGET(ehdr->e_phnum) ; ++i, ++phdr) { \ if (EGET(phdr->p_type) != PT_NULL) { \ n = EGET(phdr->p_offset) + EGET(phdr->p_filesz); \ if (n > size) \ size = n; \ } \ } \ \ *newsize = size; \ return TRUE; \ } \ \ /* modifyheaders() removes references to the section header table if \ * it was stripped, and reduces program header table entries that \ * included truncated bytes at the end of the file. \ */ \ static int modifyheaders ## CLASS (Elf ## CLASS ## _Ehdr *ehdr, \ Elf ## CLASS ## _Phdr *phdrs, \ unsigned long newsize) \ { \ Elf ## CLASS ## _Phdr *phdr; \ size_t i; \ \ /* If the section header table is gone, then remove all references \ * to it in the ELF header. \ */ \ if (EGET(ehdr->e_shoff) >= newsize) { \ ESET(ehdr->e_shoff,0); \ ESET(ehdr->e_shnum,0); \ ESET(ehdr->e_shentsize,sizeof(Elf ## CLASS ## _Shdr)); \ ESET(ehdr->e_shstrndx,0); \ } \ \ /* The program adjusts the file size of any segment that was \ * truncated. The case of a segment being completely stripped out \ * is handled separately. \ */ \ for (i = 0, phdr = phdrs ; i < EGET(ehdr->e_phnum) ; ++i, ++phdr) { \ if (EGET(phdr->p_offset) >= newsize) { \ ESET(phdr->p_offset,newsize); \ ESET(phdr->p_filesz,0); \ } else if (EGET(phdr->p_offset) + EGET(phdr->p_filesz) > newsize) { \ newsize -= EGET(phdr->p_offset); \ ESET(phdr->p_filesz, newsize); \ } \ } \ \ return TRUE; \ } \ \ /* commitchanges() writes the new headers back to the original file \ * and sets the file to its new size. \ */ \ static int commitchanges ## CLASS (int fd, Elf ## CLASS ## _Ehdr const *ehdr, \ Elf ## CLASS ## _Phdr *phdrs, \ unsigned long newsize) \ { \ size_t n; \ \ /* Save the changes to the ELF header, if any. \ */ \ if (lseek(fd, 0, SEEK_SET)) \ return ferr("could not rewind file\n"); \ errno = 0; \ if (write(fd, ehdr, sizeof *ehdr) != (ssize_t)sizeof *ehdr) \ return err("could not modify file\n"); \ \ /* Save the changes to the program segment header table, if any. \ */ \ if (lseek(fd, EGET(ehdr->e_phoff), SEEK_SET) == (off_t)-1) { \ err("could not seek in file.\n"); \ goto warning; \ } \ n = EGET(ehdr->e_phnum) * sizeof *phdrs; \ if (write(fd, phdrs, n) != (ssize_t)n) { \ err("could not write to file\n"); \ goto warning; \ } \ \ /* Eleventh-hour sanity check: don't truncate before the end of \ * the program segment header table. \ */ \ if (newsize < EGET(ehdr->e_phoff) + n) \ newsize = EGET(ehdr->e_phoff) + n; \ \ /* Chop off the end of the file. \ */ \ if (ftruncate(fd, newsize)) { \ err("could not resize file\n"); \ goto warning; \ } \ \ return TRUE; \ \ warning: \ return err("ELF file may have been corrupted!\n"); \ } /* First elements of Elf32_Ehdr and Elf64_Ehdr are common. */ static int readelfheaderident(int fd, Elf32_Ehdr *ehdr) { errno = 0; if (read(fd, ehdr, EI_NIDENT) != EI_NIDENT) return ferr("missing or incomplete ELF header.\n"); /* Check the ELF signature. */ if (!(ehdr->e_ident[EI_MAG0] == ELFMAG0 && ehdr->e_ident[EI_MAG1] == ELFMAG1 && ehdr->e_ident[EI_MAG2] == ELFMAG2 && ehdr->e_ident[EI_MAG3] == ELFMAG3)) { err("missing ELF signature.\n"); return -1; } /* Compare the file's class and endianness with the program's. */ #if __BYTE_ORDER == __LITTLE_ENDIAN if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB) { do_reverse_endian = 0; } else if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB) { /* fprintf(stderr, "ELF file has different endianness.\n"); */ do_reverse_endian = 1; } #elif __BYTE_ORDER == __BIG_ENDIAN if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB) { /* fprintf(stderr, "ELF file has different endianness.\n"); */ do_reverse_endian = 1; } else if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB) { do_reverse_endian = 0; } #else #error unkown endianness #endif else { err("Unsupported endianness\n"); return -1; } /* Check the target architecture. */ /* if (EGET(ehdr->e_machine) != ELF_ARCH) { */ /* /\* return err("ELF file created for different architecture."); *\/ */ /* fprintf(stderr, "ELF file created for different architecture.\n"); */ /* } */ return ehdr->e_ident[EI_CLASS]; } HEADER_FUNCTIONS(32) HEADER_FUNCTIONS(64) /* truncatezeros() examines the bytes at the end of the file's * size-to-be, and reduces the size to exclude any trailing zero * bytes. */ static int truncatezeros(int fd, unsigned long *newsize) { unsigned char contents[1024]; unsigned long size, n; size = *newsize; do { n = sizeof contents; if (n > size) n = size; if (lseek(fd, size - n, SEEK_SET) == (off_t)-1) return ferr("cannot seek in file.\n"); if (read(fd, contents, n) != (ssize_t)n) return ferr("cannot read file contents\n"); while (n && !contents[--n]) --size; } while (size && !n); /* Sanity check. */ if (!size) return err("ELF file is completely blank!\n"); *newsize = size; return TRUE; } /* main() loops over the cmdline arguments, leaving all the real work * to the other functions. */ int main(int argc, char *argv[]) { int fd; union { Elf32_Ehdr ehdr32; Elf64_Ehdr ehdr64; } e; union { Elf32_Phdr *phdrs32; Elf64_Phdr *phdrs64; } p; unsigned long newsize; char **arg; int failures = 0; if (argc < 2 || argv[1][0] == '-') { err("Usage: sstrip FILE...\n" "sstrip discards all nonessential bytes from an executable.\n\n" "Version 2.0-X Copyright (C) 2000,2001 Brian Raiter.\n" "Cross-devel hacks Copyright (C) 2004 Manuel Novoa III.\n" "This program is free software, licensed under the GNU\n" "General Public License. There is absolutely no warranty.\n"); return EXIT_SUCCESS; } p.phdrs32 = 0; progname = argv[0]; for (arg = argv + 1 ; *arg != NULL ; ++arg) { filename = *arg; fd = open(*arg, O_RDWR); if (fd < 0) { ferr("can't open\n"); ++failures; continue; } switch (readelfheaderident(fd, &e.ehdr32)) { case ELFCLASS32: if (!(readelfheader32(fd, &e.ehdr32) && readphdrtable32(fd, &e.ehdr32, &p.phdrs32) && getmemorysize32(&e.ehdr32, p.phdrs32, &newsize) && truncatezeros(fd, &newsize) && modifyheaders32(&e.ehdr32, p.phdrs32, newsize) && commitchanges32(fd, &e.ehdr32, p.phdrs32, newsize))) ++failures; break; case ELFCLASS64: if (!(readelfheader64(fd, &e.ehdr64) && readphdrtable64(fd, &e.ehdr64, &p.phdrs64) && getmemorysize64(&e.ehdr64, p.phdrs64, &newsize) && truncatezeros(fd, &newsize) && modifyheaders64(&e.ehdr64, p.phdrs64, newsize) && commitchanges64(fd, &e.ehdr64, p.phdrs64, newsize))) ++failures; break; default: ++failures; break; } close(fd); } return failures ? EXIT_FAILURE : EXIT_SUCCESS; } /* vi:ts=4:et:nowrap */
the_stack_data/473341.c
/* Generated by CIL v. 1.7.0 */ /* print_CIL_Input is false */ struct _IO_FILE; struct timeval; extern float strtof(char const *str , char const *endptr ) ; extern void signal(int sig , void *func ) ; typedef struct _IO_FILE FILE; extern int atoi(char const *s ) ; extern double strtod(char const *str , char const *endptr ) ; extern int fclose(void *stream ) ; extern void *fopen(char const *filename , char const *mode ) ; extern void abort() ; extern void exit(int status ) ; extern int raise(int sig ) ; extern int fprintf(struct _IO_FILE *stream , char const *format , ...) ; extern int strcmp(char const *a , char const *b ) ; extern int rand() ; extern unsigned long strtoul(char const *str , char const *endptr , int base ) ; void RandomFunc(unsigned long input[1] , unsigned long output[1] ) ; extern int strncmp(char const *s1 , char const *s2 , unsigned long maxlen ) ; extern int gettimeofday(struct timeval *tv , void *tz , ...) ; extern int printf(char const *format , ...) ; int main(int argc , char *argv[] ) ; void megaInit(void) ; extern unsigned long strlen(char const *s ) ; extern long strtol(char const *str , char const *endptr , int base ) ; extern unsigned long strnlen(char const *s , unsigned long maxlen ) ; extern void *memcpy(void *s1 , void const *s2 , unsigned long size ) ; struct timeval { long tv_sec ; long tv_usec ; }; extern void *malloc(unsigned long size ) ; extern int scanf(char const *format , ...) ; int main(int argc , char *argv[] ) { unsigned long input[1] ; unsigned long output[1] ; int randomFuns_i5 ; unsigned long randomFuns_value6 ; int randomFuns_main_i7 ; { megaInit(); if (argc != 2) { printf("Call this program with %i arguments\n", 1); exit(-1); } else { } randomFuns_i5 = 0; while (randomFuns_i5 < 1) { randomFuns_value6 = strtoul(argv[randomFuns_i5 + 1], 0, 10); input[randomFuns_i5] = randomFuns_value6; randomFuns_i5 ++; } RandomFunc(input, output); if (output[0] == 18341684236519652003UL) { printf("You win!\n"); } else { } randomFuns_main_i7 = 0; while (randomFuns_main_i7 < 1) { printf("%lu\n", output[randomFuns_main_i7]); randomFuns_main_i7 ++; } } } void RandomFunc(unsigned long input[1] , unsigned long output[1] ) { unsigned long state[1] ; unsigned long local1 ; { state[0UL] = (input[0UL] - 51238316UL) - 339126204UL; local1 = 0UL; while (local1 < input[1UL]) { local1 ++; } output[0UL] = ((state[0UL] << 1UL) | (state[0UL] >> 63UL)) ^ 105059837885669120UL; } } void megaInit(void) { { } }
the_stack_data/98530.c
#include <stdio.h> int main(void) { for (int i = 1; i <= 25; i++) { if (i % 3 == 0 && i % 5 == 0) { printf("FizzBuzz\n"); } else if (i % 3 == 0) { printf("Fizz\n"); } else if (i % 5 == 0) { printf("Buzz\n"); } else { printf("%i\n", i); } } }
the_stack_data/242330953.c
/* * Write a program that requests two floating-point numbers and prints the value * of their difference divided by their product. Have the program loop through * pairs of input values until the user enters nonnumeric input. */ #include <stdio.h> int main (void) { float x, y; printf("Enter two floating point numbers: "); while (scanf("%f %f", &x, &y) == 2) { printf("%f\n", (x - y) / (x * y)); } return 0; }
the_stack_data/864693.c
#include <stdio.h> #include <stdlib.h> //Creates a doubly linked list where you can see the position struct Node { int data; struct Node *next; struct Node *prev; }Node; void InsertFront(int i); struct Node* getNode(int i); void Print(); void Push(int n); void PrintBackwards(); void Pop(); void movePosition(int n); void Menu(); struct Node *head; struct Node *tail; int main() { head=NULL; tail=NULL; int i; for(i=0;i<60;i=i+4) //Mixes up the data with i+4 { Push(i); if(i>25) //Learning how to use Que data structure { Pop(); } Print(); } PrintBackwards(); printf("\n\n"); Menu(); } void Menu() { struct Node *temp; temp=head; int pos=3; movePosition(pos); //Print current position at the middle printf("Press 1 to go backward\nPress 2 to go forward\nPress 3 exit\n"); int ans=0; while(1) { scanf("%d",&ans); if(ans==2) { if(pos==6)//Doesnt go beyond the end of the list { movePosition(pos); } else { pos++; movePosition(pos); } } if(ans==1) { if(pos==0)//Doesnt go beyond the start of the list { movePosition(pos); } else { pos--; movePosition(pos); } } if(ans==3) { return; } } } void movePosition(int n) { struct Node *temp; temp=head; int pos=0; while(temp != NULL) { if(n==pos) { printf("|"); } printf("%d",temp->data); temp=temp->next; if(n==pos) { printf("|"); } else { printf(" "); } pos++; } printf("\n"); } void Pop() { struct Node *temp; temp=head; head=temp->next; head->prev=NULL; free(temp); } void PrintBackwards() { struct Node *temp; temp=head; while(temp->next != NULL) { temp=temp->next; } while(temp != NULL) { printf("%d ",temp->data); temp=temp->prev; } } void Push(int n) { struct Node *newNode=getNode(n); struct Node *temp; if(head==NULL) { head=newNode; tail=newNode; return; } temp=tail; tail->next=newNode; newNode->prev=tail; tail=newNode; } void Print() { struct Node *temp; temp=head; while(temp != NULL) { printf("%d ",temp->data); temp=temp->next; } printf("\n"); } void InsertFront(int i) { struct Node *newNode=getNode(i); struct Node *temp; if(head==NULL) { head=newNode; return; } newNode->next=head; head->prev=newNode; head=newNode; } struct Node* getNode(int i) { struct Node *temp; temp=(struct Node*)malloc(sizeof(struct Node)); temp->data=i; temp->next=NULL; temp->prev=NULL; return temp; }
the_stack_data/510425.c
#include <errno.h> #include <signal.h> #include <unistd.h> static int isinitialized = 0; static struct sigaction oact; static int signum = 0; static volatile sig_atomic_t sigreceived = 0; /* ARGSUSED */ static void catcher (int signo) { sigreceived = 1; } int initsuspend (int signo) { /* set up the handler for the pause */ struct sigaction act; if (isinitialized) return 0; act.sa_handler = catcher; act.sa_flags = 0; if ((sigfillset(&act.sa_mask) == -1) || (sigaction(signo, &act, &oact) == -1)) return -1; signum = signo; isinitialized = 1; return 0; } int restore(void) { if (!isinitialized) return 0; if (sigaction(signum, &oact, NULL) == -1) return -1; isinitialized = 0; return 0; } int simplesuspend(void) { sigset_t maskblocked, maskold, maskunblocked; if (!isinitialized) { errno = EINVAL; return -1; } if ((sigprocmask(SIG_SETMASK, NULL, &maskblocked) == -1) || (sigaddset(&maskblocked, signum) == -1) || (sigprocmask(SIG_SETMASK, NULL, &maskunblocked) == -1) || (sigdelset(&maskunblocked, signum) == -1) || (sigprocmask(SIG_SETMASK, &maskblocked, &maskold) == -1)) return -1; while(sigreceived == 0) sigsuspend(&maskunblocked); sigreceived = 0; return sigprocmask(SIG_SETMASK, &maskold, NULL); }
the_stack_data/238468.c
#include<stdio.h> #include<pthread.h> int count=10; pthread_mutex_t mutexcount; void*inc_thread(void*arg) { while(1) { pthread_mutex_lock(&mutexcount); count++; printf("Inc-thread=%d\n",count); pthread_mutex_unlock(&mutexcount); } } void*dec_thread(void*arg) { while(1) { pthread_mutex_lock(&mutexcount); count--; printf("Dec-thread=%d\n",count); pthread_mutex_unlock(&mutexcount); } } int main() { pthread_t incID,decID; pthread_mutex_init(&mutexcount,NULL); pthread_create(&incID,NULL,inc_thread,NULL); pthread_create(&decID,NULL,dec_thread,NULL); pthread_join(incID,NULL); pthread_join(decID,NULL); pthread_mutex_destroy(&mutexcount); printf("Execution Ended\n"); return 0; }
the_stack_data/78076.c
#include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <pthread.h> // printfs are for debugging; remove them when you use/submit your library //SYSTEM MANAGEMENT int allocationMethod = 99; void *basePointer = NULL; int totalChunkSize; int chunkSizeSOfFar = 0; pthread_mutex_t lock; //Link List for allocation struct hole *head; struct hole *emptyHead; //Each Allocated area has struct to hold is information struct hole { int holeSize, empty, flag; struct hole *nextAvailable; void *dataPtr; void *insertionPoint; }; int mem_init (void *chunkpointer, int chunksize, int method) { pthread_mutex_lock(&lock); //Take base address of the memory basePointer = chunkpointer; allocationMethod = method; //all allocation space will be determined with this method totalChunkSize = chunksize * 1024; head = ((struct hole *) chunkpointer); head->holeSize = 0; head->nextAvailable = NULL; head->dataPtr = NULL; head->insertionPoint = head + sizeof(struct hole); printf("insertionPoint: %p\n", head->insertionPoint); chunkSizeSOfFar += sizeof(struct hole); pthread_mutex_unlock(&lock); return (0);// if success } void controller(){ pthread_mutex_lock(&lock); printf("Our data sizes are: \n"); for (struct hole *cur = head; cur != NULL; cur = cur->nextAvailable) { printf("%d\n", cur->holeSize); } pthread_mutex_unlock(&lock); // printf("Remaining size: %d\n", totalChunkSize - chunkSizeSOfFar); } void controller2(){ pthread_mutex_lock(&lock); printf("Our empty list is: \n"); for (struct hole *cur = emptyHead; cur != NULL; cur = cur->nextAvailable) { printf("%d\n", cur->holeSize); } pthread_mutex_unlock(&lock); // printf("Remaining size: %d\n", totalChunkSize - chunkSizeSOfFar); } void *mem_allocate (int objectsize) { pthread_mutex_lock(&lock); int remaining = totalChunkSize - chunkSizeSOfFar; //Determine is there enough memory? if(remaining < (objectsize + sizeof(struct hole))){ printf("No available place to allocate"); pthread_mutex_unlock(&lock); return (NULL); } void *newObjectPlace; if(allocationMethod == 99){ printf("Allocation Method is not specified\n"); pthread_mutex_unlock(&lock); return (NULL); } if(head->holeSize == 0 && emptyHead == NULL){ //Chunk memory is empty so insert into head directly printf("Head and emptyHead is NULL so insert to the end\n"); struct hole *currentW; printf("newObjectPlace: %p\n", head->insertionPoint); newObjectPlace = head->insertionPoint; //find the place to place //printf("hole size: %d, and %p \n", sizeof(struct hole), sizeof(struct hole)); //printf("newObjectPlace: %p\n", newObjectPlace); //printf("head: %p\n", head); currentW = newObjectPlace + objectsize; //new node's address currentW->holeSize = (objectsize + sizeof(struct hole)); //printf("hole size is: %d\n", currentW->holeSize); currentW->dataPtr = newObjectPlace; currentW->flag = 0; currentW->nextAvailable = NULL; //nextAvailable is NULL so next insertion will goes here head->nextAvailable = currentW; head->insertionPoint = currentW + sizeof(struct hole); printf("insertionPoint: %p\n", head->insertionPoint); chunkSizeSOfFar += currentW->holeSize; head->holeSize++; //create empty }else{ //first search the emptyList to find a proper place struct hole* curEmpty = emptyHead; struct hole* prev = NULL; if(allocationMethod == 0){ // ********************************* //First fit approach so loop empty list untill you find a proper place int decision = 0; if(emptyHead != NULL){ printf("empty is not NULL **Searching EmptyLisst**\n"); while (curEmpty->nextAvailable != NULL) //loop empty list and determine block size to if it fit { if(curEmpty->holeSize > (objectsize + sizeof(struct hole) )){ //we can give that hole to the request. Loop need to stop because of first fit decision = 1; break; } prev = curEmpty; curEmpty = curEmpty->nextAvailable; } if(curEmpty->nextAvailable == NULL && decision == 0){ //check the last element if we have not find a place yet if(curEmpty->holeSize > (objectsize + sizeof(struct hole) )){ decision = 1; } } if(prev == NULL && decision == 1){ //deleting head emptyHead = emptyHead->nextAvailable; curEmpty->nextAvailable = NULL; }else if(prev != NULL && decision == 1){ //arada bir yerde bulduysa prev->nextAvailable = curEmpty->nextAvailable; curEmpty->nextAvailable = NULL; } } head->holeSize++; if(decision == 0){ //If we cannot find a place from empty list, give a location from the end (unused memory) printf("++++++++Add from new empty place++++++\n"); newObjectPlace = head->insertionPoint; struct hole *newNode = head->insertionPoint + objectsize; if(head->nextAvailable == NULL){ head->nextAvailable = newNode; newNode->nextAvailable = NULL; }else{ struct hole * cako = head->nextAvailable; while(cako->nextAvailable != NULL){ cako = cako->nextAvailable; } cako->nextAvailable = newNode; newNode->nextAvailable = NULL; } newNode->dataPtr = newObjectPlace; newNode->flag = 0; newNode->holeSize = sizeof(struct hole) + objectsize; head->insertionPoint = newNode + sizeof(struct hole); chunkSizeSOfFar = chunkSizeSOfFar + sizeof(struct hole) + objectsize; }else if(decision == 1){ //give memory from empty list printf("--------Add from empty--------\n"); newObjectPlace = (void *) curEmpty->dataPtr; printf("+++++curempty %d\n", curEmpty->holeSize); struct hole * prevvv = NULL; int foundBefore = 0; //we need to find allocated on before //printf("curEmpty=%d \n", curEmpty->holeSize); //printf("head=%lx \n", head); if(head->nextAvailable != NULL){ if(curEmpty < head->nextAvailable){ //headin nextine bağlarız curEmpty->nextAvailable = head->nextAvailable; head->nextAvailable = curEmpty; } }else{ struct hole* currentAlloc = head; prevvv = head; while(foundBefore == 0){ //curre mepty headib nextinnin ilerisinde if(currentAlloc > curEmpty){ foundBefore = 1; break; } if(currentAlloc->nextAvailable != NULL){ prevvv = currentAlloc; currentAlloc = currentAlloc->nextAvailable; }else{ prevvv = currentAlloc; break; } } if(foundBefore == 0){ currentAlloc->nextAvailable = curEmpty; curEmpty->nextAvailable = NULL; // curEMpty en sonda }else if(foundBefore == 1){ curEmpty->nextAvailable = prevvv->nextAvailable; prevvv->nextAvailable = curEmpty; } } } //empty addition ends [1] // ********************************* }else if(allocationMethod == 1){ //Best fit approach int decision = 0; struct hole * minHole = NULL; struct hole * minHolePrev = NULL; if(emptyHead != NULL){ //sdfsdfsdf printf("Head is not NULL, Searching emptyList for best fit\n"); int min = __INT_MAX__; struct hole * ege = emptyHead; while (ege != NULL){ int newMin = ege->holeSize - (sizeof(struct hole) + objectsize); if(min > newMin && newMin > 0){ min = newMin; minHole = ege; minHolePrev = prev; decision = 1; } prev = ege; ege = ege->nextAvailable; } if(minHolePrev == NULL && decision == 1){ //head için minhole head gerisi null //Silenecek olan nodu empty head tutuyor demektir emptyHead = minHole->nextAvailable; minHole->nextAvailable = NULL; printf("minhole %d\n", minHole->holeSize); printf("minholeprev is: NULL\n"); }else if(minHolePrev != NULL){ minHolePrev->nextAvailable = minHole->nextAvailable; minHole->nextAvailable = NULL; printf("minhole is: %d\n", minHole->holeSize); printf("minholeprev is: %d\n", minHolePrev->holeSize); } } // +++++++++++++++++++++++++++++++++++++++++++++++++++++ DECISION 0 head->holeSize++; if(decision == 0){ //If we cannot find a place from empty list, give a location from the end (unused memory) printf("++++++++Add from new empty place++++++\n"); newObjectPlace = head->insertionPoint; struct hole *newNode = head->insertionPoint + objectsize; if(head->nextAvailable == NULL){ head->nextAvailable = newNode; newNode->nextAvailable = NULL; }else{ struct hole * cako = head->nextAvailable; while(cako->nextAvailable != NULL){ cako = cako->nextAvailable; } cako->nextAvailable = newNode; newNode->nextAvailable = NULL; } newNode->dataPtr = newObjectPlace; newNode->flag = 0; newNode->holeSize = sizeof(struct hole) + objectsize; head->insertionPoint = newNode + sizeof(struct hole); chunkSizeSOfFar = chunkSizeSOfFar + sizeof(struct hole) + objectsize; }else if(decision == 1){ printf("Now we can add them\n"); // ++++++++++++++++++++++++++++++++++++++++++ printf("--------Add from empty BEST FIT--------\n"); newObjectPlace = (void *) minHole->dataPtr; printf("+++++minHole %d\n", minHole->holeSize); struct hole * prevvv = NULL; int foundBefore = 0; //we need to find allocated on before //printf("minHole=%d \n", minHole->holeSize); //printf("head=%lx \n", head); if(head->nextAvailable != NULL){ if(minHole < head->nextAvailable){ //headin nextine bağlarız minHole->nextAvailable = head->nextAvailable; head->nextAvailable = minHole; } }else{ struct hole* currentAlloc = head; prevvv = head; while(foundBefore == 0){ //curre mepty headib nextinnin ilerisinde if(currentAlloc > minHole){ foundBefore = 1; break; } if(currentAlloc->nextAvailable != NULL){ prevvv = currentAlloc; currentAlloc = currentAlloc->nextAvailable; }else{ prevvv = currentAlloc; break; } } if(foundBefore == 0){ currentAlloc->nextAvailable = minHole; minHole->nextAvailable = NULL; // minHole en sonda }else if(foundBefore == 1){ minHole->nextAvailable = prevvv->nextAvailable; prevvv->nextAvailable = minHole; } } // +++++++++++++++++++++++++++++++++++++++ } }else if(allocationMethod == 2){ int decision = 0; struct hole * maxHole = NULL; struct hole * maxHolePrev = NULL; if(emptyHead != NULL){ //sdfsdfsdf printf("Head is not NULL, Searching emptyList for worst fit\n"); int max = 0; struct hole * ege = emptyHead; while (ege != NULL){ int newMax = ege->holeSize - (sizeof(struct hole) + objectsize); if(max < newMax && newMax > 0){ max = newMax; maxHole = ege; maxHolePrev = prev; decision = 1; } prev = ege; ege = ege->nextAvailable; } if(maxHolePrev == NULL && decision == 1){ //head için maxHole head gerisi null //Silenecek olan nodu empty head tutuyor demektir emptyHead = maxHole->nextAvailable; maxHole->nextAvailable = NULL; printf("maxHole %d\n", maxHole->holeSize); printf("maxHolePrev is: NULL\n"); }else if(maxHolePrev != NULL){ maxHolePrev->nextAvailable = maxHole->nextAvailable; maxHole->nextAvailable = NULL; printf("maxHole is: %d\n", maxHole->holeSize); printf("maxHolePrev is: %d\n", maxHolePrev->holeSize); } } //empty head null bitti //+++++++++++++++++++++++++++++++++ head->holeSize++; if(decision == 0){ //If we cannot find a place from empty list, give a location from the end (unused memory) printf("++++++++Add from new empty place++++++\n"); newObjectPlace = head->insertionPoint; struct hole *newNode = head->insertionPoint + objectsize; if(head->nextAvailable == NULL){ head->nextAvailable = newNode; newNode->nextAvailable = NULL; }else{ struct hole * cako = head->nextAvailable; while(cako->nextAvailable != NULL){ cako = cako->nextAvailable; } cako->nextAvailable = newNode; newNode->nextAvailable = NULL; } newNode->dataPtr = newObjectPlace; newNode->flag = 0; newNode->holeSize = sizeof(struct hole) + objectsize; head->insertionPoint = newNode + sizeof(struct hole); chunkSizeSOfFar = chunkSizeSOfFar + sizeof(struct hole) + objectsize; } //+++++++++++++++++++++++++++++++++ else if(decision == 1){ printf("Now we can add them\n"); // ++++++++++++++++++++++++++++++++++++++++++ printf("--------Add from empty WORST FIT--------\n"); newObjectPlace = (void *) maxHole->dataPtr; printf("+++++maxHole %d\n", maxHole->holeSize); struct hole * prevvv = NULL; int foundBefore = 0; //we need to find allocated on before //printf("maxHole=%d \n", maxHole->holeSize); //printf("head=%lx \n", head); if(head->nextAvailable != NULL){ if(maxHole < head->nextAvailable){ //headin nextine bağlarız maxHole->nextAvailable = head->nextAvailable; head->nextAvailable = maxHole; } }else { struct hole* currentAlloc = head; prevvv = head; while(foundBefore == 0){ //curre mepty headib nextinnin ilerisinde if(currentAlloc > maxHole){ foundBefore = 1; break; } if(currentAlloc->nextAvailable != NULL){ prevvv = currentAlloc; currentAlloc = currentAlloc->nextAvailable; }else{ prevvv = currentAlloc; break; } } if(foundBefore == 0){ currentAlloc->nextAvailable = maxHole; maxHole->nextAvailable = NULL; // maxHole en sonda }else if(foundBefore == 1){ maxHole->nextAvailable = prevvv->nextAvailable; prevvv->nextAvailable = maxHole; } } } } //allocation method 2 bitti } pthread_mutex_unlock(&lock); return newObjectPlace;// if not success } void mem_free(void *objectptr) { pthread_mutex_lock(&lock); printf("free called\n"); int found = 0; int isH = 0; //nothing to delete if(head->nextAvailable == NULL){ printf("Chunk Memory is empty cannot delete desired memory block\n"); pthread_mutex_unlock(&lock); return; } struct hole * curr = head->nextAvailable; struct hole * prev = head; //Sadece bir node varsa ayrı bakmam gerekir ve alttaki while loopa girememesi lazım if(curr->nextAvailable == NULL){ if(curr->dataPtr == objectptr){ isH = 1; found = 1; } } //Find the desired memory block while(curr->nextAvailable != NULL && isH == 0){ if(curr->dataPtr == objectptr){ found = 1; break; } prev = curr; curr = curr->nextAvailable; } //Check the end of the linked list if(curr->nextAvailable == NULL && found == 0 && isH == 0){ if(curr->dataPtr == objectptr){ found = 1; } } if(found == 0){ printf("Given object ptr does not exist\n"); pthread_mutex_unlock(&lock); return; } //aşağıdaki cod istenilen nodu empty listten çıkartıyor ve bağlantıları kopartıyor //ilk if silinecek node ilk sırada is yani head->nextAvailable = silmek istediğimiz adamsa if(found == 1 && isH == 1){ //--We find desired memory block, --deletion start-- struct hole *deleted = curr; //Silenecek yerin gerisini ilerisine bağla; head->nextAvailable = deleted->nextAvailable; deleted->nextAvailable = NULL; deleted->flag = 1;//Marked as deleted deleted->dataPtr = NULL; }else if(found == 1 && isH == 0){// burası ise aradığımız block listin içinde ortada bir yerlerde ise struct hole *deleted = curr; //Silenecek yerin gerisini ilerisine bağla; prev->nextAvailable = deleted->nextAvailable; deleted->nextAvailable = NULL; deleted->flag = 1;//Marked as deleted deleted->dataPtr = NULL; } //Sildiğimiz bloğu empty linked listine bağla if(emptyHead == NULL){ //boş ise ilk elemanına emptyHead = curr; }else{//değilse empty listin sonuna git struct hole *currE = emptyHead; while (currE->nextAvailable != NULL) { currE = currE->nextAvailable; } currE->nextAvailable = curr; //Son boş bloğa bağla } head->holeSize--; //printf("dataPtr=%p \n", curr->dataPtr); //printf("objectptr=%p \n", objectptr); objectptr = NULL; pthread_mutex_unlock(&lock); return; } void mem_print (void) { pthread_mutex_lock(&lock); int useEmpty = 0; struct hole *emptyCur = NULL; void *lastPoint = head + chunkSizeSOfFar; struct hole *curr = NULL; if(emptyHead != NULL){ emptyCur = emptyHead; useEmpty = 1; } if(head->nextAvailable != NULL){ curr = head->nextAvailable; } printf("Memory Structure is: \n"); if(emptyCur == NULL && curr == NULL){ printf("No place allocated\n"); pthread_mutex_unlock(&lock); return; } else if(emptyCur != NULL && curr != NULL){ printf("*********************************\n"); printf("empty head %d\t head%d \n", emptyCur->holeSize, curr->holeSize); while(1){ int emp = 0; int all = 0; if(emptyCur > curr){ printf("out Allocated %d\t %lx\n", curr->holeSize, curr); all = 1; }else{ printf("out Empty Section %d\t %lx\n", emptyCur->holeSize, emptyCur); emp = 1; } //printf("Empty Section %d\t %lx\n", emptyCur->holeSize, emptyCur); if(curr->nextAvailable != NULL && all == 1){ curr = curr->nextAvailable; } else if(curr->nextAvailable == NULL && all == 1){ printf("in Empty Section %d\t %lx\n", emptyCur->holeSize, emptyCur); while(emptyCur->nextAvailable != NULL){ emptyCur = emptyCur->nextAvailable; printf("Empty Section %d\t %lx\n", emptyCur->holeSize, emptyCur); } break; } if(emptyCur->nextAvailable != NULL && emp == 1){ emptyCur = emptyCur->nextAvailable; } else if(emptyCur->nextAvailable == NULL && emp == 1){ printf("in Allocated %d\t %lx\n", curr->holeSize, curr); while(curr->nextAvailable != NULL){ curr = curr->nextAvailable; printf("Allocated %d\t %lx\n", curr->holeSize, curr); } break; } } } else if(emptyCur != NULL && curr == NULL){ printf("No allocated hole\n"); printf("Empty Section %d\t %lx\n", emptyCur->holeSize, emptyCur); while (emptyCur->nextAvailable != NULL) { emptyCur = emptyCur->nextAvailable; printf("Empty Section %d\t %lx\n", emptyCur->holeSize, emptyCur); } } else if(emptyCur == NULL && curr != NULL){ printf("*********************************\n"); printf("head %d\t \n", curr->holeSize); printf("No empty hole\n"); printf("Allocated %d\t %lx\n", curr->holeSize, curr); while (curr ->nextAvailable != NULL) { curr = curr->nextAvailable; printf("Allocated %d\t %lx\n", curr->holeSize, curr); } } pthread_mutex_unlock(&lock); return; }
the_stack_data/3263327.c
///////////////////////////////////////////////////// /// Seth Jaksik /// ID: 1001541359 /// Jason Bernard Lim /// ID: 1001640993 /// 3320-003 /// FAT32 Assignment /// /// Compilation: gcc mfs.c -o mfs ///////////////////////////////////////////////////// ///////////////////////////////////////////////////// /// /// INCLUDES /// ///////////////////////////////////////////////////// #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> ///////////////////////////////////////////////////// /// /// CONSTANTS /// ///////////////////////////////////////////////////// #define EOF32 = 0x0FFFFFF8; #define MaxFileName = 100; #define ClnShutBitMask = 0x08000000; #define HrdErrBitMask = 0x0400000; #define WHITESPACE " \t\n" #define MAX_COMMAND_SIZE 255 #define MAX_NUM_ARGUMENTS 10 #define True 1 #define False 0 ///////////////////////////////////////////////////// /// /// FUNCTIONS DECLARATIONS /// ///////////////////////////////////////////////////// // msf functions void open(char *filename); void close(); void info(); void stat(char *filename); void get(); void cd(char *dir); void ls(char *token); void read(); // FAT manipulations int LBAToOffset(int32_t sector); int16_t NextLB(uint32_t sector); ///////////////////////////////////////////////////// /// /// GLOBALS /// ///////////////////////////////////////////////////// struct __attribute__((__packed__)) DirectoryEntry { char DIR_Name[11]; uint8_t DIR_Attr; uint8_t Unused1[8]; uint16_t DIR_FirstClusterHigh; uint8_t Unused2[4]; uint16_t DIR_FirstClusterLow; uint32_t DIR_FileSize; }; FILE *fp; int fileOpen = False; struct DirectoryEntry dir[16]; char BS_OMEName[8]; int16_t BPB_BytesPerSec; int8_t BPB_SecPerClus; int16_t BPB_RsvdSecCnt; int8_t BPB_NumFATs; int16_t BPB_RootEntCnt; char BS_VolLab[11]; int32_t BPB_FATSz32; int32_t BPB_RootClus; int32_t RootDirSectors = 0; int32_t FirstDataSector = 0; int32_t FirstSectorofCluseter = 0; ///////////////////////////////////////////////////// /// /// int main(int argc, char *argv[]) /// /// Function Desc: /// This programs runs the simulated shell /// to parse a fat32 file sysyem. ///////////////////////////////////////////////////// int main(int argc, char **argv) { char *cmd_str = (char *)malloc(MAX_COMMAND_SIZE); char **cmd_history = (char **)malloc(sizeof(char *) * 15); int *pid_history = (int *)malloc(sizeof(int) * 15); int curr_cmd = 0, curr_pid = 0; while (1) { // Print out the mfs prompt printf("mfs> "); // Read the command from the commandline. The // maximum command that will be read is MAX_COMMAND_SIZE // This while command will wait here until the user // inputs something since fgets returns NULL when there // is no input while (!fgets(cmd_str, MAX_COMMAND_SIZE, stdin)) ; /* Parse input */ char *token[MAX_NUM_ARGUMENTS]; int token_count = 0; // Pointer to point to the token // parsed by strsep char *arg_ptr; char *working_str = strdup(cmd_str); // we are going to move the working_str pointer so // keep track of its original value so we can deallocate // the correct amount at the end char *working_root = working_str; // Tokenize the input stringswith whitespace used as the delimiter while (((arg_ptr = strsep(&working_str, WHITESPACE)) != NULL) && (token_count < MAX_NUM_ARGUMENTS)) { token[token_count] = strndup(arg_ptr, MAX_COMMAND_SIZE); if (strlen(token[token_count]) == 0) { token[token_count] = NULL; } token_count++; } if (token[0] != NULL) { //give the various cases given the user input (i.e open, close, info, etc) if (strcmp(token[0], "open") == 0) { if (token[1] != NULL) open(token[1]); else printf("Error: Improper format. Please put in format open <filename>\n"); } else if (strcmp(token[0], "info") == 0) { info(); } else if (strcmp(token[0], "close") == 0) { close(); } else if (strcmp(token[0], "stat") == 0) { if (token[1] != NULL) stat(token[1]); else printf("Error: Improper format. Please put in format stat <filename> or <directory name>\n"); } else if (strcmp(token[0], "get") == 0) { if (token[1] != NULL) get(token[1]); else printf("Error: Improper format. Please put in format get <filename>\n"); } else if (strcmp(token[0], "cd") == 0) { if (token[1] != NULL) cd(token[1]); else printf("Error: Improper format. Please put in format cd <directory>\n"); } else if (strcmp(token[0], "ls") == 0) { if (token[1] != NULL) { ls(token[1]); } else { ls(""); } } else if (strcmp(token[0], "read") == 0) { if (token[1] != NULL && token[2] != NULL && token[3] != NULL) read(token[1], atoi(token[2]), atoi(token[3])); else printf("Error: Improper format. Please put in format read <filename> <position> <number of bytes>\n"); } else if (strcmp(token[0], "exit") == 0) { exit(0); } else { printf("Error: Invalid Command\n"); } } } // ROOT DIR ADDRESS(BPB_NumFATs * BPB_FATSz32 * BPB_BytesPerSec) + (BPB_RsvdSecCnt * BPB_BytesPerSec); // FROM FAT32 SPEC // RootDirSectors = ((BPB_RootEntCnt * 32) + (BPB_BytesPerSec - 1)) / BPB_BytesPerSec; // TmpVal1 = DskSize – (BPB_ResvdSecCnt + RootDirSectors); // TmpVal2 = (256 * BPB_SecPerClus) + BPB_NumFATs; // TmpVal2 = TmpVal2 / 2; // FATSz = (TMPVal1 + (TmpVal2 - 1)) / TmpVal2; // BPB_FATSz32 = FATSz; } ///////////////////////////////////////////////////// /// /// FUNCTIONS DEFINES /// ///////////////////////////////////////////////////// ///////////////////////////////////////////////////// /// /// void open(char *filename) /// /// Params: /// char *filename - file system img to be opened /// /// Function Desc: /// This functions opens the file system img ///////////////////////////////////////////////////// void open(char *filename) { char buffer[100]; fp = fopen(filename, "r+"); //check if the file system image file exists if (fp == NULL) { printf("Error: File system image not found.\n"); } else if (fileOpen == True) { printf("Error: File system image already open.\n"); } else { fileOpen = True; // if it does initialize the global vars from spec fseek(fp, 3, SEEK_SET); fread(buffer, 8, 1, fp); memcpy(BS_OMEName, buffer, 8); fseek(fp, 11, SEEK_SET); fread(buffer, 2, 1, fp); memcpy(&BPB_BytesPerSec, buffer, 2); fseek(fp, 13, SEEK_SET); fread(buffer, 1, 1, fp); memcpy(&BPB_SecPerClus, buffer, 1); fseek(fp, 14, SEEK_SET); fread(buffer, 2, 1, fp); memcpy(&BPB_RsvdSecCnt, buffer, 2); fseek(fp, 16, SEEK_SET); fread(buffer, 1, 1, fp); memcpy(&BPB_NumFATs, buffer, 1); fseek(fp, 17, SEEK_SET); fread(buffer, 2, 1, fp); memcpy(&BPB_RootEntCnt, buffer, 2); fseek(fp, 36, SEEK_SET); fread(buffer, 4, 1, fp); memcpy(&BPB_FATSz32, buffer, 4); fseek(fp, 43, SEEK_SET); fread(buffer, 11, 1, fp); memcpy(&BS_VolLab, buffer, 11); fseek(fp, 44, SEEK_SET); fread(buffer, 4, 1, fp); memcpy(&BPB_RootClus, buffer, 4); BPB_RootClus = (BPB_NumFATs * BPB_FATSz32 * BPB_BytesPerSec) + (BPB_RsvdSecCnt * BPB_BytesPerSec); int i; for (int i = 0; i < 16; i++) { int startAdd = BPB_RootClus + (i * 32); fseek(fp, startAdd, SEEK_SET); fread(&dir[i], 32, 1, fp); } FirstDataSector = BPB_RsvdSecCnt + (BPB_NumFATs * BPB_FATSz32) + RootDirSectors; } } ///////////////////////////////////////////////////// /// /// void close() /// /// /// Function Desc: /// This functions closes the file system img ///////////////////////////////////////////////////// void close() { if (fileOpen == False) { printf("Error: File system not open.\n"); } else { fileOpen = False; memset(&BS_OMEName, 0, sizeof(char) * 8); memset(&BPB_BytesPerSec, 0, sizeof(int16_t)); memset(&BPB_SecPerClus, 0, sizeof(int8_t)); memset(&BPB_RsvdSecCnt, 0, sizeof(int16_t)); memset(&BPB_NumFATs, 0, sizeof(int8_t)); memset(&BPB_RootEntCnt, 0, sizeof(int16_t)); memset(&BS_VolLab, 0, sizeof(char) * 11); memset(&BPB_FATSz32, 0, sizeof(int32_t)); memset(&BPB_RootClus, 0, sizeof(int32_t)); } } ///////////////////////////////////////////////////// /// /// void info() /// /// Prints out information of the file system in /// both hex and base 10 /// ///////////////////////////////////////////////////// void info() { if (fileOpen == False) { printf("Error: File system image must be opened first.\n"); } else { printf("-----FILE SYSTEM INFO------\n"); printf("--------------------DEC\tHEX\n"); printf("- BPB_BytesPerSec: %d\t%x\n", BPB_BytesPerSec, BPB_BytesPerSec); printf("- BPB_SecPerClus: %d\t%x\n", BPB_SecPerClus, BPB_SecPerClus); printf("- BPB_RsvdSecCnt: %d\t%x\n", BPB_RsvdSecCnt, BPB_RsvdSecCnt); printf("- BPB_NumFATs: %d\t%x\n", BPB_NumFATs, BPB_NumFATs); printf("- BPB_FATSz32: %d\t%x\n", BPB_FATSz32, BPB_FATSz32); printf("----------------------------\n"); } } ///////////////////////////////////////////////////// /// /// void stat(char *filename) /// /// Params: /// char *filename - file system img to be opened /// /// Function Desc: /// This command shall print the attributes and starting cluster number /// of the file or directory name. If the parameter is a directory name then the size shall be 0. /// If the file or directory does not exist /// then your program shall output “Error: File not found”. ///////////////////////////////////////////////////// void stat(char *filename) { //check the various stats for a file or directory if (fileOpen == False) { printf("Error: File system image must be opened first.\n"); } else if (strcmp(filename, ".") == 0) { int i; for (i = 0; i < 16; i++) { if (dir[i].DIR_Name[0] == 0x2e) { char temp[11]; strncpy(temp, dir[i].DIR_Name, sizeof(temp)); temp[11] = '\0'; printf("File Name: %s\n", temp); printf("Attrib Byte: %x\n", dir[i].DIR_Attr); printf("First Cluster High: %d\n", dir[i].DIR_FirstClusterHigh); printf("First Cluster Low: %d\n", dir[i].DIR_FirstClusterLow); if (dir[i].DIR_Attr == 0x10) { printf("File Size: 0\n"); } else { printf("File Size: %x\n", dir[i].DIR_FileSize); } break; } } if (i == 16) { printf("Error: file not found\n"); } } else if (strcmp(filename, "..") == 0) { int i; for (i = 0; i < 16; i++) { if (dir[i].DIR_Name[0] == 0x2e && dir[i].DIR_Name[1] == 0x2e) { char temp[11]; strncpy(temp, dir[i].DIR_Name, sizeof(temp)); temp[11] = '\0'; printf("File Name: %s\n", temp); printf("Attrib Byte: %x\n", dir[i].DIR_Attr); printf("First Cluster High: %d\n", dir[i].DIR_FirstClusterHigh); printf("First Cluster Low: %d\n", dir[i].DIR_FirstClusterLow); //if the file is a directory set the file size = 0 if (dir[i].DIR_Attr == 0x10) { printf("File Size: 0\n"); } else { printf("File Size: %x\n", dir[i].DIR_FileSize); } break; } } if (i == 16) { printf("Error: file not found\n"); } } else { //for a file find the name for the file and check the stats char expanded_name[12]; memset(expanded_name, ' ', 12); char *token = strtok(filename, "."); strncpy(expanded_name, token, strlen(token)); token = strtok(NULL, "."); if (token) { strncpy((char *)(expanded_name + 8), token, strlen(token)); } expanded_name[11] = '\0'; int i; for (i = 0; i < 11; i++) { expanded_name[i] = toupper(expanded_name[i]); } for (i = 0; i < 16; i++) { if (strncmp(expanded_name, dir[i].DIR_Name, 11) == 0) { //print out the various stats needed char temp[11]; strncpy(temp, dir[i].DIR_Name, sizeof(temp)); temp[11] = '\0'; printf("File Name: %s\n", temp); printf("Attrib Byte: %x\n", dir[i].DIR_Attr); printf("First Cluster High: %d\n", dir[i].DIR_FirstClusterHigh); printf("First Cluster Low: %d\n", dir[i].DIR_FirstClusterLow); if (dir[i].DIR_Attr == 0x10) { printf("File Size: 0\n"); } else { printf("File Size: %x\n", dir[i].DIR_FileSize); } break; } } if (i == 16) { printf("Error: file not found\n"); } } } ///////////////////////////////////////////////////// /// /// void get(char *filename) /// /// Params: /// char *filename - file name to be gotten /// /// Function Desc: /// This functions gets a file specified /// and puts it in your current working directory ///////////////////////////////////////////////////// void get(char *filename) { FILE *writeTo; if (fileOpen == False) { printf("Error: File system image must be opened first.\n"); } else if (strcmp(filename, "..") == 0) { printf("Error: Cannot get a directory.\n"); } else { //find the file name to get and put it in your current directory char *use = (char *)malloc(sizeof(filename)); strcpy(use, filename); char expanded_name[12]; memset(expanded_name, ' ', 12); char *token = strtok(use, "."); strncpy(expanded_name, token, strlen(token)); token = strtok(NULL, "."); if (token) { strncpy((char *)(expanded_name + 8), token, strlen(token)); } expanded_name[11] = '\0'; int i; for (i = 0; i < 11; i++) { expanded_name[i] = toupper(expanded_name[i]); } for (i = 0; i < 16; i++) { if (strncmp(expanded_name, dir[i].DIR_Name, 11) == 0) { //get open the file char output; writeTo = fopen(filename, "w"); int sect = dir[i].DIR_FirstClusterLow; int add = LBAToOffset(sect); int readSoFar; for (readSoFar = 0; readSoFar < dir[i].DIR_FileSize; readSoFar++) { //if it goes past the current LB //find the next LB if (readSoFar % 512 == 0 && readSoFar != 0) { sect = NextLB(sect); add = LBAToOffset(sect); } fseek(fp, add++, SEEK_SET); fread(&output, 1, 1, fp); //put the file into directory fputc(output, writeTo); } //close the file fclose(writeTo); //break as to not constantly repeat break; } } if (i == 16) { printf("Error: file not found\n"); } } } ///////////////////////////////////////////////////// /// /// void cd(char *filename) /// /// Params: /// char *filename - directory to be cd'd into /// /// Function Desc: /// This function cd's into the specified directory ///////////////////////////////////////////////////// void cd(char *filename) { if (fileOpen == False) { printf("Error: File system image must be opened first.\n"); } else { //if there is more than one directory in the path // strtok by the '/' then search for that directory then cd into it char *tok = strtok(filename, "/"); while (tok != NULL) { if (strcmp(tok, "..") == 0) { int i; for (i = 0; i < 16; i++) { if (dir[i].DIR_Name[0] == 0x2e && dir[i].DIR_Name[1] == 0x2e) { int offset; if (dir[i].DIR_FirstClusterLow == 0) { offset = LBAToOffset(2); } else { offset = LBAToOffset(dir[i].DIR_FirstClusterLow); } int j; for (j = 0; j < 16; j++) { //calculate the start address then cd from there int startAdd = offset + (j * 32); fseek(fp, startAdd, SEEK_SET); fread(&dir[j], 32, 1, fp); } break; } } if (i == 16) { printf("Error: file not found\n"); } } else { int i; char *use = (char *)malloc(sizeof(tok)); strcpy(use, tok); for (i = 0; i < sizeof(use); i++) { use[i] = toupper(use[i]); } for (i = strlen(use); i < 12; i++) { strcat(use, " "); } use[11] = '\0'; for (i = 0; i < 16; i++) { if (dir[i].DIR_Attr == 0x10 && strncmp(use, dir[i].DIR_Name, 11) == 0) { int offset; if (dir[i].DIR_FirstClusterLow == 0) { offset = LBAToOffset(2); } else { offset = LBAToOffset(dir[i].DIR_FirstClusterLow); } int j; for (j = 0; j < 16; j++) { int startAdd = offset + (j * 32); fseek(fp, startAdd, SEEK_SET); fread(&dir[j], 32, 1, fp); } break; } } } tok = strtok(NULL, "/"); } } } ///////////////////////////////////////////////////// /// /// void ls(char *token) /// /// Params: /// char *token - if you want to ls the parent directory /// /// Function Desc: /// This function lists the files/subdirectories /// in the current directory. ///////////////////////////////////////////////////// void ls(char *token) { if (fileOpen == False) { printf("Error: File system image must be opened first.\n"); } else if (strcmp(token, "..") == 0) { //if asking for the parent directory //find it then print it int i; for (i = 0; i < 16; i++) { if (dir[i].DIR_Name[0] == 0x00) { break; } else if (dir[i].DIR_Name[0] == 0x2e && dir[i].DIR_Name[1] == 0x2e) { int offset; if (dir[i].DIR_FirstClusterLow == 0) { offset = LBAToOffset(2); } else { offset = LBAToOffset(dir[i].DIR_FirstClusterLow); } int j; struct DirectoryEntry temp[16]; for (j = 0; j < 16; j++) { int startAdd = offset + (j * 32); fseek(fp, startAdd, SEEK_SET); fread(&temp[j], 32, 1, fp); } for (j = 0; j < 16; j++) { if (temp[j].DIR_Name[0] == 0x00) { break; } //check if the files are to be printed out else if ((temp[j].DIR_Attr == 0x01 || temp[j].DIR_Attr == 0x10 || temp[j].DIR_Attr == 0x20 || temp[j].DIR_Attr == 0x30) && (unsigned char)temp[j].DIR_Name[0] != 0xE5) { char tok[11]; strncpy(tok, temp[j].DIR_Name, sizeof(tok)); tok[11] = '\0'; printf("%s\n", tok); } } break; } } if (i == 16) { printf("Error: file not found\n"); } } else { //else just list the files in the current directory int i; for (i = 0; i < 16; i++) { if (dir[i].DIR_Name[0] == 0x00) { break; } //check if the files are to be printed out else if ((dir[i].DIR_Attr == 0x01 || dir[i].DIR_Attr == 0x10 || dir[i].DIR_Attr == 0x20 || dir[i].DIR_Attr == 0x30) && (unsigned char)dir[i].DIR_Name[0] != 0xe5) { char temp[11]; strncpy(temp, dir[i].DIR_Name, sizeof(temp)); temp[11] = '\0'; printf("%s\n", temp); } } } } ///////////////////////////////////////////////////// /// /// void read(char *filename, int position, int numBytes) /// /// Params: /// char *filename - file system img to be opened /// int position - where to start in the file /// int numBytes - how many bytes to read /// /// Function Desc: /// This functions, given the starting position, /// reads a specified number of bytes in a file. ///////////////////////////////////////////////////// void read(char *filename, int position, int numBytes) { if (fileOpen == False) { printf("Error: File system image must be opened first.\n"); } else if (strcmp(filename, "..") == 0) { printf("Error: Cannot read a directory.\n"); } else { //find the name if the file to be read char *use = (char *)malloc(sizeof(filename)); strcpy(use, filename); char expanded_name[12]; memset(expanded_name, ' ', 12); char *token = strtok(use, "."); strncpy(expanded_name, token, strlen(token)); token = strtok(NULL, "."); if (token) { strncpy((char *)(expanded_name + 8), token, strlen(token)); } expanded_name[11] = '\0'; int i; for (i = 0; i < 11; i++) { expanded_name[i] = toupper(expanded_name[i]); } for (i = 0; i < 16; i++) { if (strncmp(expanded_name, dir[i].DIR_Name, 11) == 0) { char output; int sect = dir[i].DIR_FirstClusterLow; int add = LBAToOffset(sect); int readSoFar; for (readSoFar = 0; readSoFar < dir[i].DIR_FileSize; readSoFar++) { //when the name is found, set the char to the position to start // then read for the number of bytes if (readSoFar % 512 == 0 && readSoFar != 0) { sect = NextLB(sect); add = LBAToOffset(sect); } fseek(fp, add++, SEEK_SET); fread(&output, 1, 1, fp); if (readSoFar >= position && readSoFar < (position + numBytes)) { printf("%x ", output); } } printf("\n"); break; } } if (i == 16) { printf("Error: file not found\n"); } } } ///////////////////////////////////////////////////// /// /// int LBAToOffset(int32_t sector) /// /// Params: /// int32_t sector - the sector /// /// Function Desc: /// This function calculates the logial block /// address to the offset ///////////////////////////////////////////////////// int LBAToOffset(int32_t sector) { return ((sector - 2) * BPB_BytesPerSec) + (BPB_BytesPerSec * BPB_RsvdSecCnt) + (BPB_NumFATs * BPB_FATSz32 * BPB_BytesPerSec); } ///////////////////////////////////////////////////// /// /// int16_t NextLB(uint32_t sector) /// /// Params: /// uint32_t sector - the sector /// /// Function Desc: /// This function calculates the /// next logial block ///////////////////////////////////////////////////// int16_t NextLB(uint32_t sector) { uint32_t FATAddress = (BPB_BytesPerSec * BPB_RsvdSecCnt) + (sector * 4); int16_t val; fseek(fp, FATAddress, SEEK_SET); fread(&val, 2, 1, fp); return val; }
the_stack_data/7637.c
#include <unistd.h> int main(int argc, char *argv[]) { int i; char *str; char find; char replace; char c; // If we don't have 3 arguments (+ 1 command), print newline and return. if (argc != 4) { char c = '\n'; write(1, &c, 1); return (1); } // Store string, find char, and replace char. str = argv[1]; find = *argv[2]; replace = *argv[3]; i = 0; // Iterate through while (str[i]) { if (str[i] == find) { c = replace; } else { c = str[i]; } write(1, &c, 1); i++; } c = '\n'; write(1, &c, 1); return (0); }
the_stack_data/243893204.c
#include <stdio.h> #include <math.h> int main(){ int a, b, c; double delta; scanf("%d %d %d",&a,&b,&c); delta = ((pow(b,2))-(4*a*c)); if(delta>0){ printf("%.4f %.4f\n",((-b+(sqrt(delta)))/(2*a)),((-b-(sqrt(delta)))/(2*a))); } return 0; }
the_stack_data/211079720.c
#include <stdio.h> int main() { int M, N; while( scanf("%d %d", &M, &N)==2 ) printf("%d\n", (M*N)-1); return 0; }
the_stack_data/95449987.c
#include <stdio.h> int i,x = 1; int main() { while(1) { for(i = 1;i <= x;i++) { x++; printf("%d回目の繰り返しです。\n",i); //wait(1); } //break; } }
the_stack_data/111077533.c
/* { dg-do compile } */ /* { dg-options "-Wuninitialized -O2" } */ int g; void bar(); void blah(int); int foo (int n, int l, int m, int r) { int v; if ( (n < 10) && (m == l) && (r < 20) ) v = r; if (m) g++; else bar(); if ( (n <= 8) && (m == l) && (r < 19) ) blah(v); /* { dg-bogus "uninitialized" "bogus warning" } */ return 0; }
the_stack_data/9512340.c
/* fprintf example */ #include <stdio.h> int main () { FILE * pFile; int n; char name[100]; pFile = fopen ("myfileprintf.txt","r"); while(fscanf(pFile, "Name %d %[^\n]",&n,name) != EOF) { fgetc(pFile); printf("Name %d %s\n", n, name); } fclose (pFile); return 0; }
the_stack_data/126704111.c
/* f2c.h -- Standard Fortran to C header file */ /** barf [ba:rf] 2. "He suggested using FORTRAN, and everybody barfed." - From The Shogakukan DICTIONARY OF NEW ENGLISH (Second edition) */ #ifndef F2C_INCLUDE #define F2C_INCLUDE #include <math.h> #include <stdlib.h> #include <string.h> #include <stdio.h> #include <complex.h> #ifdef complex #undef complex #endif #ifdef I #undef I #endif #if defined(_WIN64) typedef long long BLASLONG; typedef unsigned long long BLASULONG; #else typedef long BLASLONG; typedef unsigned long BLASULONG; #endif #ifdef LAPACK_ILP64 typedef BLASLONG blasint; #if defined(_WIN64) #define blasabs(x) llabs(x) #else #define blasabs(x) labs(x) #endif #else typedef int blasint; #define blasabs(x) abs(x) #endif typedef blasint integer; typedef unsigned int uinteger; typedef char *address; typedef short int shortint; typedef float real; typedef double doublereal; typedef struct { real r, i; } complex; typedef struct { doublereal r, i; } doublecomplex; static inline _Complex float Cf(complex *z) {return z->r + z->i*_Complex_I;} static inline _Complex double Cd(doublecomplex *z) {return z->r + z->i*_Complex_I;} static inline _Complex float * _pCf(complex *z) {return (_Complex float*)z;} static inline _Complex double * _pCd(doublecomplex *z) {return (_Complex double*)z;} #define pCf(z) (*_pCf(z)) #define pCd(z) (*_pCd(z)) typedef int logical; typedef short int shortlogical; typedef char logical1; typedef char integer1; #define TRUE_ (1) #define FALSE_ (0) /* Extern is for use with -E */ #ifndef Extern #define Extern extern #endif /* I/O stuff */ typedef int flag; typedef int ftnlen; typedef int ftnint; /*external read, write*/ typedef struct { flag cierr; ftnint ciunit; flag ciend; char *cifmt; ftnint cirec; } cilist; /*internal read, write*/ typedef struct { flag icierr; char *iciunit; flag iciend; char *icifmt; ftnint icirlen; ftnint icirnum; } icilist; /*open*/ typedef struct { flag oerr; ftnint ounit; char *ofnm; ftnlen ofnmlen; char *osta; char *oacc; char *ofm; ftnint orl; char *oblnk; } olist; /*close*/ typedef struct { flag cerr; ftnint cunit; char *csta; } cllist; /*rewind, backspace, endfile*/ typedef struct { flag aerr; ftnint aunit; } alist; /* inquire */ typedef struct { flag inerr; ftnint inunit; char *infile; ftnlen infilen; ftnint *inex; /*parameters in standard's order*/ ftnint *inopen; ftnint *innum; ftnint *innamed; char *inname; ftnlen innamlen; char *inacc; ftnlen inacclen; char *inseq; ftnlen inseqlen; char *indir; ftnlen indirlen; char *infmt; ftnlen infmtlen; char *inform; ftnint informlen; char *inunf; ftnlen inunflen; ftnint *inrecl; ftnint *innrec; char *inblank; ftnlen inblanklen; } inlist; #define VOID void union Multitype { /* for multiple entry points */ integer1 g; shortint h; integer i; /* longint j; */ real r; doublereal d; complex c; doublecomplex z; }; typedef union Multitype Multitype; struct Vardesc { /* for Namelist */ char *name; char *addr; ftnlen *dims; int type; }; typedef struct Vardesc Vardesc; struct Namelist { char *name; Vardesc **vars; int nvars; }; typedef struct Namelist Namelist; #define abs(x) ((x) >= 0 ? (x) : -(x)) #define dabs(x) (fabs(x)) #define f2cmin(a,b) ((a) <= (b) ? (a) : (b)) #define f2cmax(a,b) ((a) >= (b) ? (a) : (b)) #define dmin(a,b) (f2cmin(a,b)) #define dmax(a,b) (f2cmax(a,b)) #define bit_test(a,b) ((a) >> (b) & 1) #define bit_clear(a,b) ((a) & ~((uinteger)1 << (b))) #define bit_set(a,b) ((a) | ((uinteger)1 << (b))) #define abort_() { sig_die("Fortran abort routine called", 1); } #define c_abs(z) (cabsf(Cf(z))) #define c_cos(R,Z) { pCf(R)=ccos(Cf(Z)); } #define c_div(c, a, b) {pCf(c) = Cf(a)/Cf(b);} #define z_div(c, a, b) {pCd(c) = Cd(a)/Cd(b);} #define c_exp(R, Z) {pCf(R) = cexpf(Cf(Z));} #define c_log(R, Z) {pCf(R) = clogf(Cf(Z));} #define c_sin(R, Z) {pCf(R) = csinf(Cf(Z));} //#define c_sqrt(R, Z) {*(R) = csqrtf(Cf(Z));} #define c_sqrt(R, Z) {pCf(R) = csqrtf(Cf(Z));} #define d_abs(x) (fabs(*(x))) #define d_acos(x) (acos(*(x))) #define d_asin(x) (asin(*(x))) #define d_atan(x) (atan(*(x))) #define d_atn2(x, y) (atan2(*(x),*(y))) #define d_cnjg(R, Z) { pCd(R) = conj(Cd(Z)); } #define r_cnjg(R, Z) { pCf(R) = conj(Cf(Z)); } #define d_cos(x) (cos(*(x))) #define d_cosh(x) (cosh(*(x))) #define d_dim(__a, __b) ( *(__a) > *(__b) ? *(__a) - *(__b) : 0.0 ) #define d_exp(x) (exp(*(x))) #define d_imag(z) (cimag(Cd(z))) #define r_imag(z) (cimag(Cf(z))) #define d_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x))) #define r_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x))) #define d_lg10(x) ( 0.43429448190325182765 * log(*(x)) ) #define r_lg10(x) ( 0.43429448190325182765 * log(*(x)) ) #define d_log(x) (log(*(x))) #define d_mod(x, y) (fmod(*(x), *(y))) #define u_nint(__x) ((__x)>=0 ? floor((__x) + .5) : -floor(.5 - (__x))) #define d_nint(x) u_nint(*(x)) #define u_sign(__a,__b) ((__b) >= 0 ? ((__a) >= 0 ? (__a) : -(__a)) : -((__a) >= 0 ? (__a) : -(__a))) #define d_sign(a,b) u_sign(*(a),*(b)) #define r_sign(a,b) u_sign(*(a),*(b)) #define d_sin(x) (sin(*(x))) #define d_sinh(x) (sinh(*(x))) #define d_sqrt(x) (sqrt(*(x))) #define d_tan(x) (tan(*(x))) #define d_tanh(x) (tanh(*(x))) #define i_abs(x) abs(*(x)) #define i_dnnt(x) ((integer)u_nint(*(x))) #define i_len(s, n) (n) #define i_nint(x) ((integer)u_nint(*(x))) #define i_sign(a,b) ((integer)u_sign((integer)*(a),(integer)*(b))) #define pow_dd(ap, bp) ( pow(*(ap), *(bp))) #define pow_si(B,E) spow_ui(*(B),*(E)) #define pow_ri(B,E) spow_ui(*(B),*(E)) #define pow_di(B,E) dpow_ui(*(B),*(E)) #define pow_zi(p, a, b) {pCd(p) = zpow_ui(Cd(a), *(b));} #define pow_ci(p, a, b) {pCf(p) = cpow_ui(Cf(a), *(b));} #define pow_zz(R,A,B) {pCd(R) = cpow(Cd(A),*(B));} #define s_cat(lpp, rpp, rnp, np, llp) { ftnlen i, nc, ll; char *f__rp, *lp; ll = (llp); lp = (lpp); for(i=0; i < (int)*(np); ++i) { nc = ll; if((rnp)[i] < nc) nc = (rnp)[i]; ll -= nc; f__rp = (rpp)[i]; while(--nc >= 0) *lp++ = *(f__rp)++; } while(--ll >= 0) *lp++ = ' '; } #define s_cmp(a,b,c,d) ((integer)strncmp((a),(b),f2cmin((c),(d)))) #define s_copy(A,B,C,D) { int __i,__m; for (__i=0, __m=f2cmin((C),(D)); __i<__m && (B)[__i] != 0; ++__i) (A)[__i] = (B)[__i]; } #define sig_die(s, kill) { exit(1); } #define s_stop(s, n) {exit(0);} static char junk[] = "\n@(#)LIBF77 VERSION 19990503\n"; #define z_abs(z) (cabs(Cd(z))) #define z_exp(R, Z) {pCd(R) = cexp(Cd(Z));} #define z_sqrt(R, Z) {pCd(R) = csqrt(Cd(Z));} #define myexit_() break; #define mycycle() continue; #define myceiling(w) {ceil(w)} #define myhuge(w) {HUGE_VAL} //#define mymaxloc_(w,s,e,n) {if (sizeof(*(w)) == sizeof(double)) dmaxloc_((w),*(s),*(e),n); else dmaxloc_((w),*(s),*(e),n);} #define mymaxloc(w,s,e,n) {dmaxloc_(w,*(s),*(e),n)} /* procedure parameter types for -A and -C++ */ #define F2C_proc_par_types 1 #ifdef __cplusplus typedef logical (*L_fp)(...); #else typedef logical (*L_fp)(); #endif static float spow_ui(float x, integer n) { float pow=1.0; unsigned long int u; if(n != 0) { if(n < 0) n = -n, x = 1/x; for(u = n; ; ) { if(u & 01) pow *= x; if(u >>= 1) x *= x; else break; } } return pow; } static double dpow_ui(double x, integer n) { double pow=1.0; unsigned long int u; if(n != 0) { if(n < 0) n = -n, x = 1/x; for(u = n; ; ) { if(u & 01) pow *= x; if(u >>= 1) x *= x; else break; } } return pow; } static _Complex float cpow_ui(_Complex float x, integer n) { _Complex float pow=1.0; unsigned long int u; if(n != 0) { if(n < 0) n = -n, x = 1/x; for(u = n; ; ) { if(u & 01) pow *= x; if(u >>= 1) x *= x; else break; } } return pow; } static _Complex double zpow_ui(_Complex double x, integer n) { _Complex double pow=1.0; unsigned long int u; if(n != 0) { if(n < 0) n = -n, x = 1/x; for(u = n; ; ) { if(u & 01) pow *= x; if(u >>= 1) x *= x; else break; } } return pow; } static integer pow_ii(integer x, integer n) { integer pow; unsigned long int u; if (n <= 0) { if (n == 0 || x == 1) pow = 1; else if (x != -1) pow = x == 0 ? 1/x : 0; else n = -n; } if ((n > 0) || !(n == 0 || x == 1 || x != -1)) { u = n; for(pow = 1; ; ) { if(u & 01) pow *= x; if(u >>= 1) x *= x; else break; } } return pow; } static integer dmaxloc_(double *w, integer s, integer e, integer *n) { double m; integer i, mi; for(m=w[s-1], mi=s, i=s+1; i<=e; i++) if (w[i-1]>m) mi=i ,m=w[i-1]; return mi-s+1; } static integer smaxloc_(float *w, integer s, integer e, integer *n) { float m; integer i, mi; for(m=w[s-1], mi=s, i=s+1; i<=e; i++) if (w[i-1]>m) mi=i ,m=w[i-1]; return mi-s+1; } static inline void cdotc_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) { integer n = *n_, incx = *incx_, incy = *incy_, i; _Complex float zdotc = 0.0; if (incx == 1 && incy == 1) { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc += conjf(Cf(&x[i])) * Cf(&y[i]); } } else { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc += conjf(Cf(&x[i*incx])) * Cf(&y[i*incy]); } } pCf(z) = zdotc; } static inline void zdotc_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) { integer n = *n_, incx = *incx_, incy = *incy_, i; _Complex double zdotc = 0.0; if (incx == 1 && incy == 1) { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc += conj(Cd(&x[i])) * Cd(&y[i]); } } else { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc += conj(Cd(&x[i*incx])) * Cd(&y[i*incy]); } } pCd(z) = zdotc; } static inline void cdotu_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) { integer n = *n_, incx = *incx_, incy = *incy_, i; _Complex float zdotc = 0.0; if (incx == 1 && incy == 1) { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc += Cf(&x[i]) * Cf(&y[i]); } } else { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc += Cf(&x[i*incx]) * Cf(&y[i*incy]); } } pCf(z) = zdotc; } static inline void zdotu_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) { integer n = *n_, incx = *incx_, incy = *incy_, i; _Complex double zdotc = 0.0; if (incx == 1 && incy == 1) { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc += Cd(&x[i]) * Cd(&y[i]); } } else { for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */ zdotc += Cd(&x[i*incx]) * Cd(&y[i*incy]); } } pCd(z) = zdotc; } #endif /* -- translated by f2c (version 20000121). You must link the resulting object file with the libraries: -lf2c -lm (in that order) */ /* Table of constant values */ static complex c_b1 = {1.f,0.f}; /* > \brief \b CHETRS2 */ /* =========== DOCUMENTATION =========== */ /* Online html documentation available at */ /* http://www.netlib.org/lapack/explore-html/ */ /* > \htmlonly */ /* > Download CHETRS2 + dependencies */ /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/chetrs2 .f"> */ /* > [TGZ]</a> */ /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/chetrs2 .f"> */ /* > [ZIP]</a> */ /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/chetrs2 .f"> */ /* > [TXT]</a> */ /* > \endhtmlonly */ /* Definition: */ /* =========== */ /* SUBROUTINE CHETRS2( UPLO, N, NRHS, A, LDA, IPIV, B, LDB, */ /* WORK, INFO ) */ /* CHARACTER UPLO */ /* INTEGER INFO, LDA, LDB, N, NRHS */ /* INTEGER IPIV( * ) */ /* COMPLEX A( LDA, * ), B( LDB, * ), WORK( * ) */ /* > \par Purpose: */ /* ============= */ /* > */ /* > \verbatim */ /* > */ /* > CHETRS2 solves a system of linear equations A*X = B with a complex */ /* > Hermitian matrix A using the factorization A = U*D*U**H or */ /* > A = L*D*L**H computed by CHETRF and converted by CSYCONV. */ /* > \endverbatim */ /* Arguments: */ /* ========== */ /* > \param[in] UPLO */ /* > \verbatim */ /* > UPLO is CHARACTER*1 */ /* > Specifies whether the details of the factorization are stored */ /* > as an upper or lower triangular matrix. */ /* > = 'U': Upper triangular, form is A = U*D*U**H; */ /* > = 'L': Lower triangular, form is A = L*D*L**H. */ /* > \endverbatim */ /* > */ /* > \param[in] N */ /* > \verbatim */ /* > N is INTEGER */ /* > The order of the matrix A. N >= 0. */ /* > \endverbatim */ /* > */ /* > \param[in] NRHS */ /* > \verbatim */ /* > NRHS is INTEGER */ /* > The number of right hand sides, i.e., the number of columns */ /* > of the matrix B. NRHS >= 0. */ /* > \endverbatim */ /* > */ /* > \param[in] A */ /* > \verbatim */ /* > A is COMPLEX array, dimension (LDA,N) */ /* > The block diagonal matrix D and the multipliers used to */ /* > obtain the factor U or L as computed by CHETRF. */ /* > \endverbatim */ /* > */ /* > \param[in] LDA */ /* > \verbatim */ /* > LDA is INTEGER */ /* > The leading dimension of the array A. LDA >= f2cmax(1,N). */ /* > \endverbatim */ /* > */ /* > \param[in] IPIV */ /* > \verbatim */ /* > IPIV is INTEGER array, dimension (N) */ /* > Details of the interchanges and the block structure of D */ /* > as determined by CHETRF. */ /* > \endverbatim */ /* > */ /* > \param[in,out] B */ /* > \verbatim */ /* > B is COMPLEX array, dimension (LDB,NRHS) */ /* > On entry, the right hand side matrix B. */ /* > On exit, the solution matrix X. */ /* > \endverbatim */ /* > */ /* > \param[in] LDB */ /* > \verbatim */ /* > LDB is INTEGER */ /* > The leading dimension of the array B. LDB >= f2cmax(1,N). */ /* > \endverbatim */ /* > */ /* > \param[out] WORK */ /* > \verbatim */ /* > WORK is COMPLEX array, dimension (N) */ /* > \endverbatim */ /* > */ /* > \param[out] INFO */ /* > \verbatim */ /* > INFO is INTEGER */ /* > = 0: successful exit */ /* > < 0: if INFO = -i, the i-th argument had an illegal value */ /* > \endverbatim */ /* Authors: */ /* ======== */ /* > \author Univ. of Tennessee */ /* > \author Univ. of California Berkeley */ /* > \author Univ. of Colorado Denver */ /* > \author NAG Ltd. */ /* > \date December 2016 */ /* > \ingroup complexHEcomputational */ /* ===================================================================== */ /* Subroutine */ int chetrs2_(char *uplo, integer *n, integer *nrhs, complex * a, integer *lda, integer *ipiv, complex *b, integer *ldb, complex * work, integer *info) { /* System generated locals */ integer a_dim1, a_offset, b_dim1, b_offset, i__1, i__2; complex q__1, q__2, q__3; /* Local variables */ complex akm1k; integer i__, j, k; real s; extern logical lsame_(char *, char *); complex denom; integer iinfo; extern /* Subroutine */ int cswap_(integer *, complex *, integer *, complex *, integer *), ctrsm_(char *, char *, char *, char *, integer *, integer *, complex *, complex *, integer *, complex *, integer *); logical upper; complex ak, bk; integer kp; extern /* Subroutine */ int csscal_(integer *, real *, complex *, integer *), xerbla_(char *, integer *, ftnlen); complex akm1, bkm1; extern /* Subroutine */ int csyconv_(char *, char *, integer *, complex *, integer *, integer *, complex *, integer *); /* -- LAPACK computational routine (version 3.7.0) -- */ /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */ /* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */ /* December 2016 */ /* ===================================================================== */ /* Parameter adjustments */ a_dim1 = *lda; a_offset = 1 + a_dim1 * 1; a -= a_offset; --ipiv; b_dim1 = *ldb; b_offset = 1 + b_dim1 * 1; b -= b_offset; --work; /* Function Body */ *info = 0; upper = lsame_(uplo, "U"); if (! upper && ! lsame_(uplo, "L")) { *info = -1; } else if (*n < 0) { *info = -2; } else if (*nrhs < 0) { *info = -3; } else if (*lda < f2cmax(1,*n)) { *info = -5; } else if (*ldb < f2cmax(1,*n)) { *info = -8; } if (*info != 0) { i__1 = -(*info); xerbla_("CHETRS2", &i__1, (ftnlen)7); return 0; } /* Quick return if possible */ if (*n == 0 || *nrhs == 0) { return 0; } /* Convert A */ csyconv_(uplo, "C", n, &a[a_offset], lda, &ipiv[1], &work[1], &iinfo); if (upper) { /* Solve A*X = B, where A = U*D*U**H. */ /* P**T * B */ k = *n; while(k >= 1) { if (ipiv[k] > 0) { /* 1 x 1 diagonal block */ /* Interchange rows K and IPIV(K). */ kp = ipiv[k]; if (kp != k) { cswap_(nrhs, &b[k + b_dim1], ldb, &b[kp + b_dim1], ldb); } --k; } else { /* 2 x 2 diagonal block */ /* Interchange rows K-1 and -IPIV(K). */ kp = -ipiv[k]; if (kp == -ipiv[k - 1]) { cswap_(nrhs, &b[k - 1 + b_dim1], ldb, &b[kp + b_dim1], ldb); } k += -2; } } /* Compute (U \P**T * B) -> B [ (U \P**T * B) ] */ ctrsm_("L", "U", "N", "U", n, nrhs, &c_b1, &a[a_offset], lda, &b[ b_offset], ldb); /* Compute D \ B -> B [ D \ (U \P**T * B) ] */ i__ = *n; while(i__ >= 1) { if (ipiv[i__] > 0) { i__1 = i__ + i__ * a_dim1; s = 1.f / a[i__1].r; csscal_(nrhs, &s, &b[i__ + b_dim1], ldb); } else if (i__ > 1) { if (ipiv[i__ - 1] == ipiv[i__]) { i__1 = i__; akm1k.r = work[i__1].r, akm1k.i = work[i__1].i; c_div(&q__1, &a[i__ - 1 + (i__ - 1) * a_dim1], &akm1k); akm1.r = q__1.r, akm1.i = q__1.i; r_cnjg(&q__2, &akm1k); c_div(&q__1, &a[i__ + i__ * a_dim1], &q__2); ak.r = q__1.r, ak.i = q__1.i; q__2.r = akm1.r * ak.r - akm1.i * ak.i, q__2.i = akm1.r * ak.i + akm1.i * ak.r; q__1.r = q__2.r - 1.f, q__1.i = q__2.i + 0.f; denom.r = q__1.r, denom.i = q__1.i; i__1 = *nrhs; for (j = 1; j <= i__1; ++j) { c_div(&q__1, &b[i__ - 1 + j * b_dim1], &akm1k); bkm1.r = q__1.r, bkm1.i = q__1.i; r_cnjg(&q__2, &akm1k); c_div(&q__1, &b[i__ + j * b_dim1], &q__2); bk.r = q__1.r, bk.i = q__1.i; i__2 = i__ - 1 + j * b_dim1; q__3.r = ak.r * bkm1.r - ak.i * bkm1.i, q__3.i = ak.r * bkm1.i + ak.i * bkm1.r; q__2.r = q__3.r - bk.r, q__2.i = q__3.i - bk.i; c_div(&q__1, &q__2, &denom); b[i__2].r = q__1.r, b[i__2].i = q__1.i; i__2 = i__ + j * b_dim1; q__3.r = akm1.r * bk.r - akm1.i * bk.i, q__3.i = akm1.r * bk.i + akm1.i * bk.r; q__2.r = q__3.r - bkm1.r, q__2.i = q__3.i - bkm1.i; c_div(&q__1, &q__2, &denom); b[i__2].r = q__1.r, b[i__2].i = q__1.i; /* L15: */ } --i__; } } --i__; } /* Compute (U**H \ B) -> B [ U**H \ (D \ (U \P**T * B) ) ] */ ctrsm_("L", "U", "C", "U", n, nrhs, &c_b1, &a[a_offset], lda, &b[ b_offset], ldb); /* P * B [ P * (U**H \ (D \ (U \P**T * B) )) ] */ k = 1; while(k <= *n) { if (ipiv[k] > 0) { /* 1 x 1 diagonal block */ /* Interchange rows K and IPIV(K). */ kp = ipiv[k]; if (kp != k) { cswap_(nrhs, &b[k + b_dim1], ldb, &b[kp + b_dim1], ldb); } ++k; } else { /* 2 x 2 diagonal block */ /* Interchange rows K-1 and -IPIV(K). */ kp = -ipiv[k]; if (k < *n && kp == -ipiv[k + 1]) { cswap_(nrhs, &b[k + b_dim1], ldb, &b[kp + b_dim1], ldb); } k += 2; } } } else { /* Solve A*X = B, where A = L*D*L**H. */ /* P**T * B */ k = 1; while(k <= *n) { if (ipiv[k] > 0) { /* 1 x 1 diagonal block */ /* Interchange rows K and IPIV(K). */ kp = ipiv[k]; if (kp != k) { cswap_(nrhs, &b[k + b_dim1], ldb, &b[kp + b_dim1], ldb); } ++k; } else { /* 2 x 2 diagonal block */ /* Interchange rows K and -IPIV(K+1). */ kp = -ipiv[k + 1]; if (kp == -ipiv[k]) { cswap_(nrhs, &b[k + 1 + b_dim1], ldb, &b[kp + b_dim1], ldb); } k += 2; } } /* Compute (L \P**T * B) -> B [ (L \P**T * B) ] */ ctrsm_("L", "L", "N", "U", n, nrhs, &c_b1, &a[a_offset], lda, &b[ b_offset], ldb); /* Compute D \ B -> B [ D \ (L \P**T * B) ] */ i__ = 1; while(i__ <= *n) { if (ipiv[i__] > 0) { i__1 = i__ + i__ * a_dim1; s = 1.f / a[i__1].r; csscal_(nrhs, &s, &b[i__ + b_dim1], ldb); } else { i__1 = i__; akm1k.r = work[i__1].r, akm1k.i = work[i__1].i; r_cnjg(&q__2, &akm1k); c_div(&q__1, &a[i__ + i__ * a_dim1], &q__2); akm1.r = q__1.r, akm1.i = q__1.i; c_div(&q__1, &a[i__ + 1 + (i__ + 1) * a_dim1], &akm1k); ak.r = q__1.r, ak.i = q__1.i; q__2.r = akm1.r * ak.r - akm1.i * ak.i, q__2.i = akm1.r * ak.i + akm1.i * ak.r; q__1.r = q__2.r - 1.f, q__1.i = q__2.i + 0.f; denom.r = q__1.r, denom.i = q__1.i; i__1 = *nrhs; for (j = 1; j <= i__1; ++j) { r_cnjg(&q__2, &akm1k); c_div(&q__1, &b[i__ + j * b_dim1], &q__2); bkm1.r = q__1.r, bkm1.i = q__1.i; c_div(&q__1, &b[i__ + 1 + j * b_dim1], &akm1k); bk.r = q__1.r, bk.i = q__1.i; i__2 = i__ + j * b_dim1; q__3.r = ak.r * bkm1.r - ak.i * bkm1.i, q__3.i = ak.r * bkm1.i + ak.i * bkm1.r; q__2.r = q__3.r - bk.r, q__2.i = q__3.i - bk.i; c_div(&q__1, &q__2, &denom); b[i__2].r = q__1.r, b[i__2].i = q__1.i; i__2 = i__ + 1 + j * b_dim1; q__3.r = akm1.r * bk.r - akm1.i * bk.i, q__3.i = akm1.r * bk.i + akm1.i * bk.r; q__2.r = q__3.r - bkm1.r, q__2.i = q__3.i - bkm1.i; c_div(&q__1, &q__2, &denom); b[i__2].r = q__1.r, b[i__2].i = q__1.i; /* L25: */ } ++i__; } ++i__; } /* Compute (L**H \ B) -> B [ L**H \ (D \ (L \P**T * B) ) ] */ ctrsm_("L", "L", "C", "U", n, nrhs, &c_b1, &a[a_offset], lda, &b[ b_offset], ldb); /* P * B [ P * (L**H \ (D \ (L \P**T * B) )) ] */ k = *n; while(k >= 1) { if (ipiv[k] > 0) { /* 1 x 1 diagonal block */ /* Interchange rows K and IPIV(K). */ kp = ipiv[k]; if (kp != k) { cswap_(nrhs, &b[k + b_dim1], ldb, &b[kp + b_dim1], ldb); } --k; } else { /* 2 x 2 diagonal block */ /* Interchange rows K-1 and -IPIV(K). */ kp = -ipiv[k]; if (k > 1 && kp == -ipiv[k - 1]) { cswap_(nrhs, &b[k + b_dim1], ldb, &b[kp + b_dim1], ldb); } k += -2; } } } /* Revert A */ csyconv_(uplo, "R", n, &a[a_offset], lda, &ipiv[1], &work[1], &iinfo); return 0; /* End of CHETRS2 */ } /* chetrs2_ */
the_stack_data/149045.c
hey() { int x,y,z; z= x ? : y; }
the_stack_data/165765017.c
#include <stdio.h> // (f)printf, fscanf, fgetc, fgets #include <stdlib.h> // malloc, free, atoi #include <stdint.h> // int64_t #include <inttypes.h> // PRId64 #include <string.h> // memcpy, getline #include <unistd.h> // isatty, STDIN_FILENO #include <stdbool.h> // bool #define MAXPC (3) // max param count #define STAGES (5) // number of amplifier stages (day 7) #define VMCOUNT (STAGES + 1) // maximum number of VMs typedef enum errcode { ERR_OK, ERR_FILE_NOTFOUND, ERR_FILE_NOTCSV, ERR_FILE_INVALID, ERR_MEM_OUT, ERR_IP_LO, ERR_IP_HI, ERR_IP_INSTR, ERR_PAR_READ, ERR_PAR_WRITE, } ErrCode; typedef enum parmode { POS, IMM, REL } ParMode; typedef enum opcode { NOP, ADD, MUL, INP, OUT, JNZ, JPZ, LT, EQ, RBO, HLT = 99, } OpCode; typedef struct lang { OpCode op; int pc, ic, oc; // total params, input (read) params, output (write) params } Lang; // Language definition // pc = param count, ic = input (read) param count, oc = output (write) param count static const Lang lang[] = { { .op = NOP, .pc = 0, .ic = 0, .oc = 0 }, // no operation { .op = ADD, .pc = 3, .ic = 2, .oc = 1 }, // add { .op = MUL, .pc = 3, .ic = 2, .oc = 1 }, // multiply { .op = INP, .pc = 1, .ic = 0, .oc = 1 }, // input { .op = OUT, .pc = 1, .ic = 1, .oc = 0 }, // output { .op = JNZ, .pc = 2, .ic = 2, .oc = 0 }, // jump if not zero { .op = JPZ, .pc = 2, .ic = 2, .oc = 0 }, // jump if zero { .op = LT , .pc = 3, .ic = 2, .oc = 1 }, // less than (1/0) { .op = EQ , .pc = 3, .ic = 2, .oc = 1 }, // equal (1/0) { .op = RBO, .pc = 1, .ic = 1, .oc = 0 }, // relative base offset // HLT=99 is not consecutive, so reuse NOP which has same params (i.e. none) }; static const size_t langsize = sizeof lang / sizeof *lang; typedef struct virtualmachine { int64_t *mem; size_t size; ssize_t ip, base; bool halted; } VirtualMachine; static VirtualMachine vm[VMCOUNT] = {0}; #define FIFOSIZE (100) static int64_t fifobuf[FIFOSIZE] = {0}; static size_t fifohead = 0, fifotail = 0; // Get number from stdin, either piped or on terminal static int64_t input(void) { int64_t val = 0; char *s = NULL; size_t t = 0; if (isatty(STDIN_FILENO)) { printf("? "); } if (getline(&s, &t, stdin) > 0) { val = atoll(s); } free(s); return val; } static void output(int64_t val) { printf("%"PRId64"\n", val); } static int64_t fifopop(void) { if (fifohead == fifotail) { return input(); } int64_t val = fifobuf[fifotail++]; fifotail %= FIFOSIZE; return val; } static void fifopush(int64_t val) { size_t nexthead = (fifohead + 1) % FIFOSIZE; if (nexthead == fifotail) { output(val); } fifobuf[fifohead] = val; fifohead = nexthead; } static void fifoprint() { while (fifohead != fifotail) { output(fifopop()); } } static const Lang *getdef(OpCode op) { if (op >= langsize) { return &lang[NOP]; } if (lang[op].op == op) { return &lang[op]; } for (size_t i = 0; i < langsize; ++i) { if (lang[i].op == op) { return &lang[i]; } } return &lang[NOP]; } static void clean(VirtualMachine *pv) { if (pv != NULL) { free(pv->mem); memset(pv, 0, sizeof *pv); } } static void clean_all(void) { for (size_t i = 0; i < VMCOUNT; ++i) { clean(&vm[i]); } } static __attribute__((noreturn)) void fatal(ErrCode e) { switch (e) { case ERR_OK : break; case ERR_FILE_NOTFOUND : fprintf(stderr, "File not found.\n"); break; case ERR_FILE_NOTCSV : fprintf(stderr, "Not a CSV file.\n"); break; case ERR_FILE_INVALID : fprintf(stderr, "Invalid file format.\n"); break; case ERR_MEM_OUT : fprintf(stderr, "Out of memory.\n"); break; case ERR_IP_LO : fprintf(stderr, "IP segfault (under).\n"); break; case ERR_IP_HI : fprintf(stderr, "IP segfault (over).\n"); break; case ERR_IP_INSTR : fprintf(stderr, "Instr segfault.\n"); break; case ERR_PAR_READ : fprintf(stderr, "Par segfault (read).\n"); break; case ERR_PAR_WRITE : fprintf(stderr, "Par segfault (write).\n"); break; } clean_all(); exit((int)e); } static void setsize(VirtualMachine *pv, const size_t newsize) { if (pv != NULL && newsize > pv->size) { int64_t *try = realloc(pv->mem, newsize * sizeof *(pv->mem)); if (try == NULL) { fatal(ERR_MEM_OUT); } memset(try + pv->size, 0, (newsize - pv->size) * sizeof *(pv->mem)); pv->mem = try; pv->size = newsize; } } static void addsize(VirtualMachine *pv, const ssize_t extra) { if (pv != NULL && extra > 0) { setsize(pv, pv->size + (size_t)extra); } } static void copyvm(VirtualMachine *dst, const VirtualMachine *src) { if (dst != NULL && src != NULL) { setsize(dst, src->size); // new minimal size (could still be bigger as a left-over) memcpy(dst->mem, src->mem, src->size * sizeof *(src->mem)); // copy memory from source if (dst->size > src->size) { // erase the rest memset(dst->mem + src->size, 0, (dst->size - src->size) * sizeof *(dst->mem)); } dst->ip = src->ip; dst->base = src->base; dst->halted = src->halted; } } static void load(VirtualMachine *pv, const char *filename) { // Open file FILE *f = fopen(filename, "r"); if (f == NULL) { fatal(ERR_FILE_NOTFOUND); } // Check number of commas size_t commas = 0; int c; while ((c = fgetc(f)) != EOF) { commas += c == ','; } if (!commas) { // TODO: single number "99" or even "0" should probably be a valid file fatal(ERR_FILE_NOTCSV); } // Prepare VM & memory clean(pv); // reset everything to zero setsize(pv, commas + 1); // Read file into VM memory rewind(f); int n; size_t i = 0; if (fscanf(f, "%d", &n) == 1) { // first value has no leading comma pv->mem[i++] = n; } while (i < pv->size && fscanf(f, ",%d", &n) == 1) { // all other values pv->mem[i++] = n; } fclose(f); if (i != pv->size) { fatal(ERR_FILE_INVALID); } } static void print(VirtualMachine *pv) { printf("%"PRId64, pv->mem[0]); for (size_t i = 1; i < pv->size; ++i) { printf(",%"PRId64, pv->mem[i]); } printf("\n"); } static void run(VirtualMachine *pv) { int64_t in, p[MAXPC], q; // complete instruction, parameter values, temp param value OpCode op; // opcode from instruction ParMode mode; // parameter mode for one parameter: int pc; // running parameter count while (!pv->halted) { if (pv->ip < 0) { fatal(ERR_IP_LO); } if ((size_t)(pv->ip) >= pv->size) { fatal(ERR_IP_HI); } in = pv->mem[pv->ip++]; // get instruction code, increment IP op = in % 100; const Lang *def = getdef(op); if (def->pc > 0 && (size_t)(pv->ip + def->pc) >= pv->size) { fatal(ERR_IP_INSTR); } in /= 100; // parameter modes for all parameters pc = 0; // param count while (pc < def->ic) { q = pv->mem[pv->ip++]; // get immediate parameter value, increment IP mode = in % 10; // mode for this parameter (0=positional, 1=immediate, 2=relative) if (!(mode & IMM)) { // if positional or relative if (mode & REL) { // if relative q += pv->base; } if (q < 0) { // negative addresses are invalid fatal(ERR_PAR_READ); } if ((size_t)q >= pv->size) { // read beyond mem size? setsize(pv, (size_t)(q + 1)); } q = pv->mem[q]; // indirection for positional or relative parameter } p[pc++] = q; // save & increment param count in /= 10; // modes for remaining parameters } if (def->oc) { // output param always last, never more than one, never immediate q = pv->mem[pv->ip++]; // get immediate parameter value, increment IP mode = in % 10; // mode for this parameter (0=positional, 1=immediate, 2=relative) if (mode & REL) { // if relative q += pv->base; } if (q < 0) { // negative addresses are invalid fatal(ERR_PAR_WRITE); } if ((size_t)q >= pv->size) { // write beyond mem size? setsize(pv, (size_t)(q + 1)); } p[pc++] = q; // no indirection yet, use as index in mem } switch (op) { case NOP: break; case ADD: pv->mem[p[2]] = p[0] + p[1]; break; case MUL: pv->mem[p[2]] = p[0] * p[1]; break; case INP: pv->mem[p[0]] = fifopop(); break; // when fifo empty, ask case OUT: fifopush(p[0]); return; // TODO: keep running? But needs separate in/out fifos :( case JNZ: if ( p[0]) pv->ip = p[1]; break; case JPZ: if (!p[0]) pv->ip = p[1]; break; case LT : pv->mem[p[2]] = p[0] < p[1]; break; case EQ : pv->mem[p[2]] = p[0] == p[1]; break; case RBO: pv->base += p[0]; break; case HLT: pv->halted = true; break; } } } // Permutate in lexicographic order, adapted from "perm1()" // at http://www.rosettacode.org/wiki/Permutations#version_4 static int next_perm(int *a, int n) { int k, l, t; for (k = n - 1; k && a[k - 1] >= a[k]; --k) ; if (!k--) return 0; for (l = n - 1; a[l] <= a[k]; l--) ; t = a[k]; a[k] = a[l]; a[l] = t; for (k++, l = n - 1; l > k; l--, k++) { t = a[k]; a[k] = a[l]; a[l] = t; } return 1; } // Maximum amplification for different phase permutations // amp = VirtualMachines array of length STAGES static int64_t maxamp(int part) { int64_t amax = -1; int phase[STAGES]; // Initial phase numbers: 0-4 for part 1, 5-9 for part 2 for (int i = 0; i < STAGES; ++i) { phase[i] = STAGES * (part - 1) + i; } // All permutations of phase array do { // Start every permutation with fresh amps for (int i = 0; i < STAGES; ++i) { copyvm(&vm[i], &vm[STAGES]); } // First run requires two inputs for every stage int64_t a = 0; for (int i = 0; i < STAGES; ++i) { fifopush(phase[i]); fifopush(a); run(&vm[i]); a = fifopop(); } if (part == 2) { // Multiple runs until halted fifopush(a); int i = 0; while (!vm[i].halted) { run(&vm[i++]); i %= STAGES; } a = fifopop(); } if (a > amax) { amax = a; } } while (next_perm(phase, STAGES)); return amax; } static int day2part2(VirtualMachine *app, VirtualMachine *ref) { static const int magic = 19690720; for (int verb = 0; verb < 100; ++verb) { for (int noun = 0; noun < 100; ++noun) { copyvm(app, ref); app->mem[1] = noun; app->mem[2] = verb; run(app); if (app->mem[0] == magic) { return noun * 100 + verb; } } } return -1; } int main(void) { VirtualMachine *ref, *app; // Day 2 part 1 ref = &vm[0]; app = &vm[1]; load(ref, "input02.txt"); // load data into last VM, amps are numbered 0..STAGES-1 copyvm(app, ref); app->mem[1] = 12; app->mem[2] = 2; run(app); printf("Day 2 part 1: %"PRId64"\n", app->mem[0]); // right answer = 3085697 // Day 2 part 2 printf("Day 2 part 2: %d\n", day2part2(app, ref)); // right answer = 9425 // Day 7 ref = &vm[STAGES]; load(ref, "input07.txt"); // load data into last VM, amps are numbered 0..STAGES-1 printf("Day 7 part 1: %"PRId64"\n", maxamp(1)); // right answer = 929800 printf("Day 7 part 2: %"PRId64"\n", maxamp(2)); // right answer = 15432220 // Day 9 part 1 ref = &vm[0]; app = &vm[1]; load(ref, "input09.txt"); copyvm(app, ref); fifopush(1); run(app); printf("Day 9 part 1: %"PRId64"\n", fifopop()); // right answer = 4261108180 // Day 9 part 2 copyvm(app, ref); fifopush(2); run(app); printf("Day 9 part 2: %"PRId64"\n", fifopop()); // right answer = 77944 clean_all(); return 0; }
the_stack_data/146053.c
/*** * This code is a part of EvoApproxLib library (ehw.fit.vutbr.cz/approxlib) distributed under The MIT License. * When used, please cite the following article(s): V. Mrazek, R. Hrbacek, Z. Vasicek and L. Sekanina, "EvoApprox8b: Library of approximate adders and multipliers for circuit design and benchmarking of approximation methods". Design, Automation & Test in Europe Conference & Exhibition (DATE), 2017, Lausanne, 2017, pp. 258-261. doi: 10.23919/DATE.2017.7926993 * This file contains a circuit from evoapprox8b dataset. Note that a new version of library was already published. ***/ #include <stdint.h> #include <stdlib.h> /// Approximate function mul8_345 /// Library = EvoApprox8b /// Circuit = mul8_345 /// Area (180) = 5008 /// Delay (180) = 3.600 /// Power (180) = 2214.20 /// Area (45) = 364 /// Delay (45) = 1.310 /// Power (45) = 192.40 /// Nodes = 86 /// HD = 297759 /// MAE = 199.27200 /// MSE = 67230.78125 /// MRE = 5.17 % /// WCE = 1289 /// WCRE = 200 % /// EP = 98.3 % uint16_t mul8_345(uint8_t a, uint8_t b) { uint16_t c = 0; uint8_t n0 = (a >> 0) & 0x1; uint8_t n2 = (a >> 1) & 0x1; uint8_t n4 = (a >> 2) & 0x1; uint8_t n6 = (a >> 3) & 0x1; uint8_t n8 = (a >> 4) & 0x1; uint8_t n10 = (a >> 5) & 0x1; uint8_t n12 = (a >> 6) & 0x1; uint8_t n14 = (a >> 7) & 0x1; uint8_t n16 = (b >> 0) & 0x1; uint8_t n18 = (b >> 1) & 0x1; uint8_t n20 = (b >> 2) & 0x1; uint8_t n22 = (b >> 3) & 0x1; uint8_t n24 = (b >> 4) & 0x1; uint8_t n26 = (b >> 5) & 0x1; uint8_t n28 = (b >> 6) & 0x1; uint8_t n30 = (b >> 7) & 0x1; uint8_t n32; uint8_t n33; uint8_t n34; uint8_t n38; uint8_t n39; uint8_t n45; uint8_t n49; uint8_t n55; uint8_t n62; uint8_t n63; uint8_t n72; uint8_t n73; uint8_t n83; uint8_t n89; uint8_t n99; uint8_t n116; uint8_t n117; uint8_t n123; uint8_t n235; uint8_t n282; uint8_t n398; uint8_t n399; uint8_t n414; uint8_t n415; uint8_t n449; uint8_t n514; uint8_t n532; uint8_t n548; uint8_t n598; uint8_t n648; uint8_t n664; uint8_t n682; uint8_t n683; uint8_t n749; uint8_t n764; uint8_t n782; uint8_t n798; uint8_t n814; uint8_t n898; uint8_t n914; uint8_t n915; uint8_t n932; uint8_t n933; uint8_t n948; uint8_t n949; uint8_t n1014; uint8_t n1032; uint8_t n1048; uint8_t n1064; uint8_t n1065; uint8_t n1082; uint8_t n1148; uint8_t n1149; uint8_t n1164; uint8_t n1165; uint8_t n1182; uint8_t n1183; uint8_t n1198; uint8_t n1199; uint8_t n1214; uint8_t n1215; uint8_t n1264; uint8_t n1282; uint8_t n1298; uint8_t n1314; uint8_t n1321; uint8_t n1332; uint8_t n1348; uint8_t n1399; uint8_t n1414; uint8_t n1415; uint8_t n1432; uint8_t n1433; uint8_t n1448; uint8_t n1449; uint8_t n1464; uint8_t n1465; uint8_t n1482; uint8_t n1483; uint8_t n1532; uint8_t n1548; uint8_t n1564; uint8_t n1582; uint8_t n1598; uint8_t n1614; uint8_t n1632; uint8_t n1664; uint8_t n1665; uint8_t n1682; uint8_t n1683; uint8_t n1698; uint8_t n1699; uint8_t n1714; uint8_t n1715; uint8_t n1732; uint8_t n1733; uint8_t n1748; uint8_t n1749; uint8_t n1764; uint8_t n1782; uint8_t n1798; uint8_t n1814; uint8_t n1832; uint8_t n1848; uint8_t n1864; uint8_t n1882; uint8_t n1898; uint8_t n1899; uint8_t n1914; uint8_t n1915; uint8_t n1932; uint8_t n1933; uint8_t n1948; uint8_t n1949; uint8_t n1964; uint8_t n1965; uint8_t n1982; uint8_t n1983; uint8_t n1998; uint8_t n1999; uint8_t n2014; uint8_t n2015; n32 = n28 & n12; n33 = n28 & n12; n34 = ~(n33 & n16 & n24); n38 = ~(n6 | n34 | n26); n39 = ~(n6 | n34 | n26); n45 = n10 | n30; n49 = ~(n18 & n12); n55 = ~n49; n62 = ~n55; n63 = ~n55; n72 = n2 & n38; n73 = n2 & n38; n83 = n10 & n38; n89 = ~(n73 & n63); n99 = ~n63; n116 = ~(n45 & n62 & n55); n117 = ~(n45 & n62 & n55); n123 = ~(n117 | n28); n235 = n99; n282 = (n14 & n18) | (~n14 & n39); n398 = n99 & n116; n399 = n99 & n116; n414 = n123 ^ n282; n415 = n123 & n282; n449 = ~n89; n514 = n10 & n20; n532 = n12 & n20; n548 = n14 & n20; n598 = n399 & n72; n648 = n398 | n514; n664 = n414 | n532; n682 = n415 ^ n548; n683 = n415 & n548; n749 = n449 & n22; n764 = n8 & n22; n782 = n10 & n22; n798 = n12 & n22; n814 = n14 & n22; n898 = n648 | n764; n914 = n664 ^ n782; n915 = n664 & n782; n932 = (n682 ^ n798) ^ n915; n933 = (n682 & n798) | (n798 & n915) | (n682 & n915); n948 = (n683 ^ n814) ^ n933; n949 = (n683 & n814) | (n814 & n933) | (n683 & n933); n1014 = n6 & n24; n1032 = n8 & n24; n1048 = n10 & n24; n1064 = n12 & n24; n1065 = n12 & n24; n1082 = n14 & n24; n1148 = n898 ^ n1014; n1149 = n898 & n1014; n1164 = (n914 ^ n1032) ^ n1149; n1165 = (n914 & n1032) | (n1032 & n1149) | (n914 & n1149); n1182 = (n932 ^ n1048) ^ n1165; n1183 = (n932 & n1048) | (n1048 & n1165) | (n932 & n1165); n1198 = (n948 ^ n1064) ^ n1183; n1199 = (n948 & n1064) | (n1064 & n1183) | (n948 & n1183); n1214 = (n949 ^ n1082) ^ n1199; n1215 = (n949 & n1082) | (n1082 & n1199) | (n949 & n1199); n1264 = n4 & n26; n1282 = n6 & n26; n1298 = n8 & n26; n1314 = n10 & n26; n1321 = n449; n1332 = n12 & n26; n1348 = n14 & n26; n1399 = n1148 | n1264; n1414 = (n1164 ^ n1282) ^ n1399; n1415 = (n1164 & n1282) | (n1282 & n1399) | (n1164 & n1399); n1432 = (n1182 ^ n1298) ^ n1415; n1433 = (n1182 & n1298) | (n1298 & n1415) | (n1182 & n1415); n1448 = (n1198 ^ n1314) ^ n1433; n1449 = (n1198 & n1314) | (n1314 & n1433) | (n1198 & n1433); n1464 = (n1214 ^ n1332) ^ n1449; n1465 = (n1214 & n1332) | (n1332 & n1449) | (n1214 & n1449); n1482 = (n1215 ^ n1348) ^ n1465; n1483 = (n1215 & n1348) | (n1348 & n1465) | (n1215 & n1465); n1532 = n4 & n28; n1548 = n6 & n28; n1564 = n8 & n28; n1582 = n10 & n28; n1598 = n12 & n28; n1614 = n14 & n28; n1632 = n1065; n1664 = n1414 ^ n1532; n1665 = n1414 & n1532; n1682 = (n1432 ^ n1548) ^ n1665; n1683 = (n1432 & n1548) | (n1548 & n1665) | (n1432 & n1665); n1698 = (n1448 ^ n1564) ^ n1683; n1699 = (n1448 & n1564) | (n1564 & n1683) | (n1448 & n1683); n1714 = (n1464 ^ n1582) ^ n1699; n1715 = (n1464 & n1582) | (n1582 & n1699) | (n1464 & n1699); n1732 = (n1482 ^ n1598) ^ n1715; n1733 = (n1482 & n1598) | (n1598 & n1715) | (n1482 & n1715); n1748 = (n1483 ^ n1614) ^ n1733; n1749 = (n1483 & n1614) | (n1614 & n1733) | (n1483 & n1733); n1764 = n0 & n30; n1782 = n2 & n30; n1798 = n4 & n30; n1814 = n6 & n30; n1832 = n8 & n30; n1848 = n10 & n30; n1864 = n12 & n30; n1882 = n14 & n30; n1898 = n235 ^ n1764; n1899 = n235 & n1764; n1914 = (n1664 ^ n1782) ^ n1899; n1915 = (n1664 & n1782) | (n1782 & n1899) | (n1664 & n1899); n1932 = (n1682 ^ n1798) ^ n1915; n1933 = (n1682 & n1798) | (n1798 & n1915) | (n1682 & n1915); n1948 = (n1698 ^ n1814) ^ n1933; n1949 = (n1698 & n1814) | (n1814 & n1933) | (n1698 & n1933); n1964 = (n1714 ^ n1832) ^ n1949; n1965 = (n1714 & n1832) | (n1832 & n1949) | (n1714 & n1949); n1982 = (n1732 ^ n1848) ^ n1965; n1983 = (n1732 & n1848) | (n1848 & n1965) | (n1732 & n1965); n1998 = (n1748 ^ n1864) ^ n1983; n1999 = (n1748 & n1864) | (n1864 & n1983) | (n1748 & n1983); n2014 = (n1749 ^ n1882) ^ n1999; n2015 = (n1749 & n1882) | (n1882 & n1999) | (n1749 & n1999); c |= (n1321 & 0x1) << 0; c |= (n598 & 0x1) << 1; c |= (n83 & 0x1) << 2; c |= (n32 & 0x1) << 3; c |= (n749 & 0x1) << 4; c |= (n1882 & 0x1) << 5; c |= (n1632 & 0x1) << 6; c |= (n1898 & 0x1) << 7; c |= (n1914 & 0x1) << 8; c |= (n1932 & 0x1) << 9; c |= (n1948 & 0x1) << 10; c |= (n1964 & 0x1) << 11; c |= (n1982 & 0x1) << 12; c |= (n1998 & 0x1) << 13; c |= (n2014 & 0x1) << 14; c |= (n2015 & 0x1) << 15; return c; }
the_stack_data/111078525.c
#include <stdio.h> int main() { int base, height; float area; printf("\nEnter the base of Right Angle Triangle : "); scanf("%d", &base); printf("\nEnter the height of Right Angle Triangle : "); scanf("%d", &height); area = 0.5 * (float) base * (float) height; printf("\nArea of Right Angle Triangle : %f", area); return (0); }
the_stack_data/20451056.c
// |----------------------------| // |---- 1. Import Packages ----| // |----------------------------| #include <stdio.h> #include <string.h> #include <stdlib.h> // |-----------------------------| // |----- 2. Model Entities -----| // |-----------------------------| // 2a - Product Entity struct Product{ char* name; double price; }; // 2b - ProductStock Entity struct ProductStock{ struct Product product; int quantity; }; // 2c - Customer Entity struct Customer{ char* name; double budget; struct ProductStock shoppingList[10]; int index; }; // 2d - Shop Entity struct Shop{ double cash; struct ProductStock stock[20]; int index; }; // |-----------------------------| // |----- 3. Define Methods -----| // |-----------------------------| // 3a. Create the Shop entity from shop.csv file // - Contains opening cash balance // - Contains stocked products // - Contains price for each product // - Contains stock level for each product struct Shop createAndStockShop() { FILE * fp; char * line = NULL; size_t len = 0; ssize_t read; // open stock.csv file to read values fp = fopen("stock.csv", "r"); if (fp == NULL ){ exit(EXIT_FAILURE); } // parse first line of stock.csv, to import opening cash value getline(&line, &len, fp); double cashInShop = atof(line); struct Shop shop = {cashInShop}; // parse remaining line items in stock.csv file // store in Shop struct as Productstock items // - Description (Product) // - Cost (Product) // - Stock (ProductStock) while ((read = getline(&line, &len, fp)) != -1){ char *n = strtok(line, ","); char *p = strtok(NULL, ","); char *q = strtok(NULL, ","); int quantity = atoi(q); double price = atof(p); char *name = malloc(sizeof(char) * 50); strcpy(name, n); struct Product product = {name, price}; struct ProductStock stockItem = {product, quantity}; shop.stock[shop.index++] = stockItem; } fclose(fp); return shop; } // 3b. Generate Menu Options for User to choose from int menuOptions(){ /* Offer Customer 2 options: - read in shopping list - search for and purchase single item - suggest giving customer a default budget of €20 */ int choice; printf("\nPlease Choose and Option:"); printf("\nProcess an Order (Enter 1)"); printf("\nPurchase a Single Item (Enter 2)\n"); printf("\nExit (Enter 0)\n"); scanf("%d", &choice); return choice; } // 3c. Create a Customer entity from customer.csv file struct Customer createCustomer(){ FILE * fp; char * line = NULL; size_t len = 0; ssize_t read; struct Customer custEntity = {}; // open iostream for customer.csv file fp = fopen("customer.csv", "r"); if (fp == NULL ){ exit(EXIT_FAILURE); } // parse first line of customer.csv, to import customer's name getline(&line, &len, fp); char* custName = line; custEntity.name = custName; // parse second line of customer.csv, to import customer's budget getline(&line, &len, fp); double custBudget = atof(line); custEntity.budget = custBudget; // parse remaining line items in customer.csv file while ((read = getline(&line, &len, fp)) != -1){ char *i = strtok(line, ","); char *q = strtok(NULL, ","); // store in Customer struct as shoppingList items // - Description // - Amount Required char *item = malloc(sizeof(char) * 50); strcpy(item, i); int quantity = atoi(q); //create ProductStock struct to hold each item for purchase struct ProductStock buyItem = {item, 0.0, quantity}; // add each purchase item to Customers shoppingList array custEntity.shoppingList[custEntity.index++] = buyItem; } fclose(fp); return custEntity; } // 3a - Print Product Details void printProduct(struct Product p) { printf("----------------------\n"); printf("PRODUCT NAME: %s \nPRODUCT PRICE: %.2f\n", p.name, p.price); printf("----------------------\n"); } // 3b - Print Customer Details void printCustomer(struct Customer c) { printf("\nCUSTOMER NAME: %s \nCUSTOMER BUDGET: %.2f\n", c.name, c.budget); printf("----------------------\n"); for (int i = 0; i < c.index; i++){ printProduct(c.shoppingList[i].product); printf("%s HAS ORDERED %d OF THE ABOVE PRODUCT.\n", c.name, c.shoppingList[i].quantity); double cost = c.shoppingList[i].quantity * c.shoppingList[i].product.price; printf("The cost to %s will be €%.2f\n\n", c.name, cost); } } void printShop(struct Shop s){ printf("Shop has %.2f in cash\n", s.cash); for (int i = 0; i < s.index; i++){ printProduct(s.stock[i].product); printf("Shop has %d of the above.\n", s.stock[i].quantity); } } char findProductName(struct Shop s, char *n) { int exists = 0; while (exists == 0){ for (int i = 0; i < s.index; i++) { char *name = s.stock[i].product.name; if (strcmp(name, n) == 0){ exists = 1; return exists; } } } return exists; } double findProductPrice(struct Shop s, char *n) { int exists = 0; while (exists == 0){ for (int i = 0; i < s.index; i++) { struct Product product = s.stock[i].product; char *name = product.name; if (strcmp(name, n) == 0) { return product.price; } } } return exists; } int findProductQty(struct Shop s, char *n) { for (int i = 0; i < s.index; i++) { struct Product product = s.stock[i].product; char *name = product.name; if (strcmp(name, n) == 0) { return product.price; } } return -1; } int checkStockAmount(char *n, int q, struct Shop s){ int stockCheck = -1; for(int j = 0; j < s.index; j++){ char *name = s.stock[j].product.name; if (strcmp(name, n) == 0){ if (q >= s.stock[j].quantity){ stockCheck = 1; return stockCheck; } else{ stockCheck = 0; return stockCheck; } } } return stockCheck; } void updateShop (struct Shop shop) { // complete purchase and write stock and cash updates to stock.csv FILE *fp = fopen ("stock.csv", "w"); if (fp != NULL) { fprintf(fp, "%.2f\n", shop.cash); for (int i = 0; i <shop.index; i++){ fprintf(fp, "%s, %.2f, %d\n", shop.stock[i].product.name, shop.stock[i].product.price, shop.stock[i].quantity); } fclose(fp); } } void orderSuccess(struct Shop s, struct Customer c, double tot){ printf("\n----------\nThank you, your budget of €%.2f is sufficient to cover your order cost of €%.2f.", c.budget, tot); printf("\nThank you for your custom today.\nHave a lovely day and see you again soon :-)"); // commit stock and cash changes to shop.csv updateShop(s); } void orderFail(struct Customer c, double tot){ printf("\n----------\nI'm sorry, unfortunately your budget of €%.2f in not sufficient to cover your total order cost of €%.2f.\nPlease reduce your shopping list and come back later.", c.budget, tot); // do not commit stock and cash changes to shop.csv // continue to exit without saving } void processOrder(struct Shop shop, struct Customer cust){ double orderTotal = 0; // - for each line item, check that product exists in Shop stock // - for each line item, check that product stock in shop is sufficient int shopStock; for (int i = 0; i < cust.index; i++){ char *name = cust.shoppingList[i].product.name; int qty = cust.shoppingList[i].quantity; double itemPrice = 0; double lineTotal = 0; shopStock = checkStockAmount(name, qty, shop); if (shopStock == -1){ printf("\n----------\nSorry, we do not stock %s here.", name); } else if (shopStock == 0){ printf("\n----------\nYes, we have enough of %s in stock for your order.", name); // - for each in-stock line item calculate total cost and store in array itemPrice = findProductPrice(shop, name); lineTotal = qty*itemPrice; printf("\nCost of %d %s at €%.2f each is €%.2f", qty, name, itemPrice, lineTotal); // - calculate total purchase cost and confirm customer budget is sufficient to cover orderTotal += lineTotal; // - reduce customer budget by orderTotal amount cust.budget -= lineTotal; // increase shop cash by totalOrder amount shop.cash += lineTotal; // deduct purchased items from shop stock shop.stock[i].quantity -= qty; } else if (shopStock == 1){ printf("\n----------\nSorry, we don't have enough of %s in stock at the moment.", name); } } if (cust.budget >= orderTotal){ orderSuccess(shop, cust, orderTotal); } else{ orderFail(cust, orderTotal); } } void reduceStock(struct Shop s, char *n, int q){ for (int i = 0; i <s.index; i++){ if (strcmp(n, s.stock[i].product.name) == 0){ s.stock[i].quantity -= q; break; } } updateShop(s); } void processGuestOrder(struct Shop shop, struct Customer cust){ double orderTotal = 0; // - for each line item, check that product exists in Shop stock // - for each line item, check that product stock in shop is sufficient int shopStock; char *name = cust.shoppingList[0].product.name; int qty = cust.shoppingList[0].quantity; double itemPrice = 0; double lineTotal = 0; shopStock = checkStockAmount(name, qty, shop); if (shopStock == -1){ printf("\n----------\nSorry, we do not stock %s here.", name); } else if (shopStock == 0){ printf("\n----------\nYes, we have enough of %s in stock for your order.", name); // - for each in-stock line item calculate total cost and store in array itemPrice = findProductPrice(shop, name); lineTotal = qty*itemPrice; printf("\nCost of %d %s at €%.2f each is €%.2f", qty, name, itemPrice, lineTotal); // - reduce customer budget by orderTotal amount cust.budget -= lineTotal; // increase shop cash by totalOrder amount shop.cash += lineTotal; // deduct purchased items from shop stock reduceStock(shop, name, qty); } else if (shopStock == 1){ printf("\n----------\nSorry, we don't have enough of %s in stock at the moment.", name); } if (cust.budget >= lineTotal){ orderSuccess(shop, cust, lineTotal); } else{ orderFail(cust, lineTotal); } } int main(void) { // 1. Create and stock the Shop struct Shop shop = createAndStockShop(); // 2. Offer User Options: int choice = menuOptions(); // 3. Actions based on User Choice if (choice == 0){ exit; } else if (choice == 1){ /* 2. Create Customer from file - read in Customer's budget - read in each item in Customers order - Description - Quantity */ struct Customer cust = createCustomer(); processOrder(shop, cust); } else if (choice == 2){ // Set budget to €20, since user does not have an account struct Customer cust = {"Guest Shopper", 20.0}; char *liveItem = malloc(30); int qty; cust.index = 0; printf("\nPlease type the product you wish to purchase (type 'X' to finish): "); // scanf("%s", liveItem); char temp; scanf("%c", &temp); scanf("%[^\n]s", liveItem); if (strcmp(liveItem, "X") != 0){ printf("\nHow many of %s would you like? ", liveItem); scanf("%d", &qty); cust.shoppingList[cust.index].product.name = liveItem; cust.shoppingList[cust.index].quantity = qty; printf("\n----------\nItem: %s\nQuantity: %d", cust.shoppingList[cust.index].product.name, cust.shoppingList[cust.index].quantity); processGuestOrder(shop, cust); } } else { printf("\nYou have entered an invalid menu option. Please try again.\n"); } printf("\n"); return 0; }
the_stack_data/1017739.c
#include<stdio.h> void bubble_sort(long long int a[]) { long long int temp; int i, j, r, k = 0, l = 0; for(r = 19; r > 0; r--) { for(i = 0; i < r; i++) { if(a[i] > a[i + 1]) //swapping the elements of array if not in increasing order { temp = a[i]; a[i] = a[i + 1]; a[i + 1] = temp; k++; //k is for counting the no. of comparisons l++; //l is for counting the no. of swaps } else k++; } } //printing the elements of sorted array for(j = 0; j < 20; j++) printf("%lld ", a[j]); printf("\n"); printf("%d %d\n", l, k); } int main() { long long int b[20], final; int k, l; for(k = 0; k < 20; k++) scanf("%lld,", &b[k]); bubble_sort(b); return 0; }
the_stack_data/175142729.c
/* MIT License Copyright (c) 2019 Bart Bilos 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> #pragma GCC optimize ("no-tree-loop-distribute-patterns") size_t strlen (const char * str) { size_t len = 0; while(str[len]) { ++len; } return len; }
the_stack_data/8621.c
#include<stdio.h> #include<string.h> struct student{ int rollno; char name[20]; int percentmarks; struct student *pNext; }; struct student addinfo(int rollnu, char *name, int pmarks); main() { int i; struct student stuinfo[4]; struct student *pTemp = NULL; int rollnu; char name[20]; int marks; for(i = 0; i < 4; i++) { printf("Enter student roll number\n"); scanf("%d",&rollnu); printf("Enter student name\n"); scanf("%s",name); printf("Enter student percentage of Marks\n"); scanf("%d",&marks); stuinfo[i] = addinfo(rollnu,name,marks); } stuinfo[0].pNext = &stuinfo[1]; stuinfo[1].pNext = &stuinfo[2]; stuinfo[2].pNext = &stuinfo[3]; stuinfo[3].pNext = NULL; pTemp = stuinfo; printf("\n"); while(pTemp != NULL) { printf("Roll number: %d\n", pTemp->rollno); printf("Name : %s\n",pTemp->name); printf("Marks: %d\n",pTemp->percentmarks); pTemp = pTemp->pNext; } } struct student addinfo(int rollnu, char *name, int pmarks) { struct student tempst; tempst.rollno = rollnu; strcpy(tempst.name,name); tempst.percentmarks = pmarks; return tempst; }
the_stack_data/50726.c
#include<stdio.h> int main() { int n; scanf("%d",&n); while (n) { printf("%d",n%10); n/=10; } printf("\n"); return 0; }
the_stack_data/77060.c
#include<stdio.h> #include<math.h> int strassen(int *A,int *B,int *c,int m,int n) { int p1,p2,p3,p4,p5,p6,p7; if(m==2) { p1=(*A+*(A+n+1))*(*B+*(B+n+1)); p2=(*(A+n)+*(A+n+1))*(*B); p3=(*A)*(*(B+1)-*(B+n+1)); p4=(*(A+n+1))*(-*B+*(B+n)); p5=(*A+*(A+1))*(*(B+n+1)); p6=(-*A+*(A+n))*(*B+*(B+1)); p7=(*(A+1)-(*(A+n+1)))*(*(B+n)+*(B+n+1)); *c=*c+p1+p4-p5+p7; *(c+1)=*(c+1)+p3+p5; *(c+n)=*(c+n)+p2+p4; *(c+n+1)=*(c+n+1)+p1-p2+p3+p6; } else { m=m/2; strassen(A,B,c,m,n); strassen(A+m,B+m*n,c,m,n); strassen(A,B+m,c+m,m,n); strassen(A+m,B+m*(n+1),c+m,m,n); strassen(A+m*n,B,c+m*n,m,n); strassen(A+m*(n+1),B+m*n,c+m*n,m,n); strassen(A+m*n,B+m,c+m*(n+1),m,n); strassen(A+m*(n+1),B+m*(n+1),c+m*(n+1),m,n); } return 0; } int main() { int m; printf("enter the dimension of square matrix you want to multiply\n"); scanf("%d",&m); int a[m][m]; for(int i=0;i<m;i++) { printf("enter the elements of the row %d of matrix 1\n",i+1); for(int j=0;j<m;j++) { scanf("%d",&a[i][j]); } } int b[m][m]; for(int i=0;i<m;i++) { printf("\nenter the elements of the row %d of matrix 2: \n",i+1); for(int j=0;j<m;j++) { scanf("%d",&b[i][j]); } } int C[m][m]; for(int i=0;i<m;i++) { for(int j=0;j<m;j++) { C[i][j]=0; } } printf("\nthe resultant matrix is:\n"); strassen(a,b,C,m,m); for(int i=0;i<m;i++) { for(int j=0;j<m;j++) { printf("%d\t",C[i][j]); } printf("\n"); } return 0; }
the_stack_data/212643849.c
#include <fcntl.h> #include <unistd.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <stdio.h> #include <sys/ioctl.h> #include <stdbool.h> #include <string.h> #define MAGIC_NUMB 'N' #define IOCTL_NEW_DATA_BUF_SZ _IOW(MAGIC_NUMB, 2, unsigned long) #define IOCTL_CH_MODE _IOW(MAGIC_NUMB, 3, bool) #define LOW true #define HIGH false int main(int argc, char const *argv[]) { int fd = open("/dev/capitall", O_RDWR | O_EXCL); write(fd, argv[1], strlen(argv[1])); ioctl(fd, IOCTL_CH_MODE, HIGH); write(fd, argv[1], strlen(argv[1])); char *output = malloc(100); read(fd, output, 100); printf(" %s\n", output); ioctl(fd, IOCTL_CH_MODE, LOW); write(fd, output, strlen(output)); read(fd, output, 100); printf(" %s\n", output); close(fd); return 0; }
the_stack_data/1207923.c
#include <stdlib.h> struct fptr { int (*p_fptr)(int, int); }; struct fsptr { struct fptr * sptr; }; struct wfsptr { struct fsptr * wfptr; }; int plus(int a, int b) { return a+b; } int minus(int a, int b) { return a-b; } struct fptr * foo(int a, int b, struct wfsptr * a_fptr, struct wfsptr * b_fptr) { if(a>0 && b<0) { struct fsptr * temp=a_fptr->wfptr; a_fptr->wfptr->sptr = b_fptr->wfptr->sptr; b_fptr->wfptr->sptr =temp->sptr; return a_fptr->wfptr->sptr; } return b_fptr->wfptr->sptr; } struct fptr * clever(int a, int b, struct fsptr * a_fptr, struct fsptr * b_fptr ) { struct wfsptr t1_fptr; t1_fptr.wfptr=a_fptr; struct wfsptr t2_fptr; t2_fptr.wfptr=b_fptr; return foo(a,b,&t1_fptr,&t2_fptr); } int moo(char x, int op1, int op2) { struct fptr a_fptr ; a_fptr.p_fptr=plus; struct fptr s_fptr ; s_fptr.p_fptr=minus; struct fsptr m_fptr; m_fptr.sptr=&a_fptr; struct fsptr n_fptr; n_fptr.sptr=&s_fptr; struct fptr* (*goo_ptr)(int, int, struct fsptr *,struct fsptr *); struct fptr* t_fptr = 0; t_fptr = clever(op1, op2, &m_fptr, &n_fptr); t_fptr->p_fptr(op1, op2); n_fptr.sptr->p_fptr(op1,op2); return 0; } // 38 : foo // 56 : clever // 57 : minus // 58 : minus
the_stack_data/7949999.c
/* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ /* { dg-options "-O3 -mzarch" } */ __attribute__((hotpatch(0))) int main (void) {/* { dg-error "wrong number of arguments specified" } */ return 0; }
the_stack_data/656614.c
/** @file Serial_Port_Windows.c * @see Serial_Port.h for description. * @author Adrien RICCIARDI */ #ifdef WIN32 // This file will compile on Windows only #include <Serial_Port.h> #include <stdio.h> #include <windows.h> //------------------------------------------------------------------------------------------------- // Public functions //------------------------------------------------------------------------------------------------- int SerialPortOpen(char *String_Device_File_Name, unsigned int Baud_Rate, TSerialPortParity Parity, TSerialPortID *Pointer_Serial_Port_ID) { HANDLE COM_Handle; DCB COM_Parameters; COMMTIMEOUTS Timing_Parameters; char String_Full_Device_Name[128]; // Access to the raw COM device sprintf(String_Full_Device_Name, "\\\\.\\%s", String_Device_File_Name); // Open the serial port and set all access rights COM_Handle = CreateFile(String_Full_Device_Name, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); if (COM_Handle == INVALID_HANDLE_VALUE) return -1; // Error : can't access to the serial port // Configure port COM_Parameters.DCBlength = sizeof(DCB); COM_Parameters.fBinary = 1; // Must be set to 1 or Windows becomes angry // Ignore modem signals COM_Parameters.fOutxCtsFlow = 0; COM_Parameters.fOutxDsrFlow = 0; COM_Parameters.fDtrControl = DTR_CONTROL_DISABLE; COM_Parameters.fDsrSensitivity = 0; COM_Parameters.fTXContinueOnXoff = 0; COM_Parameters.fOutX = 0; COM_Parameters.fInX = 0; COM_Parameters.fErrorChar = 0; COM_Parameters.fNull = 0; COM_Parameters.fRtsControl = RTS_CONTROL_DISABLE; COM_Parameters.fAbortOnError = 0; COM_Parameters.fDummy2 = 0; COM_Parameters.wReserved = 0; COM_Parameters.XonLim = 0; COM_Parameters.XoffLim = 0; COM_Parameters.ByteSize = 8; // 8 bits of data COM_Parameters.StopBits = ONESTOPBIT; COM_Parameters.XonChar = 0; COM_Parameters.XoffChar = 0; COM_Parameters.ErrorChar = 0; COM_Parameters.EofChar = 0; COM_Parameters.EvtChar = 0; COM_Parameters.wReserved1 = 0; // Set requested parity switch (Parity) { case SERIAL_PORT_PARITY_NONE: COM_Parameters.fParity = 0; // Disable parity checking COM_Parameters.Parity = NOPARITY; break; case SERIAL_PORT_PARITY_EVEN: COM_Parameters.fParity = 1; // Enable parity checking COM_Parameters.Parity = EVENPARITY; break; case SERIAL_PORT_PARITY_ODD: COM_Parameters.fParity = 1; // Enable parity checking COM_Parameters.Parity = ODDPARITY; break; default: CloseHandle(COM_Handle); return -1; } // Set transmit and receive speed COM_Parameters.BaudRate = Baud_Rate; // Set new parameters SetCommState(COM_Handle, &COM_Parameters); // Make reads non blocking Timing_Parameters.ReadIntervalTimeout = MAXDWORD; // According to MSDN, make the ReadFile() function returns immediately Timing_Parameters.ReadTotalTimeoutMultiplier = 0; Timing_Parameters.ReadTotalTimeoutConstant = 0; Timing_Parameters.WriteTotalTimeoutMultiplier = 0; Timing_Parameters.WriteTotalTimeoutConstant = 0; SetCommTimeouts(COM_Handle, &Timing_Parameters); // No error *Pointer_Serial_Port_ID = COM_Handle; return 0; } unsigned char SerialPortReadByte(TSerialPortID Serial_Port_ID) { unsigned char Byte; DWORD Number_Bytes_Read; do { ReadFile(Serial_Port_ID, &Byte, 1, &Number_Bytes_Read, NULL); } while (Number_Bytes_Read == 0); return Byte; } void SerialPortReadBuffer(TSerialPortID Serial_Port_ID, void *Pointer_Buffer, unsigned int Bytes_Count) { unsigned char Byte, *Pointer_Buffer_Byte = Pointer_Buffer; DWORD Number_Bytes_Read; while (Bytes_Count > 0) { // Try to get a byte ReadFile(Serial_Port_ID, &Byte, 1, &Number_Bytes_Read, NULL); if (Number_Bytes_Read > 0) { *Pointer_Buffer_Byte = Byte; Pointer_Buffer_Byte++; Bytes_Count--; } } } void SerialPortWriteByte(TSerialPortID Serial_Port_ID, unsigned char Byte) { DWORD Number_Bytes_Written; WriteFile(Serial_Port_ID, &Byte, 1, &Number_Bytes_Written, NULL); } void SerialPortWriteBuffer(TSerialPortID Serial_Port_ID, void *Pointer_Buffer, unsigned int Bytes_Count) { DWORD Number_Bytes_Written; WriteFile(Serial_Port_ID, Pointer_Buffer, Bytes_Count, &Number_Bytes_Written, NULL); } int SerialPortIsByteAvailable(TSerialPortID Serial_Port_ID, unsigned char *Pointer_Available_Byte) { DWORD Number_Bytes_Read; ReadFile(Serial_Port_ID, Pointer_Available_Byte, 1, &Number_Bytes_Read, NULL); if (Number_Bytes_Read == 0) return 0; return 1; } void SerialPortClose(TSerialPortID Serial_Port_ID) { CloseHandle(Serial_Port_ID); } #endif