// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/jpeg/jidctflt.c
// Function: jpeg_idct_float
GLOBAL(void)
jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
		 JCOEFPTR coef_block,
		 JSAMPARRAY output_buf, JDIMENSION output_col)
{
  FAST_FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
  FAST_FLOAT tmp10, tmp11, tmp12, tmp13;
  FAST_FLOAT z5, z10, z11, z12, z13;
  JCOEFPTR inptr;
  FLOAT_MULT_TYPE * quantptr;
  FAST_FLOAT * wsptr;
  JSAMPROW outptr;
  JSAMPLE *range_limit = IDCT_range_limit(cinfo);
  int ctr;
  FAST_FLOAT workspace[DCTSIZE2]; /* buffers data between passes */
  SHIFT_TEMPS

  /* Pass 1: process columns from input, store into work array. */

  inptr = coef_block;
  quantptr = (FLOAT_MULT_TYPE *) compptr->dct_table;
  wsptr = workspace;
  for (ctr = DCTSIZE; ctr > 0; ctr--) {
    /* Due to quantization, we will usually find that many of the input
     * coefficients are zero, especially the AC terms.  We can exploit this
     * by short-circuiting the IDCT calculation for any column in which all
     * the AC terms are zero.  In that case each output is equal to the
     * DC coefficient (with scale factor as needed).
     * With typical images and quantization tables, half or more of the
     * column DCT calculations can be simplified this way.
     */
    
    if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 &&
	inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 &&
	inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 &&
	inptr[DCTSIZE*7] == 0) {
      /* AC terms all zero */
      FAST_FLOAT dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
      
      wsptr[DCTSIZE*0] = dcval;
      wsptr[DCTSIZE*1] = dcval;
      wsptr[DCTSIZE*2] = dcval;
      wsptr[DCTSIZE*3] = dcval;
      wsptr[DCTSIZE*4] = dcval;
      wsptr[DCTSIZE*5] = dcval;
      wsptr[DCTSIZE*6] = dcval;
      wsptr[DCTSIZE*7] = dcval;
      
      inptr++;			/* advance pointers to next column */
      quantptr++;
      wsptr++;
      continue;
    }
    
    /* Even part */

    tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
    tmp1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
    tmp2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
    tmp3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);

    tmp10 = tmp0 + tmp2;	/* phase 3 */
    tmp11 = tmp0 - tmp2;

    tmp13 = tmp1 + tmp3;	/* phases 5-3 */
    tmp12 = (tmp1 - tmp3) * ((FAST_FLOAT) 1.414213562) - tmp13; /* 2*c4 */

    tmp0 = tmp10 + tmp13;	/* phase 2 */
    tmp3 = tmp10 - tmp13;
    tmp1 = tmp11 + tmp12;
    tmp2 = tmp11 - tmp12;
    
    /* Odd part */

    tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
    tmp5 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
    tmp6 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
    tmp7 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);

    z13 = tmp6 + tmp5;		/* phase 6 */
    z10 = tmp6 - tmp5;
    z11 = tmp4 + tmp7;
    z12 = tmp4 - tmp7;

    tmp7 = z11 + z13;		/* phase 5 */
    tmp11 = (z11 - z13) * ((FAST_FLOAT) 1.414213562); /* 2*c4 */

    z5 = (z10 + z12) * ((FAST_FLOAT) 1.847759065); /* 2*c2 */
    tmp10 = ((FAST_FLOAT) 1.082392200) * z12 - z5; /* 2*(c2-c6) */
    tmp12 = ((FAST_FLOAT) -2.613125930) * z10 + z5; /* -2*(c2+c6) */

    tmp6 = tmp12 - tmp7;	/* phase 2 */
    tmp5 = tmp11 - tmp6;
    tmp4 = tmp10 + tmp5;

    wsptr[DCTSIZE*0] = tmp0 + tmp7;
    wsptr[DCTSIZE*7] = tmp0 - tmp7;
    wsptr[DCTSIZE*1] = tmp1 + tmp6;
    wsptr[DCTSIZE*6] = tmp1 - tmp6;
    wsptr[DCTSIZE*2] = tmp2 + tmp5;
    wsptr[DCTSIZE*5] = tmp2 - tmp5;
    wsptr[DCTSIZE*4] = tmp3 + tmp4;
    wsptr[DCTSIZE*3] = tmp3 - tmp4;

    inptr++;			/* advance pointers to next column */
    quantptr++;
    wsptr++;
  }
  
  /* Pass 2: process rows from work array, store into output array. */
  /* Note that we must descale the results by a factor of 8 == 2**3. */

  wsptr = workspace;
  for (ctr = 0; ctr < DCTSIZE; ctr++) {
    outptr = output_buf[ctr] + output_col;
    /* Rows of zeroes can be exploited in the same way as we did with columns.
     * However, the column calculation has created many nonzero AC terms, so
     * the simplification applies less often (typically 5% to 10% of the time).
     * And testing floats for zero is relatively expensive, so we don't bother.
     */
    
    /* Even part */

    tmp10 = wsptr[0] + wsptr[4];
    tmp11 = wsptr[0] - wsptr[4];

    tmp13 = wsptr[2] + wsptr[6];
    tmp12 = (wsptr[2] - wsptr[6]) * ((FAST_FLOAT) 1.414213562) - tmp13;

    tmp0 = tmp10 + tmp13;
    tmp3 = tmp10 - tmp13;
    tmp1 = tmp11 + tmp12;
    tmp2 = tmp11 - tmp12;

    /* Odd part */

    z13 = wsptr[5] + wsptr[3];
    z10 = wsptr[5] - wsptr[3];
    z11 = wsptr[1] + wsptr[7];
    z12 = wsptr[1] - wsptr[7];

    tmp7 = z11 + z13;
    tmp11 = (z11 - z13) * ((FAST_FLOAT) 1.414213562);

    z5 = (z10 + z12) * ((FAST_FLOAT) 1.847759065); /* 2*c2 */
    tmp10 = ((FAST_FLOAT) 1.082392200) * z12 - z5; /* 2*(c2-c6) */
    tmp12 = ((FAST_FLOAT) -2.613125930) * z10 + z5; /* -2*(c2+c6) */

    tmp6 = tmp12 - tmp7;
    tmp5 = tmp11 - tmp6;
    tmp4 = tmp10 + tmp5;

    /* Final output stage: scale down by a factor of 8 and range-limit */

    outptr[0] = range_limit[(int) DESCALE((INT32) (tmp0 + tmp7), 3)
			    & RANGE_MASK];
    outptr[7] = range_limit[(int) DESCALE((INT32) (tmp0 - tmp7), 3)
			    & RANGE_MASK];
    outptr[1] = range_limit[(int) DESCALE((INT32) (tmp1 + tmp6), 3)
			    & RANGE_MASK];
    outptr[6] = range_limit[(int) DESCALE((INT32) (tmp1 - tmp6), 3)
			    & RANGE_MASK];
    outptr[2] = range_limit[(int) DESCALE((INT32) (tmp2 + tmp5), 3)
			    & RANGE_MASK];
    outptr[5] = range_limit[(int) DESCALE((INT32) (tmp2 - tmp5), 3)
			    & RANGE_MASK];
    outptr[4] = range_limit[(int) DESCALE((INT32) (tmp3 + tmp4), 3)
			    & RANGE_MASK];
    outptr[3] = range_limit[(int) DESCALE((INT32) (tmp3 - tmp4), 3)
			    & RANGE_MASK];
    
    wsptr += DCTSIZE;		/* advance pointer to next row */
  }
}

// Assembly:
pushq %rbx
subq $0x80, %rsp
movq 0x1a8(%rdi), %rax
movq 0x58(%rsi), %rsi
movl $0x9, %edi
xorl %r9d, %r9d
movss 0x292b1(%rip), %xmm0    # 0xaab40
movss 0x292ad(%rip), %xmm1    # 0xaab44
movss 0x292a9(%rip), %xmm2    # 0xaab48
movss 0x292a5(%rip), %xmm3    # 0xaab4c
movzwl 0x10(%rdx,%r9), %r10d
movzwl 0x20(%rdx,%r9), %r11d
movl %r11d, %ebx
orw %r10w, %bx
jne 0x818f0
cmpw $0x0, 0x30(%rdx,%r9)
jne 0x818ed
cmpw $0x0, 0x40(%rdx,%r9)
jne 0x818ed
cmpw $0x0, 0x50(%rdx,%r9)
jne 0x818ed
cmpw $0x0, 0x60(%rdx,%r9)
jne 0x818ed
cmpw $0x0, 0x70(%rdx,%r9)
je 0x81af7
xorl %r11d, %r11d
pxor %xmm4, %xmm4
pinsrw $0x1, (%rdx,%r9), %xmm4
pinsrw $0x3, %r11d, %xmm4
psrad $0x10, %xmm4
cvtdq2ps %xmm4, %xmm4
movss (%rsi,%r9,2), %xmm7
movss 0x20(%rsi,%r9,2), %xmm5
movss 0x40(%rsi,%r9,2), %xmm6
unpcklps %xmm6, %xmm7            # xmm7 = xmm7[0],xmm6[0],xmm7[1],xmm6[1]
mulps %xmm4, %xmm7
xorps %xmm4, %xmm4
pinsrw $0x1, 0x40(%rdx,%r9), %xmm4
movd 0x60(%rsi,%r9,2), %xmm9
pinsrw $0x3, 0x60(%rdx,%r9), %xmm4
psrad $0x10, %xmm4
cvtdq2ps %xmm4, %xmm6
movss 0xc0(%rsi,%r9,2), %xmm8
movss 0x80(%rsi,%r9,2), %xmm4
unpcklps %xmm8, %xmm4            # xmm4 = xmm4[0],xmm8[0],xmm4[1],xmm8[1]
mulps %xmm6, %xmm4
movaps %xmm7, %xmm6
subps %xmm4, %xmm6
addps %xmm7, %xmm4
movaps %xmm6, %xmm10
shufps $0x55, %xmm6, %xmm10    # xmm10 = xmm10[1,1],xmm6[1,1]
movaps %xmm4, %xmm7
shufps $0x55, %xmm4, %xmm7     # xmm7 = xmm7[1,1],xmm4[1,1]
mulss %xmm0, %xmm10
subss %xmm7, %xmm10
movaps %xmm4, %xmm8
addss %xmm7, %xmm8
subss %xmm7, %xmm4
movaps %xmm6, %xmm7
addss %xmm10, %xmm7
pxor %xmm11, %xmm11
pinsrw $0x1, 0x30(%rdx,%r9), %xmm11
pinsrw $0x3, 0x50(%rdx,%r9), %xmm11
subss %xmm10, %xmm6
psrad $0x10, %xmm11
cvtdq2ps %xmm11, %xmm10
movd 0xa0(%rsi,%r9,2), %xmm11
punpckldq %xmm11, %xmm9   # xmm9 = xmm9[0],xmm11[0],xmm9[1],xmm11[1]
pxor %xmm11, %xmm11
pinsrw $0x1, %r10d, %xmm11
mulps %xmm10, %xmm9
pinsrw $0x3, 0x70(%rdx,%r9), %xmm11
psrad $0x10, %xmm11
cvtdq2ps %xmm11, %xmm10
movss 0xe0(%rsi,%r9,2), %xmm11
unpcklps %xmm11, %xmm5           # xmm5 = xmm5[0],xmm11[0],xmm5[1],xmm11[1]
mulps %xmm10, %xmm5
movaps %xmm9, %xmm10
shufps $0x55, %xmm9, %xmm10    # xmm10 = xmm10[1,1],xmm9[1,1]
movaps %xmm9, %xmm11
addss %xmm10, %xmm11
subss %xmm9, %xmm10
movaps %xmm5, %xmm12
shufps $0x55, %xmm5, %xmm12    # xmm12 = xmm12[1,1],xmm5[1,1]
movaps %xmm5, %xmm9
addss %xmm12, %xmm9
subss %xmm12, %xmm5
movaps %xmm11, %xmm12
addss %xmm9, %xmm12
subss %xmm11, %xmm9
mulss %xmm0, %xmm9
movaps %xmm10, %xmm11
addss %xmm5, %xmm11
mulss %xmm1, %xmm11
mulss %xmm2, %xmm5
subss %xmm11, %xmm5
mulss %xmm3, %xmm10
addss %xmm11, %xmm10
subss %xmm12, %xmm10
subss %xmm10, %xmm9
addss %xmm9, %xmm5
movaps %xmm8, %xmm11
addss %xmm12, %xmm11
movss %xmm11, -0x80(%rsp,%r9,2)
subss %xmm12, %xmm8
movss %xmm8, 0x60(%rsp,%r9,2)
movaps %xmm7, %xmm8
addss %xmm10, %xmm8
movss %xmm8, -0x60(%rsp,%r9,2)
subss %xmm10, %xmm7
movss %xmm7, 0x40(%rsp,%r9,2)
movaps %xmm6, %xmm7
addss %xmm9, %xmm7
movss %xmm7, -0x40(%rsp,%r9,2)
subss %xmm9, %xmm6
movss %xmm6, 0x20(%rsp,%r9,2)
movaps %xmm4, %xmm6
addss %xmm5, %xmm6
movss %xmm6, (%rsp,%r9,2)
subss %xmm5, %xmm4
movl $0x60, %r10d
addq %rsp, %r10
addq $-0x80, %r10
movss %xmm4, (%r10,%r9,2)
decl %edi
addq $0x2, %r9
cmpl $0x1, %edi
ja 0x818a7
jmp 0x81b42
movswl (%rdx,%r9), %r10d
xorps %xmm4, %xmm4
cvtsi2ss %r10d, %xmm4
mulss (%rsi,%r9,2), %xmm4
movss %xmm4, -0x80(%rsp,%r9,2)
movss %xmm4, -0x60(%rsp,%r9,2)
movss %xmm4, -0x40(%rsp,%r9,2)
movss %xmm4, -0x20(%rsp,%r9,2)
movss %xmm4, (%rsp,%r9,2)
movss %xmm4, 0x20(%rsp,%r9,2)
movss %xmm4, 0x40(%rsp,%r9,2)
movl $0xe0, %r10d
jmp 0x81ad9
movl %r8d, %edx
xorl %esi, %esi
movl $0x3ff, %edi            # imm = 0x3FF
movq (%rcx,%rsi), %r8
movss -0x70(%rsp,%rsi,4), %xmm7
movss -0x80(%rsp,%rsi,4), %xmm6
movss -0x7c(%rsp,%rsi,4), %xmm5
movaps %xmm6, %xmm4
subss %xmm7, %xmm6
movss -0x78(%rsp,%rsi,4), %xmm11
movss -0x68(%rsp,%rsi,4), %xmm8
addss %xmm7, %xmm4
movaps %xmm11, %xmm13
addss %xmm8, %xmm13
subss %xmm8, %xmm11
mulss %xmm0, %xmm11
movaps %xmm6, %xmm8
movss -0x6c(%rsp,%rsi,4), %xmm9
movss -0x74(%rsp,%rsi,4), %xmm7
movaps %xmm4, %xmm10
movaps %xmm9, %xmm14
addss %xmm7, %xmm14
subss %xmm7, %xmm9
subss %xmm13, %xmm4
movss -0x64(%rsp,%rsi,4), %xmm12
movaps %xmm5, %xmm7
addss %xmm12, %xmm7
addss %xmm13, %xmm10
subss %xmm12, %xmm5
movaps %xmm14, %xmm12
addss %xmm7, %xmm12
subss %xmm13, %xmm11
subss %xmm14, %xmm7
mulss %xmm0, %xmm7
movaps %xmm9, %xmm13
addss %xmm11, %xmm8
addss %xmm5, %xmm13
mulss %xmm1, %xmm13
mulss %xmm2, %xmm5
subss %xmm11, %xmm6
subss %xmm13, %xmm5
mulss %xmm3, %xmm9
movaps %xmm10, %xmm11
addss %xmm13, %xmm9
addss %xmm12, %xmm11
cvttss2si %xmm11, %r9
subss %xmm12, %xmm9
subss %xmm9, %xmm7
addl $0x4, %r9d
shrl $0x3, %r9d
andl %edi, %r9d
subss %xmm12, %xmm10
cvttss2si %xmm10, %r10
addss %xmm7, %xmm5
movb 0x80(%rax,%r9), %r9b
addl $0x4, %r10d
shrl $0x3, %r10d
movb %r9b, (%r8,%rdx)
andl %edi, %r10d
movaps %xmm8, %xmm10
addss %xmm9, %xmm10
movb 0x80(%rax,%r10), %r9b
cvttss2si %xmm10, %r10
addl $0x4, %r10d
movb %r9b, 0x7(%r8,%rdx)
shrl $0x3, %r10d
andl %edi, %r10d
subss %xmm9, %xmm8
movb 0x80(%rax,%r10), %r9b
cvttss2si %xmm8, %r10
addl $0x4, %r10d
movb %r9b, 0x1(%r8,%rdx)
shrl $0x3, %r10d
andl %edi, %r10d
movaps %xmm6, %xmm8
movb 0x80(%rax,%r10), %r9b
addss %xmm7, %xmm8
cvttss2si %xmm8, %r10
addl $0x4, %r10d
shrl $0x3, %r10d
andl %edi, %r10d
subss %xmm7, %xmm6
movb %r9b, 0x6(%r8,%rdx)
cvttss2si %xmm6, %r9
addl $0x4, %r9d
movb 0x80(%rax,%r10), %r10b
shrl $0x3, %r9d
andl %edi, %r9d
movaps %xmm4, %xmm6
movb %r10b, 0x2(%r8,%rdx)
addss %xmm5, %xmm6
cvttss2si %xmm6, %r10
movb 0x80(%rax,%r9), %r9b
addl $0x4, %r10d
shrl $0x3, %r10d
andl %edi, %r10d
movb %r9b, 0x5(%r8,%rdx)
subss %xmm5, %xmm4
cvttss2si %xmm4, %r9
movb 0x80(%rax,%r10), %r10b
addl $0x4, %r9d
shrl $0x3, %r9d
andl %edi, %r9d
movb %r10b, 0x4(%r8,%rdx)
movb 0x80(%rax,%r9), %r9b
movb %r9b, 0x3(%r8,%rdx)
addq $0x8, %rsi
cmpq $0x40, %rsi
jne 0x81b4c
addq $0x80, %rsp
popq %rbx
retq
nopl (%rax)