// File: /workspace/github_c_makefile_star2_O3/archer1357[P]Offline-Raytracer/stb_image.c
// Function: stbi__idct_block
static void stbi__idct_block(stbi_uc *out, int out_stride, short data[64], stbi_dequantize_t *dequantize)
{
   int i,val[64],*v=val;
   stbi_dequantize_t *dq = dequantize;
   stbi_uc *o;
   short *d = data;

   // columns
   for (i=0; i < 8; ++i,++d,++dq, ++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] * dq[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]*dq[ 0],d[ 8]*dq[ 8],d[16]*dq[16],d[24]*dq[24],
                 d[32]*dq[32],d[40]*dq[40],d[48]*dq[48],d[56]*dq[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
movq %rcx, -0x68(%rsp)
movl %esi, -0x6c(%rsp)
movq %rdi, -0x80(%rsp)
xorl %eax, %eax
movswl 0x10(%rdx,%rax,2), %ebx
movzwl 0x20(%rdx,%rax,2), %esi
movl %esi, %r8d
orw %bx, %r8w
jne 0x410ee2
cmpw $0x0, 0x30(%rdx,%rax,2)
jne 0x410ee0
cmpw $0x0, 0x40(%rdx,%rax,2)
jne 0x410ee0
cmpw $0x0, 0x50(%rdx,%rax,2)
jne 0x410ee0
cmpw $0x0, 0x60(%rdx,%rax,2)
jne 0x410ee0
cmpw $0x0, 0x70(%rdx,%rax,2)
je 0x41108a
xorl %esi, %esi
movswl %si, %esi
movq -0x68(%rsp), %rcx
movzbl 0x10(%rcx,%rax), %r8d
imull %esi, %r8d
movswl 0x60(%rdx,%rax,2), %esi
movzbl 0x30(%rcx,%rax), %r9d
imull %esi, %r9d
leal (%r9,%r8), %esi
imull $0x8a9, %esi, %esi      # imm = 0x8A9
imull $0xffffe271, %r9d, %edi # imm = 0xFFFFE271
addl %esi, %edi
movl %edi, -0x78(%rsp)
imull $0xc3f, %r8d, %ebp      # imm = 0xC3F
addl %esi, %ebp
movswl (%rdx,%rax,2), %esi
movzbl (%rcx,%rax), %r9d
imull %esi, %r9d
movswl 0x40(%rdx,%rax,2), %esi
movzbl 0x20(%rcx,%rax), %r8d
imull %esi, %r8d
leal (%r8,%r9), %r10d
subl %r8d, %r9d
movswl 0x70(%rdx,%rax,2), %esi
movzbl 0x38(%rcx,%rax), %r14d
imull %esi, %r14d
movswl 0x50(%rdx,%rax,2), %esi
movzbl 0x28(%rcx,%rax), %r12d
imull %esi, %r12d
movswl 0x30(%rdx,%rax,2), %esi
movzbl 0x18(%rcx,%rax), %r15d
imull %esi, %r15d
movzbl 0x8(%rcx,%rax), %r13d
imull %ebx, %r13d
leal (%r15,%r14), %r8d
leal (%r12,%r13), %edi
leal (%r14,%r13), %esi
leal (%r15,%r12), %ebx
leal (%rdi,%r8), %r11d
imull $0x12d0, %r11d, %r11d   # imm = 0x12D0
imull $0xfffff19b, %esi, %esi # imm = 0xFFFFF19B
addl %r11d, %esi
imull $0xffffd6ff, %ebx, %ecx # imm = 0xFFFFD6FF
addl %r11d, %ecx
imull $0x20da, %r12d, %ebx    # imm = 0x20DA
imull $0x1805, %r13d, %r12d   # imm = 0x1805
imull $0xfffff9c3, %edi, %edi # imm = 0xFFFFF9C3
addl %edi, %r12d
addl %edi, %ebx
imull $0x312a, %r15d, %r13d   # imm = 0x312A
imull $0xffffe09e, %r8d, %edi # imm = 0xFFFFE09E
addl %edi, %r13d
addl %ecx, %r13d
addl %ecx, %ebx
imull $0x4c7, %r14d, %r14d    # imm = 0x4C7
addl %edi, %r14d
shll $0xc, %r10d
shll $0xc, %r9d
addl %esi, %r12d
addl %esi, %r14d
movl %r10d, %r15d
subl %ebp, %r15d
movl $0x200, %esi            # imm = 0x200
addl %esi, %r10d
addl %ebp, %r10d
movl %r9d, %ebp
movl -0x78(%rsp), %ecx
subl %ecx, %ebp
addl %esi, %r9d
addl %ecx, %r9d
leal (%r12,%r10), %ecx
sarl $0xa, %ecx
movl %ecx, -0x60(%rsp,%rax,4)
subl %r12d, %r10d
sarl $0xa, %r10d
movl %r10d, 0x80(%rsp,%rax,4)
leal (%r9,%r13), %ecx
sarl $0xa, %ecx
movl %ecx, -0x40(%rsp,%rax,4)
subl %r13d, %r9d
sarl $0xa, %r9d
movl %r9d, 0x60(%rsp,%rax,4)
leal (%rbx,%rbp), %ecx
addl $0x200, %ecx            # imm = 0x200
sarl $0xa, %ecx
movl %ecx, -0x20(%rsp,%rax,4)
leal (%rsi,%rbp), %ecx
subl %ebx, %ecx
sarl $0xa, %ecx
movl %ecx, 0x40(%rsp,%rax,4)
leal (%r15,%r14), %ecx
addl $0x200, %ecx            # imm = 0x200
sarl $0xa, %ecx
movl %ecx, (%rsp,%rax,4)
leal (%r15,%rsi), %ecx
subl %r14d, %ecx
sarl $0xa, %ecx
movl %ecx, 0x20(%rsp,%rax,4)
incq %rax
cmpl $0x8, %eax
jne 0x410ea1
jmp 0x4110cc
movswl (%rdx,%rax,2), %esi
movq -0x68(%rsp), %rcx
movzbl (%rcx,%rax), %r8d
imull %esi, %r8d
shll $0x2, %r8d
movl %r8d, 0x80(%rsp,%rax,4)
movl %r8d, 0x60(%rsp,%rax,4)
movl %r8d, 0x40(%rsp,%rax,4)
movl %r8d, 0x20(%rsp,%rax,4)
movl %r8d, (%rsp,%rax,4)
movl %r8d, -0x20(%rsp,%rax,4)
movl %r8d, -0x40(%rsp,%rax,4)
movl %r8d, -0x60(%rsp,%rax,4)
jmp 0x41107c
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 0x4110e4
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq