// File: /workspace/github_c_makefile_star2_O0/aerospike[P]aerospike-common/src/main/aerospike/as_msgpack.c
// Function: unpack_size_internal
static inline int64_t
unpack_size_internal(as_unpacker *pk, uint32_t depth)
{
	if (pk->offset >= pk->length) {
		return -1;
	}

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

	switch (type) {
	case 0xc0: // nil
	case 0xc3: // boolean true
	case 0xc2: // boolean false
		return 1;

	case 0xd0: // signed 8 bit integer
	case 0xcc: // unsigned 8 bit integer
		pk->offset++;
		return 1 + 1;

	case 0xd1: // signed 16 bit integer
	case 0xcd: // unsigned 16 bit integer
		pk->offset += 2;
		return 1 + 2;

	case 0xca: // float
	case 0xd2: // signed 32 bit integer
	case 0xce: // unsigned 32 bit integer
		pk->offset += 4;
		return 1 + 4;

	case 0xcb: // double
	case 0xd3: // signed 64 bit integer
	case 0xcf: // unsigned 64 bit integer
		pk->offset += 8;
		return 1 + 8;

	case 0xc4:
	case 0xd9: { // string/raw bytes with 8 bit header
		uint8_t length = pk->buffer[pk->offset++];
		pk->offset += length;
		return 1 + 1 + length;
	}

	case 0xc5:
	case 0xda: { // string/raw bytes with 16 bit header
		uint16_t length = extract_uint16(pk);
		pk->offset += length;
		return 1 + 2 + length;
	}

	case 0xc6:
	case 0xdb: { // string/raw bytes with 32 bit header
		uint32_t length = extract_uint32(pk);
		pk->offset += length;
		return 1 + 4 + length;
	}

	case 0xdc: { // list with 16 bit header
		uint16_t length = extract_uint16(pk);
		int64_t ret = unpack_list_elements_size(pk, length, depth);
		if (ret < 0) {
			return -2;
		}
		return 1 + 2 + ret;
	}

	case 0xdd: { // list with 32 bit header
		uint32_t length = extract_uint32(pk);
		int64_t ret = unpack_list_elements_size(pk, length, depth);
		if (ret < 0) {
			return -3;
		}
		return 1 + 4 + ret;
	}

	case 0xde: { // map with 16 bit header
		uint16_t length = extract_uint16(pk);
		int64_t ret = unpack_map_elements_size(pk, length, depth);
		if (ret < 0) {
			return -4;
		}
		return 1 + 2 + ret;
	}

	case 0xdf: { // map with 32 bit header
		uint32_t length = extract_uint32(pk);
		int64_t ret = unpack_map_elements_size(pk, length, depth);
		if (ret < 0) {
			return -5;
		}
		return 1 + 4 + ret;
	}

	case 0xd4: // fixext 1
		pk->offset += 1 + 1;
		return 1 + 1 + 1;
	case 0xd5: // fixext 2
		pk->offset += 1 + 2;
		return 1 + 1 + 2;
	case 0xd6: // fixext 4
		pk->offset += 1 + 4;
		return 1 + 1 + 4;
	case 0xd7: // fixext 8
		pk->offset += 1 + 8;
		return 1 + 1 + 8;
	case 0xd8: // fixext 16
		pk->offset += 1 + 16;
		return 1 + 1 + 16;
	case 0xc7: { // ext 8
		uint8_t length = pk->buffer[pk->offset++];
		pk->offset += 1 + length;
		return 1 + 1 + 1 + length;
	}
	case 0xc8: { // ext 16
		uint16_t length = extract_uint16(pk);
		pk->offset += 1 + length;
		return 1 + 2 + 1 + length;
	}
	case 0xc9: { // ext 32
		uint32_t length = extract_uint32(pk);
		pk->offset += 1 + length;
		return 1 + 4 + 1 + length;
	}
	default:
		break;
	}

	if ((type & 0xe0) == 0xa0) { // raw bytes with 8 bit combined header
		int length = type & 0x1f;
		pk->offset += length;
		return 1 + length;
	}

	if ((type & 0xf0) == 0x80) { // map with 8 bit combined header
		int64_t ret = unpack_map_elements_size(pk, type & 0x0f, depth);
		if (ret < 0) {
			return -6;
		}
		return 1 + ret;
	}

	if ((type & 0xf0) == 0x90) { // list with 8 bit combined header
		int64_t ret = unpack_list_elements_size(pk, type & 0x0f, depth);
		if (ret < 0) {
			return -7;
		}
		return 1 + ret;
	}

	if (type < 0x80) { // 8 bit combined unsigned integer
		return 1;
	}

	if (type >= 0xe0) { // 8 bit combined signed integer
		return 1;
	}

	return -8;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jb 0xfe9f
movq $-0x1, -0x8(%rbp)
jmp 0x1031b
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, -0x15(%rbp)
movzbl -0x15(%rbp), %eax
addl $0xffffff40, %eax       # imm = 0xFFFFFF40
movl %eax, %ecx
movq %rcx, -0x80(%rbp)
subl $0x1f, %eax
ja 0x10220
movq -0x80(%rbp), %rax
leaq 0x17337(%rip), %rcx     # 0x27210
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq $0x1, -0x8(%rbp)
jmp 0x1031b
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
movq $0x2, -0x8(%rbp)
jmp 0x1031b
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
addl $0x2, %ecx
movl %ecx, 0x8(%rax)
movq $0x3, -0x8(%rbp)
jmp 0x1031b
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
addl $0x4, %ecx
movl %ecx, 0x8(%rax)
movq $0x5, -0x8(%rbp)
jmp 0x1031b
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
addl $0x8, %ecx
movl %ecx, 0x8(%rax)
movq $0x9, -0x8(%rbp)
jmp 0x1031b
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
movb (%rax,%rcx), %al
movb %al, -0x16(%rbp)
movzbl -0x16(%rbp), %ecx
movq -0x10(%rbp), %rax
addl 0x8(%rax), %ecx
movl %ecx, 0x8(%rax)
movzbl -0x16(%rbp), %eax
addl $0x2, %eax
cltq
movq %rax, -0x8(%rbp)
jmp 0x1031b
movq -0x10(%rbp), %rdi
callq 0xe6a0
movw %ax, -0x18(%rbp)
movzwl -0x18(%rbp), %ecx
movq -0x10(%rbp), %rax
addl 0x8(%rax), %ecx
movl %ecx, 0x8(%rax)
movzwl -0x18(%rbp), %eax
addl $0x3, %eax
cltq
movq %rax, -0x8(%rbp)
jmp 0x1031b
movq -0x10(%rbp), %rdi
callq 0xe6f0
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %rax
addl 0x8(%rax), %ecx
movl %ecx, 0x8(%rax)
movl -0x1c(%rbp), %eax
addl $0x5, %eax
movl %eax, %eax
movq %rax, -0x8(%rbp)
jmp 0x1031b
movq -0x10(%rbp), %rdi
callq 0xe6a0
movw %ax, -0x1e(%rbp)
movq -0x10(%rbp), %rdi
movzwl -0x1e(%rbp), %esi
movl -0x14(%rbp), %edx
callq 0x11a90
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jge 0x10021
movq $-0x2, -0x8(%rbp)
jmp 0x1031b
movq -0x28(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x8(%rbp)
jmp 0x1031b
movq -0x10(%rbp), %rdi
callq 0xe6f0
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %esi
movl -0x14(%rbp), %edx
callq 0x11a90
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jge 0x10065
movq $-0x3, -0x8(%rbp)
jmp 0x1031b
movq -0x38(%rbp), %rax
addq $0x5, %rax
movq %rax, -0x8(%rbp)
jmp 0x1031b
movq -0x10(%rbp), %rdi
callq 0xe6a0
movw %ax, -0x3a(%rbp)
movq -0x10(%rbp), %rdi
movzwl -0x3a(%rbp), %esi
movl -0x14(%rbp), %edx
callq 0x11b80
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jge 0x100ab
movq $-0x4, -0x8(%rbp)
jmp 0x1031b
movq -0x48(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x8(%rbp)
jmp 0x1031b
movq -0x10(%rbp), %rdi
callq 0xe6f0
movl %eax, -0x4c(%rbp)
movq -0x10(%rbp), %rdi
movl -0x4c(%rbp), %esi
movl -0x14(%rbp), %edx
callq 0x11b80
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
jge 0x100ef
movq $-0x5, -0x8(%rbp)
jmp 0x1031b
movq -0x58(%rbp), %rax
addq $0x5, %rax
movq %rax, -0x8(%rbp)
jmp 0x1031b
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
addl $0x2, %ecx
movl %ecx, 0x8(%rax)
movq $0x3, -0x8(%rbp)
jmp 0x1031b
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
addl $0x3, %ecx
movl %ecx, 0x8(%rax)
movq $0x4, -0x8(%rbp)
jmp 0x1031b
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
addl $0x5, %ecx
movl %ecx, 0x8(%rax)
movq $0x6, -0x8(%rbp)
jmp 0x1031b
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
addl $0x9, %ecx
movl %ecx, 0x8(%rax)
movq $0xa, -0x8(%rbp)
jmp 0x1031b
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
addl $0x11, %ecx
movl %ecx, 0x8(%rax)
movq $0x12, -0x8(%rbp)
jmp 0x1031b
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
movb (%rax,%rcx), %al
movb %al, -0x59(%rbp)
movzbl -0x59(%rbp), %ecx
addl $0x1, %ecx
movq -0x10(%rbp), %rax
addl 0x8(%rax), %ecx
movl %ecx, 0x8(%rax)
movzbl -0x59(%rbp), %eax
addl $0x3, %eax
cltq
movq %rax, -0x8(%rbp)
jmp 0x1031b
movq -0x10(%rbp), %rdi
callq 0xe6a0
movw %ax, -0x5c(%rbp)
movzwl -0x5c(%rbp), %ecx
addl $0x1, %ecx
movq -0x10(%rbp), %rax
addl 0x8(%rax), %ecx
movl %ecx, 0x8(%rax)
movzwl -0x5c(%rbp), %eax
addl $0x4, %eax
cltq
movq %rax, -0x8(%rbp)
jmp 0x1031b
movq -0x10(%rbp), %rdi
callq 0xe6f0
movl %eax, -0x60(%rbp)
movl -0x60(%rbp), %ecx
addl $0x1, %ecx
movq -0x10(%rbp), %rax
addl 0x8(%rax), %ecx
movl %ecx, 0x8(%rax)
movl -0x60(%rbp), %eax
addl $0x6, %eax
movl %eax, %eax
movq %rax, -0x8(%rbp)
jmp 0x1031b
jmp 0x10222
movzbl -0x15(%rbp), %eax
andl $0xe0, %eax
cmpl $0xa0, %eax
jne 0x1025a
movzbl -0x15(%rbp), %eax
andl $0x1f, %eax
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %ecx
movq -0x10(%rbp), %rax
addl 0x8(%rax), %ecx
movl %ecx, 0x8(%rax)
movl -0x64(%rbp), %eax
addl $0x1, %eax
cltq
movq %rax, -0x8(%rbp)
jmp 0x1031b
movzbl -0x15(%rbp), %eax
andl $0xf0, %eax
cmpl $0x80, %eax
jne 0x102a3
movq -0x10(%rbp), %rdi
movzbl -0x15(%rbp), %esi
andl $0xf, %esi
movl -0x14(%rbp), %edx
callq 0x11b80
movq %rax, -0x70(%rbp)
cmpq $0x0, -0x70(%rbp)
jge 0x10295
movq $-0x6, -0x8(%rbp)
jmp 0x1031b
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x1031b
movzbl -0x15(%rbp), %eax
andl $0xf0, %eax
cmpl $0x90, %eax
jne 0x102e9
movq -0x10(%rbp), %rdi
movzbl -0x15(%rbp), %esi
andl $0xf, %esi
movl -0x14(%rbp), %edx
callq 0x11a90
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x78(%rbp)
jge 0x102db
movq $-0x7, -0x8(%rbp)
jmp 0x1031b
movq -0x78(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x1031b
movzbl -0x15(%rbp), %eax
cmpl $0x80, %eax
jge 0x102fe
movq $0x1, -0x8(%rbp)
jmp 0x1031b
movzbl -0x15(%rbp), %eax
cmpl $0xe0, %eax
jl 0x10313
movq $0x1, -0x8(%rbp)
jmp 0x1031b
movq $-0x8, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax,%rax)