// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: ucache_get
struct kv *
ucache_get(struct icache * const cache, const struct kv * const key, struct kv * const out)
{
  const u64 hash = key->hash;
  const u64 idx = (hash >> KVMAP_BASE_LEVEL) % cache->nr_slots;
  struct __icache_slot * const slot = &(cache->table[idx]);
  __builtin_prefetch(slot, 0, 3);
  const u64 pkey = kvmap_pkey(hash);
  for (u64 i = 0; i < ICACHE_ENTRY_NR; i++) {
    if (slot->e[i].pkey == pkey) {
      struct kv * const curr = __u64_to_ptr(slot->e[i].ptr);
      if (kv_keymatch(curr, key)) {
        icache_amap_inc(slot, i);
        struct kv * const ret = kv_dup2(curr, out);
        // cache hit
        return ret;
      }
    }
  }
  struct kv * const ret2 = cache->map_api->get(cache->map_api->map, key, out);
  return ret2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, -0x50(%rbp)
movq (%rsi), %rax
movq %rax, %rcx
shrq $0x20, %rcx
xorq %rax, %rcx
shrq $0x6, %rax
xorl %edx, %edx
divq 0x10120(%rdi)
xorl %ebx, %ebx
movq %rdi, -0x58(%rbp)
movq 0x10130(%rdi), %rax
shlq $0x6, %rdx
leaq (%rax,%rdx), %rdi
prefetcht0 (%rax,%rdx)
movq %rcx, %r8
shrq $0x10, %r8
xorq %rcx, %r8
leaq 0x10(%rsi), %rax
movq %rax, -0x60(%rbp)
xorl %r15d, %r15d
xorl %r13d, %r13d
movq %rsi, -0x48(%rbp)
movq %rdi, -0x40(%rbp)
movq %r8, -0x38(%rbp)
movq 0x8(%rdi,%r13,8), %r12
movl %r8d, %eax
xorw %r12w, %ax
jne 0x12453
movq %r12, %r14
shrq $0x10, %r14
cmpq $0x10000, %r12          # imm = 0x10000
jb 0x1238a
movq (%r14), %rax
cmpq (%rsi), %rax
jne 0x1238a
movl 0x8(%r14), %edx
cmpl 0x8(%rsi), %edx
jne 0x1238a
leaq 0x10(%r14), %rdi
movq -0x60(%rbp), %rsi
movq %rcx, -0x30(%rbp)
callq 0x63d0
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %r8
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
testl %eax, %eax
sete %r9b
jmp 0x1238d
xorl %r9d, %r9d
testb %r9b, %r9b
je 0x1244e
movq (%rdi), %rax
movq %rax, %rcx
movabsq $0xfffffffffffffff, %rdx # imm = 0xFFFFFFFFFFFFFFF
andq %rdx, %rcx
shrxq %rbx, %rcx, %rcx
notl %ecx
testb $0xf, %cl
je 0x123d8
movl $0x1, %ecx
shlxq %rbx, %rcx, %rcx
addq %rax, %rcx
andq %rdx, %rcx
movabsq $-0x1000000000000000, %rdx # imm = 0xF000000000000000
andq %rdx, %rax
orq %rcx, %rax
movq %rax, (%rdi)
cmpq $0x10000, %r12          # imm = 0x10000
jae 0x123e5
xorl %ecx, %ecx
jmp 0x1244e
movl 0x8(%r14), %eax
movl 0xc(%r14), %ecx
leaq (%rax,%rcx), %rdx
addq $0x10, %rdx
movq -0x50(%rbp), %rax
movq %rax, %rcx
testq %rax, %rax
jne 0x1242b
movq %rdx, %rdi
movl %r9d, -0x30(%rbp)
movq %rdx, %r12
callq 0x63a0
movq %r12, %rdx
movl -0x30(%rbp), %r9d
movq -0x38(%rbp), %r8
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq %rax, %rcx
testq %rax, %rax
je 0x1244e
movq %rcx, %rdi
movq %r14, %rsi
movq %rcx, %r14
movl %r9d, %r12d
callq 0x6340
movl %r12d, %r9d
movq %r14, %rcx
movq -0x38(%rbp), %r8
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
testb %r9b, %r9b
jne 0x12470
cmpq $0x6, %r13
leaq 0x1(%r13), %rax
setae %r15b
addq $0x4, %rbx
movq %rax, %r13
cmpq $0x7, %rax
jne 0x1232e
testb $0x1, %r15b
je 0x1249c
movq -0x58(%rbp), %rax
movq 0x10150(%rax), %rax
movq (%rax), %rdi
movq 0x8(%rax), %rax
movq -0x50(%rbp), %rdx
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
movq %rcx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq