// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/kvlds/btree_node_merge.c
// Function: btree_node_merge
int
btree_node_merge(struct btree * T,
    struct node ** c_in, const struct kvldskey ** k_in,
    struct node ** c_out, const struct kvldskey ** k_out, size_t nsep)
{
	size_t i;
	int rc;

	/* Sanity-check: All the nodes should be dirty. */
	for (i = 0; i <= nsep; i++)
		assert(c_in[i]->state == NODE_STATE_DIRTY);

	/* Handle leaves and parents separately. */
	if (c_in[0]->type == NODE_TYPE_LEAF)
		rc = merge_leaf(T, c_in, c_out, nsep);
	else
		rc = merge_parent(T, c_in, k_in, c_out, nsep);

	/* If we succeeded, update the tree size. */
	if (!rc) {
		/* The tree has shrunk. */
		T->nnodes -= nsep;
	}

	/* If we failed, copy the nodes and keys. */
	if (rc) {
		memcpy(c_out, c_in, (nsep + 1) * sizeof(struct node *));
		memcpy(k_out, k_in, nsep * sizeof(const struct kvldskey *));
	}

	/* Return code from merge_(leaf|parent). */
	return (rc);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r9, %rbx
movq %r8, %rbp
movq %rcx, %r12
movq %rsi, %r15
xorl %eax, %eax
movq (%r15,%rax,8), %rcx
movb 0x1c(%rcx), %cl
andb $0xc, %cl
cmpb $0x8, %cl
jne 0xa230
incq %rax
cmpq %rbx, %rax
jbe 0x9d5c
movq (%r15), %rax
movb 0x1c(%rax), %al
andb $0x3, %al
cmpb $0x1, %al
movq %rdx, 0x30(%rsp)
jne 0x9e05
xorl %eax, %eax
movq (%r15,%rax,8), %rcx
movb 0x1c(%rcx), %cl
movl %ecx, %esi
andb $0x3, %sil
cmpb $0x1, %sil
jne 0xa28d
andb $0xc, %cl
cmpb $0x8, %cl
jne 0xa24f
incq %rax
cmpq %rbx, %rax
jbe 0x9d8a
movq $-0x1, %rax
xorl %r14d, %r14d
movq 0x8(%r15,%rax,8), %rcx
addq 0x38(%rcx), %r14
incq %rax
cmpq %rax, %rbx
jne 0x9dbf
testq %r14, %r14
je 0x9e7a
movq %r14, %rax
shrq $0x3c, %rax
jne 0x9e6a
movq %rdi, 0x20(%rsp)
movq %r14, %rdi
shlq $0x4, %rdi
callq 0x22a0
testq %rax, %rax
jne 0x9e81
jmp 0xa1f5
xorl %eax, %eax
movq (%r15,%rax,8), %rcx
movb 0x1c(%rcx), %cl
testb $0x3, %cl
jne 0xa2ac
andb $0xc, %cl
cmpb $0x8, %cl
jne 0xa26e
incq %rax
cmpq %rbx, %rax
jbe 0x9e07
movq %rdi, 0x20(%rsp)
movq $-0x1, %rax
xorl %r13d, %r13d
movq %r13, %rcx
movq 0x8(%r15,%rax,8), %rsi
movq 0x38(%rsi), %r14
addq %r14, %r13
incq %r13
incq %rax
cmpq %rax, %rbx
jne 0x9e3a
addq %rcx, %r14
je 0x9f5b
movq %r14, %rax
shrq $0x3d, %rax
je 0x9f66
callq 0x20a0
movl $0xc, (%rax)
jmp 0xa1f5
movq %rdi, 0x20(%rsp)
xorl %eax, %eax
movq %rbp, 0x28(%rsp)
movq %r12, 0x18(%rsp)
xorl %ebp, %ebp
xorl %r12d, %r12d
movq %r15, 0x40(%rsp)
movq (%r15,%r12,8), %rcx
movq 0x38(%rcx), %r13
testq %r13, %r13
je 0x9ecd
movq %rbp, %rdi
shlq $0x4, %rdi
addq %rax, %rdi
movq 0x40(%rcx), %rsi
movq %r13, %rdx
shlq $0x4, %rdx
movq %rbx, %r15
movq %rax, %rbx
callq 0x2280
movq %rbx, %rax
movq %r15, %rbx
movq 0x40(%rsp), %r15
addq %r13, %rbp
incq %r12
cmpq %rbx, %r12
jbe 0x9e95
movq %rax, (%rsp)
movq 0x20(%rsp), %r13
movq %r13, %rdi
movl $0x1, %esi
xorl %edx, %edx
movq %rax, %r12
movq %r14, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x8a48
testq %rax, %rax
je 0xa016
movq (%r15), %rcx
movq 0x28(%rcx), %rsi
movq %rax, 0x10(%rsp)
movq %rsi, 0x28(%rax)
testq %rsi, %rsi
je 0x9f3a
movq 0x30(%r13), %rdi
movq 0x20(%rdi), %rax
movq (%rsi,%rax), %rax
movq (%rax), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%rax)
testq %rcx, %rcx
jne 0x9f3a
callq 0x1070f
xorl %r14d, %r14d
movq 0x18(%rsp), %r12
movq (%r15,%r14,8), %rsi
movq %r13, %rdi
callq 0x8d62
incq %r14
cmpq %rbx, %r14
jbe 0x9f42
jmp 0xa1c8
movq $0x0, 0x10(%rsp)
jmp 0x9fa0
leaq (,%r14,8), %rdi
callq 0x22a0
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0xa1f5
movabsq $0x1fffffffffffffff, %rax # imm = 0x1FFFFFFFFFFFFFFF
cmpq %rax, %r13
jbe 0x9fa0
callq 0x20a0
movl $0xc, (%rax)
jmp 0xa1eb
shlq $0x3, %r13
movq %r13, %rdi
callq 0x22a0
movq %rax, 0x38(%rsp)
testq %rax, %rax
je 0xa1eb
testq %rbx, %rbx
movq %r12, 0x18(%rsp)
movq %rbp, 0x28(%rsp)
je 0xa02d
xorl %ebp, %ebp
xorl %r12d, %r12d
movq 0x10(%rsp), %rax
leaq (%rax,%r12,8), %rdi
movq (%r15,%rbp,8), %r13
movq 0x38(%r13), %rdx
movq 0x40(%r13), %rsi
shlq $0x3, %rdx
callq 0x2280
movq 0x38(%r13), %rax
leaq (%rax,%r12), %rcx
movq 0x30(%rsp), %rdx
movq (%rdx,%rbp,8), %rdx
addq %rax, %r12
incq %r12
movq 0x10(%rsp), %rax
movq %rdx, (%rax,%rcx,8)
incq %rbp
cmpq %rbp, %rbx
jne 0x9fce
jmp 0xa030
movq %r12, %rdi
callq 0x2040
movq 0x18(%rsp), %r12
movq 0x28(%rsp), %rbp
jmp 0xa1f5
xorl %r12d, %r12d
movq 0x10(%rsp), %rax
leaq (%rax,%r12,8), %rdi
movq (%r15,%rbx,8), %rax
movq 0x38(%rax), %rdx
movq 0x40(%rax), %rsi
shlq $0x3, %rdx
callq 0x2280
xorl %r12d, %r12d
xorl %ebp, %ebp
movq 0x38(%rsp), %rax
leaq (%rax,%rbp,8), %rdi
movq (%r15,%r12,8), %rax
movq 0x38(%rax), %r13
movq 0x48(%rax), %rsi
leaq 0x8(,%r13,8), %rdx
callq 0x2280
addq %r13, %rbp
incq %rbp
incq %r12
cmpq %rbx, %r12
jbe 0xa053
movq (%r15), %rax
movsbl 0x1d(%rax), %edx
movq $0x0, (%rsp)
movq 0x20(%rsp), %r13
movq %r13, %rdi
xorl %esi, %esi
movq %r14, %rcx
movq 0x10(%rsp), %r8
movq 0x38(%rsp), %r12
movq %r12, %r9
callq 0x8a48
testq %rax, %rax
je 0xa1d9
movq (%r15), %rcx
movq 0x28(%rcx), %rsi
movq %rsi, 0x28(%rax)
testq %rsi, %rsi
movq %rax, 0x10(%rsp)
je 0xa0f4
movq 0x30(%r13), %rdi
movq 0x20(%rdi), %rcx
movq (%rsi,%rcx), %r8
movq (%r8), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%r8)
testq %rcx, %rcx
jne 0xa0f4
callq 0x1070f
movq 0x10(%rsp), %rax
xorl %ebp, %ebp
movq (%r12,%rbp,8), %r8
movb 0x1c(%r8), %cl
andb $0x3, %cl
cmpb $0x2, %cl
je 0xa13d
movq 0x28(%r8), %rsi
testq %rsi, %rsi
je 0xa13d
movq 0x30(%r13), %rdi
movq 0x20(%rdi), %rcx
movq (%rsi,%rcx), %rcx
movq (%rcx), %rdx
testq %rdx, %rdx
je 0xa2cb
decq %rdx
movq %rdx, (%rcx)
jne 0xa13d
callq 0x107ea
movq 0x10(%rsp), %rax
movq (%r12,%rbp,8), %r8
movq %rax, 0x28(%r8)
movq (%r12,%rbp,8), %rdx
movb 0x1c(%rdx), %cl
andb $0x3, %cl
cmpb $0x2, %cl
je 0xa17e
movq 0x28(%rdx), %rsi
testq %rsi, %rsi
je 0xa17e
movq 0x30(%r13), %rdi
movq 0x20(%rdi), %rcx
movq (%rsi,%rcx), %r8
movq (%r8), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%r8)
testq %rcx, %rcx
jne 0xa17e
callq 0x1070f
movq 0x10(%rsp), %rax
incq %rbp
cmpq %r14, %rbp
jbe 0xa0f6
xorl %r14d, %r14d
movq (%r15,%r14,8), %rax
movq 0x40(%rax), %rdi
callq 0x2040
movq (%r15,%r14,8), %rax
movq 0x48(%rax), %rdi
callq 0x2040
movq (%r15,%r14,8), %rsi
movq $-0x1, 0x38(%rsi)
movq %r13, %rdi
callq 0x8d62
incq %r14
cmpq %rbx, %r14
jbe 0xa18d
movq 0x18(%rsp), %r12
movq 0x10(%rsp), %rax
movq %rax, (%r12)
subq %rbx, 0x48(%r13)
xorl %eax, %eax
jmp 0xa221
movq %r12, %rdi
callq 0x2040
movq 0x18(%rsp), %r12
movq 0x28(%rsp), %rbp
movq 0x10(%rsp), %rdi
callq 0x2040
leaq 0x8(,%rbx,8), %rdx
shlq $0x3, %rbx
movq %r12, %rdi
movq %r15, %rsi
callq 0x2280
movq %rbp, %rdi
movq 0x30(%rsp), %rsi
movq %rbx, %rdx
callq 0x2280
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb1e9(%rip), %rdi      # 0x15420
leaq 0xb205(%rip), %rsi      # 0x15443
leaq 0xb211(%rip), %rcx      # 0x15456
movl $0xb1, %edx
callq 0x21c0
leaq 0xb1ca(%rip), %rdi      # 0x15420
leaq 0xb1e6(%rip), %rsi      # 0x15443
leaq 0xb293(%rip), %rcx      # 0x154f7
movl $0x1a, %edx
callq 0x21c0
leaq 0xb1ab(%rip), %rdi      # 0x15420
leaq 0xb1c7(%rip), %rsi      # 0x15443
leaq 0xb2dd(%rip), %rcx      # 0x15560
movl $0x52, %edx
callq 0x21c0
leaq 0xb243(%rip), %rdi      # 0x154d7
leaq 0xb1a8(%rip), %rsi      # 0x15443
leaq 0xb255(%rip), %rcx      # 0x154f7
movl $0x19, %edx
callq 0x21c0
leaq 0xb28b(%rip), %rdi      # 0x1553e
leaq 0xb189(%rip), %rsi      # 0x15443
leaq 0xb29f(%rip), %rcx      # 0x15560
movl $0x51, %edx
callq 0x21c0
leaq 0xa37e(%rip), %rdi      # 0x14650
leaq 0xa39d(%rip), %rsi      # 0x14676
leaq 0xa3af(%rip), %rcx      # 0x1468f
movl $0x88, %edx
callq 0x21c0
nop