// File: /workspace/github_c_makefile_star2_O0/janet-lang[P]janet/src/core/util.c
// Function: janet_dict_find
const JanetKV *janet_dict_find(const JanetKV *buckets, int32_t cap, Janet key) {
    int32_t index = janet_maphash(cap, janet_hash(key));
    int32_t i;
    const JanetKV *first_bucket = NULL;
    /* Higher half */
    for (i = index; i < cap; i++) {
        const JanetKV *kv = buckets + i;
        if (janet_checktype(kv->key, JANET_NIL)) {
            if (janet_checktype(kv->value, JANET_NIL)) {
                return kv;
            } else if (NULL == first_bucket) {
                first_bucket = kv;
            }
        } else if (janet_equals(kv->key, key)) {
            return buckets + i;
        }
    }
    /* Lower half */
    for (i = 0; i < index; i++) {
        const JanetKV *kv = buckets + i;
        if (janet_checktype(kv->key, JANET_NIL)) {
            if (janet_checktype(kv->value, JANET_NIL)) {
                return kv;
            } else if (NULL == first_bucket) {
                first_bucket = kv;
            }
        } else if (janet_equals(kv->key, key)) {
            return buckets + i;
        }
    }
    return first_bucket;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdx, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
movl %esi, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6f030
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
andl %ecx, %eax
movl %eax, -0x20(%rbp)
movq $0x0, -0x30(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x6afe2
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
xorl %eax, %eax
testb $0x1, %al
jne 0x6aedc
jmp 0x6af0b
movq -0x38(%rbp), %rax
movsd (%rax), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x6aef1
jmp 0x6af2b
movq -0x38(%rbp), %rax
movq (%rax), %rax
shrq $0x2f, %rax
andq $0xf, %rax
cmpq $0x0, %rax
je 0x6af2b
jmp 0x6afa3
movq -0x38(%rbp), %rcx
movabsq $-0x800000000000, %rax  # imm = 0xFFFF800000000000
andq (%rcx), %rax
movabsq $-0x7800000000000, %rcx # imm = 0xFFF8800000000000
cmpq %rcx, %rax
jne 0x6afa3
xorl %eax, %eax
testb $0x1, %al
jne 0x6af33
jmp 0x6af61
movq -0x38(%rbp), %rax
movsd 0x8(%rax), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x6af49
jmp 0x6af82
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
shrq $0x2f, %rax
andq $0xf, %rax
cmpq $0x0, %rax
je 0x6af82
jmp 0x6af8f
movq -0x38(%rbp), %rcx
movabsq $-0x800000000000, %rax  # imm = 0xFFFF800000000000
andq 0x8(%rcx), %rax
movabsq $-0x7800000000000, %rcx # imm = 0xFFF8800000000000
cmpq %rcx, %rax
jne 0x6af8f
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6b118
xorl %eax, %eax
cmpq -0x30(%rbp), %rax
jne 0x6af9f
movq -0x38(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0x6afa1
jmp 0x6afd2
movq -0x38(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x6e560
cmpl $0x0, %eax
je 0x6afd0
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x6b118
jmp 0x6afd2
jmp 0x6afd4
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x6aeb5
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x6b110
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
xorl %eax, %eax
testb $0x1, %al
jne 0x6b010
jmp 0x6b03f
movq -0x40(%rbp), %rax
movsd (%rax), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x6b025
jmp 0x6b05f
movq -0x40(%rbp), %rax
movq (%rax), %rax
shrq $0x2f, %rax
andq $0xf, %rax
cmpq $0x0, %rax
je 0x6b05f
jmp 0x6b0d4
movq -0x40(%rbp), %rcx
movabsq $-0x800000000000, %rax  # imm = 0xFFFF800000000000
andq (%rcx), %rax
movabsq $-0x7800000000000, %rcx # imm = 0xFFF8800000000000
cmpq %rcx, %rax
jne 0x6b0d4
xorl %eax, %eax
testb $0x1, %al
jne 0x6b067
jmp 0x6b095
movq -0x40(%rbp), %rax
movsd 0x8(%rax), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x6b07d
jmp 0x6b0b6
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
shrq $0x2f, %rax
andq $0xf, %rax
cmpq $0x0, %rax
je 0x6b0b6
jmp 0x6b0c0
movq -0x40(%rbp), %rcx
movabsq $-0x800000000000, %rax  # imm = 0xFFFF800000000000
andq 0x8(%rcx), %rax
movabsq $-0x7800000000000, %rcx # imm = 0xFFF8800000000000
cmpq %rcx, %rax
jne 0x6b0c0
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6b118
xorl %eax, %eax
cmpq -0x30(%rbp), %rax
jne 0x6b0d0
movq -0x40(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0x6b0d2
jmp 0x6b100
movq -0x40(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x6e560
cmpl $0x0, %eax
je 0x6b0fe
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x6b118
jmp 0x6b100
jmp 0x6b102
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x6afe9
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)