// File: /workspace/github_c_makefile_star2_O3/patriciogonzalezvivo[P]tprint/include/std/stb_image.h
// Function: stbi__idct_block(unsigned char*, int, short*)
static void stbi__idct_block(stbi_uc *out, int out_stride, short data[64])
{
   int i,val[64],*v=val;
   stbi_uc *o;
   short *d = data;

   // columns
   for (i=0; i < 8; ++i,++d, ++v) {
      // if all zeroes, shortcut -- this avoids dequantizing 0s and IDCTing
      if (d[ 8]==0 && d[16]==0 && d[24]==0 && d[32]==0
           && d[40]==0 && d[48]==0 && d[56]==0) {
         //    no shortcut                 0     seconds
         //    (1|2|3|4|5|6|7)==0          0     seconds
         //    all separate               -0.047 seconds
         //    1 && 2|3 && 4|5 && 6|7:    -0.047 seconds
         int dcterm = d[0] << 2;
         v[0] = v[8] = v[16] = v[24] = v[32] = v[40] = v[48] = v[56] = dcterm;
      } else {
         STBI__IDCT_1D(d[ 0],d[ 8],d[16],d[24],d[32],d[40],d[48],d[56])
         // constants scaled things up by 1<<12; let's bring them back
         // down, but keep 2 extra bits of precision
         x0 += 512; x1 += 512; x2 += 512; x3 += 512;
         v[ 0] = (x0+t3) >> 10;
         v[56] = (x0-t3) >> 10;
         v[ 8] = (x1+t2) >> 10;
         v[48] = (x1-t2) >> 10;
         v[16] = (x2+t1) >> 10;
         v[40] = (x2-t1) >> 10;
         v[24] = (x3+t0) >> 10;
         v[32] = (x3-t0) >> 10;
      }
   }

   for (i=0, v=val, o=out; i < 8; ++i,v+=8,o+=out_stride) {
      // no fast case since the first 1D IDCT spread components out
      STBI__IDCT_1D(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7])
      // constants scaled things up by 1<<12, plus we had 1<<2 from first
      // loop, plus horizontal and vertical each scale by sqrt(8) so together
      // we've got an extra 1<<3, so 1<<17 total we need to remove.
      // so we want to round that, which means adding 0.5 * 1<<17,
      // aka 65536. Also, we'll end up with -128 to 127 that we want
      // to encode as 0..255 by adding 128, so we'll add that before the shift
      x0 += 65536 + (128<<17);
      x1 += 65536 + (128<<17);
      x2 += 65536 + (128<<17);
      x3 += 65536 + (128<<17);
      // tried computing the shifts into temps, or'ing the temps to see
      // if any were out of range, but that was slower
      o[0] = stbi__clamp((x0+t3) >> 17);
      o[7] = stbi__clamp((x0-t3) >> 17);
      o[1] = stbi__clamp((x1+t2) >> 17);
      o[6] = stbi__clamp((x1-t2) >> 17);
      o[2] = stbi__clamp((x2+t1) >> 17);
      o[5] = stbi__clamp((x2-t1) >> 17);
      o[3] = stbi__clamp((x3+t0) >> 17);
      o[4] = stbi__clamp((x3-t0) >> 17);
   }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movl %esi, -0x6c(%rsp)
movq %rdi, -0x80(%rsp)
movl $0x38, %eax
movq %rdx, -0x68(%rsp)
movswl -0x60(%rdx,%rax,2), %esi
movzwl -0x50(%rdx,%rax,2), %ecx
movl %ecx, %r8d
orw %si, %r8w
jne 0x19008
cmpw $0x0, -0x40(%rdx,%rax,2)
jne 0x19006
cmpw $0x0, -0x30(%rdx,%rax,2)
jne 0x19006
cmpw $0x0, -0x20(%rdx,%rax,2)
jne 0x19006
cmpw $0x0, -0x10(%rdx,%rax,2)
jne 0x19006
cmpw $0x0, (%rdx,%rax,2)
je 0x1917c
xorl %ecx, %ecx
movswl %cx, %ecx
movswl -0x10(%rdx,%rax,2), %r8d
leal (%r8,%rcx), %r10d
imull $0x8a9, %r10d, %r10d    # imm = 0x8A9
imull $0xffffe271, %r8d, %edi # imm = 0xFFFFE271
addl %r10d, %edi
movl %edi, -0x78(%rsp)
imull $0xc3f, %ecx, %ebp      # imm = 0xC3F
addl %r10d, %ebp
movswl -0x70(%rdx,%rax,2), %r8d
movswl -0x30(%rdx,%rax,2), %ecx
leal (%rcx,%r8), %r11d
subl %ecx, %r8d
movswl (%rdx,%rax,2), %ecx
movswl -0x20(%rdx,%rax,2), %r14d
movswl -0x40(%rdx,%rax,2), %r12d
leal (%r12,%rcx), %r13d
leal (%r14,%rsi), %ebx
leal (%r12,%r14), %r15d
leal (%rbx,%r13), %r10d
imull $0x12d0, %r10d, %r9d    # imm = 0x12D0
imull $0x4c7, %ecx, %r10d     # imm = 0x4C7
addl %esi, %ecx
imull $0xfffff19b, %ecx, %ecx # imm = 0xFFFFF19B
addl %r9d, %ecx
imull $0xffffd6ff, %r15d, %edi # imm = 0xFFFFD6FF
addl %r9d, %edi
imull $0x20da, %r14d, %r14d   # imm = 0x20DA
imull $0x1805, %esi, %r15d    # imm = 0x1805
imull $0xfffff9c3, %ebx, %edx # imm = 0xFFFFF9C3
addl %edx, %r15d
addl %edx, %r14d
imull $0x312a, %r12d, %r12d   # imm = 0x312A
imull $0xffffe09e, %r13d, %edx # imm = 0xFFFFE09E
addl %edx, %r12d
addl %edi, %r12d
addl %edi, %r14d
addl %edx, %r10d
shll $0xc, %r11d
shll $0xc, %r8d
addl %ecx, %r15d
addl %ecx, %r10d
movl %r11d, %r9d
subl %ebp, %r9d
movl $0x200, %edx            # imm = 0x200
addl %edx, %r11d
addl %ebp, %r11d
movl %r8d, %r13d
movl -0x78(%rsp), %ecx
subl %ecx, %r13d
addl %edx, %r8d
addl %ecx, %r8d
leal (%r15,%r11), %ecx
sarl $0xa, %ecx
movl %ecx, -0x140(%rsp,%rax,4)
subl %r15d, %r11d
sarl $0xa, %r11d
movl %r11d, -0x60(%rsp,%rax,4)
leal (%r12,%r8), %ecx
sarl $0xa, %ecx
movl %ecx, -0x120(%rsp,%rax,4)
subl %r12d, %r8d
sarl $0xa, %r8d
movl %r8d, -0x80(%rsp,%rax,4)
leal (%r14,%r13), %ecx
addl $0x200, %ecx            # imm = 0x200
sarl $0xa, %ecx
movl %ecx, -0x100(%rsp,%rax,4)
leal (%rdx,%r13), %ecx
subl %r14d, %ecx
sarl $0xa, %ecx
movl %ecx, -0xa0(%rsp,%rax,4)
leal (%r9,%r10), %ecx
addl $0x200, %ecx            # imm = 0x200
sarl $0xa, %ecx
movl %ecx, -0xe0(%rsp,%rax,4)
leal (%r9,%rdx), %ecx
movq -0x68(%rsp), %rdx
subl %r10d, %ecx
sarl $0xa, %ecx
movl %ecx, -0xc0(%rsp,%rax,4)
incq %rax
cmpl $0x40, %eax
jne 0x18fc8
jmp 0x191b8
movswl -0x70(%rdx,%rax,2), %ecx
shll $0x2, %ecx
movl %ecx, -0x60(%rsp,%rax,4)
movl %ecx, -0x80(%rsp,%rax,4)
movl %ecx, -0xa0(%rsp,%rax,4)
movl %ecx, -0xc0(%rsp,%rax,4)
movl %ecx, -0xe0(%rsp,%rax,4)
movl %ecx, -0x100(%rsp,%rax,4)
movl %ecx, -0x120(%rsp,%rax,4)
movl %ecx, -0x140(%rsp,%rax,4)
jmp 0x1916e
movslq -0x6c(%rsp), %rax
movq %rax, -0x78(%rsp)
movq -0x80(%rsp), %rax
addq $0x7, %rax
movl $0x1c, %ecx
movq %rax, -0x80(%rsp)
movl -0x74(%rsp,%rcx), %eax
movl -0x64(%rsp,%rcx), %edx
leal (%rdx,%rax), %edi
imull $0x8a9, %edi, %edi      # imm = 0x8A9
imull $0xffffe271, %edx, %ebp # imm = 0xFFFFE271
addl %edi, %ebp
imull $0xc3f, %eax, %r14d     # imm = 0xC3F
addl %edi, %r14d
movl -0x6c(%rsp,%rcx), %eax
movl -0x7c(%rsp,%rcx), %r8d
movl -0x78(%rsp,%rcx), %r10d
leal (%rax,%r8), %ebx
subl %eax, %r8d
movl -0x60(%rsp,%rcx), %r9d
movl -0x68(%rsp,%rcx), %edi
movl -0x70(%rsp,%rcx), %r15d
leal (%r15,%r9), %eax
leal (%r10,%rdi), %r12d
leal (%r10,%r9), %edx
leal (%r15,%rdi), %r11d
leal (%r12,%rax), %r13d
imull $0x12d0, %r13d, %r13d   # imm = 0x12D0
imull $0xfffff19b, %edx, %edx # imm = 0xFFFFF19B
addl %r13d, %edx
imull $0xffffd6ff, %r11d, %esi # imm = 0xFFFFD6FF
addl %r13d, %esi
imull $0x20da, %edi, %r11d    # imm = 0x20DA
imull $0x1805, %r10d, %r13d   # imm = 0x1805
imull $0xfffff9c3, %r12d, %edi # imm = 0xFFFFF9C3
addl %edi, %r13d
addl %edi, %r11d
imull $0x312a, %r15d, %r12d   # imm = 0x312A
imull $0xffffe09e, %eax, %eax # imm = 0xFFFFE09E
addl %eax, %r12d
addl %esi, %r12d
addl %esi, %r11d
shll $0xc, %ebx
shll $0xc, %r8d
imull $0x4c7, %r9d, %r9d      # imm = 0x4C7
addl %eax, %r9d
movl %ebx, %r10d
subl %r14d, %r10d
addl %edx, %r13d
addl %edx, %r9d
movl %r8d, %r15d
subl %ebp, %r15d
movl $0x1010000, %edi        # imm = 0x1010000
addl %edi, %ebx
addl %r14d, %ebx
addl %edi, %r8d
addl %ebp, %r8d
leal (%rbx,%r13), %eax
sarl $0x11, %eax
setns %dl
negb %dl
movl $0x100, %ebp            # imm = 0x100
cmpl %ebp, %eax
movzbl %dl, %edx
cmovbl %eax, %edx
movq -0x80(%rsp), %rax
movb %dl, -0x7(%rax)
subl %r13d, %ebx
sarl $0x11, %ebx
setns %al
negb %al
cmpl %ebp, %ebx
movzbl %al, %eax
cmovbl %ebx, %eax
leal (%r12,%r8), %edx
sarl $0x11, %edx
setns %sil
negb %sil
cmpl %ebp, %edx
movzbl %sil, %esi
cmovbl %edx, %esi
movq -0x80(%rsp), %rdx
movb %al, (%rdx)
movq -0x80(%rsp), %rax
movb %sil, -0x6(%rax)
subl %r12d, %r8d
sarl $0x11, %r8d
setns %al
negb %al
cmpl %ebp, %r8d
movzbl %al, %eax
cmovbl %r8d, %eax
movq -0x80(%rsp), %rdx
movb %al, -0x1(%rdx)
leal (%r15,%r11), %eax
addl $0x1010000, %eax        # imm = 0x1010000
sarl $0x11, %eax
setns %dl
negb %dl
cmpl %ebp, %eax
movzbl %dl, %edx
cmovbl %eax, %edx
leal (%r15,%rdi), %eax
subl %r11d, %eax
sarl $0x11, %eax
setns %sil
negb %sil
cmpl %ebp, %eax
movzbl %sil, %esi
cmovbl %eax, %esi
movq -0x80(%rsp), %rax
movb %dl, -0x5(%rax)
movq -0x80(%rsp), %rax
movb %sil, -0x2(%rax)
leal (%r10,%r9), %eax
addl $0x1010000, %eax        # imm = 0x1010000
sarl $0x11, %eax
setns %dl
negb %dl
cmpl %ebp, %eax
movzbl %dl, %edx
cmovbl %eax, %edx
movq -0x80(%rsp), %rax
movb %dl, -0x4(%rax)
leal (%r10,%rdi), %eax
subl %r9d, %eax
sarl $0x11, %eax
setns %dl
negb %dl
cmpl %ebp, %eax
movzbl %dl, %edx
cmovbl %eax, %edx
movq -0x80(%rsp), %rax
movb %dl, -0x3(%rax)
addq $0x20, %rcx
addq -0x78(%rsp), %rax
cmpl $0x11c, %ecx            # imm = 0x11C
jne 0x191d0
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq