// File: /workspace/github_c_makefile_star2_O1/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 $0xb8, %rsp
movq %rcx, -0x80(%rsp)
movl %esi, -0x78(%rsp)
xorl %eax, %eax
movswl 0x10(%rdx,%rax,2), %ebp
testl %ebp, %ebp
jne 0x40fc4e
cmpw $0x0, 0x20(%rdx,%rax,2)
jne 0x40fc4e
cmpw $0x0, 0x30(%rdx,%rax,2)
jne 0x40fc4e
cmpw $0x0, 0x40(%rdx,%rax,2)
jne 0x40fc4e
cmpw $0x0, 0x50(%rdx,%rax,2)
jne 0x40fc4e
cmpw $0x0, 0x60(%rdx,%rax,2)
jne 0x40fc4e
cmpw $0x0, 0x70(%rdx,%rax,2)
je 0x40fdff
movswl 0x20(%rdx,%rax,2), %esi
movq -0x80(%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, %r9d # imm = 0xFFFFE271
addl %esi, %r9d
movl %r9d, -0x70(%rsp)
imull $0xc3f, %r8d, %ebx      # imm = 0xC3F
addl %esi, %ebx
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), %r15d
imull %esi, %r15d
movswl 0x50(%rdx,%rax,2), %esi
movzbl 0x28(%rcx,%rax), %r14d
imull %esi, %r14d
movswl 0x30(%rdx,%rax,2), %esi
movzbl 0x18(%rcx,%rax), %r12d
imull %esi, %r12d
movzbl 0x8(%rcx,%rax), %r13d
imull %ebp, %r13d
leal (%r12,%r15), %r8d
leal (%r14,%r13), %ebp
leal (%r15,%r13), %esi
leal (%r12,%r14), %ecx
leal (%r8,%rbp), %r11d
imull $0x12d0, %r11d, %r11d   # imm = 0x12D0
imull $0xfffff19b, %esi, %esi # imm = 0xFFFFF19B
addl %r11d, %esi
imull $0xffffd6ff, %ecx, %ecx # imm = 0xFFFFD6FF
addl %r11d, %ecx
imull $0x20da, %r14d, %r14d   # imm = 0x20DA
imull $0x1805, %r13d, %r13d   # imm = 0x1805
imull $0xfffff9c3, %ebp, %r11d # imm = 0xFFFFF9C3
addl %r11d, %r13d
addl %r11d, %r14d
imull $0x312a, %r12d, %ebp    # imm = 0x312A
imull $0xffffe09e, %r8d, %r8d # imm = 0xFFFFE09E
addl %r8d, %ebp
addl %ecx, %ebp
addl %ecx, %r14d
imull $0x4c7, %r15d, %r15d    # imm = 0x4C7
addl %r8d, %r15d
shll $0xc, %r10d
shll $0xc, %r9d
addl %esi, %r13d
addl %esi, %r15d
movl %r10d, %r12d
subl %ebx, %r12d
movl $0x200, %esi            # imm = 0x200
addl %esi, %r10d
addl %ebx, %r10d
movl %r9d, %ebx
movl -0x70(%rsp), %ecx
subl %ecx, %ebx
addl %esi, %r9d
addl %ecx, %r9d
leal (%r10,%r13), %ecx
sarl $0xa, %ecx
movl %ecx, -0x50(%rsp,%rax,4)
subl %r13d, %r10d
sarl $0xa, %r10d
movl %r10d, 0x90(%rsp,%rax,4)
leal (%r9,%rbp), %ecx
sarl $0xa, %ecx
movl %ecx, -0x30(%rsp,%rax,4)
subl %ebp, %r9d
sarl $0xa, %r9d
movl %r9d, 0x70(%rsp,%rax,4)
leal (%rbx,%r14), %ecx
addl $0x200, %ecx            # imm = 0x200
sarl $0xa, %ecx
movl %ecx, -0x10(%rsp,%rax,4)
leal (%rbx,%rsi), %ecx
subl %r14d, %ecx
sarl $0xa, %ecx
movl %ecx, 0x50(%rsp,%rax,4)
leal (%r12,%r15), %ecx
addl $0x200, %ecx            # imm = 0x200
sarl $0xa, %ecx
movl %ecx, 0x10(%rsp,%rax,4)
leal (%r12,%rsi), %ecx
subl %r15d, %ecx
sarl $0xa, %ecx
movl %ecx, 0x30(%rsp,%rax,4)
incq %rax
cmpl $0x8, %eax
jne 0x40fc11
jmp 0x40fe42
movswl (%rdx,%rax,2), %esi
movq -0x80(%rsp), %rcx
movzbl (%rcx,%rax), %r8d
imull %esi, %r8d
shll $0x2, %r8d
movl %r8d, 0x90(%rsp,%rax,4)
movl %r8d, 0x70(%rsp,%rax,4)
movl %r8d, 0x50(%rsp,%rax,4)
movl %r8d, 0x30(%rsp,%rax,4)
movl %r8d, 0x10(%rsp,%rax,4)
movl %r8d, -0x10(%rsp,%rax,4)
movl %r8d, -0x30(%rsp,%rax,4)
movl %r8d, -0x50(%rsp,%rax,4)
jmp 0x40fdf1
movslq -0x78(%rsp), %rax
movq %rax, -0x60(%rsp)
addq $0x7, %rdi
movl $0x1c, %ecx
movl $0x1010000, %r11d       # imm = 0x1010000
movq %rdi, -0x70(%rsp)
movl -0x64(%rsp,%rcx), %eax
movl -0x54(%rsp,%rcx), %edx
movq %rdx, -0x58(%rsp)
addl %eax, %edx
imull $0x8a9, %edx, %ebp      # imm = 0x8A9
imull $0xc3f, %eax, %r15d     # imm = 0xC3F
addl %ebp, %r15d
movl -0x5c(%rsp,%rcx), %r13d
movl -0x6c(%rsp,%rcx), %r10d
movl -0x68(%rsp,%rcx), %edi
leal (%r10,%r13), %esi
shll $0xc, %esi
movl -0x50(%rsp,%rcx), %ebx
movl -0x58(%rsp,%rcx), %r8d
movl -0x60(%rsp,%rcx), %eax
leal (%rax,%rbx), %edx
movq %r8, %r14
leal (%rdi,%r8), %r9d
leal (%r9,%rdx), %r8d
imull $0x12d0, %r8d, %r12d    # imm = 0x12D0
imull $0x1805, %edi, %r8d     # imm = 0x1805
movq %rbx, -0x78(%rsp)
addl %ebx, %edi
imull $0xfffff19b, %edi, %edi # imm = 0xFFFFF19B
addl %r12d, %edi
imull $0xfffff9c3, %r9d, %ebx # imm = 0xFFFFF9C3
addl %ebx, %r8d
movl %edi, -0x64(%rsp)
addl %edi, %r8d
leal (%rsi,%r11), %r9d
movl %r15d, -0x80(%rsp)
addl %r15d, %r9d
leal (%r8,%r9), %r11d
sarl $0x11, %r11d
cmpl $0x100, %r11d           # imm = 0x100
jb 0x40ff0c
testl %r11d, %r11d
js 0x40ff11
movb $-0x1, %r15b
cmpl $0xff, %r11d
jg 0x40ff14
movl %r11d, %r15d
jmp 0x40ff14
xorl %r15d, %r15d
movq -0x70(%rsp), %rdi
movb %r15b, -0x7(%rdi)
subl %r8d, %r9d
sarl $0x11, %r9d
cmpl $0x100, %r9d            # imm = 0x100
movl $0x1010000, %r11d       # imm = 0x1010000
movq %r14, %r15
jb 0x40ff47
testl %r9d, %r9d
js 0x40ff4c
movb $-0x1, %r8b
cmpl $0xff, %r9d
jg 0x40ff4f
movl %r9d, %r8d
jmp 0x40ff4f
xorl %r8d, %r8d
imull $0xffffe271, -0x58(%rsp), %r9d # imm = 0xFFFFE271
addl %r9d, %ebp
subl %r13d, %r10d
shll $0xc, %r10d
imull $0x312a, %eax, %r9d     # imm = 0x312A
addl %r15d, %eax
imull $0xffffd6ff, %eax, %eax # imm = 0xFFFFD6FF
addl %eax, %r12d
imull $0xffffe09e, %edx, %r14d # imm = 0xFFFFE09E
addl %r14d, %r9d
addl %r12d, %r9d
leal (%r10,%r11), %eax
addl %ebp, %eax
movb %r8b, (%rdi)
leal (%r9,%rax), %edx
sarl $0x11, %edx
cmpl $0x100, %edx            # imm = 0x100
jb 0x40ffa9
testl %edx, %edx
js 0x40ffae
movb $-0x1, %r8b
cmpl $0xff, %edx
jg 0x40ffb1
movl %edx, %r8d
jmp 0x40ffb1
xorl %r8d, %r8d
movb %r8b, -0x6(%rdi)
subl %r9d, %eax
sarl $0x11, %eax
cmpl $0x100, %eax            # imm = 0x100
jb 0x40ffcf
testl %eax, %eax
js 0x40ffd3
movb $-0x1, %dl
cmpl $0xff, %eax
jg 0x40ffd5
movl %eax, %edx
jmp 0x40ffd5
xorl %edx, %edx
subl %ebp, %r10d
imull $0x20da, %r15d, %eax    # imm = 0x20DA
addl %eax, %ebx
addl %r12d, %ebx
addl %r11d, %r10d
movb %dl, -0x1(%rdi)
leal (%rbx,%r10), %eax
sarl $0x11, %eax
cmpl $0x100, %eax            # imm = 0x100
jb 0x410005
testl %eax, %eax
js 0x410009
movb $-0x1, %dl
cmpl $0xff, %eax
jg 0x41000b
movl %eax, %edx
jmp 0x41000b
xorl %edx, %edx
movb %dl, -0x5(%rdi)
subl %ebx, %r10d
sarl $0x11, %r10d
cmpl $0x100, %r10d           # imm = 0x100
jb 0x41002e
testl %r10d, %r10d
js 0x410033
movb $-0x1, %al
cmpl $0xff, %r10d
jg 0x410035
movl %r10d, %eax
jmp 0x410035
xorl %eax, %eax
subl -0x80(%rsp), %esi
imull $0x4c7, -0x78(%rsp), %edx # imm = 0x4C7
addl %edx, %r14d
addl -0x64(%rsp), %r14d
addl %r11d, %esi
movb %al, -0x2(%rdi)
leal (%r14,%rsi), %eax
sarl $0x11, %eax
cmpl $0x100, %eax            # imm = 0x100
jb 0x41006a
testl %eax, %eax
js 0x41006e
movb $-0x1, %dl
cmpl $0xff, %eax
jg 0x410070
movl %eax, %edx
jmp 0x410070
xorl %edx, %edx
movb %dl, -0x4(%rdi)
subl %r14d, %esi
sarl $0x11, %esi
cmpl $0x100, %esi            # imm = 0x100
jb 0x41008f
testl %esi, %esi
js 0x410093
movb $-0x1, %al
cmpl $0xff, %esi
jg 0x410095
movl %esi, %eax
jmp 0x410095
xorl %eax, %eax
movb %al, -0x3(%rdi)
addq $0x20, %rcx
addq -0x60(%rsp), %rdi
cmpl $0x11c, %ecx            # imm = 0x11C
jne 0x40fe5b
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq