// File: /workspace/github_c_makefile_star2_O1/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 $0x18, %rsp
movq %rsi, %r15
movq %rdi, %r14
movl 0x8(%rsi), %eax
movl 0xc(%rsi), %ecx
leaq (%rax,%rcx), %r12
addq $0x10, %r12
movq 0x8(%rdi), %rsi
movq %r12, %rdi
callq *(%r14)
movq %rax, %rbx
testq %rax, %rax
je 0x10afd
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x6340
testq %rbx, %rbx
je 0x10ae8
movq 0x50(%r14), %r12
cmpb $0x1, (%r12)
jne 0x10996
cmpq $0x1f4, 0x8(%r12)       # imm = 0x1F4
jne 0x10996
xorl %r15d, %r15d
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 %r15, %rax
movb $0x1, (%rax)
movq %r12, %rdi
movq %rax, -0x38(%rbp)
movq %rax, %rsi
callq 0x1067b
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
xorl %edx, %edx
movq %rax, %r13
cmpq $-0x1, %rax
cmoveq %rdx, %r13
movb $0x0, (%r13)
movq 0x20(%r12), %rax
testq %rax, %rax
je 0x10934
movq %rax, -0x30(%rbp)
movl 0x8(%rax), %r15d
addq $0x10, %r15
movq %r15, %rdi
callq 0x63a0
movq %rax, %rdx
testq %rax, %rax
je 0x10934
movq %rdx, %rdi
movq -0x30(%rbp), %rsi
movq %rdx, -0x30(%rbp)
movq %r15, %rdx
callq 0x6340
movq -0x30(%rbp), %rdx
movq $0x0, -0x30(%rbp)
movq %r13, %rdi
xorl %esi, %esi
movq %r12, %rcx
callq 0x14067
movq -0x38(%rbp), %rax
movq 0x20(%rax), %r15
testq %r15, %r15
je 0x1097d
movl 0x8(%r15), %r12d
addq $0x10, %r12
movq %r12, %rdi
callq 0x63a0
testq %rax, %rax
movq %rax, -0x30(%rbp)
je 0x1097d
movq %rax, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x6340
movl $0x1, %esi
movq %r13, %rdi
movq -0x30(%rbp), %rdx
movq -0x38(%rbp), %rcx
callq 0x14067
movq %r13, 0x50(%r14)
movq 0x50(%r14), %r12
cmpb $0x1, (%r12)
jne 0x109b4
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x10b07
jmp 0x10ae8
cmpq $0xfa, 0x8(%r12)
jne 0x10ac8
xorl %r15d, %r15d
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 %r15, %rax
movb %r15b, (%rax)
movq %r12, %rdi
movq %rax, -0x38(%rbp)
movq %rax, %rsi
callq 0x10745
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
cmoveq %r15, %r13
movb %r15b, (%r13)
movq 0x20(%r12), %rax
testq %rax, %rax
je 0x10a63
movq %rax, -0x30(%rbp)
movl 0x8(%rax), %edi
addq $0x10, %rdi
movq %rdi, -0x40(%rbp)
callq 0x63a0
movq %rax, %r15
testq %rax, %rax
je 0x10a63
movq %r15, %rdi
movq -0x30(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x6340
movq $0x0, -0x30(%rbp)
movq %r13, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %r12, %rcx
callq 0x14067
movq -0x38(%rbp), %rax
movq 0x20(%rax), %r15
testq %r15, %r15
je 0x10aaf
movl 0x8(%r15), %r12d
addq $0x10, %r12
movq %r12, %rdi
callq 0x63a0
testq %rax, %rax
movq %rax, -0x30(%rbp)
je 0x10aaf
movq %rax, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x6340
movl $0x1, %esi
movq %r13, %rdi
movq -0x30(%rbp), %rdx
movq -0x38(%rbp), %rcx
callq 0x14067
movq %r13, 0x50(%r14)
movq 0x50(%r14), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x10c50
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
movq %rbx, %rcx
callq 0x10cde
testq %rbx, %rbx
setne %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x66ef
jmp 0x10855