// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/backend/asmgen_gas32.c
// Function: asm_stat_neg
static void _asm_stat_neg(
	ASMGeneratorGas32Context *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,
			_ASM_REG_BX,
			node_source
		);

		if (type_target == BE_TYPE_INT64 || type_target == BE_TYPE_UINT64) {
			_asm_inst_mov_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT32,
				_ASM_REG_NAME_ECX,
				_ASM_CONST_0
			);

			_asm_inst_mov_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT32,
				_ASM_REG_NAME_EDX,
				_ASM_CONST_0
			);

			_emu_sub_64(
				ctx,
				_ASM_REG_NAME_ECX, _ASM_REG_NAME_EDX,
				_ASM_REG_NAME_EAX, _ASM_REG_NAME_EBX
			);

			ParserSymbol *symbol_target_l = _instantiate_varsym(ctx, symbol_target, 0);
			ParserSymbol *symbol_target_h = _instantiate_varsym(ctx, symbol_target, 4);

			_asm_inst_mov_sym_x(
				ctx,
				ctx->body,
				symbol_target_l,
				_ASM_REG_NAME_ECX
			);

			_asm_inst_mov_sym_x(
				ctx,
				ctx->body,
				symbol_target_h,
				_ASM_REG_NAME_EDX
			);

			_free_varsym(ctx, symbol_target_l);
			_free_varsym(ctx, symbol_target_h);
		} else {
			_asm_inst_mov_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT32,
				_ASM_REG_NAME_EBX,
				_ASM_CONST_0
			);

			_asm_inst_sub_x_x(
				ctx,
				ctx->body,
				BE_TYPE_UINT32,
				_ASM_REG_NAME_EBX,
				_ASM_REG_NAME_EAX
			);

			ParserSymbol *symbol_target_l = _instantiate_varsym(ctx, symbol_target, 0);

			_asm_inst_mov_sym_x(
				ctx,
				ctx->body,
				symbol_target_l,
				_asm_inst_reg(ctx, type_target, _ASM_REG_BX)
			);

			_free_varsym(ctx, symbol_target_l);
		}
	} else {
		assert(0);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x18d59
jmp 0x18d78
leaq 0x67401(%rip), %rdi     # 0x80161
leaq 0x5cb91(%rip), %rsi     # 0x758f8
movl $0x1d4c, %edx           # imm = 0x1D4C
leaq 0x60854(%rip), %rcx     # 0x795c7
callq 0x30a0
cmpq $0x0, -0x10(%rbp)
je 0x18d81
jmp 0x18da0
leaq 0x5d7d4(%rip), %rdi     # 0x7655c
leaq 0x5cb69(%rip), %rsi     # 0x758f8
movl $0x1d4d, %edx           # imm = 0x1D4D
leaq 0x6082c(%rip), %rcx     # 0x795c7
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0xbe8, (%rax)          # imm = 0xBE8
jne 0x18dae
jmp 0x18dcd
leaq 0x60852(%rip), %rdi     # 0x79607
leaq 0x5cb3c(%rip), %rsi     # 0x758f8
movl $0x1d4e, %edx           # imm = 0x1D4E
leaq 0x607ff(%rip), %rcx     # 0x795c7
callq 0x30a0
movq -0x10(%rbp), %rax
cmpl $0x2, 0x44(%rax)
jne 0x18dd9
jmp 0x18df8
leaq 0x69f64(%rip), %rdi     # 0x82d44
leaq 0x5cb11(%rip), %rsi     # 0x758f8
movl $0x1d4f, %edx           # imm = 0x1D4F
leaq 0x607d4(%rip), %rcx     # 0x795c7
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 0x18e15
jmp 0x18e34
leaq 0x5d5a1(%rip), %rdi     # 0x763bd
leaq 0x5cad5(%rip), %rsi     # 0x758f8
movl $0x1d52, %edx           # imm = 0x1D52
leaq 0x60798(%rip), %rcx     # 0x795c7
callq 0x30a0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x1f720
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 0x18e71
jmp 0x19041
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rcx
xorl %esi, %esi
movl $0x1, %edx
callq 0x22a20
movzbl -0x21(%rbp), %eax
cmpl $0x5, %eax
je 0x18e9b
movzbl -0x21(%rbp), %eax
cmpl $0x9, %eax
jne 0x18f88
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x5dc9c(%rip), %rcx     # 0x76b4f
leaq 0x5dbb1(%rip), %r8      # 0x76a6b
callq 0x20f30
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x5dc85(%rip), %rcx     # 0x76b5c
leaq 0x5db8d(%rip), %r8      # 0x76a6b
callq 0x20f30
movq -0x8(%rbp), %rdi
leaq 0x5dc61(%rip), %rsi     # 0x76b4f
leaq 0x5dc67(%rip), %rdx     # 0x76b5c
leaq 0x5d4e9(%rip), %rcx     # 0x763e5
leaq 0x5d4e7(%rip), %r8      # 0x763ea
callq 0x25b70
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
xorl %edx, %edx
callq 0x1f8e0
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl $0x4, %edx
callq 0x1f8e0
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x38(%rbp), %rdx
leaq 0x5dc07(%rip), %rcx     # 0x76b4f
callq 0x20080
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x40(%rbp), %rdx
leaq 0x5dbf8(%rip), %rcx     # 0x76b5c
callq 0x20080
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x1fd10
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x1fd10
jmp 0x1903f
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x5d44a(%rip), %rcx     # 0x763ea
leaq 0x5dac4(%rip), %r8      # 0x76a6b
callq 0x20f30
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
movl $0x8, %edx
leaq 0x5d426(%rip), %rcx     # 0x763ea
leaq 0x5d41a(%rip), %r8      # 0x763e5
callq 0x25a30
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
xorl %edx, %edx
callq 0x1f8e0
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
movl $0x1, %edx
leaq 0x5c8e9(%rip), %rcx     # 0x758f8
movl $0x1da1, %r8d           # imm = 0x1DA1
movzbl -0x21(%rbp), %esi
callq 0x20d10
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq %rax, %rcx
callq 0x20080
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x1fd10
jmp 0x19060
leaq 0x5a412(%rip), %rdi     # 0x7345a
leaq 0x5c8a9(%rip), %rsi     # 0x758f8
movl $0x1da7, %edx           # imm = 0x1DA7
leaq 0x6056c(%rip), %rcx     # 0x795c7
callq 0x30a0
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)