// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/backends/riscos_common/riscos_arm.c
// Function: subtilis_riscos_arm_get_to
void subtilis_riscos_arm_get_to(subtilis_ir_section_t *s, size_t start,
				void *user_data, subtilis_error_t *err)
{
	size_t label;
	subtilis_arm_reg_t one;
	subtilis_arm_br_instr_t *br;
	subtilis_arm_instr_t *instr;
	subtilis_arm_data_instr_t *datai;
	subtilis_arm_section_t *arm_s = user_data;
	subtilis_ir_inst_t *getto = &s->ops[start]->op.instr;
	size_t ir_dest = getto->operands[0].reg;
	subtilis_arm_reg_t dest = subtilis_arm_ir_to_arm_reg(ir_dest);
	size_t ir_op1 = getto->operands[1].reg;
	subtilis_arm_reg_t op1 = subtilis_arm_ir_to_arm_reg(ir_op1);

	subtilis_arm_add_mov_imm(arm_s, SUBTILIS_ARM_CCODE_AL, false, 0, 129,
				 err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_arm_add_data_imm(arm_s, SUBTILIS_ARM_INSTR_AND,
				  SUBTILIS_ARM_CCODE_AL, false, 1, op1, 0xff,
				  err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_arm_add_mov_imm(arm_s, SUBTILIS_ARM_CCODE_AL, false, 2, 0xff,
				 err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	instr =
	    subtilis_arm_section_add_instr(arm_s, SUBTILIS_ARM_INSTR_AND, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;
	datai = &instr->operands.data;
	datai->status = false;
	datai->ccode = SUBTILIS_ARM_CCODE_AL;
	datai->dest = 2;
	datai->op1 = 2;
	datai->op2.type = SUBTILIS_ARM_OP2_SHIFTED;
	datai->op2.op.shift.shift_reg = false;
	datai->op2.op.shift.reg = op1;
	datai->op2.op.shift.type = SUBTILIS_ARM_SHIFT_LSR;
	datai->op2.op.shift.shift.integer = 8;

	/* OS_Byte */
	/* read_mask = 7 = r0, r1, r2  */
	/* write_mask = 6 = r1, r2 */
	subtilis_arm_add_swi(arm_s, SUBTILIS_ARM_CCODE_AL, 0x6 + 0x20000, 7, 6,
			     err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	one = subtilis_arm_ir_to_arm_reg(arm_s->reg_counter++);
	subtilis_arm_gen_sete_load_reg(arm_s, s, SUBTILIS_ARM_CCODE_VS, one,
				       err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	label = arm_s->label_counter++;
	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_VS;
	br->link = false;
	br->link_type = SUBTILIS_ARM_BR_LINK_VOID;
	br->target.label = label;

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

	subtilis_arm_add_mov_reg(arm_s, SUBTILIS_ARM_CCODE_EQ, false, dest, 1,
				 err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_arm_add_mvn_imm(arm_s, SUBTILIS_ARM_CCODE_NE, false, dest, 0,
				 err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_arm_section_add_label(arm_s, label, err);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
addq $0x8, %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
callq 0x6fe90
movq %rax, -0x68(%rbp)
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rdi
callq 0x6fe90
movq %rax, -0x78(%rbp)
movq -0x50(%rbp), %rdi
movq -0x20(%rbp), %rax
movl $0xd, %esi
movl $0xf, %edx
movl $0xe, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
movl $0x81, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x71b10
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0xa52b9
jmp 0xa5544
movq -0x50(%rbp), %rdi
movq -0x78(%rbp), %r9
movq -0x20(%rbp), %rax
xorl %ecx, %ecx
movl $0xe, %edx
movl $0x1, %r8d
movl %ecx, %esi
movl $0xff, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x71cd0
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0xa52f3
jmp 0xa5544
movq -0x50(%rbp), %rdi
movq -0x20(%rbp), %rax
movl $0xd, %esi
movl $0xf, %edx
movl $0xe, %ecx
xorl %r8d, %r8d
movl $0x2, %r9d
movl $0xff, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x71b10
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0xa5332
jmp 0xa5544
movq -0x50(%rbp), %rdi
movq -0x20(%rbp), %rdx
xorl %esi, %esi
callq 0x70b50
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0xa5353
jmp 0xa5544
movq -0x40(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movb $0x0, 0x4(%rax)
movq -0x48(%rbp), %rax
movl $0xe, (%rax)
movq -0x48(%rbp), %rax
movq $0x2, 0x8(%rax)
movq -0x48(%rbp), %rax
movq $0x2, 0x10(%rax)
movq -0x48(%rbp), %rax
movl $0x2, 0x18(%rax)
movq -0x48(%rbp), %rax
movb $0x0, 0x38(%rax)
movq -0x78(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x48(%rbp), %rax
movl $0x2, 0x28(%rax)
movq -0x48(%rbp), %rax
movl $0x8, 0x30(%rax)
movq -0x50(%rbp), %rdi
movq -0x20(%rbp), %r9
movl $0xe, %esi
movl $0x20006, %edx          # imm = 0x20006
movl $0x7, %ecx
movl $0x6, %r8d
callq 0x71f20
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0xa53ee
jmp 0xa5544
movq -0x50(%rbp), %rax
movq (%rax), %rdi
movq %rdi, %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
callq 0x6fe90
movq %rax, -0x30(%rbp)
movq -0x50(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %r8
movl $0x6, %edx
callq 0x75ce0
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0xa5430
jmp 0xa5544
movq -0x50(%rbp), %rcx
movq 0x10(%rcx), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x10(%rcx)
movq %rax, -0x28(%rbp)
movq -0x50(%rbp), %rdi
movq -0x20(%rbp), %rdx
movl $0x16, %esi
callq 0x70b50
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0xa546b
jmp 0xa5544
movq -0x40(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movl $0x6, (%rax)
movq -0x38(%rbp), %rax
movb $0x0, 0x4(%rax)
movq -0x38(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x28(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x50(%rbp), %rdi
movq -0x20(%rbp), %r9
movl $0xa, %esi
movl $0xe, %edx
movl $0x2, %ecx
xorl %r8d, %r8d
callq 0x72620
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0xa54ca
jmp 0xa5544
movq -0x50(%rbp), %rdi
movq -0x68(%rbp), %r8
movq -0x20(%rbp), %rax
movl $0xd, %esi
xorl %ecx, %ecx
movl $0x1, %r9d
movl %ecx, %edx
movq %rax, (%rsp)
callq 0x71fa0
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0xa54f9
jmp 0xa5544
movq -0x50(%rbp), %rdi
movq -0x68(%rbp), %r9
movq -0x20(%rbp), %rax
movl $0xf, %esi
movl $0xd, %edx
movl $0x1, %ecx
xorl %r8d, %r8d
movl $0x0, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x71b10
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0xa5533
jmp 0xa5544
movq -0x50(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x70850
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax)