// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
testq %r14, %r14
je 0xb096
movzbl 0x4(%r14), %eax
cmpl $0x8, %eax
jne 0xab91
cmpq $0x0, 0x10(%rbx)
je 0xab53
movl 0x18(%rbx), %eax
incl %eax
cmpl 0x1c(%rbx), %eax
jbe 0xab48
movq %rbx, %rdi
movl $0x1, %esi
callq 0xd771
testl %eax, %eax
jne 0xab5f
movq 0x10(%rbx), %rax
movl 0x18(%rbx), %ecx
movb $-0x6e, (%rax,%rcx)
movl 0x18(%rbx), %eax
xorl %ebp, %ebp
cmpl $0x7ffffffe, %eax       # imm = 0x7FFFFFFE
jbe 0xab68
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
xorl %eax, %eax
jmp 0xab6f
incl %eax
movl %eax, 0x18(%rbx)
movb $0x1, %al
testb %al, %al
je 0xb09b
movq 0x8(%r14), %rsi
movq %rbx, %rdi
callq 0x8a00
testl %eax, %eax
jne 0xaf58
movq 0x10(%r14), %r14
jmp 0xab13
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
decl %eax
cmpl $0xd, %eax
ja 0xb09b
leaq 0xd52c(%rip), %rcx      # 0x180d4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpq $0x0, 0x10(%rbx)
je 0xade1
movl 0x18(%rbx), %eax
incl %eax
cmpl 0x1c(%rbx), %eax
jbe 0xabdb
movq %rbx, %rdi
movl $0x1, %esi
callq 0xd771
testl %eax, %eax
jne 0xb096
movq 0x10(%rbx), %rax
movl 0x18(%rbx), %ecx
movb $-0x40, (%rax,%rcx)
jmp 0xade1
movq %rbx, %rdi
movl $0x1, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xb251
movq 0x10(%r14), %rax
xorl %edx, %edx
testq %rax, %rax
je 0xac1d
movq 0x10(%rax), %rax
testq %rax, %rax
je 0xac1d
movq %r14, %rdi
callq *%rax
movl %eax, %edx
cmpl $0xf, %edx
ja 0xaf5f
cmpq $0x0, 0x10(%rbx)
je 0xac5d
movl 0x18(%rbx), %eax
incl %eax
cmpl 0x1c(%rbx), %eax
jbe 0xac50
movq %rbx, %rdi
movl $0x1, %esi
movl %edx, %ebp
callq 0xd771
movl %ebp, %edx
testl %eax, %eax
jne 0xb096
orb $-0x70, %dl
movq 0x10(%rbx), %rax
movl 0x18(%rbx), %ecx
movb %dl, (%rax,%rcx)
movl 0x18(%rbx), %eax
cmpl $0x7ffffffe, %eax       # imm = 0x7FFFFFFE
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
ja 0xb09b
incl %eax
jmp 0xb100
movl 0xc(%r14), %esi
incl %esi
movq %rbx, %rdi
movl $0x1, %edx
callq 0xc2c6
movl %eax, %ebp
testl %eax, %eax
je 0xb016
testl %ebp, %ebp
jne 0xb09b
movl 0xc(%r14), %r15d
cmpq $0x0, 0x10(%rbx)
je 0xacdb
movq 0x10(%r14), %r14
movl 0x18(%rbx), %eax
addl %r15d, %eax
cmpl 0x1c(%rbx), %eax
jbe 0xacc9
movq %rbx, %rdi
movl %r15d, %esi
callq 0xd771
testl %eax, %eax
jne 0xb096
movl 0x18(%rbx), %edi
addq 0x10(%rbx), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x85c0
movl 0x18(%rbx), %eax
addq %r15, %rax
jmp 0xaf26
cmpq $0x0, 0x10(%rbx)
je 0xad24
movq 0x8(%r14), %r14
movl 0x18(%rbx), %eax
addl $0x9, %eax
cmpl 0x1c(%rbx), %eax
jbe 0xad11
movq %rbx, %rdi
movl $0x9, %esi
callq 0xd771
testl %eax, %eax
jne 0xb096
bswapq %r14
movq 0x10(%rbx), %rax
movl 0x18(%rbx), %ecx
movb $-0x35, (%rax,%rcx)
movq %r14, 0x1(%rax,%rcx)
movl 0x18(%rbx), %eax
cmpl $0x7ffffff6, %eax       # imm = 0x7FFFFFF6
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
ja 0xb09b
addl $0x9, %eax
jmp 0xadf6
movq %r14, %rdi
callq 0x8310
movq %rax, %r15
leal 0x1(%rax), %esi
movq %rbx, %rdi
movl $0x1, %edx
callq 0xc2c6
movl %eax, %ebp
testl %eax, %eax
jne 0xaeda
cmpq $0x0, 0x10(%rbx)
je 0xaec4
movl 0x18(%rbx), %eax
incl %eax
cmpl 0x1c(%rbx), %eax
jbe 0xad93
movq %rbx, %rdi
movl $0x1, %esi
callq 0xd771
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0xaeda
movq 0x10(%rbx), %rax
movl 0x18(%rbx), %ecx
movb $0x3, (%rax,%rcx)
jmp 0xaec4
cmpb $0x0, 0x8(%r14)
sete %bpl
cmpq $0x0, 0x10(%rbx)
je 0xade1
movl 0x18(%rbx), %eax
incl %eax
cmpl 0x1c(%rbx), %eax
jbe 0xadd2
movq %rbx, %rdi
movl $0x1, %esi
callq 0xd771
testl %eax, %eax
jne 0xb096
xorb $-0x3d, %bpl
movq 0x10(%rbx), %rax
movl 0x18(%rbx), %ecx
movb %bpl, (%rax,%rcx)
movl 0x18(%rbx), %eax
cmpl $0x7ffffffe, %eax       # imm = 0x7FFFFFFE
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
ja 0xb09b
incl %eax
movl %eax, 0x18(%rbx)
jmp 0xaf3a
movq 0x8(%r14), %rsi
movq %rbx, %rdi
movl $0x1, %edx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xbe8f
movq 0x10(%r14), %rax
xorl %esi, %esi
testq %rax, %rax
je 0xae34
movq 0x10(%rax), %rax
testq %rax, %rax
je 0xae34
movq %r14, %rdi
callq *%rax
movl %eax, %esi
movl 0x8(%r14), %eax
testb $0x1, %al
jne 0xafc8
testb $0x2, %al
jne 0xb096
movq %rbx, %rdi
movl $0x1, %edx
callq 0xc7e5
testl %eax, %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jne 0xb09b
jmp 0xafeb
movl $0x1, %ebp
jmp 0xb09b
movq %r14, %rdi
callq 0x89e0
movq %rax, %r15
leal 0x1(%rax), %esi
movq %rbx, %rdi
movl $0x1, %edx
callq 0xc2c6
movl %eax, %ebp
testl %eax, %eax
jne 0xaeda
cmpq $0x0, 0x10(%rbx)
je 0xaec4
movl 0x18(%rbx), %eax
incl %eax
cmpl 0x1c(%rbx), %eax
jbe 0xaeb9
movq %rbx, %rdi
movl $0x1, %esi
callq 0xd771
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0xaeda
movq 0x10(%rbx), %rax
movl 0x18(%rbx), %ecx
movb $0x17, (%rax,%rcx)
movl 0x18(%rbx), %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x7ffffffe, %eax       # imm = 0x7FFFFFFE
ja 0xaeda
incl %eax
movl %eax, 0x18(%rbx)
xorl %ebp, %ebp
testl %ebp, %ebp
jne 0xb09b
cmpq $0x0, 0x10(%rbx)
je 0xaf1d
movq 0x10(%r14), %r14
movl 0x18(%rbx), %eax
addl %r15d, %eax
cmpl 0x1c(%rbx), %eax
jbe 0xaf0b
movq %rbx, %rdi
movl %r15d, %esi
callq 0xd771
testl %eax, %eax
jne 0xb096
movl 0x18(%rbx), %edi
addq 0x10(%rbx), %rdi
movl %r15d, %edx
movq %r14, %rsi
callq 0x85c0
movl 0x18(%rbx), %ecx
movl %r15d, %eax
addq %rcx, %rax
cmpq $0x7fffffff, %rax       # imm = 0x7FFFFFFF
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
ja 0xb09b
movl %eax, 0x18(%rbx)
xorl %ebp, %ebp
jmp 0xb09b
movq %rbx, %rdi
movl $0x1, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xb1ec
movl %eax, %ebp
jmp 0xb09b
cmpl $0xffff, %edx           # imm = 0xFFFF
ja 0xb06f
cmpq $0x0, 0x10(%rbx)
je 0xafad
movl 0x18(%rbx), %eax
addl $0x3, %eax
cmpl 0x1c(%rbx), %eax
jbe 0xaf96
movq %rbx, %rdi
movl $0x3, %esi
movl %edx, %ebp
callq 0xd771
movl %ebp, %edx
testl %eax, %eax
jne 0xb096
rolw $0x8, %dx
movq 0x10(%rbx), %rax
movl 0x18(%rbx), %ecx
movb $-0x24, (%rax,%rcx)
movb %dl, 0x1(%rax,%rcx)
movb %dh, 0x2(%rax,%rcx)
movl 0x18(%rbx), %eax
cmpl $0x7ffffffc, %eax       # imm = 0x7FFFFFFC
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
ja 0xb09b
addl $0x3, %eax
jmp 0xb100
incl %esi
movq %rbx, %rdi
movl $0x1, %edx
callq 0xc7e5
testl %eax, %eax
je 0xb0a8
movl %eax, %ebp
xorl %eax, %eax
testb %al, %al
je 0xb09b
movq 0x10(%r14), %rax
movl $0x1, %ebp
testq %rax, %rax
je 0xb09b
movq 0x40(%rax), %rax
testq %rax, %rax
je 0xb09b
leaq 0x2801(%rip), %rsi      # 0xd812
jmp 0xb128
cmpq $0x0, 0x10(%rbx)
je 0xb050
movb 0x1c(%r14), %r15b
movl 0x18(%rbx), %eax
incl %eax
cmpl 0x1c(%rbx), %eax
jbe 0xb045
movq %rbx, %rdi
movl $0x1, %esi
callq 0xd771
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0xac94
movq 0x10(%rbx), %rax
movl 0x18(%rbx), %ecx
movb %r15b, (%rax,%rcx)
movl 0x18(%rbx), %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x7ffffffe, %eax       # imm = 0x7FFFFFFE
ja 0xac94
incl %eax
movl %eax, 0x18(%rbx)
xorl %ebp, %ebp
jmp 0xac94
cmpq $0x0, 0x10(%rbx)
je 0xb0ee
movl 0x18(%rbx), %eax
addl $0x5, %eax
cmpl 0x1c(%rbx), %eax
jbe 0xb0dd
movq %rbx, %rdi
movl $0x5, %esi
movl %edx, %ebp
callq 0xd771
movl %ebp, %edx
testl %eax, %eax
je 0xb0dd
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movb 0x8(%r14), %r15b
cmpq $0x0, 0x10(%rbx)
je 0xb147
movl 0x18(%rbx), %eax
addl $0x2, %eax
cmpl 0x1c(%rbx), %eax
jbe 0xb13a
movq %rbx, %rdi
movl $0x2, %esi
callq 0xd771
testl %eax, %eax
je 0xb13a
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0xafe1
bswapl %edx
movq 0x10(%rbx), %rax
movl 0x18(%rbx), %ecx
movb $-0x23, (%rax,%rcx)
movl %edx, 0x1(%rax,%rcx)
movl 0x18(%rbx), %eax
cmpl $0x7ffffffa, %eax       # imm = 0x7FFFFFFA
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
ja 0xb09b
addl $0x5, %eax
movl %eax, 0x18(%rbx)
movq 0x10(%r14), %rax
movl $0x1, %ebp
testq %rax, %rax
je 0xb09b
movq 0xf0(%rax), %rax
testq %rax, %rax
je 0xb09b
leaq 0x26d4(%rip), %rsi      # 0xd7fc
movq %r14, %rdi
movq %rbx, %rdx
callq *%rax
xorb $0x1, %al
movzbl %al, %ebp
jmp 0xb09b
movq 0x10(%rbx), %rax
movl 0x18(%rbx), %ecx
movw $0xc7, (%rax,%rcx)
movl 0x18(%rbx), %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x7ffffffd, %eax       # imm = 0x7FFFFFFD
ja 0xafe1
leal 0x2(%rax), %ecx
movl %ecx, 0x18(%rbx)
cmpq $0x0, 0x10(%rbx)
je 0xb18f
addl $0x3, %eax
cmpl 0x1c(%rbx), %eax
jbe 0xb184
movq %rbx, %rdi
movl $0x1, %esi
callq 0xd771
testl %eax, %eax
jne 0xafe1
movq 0x10(%rbx), %rax
movl 0x18(%rbx), %ecx
movb %r15b, (%rax,%rcx)
movl 0x18(%rbx), %eax
cmpl $0x7ffffffe, %eax       # imm = 0x7FFFFFFE
ja 0xafe1
leal 0x1(%rax), %ecx
movl %ecx, 0x18(%rbx)
cmpq $0x0, 0x10(%rbx)
je 0xb1d2
addl $0x2, %eax
cmpl 0x1c(%rbx), %eax
jbe 0xb1c7
movq %rbx, %rdi
movl $0x1, %esi
callq 0xd771
testl %eax, %eax
jne 0xafe1
movq 0x10(%rbx), %rax
movl 0x18(%rbx), %ecx
movb $-0x40, (%rax,%rcx)
movl 0x18(%rbx), %eax
cmpl $0x7ffffffe, %eax       # imm = 0x7FFFFFFE
ja 0xafe1
incl %eax
movl %eax, 0x18(%rbx)
movb $0x1, %al
jmp 0xafe3