// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
testq %rcx, %rcx
je 0x127c1
movq %rsi, %r12
movq %rdi, %r15
movl (%r8), %eax
leal -0xe16(%rax), %esi
cmpl $0x3, %esi
jb 0x12543
addl $0xfffff1c0, %eax       # imm = 0xFFFFF1C0
cmpl $0x20, %eax
ja 0x127ff
movabsq $0x100010001, %rsi      # imm = 0x100010001
btq %rax, %rsi
jae 0x127ff
movq %rdx, -0x58(%rbp)
movq %rcx, -0x50(%rbp)
movq 0x40(%r15), %rax
movq %rax, -0x60(%rbp)
testq %rax, %rax
je 0x127e0
movq 0x48(%r8), %rax
movq %r8, -0x48(%rbp)
movq 0x68(%r8), %rcx
movq %rcx, -0x40(%rbp)
movq (%rax), %r14
movq 0x8(%rax), %rbx
movq 0x68(%r14), %rax
movq %rax, -0x30(%rbp)
movq 0x68(%rbx), %rax
movq %rax, -0x38(%rbp)
leaq -0xb0(%rbp), %r13
movq %r13, %rdi
callq 0xd03d
leaq -0x170(%rbp), %rdi
callq 0xd03d
leaq -0x130(%rbp), %rdi
callq 0xd03d
leaq -0xf0(%rbp), %rdi
callq 0xd03d
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %r14, %rcx
callq 0xde8a
leaq -0xa0(%rbp), %rsi
movq %r12, %rdi
callq 0x788c
movq %r12, %rdi
movq %r13, %rsi
callq 0x788c
movq -0x58(%rbp), %rdi
testq %rdi, %rdi
je 0x125f3
leaq -0x80(%rbp), %rsi
callq 0x788c
leaq -0x170(%rbp), %r13
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0xde8a
leaq -0x160(%rbp), %rsi
movq %r12, %rdi
callq 0x788c
movq %r12, %rdi
movq %r13, %rsi
callq 0x788c
leaq -0x130(%rbp), %rbx
leaq -0xb0(%rbp), %rcx
movq %r15, %rdi
movq %rbx, %rsi
movq -0x40(%rbp), %r14
movq %r14, %rdx
movq -0x30(%rbp), %r8
callq 0xd093
leaq -0x120(%rbp), %rsi
movq %r12, %rdi
callq 0x788c
movq %r12, %rdi
movq %rbx, %rsi
callq 0x788c
leaq -0xf0(%rbp), %rbx
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq %r13, %rcx
movq -0x38(%rbp), %r8
callq 0xd093
leaq -0xe0(%rbp), %rsi
movq %r12, %rdi
callq 0x788c
movq %r12, %rdi
movq %rbx, %rsi
callq 0x788c
leaq -0x70(%rbp), %rbx
movq %rbx, %rdi
callq 0x7548
movq %r15, %rdi
movq -0x60(%rbp), %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x10e9c
movq -0x48(%rbp), %rax
movl (%rax), %eax
leaq 0x313a8(%rip), %rsi     # 0x43a6c
cmpl $0xe3f, %eax            # imm = 0xE3F
jg 0x126ff
cmpl $0xe16, %eax            # imm = 0xE16
je 0x12724
cmpl $0xe17, %eax            # imm = 0xE17
je 0x1271d
cmpl $0xe18, %eax            # imm = 0xE18
je 0x12714
leaq 0x2dc9d(%rip), %rdi     # 0x40384
leaq 0x2fc2a(%rip), %rsi     # 0x42318
leaq 0x31223(%rip), %rcx     # 0x43918
movl $0xb69, %edx            # imm = 0xB69
callq 0x30a0
cmpl $0xe40, %eax            # imm = 0xE40
je 0x1271d
cmpl $0xe60, %eax            # imm = 0xE60
je 0x12724
cmpl $0xe50, %eax            # imm = 0xE50
jne 0x126e0
leaq 0x31363(%rip), %rsi     # 0x43a7e
jmp 0x12724
leaq 0x3136c(%rip), %rsi     # 0x43a90
movq 0x8(%rbx), %rdx
testq %rdx, %rdx
leaq 0x31788(%rip), %r12     # 0x43eba
cmoveq %r12, %rdx
leaq -0x130(%rbp), %r14
movq 0x28(%r14), %rcx
testq %rcx, %rcx
cmoveq %r12, %rcx
leaq -0xf0(%rbp), %r15
movq 0x28(%r15), %r8
testq %r8, %r8
cmoveq %r12, %r8
movq -0x50(%rbp), %r13
movq %r13, %rdi
xorl %eax, %eax
callq 0x7b31
movq 0x8(%rbx), %rsi
testq %rsi, %rsi
cmoveq %r12, %rsi
addq $0x20, %r13
movq %r13, %rdi
callq 0x75cf
leaq -0xb0(%rbp), %rdi
callq 0xd787
leaq -0x170(%rbp), %rdi
callq 0xd787
movq %r14, %rdi
callq 0xd787
movq %r15, %rdi
callq 0xd787
movq %rbx, %rdi
callq 0x7a38
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x303c0(%rip), %rdi     # 0x42b88
leaq 0x2fb49(%rip), %rsi     # 0x42318
leaq 0x31142(%rip), %rcx     # 0x43918
movl $0xb05, %edx            # imm = 0xB05
callq 0x30a0
leaq 0x31734(%rip), %rdi     # 0x43f1b
leaq 0x2fb2a(%rip), %rsi     # 0x42318
leaq 0x31123(%rip), %rcx     # 0x43918
movl $0xb0f, %edx            # imm = 0xB0F
callq 0x30a0
leaq 0x31184(%rip), %rdi     # 0x4398a
leaq 0x2fb0b(%rip), %rsi     # 0x42318
leaq 0x31104(%rip), %rcx     # 0x43918
movl $0xb0c, %edx            # imm = 0xB0C
callq 0x30a0