// File: /workspace/github_c_makefile_star2_O1/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 0x9bbc
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, %rdi
shrq %rdi
andl $0x3, %ecx
movq %rdi, 0x8(%rsp)
je 0x993c
cmpl $0x1, %ecx
jne 0x9bdb
movq $0x0, (%rbx)
cmpq $0x0, 0x38(%r12)
je 0x9b11
movq %rbp, 0x10(%rsp)
movl $0xa, %eax
xorl %ebp, %ebp
xorl %esi, %esi
xorl %r13d, %r13d
cmpq %rdi, %rax
jbe 0x9903
movq 0x40(%r12), %rdx
movq %rsi, %rax
shlq $0x4, %rax
subq %rax, %rdx
addq %rbp, %rdx
movq %r14, %rdi
callq 0x9bfa
movq (%rbx), %rcx
movq %rax, (%r15,%rcx,8)
testq %rax, %rax
je 0x9b50
movq 0x40(%r12), %rax
movq (%rax,%rbp), %rax
movq 0x10(%rsp), %rdx
movq %rax, (%rdx,%rcx,8)
incq %rcx
movq %rcx, (%rbx)
movl $0xa, %eax
xorl %esi, %esi
movq 0x8(%rsp), %rdi
movq 0x40(%r12), %rcx
movq (%rcx,%rbp), %rdx
movq 0x8(%rcx,%rbp), %rcx
movzbl (%rdx), %edx
movzbl (%rcx), %ecx
addq %rax, %rdx
leaq (%rcx,%rdx), %rax
addq $0x2, %rax
incq %rsi
incq %r13
addq $0x10, %rbp
cmpq 0x38(%r12), %r13
jb 0x98b0
jmp 0x9b16
movq $0x0, (%rbx)
cmpq $0x0, 0x38(%r12)
je 0x99e3
movl $0x1, %r13d
movl $0x1e, %eax
xorl %edx, %edx
cmpq %rdi, %rax
jbe 0x99bc
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 0x9c91
movq (%rbx), %rcx
movq %rax, (%r15,%rcx,8)
testq %rax, %rax
je 0x9aea
movq 0x40(%r12), %rax
movq -0x8(%rax,%r13,8), %rax
movq %rax, (%rbp,%rcx,8)
incq %rcx
movq %rcx, (%rbx)
movl $0x1e, %eax
xorl %edx, %edx
movq 0x8(%rsp), %rdi
jmp 0x99d3
movq 0x40(%r12), %rcx
movq -0x8(%rcx,%r13,8), %rcx
movzbl (%rcx), %ecx
incq %rdx
addq %rcx, %rax
addq $0x15, %rax
incq %r13
cmpq 0x38(%r12), %r13
jbe 0x995c
jmp 0x99eb
movl $0x1, %r13d
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 0x9c91
movq (%rbx), %rcx
movq %rax, (%r15,%rcx,8)
testq %rax, %rax
je 0x9aea
incq %rcx
movq %rcx, (%rbx)
je 0x9add
xorl %r13d, %r13d
movq (%r15,%r13,8), %rax
xorl %ebp, %ebp
testq %r12, %r12
je 0x9a76
movq 0x48(%rax), %rax
movq (%rax,%rbp,8), %rax
movb 0x1c(%rax), %al
andb $0x3, %al
cmpb $0x2, %al
je 0x9a76
movq 0x30(%r14), %rdi
movq 0x20(%rdi), %rax
movq (%r12,%rax), %rax
movq (%rax), %rcx
testq %rcx, %rcx
je 0x9b9d
decq %rcx
movq %rcx, (%rax)
jne 0x9a76
movq %r12, %rsi
callq 0x10885
movq (%r15,%r13,8), %rax
movq 0x48(%rax), %rcx
movq (%rcx,%rbp,8), %rcx
movq %rax, 0x28(%rcx)
movq (%r15,%r13,8), %rsi
testq %rsi, %rsi
je 0x9ac0
movq 0x48(%rsi), %rax
movq (%rax,%rbp,8), %rax
movb 0x1c(%rax), %al
andb $0x3, %al
cmpb $0x2, %al
je 0x9ac0
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 0x9ac0
callq 0x107a3
incq %rbp
movq (%r15,%r13,8), %rax
cmpq 0x38(%rax), %rbp
jbe 0x9a38
incq %r13
cmpq (%rbx), %r13
jb 0x9a32
movq %r14, %rdi
movq %r12, %rsi
callq 0x9d9e
jmp 0x9b4a
movq (%rbx), %rax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x9b75
movq -0x8(%r15,%rax,8), %rsi
movq %r14, %rdi
callq 0x9d9e
movq (%rbx), %rax
decq %rax
movq %rax, (%rbx)
jne 0x9af7
jmp 0x9b75
xorl %r13d, %r13d
xorl %esi, %esi
subq %rsi, %r13
shlq $0x4, %r13
addq 0x40(%r12), %r13
movq %r14, %rdi
movq %r13, %rdx
callq 0x9bfa
movq (%rbx), %rcx
movq %rax, (%r15,%rcx,8)
testq %rax, %rax
je 0x9b50
incq %rcx
movq %rcx, (%rbx)
movq %r14, %rdi
movq %r12, %rsi
callq 0x8de9
xorl %ebp, %ebp
movb $0x1, %al
jmp 0x9b77
movq (%rbx), %rax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x9b75
movq -0x8(%r15,%rax,8), %rsi
movq %r14, %rdi
callq 0x8de9
movq (%rbx), %rax
decq %rax
movq %rax, (%rbx)
jne 0x9b5d
xorl %eax, %eax
testb %al, %al
je 0x9b8c
movq (%rbx), %rax
movq 0x48(%r14), %rcx
addq %rcx, %rax
decq %rax
movq %rax, 0x48(%r14)
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xaadc(%rip), %rdi      # 0x14680
leaq 0xaafb(%rip), %rsi      # 0x146a6
leaq 0xab0d(%rip), %rcx      # 0x146bf
movl $0x88, %edx
callq 0x21c0
leaq 0xb408(%rip), %rdi      # 0x14fcb
leaq 0xb788(%rip), %rsi      # 0x15352
leaq 0xb794(%rip), %rcx      # 0x15365
movl $0x155, %edx            # imm = 0x155
callq 0x21c0
leaq 0xb319(%rip), %rdi      # 0x14efb
leaq 0xb769(%rip), %rsi      # 0x15352
leaq 0xb809(%rip), %rcx      # 0x153f9
movl $0x100, %edx            # imm = 0x100
callq 0x21c0