// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/arch/arm32/arm_mem.c
// Function: prv_memseti32_core
static void prv_memseti32_core(subtilis_ir_section_t *s,
			       subtilis_arm_section_t *arm_s,
			       subtilis_error_t *err)
{
	const size_t base_reg = 0;
	const size_t val = 2;
	const size_t stm_end_reg = 10;
	const size_t end_reg = 11;
	subtilis_arm_instr_t *instr;
	subtilis_arm_stran_instr_t *stran;
	subtilis_arm_br_instr_t *br;
	size_t i;
	size_t end_label = arm_s->label_counter++;
	size_t start_label = arm_s->label_counter++;
	size_t start_small_label = arm_s->label_counter++;

	subtilis_arm_add_sub_imm(arm_s, SUBTILIS_ARM_CCODE_AL, false,
				 stm_end_reg, end_reg, 32, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_arm_add_cmp(arm_s, SUBTILIS_ARM_INSTR_CMP,
			     SUBTILIS_ARM_CCODE_AL, base_reg, stm_end_reg, 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_GT;
	br->link = false;
	br->link_type = SUBTILIS_ARM_BR_LINK_VOID;
	br->target.label = start_small_label;

	for (i = 3; i <= 9; i++) {
		subtilis_arm_add_mov_reg(arm_s, SUBTILIS_ARM_CCODE_AL, false, i,
					 2, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;
	}

	subtilis_arm_section_add_label(arm_s, start_label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_arm_add_mtran(arm_s, SUBTILIS_ARM_INSTR_STM,
			       SUBTILIS_ARM_CCODE_AL, 0, 255 << 2,
			       SUBTILIS_ARM_MTRAN_IA, true, false, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_arm_add_cmp(arm_s, SUBTILIS_ARM_INSTR_CMP,
			     SUBTILIS_ARM_CCODE_AL, base_reg, stm_end_reg, 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_LT;
	br->link = false;
	br->link_type = SUBTILIS_ARM_BR_LINK_VOID;
	br->target.label = start_label;

	subtilis_arm_section_add_label(arm_s, start_small_label, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_arm_add_cmp(arm_s, SUBTILIS_ARM_INSTR_CMP,
			     SUBTILIS_ARM_CCODE_AL, base_reg, end_reg, 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_GE;
	br->link = false;
	br->link_type = SUBTILIS_ARM_BR_LINK_VOID;
	br->target.label = end_label;

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

	stran = &instr->operands.stran;
	stran->ccode = SUBTILIS_ARM_CCODE_AL;
	stran->dest = val;
	stran->base = base_reg;
	stran->offset.type = SUBTILIS_ARM_OP2_I32;
	stran->offset.op.integer = 4;
	stran->pre_indexed = false;
	stran->write_back = true;
	stran->subtract = false;
	stran->byte = false;

	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_AL;
	br->link = false;
	br->link_type = SUBTILIS_ARM_BR_LINK_VOID;
	br->target.label = start_small_label;

	subtilis_arm_section_add_label(arm_s, end_label, err);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x2, -0x28(%rbp)
movq $0xa, -0x30(%rbp)
movq $0xb, -0x38(%rbp)
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x10(%rcx)
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x10(%rcx)
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x10(%rcx)
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl $0x2, %esi
movl $0x4, %edx
movl $0xe, %ecx
xorl %r8d, %r8d
movl $0xa, %r9d
movq $0xb, (%rsp)
movl $0x20, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x71640
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x8aab4
jmp 0x8ae11
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %r9
movl $0xa, %esi
movl $0xe, %edx
xorl %eax, %eax
movl %eax, %ecx
movl $0xa, %r8d
callq 0x72710
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x8aae3
jmp 0x8ae11
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x16, %esi
callq 0x70b50
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x8ab07
jmp 0x8ae11
movq -0x40(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movl $0xc, (%rax)
movq -0x50(%rbp), %rax
movb $0x0, 0x4(%rax)
movq -0x50(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x70(%rbp), %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x10(%rax)
movq $0x3, -0x58(%rbp)
cmpq $0x9, -0x58(%rbp)
ja 0x8ab90
movq -0x10(%rbp), %rdi
movq -0x58(%rbp), %r8
movq -0x18(%rbp), %rax
movl $0xd, %esi
movl $0xe, %edx
xorl %ecx, %ecx
movl $0x2, %r9d
movq %rax, (%rsp)
callq 0x71fa0
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x8ab80
jmp 0x8ae11
jmp 0x8ab82
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x8ab44
movq -0x10(%rbp), %rdi
movq -0x68(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x70850
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x8abaf
jmp 0x8ae11
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl $0x15, %esi
movl $0xe, %edx
xorl %ecx, %ecx
movl $0x3fc, %r8d            # imm = 0x3FC
xorl %r9d, %r9d
movl $0x1, (%rsp)
movl $0x0, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x727a0
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x8abf3
jmp 0x8ae11
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %r9
movl $0xa, %esi
movl $0xe, %edx
xorl %eax, %eax
movl %eax, %ecx
movl $0xa, %r8d
callq 0x72710
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x8ac22
jmp 0x8ae11
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x16, %esi
callq 0x70b50
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x8ac46
jmp 0x8ae11
movq -0x40(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movl $0xb, (%rax)
movq -0x50(%rbp), %rax
movb $0x0, 0x4(%rax)
movq -0x50(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x68(%rbp), %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x70850
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x8ac9a
jmp 0x8ae11
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %r9
movl $0xa, %esi
movl $0xe, %edx
xorl %eax, %eax
movl %eax, %ecx
movl $0xb, %r8d
callq 0x72710
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x8acc9
jmp 0x8ae11
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x16, %esi
callq 0x70b50
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x8aced
jmp 0x8ae11
movq -0x40(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movl $0xa, (%rax)
movq -0x50(%rbp), %rax
movb $0x0, 0x4(%rax)
movq -0x50(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x60(%rbp), %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x13, %esi
callq 0x70b50
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x8ad46
jmp 0x8ae11
movq -0x40(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movl $0xe, (%rax)
movq -0x48(%rbp), %rax
movq $0x2, 0x8(%rax)
movq -0x48(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x48(%rbp), %rax
movl $0x1, 0x18(%rax)
movq -0x48(%rbp), %rax
movl $0x4, 0x20(%rax)
movq -0x48(%rbp), %rax
movb $0x0, 0x40(%rax)
movq -0x48(%rbp), %rax
movb $0x1, 0x41(%rax)
movq -0x48(%rbp), %rax
movb $0x0, 0x42(%rax)
movq -0x48(%rbp), %rax
movb $0x0, 0x43(%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x16, %esi
callq 0x70b50
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x8adcb
jmp 0x8ae11
movq -0x40(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movl $0xe, (%rax)
movq -0x50(%rbp), %rax
movb $0x0, 0x4(%rax)
movq -0x50(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x70(%rbp), %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rdi
movq -0x60(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x70850
addq $0x90, %rsp
popq %rbp
retq
nopw (%rax,%rax)