// File: /workspace/github_c_makefile_star2_O1/aerospike[P]aerospike-common/src/main/aerospike/as_msgpack.c
// Function: pack_int64
static inline int
pack_int64(as_packer *pk, int64_t val, bool resize)
{
	if (val >= 0) {
		return pack_uint64(pk, (uint64_t)val, resize);
	}

	if (val >= -(1LL << 5)) {
		return pack_byte(pk, (uint8_t)(0xe0 | (val + 32)), resize);
	}

	if (val >= -(1LL << 7)) {
		return pack_type_uint8(pk, 0xd0, (uint8_t)val, resize);
	}

	if (val >= -(1LL << 15)) {
		return pack_type_uint16(pk, 0xd1, (uint16_t)val, resize);
	}

	if (val >= -(1LL << 31)) {
		return pack_type_uint32(pk, 0xd2, (uint32_t)val, resize);
	}

	return pack_type_uint64(pk, 0xd3, (uint64_t)val, resize);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
testq %rsi, %rsi
js 0xbeb0
movzbl %dl, %edx
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0xbc62
cmpq $-0x20, %rbx
jl 0xbf14
cmpq $0x0, 0x10(%r14)
je 0xbef9
movl 0x18(%r14), %eax
incl %eax
cmpl 0x1c(%r14), %eax
jbe 0xbeeb
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testb %dl, %dl
je 0xc0b0
movq %r14, %rdi
movl $0x1, %esi
callq 0xd771
testl %eax, %eax
jne 0xc0b0
orb $-0x20, %bl
movq 0x10(%r14), %rax
movl 0x18(%r14), %ecx
movb %bl, (%rax,%rcx)
movl 0x18(%r14), %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x7ffffffe, %eax       # imm = 0x7FFFFFFE
ja 0xc0b0
incl %eax
jmp 0xc0aa
cmpq $-0x80, %rbx
jl 0xbf7c
cmpq $0x0, 0x10(%r14)
je 0xbf60
movl 0x18(%r14), %eax
addl $0x2, %eax
cmpl 0x1c(%r14), %eax
jbe 0xbf50
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testb %dl, %dl
je 0xc0b0
movq %r14, %rdi
movl $0x2, %esi
callq 0xd771
testl %eax, %eax
jne 0xc0b0
movq 0x10(%r14), %rax
movl 0x18(%r14), %ecx
movb $-0x30, (%rax,%rcx)
movb %bl, 0x1(%rax,%rcx)
movl 0x18(%r14), %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x7ffffffd, %eax       # imm = 0x7FFFFFFD
ja 0xc0b0
addl $0x2, %eax
jmp 0xc0aa
cmpq $-0x8000, %rbx          # imm = 0x8000
jl 0xbfef
cmpq $0x0, 0x10(%r14)
je 0xbfd3
movl 0x18(%r14), %eax
addl $0x3, %eax
cmpl 0x1c(%r14), %eax
jbe 0xbfbb
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testb %dl, %dl
je 0xc0b0
movq %r14, %rdi
movl $0x3, %esi
callq 0xd771
testl %eax, %eax
jne 0xc0b0
rolw $0x8, %bx
movq 0x10(%r14), %rax
movl 0x18(%r14), %ecx
movb $-0x2f, (%rax,%rcx)
movb %bl, 0x1(%rax,%rcx)
movb %bh, 0x2(%rax,%rcx)
movl 0x18(%r14), %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x7ffffffc, %eax       # imm = 0x7FFFFFFC
ja 0xc0b0
addl $0x3, %eax
jmp 0xc0aa
cmpq $-0x80000000, %rbx      # imm = 0x80000000
jl 0xc055
cmpq $0x0, 0x10(%r14)
je 0xc040
movl 0x18(%r14), %eax
addl $0x5, %eax
cmpl 0x1c(%r14), %eax
jbe 0xc02e
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testb %dl, %dl
je 0xc0b0
movq %r14, %rdi
movl $0x5, %esi
callq 0xd771
testl %eax, %eax
jne 0xc0b0
bswapl %ebx
movq 0x10(%r14), %rax
movl 0x18(%r14), %ecx
movb $-0x2e, (%rax,%rcx)
movl %ebx, 0x1(%rax,%rcx)
movl 0x18(%r14), %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x7ffffffa, %eax       # imm = 0x7FFFFFFA
ja 0xc0b0
addl $0x5, %eax
jmp 0xc0aa
cmpq $0x0, 0x10(%r14)
je 0xc097
movl 0x18(%r14), %eax
addl $0x9, %eax
cmpl 0x1c(%r14), %eax
jbe 0xc083
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testb %dl, %dl
je 0xc0b0
movq %r14, %rdi
movl $0x9, %esi
callq 0xd771
testl %eax, %eax
jne 0xc0b0
bswapq %rbx
movq 0x10(%r14), %rax
movl 0x18(%r14), %ecx
movb $-0x2d, (%rax,%rcx)
movq %rbx, 0x1(%rax,%rcx)
movl 0x18(%r14), %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x7ffffff6, %eax       # imm = 0x7FFFFFF6
ja 0xc0b0
addl $0x9, %eax
movl %eax, 0x18(%r14)
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq