// File: /workspace/github_c_makefile_star2_O3/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 0x44405
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 0x43bfb
movabsq $-0x5000000000000, %r12 # imm = 0xFFFB000000000000
movq %rdx, %rdi
callq 0x478f5
movq %rax, -0x38(%rbp)
leaq 0x245ce(%rip), %rdi     # 0x689f0
callq 0x47261
movq %rax, %rdi
movq %r12, %r15
movq %r12, %rsi
callq 0x4ed39
movq %rax, %r12
movq 0x18(%rbx), %rdi
movq %rax, %rsi
callq 0x474e0
shrq $0x2f, %rax
cmpl $0x1fff1, %eax          # imm = 0x1FFF1
movq %r14, -0x30(%rbp)
je 0x444b3
movabsq $-0x800000000000, %r13  # imm = 0xFFFF800000000000
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0x474e0
andq %r13, %rax
movabsq $-0x7000000000000, %rcx # imm = 0xFFF9000000000000
cmpq %rcx, %rax
jne 0x4448b
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0x474e0
testb $0x1, %al
je 0x444b3
movq 0x18(%rbx), %rsi
leaq -0x50(%rbp), %r12
movq %r12, %rdi
movq %r14, %rdx
callq 0x49643
cmpl $0x2, (%r12)
jne 0x444b3
movq -0x48(%rbp), %rdi
callq 0x4ebc4
movq %rax, %r13
jmp 0x444e0
movabsq $-0x7800000000000, %r12 # imm = 0xFFF8800000000000
movl $0x1, %edi
callq 0x14690
movq %rax, %r13
incq %r12
movq %r12, %rdi
callq 0x4ece6
movq %r13, %rdi
movq %rax, %rsi
callq 0x148a3
leaq 0x23bd0(%rip), %rdi     # 0x680b7
callq 0x47261
movq %rax, %rdi
movq %r15, %r14
movq %r15, %rsi
callq 0x4ed39
movq %rax, %r12
movabsq $-0x4800000000000, %rsi # imm = 0xFFFB800000000000
movq %r13, %rdi
callq 0x4ed7e
movq -0x38(%rbp), %r15
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x476f0
leaq 0x244bd(%rip), %rdi     # 0x689e5
callq 0x47261
movq %rax, %rdi
movq %r14, %rsi
callq 0x4ed39
movq %rax, %r12
movq %rbx, %rdi
callq 0x43b8b
movabsq $-0x4000000000000, %rsi # imm = 0xFFFC000000000000
movq %rax, %rdi
callq 0x4ed39
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x476f0
movq 0x18(%rbx), %r12
movabsq $-0x5800000000000, %rsi # imm = 0xFFFA800000000000
movq -0x30(%rbp), %rdi
callq 0x4ed39
movq %rax, %r14
movabsq $-0x3800000000000, %rsi # imm = 0xFFFC800000000000
movq %r15, %rdi
callq 0x4ed7e
movq %r12, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x476f0
movq %r13, %rdi
movabsq $-0x4800000000000, %rsi # imm = 0xFFFB800000000000
callq 0x4ed7e
leaq -0x50(%rbp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x1baf6
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 0x22059
movl $0x1, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)