// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movq -0x8(%rbp), %rcx
movq 0x10(%rcx), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x10(%rcx)
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq %rdi, %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
callq 0x6fe90
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq %rdi, %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
callq 0x6fe90
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %r8
movl $0x45, %esi
movl $0xe, %edx
callq 0x879c0
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x9f43e
jmp 0x9f58b
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rcx
movl -0x18(%rbp), %r8d
movq -0x20(%rbp), %r9
movl $0x8, %esi
movl $0xe, %edx
callq 0x72620
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x9f46b
jmp 0x9f58b
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
movl $0x16, %esi
callq 0x70b50
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x9f48f
jmp 0x9f58b
movq -0x38(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movl $0x0, (%rax)
movq -0x48(%rbp), %rax
movb $0x0, 0x4(%rax)
movq -0x48(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x50(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rcx
movl -0x14(%rbp), %r8d
movq -0x20(%rbp), %r9
movl $0xe, %edx
callq 0x75bc0
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x9f4f0
jmp 0x9f58b
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
movl $0xe, %esi
callq 0x70b50
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x9f511
jmp 0x9f58b
movq -0x38(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movl $0xe, (%rax)
movq -0x28(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x40(%rbp), %rax
movl $0x1, 0x18(%rax)
movl -0x18(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %r8
movl $0x44, %esi
movl $0xe, %edx
callq 0x879c0
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x9f57a
jmp 0x9f58b
movq -0x8(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x70850
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)