// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/frontend/int32_type.c
// Function: prv_commutative_logical
static subtilis_exp_t *prv_commutative_logical(
	subtilis_parser_t *p, subtilis_exp_t *a1, subtilis_exp_t *a2,
	subtilis_op_instr_type_t in_var_imm,
	subtilis_op_instr_type_t in_var_var,
	subtilis_op_instr_type_t real_var_imm,
	subtilis_op_instr_type_t real_var_var, subtilis_error_t *err)

/* clang-format on */
{
	size_t reg;

	switch (a2->type.type) {
	case SUBTILIS_TYPE_CONST_INTEGER:
		reg = subtilis_ir_section_add_instr(
		    p->current, in_var_imm, a1->exp.ir_op, a2->exp.ir_op, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto on_error;
		a1->exp.ir_op.reg = reg;
		break;
	case SUBTILIS_TYPE_CONST_REAL:
		prv_commutative_const_real(p, a1, a2, real_var_imm,
					   &subtilis_type_integer, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto on_error;
		break;
	case SUBTILIS_TYPE_BYTE:
		a2 = subtilis_type_if_to_int(p, a2, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto on_error;
	case SUBTILIS_TYPE_INTEGER:
		reg = subtilis_ir_section_add_instr(
		    p->current, in_var_var, a1->exp.ir_op, a2->exp.ir_op, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto on_error;
		a1->exp.ir_op.reg = reg;
		break;
	case SUBTILIS_TYPE_REAL:
		prv_commutative_real(p, a1, a2, real_var_var,
				     &subtilis_type_integer, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto on_error;
		break;
	default:
		subtilis_error_set_bad_expression(err, p->l->stream->name,
						  p->l->line);
		goto on_error;
	}

	subtilis_exp_delete(a2);
	return a1;

on_error:
	subtilis_exp_delete(a1);
	subtilis_exp_delete(a2);
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq 0x18(%rbp), %rax
movl 0x10(%rbp), %eax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl %r8d, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x40(%rbp)
subq $0x6, %rax
ja 0x518ae
movq -0x40(%rbp), %rax
leaq 0x5acfb(%rip), %rcx     # 0xac480
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movl -0x24(%rbp), %esi
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq 0x18(%rbp), %r8
movq 0x148(%rcx), %rdx
movq 0x148(%rax), %rcx
callq 0x38230
movq %rax, -0x38(%rbp)
movq 0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x517ca
jmp 0x518f3
movq -0x38(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x148(%rax)
jmp 0x518e0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl -0x2c(%rbp), %ecx
movq 0x18(%rbp), %r9
leaq 0x5a0d8(%rip), %r8      # 0xab8d0
callq 0x515a0
movq 0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x5180b
jmp 0x518f3
jmp 0x518e0
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq 0x18(%rbp), %rdx
callq 0x488b0
movq %rax, -0x20(%rbp)
movq 0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x51833
jmp 0x518f3
jmp 0x51835
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movl -0x28(%rbp), %esi
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq 0x18(%rbp), %r8
movq 0x148(%rcx), %rdx
movq 0x148(%rax), %rcx
callq 0x38230
movq %rax, -0x38(%rbp)
movq 0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x51871
jmp 0x518f3
movq -0x38(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x148(%rax)
jmp 0x518e0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl 0x10(%rbp), %ecx
movq 0x18(%rbp), %r9
leaq 0x5a034(%rip), %r8      # 0xab8d0
callq 0x51670
movq 0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x518ac
jmp 0x518f3
jmp 0x518e0
movq 0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %rdx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl 0x38(%rax), %ecx
movl $0x19, %esi
leaq 0x5abd2(%rip), %r8      # 0xac4a5
movl $0x599, %r9d            # imm = 0x599
callq 0x15930
jmp 0x518f3
movq -0x20(%rbp), %rdi
callq 0x36ee0
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x5190d
movq -0x18(%rbp), %rdi
callq 0x36ee0
movq -0x20(%rbp), %rdi
callq 0x36ee0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)