// File: /workspace/github_c_makefile_star2_O3/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 0xbcea
movzbl %dl, %edx
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0xbaa1
cmpq $-0x20, %rbx
jb 0xbd50
movq 0x10(%r14), %rax
testq %rax, %rax
je 0xbd35
movl 0x18(%r14), %ecx
leal 0x1(%rcx), %esi
cmpl 0x1c(%r14), %esi
jbe 0xbd30
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testb %dl, %dl
je 0xbefc
movq %r14, %rdi
movl $0x1, %esi
callq 0xd5db
testl %eax, %eax
jne 0xbefc
movq 0x10(%r14), %rax
movl 0x18(%r14), %ecx
movl %ecx, %ecx
movb %bl, (%rax,%rcx)
movl 0x18(%r14), %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x7ffffffe, %eax       # imm = 0x7FFFFFFE
ja 0xbefc
incl %eax
jmp 0xbef6
cmpq $-0x80, %rbx
jb 0xbdbc
movq 0x10(%r14), %rax
testq %rax, %rax
je 0xbda0
movl 0x18(%r14), %ecx
leal 0x2(%rcx), %esi
cmpl 0x1c(%r14), %esi
jbe 0xbd96
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testb %dl, %dl
je 0xbefc
movq %r14, %rdi
movl $0x2, %esi
callq 0xd5db
testl %eax, %eax
jne 0xbefc
movq 0x10(%r14), %rax
movl 0x18(%r14), %ecx
movl %ecx, %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 0xbefc
addl $0x2, %eax
jmp 0xbef6
cmpq $-0x8000, %rbx          # imm = 0x8000
jb 0xbe33
movq 0x10(%r14), %rax
testq %rax, %rax
je 0xbe17
movl 0x18(%r14), %ecx
leal 0x3(%rcx), %esi
cmpl 0x1c(%r14), %esi
jbe 0xbe05
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testb %dl, %dl
je 0xbefc
movq %r14, %rdi
movl $0x3, %esi
callq 0xd5db
testl %eax, %eax
jne 0xbefc
movq 0x10(%r14), %rax
movl 0x18(%r14), %ecx
movl %ecx, %ecx
rolw $0x8, %bx
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 0xbefc
addl $0x3, %eax
jmp 0xbef6
cmpq $-0x80000000, %rbx      # imm = 0x80000000
jb 0xbe9d
movq 0x10(%r14), %rax
testq %rax, %rax
je 0xbe88
movl 0x18(%r14), %ecx
leal 0x5(%rcx), %esi
cmpl 0x1c(%r14), %esi
jbe 0xbe7c
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testb %dl, %dl
je 0xbefc
movq %r14, %rdi
movl $0x5, %esi
callq 0xd5db
testl %eax, %eax
jne 0xbefc
movq 0x10(%r14), %rax
movl 0x18(%r14), %ecx
movl %ecx, %ecx
bswapl %ebx
movb $-0x2e, (%rax,%rcx)
movl %ebx, 0x1(%rax,%rcx)
movl 0x18(%r14), %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x7ffffffa, %eax       # imm = 0x7FFFFFFA
ja 0xbefc
addl $0x5, %eax
jmp 0xbef6
movq 0x10(%r14), %rax
testq %rax, %rax
je 0xbee3
movl 0x18(%r14), %ecx
leal 0x9(%rcx), %esi
cmpl 0x1c(%r14), %esi
jbe 0xbed5
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testb %dl, %dl
je 0xbefc
movq %r14, %rdi
movl $0x9, %esi
callq 0xd5db
testl %eax, %eax
jne 0xbefc
movq 0x10(%r14), %rax
movl 0x18(%r14), %ecx
movl %ecx, %ecx
bswapq %rbx
movb $-0x2d, (%rax,%rcx)
movq %rbx, 0x1(%rax,%rcx)
movl 0x18(%r14), %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x7ffffff6, %eax       # imm = 0x7FFFFFF6
ja 0xbefc
addl $0x9, %eax
xorl %ebp, %ebp
movl %eax, 0x18(%r14)
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq