// File: /workspace/github_c_makefile_star2_O2/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, %r13
movq %rcx, %r12
movq %rdx, 0x38(%rsp)
movq %rsi, %r15
xorl %eax, %eax
cmpq %rbx, %rax
ja 0x8693
movq (%r15,%rax,8), %rcx
movb 0x1c(%rcx), %cl
andb $0xc, %cl
incq %rax
cmpb $0x8, %cl
je 0x865d
leaq 0x9dc5(%rip), %rdi      # 0x12440
leaq 0x9de1(%rip), %rsi      # 0x12463
leaq 0x9ded(%rip), %rcx      # 0x12476
movl $0xb1, %edx
callq 0x21c0
movq (%r15), %rax
movb 0x1c(%rax), %al
andb $0x3, %al
cmpb $0x1, %al
movq %rdi, 0x10(%rsp)
jne 0x86e7
xorl %eax, %eax
cmpq %rbx, %rax
ja 0x8725
movq (%r15,%rax,8), %rcx
movb 0x1c(%rcx), %cl
movl %ecx, %edx
andb $0x3, %dl
cmpb $0x1, %dl
jne 0x8aba
andb $0xc, %cl
incq %rax
cmpb $0x8, %cl
je 0x86a6
leaq 0x9d6e(%rip), %rdi      # 0x12440
leaq 0x9d8a(%rip), %rsi      # 0x12463
leaq 0x9e37(%rip), %rcx      # 0x12517
pushq $0x1a
jmp 0x8aea
xorl %eax, %eax
cmpq %rbx, %rax
ja 0x873e
movq (%r15,%rax,8), %rcx
movb 0x1c(%rcx), %cl
testb $0x3, %cl
jne 0x8ad3
andb $0xc, %cl
incq %rax
cmpb $0x8, %cl
je 0x86e9
leaq 0x9d30(%rip), %rdi      # 0x12440
leaq 0x9d4c(%rip), %rsi      # 0x12463
leaq 0x9e62(%rip), %rcx      # 0x12580
pushq $0x52
jmp 0x8aea
pushq $-0x1
popq %rax
xorl %r14d, %r14d
cmpq %rax, %rbx
je 0x8761
movq 0x8(%r15,%rax,8), %rcx
addq 0x38(%rcx), %r14
incq %rax
jmp 0x872b
pushq $-0x1
popq %rax
xorl %r14d, %r14d
cmpq %rax, %rbx
je 0x87de
movq 0x8(%r15,%rax,8), %rcx
movq 0x38(%rcx), %rcx
addq %rcx, %r14
incq %r14
incq %rax
jmp 0x8744
pushq $0x10
popq %rsi
movq %r14, %rdi
callq 0x8b0f
testq %rax, %rax
sete %dl
testq %r14, %r14
setne %cl
testb %cl, %dl
jne 0x8a81
movq %r14, 0x28(%rsp)
movq %r13, 0x30(%rsp)
movq %r12, 0x18(%rsp)
xorl %ebp, %ebp
xorl %r12d, %r12d
cmpq %rbx, %rbp
ja 0x888f
movq (%r15,%rbp,8), %rcx
movq 0x38(%rcx), %r13
testq %r13, %r13
je 0x87d6
movq %r12, %rdi
shlq $0x4, %rdi
addq %rax, %rdi
movq 0x40(%rcx), %rsi
movq %r13, %rdx
shlq $0x4, %rdx
movq %r15, %r14
movq %rbx, %r15
movq %rax, %rbx
callq 0x2280
movq %rbx, %rax
movq %r15, %rbx
movq %r14, %r15
addq %r13, %r12
incq %rbp
jmp 0x8794
movq %r14, %rdi
decq %rdi
setne %bpl
pushq $0x8
popq %rsi
movq %rdi, 0x28(%rsp)
callq 0x8b0f
testq %rax, %rax
sete %cl
testb %cl, %bpl
jne 0x8a81
movq %rax, 0x20(%rsp)
movq %r13, 0x30(%rsp)
pushq $0x8
popq %rsi
movq %r14, %rdi
callq 0x8b0f
testq %rax, %rax
setne %dl
testq %r14, %r14
sete %cl
orb %dl, %cl
cmpb $0x1, %cl
jne 0x88f4
movq %rax, 0x40(%rsp)
movq %r12, 0x18(%rsp)
xorl %r14d, %r14d
xorl %r12d, %r12d
movq 0x20(%rsp), %rbp
leaq (,%r14,8), %rdi
addq %rbp, %rdi
cmpq %r12, %rbx
je 0x88fe
movq (%r15,%r12,8), %rax
movq 0x38(%rax), %r13
movq 0x40(%rax), %rsi
leaq (,%r13,8), %rdx
callq 0x2280
leaq (%r14,%r13), %rax
movq 0x38(%rsp), %rcx
movq (%rcx,%r12,8), %rcx
addq %r13, %r14
incq %r14
movq %rcx, (%rbp,%rax,8)
incq %r12
jmp 0x8845
movq %rax, (%rsp)
pushq $0x1
popq %rsi
movq 0x10(%rsp), %r13
movq %r13, %rdi
xorl %edx, %edx
movq 0x28(%rsp), %rcx
movq %rax, %r14
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x767c
testq %rax, %rax
movq 0x18(%rsp), %r12
je 0x8a74
movq %rax, %rbp
movq (%r15), %rax
movq 0x28(%rax), %rsi
movq %rsi, 0x28(%rbp)
movq %r13, %rdi
callq 0x8b3b
xorl %r14d, %r14d
cmpq %rbx, %r14
ja 0x8a5b
movq (%r15,%r14,8), %rsi
movq %r13, %rdi
callq 0x7921
incq %r14
jmp 0x88da
movq 0x20(%rsp), %r14
jmp 0x8a74
movq (%r15,%rbx,8), %rax
movq 0x38(%rax), %rdx
movq 0x40(%rax), %rsi
shlq $0x3, %rdx
callq 0x2280
xorl %r14d, %r14d
xorl %r12d, %r12d
movq 0x40(%rsp), %rbp
cmpq %rbx, %r12
ja 0x8952
leaq (,%r14,8), %rdi
addq %rbp, %rdi
movq (%r15,%r12,8), %rax
movq 0x38(%rax), %r13
movq 0x48(%rax), %rsi
leaq 0x8(,%r13,8), %rdx
callq 0x2280
addq %r13, %r14
incq %r14
incq %r12
jmp 0x891e
movq (%r15), %rax
movsbl 0x1d(%rax), %edx
andq $0x0, (%rsp)
movq 0x10(%rsp), %r12
movq %r12, %rdi
xorl %esi, %esi
movq 0x28(%rsp), %r13
movq %r13, %rcx
movq 0x20(%rsp), %r14
movq %r14, %r8
movq %rbp, %r9
callq 0x767c
testq %rax, %rax
je 0x8a67
movq (%r15), %rcx
movq 0x28(%rcx), %rsi
movq %r12, %rdi
movq %rax, %r12
movq %rsi, 0x28(%rax)
callq 0x8b3b
xorl %r14d, %r14d
cmpq %r13, %r14
ja 0x8a16
movq (%rbp,%r14,8), %rax
movb 0x1c(%rax), %cl
andb $0x3, %cl
cmpb $0x2, %cl
je 0x89ef
movq 0x28(%rax), %rsi
testq %rsi, %rsi
je 0x89ef
movq 0x10(%rsp), %rcx
movq 0x30(%rcx), %rdi
movq 0x20(%rdi), %rcx
movq (%rsi,%rcx), %rcx
movq (%rcx), %rdx
testq %rdx, %rdx
je 0x8af0
decq %rdx
movq %rdx, (%rcx)
jne 0x89ef
callq 0xe7ec
movq (%rbp,%r14,8), %rax
movq %r12, 0x28(%rax)
movq (%rbp,%r14,8), %rax
movb 0x1c(%rax), %cl
andb $0x3, %cl
cmpb $0x2, %cl
je 0x8a11
movq 0x28(%rax), %rsi
movq 0x10(%rsp), %rdi
callq 0x8b3b
incq %r14
jmp 0x89a2
xorl %r14d, %r14d
movq 0x10(%rsp), %r13
movq %r12, %rbp
movq 0x18(%rsp), %r12
cmpq %rbx, %r14
ja 0x8a5b
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
orq $-0x1, 0x38(%rsi)
movq %r13, %rdi
callq 0x7921
incq %r14
jmp 0x8a26
movq %rbp, (%r12)
subq %rbx, 0x48(%r13)
xorl %eax, %eax
jmp 0x8aab
movq %rbp, %rdi
callq 0x2040
movq 0x18(%rsp), %r12
movq %r14, %rdi
callq 0x2040
movq 0x30(%rsp), %r13
leaq 0x8(,%rbx,8), %rdx
shlq $0x3, %rbx
movq %r12, %rdi
movq %r15, %rsi
callq 0x2280
movq %r13, %rdi
movq 0x38(%rsp), %rsi
movq %rbx, %rdx
callq 0x2280
pushq $-0x1
popq %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9a36(%rip), %rdi      # 0x124f7
leaq 0x999b(%rip), %rsi      # 0x12463
leaq 0x9a48(%rip), %rcx      # 0x12517
pushq $0x19
jmp 0x8aea
leaq 0x9a84(%rip), %rdi      # 0x1255e
leaq 0x9982(%rip), %rsi      # 0x12463
leaq 0x9a98(%rip), %rcx      # 0x12580
pushq $0x51
popq %rdx
callq 0x21c0
leaq 0x8b71(%rip), %rdi      # 0x11668
leaq 0x8b90(%rip), %rsi      # 0x1168e
leaq 0x8ba2(%rip), %rcx      # 0x116a7
movl $0x88, %edx
callq 0x21c0