// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_reg_alloc.c
// Function: prv_alloc_mul_instr
static void prv_alloc_mul_instr(void *user_data, subtilis_arm_op_t *op,
				subtilis_arm_instr_type_t type,
				subtilis_arm_mul_instr_t *instr,
				subtilis_error_t *err)
{
	size_t vreg_rm;
	bool fixed_reg_rm;
	size_t vreg_rs;
	bool fixed_reg_rs;
	int dist_rm = -1;
	int dist_rs = -1;
	subtilis_arm_reg_ud_t *ud = user_data;

	vreg_rm = instr->rm;
	fixed_reg_rm = subtilis_arm_reg_alloc_ensure(
	    ud, op, ud->int_regs, ud->int_regs, &instr->rm, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	vreg_rs = instr->rs;
	fixed_reg_rs = subtilis_arm_reg_alloc_ensure(
	    ud, op, ud->int_regs, ud->int_regs, &instr->rs, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	if (!fixed_reg_rm) {
		dist_rm = subtilis_arm_reg_alloc_calculate_dist(
		    ud, vreg_rm, op, &ud->int_regs->dist_walker, ud->int_regs);
		if (dist_rm == -1)
			ud->int_regs->phys_to_virt[instr->rm] = INT_MAX;
	}

	if (!fixed_reg_rs) {
		dist_rs = subtilis_arm_reg_alloc_calculate_dist(
		    ud, vreg_rs, op, &ud->int_regs->dist_walker, ud->int_regs);
		if (dist_rs == -1)
			ud->int_regs->phys_to_virt[instr->rs] = INT_MAX;
	}

	prv_allocate_dest_restricted(ud, op, &instr->dest, instr->rm, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	if (instr->dest == instr->rm) {
		subtilis_error_set_assertion_failed(err);
		return;
	}

	if (!fixed_reg_rm)
		ud->int_regs->next[instr->rm] = dist_rm;
	if (!fixed_reg_rs)
		ud->int_regs->next[instr->rs] = dist_rs;

	ud->instr_count++;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, %r14
movq %rcx, %r15
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x10(%rcx), %r13
movq 0x10(%rcx), %rbp
movq 0x8(%rdi), %rcx
movq %r13, %r8
movq %r14, %r9
callq 0x4fc53
cmpl $0x0, (%r14)
jne 0x50912
leaq 0x18(%r15), %r8
movq 0x18(%r15), %rcx
movq %rcx, 0x10(%rsp)
movb %al, 0xf(%rsp)
movq 0x8(%rbx), %rcx
movq %rbx, %rdi
movq %r12, %rsi
movq %r8, 0x20(%rsp)
movq %r14, %r9
callq 0x4fc53
movb 0xf(%rsp), %cl
cmpl $0x0, (%r14)
jne 0x50912
movl %eax, %edx
pushq $-0x1
popq %rsi
movl %esi, %eax
testb %cl, %cl
jne 0x50841
movq 0x8(%rbx), %r8
leaq 0x90(%r8), %rcx
movq %rbx, %rdi
movq %rbp, %rsi
movl %edx, %ebp
movq %r12, %rdx
callq 0x4f9f0
pushq $-0x1
popq %rsi
movl %ebp, %edx
cmpl $-0x1, %eax
jne 0x50841
movq 0x8(%rbx), %rax
movq 0x8(%rax), %rax
movq (%r13), %rcx
movq $0x7fffffff, (%rax,%rcx,8) # imm = 0x7FFFFFFF
movl %esi, %eax
movl %edx, %ebp
testb %dl, %dl
movl %eax, 0x1c(%rsp)
je 0x5084f
movl %esi, %eax
jmp 0x5088a
movq 0x8(%rbx), %r8
leaq 0x90(%r8), %rcx
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
movq %r12, %rdx
callq 0x4f9f0
cmpl $-0x1, %eax
jne 0x5088a
movq 0x8(%rbx), %rax
movq 0x8(%rax), %rax
movq 0x20(%rsp), %rcx
movq (%rcx), %rcx
movq $0x7fffffff, (%rax,%rcx,8) # imm = 0x7FFFFFFF
pushq $-0x1
popq %rax
movl %eax, 0x10(%rsp)
movq 0x10(%r15), %rcx
addq $0x8, %r15
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r14, %r8
callq 0x4fe38
cmpl $0x0, (%r14)
movb 0xf(%rsp), %cl
jne 0x50912
movq (%r13), %rax
cmpq %rax, (%r15)
jne 0x508df
leaq 0x1f2ea(%rip), %rdx     # 0x6fbab
pushq $0xf
popq %rsi
movq %r14, %rdi
movl $0x491, %ecx            # imm = 0x491
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1429e
testb %cl, %cl
jne 0x508f2
movq 0x8(%rbx), %rcx
movq 0x10(%rcx), %rcx
movl 0x1c(%rsp), %edx
movl %edx, (%rcx,%rax,4)
testb %bpl, %bpl
jne 0x5090e
movq 0x8(%rbx), %rax
movq 0x10(%rax), %rax
movq 0x20(%rsp), %rcx
movq (%rcx), %rcx
movl 0x10(%rsp), %edx
movl %edx, (%rax,%rcx,4)
incq 0x20(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq