// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: balance
static int balance(BtCursor *pCur){
  int rc = SQLITE_OK;
  const int nMin = pCur->pBt->usableSize * 2 / 3;
  u8 aBalanceQuickSpace[13];
  u8 *pFree = 0;

  TESTONLY( int balance_quick_called = 0 );
  TESTONLY( int balance_deeper_called = 0 );

  do {
    int iPage = pCur->iPage;
    MemPage *pPage = pCur->apPage[iPage];

    if( iPage==0 ){
      if( pPage->nOverflow ){
        /* The root page of the b-tree is overfull. In this case call the
        ** balance_deeper() function to create a new child for the root-page
        ** and copy the current contents of the root-page to it. The
        ** next iteration of the do-loop will balance the child page.
        */ 
        assert( (balance_deeper_called++)==0 );
        rc = balance_deeper(pPage, &pCur->apPage[1]);
        if( rc==SQLITE_OK ){
          pCur->iPage = 1;
          pCur->aiIdx[0] = 0;
          pCur->aiIdx[1] = 0;
          assert( pCur->apPage[1]->nOverflow );
        }
      }else{
        break;
      }
    }else if( pPage->nOverflow==0 && pPage->nFree<=nMin ){
      break;
    }else{
      MemPage * const pParent = pCur->apPage[iPage-1];
      int const iIdx = pCur->aiIdx[iPage-1];

      rc = sqlite3PagerWrite(pParent->pDbPage);
      if( rc==SQLITE_OK ){
#ifndef SQLITE_OMIT_QUICKBALANCE
        if( pPage->hasData
         && pPage->nOverflow==1
         && pPage->aiOvfl[0]==pPage->nCell
         && pParent->pgno!=1
         && pParent->nCell==iIdx
        ){
          /* Call balance_quick() to create a new sibling of pPage on which
          ** to store the overflow cell. balance_quick() inserts a new cell
          ** into pParent, which may cause pParent overflow. If this
          ** happens, the next interation of the do-loop will balance pParent 
          ** use either balance_nonroot() or balance_deeper(). Until this
          ** happens, the overflow cell is stored in the aBalanceQuickSpace[]
          ** buffer. 
          **
          ** The purpose of the following assert() is to check that only a
          ** single call to balance_quick() is made for each call to this
          ** function. If this were not verified, a subtle bug involving reuse
          ** of the aBalanceQuickSpace[] might sneak in.
          */
          assert( (balance_quick_called++)==0 );
          rc = balance_quick(pParent, pPage, aBalanceQuickSpace);
        }else
#endif
        {
          /* In this case, call balance_nonroot() to redistribute cells
          ** between pPage and up to 2 of its sibling pages. This involves
          ** modifying the contents of pParent, which may cause pParent to
          ** become overfull or underfull. The next iteration of the do-loop
          ** will balance the parent page to correct this.
          ** 
          ** If the parent page becomes overfull, the overflow cell or cells
          ** are stored in the pSpace buffer allocated immediately below. 
          ** A subsequent iteration of the do-loop will deal with this by
          ** calling balance_nonroot() (balance_deeper() may be called first,
          ** but it doesn't deal with overflow cells - just moves them to a
          ** different page). Once this subsequent call to balance_nonroot() 
          ** has completed, it is safe to release the pSpace buffer used by
          ** the previous call, as the overflow cell data will have been 
          ** copied either into the body of a database page or into the new
          ** pSpace buffer passed to the latter call to balance_nonroot().
          */
          u8 *pSpace = sqlite3PageMalloc(pCur->pBt->pageSize);
          rc = balance_nonroot(pParent, iIdx, pSpace, iPage==1, pCur->hints);
          if( pFree ){
            /* If pFree is not NULL, it points to the pSpace buffer used 
            ** by a previous call to balance_nonroot(). Its contents are
            ** now stored either on real database pages or within the 
            ** new pSpace buffer, so it may be safely freed here. */
            sqlite3PageFree(pFree);
          }

          /* The pSpace buffer will be freed after the next call to
          ** balance_nonroot(), or just before this function returns, whichever
          ** comes first. */
          pFree = pSpace;
        }
      }

      pPage->nOverflow = 0;

      /* The next iteration of the do-loop balances the parent page. */
      releasePage(pPage);
      pCur->iPage--;
    }
  }while( rc==SQLITE_OK );

  if( pFree ){
    sqlite3PageFree(pFree);
  }
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rdi, %r15
movq 0x8(%rdi), %rax
movl 0x34(%rax), %eax
addl %eax, %eax
movl $0xaaaaaaab, %ecx       # imm = 0xAAAAAAAB
imulq %rax, %rcx
shrq $0x21, %rcx
movq %rcx, -0x1e8(%rbp)
movq $0x0, -0x100(%rbp)
movq %rdi, -0x78(%rbp)
movswq 0x7a(%r15), %r13
movq 0xa8(%r15,%r13,8), %r12
movb 0x1(%r12), %al
testq %r13, %r13
je 0x311ad
testb %al, %al
jne 0x3117e
movzwl 0xe(%r12), %ecx
xorl %eax, %eax
cmpl %ecx, -0x1e8(%rbp)
jae 0x314cf
movq %r12, -0xb8(%rbp)
movq 0xa0(%r15,%r13,8), %r12
movzwl 0x7a(%r15,%r13,2), %ebx
movq 0x68(%r12), %rdi
callq 0xdebf
testl %eax, %eax
je 0x3127c
movl %eax, %r14d
jmp 0x32543
xorl %r14d, %r14d
testb %al, %al
je 0x314c8
movq $0x0, -0x130(%rbp)
movl $0x0, -0xe0(%rbp)
movq 0x48(%r12), %rbx
movq 0x68(%r12), %rdi
callq 0xdebf
movl %eax, -0x158(%rbp)
testl %eax, %eax
jne 0x31245
movl 0x70(%r12), %ecx
movq %rbx, %rdi
leaq -0x130(%rbp), %rsi
leaq -0xe0(%rbp), %rdx
xorl %r8d, %r8d
callq 0x21e3f
movl %eax, -0x158(%rbp)
movq -0x130(%rbp), %rsi
movq %r12, %rdi
leaq -0x158(%rbp), %rdx
callq 0x32b36
cmpb $0x0, 0x21(%rbx)
je 0x31245
movl -0xe0(%rbp), %esi
movl 0x70(%r12), %ecx
movq %rbx, %rdi
movl $0x5, %edx
leaq -0x158(%rbp), %r8
callq 0x22b09
movl -0x158(%rbp), %ebx
testl %ebx, %ebx
je 0x314d7
movq $0x0, 0xb0(%r15)
movq -0x130(%rbp), %rax
testq %rax, %rax
je 0x31545
movq 0x68(%rax), %rdi
callq 0xdcd4
jmp 0x31545
movq -0xb8(%rbp), %rcx
cmpb $0x0, 0x4(%rcx)
je 0x31459
cmpb $0x1, 0x1(%rcx)
jne 0x31459
movzwl 0x10(%rcx), %eax
cmpw %ax, 0x14(%rcx)
jne 0x31459
cmpl $0x1, 0x70(%r12)
je 0x31459
cmpw %bx, 0x10(%r12)
jne 0x31459
testw %ax, %ax
je 0x31f23
movq 0x48(%rcx), %rbx
movq %rbx, %rdi
leaq -0x130(%rbp), %rsi
leaq -0x1c0(%rbp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x21e3f
movl %eax, -0xe0(%rbp)
testl %eax, %eax
jne 0x3144d
movq -0xb8(%rbp), %rdi
movq 0x20(%rdi), %r13
movq %r13, -0x158(%rbp)
movq %r13, %rsi
callq 0x3072b
movw %ax, -0x40(%rbp)
movw %ax, -0x170(%rbp)
movq -0x130(%rbp), %r14
movq %r14, %rdi
movl $0xd, %esi
callq 0x20900
movq %r14, %rdi
movl $0x1, %esi
leaq -0x158(%rbp), %rdx
leaq -0x170(%rbp), %rcx
callq 0x32be9
cmpb $0x0, 0x21(%rbx)
je 0x31389
movl -0x1c0(%rbp), %esi
movl 0x70(%r12), %ecx
movq %rbx, %rdi
movl $0x5, %edx
leaq -0xe0(%rbp), %r8
callq 0x22b09
movzwl -0x40(%rbp), %eax
cmpw 0xa(%r14), %ax
jbe 0x31389
movq %r14, %rdi
movq %r13, %rsi
leaq -0xe0(%rbp), %rdx
callq 0x22f9e
movq -0xb8(%rbp), %rdi
movzwl 0x12(%rdi), %eax
movq 0x60(%rdi), %rcx
movzwl 0x10(%rdi), %edx
movzbl -0x2(%rcx,%rdx,2), %esi
shll $0x8, %esi
movzbl -0x1(%rcx,%rdx,2), %ecx
orl %esi, %ecx
andl %eax, %ecx
addq 0x50(%rdi), %rcx
movq %rcx, -0x158(%rbp)
xorl %edx, %edx
leaq 0x1(%rcx), %rax
cmpq $0x7, %rdx
ja 0x313cf
incq %rdx
cmpb $0x0, (%rcx)
movq %rax, %rcx
js 0x313ba
movq %rax, -0x158(%rbp)
leaq 0x9(%rax), %rdx
movl $0x4, %ecx
movb (%rax), %sil
incq %rax
movb %sil, -0x205(%rbp,%rcx)
incq %rcx
testb %sil, %sil
jns 0x313fa
cmpq %rdx, %rax
jb 0x313df
movq %rax, -0x158(%rbp)
movzwl 0x10(%r12), %esi
movl 0x70(%rdi), %r9d
leaq -0xe0(%rbp), %rax
movq %rax, (%rsp)
movq %r12, %rdi
leaq -0x205(%rbp), %rdx
xorl %r8d, %r8d
callq 0x30cdf
movq 0x50(%r12), %rax
movzbl 0x5(%r12), %ecx
movl -0x1c0(%rbp), %edx
bswapl %edx
movl %edx, 0x8(%rax,%rcx)
testq %r14, %r14
je 0x3144d
movq 0x68(%r14), %rdi
callq 0xdcd4
movl -0xe0(%rbp), %r14d
jmp 0x32543
movq %r12, -0x58(%rbp)
movq 0x8(%r15), %rax
movl 0x30(%rax), %edi
callq 0x1ce52
movq %rax, %r12
movzbl 0x79(%r15), %eax
movq %rax, -0xc0(%rbp)
movl $0x0, -0x2c(%rbp)
testq %r12, %r12
je 0x31567
movq -0x58(%rbp), %rax
movzbl 0x1(%rax), %ecx
movzwl 0x10(%rax), %eax
leal (%rax,%rcx), %r14d
xorl %esi, %esi
cmpl $0x2, %r14d
jb 0x31587
testl %ebx, %ebx
je 0x31572
cmpl %ebx, %r14d
jne 0x31576
movq -0xc0(%rbp), %rdx
leal (%rdx,%r14), %esi
addl $-0x2, %esi
jmp 0x3157a
xorl %eax, %eax
jmp 0x32563
xorl %r14d, %r14d
jmp 0x32563
movq -0x130(%rbp), %rbx
leaq 0x14(%rbx), %rdi
leaq 0x14(%r12), %rsi
movzbl 0x1(%r12), %edx
addl %edx, %edx
callq 0x82f0
leaq 0x20(%rbx), %rdi
leaq 0x20(%r12), %rsi
movzbl 0x1(%r12), %edx
shll $0x3, %edx
callq 0x82f0
movb 0x1(%r12), %al
movb %al, 0x1(%rbx)
movq 0x50(%rbx), %rax
movzbl (%rax), %esi
andl $-0x9, %esi
movq %r12, %rdi
callq 0x20900
movq 0x50(%r12), %rax
movzbl 0x5(%r12), %ecx
movl -0xe0(%rbp), %edx
bswapl %edx
movl %edx, 0x8(%rax,%rcx)
movq %rbx, 0xb0(%r15)
xorl %ebx, %ebx
movb $0x1, %al
testl %ebx, %ebx
je 0x31553
movl %ebx, %r14d
jmp 0x32563
movl $0x1, 0x7a(%r15)
movw $0x0, 0x7e(%r15)
jmp 0x32563
movl $0x7, %r14d
jmp 0x3252b
xorl %esi, %esi
jmp 0x3157a
decl %ebx
movl %ebx, %esi
movl $0x2, %r14d
subl -0xc0(%rbp), %r14d
movl %esi, %edx
subl %ecx, %edx
addl %r14d, %edx
movq -0x58(%rbp), %rdi
movq 0x50(%rdi), %r8
cmpl %eax, %edx
movq %r12, -0xf8(%rbp)
movq %r13, -0x1a0(%rbp)
movq %rsi, -0xf0(%rbp)
jne 0x315bc
movzbl 0x5(%rdi), %eax
addq %rax, %r8
addq $0x8, %r8
jmp 0x315da
movzwl 0x12(%rdi), %eax
movq 0x60(%rdi), %rcx
movslq %edx, %rdx
movzbl (%rcx,%rdx,2), %esi
shll $0x8, %esi
movzbl 0x1(%rcx,%rdx,2), %ecx
orl %esi, %ecx
andl %eax, %ecx
addq %rcx, %r8
movq %r8, -0x1d0(%rbp)
movq 0x48(%rdi), %r13
leal 0x1(%r14), %eax
movl %eax, -0xc4(%rbp)
movl (%r8), %esi
bswapl %esi
movl %esi, -0x8c(%rbp)
movslq %r14d, %r12
leaq -0xe0(%rbp,%r12,8), %rbx
movq %r13, %rdi
movl %esi, -0x40(%rbp)
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0x302c8
movl %eax, -0x2c(%rbp)
testl %eax, %eax
je 0x3164a
movl %r14d, %eax
movl -0x40(%rbp), %ecx
movl %ecx, -0x8c(%rbp)
cltq
leaq 0x8(,%rax,8), %rdx
xorl %ebx, %ebx
leaq -0xe0(%rbp), %rdi
xorl %esi, %esi
callq 0x8200
xorl %r12d, %r12d
jmp 0x324c3
movq %r12, -0x80(%rbp)
movq %r13, -0x70(%rbp)
movq (%rbx), %rax
movzwl 0x10(%rax), %ecx
movzbl 0x1(%rax), %eax
leal (%rcx,%rax), %r15d
incl %r15d
testl %r14d, %r14d
movq %r14, -0x48(%rbp)
je 0x318b6
movq -0xf0(%rbp), %rcx
leal (%rcx,%r14), %eax
addl %r14d, %ecx
decl %ecx
movq %rcx, -0x60(%rbp)
leal -0x2(%rax,%rax), %edi
leaq -0x194(%rbp), %rax
movq -0x80(%rbp), %rcx
leaq (%rax,%rcx,4), %rax
movq %rax, -0x88(%rbp)
leaq (,%rcx,8), %rax
movq %rax, -0x108(%rbp)
leaq -0x228(%rbp), %rax
leaq (%rax,%rcx,8), %rax
movq %rax, -0x50(%rbp)
leaq -0xe8(%rbp), %rax
leaq (%rax,%rcx,8), %rbx
negq %rcx
movq %rcx, -0x68(%rbp)
xorl %r14d, %r14d
xorl %r13d, %r13d
movq -0x58(%rbp), %r12
movq %rbx, -0xa8(%rbp)
movzwl 0x14(%r12), %eax
movq -0x60(%rbp), %rcx
addl %r13d, %ecx
cmpl %eax, %ecx
movl %edi, -0x38(%rbp)
jne 0x31731
cmpb $0x0, 0x1(%r12)
je 0x31731
movq 0x20(%r12), %rsi
movq -0x50(%rbp), %rax
movq %rsi, (%rax,%r13,8)
movl (%rsi), %eax
bswapl %eax
movl %eax, -0x40(%rbp)
movq %r12, %rdi
callq 0x3072b
movzwl %ax, %eax
movq -0x88(%rbp), %rcx
movl %eax, (%rcx,%r13,4)
movb $0x0, 0x1(%r12)
jmp 0x31866
movzwl 0x12(%r12), %eax
movq 0x50(%r12), %rcx
movq 0x60(%r12), %rdx
movzbl 0x1(%r12), %esi
addl %esi, %esi
subl %esi, %edi
movslq %edi, %rsi
movzbl (%rdx,%rsi), %edi
shll $0x8, %edi
movzbl 0x1(%rdx,%rsi), %edx
orl %edi, %edx
andl %eax, %edx
leaq (%rcx,%rdx), %rbx
movq -0x50(%rbp), %rax
movq %rbx, (%rax,%r13,8)
movl (%rcx,%rdx), %eax
bswapl %eax
movl %eax, -0x40(%rbp)
movq -0x58(%rbp), %rdi
movq %rbx, %rsi
callq 0x3072b
movzwl %ax, %edx
movq -0x88(%rbp), %rax
movl %edx, (%rax,%r13,4)
movq -0x70(%rbp), %rax
testb $0x4, 0x26(%rax)
movq -0x58(%rbp), %r12
je 0x3184a
movl 0x50(%r12), %ecx
movl %ebx, %eax
subl %ecx, %eax
leal (%rax,%rdx), %esi
movq -0x70(%rbp), %rcx
movl 0x34(%rcx), %ecx
movl %esi, -0x98(%rbp)
movl %ecx, -0xb0(%rbp)
cmpl %ecx, %esi
movq %rdx, -0xa0(%rbp)
jle 0x31809
movl $0xb, %edi
leaq 0x48040(%rip), %rsi     # 0x79814
movl $0xda00, %edx           # imm = 0xDA00
leaq 0x47d59(%rip), %rcx     # 0x79539
xorl %eax, %eax
callq 0xb8cc
movl $0xb, -0x2c(%rbp)
movq -0x108(%rbp), %rax
leaq (%rax,%r14), %rdx
leaq -0xe0(%rbp), %rdi
xorl %esi, %esi
callq 0x8200
jmp 0x31831
movslq %eax, %rdi
addq -0xf8(%rbp), %rdi
movl %edx, %edx
movq %rbx, %rsi
callq 0x82f0
subq 0x50(%r12), %rbx
addq -0xf8(%rbp), %rbx
movq -0x50(%rbp), %rax
movq %rbx, (%rax,%r13,8)
movl -0xb0(%rbp), %eax
cmpl %eax, -0x98(%rbp)
movq -0xa0(%rbp), %rdx
jg 0x31ece
movzbl 0x1(%r12), %eax
movq -0x60(%rbp), %rcx
leal (%rcx,%r13), %esi
subl %eax, %esi
movq %r12, %rdi
leaq -0x2c(%rbp), %rcx
callq 0x309c5
movq -0x70(%rbp), %rdi
movq -0xa8(%rbp), %rbx
leaq (%rbx,%r14), %rdx
movl -0x40(%rbp), %esi
xorl %ecx, %ecx
callq 0x302c8
movl %eax, -0x2c(%rbp)
testl %eax, %eax
jne 0x31d9b
movq (%rbx,%r13,8), %rax
movzwl 0x10(%rax), %ecx
addl %ecx, %r15d
movzbl 0x1(%rax), %eax
addl %eax, %r15d
incl %r15d
decq %r13
movl -0x38(%rbp), %edi
addl $-0x2, %edi
addq $-0x8, %r14
cmpq %r13, -0x68(%rbp)
jne 0x316e0
movl -0x40(%rbp), %eax
movl %eax, -0x8c(%rbp)
addl $0x3, %r15d
andl $-0x4, %r15d
movq -0x70(%rbp), %rbx
movl 0x30(%rbx), %eax
leal (%r15,%r15,4), %ecx
leal (%rax,%rcx,2), %ecx
movl %eax, %edi
addl $0x78, %edi
movl %edi, -0x98(%rbp)
imull -0xc4(%rbp), %edi
addl %ecx, %edi
callq 0x16cce
testq %rax, %rax
je 0x31dae
movslq %r15d, %rdx
movq %rax, -0x38(%rbp)
leaq (%rax,%rdx,8), %r13
movq -0xe0(%rbp), %rcx
movzbl 0x3(%rcx), %eax
movq %rax, -0x198(%rbp)
leal (,%rax,4), %eax
movzbl 0x4(%rcx), %r15d
movq %rax, -0x1d8(%rbp)
movzwl %ax, %eax
movq %rax, -0x138(%rbp)
movl $0x0, %r14d
cmpl $0x0, -0x48(%rbp)
movq %r13, -0x40(%rbp)
movq %r15, -0xb0(%rbp)
movl -0x98(%rbp), %esi
js 0x31c2b
leaq (,%rdx,2), %rax
addq %r13, %rax
movq %rax, -0x108(%rbp)
movl -0x48(%rbp), %eax
movq %rax, -0x1f8(%rbp)
movl -0xc4(%rbp), %eax
movq %rax, -0x1f0(%rbp)
leaq (%rdx,%rdx,4), %rax
movq -0x38(%rbp), %rcx
leaq (%rcx,%rax,2), %rdx
movq %rdx, -0x1e0(%rbp)
leaq (%rcx,%rax,2), %rax
addq $0x79, %rax
movq %rax, -0x1c8(%rbp)
movq $0x0, -0x68(%rbp)
xorl %ecx, %ecx
xorl %r14d, %r14d
movl $0x0, -0xe4(%rbp)
movl 0x30(%rbx), %r12d
movl %esi, %edx
imull %ecx, %edx
addl %r12d, %edx
movq -0x108(%rbp), %r8
leaq (%r8,%rdx), %r13
movq %r13, -0x1c0(%rbp,%rcx,8)
movq %rcx, -0xa0(%rbp)
movq -0xe0(%rbp,%rcx,8), %rax
movl $0xf, %ecx
movq %r13, %rdi
movq %rax, %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x78(%r8,%rdx), %r15
movq %r15, -0x28(%r15)
movq 0x50(%rax), %rsi
movl 0x30(%rbx), %edx
movq %r15, %rdi
callq 0x82f0
movq %r15, %rdx
movzwl -0x68(%r15), %r15d
movzbl -0x77(%rdx), %eax
addl %eax, %r15d
testl %eax, %eax
je 0x31aa4
movslq %r14d, %r14
addl -0x68(%rbp), %r12d
addq -0x1e0(%rbp), %r12
xorl %ebx, %ebx
movzbl 0x1(%r13), %ecx
movl %ebx, %eax
testq %rcx, %rcx
jle 0x31a5d
movzwl 0x12(%r12,%rcx,2), %edi
movb $0x1, %dl
cmpl %edi, %eax
jl 0x31a54
jne 0x31a52
movq 0x18(%r12,%rcx,8), %rsi
xorl %edx, %edx
jmp 0x31a54
decl %eax
decq %rcx
testb %dl, %dl
jne 0x31a36
jmp 0x31a7c
movzwl 0x12(%r13), %ecx
movq 0x60(%r13), %rdx
cltq
movzbl (%rdx,%rax,2), %edi
shll $0x8, %edi
movzbl 0x1(%rdx,%rax,2), %esi
orl %edi, %esi
andl %ecx, %esi
addq 0x50(%r13), %rsi
movq -0x38(%rbp), %rax
movq %rsi, (%rax,%r14,8)
movq %r13, %rdi
callq 0x3072b
movq -0x40(%rbp), %rcx
movw %ax, (%rcx,%r14,2)
incq %r14
incl %ebx
cmpl %r15d, %ebx
jne 0x31a2f
jmp 0x31b39
testl %r15d, %r15d
je 0x31b3d
movzwl 0xc(%r13), %eax
movzwl 0x12(%r13), %ecx
movq %rcx, -0x60(%rbp)
movslq %r14d, %rcx
movl %r15d, %esi
movq %rsi, -0x50(%rbp)
addl -0x68(%rbp), %r12d
addq -0x1c8(%rbp), %r12
addq %rax, %r12
movq -0x40(%rbp), %rax
leaq (%rax,%rcx,2), %rax
movq %rax, -0x88(%rbp)
movq -0x38(%rbp), %rax
leaq (%rax,%rcx,8), %rax
movq %rax, -0xa8(%rbp)
xorl %ebx, %ebx
movzbl -0x1(%r12,%rbx,2), %eax
shll $0x8, %eax
movzbl (%r12,%rbx,2), %esi
orl %eax, %esi
andl -0x60(%rbp), %esi
addq %rdx, %rsi
movq -0xa8(%rbp), %rax
movq %rsi, (%rax,%rbx,8)
movq %rdx, %r15
movq %r13, %rdi
callq 0x3072b
movq %r15, %rdx
movq -0x88(%rbp), %rcx
movw %ax, (%rcx,%rbx,2)
incq %rbx
cmpq %rbx, -0x50(%rbp)
jne 0x31af3
addl %ebx, %r14d
movq -0x70(%rbp), %rbx
movq -0xa0(%rbp), %rcx
cmpq -0x1f8(%rbp), %rcx
movq -0xb0(%rbp), %r15
movl -0x98(%rbp), %esi
jae 0x31bd7
testb %r15b, %r15b
jne 0x31bd7
movl -0x190(%rbp,%rcx,4), %eax
movzwl %ax, %edx
movslq %r14d, %r15
movq -0x40(%rbp), %rbx
movw %dx, (%rbx,%r15,2)
movslq -0xe4(%rbp), %r12
addq -0x108(%rbp), %r12
movq -0x220(%rbp,%rcx,8), %rsi
movq %r12, %rdi
movq %rdx, -0x60(%rbp)
callq 0x82f0
addq -0x1d8(%rbp), %r12
movq -0x38(%rbp), %rax
movq %r12, (%rax,%r15,8)
movzwl (%rbx,%r15,2), %eax
subl -0x138(%rbp), %eax
movw %ax, (%rbx,%r15,2)
cmpb $0x0, 0x3(%r13)
je 0x31bdd
cmpw $0x3, %ax
movq -0x40(%rbp), %r13
movl -0x98(%rbp), %esi
ja 0x31bf2
movw $0x4, (%r13,%r15,2)
jmp 0x31bf2
movq -0x40(%rbp), %r13
jmp 0x31c11
movq 0x50(%r13), %rax
movl 0x8(%rax), %eax
movl %eax, (%r12)
movq -0x40(%rbp), %r13
movl -0x98(%rbp), %esi
movq -0x60(%rbp), %rax
addl %eax, -0xe4(%rbp)
incl %r14d
movq -0x70(%rbp), %rbx
movq -0xb0(%rbp), %r15
movq -0xa0(%rbp), %rcx
incq %rcx
movq -0x68(%rbp), %rax
addl %esi, %eax
movq %rax, -0x68(%rbp)
cmpq -0x1f0(%rbp), %rcx
jne 0x319b4
movl $0x0, %r12d
testl %r14d, %r14d
movl $0x0, %edi
jle 0x31c9d
movl 0x34(%rbx), %eax
movq -0x138(%rbp), %rcx
addl %ecx, %eax
addl $-0xc, %eax
xorl %ecx, %ecx
movl %r15d, %edx
negl %edx
movl $0x0, %edx
sbbl %edx, %edx
xorl %r12d, %r12d
xorl %esi, %esi
movslq %ecx, %rdi
movzwl (%r13,%rdi,2), %edi
addl %esi, %edi
addl $0x2, %edi
cmpl %eax, %edi
jle 0x31c94
addl $0x2, %esi
movslq %r12d, %rdi
movl %esi, -0x190(%rbp,%rdi,4)
movl %ecx, -0x170(%rbp,%rdi,4)
cmpl $0x4, %r12d
jge 0x31ee9
addl %edx, %ecx
incl %r12d
xorl %edi, %edi
incl %ecx
movl %edi, %esi
cmpl %r14d, %ecx
jl 0x31c5d
movslq %r12d, %rax
movl %edi, -0x190(%rbp,%rax,4)
movl %r14d, -0x170(%rbp,%rax,4)
testl %eax, %eax
movq -0x38(%rbp), %rbx
jle 0x31d60
movl %r12d, %eax
movq %rax, %rcx
movl -0x194(%rbp,%rax,4), %edx
movl -0x190(%rbp,%rax,4), %esi
decq %rax
movl -0x174(%rbp,%rcx,4), %r8d
leal -0x1(%r8), %edi
movslq %r8d, %r8
subq %r15, %r8
movslq %edi, %rdi
testl %esi, %esi
je 0x31d16
cmpl $0x0, -0xc0(%rbp)
jne 0x31d48
movzwl (%r13,%r8,2), %r9d
addl %esi, %r9d
addl $0x2, %r9d
movzwl (%r13,%rdi,2), %r10d
movl %edx, %r11d
subl %r10d, %r11d
addl $-0x2, %r11d
cmpl %r11d, %r9d
jg 0x31d48
movslq %r8d, %r8
movzwl (%r13,%r8,2), %r8d
addl %r8d, %esi
addl $0x2, %esi
movzwl (%r13,%rdi,2), %edi
subl %edi, %edx
addl $-0x2, %edx
movl -0x170(%rbp,%rax,4), %edi
leal -0x1(%rdi), %r8d
movl %r8d, -0x170(%rbp,%rax,4)
addl $-0x2, %edi
jmp 0x31cde
movl %esi, -0x190(%rbp,%rcx,4)
movl %edx, -0x190(%rbp,%rax,4)
cmpq $0x1, %rcx
jg 0x31cbe
movq -0xe0(%rbp), %rax
cmpl $0x1, 0x70(%rax)
ja 0x31dba
xorl %r12d, %r12d
movl $0xb, %edi
leaq 0x47a98(%rip), %rsi     # 0x79814
movl $0xdac9, %edx           # imm = 0xDAC9
leaq 0x477b1(%rip), %rcx     # 0x79539
xorl %eax, %eax
callq 0xb8cc
movl $0xb, -0x2c(%rbp)
jmp 0x31edc
movq -0x48(%rbp), %r14
leal (%r14,%r13), %eax
decl %eax
movq -0x78(%rbp), %r15
jmp 0x3161f
movl $0x7, -0x2c(%rbp)
jmp 0x31ed7
movq 0x50(%rax), %rax
movzbl (%rax), %eax
movl %eax, -0x88(%rbp)
testl %r12d, %r12d
js 0x31f4d
leal 0x1(%r12), %eax
movq %rax, -0x60(%rbp)
xorl %ebx, %ebx
movl $0x0, -0x50(%rbp)
movq -0x80(%rbp), %r13
cmpq %r13, %rbx
jle 0x31e2f
movl $0x1, %ecx
cmpb $0x0, -0xc0(%rbp)
jne 0x31dff
movl -0x8c(%rbp), %ecx
xorl %r15d, %r15d
movq -0x70(%rbp), %r13
movq %r13, %rdi
leaq -0x158(%rbp), %rsi
leaq -0x8c(%rbp), %rdx
xorl %r8d, %r8d
callq 0x21e3f
movl %eax, -0x2c(%rbp)
testl %eax, %eax
je 0x31e6a
movq -0x80(%rbp), %r13
jmp 0x31eb3
movq -0xe0(%rbp,%rbx,8), %rax
movq %rax, -0x130(%rbp,%rbx,8)
movq %rax, -0x158(%rbp)
movq $0x0, -0xe0(%rbp,%rbx,8)
movq 0x68(%rax), %rdi
callq 0xdebf
movl %eax, -0x2c(%rbp)
incl -0x50(%rbp)
testl %eax, %eax
je 0x31eb0
xorl %r15d, %r15d
jmp 0x31eb3
movq -0x158(%rbp), %rax
movq %rax, -0x130(%rbp,%rbx,8)
incl -0x50(%rbp)
cmpb $0x0, 0x21(%r13)
je 0x31eac
movl 0x70(%rax), %esi
movq -0x58(%rbp), %rax
movl 0x70(%rax), %ecx
movq %r13, %rdi
movl $0x5, %edx
leaq -0x2c(%rbp), %r8
callq 0x22b09
cmpl $0x0, -0x2c(%rbp)
je 0x31eac
xorl %r15d, %r15d
jmp 0x31e26
movq -0x80(%rbp), %r13
movb $0x1, %r15b
testb %r15b, %r15b
je 0x324b3
incq %rbx
cmpq %rbx, -0x60(%rbp)
jne 0x31de6
jmp 0x31f56
movl -0x40(%rbp), %eax
movl %eax, -0x8c(%rbp)
xorl %ebx, %ebx
xorl %r12d, %r12d
movq -0x78(%rbp), %r15
movq -0x48(%rbp), %r14
jmp 0x324c3
xorl %r12d, %r12d
movl $0xb, %edi
leaq 0x4791c(%rip), %rsi     # 0x79814
movl $0xda8b, %edx           # imm = 0xDA8B
leaq 0x47635(%rip), %rcx     # 0x79539
xorl %eax, %eax
callq 0xb8cc
movl $0xb, -0x2c(%rbp)
movq -0x78(%rbp), %r15
movq -0x48(%rbp), %r14
movq -0x38(%rbp), %rbx
jmp 0x324c3
movl $0xb, %r14d
movl $0xb, %edi
leaq 0x478df(%rip), %rsi     # 0x79814
movl $0xd8af, %edx           # imm = 0xD8AF
leaq 0x475f8(%rip), %rcx     # 0x79539
xorl %eax, %eax
callq 0xb8cc
jmp 0x32543
xorl %ebx, %ebx
movl $0x0, -0x50(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x48(%rbp), %ebx
jg 0x31fb2
movl %ebx, %ecx
decl %ebx
leaq -0xe0(,%rcx,8), %r15
addq %rbp, %r15
movq (%r15), %r13
testl %eax, %eax
jne 0x31f84
movq 0x48(%r13), %rdi
movl 0x70(%r13), %edx
movq %r13, %rsi
callq 0x32647
testl %eax, %eax
jne 0x32283
testq %r13, %r13
je 0x31fa0
movq 0x68(%r13), %rdi
movl %eax, %r13d
callq 0xdcd4
movl %r13d, %eax
movq $0x0, (%r15)
incl %ebx
addq $0x8, %r15
cmpl %ebx, -0x48(%rbp)
jg 0x31f6d
movl %eax, -0x2c(%rbp)
testl %r12d, %r12d
movq -0x1a0(%rbp), %r11
movq -0x80(%rbp), %rbx
jle 0x3202d
movl %r12d, %eax
incl %r12d
movl $0x1, %ecx
xorl %edx, %edx
movq -0x130(%rbp,%rdx,8), %rsi
movl 0x70(%rsi), %edi
movq %rcx, %r9
movl %edx, %r8d
movq -0x130(%rbp,%r9,8), %r10
movl 0x70(%r10), %r10d
cmpl %edi, %r10d
cmovbl %r10d, %edi
cmovbl %r9d, %r8d
incq %r9
cmpq %r9, %r12
jne 0x31fe3
movslq %r8d, %rdi
cmpq %rdi, %rdx
jge 0x32022
movq -0x130(%rbp,%rdi,8), %r8
movq %r8, -0x130(%rbp,%rdx,8)
movq %rsi, -0x130(%rbp,%rdi,8)
incq %rdx
incq %rcx
cmpq %rax, %rdx
jne 0x31fd2
movslq -0x50(%rbp), %rax
movq -0x138(%rbp,%rax,8), %rcx
movq %rcx, -0x68(%rbp)
movl 0x70(%rcx), %ecx
bswapl %ecx
movq -0x1d0(%rbp), %rdx
movl %ecx, (%rdx)
testl %eax, %eax
movq %rbx, %r12
jle 0x32209
movl -0x50(%rbp), %eax
movq %rax, -0xa8(%rbp)
xorl %r13d, %r13d
xorl %esi, %esi
movl $0x0, -0x60(%rbp)
movl %esi, %r15d
movq -0x130(%rbp,%r13,8), %rbx
movq %rbx, %rdi
movl -0x88(%rbp), %esi
callq 0x20900
movq %r13, -0xc0(%rbp)
movl -0x170(%rbp,%r13,4), %r12d
movl %r12d, %esi
subl %r15d, %esi
movslq %r15d, %rax
movq -0x38(%rbp), %r15
leaq (%r15,%rax,8), %rdx
movq -0x40(%rbp), %r13
leaq (,%rax,2), %rcx
addq %r13, %rcx
movq %rbx, %rdi
callq 0x32be9
movq %r12, %rsi
movb $0x1, %al
cmpl %r14d, %esi
jge 0x32140
movslq %esi, %rax
movq (%r15,%rax,8), %rdx
movzwl (%r13,%rax,2), %edi
movq -0x138(%rbp), %rcx
addl %edi, %ecx
movl -0x60(%rbp), %r15d
movslq %r15d, %r8
addq -0xf8(%rbp), %r8
cmpb $0x0, 0x3(%rbx)
je 0x32150
cmpl $0x0, -0xb0(%rbp)
movq -0x80(%rbp), %r12
je 0x32166
movq %rax, %r13
decq %r13
movq -0x38(%rbp), %rcx
movq -0x8(%rcx,%rax,8), %rsi
movq %rbx, %rdi
leaq -0x158(%rbp), %rdx
movq %r8, %r12
callq 0x21585
leaq 0x4(%r12), %rdi
movq -0x158(%rbp), %rsi
callq 0x2fffb
movl %eax, %ecx
addl $0x4, %ecx
movq %r12, %rdx
movq -0x80(%rbp), %r12
xorl %r8d, %r8d
jmp 0x321a4
movq -0xf0(%rbp), %r15
movq -0x80(%rbp), %r12
jmp 0x321dc
movq 0x50(%rbx), %rax
movl (%rdx), %edi
movl %edi, 0x8(%rax)
leaq -0x2c(%rbp), %rax
movq -0x80(%rbp), %r12
movq %rsi, %r13
jmp 0x321a8
movq %rsi, %r13
addq $-0x4, %rdx
cmpw $0x4, %di
jne 0x321a4
movq %rbx, -0xa0(%rbp)
movq -0x58(%rbp), %rdi
movq %rdx, %rsi
movq %r8, %rbx
movq %rdx, -0x98(%rbp)
callq 0x3072b
movq -0x98(%rbp), %rdx
movq %rbx, %r8
movq -0xa0(%rbp), %rbx
movzwl %ax, %ecx
leaq -0x2c(%rbp), %rax
addl %ecx, %r15d
movl %r15d, -0x60(%rbp)
movl 0x70(%rbx), %r9d
movq %rax, (%rsp)
movq -0x58(%rbp), %rdi
movq -0xf0(%rbp), %r15
movl %r15d, %esi
callq 0x30cdf
xorl %eax, %eax
cmpl $0x0, -0x2c(%rbp)
sete %al
addl %eax, %r15d
addl %eax, %r13d
movq %r13, %rsi
testb %al, %al
movq -0x1a0(%rbp), %r11
movq -0xc0(%rbp), %r13
je 0x324b3
movq %r15, -0xf0(%rbp)
incq %r13
cmpq %r13, -0xa8(%rbp)
jne 0x3206c
testb $0x8, -0x88(%rbp)
jne 0x3222c
movq -0x1c0(%rbp,%r12,8), %rax
movq 0x50(%rax), %rax
movq -0x68(%rbp), %rcx
movq 0x50(%rcx), %rcx
movl 0x8(%rax), %eax
movl %eax, 0x8(%rcx)
cmpw $0x1, %r11w
movq -0x78(%rbp), %r15
movl -0x50(%rbp), %r12d
jne 0x3225f
movq -0x58(%rbp), %rax
cmpw $0x0, 0x10(%rax)
jne 0x3225f
movq -0x58(%rbp), %rax
movzbl 0x5(%rax), %eax
movq -0x130(%rbp), %rbx
cmpw %ax, 0xe(%rbx)
jae 0x32572
movq -0x70(%rbp), %rax
cmpb $0x0, 0x21(%rax)
je 0x31f16
movq -0x1c0(%rbp), %rbx
movzbl 0x1(%rbx), %edi
testl %edi, %edi
je 0x3228b
movzwl 0x14(%rbx), %r8d
jmp 0x32291
movl %eax, -0x2c(%rbp)
jmp 0x324b3
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
movq -0xb0(%rbp), %rax
testl %r14d, %r14d
jle 0x3245d
movq -0x130(%rbp), %r9
movzwl 0x10(%rbx), %r13d
addl %edi, %r13d
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
movq %rcx, -0xa0(%rbp)
movl %r14d, %eax
movq %rax, -0x98(%rbp)
xorl %r14d, %r14d
xorl %r12d, %r12d
xorl %r10d, %r10d
movl %r13d, %eax
cmpq %rax, %r14
jne 0x32329
movq -0xa0(%rbp), %rax
addl %r14d, %eax
movslq %r12d, %rcx
leaq -0x1b8(%rbp), %rdx
leaq (%rdx,%rcx,8), %rcx
movq (%rcx), %rbx
movzbl 0x1(%rbx), %edx
testl %edx, %edx
je 0x32306
movzwl 0x14(%rbx), %r8d
addl %eax, %r8d
movl %edx, %edi
movzwl 0x10(%rbx), %r13d
addl %eax, %r13d
addl %edx, %r13d
movl %r13d, %edx
incl %r12d
addq $0x8, %rcx
cmpq %rdx, %r14
je 0x322f1
movq -0xa0(%rbp), %rax
jmp 0x3232b
xorl %eax, %eax
movl %r8d, %ecx
xorl %r15d, %r15d
cmpq %rcx, %r14
sete -0xc0(%rbp)
cmpl $0x2, %edi
setge %r11b
movslq %r10d, %rdx
movl -0x170(%rbp,%rdx,4), %esi
cmpq %rsi, %r14
jne 0x3236a
leal 0x1(%rdx), %r10d
movq -0x128(%rbp,%rdx,8), %r9
cmpl $0x0, -0xb0(%rbp)
je 0x32437
cmpq %rcx, %r14
sete %cl
orb %al, %cl
testb $0x1, %cl
jne 0x32384
movl 0x70(%rbx), %eax
cmpl 0x70(%r9), %eax
je 0x32437
cmpb $0x0, -0x198(%rbp)
jne 0x323e1
movq -0x38(%rbp), %rax
movq (%rax,%r14,8), %rax
movl (%rax), %esi
bswapl %esi
movl 0x70(%r9), %ecx
movl %edi, -0x60(%rbp)
movq -0x70(%rbp), %rdi
movl $0x5, %edx
movl %r8d, -0x88(%rbp)
leaq -0x2c(%rbp), %r8
movq %r9, -0xa8(%rbp)
movl %r10d, -0x68(%rbp)
movb %r11b, -0x58(%rbp)
callq 0x22b09
movb -0x58(%rbp), %r11b
movl -0x68(%rbp), %r10d
movq -0xa8(%rbp), %r9
movl -0x88(%rbp), %r8d
movl -0x60(%rbp), %edi
movq -0x40(%rbp), %rax
movzwl (%rax,%r14,2), %eax
cmpw 0xa(%r9), %ax
jbe 0x32437
movq -0x38(%rbp), %rax
movq (%rax,%r14,8), %rsi
movl %edi, -0x60(%rbp)
movq %r9, %rdi
leaq -0x2c(%rbp), %rdx
movl %r8d, -0x88(%rbp)
movq %r9, -0xa8(%rbp)
movl %r10d, -0x68(%rbp)
movb %r11b, -0x58(%rbp)
callq 0x22f9e
movb -0x58(%rbp), %r11b
movl -0x68(%rbp), %r10d
movq -0xa8(%rbp), %r9
movl -0x88(%rbp), %r8d
movl -0x60(%rbp), %edi
movb -0xc0(%rbp), %al
movb %al, %r15b
subl %r15d, %edi
andb %r11b, %r15b
movzbl %r15b, %eax
addl %eax, %r8d
incq %r14
cmpq -0x98(%rbp), %r14
jne 0x322d1
cmpb $0x0, -0x198(%rbp)
jne 0x324b3
movl -0x50(%rbp), %r12d
testl %r12d, %r12d
movq -0x78(%rbp), %r15
jle 0x31f16
movl %r12d, %ebx
xorl %r14d, %r14d
movq -0x70(%rbp), %r13
movq -0x130(%rbp,%r14,8), %rax
movq 0x50(%rax), %rcx
movl 0x8(%rcx), %esi
bswapl %esi
movl 0x70(%rax), %ecx
movq %r13, %rdi
movl $0x5, %edx
leaq -0x2c(%rbp), %r8
callq 0x22b09
incq %r14
cmpq %r14, %rbx
jne 0x32481
jmp 0x31f16
movq -0x78(%rbp), %r15
movq -0x48(%rbp), %r14
movq -0x38(%rbp), %rbx
movl -0x50(%rbp), %r12d
movq %rbx, %rdi
callq 0x16d96
testl %r14d, %r14d
js 0x324f7
movl -0xc4(%rbp), %ebx
xorl %r14d, %r14d
movq -0xe0(%rbp,%r14,8), %rax
testq %rax, %rax
je 0x324ef
movq 0x68(%rax), %rdi
callq 0xdcd4
incq %r14
cmpq %r14, %rbx
jne 0x324d9
testl %r12d, %r12d
jle 0x32520
movl %r12d, %ebx
xorl %r14d, %r14d
movq -0x130(%rbp,%r14,8), %rax
testq %rax, %rax
je 0x32518
movq 0x68(%rax), %rdi
callq 0xdcd4
incq %r14
cmpq %r14, %rbx
jne 0x32502
movl -0x2c(%rbp), %r14d
movq -0xf8(%rbp), %r12
movq -0x100(%rbp), %rdi
testq %rdi, %rdi
je 0x3253c
callq 0x1cf8c
movq %r12, -0x100(%rbp)
movq -0xb8(%rbp), %rax
movb $0x0, 0x1(%rax)
testq %rax, %rax
je 0x3255c
movq 0x68(%rax), %rdi
callq 0xdcd4
decw 0x7a(%r15)
movb $0x1, %al
testb %al, %al
je 0x325a7
testl %r14d, %r14d
je 0x3114f
jmp 0x325a7
movq %rbx, %rdi
movq -0x58(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x32b36
cmpl $0x0, -0x2c(%rbp)
movq -0x48(%rbp), %r14
jne 0x31f1a
movq 0x48(%rbx), %rdi
movl 0x70(%rbx), %edx
movq %rbx, %rsi
callq 0x32647
movl %eax, -0x2c(%rbp)
jmp 0x31f1a
movq -0x100(%rbp), %rdi
testq %rdi, %rdi
je 0x325b8
callq 0x1cf8c
movl %r14d, %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq