// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/arch/arm32/fpa_gen.c
// Function: prv_check_divbyzero
static void prv_check_divbyzero(subtilis_arm_section_t *arm_s,
				subtilis_ir_section_t *s, int32_t error_code,
				int32_t mask, 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++;

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

	subtilis_fpa_add_cptran(arm_s, SUBTILIS_FPA_INSTR_RFS,
				SUBTILIS_ARM_CCODE_AL, 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, mask, 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 = mask;

	subtilis_fpa_add_cptran(arm_s, SUBTILIS_FPA_INSTR_WFS,
				SUBTILIS_ARM_CCODE_AL, 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 %r8, %rbx
movl %ecx, (%rsp)
movl %edx, 0x4(%rsp)
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 0x4eff7
movq %rax, %r12
movq (%r14), %rdi
leaq 0x1(%rdi), %rax
movq %rax, (%r14)
callq 0x4eff7
movq %rax, %rbp
movq %r14, %rdi
movl $0x45, %esi
movl $0xe, %edx
movq %r12, %rcx
movq %rbx, %r8
callq 0x5d445
cmpl $0x0, (%rbx)
jne 0x6bfe0
movq %r14, %rdi
movl $0x8, %esi
movl $0xe, %edx
movq %r12, %rcx
movl (%rsp), %r8d
movq %rbx, %r9
callq 0x50a87
cmpl $0x0, (%rbx)
jne 0x6bfe0
movq %r14, %rdi
movl $0x16, %esi
movq %rbx, %rdx
callq 0x4f73a
cmpl $0x0, (%rbx)
jne 0x6bfe0
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 0x4(%rsp), %r8d
movq %rbx, %r9
callq 0x5261d
xorl %eax, %eax
cmpl %eax, (%rbx)
jne 0x6bfe0
movq %r14, %rdi
movl $0xe, %esi
movq %rbx, %rdx
callq 0x4f73a
cmpl $0x0, (%rbx)
jne 0x6bfe0
movl $0xe, 0x8(%rax)
movq %r12, 0x10(%rax)
movq %r12, 0x18(%rax)
movl $0x1, 0x20(%rax)
movl (%rsp), %ecx
movl %ecx, 0x28(%rax)
movq %r14, %rdi
movl $0x44, %esi
movl $0xe, %edx
movq %r12, %rcx
movq %rbx, %r8
callq 0x5d445
cmpl $0x0, (%rbx)
je 0x6bfef
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 0x4f587