// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/jpeg/jdcolor.c
// Function: ycck_cmyk_convert
METHODDEF(void)
ycck_cmyk_convert (j_decompress_ptr cinfo,
		   JSAMPIMAGE input_buf, JDIMENSION input_row,
		   JSAMPARRAY output_buf, int num_rows)
{
  my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
  register int y, cb, cr;
  register JSAMPROW outptr;
  register JSAMPROW inptr0, inptr1, inptr2, inptr3;
  register JDIMENSION col;
  JDIMENSION num_cols = cinfo->output_width;
  /* copy these pointers into registers if possible */
  register JSAMPLE * range_limit = cinfo->sample_range_limit;
  register int * Crrtab = cconvert->Cr_r_tab;
  register int * Cbbtab = cconvert->Cb_b_tab;
  register INT32 * Crgtab = cconvert->Cr_g_tab;
  register INT32 * Cbgtab = cconvert->Cb_g_tab;
  SHIFT_TEMPS

  while (--num_rows >= 0) {
    inptr0 = input_buf[0][input_row];
    inptr1 = input_buf[1][input_row];
    inptr2 = input_buf[2][input_row];
    inptr3 = input_buf[3][input_row];
    input_row++;
    outptr = *output_buf++;
    for (col = 0; col < num_cols; col++) {
      y  = GETJSAMPLE(inptr0[col]);
      cb = GETJSAMPLE(inptr1[col]);
      cr = GETJSAMPLE(inptr2[col]);
      /* Range-limiting is essential due to noise introduced by DCT losses. */
      outptr[0] = range_limit[MAXJSAMPLE - (y + Crrtab[cr])];	/* red */
      outptr[1] = range_limit[MAXJSAMPLE - (y +			/* green */
			      ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
						 SCALEBITS)))];
      outptr[2] = range_limit[MAXJSAMPLE - (y + Cbbtab[cb])];	/* blue */
      /* K passes through unchanged */
      outptr[3] = inptr3[col];	/* don't need GETJSAMPLE here */
      outptr += 4;
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, -0x38(%rsp)
movl %edx, -0x3c(%rsp)
movq %rsi, -0x30(%rsp)
testl %r8d, %r8d
jle 0x84369
movq 0x268(%rdi), %r9
movl 0x88(%rdi), %ebx
movq 0x1a8(%rdi), %rdi
movq 0x10(%r9), %rcx
movq %rcx, -0x10(%rsp)
movq 0x18(%r9), %r11
movq 0x20(%r9), %rax
movq %rax, -0x20(%rsp)
movq 0x28(%r9), %rax
movq %rax, -0x28(%rsp)
movq %r8, -0x18(%rsp)
testq %rbx, %rbx
movq -0x20(%rsp), %rax
movq -0x28(%rsp), %r10
je 0x8434a
movl -0x3c(%rsp), %r9d
movq -0x30(%rsp), %rcx
movq (%rcx), %r14
movq 0x8(%rcx), %r15
movq (%r14,%r9,8), %r8
movq %r8, -0x8(%rsp)
movq (%r15,%r9,8), %r15
movq 0x10(%rcx), %r12
movq (%r12,%r9,8), %r12
movq 0x18(%rcx), %r13
movq (%r13,%r9,8), %r13
movq -0x38(%rsp), %rcx
movq (%rcx), %rbp
xorl %r9d, %r9d
movq -0x8(%rsp), %rcx
movzbl (%rcx,%r9), %edx
movzbl (%r15,%r9), %r8d
movzbl (%r12,%r9), %ecx
xorl $0xff, %edx
movl %edx, %esi
movq %r10, %r14
movq %rax, %r10
movq -0x10(%rsp), %rax
subl (%rax,%rcx,4), %esi
movq %r10, %rax
movq %r14, %r10
movslq %esi, %rsi
movb (%rdi,%rsi), %sil
movb %sil, (%rbp,%r9,4)
movq (%rax,%rcx,8), %rcx
addq (%r14,%r8,8), %rcx
shrq $0x10, %rcx
movl %edx, %esi
subl %ecx, %esi
movslq %esi, %rcx
movb (%rdi,%rcx), %cl
movb %cl, 0x1(%rbp,%r9,4)
subl (%r11,%r8,4), %edx
movslq %edx, %rcx
movb (%rdi,%rcx), %cl
movb %cl, 0x2(%rbp,%r9,4)
movb (%r13,%r9), %cl
movb %cl, 0x3(%rbp,%r9,4)
incq %r9
cmpq %r9, %rbx
jne 0x842d2
movq -0x18(%rsp), %rcx
leal -0x1(%rcx), %r9d
incl -0x3c(%rsp)
addq $0x8, -0x38(%rsp)
cmpl $0x2, %ecx
movl %r9d, %r8d
jge 0x84280
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq