// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/backends/riscos_common/riscos_arm.c
// Function: subtilis_riscos_arm_gcol
void subtilis_riscos_arm_gcol(subtilis_ir_section_t *s, size_t start,
			      void *user_data, subtilis_error_t *err)
{
	subtilis_arm_reg_t dest;
	subtilis_arm_reg_t op2;
	subtilis_arm_section_t *arm_s = user_data;
	subtilis_ir_inst_t *gcol = &s->ops[start]->op.instr;
	const size_t vdu = 256 + 0x20000;

	/* read_mask = 0 */
	/* write_mask = 0 */
	subtilis_arm_add_swi(arm_s, SUBTILIS_ARM_CCODE_AL, vdu + 18, 0, 0, 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 = 0;
	op2 = subtilis_arm_ir_to_arm_reg(gcol->operands[0].reg);

	subtilis_arm_add_mov_reg(arm_s, SUBTILIS_ARM_CCODE_VC, false, dest, op2,
				 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);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	dest = 0;
	op2 = subtilis_arm_ir_to_arm_reg(gcol->operands[1].reg);

	subtilis_arm_add_mov_reg(arm_s, SUBTILIS_ARM_CCODE_VC, false, dest, op2,
				 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 %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
addq $0x8, %rax
movq %rax, -0x40(%rbp)
movq $0x20100, -0x48(%rbp)   # imm = 0x20100
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %r9
movl $0xe, %esi
movl $0x20112, %edx          # imm = 0x20112
xorl %r8d, %r8d
movl %r8d, %ecx
callq 0x71f20
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0xa4a1b
jmp 0xa4b56
movq -0x38(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0xa4260
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0xa4a3a
jmp 0xa4b56
movq $0x0, -0x28(%rbp)
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x6fe90
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %r8
movq -0x30(%rbp), %r9
movq -0x20(%rbp), %rax
movl $0xd, %esi
movl $0x7, %edx
xorl %ecx, %ecx
movq %rax, (%rsp)
callq 0x71fa0
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0xa4a86
jmp 0xa4b56
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %r9
movl $0x7, %esi
movl $0x20000, %edx          # imm = 0x20000
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0x71f20
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0xa4ab3
jmp 0xa4b56
movq -0x38(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0xa4260
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0xa4ad2
jmp 0xa4b56
movq $0x0, -0x28(%rbp)
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x6fe90
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %r8
movq -0x30(%rbp), %r9
movq -0x20(%rbp), %rax
movl $0xd, %esi
movl $0x7, %edx
xorl %ecx, %ecx
movq %rax, (%rsp)
callq 0x71fa0
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0xa4b1b
jmp 0xa4b56
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %r9
movl $0x7, %esi
movl $0x20000, %edx          # imm = 0x20000
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0x71f20
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0xa4b45
jmp 0xa4b56
movq -0x38(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0xa4260
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)