LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_msgpack.c
// Function: as_unpack_map_header_element_count
int64_t
as_unpack_map_header_element_count(as_unpacker *pk)
{
	if (pk->offset >= pk->length) {
		return -1;
	}

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

	switch (type) {
	case 0xde: // map with 16 bit header
		if (size < 2) {
			return -2;
		}
		return extract_uint16(pk);
	case 0xdf: // map with 32 bit header
		if (size < 4) {
			return -3;
		}
		return extract_uint32(pk);
	default:
		break;
	}

	if ((type & 0xf0) == 0x80) { // map with 8 bit combined header
		return type & 0x0f;
	}

	return -4;
}

// Assembly:
movl 0x8(%rdi), %ecx
movl 0xc(%rdi), %esi
movq $-0x1, %rax
cmpl %esi, %ecx
jae 0xd3fa
movq (%rdi), %rdx
leaq 0x1(%rcx), %r9
movl %r9d, 0x8(%rdi)
subl %r9d, %esi
movzbl (%rdx,%rcx), %r8d
cmpl $0xdf, %r8d
je 0xd3c5
cmpl $0xde, %r8d
jne 0xd3de
movq $-0x2, %rax
cmpl $0x2, %esi
jb 0xd3fa
movzwl (%rdx,%r9), %eax
addl $0x3, %ecx
movl %ecx, 0x8(%rdi)
rolw $0x8, %ax
movzwl %ax, %eax
retq
movq $-0x3, %rax
cmpl $0x4, %esi
jb 0xd3fa
movl 0x1(%rdx,%rcx), %eax
addl $0x5, %ecx
movl %ecx, 0x8(%rdi)
bswapl %eax
retq
movl %r8d, %ecx
movq $-0x4, %rax
andl $-0x10, %ecx
cmpl $0x80, %ecx
jne 0xd3fa
andl $0xf, %r8d
movq %r8, %rax
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_msgpack.c
// Function: as_unpack_buf_compare
msgpack_compare_t
as_unpack_buf_compare(const uint8_t *buf1, uint32_t size1, const uint8_t *buf2,
		uint32_t size2)
{
	as_unpacker pk1 = {
			.buffer = buf1,
			.offset = 0,
			.length = size1
	};
	as_unpacker pk2 = {
			.buffer = buf2,
			.offset = 0,
			.length = size2
	};
	as_val_t type;

	return msgpack_compare_internal(&pk1, &pk2, 0, &type);
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x28, %rsp
xorl %ebp, %ebp
testl %esi, %esi
movq %rdx, 0x8(%rsp)
movq %rdi, 0x18(%rsp)
setne %al
testl %ecx, %ecx
movl %ebp, 0x20(%rsp)
movl %ebp, 0x10(%rsp)
movl %esi, 0x24(%rsp)
movl %ecx, 0x14(%rsp)
setne %dl
testb %dl, %al
jne 0xd460
cmpl %ecx, %esi
jl 0xd4aa
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
movl $0x2, %ebp
jg 0xd4aa
jmp 0xd4db
leaq 0x18(%rsp), %rdi
callq 0x8410
leaq 0x8(%rsp), %rdi
movl %eax, %ebx
callq 0x8410
testb %bl, %bl
sete %cl
testb %al, %al
sete %dl
orb %cl, %dl
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
jne 0xd4db
cmpb $0xd, %bl
movl $0x1, %ebp
sete %cl
cmpb $0xd, %al
sete %dl
orb %cl, %dl
jne 0xd4aa
xorl %ebp, %ebp
cmpb %al, %bl
jb 0xd4aa
movl $0x2, %ebp
jbe 0xd4e4
leaq 0x18(%rsp), %rdi
xorl %esi, %esi
callq 0xcb72
testq %rax, %rax
js 0xd4d6
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
callq 0xcb72
testq %rax, %rax
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
cmovsl %ecx, %ebp
movl %ebp, %ecx
jmp 0xd4db
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
movl %ecx, %eax
addq $0x28, %rsp
popq %rbx
popq %rbp
retq
movzbl %bl, %edx
leaq 0x18(%rsp), %rdi
leaq 0x8(%rsp), %rsi
xorl %ecx, %ecx
callq 0xda9a
movl %eax, %ecx
jmp 0xd4db
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_msgpack.c
// Function: pack_resize
static int
pack_resize(as_packer *pk, uint32_t sz)
{
	// Add current buffer to linked list and allocate a new buffer
	as_packer_buffer *entry =
			(as_packer_buffer *)cf_malloc(sizeof(as_packer_buffer));

	if (! entry) {
		return -1;
	}

	entry->buffer = pk->buffer;
	entry->length = pk->offset;
	entry->next = 0;

	size_t newcap = (size_t)((sz > (uint32_t)pk->capacity) ? sz : pk->capacity);

	if (! (pk->buffer = (unsigned char *)cf_malloc(newcap))) {
		cf_free(entry);
		return -1;
	}

	pk->capacity = (int)newcap;
	pk->offset = 0;

	if (pk->tail) {
		pk->tail->next = entry;
		pk->tail = entry;
	}
	else {
		pk->head = entry;
		pk->tail = entry;
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x18, %edi
movl %esi, %r15d
callq 0x8080
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0xd659
movq %rax, %r14
movq 0x10(%rbx), %rax
movq %rax, 0x8(%r14)
movl 0x18(%rbx), %eax
movl %eax, 0x10(%r14)
movq $0x0, (%r14)
movl 0x1c(%rbx), %eax
cmpl %r15d, %eax
cmoval %eax, %r15d
movq %r15, %rdi
callq 0x8080
testq %rax, %rax
movq %rax, 0x10(%rbx)
je 0xd651
movl %r15d, 0x1c(%rbx)
movl $0x0, 0x18(%rbx)
movq 0x8(%rbx), %rax
testq %rax, %rax
cmoveq %rbx, %rax
xorl %ebp, %ebp
movq %r14, (%rax)
movq %r14, 0x8(%rbx)
jmp 0xd659
movq %r14, %rdi
callq 0x8940
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_msgpack.c
// Function: pack_map_foreach
static bool
pack_map_foreach(const as_val* key, const as_val* val, void* udata)
{
	as_packer* pk = (as_packer*)udata;
	int rc = as_pack_val(pk, (as_val*)key);

	if (rc == 0) {
		rc = as_pack_val(pk, (as_val*)val);
	}

	return rc == 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %rsi
movq %rdx, %rdi
movq %rdx, %r14
callq 0x8a00
testl %eax, %eax
je 0xd699
xorl %eax, %eax
jmp 0xd6a9
movq %r14, %rdi
movq %rbx, %rsi
callq 0x8a00
testl %eax, %eax
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_msgpack.c
// Function: unpack_list_elements_size
static int64_t
unpack_list_elements_size(as_unpacker *pk, uint32_t ele_count, uint32_t depth)
{
	if (++depth > MSGPACK_COMPARE_MAX_DEPTH) {
		msgpack_parse_memblock *block = msgpack_parse_memblock_create(NULL);
		msgpack_parse_state *state = msgpack_parse_memblock_next(&block);

		state->index = 0;
		state->map_pair = 0;
		state->len = ele_count;
		state->type = AS_LIST;

		int64_t ret = unpack_size_non_recursive(pk, block, state);

		msgpack_parse_memblock_destroy(block);

		return ret;
	}

	int64_t total = 0;

	for (uint32_t i = 0; i < ele_count; i++) {
		int64_t ret = unpack_size_internal(pk, depth);

		if (ret < 0) {
			return -1;
		}

		total += ret;
	}

	return total;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r15d
movl %esi, %ebp
movq %rdi, %r14
incl %r15d
cmpl $0x100, %r15d           # imm = 0x100
jbe 0xd722
movl $0x1810, %edi           # imm = 0x1810
callq 0x8080
leaq 0x8(%rax), %rdx
movq %r14, %rdi
movq %rax, %rsi
movq $0x0, (%rax)
movq $0x1, 0x1808(%rax)
movl $0x0, 0x14(%rax)
movw $0x500, 0x18(%rax)      # imm = 0x500
movq %rax, %r15
movl %ebp, 0x10(%rax)
callq 0xd874
movq %rax, %rbx
movq (%r15), %r14
movq %r15, %rdi
callq 0x8940
testq %r14, %r14
movq %r14, %r15
jne 0xd70d
jmp 0xd748
xorl %ebx, %ebx
testl %ebp, %ebp
je 0xd748
movq %r14, %rdi
movl %r15d, %esi
callq 0xcb72
testq %rax, %rax
js 0xd741
addq %rax, %rbx
decl %ebp
jne 0xd728
jmp 0xd748
movq $-0x1, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_msgpack.c
// Function: unpack_map_elements_size
static int64_t
unpack_map_elements_size(as_unpacker *pk, uint32_t ele_count, uint32_t depth)
{
	if (++depth > MSGPACK_COMPARE_MAX_DEPTH) {
		msgpack_parse_memblock *block = msgpack_parse_memblock_create(NULL);
		msgpack_parse_state *state = msgpack_parse_memblock_next(&block);

		state->index = 0;
		state->map_pair = 0;
		state->len = ele_count;
		state->type = AS_MAP;

		int64_t ret = unpack_size_non_recursive(pk, block, state);
		msgpack_parse_memblock_destroy(block);

		return ret;
	}

	int64_t total = 0;

	for (uint32_t i = 0; i < ele_count; i++) {
		int64_t ret = unpack_size_internal(pk, depth);

		if (ret < 0) {
			return -1;
		}

		total += ret;
		ret = unpack_size_internal(pk, depth);

		if (ret < 0) {
			return -2;
		}

		total += ret;
	}

	return total;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %r15d
movl %esi, %ebp
movq %rdi, %r14
incl %r15d
cmpl $0x100, %r15d           # imm = 0x100
jbe 0xd7c8
movl $0x1810, %edi           # imm = 0x1810
callq 0x8080
leaq 0x8(%rax), %rdx
movq %r14, %rdi
movq %rax, %rsi
movq $0x0, (%rax)
movq $0x1, 0x1808(%rax)
movl $0x0, 0x14(%rax)
movw $0x600, 0x18(%rax)      # imm = 0x600
movq %rax, %r15
movl %ebp, 0x10(%rax)
callq 0xd874
movq %rax, %rbx
movq (%r15), %r14
movq %r15, %rdi
callq 0x8940
testq %r14, %r14
movq %r14, %r15
jne 0xd7b3
jmp 0xd80d
xorl %ebx, %ebx
testl %ebp, %ebp
je 0xd80d
movq %r14, %rdi
movl %r15d, %esi
callq 0xcb72
testq %rax, %rax
js 0xd7fd
movq %r14, %rdi
movl %r15d, %esi
movq %rax, %r12
callq 0xcb72
testq %rax, %rax
js 0xd806
addq %r12, %rbx
addq %rax, %rbx
decl %ebp
jne 0xd7ce
jmp 0xd80d
movq $-0x1, %rbx
jmp 0xd80d
movq $-0x2, %rbx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_msgpack.c
// Function: msgpack_parse_memblock_next
static msgpack_parse_state *
msgpack_parse_memblock_next(msgpack_parse_memblock **block)
{
	msgpack_parse_memblock *ptr = *block;

	if (ptr->count >= MSGPACK_PARSE_MEMBLOCK_STATE_COUNT) {
		ptr = msgpack_parse_memblock_create(ptr);
		*block = ptr;
	}

	return &ptr->buffer[ptr->count++];
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq (%rdi), %r14
movq 0x1808(%r14), %rcx
cmpq $0x100, %rcx            # imm = 0x100
jb 0xd858
movq %rdi, %rbx
movl $0x1810, %edi           # imm = 0x1810
callq 0x8080
movq %r14, (%rax)
movq $0x0, 0x1808(%rax)
movq %rax, (%rbx)
movq %rax, %r14
movq 0x1808(%rax), %rcx
leaq 0x1(%rcx), %rax
movq %rax, 0x1808(%r14)
leaq (%rcx,%rcx,2), %rax
leaq 0x8(%r14,%rax,8), %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_msgpack.c
// Function: msgpack_parse_memblock_prev
static msgpack_parse_state *
msgpack_parse_memblock_prev(msgpack_parse_memblock **block)
{
	msgpack_parse_memblock *ptr = *block;

	if (ptr->count <= 1) {
		ptr = ptr->prev;
		cf_free(*block);
		*block = ptr;
	}
	else {
		ptr->count--;
	}

	// No check for NULL ptr here, use has_prev to make sure it doesn't happen.

	return &ptr->buffer[ptr->count - 1];
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
movq 0x1808(%rdi), %rax
cmpq $0x1, %rax
ja 0xda7f
movq (%rdi), %r14
callq 0x8940
movq %r14, (%rbx)
movq %r14, %rdi
movq 0x1808(%r14), %rax
jmp 0xda89
decq %rax
movq %rax, 0x1808(%rdi)
leaq (%rax,%rax,2), %rax
leaq -0x10(%rdi,%rax,8), %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_msgpack.c
// Function: msgpack_parse_state_list_cmp_init
static bool
msgpack_parse_state_list_cmp_init(msgpack_parse_state *state, as_unpacker *pk1,
		as_unpacker *pk2)
{
	int64_t len1 = as_unpack_list_header_element_count(pk1);
	int64_t len2 = as_unpack_list_header_element_count(pk2);
	int64_t minlen = (len1 < len2) ? len1 : len2;

	if (minlen < 0) {
		return false;
	}

	state->len1 = (uint32_t)len1;
	state->len2 = (uint32_t)len2;
	state->index = 0;
	state->map_pair = 0;
	state->len = (uint32_t)minlen;
	state->type = AS_LIST;
	state->default_compare_type = msgpack_compare_int64_t(len1, len2);

	return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq %rsi, %rdi
movq %rdx, %r15
callq 0x85e0
movq %r15, %rdi
movq %rax, %r14
callq 0x85e0
cmpq %rax, %r14
movq %rax, %rcx
cmovlq %r14, %rcx
testq %rcx, %rcx
js 0xed16
xorl %edx, %edx
cmpq %rax, %r14
movl %r14d, (%rbx)
movl %eax, 0x4(%rbx)
setg %dl
xorl %esi, %esi
incl %edx
cmpq %rax, %r14
movl %esi, 0xc(%rbx)
movw $0x500, 0x10(%rbx)      # imm = 0x500
movl %ecx, 0x8(%rbx)
cmovll %esi, %edx
movl %edx, 0x14(%rbx)
testq %rcx, %rcx
setns %al
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_msgpack.c
// Function: msgpack_compare_unwind_all
static bool
msgpack_compare_unwind_all(as_unpacker *pk1, as_unpacker *pk2,
		msgpack_parse_memblock **block)
{
	if ((*block)->count == 0) {
		return true;
	}

	const msgpack_parse_state *state = &(*block)->buffer[(*block)->count - 1];

	while (true) {
		if (! msgpack_compare_unwind(pk1, pk2, state)) {
			return false;
		}

		if (! msgpack_parse_memblock_has_prev(*block)) {
			break;
		}

		state = msgpack_parse_memblock_prev(block);
	}

	return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq (%rdx), %rax
movb $0x1, %bl
movq 0x1808(%rax), %rcx
testq %rcx, %rcx
je 0xed7e
leaq (%rcx,%rcx,2), %rcx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
leaq -0x10(%rax,%rcx,8), %rdx
callq 0xed8c
testb %al, %al
je 0xed7c
movq (%r14), %rax
cmpq $0x0, (%rax)
jne 0xed69
cmpq $0x2, 0x1808(%rax)
jb 0xed7e
movq %r14, %rdi
callq 0xda51
movq %r12, %rdi
movq %r15, %rsi
movq %rax, %rdx
jmp 0xed4d
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_msgpack.c
// Function: msgpack_compare_unwind
static bool
msgpack_compare_unwind(as_unpacker *pk1, as_unpacker *pk2,
		const msgpack_parse_state *state)
{
	if (state->type == AS_LIST) {
		if (! msgpack_skip(pk1, state->len1 - state->index)) {
			return false;
		}

		if (! msgpack_skip(pk2, state->len2 - state->index)) {
			return false;
		}
	}
	else if (state->type == AS_MAP) {
		if (! msgpack_skip(pk1,
				2 * (state->len1 - state->index) - state->map_pair)) {
			return false;
		}

		if (! msgpack_skip(pk2,
				2 * (state->len2 - state->index) - state->map_pair)) {
			return false;
		}
	}

	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movzbl 0x11(%rdx), %eax
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
cmpl $0x6, %eax
je 0xee4f
cmpl $0x5, %eax
jne 0xeeee
movl (%r14), %eax
movl %eax, %r12d
subl 0xc(%r14), %r12d
je 0xee04
movq %r15, %rdi
xorl %esi, %esi
xorl %ebp, %ebp
callq 0xcb72
testq %rax, %rax
js 0xeef1
movl $0x1, %ecx
movq %rcx, %r13
cmpq %rcx, %r12
je 0xedf7
movq %r15, %rdi
xorl %esi, %esi
callq 0xcb72
leaq 0x1(%r13), %rcx
testq %rax, %rax
jns 0xeddc
cmpq %r12, %r13
jb 0xeeea
movl 0xc(%r14), %eax
movl 0x4(%r14), %r14d
subl %eax, %r14d
je 0xeeee
movq %rbx, %rdi
xorl %esi, %esi
xorl %ebp, %ebp
callq 0xcb72
testq %rax, %rax
js 0xeef1
movl $0x1, %ecx
movq %rcx, %r15
cmpq %rcx, %r14
je 0xeee5
movq %rbx, %rdi
xorl %esi, %esi
callq 0xcb72
leaq 0x1(%r15), %rcx
testq %rax, %rax
jns 0xee2b
jmp 0xeee5
movl (%r14), %r12d
movl 0xc(%r14), %eax
movzbl 0x10(%r14), %ecx
subl %eax, %r12d
addl %r12d, %r12d
subl %ecx, %r12d
je 0xeea5
movq %r15, %rdi
xorl %esi, %esi
xorl %ebp, %ebp
callq 0xcb72
testq %rax, %rax
js 0xeef1
movl $0x1, %ecx
movq %rcx, %r13
cmpq %rcx, %r12
je 0xee97
movq %r15, %rdi
xorl %esi, %esi
callq 0xcb72
leaq 0x1(%r13), %rcx
testq %rax, %rax
jns 0xee7c
cmpq %r12, %r13
jb 0xeeea
movl 0xc(%r14), %eax
movzbl 0x10(%r14), %ecx
movl 0x4(%r14), %r14d
subl %eax, %r14d
addl %r14d, %r14d
subl %ecx, %r14d
je 0xeeee
movq %rbx, %rdi
xorl %esi, %esi
xorl %ebp, %ebp
callq 0xcb72
testq %rax, %rax
js 0xeef1
movl $0x1, %ecx
movq %rcx, %r15
cmpq %rcx, %r14
je 0xeee5
movq %rbx, %rdi
xorl %esi, %esi
callq 0xcb72
leaq 0x1(%r15), %rcx
testq %rax, %rax
jns 0xeeca
cmpq %r14, %r15
jae 0xeeee
xorl %ebp, %ebp
jmp 0xeef1
movb $0x1, %bpl
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_msgpack.c
// Function: compare_ext
static msgpack_compare_t
compare_ext(as_unpacker *pk1, as_unpacker *pk2)
{
	as_msgpack_ext ext1;
	as_msgpack_ext ext2;

	if (as_unpack_ext(pk1, &ext1) != 0) {
		return MSGPACK_COMPARE_ERROR;
	}

	if (as_unpack_ext(pk2, &ext2) != 0) {
		return MSGPACK_COMPARE_ERROR;
	}

	MSGPACK_COMPARE_RET_LESS_OR_GREATER(ext1.type, ext2.type);

	int64_t minsz = ext1.size < ext2.size ? ext1.size : ext2.size;
	int cmp = memcmp(ext1.data, ext2.data, minsz);

	MSGPACK_COMPARE_RET_LESS_OR_GREATER(cmp, 0);
	MSGPACK_COMPARE_RET_LESS_OR_GREATER(ext1.size, ext2.size);

	return MSGPACK_COMPARE_EQUAL;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq %rsi, %r14
leaq 0x18(%rsp), %rsi
callq 0x8a20
movl $0xfffffffe, %ebx       # imm = 0xFFFFFFFE
testl %eax, %eax
jne 0xef8a
movq %rsp, %rsi
movq %r14, %rdi
callq 0x8a20
testl %eax, %eax
jne 0xef8a
movb 0x10(%rsp), %al
xorl %ebx, %ebx
cmpb %al, 0x28(%rsp)
jb 0xef8a
movl $0x2, %ebx
ja 0xef8a
movl 0x8(%rsp), %r14d
movl 0x20(%rsp), %ebp
movq 0x18(%rsp), %rdi
movq (%rsp), %rsi
cmpl %r14d, %ebp
movl %r14d, %edx
cmovbl %ebp, %edx
callq 0x8480
testl %eax, %eax
movl $0x0, %ebx
js 0xef8a
cmpl %r14d, %ebp
setb %cl
xorl %ebx, %ebx
testl %eax, %eax
setne %al
orb %al, %cl
je 0xef82
movb %al, %bl
addl %ebx, %ebx
jmp 0xef8a
xorl %ebx, %ebx
cmpl %ebp, %r14d
adcl $0x1, %ebx
movl %ebx, %eax
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_msgpack_serializer.c
// Function: as_msgpack_serializer_serialize_presized
static int32_t as_msgpack_serializer_serialize_presized(as_serializer *s, const as_val *v, uint8_t *buf)
{
	as_packer packer = {
		.buffer = buf,
		// Prevent extra allocation.
		// buf should contain (pre-sized) space for the unpacking.
		.capacity = INT32_MAX,
		.offset = 0,
		.head = 0,
		.tail = 0,
	};

	if (as_pack_val(&packer, v) != 0) {
		return -1;
	}

	return packer.offset;
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
movq %rsp, %rbx
xorps %xmm0, %xmm0
movabsq $0x7fffffff00000000, %rax # imm = 0x7FFFFFFF00000000
movq %rbx, %rdi
movaps %xmm0, (%rbx)
movq %rdx, 0x10(%rbx)
movq %rax, 0x18(%rbx)
callq 0x8a00
xorl %ecx, %ecx
negl %eax
sbbl %ecx, %ecx
orl 0x18(%rbx), %ecx
movl %ecx, %eax
addq $0x20, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_msgpack_serializer.c
// Function: as_msgpack_serializer_deserialize
static int as_msgpack_serializer_deserialize(as_serializer *s, as_buffer *buff, as_val **v)
{
	as_unpacker unpacker = {
			.buffer = buff->data,
			.length = buff->size,
			.offset = 0,
	};

	return as_unpack_val(&unpacker, v);
}

// Assembly:
subq $0x18, %rsp
movq 0x8(%rsi), %rax
leaq 0x8(%rsp), %rdi
movq %rax, (%rdi)
movl $0x0, 0x8(%rdi)
movl 0x4(%rsi), %eax
movq %rdx, %rsi
movl %eax, 0xc(%rdi)
callq 0x8650
addq $0x18, %rsp
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_orderedmap.c
// Function: as_orderedmap_init
as_orderedmap*
as_orderedmap_init(as_orderedmap* map, uint32_t capacity)
{
	if (map == NULL) {
		return NULL;
	}

	as_map_cons((as_map*)map, false, 1, &as_orderedmap_map_hooks);

	return as_orderedmap_cons(map, capacity);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0xf219
movl %esi, %r14d
leaq 0x10959(%rip), %rcx     # 0x1fb28
xorl %esi, %esi
movl $0x1, %edx
movq %rdi, %rbx
callq 0x8820
andl $-0x8, %r14d
movl $0x0, 0x18(%rbx)
addl $0x8, %r14d
movl %r14d, 0x1c(%rbx)
shlq $0x4, %r14
movq %r14, %rdi
callq 0x8080
testq %rax, %rax
movq %rax, 0x20(%rbx)
je 0xf219
xorl %eax, %eax
movl $0x0, 0x28(%rbx)
movq %rax, 0x30(%rbx)
movq %rax, 0x38(%rbx)
jmp 0xf21b
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_orderedmap.c
// Function: as_orderedmap_new
as_orderedmap*
as_orderedmap_new(uint32_t capacity)
{
	as_orderedmap* map = (as_orderedmap*)cf_malloc(sizeof(as_orderedmap));

	if (map == NULL) {
		return NULL;
	}

	as_map_cons((as_map*)map, true, 1, &as_orderedmap_map_hooks);

	return as_orderedmap_cons(map, capacity);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %r14d
movl $0x40, %edi
callq 0x8080
testq %rax, %rax
je 0xf293
leaq 0x108e5(%rip), %rcx     # 0x1fb28
movq %rax, %rdi
movl $0x1, %esi
movl $0x1, %edx
movq %rax, %rbx
callq 0x8820
andl $-0x8, %r14d
movl $0x0, 0x18(%rbx)
addl $0x8, %r14d
movl %r14d, 0x1c(%rbx)
shlq $0x4, %r14
movq %r14, %rdi
callq 0x8080
testq %rax, %rax
movq %rax, 0x20(%rbx)
je 0xf293
xorl %eax, %eax
movl $0x0, 0x28(%rbx)
movq %rax, 0x30(%rbx)
movq %rax, 0x38(%rbx)
jmp 0xf295
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_orderedmap.c
// Function: as_orderedmap_release
bool
as_orderedmap_release(as_orderedmap* map)
{
	if (map == NULL) {
		return false;
	}

	as_orderedmap_clear(map);
	cf_free(map->table);

	if (map->hold_table != NULL) {
		cf_free(map->hold_table);
		cf_free(map->hold_locations);
	}

	return true;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
testq %rdi, %rdi
je 0xf2d1
movq %rbx, %rdi
callq 0x8190
movq 0x20(%rbx), %rdi
callq 0x8940
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0xf2d1
callq 0x8940
movq 0x38(%rbx), %rdi
callq 0x8940
testq %rbx, %rbx
setne %al
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_orderedmap.c
// Function: as_orderedmap_clear
int
as_orderedmap_clear(as_orderedmap* map)
{
	if (map == NULL) {
		return -1;
	}

	for (uint32_t ix = 0; ix < map->count; ix++) {
		as_val_destroy(map->table[ix].key);
		as_val_destroy(map->table[ix].value);
	}

	map->count = 0;

	for (uint32_t ix = 0; ix < map->hold_count; ix++) {
		as_val_destroy(map->hold_table[ix].key);
		as_val_destroy(map->hold_table[ix].value);
	}

	map->hold_count = 0;

	return 0;
}

// Assembly:
testq %rdi, %rdi
je 0xf36c
pushq %r15
pushq %r14
pushq %rbx
cmpl $0x0, 0x18(%rdi)
movq %rdi, %rbx
je 0xf320
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x20(%rbx), %rax
movq (%rax,%r14), %rdi
callq 0x84b0
movq 0x20(%rbx), %rax
movq 0x8(%rax,%r14), %rdi
callq 0x84b0
movl 0x18(%rbx), %eax
incq %r15
addq $0x10, %r14
cmpq %rax, %r15
jb 0xf2f6
movl $0x0, 0x18(%rbx)
cmpl $0x0, 0x28(%rbx)
je 0xf35d
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x30(%rbx), %rax
movq (%rax,%r14), %rdi
callq 0x84b0
movq 0x30(%rbx), %rax
movq 0x8(%rax,%r14), %rdi
callq 0x84b0
movl 0x28(%rbx), %eax
incq %r15
addq $0x10, %r14
cmpq %rax, %r15
jb 0xf333
movl $0x0, 0x28(%rbx)
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_orderedmap.c
// Function: as_orderedmap_get
as_val*
as_orderedmap_get(const as_orderedmap* map, const as_val* key)
{
	if (map == NULL || ! is_valid_key_type(key)) {
		return NULL;
	}

	uint32_t ix;

	if (key_find(map->table, map->count, key, &ix, false)) {
		return (as_val*)map->table[ix].value;
	}

	if (key_find(map->hold_table, map->hold_count, key, &ix, false)) {
		return (as_val*)map->hold_table[ix].value;
	}

	return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
je 0xf3a4
xorl %r15d, %r15d
jmp 0xf417
movzbl 0x4(%rsi), %eax
movq %rsi, %r14
movq %rdi, %rbx
leal -0x3(%rax), %ecx
cmpl $0x2, %ecx
jae 0xf3d7
movq 0x20(%rbx), %rdi
movl 0x18(%rbx), %esi
leaq 0xc(%rsp), %rcx
movq %r14, %rdx
xorl %r8d, %r8d
callq 0xf424
testb %al, %al
je 0xf3e5
addq $0x20, %rbx
jmp 0xf407
cmpl $0x9, %eax
jne 0xf39f
cmpl $0x4, 0x1c(%r14)
jne 0xf39f
jmp 0xf3b6
movq 0x30(%rbx), %rdi
movl 0x28(%rbx), %esi
leaq 0xc(%rsp), %rcx
movq %r14, %rdx
xorl %r8d, %r8d
xorl %r15d, %r15d
callq 0xf424
testb %al, %al
je 0xf417
addq $0x30, %rbx
movl 0xc(%rsp), %ecx
movq (%rbx), %rax
shlq $0x4, %rcx
movq 0x8(%rax,%rcx), %r15
movq %r15, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_orderedmap.c
// Function: key_find
static bool
key_find(const map_entry* table, uint32_t count, const as_val* key,
		uint32_t* ix_r, bool check_last_first)
{
	int64_t low = 0;
	int64_t high = (int64_t)count - 1;

	while (low <= high) {
		int64_t ix;

		// On the first iteration, probe at the end when 'check_last_first' is
		// set. Otherwise, fall back to binary search.
		if (check_last_first) {
			check_last_first = false;
			ix = high;
		}
		else {
			ix = (low + high) / 2;
		}

		msgpack_compare_t cmp = as_val_cmp(key, table[ix].key);

		if (cmp == MSGPACK_COMPARE_GREATER) {
			low = ix + 1;
		}
		else if (cmp == MSGPACK_COMPARE_LESS) {
			high = ix - 1;
		}
		else if (cmp == MSGPACK_COMPARE_EQUAL) {
			*ix_r = (uint32_t)ix;
			return true;
		}
		else {
			*ix_r = UINT32_MAX; // error
			return false;
		}
	}

	*ix_r = (uint32_t)low; // location to insert the key at

	return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
testl %esi, %esi
je 0xf497
movl %esi, %r12d
movq %rdx, %r14
movq %rdi, %r15
xorl %ebp, %ebp
decq %r12
testb $0x1, %r8b
movq %r12, %r13
jne 0xf45e
leaq (%r12,%rbp), %rax
movq %rax, %r13
shrq $0x3f, %r13
addq %rax, %r13
sarq %r13
movq %r13, %rax
movq %r14, %rdi
shlq $0x4, %rax
movq (%r15,%rax), %rsi
callq 0x8090
testl %eax, %eax
je 0xf482
cmpl $0x2, %eax
jne 0xf49c
incq %r13
movq %r13, %rbp
jmp 0xf488
decq %r13
movq %r13, %r12
xorl %r8d, %r8d
cmpq %r12, %rbp
jle 0xf444
xorl %eax, %eax
movl %ebp, %r13d
jmp 0xf4ad
xorl %r13d, %r13d
jmp 0xf4ab
cmpl $0x1, %eax
jne 0xf4a5
movb $0x1, %al
jmp 0xf4ad
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
xorl %eax, %eax
movl %r13d, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_orderedmap.c
// Function: as_orderedmap_merge
static bool
as_orderedmap_merge(as_orderedmap* map)
{
	if (map->hold_count == 0) {
		return true;
	}

	uint32_t new_capacity = map->count + map->hold_count;

	if (new_capacity < map->capacity) {
		new_capacity = map->capacity;
	}

	map_entry* new_table = cf_malloc(new_capacity * sizeof(map_entry));

	if (new_table == NULL) {
		return false;
	}

	uint32_t src_ix = 0;
	uint32_t dst_ix = 0;

	for (uint32_t ix = 0; ix < map->hold_count; ix++) {
		uint32_t n_entries = map->hold_locations[ix] - src_ix;

		memcpy(new_table + dst_ix, map->table + src_ix,
				n_entries * sizeof(map_entry));

		src_ix += n_entries;
		dst_ix += n_entries;

		new_table[dst_ix].key = map->hold_table[ix].key;
		new_table[dst_ix].value = map->hold_table[ix].value;

		dst_ix++;
	}

	memcpy(new_table + dst_ix, map->table + src_ix,
			(map->count - src_ix) * sizeof(map_entry));

	cf_free(map->table);

	map->count += map->hold_count;
	map->capacity = new_capacity;
	map->table = new_table;

	map->hold_count = 0;

	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl 0x28(%rdi), %r12d
movb $0x1, %bl
testl %r12d, %r12d
je 0xf851
addl 0x18(%rdi), %r12d
movl 0x1c(%rdi), %eax
movq %rdi, %r15
cmpl %eax, %r12d
cmovbel %eax, %r12d
movq %r12, %rdi
shlq $0x4, %rdi
callq 0x8080
xorl %r8d, %r8d
testq %rax, %rax
je 0xf802
cmpl $0x0, 0x28(%r15)
je 0xf806
movq %r12, 0x8(%rsp)
xorl %ebp, %ebp
xorl %r12d, %r12d
xorl %ebx, %ebx
xorl %r8d, %r8d
movq %rax, 0x10(%rsp)
movq 0x38(%r15), %rcx
movl %r8d, %esi
movl %ebx, %edi
shlq $0x4, %rsi
shlq $0x4, %rdi
addq 0x20(%r15), %rsi
addq %rax, %rdi
movl (%rcx,%rbp), %r14d
movl %r14d, %r13d
subl %r8d, %r13d
movq %r13, %rdx
shlq $0x4, %rdx
callq 0x85c0
movq 0x30(%r15), %rcx
movq 0x10(%rsp), %rax
leal (%r13,%rbx), %edx
incq %r12
movq %r14, %r8
leal 0x1(%r13,%rbx), %ebx
shlq $0x4, %rdx
movq (%rcx,%rbp,4), %rcx
movq %rcx, (%rax,%rdx)
movq 0x30(%r15), %rcx
movq 0x8(%rcx,%rbp,4), %rcx
addq $0x4, %rbp
movq %rcx, 0x8(%rax,%rdx)
movl 0x28(%r15), %ecx
cmpq %rcx, %r12
jb 0xf789
movq 0x8(%rsp), %r12
movl %ebx, %ecx
movb $0x1, %bl
jmp 0xf808
xorl %ebx, %ebx
jmp 0xf851
xorl %ecx, %ecx
movl 0x18(%r15), %edx
movl %r8d, %esi
shlq $0x4, %rcx
movq %rax, %rdi
movq %rax, %r14
shlq $0x4, %rsi
addq %rcx, %rdi
addq 0x20(%r15), %rsi
subl %r8d, %edx
shlq $0x4, %rdx
callq 0x85c0
movq 0x20(%r15), %rdi
callq 0x8940
movl 0x28(%r15), %eax
addl %eax, 0x18(%r15)
movl %r12d, 0x1c(%r15)
movq %r14, 0x20(%r15)
movl $0x0, 0x28(%r15)
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_orderedmap.c
// Function: as_orderedmap_remove
int
as_orderedmap_remove(as_orderedmap* map, const as_val* key)
{
	if (map == NULL || ! is_valid_key_type(key)) {
		return -1;
	}

	if (! as_orderedmap_merge(map)) {
		return -1;
	}

	uint32_t ix;

	if (key_find(map->table, map->count, key, &ix, false)) {
		as_val_destroy(map->table[ix].key);
		as_val_destroy(map->table[ix].value);
		memmove(&map->table[ix], &map->table[ix + 1],
				sizeof(map_entry) * (map->count - (ix + 1)));
		map->count--;
	}

	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0xf929
movzbl 0x4(%rsi), %eax
movq %rsi, %r15
movq %rdi, %r14
leal -0x3(%rax), %ecx
cmpl $0x2, %ecx
jae 0xf919
movq %r14, %rdi
callq 0xf724
testb %al, %al
je 0xf929
movq 0x20(%r14), %rdi
movl 0x18(%r14), %esi
leaq 0x4(%rsp), %rcx
movq %r15, %rdx
xorl %r8d, %r8d
xorl %ebx, %ebx
callq 0xf424
testb %al, %al
je 0xf929
movl 0x4(%rsp), %r12d
movq 0x20(%r14), %rax
movq %r12, %r15
shlq $0x4, %r15
movq (%rax,%r15), %rdi
callq 0x84b0
movq 0x20(%r14), %rax
movq 0x8(%rax,%r15), %rdi
callq 0x84b0
movq 0x20(%r14), %rax
movl 0x18(%r14), %edx
leal 0x1(%r12), %esi
subl %esi, %edx
shlq $0x4, %rsi
addq %rax, %r15
addq %rax, %rsi
shlq $0x4, %rdx
movq %r15, %rdi
callq 0x8850
decl 0x18(%r14)
jmp 0xf929
cmpl $0x9, %eax
jne 0xf929
cmpl $0x4, 0x1c(%r15)
je 0xf899
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_orderedmap.c
// Function: as_orderedmap_foreach
bool
as_orderedmap_foreach(const as_orderedmap* map,
		as_map_foreach_callback callback, void* udata)
{
	if (map == NULL) {
		return false;
	}

	if (! as_orderedmap_merge((as_orderedmap*)map)) {
		return false;
	}

	for (uint32_t ix = 0; ix < map->count; ix++) {
		if (! callback(map->table[ix].key, map->table[ix].value, udata)) {
			return false;
		}
	}

	return true;
}

// Assembly:
testq %rdi, %rdi
je 0xf990
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
callq 0xf724
testb %al, %al
je 0xf993
cmpl $0x0, 0x18(%r15)
je 0xf997
movl $0x8, %r12d
xorl %r13d, %r13d
movq 0x20(%r15), %rax
movq %rbx, %rdx
movq -0x8(%rax,%r12), %rdi
movq (%rax,%r12), %rsi
callq *%r14
testb %al, %al
je 0xf999
movl 0x18(%r15), %ecx
incq %r13
addq $0x10, %r12
cmpq %rcx, %r13
jb 0xf967
jmp 0xf999
xorl %eax, %eax
retq
xorl %eax, %eax
jmp 0xf999
movb $0x1, %al
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_orderedmap.c
// Function: as_orderedmap_iterator_init
as_orderedmap_iterator*
as_orderedmap_iterator_init(as_orderedmap_iterator* it,
		const as_orderedmap* map)
{
	if (map != NULL && ! as_orderedmap_merge((as_orderedmap*)map)) {
		return NULL;
	}

	if (it == NULL) {
		return NULL;
	}

	as_iterator_init((as_iterator*)it, false, NULL,
			&as_orderedmap_iterator_hooks);
	it->ix = 0;
	it->map = map;

	return it;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
testq %rsi, %rsi
je 0xf9c8
movq %r14, %rdi
callq 0xf724
testq %rbx, %rbx
setne %cl
testb %al, %cl
jne 0xf9cd
xorl %ebx, %ebx
jmp 0xf9eb
testq %rbx, %rbx
je 0xf9c4
leaq 0x101ac(%rip), %rcx     # 0x1fb80
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x8950
movl $0x0, 0x20(%rbx)
movq %r14, 0x18(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_orderedmap.c
// Function: as_orderedmap_iterator_new
as_orderedmap_iterator*
as_orderedmap_iterator_new(const as_orderedmap* map)
{
	if (map != NULL && ! as_orderedmap_merge((as_orderedmap*)map)) {
		return NULL;
	}

	as_orderedmap_iterator* it =
			(as_orderedmap_iterator*)cf_malloc(sizeof(as_orderedmap_iterator));

	if (it == NULL) {
		return NULL;
	}

	as_iterator_init((as_iterator*)it, true, NULL,
			&as_orderedmap_iterator_hooks);
	it->ix = 0;
	it->map = map;

	return it;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rdi, %rdi
je 0xfa0e
movq %rbx, %rdi
callq 0xf724
testb %al, %al
je 0xfa44
movl $0x40, %edi
callq 0x8080
testq %rax, %rax
je 0xfa44
leaq 0x1015c(%rip), %rcx     # 0x1fb80
movq %rax, %rdi
movl $0x1, %esi
xorl %edx, %edx
movq %rax, %r14
callq 0x8950
movl $0x0, 0x20(%r14)
movq %rbx, 0x18(%r14)
jmp 0xfa47
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_orderedmap.c
// Function: as_orderedmap_iterator_next
const as_val*
as_orderedmap_iterator_next(as_orderedmap_iterator* it)
{
	if (it->ix >= it->map->count) {
		return NULL;
	}

	as_pair_init(&it->pair, it->map->table[it->ix].key,
			it->map->table[it->ix].value);
	it->ix++;

	return (as_val*)&it->pair;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl 0x20(%rdi), %eax
movq 0x18(%rdi), %rcx
cmpl 0x18(%rcx), %eax
jae 0xfaac
movq 0x20(%rcx), %rcx
shlq $0x4, %rax
leaq 0x28(%rdi), %r14
movq %rdi, %rbx
movq %r14, %rdi
movq (%rcx,%rax), %rsi
movq 0x8(%rcx,%rax), %rdx
callq 0x83a0
incl 0x20(%rbx)
jmp 0xfaaf
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_pair.c
// Function: as_pair_init
as_pair * as_pair_init(as_pair * pair, as_val * _1, as_val * _2)
{
	if ( !pair ) return pair;

	as_val_init((as_val *) pair, AS_PAIR, false);
	pair->_1 = _1;
	pair->_2 = _2;
	return pair;
}

// Assembly:
movq %rdi, %rax
testq %rdi, %rdi
je 0xfb54
movw $0x8, 0x4(%rax)
movl $0x1, (%rax)
movq %rsi, 0x8(%rax)
movq %rdx, 0x10(%rax)
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_pair.c
// Function: as_pair_new
as_pair * as_pair_new(as_val * _1, as_val * _2)
{
	as_pair * pair = (as_pair *) cf_malloc(sizeof(as_pair));
	if ( !pair ) return pair;

	as_val_init((as_val *) pair, AS_PAIR, true);
	pair->_1 = _1;
	pair->_2 = _2;
	return pair;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movl $0x18, %edi
movq %rsi, %rbx
callq 0x8080
testq %rax, %rax
je 0xfb82
movw $0x108, 0x4(%rax)       # imm = 0x108
movl $0x1, (%rax)
movq %r14, 0x8(%rax)
movq %rbx, 0x10(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_pair.c
// Function: as_pair_val_tostring
char *as_pair_val_tostring(const as_val * v)
{
	as_pair * p = as_pair_fromval(v);
	if ( p == NULL ) return NULL;

	char * a = as_val_tostring(p->_1);
	size_t al = strlen(a);
	char * b = as_val_tostring(p->_2);
	size_t bl = strlen(b);
	
	size_t l = al + bl + 5;
	char * str = (char *) cf_malloc(sizeof(char) * l);
	if (!str) return str;

	strcpy(str, "(");
	strcpy(str+1, a);
	strcpy(str+1+al,", ");
	strcpy(str+1+al+2, b);
	strcpy(str+1+al+2+bl,")");
	*(str+1+al+2+bl+1) = '\0';
	
	cf_free(a);
	cf_free(b);

	return str;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0xfc5c
cmpb $0x8, 0x4(%rdi)
movq %rdi, %r14
jne 0xfc5c
movq 0x8(%r14), %rdi
callq 0x8290
movq %rax, %rdi
movq %rax, %rbx
callq 0x8260
movq 0x10(%r14), %rdi
movq %rax, %r12
callq 0x8290
movq %rax, %rdi
movq %rax, %r15
callq 0x8260
leaq 0x5(%r12,%rax), %rdi
movq %rax, %r13
callq 0x8080
testq %rax, %rax
je 0xfc5c
leaq 0x1(%rax), %rdi
movq %rbx, %rsi
movq %rax, %r14
movw $0x28, (%rax)
callq 0x8180
leaq 0x3(%r14,%r12), %rdi
movq %r15, %rsi
leaq 0x1(%r14,%r12), %rbp
movw $0x202c, 0x1(%r14,%r12) # imm = 0x202C
movb $0x0, 0x3(%r14,%r12)
callq 0x8180
movq %rbx, %rdi
movw $0x29, 0x2(%r13,%rbp)
callq 0x8940
movq %r15, %rdi
callq 0x8940
jmp 0xfc5f
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_password.c
// Function: as_password_prompt_hash
bool
as_password_prompt_hash(const char* password, char* hash)
{
	char pass[AS_PASSWORD_HASH_SIZE];
	
	if (password && *password) {
		as_strncpy(pass, password, sizeof(pass));
	}
	else {
		as_password_prompt(pass, sizeof(pass));
	}
	
	return as_password_get_constant_hash(pass, hash);
}

// Assembly:
pushq %rbx
subq $0x40, %rsp
movq %rsi, %rbx
testq %rdi, %rdi
je 0xfd45
cmpb $0x0, (%rdi)
movq %rdi, %rsi
je 0xfd45
movq %rsp, %rdi
movl $0x40, %edx
callq 0x81a0
jmp 0xfd52
movq %rsp, %rdi
movl $0x40, %esi
callq 0xfd75
leaq 0x8627(%rip), %rsi      # 0x18380
movq %rsp, %rdi
movq %rbx, %rdx
movl $0x40, %ecx
callq 0x89d0
testq %rax, %rax
setne %al
addq $0x40, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_password.c
// Function: as_password_prompt
static void
as_password_prompt(char* password, int size)
{
	// Turn off echo.
	as_set_echo(false);

	// Prompt for password.
	printf("Enter Password: ");
	fflush(stdout);

	// Read password until newline.
	char* s = fgets(password, size, stdin);

	if (s) {
		int len = (int)strlen(password);

		if (password[len - 1] == '\n') {
			password[--len] = 0;
		}
	}
	else {
		password[0] = 0;
	}

	// Restore echo.
	as_set_echo(true);
	printf("\n");
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x40, %rsp
leaq 0x4(%rsp), %r14
movl %esi, %ebp
movq %rdi, %rbx
xorl %edi, %edi
movq %r14, %rsi
callq 0x88e0
andb $-0x9, 0xc(%r14)
xorl %edi, %edi
xorl %esi, %esi
movq %r14, %rdx
callq 0x88f0
leaq 0x85f5(%rip), %rdi      # 0x1839e
xorl %eax, %eax
callq 0x82b0
movq 0x101c9(%rip), %rax     # 0x1ff80
movq (%rax), %rdi
callq 0x8690
movq 0x101ca(%rip), %rax     # 0x1ff90
movq %rbx, %rdi
movl %ebp, %esi
movq (%rax), %rdx
callq 0x8490
testq %rax, %rax
je 0xfded
movq %rbx, %rdi
callq 0x8260
decl %eax
cltq
cmpb $0xa, (%rbx,%rax)
jne 0xfdf0
addq %rax, %rbx
movb $0x0, (%rbx)
leaq 0x4(%rsp), %rbx
xorl %edi, %edi
movq %rbx, %rsi
callq 0x88e0
orb $0x8, 0xc(%rbx)
xorl %edi, %edi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x88f0
movl $0xa, %edi
callq 0x8100
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_queue.c
// Function: as_queue_init
bool
as_queue_init(as_queue* queue, uint32_t item_size, uint32_t capacity)
{
	queue->data = cf_malloc(capacity * item_size);
	
	if (! queue->data) {
		return false;
	}
	queue->capacity = capacity;
	queue->head = queue->tail = 0;
	queue->item_size = item_size;
	queue->total = 0;
	queue->flags = ITEMS_ON_HEAP;
	return true;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl %edx, %edi
movl %edx, %r14d
movl %esi, %ebp
imull %esi, %edi
callq 0x8080
testq %rax, %rax
movq %rax, (%rbx)
je 0xfe73
movabsq $0x100000000, %rcx      # imm = 0x100000000
movl %r14d, 0x8(%rbx)
movq $0x0, 0xc(%rbx)
movl %ebp, 0x14(%rbx)
movq %rcx, 0x18(%rbx)
testq %rax, %rax
setne %al
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_queue.c
// Function: as_queue_create
as_queue*
as_queue_create(uint32_t item_size, uint32_t capacity)
{
	as_queue* queue = (as_queue*)cf_malloc(sizeof(as_queue));
	
	if (! queue) {
		return 0;
	}

	if (! as_queue_init(queue, item_size, capacity)) {
		cf_free(queue);
		return 0;
	}
	queue->flags = ITEMS_ON_HEAP | ALL_ON_HEAP;
	return queue;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edi, %ebp
movl $0x20, %edi
movl %esi, %r14d
callq 0x8080
testq %rax, %rax
je 0xfed3
movl %r14d, %edi
movq %rax, %rbx
imull %ebp, %edi
callq 0x8080
testq %rax, %rax
movq %rax, (%rbx)
je 0xfecb
movabsq $0x300000000, %rax      # imm = 0x300000000
movl %r14d, 0x8(%rbx)
movq $0x0, 0xc(%rbx)
movl %ebp, 0x14(%rbx)
movq %rax, 0x18(%rbx)
jmp 0xfed5
movq %rbx, %rdi
callq 0x8940
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_queue.c
// Function: as_queue_destroy
void
as_queue_destroy(as_queue* queue)
{
	if (queue->flags & ITEMS_ON_HEAP) {
		cf_free(queue->data);
		
		if (queue->flags & ALL_ON_HEAP) {
			cf_free(queue);
		}
	}
}

// Assembly:
pushq %rbx
testb $0x1, 0x1c(%rdi)
je 0xfef5
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x8940
testb $0x2, 0x1c(%rbx)
jne 0xfef7
popq %rbx
retq
movq %rbx, %rdi
popq %rbx
jmp 0x8940
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_queue.c
// Function: as_queue_push
bool
as_queue_push(as_queue* queue, const void* ptr)
{
	// Check queue length.
	if (as_queue_size(queue) == queue->capacity) {
		if (! as_queue_increase_capacity(queue)) {
			return false;
		}
	}

	memcpy(as_queue_get(queue, queue->tail), ptr, queue->item_size);
	queue->tail++;
	as_queue_unwrap(queue);
	return true;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl 0x10(%rdi), %eax
movl 0x8(%rdi), %ecx
movq %rsi, %r14
movq %rdi, %rbx
movl %eax, %edx
subl 0xc(%rdi), %edx
cmpl %ecx, %edx
jne 0xff2b
movq %rbx, %rdi
callq 0xff74
testb %al, %al
je 0xff68
movl 0x8(%rbx), %ecx
movl 0x10(%rbx), %eax
xorl %edx, %edx
movq %r14, %rsi
divl %ecx
movl %edx, %edi
movl 0x14(%rbx), %edx
imull %edx, %edi
addq (%rbx), %rdi
callq 0x85c0
movl 0x10(%rbx), %esi
movb $0x1, %cl
incl %esi
cmpl $0x40000000, %esi       # imm = 0x40000000
movl %esi, 0x10(%rbx)
jb 0xff6a
movl 0xc(%rbx), %eax
xorl %edx, %edx
subl %eax, %esi
divl 0x8(%rbx)
addl %edx, %esi
movl %edx, 0xc(%rbx)
movl %esi, 0x10(%rbx)
jmp 0xff6a
xorl %ecx, %ecx
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_queue.c
// Function: as_queue_increase_capacity
static bool
as_queue_increase_capacity(as_queue* queue)
{
	uint32_t new_capacity = queue->capacity * 2;
	
	if (queue->flags & ITEMS_ON_HEAP) {
		// Data already allocated on heap.
		// Check for The rare case where the queue is not fragmented, and realloc makes sense
		// and none of the offsets need to move.
		if (queue->head % queue->capacity == 0) {
			queue->data = cf_realloc(queue->data, new_capacity * queue->item_size);
			
			if (! queue->data) {
				return false;
			}
			queue->head = 0;
			queue->tail = queue->capacity;
			queue->capacity = new_capacity;
			return true;
		}
		
		// Copy to new queue.
		return as_queue_copy(queue, new_capacity, true);
	}
	
	// Switch over from stack to heap allocated.
	if (! as_queue_copy(queue, new_capacity, false)) {
		return false;
	}
	queue->flags |= ITEMS_ON_HEAP;
	return true;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl 0x8(%rdi), %ecx
testb $0x1, 0x1c(%rdi)
movq %rdi, %rbx
leal (%rcx,%rcx), %ebp
jne 0xffa0
movq %rbx, %rdi
movl %ebp, %esi
xorl %edx, %edx
xorl %r14d, %r14d
callq 0x10132
testb %al, %al
je 0xffe7
orb $0x1, 0x1c(%rbx)
jmp 0xffe4
movl 0xc(%rbx), %eax
xorl %edx, %edx
divl %ecx
testl %edx, %edx
je 0xffbe
movq %rbx, %rdi
movl %ebp, %esi
movl $0x1, %edx
popq %rbx
popq %r14
popq %rbp
jmp 0x10132
movl 0x14(%rbx), %esi
movq (%rbx), %rdi
imull %ebp, %esi
callq 0x8510
testq %rax, %rax
movq %rax, (%rbx)
je 0xffef
movl $0x0, 0xc(%rbx)
movl 0x8(%rbx), %eax
movl %eax, 0x10(%rbx)
movl %ebp, 0x8(%rbx)
movb $0x1, %r14b
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
xorl %r14d, %r14d
jmp 0xffe7
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_queue.c
// Function: as_queue_push_limit
bool
as_queue_push_limit(as_queue* queue, const void* ptr)
{
	if (as_queue_size(queue) >= queue->capacity) {
		return false;
	}

	memcpy(as_queue_get(queue, queue->tail), ptr, queue->item_size);
	queue->tail++;
	as_queue_unwrap(queue);
	return true;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl 0x10(%rdi), %eax
movl 0x8(%rdi), %ebp
movl %eax, %r14d
subl 0xc(%rdi), %r14d
cmpl %ebp, %r14d
jae 0x10043
xorl %edx, %edx
movq %rdi, %rbx
divl %ebp
movl %edx, %edi
movl 0x14(%rbx), %edx
imull %edx, %edi
addq (%rbx), %rdi
callq 0x85c0
movl 0x10(%rbx), %ecx
incl %ecx
cmpl $0x40000000, %ecx       # imm = 0x40000000
movl %ecx, 0x10(%rbx)
jb 0x10043
movl 0xc(%rbx), %eax
xorl %edx, %edx
subl %eax, %ecx
divl 0x8(%rbx)
addl %edx, %ecx
movl %edx, 0xc(%rbx)
movl %ecx, 0x10(%rbx)
cmpl %ebp, %r14d
setb %al
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_queue.c
// Function: as_queue_push_head
bool
as_queue_push_head(as_queue *queue, const void* ptr)
{
	if (as_queue_size(queue) == queue->capacity) {
		if (! as_queue_increase_capacity(queue)) {
			return false;
		}
	}

	if (queue->head == 0) {
		queue->head += queue->capacity;
		queue->tail += queue->capacity;
	}

	queue->head--;
	memcpy(as_queue_get(queue, queue->head), ptr, queue->item_size);
	as_queue_unwrap(queue);
	return true;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl 0xc(%rdi), %eax
movl 0x10(%rdi), %edx
movl 0x8(%rdi), %ecx
movq %rsi, %r14
movq %rdi, %rbx
subl %eax, %edx
cmpl %ecx, %edx
jne 0x10079
movq %rbx, %rdi
callq 0xff74
testb %al, %al
je 0x100bf
movl 0x8(%rbx), %ecx
movl 0xc(%rbx), %eax
testl %eax, %eax
jne 0x10082
addl %ecx, 0x10(%rbx)
movl %ecx, %eax
decl %eax
xorl %edx, %edx
movq %r14, %rsi
movl %eax, 0xc(%rbx)
divl %ecx
movl %edx, %edi
movl 0x14(%rbx), %edx
imull %edx, %edi
addq (%rbx), %rdi
callq 0x85c0
movl 0x10(%rbx), %esi
movb $0x1, %cl
cmpl $0x40000000, %esi       # imm = 0x40000000
jb 0x100c1
movl 0xc(%rbx), %eax
xorl %edx, %edx
subl %eax, %esi
divl 0x8(%rbx)
addl %edx, %esi
movl %edx, 0xc(%rbx)
movl %esi, 0x10(%rbx)
jmp 0x100c1
xorl %ecx, %ecx
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_queue.c
// Function: as_queue_push_head_limit
bool
as_queue_push_head_limit(as_queue *queue, const void* ptr)
{
	if (as_queue_size(queue) >= queue->capacity) {
		return false;
	}

	if (queue->head == 0) {
		queue->head += queue->capacity;
		queue->tail += queue->capacity;
	}

	queue->head--;
	memcpy(as_queue_get(queue, queue->head), ptr, queue->item_size);
	as_queue_unwrap(queue);
	return true;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl 0x10(%rdi), %ecx
movl 0xc(%rdi), %eax
movl 0x8(%rdi), %ebp
movl %ecx, %r14d
subl %eax, %r14d
cmpl %ebp, %r14d
jae 0x10127
movq %rdi, %rbx
testl %eax, %eax
jne 0x100f1
addl %ebp, %ecx
movl %ebp, %eax
movl %ecx, 0x10(%rbx)
decl %eax
xorl %edx, %edx
movl %eax, 0xc(%rbx)
divl %ebp
movl %edx, %edi
movl 0x14(%rbx), %edx
imull %edx, %edi
addq (%rbx), %rdi
callq 0x85c0
movl 0x10(%rbx), %ecx
cmpl $0x40000000, %ecx       # imm = 0x40000000
jb 0x10127
movl 0xc(%rbx), %eax
xorl %edx, %edx
subl %eax, %ecx
divl 0x8(%rbx)
addl %edx, %ecx
movl %edx, 0xc(%rbx)
movl %ecx, 0x10(%rbx)
cmpl %ebp, %r14d
setb %al
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/aerospike[P]aerospike-common/src/main/aerospike/as_queue.c
// Function: as_queue_copy
static bool
as_queue_copy(as_queue* queue, uint32_t new_capacity, bool free_old)
{
	uint8_t* tmp = cf_malloc(new_capacity * queue->item_size);
	
	if (! tmp) {
		return false;
	}
	
	// end_sz is used bytes in old queue from insert point to end.
	size_t end_sz = (queue->capacity - (queue->head % queue->capacity)) * queue->item_size;
	
	memcpy(tmp, as_queue_get(queue, queue->head), end_sz);
	memcpy(&tmp[end_sz], queue->data, (queue->capacity * queue->item_size) - end_sz);
	
	if (free_old) {
		cf_free(queue->data);
	}
	queue->data = tmp;
	queue->head = 0;
	queue->tail = queue->capacity;
	queue->capacity = new_capacity;
	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %r14
movl 0x14(%rdi), %edi
movl %edx, %ebp
movl %esi, %ebx
imull %esi, %edi
callq 0x8080
movq %rax, %r15
testq %rax, %rax
je 0x101b9
movl 0x8(%r14), %r12d
movl 0xc(%r14), %eax
xorl %edx, %edx
movq %r15, %rdi
divl %r12d
movl 0x14(%r14), %esi
subl %edx, %r12d
imull %esi, %r12d
imull %edx, %esi
addq (%r14), %rsi
movq %r12, %rdx
callq 0x85c0
movl 0x14(%r14), %edx
movq (%r14), %rsi
leaq (%r15,%r12), %rdi
imull 0x8(%r14), %edx
subq %r12, %rdx
callq 0x85c0
testb %bpl, %bpl
je 0x101a2
movq (%r14), %rdi
callq 0x8940
movq %r15, (%r14)
movl $0x0, 0xc(%r14)
movl 0x8(%r14), %eax
movl %eax, 0x10(%r14)
movl %ebx, 0x8(%r14)
testq %r15, %r15
setne %al
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq