// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r13
movq %rdi, %r14
movq (%rdi), %rdi
movq 0x10(%r14), %r15
leaq 0x1(%r15), %rax
movq %rax, 0x10(%r14)
leaq 0x1(%rdi), %rax
movq %rax, (%r14)
callq 0x4e007
movq %rax, %rbp
movq (%r14), %rdi
leaq 0x1(%rdi), %rax
movq %rax, (%r14)
callq 0x4e007
movq %rax, %r12
movq %r14, %rdi
movl $0x7c, %esi
movl $0xe, %edx
movl $0x1, %ecx
movq %rax, %r8
movq %rbx, %r9
callq 0x5ca8c
cmpl $0x0, (%rbx)
jne 0x6b485
movq %r14, %rdi
movl $0x8, %esi
movl $0xe, %edx
movq %r12, %rcx
movl $0x2, %r8d
movq %rbx, %r9
callq 0x4fa97
cmpl $0x0, (%rbx)
jne 0x6b485
movq %r14, %rdi
movl $0x16, %esi
movq %rbx, %rdx
callq 0x4e74a
cmpl $0x0, (%rbx)
jne 0x6b485
xorl %ecx, %ecx
movl %ecx, 0x8(%rax)
movb $0x0, 0xc(%rax)
movl %ecx, 0x10(%rax)
movq %r15, 0x18(%rax)
movq %r14, %rdi
movq %r13, %rsi
movl $0xe, %edx
movq %rbp, %rcx
movl $0x12, %r8d
movq %rbx, %r9
callq 0x5162d
xorl %eax, %eax
cmpl %eax, (%rbx)
jne 0x6b485
movq %r14, %rdi
movl $0xe, %esi
movq %rbx, %rdx
callq 0x4e74a
cmpl $0x0, (%rbx)
jne 0x6b485
movl $0xe, 0x8(%rax)
movq %r12, 0x10(%rax)
movq %r12, 0x18(%rax)
movl $0x1, 0x20(%rax)
movl $0x2, 0x28(%rax)
movq %r14, %rdi
movl $0x7b, %esi
movl $0xe, %edx
movl $0x1, %ecx
movq %r12, %r8
movq %rbx, %r9
callq 0x5ca8c
cmpl $0x0, (%rbx)
je 0x6b494
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4e597