// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/backends/riscos/riscos_arm2.c
// Function: subtilis_riscos_arm_gcol_tint
void subtilis_riscos_arm_gcol_tint(subtilis_ir_section_t *s, size_t start,
				   void *user_data, subtilis_error_t *err)
{
	size_t col;
	size_t tint;
	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;

	col = subtilis_arm_ir_to_arm_reg(gcol->operands[1].reg);
	tint = subtilis_arm_ir_to_arm_reg(gcol->operands[2].reg);

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

	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;

	dest = 0;

	subtilis_arm_add_mov_reg(arm_s, SUBTILIS_ARM_CCODE_VC, false, dest, 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;

	prv_do_tint(arm_s, col, tint, 2, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_riscos_handle_graphics_error(arm_s, s, err);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
addq $0x8, %rax
movq %rax, -0x50(%rbp)
movq $0x20100, -0x58(%rbp)   # imm = 0x20100
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x6fe90
movq %rax, -0x28(%rbp)
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x6fe90
movq %rax, -0x30(%rbp)
movq -0x48(%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 0xa2fed
jmp 0xa30fe
movq $0x0, -0x38(%rbp)
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x6fe90
movq %rax, -0x40(%rbp)
movq -0x48(%rbp), %rdi
movq -0x38(%rbp), %r8
movq -0x40(%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 0xa3039
jmp 0xa30fe
movq -0x48(%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 0xa3066
jmp 0xa30fe
movq $0x0, -0x38(%rbp)
movq -0x48(%rbp), %rdi
movq -0x38(%rbp), %r8
movq -0x28(%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 0xa309e
jmp 0xa30fe
movq -0x48(%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 0xa30c8
jmp 0xa30fe
movq -0x48(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x20(%rbp), %r8
movl $0x2, %ecx
callq 0xa35e0
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0xa30ed
jmp 0xa30fe
movq -0x48(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0xa4260
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)