// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: cellSizePtr
static u16 cellSizePtr(MemPage *pPage, u8 *pCell){
  u8 *pIter = pCell + pPage->childPtrSize; /* For looping over bytes of pCell */
  u8 *pEnd;                                /* End mark for a varint */
  u32 nSize;                               /* Size value to return */

#ifdef SQLITE_DEBUG
  /* The value returned by this function should always be the same as
  ** the (CellInfo.nSize) value found by doing a full parse of the
  ** cell. If SQLITE_DEBUG is defined, an assert() at the bottom of
  ** this function verifies that this invariant is not violated. */
  CellInfo debuginfo;
  pPage->xParseCell(pPage, pCell, &debuginfo);
#endif

  nSize = *pIter;
  if( nSize>=0x80 ){
    pEnd = &pIter[8];
    nSize &= 0x7f;
    do{
      nSize = (nSize<<7) | (*++pIter & 0x7f);
    }while( *(pIter)>=0x80 && pIter<pEnd );
  }
  pIter++;
  if( pPage->intKey ){
    /* pIter now points at the 64-bit integer key value, a variable length
    ** integer. The following block moves pIter to point at the first byte
    ** past the end of the key value. */
    pEnd = &pIter[9];
    while( (*pIter++)&0x80 && pIter<pEnd );
  }
  testcase( nSize==pPage->maxLocal );
  testcase( nSize==pPage->maxLocal+1 );
  if( nSize<=pPage->maxLocal ){
    nSize += (u32)(pIter - pCell);
    if( nSize<4 ) nSize = 4;
  }else{
    int minLocal = pPage->minLocal;
    nSize = minLocal + (nSize - minLocal) % (pPage->pBt->usableSize - 4);
    testcase( nSize==pPage->maxLocal );
    testcase( nSize==pPage->maxLocal+1 );
    if( nSize>pPage->maxLocal ){
      nSize = minLocal;
    }
    nSize += 4 + (u16)(pIter - pCell);
  }
  assert( nSize==debuginfo.nSize || CORRUPT_DB );
  return (u16)nSize;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
movzbl 0xa(%rcx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x24(%rbp)
cmpl $0x80, -0x24(%rbp)
jb 0x3e45e6
movq -0x18(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x20(%rbp)
movl -0x24(%rbp), %eax
andl $0x7f, %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
shll $0x7, %eax
movq -0x18(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x18(%rbp)
movzbl 0x1(%rcx), %ecx
andl $0x7f, %ecx
orl %ecx, %eax
movl %eax, -0x24(%rbp)
movq -0x18(%rbp), %rax
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x80, %ecx
movb %al, -0x29(%rbp)
jl 0x3e45dd
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
setb %al
movb %al, -0x29(%rbp)
movb -0x29(%rbp), %al
testb $0x1, %al
jne 0x3e459a
jmp 0x3e45e6
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
cmpb $0x0, 0x2(%rax)
je 0x3e4645
movq -0x18(%rbp), %rax
addq $0x9, %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rbp)
movzbl (%rax), %ecx
andl $0x80, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x2a(%rbp)
je 0x3e4638
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
setb %al
movb %al, -0x2a(%rbp)
movb -0x2a(%rbp), %al
testb $0x1, %al
jne 0x3e4641
jmp 0x3e4643
jmp 0x3e4608
jmp 0x3e4645
movl -0x24(%rbp), %eax
movq -0x8(%rbp), %rcx
movzwl 0xe(%rcx), %ecx
cmpl %ecx, %eax
ja 0x3e4674
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
addl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
cmpl $0x4, -0x24(%rbp)
jae 0x3e4672
movl $0x4, -0x24(%rbp)
jmp 0x3e46d1
movq -0x8(%rbp), %rax
movzwl 0x10(%rax), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x24(%rbp), %eax
subl -0x28(%rbp), %eax
movq -0x8(%rbp), %rcx
movq 0x48(%rcx), %rcx
movl 0x38(%rcx), %ecx
subl $0x4, %ecx
xorl %edx, %edx
divl %ecx
movl -0x30(%rbp), %eax
addl %edx, %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x8(%rbp), %rcx
movzwl 0xe(%rcx), %ecx
cmpl %ecx, %eax
jbe 0x3e46ba
movl -0x28(%rbp), %eax
movl %eax, -0x24(%rbp)
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
movzwl %ax, %eax
addl $0x4, %eax
addl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)