// File: /workspace/github_c_makefile_star2_O0/aerospike[P]aerospike-common/src/main/aerospike/as_msgpack.c
// Function: as_unpack_val
int
as_unpack_val(as_unpacker *pk, as_val **val)
{
	if (as_unpack_peek_is_ext(pk)) {
		as_unpack_size(pk);
		*val = NULL;
		return 0;
	}

	uint8_t type = pk->buffer[pk->offset++];

	switch (type) {
	case 0xc0: // nil
		return unpack_nil(val);

	case 0xc3: // boolean true
		return unpack_boolean(true, val);
	case 0xc2: // boolean false
		return unpack_boolean(false, val);

	case 0xca: // float
		return unpack_double_val((double)extract_float(pk), val);
	case 0xcb: // double
		return unpack_double_val(extract_double(pk), val);

	case 0xd0: // signed 8 bit integer
		return unpack_integer_val((int64_t)(int8_t)pk->buffer[pk->offset++],
				val);
	case 0xcc: // unsigned 8 bit integer
		return unpack_integer_val((int64_t)pk->buffer[pk->offset++], val);

	case 0xd1: // signed 16 bit integer
		return unpack_integer_val((int64_t)(int16_t)extract_uint16(pk), val);
	case 0xcd: // unsigned 16 bit integer
		return unpack_integer_val((int64_t)extract_uint16(pk), val);

	case 0xd2: // signed 32 bit integer
		return unpack_integer_val((int64_t)(int32_t)extract_uint32(pk), val);
	case 0xce: // unsigned 32 bit integer
		return unpack_integer_val((int64_t)extract_uint32(pk), val);

	case 0xd3: // signed 64 bit integer
	case 0xcf: // unsigned 64 bit integer
		return unpack_integer_val((int64_t)extract_uint64(pk), val);

	case 0xc4:
	case 0xd9: // string/raw bytes with 8 bit header
		return unpack_blob(pk, (uint32_t)pk->buffer[pk->offset++], val);
	case 0xc5:
	case 0xda: // string/raw bytes with 16 bit header
		return unpack_blob(pk, (uint32_t)extract_uint16(pk), val);
	case 0xc6:
	case 0xdb: // string/raw bytes with 32 bit header
		return unpack_blob(pk, extract_uint32(pk), val);

	case 0xdc: // list with 16 bit header
		return unpack_list(pk, (uint32_t)extract_uint16(pk), val);
	case 0xdd: // list with 32 bit header
		return unpack_list(pk, extract_uint32(pk), val);

	case 0xde: // map with 16 bit header
		return unpack_map(pk, (uint32_t)extract_uint16(pk), val);
	case 0xdf: // map with 32 bit header
		return unpack_map(pk, extract_uint32(pk), val);

	case 0xd4: // fixext 1
		return unpack_ext(pk, type, val);

	default:
		if ((type & 0xe0) == 0xa0) { // raw bytes with 8 bit combined header
			return unpack_blob(pk, (uint32_t)(type & 0x1f), val);
		}

		if ((type & 0xf0) == 0x80) { // map with 8 bit combined header
			return unpack_map(pk, (uint32_t)(type & 0x0f), val);
		}

		if ((type & 0xf0) == 0x90) { // list with 8 bit combined header
			return unpack_list(pk, (uint32_t)(type & 0x0f), val);
		}

		if (type < 0x80) { // 8 bit combined unsigned integer
			return unpack_integer_val((int64_t)type, val);
		}

		if (type >= 0xe0) { // 8 bit combined signed integer
			return unpack_integer_val((int64_t)(type & 0x1f) - 32, val);
		}

		return -2;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x88c0
testb $0x1, %al
jne 0xe0cf
jmp 0xe0ef
movq -0x10(%rbp), %rdi
callq 0x89e0
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0xe4a0
movq -0x10(%rbp), %rdx
movq (%rdx), %rax
movl 0x8(%rdx), %ecx
movl %ecx, %esi
incl %esi
movl %esi, 0x8(%rdx)
movb (%rax,%rcx), %al
movb %al, -0x19(%rbp)
movzbl -0x19(%rbp), %eax
addl $0xffffff40, %eax       # imm = 0xFFFFFF40
movl %eax, %ecx
movq %rcx, -0x28(%rbp)
subl $0x1f, %eax
ja 0xe3d5
movq -0x28(%rbp), %rax
leaq 0x18fe7(%rip), %rcx     # 0x27110
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x18(%rbp), %rdi
callq 0xe540
movl %eax, -0x4(%rbp)
jmp 0xe4a0
movq -0x18(%rbp), %rsi
movl $0x1, %edi
callq 0xe560
movl %eax, -0x4(%rbp)
jmp 0xe4a0
movq -0x18(%rbp), %rsi
xorl %edi, %edi
callq 0xe560
movl %eax, -0x4(%rbp)
jmp 0xe4a0
movq -0x10(%rbp), %rdi
callq 0xe5d0
cvtss2sd %xmm0, %xmm0
movq -0x18(%rbp), %rdi
callq 0xe5a0
movl %eax, -0x4(%rbp)
jmp 0xe4a0
movq -0x10(%rbp), %rdi
callq 0xe620
movq -0x18(%rbp), %rdi
callq 0xe5a0
movl %eax, -0x4(%rbp)
jmp 0xe4a0
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rdx
movl 0x8(%rdx), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, 0x8(%rdx)
movl %ecx, %ecx
movsbq (%rax,%rcx), %rdi
movq -0x18(%rbp), %rsi
callq 0xe670
movl %eax, -0x4(%rbp)
jmp 0xe4a0
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rdx
movl 0x8(%rdx), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, 0x8(%rdx)
movl %ecx, %ecx
movzbl (%rax,%rcx), %eax
movl %eax, %edi
movq -0x18(%rbp), %rsi
callq 0xe670
movl %eax, -0x4(%rbp)
jmp 0xe4a0
movq -0x10(%rbp), %rdi
callq 0xe6a0
movswq %ax, %rdi
movq -0x18(%rbp), %rsi
callq 0xe670
movl %eax, -0x4(%rbp)
jmp 0xe4a0
movq -0x10(%rbp), %rdi
callq 0xe6a0
movzwl %ax, %eax
movl %eax, %edi
movq -0x18(%rbp), %rsi
callq 0xe670
movl %eax, -0x4(%rbp)
jmp 0xe4a0
movq -0x10(%rbp), %rdi
callq 0xe6f0
movslq %eax, %rdi
movq -0x18(%rbp), %rsi
callq 0xe670
movl %eax, -0x4(%rbp)
jmp 0xe4a0
movq -0x10(%rbp), %rdi
callq 0xe6f0
movl %eax, %eax
movl %eax, %edi
movq -0x18(%rbp), %rsi
callq 0xe670
movl %eax, -0x4(%rbp)
jmp 0xe4a0
movq -0x10(%rbp), %rdi
callq 0xe740
movq %rax, %rdi
movq -0x18(%rbp), %rsi
callq 0xe670
movl %eax, -0x4(%rbp)
jmp 0xe4a0
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rdx
movl 0x8(%rdx), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, 0x8(%rdx)
movl %ecx, %ecx
movzbl (%rax,%rcx), %esi
movq -0x18(%rbp), %rdx
callq 0xe790
movl %eax, -0x4(%rbp)
jmp 0xe4a0
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
callq 0xe6a0
movq -0x30(%rbp), %rdi
movzwl %ax, %esi
movq -0x18(%rbp), %rdx
callq 0xe790
movl %eax, -0x4(%rbp)
jmp 0xe4a0
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0xe6f0
movq -0x38(%rbp), %rdi
movl %eax, %esi
movq -0x18(%rbp), %rdx
callq 0xe790
movl %eax, -0x4(%rbp)
jmp 0xe4a0
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
callq 0xe6a0
movq -0x40(%rbp), %rdi
movzwl %ax, %esi
movq -0x18(%rbp), %rdx
callq 0xe940
movl %eax, -0x4(%rbp)
jmp 0xe4a0
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
callq 0xe6f0
movq -0x48(%rbp), %rdi
movl %eax, %esi
movq -0x18(%rbp), %rdx
callq 0xe940
movl %eax, -0x4(%rbp)
jmp 0xe4a0
movq -0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
callq 0xe6a0
movq -0x50(%rbp), %rdi
movzwl %ax, %esi
movq -0x18(%rbp), %rdx
callq 0xea40
movl %eax, -0x4(%rbp)
jmp 0xe4a0
movq -0x10(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
callq 0xe6f0
movq -0x58(%rbp), %rdi
movl %eax, %esi
movq -0x18(%rbp), %rdx
callq 0xea40
movl %eax, -0x4(%rbp)
jmp 0xe4a0
movq -0x10(%rbp), %rdi
movb -0x19(%rbp), %al
movq -0x18(%rbp), %rdx
movzbl %al, %esi
callq 0xeaf0
movl %eax, -0x4(%rbp)
jmp 0xe4a0
movzbl -0x19(%rbp), %eax
andl $0xe0, %eax
cmpl $0xa0, %eax
jne 0xe401
movq -0x10(%rbp), %rdi
movzbl -0x19(%rbp), %esi
andl $0x1f, %esi
movq -0x18(%rbp), %rdx
callq 0xe790
movl %eax, -0x4(%rbp)
jmp 0xe4a0
movzbl -0x19(%rbp), %eax
andl $0xf0, %eax
cmpl $0x80, %eax
jne 0xe42a
movq -0x10(%rbp), %rdi
movzbl -0x19(%rbp), %esi
andl $0xf, %esi
movq -0x18(%rbp), %rdx
callq 0xea40
movl %eax, -0x4(%rbp)
jmp 0xe4a0
movzbl -0x19(%rbp), %eax
andl $0xf0, %eax
cmpl $0x90, %eax
jne 0xe453
movq -0x10(%rbp), %rdi
movzbl -0x19(%rbp), %esi
andl $0xf, %esi
movq -0x18(%rbp), %rdx
callq 0xe940
movl %eax, -0x4(%rbp)
jmp 0xe4a0
movzbl -0x19(%rbp), %eax
cmpl $0x80, %eax
jge 0xe472
movzbl -0x19(%rbp), %eax
movl %eax, %edi
movq -0x18(%rbp), %rsi
callq 0xe670
movl %eax, -0x4(%rbp)
jmp 0xe4a0
movzbl -0x19(%rbp), %eax
cmpl $0xe0, %eax
jl 0xe499
movzbl -0x19(%rbp), %eax
andl $0x1f, %eax
movslq %eax, %rdi
subq $0x20, %rdi
movq -0x18(%rbp), %rsi
callq 0xe670
movl %eax, -0x4(%rbp)
jmp 0xe4a0
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)