// File: /workspace/github_c_makefile_star2_O3/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 %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x8d24(%rip), %rsi      # 0xfe56
movq %rbx, %rdi
callq 0x10e0
testl %eax, %eax
je 0x72a0
movq %r14, %r15
movq (%r15), %rdi
movq %rbx, %rsi
callq 0xa3f8
testl %eax, %eax
jne 0x71f3
movq 0x8(%r15), %r15
testq %r15, %r15
jne 0x7145
leaq 0x88(%r14), %rdi
movq %rbx, %rsi
callq 0x5eda
testq %rax, %rax
je 0x72dd
movq %rax, %r15
leaq -0x178(%rbp), %rbx
movq %rbx, %rdi
callq 0x95ac
leaq -0x78(%rbp), %r14
movq %r14, %rdi
callq 0x95ac
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 0x73a0
movq 0x8(%r14), %r14
testq %r14, %r14
je 0x73ba
movq (%r14), %rdi
movq %rbx, %rsi
callq 0xa3f8
testl %eax, %eax
je 0x71e6
movq (%r14), %rdi
movq %rbx, %rsi
callq 0xa39c
leaq -0x78(%rbp), %rbx
movl $0xa, %ecx
movq %rbx, %rdi
movq %rax, %rsi
rep  movsq (%rsi), %es:(%rdi)
movl 0x50(%rax), %r13d
leaq -0x1c8(%rbp), %r14
movl $0xa, %ecx
movq %r14, %rdi
movq %rbx, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %r14, %rdi
callq 0x96dc
leaq -0x178(%rbp), %r12
movl $0xa, %ecx
movq %r12, %rdi
movq %r14, %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq -0x128(%rbp), %rdi
movl $0xa, %ecx
movq %rbx, %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 $0x7, 0xa0(%r15)
movl %r13d, 0xf0(%r15)
jmp 0x73a0
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 0x73c2
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1100
jmp 0x73a0
movq 0x10(%r14), %rdi
movq %rbx, %rsi
callq 0xa3f8
testl %eax, %eax
je 0x72f3
addq $0x10, %r14
jmp 0x730b
movq 0x18(%r14), %rdi
movq %rbx, %rsi
callq 0xa3f8
testl %eax, %eax
je 0x73b5
addq $0x18, %r14
movq (%r14), %rdi
movq %rbx, %rsi
callq 0xa39c
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 0x96dc
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 $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r15d, %r15d
jmp 0x73a0
movq %rbx, %rdi
callq 0x1a2c