// File: /workspace/github_c_makefile_star2_O3/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, %rbx
movl %edi, %r14d
movl $0x2, %edi
callq 0x1230
movq %rax, %r15
leaq -0x110(%rbp), %rdi
callq 0x11f0
movq %rax, %r12
movl $0x20, %edi
callq 0x54a2
movq %rax, -0xb8(%rbp)
cmpl $0x2, %r14d
jl 0x14ce
cvtsi2sd %r15, %xmm0
movsd %xmm0, -0xb0(%rbp)
xorps %xmm0, %xmm0
cvtsi2sd %r12, %xmm0
movsd %xmm0, -0xa8(%rbp)
movl %r14d, %r15d
negq %r15
xorl %r12d, %r12d
movb $0x1, %al
movl %eax, -0x40(%rbp)
movl $0x1, %r13d
incq %r13
movq -0x8(%rbx,%r13,8), %rax
cmpb $0x2d, (%rax)
jne 0x147d
cmpb $0x77, 0x1(%rax)
jne 0x1447
cmpb $0x0, 0x2(%rax)
je 0x148f
cmpb $0x64, 0x1(%rax)
jne 0x147d
cmpb $0x0, 0x2(%rax)
jne 0x147d
movq (%rbx,%r13,8), %r14
movq %r14, %rdi
callq 0x10c0
leaq 0x1(%rax), %rdi
callq 0x11a0
movq %rax, -0x80(%rbp)
movq %rax, %rdi
movq %r14, %rsi
callq 0x1060
movl $0x1, %r12d
leaq (%r15,%r13), %rax
incq %rax
incq %r13
cmpq $0x1, %rax
jne 0x1431
jmp 0x14c8
movq (%rbx,%r13,8), %r14
movq %r14, %rdi
callq 0x10c0
leaq 0x1(%rax), %rdi
callq 0x11a0
movq %rax, -0x58(%rbp)
movq %rax, %rdi
movq %r14, %rsi
callq 0x1060
movl $0x0, -0x40(%rbp)
movq %r15, %rax
addq %r13, %rax
jne 0x142e
jmp 0x14ee
testb $0x1, -0x40(%rbp)
je 0x14ee
leaq 0x4bda(%rip), %rdi      # 0x60af
callq 0x1080
xorl %eax, %eax
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4b1b(%rip), %rsi      # 0x6010
movq -0x58(%rbp), %rdi
callq 0x1200
testq %rax, %rax
je 0x1c66
movq %rax, %rbx
testl %r12d, %r12d
je 0x1608
movq %rbx, -0x48(%rbp)
movq -0x80(%rbp), %rbx
movq %rbx, %rdi
callq 0x10b0
movq %rax, -0x90(%rbp)
testq %rax, %rax
je 0x195c
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x4249
movq %rax, -0x38(%rbp)
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x4aa4
movq %rax, -0x40(%rbp)
movl $0xc8, %edi
callq 0x4aa4
movq %rax, -0x50(%rbp)
leaq 0x4aae(%rip), %rdi      # 0x6012
callq 0x1270
movq %rax, %r14
leaq 0x4aa5(%rip), %rdi      # 0x6018
leaq 0x4a96(%rip), %rsi      # 0x6010
callq 0x1200
testq %rax, %rax
je 0x1e0c
movq %rax, %rbx
movq %r14, -0x88(%rbp)
leaq -0xcf(%rbp), %r14
movq %r14, %r15
movq %rbx, %rdi
callq 0x10f0
cmpb $0xa, %al
je 0x15c0
movzbl %al, %ecx
cmpl $0xff, %ecx
je 0x1625
cmpl $0x2c, %ecx
je 0x15c0
movb %al, (%r15)
incq %r15
jmp 0x159c
movb $0x0, (%r15)
movq -0x88(%rbp), %rdi
callq 0x1030
movq %r14, %rdi
callq 0x10c0
leaq 0x1(%rax), %rdi
callq 0x11a0
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
callq 0x1060
movq -0x50(%rbp), %rdi
movq %r15, -0x88(%rbp)
movq %r15, %rsi
callq 0x4b0a
movq %rax, -0x50(%rbp)
jmp 0x1599
leaq 0x4abc(%rip), %rdi      # 0x60cb
callq 0x1080
movq -0x58(%rbp), %rdi
callq 0x1030
movq %rbx, %rdi
jmp 0x197d
movq %rbx, %rdi
callq 0x10a0
movq -0x90(%rbp), %rdi
callq 0x1180
testq %rax, %rax
je 0x1879
movq %rax, %r13
cmpb $0x2e, 0x13(%r13)
jne 0x1669
cmpb $0x0, 0x14(%r13)
je 0x1861
cmpb $0x2e, 0x14(%r13)
jne 0x1669
cmpb $0x0, 0x15(%r13)
je 0x1861
addq $0x13, %r13
movq -0x80(%rbp), %r14
movq %r14, %rdi
callq 0x10c0
movq %rax, %rbx
movq %r13, %rdi
callq 0x10c0
leaq (%rbx,%rax), %rdi
addq $0x2, %rdi
callq 0x11a0
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1060
movq %rbx, %rdi
callq 0x10c0
movw $0x2f, (%rbx,%rax)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x1250
movq %rbx, %rdi
callq 0x10b0
testq %rax, %rax
je 0x1e1d
movq %rax, %r14
movq %rbx, -0x60(%rbp)
movq %rax, %rdi
callq 0x1180
movq %rax, %r15
testq %rax, %rax
movq %r13, -0x78(%rbp)
movq %r14, -0x30(%rbp)
je 0x1850
cmpb $0x2e, 0x13(%r15)
jne 0x1710
cmpb $0x0, 0x14(%r15)
je 0x183c
cmpb $0x2e, 0x14(%r15)
jne 0x1710
cmpb $0x0, 0x15(%r15)
je 0x183c
addq $0x13, %r15
movq %r15, %rdi
callq 0x10c0
movq %rax, %r14
movq %r13, %rdi
callq 0x10c0
leaq (%r14,%rax), %rdi
addq $0x3, %rdi
callq 0x11a0
movq %rax, %r14
movq %rax, %rdi
movq %r13, %rsi
callq 0x1060
movq %r14, %rdi
callq 0x10c0
xorl %ebx, %ebx
movb %bl, 0x2(%r14,%rax)
movw $0x2f2f, (%r14,%rax)    # imm = 0x2F2F
movq %r14, %rdi
movq %r15, %rsi
callq 0x1250
movq %r14, %rdi
callq 0x10c0
movb %bl, -0x5(%r14,%rax)
movq %r15, %rdi
callq 0x10c0
movq %rax, %r12
movq %r13, %rdi
callq 0x10c0
movq %rax, %rbx
movq -0x80(%rbp), %r13
movq %r13, %rdi
callq 0x10c0
addq %r12, %rbx
leaq (%rax,%rbx), %rdi
addq $0x3, %rdi
callq 0x11a0
movq %rax, %r12
movq %rax, %rdi
movq %r13, %rsi
movq -0x78(%rbp), %r13
callq 0x1060
movq %r12, %rdi
callq 0x10c0
movw $0x2f, %bx
movw %bx, (%r12,%rax)
movq %r12, %rdi
movq %r13, %rsi
callq 0x1250
movq %r12, %rdi
callq 0x10c0
movw %bx, (%r12,%rax)
movq %r12, %rdi
movq %r15, %rsi
callq 0x1250
movq -0x38(%rbp), %rdi
movq %r14, %rsi
callq 0x42fa
movq %rax, %rbx
movq %r12, %rdi
movq -0x40(%rbp), %rsi
movq -0x50(%rbp), %rdx
leaq -0xc0(%rbp), %rcx
callq 0x527b
movq %rax, -0x40(%rbp)
movq -0xc0(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x44d6
movq %rax, -0x38(%rbp)
movq %r12, %rdi
callq 0x1030
movq %r14, %rdi
movq -0x30(%rbp), %r14
callq 0x1030
movq %r14, %rdi
callq 0x1180
movq %rax, %r15
testq %rax, %rax
jne 0x16ec
movq %r14, %rdi
callq 0x1100
movq -0x60(%rbp), %rdi
callq 0x1030
movq -0x90(%rbp), %rdi
callq 0x1180
movq %rax, %r13
testq %rax, %rax
jne 0x1645
leaq 0x486d(%rip), %rdi      # 0x60ed
callq 0x1080
movq -0x38(%rbp), %r14
cvtsi2sdl 0x4(%r14), %xmm0
movq -0x40(%rbp), %rbx
movq %rbx, %rdi
callq 0x4e3d
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x4f68
movq %rax, %rbx
movq %r14, %rdi
movq %rax, %rsi
callq 0x48cb
movq %rax, -0x60(%rbp)
movq -0x50(%rbp), %rdi
callq 0x4d89
movq %rbx, %rdi
callq 0x4d89
leaq 0x4842(%rip), %rdi      # 0x6114
callq 0x1080
leaq -0x240(%rbp), %rdi
movl $0x12c, %esi            # imm = 0x12C
movq -0x48(%rbp), %rdx
callq 0x1110
testq %rax, %rax
je 0x1987
xorl %r13d, %r13d
leaq 0x49e9(%rip), %r14      # 0x62e8
xorl %r12d, %r12d
leaq -0x240(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x1220
xorl %edi, %edi
movq %r14, %rsi
callq 0x1220
xorl %edi, %edi
movq %r14, %rsi
callq 0x1220
movq %rax, %rdi
callq 0x1240
movl %eax, %ebx
xorl %eax, %eax
xorl %ecx, %ecx
testl %ebx, %ebx
setne %al
sete %cl
addl %ecx, %r12d
addl %eax, %r13d
movq %r15, %rdi
movl $0x12c, %esi            # imm = 0x12C
movq -0x48(%rbp), %rdx
callq 0x1110
testq %rax, %rax
jne 0x1902
jmp 0x198f
leaq 0x486b(%rip), %rdi      # 0x61ce
callq 0x1080
movq %rbx, %rdi
callq 0x1030
movq -0x58(%rbp), %rdi
callq 0x1030
movq -0x48(%rbp), %rdi
callq 0x10a0
jmp 0x14da
xorl %ebx, %ebx
xorl %r12d, %r12d
xorl %r13d, %r13d
movq -0x48(%rbp), %rdi
callq 0x10a0
leaq 0x4671(%rip), %rsi      # 0x6010
movq -0x58(%rbp), %rdi
callq 0x1200
testq %rax, %rax
je 0x1c66
movq %rax, %r14
leaq 0x4678(%rip), %rdi      # 0x6033
leaq 0x467d(%rip), %rsi      # 0x603f
callq 0x1200
movq %rax, -0x50(%rbp)
testq %rax, %rax
je 0x1e0c
leaq 0x4666(%rip), %rdi      # 0x6041
leaq 0x465d(%rip), %rsi      # 0x603f
callq 0x1200
movq %rax, -0x48(%rbp)
testq %rax, %rax
je 0x1e0c
movl %ebx, -0x78(%rbp)
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
movsd 0x4601(%rip), %xmm1     # 0x6008
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0xa0(%rbp)
subl %eax, %r13d
movl %r13d, %eax
shrl $0x1f, %eax
addl %r13d, %eax
sarl %eax
movl %eax, -0x98(%rbp)
xorps %xmm0, %xmm0
cvtsi2sd %r12d, %xmm0
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x9c(%rbp)
subl %eax, %r12d
movl %r12d, %eax
shrl $0x1f, %eax
addl %r12d, %eax
sarl %eax
movl %eax, -0x94(%rbp)
leaq -0x240(%rbp), %r13
leaq 0x4887(%rip), %r12      # 0x62e8
leaq 0x45e8(%rip), %rbx      # 0x6050
movl $0x0, -0x6c(%rbp)
movl $0x0, -0x64(%rbp)
movl $0x0, -0x40(%rbp)
movl $0x0, -0x68(%rbp)
movq %r13, %rdi
movl $0x12c, %esi            # imm = 0x12C
movq %r14, %rdx
callq 0x1110
testq %rax, %rax
je 0x1c72
movq %r13, %rdi
movq %r12, %rsi
callq 0x1220
movq %rax, %r15
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1140
testl %eax, %eax
je 0x1a84
movq %r12, %rbx
testq %r15, %r15
je 0x1b34
xorl %r12d, %r12d
cmpl $0x2, %r12d
je 0x1b0f
cmpl $0x1, %r12d
je 0x1aed
testl %r12d, %r12d
jne 0x1b1a
movq %r15, %rdi
callq 0x10c0
leaq 0x1(%rax), %rdi
callq 0x11a0
movq %rax, -0x38(%rbp)
jmp 0x1b02
movq %r15, %rdi
callq 0x10c0
leaq 0x1(%rax), %rdi
callq 0x11a0
movq %rax, -0x30(%rbp)
movq %rax, %rdi
movq %r15, %rsi
callq 0x1060
jmp 0x1b1a
movq %r15, %rdi
callq 0x1240
movl %eax, -0x78(%rbp)
xorl %edi, %edi
movq %rbx, %rsi
callq 0x1220
movq %rax, %r15
incl %r12d
testq %rax, %rax
movl -0x40(%rbp), %eax
jne 0x1ac5
jmp 0x1b37
movl -0x40(%rbp), %eax
movl -0x78(%rbp), %r8d
testl %r8d, %r8d
je 0x1b6f
cmpl -0xa0(%rbp), %eax
movq %rbx, %r12
movl -0x6c(%rbp), %r15d
jge 0x1bab
movq -0x60(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x30(%rbp), %r15
movq %r15, %rdx
movl %r8d, %ecx
movl %eax, %ebx
callq 0x45a4
incl %ebx
movl %ebx, -0x40(%rbp)
jmp 0x1b9f
movl -0x68(%rbp), %r15d
cmpl -0x9c(%rbp), %r15d
movq %rbx, %r12
jge 0x1bde
movq -0x60(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x30(%rbp), %rbx
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0x45a4
incl %r15d
movl %r15d, -0x68(%rbp)
movq %rbx, %r15
leaq 0x44aa(%rip), %rbx      # 0x6050
jmp 0x1c50
cmpl -0x98(%rbp), %r15d
leaq 0x4497(%rip), %rbx      # 0x6050
jge 0x1c1c
movq -0x50(%rbp), %rdi
leaq 0x4497(%rip), %rsi      # 0x605d
movq -0x38(%rbp), %rdx
movq -0x30(%rbp), %rcx
xorl %eax, %eax
callq 0x1160
incl %r15d
movl %r15d, -0x6c(%rbp)
jmp 0x1c16
movl -0x64(%rbp), %r15d
cmpl -0x94(%rbp), %r15d
leaq 0x4460(%rip), %rbx      # 0x6050
movq -0x38(%rbp), %rdx
jge 0x1c34
movq -0x50(%rbp), %rdi
leaq 0x445c(%rip), %rsi      # 0x605d
movq -0x30(%rbp), %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x1160
incl %r15d
movl %r15d, -0x64(%rbp)
movq -0x30(%rbp), %r15
jmp 0x1c50
movq -0x48(%rbp), %rdi
leaq 0x4436(%rip), %rsi      # 0x605d
movq -0x38(%rbp), %rdx
movq -0x30(%rbp), %r15
movq %r15, %rcx
jmp 0x1c49
movq -0x48(%rbp), %rdi
leaq 0x441e(%rip), %rsi      # 0x605d
movq -0x30(%rbp), %r15
movq %r15, %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x1160
movq -0x38(%rbp), %rdi
callq 0x1030
movq %r15, %rdi
callq 0x1030
jmp 0x1a84
leaq 0x457f(%rip), %rdi      # 0x61ec
jmp 0x14d5
movq %r14, %rdi
callq 0x10a0
movq -0x50(%rbp), %rdi
callq 0x10a0
movq -0x48(%rbp), %rdi
callq 0x10a0
leaq 0x44a7(%rip), %rdi      # 0x613a
callq 0x1080
leaq 0x43c8(%rip), %rbx      # 0x6067
leaq 0x43ca(%rip), %r12      # 0x6070
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1200
movq %rax, %r15
leaq 0x43b8(%rip), %r13      # 0x6073
movl $0x1c, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rax, %rcx
callq 0x1260
leaq 0x43b9(%rip), %r14      # 0x6090
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 0x471b
movq %r13, %rdi
movq %r12, %rsi
callq 0x477a
movq %r15, %rdi
callq 0x10a0
movq %r12, %rdi
callq 0x10a0
leaq 0x4439(%rip), %rdi      # 0x6164
callq 0x1080
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x20f9
movq %rax, %r15
movq %rax, %rdi
movq %r13, %rsi
movq -0xb8(%rbp), %r12
movq %r12, %rdx
callq 0x2fc7
movq %rax, %r14
leaq 0x4446(%rip), %rdi      # 0x61a6
callq 0x1080
leaq 0x42c7(%rip), %rbx      # 0x6033
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x271b
movq %r15, %rdi
callq 0x20b1
movq %r12, %rdi
callq 0x5707
movq %r13, %rdi
callq 0x42a4
movq -0x88(%rbp), %rdi
callq 0x1030
movq %r14, %rdi
callq 0x1e5f
movq -0x58(%rbp), %rdi
callq 0x1030
movq -0x80(%rbp), %rdi
callq 0x1030
movq -0x90(%rbp), %rdi
callq 0x1100
movq %rbx, %rdi
callq 0x1050
leaq 0x426e(%rip), %rdi      # 0x6041
callq 0x1050
leaq -0xf0(%rbp), %rdi
callq 0x11f0
cvtsi2sd %rax, %xmm0
subsd -0xa8(%rbp), %xmm0
divsd -0xb0(%rbp), %xmm0
leaq 0x429d(%rip), %rdi      # 0x609d
movb $0x1, %al
callq 0x10d0
jmp 0x14da
leaq 0x4210(%rip), %rdi      # 0x6023
callq 0x1210
jmp 0x14da
leaq 0x4205(%rip), %rdi      # 0x6029
jmp 0x1e13
nop