// File: /workspace/github_c_makefile_star2_O3/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, %r13
movq 0x8(%rdi), %rax
movl 0x34(%rax), %eax
addl %eax, %eax
movl $0xaaaaaaab, %ecx       # imm = 0xAAAAAAAB
imulq %rax, %rcx
shrq $0x21, %rcx
movq %rcx, -0x1f0(%rbp)
movzwl 0x7a(%rdi), %edx
movq $0x0, -0xe8(%rbp)
movq %rdi, -0x188(%rbp)
movswq %dx, %rax
movq 0xa8(%r13,%rax,8), %r15
movb 0x1(%r15), %cl
testw %ax, %ax
je 0x31959
testb %cl, %cl
jne 0x3192b
movzwl 0xe(%r15), %ecx
cmpl %ecx, -0x1f0(%rbp)
jae 0x32cc1
movl %edx, -0xfc(%rbp)
movq 0xa0(%r13,%rax,8), %r12
movzwl 0x7a(%r13,%rax,2), %ebx
movq 0x68(%r12), %rdi
callq 0xdfbf
testl %eax, %eax
je 0x31a78
movl %eax, %r14d
jmp 0x31df2
testb %cl, %cl
je 0x32cc1
movq $0x0, -0x130(%rbp)
movl $0x0, -0xd0(%rbp)
movq 0x48(%r15), %rbx
movq 0x68(%r15), %rdi
callq 0xdfbf
testl %eax, %eax
jne 0x32cc6
movl 0x70(%r15), %ecx
movq %rbx, %rdi
leaq -0x130(%rbp), %rsi
leaq -0xd0(%rbp), %rdx
xorl %r8d, %r8d
callq 0x21af9
movl %eax, -0x1d0(%rbp)
movq -0x130(%rbp), %r12
movq %r15, %rdi
movq %r12, %rsi
leaq -0x1d0(%rbp), %r14
movq %r14, %rdx
callq 0x33216
cmpb $0x0, 0x21(%rbx)
je 0x319ea
movl -0xd0(%rbp), %esi
movl 0x70(%r15), %ecx
movq %rbx, %rdi
movl $0x5, %edx
movq %r14, %r8
callq 0x22705
movl -0x1d0(%rbp), %r14d
testl %r14d, %r14d
jne 0x32cd6
leaq 0x14(%r12), %rdi
leaq 0x14(%r15), %rsi
movzbl 0x1(%r15), %edx
addl %edx, %edx
callq 0x82f0
leaq 0x20(%r12), %rdi
leaq 0x20(%r15), %rsi
movzbl 0x1(%r15), %edx
shll $0x3, %edx
callq 0x82f0
movb 0x1(%r15), %al
movb %al, 0x1(%r12)
movq 0x50(%r12), %rax
movzbl (%rax), %esi
andl $-0x9, %esi
movq %r15, %rdi
callq 0x20600
movq 0x50(%r15), %rax
movzbl 0x5(%r15), %ecx
movl -0xd0(%rbp), %edx
bswapl %edx
movl %edx, 0x8(%rax,%rcx)
movq %r12, 0xb0(%r13)
movl $0x1, 0x7a(%r13)
movw $0x0, 0x7e(%r13)
xorl %r14d, %r14d
movw $0x1, %dx
jmp 0x31e0c
movq %r12, -0x50(%rbp)
cmpb $0x0, 0x4(%r15)
je 0x31c5c
cmpb $0x1, 0x1(%r15)
jne 0x31c5c
movzwl 0x14(%r15), %eax
cmpw 0x10(%r15), %ax
jne 0x31c5c
movq -0x50(%rbp), %rcx
cmpl $0x1, 0x70(%rcx)
je 0x31c5c
movq -0x50(%rbp), %rcx
cmpw %bx, 0x10(%rcx)
jne 0x31c5c
testw %ax, %ax
je 0x32704
movq 0x48(%r15), %rbx
movq %rbx, %rdi
leaq -0x130(%rbp), %rsi
leaq -0x1b0(%rbp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x21af9
movl %eax, %r14d
movl %eax, -0xd0(%rbp)
testl %eax, %eax
jne 0x31df2
movq 0x20(%r15), %r13
movq %r13, -0x1d0(%rbp)
movq %r15, %rdi
movq %r13, %rsi
callq 0x30fe4
movl %eax, %r14d
movw %ax, -0x150(%rbp)
movq -0x130(%rbp), %r12
movq %r12, %rdi
movl $0xd, %esi
callq 0x20600
movq %r12, %rdi
movl $0x1, %esi
leaq -0x1d0(%rbp), %rdx
leaq -0x150(%rbp), %rcx
callq 0x332c9
cmpb $0x0, 0x21(%rbx)
je 0x31b87
movl -0x1b0(%rbp), %esi
movq -0x50(%rbp), %rax
movl 0x70(%rax), %ecx
movq %rbx, %rdi
movl $0x5, %edx
leaq -0xd0(%rbp), %r8
callq 0x22705
cmpw 0xa(%r12), %r14w
jbe 0x31b87
movq %r12, %rdi
movq %r13, %rsi
leaq -0xd0(%rbp), %rdx
callq 0x22b30
movzwl 0x12(%r15), %eax
movq 0x50(%r15), %rdx
movq 0x60(%r15), %rcx
movzwl 0x10(%r15), %esi
movzbl -0x2(%rcx,%rsi,2), %edi
shll $0x8, %edi
movzbl -0x1(%rcx,%rsi,2), %esi
orl %edi, %esi
andl %eax, %esi
leaq (%rdx,%rsi), %rcx
leaq (%rdx,%rsi), %rdi
addq $0x2, %rdi
xorl %esi, %esi
movq %rdi, %rdx
leaq 0x1(%rcx), %rax
cmpq $0x7, %rsi
ja 0x31bd4
incq %rsi
leaq 0x1(%rdx), %rdi
cmpb $0x0, (%rcx)
movq %rax, %rcx
js 0x31bb8
addq $0x9, %rax
movl $0x4, %ecx
movq -0x188(%rbp), %r13
movq -0x50(%rbp), %rbx
movb -0x1(%rdx), %sil
movb %sil, -0x205(%rbp,%rcx)
incq %rcx
testb %sil, %sil
jns 0x31c08
leaq 0x1(%rdx), %rsi
cmpq %rax, %rdx
movq %rsi, %rdx
jb 0x31be8
movzwl 0x10(%rbx), %esi
movl 0x70(%r15), %r9d
leaq -0xd0(%rbp), %rax
movq %rax, (%rsp)
movq %rbx, %rdi
leaq -0x205(%rbp), %rdx
xorl %r8d, %r8d
callq 0x31552
movq 0x50(%rbx), %rax
movzbl 0x5(%rbx), %ecx
movl -0x1b0(%rbp), %edx
bswapl %edx
movl %edx, 0x8(%rax,%rcx)
testq %r12, %r12
je 0x31c50
movq 0x68(%r12), %rdi
callq 0xddd3
movl -0xd0(%rbp), %r14d
jmp 0x31df2
movq 0x8(%r13), %rax
movl 0x30(%rax), %edi
callq 0x1cc98
movq %rax, -0xd8(%rbp)
testq %rax, %rax
je 0x31ca9
movzbl 0x79(%r13), %eax
movq %rax, -0x80(%rbp)
movq -0x50(%rbp), %rdi
movzbl 0x1(%rdi), %ecx
movzwl 0x10(%rdi), %eax
leal (%rax,%rcx), %r9d
xorl %edx, %edx
cmpl $0x2, %r9d
jb 0x31cc6
testl %ebx, %ebx
je 0x31cb4
cmpl %ebx, %r9d
jne 0x31cb8
movq -0x80(%rbp), %rdx
addl %ebx, %edx
addl $-0x2, %edx
jmp 0x31cbc
movl $0x7, %r14d
jmp 0x31dd3
xorl %edx, %edx
jmp 0x31cbc
decl %ebx
movl %ebx, %edx
movl $0x2, %r9d
subl -0x80(%rbp), %r9d
movq %rdx, -0xf8(%rbp)
subl %ecx, %edx
addl %r9d, %edx
movq 0x50(%rdi), %r8
cmpl %eax, %edx
movq %r15, -0x60(%rbp)
jne 0x31ceb
movzbl 0x5(%rdi), %eax
addq %rax, %r8
addq $0x8, %r8
jmp 0x31d09
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, -0x1e0(%rbp)
movq 0x48(%rdi), %rdi
leal 0x1(%r9), %r12d
movl (%r8), %r14d
bswapl %r14d
movslq %r9d, %r13
leaq -0xd0(%rbp,%r13,8), %r15
movq %rdi, -0x78(%rbp)
movl %r14d, %esi
movq %r15, %rdx
xorl %ecx, %ecx
movq %r9, -0x48(%rbp)
callq 0x30bd2
movl %eax, -0x2c(%rbp)
movl %r12d, %ebx
testl %eax, %eax
je 0x31e1a
movslq %ebx, %rdx
shlq $0x3, %rdx
xorl %ebx, %ebx
leaq -0xd0(%rbp), %rdi
xorl %esi, %esi
callq 0x8200
xorl %r13d, %r13d
movq -0x60(%rbp), %r15
movq -0x48(%rbp), %r14
movq %rbx, %rdi
callq 0x16dea
testl %r14d, %r14d
js 0x31d9f
movl %r12d, %ebx
xorl %r14d, %r14d
movq -0xd0(%rbp,%r14,8), %rax
testq %rax, %rax
je 0x31d97
movq 0x68(%rax), %rdi
callq 0xddd3
incq %r14
cmpq %r14, %rbx
jne 0x31d81
testl %r13d, %r13d
jle 0x31dc8
movl %r13d, %ebx
xorl %r14d, %r14d
movq -0x130(%rbp,%r14,8), %rax
testq %rax, %rax
je 0x31dc0
movq 0x68(%rax), %rdi
callq 0xddd3
incq %r14
cmpq %r14, %rbx
jne 0x31daa
movl -0x2c(%rbp), %r14d
movq -0x188(%rbp), %r13
movq -0xe8(%rbp), %rdi
testq %rdi, %rdi
je 0x31de4
callq 0x1cdc9
movq -0xd8(%rbp), %rax
movq %rax, -0xe8(%rbp)
movb $0x0, 0x1(%r15)
movq 0x68(%r15), %rdi
callq 0xddd3
movzwl 0x7a(%r13), %edx
decl %edx
movw %dx, 0x7a(%r13)
testl %r14d, %r14d
je 0x31901
jmp 0x32cf0
movl %r14d, -0x68(%rbp)
movq %r13, -0xa8(%rbp)
movl %r12d, -0x30(%rbp)
movq (%r15), %rax
movzwl 0x10(%rax), %ecx
movzbl 0x1(%rax), %eax
leal (%rcx,%rax), %r15d
incl %r15d
movq -0x48(%rbp), %r14
testl %r14d, %r14d
je 0x3201e
leaq -0x174(%rbp), %rax
movq -0xa8(%rbp), %rdx
leaq (%rax,%rdx,4), %rax
movq %rax, -0x98(%rbp)
leaq -0x228(%rbp), %rax
leaq (%rax,%rdx,8), %rax
movq %rax, -0x70(%rbp)
leaq -0xd8(%rbp), %rax
leaq (%rax,%rdx,8), %r13
movq -0xf8(%rbp), %rcx
leal (%rcx,%r14), %eax
addl %r14d, %ecx
decl %ecx
movq %rcx, -0x40(%rbp)
leal -0x2(,%rax,2), %r8d
negq %rdx
movq %rdx, -0x90(%rbp)
xorl %ebx, %ebx
xorl %r12d, %r12d
movq %r13, -0x58(%rbp)
movq %r12, -0xa0(%rbp)
movq -0x50(%rbp), %rdi
movzwl 0x14(%rdi), %ecx
movq -0x40(%rbp), %rax
leal (%rax,%rbx), %edx
movb 0x1(%rdi), %al
cmpl %ecx, %edx
movl %r8d, -0x38(%rbp)
jne 0x31f00
testb %al, %al
je 0x31f00
movq 0x20(%rdi), %rsi
movq -0x70(%rbp), %rax
movq %rsi, (%rax,%rbx,8)
movl (%rsi), %r14d
bswapl %r14d
movq %rdi, %r13
callq 0x30fe4
movzwl %ax, %eax
movq -0x98(%rbp), %rcx
movl %eax, (%rcx,%rbx,4)
movb $0x0, 0x1(%r13)
jmp 0x31fc0
movzbl %al, %eax
movzwl 0x12(%rdi), %ecx
movq 0x50(%rdi), %rdx
movq 0x60(%rdi), %rsi
addl %eax, %eax
subl %eax, %r8d
movslq %r8d, %rax
movzbl (%rsi,%rax), %r8d
shll $0x8, %r8d
movzbl 0x1(%rsi,%rax), %eax
orl %r8d, %eax
andl %ecx, %eax
leaq (%rdx,%rax), %r13
movq -0x70(%rbp), %rcx
movq %r13, (%rcx,%rbx,8)
movl (%rdx,%rax), %r14d
movq %r13, %rsi
callq 0x30fe4
movq -0x50(%rbp), %rdi
movzwl %ax, %r12d
movq -0x98(%rbp), %rax
movl %r12d, (%rax,%rbx,4)
movq -0x78(%rbp), %rax
testb $0x4, 0x26(%rax)
je 0x31fa4
movl 0x50(%rdi), %ecx
movl %r13d, %eax
subl %ecx, %eax
leal (%rax,%r12), %ecx
movq -0x78(%rbp), %rdx
cmpl 0x34(%rdx), %ecx
jg 0x326a8
movslq %eax, %rdi
addq -0xd8(%rbp), %rdi
movl %r12d, %edx
movq %r13, %rsi
callq 0x82f0
movq -0x50(%rbp), %rdi
subq 0x50(%rdi), %r13
addq -0xd8(%rbp), %r13
movq -0x70(%rbp), %rax
movq %r13, (%rax,%rbx,8)
bswapl %r14d
movzbl 0x1(%rdi), %eax
movq -0x40(%rbp), %rcx
leal (%rcx,%rbx), %esi
subl %eax, %esi
movl %r12d, %edx
leaq -0x2c(%rbp), %rcx
callq 0x31267
movq -0x58(%rbp), %r13
movq -0xa0(%rbp), %r12
leaq (%r12,%r13), %rdx
movq -0x78(%rbp), %rdi
movl %r14d, -0x68(%rbp)
movl %r14d, %esi
xorl %ecx, %ecx
callq 0x30bd2
movl %eax, -0x2c(%rbp)
testl %eax, %eax
jne 0x32523
movq (%r13,%rbx,8), %rax
movzwl 0x10(%rax), %ecx
addl %ecx, %r15d
movzbl 0x1(%rax), %eax
addl %eax, %r15d
incl %r15d
addq $-0x8, %r12
decq %rbx
movl -0x38(%rbp), %r8d
addl $-0x2, %r8d
cmpq %rbx, -0x90(%rbp)
jne 0x31eaa
movl -0x68(%rbp), %eax
movl %eax, -0xe0(%rbp)
addl $0x3, %r15d
andl $-0x4, %r15d
movq -0x78(%rbp), %rbx
movl 0x30(%rbx), %eax
leal (%r15,%r15,4), %ecx
leal (%rax,%rcx,2), %ecx
movl %eax, %edi
addl $0x78, %edi
movl %edi, -0x84(%rbp)
movl -0x30(%rbp), %r12d
imull %r12d, %edi
addl %ecx, %edi
callq 0x16d29
testq %rax, %rax
je 0x3252f
movslq %r15d, %rdi
leaq (%rax,%rdi,8), %rdx
movq -0xd0(%rbp), %rsi
movzbl 0x3(%rsi), %ecx
movq %rcx, -0x178(%rbp)
leal (,%rcx,4), %ecx
movq %rcx, -0xb0(%rbp)
movq %rsi, -0x180(%rbp)
movzbl 0x4(%rsi), %ecx
movq %rcx, -0xb8(%rbp)
movq -0x48(%rbp), %rcx
testl %ecx, %ecx
movq %rax, -0x38(%rbp)
movq %rdx, -0xa0(%rbp)
js 0x3253d
leaq (%rdx,%rdi,2), %rcx
movq %rcx, -0x190(%rbp)
movl %r12d, %ecx
movq %rcx, -0x1f8(%rbp)
movq %rdi, -0xf0(%rbp)
leaq (%rdi,%rdi,4), %rcx
leaq (%rax,%rcx,2), %rdx
movq %rdx, -0x1e8(%rbp)
leaq (%rax,%rcx,2), %rax
addq $0x79, %rax
movq %rax, -0x1d8(%rbp)
movq $0x0, -0x58(%rbp)
xorl %esi, %esi
xorl %r14d, %r14d
movl $0x0, -0xdc(%rbp)
movl -0x84(%rbp), %eax
movl 0x30(%rbx), %r12d
movl %eax, %edx
imull %esi, %edx
addl %r12d, %edx
movq -0x190(%rbp), %r8
leaq (%r8,%rdx), %r13
movq %r13, -0x1b0(%rbp,%rsi,8)
movq %rsi, -0x90(%rbp)
movq -0xd0(%rbp,%rsi,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 0x32204
movslq %r14d, %r14
addl -0x58(%rbp), %r12d
addq -0x1e8(%rbp), %r12
xorl %ebx, %ebx
movzbl 0x1(%r13), %eax
movl %ebx, %ecx
testq %rax, %rax
je 0x321b2
addq $0x9, %rax
movl %ebx, %ecx
movzwl (%r12,%rax,2), %edx
cmpl %edx, %ecx
jl 0x321a1
je 0x321d4
decl %ecx
leaq -0x1(%rax), %rdx
addq $-0x9, %rax
cmpq $0x1, %rax
movq %rdx, %rax
ja 0x32194
movzwl 0x12(%r13), %eax
movq 0x60(%r13), %rdx
movslq %ecx, %rcx
movzbl (%rdx,%rcx,2), %edi
shll $0x8, %edi
movzbl 0x1(%rdx,%rcx,2), %esi
orl %edi, %esi
andl %eax, %esi
addq 0x50(%r13), %rsi
jmp 0x321d9
movq -0x30(%r12,%rax,8), %rsi
movq -0x38(%rbp), %rax
movq %rsi, (%rax,%r14,8)
movq %r13, %rdi
callq 0x30fe4
movq -0xa0(%rbp), %rcx
movw %ax, (%rcx,%r14,2)
incq %r14
incl %ebx
cmpl %r15d, %ebx
jne 0x32182
jmp 0x32296
testl %r15d, %r15d
je 0x3229a
movzwl 0xc(%r13), %eax
movzwl 0x12(%r13), %ecx
movq %rcx, -0x40(%rbp)
movslq %r14d, %rcx
movl %r15d, %esi
movq %rsi, -0x70(%rbp)
addl -0x58(%rbp), %r12d
addq -0x1d8(%rbp), %r12
addq %rax, %r12
movq -0xa0(%rbp), %rax
leaq (%rax,%rcx,2), %rax
movq %rax, -0x68(%rbp)
movq -0x38(%rbp), %rax
leaq (%rax,%rcx,8), %rax
movq %rax, -0x98(%rbp)
xorl %ebx, %ebx
movzbl -0x1(%r12,%rbx,2), %eax
shll $0x8, %eax
movzbl (%r12,%rbx,2), %esi
orl %eax, %esi
andl -0x40(%rbp), %esi
addq %rdx, %rsi
movq -0x98(%rbp), %rax
movq %rsi, (%rax,%rbx,8)
movq %rdx, %r15
movq %r13, %rdi
callq 0x30fe4
movq %r15, %rdx
movq -0x68(%rbp), %rcx
movw %ax, (%rcx,%rbx,2)
incq %rbx
cmpq %rbx, -0x70(%rbp)
jne 0x32253
addl %ebx, %r14d
movq -0x78(%rbp), %rbx
movq -0x90(%rbp), %rsi
cmpq -0xa8(%rbp), %rsi
movq -0x60(%rbp), %r15
movq -0xa0(%rbp), %r12
jge 0x3233d
cmpb $0x0, -0xb8(%rbp)
jne 0x3233d
movl -0x170(%rbp,%rsi,4), %eax
movzwl %ax, %edx
movslq %r14d, %r15
movw %dx, (%r12,%r15,2)
movq %r12, %rbx
movslq -0xdc(%rbp), %r12
addq -0x190(%rbp), %r12
movq -0x220(%rbp,%rsi,8), %rsi
movq %r12, %rdi
movq %rdx, -0x40(%rbp)
callq 0x82f0
movq -0xb0(%rbp), %rcx
addq %rcx, %r12
movq -0x38(%rbp), %rax
movq %r12, (%rax,%r15,8)
movzwl (%rbx,%r15,2), %eax
movzwl %cx, %ecx
subl %ecx, %eax
movw %ax, (%rbx,%r15,2)
cmpb $0x0, 0x3(%r13)
je 0x32345
cmpw $0x3, %ax
movq -0xa0(%rbp), %r12
movl -0x84(%rbp), %eax
ja 0x3235d
movw $0x4, (%r12,%r15,2)
jmp 0x3235d
movl -0x84(%rbp), %eax
jmp 0x32379
movq 0x50(%r13), %rax
movl 0x8(%rax), %eax
movl %eax, (%r12)
movq -0xa0(%rbp), %r12
movl -0x84(%rbp), %eax
movq -0x40(%rbp), %rcx
addl %ecx, -0xdc(%rbp)
incl %r14d
movq -0x60(%rbp), %r15
movq -0x78(%rbp), %rbx
movq -0x90(%rbp), %rsi
incq %rsi
movq -0x58(%rbp), %rcx
addl %eax, %ecx
movq %rcx, -0x58(%rbp)
cmpq -0x1f8(%rbp), %rsi
jne 0x32107
movq -0xb0(%rbp), %rcx
movzwl %cx, %ecx
testl %r14d, %r14d
jle 0x3254b
movl 0x34(%rbx), %eax
movq %rcx, -0xb0(%rbp)
addl %eax, %ecx
addl $-0xc, %ecx
xorl %edx, %edx
movq -0xb8(%rbp), %rax
negq %rax
movl $0x0, %esi
sbbl %esi, %esi
xorl %r13d, %r13d
xorl %eax, %eax
movq -0x38(%rbp), %rbx
movslq %edx, %rdi
movzwl (%r12,%rdi,2), %edi
addl %eax, %edi
addl $0x2, %edi
cmpl %ecx, %edi
jle 0x32409
addl $0x2, %eax
movslq %r13d, %rdi
movl %eax, -0x170(%rbp,%rdi,4)
movl %edx, -0x150(%rbp,%rdi,4)
cmpl $0x4, %r13d
jge 0x3272e
addl %esi, %edx
incl %r13d
xorl %eax, %eax
jmp 0x3240b
movl %edi, %eax
incl %edx
cmpl %r14d, %edx
jl 0x323d1
movslq %r13d, %rcx
movl %eax, -0x170(%rbp,%rcx,4)
movl %r14d, -0x150(%rbp,%rcx,4)
testl %ecx, %ecx
setg %cl
movl %ecx, -0x70(%rbp)
jle 0x324f2
movl %r13d, %ecx
movq -0xf0(%rbp), %rsi
shlq $0x3, %rsi
movq -0xb8(%rbp), %rdx
addl %edx, %edx
subq %rdx, %rsi
addq %rbx, %rsi
movq %rsi, -0xf0(%rbp)
movq %rcx, %rdx
decq %rcx
movl %eax, %r8d
movl -0x174(%rbp,%rdx,4), %eax
movslq -0x154(%rbp,%rdx,4), %rdi
leal -0x1(%rdi), %esi
movq -0xf0(%rbp), %r9
leaq (%r9,%rdi,2), %rdi
testl %r8d, %r8d
je 0x324ab
cmpl $0x0, -0x80(%rbp)
jne 0x324d9
movzwl (%rdi), %r9d
addl %r8d, %r9d
addl $0x2, %r9d
movslq %esi, %r10
movzwl (%r12,%r10,2), %r11d
movl %eax, %r10d
subl %r11d, %r10d
addl $-0x2, %r10d
cmpl %r10d, %r9d
jle 0x324c4
jmp 0x324d9
movzwl (%rdi), %r9d
movslq %esi, %r8
movzwl (%r12,%r8,2), %r8d
addl $0x2, %r9d
subl %r8d, %eax
addl $-0x2, %eax
movl %eax, %r10d
movl %esi, -0x150(%rbp,%rcx,4)
decl %esi
addq $-0x2, %rdi
movl %r9d, %r8d
movl %r10d, %eax
jmp 0x3247c
movl %r8d, -0x170(%rbp,%rdx,4)
movl %eax, -0x170(%rbp,%rcx,4)
cmpq $0x1, %rdx
jg 0x32456
movq -0x180(%rbp), %rax
cmpl $0x2, 0x70(%rax)
movq -0xa8(%rbp), %r12
jb 0x32574
movq 0x50(%rax), %rax
movzbl (%rax), %eax
movl %eax, -0x68(%rbp)
movb $0x1, %al
testl %r13d, %r13d
js 0x32760
movl %eax, -0x58(%rbp)
jmp 0x325af
addl -0x48(%rbp), %ebx
movl -0x30(%rbp), %r12d
jmp 0x31d4c
movl $0x7, -0x2c(%rbp)
xorl %ebx, %ebx
jmp 0x31d63
xorl %r14d, %r14d
movq -0x60(%rbp), %r15
movq -0xb0(%rbp), %rcx
movl $0x0, -0x170(%rbp)
movl %r14d, -0x150(%rbp)
movq -0x180(%rbp), %rax
cmpl $0x2, 0x70(%rax)
movq -0x38(%rbp), %rbx
movq -0xa8(%rbp), %r12
jae 0x3258d
xorl %r13d, %r13d
movl $0xb, %edi
leaq 0x47291(%rip), %rsi     # 0x79814
movl $0xdac9, %edx           # imm = 0xDAC9
jmp 0x32742
movq %rcx, -0xb0(%rbp)
movq 0x50(%rax), %rax
movzbl (%rax), %eax
movl %eax, -0x68(%rbp)
movl $0x0, -0x70(%rbp)
xorl %r13d, %r13d
movl $0x0, -0x58(%rbp)
leal 0x1(%r13), %r15d
xorl %ebx, %ebx
movl $0x0, -0x40(%rbp)
cmpq %r12, %rbx
jle 0x32647
movq %r15, %r12
movl $0x1, %ecx
cmpb $0x0, -0x80(%rbp)
jne 0x325d9
movl -0xe0(%rbp), %ecx
movq -0x78(%rbp), %r15
movq %r15, %rdi
leaq -0x1d0(%rbp), %rsi
leaq -0xe0(%rbp), %rdx
xorl %r8d, %r8d
callq 0x21af9
movl %eax, -0x2c(%rbp)
testl %eax, %eax
jne 0x32693
movq -0x1d0(%rbp), %rax
movq %rax, -0x130(%rbp,%rbx,8)
incl -0x40(%rbp)
cmpb $0x0, 0x21(%r15)
je 0x32678
movl 0x70(%rax), %esi
movq -0x50(%rbp), %rax
movl 0x70(%rax), %ecx
movq %r15, %rdi
movl $0x5, %edx
leaq -0x2c(%rbp), %r8
callq 0x22705
cmpl $0x0, -0x2c(%rbp)
movq %r12, %r15
movq -0xa8(%rbp), %r12
je 0x32682
jmp 0x32693
movq -0xd0(%rbp,%rbx,8), %rax
movq %rax, -0x130(%rbp,%rbx,8)
movq $0x0, -0xd0(%rbp,%rbx,8)
movq 0x68(%rax), %rdi
callq 0xdfbf
movl %eax, -0x2c(%rbp)
incl -0x40(%rbp)
testl %eax, %eax
je 0x32682
jmp 0x32693
movq %r12, %r15
movq -0xa8(%rbp), %r12
incq %rbx
cmpq %rbx, %r15
jne 0x325bc
jmp 0x3276d
movq -0x60(%rbp), %r15
movl -0x30(%rbp), %r12d
movq -0x38(%rbp), %rbx
movl -0x40(%rbp), %r13d
jmp 0x31d6a
xorl %ebx, %ebx
movl $0xb, %edi
leaq 0x4715e(%rip), %rsi     # 0x79814
movl $0xda00, %edx           # imm = 0xDA00
leaq 0x46e77(%rip), %rcx     # 0x79539
xorl %eax, %eax
callq 0xb9c7
movl $0xb, -0x2c(%rbp)
movq -0xa8(%rbp), %rax
movq -0xa0(%rbp), %rcx
leaq (%rcx,%rax,8), %rdx
leaq -0xd0(%rbp), %rdi
xorl %esi, %esi
callq 0x8200
xorl %r13d, %r13d
movq -0x60(%rbp), %r15
movq -0x48(%rbp), %r14
movl -0x30(%rbp), %r12d
jmp 0x31d6e
movl $0xb, %r14d
movl $0xb, %edi
leaq 0x470fe(%rip), %rsi     # 0x79814
movl $0xd8af, %edx           # imm = 0xD8AF
leaq 0x46e17(%rip), %rcx     # 0x79539
xorl %eax, %eax
callq 0xb9c7
jmp 0x31df2
xorl %r13d, %r13d
movl $0xb, %edi
leaq 0x470d7(%rip), %rsi     # 0x79814
movl $0xda8b, %edx           # imm = 0xDA8B
leaq 0x46df0(%rip), %rcx     # 0x79539
xorl %eax, %eax
callq 0xb9c7
movl $0xb, -0x2c(%rbp)
movl -0x30(%rbp), %r12d
jmp 0x31d6a
movl %eax, -0x58(%rbp)
xorl %r15d, %r15d
movl $0x0, -0x40(%rbp)
cmpl -0x48(%rbp), %r15d
jg 0x327bd
movl %r15d, %eax
decl %r15d
leaq -0xd0(,%rax,8), %r12
addq %rbp, %r12
movq (%r12), %rbx
movq 0x48(%rbx), %rdi
movl 0x70(%rbx), %edx
movq %rbx, %rsi
callq 0x32d90
testl %eax, %eax
jne 0x32a39
movq 0x68(%rbx), %rdi
callq 0xddd3
movq $0x0, (%r12)
incl %r15d
addq $0x8, %r12
cmpl %r15d, -0x48(%rbp)
jg 0x32784
movl $0x0, -0x2c(%rbp)
cmpb $0x0, -0x70(%rbp)
je 0x32832
movl %r13d, %eax
incl %r13d
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, %r13
jne 0x327e8
movslq %r8d, %rdi
cmpq %rdi, %rdx
jge 0x32827
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 0x327d7
movslq -0x40(%rbp), %rax
movq -0x138(%rbp,%rax,8), %rcx
movq %rcx, -0x90(%rbp)
movl 0x70(%rcx), %ecx
bswapl %ecx
movq -0x1e0(%rbp), %rdx
movl %ecx, (%rdx)
testl %eax, %eax
jle 0x329b9
movl -0x40(%rbp), %eax
movq %rax, -0x98(%rbp)
xorl %r15d, %r15d
xorl %ebx, %ebx
movl $0x0, -0x80(%rbp)
movq -0x130(%rbp,%r15,8), %r13
movq %r13, %rdi
movl -0x68(%rbp), %esi
callq 0x20600
movq %r15, -0x70(%rbp)
movl -0x150(%rbp,%r15,4), %r15d
movl %r15d, %esi
subl %ebx, %esi
movslq %ebx, %rax
movq -0x38(%rbp), %rbx
leaq (%rbx,%rax,8), %rdx
movq -0xa0(%rbp), %r12
leaq (%r12,%rax,2), %rcx
movq %r13, %rdi
callq 0x332c9
movq %r15, %rsi
cmpl %r14d, %esi
jge 0x329a3
movslq %esi, %rax
movq (%rbx,%rax,8), %r8
movzwl (%r12,%rax,2), %ecx
movq -0xb0(%rbp), %rdx
leal (%rdx,%rcx), %ebx
movslq -0x80(%rbp), %r15
addq -0xd8(%rbp), %r15
cmpb $0x0, 0x3(%r13)
je 0x3292f
cmpq $0x0, -0xb8(%rbp)
je 0x3293e
movq %rax, %rcx
decq %rcx
movq %rcx, %r12
movq -0x38(%rbp), %rcx
movq -0x8(%rcx,%rax,8), %rsi
movq %r13, %rdi
leaq -0x1d0(%rbp), %rdx
callq 0x2121e
leaq 0x4(%r15), %rdi
movq -0x1d0(%rbp), %rsi
callq 0x308ff
movl %eax, %ebx
addl $0x4, %ebx
movq %r15, %r8
xorl %r15d, %r15d
jmp 0x32960
movq %rsi, %r12
movq 0x50(%r13), %rax
movl (%r8), %ecx
movl %ecx, 0x8(%rax)
jmp 0x32960
movq %rsi, %r12
addq $-0x4, %r8
cmpw $0x4, %cx
jne 0x32960
movq -0x50(%rbp), %rdi
movq %r8, %rsi
movq %r8, %rbx
callq 0x30fe4
movq %rbx, %r8
movzwl %ax, %ebx
leaq -0x2c(%rbp), %rax
movl 0x70(%r13), %r9d
movq %rax, (%rsp)
movq -0x50(%rbp), %rdi
movq -0xf8(%rbp), %r13
movl %r13d, %esi
movq %r8, %rdx
movl %ebx, %ecx
movq %r15, %r8
callq 0x31552
cmpl $0x0, -0x2c(%rbp)
jne 0x32a3c
addl %ebx, -0x80(%rbp)
movq %r12, %rsi
incl %esi
incl %r13d
movq %r13, -0xf8(%rbp)
movq -0x70(%rbp), %r15
incq %r15
movl %esi, %ebx
cmpq %r15, -0x98(%rbp)
jne 0x32871
testb $0x8, -0x68(%rbp)
jne 0x329e3
movq -0xa8(%rbp), %rax
movq -0x1b0(%rbp,%rax,8), %rax
movq 0x50(%rax), %rax
movq -0x90(%rbp), %rcx
movq 0x50(%rcx), %rcx
movl 0x8(%rax), %eax
movl %eax, 0x8(%rcx)
cmpw $0x1, -0xfc(%rbp)
movq -0x60(%rbp), %r15
movq -0x48(%rbp), %r12
movq -0x50(%rbp), %rsi
movl -0x40(%rbp), %r13d
jne 0x32a19
cmpw $0x0, 0x10(%rsi)
jne 0x32a19
movzbl 0x5(%rsi), %eax
movq -0x130(%rbp), %rbx
cmpw %ax, 0xe(%rbx)
jae 0x32c91
movq -0x78(%rbp), %rax
cmpb $0x0, 0x21(%rax)
je 0x32a55
movq -0x1b0(%rbp), %rbx
movzbl 0x1(%rbx), %edi
testl %edi, %edi
je 0x32a67
movzwl 0x14(%rbx), %r13d
jmp 0x32a6d
movl %eax, -0x2c(%rbp)
movq -0x60(%rbp), %r15
movq -0x48(%rbp), %r14
movl -0x30(%rbp), %r12d
movq -0x38(%rbp), %rbx
movl -0x40(%rbp), %r13d
jmp 0x31d6e
movl -0x30(%rbp), %eax
movq -0x38(%rbp), %rbx
movq %r12, %r14
movl %eax, %r12d
jmp 0x31d6e
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movl -0x58(%rbp), %eax
testb %al, %al
je 0x32c19
movq -0x130(%rbp), %r8
movzwl 0x10(%rbx), %r15d
addl %edi, %r15d
xorl %eax, %eax
cmpq $0x0, -0xb8(%rbp)
sete %al
movq %rax, -0x58(%rbp)
movl %r14d, %eax
movq %rax, -0x90(%rbp)
xorl %r14d, %r14d
xorl %r12d, %r12d
xorl %r9d, %r9d
movl %r15d, %eax
cmpq %rax, %r14
jne 0x32afd
movq -0x58(%rbp), %rax
addl %r14d, %eax
movslq %r12d, %rcx
leaq -0x1a8(%rbp), %rdx
leaq (%rdx,%rcx,8), %rcx
movq (%rcx), %rbx
movzbl 0x1(%rbx), %edx
testl %edx, %edx
je 0x32add
movzwl 0x14(%rbx), %r13d
addl %eax, %r13d
movl %edx, %edi
movzwl 0x10(%rbx), %r15d
addl %eax, %r15d
addl %edx, %r15d
movl %r15d, %edx
incl %r12d
addq $0x8, %rcx
cmpq %rdx, %r14
je 0x32ac8
movq -0x58(%rbp), %rax
jmp 0x32aff
xorl %eax, %eax
movl %r13d, %ecx
xorl %r10d, %r10d
cmpq %rcx, %r14
sete -0x70(%rbp)
cmpl $0x2, %edi
setge %r11b
movslq %r9d, %rdx
movl -0x150(%rbp,%rdx,4), %esi
cmpq %rsi, %r14
jne 0x32b3c
leal 0x1(%rdx), %r9d
movq -0x128(%rbp,%rdx,8), %r8
cmpq $0x0, -0xb8(%rbp)
je 0x32bf6
cmpq %rcx, %r14
sete %cl
orb %al, %cl
testb $0x1, %cl
jne 0x32b56
movl 0x70(%rbx), %eax
cmpl 0x70(%r8), %eax
je 0x32bf6
cmpb $0x0, -0x178(%rbp)
jne 0x32ba8
movq -0x38(%rbp), %rax
movq (%rax,%r14,8), %rax
movl (%rax), %esi
bswapl %esi
movl 0x70(%r8), %ecx
movl %edi, -0x68(%rbp)
movq -0x78(%rbp), %rdi
movl $0x5, %edx
movq %r8, -0x98(%rbp)
leaq -0x2c(%rbp), %r8
movl %r9d, -0x80(%rbp)
movb %r11b, -0x50(%rbp)
callq 0x22705
movb -0x50(%rbp), %r11b
xorl %r10d, %r10d
movl -0x80(%rbp), %r9d
movq -0x98(%rbp), %r8
movl -0x68(%rbp), %edi
movq -0xa0(%rbp), %rax
movzwl (%rax,%r14,2), %eax
cmpw 0xa(%r8), %ax
jbe 0x32bf6
movq -0x38(%rbp), %rax
movq (%rax,%r14,8), %rsi
movl %edi, -0x68(%rbp)
movq %r8, %rdi
leaq -0x2c(%rbp), %rdx
movq %r8, -0x98(%rbp)
movl %r9d, -0x80(%rbp)
movb %r11b, -0x50(%rbp)
callq 0x22b30
movb -0x50(%rbp), %r11b
xorl %r10d, %r10d
movl -0x80(%rbp), %r9d
movq -0x98(%rbp), %r8
movl -0x68(%rbp), %edi
movb -0x70(%rbp), %al
movb %al, %r10b
subl %r10d, %edi
andb %r11b, %r10b
movzbl %r10b, %eax
addl %eax, %r13d
incq %r14
cmpq -0x90(%rbp), %r14
jne 0x32aab
movl -0x40(%rbp), %r13d
testl %r13d, %r13d
setle %al
cmpb $0x0, -0x178(%rbp)
setne %cl
orb %al, %cl
jne 0x32c7c
movl %r13d, %ebx
xorl %r14d, %r14d
leaq -0x2c(%rbp), %r15
movq -0x78(%rbp), %r12
movq -0x130(%rbp,%r14,8), %rax
movq 0x50(%rax), %rcx
movl 0x8(%rcx), %esi
bswapl %esi
movl 0x70(%rax), %ecx
movq %r12, %rdi
movl $0x5, %edx
movq %r15, %r8
callq 0x22705
incq %r14
cmpq %r14, %rbx
jne 0x32c3f
movq -0x60(%rbp), %r15
movl -0x30(%rbp), %r12d
movq -0x38(%rbp), %rbx
jmp 0x31d6a
movq -0x60(%rbp), %r15
movq -0x48(%rbp), %r14
movl -0x30(%rbp), %r12d
movq -0x38(%rbp), %rbx
jmp 0x31d6e
movq %rbx, %rdi
leaq -0x2c(%rbp), %rdx
callq 0x33216
cmpl $0x0, -0x2c(%rbp)
jne 0x32cb5
movq 0x48(%rbx), %rdi
movl 0x70(%rbx), %edx
movq %rbx, %rsi
callq 0x32d90
movl %eax, -0x2c(%rbp)
movq -0x38(%rbp), %rbx
movq %r12, %r14
jmp 0x326fb
xorl %r14d, %r14d
jmp 0x32cf0
movl %eax, %r14d
movq $0x0, 0xb0(%r13)
jmp 0x32cf0
movq $0x0, 0xb0(%r13)
testq %r12, %r12
je 0x32cf0
movq 0x68(%r12), %rdi
callq 0xddd3
movq -0xe8(%rbp), %rdi
testq %rdi, %rdi
je 0x32d01
callq 0x1cdc9
movl %r14d, %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq