// File: /workspace/github_c_makefile_star2_O0/chgzm[P]minic/generator.c
// Function: process_identifier_right
static void process_identifier_right(const char* identifier) {
    // enum 
    if (strintmap_contains(enum_map, identifier)) {
        printf("  push %d\n", strintmap_get(enum_map, identifier));
        return;
    } 

    // local variable
    const LocalVar* lv = get_localvar(identifier);
    if (lv != NULL) {
        printf("  lea rax, [rbp-%d]\n", lv->offset);
        if (lv->type->array_size == 0) { 
            if (lv->type->type_size == 1 && lv->type->ptr_count == 0) {
                printf("  movzx eax, BYTE PTR [rax]\n");
            } else { 
                printf("  mov rax, [rax]\n");
            }
        } 
        printf("  push rax\n");
        intstack_push(size_stack, lv->type->size);
        stack_push(type_stack, lv->type);

        return;
    } 

    // global variable
    const GlobalVar* gv = get_globalvar(identifier);
    printf("  lea rax, %s[rip]\n", gv->name);
    if (gv->type->array_size == 0) {
        if (gv->type->type_size == 1 && gv->type->ptr_count == 0) {
            printf("  movzx eax, BYTE PTR [rax]\n");
        } else { 
            printf("  mov rax, [rax]\n");
        }
    }
    printf("  push rax\n");
    intstack_push(size_stack, gv->type->size);
    stack_push(type_stack, gv->type);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq 0xef65(%rip), %rdi      # 0x15158
movq -0x8(%rbp), %rsi
callq 0xedc0
testb $0x1, %al
jne 0x6202
jmp 0x6227
movq 0xef4f(%rip), %rdi      # 0x15158
movq -0x8(%rbp), %rsi
callq 0xee60
movl %eax, %esi
leaq 0x96d9(%rip), %rdi      # 0xf8f4
movb $0x0, %al
callq 0x1090
jmp 0x6378
movq -0x8(%rbp), %rdi
callq 0x5c10
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x62d7
movq -0x10(%rbp), %rax
movl 0x14(%rax), %esi
leaq 0x946b(%rip), %rdi      # 0xf6b8
movb $0x0, %al
callq 0x1090
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpl $0x0, 0xc(%rax)
jne 0x629b
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpl $0x1, 0x4(%rax)
jne 0x628b
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpl $0x0, 0x10(%rax)
jne 0x628b
leaq 0x96b6(%rip), %rdi      # 0xf938
movb $0x0, %al
callq 0x1090
jmp 0x6299
leaq 0x9642(%rip), %rdi      # 0xf8d4
movb $0x0, %al
callq 0x1090
jmp 0x629b
leaq 0x942b(%rip), %rdi      # 0xf6cd
movb $0x0, %al
callq 0x1090
movq 0xee90(%rip), %rdi      # 0x15140
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl 0x8(%rax), %esi
callq 0xe810
movq 0xee6a(%rip), %rdi      # 0x15130
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0xe6e0
jmp 0x6378
movq -0x8(%rbp), %rdi
callq 0x5c90
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0x968b(%rip), %rdi      # 0xf97e
movb $0x0, %al
callq 0x1090
movq -0x18(%rbp), %rax
movq (%rax), %rax
cmpl $0x0, 0xc(%rax)
jne 0x6341
movq -0x18(%rbp), %rax
movq (%rax), %rax
cmpl $0x1, 0x4(%rax)
jne 0x6331
movq -0x18(%rbp), %rax
movq (%rax), %rax
cmpl $0x0, 0x10(%rax)
jne 0x6331
leaq 0x9610(%rip), %rdi      # 0xf938
movb $0x0, %al
callq 0x1090
jmp 0x633f
leaq 0x959c(%rip), %rdi      # 0xf8d4
movb $0x0, %al
callq 0x1090
jmp 0x6341
leaq 0x9385(%rip), %rdi      # 0xf6cd
movb $0x0, %al
callq 0x1090
movq 0xedea(%rip), %rdi      # 0x15140
movq -0x18(%rbp), %rax
movq (%rax), %rax
movl 0x8(%rax), %esi
callq 0xe810
movq 0xedc4(%rip), %rdi      # 0x15130
movq -0x18(%rbp), %rax
movq (%rax), %rsi
callq 0xe6e0
addq $0x20, %rsp
popq %rbp
retq
nop