// File: /workspace/github_c_makefile_star2_O1/wuxb45[P]SLB/lib1.c
// Function: skiplist_get
struct kv *
skiplist_get(struct skiplist * const list, const struct kv * const key, struct kv * const out)
{
  u64 i = list->height - 1;
  struct skipnode * left = &(list->n0);
  struct skipnode * right = NULL;
  while (i) {
    while (left->next[i]) {
      right = left->next[i];
      struct kv * const curr = __u64_to_ptr(right->e.ptr);
      debug_assert(curr);
      const int cmp = list->comp(key, curr);
      if (cmp == 0) {
        if (list->mm.hf) list->mm.hf(curr, list->mm.hp);
        struct kv * const ret = kv_dup2(curr, out);
        return ret;
      } else if (cmp < 0) {
        break;
      } else {
        left = right;
      }
    }
    i--;
  }
  const u64 pkey = kvmap_pkey(key->hash);
  if (left) left = left->next[0];
  while (left && (left != right)) {
    struct kv * const curr = __u64_to_ptr(left->e.ptr);
    if (kvmap_pkey(curr->hash) == pkey) {
      if (kv_keymatch(curr, key)) {
        if (list->mm.hf) list->mm.hf(curr, list->mm.hp);
        struct kv * const ret = kv_dup2(curr, out);
        return ret;
      }
    }
    left = left->next[0];
  }
  return NULL;
}

// 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, -0x40(%rbp)
movq 0x258(%rdi), %rsi
leaq 0x260(%rdi), %rdx
decq %rsi
movq %rdi, -0x30(%rbp)
je 0xef21
movq %rdi, %r14
movq $0x0, -0x48(%rbp)
movq 0x8(%rdx,%rsi,8), %rax
testq %rax, %rax
movq %rsi, -0x58(%rbp)
je 0xef03
movq %rdx, %r15
movq %rax, -0x48(%rbp)
movq (%rax), %r12
cmpq $0xffff, %r12           # imm = 0xFFFF
jbe 0xeeeb
movq %r12, %rbx
shrq $0x10, %rbx
movq -0x40(%rbp), %rdi
movq %rbx, %rsi
callq *0x50(%r14)
testl %eax, %eax
je 0xee52
movl %eax, %r13d
movq %r15, %rdx
js 0xee41
movq -0x48(%rbp), %rdx
sarl $0x1f, %r13d
andl $0x5, %r13d
movq -0x30(%rbp), %r14
jmp 0xeed2
movq 0x20(%r14), %rax
testq %rax, %rax
je 0xee68
movq 0x28(%r14), %rsi
movq %rbx, %rdi
callq *%rax
movq -0x30(%rbp), %r14
movl $0x1, %r13d
cmpq $0x10000, %r12          # imm = 0x10000
jae 0xee81
movq $0x0, -0x38(%rbp)
jmp 0xeecf
movl 0x8(%rbx), %eax
movl 0xc(%rbx), %ecx
leaq (%rax,%rcx), %r12
addq $0x10, %r12
movq -0x50(%rbp), %r14
testq %r14, %r14
je 0xeeac
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x6340
movq %r14, -0x38(%rbp)
jmp 0xeecb
movq %r12, %rdi
callq 0x63a0
testq %rax, %rax
movq %rax, -0x38(%rbp)
je 0xeecb
movq %rax, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x6340
movq -0x30(%rbp), %r14
movq %r15, %rdx
testl %r13d, %r13d
jne 0xeef9
movq -0x58(%rbp), %rsi
movq 0x8(%rdx,%rsi,8), %rax
testq %rax, %rax
jne 0xee08
jmp 0xef03
callq 0x66ef
movq -0x30(%rbp), %r14
jmp 0xee1f
cmpl $0x5, %r13d
jne 0xef0e
movq -0x58(%rbp), %rsi
decq %rsi
jne 0xedf6
jmp 0xef29
movq -0x38(%rbp), %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq $0x0, -0x48(%rbp)
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq %rax, %r15
shrq $0x20, %r15
xorq %rax, %r15
testq %rdx, %rdx
je 0xef45
movq 0x8(%rdx), %r12
jmp 0xef48
xorl %r12d, %r12d
movq -0x40(%rbp), %rax
leaq 0x10(%rax), %r14
testq %r12, %r12
je 0xf02b
movl $0x0, %eax
cmpq -0x48(%rbp), %r12
je 0xef12
movq (%r12), %r13
shrq $0x10, %r13
movq (%r13), %rax
movq %rax, %rcx
shrq $0x20, %rcx
xorl %eax, %ecx
movl %ecx, %edx
xorl %r15d, %edx
shrl $0x10, %edx
xorl %r15d, %edx
xorw %cx, %dx
jne 0xefaf
movq -0x40(%rbp), %rcx
cmpq (%rcx), %rax
jne 0xefaf
movl 0x8(%r13), %edx
movq -0x40(%rbp), %rax
cmpl 0x8(%rax), %edx
jne 0xefaf
leaq 0x10(%r13), %rdi
movq %r14, %rsi
callq 0x63d0
testl %eax, %eax
je 0xefc3
movq 0x8(%r12), %r12
movb $0x1, %cl
movq -0x38(%rbp), %rax
testb %cl, %cl
jne 0xef50
jmp 0xef12
movq -0x30(%rbp), %rcx
movq 0x20(%rcx), %rax
testq %rax, %rax
je 0xefd9
movq 0x28(%rcx), %rsi
movq %r13, %rdi
callq *%rax
movl 0x8(%r13), %eax
movl 0xc(%r13), %ecx
leaq (%rax,%rcx), %rdx
addq $0x10, %rdx
movq -0x50(%rbp), %rbx
testq %rbx, %rbx
je 0xf005
movq %rbx, %rdi
movq %r13, %rsi
callq 0x6340
xorl %ecx, %ecx
movq %rbx, -0x38(%rbp)
jmp 0xefb6
movq %rdx, %rbx
movq %rdx, %rdi
callq 0x63a0
testq %rax, %rax
movq %rax, -0x38(%rbp)
je 0xf027
movq %rax, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x6340
xorl %ecx, %ecx
jmp 0xefb6
xorl %eax, %eax
jmp 0xef12