// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3WalCheckpoint
SQLITE_PRIVATE int sqlite3WalCheckpoint(
  Wal *pWal,                      /* Wal connection */
  sqlite3 *db,                    /* Check this handle's interrupt flag */
  int eMode,                      /* PASSIVE, FULL, RESTART, or TRUNCATE */
  int (*xBusy)(void*),            /* Function to call when busy */
  void *pBusyArg,                 /* Context argument for xBusyHandler */
  int sync_flags,                 /* Flags to sync db file with (or 0) */
  int nBuf,                       /* Size of temporary buffer */
  u8 *zBuf,                       /* Temporary buffer to use */
  int *pnLog,                     /* OUT: Number of frames in WAL */
  int *pnCkpt                     /* OUT: Number of backfilled frames in WAL */
){
  int rc;                         /* Return code */
  int isChanged = 0;              /* True if a new wal-index header is loaded */
  int eMode2 = eMode;             /* Mode to pass to walCheckpoint() */
  int (*xBusy2)(void*) = xBusy;   /* Busy handler for eMode2 */

  assert( pWal->ckptLock==0 );
  assert( pWal->writeLock==0 );

  /* EVIDENCE-OF: R-62920-47450 The busy-handler callback is never invoked
  ** in the SQLITE_CHECKPOINT_PASSIVE mode. */
  assert( eMode!=SQLITE_CHECKPOINT_PASSIVE || xBusy==0 );

  if( pWal->readOnly ) return SQLITE_READONLY;
  WALTRACE(("WAL%p: checkpoint begins\n", pWal));

  /* Enable blocking locks, if possible. If blocking locks are successfully
  ** enabled, set xBusy2=0 so that the busy-handler is never invoked. */
  sqlite3WalDb(pWal, db);
  (void)walEnableBlocking(pWal);

  /* IMPLEMENTATION-OF: R-62028-47212 All calls obtain an exclusive
  ** "checkpoint" lock on the database file.
  ** EVIDENCE-OF: R-10421-19736 If any other process is running a
  ** checkpoint operation at the same time, the lock cannot be obtained and
  ** SQLITE_BUSY is returned.
  ** EVIDENCE-OF: R-53820-33897 Even if there is a busy-handler configured,
  ** it will not be invoked in this case.
  */
  rc = walLockExclusive(pWal, WAL_CKPT_LOCK, 1);
  testcase( rc==SQLITE_BUSY );
  testcase( rc!=SQLITE_OK && xBusy2!=0 );
  if( rc==SQLITE_OK ){
    pWal->ckptLock = 1;

    /* IMPLEMENTATION-OF: R-59782-36818 The SQLITE_CHECKPOINT_FULL, RESTART and
    ** TRUNCATE modes also obtain the exclusive "writer" lock on the database
    ** file.
    **
    ** EVIDENCE-OF: R-60642-04082 If the writer lock cannot be obtained
    ** immediately, and a busy-handler is configured, it is invoked and the
    ** writer lock retried until either the busy-handler returns 0 or the
    ** lock is successfully obtained.
    */
    if( eMode!=SQLITE_CHECKPOINT_PASSIVE ){
      rc = walBusyLock(pWal, xBusy2, pBusyArg, WAL_WRITE_LOCK, 1);
      if( rc==SQLITE_OK ){
        pWal->writeLock = 1;
      }else if( rc==SQLITE_BUSY ){
        eMode2 = SQLITE_CHECKPOINT_PASSIVE;
        xBusy2 = 0;
        rc = SQLITE_OK;
      }
    }
  }


  /* Read the wal-index header. */
  if( rc==SQLITE_OK ){
    walDisableBlocking(pWal);
    rc = walIndexReadHdr(pWal, &isChanged);
    (void)walEnableBlocking(pWal);
    if( isChanged && pWal->pDbFd->pMethods->iVersion>=3 ){
      sqlite3OsUnfetch(pWal->pDbFd, 0, 0);
    }
  }

  /* Copy data from the log to the database file. */
  if( rc==SQLITE_OK ){

    if( pWal->hdr.mxFrame && walPagesize(pWal)!=nBuf ){
      rc = SQLITE_CORRUPT_BKPT;
    }else{
      rc = walCheckpoint(pWal, db, eMode2, xBusy2, pBusyArg, sync_flags, zBuf);
    }

    /* If no error occurred, set the output variables. */
    if( rc==SQLITE_OK || rc==SQLITE_BUSY ){
      if( pnLog ) *pnLog = (int)pWal->hdr.mxFrame;
      if( pnCkpt ) *pnCkpt = (int)(walCkptInfo(pWal)->nBackfill);
    }
  }

  if( isChanged ){
    /* If a new wal-index header was loaded before the checkpoint was
    ** performed, then the pager-cache associated with pWal is now
    ** out of date. So zero the cached wal-index header to ensure that
    ** next time the pager opens a snapshot on this database it knows that
    ** the cache needs to be reset.
    */
    memset(&pWal->hdr, 0, sizeof(WalIndexHdr));
  }

  walDisableBlocking(pWal);
  sqlite3WalDb(pWal, 0);

  /* Release the locks. */
  sqlite3WalEndWriteTransaction(pWal);
  if( pWal->ckptLock ){
    walUnlockExclusive(pWal, WAL_CKPT_LOCK, 1);
    pWal->ckptLock = 0;
  }
  WALTRACE(("WAL%p: checkpoint %s\n", pWal, rc ? "failed" : "ok"));
#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
  if( rc==SQLITE_BUSY_TIMEOUT ) rc = SQLITE_BUSY;
#endif
  return (rc==SQLITE_OK && eMode!=eMode2 ? SQLITE_BUSY : rc);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movl $0x0, 0x64(%rsp)
movl $0x8, %eax
cmpb $0x0, 0x42(%rdi)
jne 0x2958fb
movq %r8, %r12
movl %edx, %r13d
movq %rdi, %r15
movq %rsi, 0xa0(%rsp)
movl %r9d, 0x44(%rsp)
xorl %ebp, %ebp
cmpb $0x0, 0x3f(%rdi)
movq %rcx, %rbx
jne 0x29583e
movq 0x8(%r15), %rdi
movq (%rdi), %rax
movl $0x1, %esi
movl $0x1, %edx
movl $0xa, %ecx
callq *0x70(%rax)
movq %rbx, %rcx
movl %eax, %ebp
testl %ebp, %ebp
je 0x29590d
movl %r13d, %r14d
testl %ebp, %ebp
jne 0x295896
movq %r12, 0x28(%rsp)
movl %r14d, %r12d
movl %r13d, %r14d
movq %rcx, %r13
leaq 0x64(%rsp), %rbx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x291964
movl %eax, %ebp
cmpl $0x0, (%rbx)
je 0x295888
movq 0x8(%r15), %rdi
movq (%rdi), %rax
cmpl $0x3, (%rax)
jl 0x295888
xorl %esi, %esi
xorl %edx, %edx
callq *0x90(%rax)
movq %r13, %rcx
movl %r14d, %r13d
movl %r12d, %r14d
movq 0x28(%rsp), %r12
testl %ebp, %ebp
je 0x295975
cmpl $0x0, 0x64(%rsp)
je 0x2958b7
xorps %xmm0, %xmm0
movups %xmm0, 0x68(%r15)
movups %xmm0, 0x58(%r15)
movups %xmm0, 0x48(%r15)
movq %r15, %rdi
callq 0x2925ee
cmpb $0x0, 0x41(%r15)
je 0x2958eb
cmpb $0x0, 0x3f(%r15)
jne 0x2958e6
movq 0x8(%r15), %rdi
movq (%rdi), %rax
movl $0x1, %esi
movl $0x1, %edx
movl $0x9, %ecx
callq *0x70(%rax)
movb $0x0, 0x41(%r15)
testl %ebp, %ebp
movl $0x5, %eax
cmovnel %ebp, %eax
cmpl %r13d, %r14d
cmovel %ebp, %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, 0x41(%r15)
testl %r13d, %r13d
je 0x295b3a
cmpb $0x0, 0x3f(%r15)
movl $0x0, %ebp
jne 0x295942
movq 0x8(%r15), %rdi
movq (%rdi), %rax
xorl %esi, %esi
movl $0x1, %edx
movl $0xa, %ecx
callq *0x70(%rax)
movq %rbx, %rcx
movl %eax, %ebp
testq %rcx, %rcx
je 0x295958
cmpl $0x5, %ebp
jne 0x295958
movq %r12, %rdi
callq *%rbx
movq %rbx, %rcx
testl %eax, %eax
jne 0x29591b
cmpl $0x5, %ebp
je 0x295b94
testl %ebp, %ebp
jne 0x295846
movb $0x1, 0x40(%r15)
xorl %ebp, %ebp
jmp 0x295846
movl 0x58(%r15), %ebx
testl %ebx, %ebx
je 0x29599c
movzwl 0x56(%r15), %eax
movl %eax, %edx
shll $0x10, %edx
orl %eax, %edx
andl $0x1fe00, %edx          # imm = 0x1FE00
cmpl 0x1e0(%rsp), %edx
jne 0x295b4d
movl %r13d, 0x1c(%rsp)
movzwl 0x56(%r15), %eax
movq 0x30(%r15), %rdx
movq (%rdx), %r13
movl 0x60(%r13), %edx
cmpl %ebx, %edx
jae 0x295b44
movq %r12, 0x28(%rsp)
movl %r14d, 0x18(%rsp)
movl %eax, %edx
shll $0x10, %edx
orl %eax, %edx
andl $0x1fe00, %edx          # imm = 0x1FE00
movl %edx, 0x40(%rsp)
movl 0x5c(%r15), %eax
movq %rax, 0x90(%rsp)
xorl %ebp, %ebp
movl $0x1, %r14d
movq %r15, 0x38(%rsp)
movq %r13, 0x48(%rsp)
movl 0x64(%r13,%r14,4), %r12d
cmpl %r12d, %ebx
jbe 0x295aa3
movl %ebx, 0xc(%rsp)
leaq 0x3(%r14), %rbx
movq %rcx, %r13
xorl %ebp, %ebp
cmpb $0x0, 0x3f(%r15)
jne 0x295a2f
movq 0x8(%r15), %rdi
movq (%rdi), %rax
movl %ebx, %esi
movl $0x1, %edx
movl $0xa, %ecx
callq *0x70(%rax)
movq %r13, %rcx
movl %eax, %ebp
testq %rcx, %rcx
je 0x295a48
cmpl $0x5, %ebp
jne 0x295a48
movq 0x28(%rsp), %rdi
callq *%r13
movq %r13, %rcx
testl %eax, %eax
jne 0x295a0b
cmpl $0x5, %ebp
je 0x295aa8
movl $0x5, %r15d
testl %ebp, %ebp
jne 0x295a98
cmpq $0x1, %r14
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovel 0xc(%rsp), %eax
movq 0x48(%rsp), %rdx
movl %eax, 0x64(%rdx,%r14,4)
xorl %r15d, %r15d
movq 0x38(%rsp), %rax
cmpb $0x0, 0x3f(%rax)
jne 0x295a96
movq 0x8(%rax), %rdi
movq (%rdi), %rax
movl %ebx, %esi
movl $0x1, %edx
movl $0x9, %ecx
callq *0x70(%rax)
movq %r13, %rcx
xorl %ebp, %ebp
movq 0x48(%rsp), %r13
movl 0xc(%rsp), %ebx
jmp 0x295ab5
xorl %r15d, %r15d
jmp 0x295ab5
xorl %r15d, %r15d
movl %r12d, %ebx
xorl %ecx, %ecx
movq 0x48(%rsp), %r13
testl %r15d, %r15d
jne 0x295b7d
incq %r14
cmpq $0x5, %r14
movq 0x38(%rsp), %r15
jne 0x2959f2
movl 0x60(%r13), %eax
cmpl %ebx, %eax
movq %rcx, 0x10(%rsp)
movl %ebx, 0xc(%rsp)
jae 0x295bb4
movabsq $0xffffffff021, %rax    # imm = 0xFFFFFFFF021
movl 0x60(%r13), %r14d
movl 0x58(%r15), %ecx
leal 0x1000(%rcx), %r15d
addq %rax, %r15
shrq $0xc, %r15
movq %r15, %rax
shlq $0x20, %rax
movq %rax, 0x70(%rsp)
sarq $0x1b, %rax
movq %rcx, 0x88(%rsp)
leaq (%rax,%rcx,2), %rbx
addq $0x28, %rbx
callq 0x27bed9
testl %eax, %eax
je 0x295bc5
xorl %r12d, %r12d
jmp 0x295bd0
xorl %ebp, %ebp
xorl %r14d, %r14d
jmp 0x295849
xorl %ebx, %ebx
xorl %ebp, %ebp
jmp 0x29630e
leaq 0x1497cb(%rip), %rsi    # 0x3df31f
leaq 0x1498d5(%rip), %rdx    # 0x3df430
leaq 0x149623(%rip), %r8     # 0x3df185
movl $0xb, %ebp
movl $0xb, %edi
movl $0xf6f6, %ecx           # imm = 0xF6F6
xorl %eax, %eax
callq 0x27e637
jmp 0x2963f6
cmpl $0x5, %r15d
jne 0x295ba0
xorl %ebx, %ebx
movq 0x38(%rsp), %r15
movl 0x18(%rsp), %r14d
jmp 0x2963e9
xorl %ebp, %ebp
xorl %r14d, %r14d
xorl %ecx, %ecx
jmp 0x295849
movq 0x38(%rsp), %r15
movl 0x18(%rsp), %r14d
movl 0x1c(%rsp), %r13d
jmp 0x2963f6
xorl %eax, %eax
movl 0x18(%rsp), %r14d
movq 0x28(%rsp), %r12
jmp 0x295f61
movq %rbx, %rdi
callq 0x27c381
movq %rax, %r12
testq %r12, %r12
je 0x295bfe
leal 0x1(%r15), %ebp
movq %r12, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x173a0
movl %ebp, 0x4(%r12)
callq 0x27bed9
testl %eax, %eax
movq %r12, 0x30(%rsp)
je 0x295c22
xorl %r13d, %r13d
jmp 0x295c3e
movl $0x7, %ebp
xorl %eax, %eax
movq 0x38(%rsp), %r15
movl 0x18(%rsp), %r14d
movq 0x28(%rsp), %r12
movq 0x10(%rsp), %rcx
movl 0xc(%rsp), %ebx
jmp 0x295f61
movl $0x1000, %edi           # imm = 0x1000
movq 0x88(%rsp), %rax
cmpl %edi, %eax
cmovbl %eax, %edi
addl %edi, %edi
callq 0x27c381
movq %rax, %r13
testq %r13, %r13
setne %cl
movl $0x7, %ebp
movl $0x0, %eax
cmovnel %eax, %ebp
movl 0xc(%rsp), %ebx
je 0x295f11
addl $0x1001, %r14d          # imm = 0x1001
movabsq $0xffffffff021, %rax    # imm = 0xFFFFFFFF021
addq %rax, %r14
shrq $0xc, %r14
cmpl %r15d, %r14d
movq 0x28(%rsp), %r12
jg 0x295f16
movq 0x30(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x98(%rsp)
movslq %r14d, %r14
sarq $0x20, 0x70(%rsp)
leaq 0x20(%rsp), %r15
movq 0x38(%rsp), %rdi
movl %r14d, %esi
leaq 0xa8(%rsp), %rdx
callq 0x292625
movl %eax, %ebp
testl %eax, %eax
sete %cl
jne 0x295ef9
movq %r14, %rax
movq 0xb0(%rsp), %r14
addq $0x4, %r14
movq %r14, 0xb0(%rsp)
movq %rax, 0xc8(%rsp)
cmpq 0x70(%rsp), %rax
movb %cl, 0x27(%rsp)
jne 0x295cff
movq 0x88(%rsp), %rax
movl %eax, %edx
subl 0xb8(%rsp), %edx
jmp 0x295d0e
movq 0xa8(%rsp), %rdx
subq %r14, %rdx
shrq $0x2, %rdx
movq 0x30(%rsp), %rax
movslq 0x4(%rax), %rax
shlq $0x5, %rax
addq 0x98(%rsp), %rax
movl 0xb8(%rsp), %ecx
leaq (%rax,%rcx,2), %rsi
leal 0x1(%rcx), %eax
movl %eax, 0x84(%rsp)
movl %eax, 0xb8(%rsp)
testl %edx, %edx
movq %rdx, 0x50(%rsp)
movq %rsi, 0x68(%rsp)
jle 0x295e33
movq %rbp, 0xc0(%rsp)
movl %edx, %r15d
xorl %eax, %eax
movw %ax, (%rsi,%rax,2)
incq %rax
cmpq %rax, %r15
jne 0x295d5e
movl $0x0, 0x20(%rsp)
movq $0x0, 0x58(%rsp)
movl $0xd0, %edx
leaq 0xd0(%rsp), %rdi
xorl %esi, %esi
callq 0x173a0
xorl %ebx, %ebx
movq %r15, 0x78(%rsp)
movl $0x1, 0x20(%rsp)
movq 0x68(%rsp), %rax
leaq (%rax,%rbx,2), %rax
movq %rax, 0x58(%rsp)
xorl %r12d, %r12d
testb $0x1, %bl
leaq 0x58(%rsp), %r15
leaq 0x20(%rsp), %rbp
je 0x295df1
xorl %r12d, %r12d
movl %r12d, %eax
shlq $0x4, %rax
movq 0xd8(%rsp,%rax), %rsi
movl 0xd0(%rsp,%rax), %edx
movq %r14, %rdi
movq %r15, %rcx
movq %rbp, %r8
movq %r13, %r9
callq 0x296438
incl %r12d
btl %r12d, %ebx
jb 0x295dc1
movq 0x58(%rsp), %rax
movl %r12d, %ecx
shlq $0x4, %rcx
movq %rax, 0xd8(%rsp,%rcx)
movl 0x20(%rsp), %eax
movl %eax, 0xd0(%rsp,%rcx)
incq %rbx
movq 0x78(%rsp), %r15
cmpq %r15, %rbx
jne 0x295d96
incl %r12d
leaq 0x20(%rsp), %r15
movq 0xc0(%rsp), %rbp
jmp 0x295e5e
movl $0x0, 0x20(%rsp)
movq $0x0, 0x58(%rsp)
movl $0xd0, %edx
leaq 0xd0(%rsp), %rdi
xorl %esi, %esi
callq 0x173a0
movl $0x1, %r12d
cmpl $0xc, %r12d
movq 0x50(%rsp), %rcx
ja 0x295eb0
movl %r12d, %ebx
movq %rbx, %r12
shlq $0x4, %r12
leaq 0xd8(%rsp), %rax
addq %rax, %r12
btl %ebx, %ecx
jae 0x295ea4
movq (%r12), %rsi
movl -0x8(%r12), %edx
movq %r14, %rdi
leaq 0x58(%rsp), %rcx
movq %r15, %r8
movq %r13, %r9
callq 0x296438
movq 0x50(%rsp), %rcx
incq %rbx
addq $0x10, %r12
cmpl $0xd, %ebx
jne 0x295e7e
movl 0x20(%rsp), %eax
movq 0xc8(%rsp), %rsi
movq %rsi, %rcx
shlq $0x5, %rcx
movq 0x98(%rsp), %rdx
movl 0x84(%rsp), %edi
movl %edi, 0x1c(%rdx,%rcx)
movl %eax, 0x18(%rdx,%rcx)
movq 0x68(%rsp), %rax
movq %rax, 0x8(%rdx,%rcx)
movq %r14, 0x10(%rdx,%rcx)
movq %rsi, %r14
movq 0x28(%rsp), %r12
movl 0xc(%rsp), %ebx
movb 0x27(%rsp), %cl
testl %ebp, %ebp
jne 0x295f16
leaq 0x1(%r14), %rax
cmpq 0x70(%rsp), %r14
movq %rax, %r14
jl 0x295ca0
jmp 0x295f16
movq 0x28(%rsp), %r12
movq %r13, %rdi
movl %ecx, %r14d
callq 0x27c490
testb %r14b, %r14b
je 0x295f41
movq 0x38(%rsp), %r15
movl 0x18(%rsp), %r14d
movq 0x10(%rsp), %rcx
movq 0x48(%rsp), %r13
movq 0x30(%rsp), %rax
jmp 0x295f61
movq 0x30(%rsp), %rdi
callq 0x27c490
xorl %eax, %eax
movq 0x38(%rsp), %r15
movl 0x18(%rsp), %r14d
movq 0x10(%rsp), %rcx
movq 0x48(%rsp), %r13
movq %rax, 0x30(%rsp)
testq %rax, %rax
je 0x296301
xorl %ebp, %ebp
cmpb $0x0, 0x3f(%r15)
jne 0x295f98
movq 0x8(%r15), %rdi
movq (%rdi), %rax
movl $0x3, %esi
movl $0x1, %edx
movl $0xa, %ecx
callq *0x70(%rax)
movq 0x10(%rsp), %rcx
movl %eax, %ebp
testq %rcx, %rcx
je 0x295fb2
cmpl $0x5, %ebp
jne 0x295fb2
movq %r12, %rdi
callq *0x10(%rsp)
movq 0x10(%rsp), %rcx
testl %eax, %eax
jne 0x295f6f
testl %ebp, %ebp
jne 0x296301
movl 0x60(%r13), %eax
movl %eax, 0x68(%rsp)
movl %ebx, 0x80(%r13)
movl 0x44(%rsp), %esi
shrl $0x2, %esi
andl $0x3, %esi
movl %esi, 0x44(%rsp)
je 0x295fec
movq 0x10(%r15), %rdi
movq (%rdi), %rax
callq *0x28(%rax)
movq 0x10(%rsp), %rcx
movl %eax, %ebp
jmp 0x295fee
xorl %ebp, %ebp
movq 0x30(%rsp), %rbx
movl 0x40(%rsp), %r14d
movl %r14d, %eax
movq %rax, 0x50(%rsp)
testl %ebp, %ebp
jne 0x2960ce
movq 0x90(%rsp), %rax
imulq 0x50(%rsp), %rax
movq %rax, 0xd0(%rsp)
movq 0x8(%r15), %rdi
movq (%rdi), %rax
testq %rax, %rax
je 0x296034
movl $0x27, %esi
xorl %edx, %edx
callq *0x50(%rax)
movq 0x8(%r15), %rdi
movq (%rdi), %rax
leaq 0xa8(%rsp), %rsi
callq *0x30(%rax)
movl %eax, %ebp
testl %eax, %eax
movq 0x10(%rsp), %rcx
jne 0x2960ce
movq 0xa8(%rsp), %rax
movq 0xd0(%rsp), %rsi
xorl %ebp, %ebp
cmpq %rsi, %rax
jge 0x2960ce
movl 0x58(%r15), %edx
imulq 0x50(%rsp), %rdx
addq %rdx, %rax
addq $0x10000, %rax          # imm = 0x10000
cmpq %rsi, %rax
jge 0x2960ad
leaq 0x149298(%rip), %rsi    # 0x3df31f
leaq 0x1493a2(%rip), %rdx    # 0x3df430
leaq 0x1490f0(%rip), %r8     # 0x3df185
movl $0xb, %ebp
movl $0xb, %edi
movl $0xefec, %ecx           # imm = 0xEFEC
xorl %eax, %eax
callq 0x27e637
jmp 0x2960c9
movq 0x8(%r15), %rdi
movq (%rdi), %rax
testq %rax, %rax
je 0x2960c9
leaq 0xd0(%rsp), %rdx
movl $0x5, %esi
callq *0x50(%rax)
movq 0x10(%rsp), %rcx
leaq 0x8(%rbx), %r13
movl %r14d, %eax
orl $0x18, %eax
movq %rax, 0x78(%rsp)
xorl %r15d, %r15d
testl %ebp, %ebp
jne 0x296250
movslq 0x4(%rbx), %rax
testq %rax, %rax
jle 0x29615b
movl (%rbx), %ecx
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq 0xa0(%rsp), %rbp
movq %rax, %rdx
decq %rax
movq %rax, %r8
shlq $0x5, %r8
leaq (%r8,%r13), %rsi
movl (%r13,%r8), %edi
movl 0x18(%r13,%r8), %r8d
cmpl %r8d, %edi
jge 0x296153
movq 0x8(%rsi), %r9
movq 0x10(%rsi), %r11
movslq %edi, %r10
movzwl (%r9,%r10,2), %r10d
movl (%r11,%r10,4), %r9d
cmpl %ecx, %r9d
jbe 0x29614a
cmpl %ebx, %r9d
jae 0x29614e
addl 0x1c(%rsi), %r10d
movl %r10d, %r15d
movl %r9d, %ebx
jmp 0x29614e
incl %edi
movl %edi, (%rsi)
cmpl %ecx, %r9d
jbe 0x29611b
cmpq $0x1, %rdx
jg 0x296100
jmp 0x296168
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq 0xa0(%rsp), %rbp
movq 0x30(%rsp), %rax
movl %ebx, (%rax)
cmpl $-0x1, %ebx
je 0x296249
movl 0x168(%rbp), %eax
testl %eax, %eax
movq 0x10(%rsp), %rcx
je 0x2961ab
xorl %eax, %eax
cmpb $0x0, 0x61(%rbp)
sete %al
leal 0x7(,%rax,2), %ebp
movb $0x1, %al
testb %al, %al
movq 0x30(%rsp), %rbx
je 0x2960e0
jmp 0x296250
xorl %eax, %eax
cmpl 0x68(%rsp), %r15d
jbe 0x29620e
cmpl 0xc(%rsp), %r15d
ja 0x29620e
movl $0x0, %ebp
cmpl 0x90(%rsp), %ebx
ja 0x296199
leal -0x1(%r15), %ecx
imulq 0x78(%rsp), %rcx
addq $0x38, %rcx
movq 0x38(%rsp), %r12
movq 0x10(%r12), %rdi
movq (%rdi), %rax
movl %r14d, %edx
movq 0x1e8(%rsp), %r14
movq %r14, %rsi
callq *0x10(%rax)
testl %eax, %eax
je 0x296212
movl %eax, %ebp
movb $0x1, %al
movq 0x28(%rsp), %r12
movq 0x10(%rsp), %rcx
movl 0x40(%rsp), %r14d
jmp 0x296199
xorl %ebp, %ebp
jmp 0x296199
decl %ebx
imulq 0x50(%rsp), %rbx
movq 0x8(%r12), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movl 0x40(%rsp), %r14d
movl %r14d, %edx
movq %rbx, %rcx
callq *0x18(%rax)
movl %eax, %ebp
testl %eax, %eax
setne %al
movq 0x28(%rsp), %r12
movq 0x10(%rsp), %rcx
jmp 0x296199
xorl %ebp, %ebp
movq 0x10(%rsp), %rcx
movq 0x38(%rsp), %r15
movq 0x8(%r15), %rdi
movq (%rdi), %rax
testq %rax, %rax
movl 0x18(%rsp), %r14d
je 0x296275
movl $0x25, %esi
xorl %edx, %edx
callq *0x50(%rax)
movq 0x10(%rsp), %rcx
testl %ebp, %ebp
movq 0x48(%rsp), %r13
movl 0xc(%rsp), %ebx
jne 0x2962dc
movq 0x30(%r15), %rax
movq (%rax), %rax
xorl %ebp, %ebp
cmpl 0x10(%rax), %ebx
jne 0x2962d2
movl 0x5c(%r15), %esi
imulq 0x50(%rsp), %rsi
movq 0x8(%r15), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movl %eax, %ebp
cmpl $0x0, 0x44(%rsp)
je 0x2962cd
testl %ebp, %ebp
movq 0x10(%rsp), %rcx
jne 0x2962d2
movq 0x8(%r15), %rdi
movq (%rdi), %rax
movl 0x44(%rsp), %esi
callq *0x28(%rax)
movq 0x10(%rsp), %rcx
movl %eax, %ebp
jmp 0x2962d2
movq 0x10(%rsp), %rcx
testl %ebp, %ebp
jne 0x2962dc
movl %ebx, 0x60(%r13)
xorl %ebp, %ebp
cmpb $0x0, 0x3f(%r15)
jne 0x296301
movq 0x8(%r15), %rdi
movq (%rdi), %rax
movl $0x3, %esi
movl $0x1, %edx
movl $0x9, %ecx
callq *0x70(%rax)
movq 0x10(%rsp), %rcx
xorl %eax, %eax
cmpl $0x5, %ebp
cmovel %eax, %ebp
movq 0x30(%rsp), %rbx
testl %r14d, %r14d
je 0x2963e9
testl %ebp, %ebp
jne 0x2963e9
movl 0x60(%r13), %eax
movl $0x5, %ebp
cmpl 0x58(%r15), %eax
jb 0x2963e9
xorl %ebp, %ebp
cmpl $0x2, %r14d
jl 0x2963e9
movq %rbx, %r13
leaq 0xd0(%rsp), %rsi
movl $0x4, %edi
movq %rcx, %rbx
callq 0x27e7ad
movq %rbx, %rcx
xorl %ebp, %ebp
cmpb $0x0, 0x3f(%r15)
jne 0x296380
movq 0x8(%r15), %rdi
movq (%rdi), %rax
movl $0x4, %esi
movl $0x4, %edx
movl $0xa, %ecx
callq *0x70(%rax)
movq %rbx, %rcx
movl %eax, %ebp
testq %rcx, %rcx
je 0x296396
cmpl $0x5, %ebp
jne 0x296396
movq %r12, %rdi
callq *%rbx
movq %rbx, %rcx
testl %eax, %eax
jne 0x296359
testl %ebp, %ebp
movq %r13, %rbx
movl 0x1c(%rsp), %r13d
jne 0x2963ee
xorl %ebp, %ebp
cmpl $0x3, %r14d
jne 0x2963c7
movl 0xd0(%rsp), %esi
movq %r15, %rdi
callq 0x291302
movq 0x10(%r15), %rdi
movq (%rdi), %rax
xorl %esi, %esi
callq *0x20(%rax)
movl %eax, %ebp
cmpb $0x0, 0x3f(%r15)
jne 0x2963ee
movq 0x8(%r15), %rdi
movq (%rdi), %rax
movl $0x4, %esi
movl $0x4, %edx
movl $0x9, %ecx
callq *0x70(%rax)
jmp 0x2963ee
movl 0x1c(%rsp), %r13d
movq %rbx, %rdi
callq 0x27c490
cmpl $0x5, %ebp
je 0x296403
testl %ebp, %ebp
jne 0x29589e
movq 0x1f8(%rsp), %rax
movq 0x1f0(%rsp), %rcx
testq %rcx, %rcx
je 0x29641e
movl 0x58(%r15), %edx
movl %edx, (%rcx)
testq %rax, %rax
je 0x29589e
movq 0x30(%r15), %rcx
movq (%rcx), %rcx
movl 0x60(%rcx), %ecx
movl %ecx, (%rax)
jmp 0x29589e