// File: /workspace/github_c_makefile_star2_O3/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
movzbl 0x1c(%rsi), %ecx
movl %ecx, %eax
andb $0xc, %al
cmpb $0x8, %al
jne 0x9b43
movq %r8, %rbx
movq %rdx, %rbp
movq %rsi, %r12
movq %rdi, %r14
movq (%rdi), %rax
addq %rax, %rax
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rdx
movq %rdx, %r9
shrq %r9
andl $0x3, %ecx
movq %r9, 0x8(%rsp)
je 0x98da
cmpl $0x1, %ecx
jne 0x9b62
movq $0x0, (%rbx)
movq 0x38(%r12), %rax
movq 0x40(%r12), %rdx
testq %rax, %rax
je 0x9aa5
movq %rbp, 0x10(%rsp)
movl $0xa, %ecx
xorl %ebp, %ebp
xorl %esi, %esi
xorl %r13d, %r13d
cmpq %r9, %rcx
jbe 0x98a7
movq %rsi, %rax
shlq $0x4, %rax
subq %rax, %rdx
addq %rbp, %rdx
movq %r14, %rdi
callq 0x9b81
movq (%rbx), %rcx
movq %rax, (%r15,%rcx,8)
testq %rax, %rax
je 0x9af1
movq 0x40(%r12), %rax
movq (%rax,%rbp), %rax
movq 0x10(%rsp), %rdx
movq %rax, (%rdx,%rcx,8)
incq %rcx
movq %rcx, (%rbx)
movq 0x38(%r12), %rax
movq 0x40(%r12), %rdx
movl $0xa, %ecx
xorl %esi, %esi
movq 0x8(%rsp), %r9
movq (%rdx,%rbp), %rdi
movq 0x8(%rdx,%rbp), %r8
movzbl (%rdi), %edi
movzbl (%r8), %r8d
addq %rcx, %rdi
leaq (%r8,%rdi), %rcx
addq $0x2, %rcx
incq %rsi
incq %r13
addq $0x10, %rbp
cmpq %rax, %r13
jb 0x984f
jmp 0x9aaa
movq $0x0, (%rbx)
movq 0x38(%r12), %rax
movl $0x1, %r13d
testq %rax, %rax
je 0x9986
movl $0x1e, %ecx
xorl %edx, %edx
cmpq %r9, %rcx
jbe 0x9961
movsbl 0x1d(%r12), %esi
movq %rdx, %r8
notq %r8
addq %r13, %r8
shlq $0x3, %r8
movq 0x40(%r12), %rcx
addq %r8, %rcx
addq 0x48(%r12), %r8
movq %r14, %rdi
callq 0x9c0f
movq (%rbx), %rcx
movq %rax, (%r15,%rcx,8)
testq %rax, %rax
je 0x9a7d
movq 0x40(%r12), %rax
movq -0x8(%rax,%r13,8), %rax
movq %rax, (%rbp,%rcx,8)
incq %rcx
movq %rcx, (%rbx)
movq 0x38(%r12), %rax
movl $0x1e, %ecx
xorl %edx, %edx
movq 0x8(%rsp), %r9
jmp 0x9978
movq 0x40(%r12), %rsi
movq -0x8(%rsi,%r13,8), %rsi
movzbl (%rsi), %esi
incq %rdx
addq %rsi, %rcx
addq $0x15, %rcx
incq %r13
cmpq %rax, %r13
jbe 0x98fc
jmp 0x9988
xorl %edx, %edx
movsbl 0x1d(%r12), %esi
movq %rdx, %r8
notq %r8
addq %r13, %r8
shlq $0x3, %r8
movq 0x40(%r12), %rcx
addq %r8, %rcx
addq 0x48(%r12), %r8
movq %r14, %rdi
callq 0x9c0f
movq (%rbx), %rcx
movq %rax, (%r15,%rcx,8)
testq %rax, %rax
je 0x9a7d
incq %rcx
movq %rcx, (%rbx)
je 0x9a70
xorl %r13d, %r13d
movq (%r15,%r13,8), %rsi
xorl %ebp, %ebp
movq 0x48(%rsi), %rax
movq (%rax,%rbp,8), %rax
movb 0x1c(%rax), %al
andb $0x3, %al
cmpb $0x2, %al
je 0x9a12
movq 0x30(%r14), %rdi
movq 0x20(%rdi), %rax
movq (%r12,%rax), %rax
movq (%rax), %rcx
testq %rcx, %rcx
je 0x9b24
decq %rcx
movq %rcx, (%rax)
jne 0x9a12
movq %r12, %rsi
callq 0x107ea
movq (%r15,%r13,8), %rsi
movq 0x48(%rsi), %rax
movq (%rax,%rbp,8), %rax
movq %rsi, 0x28(%rax)
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 0x9a57
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 0x9a57
callq 0x1070f
movq (%r15,%r13,8), %rsi
incq %rbp
cmpq 0x38(%rsi), %rbp
jbe 0x99d5
incq %r13
cmpq (%rbx), %r13
jb 0x99cf
movq %r14, %rdi
movq %r12, %rsi
callq 0x9d09
jmp 0x9adc
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rcx, %rcx
je 0x9b13
movq -0x8(%r15,%rcx,8), %rsi
movq %r14, %rdi
callq 0x9d09
movq (%rbx), %rcx
decq %rcx
movq %rcx, (%rbx)
jne 0x9a8b
jmp 0x9b13
xorl %r13d, %r13d
xorl %esi, %esi
subq %rsi, %r13
shlq $0x4, %r13
addq %rdx, %r13
movq %r14, %rdi
movq %r13, %rdx
callq 0x9b81
movq (%rbx), %rcx
movq %rax, (%r15,%rcx,8)
testq %rax, %rax
je 0x9af1
incq %rcx
movq %rcx, (%rbx)
movq %r14, %rdi
movq %r12, %rsi
callq 0x8d62
movq (%rbx), %rax
movq 0x48(%r14), %rcx
addq %rcx, %rax
decq %rax
movq %rax, 0x48(%r14)
xorl %ebp, %ebp
jmp 0x9b13
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rcx, %rcx
je 0x9b13
movq -0x8(%r15,%rcx,8), %rsi
movq %r14, %rdi
callq 0x8d62
movq (%rbx), %rcx
decq %rcx
movq %rcx, (%rbx)
jne 0x9afb
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xab25(%rip), %rdi      # 0x14650
leaq 0xab44(%rip), %rsi      # 0x14676
leaq 0xab56(%rip), %rcx      # 0x1468f
movl $0x88, %edx
callq 0x21c0
leaq 0xb43c(%rip), %rdi      # 0x14f86
leaq 0xb7bc(%rip), %rsi      # 0x1530d
leaq 0xb7c8(%rip), %rcx      # 0x15320
movl $0x155, %edx            # imm = 0x155
callq 0x21c0
leaq 0xb362(%rip), %rdi      # 0x14ecb
leaq 0xb79d(%rip), %rsi      # 0x1530d
leaq 0xb83d(%rip), %rcx      # 0x153b4
movl $0x100, %edx            # imm = 0x100
callq 0x21c0