// File: /workspace/github_c_makefile_star2_O0/Ihsoh[P]ilang/compiler/frontend/irgen.c
// Function: ir_expr_bitwise
static void _ir_expr_bitwise(
	IRGeneratorContext *ctx,
	ResizableString *rstr,
	ResizableString *rstr_result_lhs_ptr,
	_ExprResult *expr_result,
	ParserASTNode *node
) {
	assert(ctx);
	assert(rstr);
	assert(expr_result);
	assert(node);
	assert(node->type == FE_NODE_EXPR_BAND
			|| node->type == FE_NODE_EXPR_BAND_ASSIGN
			|| node->type == FE_NODE_EXPR_BXOR
			|| node->type == FE_NODE_EXPR_BXOR_ASSIGN
			|| node->type == FE_NODE_EXPR_BOR
			|| node->type == FE_NODE_EXPR_BOR_ASSIGN);

	ParserSymbol *func_symbol = ctx->func_symbol;
	assert(func_symbol);

	ParserASTNode *node_lhs = node->childs[0];
	ParserASTNode *node_rhs = node->childs[1];

	ParserASTNode *node_type = FE_EXPR_AST_NODE_GET_TYPE_NODE(node);

	ParserASTNode *node_lhs_type = FE_EXPR_AST_NODE_GET_TYPE_NODE(node_lhs);
	ParserASTNode *node_rhs_type = FE_EXPR_AST_NODE_GET_TYPE_NODE(node_rhs);

	_ExprResult result_lhs;
	_ExprResult result_rhs;
	_ExprResult result_lhs_casted;
	_ExprResult result_rhs_casted;

	_expr_result_init(&result_lhs);
	_expr_result_init(&result_rhs);
	_expr_result_init(&result_lhs_casted);
	_expr_result_init(&result_rhs_casted);

	_ir_expr(ctx, rstr, &result_lhs, node_lhs);
	rstr_append_with_rstr(rstr, &(result_lhs.rstr_for_result_ptr));
	rstr_append_with_rstr(rstr, &(result_lhs.rstr_for_result));

	if (rstr_result_lhs_ptr != NULL) {
		rstr_append_with_rstr(
			rstr_result_lhs_ptr,
			&(result_lhs.rstr_result_ptr)
		);
	}

	_ir_expr(ctx, rstr, &result_rhs, node_rhs);
	rstr_append_with_rstr(rstr, &(result_rhs.rstr_for_result_ptr));
	rstr_append_with_rstr(rstr, &(result_rhs.rstr_for_result));

	_expr_result_cast(
		ctx,
		&result_lhs_casted,
		node_type,
		&result_lhs,
		node_lhs_type
	);
	rstr_append_with_rstr(rstr, &(result_lhs_casted.rstr_for_result_ptr));
	rstr_append_with_rstr(rstr, &(result_lhs_casted.rstr_for_result));

	_expr_result_cast(
		ctx,
		&result_rhs_casted,
		node_type,
		&result_rhs,
		node_rhs_type
	);
	rstr_append_with_rstr(rstr, &(result_rhs_casted.rstr_for_result_ptr));
	rstr_append_with_rstr(rstr, &(result_rhs_casted.rstr_for_result));

	ResizableString rstr_tmp_label_val;
	rstr_init(&rstr_tmp_label_val);
	_generate_func_tmp_var(
		ctx,
		func_symbol,
		&rstr_tmp_label_val,
		node_type
	);

	#define	_A(cmd)	\
		rstr_appendf(	\
			&(expr_result->rstr_for_result),	\
			cmd" %s, %s, %s;\n",	\
			RSTR_CSTR(&rstr_tmp_label_val),	\
			RSTR_CSTR(&(result_lhs_casted.rstr_result)),	\
			RSTR_CSTR(&(result_rhs_casted.rstr_result))	\
		);

	switch (node->type) {
		case FE_NODE_EXPR_BAND:
		case FE_NODE_EXPR_BAND_ASSIGN: {
			_A("band")
			break;
		}
		case FE_NODE_EXPR_BXOR:
		case FE_NODE_EXPR_BXOR_ASSIGN: {
			_A("bxor")
			break;
		}
		case FE_NODE_EXPR_BOR:
		case FE_NODE_EXPR_BOR_ASSIGN: {
			_A("bor")
			break;
		}
		default: {
			assert(0);
		}
	}

	#undef	_A

	_expr_result_set_result(
		expr_result,
		RSTR_CSTR(&rstr_tmp_label_val)
	);

	_expr_result_free(&result_lhs);
	_expr_result_free(&result_rhs);
	_expr_result_free(&result_lhs_casted);
	_expr_result_free(&result_rhs_casted);
	rstr_free(&rstr_tmp_label_val);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x230, %rsp            # imm = 0x230
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x1cfa8
jmp 0x1cfc7
leaq 0x5f5a7(%rip), %rdi     # 0x7c556
leaq 0x573de(%rip), %rsi     # 0x74394
movl $0xb03, %edx            # imm = 0xB03
leaq 0x58b93(%rip), %rcx     # 0x75b55
callq 0x30a0
cmpq $0x0, -0x10(%rbp)
je 0x1cfd0
jmp 0x1cfef
leaq 0x55b37(%rip), %rdi     # 0x72b0e
leaq 0x573b6(%rip), %rsi     # 0x74394
movl $0xb04, %edx            # imm = 0xB04
leaq 0x58b6b(%rip), %rcx     # 0x75b55
callq 0x30a0
cmpq $0x0, -0x20(%rbp)
je 0x1cff8
jmp 0x1d017
leaq 0x57c14(%rip), %rdi     # 0x74c13
leaq 0x5738e(%rip), %rsi     # 0x74394
movl $0xb05, %edx            # imm = 0xB05
leaq 0x58b43(%rip), %rcx     # 0x75b55
callq 0x30a0
cmpq $0x0, -0x28(%rbp)
je 0x1d020
jmp 0x1d03f
leaq 0x58fac(%rip), %rdi     # 0x75fd3
leaq 0x57366(%rip), %rsi     # 0x74394
movl $0xb06, %edx            # imm = 0xB06
leaq 0x58b1b(%rip), %rcx     # 0x75b55
callq 0x30a0
movq -0x28(%rbp), %rax
cmpl $0xe60, (%rax)          # imm = 0xE60
je 0x1d087
movq -0x28(%rbp), %rax
cmpl $0xe16, (%rax)          # imm = 0xE16
je 0x1d087
movq -0x28(%rbp), %rax
cmpl $0xe50, (%rax)          # imm = 0xE50
je 0x1d087
movq -0x28(%rbp), %rax
cmpl $0xe18, (%rax)          # imm = 0xE18
je 0x1d087
movq -0x28(%rbp), %rax
cmpl $0xe40, (%rax)          # imm = 0xE40
je 0x1d087
movq -0x28(%rbp), %rax
cmpl $0xe17, (%rax)          # imm = 0xE17
jne 0x1d089
jmp 0x1d0a8
leaq 0x58b37(%rip), %rdi     # 0x75bc7
leaq 0x572fd(%rip), %rsi     # 0x74394
movl $0xb0c, %edx            # imm = 0xB0C
leaq 0x58ab2(%rip), %rcx     # 0x75b55
callq 0x30a0
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x1d0bd
jmp 0x1d0dc
leaq 0x590af(%rip), %rdi     # 0x76173
leaq 0x572c9(%rip), %rsi     # 0x74394
movl $0xb0f, %edx            # imm = 0xB0F
leaq 0x58a7e(%rip), %rcx     # 0x75b55
callq 0x30a0
movq -0x28(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
movq 0x68(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rax
movq 0x68(%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x40(%rbp), %rax
movq 0x68(%rax), %rax
movq %rax, -0x58(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x113b0
leaq -0xd8(%rbp), %rdi
callq 0x113b0
leaq -0x118(%rbp), %rdi
callq 0x113b0
leaq -0x158(%rbp), %rdi
callq 0x113b0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rcx
leaq -0x98(%rbp), %rdx
callq 0x13d10
movq -0x10(%rbp), %rdi
leaq -0x98(%rbp), %rsi
addq $0x10, %rsi
callq 0x9100
movq -0x10(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x9100
cmpq $0x0, -0x18(%rbp)
je 0x1d1a6
movq -0x18(%rbp), %rdi
leaq -0x98(%rbp), %rsi
addq $0x30, %rsi
callq 0x9100
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x40(%rbp), %rcx
leaq -0xd8(%rbp), %rdx
movq %rdx, -0x188(%rbp)
callq 0x13d10
movq -0x10(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x9100
movq -0x188(%rbp), %rsi
movq -0x10(%rbp), %rdi
callq 0x9100
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rdx
movq -0x50(%rbp), %r8
leaq -0x118(%rbp), %rsi
movq %rsi, -0x190(%rbp)
leaq -0x98(%rbp), %rcx
callq 0x11460
movq -0x10(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x9100
movq -0x190(%rbp), %rsi
movq -0x10(%rbp), %rdi
callq 0x9100
movq -0x188(%rbp), %rcx
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rdx
movq -0x58(%rbp), %r8
leaq -0x158(%rbp), %rsi
movq %rsi, -0x180(%rbp)
callq 0x11460
movq -0x10(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0x9100
movq -0x180(%rbp), %rsi
movq -0x10(%rbp), %rdi
callq 0x9100
leaq -0x168(%rbp), %rdi
movq %rdi, -0x178(%rbp)
callq 0x8c90
movq -0x178(%rbp), %rdx
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x48(%rbp), %rcx
callq 0x1ab00
movq -0x28(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x16c(%rbp)
subl $0xe16, %eax            # imm = 0xE16
je 0x1d310
jmp 0x1d2b1
movl -0x16c(%rbp), %eax
subl $0xe17, %eax            # imm = 0xE17
je 0x1d4ac
jmp 0x1d2c4
movl -0x16c(%rbp), %eax
subl $0xe18, %eax            # imm = 0xE18
je 0x1d3de
jmp 0x1d2d7
movl -0x16c(%rbp), %eax
subl $0xe40, %eax            # imm = 0xE40
je 0x1d4ac
jmp 0x1d2ea
movl -0x16c(%rbp), %eax
subl $0xe50, %eax            # imm = 0xE50
je 0x1d3de
jmp 0x1d2fd
movl -0x16c(%rbp), %eax
subl $0xe60, %eax            # imm = 0xE60
jne 0x1d577
jmp 0x1d310
movq -0x20(%rbp), %rax
movq %rax, -0x198(%rbp)
cmpq $0x0, -0x160(%rbp)
jne 0x1d335
leaq 0x5a589(%rip), %rax     # 0x778b5
movq %rax, -0x1a0(%rbp)
jmp 0x1d343
movq -0x160(%rbp), %rax
movq %rax, -0x1a0(%rbp)
movq -0x1a0(%rbp), %rax
movq %rax, -0x1a8(%rbp)
cmpq $0x0, -0xf0(%rbp)
jne 0x1d36b
leaq 0x5a553(%rip), %rax     # 0x778b5
movq %rax, -0x1b0(%rbp)
jmp 0x1d379
movq -0xf0(%rbp), %rax
movq %rax, -0x1b0(%rbp)
movq -0x1b0(%rbp), %rax
movq %rax, -0x1b8(%rbp)
cmpq $0x0, -0x130(%rbp)
jne 0x1d3a1
leaq 0x5a51d(%rip), %rax     # 0x778b5
movq %rax, -0x1c0(%rbp)
jmp 0x1d3af
movq -0x130(%rbp), %rax
movq %rax, -0x1c0(%rbp)
movq -0x1b8(%rbp), %rcx
movq -0x1a8(%rbp), %rdx
movq -0x198(%rbp), %rdi
movq -0x1c0(%rbp), %r8
leaq 0x588d7(%rip), %rsi     # 0x75ca9
movb $0x0, %al
callq 0x94d0
jmp 0x1d596
movq -0x20(%rbp), %rax
movq %rax, -0x1c8(%rbp)
cmpq $0x0, -0x160(%rbp)
jne 0x1d403
leaq 0x5a4bb(%rip), %rax     # 0x778b5
movq %rax, -0x1d0(%rbp)
jmp 0x1d411
movq -0x160(%rbp), %rax
movq %rax, -0x1d0(%rbp)
movq -0x1d0(%rbp), %rax
movq %rax, -0x1d8(%rbp)
cmpq $0x0, -0xf0(%rbp)
jne 0x1d439
leaq 0x5a485(%rip), %rax     # 0x778b5
movq %rax, -0x1e0(%rbp)
jmp 0x1d447
movq -0xf0(%rbp), %rax
movq %rax, -0x1e0(%rbp)
movq -0x1e0(%rbp), %rax
movq %rax, -0x1e8(%rbp)
cmpq $0x0, -0x130(%rbp)
jne 0x1d46f
leaq 0x5a44f(%rip), %rax     # 0x778b5
movq %rax, -0x1f0(%rbp)
jmp 0x1d47d
movq -0x130(%rbp), %rax
movq %rax, -0x1f0(%rbp)
movq -0x1e8(%rbp), %rcx
movq -0x1d8(%rbp), %rdx
movq -0x1c8(%rbp), %rdi
movq -0x1f0(%rbp), %r8
leaq 0x5881b(%rip), %rsi     # 0x75cbb
movb $0x0, %al
callq 0x94d0
jmp 0x1d596
movq -0x20(%rbp), %rax
movq %rax, -0x1f8(%rbp)
cmpq $0x0, -0x160(%rbp)
jne 0x1d4d1
leaq 0x5a3ed(%rip), %rax     # 0x778b5
movq %rax, -0x200(%rbp)
jmp 0x1d4df
movq -0x160(%rbp), %rax
movq %rax, -0x200(%rbp)
movq -0x200(%rbp), %rax
movq %rax, -0x208(%rbp)
cmpq $0x0, -0xf0(%rbp)
jne 0x1d507
leaq 0x5a3b7(%rip), %rax     # 0x778b5
movq %rax, -0x210(%rbp)
jmp 0x1d515
movq -0xf0(%rbp), %rax
movq %rax, -0x210(%rbp)
movq -0x210(%rbp), %rax
movq %rax, -0x218(%rbp)
cmpq $0x0, -0x130(%rbp)
jne 0x1d53d
leaq 0x5a381(%rip), %rax     # 0x778b5
movq %rax, -0x220(%rbp)
jmp 0x1d54b
movq -0x130(%rbp), %rax
movq %rax, -0x220(%rbp)
movq -0x218(%rbp), %rcx
movq -0x208(%rbp), %rdx
movq -0x1f8(%rbp), %rdi
movq -0x220(%rbp), %r8
leaq 0x5875f(%rip), %rsi     # 0x75ccd
movb $0x0, %al
callq 0x94d0
jmp 0x1d596
leaq 0x54edd(%rip), %rdi     # 0x7245b
leaq 0x56e0f(%rip), %rsi     # 0x74394
movl $0xb69, %edx            # imm = 0xB69
leaq 0x585c4(%rip), %rcx     # 0x75b55
callq 0x30a0
movq -0x20(%rbp), %rax
movq %rax, -0x228(%rbp)
cmpq $0x0, -0x160(%rbp)
jne 0x1d5bb
leaq 0x5a303(%rip), %rax     # 0x778b5
movq %rax, -0x230(%rbp)
jmp 0x1d5c9
movq -0x160(%rbp), %rax
movq %rax, -0x230(%rbp)
movq -0x228(%rbp), %rdi
movq -0x230(%rbp), %rsi
callq 0x1a6c0
leaq -0x98(%rbp), %rdi
callq 0x130a0
leaq -0xd8(%rbp), %rdi
callq 0x130a0
leaq -0x118(%rbp), %rdi
callq 0x130a0
leaq -0x158(%rbp), %rdi
callq 0x130a0
leaq -0x168(%rbp), %rdi
callq 0x9310
addq $0x230, %rsp            # imm = 0x230
popq %rbp
retq
nopw %cs:(%rax,%rax)