// File: /workspace/github_c_makefile_star2_O0/felipelouza[P]egap/mergegap.c
// Function: addCharToPrefix
static bool addCharToPrefix(solidBlockFile *solidHead, liquidBlock *liquid, customInt prefixLength, bool *mergeChanged, const int round, g_data *g) {
  assert(liquid->empty);
  liquid->beginsAt = liquid->endsAt = 0;  
  for(int i=0;i<liquid->occ_size;i++) assert(liquid->occ[i]==0);
  // copy first column to F 
  array_copy(g->F, g->firstColumn, g->sizeOfAlpha); //initialize char positions
  // pointer inside each BWT (k_0 & k_1 in the pseudocode)
  array_clear(g->inCnt,g->numBwt,0);
  if(g->extMem) {
    rewind_bw_files(g);  // set file pointers at the beginning of each BWT 
    open_merge_files(g); // open merge file for reading and newmerge files for writing
  }
  // id for each character, init with an invalid id
  customInt blockID[g->sizeOfAlpha];
  array_clear(blockID,g->sizeOfAlpha, g->mergeLen);  // mergeLen is an invalid id
  customInt id = 0, k; 
  int m = (round%2==1) ? 1 : 2;  // mask for the bitB array
  uint64_t lcpWritten =0;

  protoBlock cblock = {.mono = false};
  solidBlock *next = readBlock(solidHead); // first block
  solidBlock *last = NULL;                 // previous block

  for (k = 0; k < g->mergeLen; ) { 
    assert(next==NULL || k <= next->beginsAt);  // we did not pass next block
    assert(last==NULL || last->nextBlock == next); // last is the immediately preceeding block

    // check if we are entering a block, and if the block is at least 2 iterations old
    bool start_block, last_block_recent=true; // for k=0 a new block starts, so last is properly initialized
    if(g->lcpMerge) {
      start_block = (g->blockBeginsAt[k]>0) && (g->blockBeginsAt[k] < prefixLength);
      if(start_block) last_block_recent = g->blockBeginsAt[k]>=prefixLength-1;
    }
    else 
      start_block = tba_block_test_set(g->bitB,k,m,&last_block_recent);    
    if(start_block && last_block_recent && g->lcpCompute)
      {writeLcp(k,prefixLength-2,g); lcpWritten++;} // save lcp value found in previous iteration
    if (start_block) {
      // if the block we just left is a singleton we add it to liquid that remains active
      if(!last_block_recent && cblock.mono==true && (cblock.beginsAt==k-1)) {
        cblock.endsAt = k;           // solidifiable singleton block just ended
        add_singleton2liquid(&cblock, liquid);
      }
      // if the block we left is not recent, monochrome, we are not computing LCPs and not using extMem add it  
      else if(!last_block_recent && cblock.mono==true && !g->lcpCompute && !g->extMem) {
        cblock.endsAt = k;           // solidifiable monochorome block just ended
        add_proto2liquid(&cblock,liquid);  // add proto to liquid that remains active 
      }
      else { // proto block cannot be added, close current liquid
        if(!liquid->empty)
          last = finalize_liquid(last,liquid,next,solidHead); // this is the only point where a new block is created
        assert(liquid->empty);
        liquid->beginsAt=liquid->endsAt=k; // start empty liquid block
      }
      assert(liquid->endsAt==k);
      // block ending at k considered, now look forward 
      if(next!=NULL && next->beginsAt==k) { // entering an irrelevant block
        skip(next, g);                      // skip block
        k = next->endsAt;                   // update k
        // merge liquid with next block and possibly previous 
        if(last==NULL || last->endsAt!=liquid->beginsAt) {
            if(!liquid->empty) merge_liquid(liquid,next,solidHead); // simple merge
            if(last!=NULL) writeBlock(last,solidHead);  // save current last  
            last = next;   // advance last           
        }
        else  //three way merge, next is freed, last does not change
          merge_sls(last,liquid,next,solidHead); // only point where a solid block can be destroyed  
        assert(liquid->empty);
        liquid->beginsAt=liquid->endsAt=k; // start empty liquid block
        next = readBlock(solidHead);       // next has become last, update next (was: next = last->nextBlock; )
        last->nextBlock = next;
        assert(k==last->endsAt);
        cblock.mono = false;        // prevent re-adding the just skipped block
        continue;                   // resume from the end of the block 
      }
      // we are entering a relevant block, unless it is a recent one make it a candidate for solidification  
      if( !last_block_recent ) {
        cblock.beginsAt = k; cblock.mono=true; 
        if(!g->extMem) { // monochrome blocks of length>1 are not used in external memory  
          cblock.color = g->mergeColor[k];
          cblock.start = &g->bws[cblock.color][g->inCnt[cblock.color]]; // bwt-position of first char in block
        }
      }
      else cblock.mono = false; // not a candidate for solid block, wait next iteration 
      if(last_block_recent) 
         id = k;    // id of the new block 
    }
    // processing a char in a relevant block
    int currentColor=0;   // b in pseudocode
    int currentChar=0;  // c in pseudocode: next char in current BWT 
    if(g->extMem) {
      assert(ftell(g->fmergeColor)==k*sizeof(palette));
      currentColor = fread_color(g->fmergeColor);
      assert(ftell(g->bwf[currentColor])==(g->inCnt[currentColor]+(g->bws[currentColor]-g->bws[0])+g->symb_offset)*sizeof(symbol)); 
      int e = fread(&currentChar,sizeof(symbol),1,g->bwf[currentColor]);
      if(e!=1) die("mergegap:addCharToPrefix:bwt[color]Read"); 
      g->inCnt[currentColor]++;
    }
    else {
      currentColor = g->mergeColor[k];
      currentChar  = g->bws[currentColor][g->inCnt[currentColor]++]; // c in pseudocode
    }
    // add currentChar/Color to proto block  
    cblock.lastChar =  currentChar;   // save lastchar, only useful for singleton blocks
    cblock.lastColor =  currentColor; // save lastcolor, only useful for singleton blocks
    if(!g->extMem)
      if(currentColor != cblock.color) cblock.mono = false;       // block is not monochrome
    // write color in new Z array, except 0 chars
    if(currentChar!=0) {
      customInt positionToUpdate = g->F[currentChar]++;
      if(g->extMem) {
        cwriter_put(&g->fnewMergeColor[currentChar],currentColor);
        assert(cwriter_tell(&g->fnewMergeColor[currentChar])==g->F[currentChar]*sizeof(palette));
        *mergeChanged=true; // this could be a problem....
      }
      else {
        g->newMergeColor[positionToUpdate] = currentColor;
        if(g->bwtOnly && !*mergeChanged && g->mergeColor[positionToUpdate]!=currentColor)
          *mergeChanged=true;  // remember there is a difference from the previous iteration
      }
      // create new block?
      if (blockID[currentChar] != id) {
        if(!g->lcpMerge) { // no lcp just mark B array 
          if(last_block_recent) tba_mark_if0(g->bitB,positionToUpdate,m);
        }
        else  // update lcp
          if(last_block_recent && g->blockBeginsAt[positionToUpdate]==0) // only 0 values in B are overwritten
            g->blockBeginsAt[positionToUpdate] = prefixLength;
        blockID[currentChar] = id; // update block id, always!
      }
    }
    k++;
  } // end main loop
  assert(k==g->mergeLen);
  assert(next==NULL); 
  if(cblock.mono==true && cblock.beginsAt==k-1) {
    cblock.endsAt = k;           // solidifiable singleton block just ended
    add_singleton2liquid(&cblock, liquid);
    assert(!liquid->empty);
  }
  else if(cblock.mono==true && !g->lcpCompute && !g->extMem) {
    cblock.endsAt = k;
    add_proto2liquid(&cblock,liquid);  // add proto to liquid that remains active
    assert(!liquid->empty);
  }
  if(!liquid->empty) 
    last = finalize_liquid(last,liquid,NULL,solidHead); // a new block could be created 
  assert(liquid->empty);
  // add EOF value to lcp file and entry to .size file 
  if(g->lcpCompute && lcpWritten>0)
    writeLcp_EOF(++lcpWritten, g);
  // check if all sequence has become irrelevant
  bool everything_irrelevant = false;
  if(last!=NULL && last->beginsAt==0 && last->endsAt==g->mergeLen)
    everything_irrelevant = true;
  // save last block   
  if(last!=NULL) writeBlock(last,solidHead);
  // check we have read all chars from all BWT's 
  for(int i=0; i<g->numBwt; i++)
    assert(g->inCnt[i]==g->bwtLen[i]);
    
  // swap merge and newMerge
  if(g->extMem) { // close merge files and swap file names 
    assert(ftell(g->fmergeColor)==g->mergeLen*sizeof(palette));
    assert(g->F[g->sizeOfAlpha-1]==g->mergeLen);
    assert(cwriter_tell(&g->fnewMergeColor[g->sizeOfAlpha-1])==g->mergeLen*sizeof(palette));
    close_merge_files(g);
    char *tmp=g->merge_fname; g->merge_fname = g->newmerge_fname; g->newmerge_fname = tmp;
  } else { // swap arrays 
    palette *tmp=g->mergeColor; g->mergeColor=g->newMergeColor; g->newMergeColor=tmp;
  }
  return everything_irrelevant;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq %r9, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x10(%rbp), %rax
movq $0x0, (%rax)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jge 0xfc9a
jmp 0xfc8f
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xfc81
movq -0x30(%rbp), %rax
movq 0x5110(%rax), %rdi
movq -0x30(%rbp), %rax
movq 0x5108(%rax), %rsi
movq -0x30(%rbp), %rax
movslq 0x38(%rax), %rdx
callq 0x3d70
movq -0x30(%rbp), %rax
movq 0x5118(%rax), %rdi
movq -0x30(%rbp), %rax
movslq 0x20(%rax), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x3310
movq -0x30(%rbp), %rax
testb $0x1, 0x69(%rax)
je 0xfcf5
movq -0x30(%rbp), %rdi
callq 0x6e70
movq -0x30(%rbp), %rdi
callq 0x11450
movq -0x30(%rbp), %rax
movl 0x38(%rax), %eax
movq %rsp, %rcx
movq %rcx, -0x40(%rbp)
leaq 0xf(,%rax,8), %rcx
andq $-0x10, %rcx
movq %rsp, %rdi
subq %rcx, %rdi
movq %rdi, -0xd8(%rbp)
movq %rdi, %rsp
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
movslq 0x38(%rax), %rsi
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rdx
callq 0x3310
movq $0x0, -0x50(%rbp)
movl -0x24(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl $0x2, %eax
movl $0x1, %ecx
cmpl $0x1, %edx
cmovel %ecx, %eax
movl %eax, -0x5c(%rbp)
movq $0x0, -0x68(%rbp)
leaq -0x90(%rbp), %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0x2140
movq -0x8(%rbp), %rdi
callq 0x10650
movq %rax, -0x98(%rbp)
movq $0x0, -0xa0(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq -0x30(%rbp), %rcx
cmpq 0x28(%rcx), %rax
jae 0x10398
movb $0x1, -0xa2(%rbp)
movq -0x30(%rbp), %rax
testb $0x1, 0x3d(%rax)
je 0xfe45
movq -0x30(%rbp), %rax
movq 0x98(%rax), %rax
movq -0x58(%rbp), %rcx
movzbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0xd9(%rbp)
jle 0xfe03
movq -0x30(%rbp), %rax
movq 0x98(%rax), %rax
movq -0x58(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpq -0x18(%rbp), %rax
setb %al
movb %al, -0xd9(%rbp)
movb -0xd9(%rbp), %al
andb $0x1, %al
movb %al, -0xa1(%rbp)
testb $0x1, -0xa1(%rbp)
je 0xfe43
movq -0x30(%rbp), %rax
movq 0x98(%rax), %rax
movq -0x58(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x18(%rbp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
setae %al
andb $0x1, %al
movb %al, -0xa2(%rbp)
jmp 0xfe6b
movq -0x30(%rbp), %rax
movq 0x98(%rax), %rdi
movq -0x58(%rbp), %rsi
movl -0x5c(%rbp), %edx
leaq -0xa2(%rbp), %rcx
callq 0x11180
andb $0x1, %al
movb %al, -0xa1(%rbp)
testb $0x1, -0xa1(%rbp)
je 0xfeaa
testb $0x1, -0xa2(%rbp)
je 0xfeaa
movq -0x30(%rbp), %rax
testb $0x1, 0x3e(%rax)
je 0xfeaa
movq -0x58(%rbp), %rdi
movq -0x18(%rbp), %rax
subq $0x2, %rax
movl %eax, %esi
movq -0x30(%rbp), %rdx
callq 0x4000
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
testb $0x1, -0xa1(%rbp)
je 0x10100
testb $0x1, -0xa2(%rbp)
jne 0xff01
movb -0x78(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0xff01
movq -0x90(%rbp), %rax
movq -0x58(%rbp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jne 0xff01
movq -0x58(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x90(%rbp), %rdi
callq 0x10950
jmp 0xff89
testb $0x1, -0xa2(%rbp)
jne 0xff48
movb -0x78(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0xff48
movq -0x30(%rbp), %rax
testb $0x1, 0x3e(%rax)
jne 0xff48
movq -0x30(%rbp), %rax
testb $0x1, 0x69(%rax)
jne 0xff48
movq -0x58(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x90(%rbp), %rdi
callq 0x109c0
jmp 0xff87
movq -0x10(%rbp), %rax
testb $0x1, 0x2c(%rax)
jne 0xff74
movq -0xa0(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x98(%rbp), %rdx
movq -0x8(%rbp), %rcx
callq 0x8a10
movq %rax, -0xa0(%rbp)
movq -0x58(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
jmp 0xff89
cmpq $0x0, -0x98(%rbp)
je 0x10089
movq -0x98(%rbp), %rax
movq (%rax), %rax
cmpq -0x58(%rbp), %rax
jne 0x10089
movq -0x98(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x10a80
movq -0x98(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
cmpq $0x0, -0xa0(%rbp)
je 0xffe8
movq -0xa0(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq (%rcx), %rax
je 0x10030
movq -0x10(%rbp), %rax
testb $0x1, 0x2c(%rax)
jne 0x10006
movq -0x10(%rbp), %rdi
movq -0x98(%rbp), %rsi
movq -0x8(%rbp), %rdx
callq 0x8af0
cmpq $0x0, -0xa0(%rbp)
je 0x10020
movq -0xa0(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x8db0
movq -0x98(%rbp), %rax
movq %rax, -0xa0(%rbp)
jmp 0x1004b
movq -0xa0(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x98(%rbp), %rdx
movq -0x8(%rbp), %rcx
callq 0x10e30
movq -0x58(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rdi
callq 0x10650
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rcx
movq -0xa0(%rbp), %rax
movq %rcx, 0x18(%rax)
movb $0x0, -0x78(%rbp)
jmp 0xfd9c
testb $0x1, -0xa2(%rbp)
jne 0x100e9
movq -0x58(%rbp), %rax
movq %rax, -0x90(%rbp)
movb $0x1, -0x78(%rbp)
movq -0x30(%rbp), %rax
testb $0x1, 0x69(%rax)
jne 0x100e7
movq -0x30(%rbp), %rax
movq 0x50e8(%rax), %rax
movq -0x58(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x74(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movslq -0x74(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x30(%rbp), %rcx
movq 0x5118(%rcx), %rcx
movslq -0x74(%rbp), %rdx
addq (%rcx,%rdx,8), %rax
movq %rax, -0x80(%rbp)
jmp 0x100ed
movb $0x0, -0x78(%rbp)
testb $0x1, -0xa2(%rbp)
je 0x100fe
movq -0x58(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x10100
movl $0x0, -0xa8(%rbp)
movl $0x0, -0xac(%rbp)
movq -0x30(%rbp), %rax
testb $0x1, 0x69(%rax)
je 0x10199
movq -0x30(%rbp), %rax
movq 0x50c8(%rax), %rdi
callq 0x11580
movl %eax, -0xa8(%rbp)
movq -0x30(%rbp), %rax
movq 0x50a0(%rax), %rax
movslq -0xa8(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
leaq -0xac(%rbp), %rdi
movl $0x1, %edx
movq %rdx, %rsi
callq 0x2090
movl %eax, -0xb0(%rbp)
cmpl $0x1, -0xb0(%rbp)
je 0x10179
leaq 0x60b4(%rip), %rdi      # 0x16228
callq 0x3ce0
movq -0x30(%rbp), %rax
movq 0x5118(%rax), %rax
movslq -0xa8(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
addq $0x1, %rdx
movq %rdx, (%rax,%rcx,8)
jmp 0x101ef
movq -0x30(%rbp), %rax
movq 0x50e8(%rax), %rax
movq -0x58(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0xa8(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movslq -0xa8(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x30(%rbp), %rcx
movq 0x5118(%rcx), %rdx
movslq -0xa8(%rbp), %rsi
movq (%rdx,%rsi,8), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rdx,%rsi,8)
movzbl (%rax,%rcx), %eax
movl %eax, -0xac(%rbp)
movl -0xac(%rbp), %eax
movl %eax, -0x70(%rbp)
movl -0xa8(%rbp), %eax
movl %eax, -0x6c(%rbp)
movq -0x30(%rbp), %rax
testb $0x1, 0x69(%rax)
jne 0x1021c
movl -0xa8(%rbp), %eax
cmpl -0x74(%rbp), %eax
je 0x1021a
movb $0x0, -0x78(%rbp)
jmp 0x1021c
cmpl $0x0, -0xac(%rbp)
je 0x10387
movq -0x30(%rbp), %rax
movq 0x5110(%rax), %rcx
movslq -0xac(%rbp), %rdx
movq (%rcx,%rdx,8), %rax
movq %rax, %rsi
addq $0x1, %rsi
movq %rsi, (%rcx,%rdx,8)
movq %rax, -0xb8(%rbp)
movq -0x30(%rbp), %rax
testb $0x1, 0x69(%rax)
je 0x1028b
movq -0x30(%rbp), %rax
movq 0x50d0(%rax), %rdi
movslq -0xac(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rdi
movl -0xa8(%rbp), %eax
movzbl %al, %esi
callq 0x7960
movq -0x20(%rbp), %rax
movb $0x1, (%rax)
jmp 0x102e2
movl -0xa8(%rbp), %eax
movb %al, %dl
movq -0x30(%rbp), %rax
movq 0x50f0(%rax), %rax
movq -0xb8(%rbp), %rcx
movb %dl, (%rax,%rcx)
movq -0x30(%rbp), %rax
testb $0x1, 0x3c(%rax)
je 0x102e0
movq -0x20(%rbp), %rax
testb $0x1, (%rax)
jne 0x102e0
movq -0x30(%rbp), %rax
movq 0x50e8(%rax), %rax
movq -0xb8(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl -0xa8(%rbp), %eax
je 0x102e0
movq -0x20(%rbp), %rax
movb $0x1, (%rax)
jmp 0x102e2
movq -0xd8(%rbp), %rax
movslq -0xac(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq -0x50(%rbp), %rax
je 0x10385
movq -0x30(%rbp), %rax
testb $0x1, 0x3d(%rax)
jne 0x1032e
testb $0x1, -0xa2(%rbp)
je 0x1032c
movq -0x30(%rbp), %rax
movq 0x98(%rax), %rdi
movq -0xb8(%rbp), %rsi
movslq -0x5c(%rbp), %rdx
callq 0x11250
jmp 0x1036f
testb $0x1, -0xa2(%rbp)
je 0x1036d
movq -0x30(%rbp), %rax
movq 0x98(%rax), %rax
movq -0xb8(%rbp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x1036d
movq -0x18(%rbp), %rax
movb %al, %dl
movq -0x30(%rbp), %rax
movq 0x98(%rax), %rax
movq -0xb8(%rbp), %rcx
movb %dl, (%rax,%rcx)
jmp 0x1036f
movq -0xd8(%rbp), %rax
movq -0x50(%rbp), %rdx
movslq -0xac(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x10387
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0xfd9c
movb -0x78(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x103d6
movq -0x90(%rbp), %rax
movq -0x58(%rbp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jne 0x103d6
movq -0x58(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x90(%rbp), %rdi
callq 0x10950
jmp 0x10414
movb -0x78(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x10412
movq -0x30(%rbp), %rax
testb $0x1, 0x3e(%rax)
jne 0x10412
movq -0x30(%rbp), %rax
testb $0x1, 0x69(%rax)
jne 0x10412
movq -0x58(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x90(%rbp), %rdi
callq 0x109c0
jmp 0x10414
movq -0x10(%rbp), %rax
testb $0x1, 0x2c(%rax)
jne 0x1043d
movq -0xa0(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x8(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
callq 0x8a10
movq %rax, -0xa0(%rbp)
movq -0x30(%rbp), %rax
testb $0x1, 0x3e(%rax)
je 0x10463
cmpq $0x0, -0x68(%rbp)
jbe 0x10463
movq -0x68(%rbp), %rdi
addq $0x1, %rdi
movq %rdi, -0x68(%rbp)
movq -0x30(%rbp), %rsi
callq 0x40c0
movb $0x0, -0xb9(%rbp)
cmpq $0x0, -0xa0(%rbp)
je 0x1049d
movq -0xa0(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x1049d
movq -0xa0(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x30(%rbp), %rcx
cmpq 0x28(%rcx), %rax
jne 0x1049d
movb $0x1, -0xb9(%rbp)
cmpq $0x0, -0xa0(%rbp)
je 0x104b7
movq -0xa0(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x8db0
movl $0x0, -0xc0(%rbp)
movl -0xc0(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl 0x20(%rcx), %eax
jge 0x104e3
jmp 0x104d2
movl -0xc0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc0(%rbp)
jmp 0x104c1
movq -0x30(%rbp), %rax
testb $0x1, 0x69(%rax)
je 0x10532
movq -0x30(%rbp), %rdi
callq 0x11990
movq -0x30(%rbp), %rax
movq 0x50d8(%rax), %rax
movq %rax, -0xc8(%rbp)
movq -0x30(%rbp), %rax
movq 0x50e0(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x50d8(%rax)
movq -0xc8(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x50e0(%rax)
jmp 0x1056c
movq -0x30(%rbp), %rax
movq 0x50e8(%rax), %rax
movq %rax, -0xd0(%rbp)
movq -0x30(%rbp), %rax
movq 0x50f0(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x50e8(%rax)
movq -0xd0(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x50f0(%rax)
movb -0xb9(%rbp), %al
movq -0x40(%rbp), %rcx
movq %rcx, %rsp
andb $0x1, %al
movq %rbp, %rsp
popq %rbp
retq