// File: /workspace/github_c_makefile_star2_O1/janet-lang[P]janet/src/core/specials.c
// Function: varleaf
static int varleaf(
    JanetCompiler *c,
    const uint8_t *sym,
    JanetSlot s,
    JanetTable *reftab) {
    if (c->scope->flags & JANET_SCOPE_TOP) {
        /* Global var, generate var */
        JanetSlot refslot;
        JanetTable *entry = janet_table_clone(reftab);

        Janet redef_kw = janet_ckeywordv("redef");
        int is_redef = janet_truthy(janet_table_get(c->env, redef_kw));

        JanetArray *ref;
        JanetBinding old_binding;
        if (is_redef && (old_binding = janet_resolve_ext(c->env, sym),
                         old_binding.type == JANET_BINDING_VAR)) {
            ref = janet_unwrap_array(old_binding.value);
        } else {
            ref = janet_array(1);
            janet_array_push(ref, janet_wrap_nil());
        }

        janet_table_put(entry, janet_ckeywordv("ref"), janet_wrap_array(ref));
        janet_table_put(entry, janet_ckeywordv("source-map"),
                        janet_wrap_tuple(janetc_make_sourcemap(c)));
        janet_table_put(c->env, janet_wrap_symbol(sym), janet_wrap_table(entry));
        refslot = janetc_cslot(janet_wrap_array(ref));
        janetc_emit_ssu(c, JOP_PUT_INDEX, refslot, s, 0, 0);
        return 1;
    } else {
        return namelocal(c, sym, JANET_SLOT_MUTABLE, s);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %rax
testb $0x4, 0x6c(%rax)
jne 0x44d48
movq %rbx, %rdi
movq %r14, %rsi
movl $0x40000, %edx          # imm = 0x40000
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x44517
movabsq $-0x5000000000000, %r12 # imm = 0xFFFB000000000000
movq %rdx, %rdi
callq 0x483b2
movq %rax, -0x38(%rbp)
leaq 0x24cab(%rip), %rdi     # 0x69a10
callq 0x47cd3
movq %rax, %rdi
movq %r12, %r15
movq %r12, %rsi
callq 0x4f9ad
movq %rax, %r12
movq 0x18(%rbx), %rdi
movq %rax, %rsi
callq 0x47f51
shrq $0x2f, %rax
cmpl $0x1fff1, %eax          # imm = 0x1FFF1
movq %r14, -0x30(%rbp)
je 0x44df6
movabsq $-0x800000000000, %r13  # imm = 0xFFFF800000000000
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0x47f51
andq %r13, %rax
movabsq $-0x7000000000000, %rcx # imm = 0xFFF9000000000000
cmpq %rcx, %rax
jne 0x44dce
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0x47f51
testb $0x1, %al
je 0x44df6
movq 0x18(%rbx), %rsi
leaq -0x50(%rbp), %r12
movq %r12, %rdi
movq %r14, %rdx
callq 0x4a15b
cmpl $0x2, (%r12)
jne 0x44df6
movq -0x48(%rbp), %rdi
callq 0x4f838
movq %rax, %r13
jmp 0x44e23
movabsq $-0x7800000000000, %r12 # imm = 0xFFF8800000000000
movl $0x1, %edi
callq 0x146a0
movq %rax, %r13
incq %r12
movq %r12, %rdi
callq 0x4f95a
movq %r13, %rdi
movq %rax, %rsi
callq 0x148b3
leaq 0x242ad(%rip), %rdi     # 0x690d7
callq 0x47cd3
movq %rax, %rdi
movq %r15, %r14
movq %r15, %rsi
callq 0x4f9ad
movq %rax, %r12
movabsq $-0x4800000000000, %rsi # imm = 0xFFFB800000000000
movq %r13, %rdi
callq 0x4f9f2
movq -0x38(%rbp), %r15
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x481b3
leaq 0x24b9a(%rip), %rdi     # 0x69a05
callq 0x47cd3
movq %rax, %rdi
movq %r14, %rsi
callq 0x4f9ad
movq %rax, %r12
movq %rbx, %rdi
callq 0x444a7
movabsq $-0x4000000000000, %rsi # imm = 0xFFFC000000000000
movq %rax, %rdi
callq 0x4f9ad
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x481b3
movq 0x18(%rbx), %r12
movabsq $-0x5800000000000, %rsi # imm = 0xFFFA800000000000
movq -0x30(%rbp), %rdi
callq 0x4f9ad
movq %rax, %r14
movabsq $-0x3800000000000, %rsi # imm = 0xFFFC800000000000
movq %r15, %rdi
callq 0x4f9f2
movq %r12, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x481b3
movq %r13, %rdi
movabsq $-0x4800000000000, %rsi # imm = 0xFFFB800000000000
callq 0x4f9f2
leaq -0x50(%rbp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x1bc4e
leaq 0x10(%rbp), %rcx
movq 0x10(%rcx), %rax
movq %rax, 0x28(%rsp)
movups (%rcx), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x10(%r14), %rax
movq %rax, 0x10(%rsp)
movups (%r14), %xmm0
movups %xmm0, (%rsp)
movq %rbx, %rdi
movl $0x3e, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x223b5
movl $0x1, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq