// File: /workspace/github_c_makefile_star2_O3/wuxb45[P]SLB/lib1.c
// Function: bptree_set
bool
bptree_set(struct bptree * const tree, const struct kv * const kv0)
{
  const struct kv * const kv = kv_alloc_dup(kv0, &(tree->mm));
  if (kv == NULL) return false;

  if ((tree->root->leaf) && (tree->root->nr == BPTREE_LEAF_FO)) {
    bptree_split_root_leaf(tree);
  }
  if (tree->root->leaf) {
    return bptree_set_leaf(tree, tree->root, kv);
  }
  // intm
  if (tree->root->nr == BPTREE_INTM_FO) {
    bptree_split_root_intm(tree);
  }
  const u64 subidx = bptree_intm_locate(tree->root, kv);
  return bptree_set_rec(tree, tree->root, subidx, kv);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %r12
movq 0x8(%rdi), %rsi
movl 0x8(%r14), %eax
movl 0xc(%r14), %ecx
leaq (%rax,%rcx), %r15
addq $0x10, %r15
movq %r15, %rdi
callq *(%r12)
movq %rax, %rbx
testq %rax, %rax
je 0x10584
movq %rbx, -0x38(%rbp)
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x6340
movq 0x50(%r12), %rbx
movb (%rbx), %al
cmpb $0x1, %al
jne 0x1057b
cmpq $0x1f4, 0x8(%rbx)       # imm = 0x1F4
jne 0x1057b
movq %r12, -0x48(%rbp)
xorl %r14d, %r14d
movl $0x1000, %esi           # imm = 0x1000
xorl %edi, %edi
movl $0x3, %edx
movl $0x2022, %ecx           # imm = 0x2022
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
xorl %r9d, %r9d
callq 0x6190
cmpq $-0x1, %rax
cmoveq %r14, %rax
movb $0x1, (%rax)
movq %rbx, %rdi
movq %rax, -0x40(%rbp)
movq %rax, %rsi
callq 0x102c3
movl $0x1000, %esi           # imm = 0x1000
xorl %edi, %edi
movl $0x3, %edx
movl $0x2022, %ecx           # imm = 0x2022
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
xorl %r9d, %r9d
callq 0x6190
movq %rax, %r13
cmpq $-0x1, %rax
movq %rax, -0x50(%rbp)
cmoveq %r14, %r13
movb $0x0, (%r13)
movq %rbx, -0x30(%rbp)
movq 0x20(%rbx), %rbx
testq %rbx, %rbx
movq -0x38(%rbp), %r15
je 0x105a1
movl 0x8(%rbx), %r12d
addq $0x10, %r12
movq %r12, %rdi
callq 0x63a0
testq %rax, %rax
je 0x1059e
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x6340
jmp 0x105a1
movq -0x38(%rbp), %r15
jmp 0x10612
callq 0x66ef
xorl %edi, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x6340
movq %rbx, %r15
jmp 0x108f5
xorl %r14d, %r14d
xorl %r12d, %r12d
movq %r13, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq -0x30(%rbp), %rcx
callq 0x13b0c
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rbx
testq %rbx, %rbx
je 0x105ed
movl 0x8(%rbx), %r14d
addq $0x10, %r14
movq %r14, %rdi
callq 0x63a0
testq %rax, %rax
je 0x105ea
movq %rax, %r12
movq %rax, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x6340
jmp 0x105ed
xorl %r12d, %r12d
movl $0x1, %esi
movq %r13, %rdi
movq %r12, %rdx
movq -0x40(%rbp), %rcx
callq 0x13b0c
movq -0x48(%rbp), %r12
movq %r13, 0x50(%r12)
movb (%r13), %al
movq -0x50(%rbp), %rbx
testb $0x1, %al
je 0x10621
movq %r12, %rdi
movq %rbx, %rsi
jmp 0x108ed
cmpq $0xfa, 0x8(%rbx)
movq %r12, -0x48(%rbp)
jne 0x10745
xorl %r14d, %r14d
movl $0x1000, %esi           # imm = 0x1000
xorl %edi, %edi
movl $0x3, %edx
movl $0x2022, %ecx           # imm = 0x2022
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
xorl %r9d, %r9d
callq 0x6190
cmpq $-0x1, %rax
cmoveq %r14, %rax
movb %r14b, (%rax)
movq %rbx, %rdi
movq %rax, -0x40(%rbp)
movq %rax, %rsi
callq 0x1038d
movl $0x1000, %esi           # imm = 0x1000
xorl %edi, %edi
movl $0x3, %edx
movl $0x2022, %ecx           # imm = 0x2022
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
xorl %r9d, %r9d
callq 0x6190
movq %rax, %r13
cmpq $-0x1, %rax
movq %rax, -0x50(%rbp)
cmoveq %r14, %r13
movb %r14b, (%r13)
movq %rbx, -0x30(%rbp)
movq 0x20(%rbx), %rbx
testq %rbx, %rbx
je 0x106d9
movl 0x8(%rbx), %r12d
addq $0x10, %r12
movq %r12, %rdi
callq 0x63a0
testq %rax, %rax
je 0x106d6
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x6340
jmp 0x106d9
xorl %r14d, %r14d
xorl %r12d, %r12d
movq %r13, %rdi
xorl %esi, %esi
movq %r14, %rdx
movq -0x30(%rbp), %rcx
callq 0x13b0c
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rbx
testq %rbx, %rbx
je 0x10725
movl 0x8(%rbx), %r14d
addq $0x10, %r14
movq %r14, %rdi
callq 0x63a0
testq %rax, %rax
je 0x10722
movq %rax, %r12
movq %rax, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x6340
jmp 0x10725
xorl %r12d, %r12d
movl $0x1, %esi
movq %r13, %rdi
movq %r12, %rdx
movq -0x40(%rbp), %rcx
callq 0x13b0c
movq -0x48(%rbp), %rax
movq %r13, 0x50(%rax)
movq -0x50(%rbp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x10a4e
movq %rax, %r12
leaq 0x20(%rbx), %rax
movq %rax, -0x40(%rbp)
movq %rbx, -0x30(%rbp)
cmpb $0x0, (%rbx)
jne 0x108ac
movq %r12, %rax
shlq $0x4, %rax
movq -0x40(%rbp), %rcx
leaq (%rcx,%rax), %rbx
addq $0x8, %rbx
movq (%rbx), %r13
movq 0x8(%r13), %rax
cmpb $0x1, (%r13)
jne 0x107e7
cmpq $0x1f4, %rax            # imm = 0x1F4
jne 0x108e6
movq -0x30(%rbp), %rax
cmpq $0xfa, 0x8(%rax)
jae 0x108b6
movl $0x1000, %esi           # imm = 0x1000
xorl %edi, %edi
movl $0x3, %edx
movl $0x2022, %ecx           # imm = 0x2022
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
xorl %r9d, %r9d
callq 0x6190
movq %rax, %r14
cmpq $-0x1, %rax
movl $0x0, %eax
cmoveq %rax, %r14
movb $0x1, (%r14)
movq %r13, %rdi
movq %r14, %rsi
callq 0x102c3
jmp 0x10843
cmpq $0xfa, %rax
jne 0x108d0
movq -0x30(%rbp), %rax
cmpq $0xfa, 0x8(%rax)
jae 0x108c3
movl $0x1000, %esi           # imm = 0x1000
xorl %edi, %edi
movl $0x3, %edx
movl $0x2022, %ecx           # imm = 0x2022
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
xorl %r9d, %r9d
callq 0x6190
movq %rax, %r14
cmpq $-0x1, %rax
movl $0x0, %eax
cmoveq %rax, %r14
movb $0x0, (%r14)
movq %r13, %rdi
movq %r14, %rsi
callq 0x1038d
movq 0x20(%r14), %rbx
movl $0x0, %r13d
testq %rbx, %rbx
je 0x10881
movl 0x8(%rbx), %r15d
addq $0x10, %r15
movq %r15, %rdi
callq 0x63a0
testq %rax, %rax
je 0x1087a
movq %rax, %r13
movq %rax, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x6340
jmp 0x1087d
xorl %r13d, %r13d
movq -0x38(%rbp), %r15
incq %r12
movq -0x30(%rbp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %r14, %rcx
callq 0x13b0c
movq %rbx, %rdi
movq %r15, %rsi
callq 0x10a4e
movq %rax, %r12
jmp 0x1075f
callq 0x66ef
jmp 0x10768
callq 0x66ef
movq (%rbx), %r13
jmp 0x107a7
callq 0x66ef
movq (%rbx), %r13
jmp 0x10805
movq %r13, %rdi
movq %r15, %rsi
callq 0x10a4e
movq %rax, %r12
movq %r13, %rbx
jmp 0x10753
movq -0x48(%rbp), %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x1090a
testq %r15, %r15
setne %al
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq