// File: /workspace/github_c_makefile_star2_O2/wuxb45[P]SLB/lib1.c
// Function: kvmap1_insert
static bool
kvmap1_insert(struct kvmap1 * const map, const struct kv * const kv, const u64 max_level)
{
  u64 i = UINT64_MAX;
  u64 j = UINT64_MAX;
  u64 k = UINT64_MAX;
  if (kvmap1_locate_free_entry(map, kv, &i, &j, &k)) {
    // has free entry, just insert
    struct __kvmap_entry * const e = &(map->levels[i].table[j].e[k]);
    kvmap1_put_entry(map, e, kv);
    //(void)atomic_fetch_add(&(map->nr_kv), 1);
    (void)atomic_fetch_add(&(map->levels[i].nr_kv), 1);
    return true;
  } else if (i < max_level) {
    kvmap1_split(map, i, j);
    return kvmap1_insert(map, kv, max_level);
  } else {
    return false;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
leaq -0x88(%rbp), %r12
orq $-0x1, (%r12)
leaq -0x80(%rbp), %r13
orq $-0x1, (%r13)
movq %rdx, -0x68(%rbp)
movq %rdi, %r14
movq %rsi, -0x60(%rbp)
movq (%rsi), %rsi
movb 0x50(%rdi), %cl
rolq %cl, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x10795
leaq 0x10128(%r14), %rbx
movq (%r12), %r12
movq %r12, -0x38(%rbp)
shlq $0x5, %r12
leaq (%r14,%r12), %r15
addq $0x10128, %r15          # imm = 0x10128
movq (%r13), %rcx
movq %rcx, %r13
shlq $0x6, %r13
movq (%r15), %rsi
addq %r13, %rsi
xorl %eax, %eax
cmpq $0x40, %rax
je 0xbb81
cmpq $0x10000, (%rsi,%rax)   # imm = 0x10000
jb 0xbc84
addq $0x8, %rax
jmp 0xbb67
movq -0x38(%rbp), %r12
cmpq -0x68(%rbp), %r12
jae 0xbc9d
cmpq $0x40, %r12
movq %rcx, -0x30(%rbp)
jb 0xbba2
callq 0x6e43
movq -0x30(%rbp), %rcx
pushq $0x1
popq %rax
shlxq %r12, %rax, %rax
movq %rax, -0x78(%rbp)
cmpq %rcx, %rax
ja 0xbbbc
callq 0x6e43
movq -0x30(%rbp), %rcx
incq %r12
movq %r12, -0x58(%rbp)
shlq $0x5, %r12
cmpq $0x0, (%r15)
jne 0xbbd6
callq 0x6e43
movq -0x30(%rbp), %rcx
addq %r12, %rbx
cmpq $0x0, 0x8(%r15)
jne 0xbbe9
callq 0x6e43
movq -0x30(%rbp), %rcx
cmpq $0x0, (%rbx)
movq -0x38(%rbp), %r12
jne 0xbcf8
pushq $0x2
popq %rax
shlxq %r12, %rax, %rdi
callq 0x7306
movq %r12, %rcx
movq %rax, %r12
leaq -0x70(%rbp), %rdx
andq $0x0, (%rdx)
leal -0x5(%rcx), %eax
movl $0x1000, %ecx           # imm = 0x1000
shlxq %rax, %rcx, %rdi
pushq $0x1
popq %rsi
callq 0x7c29
movq %r12, -0x50(%rbp)
testq %r12, %r12
jne 0xbc3b
movq %rax, %r12
callq 0x6e43
movq %r12, %rax
movq %rax, -0x48(%rbp)
testq %rax, %rax
jne 0xbc49
callq 0x6e43
leaq 0x100e8(%r14), %rdi
movq %rdi, -0x40(%rbp)
callq 0x6afb
cmpq $0x0, (%rbx)
movq -0x38(%rbp), %r12
je 0xbcae
movq -0x40(%rbp), %rdi
callq 0x6320
movq -0x50(%rbp), %rdi
callq 0x6060
movq -0x70(%rbp), %rsi
movq -0x48(%rbp), %rdi
callq 0x6410
jmp 0xbcf4
addq %rax, %rsi
movq %r14, %rdi
movq -0x60(%rbp), %rdx
callq 0xba75
lock
incq 0x18(%rbx,%r12)
movb $0x1, %al
jmp 0xbc9f
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq -0x50(%rbp), %rax
movq %rax, 0x8(%rbx)
movq -0x48(%rbp), %rax
movq %rax, (%rbx)
movq -0x70(%rbp), %rax
movq %rax, 0x10(%rbx)
mfence
cmpq %r12, 0x58(%r14)
movq -0x40(%rbp), %rdi
ja 0xbcec
movq -0x58(%rbp), %rax
je 0xbce8
callq 0x6e43
movq -0x40(%rbp), %rdi
movq 0x58(%r14), %rax
incq %rax
movq %rax, 0x58(%r14)
mfence
callq 0x6320
movq -0x30(%rbp), %rcx
movq -0x78(%rbp), %r12
orq %rcx, %r12
movq 0x8(%rbx), %rdi
movq %rcx, %rsi
callq 0x7379
movq 0x8(%rbx), %rdi
movq %r12, %rsi
movq -0x38(%rbp), %r12
callq 0x7379
cmpq %r12, 0x58(%r14)
ja 0xbd26
callq 0x6e43
pushq $-0x2
popq %rax
shlxq %r12, %rax, %rax
notq %rax
xorl %edx, %edx
cmpq $0x8, %rdx
je 0xbd96
movq (%r15), %rcx
addq %r13, %rcx
movq (%rcx,%rdx,8), %rsi
cmpq $0x10000, %rsi          # imm = 0x10000
jb 0xbd91
movq %rsi, %rcx
shrq $0x10, %rcx
movq (%rcx), %rdi
movb 0x50(%r14), %cl
rolq %cl, %rdi
andq %rax, %rdi
shlq $0x6, %rdi
addq (%rbx), %rdi
movq %rsi, (%rdi,%rdx,8)
movq (%r15), %rcx
addq %r13, %rcx
movzwl (%rcx,%rdx,8), %esi
movq %rsi, (%rcx,%rdx,8)
movq (%r15), %rcx
addq %r13, %rcx
andq $-0x10000, (%rcx,%rdx,8) # imm = 0xFFFF0000
lock
incq 0x18(%rbx)
lock
decq 0x18(%r15)
incq %rdx
jmp 0xbd33
leaq 0x100e8(%r14), %r13
movq %r13, %rdi
callq 0x6afb
cmpq %r12, 0x68(%r14)
jne 0xbdbf
movq 0x18(%rbx), %rax
movq 0x18(%r15), %rcx
addq %rcx, %rcx
cmpq %rcx, %rax
jb 0xbdbf
incq 0x68(%r14)
movq 0x8(%r15), %rdi
movq -0x30(%rbp), %rsi
callq 0x73af
movq 0x8(%r15), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
jne 0xbdf0
cmpq %r12, 0x60(%r14)
jne 0xbdf0
movq (%r15), %r12
andq $0x0, (%r15)
movq -0x58(%rbp), %rax
movq %rax, 0x60(%r14)
jmp 0xbdf3
xorl %r12d, %r12d
movq %r13, %rdi
callq 0x6320
testq %r12, %r12
je 0xbe0c
movq 0x10(%r15), %rsi
movq %r12, %rdi
callq 0x6410
movq %r14, %rdi
movq -0x60(%rbp), %rsi
movq -0x68(%rbp), %rdx
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xbaf1