LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/backends/riscos_common/riscos_arm.c
// Function: subtilis_riscos_arm_inkey
void subtilis_riscos_arm_inkey(subtilis_ir_section_t *s, size_t start,
			       void *user_data, subtilis_error_t *err)
{
	subtilis_arm_reg_t one;
	subtilis_arm_section_t *arm_s = user_data;
	subtilis_ir_inst_t *inkey = &s->ops[start]->op.instr;
	size_t ir_dest = inkey->operands[0].reg;
	subtilis_arm_reg_t dest = subtilis_arm_ir_to_arm_reg(ir_dest);
	size_t ir_op1 = inkey->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_mov_reg(arm_s, SUBTILIS_ARM_CCODE_AL, false, 1, op1,
				 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;

	/* 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;

	subtilis_arm_add_mov_reg(arm_s, SUBTILIS_ARM_CCODE_VC, true, 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);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %rbx
movq %rdx, %r14
movq %rdi, %r12
movq 0x48(%rdi), %rax
movq (%rax,%rsi,8), %r13
movq 0x10(%r13), %rdi
callq 0x4eff7
movq %rax, %r15
movq 0x18(%r13), %rdi
callq 0x4eff7
movq %rax, %r13
movq %r14, %rdi
movl $0xd, %esi
movl $0xf, %edx
movl $0xe, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq %rbx
pushq $0x81
callq 0x50249
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x6fb7f
subq $0x8, %rsp
movl $0x1, %r8d
movq %r14, %rdi
movl $0xd, %esi
movl $0xe, %edx
xorl %ecx, %ecx
movq %r13, %r9
pushq %rbx
callq 0x5060d
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x6fb7f
movl $0x2, %r9d
movq %r14, %rdi
movl $0xd, %esi
movl $0xf, %edx
movl $0xe, %ecx
xorl %r8d, %r8d
pushq %rbx
pushq $0xff
callq 0x50249
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x6fb7f
movl $0x20006, %edx          # imm = 0x20006
movq %r14, %rdi
movl $0xe, %esi
movl $0x7, %ecx
movl $0x6, %r8d
movq %rbx, %r9
callq 0x505b2
cmpl $0x0, (%rbx)
jne 0x6fb7f
movq (%r14), %rdi
leaq 0x1(%rdi), %rax
movq %rax, (%r14)
callq 0x4eff7
movq %r14, %rdi
movq %r12, %rsi
movl $0x6, %edx
movq %rax, %rcx
movq %rbx, %r8
callq 0x526e6
cmpl $0x0, (%rbx)
jne 0x6fb7f
subq $0x8, %rsp
movl $0x1, %r9d
movq %r14, %rdi
movl $0xd, %esi
movl $0x7, %edx
movl $0x1, %ecx
movq %r15, %r8
pushq %rbx
callq 0x5060d
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x6fb7f
movq %r14, %rdi
movl $0xf, %esi
movl $0xd, %edx
movl $0x1, %ecx
xorl %r8d, %r8d
movq %r15, %r9
pushq %rbx
pushq $0x0
callq 0x50249
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/backends/riscos_common/riscos_arm.c
// Function: subtilis_riscos_arm_os_byte_id
void subtilis_riscos_arm_os_byte_id(subtilis_ir_section_t *s, size_t start,
				    void *user_data, subtilis_error_t *err)
{
	subtilis_arm_reg_t one;
	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);

	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_mov_imm(arm_s, SUBTILIS_ARM_CCODE_AL, false, 1, 0,
				 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;

	/* 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;

	subtilis_arm_add_mov_reg(arm_s, SUBTILIS_ARM_CCODE_VC, false, dest, 1,
				 err);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movq %rdi, %r12
movq 0x48(%rdi), %rax
movq (%rax,%rsi,8), %rax
movq 0x10(%rax), %rdi
callq 0x4eff7
movq %rax, %r15
movq %r14, %rdi
movl $0xd, %esi
movl $0xf, %edx
movl $0xe, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq %rbx
pushq $0x81
callq 0x50249
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x6fc88
movl $0x1, %r9d
movq %r14, %rdi
movl $0xd, %esi
movl $0xf, %edx
movl $0xe, %ecx
xorl %r8d, %r8d
pushq %rbx
pushq $0x0
callq 0x50249
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x6fc88
movl $0x2, %r9d
movq %r14, %rdi
movl $0xd, %esi
movl $0xf, %edx
movl $0xe, %ecx
xorl %r8d, %r8d
pushq %rbx
pushq $0xff
callq 0x50249
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x6fc88
movl $0x20006, %edx          # imm = 0x20006
movq %r14, %rdi
movl $0xe, %esi
movl $0x7, %ecx
movl $0x6, %r8d
movq %rbx, %r9
callq 0x505b2
cmpl $0x0, (%rbx)
jne 0x6fc88
movq (%r14), %rdi
leaq 0x1(%rdi), %rax
movq %rax, (%r14)
callq 0x4eff7
movq %r14, %rdi
movq %r12, %rsi
movl $0x6, %edx
movq %rax, %rcx
movq %rbx, %r8
callq 0x526e6
cmpl $0x0, (%rbx)
je 0x6fc94
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
subq $0x8, %rsp
movl $0x1, %r9d
movq %r14, %rdi
movl $0xd, %esi
movl $0x7, %edx
xorl %ecx, %ecx
movq %r15, %r8
pushq %rbx
callq 0x5060d
addq $0x18, %rsp
jmp 0x6fc8c
// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/backends/riscos_common/riscos_arm.c
// Function: subtilis_riscos_arm_vdui
void subtilis_riscos_arm_vdui(subtilis_ir_section_t *s, size_t start,
			      void *user_data, subtilis_error_t *err)
{
	subtilis_arm_section_t *arm_s = user_data;
	subtilis_ir_inst_t *vdu = &s->ops[start]->op.instr;
	size_t ch = vdu->operands[0].integer & 0xff;

	/* read_mask = 0 */
	/* write_mask = 0 */
	subtilis_arm_add_swi(arm_s, SUBTILIS_ARM_CCODE_AL, 256 + ch + 0x20000,
			     0, 0, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_riscos_handle_graphics_error(arm_s, s, err);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rcx, %rbx
movq %rdx, %r14
movq %rdi, %r15
movq 0x48(%rdi), %rax
movq (%rax,%rsi,8), %rax
movzbl 0x10(%rax), %edx
orq $0x20100, %rdx          # imm = 0x20100
movq %r14, %rdi
movl $0xe, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %rbx, %r9
callq 0x505b2
cmpl $0x0, (%rbx)
je 0x6fcfd
popq %rbx
popq %r14
popq %r15
retq
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x6ed7d
// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/backends/riscos_common/riscos_arm.c
// Function: subtilis_riscos_arm_vdu
void subtilis_riscos_arm_vdu(subtilis_ir_section_t *s, size_t start,
			     void *user_data, subtilis_error_t *err)
{
	subtilis_arm_section_t *arm_s = user_data;
	subtilis_ir_inst_t *vdu = &s->ops[start]->op.instr;
	size_t ir_src = vdu->operands[0].reg;
	subtilis_arm_reg_t src = subtilis_arm_ir_to_arm_reg(ir_src);

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

	/* OS_WriteC */
	/* read_mask = 0x1 = r0 */
	/* write_mask = 0 */
	subtilis_arm_add_swi(arm_s, SUBTILIS_ARM_CCODE_AL, 0x0 + 0x20000, 1, 0,
			     err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_riscos_handle_graphics_error(arm_s, s, err);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rdi, %r15
movq 0x48(%rdi), %rax
movq (%rax,%rsi,8), %rax
movq 0x10(%rax), %rdi
callq 0x4eff7
movq %rbx, (%rsp)
movq %r14, %rdi
movl $0xd, %esi
movl $0xe, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %rax, %r9
callq 0x5060d
cmpl $0x0, (%rbx)
jne 0x6fd78
movl $0x20000, %edx          # imm = 0x20000
movq %r14, %rdi
movl $0xe, %esi
movl $0x1, %ecx
xorl %r8d, %r8d
movq %rbx, %r9
callq 0x505b2
cmpl $0x0, (%rbx)
je 0x6fd82
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x6ed7d
// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/backends/riscos_common/riscos_arm.c
// Function: subtilis_riscos_arm_point_tint
void subtilis_riscos_arm_point_tint(subtilis_ir_section_t *s, size_t start,
				    void *user_data, size_t res_reg,
				    subtilis_error_t *err)
{
	subtilis_arm_reg_t x;
	subtilis_arm_reg_t y;
	subtilis_arm_reg_t dest;
	subtilis_arm_section_t *arm_s = user_data;
	subtilis_ir_inst_t *plot = &s->ops[start]->op.instr;

	x = subtilis_arm_ir_to_arm_reg(plot->operands[1].reg);
	subtilis_arm_add_mov_reg(arm_s, SUBTILIS_ARM_CCODE_AL, false, 0, x,
				 err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	y = subtilis_arm_ir_to_arm_reg(plot->operands[2].reg);
	subtilis_arm_add_mov_reg(arm_s, SUBTILIS_ARM_CCODE_AL, false, 1, y,
				 err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	/* OS_ReadPoint */
	/* read_mask = 0x3 = r0, r1 */
	/* write_mask = 0x1c = r2, r3, r4 */
	subtilis_arm_add_swi(arm_s, SUBTILIS_ARM_CCODE_AL, 0x32 + 0x20000, 3,
			     0x1C, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_riscos_handle_graphics_error(arm_s, s, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	dest = subtilis_arm_ir_to_arm_reg(plot->operands[0].reg);
	subtilis_arm_add_mov_reg(arm_s, SUBTILIS_ARM_CCODE_VC, false, dest,
				 res_reg, err);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %r8, %r14
movq %rcx, %rbx
movq %rdx, %r15
movq %rdi, %r12
movq 0x48(%rdi), %rax
movq (%rax,%rsi,8), %r13
movq 0x18(%r13), %rdi
callq 0x4eff7
movq %r14, (%rsp)
movq %r15, %rdi
movl $0xd, %esi
movl $0xe, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %rax, %r9
callq 0x5060d
cmpl $0x0, (%r14)
jne 0x6fe7c
movq 0x20(%r13), %rdi
callq 0x4eff7
movq %r14, (%rsp)
movl $0x1, %r8d
movq %r15, %rdi
movl $0xd, %esi
movl $0xe, %edx
xorl %ecx, %ecx
movq %rax, %r9
callq 0x5060d
cmpl $0x0, (%r14)
jne 0x6fe7c
movl $0x20032, %edx          # imm = 0x20032
movq %r15, %rdi
movl $0xe, %esi
movl $0x3, %ecx
movl $0x1c, %r8d
movq %r14, %r9
callq 0x505b2
cmpl $0x0, (%r14)
jne 0x6fe7c
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x6ed7d
cmpl $0x0, (%r14)
jne 0x6fe7c
movq 0x10(%r13), %rdi
callq 0x4eff7
movq %r14, (%rsp)
movq %r15, %rdi
movl $0xd, %esi
movl $0x7, %edx
xorl %ecx, %ecx
movq %rax, %r8
movq %rbx, %r9
callq 0x5060d
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/backends/riscos_common/riscos_arm.c
// Function: subtilis_riscos_arm_ref
void subtilis_riscos_arm_ref(subtilis_ir_section_t *s, size_t start,
			     void *user_data, subtilis_error_t *err)
{
	subtilis_arm_reg_t count;
	subtilis_arm_reg_t block;
	subtilis_ir_inst_t *ref = &s->ops[start]->op.instr;
	subtilis_arm_section_t *arm_s = user_data;

	/*
	 * Subtract 8 from the memory address provided by program
	 */

	block = subtilis_arm_ir_to_arm_reg(ref->operands[0].reg);
	count = subtilis_arm_ir_to_arm_reg(arm_s->reg_counter++);

	subtilis_arm_add_stran_imm(arm_s, SUBTILIS_ARM_INSTR_LDR,
				   SUBTILIS_ARM_CCODE_AL, count, block, -8,
				   false, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_arm_add_add_imm(arm_s, SUBTILIS_ARM_CCODE_AL, false, count,
				 count, 1, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_arm_add_stran_imm(arm_s, SUBTILIS_ARM_INSTR_STR,
				   SUBTILIS_ARM_CCODE_AL, count, block, -8,
				   false, err);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movq 0x48(%rdi), %rax
movq (%rax,%rsi,8), %rax
movq 0x10(%rax), %rdi
callq 0x4eff7
movq %rax, %r15
movq (%r14), %rdi
leaq 0x1(%rdi), %rax
movq %rax, (%r14)
callq 0x4eff7
movq %rax, %r12
movq %r14, %rdi
movl $0x12, %esi
movl $0xe, %edx
movq %rax, %rcx
movq %r15, %r8
movl $0xfffffff8, %r9d       # imm = 0xFFFFFFF8
pushq %rbx
pushq $0x0
callq 0x5067b
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x7023f
subq $0x8, %rsp
movq %r14, %rdi
movl $0x4, %esi
movl $0x2, %edx
movl $0xe, %ecx
xorl %r8d, %r8d
movq %r12, %r9
pushq %rbx
pushq $0x1
pushq %r12
callq 0x4fe13
addq $0x20, %rsp
cmpl $0x0, (%rbx)
je 0x7024b
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %r14, %rdi
movl $0x13, %esi
movl $0xe, %edx
movq %r12, %rcx
movq %r15, %r8
movl $0xfffffff8, %r9d       # imm = 0xFFFFFFF8
pushq %rbx
pushq $0x0
callq 0x5067b
addq $0x18, %rsp
jmp 0x70243
// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/backends/riscos_common/riscos_arm.c
// Function: subtilis_riscos_arm_getref
void subtilis_riscos_arm_getref(subtilis_ir_section_t *s, size_t start,
				void *user_data, subtilis_error_t *err)
{
	subtilis_arm_reg_t count;
	subtilis_arm_reg_t ptr;
	subtilis_arm_reg_t block;
	subtilis_ir_inst_t *getref = &s->ops[start]->op.instr;
	subtilis_arm_section_t *arm_s = user_data;

	count = subtilis_arm_ir_to_arm_reg(getref->operands[0].reg);
	ptr = subtilis_arm_ir_to_arm_reg(getref->operands[1].reg);
	block = subtilis_arm_ir_to_arm_reg(arm_s->reg_counter++);

	/*
	 * Subtract 8 from the memory address provided by program
	 */

	subtilis_arm_add_sub_imm(arm_s, SUBTILIS_ARM_CCODE_AL, false, block,
				 ptr, 8, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_arm_add_stran_imm(arm_s, SUBTILIS_ARM_INSTR_LDR,
				   SUBTILIS_ARM_CCODE_AL, count, block, 0,
				   false, err);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %rbx
movq %rdx, %r14
movq 0x48(%rdi), %rax
movq (%rax,%rsi,8), %r12
movq 0x10(%r12), %rdi
callq 0x4eff7
movq %rax, %r15
movq 0x18(%r12), %rdi
callq 0x4eff7
movq %rax, %r13
movq (%r14), %rdi
leaq 0x1(%rdi), %rax
movq %rax, (%r14)
callq 0x4eff7
movq %rax, %r12
subq $0x8, %rsp
movq %r14, %rdi
movl $0x2, %esi
movl $0x4, %edx
movl $0xe, %ecx
xorl %r8d, %r8d
movq %rax, %r9
pushq %rbx
pushq $0x8
pushq %r13
callq 0x4fe13
addq $0x20, %rsp
cmpl $0x0, (%rbx)
jne 0x70306
movq %r14, %rdi
movl $0x12, %esi
movl $0xe, %edx
movq %r15, %rcx
movq %r12, %r8
xorl %r9d, %r9d
pushq %rbx
pushq $0x0
callq 0x5067b
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/backends/riscos_common/riscos_arm.c
// Function: subtilis_riscos_tcol
void subtilis_riscos_tcol(subtilis_ir_section_t *s, size_t start,
			  void *user_data, subtilis_error_t *err)
{
	subtilis_arm_section_t *arm_s = user_data;
	subtilis_ir_inst_t *tcol = &s->ops[start]->op.instr;
	size_t col;

	/* read_mask = 0 */
	/* write_mask = 0 */
	subtilis_arm_add_swi(arm_s, SUBTILIS_ARM_CCODE_AL, 256 + 17 + 0x20000,
			     0, 0, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	col = subtilis_arm_ir_to_arm_reg(tcol->operands[0].reg);
	subtilis_arm_add_mov_reg(arm_s, SUBTILIS_ARM_CCODE_VC, false, 0, col,
				 err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	/* OS_WriteC */
	/* read_mask = 0x1 = r0 */
	/* write_mask = 0 */
	subtilis_arm_add_swi(arm_s, SUBTILIS_ARM_CCODE_VC, 0 + 0x20000, 1, 0,
			     err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_riscos_handle_graphics_error(arm_s, s, err);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movq %rdi, %r15
movq 0x48(%rdi), %rax
movq (%rax,%rsi,8), %r12
movl $0x20111, %edx          # imm = 0x20111
movq %r14, %rdi
movl $0xe, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %rbx, %r9
callq 0x505b2
cmpl $0x0, (%rbx)
jne 0x70397
movq 0x10(%r12), %rdi
callq 0x4eff7
movq %rbx, (%rsp)
movq %r14, %rdi
movl $0xd, %esi
movl $0x7, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %rax, %r9
callq 0x5060d
cmpl $0x0, (%rbx)
jne 0x70397
movl $0x20000, %edx          # imm = 0x20000
movq %r14, %rdi
movl $0x7, %esi
movl $0x1, %ecx
xorl %r8d, %r8d
movq %rbx, %r9
callq 0x505b2
cmpl $0x0, (%rbx)
je 0x703a3
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x6ed7d
// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/backends/riscos_common/riscos_arm.c
// Function: subtilis_riscos_palette
void subtilis_riscos_palette(subtilis_ir_section_t *s, size_t start,
			     void *user_data, subtilis_error_t *err)
{
	subtilis_arm_section_t *arm_s = user_data;
	subtilis_ir_inst_t *tcol = &s->ops[start]->op.instr;
	size_t col;
	size_t i;

	/* read_mask = 0 */
	/* write_mask = 0 */
	subtilis_arm_add_swi(arm_s, SUBTILIS_ARM_CCODE_AL, 256 + 19 + 0x20000,
			     0, 0, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	col = subtilis_arm_ir_to_arm_reg(tcol->operands[0].reg);
	subtilis_arm_add_mov_reg(arm_s, SUBTILIS_ARM_CCODE_VC, false, 0, col,
				 err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	/* OS_WriteC */
	/* read_mask = 0x1 = r0 */
	/* write_mask = 0 */
	subtilis_arm_add_swi(arm_s, SUBTILIS_ARM_CCODE_VC, 0 + 0x20000, 1, 0,
			     err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	/* read_mask = 0 */
	/* write_mask = 0 */
	subtilis_arm_add_swi(arm_s, SUBTILIS_ARM_CCODE_VC, 256 + 16 + 0x20000,
			     0, 0, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	for (i = 1; i < 4; i++) {
		col = subtilis_arm_ir_to_arm_reg(tcol->operands[i].reg);
		subtilis_arm_add_mov_reg(arm_s, SUBTILIS_ARM_CCODE_VC, false, 0,
					 col, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;

		/* OS_WriteC */
		/* read_mask = 0x1 = r0 */
		/* write_mask = 0 */
		subtilis_arm_add_swi(arm_s, SUBTILIS_ARM_CCODE_VC, 0 + 0x20000,
				     1, 0, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;
	}

	subtilis_riscos_handle_graphics_error(arm_s, s, err);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rdi, %r15
movq 0x48(%rdi), %rax
movq (%rax,%rsi,8), %r12
movl $0x20113, %edx          # imm = 0x20113
movq %r14, %rdi
movl $0xe, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %rbx, %r9
callq 0x505b2
cmpl $0x0, (%rbx)
jne 0x70467
movq 0x10(%r12), %rdi
callq 0x4eff7
movq %rbx, (%rsp)
movq %r14, %rdi
movl $0xd, %esi
movl $0x7, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %rax, %r9
callq 0x5060d
cmpl $0x0, (%rbx)
jne 0x70467
movl $0x20000, %edx          # imm = 0x20000
movq %r14, %rdi
movl $0x7, %esi
movl $0x1, %ecx
xorl %r8d, %r8d
movq %rbx, %r9
callq 0x505b2
cmpl $0x0, (%rbx)
jne 0x70467
movl $0x20110, %edx          # imm = 0x20110
movq %r14, %rdi
movl $0x7, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %rbx, %r9
callq 0x505b2
cmpl $0x0, (%rbx)
je 0x70475
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
xorl %r13d, %r13d
movq 0x18(%r12,%r13,8), %rdi
callq 0x4eff7
movq %rbx, (%rsp)
movq %r14, %rdi
movl $0xd, %esi
movl $0x7, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %rax, %r9
callq 0x5060d
cmpl $0x0, (%rbx)
jne 0x70467
movl $0x20000, %edx          # imm = 0x20000
movq %r14, %rdi
movl $0x7, %esi
movl $0x1, %ecx
xorl %r8d, %r8d
movq %rbx, %r9
callq 0x505b2
cmpl $0x0, (%rbx)
jne 0x70467
incq %r13
cmpq $0x3, %r13
jne 0x70478
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x6ed7d
// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/backends/riscos_common/riscos_arm.c
// Function: subtilis_riscos_arm_i32_to_dec
void subtilis_riscos_arm_i32_to_dec(subtilis_ir_section_t *s, size_t start,
				    void *user_data, subtilis_error_t *err)
{
	subtilis_arm_reg_t dest;
	subtilis_arm_reg_t buffer;
	subtilis_arm_reg_t val;
	subtilis_arm_section_t *arm_s = user_data;
	subtilis_ir_inst_t *to_deci = &s->ops[start]->op.instr;

	dest = subtilis_arm_ir_to_arm_reg(to_deci->operands[0].reg);
	val = subtilis_arm_ir_to_arm_reg(to_deci->operands[1].reg);
	buffer = subtilis_arm_ir_to_arm_reg(to_deci->operands[2].reg);

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

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

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

	/* OS_ConvertInteger4 */
	/* read_mask = 0x7 = r0, r1, r2 */
	/* write_mask = 0x7 = r0, r1, r2 */
	subtilis_arm_add_swi(arm_s, SUBTILIS_ARM_CCODE_AL, 0xdc, 0x7, 0x7, err);

	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_arm_add_data_imm(arm_s, SUBTILIS_ARM_INSTR_RSB,
				  SUBTILIS_ARM_CCODE_AL, false, dest, 2, 12,
				  err);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %rbx
movq %rdx, %r14
movq 0x48(%rdi), %rax
movq (%rax,%rsi,8), %r12
movq 0x10(%r12), %rdi
callq 0x4eff7
movq %rax, %r15
movq 0x18(%r12), %rdi
callq 0x4eff7
movq %rax, %r13
movq 0x20(%r12), %rdi
callq 0x4eff7
movq %rax, %r12
subq $0x8, %rsp
movq %r14, %rdi
movl $0xd, %esi
movl $0xe, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %r13, %r9
pushq %rbx
callq 0x5060d
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x705f5
subq $0x8, %rsp
movl $0x1, %r8d
movq %r14, %rdi
movl $0xd, %esi
movl $0xe, %edx
xorl %ecx, %ecx
movq %r12, %r9
pushq %rbx
callq 0x5060d
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x705f5
movl $0x2, %r9d
movq %r14, %rdi
movl $0xd, %esi
movl $0xf, %edx
movl $0xe, %ecx
xorl %r8d, %r8d
pushq %rbx
pushq $0xc
callq 0x50249
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x705f5
movl $0xdc, %edx
movq %r14, %rdi
movl $0xe, %esi
movl $0x7, %ecx
movl $0x7, %r8d
movq %rbx, %r9
callq 0x505b2
cmpl $0x0, (%rbx)
jne 0x705f5
movl $0x2, %r9d
movq %r14, %rdi
movl $0x3, %esi
movl $0xe, %edx
xorl %ecx, %ecx
movq %r15, %r8
pushq %rbx
pushq $0xc
callq 0x503c6
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/backends/riscos_common/riscos_arm.c
// Function: subtilis_riscos_arm_i32_to_hex
void subtilis_riscos_arm_i32_to_hex(subtilis_ir_section_t *s, size_t start,
				    void *user_data, subtilis_error_t *err)
{
	subtilis_arm_reg_t dest;
	subtilis_arm_reg_t buffer;
	subtilis_arm_reg_t val;
	subtilis_arm_section_t *arm_s = user_data;
	subtilis_ir_inst_t *to_hexi = &s->ops[start]->op.instr;

	dest = subtilis_arm_ir_to_arm_reg(to_hexi->operands[0].reg);
	val = subtilis_arm_ir_to_arm_reg(to_hexi->operands[1].reg);
	buffer = subtilis_arm_ir_to_arm_reg(to_hexi->operands[2].reg);

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

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

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

	/* OS_ConvertHex8 */
	/* read_mask = 0x7 = r0, r1, r2 */
	/* write_mask = 0x7 = r0, r1, r2 */
	subtilis_arm_add_swi(arm_s, SUBTILIS_ARM_CCODE_AL, 0xd4, 0x7, 0x7, err);

	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_arm_add_data_imm(arm_s, SUBTILIS_ARM_INSTR_RSB,
				  SUBTILIS_ARM_CCODE_AL, false, dest, 2, 11,
				  err);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %rbx
movq %rdx, %r14
movq 0x48(%rdi), %rax
movq (%rax,%rsi,8), %r12
movq 0x10(%r12), %rdi
callq 0x4eff7
movq %rax, %r15
movq 0x18(%r12), %rdi
callq 0x4eff7
movq %rax, %r13
movq 0x20(%r12), %rdi
callq 0x4eff7
movq %rax, %r12
subq $0x8, %rsp
movq %r14, %rdi
movl $0xd, %esi
movl $0xe, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %r13, %r9
pushq %rbx
callq 0x5060d
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x70709
subq $0x8, %rsp
movl $0x1, %r8d
movq %r14, %rdi
movl $0xd, %esi
movl $0xe, %edx
xorl %ecx, %ecx
movq %r12, %r9
pushq %rbx
callq 0x5060d
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x70709
movl $0x2, %r9d
movq %r14, %rdi
movl $0xd, %esi
movl $0xf, %edx
movl $0xe, %ecx
xorl %r8d, %r8d
pushq %rbx
pushq $0xb
callq 0x50249
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x70709
movl $0xd4, %edx
movq %r14, %rdi
movl $0xe, %esi
movl $0x7, %ecx
movl $0x7, %r8d
movq %rbx, %r9
callq 0x505b2
cmpl $0x0, (%rbx)
jne 0x70709
movl $0x2, %r9d
movq %r14, %rdi
movl $0x3, %esi
movl $0xe, %edx
xorl %ecx, %ecx
movq %r15, %r8
pushq %rbx
pushq $0xb
callq 0x503c6
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/backends/riscos_common/riscos_arm.c
// Function: subtilis_riscos_arm_heap_free_space
void subtilis_riscos_arm_heap_free_space(subtilis_ir_section_t *s, size_t start,
					 void *user_data, subtilis_error_t *err)
{
	subtilis_arm_reg_t heap_start;
	subtilis_arm_reg_t result;
	subtilis_arm_reg_t scratch;
	subtilis_arm_section_t *arm_s = user_data;
	subtilis_ir_inst_t *free_space = &s->ops[start]->op.instr;

	heap_start = subtilis_arm_ir_to_arm_reg(arm_s->reg_counter++);
	result = subtilis_arm_ir_to_arm_reg(free_space->operands[0].reg);
	scratch = subtilis_arm_ir_to_arm_reg(arm_s->reg_counter++);

	prv_load_heap_pointer(arm_s, scratch, heap_start, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_arm_heap_free_space(arm_s, heap_start, result, err);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movq 0x48(%rdi), %rax
movq (%rax,%rsi,8), %r12
movq (%rdx), %rdi
leaq 0x1(%rdi), %rax
movq %rax, (%rdx)
callq 0x4eff7
movq %rax, %r15
movq 0x10(%r12), %rdi
callq 0x4eff7
movq %rax, %r12
movq (%r14), %rdi
leaq 0x1(%rdi), %rax
movq %rax, (%r14)
callq 0x4eff7
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x70795
cmpl $0x0, (%rbx)
je 0x70779
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x62a3c
// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/backends/riscos_common/riscos_arm.c
// Function: subtilis_riscos_arm_block_free_space
void subtilis_riscos_arm_block_free_space(subtilis_ir_section_t *s,
					  size_t start, void *user_data,
					  subtilis_error_t *err)
{
	subtilis_arm_reg_t total;
	subtilis_arm_reg_t space_used;
	subtilis_arm_instr_t *instr;
	subtilis_arm_data_instr_t *datai;
	subtilis_arm_section_t *arm_s = user_data;
	subtilis_ir_inst_t *block_space = &s->ops[start]->op.instr;
	subtilis_arm_reg_t dest =
	    subtilis_arm_ir_to_arm_reg(block_space->operands[0].reg);
	subtilis_arm_reg_t block =
	    subtilis_arm_ir_to_arm_reg(block_space->operands[1].reg);

	total = subtilis_arm_ir_to_arm_reg(arm_s->reg_counter++);
	space_used = subtilis_arm_ir_to_arm_reg(arm_s->reg_counter++);

	subtilis_arm_add_stran_imm(arm_s, SUBTILIS_ARM_INSTR_LDR,
				   SUBTILIS_ARM_CCODE_AL, space_used, block, -4,
				   false, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_arm_add_stran_imm(arm_s, SUBTILIS_ARM_INSTR_LDR,
				   SUBTILIS_ARM_CCODE_AL, total, block, -16,
				   false, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	instr =
	    subtilis_arm_section_add_instr(arm_s, SUBTILIS_ARM_INSTR_SUB, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;
	datai = &instr->operands.data;
	datai->ccode = SUBTILIS_ARM_CCODE_AL;
	datai->status = false;
	datai->dest = dest;
	datai->op1 = total;
	datai->op2.type = SUBTILIS_ARM_OP2_REG;
	datai->op2.op.reg = space_used;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r15
movq 0x48(%rdi), %rax
movq (%rax,%rsi,8), %r12
movq 0x10(%r12), %rdi
callq 0x4eff7
movq %rax, %r14
movq 0x18(%r12), %rdi
callq 0x4eff7
movq %rax, %rbp
movq (%r15), %rdi
leaq 0x1(%rdi), %rax
movq %rax, (%r15)
callq 0x4eff7
movq %rax, %r12
movq (%r15), %rdi
leaq 0x1(%rdi), %rax
movq %rax, (%r15)
callq 0x4eff7
movq %rax, %r13
movq %r15, %rdi
movl $0x12, %esi
movl $0xe, %edx
movq %rax, %rcx
movq %rbp, %r8
movl $0xfffffffc, %r9d       # imm = 0xFFFFFFFC
pushq %rbx
pushq $0x0
callq 0x5067b
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x708e5
movq %r15, %rdi
movl $0x12, %esi
movl $0xe, %edx
movq %r12, %rcx
movq %rbp, %r8
movl $0xfffffff0, %r9d       # imm = 0xFFFFFFF0
pushq %rbx
pushq $0x0
callq 0x5067b
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x708e5
movq %r15, %rdi
movl $0x2, %esi
movq %rbx, %rdx
callq 0x4f73a
cmpl $0x0, (%rbx)
jne 0x708e5
movl $0xe, 0x8(%rax)
movb $0x0, 0xc(%rax)
movq %r14, 0x10(%rax)
movq %r12, 0x18(%rax)
movl $0x0, 0x20(%rax)
movq %r13, 0x28(%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/backends/riscos_common/riscos_arm.c
// Function: subtilis_riscos_arm_block_adjust
void subtilis_riscos_arm_block_adjust(subtilis_ir_section_t *s, size_t start,
				      void *user_data, subtilis_error_t *err)
{
	subtilis_arm_reg_t new_space_used;
	subtilis_arm_reg_t space_used;
	subtilis_arm_instr_t *instr;
	subtilis_arm_data_instr_t *datai;
	subtilis_arm_section_t *arm_s = user_data;
	subtilis_ir_inst_t *block_adjust = &s->ops[start]->op.instr;
	subtilis_arm_reg_t block =
	    subtilis_arm_ir_to_arm_reg(block_adjust->operands[0].reg);
	subtilis_arm_reg_t increment =
	    subtilis_arm_ir_to_arm_reg(block_adjust->operands[1].reg);

	space_used = subtilis_arm_ir_to_arm_reg(arm_s->reg_counter++);
	new_space_used = subtilis_arm_ir_to_arm_reg(arm_s->reg_counter++);

	subtilis_arm_add_stran_imm(arm_s, SUBTILIS_ARM_INSTR_LDR,
				   SUBTILIS_ARM_CCODE_AL, space_used, block, -4,
				   false, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	instr =
	    subtilis_arm_section_add_instr(arm_s, SUBTILIS_ARM_INSTR_ADD, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;
	datai = &instr->operands.data;
	datai->ccode = SUBTILIS_ARM_CCODE_AL;
	datai->status = false;
	datai->dest = new_space_used;
	datai->op1 = space_used;
	datai->op2.type = SUBTILIS_ARM_OP2_REG;
	datai->op2.op.reg = increment;

	subtilis_arm_add_stran_imm(arm_s, SUBTILIS_ARM_INSTR_STR,
				   SUBTILIS_ARM_CCODE_AL, new_space_used, block,
				   -4, false, err);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movq 0x48(%rdi), %rax
movq (%rax,%rsi,8), %r12
movq 0x10(%r12), %rdi
callq 0x4eff7
movq %rax, %r15
movq 0x18(%r12), %rdi
callq 0x4eff7
movq %rax, %r12
movq (%r14), %rdi
leaq 0x1(%rdi), %rax
movq %rax, (%r14)
callq 0x4eff7
movq %rax, %r13
movq (%r14), %rdi
leaq 0x1(%rdi), %rax
movq %rax, (%r14)
callq 0x4eff7
movq %rax, %rbp
movq %r14, %rdi
movl $0x12, %esi
movl $0xe, %edx
movq %r13, %rcx
movq %r15, %r8
movl $0xfffffffc, %r9d       # imm = 0xFFFFFFFC
pushq %rbx
pushq $0x0
callq 0x5067b
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x7098a
movq %r14, %rdi
movl $0x4, %esi
movq %rbx, %rdx
callq 0x4f73a
cmpl $0x0, (%rbx)
je 0x70999
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xe, 0x8(%rax)
movb $0x0, 0xc(%rax)
movq %rbp, 0x10(%rax)
movq %r13, 0x18(%rax)
xorl %r10d, %r10d
movl %r10d, 0x20(%rax)
movq %r12, 0x28(%rax)
movq %r14, %rdi
movl $0x13, %esi
movl $0xe, %edx
movq %rbp, %rcx
movq %r15, %r8
movl $0xfffffffc, %r9d       # imm = 0xFFFFFFFC
pushq %rbx
pushq %r10
callq 0x5067b
addq $0x18, %rsp
jmp 0x7098e
// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/backends/riscos_common/riscos_arm.c
// Function: subtilis_riscos_sys_check
bool subtilis_riscos_sys_check(size_t call_id, uint32_t *in_regs,
			       uint32_t *out_regs, bool *handle_errors,
			       const subtilis_arm_swi_t *swi_list,
			       size_t swi_count)
{
	subtilis_arm_swi_t *found;

	if (call_id & 0x20000) {
		*handle_errors = true;
		call_id &= ~0x20000;
	} else {
		*handle_errors = false;
	}

	if (call_id >= 0x100 && call_id <= 0x1ff) {
		*in_regs = 0;
		return true;
	}

	found = bsearch(&call_id, &swi_list[0], swi_count, sizeof(*found),
			prv_sys_num_lookup);

	if (!found)
		return false;

	*in_regs = found->in_regs;
	*out_regs = found->out_regs;

	return true;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, (%rsp)
btl $0x11, %edi
jb 0x709f7
movb $0x0, (%rcx)
jmp 0x70a05
movb $0x1, (%rcx)
andq $-0x20001, %rdi         # imm = 0xFFFDFFFF
movq %rdi, (%rsp)
movq $-0x100, %rax
andq (%rsp), %rax
cmpq $0x100, %rax            # imm = 0x100
jne 0x70a21
movl $0x0, (%r14)
jmp 0x70a4e
leaq 0x34(%rip), %rax        # 0x70a5c
movq %rsp, %rdi
movl $0x18, %ecx
movq %r8, %rsi
movq %r9, %rdx
movq %rax, %r8
callq 0x122a0
testq %rax, %rax
je 0x70a58
movl 0x10(%rax), %ecx
movl %ecx, (%r14)
movl 0x14(%rax), %eax
movl %eax, (%rbx)
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
xorl %eax, %eax
jmp 0x70a50
// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/backends/riscos_common/riscos_arm.c
// Function: prv_open_file
static void prv_open_file(subtilis_ir_section_t *s, size_t start,
			  void *user_data, int32_t code, int32_t bits,
			  subtilis_error_t *err)
{
	subtilis_arm_reg_t dest;
	subtilis_arm_reg_t buffer;
	subtilis_arm_reg_t one;
	subtilis_arm_section_t *arm_s = user_data;
	subtilis_ir_inst_t *openf = &s->ops[start]->op.instr;

	dest = subtilis_arm_ir_to_arm_reg(openf->operands[0].reg);
	buffer = subtilis_arm_ir_to_arm_reg(openf->operands[1].reg);

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

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

	/* OS_Find */
	/* read_mask = 0x3 = r0, r1 */
	/* write_mask = 0x1 = r0 */
	subtilis_arm_add_swi(arm_s, SUBTILIS_ARM_CCODE_AL, 0x20000 + 0xd, 0x3,
			     0x1, 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;

	subtilis_arm_add_mov_reg(arm_s, SUBTILIS_ARM_CCODE_VC, false, dest, 0,
				 err);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %r14
movl %r8d, %ebp
movl %ecx, %r15d
movq %rdx, %rbx
movq %rdi, %r12
movq 0x48(%rdi), %rax
movq (%rax,%rsi,8), %r13
movq 0x10(%r13), %rdi
callq 0x4eff7
movq %rax, 0x10(%rsp)
movq 0x18(%r13), %rdi
callq 0x4eff7
movq %rax, %r13
orl %ebp, %r15d
movq %r14, 0x8(%rsp)
movl %r15d, (%rsp)
movq %rbx, %rdi
movl $0xd, %esi
movl $0xf, %edx
movl $0xe, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x50249
cmpl $0x0, (%r14)
jne 0x70d63
movq %r14, (%rsp)
movl $0x1, %r8d
movq %rbx, %rdi
movl $0xd, %esi
movl $0xe, %edx
xorl %ecx, %ecx
movq %r13, %r9
callq 0x5060d
cmpl $0x0, (%r14)
jne 0x70d63
movl $0x2000d, %edx          # imm = 0x2000D
movq %rbx, %rdi
movl $0xe, %esi
movl $0x3, %ecx
movl $0x1, %r8d
movq %r14, %r9
callq 0x505b2
cmpl $0x0, (%r14)
jne 0x70d63
movq (%rbx), %rdi
leaq 0x1(%rdi), %rax
movq %rax, (%rbx)
callq 0x4eff7
movq %rbx, %rdi
movq %r12, %rsi
movl $0x6, %edx
movq %rax, %rcx
movq %r14, %r8
callq 0x526e6
cmpl $0x0, (%r14)
jne 0x70d63
movq %r14, (%rsp)
movq %rbx, %rdi
movl $0xd, %esi
movl $0x7, %edx
xorl %ecx, %ecx
movq 0x10(%rsp), %r8
xorl %r9d, %r9d
callq 0x5060d
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/backends/riscos_common/riscos_arm.c
// Function: subtilis_riscos_close
void subtilis_riscos_close(subtilis_ir_section_t *s, size_t start,
			   void *user_data, subtilis_error_t *err)
{
	subtilis_arm_reg_t handle;
	subtilis_arm_reg_t one;
	subtilis_arm_section_t *arm_s = user_data;
	subtilis_ir_inst_t *closef = &s->ops[start]->op.instr;

	handle = subtilis_arm_ir_to_arm_reg(closef->operands[0].reg);

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

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

	/* OS_Find */
	/* read_mask = 0x3 = r0, r1 */
	/* write_mask = 0x1 = r0 */
	subtilis_arm_add_swi(arm_s, SUBTILIS_ARM_CCODE_AL, 0x20000 + 0xd, 0x3,
			     0x1, 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);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movq %rdi, %r15
movq 0x48(%rdi), %rax
movq (%rax,%rsi,8), %rax
movq 0x10(%rax), %rdi
callq 0x4eff7
movq %rax, %r12
movq %r14, %rdi
movl $0xd, %esi
movl $0xf, %edx
movl $0xe, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq %rbx
pushq $0x0
callq 0x50249
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x70e36
subq $0x8, %rsp
movl $0x1, %r8d
movq %r14, %rdi
movl $0xd, %esi
movl $0xe, %edx
xorl %ecx, %ecx
movq %r12, %r9
pushq %rbx
callq 0x5060d
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x70e36
movl $0x2000d, %edx          # imm = 0x2000D
movq %r14, %rdi
movl $0xe, %esi
movl $0x3, %ecx
movl $0x1, %r8d
movq %rbx, %r9
callq 0x505b2
cmpl $0x0, (%rbx)
je 0x70e42
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq (%r14), %rdi
leaq 0x1(%rdi), %rax
movq %rax, (%r14)
callq 0x4eff7
movq %r14, %rdi
movq %r15, %rsi
movl $0x6, %edx
movq %rax, %rcx
movq %rbx, %r8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x526e6
// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/backends/riscos_common/riscos_arm.c
// Function: subtilis_riscos_bget
void subtilis_riscos_bget(subtilis_ir_section_t *s, size_t start,
			  void *user_data, subtilis_error_t *err)
{
	subtilis_arm_reg_t dest;
	subtilis_arm_reg_t handle;
	subtilis_arm_reg_t one;
	subtilis_arm_section_t *arm_s = user_data;
	subtilis_ir_inst_t *bget = &s->ops[start]->op.instr;

	dest = subtilis_arm_ir_to_arm_reg(bget->operands[0].reg);
	handle = subtilis_arm_ir_to_arm_reg(bget->operands[1].reg);

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

	/* OS_BGet */
	/* read_mask = 0x2 = r1 */
	/* write_mask = 0x1 = r0 */
	subtilis_arm_add_swi(arm_s, SUBTILIS_ARM_CCODE_AL, 0xa, 0x2, 0x1, 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_CS, one,
				       err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_arm_add_mov_reg(arm_s, SUBTILIS_ARM_CCODE_CC, false, dest, 0,
				 err);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rcx, %r14
movq %rdx, %rbx
movq %rdi, %r12
movq 0x48(%rdi), %rax
movq (%rax,%rsi,8), %r13
movq 0x10(%r13), %rdi
callq 0x4eff7
movq %rax, %r15
movq 0x18(%r13), %rdi
callq 0x4eff7
movq %r14, (%rsp)
movl $0x1, %r8d
movq %rbx, %rdi
movl $0xd, %esi
movl $0xe, %edx
xorl %ecx, %ecx
movq %rax, %r9
callq 0x5060d
cmpl $0x0, (%r14)
jne 0x70f3b
movl $0xa, %edx
movq %rbx, %rdi
movl $0xe, %esi
movl $0x2, %ecx
movl $0x1, %r8d
movq %r14, %r9
callq 0x505b2
cmpl $0x0, (%r14)
jne 0x70f3b
movq (%rbx), %rdi
leaq 0x1(%rdi), %rax
movq %rax, (%rbx)
callq 0x4eff7
movq %rbx, %rdi
movq %r12, %rsi
movl $0x2, %edx
movq %rax, %rcx
movq %r14, %r8
callq 0x526e6
cmpl $0x0, (%r14)
jne 0x70f3b
movq %r14, (%rsp)
movq %rbx, %rdi
movl $0xd, %esi
movl $0x3, %edx
xorl %ecx, %ecx
movq %r15, %r8
xorl %r9d, %r9d
callq 0x5060d
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/backends/riscos_common/riscos_arm.c
// Function: subtilis_riscos_bput
void subtilis_riscos_bput(subtilis_ir_section_t *s, size_t start,
			  void *user_data, subtilis_error_t *err)
{
	subtilis_arm_reg_t data;
	subtilis_arm_reg_t handle;
	subtilis_arm_reg_t one;
	subtilis_arm_section_t *arm_s = user_data;
	subtilis_ir_inst_t *bget = &s->ops[start]->op.instr;

	data = subtilis_arm_ir_to_arm_reg(bget->operands[0].reg);
	handle = subtilis_arm_ir_to_arm_reg(bget->operands[1].reg);

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

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

	/* OS_BPut */
	/* read_mask = 0x3 = r1 */
	/* write_mask = 0x0 = r0 */
	subtilis_arm_add_swi(arm_s, SUBTILIS_ARM_CCODE_AL, 0x20000 + 0xb, 0x3,
			     0x0, 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);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rdi, %r15
movq 0x48(%rdi), %rax
movq (%rax,%rsi,8), %r12
movq 0x10(%r12), %rdi
callq 0x4eff7
movq %rax, %r13
movq 0x18(%r12), %rdi
callq 0x4eff7
movq %rax, %r12
movq %rbx, (%rsp)
movq %r14, %rdi
movl $0xd, %esi
movl $0xe, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %r13, %r9
callq 0x5060d
cmpl $0x0, (%rbx)
jne 0x70fec
movq %rbx, (%rsp)
movl $0x1, %r8d
movq %r14, %rdi
movl $0xd, %esi
movl $0xe, %edx
xorl %ecx, %ecx
movq %r12, %r9
callq 0x5060d
cmpl $0x0, (%rbx)
jne 0x70fec
movl $0x2000b, %edx          # imm = 0x2000B
movq %r14, %rdi
movl $0xe, %esi
movl $0x3, %ecx
xorl %r8d, %r8d
movq %rbx, %r9
callq 0x505b2
cmpl $0x0, (%rbx)
je 0x70ffa
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq (%r14), %rdi
leaq 0x1(%rdi), %rax
movq %rax, (%r14)
callq 0x4eff7
movq %r14, %rdi
movq %r15, %rsi
movl $0x6, %edx
movq %rax, %rcx
movq %rbx, %r8
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x526e6
// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/backends/riscos_common/riscos_arm.c
// Function: subtilis_riscos_block_put
void subtilis_riscos_block_put(subtilis_ir_section_t *s, size_t start,
			       void *user_data, subtilis_error_t *err)
{
	subtilis_arm_reg_t handle;
	subtilis_arm_reg_t buffer;
	subtilis_arm_reg_t length;
	subtilis_arm_reg_t one;
	subtilis_arm_section_t *arm_s = user_data;
	subtilis_ir_inst_t *blockput = &s->ops[start]->op.instr;

	handle = subtilis_arm_ir_to_arm_reg(blockput->operands[0].reg);
	buffer = subtilis_arm_ir_to_arm_reg(blockput->operands[1].reg);
	length = subtilis_arm_ir_to_arm_reg(blockput->operands[2].reg);

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

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

	subtilis_arm_add_mov_reg(arm_s, SUBTILIS_ARM_CCODE_AL, false, 2, buffer,
				 err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_arm_add_mov_reg(arm_s, SUBTILIS_ARM_CCODE_AL, false, 3, length,
				 err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	/* OS_GBPB  2 */
	/* read_mask = 0xf = r0, r1, r2, r3 */
	/* write_mask = 0x1c = r2, r3, r4 */
	subtilis_arm_add_swi(arm_s, SUBTILIS_ARM_CCODE_AL, 0x20000 + 0x0c, 0xf,
			     0x1c, 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);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rdi, %r15
movq 0x48(%rdi), %rax
movq (%rax,%rsi,8), %r12
movq 0x10(%r12), %rdi
callq 0x4eff7
movq %rax, %rbp
movq 0x18(%r12), %rdi
callq 0x4eff7
movq %rax, %r13
movq 0x20(%r12), %rdi
callq 0x4eff7
movq %rax, %r12
movq %rbx, 0x8(%rsp)
movl $0x2, (%rsp)
movq %r14, %rdi
movl $0xd, %esi
movl $0xf, %edx
movl $0xe, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x50249
cmpl $0x0, (%rbx)
jne 0x712da
movq %rbx, (%rsp)
movl $0x1, %r8d
movq %r14, %rdi
movl $0xd, %esi
movl $0xe, %edx
xorl %ecx, %ecx
movq %rbp, %r9
callq 0x5060d
cmpl $0x0, (%rbx)
jne 0x712da
movq %rbx, (%rsp)
movl $0x2, %r8d
movq %r14, %rdi
movl $0xd, %esi
movl $0xe, %edx
xorl %ecx, %ecx
movq %r13, %r9
callq 0x5060d
cmpl $0x0, (%rbx)
jne 0x712da
movq %rbx, (%rsp)
movl $0x3, %r8d
movq %r14, %rdi
movl $0xd, %esi
movl $0xe, %edx
xorl %ecx, %ecx
movq %r12, %r9
callq 0x5060d
cmpl $0x0, (%rbx)
jne 0x712da
movl $0x2000c, %edx          # imm = 0x2000C
movq %r14, %rdi
movl $0xe, %esi
movl $0xf, %ecx
movl $0x1c, %r8d
movq %rbx, %r9
callq 0x505b2
cmpl $0x0, (%rbx)
je 0x712e9
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r14), %rdi
leaq 0x1(%rdi), %rax
movq %rax, (%r14)
callq 0x4eff7
movq %r14, %rdi
movq %r15, %rsi
movl $0x6, %edx
movq %rax, %rcx
movq %rbx, %r8
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x526e6
// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/backends/riscos_common/riscos_arm.c
// Function: subtilis_riscos_ext
void subtilis_riscos_ext(subtilis_ir_section_t *s, size_t start,
			 void *user_data, subtilis_error_t *err)
{
	subtilis_arm_reg_t dest;
	subtilis_arm_reg_t handle;
	subtilis_arm_reg_t one;
	subtilis_arm_section_t *arm_s = user_data;
	subtilis_ir_inst_t *bget = &s->ops[start]->op.instr;

	dest = subtilis_arm_ir_to_arm_reg(bget->operands[0].reg);
	handle = subtilis_arm_ir_to_arm_reg(bget->operands[1].reg);

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

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

	/* OS_Args 2 */
	/* read_mask = 0x3 = r0, r1 */
	/* write_mask = 0x4 = r2 */
	subtilis_arm_add_swi(arm_s, SUBTILIS_ARM_CCODE_AL, 0x20000 + 0x9, 0x3,
			     0x4, 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;

	subtilis_arm_add_mov_reg(arm_s, SUBTILIS_ARM_CCODE_VC, false, dest, 2,
				 err);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rcx, %r15
movq %rdx, %rbx
movq %rdi, %r12
movq 0x48(%rdi), %rax
movq (%rax,%rsi,8), %r13
movq 0x10(%r13), %rdi
callq 0x4eff7
movq %rax, %r14
movq 0x18(%r13), %rdi
callq 0x4eff7
movq %rax, %r13
movq %r15, 0x8(%rsp)
movl $0x2, (%rsp)
movq %rbx, %rdi
movl $0xd, %esi
movl $0xf, %edx
movl $0xe, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x50249
cmpl $0x0, (%r15)
jne 0x715dc
movq %r15, (%rsp)
movl $0x1, %r8d
movq %rbx, %rdi
movl $0xd, %esi
movl $0xe, %edx
xorl %ecx, %ecx
movq %r13, %r9
callq 0x5060d
cmpl $0x0, (%r15)
jne 0x715dc
movl $0x20009, %edx          # imm = 0x20009
movq %rbx, %rdi
movl $0xe, %esi
movl $0x3, %ecx
movl $0x4, %r8d
movq %r15, %r9
callq 0x505b2
cmpl $0x0, (%r15)
jne 0x715dc
movq (%rbx), %rdi
leaq 0x1(%rdi), %rax
movq %rax, (%rbx)
callq 0x4eff7
movq %rbx, %rdi
movq %r12, %rsi
movl $0x6, %edx
movq %rax, %rcx
movq %r15, %r8
callq 0x526e6
cmpl $0x0, (%r15)
jne 0x715dc
movq %r15, (%rsp)
movl $0x2, %r9d
movq %rbx, %rdi
movl $0xd, %esi
movl $0x7, %edx
xorl %ecx, %ecx
movq %r14, %r8
callq 0x5060d
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq