// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/int32_type.c
// Function: prv_div
static subtilis_exp_t *prv_div(subtilis_parser_t *p, subtilis_exp_t *a1,
			       subtilis_exp_t *a2, subtilis_error_t *err)
{
	switch (a2->type.type) {
	case SUBTILIS_TYPE_CONST_INTEGER:
		if (a2->exp.ir_op.integer == 0) {
			subtilis_error_set_divide_by_zero(
			    err, p->l->stream->name, p->l->line);
			break;
		}
		a1->exp.ir_op.reg =
		    prv_div_by_constant(p, a1->exp.ir_op, a2->exp.ir_op, 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:
		a1->exp.ir_op.reg =
		    prv_div_mod_vars(p, a1->exp.ir_op, a2->exp.ir_op,
				     SUBTILIS_OP_INSTR_DIV_I32, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto on_error;
		break;
	default:
		subtilis_error_set_assertion_failed(err);
		goto on_error;
	}

	subtilis_exp_delete(a2);
	return a1;

on_error:

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r12
movl (%rdx), %eax
cmpl $0x6, %eax
je 0x3adec
cmpl $0x5, %eax
je 0x3ae07
cmpl $0x1, %eax
jne 0x3ae27
cmpl $0x0, 0x148(%r14)
je 0x3ae42
movq 0x148(%r14), %r13
testl %r13d, %r13d
je 0x3ae69
movl %r13d, %eax
negl %eax
cmovsl %r13d, %eax
movq 0x148(%rbx), %rdx
movl %eax, %edi
shrl %edi
xorl %ebp, %ebp
movl $0x1, %esi
movl %ebp, %ecx
shll %cl, %esi
incq %rbp
cmpl %esi, %edi
jae 0x3ad15
cmpl %esi, %eax
jne 0x3ae90
movq 0x48(%r12), %rdi
movl $0x1f, %ecx
movl $0x50, %esi
movq %rdx, (%rsp)
movq %r15, %r8
callq 0x2bc8f
cmpl $0x0, (%r15)
jne 0x3ae96
movl $0x21, %ecx
subl %ebp, %ecx
movq 0x48(%r12), %rdi
movl $0x4e, %esi
movq %rax, %rdx
movq %r15, %r8
callq 0x2bc8f
cmpl $0x0, (%r15)
jne 0x3ae96
movq 0x48(%r12), %rdi
xorl %esi, %esi
movq (%rsp), %rdx
movq %rax, %rcx
movq %r15, %r8
callq 0x2bc8f
cmpl $0x0, (%r15)
jne 0x3ae96
movq 0x48(%r12), %rdi
decq %rbp
movl $0x50, %esi
movq %rax, %rdx
movq %rbp, %rcx
movq %r15, %r8
callq 0x2bc8f
cmpl $0x0, (%r15)
jne 0x3ae96
testl %r13d, %r13d
jns 0x3ae98
movq 0x48(%r12), %rdi
movl $0x21, %esi
movq %rax, %rdx
xorl %ecx, %ecx
movq %r15, %r8
callq 0x2bc8f
cmpl $0x0, (%r15)
jne 0x3ae96
jmp 0x3ae98
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x367cf
movq %rax, %r14
cmpl $0x0, (%r15)
jne 0x3aea5
movq 0x148(%rbx), %rsi
movq 0x148(%r14), %rdx
movq %r12, %rdi
movl $0x6, %ecx
movq %r15, %r8
callq 0x3b836
jmp 0x3ae98
leaq 0x3a6d5(%rip), %rdx     # 0x75503
movq %r15, %rdi
movl $0xf, %esi
movl $0x690, %ecx            # imm = 0x690
callq 0x145a4
jmp 0x3aea5
movq (%r12), %rax
movq 0x30(%rax), %rdx
movl 0x38(%rax), %ecx
leaq 0x3a6af(%rip), %r8      # 0x75503
movq %r15, %rdi
movl $0x1a, %esi
movl $0x67c, %r9d            # imm = 0x67C
callq 0x145c8
jmp 0x3aeaf
movq (%r12), %rax
movq 0x30(%rax), %rdx
movl 0x38(%rax), %ecx
leaq 0x3a688(%rip), %r8      # 0x75503
movq %r15, %rdi
movl $0x1a, %esi
movl $0x65d, %r9d            # imm = 0x65D
callq 0x145c8
jmp 0x3ae96
cmpl $0x0, (%r15)
je 0x3aec9
xorl %eax, %eax
movq %rax, 0x148(%rbx)
cmpl $0x0, (%r15)
je 0x3aeaf
movq %rbx, %rdi
callq 0x2b166
xorl %ebx, %ebx
movq %r14, %rdi
callq 0x2b166
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testb $0x1, 0x8(%r12)
movq 0x48(%r12), %rdi
jne 0x3aefd
movq %rdx, %rbp
movl $0x1b, %esi
movq %r13, %rdx
movq %r15, %rcx
callq 0x2be09
cmpl $0x0, (%r15)
jne 0x3ae96
movq %r12, %rdi
movq %rbp, %rsi
movq %rax, %rdx
jmp 0x3ae18
movl $0xf, %esi
movq %r13, %rcx
movq %r15, %r8
callq 0x2bc8f
jmp 0x3ae98