// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/jpeg/jfdctfst.c
// Function: jpeg_fdct_ifast
GLOBAL(void)
jpeg_fdct_ifast (DCTELEM * data)
{
  DCTELEM tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
  DCTELEM tmp10, tmp11, tmp12, tmp13;
  DCTELEM z1, z2, z3, z4, z5, z11, z13;
  DCTELEM *dataptr;
  int ctr;
  SHIFT_TEMPS

  /* Pass 1: process rows. */

  dataptr = data;
  for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
    tmp0 = dataptr[0] + dataptr[7];
    tmp7 = dataptr[0] - dataptr[7];
    tmp1 = dataptr[1] + dataptr[6];
    tmp6 = dataptr[1] - dataptr[6];
    tmp2 = dataptr[2] + dataptr[5];
    tmp5 = dataptr[2] - dataptr[5];
    tmp3 = dataptr[3] + dataptr[4];
    tmp4 = dataptr[3] - dataptr[4];
    
    /* Even part */
    
    tmp10 = tmp0 + tmp3;	/* phase 2 */
    tmp13 = tmp0 - tmp3;
    tmp11 = tmp1 + tmp2;
    tmp12 = tmp1 - tmp2;
    
    dataptr[0] = tmp10 + tmp11; /* phase 3 */
    dataptr[4] = tmp10 - tmp11;
    
    z1 = MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */
    dataptr[2] = tmp13 + z1;	/* phase 5 */
    dataptr[6] = tmp13 - z1;
    
    /* Odd part */

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

    /* The rotator is modified from fig 4-8 to avoid extra negations. */
    z5 = MULTIPLY(tmp10 - tmp12, FIX_0_382683433); /* c6 */
    z2 = MULTIPLY(tmp10, FIX_0_541196100) + z5; /* c2-c6 */
    z4 = MULTIPLY(tmp12, FIX_1_306562965) + z5; /* c2+c6 */
    z3 = MULTIPLY(tmp11, FIX_0_707106781); /* c4 */

    z11 = tmp7 + z3;		/* phase 5 */
    z13 = tmp7 - z3;

    dataptr[5] = z13 + z2;	/* phase 6 */
    dataptr[3] = z13 - z2;
    dataptr[1] = z11 + z4;
    dataptr[7] = z11 - z4;

    dataptr += DCTSIZE;		/* advance pointer to next row */
  }

  /* Pass 2: process columns. */

  dataptr = data;
  for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
    tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7];
    tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7];
    tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6];
    tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6];
    tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5];
    tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5];
    tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4];
    tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4];
    
    /* Even part */
    
    tmp10 = tmp0 + tmp3;	/* phase 2 */
    tmp13 = tmp0 - tmp3;
    tmp11 = tmp1 + tmp2;
    tmp12 = tmp1 - tmp2;
    
    dataptr[DCTSIZE*0] = tmp10 + tmp11; /* phase 3 */
    dataptr[DCTSIZE*4] = tmp10 - tmp11;
    
    z1 = MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */
    dataptr[DCTSIZE*2] = tmp13 + z1; /* phase 5 */
    dataptr[DCTSIZE*6] = tmp13 - z1;
    
    /* Odd part */

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

    /* The rotator is modified from fig 4-8 to avoid extra negations. */
    z5 = MULTIPLY(tmp10 - tmp12, FIX_0_382683433); /* c6 */
    z2 = MULTIPLY(tmp10, FIX_0_541196100) + z5; /* c2-c6 */
    z4 = MULTIPLY(tmp12, FIX_1_306562965) + z5; /* c2+c6 */
    z3 = MULTIPLY(tmp11, FIX_0_707106781); /* c4 */

    z11 = tmp7 + z3;		/* phase 5 */
    z13 = tmp7 - z3;

    dataptr[DCTSIZE*5] = z13 + z2; /* phase 6 */
    dataptr[DCTSIZE*3] = z13 - z2;
    dataptr[DCTSIZE*1] = z11 + z4;
    dataptr[DCTSIZE*7] = z11 - z4;

    dataptr++;			/* advance pointer to next column */
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl $0x7, %eax
movq %rdi, %rcx
testl %eax, %eax
js 0x6e390
movl 0x1c(%rcx), %r8d
movl (%rcx), %edx
movl 0x4(%rcx), %esi
leal (%r8,%rdx), %r9d
subl %r8d, %edx
movl 0x18(%rcx), %r8d
leal (%r8,%rsi), %r11d
subl %r8d, %esi
movl 0x8(%rcx), %r8d
movl 0x14(%rcx), %r10d
leal (%r10,%r8), %ebx
subl %r10d, %r8d
movl 0xc(%rcx), %r10d
movl 0x10(%rcx), %r14d
leal (%r14,%r10), %r15d
subl %r14d, %r10d
leal (%r15,%r9), %r14d
subl %r15d, %r9d
leal (%rbx,%r11), %r15d
subl %ebx, %r11d
leal (%r14,%r15), %ebx
movl %ebx, (%rcx)
subl %r15d, %r14d
movl %r14d, 0x10(%rcx)
addl %r9d, %r11d
movslq %r11d, %r11
imulq $0xb5, %r11, %r11
shrq $0x8, %r11
leal (%r9,%r11), %ebx
movl %ebx, 0x8(%rcx)
subl %r11d, %r9d
movl %r9d, 0x18(%rcx)
addl %r8d, %r10d
addl %esi, %r8d
addl %edx, %esi
movslq %r10d, %r9
subl %esi, %r10d
movslq %r10d, %r10
imulq $0x62, %r10, %r10
shrq $0x8, %r10
imulq $0x8b, %r9, %r9
shrq $0x8, %r9
addl %r10d, %r9d
movslq %esi, %rsi
imulq $0x14e, %rsi, %rsi      # imm = 0x14E
shrq $0x8, %rsi
addl %r10d, %esi
movslq %r8d, %r8
imulq $0xb5, %r8, %r8
shrq $0x8, %r8
leal (%rdx,%r8), %r10d
subl %r8d, %edx
leal (%r9,%rdx), %r8d
movl %r8d, 0x14(%rcx)
subl %r9d, %edx
movl %edx, 0xc(%rcx)
leal (%rsi,%r10), %edx
movl %edx, 0x4(%rcx)
subl %esi, %r10d
movl %r10d, 0x1c(%rcx)
addq $0x20, %rcx
decl %eax
jmp 0x6e2a1
movl $0x7, %eax
testl %eax, %eax
js 0x6e494
movl 0xe0(%rdi), %esi
movl (%rdi), %ecx
movl 0x20(%rdi), %edx
leal (%rsi,%rcx), %r8d
subl %esi, %ecx
movl 0xc0(%rdi), %esi
leal (%rsi,%rdx), %r10d
subl %esi, %edx
movl 0x40(%rdi), %esi
movl 0xa0(%rdi), %r9d
leal (%r9,%rsi), %r11d
subl %r9d, %esi
movl 0x60(%rdi), %r9d
movl 0x80(%rdi), %ebx
leal (%rbx,%r9), %r14d
subl %ebx, %r9d
leal (%r14,%r8), %ebx
subl %r14d, %r8d
leal (%r11,%r10), %r14d
subl %r11d, %r10d
leal (%rbx,%r14), %r11d
movl %r11d, (%rdi)
subl %r14d, %ebx
movl %ebx, 0x80(%rdi)
addl %r8d, %r10d
movslq %r10d, %r10
imulq $0xb5, %r10, %r10
shrq $0x8, %r10
leal (%r8,%r10), %r11d
movl %r11d, 0x40(%rdi)
subl %r10d, %r8d
movl %r8d, 0xc0(%rdi)
addl %esi, %r9d
addl %edx, %esi
addl %ecx, %edx
movslq %r9d, %r8
subl %edx, %r9d
movslq %r9d, %r9
imulq $0x62, %r9, %r9
shrq $0x8, %r9
imulq $0x8b, %r8, %r8
shrq $0x8, %r8
addl %r9d, %r8d
movslq %edx, %rdx
imulq $0x14e, %rdx, %rdx      # imm = 0x14E
shrq $0x8, %rdx
addl %r9d, %edx
movslq %esi, %rsi
imulq $0xb5, %rsi, %rsi
shrq $0x8, %rsi
leal (%rcx,%rsi), %r9d
subl %esi, %ecx
leal (%r8,%rcx), %esi
movl %esi, 0xa0(%rdi)
subl %r8d, %ecx
movl %ecx, 0x60(%rdi)
leal (%rdx,%r9), %ecx
movl %ecx, 0x20(%rdi)
subl %edx, %r9d
movl %r9d, 0xe0(%rdi)
addq $0x4, %rdi
decl %eax
jmp 0x6e395
popq %rbx
popq %r14
popq %r15
retq
nop