// File: /workspace/github_c_makefile_star2_O2/janet-lang[P]janet/src/core/specials.c
// Function: defleaf
static int defleaf(
    JanetCompiler *c,
    const uint8_t *sym,
    JanetSlot s,
    JanetTable *tab) {
    if (c->scope->flags & JANET_SCOPE_TOP) {
        JanetTable *entry = janet_table_clone(tab);
        janet_table_put(entry, janet_ckeywordv("source-map"),
                        janet_wrap_tuple(janetc_make_sourcemap(c)));

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

        if (is_redef) {
            JanetBinding binding = janet_resolve_ext(c->env, sym);
            JanetArray *ref;
            if (binding.type == JANET_BINDING_DYNAMIC_DEF || binding.type == JANET_BINDING_DYNAMIC_MACRO) {
                ref = janet_unwrap_array(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));
            JanetSlot refslot = janetc_cslot(janet_wrap_array(ref));
            janetc_emit_ssu(c, JOP_PUT_INDEX, refslot, s, 0, 0);
        } else {
            JanetSlot valsym = janetc_cslot(janet_ckeywordv("value"));
            JanetSlot tabslot = janetc_cslot(janet_wrap_table(entry));
            janetc_emit_sss(c, JOP_PUT, tabslot, valsym, s, 0);
        }

        /* Add env entry to env */
        janet_table_put(c->env, janet_wrap_symbol(sym), janet_wrap_table(entry));
    }
    return namelocal(c, sym, 0, s);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdi, %r14
leaq 0x10(%rbp), %rcx
movq (%rdi), %rax
testb $0x4, 0x6c(%rax)
je 0x4052c
movq %rsi, -0x30(%rbp)
movabsq $-0x5000000000000, %r13 # imm = 0xFFFB000000000000
movq %rdx, %rdi
callq 0x44033
movq %rax, %rbx
leaq 0x24769(%rip), %rdi     # 0x64a05
callq 0x439c6
movq %rax, %rdi
movq %r13, %rsi
callq 0x4b366
movq %rax, %r15
movq %r14, %rdi
callq 0x40558
movabsq $-0x4000000000000, %rsi # imm = 0xFFFC000000000000
movq %rax, %rdi
callq 0x4b366
movq %rbx, %r12
movq %rbx, %rdi
movq %r13, %rbx
movq %r15, %rsi
movq %rax, %rdx
callq 0x43e19
leaq 0x2472c(%rip), %rdi     # 0x64a10
callq 0x439c6
movq %rax, %rdi
movq %r13, %rsi
callq 0x4b366
movq %rax, %r15
movq 0x18(%r14), %rdi
movq %rax, %rsi
callq 0x43c35
shrq $0x2f, %rax
cmpl $0x1fff1, %eax          # imm = 0x1FFF1
movq %r12, -0x38(%rbp)
jne 0x403ab
leaq 0x18ce9(%rip), %rdi     # 0x59006
callq 0x439c6
movq %rax, %rdi
movq %rbx, %rsi
callq 0x4b366
leaq -0x50(%rbp), %r15
movq %r15, %rdi
movq %rax, %rsi
callq 0x19f5c
movq %r12, %rdi
movabsq $-0x3800000000000, %r12 # imm = 0xFFFC800000000000
movq %r12, %rsi
callq 0x4b3ab
leaq -0x68(%rbp), %r13
movq %r13, %rdi
movq %rax, %rsi
callq 0x19f5c
leaq 0x10(%rbp), %rcx
movq 0x10(%rcx), %rax
movq %rax, 0x40(%rsp)
movups (%rcx), %xmm0
movups %xmm0, 0x30(%rsp)
movq 0x10(%r15), %rax
movq %rax, 0x28(%rsp)
movups (%r15), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x10(%r13), %rax
movq %rax, 0x10(%rsp)
movups (%r13), %xmm0
movups %xmm0, (%rsp)
pushq $0x3c
popq %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x2010f
jmp 0x404ee
movabsq $-0x7000000000000, %r13 # imm = 0xFFF9000000000000
movq 0x18(%r14), %rdi
movq %r15, %rsi
callq 0x43c35
movabsq $-0x800000000000, %rcx  # imm = 0xFFFF800000000000
andq %rcx, %rax
cmpq %r13, %rax
jne 0x403e7
movq 0x18(%r14), %rdi
movq %r15, %rsi
callq 0x43c35
testb $0x1, %al
je 0x40316
incq %r13
movq %r13, %rdi
callq 0x4b313
movq %r12, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x43e19
movq 0x18(%r14), %rsi
leaq -0x50(%rbp), %r15
movq %r15, %rdi
movq -0x30(%rbp), %rdx
callq 0x45b75
movl (%r15), %eax
andl $-0x2, %eax
cmpl $0x4, %eax
jne 0x4042d
movq -0x48(%rbp), %rdi
callq 0x4b1f1
movq %rax, %r15
jmp 0x40458
movabsq $-0x7800000000000, %r13 # imm = 0xFFF8800000000000
pushq $0x1
popq %rdi
callq 0x12f68
movq %rax, %r15
incq %r13
movq %r13, %rdi
callq 0x4b313
movq %r15, %rdi
movq %rax, %rsi
callq 0x131d2
leaq 0x23c78(%rip), %rdi     # 0x640d7
callq 0x439c6
movq %rax, %rdi
movq %rbx, %rsi
callq 0x4b366
movq %rax, %r13
movabsq $-0x4800000000000, %rbx # imm = 0xFFFB800000000000
movq %r15, %rdi
movq %rbx, %rsi
callq 0x4b3ab
movq %r12, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x43e19
movq %r15, %rdi
movq %rbx, %rsi
callq 0x4b3ab
leaq -0x68(%rbp), %r15
movq %r15, %rdi
movq %rax, %rsi
callq 0x19f5c
leaq 0x10(%rbp), %rcx
movq 0x10(%rcx), %rax
movq %rax, 0x28(%rsp)
movups (%rcx), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
pushq $0x3e
popq %rsi
movq %r14, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x20105
movabsq $-0x3800000000000, %r12 # imm = 0xFFFC800000000000
movq 0x18(%r14), %r15
movabsq $-0x5800000000000, %rsi # imm = 0xFFFA800000000000
movq -0x30(%rbp), %rbx
movq %rbx, %rdi
callq 0x4b366
movq %rax, %r13
movq -0x38(%rbp), %rdi
movq %r12, %rsi
callq 0x4b3ab
movq %r15, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x43e19
movq %rbx, %rsi
leaq 0x10(%rbp), %rcx
movq 0x10(%rcx), %rax
movq %rax, 0x10(%rsp)
movups (%rcx), %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
xorl %edx, %edx
callq 0x405c3
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq