// File: /workspace/github_c_makefile_star2_O0/janet-lang[P]janet/src/core/specials.c
// Function: namelocal
static int namelocal(JanetCompiler *c, const uint8_t *head, int32_t flags, JanetSlot ret) {
    int isUnnamedRegister = !(ret.flags & JANET_SLOT_NAMED) &&
                            ret.index > 0 &&
                            ret.envindex >= 0;
    /* optimization for `(def x my-def)` - don't emit a movn/movf instruction, we can just alias my-def */
    /* TODO - implement optimization for `(def x my-var)` correctly as well w/ de-aliasing */
    int canAlias = !(flags & JANET_SLOT_MUTABLE) &&
                   !(ret.flags & JANET_SLOT_MUTABLE) &&
                   (ret.flags & JANET_SLOT_NAMED) &&
                   (ret.index >= 0) &&
                   (ret.envindex == -1);
    if (canAlias) {
        ret.flags &= ~JANET_SLOT_MUTABLE;
        isUnnamedRegister = 1; /* don't free slot after use - is an alias for another slot */
    } else if (!isUnnamedRegister) {
        /* Slot is not able to be named */
        JanetSlot localslot = janetc_farslot(c);
        janetc_copy(c, localslot, ret);
        ret = localslot;
    }
    ret.flags |= flags;
    janetc_nameslot(c, head, ret);
    return !isUnnamedRegister;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
leaq 0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl 0x10(%rax), %ecx
andl $0x20000, %ecx          # imm = 0x20000
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x39(%rbp)
jne 0x6351e
movq -0x48(%rbp), %rcx
xorl %eax, %eax
cmpl $0x0, 0x8(%rcx)
movb %al, -0x39(%rbp)
jle 0x6351e
movq -0x48(%rbp), %rax
cmpl $0x0, 0xc(%rax)
setge %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x18(%rbp)
movl -0x14(%rbp), %ecx
andl $0x40000, %ecx          # imm = 0x40000
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x49(%rbp)
jne 0x63587
movq -0x48(%rbp), %rax
movl 0x10(%rax), %ecx
andl $0x40000, %ecx          # imm = 0x40000
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x49(%rbp)
jne 0x63587
movq -0x48(%rbp), %rax
movl 0x10(%rax), %ecx
andl $0x20000, %ecx          # imm = 0x20000
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x49(%rbp)
je 0x63587
movq -0x48(%rbp), %rcx
xorl %eax, %eax
cmpl $0x0, 0x8(%rcx)
movb %al, -0x49(%rbp)
jl 0x63587
movq -0x48(%rbp), %rax
cmpl $-0x1, 0xc(%rax)
sete %al
movb %al, -0x49(%rbp)
movb -0x49(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x635b1
movq -0x48(%rbp), %rax
movl 0x10(%rax), %ecx
andl $0xfffbffff, %ecx       # imm = 0xFFFBFFFF
movl %ecx, 0x10(%rax)
movl $0x1, -0x18(%rbp)
jmp 0x63625
cmpl $0x0, -0x18(%rbp)
jne 0x63623
movq -0x8(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x20470
movq -0x48(%rbp), %rax
movq -0x8(%rbp), %rdi
leaq -0x38(%rbp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rsp)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rsp)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rsp)
movq (%rax), %rcx
movq %rcx, 0x18(%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x20(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x28(%rsp)
callq 0x295a0
movq -0x48(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rcx, (%rax)
movq -0x30(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rcx
movq %rcx, 0x10(%rax)
jmp 0x63625
movq -0x48(%rbp), %rax
movl -0x14(%rbp), %ecx
orl 0x10(%rax), %ecx
movl %ecx, 0x10(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x20330
cmpl $0x0, -0x18(%rbp)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
addq $0x80, %rsp
popq %rbp
retq
nop