// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/arch/arm32/vfp_gen.c
// Function: prv_cmp_imm
static void prv_cmp_imm(subtilis_ir_section_t *s, size_t start, void *user_data,
			subtilis_arm_ccode_type_t ok,
			subtilis_arm_ccode_type_t nok, subtilis_error_t *err)
{
	subtilis_arm_reg_t op1;
	subtilis_arm_reg_t op2;
	subtilis_arm_reg_t dest;
	subtilis_arm_section_t *arm_s = user_data;
	subtilis_ir_inst_t *cmp = &s->ops[start]->op.instr;

	op1 = subtilis_arm_ir_to_dreg(cmp->operands[1].reg);

	if (cmp->operands[2].real == 0.0) {
		subtilis_vfp_add_cmpz(arm_s, SUBTILIS_VFP_INSTR_FCMPZD,
				      SUBTILIS_ARM_CCODE_AL, op1, err);
	} else {
		op2 = subtilis_arm_ir_to_dreg(s->freg_counter++);
		subtilis_vfp_add_copy_imm(arm_s, SUBTILIS_ARM_CCODE_AL, op2,
					  cmp->operands[2].real, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;
		subtilis_vfp_add_cmp(arm_s, SUBTILIS_VFP_INSTR_FCMPD,
				     SUBTILIS_ARM_CCODE_AL, op1, op2, err);
	}
	if (err->type != SUBTILIS_ERROR_OK)
		return;

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

	dest = subtilis_arm_ir_to_arm_reg(cmp->operands[0].reg);
	subtilis_arm_add_mov_imm(arm_s, ok, false, dest, -1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;
	subtilis_arm_add_mov_imm(arm_s, nok, false, dest, 0, err);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movq %r9, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
addq $0x8, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x6f840
movq %rax, -0x30(%rbp)
movq -0x50(%rbp), %rax
movsd 0x18(%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x9f461
jp 0x9f461
movq -0x48(%rbp), %rdi
movq -0x30(%rbp), %rcx
movq -0x28(%rbp), %r8
movl $0x76, %esi
movl $0xe, %edx
callq 0x87560
jmp 0x9f4c9
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
movq %rdi, %rcx
addq $0x1, %rcx
movq %rcx, 0x20(%rax)
callq 0x6f840
movq %rax, -0x38(%rbp)
movq -0x48(%rbp), %rdi
movq -0x38(%rbp), %rdx
movq -0x50(%rbp), %rax
movsd 0x18(%rax), %xmm0
movq -0x28(%rbp), %rcx
movl $0xe, %esi
callq 0x86f10
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x9f4aa
jmp 0x9f57a
movq -0x48(%rbp), %rdi
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %r8
movq -0x28(%rbp), %r9
movl $0x72, %esi
movl $0xe, %edx
callq 0x874f0
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x9f4d7
jmp 0x9f57a
movq -0x48(%rbp), %rdi
movq -0x28(%rbp), %r9
movl $0x7c, %esi
movl $0xe, %edx
movl $0x1, %ecx
movl $0xf, %r8d
callq 0x87630
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x9f504
jmp 0x9f57a
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x6eea0
movq %rax, -0x40(%rbp)
movq -0x48(%rbp), %rdi
movl -0x1c(%rbp), %ecx
movq -0x40(%rbp), %r9
movq -0x28(%rbp), %rax
movl $0xd, %esi
movl $0xf, %edx
xorl %r8d, %r8d
movl $0xffffffff, (%rsp)     # imm = 0xFFFFFFFF
movq %rax, 0x8(%rsp)
callq 0x70b20
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x9f54d
jmp 0x9f57a
movq -0x48(%rbp), %rdi
movl -0x20(%rbp), %ecx
movq -0x40(%rbp), %r9
movq -0x28(%rbp), %rax
movl $0xd, %esi
movl $0xf, %edx
xorl %r8d, %r8d
movl $0x0, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x70b20
addq $0x60, %rsp
popq %rbp
retq