// File: /workspace/github_c_makefile_star2_O1/Ihsoh[P]ilang/compiler/frontend/irgen.c
// Function: ir_expr_logic
static bool _ir_expr_logic(
	IRGeneratorContext *ctx,
	ResizableString *rstr,
	_ExprResult *expr_result,
	ParserASTNode *node
) {
	assert(ctx);
	assert(rstr);
	assert(expr_result);
	assert(node);

	switch (node->type) {
		case FE_NODE_EXPR_AND: {
			assert(node->nchilds == 2);

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

			ParserASTNode *node_target_type = FE_EXPR_AST_NODE_GET_TYPE_NODE(node);

			ResizableString rstr_zero;
			rstr_init(&rstr_zero);
			_const_int(ctx, &rstr_zero, node_target_type, 0);

			ResizableString rstr_one;
			rstr_init(&rstr_one);
			_const_int(ctx, &rstr_one, node_target_type, 1);

			ResizableString rstr_result;
			rstr_init(&rstr_result);
			_generate_func_tmp_var(
				ctx,
				ctx->func_symbol,
				&rstr_result,
				node_target_type
			);

			rstr_appendf(
				rstr,
				"assign %s, %s;\n",
				RSTR_CSTR(&rstr_result),
				RSTR_CSTR(&rstr_zero)
			);

			_ExprResult result_lhs;
			_expr_result_init(&result_lhs);

			_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));

			ResizableString rstr_cond_expr_lhs;
			rstr_init(&rstr_cond_expr_lhs);
			_ir_cond_expr_with_rstr(ctx, rstr, &rstr_cond_expr_lhs, &result_lhs, node_lhs);

			_TMP_LABEL_DEF(ctx, lhs_true)
			_TMP_LABEL_DEF(ctx, rhs_true)
			_TMP_LABEL_DEF(ctx, end)

			rstr_appendf(
				rstr,
				"cbr %s, %s, %s;\n",
				RSTR_CSTR(&rstr_cond_expr_lhs),
				_TMP_LABEL_CSTR(lhs_true),
				_TMP_LABEL_CSTR(end)
			);

			rstr_appendf(
				rstr,
				"%s:\n",
				_TMP_LABEL_CSTR(lhs_true)
			);

			_ExprResult result_rhs;
			_expr_result_init(&result_rhs);

			_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));

			ResizableString rstr_cond_expr_rhs;
			rstr_init(&rstr_cond_expr_rhs);
			_ir_cond_expr_with_rstr(ctx, rstr, &rstr_cond_expr_rhs, &result_rhs, node_rhs);

			rstr_appendf(
				rstr,
				"cbr %s, %s, %s;\n",
				RSTR_CSTR(&rstr_cond_expr_rhs),
				_TMP_LABEL_CSTR(rhs_true),
				_TMP_LABEL_CSTR(end)
			);

			rstr_appendf(
				rstr,
				"%s:\n",
				_TMP_LABEL_CSTR(rhs_true)
			);

			rstr_appendf(
				rstr,
				"assign %s, %s;\n",
				RSTR_CSTR(&rstr_result),
				RSTR_CSTR(&rstr_one)
			);

			rstr_appendf(
				rstr,
				"%s:\n",
				_TMP_LABEL_CSTR(end)
			);

			_expr_result_set_result(
				expr_result,
				RSTR_CSTR(&rstr_result)
			);

			rstr_free(&rstr_zero);
			rstr_free(&rstr_one);
			rstr_free(&rstr_result);

			_expr_result_free(&result_lhs);
			rstr_free(&rstr_cond_expr_lhs);

			_TMP_LABEL_FREE(lhs_true)
			_TMP_LABEL_FREE(rhs_true)
			_TMP_LABEL_FREE(end)

			_expr_result_free(&result_rhs);
			rstr_free(&rstr_cond_expr_rhs);

			return true;
		}
		case FE_NODE_EXPR_OR: {
			assert(node->nchilds == 2);

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

			ParserASTNode *node_target_type = FE_EXPR_AST_NODE_GET_TYPE_NODE(node);

			ResizableString rstr_zero;
			rstr_init(&rstr_zero);
			_const_int(ctx, &rstr_zero, node_target_type, 0);

			ResizableString rstr_one;
			rstr_init(&rstr_one);
			_const_int(ctx, &rstr_one, node_target_type, 1);

			ResizableString rstr_result;
			rstr_init(&rstr_result);
			_generate_func_tmp_var(
				ctx,
				ctx->func_symbol,
				&rstr_result,
				node_target_type
			);

			rstr_appendf(
				rstr,
				"assign %s, %s;\n",
				RSTR_CSTR(&rstr_result),
				RSTR_CSTR(&rstr_zero)
			);

			_ExprResult result_lhs;
			_expr_result_init(&result_lhs);

			_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));

			ResizableString rstr_cond_expr_lhs;
			rstr_init(&rstr_cond_expr_lhs);
			_ir_cond_expr_with_rstr(ctx, rstr, &rstr_cond_expr_lhs, &result_lhs, node_lhs);

			_TMP_LABEL_DEF(ctx, lhs_true)
			_TMP_LABEL_DEF(ctx, lhs_false)
			_TMP_LABEL_DEF(ctx, rhs_true)
			_TMP_LABEL_DEF(ctx, end)

			rstr_appendf(
				rstr,
				"cbr %s, %s, %s;\n",
				RSTR_CSTR(&rstr_cond_expr_lhs),
				_TMP_LABEL_CSTR(lhs_true),
				_TMP_LABEL_CSTR(lhs_false)
			);

			rstr_appendf(
				rstr,
				"%s:\n",
				_TMP_LABEL_CSTR(lhs_true)
			);

			rstr_appendf(
				rstr,
				"assign %s, %s;\n",
				RSTR_CSTR(&rstr_result),
				RSTR_CSTR(&rstr_one)
			);

			rstr_appendf(
				rstr,
				"br %s;\n",
				_TMP_LABEL_CSTR(end)
			);

			rstr_appendf(
				rstr,
				"%s:\n",
				_TMP_LABEL_CSTR(lhs_false)
			);

			_ExprResult result_rhs;
			_expr_result_init(&result_rhs);

			_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));

			ResizableString rstr_cond_expr_rhs;
			rstr_init(&rstr_cond_expr_rhs);
			_ir_cond_expr_with_rstr(ctx, rstr, &rstr_cond_expr_rhs, &result_rhs, node_rhs);

			rstr_appendf(
				rstr,
				"cbr %s, %s, %s;\n",
				RSTR_CSTR(&rstr_cond_expr_rhs),
				_TMP_LABEL_CSTR(rhs_true),
				_TMP_LABEL_CSTR(end)
			);

			rstr_appendf(
				rstr,
				"%s:\n",
				_TMP_LABEL_CSTR(rhs_true)
			);

			rstr_appendf(
				rstr,
				"assign %s, %s;\n",
				RSTR_CSTR(&rstr_result),
				RSTR_CSTR(&rstr_one)
			);

			rstr_appendf(
				rstr,
				"%s:\n",
				_TMP_LABEL_CSTR(end)
			);

			_expr_result_set_result(
				expr_result,
				RSTR_CSTR(&rstr_result)
			);

			rstr_free(&rstr_zero);
			rstr_free(&rstr_one);
			rstr_free(&rstr_result);

			_expr_result_free(&result_lhs);
			rstr_free(&rstr_cond_expr_lhs);

			_TMP_LABEL_FREE(lhs_true)
			_TMP_LABEL_FREE(lhs_false)
			_TMP_LABEL_FREE(rhs_true)
			_TMP_LABEL_FREE(end)

			_expr_result_free(&result_rhs);
			rstr_free(&rstr_cond_expr_rhs);

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rsi, %r14
movq %rdi, %r15
movl (%rcx), %eax
cmpl $0xe20, %eax            # imm = 0xE20
je 0xffa8
cmpl $0xe30, %eax            # imm = 0xE30
jne 0x1038d
movq %rdx, -0x40(%rbp)
cmpl $0x2, 0x44(%rcx)
jne 0x103a1
movq 0x48(%rcx), %rax
movq 0x68(%rcx), %r12
movq (%rax), %rcx
movq %rcx, -0x30(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
leaq -0xb0(%rbp), %r13
movq %r13, %rdi
callq 0x7548
movq %r13, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x1281e
leaq -0xa0(%rbp), %rbx
movq %rbx, %rdi
callq 0x7548
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x1281e
leaq -0x90(%rbp), %rbx
movq %rbx, %rdi
callq 0x7548
movq 0x40(%r15), %rsi
movq %r15, %rdi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x10e9c
movq 0x8(%rbx), %rdx
testq %rdx, %rdx
leaq 0x341c0(%rip), %rax     # 0x43eba
cmoveq %rax, %rdx
movq 0x8(%r13), %rcx
testq %rcx, %rcx
cmoveq %rax, %rcx
leaq 0x328da(%rip), %rsi     # 0x425ea
movq %r14, %rdi
xorl %eax, %eax
callq 0x7b31
leaq -0x150(%rbp), %rbx
movq %rbx, %rdi
callq 0xd03d
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq -0x30(%rbp), %r12
movq %r12, %rcx
callq 0xde8a
leaq -0x140(%rbp), %rsi
movq %r14, %rdi
callq 0x788c
movq %r14, %rdi
movq %rbx, %rsi
callq 0x788c
leaq -0xc0(%rbp), %r13
movq %r13, %rdi
callq 0x7548
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %rbx, %rcx
movq %r12, %r8
callq 0x128cf
leaq -0x70(%rbp), %rbx
movq %rbx, %rdi
callq 0x7548
movq 0x40(%r15), %rdi
movq %rbx, %rsi
callq 0x10e32
leaq -0x60(%rbp), %rbx
movq %rbx, %rdi
callq 0x7548
movq 0x40(%r15), %rdi
movq %rbx, %rsi
callq 0x10e32
leaq -0x80(%rbp), %r12
movq %r12, %rdi
callq 0x7548
movq 0x40(%r15), %rdi
movq %r12, %rsi
callq 0x10e32
movq 0x8(%r13), %rdx
testq %rdx, %rdx
leaq 0x340e9(%rip), %rax     # 0x43eba
cmoveq %rax, %rdx
leaq -0x70(%rbp), %rbx
movq 0x8(%rbx), %rcx
testq %rcx, %rcx
cmoveq %rax, %rcx
movq 0x8(%r12), %r8
testq %r8, %r8
cmoveq %rax, %r8
movq %rax, %r12
leaq 0x33d05(%rip), %rsi     # 0x43aff
movq %r14, %rdi
xorl %eax, %eax
callq 0x7b31
movq 0x8(%rbx), %rdx
testq %rdx, %rdx
cmoveq %r12, %rdx
leaq 0x36eb9(%rip), %rsi     # 0x46ccf
movq %r14, %rdi
xorl %eax, %eax
callq 0x7b31
leaq -0x110(%rbp), %r13
movq %r13, %rdi
callq 0xd03d
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq -0x38(%rbp), %rbx
movq %rbx, %rcx
callq 0xde8a
leaq -0x100(%rbp), %rsi
movq %r14, %rdi
callq 0x788c
movq %r14, %rdi
movq %r13, %rsi
callq 0x788c
leaq -0x50(%rbp), %r12
movq %r12, %rdi
callq 0x7548
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r13, %rcx
movq %rbx, %r8
callq 0x128cf
movq 0x8(%r12), %rdx
testq %rdx, %rdx
leaq 0x3402d(%rip), %r12     # 0x43eba
cmoveq %r12, %rdx
leaq -0x60(%rbp), %rbx
movq 0x8(%rbx), %rcx
testq %rcx, %rcx
cmoveq %r12, %rcx
leaq -0x80(%rbp), %r13
movq 0x8(%r13), %r8
testq %r8, %r8
cmoveq %r12, %r8
movq %r14, %rdi
leaq 0x33c46(%rip), %rsi     # 0x43aff
xorl %eax, %eax
callq 0x7b31
movq 0x8(%rbx), %rdx
testq %rdx, %rdx
cmoveq %r12, %rdx
movq %r14, %rdi
leaq 0x36dfa(%rip), %rsi     # 0x46ccf
xorl %eax, %eax
callq 0x7b31
leaq -0x90(%rbp), %rbx
movq 0x8(%rbx), %rdx
testq %rdx, %rdx
cmoveq %r12, %rdx
leaq -0xa0(%rbp), %r15
movq 0x8(%r15), %rcx
testq %rcx, %rcx
cmoveq %r12, %rcx
movq %r14, %rdi
leaq 0x326e0(%rip), %rsi     # 0x425ea
xorl %eax, %eax
callq 0x7b31
movq 0x8(%r13), %rdx
testq %rdx, %rdx
cmoveq %r12, %rdx
movq %r14, %rdi
leaq 0x36da9(%rip), %rsi     # 0x46ccf
xorl %eax, %eax
callq 0x7b31
movq 0x8(%rbx), %rsi
testq %rsi, %rsi
cmoveq %r12, %rsi
movq -0x40(%rbp), %rdi
addq $0x20, %rdi
callq 0x75cf
leaq -0xb0(%rbp), %rdi
callq 0x7a38
movq %r15, %rdi
callq 0x7a38
movq %rbx, %rdi
callq 0x7a38
leaq -0x150(%rbp), %rdi
callq 0xd787
leaq -0xc0(%rbp), %rdi
callq 0x7a38
leaq -0x70(%rbp), %rdi
callq 0x7a38
leaq -0x60(%rbp), %rdi
callq 0x7a38
movq %r13, %rdi
callq 0x7a38
leaq -0x110(%rbp), %rdi
callq 0xd787
leaq -0x50(%rbp), %rdi
jmp 0x10384
movq %rdx, -0x40(%rbp)
cmpl $0x2, 0x44(%rcx)
jne 0x103c0
movq 0x48(%rcx), %rax
movq 0x68(%rcx), %r12
movq (%rax), %rcx
movq %rcx, -0x30(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
leaq -0xb0(%rbp), %r13
movq %r13, %rdi
callq 0x7548
movq %r13, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x1281e
leaq -0xa0(%rbp), %r13
movq %r13, %rdi
callq 0x7548
movq %r13, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x1281e
leaq -0x90(%rbp), %rbx
movq %rbx, %rdi
callq 0x7548
movq 0x40(%r15), %rsi
movq %r15, %rdi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x10e9c
movq 0x8(%rbx), %rdx
testq %rdx, %rdx
leaq 0x33e83(%rip), %rsi     # 0x43eba
cmoveq %rsi, %rdx
leaq -0xb0(%rbp), %rax
movq 0x8(%rax), %rcx
testq %rcx, %rcx
cmoveq %rsi, %rcx
leaq 0x32596(%rip), %rsi     # 0x425ea
movq %r14, %rdi
xorl %eax, %eax
callq 0x7b31
leaq -0x150(%rbp), %r13
movq %r13, %rdi
callq 0xd03d
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq -0x30(%rbp), %r12
movq %r12, %rcx
callq 0xde8a
leaq -0x140(%rbp), %rsi
movq %r14, %rdi
callq 0x788c
movq %r14, %rdi
movq %r13, %rsi
callq 0x788c
leaq -0xc0(%rbp), %rbx
movq %rbx, %rdi
callq 0x7548
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r13, %rcx
movq %r12, %r8
callq 0x128cf
leaq -0x70(%rbp), %r12
movq %r12, %rdi
callq 0x7548
movq 0x40(%r15), %rdi
movq %r12, %rsi
callq 0x10e32
leaq -0x60(%rbp), %r12
movq %r12, %rdi
callq 0x7548
movq 0x40(%r15), %rdi
movq %r12, %rsi
callq 0x10e32
leaq -0x80(%rbp), %r12
movq %r12, %rdi
callq 0x7548
movq 0x40(%r15), %rdi
movq %r12, %rsi
callq 0x10e32
leaq -0x50(%rbp), %r12
movq %r12, %rdi
callq 0x7548
movq 0x40(%r15), %rdi
movq %r12, %rsi
callq 0x10e32
movq 0x8(%rbx), %rdx
testq %rdx, %rdx
leaq 0x33d8d(%rip), %r13     # 0x43eba
cmoveq %r13, %rdx
leaq -0x70(%rbp), %rbx
movq 0x8(%rbx), %rcx
testq %rcx, %rcx
cmoveq %r13, %rcx
leaq -0x60(%rbp), %r12
movq 0x8(%r12), %r8
testq %r8, %r8
cmoveq %r13, %r8
leaq 0x339a8(%rip), %rsi     # 0x43aff
movq %r14, %rdi
xorl %eax, %eax
callq 0x7b31
movq 0x8(%rbx), %rdx
testq %rdx, %rdx
cmoveq %r13, %rdx
leaq 0x36b5c(%rip), %rbx     # 0x46ccf
movq %r14, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x7b31
leaq -0x90(%rbp), %rax
movq 0x8(%rax), %rdx
testq %rdx, %rdx
cmoveq %r13, %rdx
leaq -0xa0(%rbp), %rax
movq 0x8(%rax), %rcx
testq %rcx, %rcx
cmoveq %r13, %rcx
movq %r14, %rdi
leaq 0x3243c(%rip), %rsi     # 0x425ea
xorl %eax, %eax
callq 0x7b31
leaq -0x50(%rbp), %rax
movq 0x8(%rax), %rdx
testq %rdx, %rdx
cmoveq %r13, %rdx
leaq 0x33945(%rip), %rsi     # 0x43b10
movq %r14, %rdi
xorl %eax, %eax
callq 0x7b31
movq 0x8(%r12), %rdx
testq %rdx, %rdx
cmoveq %r13, %rdx
movq %r14, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x7b31
leaq -0x110(%rbp), %r12
movq %r12, %rdi
callq 0xd03d
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq -0x38(%rbp), %rbx
movq %rbx, %rcx
callq 0xde8a
leaq -0x100(%rbp), %rsi
movq %r14, %rdi
callq 0x788c
movq %r14, %rdi
movq %r12, %rsi
callq 0x788c
leaq -0xd0(%rbp), %r13
movq %r13, %rdi
callq 0x7548
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %r12, %rcx
movq %rbx, %r8
callq 0x128cf
movq 0x8(%r13), %rdx
testq %rdx, %rdx
leaq 0x33c5d(%rip), %r13     # 0x43eba
cmoveq %r13, %rdx
leaq -0x80(%rbp), %rbx
movq 0x8(%rbx), %rcx
testq %rcx, %rcx
cmoveq %r13, %rcx
leaq -0x50(%rbp), %r12
movq 0x8(%r12), %r8
testq %r8, %r8
cmoveq %r13, %r8
movq %r14, %rdi
leaq 0x33875(%rip), %rsi     # 0x43aff
xorl %eax, %eax
callq 0x7b31
movq 0x8(%rbx), %rdx
testq %rdx, %rdx
cmoveq %r13, %rdx
movq %r14, %rdi
leaq 0x36a29(%rip), %r12     # 0x46ccf
movq %r12, %rsi
xorl %eax, %eax
callq 0x7b31
leaq -0x90(%rbp), %rbx
movq 0x8(%rbx), %rdx
testq %rdx, %rdx
cmoveq %r13, %rdx
leaq -0xa0(%rbp), %r15
movq 0x8(%r15), %rcx
testq %rcx, %rcx
cmoveq %r13, %rcx
movq %r14, %rdi
leaq 0x3230c(%rip), %rsi     # 0x425ea
xorl %eax, %eax
callq 0x7b31
leaq -0x50(%rbp), %rax
movq 0x8(%rax), %rdx
testq %rdx, %rdx
cmoveq %r13, %rdx
movq %r14, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x7b31
movq 0x8(%rbx), %rsi
testq %rsi, %rsi
cmoveq %r13, %rsi
movq -0x40(%rbp), %rdi
addq $0x20, %rdi
callq 0x75cf
leaq -0xb0(%rbp), %rdi
callq 0x7a38
movq %r15, %rdi
callq 0x7a38
movq %rbx, %rdi
callq 0x7a38
leaq -0x150(%rbp), %rdi
callq 0xd787
leaq -0xc0(%rbp), %rdi
callq 0x7a38
leaq -0x70(%rbp), %rdi
callq 0x7a38
leaq -0x60(%rbp), %rdi
callq 0x7a38
leaq -0x80(%rbp), %rdi
callq 0x7a38
leaq -0x50(%rbp), %rdi
callq 0x7a38
leaq -0x110(%rbp), %rdi
callq 0xd787
leaq -0xd0(%rbp), %rdi
callq 0x7a38
movb $0x1, %al
jmp 0x1038f
xorl %eax, %eax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3b8ad(%rip), %rdi     # 0x4bc55
leaq 0x31f69(%rip), %rsi     # 0x42318
leaq 0x336eb(%rip), %rcx     # 0x43aa1
movl $0xbdc, %edx            # imm = 0xBDC
callq 0x30a0
leaq 0x3b88e(%rip), %rdi     # 0x4bc55
leaq 0x31f4a(%rip), %rsi     # 0x42318
leaq 0x336cc(%rip), %rcx     # 0x43aa1
movl $0xc54, %edx            # imm = 0xC54
callq 0x30a0