// File: /workspace/github_c_makefile_star2_O1/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 0x4f95a
movq %rax, 0x8(%rbx)
movl %r15d, 0x10(%rbx)
movq %r14, %rax
shrq $0x2f, %rax
cmpl $0x1fff9, %eax          # imm = 0x1FFF9
jne 0x49fbe
movq %r12, %r15
movabsq $-0x800000000000, %r12  # imm = 0xFFFF800000000000
movabsq $-0x5000000000000, %r13 # imm = 0xFFFB000000000000
movq %r14, %rdi
callq 0x4f838
movq %rax, %r14
leaq 0xb875(%rip), %rdi      # 0x5556b
callq 0x47cd3
movq %rax, %rdi
movq %r13, %rsi
callq 0x4f9ad
movq %r14, -0x40(%rbp)
movq %r14, %rdi
movq %rax, %rsi
callq 0x47f51
movq %rax, %rcx
andq %r12, %rcx
cmpq %r15, %rcx
je 0x49d95
movl $0x2, %r12d
cmpq %r13, %rcx
jne 0x49d87
movq %rax, %rdi
callq 0x4f838
movq %rax, %r14
leaq 0xb8fc(%rip), %rsi      # 0x55639
movq %rax, %rdi
callq 0x4920e
testl %eax, %eax
je 0x49d81
leaq 0xb8f1(%rip), %rsi      # 0x55641
movq %r14, %rdi
callq 0x4920e
testl %eax, %eax
je 0x49d87
leaq 0xb8e5(%rip), %rsi      # 0x55648
movq %r14, %rdi
callq 0x4920e
testl %eax, %eax
movabsq $-0x800000000000, %r12  # imm = 0xFFFF800000000000
jne 0x49d95
movl $0x3, %r12d
jmp 0x49d87
movl $0x1, %r12d
movl %r12d, 0x10(%rbx)
movabsq $-0x800000000000, %r12  # imm = 0xFFFF800000000000
leaq 0x2290e(%rip), %rdi     # 0x6c6aa
callq 0x47cd3
movq %rax, %rdi
movq %r13, %rsi
callq 0x4f9ad
movq -0x40(%rbp), %r15
movq %r15, %rdi
movq %rax, %rsi
callq 0x47f51
andq %r12, %rax
movabsq $-0x7800000000000, %rcx # imm = 0xFFF8800000000000
cmpq %rcx, %rax
jne 0x49dd1
xorl %edx, %edx
jmp 0x49e2f
leaq 0x228d2(%rip), %rdi     # 0x6c6aa
callq 0x47cd3
movq %rax, %rdi
movq %r13, %rsi
callq 0x4f9ad
movq %r15, %rdi
movq %rax, %rsi
callq 0x47f51
andq %r12, %rax
movb $0x1, %dl
movabsq $-0x7000000000000, %rcx # imm = 0xFFF9000000000000
cmpq %rcx, %rax
jne 0x49e2f
leaq 0x2289c(%rip), %rdi     # 0x6c6aa
callq 0x47cd3
movq %rax, %rdi
movq %r13, %rsi
callq 0x4f9ad
movq %r15, %rdi
movq %rax, %rsi
callq 0x47f51
movq %rax, %rdx
andb $0x1, %dl
movq %rdx, -0x38(%rbp)
leaq 0x141cc(%rip), %rdi     # 0x5e006
callq 0x47cd3
movq %rax, %rdi
movq %r13, %rsi
callq 0x4f9ad
movq %r15, %rdi
movq %rax, %rsi
callq 0x47f51
movq %rax, -0x30(%rbp)
leaq 0x1f277(%rip), %rdi     # 0x690d7
callq 0x47cd3
movq %rax, %rdi
movq %r13, %rsi
callq 0x4f9ad
movq %r15, %rdi
movq %rax, %rsi
callq 0x47f51
movq %rax, %r12
movq %rax, %r14
movabsq $-0x800000000000, %r13  # imm = 0xFFFF800000000000
andq %r13, %r14
movabsq $-0x4800000000000, %rcx # imm = 0xFFFB800000000000
cmpq %rcx, %r14
jne 0x49ee6
leaq 0x1fb6c(%rip), %rdi     # 0x69a10
callq 0x47cd3
movq %rax, %rdi
movabsq $-0x5000000000000, %rsi # imm = 0xFFFB000000000000
callq 0x4f9ad
movq %r15, %rdi
movq %rax, %rsi
callq 0x47f51
andq %r13, %rax
movabsq $-0x7800000000000, %rcx # imm = 0xFFF8800000000000
cmpq %rcx, %rax
jne 0x49f27
xorl %eax, %eax
movabsq $-0x4800000000000, %rcx # imm = 0xFFFB800000000000
jmp 0x49ee8
xorl %eax, %eax
cmpb $0x0, -0x38(%rbp)
je 0x49f0b
movzbl %al, %ecx
leal 0x3(,%rcx,2), %ecx
testb %al, %al
movq -0x30(%rbp), %rax
cmovneq %r12, %rax
movq %rax, 0x8(%rbx)
jmp 0x49fbc
cmpq %rcx, %r14
jne 0x49faf
movq %r12, 0x8(%rbx)
movzbl %al, %eax
leal 0x2(,%rax,2), %ecx
jmp 0x49fbc
leaq 0x1fae2(%rip), %rdi     # 0x69a10
callq 0x47cd3
movq %rax, %rdi
movabsq $-0x5000000000000, %rsi # imm = 0xFFFB000000000000
callq 0x4f9ad
movq %r15, %rdi
movq %rax, %rsi
callq 0x47f51
movq %rax, %rcx
andq %r13, %rcx
movb $0x1, %al
movabsq $-0x7000000000000, %rdx # imm = 0xFFF9000000000000
cmpq %rdx, %rcx
movabsq $-0x4800000000000, %rcx # imm = 0xFFFB800000000000
jne 0x49ee8
leaq 0x1fa94(%rip), %rdi     # 0x69a10
callq 0x47cd3
movq %rax, %rdi
movabsq $-0x5000000000000, %rsi # imm = 0xFFFB000000000000
callq 0x4f9ad
movq %r15, %rdi
movq %rax, %rsi
callq 0x47f51
movabsq $-0x4800000000000, %rcx # imm = 0xFFFB800000000000
andb $0x1, %al
jmp 0x49ee8
movq -0x30(%rbp), %rax
movq %rax, 0x8(%rbx)
movl $0x1, %ecx
movl %ecx, (%rbx)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq