// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/frontend/irgen_llvmir.c
// Function: ir_expr_identifier
static bool _ir_expr_identifier(
	IRGeneratorLlvmirContext *ctx,
	ResizableString *rstr,
	_ExprResult *expr_result,
	ParserASTNode *node
) {
	assert(ctx);
	assert(rstr);
	assert(expr_result);
	assert(node);

	if (node->type != FE_NODE_EXPR_ATOM) {
		return false;
	}

	ParserASTNode *child = node->childs[0];
	if (child->type != FE_NODE_IDENTIFIER) {
		return false;
	}

	ParserSymbol *func_symbol = ctx->func_symbol;
	assert(func_symbol);

	ParserSymbol *symbol = parser_get_symbol_from_node(ctx->psrctx, node, 0, child->token);
	assert(symbol);

	if (symbol->type == FE_SYM_VAR) {
		assert(FE_VAR_SYMBOL_GET_HAS_CODE_GEN_NAME(symbol));
		ResizableString *code_gen_name = FE_VAR_SYMBOL_GET_CODE_GEN_NAME(symbol);

		ResizableString rstr_tmp_label;
		rstr_init(&rstr_tmp_label);
		_generate_func_tmp(ctx, func_symbol, &rstr_tmp_label);

		ParserASTNode *node_type = FE_VAR_SYMBOL_GET_TYPE_NODE(symbol);
		ResizableString rstr_type;
		rstr_init(&rstr_type);
		_ir_type(ctx, &rstr_type, node_type);

		rstr_appendf(
			&(expr_result->rstr_for_result),
			"%s = load %s, %s* %s\n",
			RSTR_CSTR(&rstr_tmp_label),
			RSTR_CSTR(&rstr_type),
			RSTR_CSTR(&rstr_type),
			RSTR_CSTR(code_gen_name)
		);
		_expr_result_set_result(expr_result, RSTR_CSTR(&rstr_type), RSTR_CSTR(&rstr_tmp_label));

		_expr_result_set_result_ptr(expr_result, RSTR_CSTR(&rstr_type), RSTR_CSTR(code_gen_name));

		rstr_free(&rstr_tmp_label);
		rstr_free(&rstr_type);
	} else if (symbol->type == FE_SYM_FUNC) {
		ParserASTNode *node_type = FE_FUNC_SYMBOL_GET_FUNC_TYPE_NODE(symbol);
		ResizableString rstr_type;
		rstr_init(&rstr_type);
		_ir_type(ctx, &rstr_type, node_type);

		ResizableString rstr_func_name;
		rstr_init_with_char(&rstr_func_name, '@');
		rstr_append_with_raw(
			&rstr_func_name,
			symbol->token->content,
			symbol->token->len
		);

		_expr_result_set_func_result(expr_result, RSTR_CSTR(&rstr_type), RSTR_CSTR(&rstr_func_name));

		_expr_result_set_result_ptr(expr_result, RSTR_CSTR(&rstr_type), RSTR_CSTR(&rstr_func_name));

		rstr_free(&rstr_type);
		rstr_free(&rstr_func_name);
	} else {
		assert(0);
	}

	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x160, %rsp            # imm = 0x160
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x2d984
jmp 0x2d9a3
leaq 0x4ebcb(%rip), %rdi     # 0x7c556
leaq 0x4a73e(%rip), %rsi     # 0x780d0
movl $0x7ac, %edx            # imm = 0x7AC
leaq 0x4af14(%rip), %rcx     # 0x788b2
callq 0x30a0
cmpq $0x0, -0x18(%rbp)
je 0x2d9ac
jmp 0x2d9cb
leaq 0x4515b(%rip), %rdi     # 0x72b0e
leaq 0x4a716(%rip), %rsi     # 0x780d0
movl $0x7ad, %edx            # imm = 0x7AD
leaq 0x4aeec(%rip), %rcx     # 0x788b2
callq 0x30a0
cmpq $0x0, -0x20(%rbp)
je 0x2d9d4
jmp 0x2d9f3
leaq 0x47238(%rip), %rdi     # 0x74c13
leaq 0x4a6ee(%rip), %rsi     # 0x780d0
movl $0x7ae, %edx            # imm = 0x7AE
leaq 0x4aec4(%rip), %rcx     # 0x788b2
callq 0x30a0
cmpq $0x0, -0x28(%rbp)
je 0x2d9fc
jmp 0x2da1b
leaq 0x485d0(%rip), %rdi     # 0x75fd3
leaq 0x4a6c6(%rip), %rsi     # 0x780d0
movl $0x7af, %edx            # imm = 0x7AF
leaq 0x4ae9c(%rip), %rcx     # 0x788b2
callq 0x30a0
movq -0x28(%rbp), %rax
cmpl $0xee0, (%rax)          # imm = 0xEE0
je 0x2da30
movb $0x0, -0x1(%rbp)
jmp 0x2deff
movq -0x28(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x200, (%rax)          # imm = 0x200
je 0x2da54
movb $0x0, -0x1(%rbp)
jmp 0x2deff
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x2da69
jmp 0x2da88
leaq 0x48703(%rip), %rdi     # 0x76173
leaq 0x4a659(%rip), %rsi     # 0x780d0
movl $0x7bb, %edx            # imm = 0x7BB
leaq 0x4ae2f(%rip), %rcx     # 0x788b2
callq 0x30a0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rcx
xorl %edx, %edx
callq 0x82f0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x2daaf
jmp 0x2dace
leaq 0x486c2(%rip), %rdi     # 0x76178
leaq 0x4a613(%rip), %rsi     # 0x780d0
movl $0x7be, %edx            # imm = 0x7BE
leaq 0x4ade9(%rip), %rcx     # 0x788b2
callq 0x30a0
movq -0x40(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x2dd59
movq -0x40(%rbp), %rax
testb $0x1, 0x48(%rax)
je 0x2dae7
jmp 0x2db06
leaq 0x486fe(%rip), %rdi     # 0x761ec
leaq 0x4a5db(%rip), %rsi     # 0x780d0
movl $0x7c1, %edx            # imm = 0x7C1
leaq 0x4adb1(%rip), %rcx     # 0x788b2
callq 0x30a0
movq -0x40(%rbp), %rax
addq $0x30, %rax
addq $0x20, %rax
movq %rax, -0x48(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x8c90
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq -0x58(%rbp), %rdx
callq 0x35980
movq -0x40(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x60(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x8c90
movq -0x10(%rbp), %rdi
movq -0x60(%rbp), %rdx
leaq -0x70(%rbp), %rsi
callq 0x299e0
movq -0x20(%rbp), %rax
movq %rax, -0xa0(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x2db78
leaq 0x49d46(%rip), %rax     # 0x778b5
movq %rax, -0xa8(%rbp)
jmp 0x2db83
movq -0x50(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
movq %rax, -0xb0(%rbp)
cmpq $0x0, -0x68(%rbp)
jne 0x2dba8
leaq 0x49d16(%rip), %rax     # 0x778b5
movq %rax, -0xb8(%rbp)
jmp 0x2dbb3
movq -0x68(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0xc0(%rbp)
cmpq $0x0, -0x68(%rbp)
jne 0x2dbd8
leaq 0x49ce6(%rip), %rax     # 0x778b5
movq %rax, -0xc8(%rbp)
jmp 0x2dbe3
movq -0x68(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0x48(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x2dc0c
leaq 0x49cb2(%rip), %rax     # 0x778b5
movq %rax, -0xd8(%rbp)
jmp 0x2dc1b
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xd8(%rbp)
movq -0xd0(%rbp), %r8
movq -0xc0(%rbp), %rcx
movq -0xb0(%rbp), %rdx
movq -0xa0(%rbp), %rdi
movq -0xd8(%rbp), %r9
leaq 0x4acd6(%rip), %rsi     # 0x7891b
movb $0x0, %al
callq 0x94d0
movq -0x20(%rbp), %rax
movq %rax, -0xe0(%rbp)
cmpq $0x0, -0x68(%rbp)
jne 0x2dc6e
leaq 0x49c50(%rip), %rax     # 0x778b5
movq %rax, -0xe8(%rbp)
jmp 0x2dc79
movq -0x68(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rax
movq %rax, -0xf0(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x2dc9e
leaq 0x49c20(%rip), %rax     # 0x778b5
movq %rax, -0xf8(%rbp)
jmp 0x2dca9
movq -0x50(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0xf0(%rbp), %rsi
movq -0xe0(%rbp), %rdi
movq -0xf8(%rbp), %rdx
callq 0x358a0
movq -0x20(%rbp), %rax
movq %rax, -0x100(%rbp)
cmpq $0x0, -0x68(%rbp)
jne 0x2dce5
leaq 0x49bd9(%rip), %rax     # 0x778b5
movq %rax, -0x108(%rbp)
jmp 0x2dcf0
movq -0x68(%rbp), %rax
movq %rax, -0x108(%rbp)
movq -0x108(%rbp), %rax
movq %rax, -0x110(%rbp)
movq -0x48(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x2dd19
leaq 0x49ba5(%rip), %rax     # 0x778b5
movq %rax, -0x118(%rbp)
jmp 0x2dd28
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x118(%rbp)
movq -0x110(%rbp), %rsi
movq -0x100(%rbp), %rdi
movq -0x118(%rbp), %rdx
callq 0x35a50
leaq -0x58(%rbp), %rdi
callq 0x9310
leaq -0x70(%rbp), %rdi
callq 0x9310
jmp 0x2defb
movq -0x40(%rbp), %rax
cmpl $0x3, (%rax)
jne 0x2deda
movq -0x40(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x78(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x8c90
movq -0x10(%rbp), %rdi
movq -0x78(%rbp), %rdx
leaq -0x88(%rbp), %rsi
callq 0x299e0
leaq -0x98(%rbp), %rdi
movl $0x40, %esi
callq 0x8e40
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rsi
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x4(%rax), %edx
leaq -0x98(%rbp), %rdi
callq 0x8f90
movq -0x20(%rbp), %rax
movq %rax, -0x120(%rbp)
cmpq $0x0, -0x80(%rbp)
jne 0x2dde8
leaq 0x49ad6(%rip), %rax     # 0x778b5
movq %rax, -0x128(%rbp)
jmp 0x2ddf3
movq -0x80(%rbp), %rax
movq %rax, -0x128(%rbp)
movq -0x128(%rbp), %rax
movq %rax, -0x130(%rbp)
cmpq $0x0, -0x90(%rbp)
jne 0x2de1b
leaq 0x49aa3(%rip), %rax     # 0x778b5
movq %rax, -0x138(%rbp)
jmp 0x2de29
movq -0x90(%rbp), %rax
movq %rax, -0x138(%rbp)
movq -0x130(%rbp), %rsi
movq -0x120(%rbp), %rdi
movq -0x138(%rbp), %rdx
callq 0x35b30
movq -0x20(%rbp), %rax
movq %rax, -0x140(%rbp)
cmpq $0x0, -0x80(%rbp)
jne 0x2de65
leaq 0x49a59(%rip), %rax     # 0x778b5
movq %rax, -0x148(%rbp)
jmp 0x2de70
movq -0x80(%rbp), %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rax
movq %rax, -0x150(%rbp)
cmpq $0x0, -0x90(%rbp)
jne 0x2de98
leaq 0x49a26(%rip), %rax     # 0x778b5
movq %rax, -0x158(%rbp)
jmp 0x2dea6
movq -0x90(%rbp), %rax
movq %rax, -0x158(%rbp)
movq -0x150(%rbp), %rsi
movq -0x140(%rbp), %rdi
movq -0x158(%rbp), %rdx
callq 0x35a50
leaq -0x88(%rbp), %rdi
callq 0x9310
leaq -0x98(%rbp), %rdi
callq 0x9310
jmp 0x2def9
leaq 0x4457a(%rip), %rdi     # 0x7245b
leaq 0x4a1e8(%rip), %rsi     # 0x780d0
movl $0x7f0, %edx            # imm = 0x7F0
leaq 0x4a9be(%rip), %rcx     # 0x788b2
callq 0x30a0
jmp 0x2defb
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x160, %rsp            # imm = 0x160
popq %rbp
retq
nopl (%rax)