// File: /workspace/github_c_makefile_star2_O1/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, %r12
movq %rcx, %rbp
movq %rdx, %r15
movq %rsi, %r13
movq %rdi, 0x8(%rsp)
xorl %eax, %eax
movq (%r13,%rax,8), %rcx
movb 0x1c(%rcx), %cl
andb $0xc, %cl
cmpb $0x8, %cl
jne 0xa344
incq %rax
cmpq %rbx, %rax
jbe 0x9df8
movq (%r13), %rdx
movb 0x1c(%rdx), %al
andb $0x3, %al
cmpb $0x1, %al
jne 0x9e8c
xorl %eax, %eax
movq (%r13,%rax,8), %rcx
movb 0x1c(%rcx), %cl
movl %ecx, %edx
andb $0x3, %dl
cmpb $0x1, %dl
jne 0xa3a1
andb $0xc, %cl
cmpb $0x8, %cl
jne 0xa363
incq %rax
cmpq %rbx, %rax
jbe 0x9e23
movq $-0x1, %rax
xorl %r14d, %r14d
movq 0x8(%r13,%rax,8), %rcx
addq 0x38(%rcx), %r14
incq %rax
cmpq %rax, %rbx
jne 0x9e57
testq %r14, %r14
je 0x9e85
movq %r14, %rax
shrq $0x3c, %rax
je 0x9f04
callq 0x20a0
movl $0xc, (%rax)
xorl %eax, %eax
jmp 0x9f10
xorl %eax, %eax
movq (%r13,%rax,8), %rcx
movb 0x1c(%rcx), %cl
testb $0x3, %cl
jne 0xa3c0
andb $0xc, %cl
cmpb $0x8, %cl
jne 0xa382
incq %rax
cmpq %rbx, %rax
jbe 0x9e8e
movq %rdx, 0x38(%rsp)
movq %rbp, 0x18(%rsp)
movq $-0x1, %rax
xorl %ebp, %ebp
movq %rbp, %rcx
movq 0x8(%r13,%rax,8), %rdx
movq 0x38(%rdx), %r14
addq %r14, %rbp
incq %rbp
incq %rax
cmpq %rax, %rbx
jne 0x9ec6
addq %rcx, %r14
je 0x9efd
movq %r14, %rax
shrq $0x3d, %rax
je 0xa01f
callq 0x20a0
movl $0xc, (%rax)
xorl %edi, %edi
jmp 0xa02f
movq %r14, %rdi
shlq $0x4, %rdi
callq 0x22a0
testq %rax, %rax
sete %dl
testq %r14, %r14
setne %cl
testb %cl, %dl
je 0x9f27
xorl %eax, %eax
jmp 0xa2f8
movq %rbp, 0x18(%rsp)
movq %r15, 0x20(%rsp)
movq %r12, 0x28(%rsp)
xorl %r12d, %r12d
xorl %ebp, %ebp
movq %r13, 0x40(%rsp)
movq (%r13,%rbp,8), %r15
movq 0x38(%r15), %rdx
testq %rdx, %rdx
je 0x9f76
movq %r12, %rdi
shlq $0x4, %rdi
addq %rax, %rdi
movq %rbx, %r13
movq %rax, %rbx
movq 0x40(%r15), %rsi
shlq $0x4, %rdx
callq 0x2280
movq %rbx, %rax
movq %r13, %rbx
movq 0x40(%rsp), %r13
addq 0x38(%r15), %r12
incq %rbp
cmpq %rbx, %rbp
jbe 0x9f40
movq %rax, (%rsp)
movq 0x8(%rsp), %rdi
movq %rax, %r15
movl $0x1, %esi
xorl %edx, %edx
movq %r14, %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x8ac8
testq %rax, %rax
movq 0x28(%rsp), %r12
je 0xa065
movq %rax, %r14
movq (%r13), %rax
movq 0x28(%rax), %rsi
movq %rsi, 0x28(%r14)
testq %rsi, %rsi
movq 0x18(%rsp), %rbp
je 0x9fef
movq 0x8(%rsp), %rax
movq 0x30(%rax), %rdi
movq 0x20(%rdi), %rax
movq (%rsi,%rax), %rax
movq (%rax), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%rax)
testq %rcx, %rcx
jne 0x9fef
callq 0x107a3
xorl %r15d, %r15d
movq 0x8(%rsp), %r12
movq (%r13,%r15,8), %rsi
movq %r12, %rdi
callq 0x8de9
incq %r15
cmpq %rbx, %r15
jbe 0x9ff7
movq %r14, (%rbp)
xorl %r14d, %r14d
movb $0x1, %al
movq 0x20(%rsp), %r15
jmp 0xa2ce
leaq (,%r14,8), %rdi
callq 0x22a0
movq %rax, %rdi
testq %rdi, %rdi
sete %al
testq %r14, %r14
setne %cl
testb %al, %cl
jne 0xa2f1
testq %rbp, %rbp
movq %rdi, 0x30(%rsp)
je 0xa079
movq %rbp, %rax
shrq $0x3d, %rax
je 0xa07d
callq 0x20a0
movl $0xc, (%rax)
xorl %eax, %eax
jmp 0xa08a
movq %r15, %rdi
callq 0x2040
xorl %eax, %eax
movq 0x20(%rsp), %r15
jmp 0xa2f3
xorl %eax, %eax
jmp 0xa08f
leaq (,%rbp,8), %rdi
callq 0x22a0
movq 0x30(%rsp), %rdi
testq %rbp, %rbp
setne %dl
testq %rax, %rax
sete %cl
testb %cl, %dl
jne 0xa2ec
movq %rax, 0x10(%rsp)
movq %r12, 0x28(%rsp)
testq %rbx, %rbx
movq %r15, 0x20(%rsp)
je 0xa108
xorl %r12d, %r12d
xorl %ebp, %ebp
movq 0x30(%rsp), %rax
leaq (%rax,%rbp,8), %rdi
movq (%r13,%r12,8), %r15
movq 0x38(%r15), %rdx
movq 0x40(%r15), %rsi
shlq $0x3, %rdx
callq 0x2280
movq 0x30(%rsp), %rdi
movq 0x38(%r15), %rax
movq 0x20(%rsp), %r15
leaq (%rax,%rbp), %rcx
movq (%r15,%r12,8), %rdx
addq %rax, %rbp
incq %rbp
movq %rdx, (%rdi,%rcx,8)
incq %r12
cmpq %r12, %rbx
jne 0xa0bc
movq %rbx, %rax
jmp 0xa10c
xorl %ebp, %ebp
xorl %eax, %eax
leaq (%rdi,%rbp,8), %rdi
movq (%r13,%rax,8), %rax
movq 0x38(%rax), %rdx
movq 0x40(%rax), %rsi
shlq $0x3, %rdx
callq 0x2280
xorl %r12d, %r12d
xorl %ebp, %ebp
movq 0x10(%rsp), %rax
leaq (%rax,%rbp,8), %rdi
movq (%r13,%r12,8), %r15
movq 0x38(%r15), %rax
movq 0x48(%r15), %rsi
leaq 0x8(,%rax,8), %rdx
callq 0x2280
movq 0x38(%r15), %rax
addq %rax, %rbp
incq %rbp
incq %r12
cmpq %rbx, %r12
jbe 0xa12b
movq 0x38(%rsp), %rax
movsbl 0x1d(%rax), %edx
movq $0x0, (%rsp)
movq 0x8(%rsp), %r12
movq %r12, %rdi
xorl %esi, %esi
movq %r14, %rcx
movq 0x30(%rsp), %r15
movq %r15, %r8
movq 0x10(%rsp), %r9
callq 0x8ac8
testq %rax, %rax
je 0xa2d5
movq %rax, %rbp
movq (%r13), %rax
movq 0x28(%rax), %rsi
movq %rsi, 0x28(%rbp)
testq %rsi, %rsi
movq 0x20(%rsp), %r15
movq 0x10(%rsp), %r8
je 0xa1dd
movq 0x30(%r12), %rdi
movq 0x20(%rdi), %rax
movq (%rsi,%rax), %rax
movq (%rax), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%rax)
testq %rcx, %rcx
jne 0xa1dd
callq 0x107a3
movq 0x10(%rsp), %r8
xorl %r12d, %r12d
movq (%r8,%r12,8), %rax
movb 0x1c(%rax), %cl
andb $0x3, %cl
cmpb $0x2, %cl
je 0xa227
movq 0x28(%rax), %rsi
testq %rsi, %rsi
je 0xa227
movq 0x8(%rsp), %rax
movq 0x30(%rax), %rdi
movq 0x20(%rdi), %rax
movq (%rsi,%rax), %rax
movq (%rax), %rcx
testq %rcx, %rcx
je 0xa3df
decq %rcx
movq %rcx, (%rax)
jne 0xa227
callq 0x10885
movq 0x10(%rsp), %r8
movq (%r8,%r12,8), %rax
movq %rbp, 0x28(%rax)
movq (%r8,%r12,8), %rax
movb 0x1c(%rax), %cl
andb $0x3, %cl
cmpb $0x2, %cl
je 0xa271
movq 0x28(%rax), %rsi
testq %rsi, %rsi
je 0xa271
movq 0x8(%rsp), %rax
movq 0x30(%rax), %rdi
movq 0x20(%rdi), %rax
movq (%rsi,%rax), %rax
movq (%rax), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%rax)
testq %rcx, %rcx
jne 0xa271
callq 0x107a3
movq 0x10(%rsp), %r8
incq %r12
cmpq %r14, %r12
jbe 0xa1e0
xorl %r14d, %r14d
movq 0x8(%rsp), %r12
movq (%r13,%r14,8), %rax
movq 0x40(%rax), %rdi
callq 0x2040
movq (%r13,%r14,8), %rax
movq 0x48(%rax), %rdi
callq 0x2040
movq (%r13,%r14,8), %rsi
movq $-0x1, 0x38(%rsi)
movq %r12, %rdi
callq 0x8de9
incq %r14
cmpq %rbx, %r14
jbe 0xa285
movq 0x18(%rsp), %rax
movq %rbp, (%rax)
movq %rax, %rbp
xorl %r14d, %r14d
movb $0x1, %al
movq 0x28(%rsp), %r12
jmp 0xa2fe
movq 0x10(%rsp), %rdi
callq 0x2040
movq 0x28(%rsp), %r12
movq %r15, %rdi
movq 0x20(%rsp), %r15
callq 0x2040
xorl %eax, %eax
movq 0x18(%rsp), %rbp
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testb %al, %al
je 0xa30d
movq 0x8(%rsp), %rax
subq %rbx, 0x48(%rax)
jmp 0xa332
leaq 0x8(,%rbx,8), %rdx
shlq $0x3, %rbx
movq %rbp, %rdi
movq %r13, %rsi
callq 0x2280
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x2280
movl %r14d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb11a(%rip), %rdi      # 0x15465
leaq 0xb136(%rip), %rsi      # 0x15488
leaq 0xb142(%rip), %rcx      # 0x1549b
movl $0xb1, %edx
callq 0x21c0
leaq 0xb0fb(%rip), %rdi      # 0x15465
leaq 0xb117(%rip), %rsi      # 0x15488
leaq 0xb1c4(%rip), %rcx      # 0x1553c
movl $0x1a, %edx
callq 0x21c0
leaq 0xb0dc(%rip), %rdi      # 0x15465
leaq 0xb0f8(%rip), %rsi      # 0x15488
leaq 0xb20e(%rip), %rcx      # 0x155a5
movl $0x52, %edx
callq 0x21c0
leaq 0xb174(%rip), %rdi      # 0x1551c
leaq 0xb0d9(%rip), %rsi      # 0x15488
leaq 0xb186(%rip), %rcx      # 0x1553c
movl $0x19, %edx
callq 0x21c0
leaq 0xb1bc(%rip), %rdi      # 0x15583
leaq 0xb0ba(%rip), %rsi      # 0x15488
leaq 0xb1d0(%rip), %rcx      # 0x155a5
movl $0x51, %edx
callq 0x21c0
leaq 0xa29a(%rip), %rdi      # 0x14680
leaq 0xa2b9(%rip), %rsi      # 0x146a6
leaq 0xa2cb(%rip), %rcx      # 0x146bf
movl $0x88, %edx
callq 0x21c0
nop