// File: /workspace/github_c_makefile_star2_O1/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), %r15
testq %r15, %r15
je 0x4b79
movq %r15, %rax
shrq $0x3c, %rax
je 0x4b7d
callq 0x20a0
movl $0xc, (%rax)
xorl %eax, %eax
jmp 0x4b89
movq %r15, %rdi
shlq $0x4, %rdi
callq 0x22a0
testq %r15, %r15
setne %dl
testq %rax, %rax
sete %cl
testb %cl, %dl
jne 0x4f49
movq %rax, (%rsp)
testq %r15, %r15
je 0x4c69
xorl %r12d, %r12d
xorl %r15d, %r15d
movq 0x28(%rbx), %rax
movq (%rax,%r12,8), %r13
movq 0x8(%r13), %rdi
testb $0xc, 0x1c(%rdi)
jne 0x4c5a
movq (%r13), %rbp
movq 0x10(%rbp), %rsi
callq 0x7f3c
movl 0x8(%rbp), %ecx
cmpl $0x112, %ecx            # imm = 0x112
jle 0x4bf8
cmpl $0x113, %ecx            # imm = 0x113
je 0x4c0f
cmpl $0x120, %ecx            # imm = 0x120
je 0x4c0f
cmpl $0x121, %ecx            # imm = 0x121
je 0x4c16
jmp 0x4c2c
cmpl $0x111, %ecx            # imm = 0x111
je 0x4c16
cmpl $0x112, %ecx            # imm = 0x112
jne 0x4c2c
testq %rax, %rax
jne 0x4c5a
jmp 0x4c2c
testq %rax, %rax
jne 0x4c2c
jmp 0x4c5a
testq %rax, %rax
je 0x4c5a
movq 0x20(%rbp), %rdi
movq 0x8(%rax), %rsi
callq 0x10342
testl %eax, %eax
jne 0x4c5a
movq 0x8(%r13), %rsi
movq %r15, %r14
shlq $0x4, %r14
movq (%rsp), %r13
movq %rsi, (%r13,%r14)
movq 0x18(%rbx), %rdi
callq 0x8fed
movq %rax, 0x8(%r13,%r14)
testq %rax, %rax
je 0x4f40
incq %r15
incq %r12
cmpq 0x10(%rbx), %r12
jb 0x4bb0
jmp 0x4c6c
xorl %r15d, %r15d
cmpq $0x0, 0x10(%rbx)
je 0x4cb9
xorl %r12d, %r12d
movq 0x28(%rbx), %rax
movq (%rax,%r12,8), %rax
movq 0x8(%rax), %rsi
testq %rsi, %rsi
je 0x4cb0
movq 0x18(%rbx), %rax
movq 0x30(%rax), %rdi
movq 0x20(%rdi), %rax
movq (%rsi,%rax), %rax
movq (%rax), %rcx
testq %rcx, %rcx
je 0x4fc1
decq %rcx
movq %rcx, (%rax)
jne 0x4cb0
callq 0x10885
incq %r12
cmpq 0x10(%rbx), %r12
jb 0x4c76
testq %r15, %r15
je 0x4cd6
leaq 0x5a1(%rip), %rcx       # 0x5266
movl $0x10, %edx
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x20e0
cmpq $0x0, 0x10(%rbx)
je 0x4d31
xorl %ebp, %ebp
leaq 0x580(%rip), %r12       # 0x5266
leaq 0x8(%rsp), %r13
movq 0x28(%rbx), %rax
movq (%rax,%rbp,8), %rax
movq 0x8(%rax), %r14
movq %r14, 0x8(%rsp)
movl $0x10, %ecx
movq %r13, %rdi
movq (%rsp), %rsi
movq %r15, %rdx
movq %r12, %r8
callq 0x23a0
testq %rax, %rax
je 0x4d1c
movq 0x8(%rax), %r14
movq 0x28(%rbx), %rax
movq (%rax,%rbp,8), %rax
movq %r14, 0x8(%rax)
incq %rbp
cmpq 0x10(%rbx), %rbp
jb 0x4ceb
movq %r15, 0x40(%rbx)
testq %r15, %r15
je 0x4d52
movq %r15, %rax
shrq $0x3d, %rax
je 0x4d60
callq 0x20a0
movl $0xc, (%rax)
xorl %eax, %eax
jmp 0x4d6d
movq $0x0, 0x38(%rbx)
movq (%rsp), %rdi
jmp 0x4da3
leaq (,%r15,8), %rdi
callq 0x22a0
movq %rax, 0x38(%rbx)
testq %rax, %rax
je 0x4f40
cmpq $0x1, %r15
adcq $0x0, %r15
movq (%rsp), %rdi
leaq 0x8(%rdi), %rax
xorl %ecx, %ecx
movq (%rax), %rdx
movq 0x38(%rbx), %rsi
movq %rdx, (%rsi,%rcx,8)
incq %rcx
addq $0x10, %rax
cmpq %rcx, %r15
jne 0x4d8c
callq 0x2040
movq 0x18(%rbx), %rax
movq 0x40(%rax), %rdi
callq 0x7243
testl %eax, %eax
jne 0x4f49
movq 0x18(%rbx), %rax
movq 0x28(%rax), %rax
testb $0xc, 0x1c(%rax)
je 0x4fa7
cmpq $0x0, 0x40(%rbx)
je 0x4df7
xorl %r14d, %r14d
movq 0x38(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x86d8
testl %eax, %eax
jne 0x4f49
incq %r14
cmpq 0x40(%rbx), %r14
jb 0x4dd9
cmpq $0x0, 0x10(%rbx)
je 0x4f5f
xorl %r12d, %r12d
movq 0x28(%rbx), %rax
movq (%rax,%r12,8), %rbp
movq 0x8(%rbp), %r14
movb 0x1c(%r14), %al
andb $0xc, %al
cmpb $0x8, %al
jne 0x4f18
movq (%rbp), %r13
movq 0x10(%r13), %rsi
movq %r14, %rdi
callq 0x878d
movq %rax, %r8
movq 0x8(%rax), %rsi
movl 0x8(%r13), %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movb $0x1, %r15b
leal -0x110(%rcx), %edx
cmpl $0x3, %edx
ja 0x4e67
leaq 0xf80c(%rip), %rdi      # 0x14660
movslq (%rdi,%rdx,4), %rcx
addq %rdi, %rcx
jmpq *%rcx
xorl %r15d, %r15d
xorl %eax, %eax
jmp 0x4eec
cmpl $0x120, %ecx            # imm = 0x120
je 0x4e96
cmpl $0x121, %ecx            # imm = 0x121
jne 0x4eec
testq %rsi, %rsi
je 0x4eec
movq 0x20(%r13), %rdi
movq %r8, %r15
callq 0x10342
movq %r15, %r8
xorl %r15d, %r15d
testl %eax, %eax
setne %r15b
jmp 0x4ea0
xorl %r15d, %r15d
testq %rsi, %rsi
sete %r15b
movl %r15d, %eax
negl %eax
orl $0x2, %eax
jmp 0x4eec
xorl %r15d, %r15d
testq %rsi, %rsi
setne %r15b
movl %r15d, %eax
negl %eax
jmp 0x4eec
xorl %r15d, %r15d
testq %rsi, %rsi
sete %r15b
jmp 0x4ee4
testq %rsi, %rsi
je 0x4eec
movq 0x20(%r13), %rdi
movq %r8, %r15
callq 0x10342
movq %r15, %r8
xorl %r15d, %r15d
testl %eax, %eax
setne %r15b
movl %r15d, %eax
negl %eax
orl $0x1, %eax
cmpl $0x2, %eax
je 0x4f06
cmpl $0x1, %eax
je 0x4f00
testl %eax, %eax
jne 0x4f0c
cmpq $0x0, (%r8)
je 0x4f27
movq 0x18(%r13), %rax
jmp 0x4f08
xorl %eax, %eax
movq %rax, 0x8(%r8)
testb %r15b, %r15b
jne 0x4f18
movl $0x1, 0x18(%rbp)
incq %r12
cmpq 0x10(%rbx), %r12
jb 0x4e05
jmp 0x4f5f
movq 0x10(%r13), %rdx
movq 0x18(%r13), %rcx
movq %r14, %rdi
movq %r8, %rsi
callq 0x87bc
testl %eax, %eax
je 0x4f0c
jmp 0x4f49
movq (%rsp), %rdi
callq 0x2040
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x0, 0x40(%rbx)
je 0x4f83
xorl %r14d, %r14d
movq 0x38(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x8816
testl %eax, %eax
jne 0x4f49
incq %r14
cmpq 0x40(%rbx), %r14
jb 0x4f69
movq 0x38(%rbx), %rdi
callq 0x2040
movq 0x18(%rbx), %rdi
leaq 0x1d3(%rip), %rsi       # 0x516a
movq %rbx, %rdx
callq 0x622c
testl %eax, %eax
jne 0x4f49
xorl %ebp, %ebp
jmp 0x4f4e
leaq 0x1dd(%rip), %rdi       # 0x518b
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %edx, %edx
callq 0xba4c
testq %rax, %rax
jne 0x4f4e
jmp 0x4f49
leaq 0xf6b8(%rip), %rdi      # 0x14680
leaq 0xf6d7(%rip), %rsi      # 0x146a6
leaq 0xf6e9(%rip), %rcx      # 0x146bf
movl $0x88, %edx
callq 0x21c0