// File: /workspace/github_c_makefile_star2_O2/janet-lang[P]janet/src/core/symcache.c
// Function: janet_symcache_findmem
static const uint8_t **janet_symcache_findmem(
    const uint8_t *str,
    int32_t len,
    int32_t hash,
    int *success) {
    uint32_t bounds[4];
    uint32_t i, j, index;
    const uint8_t **firstEmpty = NULL;

    /* We will search two ranges - index to the end,
     * and 0 to the index. */
    index = (uint32_t)hash & (janet_vm.cache_capacity - 1);
    bounds[0] = index;
    bounds[1] = janet_vm.cache_capacity;
    bounds[2] = 0;
    bounds[3] = index;
    for (j = 0; j < 4; j += 2)
        for (i = bounds[j]; i < bounds[j + 1]; ++i) {
            const uint8_t *test = janet_vm.cache[i];
            /* Check empty spots */
            if (NULL == test) {
                if (NULL == firstEmpty)
                    firstEmpty = janet_vm.cache + i;
                goto notfound;
            }
            /* Check for marked deleted */
            if (JANET_SYMCACHE_DELETED == test) {
                if (firstEmpty == NULL)
                    firstEmpty = janet_vm.cache + i;
                continue;
            }
            if (janet_string_equalconst(test, str, len, hash)) {
                /* Replace first deleted */
                *success = 1;
                if (firstEmpty != NULL) {
                    *firstEmpty = test;
                    janet_vm.cache[i] = JANET_SYMCACHE_DELETED;
                    return firstEmpty;
                }
                return janet_vm.cache + i;
            }
        }
notfound:
    *success = 0;
    janet_assert(firstEmpty != NULL, "symcache failed to get memory");
    return firstEmpty;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, -0x30(%rbp)
movl %edx, %ebx
movl %esi, -0x3c(%rbp)
movq %rdi, -0x60(%rbp)
movq %fs:0x0, %rax
leaq -0x348(%rax), %rax
movq %rax, -0x38(%rbp)
movl 0x78(%rax), %eax
leal -0x1(%rax), %ecx
movl %ebx, -0x40(%rbp)
andl %ebx, %ecx
movl %ecx, -0x50(%rbp)
movl %eax, -0x4c(%rbp)
andl $0x0, -0x48(%rbp)
movl %ecx, -0x44(%rbp)
xorl %eax, %eax
xorl %ebx, %ebx
cmpq $0x3, %rax
ja 0x4379f
movl -0x50(%rbp,%rax,4), %r12d
movq %rax, -0x58(%rbp)
movl -0x4c(%rbp,%rax,4), %r15d
leaq (,%r12,8), %r14
cmpq %r15, %r12
jae 0x43751
movq -0x38(%rbp), %rax
movq 0x70(%rax), %rax
movq (%rax,%r14), %r13
addq %r14, %rax
testq %r13, %r13
je 0x4375b
leaq 0x23218(%rip), %rcx     # 0x6693c
cmpq %rcx, %r13
je 0x43741
movq %r13, %rdi
movq -0x60(%rbp), %rsi
movl -0x3c(%rbp), %edx
movl -0x40(%rbp), %ecx
callq 0x411ae
testl %eax, %eax
je 0x43748
jmp 0x4376b
testq %rbx, %rbx
cmoveq %rax, %rbx
incq %r12
addq $0x8, %r14
jmp 0x43704
movq -0x58(%rbp), %rax
addq $0x2, %rax
jmp 0x436e4
testq %rbx, %rbx
cmoveq %rax, %rbx
movq -0x30(%rbp), %rax
andl $0x0, (%rax)
jmp 0x437ab
movq -0x30(%rbp), %rax
movl $0x1, (%rax)
testq %rbx, %rbx
je 0x43792
movq %r13, (%rbx)
movq -0x38(%rbp), %rax
movq 0x70(%rax), %rax
leaq 0x231b0(%rip), %rcx     # 0x6693c
movq %rcx, (%rax,%r14)
jmp 0x437ab
movq -0x38(%rbp), %rax
addq 0x70(%rax), %r14
movq %r14, %rbx
jmp 0x437ab
movq -0x30(%rbp), %rax
andl $0x0, (%rax)
testq %rbx, %rbx
je 0x437bd
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x3c82c(%rip), %rax     # 0x7fff0
movq (%rax), %rdi
leaq 0xc842(%rip), %rsi      # 0x50010
leaq 0x23135(%rip), %rcx     # 0x6690a
leaq 0x23142(%rip), %r8      # 0x6691e
pushq $0x6f
popq %rdx
xorl %eax, %eax
callq 0x125e0
callq 0x12100