// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/kvlds/dispatch_mr.c
// Function: callback_gotleaves
static int
callback_gotleaves(void * cookie)
{
	struct batch * B = cookie;

	/* Dirty the nodes we will need to modify. */
	if (batch_dirty(B))
		goto err0;

	/*
	 * If we didn't dirty anything, skip the operation-performing,
	 * balancing, and syncing, and go straight to sending responses.
	 */
	if (B->T->root_dirty->state == NODE_STATE_CLEAN)
		goto dosync;

	/* Perform the requested operations. */
	if (batch_run(B))
		goto err0;

	/* Next we need to rebalance the tree. */
	if (btree_balance(B->T, callback_balanced, B))
		goto err0;

	/* Success! */
	return (0);

dosync:
	/* We're skipping balancing and syncing because nothing changed. */
	if (!events_immediate_register(callback_synced, B, 0))
		goto err0;

	/* Success! */
	return (0);

err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
pushq $0x10
popq %rsi
callq 0x4008
movq %rax, (%rsp)
testq %rax, %rax
je 0x4226
xorl %ebp, %ebp
xorl %r12d, %r12d
movq (%rsp), %r15
movq 0x10(%rbx), %rax
cmpq %rax, %r12
jae 0x4118
movq 0x28(%rbx), %rax
movq (%rax,%r12,8), %r13
movq 0x8(%r13), %rdi
testb $0xc, 0x1c(%rdi)
jne 0x4110
movq (%r13), %r14
movq 0x10(%r14), %rsi
callq 0x6d6c
movl 0x8(%r14), %ecx
cmpl $0x111, %ecx            # imm = 0x111
je 0x40d1
cmpl $0x121, %ecx            # imm = 0x121
je 0x40d1
cmpl $0x113, %ecx            # imm = 0x113
je 0x40ca
cmpl $0x120, %ecx            # imm = 0x120
je 0x40ca
cmpl $0x112, %ecx            # imm = 0x112
jne 0x40e7
testq %rax, %rax
jne 0x4110
jmp 0x40e7
testq %rax, %rax
jne 0x40e7
jmp 0x4110
testq %rax, %rax
je 0x4110
movq 0x20(%r14), %rdi
movq 0x8(%rax), %rsi
callq 0xe315
testl %eax, %eax
jne 0x4110
movq 0x8(%r13), %rsi
movq %rbp, %r14
shlq $0x4, %r14
movq %rsi, (%r15,%r14)
movq 0x18(%rbx), %rdi
callq 0x7abe
movq %rax, 0x8(%r15,%r14)
testq %rax, %rax
je 0x4232
incq %rbp
incq %r12
jmp 0x4067
xorl %r12d, %r12d
cmpq %rax, %r12
jae 0x4163
movq 0x28(%rbx), %rcx
movq (%rcx,%r12,8), %rcx
movq 0x8(%rcx), %rsi
testq %rsi, %rsi
je 0x415e
movq 0x18(%rbx), %rcx
movq 0x30(%rcx), %rdi
movq 0x20(%rdi), %rcx
movq (%rsi,%rcx), %rcx
movq (%rcx), %rdx
testq %rdx, %rdx
je 0x43df
decq %rdx
movq %rdx, (%rcx)
jne 0x415e
callq 0xe7ec
movq 0x10(%rbx), %rax
incq %r12
jmp 0x411b
testq %rbp, %rbp
je 0x417e
leaq 0x50d(%rip), %rcx       # 0x467c
pushq $0x10
popq %rdx
movq (%rsp), %rdi
movq %rbp, %rsi
callq 0x20e0
xorl %r14d, %r14d
leaq 0x8(%rsp), %r13
pushq $0x10
popq %r12
cmpq 0x10(%rbx), %r14
jae 0x41d4
movq 0x28(%rbx), %rax
movq (%rax,%r14,8), %rax
movq 0x8(%rax), %r15
movq %r15, 0x8(%rsp)
movq %r13, %rdi
movq (%rsp), %rsi
movq %rbp, %rdx
movq %r12, %rcx
leaq 0x4c7(%rip), %r8        # 0x467c
callq 0x23a0
testq %rax, %rax
je 0x41c3
movq 0x8(%rax), %r15
movq 0x28(%rbx), %rax
movq (%rax,%r14,8), %rax
movq %r15, 0x8(%rax)
incq %r14
jmp 0x418a
movq %rbp, 0x40(%rbx)
testq %rbp, %rbp
je 0x423d
pushq $0x8
popq %rsi
movq %rbp, %rdi
callq 0x4008
movq %rax, 0x38(%rbx)
testq %rax, %rax
setne %cl
movq 0x40(%rbx), %rax
testq %rax, %rax
sete %dl
orb %cl, %dl
cmpb $0x1, %dl
jne 0x4232
movq (%rsp), %rcx
addq $0x8, %rcx
xorl %edx, %edx
cmpq %rdx, %rax
je 0x4242
movq (%rcx), %rsi
movq 0x38(%rbx), %rdi
movq %rsi, (%rdi,%rdx,8)
incq %rdx
addq $0x10, %rcx
jmp 0x420d
cmpq $0x0, 0x10(%rbx)
jne 0x425c
jmp 0x405e
movq (%rsp), %rdi
callq 0x2040
jmp 0x425c
andq $0x0, 0x38(%rbx)
movq (%rsp), %rdi
callq 0x2040
movq 0x18(%rbx), %rax
movq 0x40(%rax), %rdi
callq 0x61f0
testl %eax, %eax
je 0x4270
pushq $-0x1
popq %rbp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x18(%rbx), %rax
movq 0x28(%rax), %rax
testb $0xc, 0x1c(%rax)
je 0x429d
xorl %r14d, %r14d
cmpq 0x40(%rbx), %r14
jae 0x42b7
movq 0x38(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x72f0
incq %r14
testl %eax, %eax
je 0x4281
jmp 0x425c
leaq 0x306(%rip), %rdi       # 0x45aa
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %edx, %edx
callq 0x9f40
testq %rax, %rax
jne 0x425f
jmp 0x425c
xorl %r12d, %r12d
cmpq 0x10(%rbx), %r12
jae 0x4396
movq 0x28(%rbx), %rax
movq (%rax,%r12,8), %rbp
movq 0x8(%rbp), %r15
movb 0x1c(%r15), %al
andb $0xc, %al
cmpb $0x8, %al
jne 0x438e
movq (%rbp), %r13
movq 0x10(%r13), %rsi
movq %r15, %rdi
callq 0x7391
movq %rax, %r14
movq 0x8(%rax), %rsi
movl 0x8(%r13), %eax
leal -0x110(%rax), %ecx
cmpl $0x3, %ecx
ja 0x4328
leaq 0xd33d(%rip), %rdx      # 0x11648
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
testq %rsi, %rsi
je 0x438e
movq 0x20(%r13), %rdi
callq 0xe315
testl %eax, %eax
jne 0x438e
jmp 0x437f
cmpl $0x120, %eax            # imm = 0x120
je 0x434a
cmpl $0x121, %eax            # imm = 0x121
jne 0x438e
testq %rsi, %rsi
je 0x438e
movq 0x20(%r13), %rdi
callq 0xe315
testl %eax, %eax
jne 0x438e
jmp 0x434f
testq %rsi, %rsi
je 0x438e
xorl %eax, %eax
jmp 0x4383
testq %rsi, %rsi
jne 0x438e
cmpq $0x0, (%r14)
jne 0x437f
movq 0x10(%r13), %rdx
movq 0x18(%r13), %rcx
movq %r15, %rdi
movq %r14, %rsi
callq 0x73c0
testl %eax, %eax
je 0x4387
jmp 0x425c
testq %rsi, %rsi
je 0x438e
movq 0x18(%r13), %rax
movq %rax, 0x8(%r14)
movl $0x1, 0x18(%rbp)
incq %r12
jmp 0x42ba
xorl %r14d, %r14d
movq 0x38(%rbx), %rdi
cmpq 0x40(%rbx), %r14
jae 0x43b8
movq (%rdi,%r14,8), %rdi
callq 0x741a
incq %r14
testl %eax, %eax
je 0x4399
jmp 0x425c
callq 0x2040
movq 0x18(%rbx), %rdi
leaq 0x1c1(%rip), %rsi       # 0x4589
movq %rbx, %rdx
callq 0x5470
testl %eax, %eax
jne 0x425c
xorl %ebp, %ebp
jmp 0x425f
leaq 0xd282(%rip), %rdi      # 0x11668
leaq 0xd2a1(%rip), %rsi      # 0x1168e
leaq 0xd2b3(%rip), %rcx      # 0x116a7
movl $0x88, %edx
callq 0x21c0