// File: /workspace/github_c_makefile_star2_O2/DVaronos[P]AnLogProject1/main.c
// Function: main
int main( int argc, char *argv[] ){

    double t1, t2,time,ticspersec;
    struct tms tb1, tb2;

    ticspersec = (double) sysconf(_SC_CLK_TCK);
    t1 = (double) times(&tb1);

   JobSheduler* Sheduler= JSInit(32);
   DIR* directory;
   DIR* indirectory;
   struct dirent* new_directory;
   struct dirent* curfile;
   FILE *dataw;
   FILE *scsv;
   FILE *dcsv;
   FILE *testing;
   FILE* validation;
   char* wfile;
   char* dd;
   char* token=NULL;
   char line[300];
   int inputexist=0,dexist=0;
   char c;

   for(int i=1 ; i<argc ; i++){//Elegxos gia to an iparxei arxio eisodou
     if(strcmp(argv[i],"-w")==0){//Efoson iparxi inputfile apothikefsi tou onomatos tou
       wfile=malloc(sizeof(char)*(strlen(argv[i+1])+1));
       strcpy(wfile,argv[i+1]);
       inputexist=1;
     }else if(strcmp(argv[i],"-d")==0){//Efoson iparxi inputfile apothikefsi tou onomatos tou
       dd=malloc(sizeof(char)*(strlen(argv[i+1])+1));
       strcpy(dd,argv[i+1]);
       dexist=1;
     }
   }

   if(inputexist){//Elegxos gia an iparxi input file
     if((dataw=fopen(wfile,"r"))==NULL){//ean den iparxei to arxeio pou dothike san input file vgenei error kai termatizei h efarmogh
       printf("ERROR:There no such wfile\n");
       free(dataw);
       return 0;
     }
   }else{//Ean den iparxei kan kapoio inputfile vgeneierror kai termatizei h efarmogh
     printf("ERROR:There is no inputfile\n");
     return 0;
   }

   if(dexist){//Elegxos gia an iparxi input file
     if((directory=opendir(dd))==NULL){//ean den iparxei to arxeio pou dothike san input file vgenei error kai termatizei h efarmogh
       printf("ERROR:There no such directory\n");
       free(dd);
       free(wfile);
       fclose(dataw);
       return 0;
     }
   }else{//Ean den iparxei kan kapoio inputfile vgeneierror kai termatizei h efarmogh
     printf("ERROR:There is no input directory\n");
     free(wfile);
     fclose(dataw);
     return 0;
   }

   char* newfile;
   char* newdir;
   char* newid;
   char word[15];
   Hash* H=HashCreate(1000);  //Domh hash gia apotikefsh tou dataset x
   LHash* LEK=LHashCreate(1000);  //Domh LHash gia to leksilogio
   LHash* Common=LHashCreate(200);  //Domh LHash gia tis koines lekeis
   char* temp=strdup("start");
   int charcount=0;
   FILE *com;
   WHash* S;

   if( (com=fopen("common.txt","r"))==NULL){//Anigma tou common.tx pou periexei tis koines leksis
     perror("Fopen");
     return 0;
   }

   while((c = fgetc(com))!= EOF){//Apothikevo tis common leksis se ena Lhash
 		if(c ==',' || c== '\n'){

       word[charcount]='\0';

       free(temp);
       temp=malloc(sizeof(char)*(strlen(word)+1));
       strcpy(temp,word);
       Common=LHashInsert(Common,temp);

 			charcount=0;
     }else{
 			word[charcount]=c;
       charcount++;
 		}
 	}

  fclose(com);

   while( (new_directory=readdir(directory)) ){ //Diavazw to periexomeno tou fakelou pou dothike(diladi tous ipofakelous)

        if(strcmp(new_directory->d_name,".") && strcmp(new_directory->d_name,"..")){ //Ean den einai o eaftos rou h o proigoumenos

            newdir=malloc(sizeof(char)*( strlen(dd)+strlen(new_directory->d_name) +2)); //To newdir einai to path tou neou ipofakelou
            strcpy(newdir,dd);
            strcat(newdir,"/");
            strcat(newdir,new_directory->d_name);

            if( (indirectory=opendir(newdir))==NULL){
                perror("ERORR\n");
                return 0;
            }else{
                while( (curfile=readdir(indirectory)) ){ //Divazo to periexomenotou ypofakelou(Diladi ta json files pou einai messa se afton ton fakelo)

                    if(strcmp(curfile->d_name,".") && strcmp(curfile->d_name,"..")){  //Ean den einai o eaftos rou h o proigoumenos

                      newid=malloc(sizeof(char)*( strlen(curfile->d_name)+strlen(new_directory->d_name) +3)); //To newid tha exei to id ths cameras pou antistixei se afto to json file
                      strcpy(newid,new_directory->d_name);
                      strcat(newid,"//");
                      strcat(newid,curfile->d_name);
                      newid[strlen(newid)-5]='\0'; //Den theloume thn katalhksh ".json"

                      newfile=malloc(sizeof(char)*( strlen(curfile->d_name)+strlen(new_directory->d_name)+strlen(dd) +3)); //To newfile tha exei to path tou sigekrimenou json arxeiou
                      strcpy(newfile,dd);
                      strcat(newfile,"/");
                      strcat(newfile,new_directory->d_name);
                      strcat(newfile,"/");
                      strcat(newfile,curfile->d_name);

                      H=HashInsert(H,newid); //Apothikevo to id ths cameras sthn domh
                      LEK=Readjson(newfile,LEK,Common,&S); //Diavazo to json file kai apothikevo ta dedomena sto leksilogio kai se ena WHash
                      //jcount++;
                      H=HashReplaceSpear(H,newid,S);  //Eisago to whash sthn atnisthxh thesh sthn domh
                      free(newfile);
                      free(newid);

                    }
                }
                closedir(indirectory); // klinw ton ipofakelo
            }
            free(newdir);
        }
    }
   printf("The storage of datasetX  just finished\n");

   LHashTfIdf(LEK,H->count); //Ipologizo to IDF twn leksewn tou leksilogiou
   LEK=NMostLHash(LEK,1000);  //Pairnw tis 1000 pio simantikes leksi
   H=HashVectorts(H,LEK); //Dimiourgw gia kathe kamera ena vector simfona me to leksilogio
   FreeLHash(Common); //Apodesmevw to leksilogio kai to Common hash giati pleon den ta xriazome
   FreeLHash(LEK);
   printf("The creation of vectors just finished\n");
   char* first;
   char* second;
   int match=0,tcount,z=0,a=0;

   while (fgets(line,sizeof(line),dataw)){//Diavazei to csv file grami grami
     token=strtok(line,",");
     token=strtok(NULL,",");
     token=strtok(NULL,",");
     match=atoi(token);
     if(match){
       a++; //arithmos twn thetikwn sisxetisewn
     }else{
       z++; //arithmos twn arnitikwn sisxetisewn
     }
	 }
   fclose(dataw);
   int sa,ta,sz,tz,trz=0,tra=0,tez=0,tea=0;

   sa=a*0.6;  //to 60% twn thetikwn sisxetisewn tou dataw
   ta=(a-sa)/2; ////to 20% twn thetikwn sisxetisewn tou dataw
   sz=z*0.6; //to 60% twn arnitikwn sisxetisewn tou dataw
   tz=(z-sz)/2; //to 20% twn arnitikwn sisxetisewn tou dataw
   if((dataw=fopen(wfile,"r"))==NULL){//ean den iparxei to arxeio pou dothike san input file vgenei error kai termatizei h efarmogh
     printf("ERROR:There no such wfile\n");
     free(dataw);
     return 0;
   }

   if( (testing=fopen("Testing.csv","w"))==NULL){
     perror("Fopen");
     return 0;
   }
   if( (validation=fopen("Validation.csv","w"))==NULL){
     perror("Fopen");
     return 0;
   }
	 while (fgets(line,sizeof(line),dataw)){//Diavazei to csv file grami grami
     token=strtok(line,",");
     if(!strcmp(token,"left_spec_id"))  continue;
     tcount=0;
     while(token!=NULL){//apothikefsi tou kathe stixoiou ths gramhs se metavlites
      tcount++;
      switch(tcount){
        case 1://ean tcount==1 tote to token isoute me to proto proion
          first=malloc(sizeof(char)*(strlen(token)+1));
          strcpy(first,token);
          break;
        case 2://ean tcount==2 tote to token isoute me to deftero proion
          second=malloc(sizeof(char)*(strlen(token)+1));
          strcpy(second,token);
          break;
        case 3://Ean tcount==3 tote to token einai 0 h 1 analoga to an teriazoun ta proionta
          match=atoi(token);
          break;
      }
      token=strtok(NULL,",");
    }

    if(match){ //Ean einai thetikh sisxetish
      if(tra<sa){ //Ean den exw isagei to 60% twn thetikwn sisxetisewn sto trainig set
        HashConect(H,first,second,match);
        tra++;
      }else if(tea<ta){ //Ean den exw isagei to 20% twn thetikwn sisxetisewn sto testing set
        fprintf(testing,"%s,%s,%d\n",first,second,match );
        tea++;
      }else{ //To ipolipo 20% twn thetikwn sisxetisewn paei sto validation set
        fprintf(validation,"%s,%s,%d\n",first,second,match );
      }
    }else{  //Ean einai arnitilh sisxetish
      if(trz<sz){  //Ean den exw isagei to 60% twn arnitikwn sisxetisewn sto trainig set
        HashConect(H,first,second,match);
        trz++;
      }else if(tez<tz){ //Ean den exw isagei to 20% twn arnitikwn sisxetisewn sto testing set
        fprintf(testing,"%s,%s,%d\n",first,second,match );
        tez++;
      }else{  //To ipolipo 20% twn arnitikwn sisxetisewn paei sto validation set
        fprintf(validation,"%s,%s,%d\n",first,second,match );
      }
    }
    free(first);
    free(second);
	}
  fclose(dataw);
  fclose(testing);
  fclose(validation);
  printf("The reading of the datasetW just finished\n");

  scsv=fopen("Same.csv","w+"); //Dimiourgw ena neo csv arxio
  fprintf(scsv,"left_spec_id, right_spec_id\n");

  dcsv=fopen("Diffrend.csv","w+"); //Dimiourgw ena neo csv arxio
  fprintf(dcsv,"left_spec_id, right_spec_id\n");

  HashTransfer(H,scsv); //Pernaw ta teriasmata sto csv arxio
  HashDiff(H,dcsv);

  fclose(scsv);
  fclose(dcsv);
  printf("The creation of the Same.csv and Diffrend.csv files just finished\n");
  Input* input=InputMake("Same.csv","Diffrend.csv", H);
  Model* model;
  model=RepetitiveTaining(input,H,Sheduler);
  printf("The training of the model just finished\n");

  Testing("Testing.csv",model,H);


  //apodesmefsh twn domwn
  FreeInput(input);
  JSDestroy(Sheduler);
  FreeHash(H);
  free(temp);
  FreeModel(model);
  free(wfile);
  free(dd);
  closedir(directory);
  remove("Testing.csv");
  remove("Validation.csv");

  t2 = (double) times(&tb2);
  time=((t2 - t1) / ticspersec);  //O xrronos pou perase gia na vrethei o arithmos
  printf("Time was %f secs\n",time);


}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %rsi, %r15
movl %edi, %r14d
pushq $0x2
popq %rdi
callq 0x1230
movq %rax, -0x48(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x11f0
movq %rax, -0x58(%rbp)
pushq $0x20
popq %rdi
callq 0x4d42
movq %rax, -0xb0(%rbp)
movslq %r14d, %r13
movl $0x0, -0x38(%rbp)
pushq $0x1
popq %rbx
xorl %r12d, %r12d
cmpq %r13, %rbx
jge 0x1485
movq (%r15,%rbx,8), %rax
cmpb $0x2d, (%rax)
jne 0x147d
cmpb $0x77, 0x1(%rax)
jne 0x141b
cmpb $0x0, 0x2(%rax)
je 0x1454
cmpb $0x64, 0x1(%rax)
jne 0x147d
cmpb $0x0, 0x2(%rax)
jne 0x147d
movq 0x8(%r15,%rbx,8), %r14
movq %r14, %rdi
callq 0x10c0
leaq 0x1(%rax), %rdi
callq 0x11a0
movq %rax, -0x60(%rbp)
movq %rax, %rdi
movq %r14, %rsi
callq 0x1060
pushq $0x1
popq %rax
movl %eax, -0x38(%rbp)
jmp 0x147d
movq 0x8(%r15,%rbx,8), %r14
movq %r14, %rdi
callq 0x10c0
leaq 0x1(%rax), %rdi
callq 0x11a0
movq %rax, -0x78(%rbp)
movq %rax, %rdi
movq %r14, %rsi
callq 0x1060
pushq $0x1
popq %r12
incq %rbx
jmp 0x1401
testl %r12d, %r12d
je 0x15b9
leaq 0x4b7b(%rip), %rsi      # 0x6010
movq -0x78(%rbp), %rbx
movq %rbx, %rdi
callq 0x1200
movq %rax, -0x30(%rbp)
testq %rax, %rax
je 0x1b59
cmpl $0x0, -0x38(%rbp)
je 0x15c5
movq -0x60(%rbp), %r13
movq %r13, %rdi
callq 0x10b0
testq %rax, %rax
je 0x1b6a
movq %rax, %r15
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x3d21
movq %rax, -0x38(%rbp)
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x44d5
movq %rax, %rbx
movl $0xc8, %edi
callq 0x44d5
movq %rax, -0x40(%rbp)
leaq 0x4b12(%rip), %rdi      # 0x6012
callq 0x1270
movq %rax, %r12
leaq 0x4b09(%rip), %rdi      # 0x6018
leaq 0x4afa(%rip), %rsi      # 0x6010
callq 0x1200
testq %rax, %rax
je 0x1d3e
movq %rax, %r14
movq %rbx, -0x50(%rbp)
movq %r15, -0x90(%rbp)
cvtsi2sdq -0x48(%rbp), %xmm0
movsd %xmm0, -0xa8(%rbp)
cvtsi2sdq -0x58(%rbp), %xmm0
movsd %xmm0, -0xa0(%rbp)
leaq -0xc7(%rbp), %rbx
movq %rbx, %r15
movq %r14, %rdi
callq 0x10f0
cmpb $0xa, %al
je 0x157c
movzbl %al, %ecx
cmpl $0xff, %ecx
je 0x15d6
cmpl $0x2c, %ecx
je 0x157c
movb %al, (%r15)
incq %r15
jmp 0x1558
movb $0x0, (%r15)
movq %r12, %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x10c0
leaq 0x1(%rax), %rdi
callq 0x11a0
movq %rax, %r12
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1060
movq -0x40(%rbp), %rdi
movq %r12, %rsi
callq 0x451d
movq %rax, -0x40(%rbp)
jmp 0x1555
leaq 0x4aef(%rip), %rdi      # 0x60af
jmp 0x1b60
leaq 0x4aff(%rip), %rdi      # 0x60cb
callq 0x1080
jmp 0x1b7e
movq %r12, -0x98(%rbp)
movq %r14, %rdi
callq 0x10a0
movq -0x90(%rbp), %rbx
movq %rbx, %rdi
callq 0x1180
testq %rax, %rax
je 0x17f6
movq %rax, %r12
cmpb $0x2e, 0x13(%rax)
jne 0x161e
cmpb $0x0, 0x14(%r12)
je 0x15ec
cmpb $0x2e, 0x14(%r12)
jne 0x161e
cmpb $0x0, 0x15(%r12)
je 0x15ec
addq $0x13, %r12
movq %r13, %rdi
callq 0x10c0
movq %rax, %rbx
movq %r12, %rdi
callq 0x10c0
leaq (%rbx,%rax), %rdi
addq $0x2, %rdi
callq 0x11a0
movq %rax, %rbx
movq %rax, %rdi
movq %r13, %rsi
callq 0x1060
movq %rbx, %rdi
callq 0x10c0
movw $0x2f, (%rbx,%rax)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1250
movq %rbx, %rdi
callq 0x10b0
testq %rax, %rax
je 0x1d4c
movq %rax, %r15
movq %rbx, -0x58(%rbp)
movq %r15, %rdi
callq 0x1180
testq %rax, %rax
je 0x17dc
movq %rax, %r14
cmpb $0x2e, 0x13(%rax)
jne 0x16b0
cmpb $0x0, 0x14(%r14)
je 0x1681
cmpb $0x2e, 0x14(%r14)
jne 0x16b0
cmpb $0x0, 0x15(%r14)
je 0x1681
addq $0x13, %r14
movq %r14, %rdi
callq 0x10c0
movq %rax, %rbx
movq %r12, %rdi
callq 0x10c0
leaq (%rbx,%rax), %rdi
addq $0x3, %rdi
callq 0x11a0
movq %rax, %r13
movq %rax, %rdi
movq %r12, %rsi
callq 0x1060
movq %r13, %rdi
callq 0x10c0
xorl %ebx, %ebx
movb %bl, 0x2(%r13,%rax)
movw $0x2f2f, (%r13,%rax)    # imm = 0x2F2F
movq %r13, %rdi
movq %r14, %rsi
callq 0x1250
movq %r13, %rdi
callq 0x10c0
movb %bl, -0x5(%r13,%rax)
movq %r14, %rdi
callq 0x10c0
movq %rax, -0x48(%rbp)
movq %r12, %rdi
callq 0x10c0
movq %rax, %rbx
movq -0x60(%rbp), %rdi
callq 0x10c0
addq -0x48(%rbp), %rbx
leaq (%rax,%rbx), %rdi
addq $0x3, %rdi
callq 0x11a0
movq %rax, %rbx
movq %rax, %rdi
movq -0x60(%rbp), %rsi
callq 0x1060
movq %rbx, %rdi
callq 0x10c0
movw $0x2f, %cx
movw %cx, (%rbx,%rax)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1250
movq %rbx, %rdi
callq 0x10c0
movw $0x2f, %cx
movw %cx, (%rbx,%rax)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1250
movq -0x38(%rbp), %rdi
movq %r13, %rsi
callq 0x3dcd
movq %rax, %r14
movq %rbx, %rdi
movq -0x50(%rbp), %rsi
movq -0x40(%rbp), %rdx
leaq -0xb8(%rbp), %rcx
callq 0x4b53
movq %rax, -0x50(%rbp)
movq -0xb8(%rbp), %rdx
movq %r14, %rdi
movq %r13, %rsi
callq 0x3f81
movq %rax, -0x38(%rbp)
movq %rbx, %rdi
callq 0x1030
movq %r13, %rdi
callq 0x1030
jmp 0x1681
movq %r15, %rdi
callq 0x1100
movq -0x58(%rbp), %rdi
callq 0x1030
movq -0x60(%rbp), %r13
jmp 0x15e5
leaq 0x48f0(%rip), %rdi      # 0x60ed
callq 0x1080
movq -0x38(%rbp), %r14
cvtsi2sdl 0x4(%r14), %xmm0
movq -0x50(%rbp), %rbx
movq %rbx, %rdi
callq 0x47c9
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x48bc
movq %rax, %rbx
movq %r14, %rdi
movq %rax, %rsi
callq 0x4334
movq %rax, -0x50(%rbp)
movq -0x40(%rbp), %rdi
callq 0x4720
movq %rbx, %rdi
callq 0x4720
leaq 0x48c5(%rip), %rdi      # 0x6114
callq 0x1080
xorl %r15d, %r15d
leaq -0x240(%rbp), %r12
leaq 0x4a83(%rip), %r13      # 0x62e8
xorl %ebx, %ebx
xorl %r14d, %r14d
movq %r12, %rdi
movl $0x12c, %esi            # imm = 0x12C
movq -0x30(%rbp), %rdx
callq 0x1110
testq %rax, %rax
je 0x18be
movq %r12, %rdi
movq %r13, %rsi
callq 0x1220
xorl %edi, %edi
movq %r13, %rsi
callq 0x1220
xorl %edi, %edi
movq %r13, %rsi
callq 0x1220
movq %rax, %rdi
callq 0x1240
movl %eax, %r15d
xorl %eax, %eax
xorl %ecx, %ecx
testl %r15d, %r15d
setne %al
sete %cl
addl %ecx, %ebx
addl %eax, %r14d
jmp 0x186a
movq -0x30(%rbp), %rdi
callq 0x10a0
cvtsi2sd %r14d, %xmm0
movsd 0x4734(%rip), %xmm1     # 0x6008
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %r12d
subl %r12d, %r14d
movl %r14d, %eax
cltd
pushq $0x2
popq %rcx
idivl %ecx
movl %eax, -0x80(%rbp)
cvtsi2sd %ebx, %xmm0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x84(%rbp)
subl %eax, %ebx
movl %ebx, %eax
cltd
idivl %ecx
movl %eax, %ebx
leaq 0x4702(%rip), %rsi      # 0x6010
movq -0x78(%rbp), %rdi
callq 0x1200
testq %rax, %rax
je 0x1b59
movq %rax, %r13
leaq 0x4709(%rip), %rdi      # 0x6033
leaq 0x470e(%rip), %rsi      # 0x603f
callq 0x1200
movq %rax, -0x40(%rbp)
testq %rax, %rax
je 0x1d3e
leaq 0x46f7(%rip), %rdi      # 0x6041
leaq 0x46ee(%rip), %rsi      # 0x603f
callq 0x1200
movq %rax, -0x48(%rbp)
testq %rax, %rax
je 0x1d3e
movl %r12d, -0x7c(%rbp)
leaq -0x240(%rbp), %r12
movl $0x0, -0x6c(%rbp)
movl $0x0, -0x64(%rbp)
movl $0x0, -0x70(%rbp)
movl $0x0, -0x68(%rbp)
movq %r12, %rdi
movl $0x12c, %esi            # imm = 0x12C
movq %r13, %rdx
callq 0x1110
testq %rax, %rax
je 0x1b94
movq %r12, %rdi
leaq 0x493b(%rip), %rsi      # 0x62e8
callq 0x1220
movq %rax, %r14
movq %rax, %rdi
leaq 0x4691(%rip), %rsi      # 0x6050
callq 0x1140
testl %eax, %eax
je 0x198a
movl %ebx, -0x58(%rbp)
xorl %ebx, %ebx
testq %r14, %r14
je 0x1a39
cmpl $0x2, %ebx
je 0x1a19
cmpl $0x1, %ebx
je 0x19f7
testl %ebx, %ebx
jne 0x1a24
movq %r14, %rdi
callq 0x10c0
leaq 0x1(%rax), %rdi
callq 0x11a0
movq %rax, -0x38(%rbp)
jmp 0x1a0c
movq %r14, %rdi
callq 0x10c0
leaq 0x1(%rax), %rdi
callq 0x11a0
movq %rax, -0x30(%rbp)
movq %rax, %rdi
movq %r14, %rsi
callq 0x1060
jmp 0x1a24
movq %r14, %rdi
callq 0x1240
movl %eax, %r15d
xorl %edi, %edi
leaq 0x48bb(%rip), %rsi      # 0x62e8
callq 0x1220
movq %rax, %r14
incl %ebx
jmp 0x19cd
testl %r15d, %r15d
movl -0x70(%rbp), %eax
je 0x1a70
cmpl -0x7c(%rbp), %eax
movl -0x6c(%rbp), %r14d
jge 0x1a9f
movq -0x50(%rbp), %rdi
movq -0x38(%rbp), %rbx
movq %rbx, %rsi
movq -0x30(%rbp), %rdx
movl %r15d, %ecx
movl %eax, %r14d
callq 0x4048
incl %r14d
movl %r14d, -0x70(%rbp)
jmp 0x1afe
movl -0x68(%rbp), %r14d
cmpl -0x84(%rbp), %r14d
movl -0x58(%rbp), %eax
jge 0x1ace
movq -0x50(%rbp), %rdi
movq -0x38(%rbp), %rbx
movq %rbx, %rsi
movq -0x30(%rbp), %rdx
xorl %ecx, %ecx
callq 0x4048
incl %r14d
movl %r14d, -0x68(%rbp)
jmp 0x1afe
cmpl -0x80(%rbp), %r14d
jge 0x1b04
movq -0x40(%rbp), %rdi
leaq 0x45ad(%rip), %rsi      # 0x605d
movq -0x38(%rbp), %rbx
movq %rbx, %rdx
movq -0x30(%rbp), %rcx
movl %r15d, %r8d
xorl %eax, %eax
callq 0x1160
incl %r14d
movl %r14d, -0x6c(%rbp)
jmp 0x1afe
movl -0x64(%rbp), %r14d
cmpl %eax, %r14d
movq -0x38(%rbp), %rbx
jge 0x1b22
movq -0x40(%rbp), %rdi
leaq 0x4577(%rip), %rsi      # 0x605d
movq %rbx, %rdx
movq -0x30(%rbp), %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x1160
incl %r14d
movl %r14d, -0x64(%rbp)
movq -0x30(%rbp), %r14
jmp 0x1b41
movq -0x48(%rbp), %rdi
leaq 0x454e(%rip), %rsi      # 0x605d
movq -0x38(%rbp), %rbx
movq %rbx, %rdx
movq -0x30(%rbp), %r14
movq %r14, %rcx
movl %r15d, %r8d
jmp 0x1b3a
movq -0x48(%rbp), %rdi
leaq 0x4530(%rip), %rsi      # 0x605d
movq %rbx, %rdx
movq -0x30(%rbp), %r14
movq %r14, %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x1160
movq %rbx, %rdi
callq 0x1030
movq %r14, %rdi
callq 0x1030
movl -0x58(%rbp), %ebx
jmp 0x198a
leaq 0x468c(%rip), %rdi      # 0x61ec
callq 0x1080
jmp 0x1d2a
leaq 0x465d(%rip), %rdi      # 0x61ce
callq 0x1080
movq %r13, %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x1030
movq -0x30(%rbp), %rdi
callq 0x10a0
jmp 0x1d2a
movq %r13, %rdi
callq 0x10a0
movq -0x40(%rbp), %rdi
callq 0x10a0
movq -0x48(%rbp), %rdi
callq 0x10a0
leaq 0x4585(%rip), %rdi      # 0x613a
callq 0x1080
leaq 0x44a6(%rip), %rdi      # 0x6067
leaq 0x44a8(%rip), %r12      # 0x6070
movq %r12, %rsi
callq 0x1200
movq %rax, %r15
leaq 0x4499(%rip), %r13      # 0x6073
pushq $0x1c
popq %rbx
pushq $0x1
popq %r14
movq %r13, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq %rax, %rcx
callq 0x1260
leaq 0x4497(%rip), %rdi      # 0x6090
movq %r12, %rsi
callq 0x1200
movq %rax, %r12
movq %r13, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq %rax, %rcx
callq 0x1260
movq -0x50(%rbp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x4196
movq %r13, %rdi
movq %r12, %rsi
callq 0x41f1
movq %r15, %rdi
callq 0x10a0
movq %r12, %rdi
callq 0x10a0
leaq 0x451e(%rip), %rdi      # 0x6164
callq 0x1080
leaq 0x4415(%rip), %rdi      # 0x6067
leaq 0x4437(%rip), %rsi      # 0x6090
movq %r13, %rdx
callq 0x1ff3
movq %rax, %r15
movq %rax, %rdi
movq %r13, %rsi
movq -0xb0(%rbp), %r12
movq %r12, %rdx
callq 0x2db1
movq %rax, %r14
leaq 0x4523(%rip), %rdi      # 0x61a6
callq 0x1080
leaq 0x43a4(%rip), %rbx      # 0x6033
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x25ae
movq %r15, %rdi
callq 0x1fb2
movq %r12, %rdi
callq 0x4f90
movq %r13, %rdi
callq 0x3d79
movq -0x98(%rbp), %rdi
callq 0x1030
movq %r14, %rdi
callq 0x1d8b
movq -0x78(%rbp), %rdi
callq 0x1030
movq -0x60(%rbp), %rdi
callq 0x1030
movq -0x90(%rbp), %rdi
callq 0x1100
movq %rbx, %rdi
callq 0x1050
leaq 0x434b(%rip), %rdi      # 0x6041
callq 0x1050
leaq -0xe8(%rbp), %rdi
callq 0x11f0
cvtsi2sd %rax, %xmm0
subsd -0xa0(%rbp), %xmm0
divsd -0xa8(%rbp), %xmm0
leaq 0x437a(%rip), %rdi      # 0x609d
movb $0x1, %al
callq 0x10d0
xorl %eax, %eax
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x42de(%rip), %rdi      # 0x6023
callq 0x1210
jmp 0x1d2a
leaq 0x42d6(%rip), %rdi      # 0x6029
jmp 0x1d45
nopl (%rax)