// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/backend/asmgen_gas32.c
// Function: instantiate_varsym
static ParserSymbol * _instantiate_varsym(
	ASMGeneratorGas32Context *ctx,
	ParserSymbol * varsym,
	int offset
) {
	assert(varsym);
	assert(BE_VAR_SYMBOL_GET_HAS_CODE_GEN_NAME(varsym));

	ParserSymbol *symbol = parser_clone_symbol(ctx->psrctx, varsym);
	rstr_init(BE_VAR_SYMBOL_GET_CODE_GEN_NAME(symbol));
	
	switch (BE_VAR_SYMBOL_GET_SCOPE_TYPE(symbol)) {
		case BE_VAR_TYPE_GLOBAL: {
			ParserSymbol *cur_func_symbol = ctx->func_symbol;
			assert(cur_func_symbol);
			ParserASTNode *cur_func_name_node = BE_FUNC_SYMBOL_GET_FUNC_NAME_NODE(cur_func_symbol);
			assert(cur_func_name_node);

			ResizableString rstr_label;
			rstr_init(&rstr_label);
			rstr_append_with_cstr(
				&rstr_label,
				_ASM_IP_LABEL_PREFIX
			);
			rstr_append_with_raw(
				&rstr_label,
				cur_func_name_node->token->content,
				cur_func_name_node->token->len
			);

			_asm_get_ip(ctx);

			rstr_appendf(
				BE_VAR_SYMBOL_GET_CODE_GEN_NAME(symbol),
				RSTR_CSTR(BE_VAR_SYMBOL_GET_CODE_GEN_NAME(varsym)),
				RSTR_CSTR(&rstr_label),
				offset,
				_ASM_IP_REG
			);

			rstr_free(&rstr_label);
			break;
		}
		case BE_VAR_TYPE_LOCAL: {
			rstr_appendf(
				BE_VAR_SYMBOL_GET_CODE_GEN_NAME(symbol),
				RSTR_CSTR(BE_VAR_SYMBOL_GET_CODE_GEN_NAME(varsym)),
				offset,
				_ASM_STACK_FRAME_REG
			);
			break;
		}
		case BE_VAR_TYPE_FUNC_PARAM: {
			rstr_append_with_rstr(
				BE_VAR_SYMBOL_GET_CODE_GEN_NAME(symbol),
				BE_VAR_SYMBOL_GET_CODE_GEN_NAME(varsym)
			);
			break;
		}
		default: {
			assert(0);
			return NULL;
		}
	}

	return symbol;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x1f8ff
jmp 0x1f91e
leaq 0x56bb2(%rip), %rdi     # 0x764b8
leaq 0x55feb(%rip), %rsi     # 0x758f8
movl $0xe2a, %edx            # imm = 0xE2A
leaq 0x56ba6(%rip), %rcx     # 0x764bf
callq 0x30a0
movq -0x10(%rbp), %rax
testb $0x1, 0x48(%rax)
je 0x1f92a
jmp 0x1f949
leaq 0x56be1(%rip), %rdi     # 0x76512
leaq 0x55fc0(%rip), %rsi     # 0x758f8
movl $0xe2b, %edx            # imm = 0xE2B
leaq 0x56b7b(%rip), %rcx     # 0x764bf
callq 0x30a0
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x8150
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
addq $0x50, %rdi
callq 0x8c90
movq -0x20(%rbp), %rax
movzbl 0x78(%rax), %eax
movl %eax, -0x44(%rbp)
subl $0x1, %eax
je 0x1f99b
jmp 0x1f97c
movl -0x44(%rbp), %eax
subl $0x2, %eax
je 0x1fac8
jmp 0x1f98a
movl -0x44(%rbp), %eax
subl $0x3, %eax
je 0x1fb17
jmp 0x1fb36
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x1f9b0
jmp 0x1f9cf
leaq 0x56b87(%rip), %rdi     # 0x7653e
leaq 0x55f3a(%rip), %rsi     # 0x758f8
movl $0xe33, %edx            # imm = 0xE33
leaq 0x56af5(%rip), %rcx     # 0x764bf
callq 0x30a0
movq -0x28(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x1f9e4
jmp 0x1fa03
leaq 0x56b63(%rip), %rdi     # 0x7654e
leaq 0x55f06(%rip), %rsi     # 0x758f8
movl $0xe35, %edx            # imm = 0xE35
leaq 0x56ac1(%rip), %rcx     # 0x764bf
callq 0x30a0
leaq -0x40(%rbp), %rdi
callq 0x8c90
leaq -0x40(%rbp), %rdi
leaq 0x567f3(%rip), %rsi     # 0x7620a
callq 0x8d70
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rsi
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movl 0x4(%rax), %edx
leaq -0x40(%rbp), %rdi
callq 0x8f90
movq -0x8(%rbp), %rdi
callq 0x20ea0
movq -0x20(%rbp), %rax
addq $0x30, %rax
addq $0x20, %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x58(%rax)
jne 0x1fa6d
leaq 0x564d8(%rip), %rax     # 0x75f3f
movq %rax, -0x58(%rbp)
jmp 0x1fa79
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x1fa95
leaq 0x564b0(%rip), %rax     # 0x75f3f
movq %rax, -0x68(%rbp)
jmp 0x1fa9d
movq -0x38(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rsi
movq -0x50(%rbp), %rdi
movq -0x68(%rbp), %rdx
movl -0x14(%rbp), %ecx
leaq 0x56761(%rip), %r8      # 0x76214
movb $0x0, %al
callq 0x94d0
leaq -0x40(%rbp), %rdi
callq 0x9310
jmp 0x1fb55
movq -0x20(%rbp), %rax
addq $0x30, %rax
addq $0x20, %rax
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x58(%rax)
jne 0x1faf0
leaq 0x56455(%rip), %rax     # 0x75f3f
movq %rax, -0x78(%rbp)
jmp 0x1fafc
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x70(%rbp), %rdi
movq -0x78(%rbp), %rsi
movl -0x14(%rbp), %edx
leaq 0x56a53(%rip), %rcx     # 0x76561
movb $0x0, %al
callq 0x94d0
jmp 0x1fb55
movq -0x20(%rbp), %rdi
addq $0x30, %rdi
addq $0x20, %rdi
movq -0x10(%rbp), %rsi
addq $0x30, %rsi
addq $0x20, %rsi
callq 0x9100
jmp 0x1fb55
leaq 0x5391d(%rip), %rdi     # 0x7345a
leaq 0x55db4(%rip), %rsi     # 0x758f8
movl $0xe61, %edx            # imm = 0xE61
leaq 0x5696f(%rip), %rcx     # 0x764bf
callq 0x30a0
movq -0x20(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)