// File: /workspace/github_c_makefile_star2_O0/felipelouza[P]egap/multiround.c
// Function: multiround
void multiround(bool hm, int group_size,char *path, g_data *input, int num_threads)
{
  customInt offset, tot_symb=0;
  // threads related
  pc_system merge;
  pthread_t t[num_threads];
  g_data buffer[Threads_buf_size];
  int e;
  
  // init threads
  if(num_threads>0) {
    pc_system_init(&merge,Threads_buf_size);
    merge.buffer = (void *) buffer;
    merge.hm = hm;
    for(int i=0;i<num_threads;i++) {
      e = pthread_create(&t[i], NULL, merger, &merge);
      if(e) die("multiround create");
    }
    if(input->verbose>0) printf("%d merger threads created\n",num_threads);
  }
  
  // multiround merging  
  for(int r=0; ;r++) {     // do as many rounds as necessary
    
    if(input->numBwt<= 2*group_size-1 ) 
       break;  // we have reached the last round (or almost)
       
    // main loop to be executed by parallel threads
    // offset is within the number of bwt
    if(num_threads>0) {
      e = pthread_mutex_lock(&merge.remutex);
      if(e) die("remaining lock 1");
      merge.remaining = (input->numBwt+group_size-1)/group_size; // parallel merges in this round
      e= pthread_mutex_unlock(&merge.remutex);
      if(e) die("remaining unlock 1");
    }
    tot_symb = 0; 
    for(offset=0; offset < input->numBwt; offset += group_size) {
      g_data g=*input; // copy current status
      if(g.verbose>2) printf("Round %d, NumBwt offset "CUSTOM_FORMAT"\n",r,offset);
      g.bws = input->bws+offset;
      g.bwtLen = input->bwtLen+offset;
      if(input->smallAlpha) g.bwtOcc = input->bwtOcc+offset;
      g.numBwt = min(group_size, input->numBwt - offset);
      g.symb_offset = tot_symb;
      g.mergeLen=0;
      for(int i=0;i<g.numBwt;i++) g.mergeLen += g.bwtLen[i];
      if(input->lcpCompute) {
        assert(!input->bwtOnly && !input->lcpMerge);
        g.bwtOnly = true;      // since this is not the last round we can only
        g.lcpCompute = false;  // compute the BWT and ignore LCP  
      }
      // prepare access to lcp values
      if(g.lcpMerge) g.lcps = input->lcps+offset;
      // execute merge, possibly using threads 
      if(num_threads>0) {
        e = sem_wait(merge.free_slots); if(e) die("multiround producer wait");
        check_g_data(&g);
        buffer[merge.pindex++ % merge.buf_size]=g; // copy g_data to buffer
        e = sem_post(merge.ready);  if(e) die("multiround producer post");
      }
      else { // no helper threads
        if (hm) holtMcMillan(&g, false);
        else gap(&g, false);
        // update input via g
        for(int i=1;i<g.numBwt;i++) {
          g.bwtLen[0] += g.bwtLen[i];
          if(g.smallAlpha)
            for(int j=0;j<g.sizeOfAlpha;j++)
              g.bwtOcc[0][j] += g.bwtOcc[i][j];
        }
        assert(g.bwtLen[0]==g.mergeLen);
      }
      // update tot_symb seen so far
      tot_symb += g.mergeLen;
    } // end of inner parallelizable loop
    assert(input->mergeLen==tot_symb);
    // --- wait till all merges for this round have been completed 
    if(num_threads>0) {
      e = pthread_mutex_lock(&merge.remutex); if(e) die("remaining lock 2");
      while(merge.remaining>0) {
        e = pthread_cond_wait(&merge.recond,&merge.remutex);
        if(e) die("remaining wait");
      }
      e = pthread_mutex_unlock(&merge.remutex); if(e) die("remaining unlock 2");
      assert(merge.pindex==merge.cindex);
      if(input->verbose>1) puts("Threads syncronized, round completed");
    }
    // merged done for all segments. merged bwt/lcp are in g.bws[0][] and g.lcps[0] (if g.lcpMerge==true)

    // update input so that it consists of fewer, larger segments. move Len and Occ real entries to the left
    for(offset=0; offset < input->numBwt; offset += group_size) {
      input->bwtLen[offset/group_size] = input->bwtLen[offset];
      input->bws[offset/group_size] = input->bws[offset];
      if(input->lcpMerge) input->lcps[offset/group_size] = input->lcps[offset];;
      // replace with a swap ??? 
      if(input->smallAlpha)
        for(int j=0;j<input->sizeOfAlpha;j++)
          input->bwtOcc[offset/group_size][j] = input->bwtOcc[offset][j];
    }
    input->numBwt = (input->numBwt+group_size-1)/group_size;
    check_g_data(input);
    if(input->verbose>0)  printf("Round %d complete: %d merged bwt/lcp saved\n",r,input->numBwt);
  } // end of all rounds except last
  if(num_threads>0) {  // last round does not use threads, kill consumers
    g_data g; // dummy task
    g.numBwt = 0;
    g.verbose = input->verbose;
    for(int i=0;i<num_threads;i++) {
        e = sem_wait(merge.free_slots); if(e) die("cleaning producer wait");
        buffer[merge.pindex++ % merge.buf_size]=g; // copy g_data to buffer
        e = sem_post(merge.ready);  if(e) die("cleaning producer post");
    }
    for(int i=0;i<num_threads;i++) {
      e = pthread_join(t[i], NULL);
      if(e) die("multiround join");
    }
    pc_system_destroy(&merge);
    if(input->verbose>1) printf("%d merge threads destroyed\n",num_threads);
  }
  // here maybe there is an additional round to go from n<2g, to g;
  // there is some code duplication, but it is an important special case 
  if(input->numBwt > group_size) { 
    offset = group_size-1; // first BWT to consider 
    tot_symb = 0;          // total number of symbols to skip
    for(int i=0;i<offset;i++)
      tot_symb += input->bwtLen[i];
    // prepare merge task  
    g_data g=*input; // copy current status
    if(g.verbose>2) printf("Special round, NumBwt offset "CUSTOM_FORMAT"\n",offset);
    g.bws = input->bws+offset;
    g.bwtLen = input->bwtLen+offset;
    if(input->smallAlpha) g.bwtOcc = input->bwtOcc+offset;
    g.numBwt = input->numBwt - offset;
    assert(g.numBwt <= group_size);
    g.symb_offset = tot_symb;
    g.mergeLen=0;
    for(int i=0;i<g.numBwt;i++) g.mergeLen += g.bwtLen[i];
    if(input->lcpCompute) {
      assert(!input->bwtOnly && !input->lcpMerge);
      g.bwtOnly = true;      // since this is not the last round we can only
      g.lcpCompute = false;  // compute the BWT and ignore LCP  
    }
    if(g.lcpMerge) g.lcps = input->lcps+offset;
    // execute merge 
    if (hm) holtMcMillan(&g, false);
    else gap(&g, false);
    // update input via g
    for(int i=1;i<g.numBwt;i++) {
      g.bwtLen[0] += g.bwtLen[i];
      if(g.smallAlpha)
        for(int j=0;j<g.sizeOfAlpha;j++)
          g.bwtOcc[0][j] += g.bwtOcc[i][j];
    }
    assert(g.bwtLen[0]==g.mergeLen);
    // update input so that it consists of fewer, larger segments. move Len and Occ real entries to the left
    input->numBwt = (input->numBwt-g.numBwt+1);
    assert(input->numBwt==group_size);
    check_g_data(input);
  }
  assert(input->numBwt <= group_size);
  // execute last round (only point where gap/hm with lastRound==true is called) 
  if (hm) holtMcMillan(input, true);
  else gap(input, true);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x74b60, %rsp          # imm = 0x74B60
movb %dil, %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movl %esi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movq $0x0, -0x30(%rbp)
movl -0x1c(%rbp), %eax
movq %rsp, %rcx
movq %rcx, -0xe8(%rbp)
leaq 0xf(,%rax,8), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x74b18(%rbp)
movq %rcx, %rsp
movq %rax, -0xf0(%rbp)
cmpl $0x0, -0x1c(%rbp)
jle 0x134ea
leaq -0xe0(%rbp), %rdi
movl $0x14, %esi
callq 0x12dc0
leaq -0x65770(%rbp), %rax
movq %rax, -0xa0(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
movb %al, -0x38(%rbp)
movl $0x0, -0x65778(%rbp)
movl -0x65778(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x134ca
movq -0x74b18(%rbp), %rdi
movslq -0x65778(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
leaq -0x390(%rip), %rdx      # 0x13100
leaq -0xe0(%rbp), %rcx
callq 0x22c0
movl %eax, -0x65774(%rbp)
cmpl $0x0, -0x65774(%rbp)
je 0x134b7
leaq 0x3131(%rip), %rdi      # 0x165e3
callq 0x3ce0
jmp 0x134b9
movl -0x65778(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x65778(%rbp)
jmp 0x13465
movq -0x18(%rbp), %rax
cmpl $0x0, 0x94(%rax)
jle 0x134e8
movl -0x1c(%rbp), %esi
leaq 0x3114(%rip), %rdi      # 0x165f5
movb $0x0, %al
callq 0x20f0
jmp 0x134ea
movl $0x0, -0x6577c(%rbp)
movq -0x18(%rbp), %rax
movl 0x20(%rax), %eax
movl -0x8(%rbp), %ecx
shll %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jg 0x1350c
jmp 0x13b86
cmpl $0x0, -0x1c(%rbp)
jle 0x13581
leaq -0xe0(%rbp), %rdi
addq $0x50, %rdi
callq 0x23e0
movl %eax, -0x65774(%rbp)
cmpl $0x0, -0x65774(%rbp)
je 0x1353d
leaq 0x30d8(%rip), %rdi      # 0x16610
callq 0x3ce0
movq -0x18(%rbp), %rax
movl 0x20(%rax), %eax
addl -0x8(%rbp), %eax
subl $0x1, %eax
cltd
idivl -0x8(%rbp)
movl %eax, -0x94(%rbp)
leaq -0xe0(%rbp), %rdi
addq $0x50, %rdi
callq 0x2230
movl %eax, -0x65774(%rbp)
cmpl $0x0, -0x65774(%rbp)
je 0x1357f
leaq 0x30a7(%rip), %rdi      # 0x16621
callq 0x3ce0
jmp 0x13581
movq $0x0, -0x30(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq 0x20(%rcx), %rcx
cmpq %rcx, %rax
jae 0x138b9
movq -0x18(%rbp), %rsi
leaq -0x6a8a0(%rbp), %rdi
movl $0x5120, %edx           # imm = 0x5120
callq 0x21e0
cmpl $0x2, -0x6a80c(%rbp)
jle 0x135dc
movl -0x6577c(%rbp), %esi
movq -0x28(%rbp), %rdx
leaq 0x305f(%rip), %rdi      # 0x16634
movb $0x0, %al
callq 0x20f0
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x28(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x6a8a0(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x28(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x6a898(%rbp)
movq -0x18(%rbp), %rax
testb $0x1, 0x68(%rax)
je 0x13633
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x28(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x6a888(%rbp)
movslq -0x8(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq 0x20(%rcx), %rcx
subq -0x28(%rbp), %rcx
cmpq %rcx, %rax
jae 0x13655
movslq -0x8(%rbp), %rax
movq %rax, -0x74b20(%rbp)
jmp 0x13668
movq -0x18(%rbp), %rax
movslq 0x20(%rax), %rax
subq -0x28(%rbp), %rax
movq %rax, -0x74b20(%rbp)
movq -0x74b20(%rbp), %rax
movl %eax, -0x6a880(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x6a870(%rbp)
movq $0x0, -0x6a878(%rbp)
movl $0x0, -0x6a8a4(%rbp)
movl -0x6a8a4(%rbp), %eax
cmpl -0x6a880(%rbp), %eax
jge 0x136d4
movq -0x6a898(%rbp), %rax
movslq -0x6a8a4(%rbp), %rcx
movq (%rax,%rcx,8), %rax
addq -0x6a878(%rbp), %rax
movq %rax, -0x6a878(%rbp)
movl -0x6a8a4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6a8a4(%rbp)
jmp 0x13695
movq -0x18(%rbp), %rax
testb $0x1, 0x3e(%rax)
je 0x136ec
movb $0x1, -0x6a864(%rbp)
movb $0x0, -0x6a862(%rbp)
testb $0x1, -0x6a863(%rbp)
je 0x13712
movq -0x18(%rbp), %rax
movq 0x88(%rax), %rax
movq -0x28(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x6a818(%rbp)
cmpl $0x0, -0x1c(%rbp)
jle 0x137b8
movq -0xb0(%rbp), %rdi
callq 0x2070
movl %eax, -0x65774(%rbp)
cmpl $0x0, -0x65774(%rbp)
je 0x13743
leaq 0x2f13(%rip), %rdi      # 0x16651
callq 0x3ce0
leaq -0x6a8a0(%rbp), %rdi
callq 0x3dd0
movl -0xe0(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0xe0(%rbp)
cltd
idivl -0x98(%rbp)
movslq %edx, %rax
leaq -0x65770(%rbp), %rdi
imulq $0x5120, %rax, %rax     # imm = 0x5120
addq %rax, %rdi
leaq -0x6a8a0(%rbp), %rsi
movl $0x5120, %edx           # imm = 0x5120
callq 0x21e0
movq -0xa8(%rbp), %rdi
callq 0x2160
movl %eax, -0x65774(%rbp)
cmpl $0x0, -0x65774(%rbp)
je 0x137b3
leaq 0x2ebc(%rip), %rdi      # 0x1666a
callq 0x3ce0
jmp 0x13899
testb $0x1, -0x1(%rbp)
je 0x137ce
leaq -0x6a8a0(%rbp), %rdi
xorl %esi, %esi
callq 0x11a30
jmp 0x137dc
leaq -0x6a8a0(%rbp), %rdi
xorl %esi, %esi
callq 0xec00
movl $0x1, -0x6a8a8(%rbp)
movl -0x6a8a8(%rbp), %eax
cmpl -0x6a880(%rbp), %eax
jge 0x13897
movq -0x6a898(%rbp), %rax
movslq -0x6a8a8(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movq -0x6a898(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
testb $0x1, -0x6a838(%rbp)
je 0x13881
movl $0x0, -0x6a8ac(%rbp)
movl -0x6a8ac(%rbp), %eax
cmpl -0x6a868(%rbp), %eax
jge 0x1387f
movq -0x6a888(%rbp), %rax
movslq -0x6a8a8(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x6a8ac(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq -0x6a888(%rbp), %rax
movq (%rax), %rax
movslq -0x6a8ac(%rbp), %rcx
addq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movl -0x6a8ac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6a8ac(%rbp)
jmp 0x1382a
jmp 0x13881
jmp 0x13883
movl -0x6a8a8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6a8a8(%rbp)
jmp 0x137e6
jmp 0x13899
movq -0x6a878(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movslq -0x8(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x13591
cmpl $0x0, -0x1c(%rbp)
jle 0x13977
leaq -0xe0(%rbp), %rdi
addq $0x50, %rdi
callq 0x23e0
movl %eax, -0x65774(%rbp)
cmpl $0x0, -0x65774(%rbp)
je 0x138ee
leaq 0x2d9a(%rip), %rdi      # 0x16683
callq 0x3ce0
jmp 0x138f0
cmpl $0x0, -0x94(%rbp)
jle 0x13931
leaq -0xe0(%rbp), %rdi
addq $0x78, %rdi
leaq -0xe0(%rbp), %rsi
addq $0x50, %rsi
callq 0x20b0
movl %eax, -0x65774(%rbp)
cmpl $0x0, -0x65774(%rbp)
je 0x1392f
leaq 0x2d6a(%rip), %rdi      # 0x16694
callq 0x3ce0
jmp 0x138f0
leaq -0xe0(%rbp), %rdi
addq $0x50, %rdi
callq 0x2230
movl %eax, -0x65774(%rbp)
cmpl $0x0, -0x65774(%rbp)
je 0x1395c
leaq 0x2d4c(%rip), %rdi      # 0x166a3
callq 0x3ce0
movq -0x18(%rbp), %rax
cmpl $0x1, 0x94(%rax)
jle 0x13975
leaq 0x2d46(%rip), %rdi      # 0x166b6
callq 0x2080
jmp 0x13977
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq 0x20(%rcx), %rcx
cmpq %rcx, %rax
jae 0x13b25
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x74b40(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x74b38(%rbp)
movq -0x28(%rbp), %rax
movslq -0x8(%rbp), %rcx
xorl %edx, %edx
divq %rcx
movq -0x74b40(%rbp), %rdx
movq %rax, %rcx
movq -0x74b38(%rbp), %rax
movq %rdx, (%rax,%rcx,8)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x74b30(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x74b28(%rbp)
movq -0x28(%rbp), %rax
movslq -0x8(%rbp), %rcx
xorl %edx, %edx
divq %rcx
movq -0x74b30(%rbp), %rdx
movq %rax, %rcx
movq -0x74b28(%rbp), %rax
movq %rdx, (%rax,%rcx,8)
movq -0x18(%rbp), %rax
testb $0x1, 0x3d(%rax)
je 0x13a7a
movq -0x18(%rbp), %rax
movq 0x88(%rax), %rax
movq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x74b50(%rbp)
movq -0x18(%rbp), %rax
movq 0x88(%rax), %rax
movq %rax, -0x74b48(%rbp)
movq -0x28(%rbp), %rax
movslq -0x8(%rbp), %rcx
xorl %edx, %edx
divq %rcx
movq -0x74b50(%rbp), %rdx
movq %rax, %rcx
movq -0x74b48(%rbp), %rax
movq %rdx, (%rax,%rcx,8)
movq -0x18(%rbp), %rax
testb $0x1, 0x68(%rax)
je 0x13b12
movl $0x0, -0x6a8b0(%rbp)
movl -0x6a8b0(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x38(%rcx), %eax
jge 0x13b10
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x28(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x6a8b0(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x74b60(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x74b58(%rbp)
movq -0x28(%rbp), %rax
movslq -0x8(%rbp), %rcx
xorl %edx, %edx
divq %rcx
movq -0x74b60(%rbp), %rdx
movq %rax, %rcx
movq -0x74b58(%rbp), %rax
movq (%rax,%rcx,8), %rax
movslq -0x6a8b0(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x6a8b0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6a8b0(%rbp)
jmp 0x13a92
jmp 0x13b12
jmp 0x13b14
movslq -0x8(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x1397f
movq -0x18(%rbp), %rax
movl 0x20(%rax), %eax
addl -0x8(%rbp), %eax
subl $0x1, %eax
cltd
idivl -0x8(%rbp)
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x18(%rbp), %rdi
callq 0x3dd0
movq -0x18(%rbp), %rax
cmpl $0x0, 0x94(%rax)
jle 0x13b70
movl -0x6577c(%rbp), %esi
movq -0x18(%rbp), %rax
movl 0x20(%rax), %edx
leaq 0x2b72(%rip), %rdi      # 0x166db
movb $0x0, %al
callq 0x20f0
jmp 0x13b72
movl -0x6577c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6577c(%rbp)
jmp 0x134f4
cmpl $0x0, -0x1c(%rbp)
jle 0x13cee
movl $0x0, -0x6f9b0(%rbp)
movq -0x18(%rbp), %rax
movl 0x94(%rax), %eax
movl %eax, -0x6f93c(%rbp)
movl $0x0, -0x6f9d4(%rbp)
movl -0x6f9d4(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x13c64
movq -0xb0(%rbp), %rdi
callq 0x2070
movl %eax, -0x65774(%rbp)
cmpl $0x0, -0x65774(%rbp)
je 0x13bea
leaq 0x2b22(%rip), %rdi      # 0x16707
callq 0x3ce0
movl -0xe0(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0xe0(%rbp)
cltd
idivl -0x98(%rbp)
movslq %edx, %rax
leaq -0x65770(%rbp), %rdi
imulq $0x5120, %rax, %rax     # imm = 0x5120
addq %rax, %rdi
leaq -0x6f9d0(%rbp), %rsi
movl $0x5120, %edx           # imm = 0x5120
callq 0x21e0
movq -0xa8(%rbp), %rdi
callq 0x2160
movl %eax, -0x65774(%rbp)
cmpl $0x0, -0x65774(%rbp)
je 0x13c4e
leaq 0x2ad5(%rip), %rdi      # 0x1671e
callq 0x3ce0
jmp 0x13c50
movl -0x6f9d4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6f9d4(%rbp)
jmp 0x13bb4
movl $0x0, -0x6f9d8(%rbp)
movl -0x6f9d8(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x13cc2
movq -0x74b18(%rbp), %rax
movslq -0x6f9d8(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2390
movl %eax, -0x65774(%rbp)
cmpl $0x0, -0x65774(%rbp)
je 0x13caf
leaq 0x2a8b(%rip), %rdi      # 0x16735
callq 0x3ce0
jmp 0x13cb1
movl -0x6f9d8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6f9d8(%rbp)
jmp 0x13c6e
leaq -0xe0(%rbp), %rdi
callq 0x13040
movq -0x18(%rbp), %rax
cmpl $0x1, 0x94(%rax)
jle 0x13cec
movl -0x1c(%rbp), %esi
leaq 0x2a60(%rip), %rdi      # 0x16745
movb $0x0, %al
callq 0x20f0
jmp 0x13cee
movq -0x18(%rbp), %rax
movl 0x20(%rax), %eax
cmpl -0x8(%rbp), %eax
jle 0x13f8a
movl -0x8(%rbp), %eax
subl $0x1, %eax
cltq
movq %rax, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movl $0x0, -0x6f9dc(%rbp)
movslq -0x6f9dc(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0x13d55
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x6f9dc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movl -0x6f9dc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6f9dc(%rbp)
jmp 0x13d1c
movq -0x18(%rbp), %rsi
leaq -0x74b00(%rbp), %rdi
movl $0x5120, %edx           # imm = 0x5120
callq 0x21e0
cmpl $0x2, -0x74a6c(%rbp)
jle 0x13d85
movq -0x28(%rbp), %rsi
leaq 0x29e3(%rip), %rdi      # 0x16761
movb $0x0, %al
callq 0x20f0
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x28(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x74b00(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x28(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x74af8(%rbp)
movq -0x18(%rbp), %rax
testb $0x1, 0x68(%rax)
je 0x13ddc
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x28(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x74ae8(%rbp)
movq -0x18(%rbp), %rax
movslq 0x20(%rax), %rax
subq -0x28(%rbp), %rax
movl %eax, -0x74ae0(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x74ad0(%rbp)
movq $0x0, -0x74ad8(%rbp)
movl $0x0, -0x74b04(%rbp)
movl -0x74b04(%rbp), %eax
cmpl -0x74ae0(%rbp), %eax
jge 0x13e4d
movq -0x74af8(%rbp), %rax
movslq -0x74b04(%rbp), %rcx
movq (%rax,%rcx,8), %rax
addq -0x74ad8(%rbp), %rax
movq %rax, -0x74ad8(%rbp)
movl -0x74b04(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74b04(%rbp)
jmp 0x13e0e
movq -0x18(%rbp), %rax
testb $0x1, 0x3e(%rax)
je 0x13e65
movb $0x1, -0x74ac4(%rbp)
movb $0x0, -0x74ac2(%rbp)
testb $0x1, -0x74ac3(%rbp)
je 0x13e8b
movq -0x18(%rbp), %rax
movq 0x88(%rax), %rax
movq -0x28(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x74a78(%rbp)
testb $0x1, -0x1(%rbp)
je 0x13ea1
leaq -0x74b00(%rbp), %rdi
xorl %esi, %esi
callq 0x11a30
jmp 0x13eaf
leaq -0x74b00(%rbp), %rdi
xorl %esi, %esi
callq 0xec00
movl $0x1, -0x74b08(%rbp)
movl -0x74b08(%rbp), %eax
cmpl -0x74ae0(%rbp), %eax
jge 0x13f6a
movq -0x74af8(%rbp), %rax
movslq -0x74b08(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movq -0x74af8(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
testb $0x1, -0x74a98(%rbp)
je 0x13f54
movl $0x0, -0x74b0c(%rbp)
movl -0x74b0c(%rbp), %eax
cmpl -0x74ac8(%rbp), %eax
jge 0x13f52
movq -0x74ae8(%rbp), %rax
movslq -0x74b08(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x74b0c(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq -0x74ae8(%rbp), %rax
movq (%rax), %rax
movslq -0x74b0c(%rbp), %rcx
addq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movl -0x74b0c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74b0c(%rbp)
jmp 0x13efd
jmp 0x13f54
jmp 0x13f56
movl -0x74b08(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74b08(%rbp)
jmp 0x13eb9
movq -0x18(%rbp), %rax
movl 0x20(%rax), %ecx
subl -0x74ae0(%rbp), %ecx
addl $0x1, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x18(%rbp), %rdi
callq 0x3dd0
testb $0x1, -0x1(%rbp)
je 0x13fa0
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0x11a30
jmp 0x13fae
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0xec00
movq -0xe8(%rbp), %rax
movq %rax, %rsp
movq %rbp, %rsp
popq %rbp
retq