// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: btreeParseCellPtr
static void btreeParseCellPtr(
  MemPage *pPage,         /* Page containing the cell */
  u8 *pCell,              /* Pointer to the cell text. */
  CellInfo *pInfo         /* Fill in this structure */
){
  u8 *pIter;              /* For scanning through pCell */
  u32 nPayload;           /* Number of bytes of cell payload */
  u64 iKey;               /* Extracted Key value */

  assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  assert( pPage->leaf==0 || pPage->leaf==1 );
  assert( pPage->intKeyLeaf );
  assert( pPage->childPtrSize==0 );
  pIter = pCell;

  /* The next block of code is equivalent to:
  **
  **     pIter += getVarint32(pIter, nPayload);
  **
  ** The code is inlined to avoid a function call.
  */
  nPayload = *pIter;
  if( nPayload>=0x80 ){
    u8 *pEnd = &pIter[8];
    nPayload &= 0x7f;
    do{
      nPayload = (nPayload<<7) | (*++pIter & 0x7f);
    }while( (*pIter)>=0x80 && pIter<pEnd );
  }
  pIter++;

  /* The next block of code is equivalent to:
  **
  **     pIter += getVarint(pIter, (u64*)&pInfo->nKey);
  **
  ** The code is inlined to avoid a function call.
  */
  iKey = *pIter;
  if( iKey>=0x80 ){
    u8 *pEnd = &pIter[7];
    iKey &= 0x7f;
    while(1){
      iKey = (iKey<<7) | (*++pIter & 0x7f);
      if( (*pIter)<0x80 ) break;
      if( pIter>=pEnd ){
        iKey = (iKey<<8) | *++pIter;
        break;
      }
    }
  }
  pIter++;

  pInfo->nKey = *(i64*)&iKey;
  pInfo->nPayload = nPayload;
  pInfo->pPayload = pIter;
  testcase( nPayload==pPage->maxLocal );
  testcase( nPayload==pPage->maxLocal+1 );
  if( nPayload<=pPage->maxLocal ){
    /* This is the (easy) common case where the entire payload fits
    ** on the local page.  No overflow is required.
    */
    pInfo->nSize = nPayload + (u16)(pIter - pCell);
    if( pInfo->nSize<4 ) pInfo->nSize = 4;
    pInfo->nLocal = (u16)nPayload;
  }else{
    btreeParseCellAdjustSizeForOverflow(pPage, pCell, pInfo);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x24(%rbp)
cmpl $0x80, -0x24(%rbp)
jb 0x3e4770
movq -0x20(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x38(%rbp)
movl -0x24(%rbp), %eax
andl $0x7f, %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
shll $0x7, %eax
movq -0x20(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x20(%rbp)
movzbl 0x1(%rcx), %ecx
andl $0x7f, %ecx
orl %ecx, %eax
movl %eax, -0x24(%rbp)
movq -0x20(%rbp), %rax
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x80, %ecx
movb %al, -0x41(%rbp)
jl 0x3e4767
movq -0x20(%rbp), %rax
cmpq -0x38(%rbp), %rax
setb %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0x3e4724
jmp 0x3e4770
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
movq %rax, -0x30(%rbp)
cmpq $0x80, -0x30(%rbp)
jb 0x3e4817
movq -0x20(%rbp), %rax
addq $0x7, %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
andq $0x7f, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
shlq $0x7, %rax
movq -0x20(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x20(%rbp)
movzbl 0x1(%rcx), %ecx
andl $0x7f, %ecx
movslq %ecx, %rcx
orq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x80, %eax
jge 0x3e47e5
jmp 0x3e4815
movq -0x20(%rbp), %rax
cmpq -0x40(%rbp), %rax
jb 0x3e4813
movq -0x30(%rbp), %rax
shlq $0x8, %rax
movq -0x20(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x20(%rbp)
movzbl 0x1(%rcx), %ecx
orq %rcx, %rax
movq %rax, -0x30(%rbp)
jmp 0x3e4815
jmp 0x3e47ad
jmp 0x3e4817
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x30(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movl -0x24(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x20(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movl -0x24(%rbp), %eax
movq -0x8(%rbp), %rcx
movzwl 0xe(%rcx), %ecx
cmpl %ecx, %eax
ja 0x3e4898
movl -0x24(%rbp), %eax
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rdx
subq %rdx, %rcx
movzwl %cx, %ecx
addl %ecx, %eax
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, 0x16(%rax)
movq -0x18(%rbp), %rax
movzwl 0x16(%rax), %eax
cmpl $0x4, %eax
jge 0x3e4888
movq -0x18(%rbp), %rax
movw $0x4, 0x16(%rax)
movl -0x24(%rbp), %eax
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, 0x14(%rax)
jmp 0x3e48a9
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x3e4ac0
addq $0x50, %rsp
popq %rbp
retq
nop