// File: /workspace/github_c_makefile_star2_O1/hsjoihs[P]c-compiler/typecheck_expression.c
// Function: from_name_to_expr
static struct Expr * /* nullable */
from_name_to_expr(struct AnalyzerState *ptr_ps, const char *name)
{
	if (strcmp(name, "__func__") == 0) {
		struct Expr *p_expr = calloc(1, sizeof(struct Expr));
		*p_expr = string_literal(ptr_ps->current_function_name);
		return p_expr;
	}
	if (!is_local_var(&ptr_ps->scope_chain, name)) {
		const struct EnumeratorAndValue *ptr_enum_and_value =
		    get_global_enumerator(&ptr_ps->global_enumerator_list, name);
		if (ptr_enum_and_value) {
			struct Expr expr;
			expr.details.type = INT_TYPE();
			expr.details.true_type = INT_TYPE();
			expr.category = INT_VALUE;
			expr.int_value = ptr_enum_and_value->value;

			struct Expr *p_expr = calloc(1, sizeof(struct Expr));
			*p_expr = expr;
			return p_expr;
		}

		struct Type type;

		if (isElem(ptr_ps->global_vars_type_map, name)) {
			struct Type *ptr_type = lookup(ptr_ps->global_vars_type_map, name);
			type = *ptr_type;
		} else if (isElem(ptr_ps->func_info_map, name)) {
			struct Type *ptr_type = lookup(ptr_ps->func_info_map, name);
			type = *ptr_type;
		} else {
			return 0;
		}

		struct Expr expr;
		struct Type t2 = type;
		if_array_convert_to_ptr_(&t2);

		expr.details.type = t2;
		expr.details.true_type = type;
		expr.category = GLOBAL_VAR_;
		expr.global_var_name = name;

		struct Expr *p_expr = calloc(1, sizeof(struct Expr));
		*p_expr = expr;
		return p_expr;
	} else {
		struct LocalVarInfo info =
		    resolve_name_locally(&ptr_ps->scope_chain, name);

		struct Expr expr;
		struct Type t2 = info.type;
		if_array_convert_to_ptr_(&t2);

		expr.details.type = t2;
		expr.details.true_type = info.type;
		expr.category = LOCAL_VAR_;
		expr.local_var_offset = info.offset;

		struct Expr *p_expr = calloc(1, sizeof(struct Expr));
		*p_expr = expr;
		return p_expr;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x8ebd(%rip), %rsi      # 0xfe7e
movq %rbx, %rdi
callq 0x10e0
testl %eax, %eax
je 0x7077
movq %r14, %rdi
movq %rbx, %rsi
callq 0x5cdc
testl %eax, %eax
je 0x70b4
leaq -0x78(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x802b
leaq -0x1c8(%rbp), %rbx
movl $0xa, %ecx
movq %rbx, %rdi
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %rbx, %rdi
callq 0x9628
leaq -0x178(%rbp), %r14
movl $0xa, %ecx
movq %r14, %rdi
movq %rbx, %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq -0x128(%rbp), %rdi
movl $0xa, %ecx
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
movl 0x50(%r15), %ebx
movl $0x1, %edi
movl $0x100, %esi            # imm = 0x100
callq 0x10d0
movq %rax, %r15
movl $0xa0, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x1100
movl $0x7, 0xa0(%r15)
movl %ebx, 0xf0(%r15)
jmp 0x71f8
movl $0x1, %edi
movl $0x100, %esi            # imm = 0x100
callq 0x10d0
movq %rax, %r15
movq 0x98(%r14), %rsi
leaq -0x178(%rbp), %rbx
movq %rbx, %rdi
callq 0x7210
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1100
jmp 0x71f8
leaq 0x88(%r14), %rdi
movq %rbx, %rsi
callq 0x5d0f
testq %rax, %rax
je 0x7135
movq %rax, %r15
leaq -0x178(%rbp), %rbx
movq %rbx, %rdi
callq 0x94f8
leaq -0x78(%rbp), %r14
movq %r14, %rdi
callq 0x94f8
leaq -0x128(%rbp), %rdi
movl $0xa, %ecx
movq %r14, %rsi
rep  movsq (%rsi), %es:(%rdi)
movl 0x8(%r15), %r14d
movl $0x1, %edi
movl $0x100, %esi            # imm = 0x100
callq 0x10d0
movq %rax, %r15
movl $0xa0, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1100
movl $0x9, 0xa0(%r15)
movl %r14d, 0xc8(%r15)
jmp 0x71f8
movq 0x10(%r14), %rdi
movq %rbx, %rsi
callq 0xa389
testl %eax, %eax
je 0x714b
addq $0x10, %r14
jmp 0x7163
movq 0x18(%r14), %rdi
movq %rbx, %rsi
callq 0xa389
testl %eax, %eax
je 0x720b
addq $0x18, %r14
movq (%r14), %rdi
movq %rbx, %rsi
callq 0xa32d
leaq -0x78(%rbp), %r14
movl $0xa, %ecx
movq %r14, %rdi
movq %rax, %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq -0x1c8(%rbp), %r15
movl $0xa, %ecx
movq %r15, %rdi
movq %r14, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %r15, %rdi
callq 0x9628
leaq -0x178(%rbp), %r12
movl $0xa, %ecx
movq %r12, %rdi
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq -0x128(%rbp), %rdi
movl $0xa, %ecx
movq %r14, %rsi
rep  movsq (%rsi), %es:(%rdi)
movl $0x1, %edi
movl $0x100, %esi            # imm = 0x100
callq 0x10d0
movq %rax, %r15
movl $0xa0, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x1100
movl $0x8, 0xa0(%r15)
movq %rbx, 0xd0(%r15)
movq %r15, %rax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
xorl %r15d, %r15d
jmp 0x71f8