// File: /workspace/github_c_makefile_star2_O3/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
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movb 0x56(%rdi), %al
cmpb $0x1, %al
jne 0x37532
movb 0x58(%rbx), %dl
movsbq %dl, %rax
movq 0x98(%rbx,%rax,8), %rcx
cmpb $0x0, 0x5(%rcx)
movzwl 0x70(%rbx,%rax,2), %esi
je 0x3756b
testw %si, %si
jne 0x375b7
jmp 0x37528
movw $0x0, 0x36(%rbx)
andb $-0x7, 0x54(%rbx)
decb %dl
movb %dl, 0x58(%rbx)
movq 0x98(%rbx,%rax,8), %rax
movq 0x70(%rax), %rdi
callq 0x24e28
movb 0x58(%rbx), %dl
movsbq %dl, %rax
movzwl 0x70(%rbx,%rax,2), %esi
testw %si, %si
jne 0x375af
testb %dl, %dl
jne 0x374f3
movb $0x0, 0x56(%rbx)
jmp 0x375a4
cmpb $0x3, %al
jb 0x37549
movq %rbx, %rdi
callq 0x3646f
testl %eax, %eax
jne 0x375cc
movb 0x56(%rbx), %al
testb %al, %al
je 0x375a4
movl 0x50(%rbx), %eax
testl %eax, %eax
je 0x374ca
movb $0x1, 0x56(%rbx)
movl $0x0, 0x50(%rbx)
jns 0x374ca
jmp 0x375ab
movzwl %si, %eax
movzwl 0x14(%rcx), %edx
movq 0x50(%rcx), %rsi
movq 0x60(%rcx), %rcx
movzbl (%rcx,%rax,2), %edi
shll $0x8, %edi
movzbl 0x1(%rcx,%rax,2), %eax
orl %edi, %eax
andl %edx, %eax
movl (%rsi,%rax), %esi
bswapl %esi
movq %rbx, %rdi
callq 0x368c1
testl %eax, %eax
jne 0x375cc
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x375e0
movl $0x1, (%r14)
xorl %eax, %eax
jmp 0x375cc
movq 0x98(%rbx,%rax,8), %rcx
decl %esi
movw %si, 0x70(%rbx,%rax,2)
xorl %eax, %eax
cmpb $0x0, 0x2(%rcx)
je 0x375cc
cmpb $0x0, 0x5(%rcx)
je 0x375d1
popq %rbx
popq %r14
popq %rbp
retq
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x332c8