// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/backend/asmgen_gas64.c
// Function: asm_stat_neg
static void _asm_stat_neg(
	ASMGeneratorGas64Context *ctx,
	ParserASTNode *node
) {
	assert(ctx);
	assert(node);
	assert(node->type == BE_NODE_STAT_NEG);
	assert(node->nchilds == 2);

	ParserASTNode *node_target = node->childs[0];
	assert(node_target->type == BE_NODE_IDENTIFIER);
	ParserSymbol *symbol_target = _get_var_symbol_by_id_node(ctx, node_target);
	uint8_t type_target = BE_VAR_SYMBOL_GET_TYPE(symbol_target);

	ParserASTNode *node_source = node->childs[1];

	if (be_sem_is_integer_type(type_target)) {
		_move_id_or_constexpr_to_reg(
			ctx,
			_ASM_REG_AX,
			node_source
		);

		_asm_inst_mov_x_x(
			ctx,
			ctx->body,
			BE_TYPE_UINT64,
			_ASM_REG_NAME_RBX,
			_ASM_CONST_0
		);

		_asm_inst_sub_x_x(
			ctx,
			ctx->body,
			BE_TYPE_UINT64,
			_ASM_REG_NAME_RBX,
			_ASM_REG_NAME_RAX
		);

		_asm_inst_mov_sym_x(
			ctx,
			ctx->body,
			symbol_target,
			_asm_inst_reg(ctx, type_target, _ASM_REG_BX)
		);
	} else {
		assert(0);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x2f009
jmp 0x2f028
leaq 0x51151(%rip), %rdi     # 0x80161
leaq 0x4baed(%rip), %rsi     # 0x7ab04
movl $0x15c3, %edx           # imm = 0x15C3
leaq 0x4e37e(%rip), %rcx     # 0x7d3a1
callq 0x30a0
cmpq $0x0, -0x10(%rbp)
je 0x2f031
jmp 0x2f050
leaq 0x47524(%rip), %rdi     # 0x7655c
leaq 0x4bac5(%rip), %rsi     # 0x7ab04
movl $0x15c4, %edx           # imm = 0x15C4
leaq 0x4e356(%rip), %rcx     # 0x7d3a1
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0xbe8, (%rax)          # imm = 0xBE8
jne 0x2f05e
jmp 0x2f07d
leaq 0x4a5a2(%rip), %rdi     # 0x79607
leaq 0x4ba98(%rip), %rsi     # 0x7ab04
movl $0x15c5, %edx           # imm = 0x15C5
leaq 0x4e329(%rip), %rcx     # 0x7d3a1
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0x2, 0x44(%rax)
jne 0x2f089
jmp 0x2f0a8
leaq 0x53cb4(%rip), %rdi     # 0x82d44
leaq 0x4ba6d(%rip), %rsi     # 0x7ab04
movl $0x15c6, %edx           # imm = 0x15C6
leaq 0x4e2fe(%rip), %rcx     # 0x7d3a1
callq 0x30a0
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x200, (%rax)          # imm = 0x200
jne 0x2f0c5
jmp 0x2f0e4
leaq 0x472f1(%rip), %rdi     # 0x763bd
leaq 0x4ba31(%rip), %rsi     # 0x7ab04
movl $0x15c9, %edx           # imm = 0x15C9
leaq 0x4e2c2(%rip), %rcx     # 0x7d3a1
callq 0x30a0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x32820
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movb 0x30(%rax), %al
movb %al, -0x21(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movzbl -0x21(%rbp), %edi
callq 0x4da80
testb $0x1, %al
jne 0x2f121
jmp 0x2f1bc
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rdx
xorl %esi, %esi
callq 0x334a0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x9, %edx
leaq 0x4c5b7(%rip), %rcx     # 0x7b6ff
leaq 0x4791c(%rip), %r8      # 0x76a6b
callq 0x33720
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x9, %edx
leaq 0x4c593(%rip), %rcx     # 0x7b6ff
leaq 0x4bf47(%rip), %r8      # 0x7b0ba
callq 0x37320
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movl $0x1, %edx
movzbl -0x21(%rbp), %esi
callq 0x334d0
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq %rax, %rcx
callq 0x32d40
jmp 0x2f1db
leaq 0x44297(%rip), %rdi     # 0x7345a
leaq 0x4b93a(%rip), %rsi     # 0x7ab04
movl $0x15ed, %edx           # imm = 0x15ED
leaq 0x4e1cb(%rip), %rcx     # 0x7d3a1
callq 0x30a0
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)