// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3BtreeCommitPhaseOne
SQLITE_PRIVATE int sqlite3BtreeCommitPhaseOne(Btree *p, const char *zSuperJrnl){
  int rc = SQLITE_OK;
  if( p->inTrans==TRANS_WRITE ){
    BtShared *pBt = p->pBt;
    sqlite3BtreeEnter(p);
#ifndef SQLITE_OMIT_AUTOVACUUM
    if( pBt->autoVacuum ){
      rc = autoVacuumCommit(pBt);
      if( rc!=SQLITE_OK ){
        sqlite3BtreeLeave(p);
        return rc;
      }
    }
    if( pBt->bDoTruncate ){
      sqlite3PagerTruncateImage(pBt->pPager, pBt->nPage);
    }
#endif
    rc = sqlite3PagerCommitPhaseOne(pBt->pPager, zSuperJrnl, 0);
    sqlite3BtreeLeave(p);
  }
  return rc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
xorl %ebp, %ebp
cmpb $0x2, 0x10(%rdi)
jne 0x281279
movq %rsi, %rbx
movq (%rdi), %rax
movq 0x8(%rdi), %r14
movq %rax, 0x8(%r14)
cmpb $0x0, 0x21(%r14)
je 0x28128a
movq (%r14), %rdi
movq 0x10(%r14), %r13
testq %r13, %r13
je 0x2811dc
movq %r13, %rax
andb $-0x5, 0x1(%rax)
movq 0x28(%rax), %rax
testq %rax, %rax
jne 0x2811cf
xorl %ebp, %ebp
cmpb $0x0, 0x22(%r14)
jne 0x281275
movl 0x40(%r14), %r12d
xorl %eax, %eax
cmpl $0x2, %r12d
jb 0x281232
movl 0x38(%r14), %eax
movl $0xcccccccd, %esi       # imm = 0xCCCCCCCD
imulq %rax, %rsi
shrq $0x22, %rsi
incl %esi
leal -0x2(%r12), %ecx
movl %ecx, %eax
xorl %edx, %edx
divl %esi
subl %edx, %ecx
movl 0x2458a5(%rip), %eax    # 0x4c6ac0
xorl %edx, %edx
divl 0x34(%r14)
leal 0x1(%rcx), %edx
xorl %esi, %esi
cmpl %eax, %edx
sete %sil
leal (%rcx,%rsi), %eax
addl $0x2, %eax
cmpl %r12d, %eax
je 0x28124a
movl 0x245883(%rip), %eax    # 0x4c6ac0
xorl %edx, %edx
divl 0x34(%r14)
incl %eax
cmpl %eax, %r12d
jne 0x2812b6
leaq 0x15e0ce(%rip), %rsi    # 0x3df31f
leaq 0x15e1d8(%rip), %rdx    # 0x3df430
leaq 0x15df26(%rip), %r8     # 0x3df185
movl $0xb, %ebp
movl $0xb, %edi
movl $0x10b44, %ecx          # imm = 0x10B44
xorl %eax, %eax
callq 0x27e637
testl %ebp, %ebp
je 0x28128a
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x0, 0x23(%r14)
je 0x28129b
movq (%r14), %rax
movl 0x40(%r14), %ecx
movl %ecx, 0x1c(%rax)
movq (%r14), %rdi
movq %rbx, %rsi
xorl %edx, %edx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x280e7b
movq %rdi, 0x10(%rsp)
movq 0x18(%r14), %rax
movq 0x50(%rax), %rax
movl 0x24(%rax), %ebp
bswapl %ebp
movq %r14, %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0x2978cf
cmpl %r12d, %eax
jbe 0x281303
leaq 0x15e03e(%rip), %rsi    # 0x3df31f
leaq 0x15e148(%rip), %rdx    # 0x3df430
leaq 0x15de96(%rip), %r8     # 0x3df185
movl $0xb, %ebp
movl $0xb, %edi
movl $0x10b49, %ecx          # imm = 0x10B49
jmp 0x28126e
movl %eax, %r15d
movl %ebp, 0xc(%rsp)
xorl %ebp, %ebp
testq %r13, %r13
je 0x281324
cmpl %r12d, %r15d
jae 0x281324
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x297c7e
movl %eax, %ebp
cmpl %r15d, %r12d
seta %cl
testl %ebp, %ebp
sete %al
andb %al, %cl
cmpb $0x1, %cl
jne 0x28135c
movq %r14, %rdi
movl %r15d, %esi
movl %r12d, %edx
movl $0x1, %ecx
callq 0x2979d2
movl %eax, %ebp
decl %r12d
testl %eax, %eax
sete %al
cmpl %r15d, %r12d
jbe 0x28135c
testl %ebp, %ebp
je 0x281336
cmpl $0x65, %ebp
sete %cl
cmpl $0x0, 0xc(%rsp)
je 0x2813ad
orb %al, %cl
je 0x2813ad
movq 0x18(%r14), %rax
movq 0x70(%rax), %rdi
callq 0x280e3a
movl %eax, %ebp
movq 0x18(%r14), %rax
movq 0x50(%rax), %rax
xorl %ecx, %ecx
movl %ecx, 0x20(%rax)
movq 0x18(%r14), %rax
movq 0x50(%rax), %rax
movl %ecx, 0x24(%rax)
movq 0x18(%r14), %rax
movq 0x50(%rax), %rax
movl %r15d, %ecx
bswapl %ecx
movl %ecx, 0x1c(%rax)
movb $0x1, 0x23(%r14)
movl %r15d, 0x40(%r14)
testl %ebp, %ebp
je 0x281275
movq 0x10(%rsp), %rdi
callq 0x293290
jmp 0x281275