// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: cuckoo_try_set
static bool
cuckoo_try_set(struct cuckoo * const map, const struct kv * const kv)
{
  const u64 hash2[2] = {cuckoo_hash(kv, 0), cuckoo_hash(kv, 1), };
  const u64 pkey = kvmap_pkey(kv->hash);

  cuckoo_lock_two(map, kv);
  // try update
  for (u64 x = 0; x < 2; x++) {
    struct __kvmap_slot * const slot = cuckoo_hash_slot(map, hash2[x]);
    for (u64 k = 0; k < 8; k++) {
      if (slot->e[k].pkey == pkey) {
        const struct kv * const curr = __u64_to_ptr(slot->e[k].ptr);
        if (kv_keymatch(kv, curr)) {
          kvmap_put_entry(&(map->mm), &(slot->e[k]), kv);
          cuckoo_unlock_two(map, kv);
          return true;
        }
      }
    }
  }

  // cuckoo
  for (u64 depth = 0; depth < 3; depth++) {
    for (u64 x = 0; x < 2; x++) {
      if (cuckoo_cuckoo_depth(map, hash2[x], kv, depth)) {
        cuckoo_unlock_two(map, kv);
        return true;
      }
    }
  }
  cuckoo_unlock_two(map, kv);
  if (map->bm) cuckoo_expand(map);
  return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rax
movq %rax, -0x50(%rbp)
rorxq $0x2d, %rax, %rcx
movq %rcx, -0x48(%rbp)
movq %rax, %rcx
shrq $0x20, %rcx
xorq %rax, %rcx
movq %rcx, %r13
shrq $0x10, %r13
xorq %rcx, %r13
callq 0xe0a9
movq %r14, %r8
movq %rbx, -0x38(%rbp)
leaq 0x10118(%rbx), %rax
movq %rax, -0x40(%rbp)
leaq 0x10(%r14), %rax
movq %rax, -0x58(%rbp)
xorl %r15d, %r15d
movq %r14, -0x30(%rbp)
movq -0x50(%rbp,%r15,8), %rbx
movq -0x38(%rbp), %rax
movq 0x100d8(%rax), %rax
testq %rax, %rax
je 0xe4ad
movq %rbx, %rcx
shrq $0x6, %rcx
movl %ecx, %edx
andl $0x3ff, %edx            # imm = 0x3FF
cmpq %rdx, (%rax)
jbe 0xe4ad
shrl $0x6, %edx
shrxq %rcx, 0x10(%rax,%rdx,8), %rax
andl $0x1, %eax
jmp 0xe4af
xorl %eax, %eax
leaq (%rax,%rax,2), %r12
movq -0x40(%rbp), %rax
movq 0x10(%rax,%r12,8), %r14
cmpq $0x0, (%rax,%r12,8)
je 0xe535
leaq (%rax,%r12,8), %rax
bzhiq %r14, %rbx, %rbx
shlq $0x6, %rbx
addq (%rax), %rbx
xorl %r14d, %r14d
movq (%rbx,%r14,8), %r12
movl %r13d, %eax
xorw %r12w, %ax
jne 0xe51a
cmpq $0x10000, %r12          # imm = 0x10000
jb 0xe51a
shrq $0x10, %r12
movq (%r8), %rax
cmpq (%r12), %rax
jne 0xe51a
movl 0x8(%r8), %edx
cmpl 0x8(%r12), %edx
jne 0xe51a
leaq 0x10(%r12), %rsi
movq -0x58(%rbp), %rdi
callq 0x63d0
movq -0x30(%rbp), %r8
testl %eax, %eax
je 0xe547
incq %r14
cmpq $0x8, %r14
jne 0xe4d6
leaq 0x1(%r15), %rax
testq %r15, %r15
movq %rax, %r15
je 0xe475
jmp 0xe569
callq 0x66ef
movq -0x40(%rbp), %rax
movq -0x30(%rbp), %r8
jmp 0xe4c3
movq -0x38(%rbp), %r15
movq 0x40(%r15), %rax
testq %rax, %rax
je 0xe654
movq 0x48(%r15), %rdx
movq %r12, %rdi
movq %r8, %rsi
callq *%rax
jmp 0xe666
xorl %ebx, %ebx
xorl %r15d, %r15d
movq -0x38(%rbp), %r12
xorl %r14d, %r14d
movq -0x50(%rbp,%r14,8), %rsi
movq %r12, %rdi
movq %r8, %rdx
movq %r15, %rcx
callq 0x137f2
testb %al, %al
jne 0xe5af
incq %r14
cmpq $0x1, %r14
movq -0x30(%rbp), %r8
je 0xe575
cmpq $0x2, %r15
leaq 0x1(%r15), %rax
setae %bl
movq %rax, %r15
cmpq $0x3, %rax
jne 0xe572
jmp 0xe5cd
movq %r12, %rdi
movq -0x30(%rbp), %r14
movq %r14, %rsi
callq 0xe140
movq %r14, %r8
movb $0x1, %r15b
testb $0x1, %bl
je 0xe6a8
movq %r12, %rdi
movq %r8, %rsi
callq 0xe140
cmpq $0x0, 0x100d8(%r12)
je 0xe6ba
leaq 0x10050(%r12), %r14
movq %r14, %rdi
callq 0x6280
testl %eax, %eax
je 0xe611
cmpl $0xb, %eax
je 0xe60d
cmpl $0x10, %eax
jne 0xe6bf
xorl %ebx, %ebx
jmp 0xe613
movb $0x1, %al
jmp 0xe615
movb $0x1, %bl
xorl %eax, %eax
testb %al, %al
jne 0xe5ef
testb $0x1, %bl
je 0xe6ba
leaq 0x10090(%r12), %rdi
leaq 0x54a5(%rip), %rdx      # 0x13ad6
xorl %r15d, %r15d
xorl %esi, %esi
movq %r12, %rcx
callq 0x6430
movq 0x10090(%r12), %rdi
leaq 0x7170(%rip), %rsi      # 0x157bd
callq 0x61d0
jmp 0xe6a8
movq 0x10(%r15), %rax
testq %rax, %rax
je 0xe66a
movq 0x18(%r15), %rsi
movq %r12, %rdi
callq *%rax
movq -0x30(%rbp), %r8
movzwl (%rbx,%r14,8), %eax
movq %r8, %rcx
shlq $0x10, %rcx
orq %rcx, %rax
movq %rax, (%rbx,%r14,8)
movq (%r8), %rax
movq %rax, %rdx
shrq $0x20, %rdx
xorl %eax, %edx
movl %edx, %eax
shrl $0x10, %eax
xorl %edx, %eax
movzwl %ax, %eax
orq %rcx, %rax
movq %rax, (%rbx,%r14,8)
movq %r15, %rdi
movq %r8, %rsi
callq 0xe140
movb $0x1, %r15b
movl %r15d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r15d, %r15d
jmp 0xe6a8
xorl %edi, %edi
callq 0x6530