// File: /workspace/github_c_makefile_star2_O3/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
testq %rdi, %rdi
je 0x4c0f
movq %rdi, %rax
shrq $0x3c, %rax
je 0x4c81
callq 0x20a0
movl $0xc, (%rax)
jmp 0x4fe6
movq $0x0, 0x40(%rbx)
xorl %edi, %edi
movq $0x0, 0x38(%rbx)
callq 0x2040
movq 0x18(%rbx), %rax
movq 0x40(%rax), %rdi
callq 0x71e8
testl %eax, %eax
jne 0x4fe6
movq 0x18(%rbx), %rax
movq 0x28(%rax), %rax
testb $0xc, 0x1c(%rax)
je 0x4da7
cmpq $0x0, 0x40(%rbx)
je 0x4ebc
xorl %r14d, %r14d
movq 0x38(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x8670
testl %eax, %eax
jne 0x4fe6
incq %r14
movq 0x40(%rbx), %rax
cmpq %rax, %r14
jb 0x4c5b
jmp 0x4ebe
shlq $0x4, %rdi
callq 0x22a0
testq %rax, %rax
je 0x4fe6
movq %rax, (%rsp)
xorl %r12d, %r12d
xorl %r15d, %r15d
movq 0x28(%rbx), %rax
movq (%rax,%r12,8), %r13
movq 0x8(%r13), %rdi
testb $0xc, 0x1c(%rdi)
jne 0x4d47
movq (%r13), %rbp
movq 0x10(%rbp), %rsi
callq 0x7ee4
movl 0x8(%rbp), %ecx
cmpl $0x112, %ecx            # imm = 0x112
jle 0x4ce5
cmpl $0x113, %ecx            # imm = 0x113
je 0x4cfc
cmpl $0x120, %ecx            # imm = 0x120
je 0x4cfc
cmpl $0x121, %ecx            # imm = 0x121
je 0x4d03
jmp 0x4d19
cmpl $0x111, %ecx            # imm = 0x111
je 0x4d03
cmpl $0x112, %ecx            # imm = 0x112
jne 0x4d19
testq %rax, %rax
jne 0x4d47
jmp 0x4d19
testq %rax, %rax
jne 0x4d19
jmp 0x4d47
testq %rax, %rax
je 0x4d47
movq 0x20(%rbp), %rdi
movq 0x8(%rax), %rsi
callq 0x102c6
testl %eax, %eax
jne 0x4d47
movq 0x8(%r13), %rsi
movq %r15, %r14
shlq $0x4, %r14
movq (%rsp), %r13
movq %rsi, (%r13,%r14)
movq 0x18(%rbx), %rdi
callq 0x8f61
movq %rax, 0x8(%r13,%r14)
testq %rax, %rax
je 0x4eae
incq %r15
incq %r12
movq 0x10(%rbx), %rax
cmpq %rax, %r12
jb 0x4c9d
testq %rax, %rax
je 0x4dc8
xorl %r12d, %r12d
movq 0x28(%rbx), %rcx
movq (%rcx,%r12,8), %rcx
movq 0x8(%rcx), %rsi
testq %rsi, %rsi
je 0x4d9d
movq 0x18(%rbx), %rcx
movq 0x30(%rcx), %rdi
movq 0x20(%rdi), %rcx
movq (%rsi,%rcx), %rcx
movq (%rcx), %rdx
testq %rdx, %rdx
je 0x5000
decq %rdx
movq %rdx, (%rcx)
jne 0x4d9d
callq 0x107ea
movq 0x10(%rbx), %rax
incq %r12
cmpq %rax, %r12
jb 0x4d5f
jmp 0x4dca
leaq 0x428(%rip), %rdi       # 0x51d6
xorl %ebp, %ebp
movq %rbx, %rsi
xorl %edx, %edx
callq 0xb910
testq %rax, %rax
jne 0x4feb
jmp 0x4fe6
xorl %eax, %eax
testq %r15, %r15
je 0x4deb
leaq 0x4db(%rip), %rcx       # 0x52b1
movl $0x10, %edx
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x20e0
movq 0x10(%rbx), %rax
testq %rax, %rax
je 0x4e44
movq 0x28(%rbx), %rax
xorl %ebp, %ebp
leaq 0x4b4(%rip), %r12       # 0x52b1
leaq 0x8(%rsp), %r13
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 0x4e2f
movq 0x8(%rax), %r14
movq 0x28(%rbx), %rax
movq (%rax,%rbp,8), %rcx
movq %r14, 0x8(%rcx)
incq %rbp
cmpq 0x10(%rbx), %rbp
jb 0x4e02
movq %r15, 0x40(%rbx)
testq %r15, %r15
je 0x4e6b
movq %r15, %rax
shrq $0x3d, %rax
je 0x4e74
callq 0x20a0
movl $0xc, (%rax)
movq $0x0, 0x38(%rbx)
jmp 0x4eae
movq (%rsp), %rdi
jmp 0x4c19
leaq (,%r15,8), %rdi
callq 0x22a0
movq %rax, 0x38(%rbx)
testq %rax, %rax
je 0x4eae
movl $0x4, %eax
movq (%rsp), %rdi
movq (%rdi,%rax,2), %rcx
movq 0x38(%rbx), %rdx
movq %rcx, -0x4(%rdx,%rax)
addq $0x8, %rax
decq %r15
jne 0x4e93
jmp 0x4c21
movq (%rsp), %rdi
callq 0x2040
jmp 0x4fe6
xorl %eax, %eax
cmpq $0x0, 0x10(%rbx)
je 0x4fa4
xorl %r12d, %r12d
movq 0x28(%rbx), %rax
movq (%rax,%r12,8), %rbp
movq 0x8(%rbp), %r15
movb 0x1c(%r15), %al
andb $0xc, %al
cmpb $0x8, %al
jne 0x4f93
movq (%rbp), %r13
movq 0x10(%r13), %rsi
movq %r15, %rdi
callq 0x8725
movq %rax, %r14
movq 0x8(%rax), %rsi
movl 0x8(%r13), %eax
leal -0x110(%rax), %ecx
cmpl $0x3, %ecx
ja 0x4f30
leaq 0xf71d(%rip), %rdx      # 0x14630
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
testq %rsi, %rsi
je 0x4f93
movq 0x20(%r13), %rdi
callq 0x102c6
testl %eax, %eax
jne 0x4f93
jmp 0x4f84
cmpl $0x120, %eax            # imm = 0x120
je 0x4f52
cmpl $0x121, %eax            # imm = 0x121
jne 0x4f93
testq %rsi, %rsi
je 0x4f93
movq 0x20(%r13), %rdi
callq 0x102c6
testl %eax, %eax
jne 0x4f93
jmp 0x4f57
testq %rsi, %rsi
je 0x4f93
xorl %eax, %eax
jmp 0x4f88
testq %rsi, %rsi
jne 0x4f93
cmpq $0x0, (%r14)
jne 0x4f84
movq 0x10(%r13), %rdx
movq 0x18(%r13), %rcx
movq %r15, %rdi
movq %r14, %rsi
callq 0x8754
testl %eax, %eax
je 0x4f8c
jmp 0x4fe6
testq %rsi, %rsi
je 0x4f93
movq 0x18(%r13), %rax
movq %rax, 0x8(%r14)
movl $0x1, 0x18(%rbp)
incq %r12
cmpq 0x10(%rbx), %r12
jb 0x4ecc
movq 0x40(%rbx), %rax
testq %rax, %rax
je 0x4fc6
xorl %r14d, %r14d
movq 0x38(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x87ae
testl %eax, %eax
jne 0x4fe6
incq %r14
cmpq 0x40(%rbx), %r14
jb 0x4fac
movq 0x38(%rbx), %rdi
callq 0x2040
movq 0x18(%rbx), %rdi
leaq 0x1db(%rip), %rsi       # 0x51b5
movq %rbx, %rdx
callq 0x623c
testl %eax, %eax
je 0x4ffc
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
jmp 0x4feb
leaq 0xf649(%rip), %rdi      # 0x14650
leaq 0xf668(%rip), %rsi      # 0x14676
leaq 0xf67a(%rip), %rcx      # 0x1468f
movl $0x88, %edx
callq 0x21c0