// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x28(%rax)
jne 0x141af
movb $0x1, -0x1(%rbp)
jmp 0x14350
movq -0x10(%rbp), %rax
movl 0x18(%rax), %eax
movq -0x10(%rbp), %rcx
addl 0x28(%rcx), %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x1c(%rcx), %eax
jae 0x141d6
movq -0x10(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, %edi
shlq $0x4, %rdi
callq 0x8090
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x141f8
movb $0x0, -0x1(%rbp)
jmp 0x14350
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x28(%rcx), %eax
jae 0x142d6
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movl -0x2c(%rbp), %ecx
movl (%rax,%rcx,4), %eax
subl -0x24(%rbp), %eax
movl %eax, -0x30(%rbp)
movq -0x20(%rbp), %rdi
movl -0x28(%rbp), %eax
shlq $0x4, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rsi
movl -0x24(%rbp), %eax
shlq $0x4, %rax
addq %rax, %rsi
movl -0x30(%rbp), %eax
movl %eax, %edx
shlq $0x4, %rdx
callq 0x86b0
movl -0x30(%rbp), %eax
addl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x30(%rbp), %eax
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x2c(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq -0x20(%rbp), %rax
movl -0x28(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x2c(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rcx
movq -0x20(%rbp), %rax
movl -0x28(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x1420d
movq -0x20(%rbp), %rdi
movl -0x28(%rbp), %eax
shlq $0x4, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rsi
movl -0x24(%rbp), %eax
shlq $0x4, %rax
addq %rax, %rsi
movq -0x10(%rbp), %rax
movl 0x18(%rax), %eax
subl -0x24(%rbp), %eax
movl %eax, %eax
movl %eax, %edx
shlq $0x4, %rdx
callq 0x86b0
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x8aa0
movq -0x10(%rbp), %rax
movl 0x28(%rax), %ecx
movq -0x10(%rbp), %rax
addl 0x18(%rax), %ecx
movl %ecx, 0x18(%rax)
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x28(%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)