// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/arch/arm32/vfp_gen.c
// Function: prv_check_divbyzero
static void prv_check_divbyzero(subtilis_arm_section_t *arm_s,
				subtilis_ir_section_t *s,
				subtilis_arm_reg_t res, int32_t error_code,
				subtilis_error_t *err)
{
	subtilis_arm_reg_t status;
	subtilis_arm_reg_t dest;
	subtilis_arm_instr_t *instr;
	subtilis_arm_data_instr_t *datai;
	subtilis_arm_br_instr_t *br;
	size_t label = arm_s->label_counter++;

	dest = subtilis_arm_ir_to_arm_reg(arm_s->reg_counter++);
	status = subtilis_arm_ir_to_arm_reg(arm_s->reg_counter++);

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

	subtilis_arm_add_cmp_imm(arm_s, SUBTILIS_ARM_INSTR_TST,
				 SUBTILIS_ARM_CCODE_AL, status, 2, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	instr =
	    subtilis_arm_section_add_instr(arm_s, SUBTILIS_ARM_INSTR_B, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	br = &instr->operands.br;
	br->ccode = SUBTILIS_ARM_CCODE_EQ;
	br->link = false;
	br->link_type = SUBTILIS_ARM_BR_LINK_VOID;
	br->target.label = label;

	subtilis_arm_gen_sete(arm_s, s, SUBTILIS_ARM_CCODE_AL, dest, error_code,
			      err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	instr =
	    subtilis_arm_section_add_instr(arm_s, SUBTILIS_ARM_INSTR_BIC, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	datai = &instr->operands.data;
	datai->ccode = SUBTILIS_ARM_CCODE_AL;
	datai->dest = status;
	datai->op1 = status;
	datai->op2.type = SUBTILIS_ARM_OP2_I32;
	datai->op2.op.integer = 2;

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

	subtilis_arm_section_add_label(arm_s, label, 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)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rcx
movq 0x10(%rcx), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x10(%rcx)
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq %rdi, %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
callq 0x6eea0
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq %rdi, %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
callq 0x6eea0
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %r8
movq -0x28(%rbp), %r9
movl $0x7c, %esi
movl $0xe, %edx
movl $0x1, %ecx
callq 0x87630
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x9e9f4
jmp 0x9eb4c
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rcx
movq -0x28(%rbp), %r9
movl $0x8, %esi
movl $0xe, %edx
movl $0x2, %r8d
callq 0x71630
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x9ea23
jmp 0x9eb4c
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
movl $0x16, %esi
callq 0x6fb60
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x9ea47
jmp 0x9eb4c
movq -0x40(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movl $0x0, (%rax)
movq -0x50(%rbp), %rax
movb $0x0, 0x4(%rax)
movq -0x50(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x58(%rbp), %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rcx
movl -0x1c(%rbp), %r8d
movq -0x28(%rbp), %r9
movl $0xe, %edx
callq 0x74bd0
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x9eaa8
jmp 0x9eb4c
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
movl $0xe, %esi
callq 0x6fb60
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x9eacc
jmp 0x9eb4c
movq -0x40(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movl $0xe, (%rax)
movq -0x30(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x30(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x48(%rbp), %rax
movl $0x1, 0x18(%rax)
movq -0x48(%rbp), %rax
movl $0x2, 0x20(%rax)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %r8
movq -0x28(%rbp), %r9
movl $0x7b, %esi
movl $0xe, %edx
movl $0x1, %ecx
callq 0x87630
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x9eb3b
jmp 0x9eb4c
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x6f860
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)