// File: /workspace/github_c_makefile_star2_O3/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, %r14
movq %rcx, %r12
movq %rsi, %r13
movq %rdi, %rbx
leaq 0x10(%rcx), %r15
movq 0x10(%rcx), %rax
movq %rax, 0x20(%rsp)
movq 0x8(%rdi), %rcx
movq %r15, %r8
movq %r14, %r9
callq 0x52fd8
cmpl $0x0, (%r14)
je 0x53aa7
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %ebp
movl 0x18(%r12), %eax
testl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
jne 0x53adf
leaq 0x20(%r12), %rcx
leaq 0x14(%rsp), %rdx
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %r8
callq 0x55f53
movq %rax, 0x18(%rsp)
cmpl $0x0, (%r14)
jne 0x53a98
movl 0x18(%r12), %eax
jmp 0x53ae8
movq $0x0, 0x18(%rsp)
cmpl $0x2, %eax
jne 0x53b1a
cmpb $0x1, 0x38(%r12)
jne 0x53b1a
leaq 0x30(%r12), %rcx
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %r8
callq 0x55f53
movq %rax, 0x8(%rsp)
cmpl $0x0, (%r14)
jne 0x53a98
jmp 0x53b23
movq $0x0, 0x8(%rsp)
testb %bpl, %bpl
je 0x53b50
addq $0x8, %r12
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq $-0x1, %rcx
movq %r14, %r8
callq 0x531ec
cmpl $0x0, (%r14)
jne 0x53a98
jmp 0x53bb9
movq 0x8(%rbx), %r8
leaq 0x90(%r8), %rcx
movq %rbx, %rdi
movq 0x20(%rsp), %rsi
movq %r13, %rdx
callq 0x52d7c
movl %eax, %ebp
cmpl $-0x1, %eax
jne 0x53b85
movq 0x8(%rbx), %rax
movq 0x8(%rax), %rax
movq (%r15), %rcx
movq $0x7fffffff, (%rax,%rcx,8) # imm = 0x7FFFFFFF
addq $0x8, %r12
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq $-0x1, %rcx
movq %r14, %r8
callq 0x531ec
cmpl $0x0, (%r14)
jne 0x53a98
movq 0x8(%rbx), %rax
movq 0x10(%rax), %rax
movq (%r15), %rcx
movl %ebp, (%rax,%rcx,4)
movq 0x18(%rsp), %rdx
testq %rdx, %rdx
je 0x53bd5
movl 0x14(%rsp), %eax
movq 0x8(%rbx), %rcx
movq 0x10(%rcx), %rcx
movq (%rdx), %rdx
movl %eax, (%rcx,%rdx,4)
movq 0x8(%rsp), %rdx
testq %rdx, %rdx
je 0x53bf1
movl 0x10(%rsp), %eax
movq 0x8(%rbx), %rcx
movq 0x10(%rcx), %rcx
movq (%rdx), %rdx
movl %eax, (%rcx,%rdx,4)
incq 0x20(%rbx)
jmp 0x53a98