// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/arch/arm32/arm_reg_alloc.c
// Function: prv_alloc_data_instr
static void prv_alloc_data_instr(void *user_data, subtilis_arm_op_t *op,
				 subtilis_arm_instr_type_t type,
				 subtilis_arm_data_instr_t *instr,
				 subtilis_error_t *err)
{
	int dist_op1;
	int dist_op2;
	int dist_op2_shift;
	size_t vreg_op1;
	bool fixed_reg_op1;
	subtilis_arm_reg_ud_t *ud = user_data;
	subtilis_arm_reg_t *reg = NULL;
	subtilis_arm_reg_t *shift_reg = NULL;

	vreg_op1 = instr->op1;
	fixed_reg_op1 = subtilis_arm_reg_alloc_ensure(
	    ud, op, ud->int_regs, ud->int_regs, &instr->op1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	reg = prv_ensure_op2(ud, op, &instr->op2, &dist_op2, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	shift_reg =
	    prv_ensure_op2_shift_reg(ud, op, &instr->op2, &dist_op2_shift, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	if (!fixed_reg_op1) {
		dist_op1 = subtilis_arm_reg_alloc_calculate_dist(
		    ud, vreg_op1, op, &ud->int_regs->dist_walker, ud->int_regs);
		if (dist_op1 == -1)
			ud->int_regs->phys_to_virt[instr->op1] = INT_MAX;
	}

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

	if (!fixed_reg_op1)
		ud->int_regs->next[instr->op1] = dist_op1;
	if (reg)
		ud->int_regs->next[*reg] = dist_op2;
	if (shift_reg)
		ud->int_regs->next[*shift_reg] = dist_op2_shift;

	ud->instr_count++;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, %r15
movq %rcx, %r12
movq %rsi, %r13
movq %rdi, %rbx
leaq 0x10(%rcx), %r14
movq 0x10(%rcx), %rax
movq %rax, 0x20(%rsp)
movq 0x8(%rdi), %rcx
movq %r14, %r8
movq %r15, %r9
callq 0x5315a
cmpl $0x0, (%r15)
jne 0x53d26
leaq 0x18(%r12), %rbp
leaq 0x14(%rsp), %rcx
movq %rbx, %rdi
movq %r13, %rsi
movq %rbp, %rdx
movq %r15, %r8
movb %al, 0xb(%rsp)
callq 0x55dc3
movb 0xb(%rsp), %cl
cmpl $0x0, (%r15)
jne 0x53d26
movq %rax, %rdx
cmpl $0x2, (%rbp)
jne 0x53c5b
cmpb $0x1, 0x38(%r12)
jne 0x53c5b
leaq 0x30(%r12), %rcx
movq %rdx, %rbp
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %r8
callq 0x55ddd
movq %rbp, %rdx
movb 0xb(%rsp), %cl
jmp 0x53c5d
xorl %eax, %eax
cmpl $0x0, (%r15)
jne 0x53d26
movq %rax, 0x18(%rsp)
movq %rdx, %rbp
testb %cl, %cl
jne 0x53cb2
movq 0x8(%rbx), %r8
leaq 0x90(%r8), %rcx
movq %rbx, %rdi
movq 0x20(%rsp), %rsi
movq %r13, %rdx
callq 0x52f08
movl %eax, 0xc(%rsp)
cmpl $-0x1, %eax
jne 0x53cb2
movq 0x8(%rbx), %rax
movq 0x8(%rax), %rax
movq (%r14), %rcx
movq $0x7fffffff, (%rax,%rcx,8) # imm = 0x7FFFFFFF
movl $0xffffffff, 0xc(%rsp)  # imm = 0xFFFFFFFF
addq $0x8, %r12
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq $-0x1, %rcx
movq %r15, %r8
callq 0x53378
cmpl $0x0, (%r15)
movb 0xb(%rsp), %al
movq 0x18(%rsp), %rsi
jne 0x53d26
testb %al, %al
jne 0x53cf3
movq 0x8(%rbx), %rax
movq 0x10(%rax), %rax
movq (%r14), %rcx
movl 0xc(%rsp), %edx
movl %edx, (%rax,%rcx,4)
testq %rbp, %rbp
je 0x53d0b
movl 0x14(%rsp), %eax
movq 0x8(%rbx), %rcx
movq 0x10(%rcx), %rcx
movq (%rbp), %rdx
movl %eax, (%rcx,%rdx,4)
testq %rsi, %rsi
je 0x53d22
movl 0x10(%rsp), %eax
movq 0x8(%rbx), %rcx
movq 0x10(%rcx), %rcx
movq (%rsi), %rdx
movl %eax, (%rcx,%rdx,4)
incq 0x20(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq