// File: /workspace/github_c_makefile_star2_O3/felipelouza[P]egap/tools/mergelcp.c
// Function: main
int main(int argc, char **argv) {                   
  
  extern char *optarg;
  extern int optind, opterr, optopt;
  
  int c=0, time=0, verbose=0;
  char *c_file=NULL;
  int heap_size=HEAP_SIZE;
  int pos_size=4, lcp_size=4;
  size_t RAM=0;
  int k=0, e;
  
  while ((c=getopt(argc, argv, "s:vthk:m:")) != -1) {
    switch (c)
    {
      case 's':
        heap_size=atoi(optarg); break;  // compute LCP and output in Gap format 
      case 'v':
        verbose++; break;
      case 't':
        time++; break;
      case 'h':
        usage(argv[0]); break;       // show usage and stop
      case 'k':
        k=atoi(optarg); break;       // k-truncated LCP merging
      case 'm':
        RAM=(size_t)atoi(optarg)*MB; break;
      case '?':
        exit(EXIT_FAILURE);
    }
  }
  
  if(verbose>0) {
    puts("Command line:");
    int i;
    for(i=0;i<argc;i++)
      printf(" %s",argv[i]);
    puts("");
  }

  if(optind+3==argc) {
    c_file=argv[optind++];
    pos_size=atoi(argv[optind++]);
    lcp_size=atoi(argv[optind++]);
    
    if(pos_size+lcp_size>16) {
      fprintf(stderr,"POS_SIZE+LCP_SIZE can be at most 16\n");
      exit(EXIT_FAILURE);
    } 
    if(pos_size<=0 || lcp_size<=0) {
      fprintf(stderr,"Both POS_SIZE LCP_SIZE must be at least 1\n");
      exit(EXIT_FAILURE);
    } 
  }
  else{
    usage(argv[0]);
  }
  
  if(heap_size<2){
    puts("ERROR: s must be larger than 1");
    exit(EXIT_FAILURE);
  }

  
  //config
  char c_lcp[PATH_MAX], c_size[PATH_MAX];
  char c_lcp_multi[PATH_MAX], c_size_multi[PATH_MAX]; //multilevel
  
  sprintf(c_lcp, "%s.pair.lcp",  c_file);
  sprintf(c_size, "%s.size.lcp", c_file);
  
  printf("INPUT:\t%s, %s\n", c_lcp, c_size);
  
  if(verbose){
    printf("sizeof(pos) = %d bytes\n", pos_size);
    printf("sizeof(lcp) = %d bytes\n", lcp_size);
  }

  printf("##\n");
  if(RAM){
    if(RAM<pow(2,20)) printf("RAM = %.2lf KB\n", RAM/pow(2,10));
    else if (RAM>=pow(2,20) && RAM<pow(2,30)) printf("RAM = %.2lf MB\n", RAM/pow(2,20));
    else printf("RAM = %.2lf GB\n", (double)RAM/pow(2,30));
    //fprintf(stderr,"RAM = %.2lf GB\n", (double)RAM/pow(2,30));
  }
  else printf("RAM = unlimited\n");

  // inits 
  time_t t_start=0, t_total=0;
  clock_t c_start=0, c_total=0;
   
  time_start(&t_start, &c_start);
  time_start(&t_total, &c_total);
  
  //alloc heap
  int level=0, onelevel=0;
  size_t i, blocks;
  FILE *f_size, *f_lcp;
  heap *h;
  size_t size, seek=0;
  size_t sum;

  f_size = fopen(c_size, "rb");//header file
  size_t n;
  e = fread(&n, sizeof(size_t), 1, f_size);
  if(e!=1) {perror (__func__); exit(EXIT_FAILURE);}
  printf("Number of LCP entries in output file: = %zu\n", n);
  
  //LEVEL 1 
  do{ // multilevel merging
  
    //printf("INPUT: %s\t%s\n", c_lcp, c_size);
    seek=0;
    
    blocks=1; i=0; sum=0;
    level++;
    h = heap_alloc(heap_size, c_lcp, level, pos_size, lcp_size, RAM);
    
    
    //output
    sprintf(c_lcp_multi, "%s.pair.%d.lcp", c_file, level);  
    f_lcp = file_open(c_lcp_multi, "wb");//lists file
    
    sprintf(c_size_multi, "%s.size.%d.lcp", c_file, level);
    FILE* f_size_multi = file_open(c_size_multi, "wb");
    
    /**/
    while(fread(&size, sizeof(size_t), 1, f_size)){
      //init heap
      #if DEBUG
        printf("%zu (%zu): ", size, seek);
      #endif
      heap_insert(h, seek); //size == seek
      seek+=size;
      
      if(++i == heap_size){
            
        heap_sort_level(h, f_lcp, &sum, c_file, level, k);     
        fwrite(&sum, sizeof(size_t), 1, f_size_multi);
      
        //new heap
        heap_free(h, f_lcp, level);
        h = heap_alloc(heap_size, c_lcp, level, pos_size, lcp_size, RAM);
        
        blocks++;
        i=0;
        sum=0;
      }
    }
    
    if(i){//last block
      
      if(blocks==1 && level==1){
        onelevel=1;
        fclose(f_lcp); fclose(f_size); fclose(f_size_multi);
        //empty files
        remove(c_size_multi);
        remove(c_lcp_multi);
        break;
      }
      
      heap_sort_level(h, f_lcp, &sum, c_file, level, k);
      fwrite(&sum, sizeof(size_t), 1, f_size_multi);    
    }
        
    heap_free(h, f_lcp, level);
    fclose(f_lcp); fclose(f_size); fclose(f_size_multi);
    
    if(verbose)
      printf("%zux%d+%zu\t\n", blocks-1, heap_size, i);
    
    if(level>1){//do not remove the original inputs
      remove(c_lcp);
      remove(c_size);
    }
    
    //input for the next level
    sprintf(c_lcp, "%s.pair.%d.lcp", c_file, level);
    sprintf(c_size, "%s.size.%d.lcp", c_file, level);

    f_size = fopen(c_size, "rb");//header file
  }
  while(blocks>heap_size);
  
  if(onelevel){
    if(verbose)
      printf("%zux%d+%zu\t\n", blocks-1, heap_size, i);
  }
  else{
    /**/
    if(time){
      printf("## LEVEL 1 ##\n");
      //fprintf(stderr,"%.6lf\n", time_stop(t_start, c_start));
      time_stop(t_start, c_start);
      time_start(&t_start, &c_start);
    }
    /**/
    
    //LEVEL 2
    
    //printf("INPUT: %s\t%s\n", c_lcp_multi, c_size_multi);
    if(verbose)
      printf("%dx%zu\t\n", 1, blocks);
    
    f_size = file_open(c_size_multi, "rb");//header file

    h = heap_alloc(blocks, c_lcp_multi, 0, pos_size, lcp_size, RAM);
    seek=0;
    
    while(fread(&size, sizeof(size_t), 1, f_size)){
      #if DEBUG
        printf("%zu (%zu): ", size, seek);
      #endif
      heap_insert(h, seek); //size == seek
      seek+=size;
    }
    
    fclose(f_size);
  }
  
  sprintf(c_lcp, "%s.%d.lcp", c_file, lcp_size);//linal
  f_lcp = file_open(c_lcp, "wb");
    
  size_t total=0;
  
  #if CHECK == 1
    if(heap_sort_level(h, f_lcp, &total, c_file, 0, k)) printf("isSorted!!\n");
    else printf("isNotSorted!!\n");
  #else
    heap_sort_level(h, f_lcp, &total, c_file, 0, k);
  #endif
  
  printf("N = %zu (%zu)\n", total, n);

  if(k){
    //complete LCP empty entries
    /**/
    int64_t curr=total;
    int64_t pos=n;

    pair aux=lcp(k); //k-truncated LCP-values
    for(;curr<pos;curr++){
      #if CHECK == 1
        fprintf(stderr,"** %lu, %lu (lcp = %lu)\n", pos, curr, lcp(aux));
      #endif
      heap_write(h, f_lcp, aux, level);
    }
    /**/
  }
  
  heap_free(h, f_lcp, 0);
  fclose(f_lcp);
  
  /**/
  if(time){
    printf("## LEVEL 2 ##\n");
    time_stop(t_start, c_start);
  }
  /**/
  
  if(time){
    printf("## TOTAL ##\n");
    fprintf(stderr,"%.6lf\n", time_stop(t_total, c_total));
  }
  
  printf("OUTPUT:\t%s\n", c_lcp);
  
  remove(c_lcp_multi);
  remove(c_size_multi);
  
  //checking
  #if CHECK == 2
    printf("CHECK:\t");
    char c_pos[500];
    sprintf(c_pos, "%s.pos.lcp", c_file);
    FILE* f_pos = file_open(c_pos, "rb");
    f_lcp = file_open(c_lcp, "rb");
    uint64_t pos=0,lcp=0;
    int true=1; 
    size_t previous=0;
    sum=0;
    while(fread(&pos, pos_size, 1, f_pos)){
      fread(&lcp, lcp_size, 1, f_lcp);
      #if DEBUG
        printf("<%lu, %lu> ", pos, lcp);
      #endif
      if(previous>pos){
        true=0; break;
      }
      previous=pos;
      sum++;
    }
    printf("\n");
    if(true) printf("isSorted!! (%zu)\n", sum);
    else printf("isNotSorted!!\n");

    fclose(f_pos);
    fclose(f_lcp);
  #endif

  /**/
  sprintf(c_lcp, "%s.pair.lcp",  c_file);
  sprintf(c_size, "%s.size.lcp", c_file);

  remove(c_lcp);
  remove(c_size);
  /**/


return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x40a8, %rsp           # imm = 0x40A8
movq %rsi, %rbx
movl %edi, %ebp
movl $0x100, 0xc(%rsp)       # imm = 0x100
movq $0x0, 0x28(%rsp)
leaq 0x2a60(%rip), %r14      # 0x4299
leaq 0x2800(%rip), %r15      # 0x4040
movq 0x5791(%rip), %r12      # 0x6fd8
movl $0x0, 0x14(%rsp)
movl $0x0, 0x10(%rsp)
xorl %r13d, %r13d
movl %ebp, %edi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1180
leal -0x68(%rax), %ecx
cmpl $0xe, %ecx
ja 0x1887
movslq (%r15,%rcx,4), %rax
addq %r15, %rax
jmpq *%rax
movq (%r12), %rdi
callq 0x11a0
movl %eax, 0x14(%rsp)
jmp 0x185a
cmpl $-0x1, %eax
je 0x18c6
cmpl $0x3f, %eax
jne 0x185a
jmp 0x20ff
incl %r13d
jmp 0x185a
incl 0x10(%rsp)
jmp 0x185a
movq (%r12), %rdi
callq 0x11a0
movl %eax, 0xc(%rsp)
jmp 0x185a
movq (%r12), %rdi
callq 0x11a0
cltq
shlq $0x14, %rax
movq %rax, 0x28(%rsp)
jmp 0x185a
cmpl $0x0, 0x10(%rsp)
jle 0x190a
leaq 0x29cf(%rip), %rdi      # 0x42a3
callq 0x1080
testl %ebp, %ebp
jle 0x1900
movl %ebp, %r15d
leaq 0x29ca(%rip), %r14      # 0x42b1
xorl %r12d, %r12d
movq (%rbx,%r12,8), %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x10d0
incq %r12
cmpq %r12, %r15
jne 0x18ea
movl $0xa, %edi
callq 0x1040
movq 0x56bf(%rip), %r15      # 0x6fd0
movslq (%r15), %r14
leal 0x3(%r14), %eax
cmpl %ebp, %eax
jne 0x20e1
movq (%rbx,%r14,8), %rax
movq %rax, 0x38(%rsp)
leaq 0x2(%r14), %rax
movl %eax, (%r15)
movq 0x8(%rbx,%r14,8), %rdi
callq 0x11a0
movl %eax, %r12d
movl %ebp, (%r15)
movq 0x10(%rbx,%r14,8), %rdi
callq 0x11a0
movq %rax, 0x20(%rsp)
addl %r12d, %eax
cmpl $0x11, %eax
jge 0x20e9
testl %r12d, %r12d
movq 0x28(%rsp), %r15
jle 0x20ee
cmpl $0x0, 0x20(%rsp)
jle 0x20ee
cmpl $0x1, 0xc(%rsp)
movq 0x38(%rsp), %r14
jle 0x20f3
leaq 0x2999(%rip), %rsi      # 0x4324
leaq 0xa0(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x11b0
leaq 0x2989(%rip), %rsi      # 0x4330
movq %r14, %rdx
leaq 0x30a0(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x11b0
leaq 0x2979(%rip), %rdi      # 0x433c
movq %rbx, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x10d0
cmpl $0x0, 0x10(%rsp)
je 0x19fb
leaq 0x296d(%rip), %rdi      # 0x434b
movl %r12d, %esi
xorl %eax, %eax
callq 0x10d0
leaq 0x2974(%rip), %rdi      # 0x4363
movq 0x20(%rsp), %rsi
xorl %eax, %eax
callq 0x10d0
leaq 0x2a5c(%rip), %rdi      # 0x445e
callq 0x1080
testq %r15, %r15
movl %r13d, 0x1c(%rsp)
je 0x1a4c
movq %r15, %xmm1
punpckldq 0x25f2(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x25fa(%rip), %xmm1     # 0x4020
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
cmpq $0x3fffffff, %r15       # imm = 0x3FFFFFFF
ja 0x1a5a
mulsd 0x25f5(%rip), %xmm0     # 0x4038
leaq 0x2931(%rip), %rdi      # 0x437b
jmp 0x1a69
leaq 0x29f0(%rip), %rdi      # 0x4443
callq 0x1080
jmp 0x1a70
mulsd 0x25ce(%rip), %xmm0     # 0x4030
leaq 0x2922(%rip), %rdi      # 0x438b
movb $0x1, %al
callq 0x10d0
movq %r15, 0x28(%rsp)
xorl %eax, %eax
leaq 0x80(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x90(%rsp), %rbx
movq %rax, (%rbx)
leaq 0x78(%rsp), %rsi
movq %rax, (%rsi)
leaq 0x88(%rsp), %r14
movq %rax, (%r14)
callq 0x2110
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2110
leaq 0x28e4(%rip), %rsi      # 0x439b
leaq 0x30a0(%rsp), %rdi
callq 0x1160
movq %rax, %r13
leaq 0x70(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
movq %rax, %rcx
callq 0x1090
cmpl $0x1, %eax
jne 0x2109
movq 0x70(%rsp), %rsi
leaq 0x28b0(%rip), %rdi      # 0x43a3
xorl %eax, %eax
callq 0x10d0
movl 0xc(%rsp), %eax
movq %rax, 0x68(%rsp)
leaq 0xa0(%rsp), %rsi
leaq 0x28be(%rip), %r15      # 0x43d0
xorl %eax, %eax
movq 0x38(%rsp), %rbp
movq %r12, %rcx
movq %r12, 0x60(%rsp)
movq $0x0, 0x48(%rsp)
movq %rax, 0x50(%rsp)
leal 0x1(%rax), %r14d
movl 0xc(%rsp), %edi
movl %r14d, %edx
movq 0x20(%rsp), %r8
movq 0x28(%rsp), %r9
callq 0x283c
movq %rax, %rbx
leaq 0x20a0(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movq %rbp, %rdx
movl %r14d, %ecx
xorl %eax, %eax
callq 0x11b0
movq %r12, %rdi
leaq 0x286e(%rip), %rsi      # 0x43df
callq 0x14cc
movq %rax, %r15
leaq 0x10a0(%rsp), %r12
movq %r12, %rdi
leaq 0x2857(%rip), %rsi      # 0x43e2
movq %rbp, %rdx
movl %r14d, 0x18(%rsp)
movl %r14d, %ecx
xorl %eax, %eax
callq 0x11b0
movq %r12, %rdi
leaq 0x2838(%rip), %rsi      # 0x43df
callq 0x14cc
movq %rax, 0x40(%rsp)
movl $0x8, %esi
movl $0x1, %edx
leaq 0x30(%rsp), %rdi
movq %r13, %rcx
callq 0x1090
movl $0x1, %r12d
testq %rax, %rax
je 0x1d16
xorl %r14d, %r14d
xorl %ebp, %ebp
movq %r13, 0x58(%rsp)
movq 0x30(%rsp), %rsi
leaq 0x2804(%rip), %rdi      # 0x43f1
movq %r14, %rdx
xorl %eax, %eax
callq 0x10d0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2eac
addq 0x30(%rsp), %r14
incq %rbp
cmpq 0x68(%rsp), %rbp
jne 0x1c96
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %r13
leaq 0x48(%rsp), %r12
movq %r12, %rdx
movl 0x18(%rsp), %ebp
movl %ebp, %r8d
movl 0x14(%rsp), %r9d
callq 0x14f0
movl $0x8, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %r13, %r12
movq 0x58(%rsp), %r13
movq 0x40(%rsp), %rcx
callq 0x11d0
movq %rbx, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x2b5d
movl 0xc(%rsp), %edi
leaq 0xa0(%rsp), %rsi
movl %ebp, %edx
movq 0x60(%rsp), %rcx
movq 0x20(%rsp), %r8
movq 0x28(%rsp), %r9
callq 0x283c
movq %rax, %rbx
incq %r12
movq $0x0, 0x48(%rsp)
xorl %ebp, %ebp
movl $0x8, %esi
movl $0x1, %edx
leaq 0x30(%rsp), %rdi
movq %r13, %rcx
callq 0x1090
testq %rax, %rax
jne 0x1be1
testq %rbp, %rbp
je 0x1d16
cmpq $0x1, %r12
sete %al
cmpl $0x0, 0x50(%rsp)
sete %cl
testb %al, %cl
jne 0x205f
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %r13
leaq 0x48(%rsp), %r12
movq %r12, %rdx
movl 0x18(%rsp), %r14d
movl %r14d, %r8d
movl 0x14(%rsp), %r9d
callq 0x14f0
movl $0x8, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %r13, %r12
movq 0x58(%rsp), %r13
movq 0x40(%rsp), %rcx
callq 0x11d0
jmp 0x1d1d
xorl %ebp, %ebp
movl 0x18(%rsp), %r14d
movq %rbx, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq 0x2b5d
movq %r15, %rdi
callq 0x10b0
movq %r13, %rdi
callq 0x10b0
movq 0x40(%rsp), %rdi
callq 0x10b0
cmpl $0x0, 0x10(%rsp)
movl %r14d, %ebx
je 0x1d69
leaq -0x1(%r12), %rsi
leaq 0x26a2(%rip), %rdi      # 0x43fd
movl 0xc(%rsp), %edx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x10d0
cmpl $0x0, 0x50(%rsp)
leaq 0x265b(%rip), %r15      # 0x43d0
leaq 0x2666(%rip), %r14      # 0x43e2
leaq 0x30a0(%rsp), %r13
je 0x1d9b
leaq 0xa0(%rsp), %rdi
callq 0x1060
movq %r13, %rdi
callq 0x1060
leaq 0xa0(%rsp), %rdi
movq %r15, %rsi
movq 0x38(%rsp), %rbp
movq %rbp, %rdx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x11b0
movq %r13, %rdi
movq %r14, %rsi
movq %rbp, %rdx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x11b0
movq %r13, %rdi
leaq 0x25c8(%rip), %rsi      # 0x439b
callq 0x1160
leaq 0xa0(%rsp), %rsi
movq %rax, %r13
movl %ebx, %eax
cmpq 0x68(%rsp), %r12
movq 0x60(%rsp), %rcx
ja 0x1b21
movq %rcx, %r15
cmpl $0x0, 0x1c(%rsp)
je 0x1e2e
leaq 0x264d(%rip), %rdi      # 0x4453
callq 0x1080
leaq 0x80(%rsp), %rbx
movq (%rbx), %rdi
leaq 0x78(%rsp), %r14
movq (%r14), %rsi
callq 0x2134
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2110
cmpl $0x0, 0x10(%rsp)
movq 0x28(%rsp), %rbx
je 0x1e50
leaq 0x25c9(%rip), %rdi      # 0x440a
movl $0x1, %esi
movq %r12, %rdx
xorl %eax, %eax
callq 0x10d0
leaq 0x2544(%rip), %rsi      # 0x439b
leaq 0x10a0(%rsp), %rdi
callq 0x14cc
movq %rax, %r14
leaq 0x20a0(%rsp), %rsi
movl %r12d, %edi
xorl %edx, %edx
movl %r15d, %ecx
movq 0x20(%rsp), %r8
movq %rbx, %r9
callq 0x283c
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x1090
testq %rax, %rax
je 0x1eef
leaq 0x2547(%rip), %r15      # 0x43f1
leaq 0x30(%rsp), %r12
xorl %r13d, %r13d
movq 0x30(%rsp), %rbp
movq %r15, %rdi
movq %rbp, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x10d0
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2eac
addq %rbp, %r13
movl $0x8, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %r14, %rcx
callq 0x1090
testq %rax, %rax
jne 0x1eb2
movq %r14, %rdi
callq 0x10b0
movl 0x1c(%rsp), %ebp
leaq 0x2511(%rip), %rsi      # 0x4413
leaq 0xa0(%rsp), %r14
movq %r14, %rdi
movq 0x38(%rsp), %rdx
movq 0x20(%rsp), %rcx
xorl %eax, %eax
callq 0x11b0
leaq 0x24ba(%rip), %rsi      # 0x43df
movq %r14, %rdi
callq 0x14cc
movq %rax, %r14
leaq 0x98(%rsp), %r15
movq $0x0, (%r15)
movq %rbx, %rdi
movq %rax, %rsi
movq %r15, %rdx
xorl %r8d, %r8d
movl 0x14(%rsp), %r13d
movl %r13d, %r9d
callq 0x14f0
movq (%r15), %r12
movq 0x70(%rsp), %r15
leaq 0x24b6(%rip), %rdi      # 0x441d
movq %r12, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x10d0
testl %r13d, %r13d
movl 0x18(%rsp), %r13d
je 0x1fb6
subq %r12, %r15
jle 0x1fb6
movslq 0x14(%rsp), %r12
movslq 0x218(%rbx), %rax
shlq $0x4, %rax
leaq 0x20e6(%rip), %rcx      # 0x4080
andq (%rax,%rcx), %r12
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
xorl %ecx, %ecx
movl %r13d, %r8d
callq 0x302c
decq %r15
jne 0x1f9e
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x2b5d
movq %r14, %rdi
callq 0x10b0
testl %ebp, %ebp
jne 0x20ba
leaq 0x2459(%rip), %rdi      # 0x4433
leaq 0xa0(%rsp), %rbx
movq %rbx, %rsi
xorl %eax, %eax
callq 0x10d0
leaq 0x20a0(%rsp), %rdi
callq 0x1060
leaq 0x10a0(%rsp), %rdi
callq 0x1060
leaq 0x2317(%rip), %rsi      # 0x4324
movq %rbx, %rdi
movq 0x38(%rsp), %r15
movq %r15, %rdx
xorl %eax, %eax
callq 0x11b0
leaq 0x230a(%rip), %rsi      # 0x4330
leaq 0x30a0(%rsp), %r14
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x11b0
movq %rbx, %rdi
callq 0x1060
movq %r14, %rdi
callq 0x1060
xorl %eax, %eax
addq $0x40a8, %rsp           # imm = 0x40A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
callq 0x10b0
movq %r13, %rdi
callq 0x10b0
movq 0x40(%rsp), %rdi
callq 0x10b0
leaq 0x10a0(%rsp), %rdi
callq 0x1060
leaq 0x20a0(%rsp), %rdi
callq 0x1060
cmpl $0x0, 0x10(%rsp)
je 0x1ef7
leaq 0x2358(%rip), %rdi      # 0x43fd
xorl %esi, %esi
movl 0xc(%rsp), %edx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x10d0
jmp 0x1ef7
leaq 0x80(%rsp), %rdi
leaq 0x78(%rsp), %rsi
leaq 0x90(%rsp), %rdx
leaq 0x88(%rsp), %rcx
callq 0x122a
jmp 0x1fd3
movq (%rbx), %rdi
callq 0x1777
callq 0x12b9
callq 0x1294
leaq 0x220b(%rip), %rdi      # 0x4305
callq 0x1080
movl $0x1, %edi
callq 0x11c0
callq 0x1215
nop