// File: /workspace/github_c_makefile_star2_O3/janet-lang[P]janet/src/core/util.c
// Function: janet_binding_from_entry
JanetBinding janet_binding_from_entry(Janet entry) {
    JanetTable *entry_table;
    JanetBinding binding = {
        JANET_BINDING_NONE,
        janet_wrap_nil(),
        JANET_BINDING_DEP_NONE
    };

    /* Check environment for entry */
    if (!janet_checktype(entry, JANET_TABLE))
        return binding;
    entry_table = janet_unwrap_table(entry);

    /* deprecation check */
    Janet deprecate = janet_table_get(entry_table, janet_ckeywordv("deprecated"));
    if (janet_checktype(deprecate, JANET_KEYWORD)) {
        JanetKeyword depkw = janet_unwrap_keyword(deprecate);
        if (!janet_cstrcmp(depkw, "relaxed")) {
            binding.deprecation = JANET_BINDING_DEP_RELAXED;
        } else if (!janet_cstrcmp(depkw, "normal")) {
            binding.deprecation = JANET_BINDING_DEP_NORMAL;
        } else if (!janet_cstrcmp(depkw, "strict")) {
            binding.deprecation = JANET_BINDING_DEP_STRICT;
        }
    } else if (!janet_checktype(deprecate, JANET_NIL)) {
        binding.deprecation = JANET_BINDING_DEP_NORMAL;
    }

    int macro = janet_truthy(janet_table_get(entry_table, janet_ckeywordv("macro")));
    Janet value = janet_table_get(entry_table, janet_ckeywordv("value"));
    Janet ref = janet_table_get(entry_table, janet_ckeywordv("ref"));
    int ref_is_valid = janet_checktype(ref, JANET_ARRAY);
    int redef = ref_is_valid && janet_truthy(janet_table_get(entry_table, janet_ckeywordv("redef")));

    if (macro) {
        binding.value = redef ? ref : value;
        binding.type = redef ? JANET_BINDING_DYNAMIC_MACRO : JANET_BINDING_MACRO;
        return binding;
    }

    if (ref_is_valid) {
        binding.value = ref;
        binding.type = redef ? JANET_BINDING_DYNAMIC_DEF : JANET_BINDING_VAR;
    } else {
        binding.value = value;
        binding.type = JANET_BINDING_DEF;
    }

    return binding;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movabsq $-0x7800000000000, %r12 # imm = 0xFFF8800000000000
xorl %r15d, %r15d
movl %r15d, (%rdi)
leaq 0x1(%r12), %rdi
callq 0x4ece6
movq %rax, 0x8(%rbx)
movl %r15d, 0x10(%rbx)
movq %r14, %rax
shrq $0x2f, %rax
cmpl $0x1fff9, %eax          # imm = 0x1FFF9
jne 0x494a5
movabsq $-0x800000000000, %rax  # imm = 0xFFFF800000000000
movabsq $-0x5000000000000, %r13 # imm = 0xFFFB000000000000
movq %r14, %rdi
movq %rax, %r14
callq 0x4ebc4
movq %rax, %r15
leaq 0xb3b8(%rip), %rdi      # 0x5456b
callq 0x47261
movq %rax, %rdi
movq %r13, %rsi
callq 0x4ed39
movq %r15, %rdi
movq %rax, %rsi
callq 0x474e0
movq %rax, %rcx
andq %r14, %rcx
cmpq %r12, %rcx
je 0x492c9
movl $0x2, %r14d
cmpq %r13, %rcx
jne 0x492bb
movq %rax, %rdi
callq 0x4ebc4
movslq -0x8(%rax), %rcx
leaq 0xb43a(%rip), %rdx      # 0x54639
xorl %esi, %esi
testq %rcx, %rcx
jle 0x49228
movb (%rax,%rsi), %dil
cmpb (%rsi,%rdx), %dil
jne 0x4922e
cmpq $0x7, %rsi
je 0x49223
incq %rsi
cmpq %rsi, %rcx
jne 0x49206
movq %rcx, %rsi
jmp 0x49228
movl $0x7, %esi
cmpb $0x0, (%rsi,%rdx)
je 0x49258
leaq 0xb40c(%rip), %rdx      # 0x54641
xorl %esi, %esi
testl %ecx, %ecx
jle 0x49265
movb (%rax,%rsi), %dil
cmpb (%rsi,%rdx), %dil
jne 0x4926b
cmpq $0x6, %rsi
je 0x49260
incq %rsi
cmpq %rsi, %rcx
jne 0x4923b
movq %rcx, %rsi
jmp 0x49265
movl $0x1, %r14d
jmp 0x492bb
movl $0x6, %esi
cmpb $0x0, (%rsi,%rdx)
je 0x492bb
leaq 0xb3d6(%rip), %rdx      # 0x54648
testl %ecx, %ecx
jle 0x4929c
xorl %esi, %esi
movabsq $-0x800000000000, %r14  # imm = 0xFFFF800000000000
movb (%rax,%rsi), %dil
cmpb (%rsi,%rdx), %dil
jne 0x492c9
cmpq $0x6, %rsi
je 0x492aa
incq %rsi
cmpq %rsi, %rcx
jne 0x49282
jmp 0x492af
xorl %ecx, %ecx
movabsq $-0x800000000000, %r14  # imm = 0xFFFF800000000000
jmp 0x492af
movl $0x6, %ecx
cmpb $0x0, (%rcx,%rdx)
jne 0x492c9
movl $0x3, %r14d
movl %r14d, 0x10(%rbx)
movabsq $-0x800000000000, %r14  # imm = 0xFFFF800000000000
leaq 0x223ba(%rip), %rdi     # 0x6b68a
callq 0x47261
movq %rax, %rdi
movq %r13, %rsi
callq 0x4ed39
movq %r15, %rdi
movq %rax, %rsi
callq 0x474e0
andq %r14, %rax
cmpq %r12, %rax
jne 0x492fa
movq %r14, %r12
xorl %edx, %edx
jmp 0x4935b
leaq 0x22389(%rip), %rdi     # 0x6b68a
callq 0x47261
movq %rax, %rdi
movq %r13, %rsi
callq 0x4ed39
movq %r15, %rdi
movq %rax, %rsi
callq 0x474e0
movq %r14, %r12
andq %r14, %rax
movb $0x1, %dl
movabsq $-0x7000000000000, %rcx # imm = 0xFFF9000000000000
cmpq %rcx, %rax
jne 0x4935b
leaq 0x22350(%rip), %rdi     # 0x6b68a
callq 0x47261
movq %rax, %rdi
movq %r13, %rsi
callq 0x4ed39
movq %r15, %rdi
movq %rax, %rsi
callq 0x474e0
movq %rax, %rdx
andb $0x1, %dl
movq %rdx, -0x38(%rbp)
leaq 0x13ca0(%rip), %rdi     # 0x5d006
callq 0x47261
movq %rax, %rdi
movq %r13, %rsi
callq 0x4ed39
movq %r15, %rdi
movq %rax, %rsi
callq 0x474e0
movq %rax, -0x30(%rbp)
leaq 0x1ed2b(%rip), %rdi     # 0x680b7
callq 0x47261
movq %rax, %rdi
movq %r13, %rsi
callq 0x4ed39
movq %r15, %rdi
movq %rax, %rsi
callq 0x474e0
movq %rax, %r14
andq %r12, %rax
movabsq $-0x4800000000000, %rcx # imm = 0xFFFB800000000000
cmpq %rcx, %rax
jne 0x493f4
leaq 0x1f62d(%rip), %rdi     # 0x689f0
callq 0x47261
movq %rax, %rdi
movq %r13, %rsi
callq 0x4ed39
movq %r15, %rdi
movq %rax, %rsi
callq 0x474e0
andq %r12, %rax
movabsq $-0x7800000000000, %rcx # imm = 0xFFF8800000000000
cmpq %rcx, %rax
jne 0x49409
xorl %eax, %eax
jmp 0x49466
movl $0x3, %ecx
cmpb $0x0, -0x38(%rbp)
je 0x49486
movq -0x30(%rbp), %rax
jmp 0x49480
leaq 0x1f5e0(%rip), %rdi     # 0x689f0
callq 0x47261
movq %rax, %rdi
movq %r13, %rsi
callq 0x4ed39
movq %r15, %rdi
movq %rax, %rsi
callq 0x474e0
movq %rax, %rcx
andq %r12, %rcx
movb $0x1, %al
movabsq $-0x7000000000000, %rdx # imm = 0xFFF9000000000000
cmpq %rdx, %rcx
jne 0x49466
leaq 0x1f5a7(%rip), %rdi     # 0x689f0
callq 0x47261
movq %rax, %rdi
movq %r13, %rsi
callq 0x4ed39
movq %r15, %rdi
movq %rax, %rsi
callq 0x474e0
andb $0x1, %al
cmpb $0x0, -0x38(%rbp)
je 0x49495
movzbl %al, %ecx
leal 0x3(,%rcx,2), %ecx
testb %al, %al
movq -0x30(%rbp), %rax
cmovneq %r14, %rax
movq %rax, 0x8(%rbx)
jmp 0x494a3
movq -0x30(%rbp), %rax
movq %rax, 0x8(%rbx)
movl $0x1, %ecx
jmp 0x494a3
movq %r14, 0x8(%rbx)
movzbl %al, %eax
leal 0x2(,%rax,2), %ecx
movl %ecx, (%rbx)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq