// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/frontend/irgen_c.c
// Function: ir_expr_unary
static bool _ir_expr_unary(
	IRGeneratorCContext *ctx,
	ResizableString *rstr,
	ParserASTNode *node_expr
) {
	assert(ctx);
	assert(rstr);
	assert(node_expr);

	#define	_IR_EXPR_UNARY(str_opt)	\
	{	\
		assert(node_expr->nchilds == 1);	\
		rstr_append_with_cstr(rstr, "(");	\
		rstr_append_with_cstr(rstr, (str_opt));	\
		_ir_expr(ctx, rstr, node_expr->childs[0]);	\
		rstr_append_with_cstr(rstr, ")");	\
	}

	#define	_IR_EXPR_UNARY_POSTFIX(str_opt)	\
	{	\
		assert(node_expr->nchilds == 1);	\
		rstr_append_with_cstr(rstr, "(");	\
		_ir_expr(ctx, rstr, node_expr->childs[0]);	\
		rstr_append_with_cstr(rstr, (str_opt));	\
		rstr_append_with_cstr(rstr, ")");	\
	}

	switch (node_expr->type) {
		case FE_NODE_EXPR_NOT: {
			_IR_EXPR_UNARY("!")
			return true;
		}
		case FE_NODE_EXPR_POSITIVE: {
			_IR_EXPR_UNARY("+")
			return true;
		}
		case FE_NODE_EXPR_NEGATIVE: {
			_IR_EXPR_UNARY("-")
			return true;
		}
		case FE_NODE_EXPR_BNOT: {
			_IR_EXPR_UNARY("~")
			return true;
		}
		case FE_NODE_EXPR_INC_LEFT: {
			_IR_EXPR_UNARY("++")
			return true;
		}
		case FE_NODE_EXPR_DEC_LEFT: {
			_IR_EXPR_UNARY("--")
			return true;
		}
		case FE_NODE_EXPR_INC_RIGHT: {
			_IR_EXPR_UNARY_POSTFIX("++")
			return true;
		}
		case FE_NODE_EXPR_DEC_RIGHT: {
			_IR_EXPR_UNARY_POSTFIX("--")
			return true;
		}
		case FE_NODE_EXPR_SIZEOF: {
			assert(node_expr->nchilds == 1);

			_IR_EXPR_AUTO_CAST_BEGIN

			rstr_append_with_cstr(rstr, "(sizeof(");
			
			ResizableString rstr_type;
			rstr_init(&rstr_type);
			_ir_type(ctx, &rstr_type, node_expr->childs[0]);
			rstr_append_with_rstr(rstr, &rstr_type);
			rstr_free(&rstr_type);
			
			rstr_append_with_cstr(rstr, "))");

			_IR_EXPR_AUTO_CAST_END
			
			return true;
		}
		case FE_NODE_EXPR_CAST: {
			assert(node_expr->nchilds == 2);

			rstr_append_with_cstr(rstr, "((");

			ResizableString rstr_type;
			rstr_init(&rstr_type);
			_ir_type(ctx, &rstr_type, node_expr->childs[0]);
			rstr_append_with_rstr(rstr, &rstr_type);
			rstr_free(&rstr_type);

			rstr_append_with_cstr(rstr, ")");
			_ir_expr(ctx, rstr, node_expr->childs[1]);
			rstr_append_with_cstr(rstr, ")");

			return true;
		}
		case FE_NODE_EXPR_REF: {
			_IR_EXPR_UNARY("&")
			return true;
		}
		case FE_NODE_EXPR_DEREF: {
			_IR_EXPR_UNARY("*")
			return true;
		}
		case FE_NODE_EXPR_VA_ARG: {
			assert(node_expr->nchilds == 2);

			rstr_append_with_cstr(rstr, "(va_arg(");

			_ir_expr(ctx, rstr, node_expr->childs[0]);

			rstr_append_with_cstr(rstr, ", ");

			ResizableString rstr_type;
			rstr_init(&rstr_type);
			_ir_type(ctx, &rstr_type, node_expr->childs[1]);
			rstr_append_with_rstr(rstr, &rstr_type);
			rstr_free(&rstr_type);

			rstr_append_with_cstr(rstr, "))");

			return true;
		}
		default: {
			return false;
		}
	}

	#undef	_IR_EXPR_UNARY
	#undef	_IR_EXPR_UNARY_POSTFIX
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x230a0
jmp 0x230bf
leaq 0x594af(%rip), %rdi     # 0x7c556
leaq 0x53d3a(%rip), %rsi     # 0x76de8
movl $0x231, %edx            # imm = 0x231
leaq 0x54304(%rip), %rcx     # 0x773be
callq 0x30a0
cmpq $0x0, -0x18(%rbp)
je 0x230c8
jmp 0x230e7
leaq 0x4fa3f(%rip), %rdi     # 0x72b0e
leaq 0x53d12(%rip), %rsi     # 0x76de8
movl $0x232, %edx            # imm = 0x232
leaq 0x542dc(%rip), %rcx     # 0x773be
callq 0x30a0
cmpq $0x0, -0x20(%rbp)
je 0x230f0
jmp 0x2310f
leaq 0x53ffe(%rip), %rdi     # 0x770f5
leaq 0x53cea(%rip), %rsi     # 0x76de8
movl $0x233, %edx            # imm = 0x233
leaq 0x542b4(%rip), %rcx     # 0x773be
callq 0x30a0
movq -0x20(%rbp), %rax
movl (%rax), %eax
addl $0xfffff140, %eax       # imm = 0xFFFFF140
movl %eax, %ecx
movq %rcx, -0x68(%rbp)
subl $0xe, %eax
ja 0x23874
movq -0x68(%rbp), %rax
leaq 0x53c3c(%rip), %rcx     # 0x76d70
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x20(%rbp), %rax
cmpl $0x1, 0x44(%rax)
jne 0x23149
jmp 0x23168
leaq 0x53faf(%rip), %rdi     # 0x770ff
leaq 0x53c91(%rip), %rsi     # 0x76de8
movl $0x249, %edx            # imm = 0x249
leaq 0x5425b(%rip), %rcx     # 0x773be
callq 0x30a0
movq -0x18(%rbp), %rdi
leaq 0x548ea(%rip), %rsi     # 0x77a5d
callq 0x8d70
movq -0x18(%rbp), %rdi
leaq 0x51311(%rip), %rsi     # 0x74494
callq 0x8d70
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rdx
callq 0x227b0
movq -0x18(%rbp), %rdi
leaq 0x53df3(%rip), %rsi     # 0x76f9e
callq 0x8d70
movb $0x1, -0x1(%rbp)
jmp 0x23878
movq -0x20(%rbp), %rax
cmpl $0x1, 0x44(%rax)
jne 0x231c5
jmp 0x231e4
leaq 0x53f33(%rip), %rdi     # 0x770ff
leaq 0x53c15(%rip), %rsi     # 0x76de8
movl $0x24d, %edx            # imm = 0x24D
leaq 0x541df(%rip), %rcx     # 0x773be
callq 0x30a0
movq -0x18(%rbp), %rdi
leaq 0x5486e(%rip), %rsi     # 0x77a5d
callq 0x8d70
movq -0x18(%rbp), %rdi
leaq 0x54212(%rip), %rsi     # 0x77411
callq 0x8d70
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rdx
callq 0x227b0
movq -0x18(%rbp), %rdi
leaq 0x53d77(%rip), %rsi     # 0x76f9e
callq 0x8d70
movb $0x1, -0x1(%rbp)
jmp 0x23878
movq -0x20(%rbp), %rax
cmpl $0x1, 0x44(%rax)
jne 0x23241
jmp 0x23260
leaq 0x53eb7(%rip), %rdi     # 0x770ff
leaq 0x53b99(%rip), %rsi     # 0x76de8
movl $0x251, %edx            # imm = 0x251
leaq 0x54163(%rip), %rcx     # 0x773be
callq 0x30a0
movq -0x18(%rbp), %rdi
leaq 0x547f2(%rip), %rsi     # 0x77a5d
callq 0x8d70
movq -0x18(%rbp), %rdi
leaq 0x54199(%rip), %rsi     # 0x77414
callq 0x8d70
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rdx
callq 0x227b0
movq -0x18(%rbp), %rdi
leaq 0x53cfb(%rip), %rsi     # 0x76f9e
callq 0x8d70
movb $0x1, -0x1(%rbp)
jmp 0x23878
movq -0x20(%rbp), %rax
cmpl $0x1, 0x44(%rax)
jne 0x232bd
jmp 0x232dc
leaq 0x53e3b(%rip), %rdi     # 0x770ff
leaq 0x53b1d(%rip), %rsi     # 0x76de8
movl $0x255, %edx            # imm = 0x255
leaq 0x540e7(%rip), %rcx     # 0x773be
callq 0x30a0
movq -0x18(%rbp), %rdi
leaq 0x54776(%rip), %rsi     # 0x77a5d
callq 0x8d70
movq -0x18(%rbp), %rdi
leaq 0x54117(%rip), %rsi     # 0x7740e
callq 0x8d70
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rdx
callq 0x227b0
movq -0x18(%rbp), %rdi
leaq 0x53c7f(%rip), %rsi     # 0x76f9e
callq 0x8d70
movb $0x1, -0x1(%rbp)
jmp 0x23878
movq -0x20(%rbp), %rax
cmpl $0x1, 0x44(%rax)
jne 0x23339
jmp 0x23358
leaq 0x53dbf(%rip), %rdi     # 0x770ff
leaq 0x53aa1(%rip), %rsi     # 0x76de8
movl $0x259, %edx            # imm = 0x259
leaq 0x5406b(%rip), %rcx     # 0x773be
callq 0x30a0
movq -0x18(%rbp), %rdi
leaq 0x546fa(%rip), %rsi     # 0x77a5d
callq 0x8d70
movq -0x18(%rbp), %rdi
leaq 0x5409d(%rip), %rsi     # 0x77410
callq 0x8d70
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rdx
callq 0x227b0
movq -0x18(%rbp), %rdi
leaq 0x53c03(%rip), %rsi     # 0x76f9e
callq 0x8d70
movb $0x1, -0x1(%rbp)
jmp 0x23878
movq -0x20(%rbp), %rax
cmpl $0x1, 0x44(%rax)
jne 0x233b5
jmp 0x233d4
leaq 0x53d43(%rip), %rdi     # 0x770ff
leaq 0x53a25(%rip), %rsi     # 0x76de8
movl $0x25d, %edx            # imm = 0x25D
leaq 0x53fef(%rip), %rcx     # 0x773be
callq 0x30a0
movq -0x18(%rbp), %rdi
leaq 0x5467e(%rip), %rsi     # 0x77a5d
callq 0x8d70
movq -0x18(%rbp), %rdi
leaq 0x54024(%rip), %rsi     # 0x77413
callq 0x8d70
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rdx
callq 0x227b0
movq -0x18(%rbp), %rdi
leaq 0x53b87(%rip), %rsi     # 0x76f9e
callq 0x8d70
movb $0x1, -0x1(%rbp)
jmp 0x23878
movq -0x20(%rbp), %rax
cmpl $0x1, 0x44(%rax)
jne 0x23431
jmp 0x23450
leaq 0x53cc7(%rip), %rdi     # 0x770ff
leaq 0x539a9(%rip), %rsi     # 0x76de8
movl $0x261, %edx            # imm = 0x261
leaq 0x53f73(%rip), %rcx     # 0x773be
callq 0x30a0
movq -0x18(%rbp), %rdi
leaq 0x54602(%rip), %rsi     # 0x77a5d
callq 0x8d70
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rdx
callq 0x227b0
movq -0x18(%rbp), %rdi
leaq 0x53f8d(%rip), %rsi     # 0x77410
callq 0x8d70
movq -0x18(%rbp), %rdi
leaq 0x53b0b(%rip), %rsi     # 0x76f9e
callq 0x8d70
movb $0x1, -0x1(%rbp)
jmp 0x23878
movq -0x20(%rbp), %rax
cmpl $0x1, 0x44(%rax)
jne 0x234ad
jmp 0x234cc
leaq 0x53c4b(%rip), %rdi     # 0x770ff
leaq 0x5392d(%rip), %rsi     # 0x76de8
movl $0x265, %edx            # imm = 0x265
leaq 0x53ef7(%rip), %rcx     # 0x773be
callq 0x30a0
movq -0x18(%rbp), %rdi
leaq 0x54586(%rip), %rsi     # 0x77a5d
callq 0x8d70
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rdx
callq 0x227b0
movq -0x18(%rbp), %rdi
leaq 0x53f14(%rip), %rsi     # 0x77413
callq 0x8d70
movq -0x18(%rbp), %rdi
leaq 0x53a8f(%rip), %rsi     # 0x76f9e
callq 0x8d70
movb $0x1, -0x1(%rbp)
jmp 0x23878
movq -0x20(%rbp), %rax
cmpl $0x1, 0x44(%rax)
jne 0x23529
jmp 0x23548
leaq 0x53bcf(%rip), %rdi     # 0x770ff
leaq 0x538b1(%rip), %rsi     # 0x76de8
movl $0x269, %edx            # imm = 0x269
leaq 0x53e7b(%rip), %rcx     # 0x773be
callq 0x30a0
leaq -0x30(%rbp), %rdi
callq 0x8c90
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x68(%rax), %rdx
leaq -0x30(%rbp), %rsi
callq 0x216c0
movq -0x18(%rbp), %rax
movq %rax, -0x70(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x23582
leaq 0x54339(%rip), %rax     # 0x778b5
movq %rax, -0x78(%rbp)
jmp 0x2358a
movq -0x28(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x70(%rbp), %rdi
movq -0x78(%rbp), %rdx
leaq 0x53bd2(%rip), %rsi     # 0x7716b
movb $0x0, %al
callq 0x94d0
movq -0x18(%rbp), %rdi
leaq 0x53e6b(%rip), %rsi     # 0x77416
callq 0x8d70
leaq -0x40(%rbp), %rdi
callq 0x8c90
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rdx
leaq -0x40(%rbp), %rsi
callq 0x216c0
movq -0x18(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x9100
leaq -0x40(%rbp), %rdi
callq 0x9310
movq -0x18(%rbp), %rdi
leaq 0x539ab(%rip), %rsi     # 0x76f9d
callq 0x8d70
leaq -0x30(%rbp), %rdi
callq 0x9310
movq -0x18(%rbp), %rdi
movl $0x29, %esi
callq 0x8ea0
movb $0x1, -0x1(%rbp)
jmp 0x23878
movq -0x20(%rbp), %rax
cmpl $0x2, 0x44(%rax)
jne 0x23623
jmp 0x23642
leaq 0x53cee(%rip), %rdi     # 0x77318
leaq 0x537b7(%rip), %rsi     # 0x76de8
movl $0x27c, %edx            # imm = 0x27C
leaq 0x53d81(%rip), %rcx     # 0x773be
callq 0x30a0
movq -0x18(%rbp), %rdi
leaq 0x53dd2(%rip), %rsi     # 0x7741f
callq 0x8d70
leaq -0x50(%rbp), %rdi
callq 0x8c90
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rdx
leaq -0x50(%rbp), %rsi
callq 0x216c0
movq -0x18(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x9100
leaq -0x50(%rbp), %rdi
callq 0x9310
movq -0x18(%rbp), %rdi
leaq 0x5390a(%rip), %rsi     # 0x76f9e
callq 0x8d70
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rdx
callq 0x227b0
movq -0x18(%rbp), %rdi
leaq 0x538e1(%rip), %rsi     # 0x76f9e
callq 0x8d70
movb $0x1, -0x1(%rbp)
jmp 0x23878
movq -0x20(%rbp), %rax
cmpl $0x1, 0x44(%rax)
jne 0x236d7
jmp 0x236f6
leaq 0x53a21(%rip), %rdi     # 0x770ff
leaq 0x53703(%rip), %rsi     # 0x76de8
movl $0x28d, %edx            # imm = 0x28D
leaq 0x53ccd(%rip), %rcx     # 0x773be
callq 0x30a0
movq -0x18(%rbp), %rdi
leaq 0x5435c(%rip), %rsi     # 0x77a5d
callq 0x8d70
movq -0x18(%rbp), %rdi
leaq 0x578cc(%rip), %rsi     # 0x7afdd
callq 0x8d70
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rdx
callq 0x227b0
movq -0x18(%rbp), %rdi
leaq 0x53865(%rip), %rsi     # 0x76f9e
callq 0x8d70
movb $0x1, -0x1(%rbp)
jmp 0x23878
movq -0x20(%rbp), %rax
cmpl $0x1, 0x44(%rax)
jne 0x23753
jmp 0x23772
leaq 0x539a5(%rip), %rdi     # 0x770ff
leaq 0x53687(%rip), %rsi     # 0x76de8
movl $0x291, %edx            # imm = 0x291
leaq 0x53c51(%rip), %rcx     # 0x773be
callq 0x30a0
movq -0x18(%rbp), %rdi
leaq 0x542e0(%rip), %rsi     # 0x77a5d
callq 0x8d70
movq -0x18(%rbp), %rdi
leaq 0x538ae(%rip), %rsi     # 0x7703b
callq 0x8d70
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rdx
callq 0x227b0
movq -0x18(%rbp), %rdi
leaq 0x537e9(%rip), %rsi     # 0x76f9e
callq 0x8d70
movb $0x1, -0x1(%rbp)
jmp 0x23878
movq -0x20(%rbp), %rax
cmpl $0x2, 0x44(%rax)
jne 0x237cf
jmp 0x237ee
leaq 0x53b42(%rip), %rdi     # 0x77318
leaq 0x5360b(%rip), %rsi     # 0x76de8
movl $0x295, %edx            # imm = 0x295
leaq 0x53bd5(%rip), %rcx     # 0x773be
callq 0x30a0
movq -0x18(%rbp), %rdi
leaq 0x53c29(%rip), %rsi     # 0x77422
callq 0x8d70
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rdx
callq 0x227b0
movq -0x18(%rbp), %rdi
leaq 0x519a8(%rip), %rsi     # 0x751c9
callq 0x8d70
leaq -0x60(%rbp), %rdi
callq 0x8c90
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rdx
leaq -0x60(%rbp), %rsi
callq 0x216c0
movq -0x18(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x9100
leaq -0x60(%rbp), %rdi
callq 0x9310
movq -0x18(%rbp), %rdi
leaq 0x53734(%rip), %rsi     # 0x76f9d
callq 0x8d70
movb $0x1, -0x1(%rbp)
jmp 0x23878
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)