// File: /workspace/github_c_makefile_star2_O3/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 $0x28, %rsp
movq %rdx, -0x30(%rbp)
movq %rsi, -0x40(%rbp)
movq 0x258(%rdi), %r14
movq %rdi, -0x38(%rbp)
leaq 0x260(%rdi), %rbx
xorl %r13d, %r13d
decq %r14
je 0xecaf
movq 0x8(%rbx,%r14,8), %rax
testq %rax, %rax
je 0xebf3
movq %rax, %r13
movq (%rax), %r15
cmpq $0xffff, %r15           # imm = 0xFFFF
jbe 0xec3a
movq %r15, %r12
shrq $0x10, %r12
movq -0x40(%rbp), %rdi
movq %r12, %rsi
movq -0x38(%rbp), %rax
callq *0x50(%rax)
testl %eax, %eax
je 0xec41
js 0xebf3
movq 0x8(%r13,%r14,8), %rax
movq %r13, %rbx
jmp 0xec01
callq 0x66ef
jmp 0xec15
movq -0x38(%rbp), %rcx
movq 0x20(%rcx), %rax
testq %rax, %rax
je 0xec57
movq 0x28(%rcx), %rsi
movq %r12, %rdi
callq *%rax
cmpq $0x10000, %r15          # imm = 0x10000
jb 0xed3c
movl 0x8(%r12), %eax
movl 0xc(%r12), %ecx
leaq (%rax,%rcx), %rbx
addq $0x10, %rbx
cmpq $0x0, -0x30(%rbp)
jne 0xec92
movq %rbx, %rdi
callq 0x63a0
movq %rax, -0x30(%rbp)
testq %rax, %rax
je 0xed3c
movq -0x30(%rbp), %rdi
movq %r12, %rsi
movq %rbx, %rdx
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6340
movq 0x8(%rbx), %r14
testq %r14, %r14
je 0xed3c
cmpq %r13, %r14
je 0xed3c
movq -0x40(%rbp), %rax
movq (%rax), %rsi
movq %rsi, %r15
shrq $0x20, %r15
xorq %rsi, %r15
addq $0x10, %rax
movq %rax, -0x48(%rbp)
movq %rsi, -0x50(%rbp)
movq (%r14), %r12
shrq $0x10, %r12
movq (%r12), %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 0xed2e
cmpq %rsi, %rax
jne 0xed2e
movl 0x8(%r12), %ebx
movq -0x40(%rbp), %rax
cmpl 0x8(%rax), %ebx
jne 0xed2e
leaq 0x10(%r12), %rdi
movq -0x48(%rbp), %rsi
movq %rbx, %rdx
callq 0x63d0
movq -0x50(%rbp), %rsi
testl %eax, %eax
je 0xed4d
movq 0x8(%r14), %r14
testq %r14, %r14
je 0xed3c
cmpq %r13, %r14
jne 0xecde
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq -0x38(%rbp), %rcx
movq 0x20(%rcx), %rax
testq %rax, %rax
je 0xed68
movq 0x28(%rcx), %rsi
movq %r12, %rdi
callq *%rax
movl 0x8(%r12), %ebx
movl 0xc(%r12), %eax
addq %rax, %rbx
addq $0x10, %rbx
jmp 0xec76