// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/arch/arm32/vfp_alloc.c
// Function: prv_alloc_vfp_cmp_instr
static void prv_alloc_vfp_cmp_instr(void *user_data, subtilis_arm_op_t *op,
				    subtilis_arm_instr_type_t type,
				    subtilis_vfp_cmp_instr_t *instr,
				    subtilis_error_t *err)
{
	size_t vreg_op1;
	int dist_op1;
	size_t vreg_op2;
	subtilis_arm_reg_ud_t *ud = user_data;
	int dist_op2 = -1;

	switch (type) {
	case SUBTILIS_VFP_INSTR_FCMPS:
	case SUBTILIS_VFP_INSTR_FCMPES:
	case SUBTILIS_VFP_INSTR_FCMPZS:
	case SUBTILIS_VFP_INSTR_FCMPEZS:
		subtilis_error_set_assertion_failed(err);
		return;
	default:
		break;
	}

	if (type == SUBTILIS_VFP_INSTR_FCMPED ||
	    type == SUBTILIS_VFP_INSTR_FCMPD) {
		vreg_op2 = instr->op2;
		(void)subtilis_arm_reg_alloc_ensure(
		    ud, op, ud->int_regs, ud->real_regs, &instr->op2, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;
		dist_op2 = subtilis_arm_reg_alloc_calculate_dist(
		    ud, vreg_op2, op, &ud->real_regs->dist_walker,
		    ud->real_regs);
	}

	vreg_op1 = instr->op1;
	(void)subtilis_arm_reg_alloc_ensure(ud, op, ud->int_regs, ud->real_regs,
					    &instr->op1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;
	dist_op1 = subtilis_arm_reg_alloc_calculate_dist(
	    ud, vreg_op1, op, &ud->real_regs->dist_walker, ud->real_regs);
	if (dist_op1 == -1)
		ud->real_regs->phys_to_virt[instr->op1] = INT_MAX;

	if ((type == SUBTILIS_VFP_INSTR_FCMPED ||
	     type == SUBTILIS_VFP_INSTR_FCMPD) &&
	    dist_op2 == -1)
		ud->real_regs->phys_to_virt[instr->op2] = INT_MAX;

	ud->real_regs->next[instr->op1] = dist_op1;
	if (type == SUBTILIS_VFP_INSTR_FCMPED ||
	    type == SUBTILIS_VFP_INSTR_FCMPD)
		ud->real_regs->next[instr->op2] = dist_op2;

	ud->instr_count++;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %r13
movq %rcx, %r14
movl %edx, %r15d
movq %rsi, %r12
movq %rdi, %rbx
leal -0x71(%r15), %eax
cmpl $0x6, %eax
ja 0x6c796
movl $0x55, %ecx
btl %eax, %ecx
jae 0x6c796
leaq 0xa904(%rip), %rdx      # 0x7707a
movq %r13, %rdi
movl $0xf, %esi
movl $0x1ba, %ecx            # imm = 0x1BA
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x135b4
cmpl $0x74, %r15d
sete 0xb(%rsp)
cmpl $0x72, %r15d
sete 0xa(%rsp)
cmpl $0x74, %r15d
je 0x6c7b9
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0x72, %r15d
jne 0x6c7fb
leaq 0x10(%r14), %r8
movq 0x10(%r14), %rbp
movq 0x8(%rbx), %rdx
movq 0x10(%rbx), %rcx
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %r9
callq 0x51fe8
cmpl $0x0, (%r13)
jne 0x6c8b3
movq 0x10(%rbx), %r8
leaq 0x90(%r8), %rcx
movq %rbx, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x51d8c
movl %eax, 0xc(%rsp)
leaq 0x8(%r14), %rbp
movq 0x8(%r14), %rax
movq %rax, 0x10(%rsp)
movq 0x8(%rbx), %rdx
movq 0x10(%rbx), %rcx
movq %rbx, %rdi
movq %r12, %rsi
movq %rbp, %r8
movq %r13, %r9
callq 0x51fe8
cmpl $0x0, (%r13)
jne 0x6c8b3
movb 0xb(%rsp), %r13b
orb 0xa(%rsp), %r13b
movq 0x10(%rbx), %r8
leaq 0x90(%r8), %rcx
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
movq %r12, %rdx
callq 0x51d8c
movq 0x10(%rbx), %rcx
cmpl $-0x1, %eax
jne 0x6c86e
movq 0x8(%rcx), %rdx
movq (%rbp), %rsi
movq $0x7fffffff, (%rdx,%rsi,8) # imm = 0x7FFFFFFF
movl 0xc(%rsp), %edi
cmpl $-0x1, %edi
sete %dl
andb %dl, %r13b
cmpb $0x1, %r13b
jne 0x6c891
movq 0x8(%rcx), %rdx
movq 0x10(%r14), %rsi
movq $0x7fffffff, (%rdx,%rsi,8) # imm = 0x7FFFFFFF
movq 0x10(%rcx), %rcx
movq (%rbp), %rdx
movl %eax, (%rcx,%rdx,4)
cmpl $0x74, %r15d
je 0x6c8a8
cmpl $0x72, %r15d
jne 0x6c8af
movq 0x10(%r14), %rax
movl %edi, (%rcx,%rax,4)
incq 0x20(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq