// File: /workspace/github_c_makefile_star2_O1/skeeto[P]flappy/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:   /* Reserved for future use */
    case 11:   /* Reserved for future use */
    case 0: {  /* NULL */
      pMem->flags = MEM_Null;
      break;
    }
    case 1: { /* 1-byte signed integer */
      pMem->u.i = (signed char)buf[0];
      pMem->flags = MEM_Int;
      return 1;
    }
    case 2: { /* 2-byte signed integer */
      pMem->u.i = (((signed char)buf[0])<<8) | buf[1];
      pMem->flags = MEM_Int;
      return 2;
    }
    case 3: { /* 3-byte signed integer */
      pMem->u.i = (((signed char)buf[0])<<16) | (buf[1]<<8) | buf[2];
      pMem->flags = MEM_Int;
      return 3;
    }
    case 4: { /* 4-byte signed integer */
      pMem->u.i = (buf[0]<<24) | (buf[1]<<16) | (buf[2]<<8) | buf[3];
      pMem->flags = MEM_Int;
      return 4;
    }
    case 5: { /* 6-byte signed integer */
      u64 x = (((signed char)buf[0])<<8) | buf[1];
      u32 y = (buf[2]<<24) | (buf[3]<<16) | (buf[4]<<8) | buf[5];
      x = (x<<32) | y;
      pMem->u.i = *(i64*)&x;
      pMem->flags = MEM_Int;
      return 6;
    }
    case 6:   /* 8-byte signed integer */
    case 7: { /* IEEE floating point */
      u64 x;
      u32 y;
#if !defined(NDEBUG) && !defined(SQLITE_OMIT_FLOATING_POINT)
      /* Verify that integers and floating point values use the same
      ** byte order.  Or, that if SQLITE_MIXED_ENDIAN_64BIT_FLOAT is
      ** defined that 64-bit floating point values really are mixed
      ** endian.
      */
      static const u64 t1 = ((u64)0x3ff00000)<<32;
      static const double r1 = 1.0;
      u64 t2 = t1;
      swapMixedEndianFloat(t2);
      assert( sizeof(r1)==sizeof(t2) && memcmp(&r1, &t2, sizeof(r1))==0 );
#endif

      x = (buf[0]<<24) | (buf[1]<<16) | (buf[2]<<8) | buf[3];
      y = (buf[4]<<24) | (buf[5]<<16) | (buf[6]<<8) | buf[7];
      x = (x<<32) | y;
      if( serial_type==6 ){
        pMem->u.i = *(i64*)&x;
        pMem->flags = MEM_Int;
      }else{
        assert( sizeof(x)==8 && sizeof(pMem->r)==8 );
        swapMixedEndianFloat(x);
        memcpy(&pMem->r, &x, sizeof(x));
        pMem->flags = sqlite3IsNaN(pMem->r) ? MEM_Null : MEM_Real;
      }
      return 8;
    }
    case 8:    /* Integer 0 */
    case 9: {  /* Integer 1 */
      pMem->u.i = serial_type-8;
      pMem->flags = MEM_Int;
      return 0;
    }
    default: {
      static const u16 aFlag[] = { MEM_Blob|MEM_Ephem, MEM_Str|MEM_Ephem };
      u32 len = (serial_type-12)/2;
      pMem->z = (char *)buf;
      pMem->n = len;
      pMem->xDel = 0;
      pMem->flags = aFlag[serial_type&1];
      return len;
    }
  }
  return 0;
}

// Assembly:
cmpl $0xb, %esi
ja 0x2db07
xorl %eax, %eax
movl %esi, %ecx
leaq 0x3ed05(%rip), %r8      # 0x6c6f4
movslq (%r8,%rcx,4), %rcx
addq %r8, %rcx
jmpq *%rcx
movw $0x1, %cx
jmp 0x2daca
addl $-0x8, %esi
movq %rsi, 0x18(%rdx)
jmp 0x2dac6
movq (%rdi), %rax
bswapq %rax
cmpl $0x6, %esi
jne 0x2dacf
movq %rax, 0x18(%rdx)
movl $0x8, %eax
jmp 0x2dac6
movzbl (%rdi), %eax
shll $0x18, %eax
movzbl 0x1(%rdi), %ecx
shll $0x10, %ecx
cltq
orq %rcx, %rax
movzbl 0x2(%rdi), %ecx
shll $0x8, %ecx
orq %rax, %rcx
movzbl 0x3(%rdi), %eax
orq %rcx, %rax
movq %rax, 0x18(%rdx)
movl $0x4, %eax
jmp 0x2dac6
movsbq (%rdi), %rax
shlq $0x10, %rax
movzbl 0x1(%rdi), %ecx
shll $0x8, %ecx
orq %rax, %rcx
movzbl 0x2(%rdi), %eax
orq %rcx, %rax
movq %rax, 0x18(%rdx)
movl $0x3, %eax
jmp 0x2dac6
movsbq (%rdi), %rax
movq %rax, 0x18(%rdx)
movl $0x1, %eax
jmp 0x2dac6
movsbq (%rdi), %rax
shlq $0x8, %rax
movzbl 0x1(%rdi), %ecx
orq %rax, %rcx
movq %rcx, 0x18(%rdx)
movl $0x2, %eax
jmp 0x2dac6
movsbl (%rdi), %eax
shll $0x8, %eax
movzbl 0x1(%rdi), %ecx
orl %eax, %ecx
movl 0x2(%rdi), %eax
bswapl %eax
shlq $0x20, %rcx
orq %rax, %rcx
movq %rcx, 0x18(%rdx)
movl $0x6, %eax
movw $0x4, %cx
movw %cx, 0x24(%rdx)
retq
movq %rax, 0x10(%rdx)
movq %rax, -0x10(%rsp)
movsd -0x10(%rsp), %xmm0
movsd %xmm0, -0x8(%rsp)
movsd -0x10(%rsp), %xmm0
ucomisd -0x8(%rsp), %xmm0
movl $0x1, %esi
movl $0x8, %eax
movl $0x8, %ecx
cmovnel %esi, %ecx
cmovpl %esi, %ecx
jmp 0x2daca
leal -0xc(%rsi), %eax
shrl %eax
movq %rdi, 0x8(%rdx)
movl %eax, 0x20(%rdx)
movq $0x0, 0x28(%rdx)
andl $0x1, %esi
leaq 0x4249b(%rip), %rcx     # 0x6ffc0
movzwl (%rcx,%rsi,2), %ecx
jmp 0x2daca