// File: /workspace/github_c_makefile_star2_O0/albinoloverats[P]hide/src/jpeg-load.c
// Function: YCrCB_to_RGB24_Block8x8
static void YCrCB_to_RGB24_Block8x8(stJpegData *jdata, int w, int h, int imgx, int imgy, int imgw, int imgh)
{
	const uint8_t *Y  = jdata->m_Y;
	const uint8_t *Cb = jdata->m_Cb;
	const uint8_t *Cr = jdata->m_Cr;

	for (int y = 0; y < (8 * h); y++)
		for (int x = 0; x < (8 * w); x++)
		{
			if ((x + imgx >= imgw) || (y + imgy >= imgh))
				continue;

			int poff = x * 3 + jdata->m_width * 3 * y;
			uint8_t *pix = &(jdata->m_colourspace[poff]);

			int yoff = x + y * (w << 3);
			int coff = (int)(x * (1.0 / w)) + ((int)(y * (1.0 / h)) << 3);

			int r, g, b;
			ConvertYCrCbtoRGB(Y[yoff], Cr[coff], Cb[coff], &r, &g, &b);

			pix[0] = byte_limit(r, 0);
			pix[1] = byte_limit(g, 0);
			pix[2] = byte_limit(b, 0);
		}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movl %r8d, -0x18(%rbp)
movl %r9d, -0x1c(%rbp)
movq -0x8(%rbp), %rax
addq $0x19380, %rax          # imm = 0x19380
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
addq $0x194c0, %rax          # imm = 0x194C0
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
addq $0x19480, %rax          # imm = 0x19480
movq %rax, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movl -0x10(%rbp), %ecx
shll $0x3, %ecx
cmpl %ecx, %eax
jge 0x2c05
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
movl -0xc(%rbp), %ecx
shll $0x3, %ecx
cmpl %ecx, %eax
jge 0x2bf5
movl -0x40(%rbp), %eax
addl -0x14(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x2a83
movl -0x3c(%rbp), %eax
addl -0x18(%rbp), %eax
cmpl 0x10(%rbp), %eax
jl 0x2a88
jmp 0x2be7
imull $0x3, -0x40(%rbp), %eax
movq -0x8(%rbp), %rcx
imull $0x3, 0x8(%rcx), %ecx
imull -0x3c(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x44(%rbp)
movq -0x8(%rbp), %rax
movq 0x19500(%rax), %rax
movslq -0x44(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movl -0x40(%rbp), %eax
movl -0x3c(%rbp), %ecx
movl -0xc(%rbp), %edx
shll $0x3, %edx
imull %edx, %ecx
addl %ecx, %eax
movl %eax, -0x54(%rbp)
cvtsi2sdl -0x40(%rbp), %xmm0
cvtsi2sdl -0xc(%rbp), %xmm2
movsd 0x45df(%rip), %xmm1     # 0x70b8
divsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
cvtsi2sdl -0x3c(%rbp), %xmm0
cvtsi2sdl -0x10(%rbp), %xmm2
movsd 0x45c1(%rip), %xmm1     # 0x70b8
divsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
shll $0x3, %ecx
addl %ecx, %eax
movl %eax, -0x58(%rbp)
movq -0x28(%rbp), %rax
movslq -0x54(%rbp), %rcx
movzbl (%rax,%rcx), %edi
movq -0x38(%rbp), %rax
movslq -0x58(%rbp), %rcx
movzbl (%rax,%rcx), %esi
movq -0x30(%rbp), %rax
movslq -0x58(%rbp), %rcx
movzbl (%rax,%rcx), %edx
leaq -0x5c(%rbp), %rcx
leaq -0x60(%rbp), %r8
leaq -0x64(%rbp), %r9
callq 0x3cd0
cmpl $0x0, -0x5c(%rbp)
jge 0x2b4d
xorl %eax, %eax
movl %eax, -0x68(%rbp)
jmp 0x2b6c
cmpl $0xff, -0x5c(%rbp)
jle 0x2b60
movl $0xff, %eax
movl %eax, -0x6c(%rbp)
jmp 0x2b66
movl -0x5c(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movl %eax, -0x68(%rbp)
movl -0x68(%rbp), %eax
movb %al, %cl
movq -0x50(%rbp), %rax
movb %cl, (%rax)
cmpl $0x0, -0x60(%rbp)
jge 0x2b84
xorl %eax, %eax
movl %eax, -0x70(%rbp)
jmp 0x2ba3
cmpl $0xff, -0x60(%rbp)
jle 0x2b97
movl $0xff, %eax
movl %eax, -0x74(%rbp)
jmp 0x2b9d
movl -0x60(%rbp), %eax
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %eax
movl %eax, -0x70(%rbp)
movl -0x70(%rbp), %eax
movb %al, %cl
movq -0x50(%rbp), %rax
movb %cl, 0x1(%rax)
cmpl $0x0, -0x64(%rbp)
jge 0x2bbc
xorl %eax, %eax
movl %eax, -0x78(%rbp)
jmp 0x2bdb
cmpl $0xff, -0x64(%rbp)
jle 0x2bcf
movl $0xff, %eax
movl %eax, -0x7c(%rbp)
jmp 0x2bd5
movl -0x64(%rbp), %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movl %eax, -0x78(%rbp)
movl -0x78(%rbp), %eax
movb %al, %cl
movq -0x50(%rbp), %rax
movb %cl, 0x2(%rax)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x2a5c
jmp 0x2bf7
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x2a44
addq $0x80, %rsp
popq %rbp
retq
nop