// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/frontend/float64_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 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:
		a2->exp.ir_op.real = (double)a2->exp.ir_op.integer;
	case SUBTILIS_TYPE_CONST_REAL:
		reg = subtilis_ir_section_add_instr(p->current, real_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;
		a1->type.type = SUBTILIS_TYPE_INTEGER;
		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_instr2(
		    p->current, SUBTILIS_OP_INSTR_MOV_I32_FP, a2->exp.ir_op,
		    err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto on_error;
		a2->exp.ir_op.reg = reg;
	case SUBTILIS_TYPE_REAL:
		reg = subtilis_ir_section_add_instr(p->current, real_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;
		a1->type.type = SUBTILIS_TYPE_INTEGER;
		break;
	default:
		subtilis_error_set_bad_expression(err, p->l->stream->name,
						  p->l->line);
		break;
	}

	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 %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl %r8d, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x40(%rbp)
subq $0x6, %rax
ja 0x4da74
movq -0x40(%rbp), %rax
leaq 0x5ea96(%rip), %rcx     # 0xac3d4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x20(%rbp), %rax
cvtsi2sdl 0x148(%rax), %xmm0
movq -0x20(%rbp), %rax
movsd %xmm0, 0x148(%rax)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movl -0x24(%rbp), %esi
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq -0x30(%rbp), %r8
movq 0x148(%rcx), %rdx
movq 0x148(%rax), %rcx
callq 0x38230
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x4d99b
jmp 0x4dab7
movq -0x38(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x148(%rax)
movq -0x18(%rbp), %rax
movl $0x5, (%rax)
jmp 0x4daa4
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x488b0
movq %rax, -0x20(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x4d9dc
jmp 0x4dab7
jmp 0x4d9de
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x20(%rbp), %rax
movq -0x30(%rbp), %rcx
movq 0x148(%rax), %rdx
movl $0x51, %esi
callq 0x38490
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x4da11
jmp 0x4dab7
movq -0x38(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x148(%rax)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movl -0x28(%rbp), %esi
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq -0x30(%rbp), %r8
movq 0x148(%rcx), %rdx
movq 0x148(%rax), %rcx
callq 0x38230
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
je 0x4da59
jmp 0x4dab7
movq -0x38(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x148(%rax)
movq -0x18(%rbp), %rax
movl $0x5, (%rax)
jmp 0x4daa4
movq -0x30(%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 0x5e965(%rip), %r8      # 0xac3fe
movl $0x410, %r9d            # imm = 0x410
callq 0x15930
movq -0x20(%rbp), %rdi
callq 0x36ee0
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x4dad1
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
nopl (%rax,%rax)