// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3VdbeRecordUnpack
SQLITE_PRIVATE void sqlite3VdbeRecordUnpack(
  KeyInfo *pKeyInfo,     /* Information about the record format */
  int nKey,              /* Size of the binary record */
  const void *pKey,      /* The binary record */
  UnpackedRecord *p      /* Populate this structure before returning. */
){
  const unsigned char *aKey = (const unsigned char *)pKey;
  u32 d;
  u32 idx;                        /* Offset in aKey[] to read from */
  u16 u;                          /* Unsigned loop counter */
  u32 szHdr;
  Mem *pMem = p->aMem;

  p->default_rc = 0;
  assert( EIGHT_BYTE_ALIGNMENT(pMem) );
  idx = getVarint32(aKey, szHdr);
  d = szHdr;
  u = 0;
  while( idx<szHdr && d<=(u32)nKey ){
    u32 serial_type;

    idx += getVarint32(&aKey[idx], serial_type);
    pMem->enc = pKeyInfo->enc;
    pMem->db = pKeyInfo->db;
    /* pMem->flags = 0; // sqlite3VdbeSerialGet() will set this for us */
    pMem->szMalloc = 0;
    pMem->z = 0;
    d += sqlite3VdbeSerialGet(&aKey[d], serial_type, pMem);
    pMem++;
    if( (++u)>=p->nField ) break;
  }
  if( d>(u32)nKey && u ){
    assert( CORRUPT_DB );
    /* In a corrupt record entry, the last pMem might have been set up using
    ** uninitialized memory. Overwrite its value with NULL, to prevent
    ** warnings from MSAN. */
    sqlite3VdbeMemSetNull(pMem-1);
  }
  assert( u<=pKeyInfo->nKeyField + 1 );
  p->nField = u;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movb $0x0, 0x12(%rax)
movq -0x28(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x80, %eax
jge 0x3fbfb5
movq -0x28(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x38(%rbp)
movl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x3fbfc8
movq -0x28(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x3fa520
movzbl %al, %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
movzbl %al, %eax
movl %eax, -0x30(%rbp)
movl -0x38(%rbp), %eax
movl %eax, -0x2c(%rbp)
movw $0x0, -0x32(%rbp)
movl -0x30(%rbp), %ecx
xorl %eax, %eax
cmpl -0x38(%rbp), %ecx
movb %al, -0x49(%rbp)
jae 0x3fbff6
movl -0x2c(%rbp), %eax
cmpl -0xc(%rbp), %eax
setbe %al
movb %al, -0x49(%rbp)
movb -0x49(%rbp), %al
testb $0x1, %al
jne 0x3fc002
jmp 0x3fc0d0
movq -0x28(%rbp), %rax
movl -0x30(%rbp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x80, %eax
jge 0x3fc02c
movq -0x28(%rbp), %rax
movl -0x30(%rbp), %ecx
movzbl (%rax,%rcx), %eax
movl %eax, -0x44(%rbp)
movl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x3fc045
movq -0x28(%rbp), %rdi
movl -0x30(%rbp), %eax
addq %rax, %rdi
leaq -0x44(%rbp), %rsi
callq 0x3fa520
movzbl %al, %eax
movl %eax, -0x50(%rbp)
movl -0x50(%rbp), %eax
movzbl %al, %eax
addl -0x30(%rbp), %eax
movl %eax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movb 0x4(%rax), %cl
movq -0x40(%rbp), %rax
movb %cl, 0xa(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x40(%rbp), %rax
movl $0x0, 0x20(%rax)
movq -0x40(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x28(%rbp), %rdi
movl -0x2c(%rbp), %eax
addq %rax, %rdi
movl -0x44(%rbp), %esi
movq -0x40(%rbp), %rdx
callq 0x3fa720
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x40(%rbp), %rax
addq $0x38, %rax
movq %rax, -0x40(%rbp)
movw -0x32(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x32(%rbp)
movzwl %ax, %eax
movq -0x20(%rbp), %rcx
movzwl 0x10(%rcx), %ecx
cmpl %ecx, %eax
jl 0x3fc0cb
jmp 0x3fc0d0
jmp 0x3fbfdd
movl -0x2c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jbe 0x3fc0ee
movzwl -0x32(%rbp), %eax
cmpl $0x0, %eax
je 0x3fc0ee
movq -0x40(%rbp), %rdi
addq $-0x38, %rdi
callq 0x3c8550
movw -0x32(%rbp), %cx
movq -0x20(%rbp), %rax
movw %cx, 0x10(%rax)
addq $0x50, %rsp
popq %rbp
retq