// File: /workspace/github_c_makefile_star2_O1/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 $0x58, %rsp
movq %rdx, -0x78(%rbp)
movq %rsi, -0x70(%rbp)
movq %rdi, %rbx
leaq 0x10128(%rdi), %rax
movq %rax, -0x30(%rbp)
movq -0x70(%rbp), %rax
movq (%rax), %rax
movb 0x50(%rbx), %cl
rolq %cl, %rax
movq 0x68(%rbx), %rcx
leaq -0x1(%rcx), %rdx
movq 0x60(%rbx), %rsi
movq $-0x1, %r15
movq $-0x1, %r14
movq %rcx, %rdi
movq -0x30(%rbp), %r11
cmpq %rsi, %rdi
jb 0xcf6a
bzhiq %rdi, %rax, %r9
movq %rdi, %r8
shlq $0x5, %r8
movq 0x8(%r11,%r8), %r8
cmpq %r9, (%r8)
jbe 0xcf39
movq %r9, %r10
shrq $0x6, %r10
movq 0x10(%r8,%r10,8), %r8
btq %r9, %r8
setb %r8b
jmp 0xcf3c
xorl %r8d, %r8d
testb %r8b, %r8b
je 0xcf49
movq %rdi, %r15
movq %r9, %r14
jmp 0xcf65
cmpq %rcx, %rdi
jae 0xcf53
decq %rdi
jmp 0xcf65
movq %rdx, %r9
cmpq 0x58(%rbx), %rdi
je 0xcf62
incq %rdi
movq %rdi, %r9
movq %r9, %rdi
testb %r8b, %r8b
je 0xcf08
movq %r15, -0x38(%rbp)
shlq $0x5, %r15
movq (%r11,%r15), %r12
movq %r14, -0x48(%rbp)
shlq $0x6, %r14
cmpq $0x10000, (%r12,%r14)   # imm = 0x10000
jae 0xcf8f
movb $0x1, %al
xorl %r13d, %r13d
jmp 0xcfc1
leaq (%r12,%r14), %rcx
addq $0x8, %rcx
xorl %r13d, %r13d
movq %r13, %rax
cmpq $0x7, %r13
je 0xcfb3
leaq 0x1(%rax), %r13
cmpq $0x10000, (%rcx,%rax,8) # imm = 0x10000
jae 0xcf9a
jmp 0xcfba
movq $-0x1, %r13
cmpq $0x7, %rax
setb %al
testb %al, %al
jne 0xd325
movq -0x38(%rbp), %r12
cmpq -0x78(%rbp), %r12
jae 0xd390
cmpq $0x40, %r12
jae 0xd2c9
movl $0x1, %eax
shlxq %r12, %rax, %r13
cmpq -0x48(%rbp), %r13
jbe 0xd2d7
addq %r11, %r15
cmpq $0x0, (%r15)
je 0xd2e5
cmpq $0x0, 0x8(%r15)
je 0xd2f3
leaq 0x1(%r12), %r8
movq %r8, %r12
shlq $0x5, %r12
addq %r11, %r12
cmpq $0x0, (%r12)
jne 0xd11e
movl $0x1, %eax
movq %r8, -0x68(%rbp)
shlxq %r8, %rax, %rax
movq %rax, -0x40(%rbp)
addq $0x3f, %rax
shrq $0x6, %rax
leaq 0x10(,%rax,8), %rsi
movl $0x1, %edi
callq 0x62d0
movq -0x40(%rbp), %rcx
movq %rcx, (%rax)
xorl %ecx, %ecx
movq %rax, -0x40(%rbp)
xchgq %rcx, 0x8(%rax)
movq $0x0, -0x50(%rbp)
movq -0x38(%rbp), %rax
addl $-0x5, %eax
movl $0x1000, %ecx           # imm = 0x1000
shlxq %rax, %rcx, %rdi
movl $0x1, %esi
leaq -0x50(%rbp), %rdx
callq 0x831a
movq %rax, -0x58(%rbp)
testq %rax, %rax
je 0xd311
leaq 0x100e8(%rbx), %rdi
movq %rdi, -0x60(%rbp)
callq 0x6050
cmpl $0x23, %eax
je 0xd3a1
cmpq $0x0, (%r12)
je 0xd0d9
movq -0x60(%rbp), %rdi
callq 0x6320
movq -0x40(%rbp), %rdi
callq 0x6060
movq -0x50(%rbp), %rsi
movq -0x58(%rbp), %rdi
callq 0x6410
jmp 0xd11a
movq -0x40(%rbp), %rax
movq %rax, 0x8(%r12)
movq -0x58(%rbp), %rax
movq %rax, (%r12)
movq -0x50(%rbp), %rax
movq %rax, 0x10(%r12)
mfence
movq 0x58(%rbx), %rax
cmpq -0x68(%rbp), %rax
jae 0xd10e
cmpq -0x38(%rbp), %rax
jne 0xd31b
incq 0x58(%rbx)
mfence
movq -0x60(%rbp), %rdi
callq 0x6320
movq -0x68(%rbp), %r8
movq 0x8(%r12), %rax
movq -0x48(%rbp), %rdi
cmpq %rdi, (%rax)
jbe 0xd155
movq %rdi, %rcx
shrq $0x6, %rcx
movq 0x10(%rax,%rcx,8), %rdx
btq %rdi, %rdx
jb 0xd155
movl $0x1, %esi
shlxq %rdi, %rsi, %rsi
orq %rsi, %rdx
movq %rdx, 0x10(%rax,%rcx,8)
lock
incq 0x8(%rax)
orq %rdi, %r13
movq 0x8(%r12), %rax
cmpq %r13, (%rax)
jbe 0xd18b
movq %r13, %rcx
shrq $0x6, %rcx
movq 0x10(%rax,%rcx,8), %rdx
btq %r13, %rdx
jb 0xd18b
movl $0x1, %esi
shlxq %r13, %rsi, %rsi
orq %rsi, %rdx
movq %rdx, 0x10(%rax,%rcx,8)
lock
incq 0x8(%rax)
cmpq %r8, 0x58(%rbx)
jb 0xd301
movq $-0x1, %rax
shlxq %r8, %rax, %rax
notq %rax
xorl %edx, %edx
movq (%r15), %rcx
addq %r14, %rcx
movq (%rcx,%rdx,8), %rsi
cmpq $0x10000, %rsi          # imm = 0x10000
jb 0xd1ff
movq %rsi, %rcx
shrq $0x10, %rcx
movq (%rcx), %rdi
movb 0x50(%rbx), %cl
rolq %cl, %rdi
andq %rax, %rdi
shlq $0x6, %rdi
addq (%r12), %rdi
movq %rsi, (%rdi,%rdx,8)
movq (%r15), %rcx
addq %r14, %rcx
movzwl (%rcx,%rdx,8), %esi
movq %rsi, (%rcx,%rdx,8)
movq (%r15), %rcx
addq %r14, %rcx
andq $-0x10000, (%rcx,%rdx,8) # imm = 0xFFFF0000
lock
incq 0x18(%r12)
lock
decq 0x18(%r15)
incq %rdx
cmpq $0x8, %rdx
jne 0xd1a6
leaq 0x100e8(%rbx), %r13
movq %r13, %rdi
callq 0x6050
cmpl $0x23, %eax
je 0xd3a1
movq -0x38(%rbp), %rax
cmpq %rax, 0x68(%rbx)
movq -0x48(%rbp), %rdi
jne 0xd243
movq 0x18(%r12), %rax
movq 0x18(%r15), %rcx
addq %rcx, %rcx
cmpq %rcx, %rax
jb 0xd243
incq 0x68(%rbx)
movq 0x8(%r15), %rax
cmpq %rdi, (%rax)
jbe 0xd277
movq %rdi, %rcx
shrq $0x6, %rcx
movq 0x10(%rax,%rcx,8), %rdx
btq %rdi, %rdx
jae 0xd277
movl $0x1, %esi
shlxq %rdi, %rsi, %rsi
andnq %rdx, %rsi, %rdx
movq %rdx, 0x10(%rax,%rcx,8)
lock
decq 0x8(%rax)
movq 0x8(%r15), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
movq -0x38(%rbp), %rcx
jne 0xd2a4
movq 0x60(%rbx), %rax
cmpq %rcx, %rax
jne 0xd2a4
movq (%r15), %r12
movq $0x0, (%r15)
incq %rax
movq %rax, 0x60(%rbx)
jmp 0xd2a7
xorl %r12d, %r12d
movq %r13, %rdi
callq 0x6320
testq %r12, %r12
je 0xceda
movq 0x10(%r15), %rsi
movq %r12, %rdi
callq 0x6410
jmp 0xceda
callq 0x66ef
movq -0x30(%rbp), %r11
jmp 0xcfe1
callq 0x66ef
movq -0x30(%rbp), %r11
jmp 0xcff5
callq 0x66ef
movq -0x30(%rbp), %r11
jmp 0xd002
callq 0x66ef
movq -0x30(%rbp), %r11
jmp 0xd00d
movq %r8, %r13
callq 0x66ef
movq %r13, %r8
jmp 0xd195
callq 0x66ef
jmp 0xd098
callq 0x66ef
jmp 0xd10a
addq %r14, %r12
movq (%r12,%r13,8), %rdi
cmpq $0x10000, %rdi          # imm = 0x10000
jb 0xd34c
movq 0x10(%rbx), %rax
testq %rax, %rax
je 0xd34c
shrq $0x10, %rdi
movq 0x18(%rbx), %rsi
callq *%rax
movq -0x30(%rbp), %r11
movzwl (%r12,%r13,8), %eax
movq -0x70(%rbp), %rcx
movq %rcx, %rdx
shlq $0x10, %rdx
orq %rdx, %rax
movq %rax, (%r12,%r13,8)
movq (%rcx), %rax
movb 0x50(%rbx), %cl
rolq %cl, %rax
movq %rax, %rcx
shrq $0x20, %rcx
xorl %eax, %ecx
movl %ecx, %eax
shrl $0x10, %eax
xorl %ecx, %eax
movzwl %ax, %eax
orq %rdx, %rax
movq %rax, (%r12,%r13,8)
lock
incq 0x18(%r11,%r15)
movb $0x1, %al
jmp 0xd392
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %edi, %edi
callq 0x6530