// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/arch/arm32/vfp_gen.c
// Function: subtilis_vfp_gen_movrrdi32
void subtilis_vfp_gen_movrrdi32(subtilis_ir_section_t *s, size_t start,
				void *user_data, subtilis_error_t *err)
{
	subtilis_arm_reg_t dest;
	subtilis_arm_reg_t src;
	subtilis_arm_reg_t fpscr;
	subtilis_arm_reg_t tmp;
	subtilis_arm_reg_t fpscr_mod;
	subtilis_arm_section_t *arm_s = user_data;
	subtilis_ir_inst_t *instr = &s->ops[start]->op.instr;

	dest = subtilis_arm_ir_to_arm_reg(instr->operands[0].reg);
	src = subtilis_arm_ir_to_dreg(instr->operands[1].reg);
	tmp = subtilis_arm_ir_to_dreg(s->freg_counter++);
	fpscr = subtilis_arm_ir_to_dreg(s->reg_counter++);
	fpscr_mod = subtilis_arm_ir_to_dreg(s->reg_counter++);

	subtilis_vfp_add_sysreg(arm_s, SUBTILIS_VFP_INSTR_FMRX,
				SUBTILIS_ARM_CCODE_AL,
				SUBTILIS_VFP_SYSREG_FPSCR, fpscr, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_arm_add_data_imm(arm_s, SUBTILIS_ARM_INSTR_BIC,
				  SUBTILIS_ARM_CCODE_AL, false, fpscr_mod,
				  fpscr, 3 << 22, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_arm_add_data_imm(arm_s, SUBTILIS_ARM_INSTR_ORR,
				  SUBTILIS_ARM_CCODE_AL, false, fpscr_mod,
				  fpscr_mod, 2 << 22, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_vfp_add_sysreg(arm_s, SUBTILIS_VFP_INSTR_FMXR,
				SUBTILIS_ARM_CCODE_AL,
				SUBTILIS_VFP_SYSREG_FPSCR, fpscr_mod, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_vfp_add_tran(arm_s, SUBTILIS_VFP_INSTR_FTOSID,
			      SUBTILIS_ARM_CCODE_AL, true, tmp, src, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_vfp_add_sysreg(arm_s, SUBTILIS_VFP_INSTR_FMXR,
				SUBTILIS_ARM_CCODE_AL,
				SUBTILIS_VFP_SYSREG_FPSCR, fpscr, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;
	subtilis_vfp_add_cptran(arm_s, SUBTILIS_VFP_INSTR_FMRS,
				SUBTILIS_ARM_CCODE_AL, true, dest, tmp, err);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movq %rdi, %r15
movq 0x48(%rdi), %rax
movq (%rax,%rsi,8), %r12
movq 0x10(%r12), %rdi
callq 0x4e007
movq %rax, (%rsp)
movq 0x18(%r12), %rdi
callq 0x4e592
movq %rax, %r13
movq 0x20(%r15), %rdi
leaq 0x1(%rdi), %rax
movq %rax, 0x20(%r15)
callq 0x4e592
movq %rax, %r12
movq 0x18(%r15), %rdi
leaq 0x1(%rdi), %rax
movq %rax, 0x18(%r15)
callq 0x4e592
movq %rax, %rbp
movq 0x18(%r15), %rdi
leaq 0x1(%rdi), %rax
movq %rax, 0x18(%r15)
callq 0x4e592
movq %rax, %r15
movq %r14, %rdi
movl $0x7c, %esi
movl $0xe, %edx
movl $0x1, %ecx
movq %rbp, %r8
movq %rbx, %r9
callq 0x5ca8c
cmpl $0x0, (%rbx)
jne 0x6adc5
movq %r14, %rdi
movl $0xe, %esi
movl $0xe, %edx
xorl %ecx, %ecx
movq %r15, %r8
movq %rbp, %r9
pushq %rbx
pushq $0xc00000               # imm = 0xC00000
callq 0x4f3d6
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x6adc5
movq %r14, %rdi
movl $0xc, %esi
movl $0xe, %edx
xorl %ecx, %ecx
movq %r15, %r8
movq %r15, %r9
pushq %rbx
pushq $0x800000               # imm = 0x800000
callq 0x4f3d6
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x6adc5
movq %r14, %rdi
movl $0x7b, %esi
movl $0xe, %edx
movl $0x1, %ecx
movq %r15, %r8
movq %rbx, %r9
callq 0x5ca8c
cmpl $0x0, (%rbx)
jne 0x6adc5
subq $0x8, %rsp
movq %r14, %rdi
movl $0x54, %esi
movl $0xe, %edx
movl $0x1, %ecx
movq %r12, %r8
movq %r13, %r9
pushq %rbx
callq 0x5c93b
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x6adc5
movq %r14, %rdi
movl $0x7b, %esi
movl $0xe, %edx
movl $0x1, %ecx
movq %rbp, %r8
movq %rbx, %r9
callq 0x5ca8c
cmpl $0x0, (%rbx)
je 0x6add4
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
subq $0x8, %rsp
movq %r14, %rdi
movl $0x5e, %esi
movl $0xe, %edx
movl $0x1, %ecx
movq 0x8(%rsp), %r8
movq %r12, %r9
pushq %rbx
callq 0x5c97b
addq $0x18, %rsp
jmp 0x6adc9