// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3VdbeSerialGet
SQLITE_PRIVATE u32 sqlite3VdbeSerialGet(
  const unsigned char *buf,     /* Buffer to deserialize from */
  u32 serial_type,              /* Serial type to deserialize */
  Mem *pMem                     /* Memory cell to write value into */
){
  switch( serial_type ){
    case 10: { /* Internal use only: NULL with virtual table
               ** UPDATE no-change flag set */
      pMem->flags = MEM_Null|MEM_Zero;
      pMem->n = 0;
      pMem->u.nZero = 0;
      break;
    }
    case 11:   /* Reserved for future use */
    case 0: {  /* Null */
      /* EVIDENCE-OF: R-24078-09375 Value is a NULL. */
      pMem->flags = MEM_Null;
      break;
    }
    case 1: {
      /* EVIDENCE-OF: R-44885-25196 Value is an 8-bit twos-complement
      ** integer. */
      pMem->u.i = ONE_BYTE_INT(buf);
      pMem->flags = MEM_Int;
      testcase( pMem->u.i<0 );
      return 1;
    }
    case 2: { /* 2-byte signed integer */
      /* EVIDENCE-OF: R-49794-35026 Value is a big-endian 16-bit
      ** twos-complement integer. */
      pMem->u.i = TWO_BYTE_INT(buf);
      pMem->flags = MEM_Int;
      testcase( pMem->u.i<0 );
      return 2;
    }
    case 3: { /* 3-byte signed integer */
      /* EVIDENCE-OF: R-37839-54301 Value is a big-endian 24-bit
      ** twos-complement integer. */
      pMem->u.i = THREE_BYTE_INT(buf);
      pMem->flags = MEM_Int;
      testcase( pMem->u.i<0 );
      return 3;
    }
    case 4: { /* 4-byte signed integer */
      /* EVIDENCE-OF: R-01849-26079 Value is a big-endian 32-bit
      ** twos-complement integer. */
      pMem->u.i = FOUR_BYTE_INT(buf);
#ifdef __HP_cc
      /* Work around a sign-extension bug in the HP compiler for HP/UX */
      if( buf[0]&0x80 ) pMem->u.i |= 0xffffffff80000000LL;
#endif
      pMem->flags = MEM_Int;
      testcase( pMem->u.i<0 );
      return 4;
    }
    case 5: { /* 6-byte signed integer */
      /* EVIDENCE-OF: R-50385-09674 Value is a big-endian 48-bit
      ** twos-complement integer. */
      pMem->u.i = FOUR_BYTE_UINT(buf+2) + (((i64)1)<<32)*TWO_BYTE_INT(buf);
      pMem->flags = MEM_Int;
      testcase( pMem->u.i<0 );
      return 6;
    }
    case 6:   /* 8-byte signed integer */
    case 7: { /* IEEE floating point */
      /* These use local variables, so do them in a separate routine
      ** to avoid having to move the frame pointer in the common case */
      return serialGet(buf,serial_type,pMem);
    }
    case 8:    /* Integer 0 */
    case 9: {  /* Integer 1 */
      /* EVIDENCE-OF: R-12976-22893 Value is the integer 0. */
      /* EVIDENCE-OF: R-18143-12121 Value is the integer 1. */
      pMem->u.i = serial_type-8;
      pMem->flags = MEM_Int;
      return 0;
    }
    default: {
      /* EVIDENCE-OF: R-14606-31564 Value is a BLOB that is (N-12)/2 bytes in
      ** length.
      ** EVIDENCE-OF: R-28401-00140 Value is a string in the text encoding and
      ** (N-13)/2 bytes in length. */
      static const u16 aFlag[] = { MEM_Blob|MEM_Ephem, MEM_Str|MEM_Ephem };
      pMem->z = (char *)buf;
      pMem->n = (serial_type-12)/2;
      pMem->flags = aFlag[serial_type&1];
      return pMem->n;
    }
  }
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl -0x14(%rbp), %eax
movq %rax, -0x28(%rbp)
subq $0xb, %rax
ja 0x3fa919
movq -0x28(%rbp), %rax
leaq 0x1aa64d(%rip), %rcx    # 0x5a4d9c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x20(%rbp), %rax
movw $0x4001, 0x8(%rax)      # imm = 0x4001
movq -0x20(%rbp), %rax
movl $0x0, 0xc(%rax)
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
jmp 0x3fa95d
movq -0x20(%rbp), %rax
movw $0x1, 0x8(%rax)
jmp 0x3fa95d
movq -0x10(%rbp), %rax
movsbq (%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movw $0x4, 0x8(%rax)
movl $0x1, -0x4(%rbp)
jmp 0x3fa964
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
shll $0x8, %eax
movq -0x10(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
orl %ecx, %eax
movslq %eax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movw $0x4, 0x8(%rax)
movl $0x2, -0x4(%rbp)
jmp 0x3fa964
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
shll $0x10, %eax
movq -0x10(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
shll $0x8, %ecx
orl %ecx, %eax
movq -0x10(%rbp), %rcx
movzbl 0x2(%rcx), %ecx
orl %ecx, %eax
movslq %eax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movw $0x4, 0x8(%rax)
movl $0x3, -0x4(%rbp)
jmp 0x3fa964
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
shll $0x18, %eax
movq -0x10(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
shll $0x10, %ecx
orl %ecx, %eax
movq -0x10(%rbp), %rcx
movzbl 0x2(%rcx), %ecx
shll $0x8, %ecx
orl %ecx, %eax
movq -0x10(%rbp), %rcx
movzbl 0x3(%rcx), %ecx
orl %ecx, %eax
movslq %eax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movw $0x4, 0x8(%rax)
movl $0x4, -0x4(%rbp)
jmp 0x3fa964
movq -0x10(%rbp), %rax
movzbl 0x2(%rax), %eax
shll $0x18, %eax
movq -0x10(%rbp), %rcx
movzbl 0x3(%rcx), %ecx
shll $0x10, %ecx
orl %ecx, %eax
movq -0x10(%rbp), %rcx
movzbl 0x4(%rcx), %ecx
shll $0x8, %ecx
orl %ecx, %eax
movq -0x10(%rbp), %rcx
movzbl 0x5(%rcx), %ecx
orl %ecx, %eax
movl %eax, %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
shll $0x8, %eax
movq -0x10(%rbp), %rdx
movzbl 0x1(%rdx), %edx
orl %edx, %eax
cltq
shlq $0x20, %rax
addq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movw $0x4, 0x8(%rax)
movl $0x6, -0x4(%rbp)
jmp 0x3fa964
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movq -0x20(%rbp), %rdx
callq 0x400ad0
movl %eax, -0x4(%rbp)
jmp 0x3fa964
movl -0x14(%rbp), %eax
subl $0x8, %eax
movl %eax, %eax
movl %eax, %ecx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movw $0x4, 0x8(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x3fa964
movq -0x10(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movl -0x14(%rbp), %ecx
subl $0xc, %ecx
shrl %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0xc(%rax)
movl -0x14(%rbp), %eax
andl $0x1, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x1acacb(%rip), %rax    # 0x5a7410
movw (%rax,%rcx,2), %cx
movq -0x20(%rbp), %rax
movw %cx, 0x8(%rax)
movq -0x20(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x3fa964
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)