// File: /workspace/github_c_makefile_star2_O0/felipelouza[P]egap/gap.c
// Function: main
int main(int argc, char *argv[]) {
  extern int optind, opterr, optopt;
  extern char *optarg;
  int c, group_size;
  char *path;
  g_data g;

  // default option values
  g.verbose=0; g.solid_limit = 256;
  group_size=MAX_NUMBER_OF_BWTS;      
  g.mwXMerge = g.bwtOnly = true;
  bool hm = false;
  g.unsortedLcp = NULL;
  g.outPath = NULL;
  g.algorithm = 0;
  g.extMem = g.smallAlpha=g.mmapZ=g.mmapBWT=g.mmapB= g.lcpMerge = g.lcpCompute = false;
  g.outputDA = 0;
  g.outputColors = 0;
  g.outputSA = 0;
  g.outputSL = 0;
  g.outputQS = 0;
  g.dbOrder = 0;           // order for deBruijn graph 
  int num_threads = 0;
  while ((c=getopt(argc, argv, "vhalrxmd:c:p:g:A:s:o:EZTBD:S:qL:")) != -1) {
    switch (c) 
      {
      case 'v':
        g.verbose++; break;         // verbose output (can be repeated)
      case 'o':
        g.outPath=optarg; break;    // basename for output files 
      case 'l':
        g.lcpCompute = true;        // compute lcp array from scratch 
        g.bwtOnly=false; break;  
      case 'r':
        g.lcpMerge = true;          // merge lcp values 
        g.bwtOnly=false; break;  
      case 'x':
        g.mwXMerge=false; break;      // do not use external multiway merge sort for computing lcp values
      case 'd':
        g.outputDA = atoi(optarg); break;  // output Document Array (for last iteration only) 
      case 'c':
        g.outputColors = atoi(optarg); break;  // output Document Array (one color for each chunk/file) 
      case 'S':
        g.outputSA = atoi(optarg); break;  // output Suffix Array (for last iteration only) 
      case 'L':
        g.outputSL = atoi(optarg); break;  // output Suffixes' lengths (for last iteration only) 
      case 'q':
        g.outputQS = 1; break;  // output QS permuted according to the BWT (for last iteration only) 
      case 'm':
        hm=true; break;                 // use hm algorithm 
      case 'a':
        g.smallAlpha=true; break;       // assume alphabet is small and use bwtOcc[][]
      case 'g':
        group_size = atoi(optarg);      // size for multigroup algorithm 
        break;      
      case 'A':
        g.algorithm = atoi(optarg);     // preferred algorithm 
        break;      
      case 'D':
        g.dbOrder = atoi(optarg);       // if > 1 compute order-k db graph 
        break;      
      case 's':
        g.solid_limit = atoi(optarg);   // smallest solid block 
        break;                
      case 'p':
        num_threads = atoi(optarg);     // number of consumer threads 
        break;       
      case 'E':
        g.extMem=true; break;           // use external memory (see mergegap.c)
      case 'Z':
        g.mmapZ=true; break;      // mmap merge and newmerge
      case 'B':
        g.mmapB=true; break;      // mmap B array
      case 'T':
        g.mmapBWT=true; break;    // mmap input BWTs
      case 'h':                   // usage instruction 
      case '?':
        usage(argv[0],&g);
        exit(EXIT_FAILURE);
      }
  }
  if(g.dbOrder<0 || g.dbOrder==1) { // illegal order
    printf("dbOrder must be at least 2\n");
    exit(EXIT_FAILURE);
  }
  if(g.dbOrder>1) { // valid order !=0
    if(!g.extMem) {
      printf("Option -D forces option -E\n");
      g.extMem = true;
    }
    if(g.algorithm!=128) {
      printf("Option -D forces option -A 128\n");
      g.algorithm = 128;
    }
    if(g.lcpMerge) {
      printf("Option -D incompatible with merging lcp values\n");
      exit(EXIT_FAILURE);
    }
  }
  if(num_threads <0) {
    printf("Invalid number of threads, must be non negative\n");
    exit(EXIT_FAILURE);
  }
  if(group_size<2 || group_size>MAX_NUMBER_OF_BWTS) {
    printf("Invalid group size. Must be in range [2,%llu]\n",MAX_NUMBER_OF_BWTS);
    exit(EXIT_FAILURE);
  } 
  if(hm && g.lcpCompute) {// not sure this is required, maybe changing something inside holtMcMillan() will suffice 
    printf("You cannot compute lcp values with H&M (only merge)\n");
    exit(EXIT_FAILURE);
  }
  if(g.lcpMerge && g.lcpCompute) {
    printf("You can *either* merge *or* compute lcp values\n");
    exit(EXIT_FAILURE);
  }
  if(!g.mwXMerge && !g.lcpCompute) {
    printf("Option -x can only be used with -l\n");
    exit(EXIT_FAILURE);
  }
  if(g.extMem) {
    if(hm) {
      printf("You cannot run H&M in external memory\n");
      exit(EXIT_FAILURE);
    }
    if(g.mmapBWT) { // extMem reads from the input bwt files from disk, it does not mmap them
      printf("Option -E incompatible with -T\n");
      exit(EXIT_FAILURE);
    }
    if(!g.smallAlpha) {
      printf("Option -E forces option -a\n");
      g.smallAlpha = true;
    }
  }
  if(optind+1==argc) {
    path=argv[optind];
  }
  else  {
    usage(argv[0],&g);
    exit(EXIT_FAILURE);
  }

  if(g.verbose>0) {
    puts("Command line:");
    for(int i=0;i<argc;i++)
      printf(" %s",argv[i]);
    puts("");
  }

  if(g.verbose>1) {
    puts(                    "***************************************************");
    if(g.bwtOnly)       puts("* Merge BWTs");
    else if(g.lcpMerge) puts("* Merge BWTs and LCPs");
    else                puts("* Merge BWTs and compute LCPs");
    if(hm)              puts("* Using multiround HM algorithm");
    else                puts("* Using multiround Gap algorithm");
    printf(                  "* Max #BWT %llu, Max LCP: %llu, Max mergeSize: %llu\n",
                     MAX_NUMBER_OF_BWTS, MAX_LCP_SIZE, MAX_OUTPUT_SIZE);  
    puts(                    "* Using Timo Bingmann's malloc_count to measure heap usage");
    puts(            "***************************************************");
  }

  // input check completed start measuring time 
  clock_t start = clock();
  time_t start_wc = time(NULL);
  double elapsed, elapsed_wc;

  // read BWT values. init g.numBWT, g.bwtLen[]; if !extMem also g.bws[]
  // also  remap BWTs init g->sizeOfAlpha and if g->smallAlpha is true init also g>bwtOcc[i]
  g.bwtOcc=NULL; g.sizeOfAlpha = 0;      //these two will be initialized later
  bool something_to_do = readBWTsingle(path, &g);
  
  if(g.numBwt> group_size) { // multiround computation required
    if(g.outputDA>0 || g.outputSA>0 || g.outputQS>0 || g.outputSL>0) {
      puts("Sorry, multiround DA, SA, QS or SL computation not supported");
      exit(EXIT_FAILURE);
    }
  }
  if(g.mmapBWT) { 
    if(g.outputDA>0 || g.outputSA>0 || g.outputQS>0 || g.outputSL>0) {
      puts("Sorry, internal memory DA, SA, QS or SL computation not supported");
      exit(EXIT_FAILURE);
    }
  }
  if(!something_to_do) {
    puts("Single BWT in input and no LCP/dBG computation. I have nothing to do!"); 
    //g.mergeLen = g.sizeOfAlpha = 1;
  }
  else {
    // init additional g fields 
    g.lcpinPath = path;
    if(g.outPath==NULL) g.outPath = path;  
    g.symb_offset = 0;
    g.blockBeginsAt = NULL; g.lcps = NULL; // prevent unintended use
    // if requested allocate space for and read lcp Values (B array)
    if(g.lcpMerge)
       initLCPmem(&g); // init g.lcps. lcp values are stored in mmapped memory 
          
    elapsed = (clock()-start)/(double)(CLOCKS_PER_SEC);
    elapsed_wc = difftime(time(NULL),start_wc);
    // printf("Partial elapsed time: %.4lf secs\n", elapsed_wc);
    // printf("Partial computing time: %.4lf secs\n", elapsed);    
    #if MALLOC_COUNT_FLAG
      printf("Merge starting (%d bwts). Mem: %zu peak, %zu current\n", g.numBwt, malloc_count_peak(), malloc_count_current());
    #else
      printf("Merge starting (%d bwts).\n", g.numBwt);
    #endif
      
    // do the merging
    multiround(hm,group_size,path,&g, num_threads);
    
    // computation done the result is in g->bws[0], and g->lcps[0] (if lcpMerge) 
    // if lcpCompute the result is already in the outputfile or in the pair files 
    // and a message is printed to run mergelcp 
  
    // write content of g.bws[0] to output file (if necessary) and/or free/munmap it 
    if(g.mmapBWT) {
      int e = munmap(g.bws[0],g.mergeLen*sizeof(symbol));
      if(e) die("main (unmap bws)");
    }
    else if(!g.extMem) { 
      writeOutputBWT(&g,path,hm); // if we are working in external memory output overwrites input
      free(g.bws[0]); // deallocate all bwt's (they are contiguous)
    }
    // free other bwt related stuff
    free(g.bws);
    if(g.smallAlpha) {free(g.bwtOcc[0]); free(g.bwtOcc);}
    free(g.bwtLen);
    // free lcp related stuff
    if(g.lcpMerge) {
      int e = munmap(g.lcps[0],g.mergeLen*sizeof(lcpInt));
      if(e) die("main (unmap lcps)");
      free(g.lcps);      
    }
  }
  
  // report running times  
  elapsed = (clock()-start)/(double)(CLOCKS_PER_SEC);
  elapsed_wc = difftime(time(NULL),start_wc);
  printf("##\n");
  printf("Elapsed time: %.4lf secs\n", elapsed_wc);
  // fprintf(stderr, "%.6lf\n", elapsed_wc);
  printf("Computing time: %.4lf secs\n", elapsed);
  printf("##\n");
  printf("Size of merged BWT: "CUSTOM_FORMAT, g.mergeLen);
  printf(" Alphabet size: %d\n", g.sizeOfAlpha);
  printf("##\n");
  printf("Microseconds per symbol: %.4lf\n", elapsed_wc*1000000.0/g.mergeLen);
  //  fprintf(stderr, "%.6lf\n", elapsed_wc*1000000.0/g.mergeLen);
  #if MALLOC_COUNT_FLAG
    printf("Peak memory allocation: %zu bytes, %.4lf bytes/symbol\n",
           malloc_count_peak(), (double)malloc_count_peak()/g.mergeLen);
  #endif
  printf("##\n");

  return 0; // Done!!!
}

// Assembly:
subq $0x51f8, %rsp           # imm = 0x51F8
movl $0x0, 0x51f4(%rsp)
movl %edi, 0x51f0(%rsp)
movq %rsi, 0x51e8(%rsp)
movl $0x0, 0x14c(%rsp)
movl $0x100, 0x148(%rsp) # imm = 0x100
movl $0x100, 0x51e0(%rsp) # imm = 0x100
movb $0x1, 0xf4(%rsp)
movb $0x1, 0xf7(%rsp)
movb $0x0, 0xb7(%rsp)
movq $0x0, 0x110(%rsp)
movq $0x0, 0x138(%rsp)
movl $0x0, 0x124(%rsp)
movb $0x0, 0xf6(%rsp)
movb $0x0, 0xf5(%rsp)
movb $0x0, 0x129(%rsp)
movb $0x0, 0x12a(%rsp)
movb $0x0, 0x128(%rsp)
movb $0x0, 0x120(%rsp)
movb $0x0, 0x121(%rsp)
movl $0x0, 0xfc(%rsp)
movl $0x0, 0x100(%rsp)
movl $0x0, 0x104(%rsp)
movl $0x0, 0x108(%rsp)
movl $0x0, 0x10c(%rsp)
movl $0x0, 0xf8(%rsp)
movl $0x0, 0xb0(%rsp)
movl 0x51f0(%rsp), %edi
movq 0x51e8(%rsp), %rsi
leaq 0x11e3a(%rip), %rdx     # 0x145c2
callq 0x2330
movl %eax, 0x51e4(%rsp)
cmpl $-0x1, %eax
je 0x2993
movl 0x51e4(%rsp), %eax
addl $-0x3f, %eax
movl %eax, %ecx
movq %rcx, 0x70(%rsp)
subl $0x39, %eax
ja 0x298e
movq 0x70(%rsp), %rax
leaq 0x1186d(%rip), %rcx     # 0x14030
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x14c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14c(%rsp)
jmp 0x298e
movq 0x167ef(%rip), %rax     # 0x18fd8
movq (%rax), %rax
movq %rax, 0x138(%rsp)
jmp 0x298e
movb $0x1, 0xf6(%rsp)
movb $0x0, 0xf4(%rsp)
jmp 0x298e
movb $0x1, 0xf5(%rsp)
movb $0x0, 0xf4(%rsp)
jmp 0x298e
movb $0x0, 0xf7(%rsp)
jmp 0x298e
movq 0x167a1(%rip), %rax     # 0x18fd8
movq (%rax), %rdi
callq 0x2350
movl %eax, 0xfc(%rsp)
jmp 0x298e
movq 0x16786(%rip), %rax     # 0x18fd8
movq (%rax), %rdi
callq 0x2350
movl %eax, 0x100(%rsp)
jmp 0x298e
movq 0x1676b(%rip), %rax     # 0x18fd8
movq (%rax), %rdi
callq 0x2350
movl %eax, 0x104(%rsp)
jmp 0x298e
movq 0x16750(%rip), %rax     # 0x18fd8
movq (%rax), %rdi
callq 0x2350
movl %eax, 0x108(%rsp)
jmp 0x298e
movl $0x1, 0x10c(%rsp)
jmp 0x298e
movb $0x1, 0xb7(%rsp)
jmp 0x298e
movb $0x1, 0x120(%rsp)
jmp 0x298e
movq 0x1670b(%rip), %rax     # 0x18fd8
movq (%rax), %rdi
callq 0x2350
movl %eax, 0x51e0(%rsp)
jmp 0x298e
movq 0x166f0(%rip), %rax     # 0x18fd8
movq (%rax), %rdi
callq 0x2350
movl %eax, 0x124(%rsp)
jmp 0x298e
movq 0x166d5(%rip), %rax     # 0x18fd8
movq (%rax), %rdi
callq 0x2350
movl %eax, 0xf8(%rsp)
jmp 0x298e
movq 0x166bd(%rip), %rax     # 0x18fd8
movq (%rax), %rdi
callq 0x2350
movl %eax, 0x148(%rsp)
jmp 0x298e
movq 0x166a5(%rip), %rax     # 0x18fd8
movq (%rax), %rdi
callq 0x2350
movl %eax, 0xb0(%rsp)
jmp 0x298e
movb $0x1, 0x121(%rsp)
jmp 0x298e
movb $0x1, 0x128(%rsp)
jmp 0x298e
movb $0x1, 0x129(%rsp)
jmp 0x298e
movb $0x1, 0x12a(%rsp)
jmp 0x298e
movq 0x51e8(%rsp), %rax
movq (%rax), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x24f0
movl $0x1, %edi
callq 0x2370
jmp 0x2772
cmpl $0x0, 0xf8(%rsp)
jl 0x29a7
cmpl $0x1, 0xf8(%rsp)
jne 0x29bf
leaq 0x11c35(%rip), %rdi     # 0x145e3
movb $0x0, %al
callq 0x20f0
movl $0x1, %edi
callq 0x2370
cmpl $0x1, 0xf8(%rsp)
jle 0x2a33
testb $0x1, 0x121(%rsp)
jne 0x29e9
leaq 0x11c25(%rip), %rdi     # 0x145ff
movb $0x0, %al
callq 0x20f0
movb $0x1, 0x121(%rsp)
cmpl $0x80, 0x124(%rsp)
je 0x2a0f
leaq 0x11c1e(%rip), %rdi     # 0x1461b
movb $0x0, %al
callq 0x20f0
movl $0x80, 0x124(%rsp)
testb $0x1, 0xf5(%rsp)
je 0x2a31
leaq 0x11c1b(%rip), %rdi     # 0x1463b
movb $0x0, %al
callq 0x20f0
movl $0x1, %edi
callq 0x2370
jmp 0x2a33
cmpl $0x0, 0xb0(%rsp)
jge 0x2a55
leaq 0x11c27(%rip), %rdi     # 0x1466b
movb $0x0, %al
callq 0x20f0
movl $0x1, %edi
callq 0x2370
cmpl $0x2, 0x51e0(%rsp)
jl 0x2a6f
movslq 0x51e0(%rsp), %rax
cmpq $0x100, %rax            # imm = 0x100
jbe 0x2a8c
leaq 0x11c26(%rip), %rdi     # 0x1469c
movl $0x100, %esi            # imm = 0x100
movb $0x0, %al
callq 0x20f0
movl $0x1, %edi
callq 0x2370
testb $0x1, 0xb7(%rsp)
je 0x2ab8
testb $0x1, 0xf6(%rsp)
je 0x2ab8
leaq 0x11c24(%rip), %rdi     # 0x146cb
movb $0x0, %al
callq 0x20f0
movl $0x1, %edi
callq 0x2370
testb $0x1, 0xf5(%rsp)
je 0x2ae4
testb $0x1, 0xf6(%rsp)
je 0x2ae4
leaq 0x11c2d(%rip), %rdi     # 0x14700
movb $0x0, %al
callq 0x20f0
movl $0x1, %edi
callq 0x2370
testb $0x1, 0xf7(%rsp)
jne 0x2b10
testb $0x1, 0xf6(%rsp)
jne 0x2b10
leaq 0x11c31(%rip), %rdi     # 0x14730
movb $0x0, %al
callq 0x20f0
movl $0x1, %edi
callq 0x2370
testb $0x1, 0x121(%rsp)
je 0x2b80
testb $0x1, 0xb7(%rsp)
je 0x2b3c
leaq 0x11c29(%rip), %rdi     # 0x14754
movb $0x0, %al
callq 0x20f0
movl $0x1, %edi
callq 0x2370
testb $0x1, 0x12a(%rsp)
je 0x2b5e
leaq 0x11c2e(%rip), %rdi     # 0x1477b
movb $0x0, %al
callq 0x20f0
movl $0x1, %edi
callq 0x2370
testb $0x1, 0x120(%rsp)
jne 0x2b7e
leaq 0x11c2c(%rip), %rdi     # 0x1479b
movb $0x0, %al
callq 0x20f0
movb $0x1, 0x120(%rsp)
jmp 0x2b80
movq 0x16449(%rip), %rax     # 0x18fd0
movl (%rax), %eax
addl $0x1, %eax
cmpl 0x51f0(%rsp), %eax
jne 0x2bb5
movq 0x51e8(%rsp), %rax
movq 0x1642c(%rip), %rcx     # 0x18fd0
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x51d8(%rsp)
jmp 0x2bd7
movq 0x51e8(%rsp), %rax
movq (%rax), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x24f0
movl $0x1, %edi
callq 0x2370
cmpl $0x0, 0x14c(%rsp)
jle 0x2c49
leaq 0x11bcf(%rip), %rdi     # 0x147b7
callq 0x2080
movl $0x0, 0xac(%rsp)
movl 0xac(%rsp), %eax
cmpl 0x51f0(%rsp), %eax
jge 0x2c3d
movq 0x51e8(%rsp), %rax
movslq 0xac(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x11ba2(%rip), %rdi     # 0x147c5
movb $0x0, %al
callq 0x20f0
movl 0xac(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xac(%rsp)
jmp 0x2bf8
leaq 0x1156c(%rip), %rdi     # 0x141b0
callq 0x2080
cmpl $0x1, 0x14c(%rsp)
jle 0x2cfc
leaq 0x11b6b(%rip), %rdi     # 0x147c9
callq 0x2080
testb $0x1, 0xf4(%rsp)
je 0x2c7b
leaq 0x11b89(%rip), %rdi     # 0x147fd
callq 0x2080
jmp 0x2ca1
testb $0x1, 0xf5(%rsp)
je 0x2c93
leaq 0x11b7e(%rip), %rdi     # 0x1480a
callq 0x2080
jmp 0x2c9f
leaq 0x11b86(%rip), %rdi     # 0x14820
callq 0x2080
jmp 0x2ca1
testb $0x1, 0xb7(%rsp)
je 0x2cb9
leaq 0x11b8c(%rip), %rdi     # 0x1483e
callq 0x2080
jmp 0x2cc5
leaq 0x11b9e(%rip), %rdi     # 0x1485e
callq 0x2080
leaq 0x11bb3(%rip), %rdi     # 0x1487f
movl $0x100, %esi            # imm = 0x100
movl $0xff, %edx
movq $-0x2, %rcx
movb $0x0, %al
callq 0x20f0
leaq 0x11bc9(%rip), %rdi     # 0x148b4
callq 0x2080
leaq 0x11ad2(%rip), %rdi     # 0x147c9
callq 0x2080
callq 0x20c0
movq %rax, 0xa0(%rsp)
xorl %eax, %eax
movl %eax, %edi
callq 0x21f0
movq %rax, 0x98(%rsp)
movq $0x0, 0xd0(%rsp)
movl $0x0, 0xf0(%rsp)
movq 0x51d8(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x3360
andb $0x1, %al
movb %al, 0x87(%rsp)
movl 0xd8(%rsp), %eax
cmpl 0x51e0(%rsp), %eax
jle 0x2d9f
cmpl $0x0, 0xfc(%rsp)
jg 0x2d87
cmpl $0x0, 0x104(%rsp)
jg 0x2d87
cmpl $0x0, 0x10c(%rsp)
jg 0x2d87
cmpl $0x0, 0x108(%rsp)
jle 0x2d9d
leaq 0x11b61(%rip), %rdi     # 0x148ef
callq 0x2080
movl $0x1, %edi
callq 0x2370
jmp 0x2d9f
testb $0x1, 0x12a(%rsp)
je 0x2de9
cmpl $0x0, 0xfc(%rsp)
jg 0x2dd1
cmpl $0x0, 0x104(%rsp)
jg 0x2dd1
cmpl $0x0, 0x10c(%rsp)
jg 0x2dd1
cmpl $0x0, 0x108(%rsp)
jle 0x2de7
leaq 0x11b54(%rip), %rdi     # 0x1492c
callq 0x2080
movl $0x1, %edi
callq 0x2370
jmp 0x2de9
testb $0x1, 0x87(%rsp)
jne 0x2e04
leaq 0x11b74(%rip), %rdi     # 0x1496e
callq 0x2080
jmp 0x3026
movq 0x51d8(%rsp), %rax
movq %rax, 0x130(%rsp)
cmpq $0x0, 0x138(%rsp)
jne 0x2e2f
movq 0x51d8(%rsp), %rax
movq %rax, 0x138(%rsp)
movq $0x0, 0xe8(%rsp)
movq $0x0, 0x150(%rsp)
movq $0x0, 0x140(%rsp)
testb $0x1, 0xf5(%rsp)
je 0x2e6a
leaq 0xb8(%rsp), %rdi
callq 0x41b0
callq 0x20c0
subq 0xa0(%rsp), %rax
cvtsi2sd %rax, %xmm0
movsd 0x11184(%rip), %xmm1    # 0x14008
divsd %xmm1, %xmm0
movsd %xmm0, 0x90(%rsp)
xorl %eax, %eax
movl %eax, %edi
callq 0x21f0
movq %rax, %rdi
movq 0x98(%rsp), %rsi
callq 0x2100
movsd %xmm0, 0x88(%rsp)
movl 0xd8(%rsp), %eax
movl %eax, 0x64(%rsp)
callq 0x12730
movq %rax, 0x68(%rsp)
callq 0x12720
movl 0x64(%rsp), %esi
movq 0x68(%rsp), %rdx
movq %rax, %rcx
leaq 0x11ad4(%rip), %rdi     # 0x149b4
movb $0x0, %al
callq 0x20f0
movb 0xb7(%rsp), %al
movl 0x51e0(%rsp), %esi
movq 0x51d8(%rsp), %rdx
movl 0xb0(%rsp), %r8d
leaq 0xb8(%rsp), %rcx
andb $0x1, %al
movzbl %al, %edi
callq 0x133d0
testb $0x1, 0x12a(%rsp)
je 0x2f5c
movq 0xb8(%rsp), %rax
movq (%rax), %rdi
movq 0xe0(%rsp), %rsi
shlq $0x0, %rsi
callq 0x2280
movl %eax, 0x80(%rsp)
cmpl $0x0, 0x80(%rsp)
je 0x2f5a
leaq 0x11a95(%rip), %rdi     # 0x149ea
callq 0x3ce0
jmp 0x2f99
testb $0x1, 0x121(%rsp)
jne 0x2f97
movq 0x51d8(%rsp), %rsi
movb 0xb7(%rsp), %al
leaq 0xb8(%rsp), %rdi
andb $0x1, %al
movzbl %al, %edx
callq 0x31f0
movq 0xb8(%rsp), %rax
movq (%rax), %rdi
callq 0x12940
jmp 0x2f99
movq 0xb8(%rsp), %rdi
callq 0x12940
testb $0x1, 0x120(%rsp)
je 0x2fcd
movq 0xd0(%rsp), %rax
movq (%rax), %rdi
callq 0x12940
movq 0xd0(%rsp), %rdi
callq 0x12940
movq 0xc0(%rsp), %rdi
callq 0x12940
testb $0x1, 0xf5(%rsp)
je 0x3024
movq 0x140(%rsp), %rax
movq (%rax), %rdi
movq 0xe0(%rsp), %rsi
shlq $0x0, %rsi
callq 0x2280
movl %eax, 0x7c(%rsp)
cmpl $0x0, 0x7c(%rsp)
je 0x3017
leaq 0x119e9(%rip), %rdi     # 0x149fb
callq 0x3ce0
movq 0x140(%rsp), %rdi
callq 0x12940
jmp 0x3026
callq 0x20c0
movq 0xa0(%rsp), %rcx
subq %rcx, %rax
cvtsi2sd %rax, %xmm0
movsd 0x10fc5(%rip), %xmm1    # 0x14008
movsd %xmm1, 0x20(%rsp)
divsd %xmm1, %xmm0
movsd %xmm0, 0x90(%rsp)
xorl %eax, %eax
movl %eax, 0xc(%rsp)
movl %eax, %edi
callq 0x21f0
movq %rax, %rdi
movq 0x98(%rsp), %rsi
callq 0x2100
movl 0xc(%rsp), %eax
movsd %xmm0, 0x88(%rsp)
leaq 0x11986(%rip), %rdi     # 0x14a0d
movq %rdi, 0x10(%rsp)
movb %al, 0x1f(%rsp)
callq 0x20f0
movsd 0x88(%rsp), %xmm0
leaq 0x1196c(%rip), %rdi     # 0x14a11
movb $0x1, %al
movb %al, 0x2f(%rsp)
callq 0x20f0
movb 0x2f(%rsp), %al
movsd 0x90(%rsp), %xmm0
leaq 0x11967(%rip), %rdi     # 0x14a2b
callq 0x20f0
movq 0x10(%rsp), %rdi
movb 0x1f(%rsp), %al
callq 0x20f0
movb 0x1f(%rsp), %al
movq 0xe0(%rsp), %rsi
leaq 0x1195d(%rip), %rdi     # 0x14a47
callq 0x20f0
movb 0x1f(%rsp), %al
movl 0xf0(%rsp), %esi
leaq 0x1195e(%rip), %rdi     # 0x14a5f
callq 0x20f0
movq 0x10(%rsp), %rdi
movb 0x1f(%rsp), %al
callq 0x20f0
movsd 0x20(%rsp), %xmm1
movb 0x2f(%rsp), %al
movsd 0x88(%rsp), %xmm0
mulsd %xmm1, %xmm0
movq 0xe0(%rsp), %xmm1
movaps 0x10ed5(%rip), %xmm2    # 0x14010
movaps %xmm2, 0x30(%rsp)
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x10ed4(%rip), %xmm2    # 0x14020
movaps %xmm2, 0x40(%rsp)
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
leaq 0x11908(%rip), %rdi     # 0x14a73
callq 0x20f0
callq 0x12730
movq %rax, 0x58(%rsp)
callq 0x12730
movaps 0x30(%rsp), %xmm3
movaps 0x40(%rsp), %xmm2
movq 0x58(%rsp), %rsi
movq %rax, %xmm0
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq 0xe0(%rsp), %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
leaq 0x118c6(%rip), %rdi     # 0x14a93
movb $0x1, %al
callq 0x20f0
leaq 0x11832(%rip), %rdi     # 0x14a0d
movb $0x0, %al
callq 0x20f0
xorl %eax, %eax
addq $0x51f8, %rsp           # imm = 0x51F8
retq
nopl (%rax)