// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/backend/asmgen_gas32.c
// Function: asm_inst_mov_x_fsym
static void _asm_inst_mov_x_fsym(
	ASMGeneratorGas32Context *ctx,
	ResizableString *rstr,
	const char *target,
	ParserSymbol *source
) {
	assert(ctx);
	assert(rstr);
	assert(target);
	assert(source);
	assert(source->type == BE_SYM_FUNC);

	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_cur_func_name;
	rstr_init_with_raw(
		&rstr_cur_func_name,
		cur_func_name_node->token->content,
		cur_func_name_node->token->len
	);

	ResizableString rstr_func_name;
	rstr_init_with_raw(
		&rstr_func_name,
		source->token->content,
		source->token->len
	);

	ResizableString rstr_disp;
	rstr_init(&rstr_disp);
	rstr_appendf(
		&rstr_disp,
		"%s-%s%s",
		RSTR_CSTR(&rstr_func_name),
		_ASM_IP_LABEL_PREFIX,
		RSTR_CSTR(&rstr_cur_func_name)
	);

	_asm_get_ip(ctx);

	ResizableString rstr_source;
	rstr_init(&rstr_source);
	_asm_inst_memref_base_disp(
		ctx,
		&rstr_source,
		_ASM_IP_REG,
		RSTR_CSTR(&rstr_disp)
	);

	_asm_inst_lea_x_x(
		ctx,
		rstr,
		target,
		RSTR_CSTR(&rstr_source)
	);

	rstr_free(&rstr_cur_func_name);
	rstr_free(&rstr_func_name);
	rstr_free(&rstr_disp);
	rstr_free(&rstr_source);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x1fdb4
jmp 0x1fdd3
leaq 0x603a6(%rip), %rdi     # 0x80161
leaq 0x55b36(%rip), %rsi     # 0x758f8
movl $0x374, %edx            # imm = 0x374
leaq 0x56a32(%rip), %rcx     # 0x76800
callq 0x30a0
cmpq $0x0, -0x10(%rbp)
je 0x1fddc
jmp 0x1fdfb
leaq 0x53d2a(%rip), %rdi     # 0x73b0d
leaq 0x55b0e(%rip), %rsi     # 0x758f8
movl $0x375, %edx            # imm = 0x375
leaq 0x56a0a(%rip), %rcx     # 0x76800
callq 0x30a0
cmpq $0x0, -0x18(%rbp)
je 0x1fe04
jmp 0x1fe23
leaq 0x5f529(%rip), %rdi     # 0x7f334
leaq 0x55ae6(%rip), %rsi     # 0x758f8
movl $0x376, %edx            # imm = 0x376
leaq 0x569e2(%rip), %rcx     # 0x76800
callq 0x30a0
cmpq $0x0, -0x20(%rbp)
je 0x1fe2c
jmp 0x1fe4b
leaq 0x5c401(%rip), %rdi     # 0x7c234
leaq 0x55abe(%rip), %rsi     # 0x758f8
movl $0x377, %edx            # imm = 0x377
leaq 0x569ba(%rip), %rcx     # 0x76800
callq 0x30a0
movq -0x20(%rbp), %rax
cmpl $0x3, (%rax)
jne 0x1fe56
jmp 0x1fe75
leaq 0x56a0a(%rip), %rdi     # 0x76867
leaq 0x55a94(%rip), %rsi     # 0x758f8
movl $0x378, %edx            # imm = 0x378
leaq 0x56990(%rip), %rcx     # 0x76800
callq 0x30a0
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x1fe8a
jmp 0x1fea9
leaq 0x566ad(%rip), %rdi     # 0x7653e
leaq 0x55a60(%rip), %rsi     # 0x758f8
movl $0x37b, %edx            # imm = 0x37B
leaq 0x5695c(%rip), %rcx     # 0x76800
callq 0x30a0
movq -0x28(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x1febe
jmp 0x1fedd
leaq 0x56689(%rip), %rdi     # 0x7654e
leaq 0x55a2c(%rip), %rsi     # 0x758f8
movl $0x37d, %edx            # imm = 0x37D
leaq 0x56928(%rip), %rcx     # 0x76800
callq 0x30a0
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 0x8ee0
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rsi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x4(%rax), %edx
leaq -0x50(%rbp), %rdi
callq 0x8ee0
leaq -0x60(%rbp), %rdi
callq 0x8c90
cmpq $0x0, -0x48(%rbp)
jne 0x1ff3a
leaq 0x5600b(%rip), %rax     # 0x75f3f
movq %rax, -0x78(%rbp)
jmp 0x1ff42
movq -0x48(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x80(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x1ff61
leaq 0x55fe7(%rip), %rax     # 0x75f3f
movq %rax, -0x88(%rbp)
jmp 0x1ff6c
movq -0x38(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x80(%rbp), %rdx
movq -0x88(%rbp), %r8
leaq -0x60(%rbp), %rdi
leaq 0x56901(%rip), %rsi     # 0x76883
leaq 0x56281(%rip), %rcx     # 0x7620a
movb $0x0, %al
callq 0x94d0
movq -0x8(%rbp), %rdi
callq 0x20ea0
leaq -0x70(%rbp), %rdi
callq 0x8c90
movq -0x8(%rbp), %rax
movq %rax, -0x90(%rbp)
cmpq $0x0, -0x58(%rbp)
jne 0x1ffc4
leaq 0x55f84(%rip), %rax     # 0x75f3f
movq %rax, -0x98(%rbp)
jmp 0x1ffcf
movq -0x58(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x90(%rbp), %rdi
movq -0x98(%rbp), %rcx
leaq -0x70(%rbp), %rsi
leaq 0x5622c(%rip), %rdx     # 0x76214
callq 0x10e00
movq -0x8(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0xa0(%rbp)
cmpq $0x0, -0x68(%rbp)
jne 0x20025
leaq 0x55f23(%rip), %rax     # 0x75f3f
movq %rax, -0xb8(%rbp)
jmp 0x20030
movq -0x68(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0xa0(%rbp), %rdx
movq -0xa8(%rbp), %rsi
movq -0xb0(%rbp), %rdi
movq -0xb8(%rbp), %rcx
callq 0x21370
leaq -0x40(%rbp), %rdi
callq 0x9310
leaq -0x50(%rbp), %rdi
callq 0x9310
leaq -0x60(%rbp), %rdi
callq 0x9310
leaq -0x70(%rbp), %rdi
callq 0x9310
addq $0xc0, %rsp
popq %rbp
retq
nop