// File: /workspace/github_c_makefile_star2_O1/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, %r12d
movl $0x2, %edi
callq 0x1230
movq %rax, %r13
leaq -0x110(%rbp), %rdi
callq 0x11f0
movq %rax, -0x38(%rbp)
movl $0x20, %edi
callq 0x549d
movq %rax, -0xb8(%rbp)
cmpl $0x2, %r12d
jl 0x14c8
movq %r13, -0x58(%rbp)
movl %r12d, %r14d
movl $0x0, -0x48(%rbp)
movl $0x1, %r13d
leaq 0x4bf7(%rip), %r12      # 0x6010
movl $0x0, -0x30(%rbp)
movq (%r15,%r13,8), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1140
testl %eax, %eax
je 0x1474
movq %rbx, %rdi
leaq 0x4bd6(%rip), %rsi      # 0x6013
callq 0x1140
testl %eax, %eax
jne 0x14a0
movq 0x8(%r15,%r13,8), %rbx
movq %rbx, %rdi
callq 0x10c0
leaq 0x1(%rax), %rdi
callq 0x11a0
movq %rax, -0x68(%rbp)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1060
movl $0x1, -0x30(%rbp)
jmp 0x14a0
movq 0x8(%r15,%r13,8), %rbx
movq %rbx, %rdi
callq 0x10c0
leaq 0x1(%rax), %rdi
callq 0x11a0
movq %rax, -0x80(%rbp)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1060
movl $0x1, -0x48(%rbp)
incq %r13
cmpq %r13, %r14
jne 0x1420
cmpl $0x0, -0x48(%rbp)
sete %al
cmpl $0x0, -0x30(%rbp)
sete %bl
movq -0x80(%rbp), %r14
movq -0x68(%rbp), %r12
movq -0x58(%rbp), %r13
jmp 0x14cc
movb $0x1, %bl
movb $0x1, %al
testb %al, %al
je 0x14dc
leaq 0x4bdf(%rip), %rdi      # 0x60b6
jmp 0x1c8a
leaq 0x4b33(%rip), %rsi      # 0x6016
movq %r14, %rdi
callq 0x1200
testq %rax, %rax
je 0x1c83
movq %rax, -0x40(%rbp)
testb %bl, %bl
je 0x150d
leaq 0x4bcf(%rip), %rdi      # 0x60d2
callq 0x1080
jmp 0x1989
movq %r12, %rdi
callq 0x10b0
movq %rax, -0x90(%rbp)
testq %rax, %rax
je 0x1975
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x4255
movq %rax, -0x58(%rbp)
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x4a9d
movq %rax, -0x30(%rbp)
movl $0xc8, %edi
callq 0x4a9d
movq %rax, -0x50(%rbp)
leaq 0x4ac2(%rip), %rdi      # 0x6018
callq 0x1270
movq %rax, %rbx
leaq 0x4ab9(%rip), %rdi      # 0x601e
leaq 0x4aaa(%rip), %rsi      # 0x6016
callq 0x1200
testq %rax, %rax
je 0x1e3d
movq %rax, %r15
movq %rbx, -0x88(%rbp)
movq %r14, -0x80(%rbp)
cvtsi2sd %r13, %xmm0
movsd %xmm0, -0xb0(%rbp)
xorps %xmm0, %xmm0
cvtsi2sdq -0x38(%rbp), %xmm0
movsd %xmm0, -0xa8(%rbp)
leaq -0xcf(%rbp), %rbx
movq %rbx, %r14
movq %r15, %rdi
callq 0x1100
cmpb $0xa, %al
je 0x15d4
movzbl %al, %ecx
cmpl $0xff, %ecx
je 0x161c
cmpl $0x2c, %ecx
je 0x15d4
movb %al, (%r14)
incq %r14
jmp 0x15b0
movb $0x0, (%r14)
movq -0x88(%rbp), %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x10c0
leaq 0x1(%rax), %rdi
callq 0x11a0
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1060
movq -0x50(%rbp), %rdi
movq %r14, -0x88(%rbp)
movq %r14, %rsi
callq 0x4b03
movq %rax, -0x50(%rbp)
jmp 0x15ad
movq %r15, %rdi
callq 0x10a0
movq -0x90(%rbp), %rdi
callq 0x1180
testq %rax, %rax
movq %r12, -0x68(%rbp)
je 0x188d
leaq 0x49ec(%rip), %r14      # 0x6030
addq $0x13, %rax
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
callq 0x1140
testl %eax, %eax
je 0x1878
movq %r15, %rdi
leaq 0x49c7(%rip), %rsi      # 0x602f
callq 0x1140
testl %eax, %eax
je 0x1878
movq %r12, %rdi
callq 0x10c0
movq %rax, %rbx
movq %r15, %rdi
callq 0x10c0
leaq (%rbx,%rax), %rdi
addq $0x2, %rdi
callq 0x11a0
movq %rax, %rbx
movq %rax, %rdi
movq %r12, %rsi
callq 0x1060
movq %rbx, %rdi
callq 0x10c0
movw $0x2f, (%rbx,%rax)
movq %rbx, %rdi
movq %r15, -0x48(%rbp)
movq %r15, %rsi
callq 0x1250
movq %rbx, -0x60(%rbp)
movq %rbx, %rdi
callq 0x10b0
testq %rax, %rax
je 0x1e4e
movq %rax, %rbx
movq %rax, %rdi
callq 0x1180
movq %rax, %r12
testq %rax, %rax
movq %rbx, -0x38(%rbp)
je 0x1863
addq $0x13, %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x1140
testl %eax, %eax
je 0x184f
movq %r12, %rdi
leaq 0x491e(%rip), %rsi      # 0x602f
callq 0x1140
testl %eax, %eax
je 0x184f
movq %r12, %rdi
callq 0x10c0
movq %rax, %r15
movq -0x48(%rbp), %r14
movq %r14, %rdi
callq 0x10c0
leaq (%r15,%rax), %rdi
addq $0x3, %rdi
callq 0x11a0
movq %rax, %r13
movq %rax, %rdi
movq %r14, %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 %r12, %rsi
callq 0x1250
movq %r13, %rdi
callq 0x10c0
movb %bl, -0x5(%r13,%rax)
movq %r12, %rdi
callq 0x10c0
movq %rax, %r15
movq %r14, %rdi
callq 0x10c0
movq %rax, %rbx
movq -0x68(%rbp), %r14
movq %r14, %rdi
callq 0x10c0
addq %r15, %rbx
leaq (%rax,%rbx), %rdi
addq $0x3, %rdi
callq 0x11a0
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
leaq 0x486f(%rip), %r14      # 0x6030
callq 0x1060
movq %r15, %rdi
callq 0x10c0
movw $0x2f, %bx
movw %bx, (%r15,%rax)
movq %r15, %rdi
movq -0x48(%rbp), %rsi
callq 0x1250
movq %r15, %rdi
callq 0x10c0
movw %bx, (%r15,%rax)
movq %r15, %rdi
movq %r12, %rsi
callq 0x1250
movq -0x58(%rbp), %rdi
movq %r13, %rsi
callq 0x4306
movq %rax, %rbx
movq %r15, %rdi
movq -0x30(%rbp), %rsi
movq -0x50(%rbp), %rdx
leaq -0xc0(%rbp), %rcx
callq 0x5271
movq %rax, -0x30(%rbp)
movq -0xc0(%rbp), %rdx
movq %rbx, %rdi
movq -0x38(%rbp), %rbx
movq %r13, %rsi
callq 0x44d9
movq %rax, -0x58(%rbp)
movq %r15, %rdi
callq 0x1030
movq %r13, %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x1180
movq %rax, %r12
testq %rax, %rax
jne 0x16f0
movq %rbx, %rdi
callq 0x1110
movq -0x60(%rbp), %rdi
callq 0x1030
movq -0x68(%rbp), %r12
movq -0x90(%rbp), %rdi
callq 0x1180
testq %rax, %rax
jne 0x1644
leaq 0x4860(%rip), %rdi      # 0x60f4
callq 0x1080
movq -0x58(%rbp), %r14
xorps %xmm0, %xmm0
cvtsi2sdl 0x4(%r14), %xmm0
movq -0x30(%rbp), %rbx
movq %rbx, %rdi
callq 0x4e30
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x4f5b
movq %rax, %rbx
movq %r14, %rdi
movq %rax, %rsi
callq 0x48ce
movq %rax, -0x60(%rbp)
movq -0x50(%rbp), %rdi
callq 0x4d7f
movq %rbx, %rdi
callq 0x4d7f
leaq 0x4832(%rip), %rdi      # 0x611b
callq 0x1080
leaq -0x240(%rbp), %rdi
movl $0x12c, %esi            # imm = 0x12C
movq -0x40(%rbp), %rdx
callq 0x1120
testq %rax, %rax
je 0x199f
xorl %r12d, %r12d
leaq 0x49e2(%rip), %rbx      # 0x62f8
xorl %r13d, %r13d
leaq -0x240(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1220
xorl %edi, %edi
movq %rbx, %rsi
callq 0x1220
xorl %edi, %edi
movq %rbx, %rsi
callq 0x1220
movq %rax, %rdi
callq 0x1240
movl %eax, %r14d
xorl %eax, %eax
xorl %ecx, %ecx
testl %r14d, %r14d
setne %al
sete %cl
addl %ecx, %r13d
addl %eax, %r12d
movq %r15, %rdi
movl $0x12c, %esi            # imm = 0x12C
movq -0x40(%rbp), %rdx
callq 0x1120
testq %rax, %rax
jne 0x1919
jmp 0x19a8
leaq 0x4859(%rip), %rdi      # 0x61d5
callq 0x1080
movq %r12, %rdi
callq 0x1030
movq %r14, %rdi
callq 0x1030
movq -0x40(%rbp), %rdi
callq 0x10a0
jmp 0x1c8f
xorl %r14d, %r14d
xorl %r13d, %r13d
xorl %r12d, %r12d
movq -0x40(%rbp), %rdi
callq 0x10a0
leaq 0x465e(%rip), %rsi      # 0x6016
movq -0x80(%rbp), %rdi
callq 0x1200
testq %rax, %rax
je 0x1c83
movq %rax, %rbx
leaq 0x4668(%rip), %rdi      # 0x603c
leaq 0x4636(%rip), %rsi      # 0x6011
callq 0x1200
movq %rax, -0x50(%rbp)
testq %rax, %rax
je 0x1e3d
leaq 0x4654(%rip), %rdi      # 0x6048
leaq 0x4616(%rip), %rsi      # 0x6011
callq 0x1200
movq %rax, -0x40(%rbp)
testq %rax, %rax
je 0x1e3d
movl %r14d, -0x58(%rbp)
xorps %xmm0, %xmm0
cvtsi2sd %r12d, %xmm0
movsd 0x45e7(%rip), %xmm1     # 0x6008
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0xa0(%rbp)
subl %eax, %r12d
movl %r12d, %eax
shrl $0x1f, %eax
addl %r12d, %eax
sarl %eax
movl %eax, -0x98(%rbp)
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x9c(%rbp)
subl %eax, %r13d
movl %r13d, %eax
shrl $0x1f, %eax
addl %r13d, %eax
sarl %eax
movl %eax, -0x94(%rbp)
leaq -0x240(%rbp), %r13
leaq 0x487d(%rip), %r12      # 0x62f8
leaq 0x45d5(%rip), %r14      # 0x6057
movl $0x0, -0x74(%rbp)
movl $0x0, -0x6c(%rbp)
movl $0x0, -0x48(%rbp)
movl $0x0, -0x70(%rbp)
movq %r13, %rdi
movl $0x12c, %esi            # imm = 0x12C
movq %rbx, %rdx
callq 0x1120
testq %rax, %rax
je 0x1ca3
movq %r13, %rdi
movq %r12, %rsi
callq 0x1220
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
callq 0x1140
testl %eax, %eax
je 0x1a9e
movq %r12, %r14
testq %r15, %r15
je 0x1b4e
xorl %r12d, %r12d
cmpl $0x2, %r12d
je 0x1b29
cmpl $0x1, %r12d
je 0x1b07
testl %r12d, %r12d
jne 0x1b34
movq %r15, %rdi
callq 0x10c0
leaq 0x1(%rax), %rdi
callq 0x11a0
movq %rax, -0x30(%rbp)
jmp 0x1b1c
movq %r15, %rdi
callq 0x10c0
leaq 0x1(%rax), %rdi
callq 0x11a0
movq %rax, -0x38(%rbp)
movq %rax, %rdi
movq %r15, %rsi
callq 0x1060
jmp 0x1b34
movq %r15, %rdi
callq 0x1240
movl %eax, -0x58(%rbp)
xorl %edi, %edi
movq %r14, %rsi
callq 0x1220
movq %rax, %r15
incl %r12d
testq %rax, %rax
movl -0x48(%rbp), %eax
jne 0x1adf
jmp 0x1b51
movl -0x48(%rbp), %eax
movl -0x58(%rbp), %r8d
testl %r8d, %r8d
je 0x1b8c
cmpl -0xa0(%rbp), %eax
movq %r14, %r12
movl -0x74(%rbp), %r15d
jge 0x1bc8
movq -0x60(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %r15
movq %r15, %rdx
movl %r8d, %ecx
movl %eax, %r14d
callq 0x45a7
incl %r14d
movl %r14d, -0x48(%rbp)
jmp 0x1bbc
movl -0x70(%rbp), %r15d
cmpl -0x9c(%rbp), %r15d
movq %r14, %r12
jge 0x1bfb
movq -0x60(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %r14
movq %r14, %rdx
xorl %ecx, %ecx
callq 0x45a7
incl %r15d
movl %r15d, -0x70(%rbp)
movq %r14, %r15
leaq 0x4494(%rip), %r14      # 0x6057
jmp 0x1c6d
cmpl -0x98(%rbp), %r15d
leaq 0x4481(%rip), %r14      # 0x6057
jge 0x1c39
movq -0x50(%rbp), %rdi
leaq 0x4481(%rip), %rsi      # 0x6064
movq -0x30(%rbp), %rdx
movq -0x38(%rbp), %rcx
xorl %eax, %eax
callq 0x1160
incl %r15d
movl %r15d, -0x74(%rbp)
jmp 0x1c33
movl -0x6c(%rbp), %r15d
cmpl -0x94(%rbp), %r15d
leaq 0x444a(%rip), %r14      # 0x6057
movq -0x30(%rbp), %rdx
jge 0x1c51
movq -0x50(%rbp), %rdi
leaq 0x4446(%rip), %rsi      # 0x6064
movq -0x38(%rbp), %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x1160
incl %r15d
movl %r15d, -0x6c(%rbp)
movq -0x38(%rbp), %r15
jmp 0x1c6d
movq -0x40(%rbp), %rdi
leaq 0x4420(%rip), %rsi      # 0x6064
movq -0x30(%rbp), %rdx
movq -0x38(%rbp), %r15
movq %r15, %rcx
jmp 0x1c66
movq -0x40(%rbp), %rdi
leaq 0x4408(%rip), %rsi      # 0x6064
movq -0x38(%rbp), %r15
movq %r15, %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x1160
movq -0x30(%rbp), %rdi
callq 0x1030
movq %r15, %rdi
callq 0x1030
jmp 0x1a9e
leaq 0x4569(%rip), %rdi      # 0x61f3
callq 0x1080
xorl %eax, %eax
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x10a0
movq -0x50(%rbp), %rdi
callq 0x10a0
movq -0x40(%rbp), %rdi
callq 0x10a0
leaq 0x447d(%rip), %rdi      # 0x6141
callq 0x1080
leaq 0x439e(%rip), %rbx      # 0x606e
leaq 0x43a0(%rip), %r12      # 0x6077
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1200
movq %rax, %r15
leaq 0x438e(%rip), %r13      # 0x607a
movl $0x1c, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rax, %rcx
callq 0x1260
leaq 0x438f(%rip), %r14      # 0x6097
movq %r14, %rdi
movq %r12, %rsi
callq 0x1200
movq %rax, %r12
movl $0x1c, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rax, %rcx
callq 0x1260
movq -0x60(%rbp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x471e
movq %r13, %rdi
movq %r12, %rsi
callq 0x477d
movq %r15, %rdi
callq 0x10a0
movq %r12, %rdi
callq 0x10a0
leaq 0x440f(%rip), %rdi      # 0x616b
callq 0x1080
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x2134
movq %rax, %r15
movq %rax, %rdi
movq %r13, %rsi
movq -0xb8(%rbp), %r12
movq %r12, %rdx
callq 0x2fd5
movq %rax, %r14
leaq 0x441c(%rip), %rdi      # 0x61ad
callq 0x1080
leaq 0x429f(%rip), %rbx      # 0x603c
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x275b
movq %r15, %rdi
callq 0x20ec
movq %r12, %rdi
callq 0x5714
movq %r13, %rdi
callq 0x42b0
movq -0x88(%rbp), %rdi
callq 0x1030
movq %r14, %rdi
callq 0x1e9a
movq -0x80(%rbp), %rdi
callq 0x1030
movq -0x68(%rbp), %rdi
callq 0x1030
movq -0x90(%rbp), %rdi
callq 0x1110
movq %rbx, %rdi
callq 0x1050
leaq 0x4244(%rip), %rdi      # 0x6048
callq 0x1050
leaq -0xf0(%rbp), %rdi
callq 0x11f0
cvtsi2sd %rax, %xmm0
subsd -0xa8(%rbp), %xmm0
divsd -0xb0(%rbp), %xmm0
leaq 0x4273(%rip), %rdi      # 0x60a4
movb $0x1, %al
callq 0x10d0
jmp 0x1c8f
leaq 0x41e5(%rip), %rdi      # 0x6029
callq 0x1210
jmp 0x1c8f
leaq 0x41dd(%rip), %rdi      # 0x6032
jmp 0x1e44
nop