// File: /workspace/github_c_makefile_star2_O0/aerospike[P]aerospike-common/src/main/aerospike/as_msgpack.c
// Function: as_pack_val
int
as_pack_val(as_packer *pk, const as_val *val)
{
	if (! val) {
		return -1;
	}

	int rc = 0;

	// TODO - Make all of these const.
	switch (as_val_type(val)) {
	case AS_NIL:
		rc = pack_byte(pk, 0xc0, true);
		break;
	case AS_BOOLEAN:
		rc = pack_as_boolean(pk, (const as_boolean *)val);
		break;
	case AS_INTEGER:
		rc = pack_as_integer(pk, (const as_integer *)val);
		break;
	case AS_DOUBLE:
		rc = pack_as_double(pk, (const as_double *)val);
		break;
	case AS_STRING:
		rc = pack_string(pk, (as_string *)val);
		break;
	case AS_BYTES:
		rc = pack_bytes(pk, (const as_bytes *)val);
		break;
	case AS_LIST:
		rc = pack_list(pk, (as_list *)val);
		break;
	case AS_MAP:
		rc = pack_map(pk, (const as_map *)val);
		break;
	case AS_REC:
		rc = pack_rec(pk, (const as_rec *)val);
		break;
	case AS_PAIR:
		rc = pack_pair(pk, (as_pair *)val);
		break;
	case AS_GEOJSON:
		rc = pack_geojson(pk, (as_geojson *)val);
		break;
	case AS_CMP_WILDCARD:
		rc = as_pack_wildcard_internal(pk, true);
		break;
	case AS_CMP_INF:
		rc = as_pack_inf_internal(pk, true);
		break;
	default:
		return -2;
	}

	return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0xd933
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xda90
movl $0x0, -0x1c(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0xd94e
movq -0x18(%rbp), %rax
movzbl 0x4(%rax), %eax
movl %eax, -0x20(%rbp)
jmp 0xd955
xorl %eax, %eax
movl %eax, -0x20(%rbp)
jmp 0xd955
movl -0x20(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x28(%rbp)
subl $0xd, %eax
ja 0xda81
movq -0x28(%rbp), %rax
leaq 0x19764(%rip), %rcx     # 0x270d8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rdi
movl $0xc0, %esi
movl $0x1, %edx
callq 0xdaa0
movl %eax, -0x1c(%rbp)
jmp 0xda8a
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xdb30
movl %eax, -0x1c(%rbp)
jmp 0xda8a
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xdb80
movl %eax, -0x1c(%rbp)
jmp 0xda8a
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xdbc0
movl %eax, -0x1c(%rbp)
jmp 0xda8a
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xdc00
movl %eax, -0x1c(%rbp)
jmp 0xda8a
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xdc80
movl %eax, -0x1c(%rbp)
jmp 0xda8a
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xdd00
movl %eax, -0x1c(%rbp)
jmp 0xda8a
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xddc0
movl %eax, -0x1c(%rbp)
jmp 0xda8a
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xdee0
movl %eax, -0x1c(%rbp)
jmp 0xda8a
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xdf00
movl %eax, -0x1c(%rbp)
jmp 0xda8a
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xdf90
movl %eax, -0x1c(%rbp)
jmp 0xda8a
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0xe010
movl %eax, -0x1c(%rbp)
jmp 0xda8a
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0xe060
movl %eax, -0x1c(%rbp)
jmp 0xda8a
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0xda90
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)