// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: cellSizePtr
static u16 cellSizePtr(MemPage *pPage, u8 *pCell){
  u8 *pIter = &pCell[pPage->childPtrSize];
  u32 nSize;

#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;
  btreeParseCellPtr(pPage, pCell, &debuginfo);
#endif

  if( pPage->intKey ){
    u8 *pEnd;
    if( pPage->hasData ){
      pIter += getVarint32(pIter, nSize);
    }else{
      nSize = 0;
    }

    /* 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 );
  }else{
    pIter += getVarint32(pIter, nSize);
  }

  testcase( nSize==pPage->maxLocal );
  testcase( nSize==pPage->maxLocal+1 );
  if( nSize>pPage->maxLocal ){
    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;
  }
  nSize += (u32)(pIter - pCell);

  /* The minimum size of any cell is 4 bytes. */
  if( nSize<4 ){
    nSize = 4;
  }

  assert( nSize==debuginfo.nSize );
  return (u16)nSize;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
movzbl 0x6(%rcx), %ecx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
cmpb $0x0, 0x2(%rax)
je 0x41cd6
movq -0x8(%rbp), %rax
cmpb $0x0, 0x4(%rax)
je 0x41c86
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x80, %eax
jge 0x41c5d
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x1c(%rbp)
movl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x41c70
movq -0x18(%rbp), %rdi
leaq -0x1c(%rbp), %rsi
callq 0x2c290
movzbl %al, %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
movzbl %al, %ecx
movq -0x18(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
jmp 0x41c8d
movl $0x0, -0x1c(%rbp)
movq -0x18(%rbp), %rax
addq $0x9, %rax
movq %rax, -0x28(%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, -0x31(%rbp)
je 0x41cc9
movq -0x18(%rbp), %rax
cmpq -0x28(%rbp), %rax
setb %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0x41cd2
jmp 0x41cd4
jmp 0x41c99
jmp 0x41d1f
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x80, %eax
jge 0x41cf8
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x1c(%rbp)
movl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x41d0b
movq -0x18(%rbp), %rdi
leaq -0x1c(%rbp), %rsi
callq 0x2c290
movzbl %al, %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
movzbl %al, %ecx
movq -0x18(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
movzwl 0x8(%rcx), %ecx
cmpl %ecx, %eax
jbe 0x41d7d
movq -0x8(%rbp), %rax
movzwl 0xa(%rax), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x1c(%rbp), %eax
subl -0x2c(%rbp), %eax
movq -0x8(%rbp), %rcx
movq 0x48(%rcx), %rcx
movl 0x34(%rcx), %ecx
subl $0x4, %ecx
xorl %edx, %edx
divl %ecx
movl -0x3c(%rbp), %eax
addl %edx, %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
movzwl 0x8(%rcx), %ecx
cmpl %ecx, %eax
jbe 0x41d74
movl -0x2c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
cmpl $0x4, -0x1c(%rbp)
jae 0x41d9b
movl $0x4, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)