// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/kvlds/btree_node_split.c
// Function: btree_node_split
int
btree_node_split(struct btree * T, struct node * N,
    const struct kvldskey ** keys, struct node ** parents, size_t * nparts)
{
	size_t breakat;
	int rc;

	/* Sanity-check: We should never try to split a non-dirty node. */
	assert(N->state == NODE_STATE_DIRTY);

	/* We will split when we exceed 2/3 of a full node. */
	breakat = (T->pagelen * 2)/3;

	/* Handle leaves and parents separately. */
	if (N->type == NODE_TYPE_LEAF)
		rc = split_leaf(T, N, keys, parents, nparts, breakat);
	else
		rc = split_parent(T, N, keys, parents, nparts, breakat);

	/* On success, update recorded size of tree. */
	if (rc == 0)
		T->nnodes += *nparts - 1;

	/* Return status from split_leaf or split_parent. */
	return (rc);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r15
movq %rdx, 0x10(%rsp)
movzbl 0x1c(%rsi), %ecx
movl %ecx, %eax
andb $0xc, %al
cmpb $0x8, %al
jne 0x8451
movq %r8, %rbx
movq %rsi, %r12
movq %rdi, %r14
movq (%rdi), %rax
addq %rax, %rax
pushq $0x3
popq %rsi
xorl %edx, %edx
divq %rsi
andl $0x3, %ecx
movq %rax, 0x8(%rsp)
je 0x81f8
cmpl $0x1, %ecx
jne 0x8470
andq $0x0, (%rbx)
pushq $0xa
popq %rdi
xorl %r13d, %r13d
xorl %ebp, %ebp
xorl %esi, %esi
cmpq 0x38(%r12), %rbp
jae 0x838a
movq 0x40(%r12), %rdx
cmpq %rax, %rdi
jbe 0x81cf
movq %rsi, %rax
shlq $0x4, %rax
subq %rax, %rdx
addq %r13, %rdx
movq %r14, %rdi
callq 0x848f
movq (%rbx), %rcx
movq %rax, (%r15,%rcx,8)
testq %rax, %rax
je 0x83e3
movq 0x40(%r12), %rax
movq (%rax,%r13), %rax
movq 0x10(%rsp), %rdx
movq %rax, (%rdx,%rcx,8)
incq %rcx
movq %rcx, (%rbx)
movq 0x40(%r12), %rdx
pushq $0xa
popq %rdi
xorl %esi, %esi
movq 0x8(%rsp), %rax
movq (%rdx,%r13), %rcx
movq 0x8(%rdx,%r13), %rdx
movzbl (%rcx), %ecx
movzbl (%rdx), %edx
addq %rdi, %rcx
leaq (%rdx,%rcx), %rdi
addq $0x2, %rdi
incq %rsi
incq %rbp
addq $0x10, %r13
jmp 0x816e
andq $0x0, (%rbx)
pushq $0x1e
popq %rsi
pushq $0x1
popq %rbp
xorl %r13d, %r13d
xorl %edx, %edx
cmpq 0x38(%r12), %rbp
ja 0x8299
cmpq %rax, %rsi
jbe 0x8277
movsbl 0x1d(%r12), %esi
leaq (,%rdx,8), %rax
movq 0x40(%r12), %rcx
movq 0x48(%r12), %r8
subq %rax, %rcx
addq %r13, %rcx
subq %rax, %r8
addq %r13, %r8
movq %r14, %rdi
callq 0x8531
movq (%rbx), %rcx
movq %rax, (%r15,%rcx,8)
testq %rax, %rax
je 0x83c3
movq 0x40(%r12), %rax
movq (%rax,%r13), %rax
movq 0x10(%rsp), %rdx
movq %rax, (%rdx,%rcx,8)
incq %rcx
movq %rcx, (%rbx)
pushq $0x1e
popq %rsi
xorl %edx, %edx
movq 0x8(%rsp), %rax
jmp 0x828d
movq 0x40(%r12), %rcx
movq (%rcx,%r13), %rcx
movzbl (%rcx), %ecx
incq %rdx
addq %rcx, %rsi
addq $0x15, %rsi
incq %rbp
addq $0x8, %r13
jmp 0x8207
movsbl 0x1d(%r12), %esi
leaq (,%rdx,8), %rax
movq 0x40(%r12), %rcx
movq 0x48(%r12), %r8
subq %rax, %rcx
addq %r13, %rcx
subq %rax, %r8
addq %r13, %r8
movq %r14, %rdi
callq 0x8531
movq (%rbx), %rcx
movq %rax, (%r15,%rcx,8)
testq %rax, %rax
je 0x83c3
incq %rcx
movq %rcx, (%rbx)
xorl %r13d, %r13d
cmpq %rcx, %r13
jae 0x8403
xorl %ebp, %ebp
movq (%r15,%r13,8), %rax
cmpq 0x38(%rax), %rbp
ja 0x837f
movq 0x48(%rax), %rcx
movq (%rcx,%rbp,8), %rcx
movb 0x1c(%rcx), %cl
andb $0x3, %cl
cmpb $0x2, %cl
je 0x8336
movq 0x30(%r14), %rdi
movq 0x20(%rdi), %rcx
movq (%r12,%rcx), %rcx
movq (%rcx), %rdx
testq %rdx, %rdx
je 0x8432
decq %rdx
movq %rdx, (%rcx)
jne 0x8336
movq %r12, %rsi
callq 0xe7ec
movq (%r15,%r13,8), %rax
movq 0x48(%rax), %rcx
movq (%rcx,%rbp,8), %rcx
movq %rax, 0x28(%rcx)
movq (%r15,%r13,8), %rsi
movq 0x48(%rsi), %rax
movq (%rax,%rbp,8), %rax
movb 0x1c(%rax), %al
andb $0x3, %al
cmpb $0x2, %al
je 0x8377
movq 0x30(%r14), %rdi
movq 0x20(%rdi), %rax
movq (%rsi,%rax), %rax
movq (%rax), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%rax)
testq %rcx, %rcx
jne 0x8377
callq 0xe71b
incq %rbp
jmp 0x82e9
incq %r13
movq (%rbx), %rcx
jmp 0x82de
movq 0x40(%r12), %rdx
movq %rsi, %rax
shlq $0x4, %rax
subq %rax, %rdx
addq %r13, %rdx
movq %r14, %rdi
callq 0x848f
movq (%rbx), %rcx
movq %rax, (%r15,%rcx,8)
testq %rax, %rax
je 0x83e3
incq %rcx
movq %rcx, (%rbx)
movq %r14, %rdi
movq %r12, %rsi
callq 0x7921
jmp 0x840e
pushq $-0x1
popq %rbp
testq %rcx, %rcx
je 0x8421
movq -0x8(%r15,%rcx,8), %rsi
movq %r14, %rdi
callq 0x8609
movq (%rbx), %rcx
decq %rcx
movq %rcx, (%rbx)
jmp 0x83c6
pushq $-0x1
popq %rbp
testq %rcx, %rcx
je 0x8421
movq -0x8(%r15,%rcx,8), %rsi
movq %r14, %rdi
callq 0x7921
movq (%rbx), %rcx
decq %rcx
movq %rcx, (%rbx)
jmp 0x83e6
movq %r14, %rdi
movq %r12, %rsi
callq 0x8609
movq (%rbx), %rax
movq 0x48(%r14), %rcx
addq %rcx, %rax
decq %rax
movq %rax, 0x48(%r14)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x922f(%rip), %rdi      # 0x11668
leaq 0x924e(%rip), %rsi      # 0x1168e
leaq 0x9260(%rip), %rcx      # 0x116a7
movl $0x88, %edx
callq 0x21c0
leaq 0x9b4e(%rip), %rdi      # 0x11fa6
leaq 0x9ece(%rip), %rsi      # 0x1232d
leaq 0x9eda(%rip), %rcx      # 0x12340
movl $0x155, %edx            # imm = 0x155
callq 0x21c0
leaq 0x9a74(%rip), %rdi      # 0x11eeb
leaq 0x9eaf(%rip), %rsi      # 0x1232d
leaq 0x9f4f(%rip), %rcx      # 0x123d4
movl $0x100, %edx            # imm = 0x100
callq 0x21c0