// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/backends/riscos/riscos_arm2.c
// Function: prv_do_tint
static void prv_do_tint(subtilis_arm_section_t *arm_s, subtilis_arm_reg_t col,
			subtilis_arm_reg_t tint, uint32_t add,
			subtilis_error_t *err)
{
	size_t i;
	subtilis_arm_instr_t *instr;
	subtilis_arm_data_instr_t *datai;

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

	datai = &instr->operands.data;
	datai->status = false;
	datai->ccode = SUBTILIS_ARM_CCODE_VC;
	datai->dest = 0;
	datai->op2.type = SUBTILIS_ARM_OP2_SHIFTED;
	datai->op2.op.shift.reg = col;
	datai->op2.op.shift.shift_reg = false;
	datai->op2.op.shift.shift.integer = 7;
	datai->op2.op.shift.type = SUBTILIS_ARM_SHIFT_LSR;

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

	if (add != 0) {
		subtilis_arm_add_data_imm(arm_s, SUBTILIS_ARM_INSTR_ADD,
					  SUBTILIS_ARM_CCODE_VC, false, 0, 0,
					  add, 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 + 23 + 0x20000,
			     0, 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 + 17 + 0x20000,
			     0, 0, 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_arm_add_mov_reg(arm_s, SUBTILIS_ARM_CCODE_VC, false, 0, tint,
				 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;

	for (i = 0; i < 6; i++) {
		subtilis_arm_add_swi(arm_s, SUBTILIS_ARM_CCODE_VC,
				     256 + 0x20000, 0, 0, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
movl $0xd, %esi
callq 0x70b50
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0xa361f
jmp 0xa381e
movq -0x38(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movb $0x0, 0x4(%rax)
movq -0x40(%rbp), %rax
movl $0x7, (%rax)
movq -0x40(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x40(%rbp), %rax
movl $0x2, 0x18(%rax)
movq -0x10(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x40(%rbp), %rax
movb $0x0, 0x38(%rax)
movq -0x40(%rbp), %rax
movl $0x7, 0x30(%rax)
movq -0x40(%rbp), %rax
movl $0x2, 0x28(%rax)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
xorl %ecx, %ecx
movl $0x7, %edx
xorl %esi, %esi
movl %esi, %r9d
movl %ecx, %esi
movq %r9, %r8
movl $0x1, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x71cd0
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0xa36b6
jmp 0xa381e
cmpl $0x0, -0x1c(%rbp)
je 0xa36fb
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %r10d
movq -0x28(%rbp), %rax
movl $0x4, %esi
movl $0x7, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
movl %r8d, %r9d
movq %r9, %r8
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x71cd0
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0xa36f9
jmp 0xa381e
jmp 0xa36fb
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %r9
movl $0x7, %esi
movl $0x20117, %edx          # imm = 0x20117
xorl %r8d, %r8d
movl %r8d, %ecx
callq 0x71f20
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0xa3726
jmp 0xa381e
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %r9
movl $0x7, %esi
movl $0x20111, %edx          # imm = 0x20111
xorl %r8d, %r8d
movl %r8d, %ecx
callq 0x71f20
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0xa3751
jmp 0xa381e
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %r9
movl $0x7, %esi
movl $0x20000, %edx          # imm = 0x20000
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0x71f20
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0xa377e
jmp 0xa381e
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %r9
movq -0x28(%rbp), %rax
movl $0xd, %esi
movl $0x7, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %rax, (%rsp)
callq 0x71fa0
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0xa37ad
jmp 0xa381e
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %r9
movl $0x7, %esi
movl $0x20000, %edx          # imm = 0x20000
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0x71f20
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0xa37d7
jmp 0xa381e
movq $0x0, -0x30(%rbp)
cmpq $0x6, -0x30(%rbp)
jae 0xa381e
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %r9
movl $0x7, %esi
movl $0x20100, %edx          # imm = 0x20100
xorl %r8d, %r8d
movl %r8d, %ecx
callq 0x71f20
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0xa380e
jmp 0xa381e
jmp 0xa3810
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xa37df
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop