// File: /workspace/github_c_makefile_star2_O0/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: btreePrevious
static SQLITE_NOINLINE int btreePrevious(BtCursor *pCur, int *pRes){
  int rc;
  MemPage *pPage;

  assert( cursorHoldsMutex(pCur) );
  assert( pRes!=0 );
  assert( *pRes==0 );
  assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );
  assert( (pCur->curFlags & (BTCF_AtLast|BTCF_ValidOvfl|BTCF_ValidNKey))==0 );
  assert( pCur->info.nSize==0 );
  if( pCur->eState!=CURSOR_VALID ){
    rc = restoreCursorPosition(pCur);
    if( rc!=SQLITE_OK ){
      return rc;
    }
    if( CURSOR_INVALID==pCur->eState ){
      *pRes = 1;
      return SQLITE_OK;
    }
    if( pCur->skipNext ){
      assert( pCur->eState==CURSOR_VALID || pCur->eState==CURSOR_SKIPNEXT );
      pCur->eState = CURSOR_VALID;
      if( pCur->skipNext<0 ){
        pCur->skipNext = 0;
        return SQLITE_OK;
      }
      pCur->skipNext = 0;
    }
  }

  pPage = pCur->apPage[pCur->iPage];
  assert( pPage->isInit );
  if( !pPage->leaf ){
    int idx = pCur->aiIdx[pCur->iPage];
    rc = moveToChild(pCur, get4byte(findCell(pPage, idx)));
    if( rc ) return rc;
    rc = moveToRightmost(pCur);
  }else{
    while( pCur->aiIdx[pCur->iPage]==0 ){
      if( pCur->iPage==0 ){
        pCur->eState = CURSOR_INVALID;
        *pRes = 1;
        return SQLITE_OK;
      }
      moveToParent(pCur);
    }
    assert( pCur->info.nSize==0 );
    assert( (pCur->curFlags & (BTCF_ValidNKey|BTCF_ValidOvfl))==0 );

    pCur->aiIdx[pCur->iPage]--;
    pPage = pCur->apPage[pCur->iPage];
    if( pPage->intKey && !pPage->leaf ){
      rc = sqlite3BtreePrevious(pCur, pRes);
    }else{
      rc = SQLITE_OK;
    }
  }
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x56(%rax), %eax
cmpl $0x1, %eax
je 0x4ab0e
movq -0x10(%rbp), %rax
movzbl 0x56(%rax), %eax
cmpl $0x3, %eax
jl 0x4aa8c
movq -0x10(%rbp), %rdi
callq 0x488c0
movl %eax, -0x30(%rbp)
jmp 0x4aa93
xorl %eax, %eax
movl %eax, -0x30(%rbp)
jmp 0x4aa93
movl -0x30(%rbp), %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x4aaaa
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x4ac84
movq -0x10(%rbp), %rax
movzbl 0x56(%rax), %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x4aace
movq -0x18(%rbp), %rax
movl $0x1, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x4ac84
movq -0x10(%rbp), %rax
cmpl $0x0, 0x50(%rax)
je 0x4ab0c
movq -0x10(%rbp), %rax
movb $0x1, 0x56(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x50(%rax)
jge 0x4ab01
movq -0x10(%rbp), %rax
movl $0x0, 0x50(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x4ac84
movq -0x10(%rbp), %rax
movl $0x0, 0x50(%rax)
jmp 0x4ab0e
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rcx
movsbq 0x58(%rcx), %rcx
movq 0x98(%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpb $0x0, 0x5(%rax)
jne 0x4abcc
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rcx
movsbq 0x58(%rcx), %rcx
movzwl 0x70(%rax,%rcx,2), %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq 0x50(%rax), %rdi
movq -0x28(%rbp), %rax
movzwl 0x14(%rax), %eax
movq -0x28(%rbp), %rcx
movq 0x60(%rcx), %rcx
movl -0x2c(%rbp), %edx
shll %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
shll $0x8, %ecx
movq -0x28(%rbp), %rdx
movq 0x60(%rdx), %rdx
movl -0x2c(%rbp), %esi
shll %esi
movslq %esi, %rsi
movzbl 0x1(%rdx,%rsi), %edx
orl %edx, %ecx
andl %ecx, %eax
cltq
addq %rax, %rdi
callq 0x26b20
movq -0x38(%rbp), %rdi
movl %eax, %esi
callq 0x49040
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x4abbb
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x4ac84
movq -0x10(%rbp), %rdi
callq 0x4ac90
movl %eax, -0x1c(%rbp)
jmp 0x4ac7e
jmp 0x4abce
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rcx
movsbq 0x58(%rcx), %rcx
movzwl 0x70(%rax,%rcx,2), %eax
cmpl $0x0, %eax
jne 0x4ac18
movq -0x10(%rbp), %rax
movsbl 0x58(%rax), %eax
cmpl $0x0, %eax
jne 0x4ac0d
movq -0x10(%rbp), %rax
movb $0x0, 0x56(%rax)
movq -0x18(%rbp), %rax
movl $0x1, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x4ac84
movq -0x10(%rbp), %rdi
callq 0x48fe0
jmp 0x4abce
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rcx
movsbq 0x58(%rcx), %rcx
movw 0x70(%rax,%rcx,2), %dx
addw $-0x1, %dx
movw %dx, 0x70(%rax,%rcx,2)
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rcx
movsbq 0x58(%rcx), %rcx
movq 0x98(%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movzbl 0x2(%rax), %eax
cmpl $0x0, %eax
je 0x4ac75
movq -0x28(%rbp), %rax
cmpb $0x0, 0x5(%rax)
jne 0x4ac75
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x44b10
movl %eax, -0x1c(%rbp)
jmp 0x4ac7c
movl $0x0, -0x1c(%rbp)
jmp 0x4ac7e
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)