// File: 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:
movq %rdi, -0x8(%rsp)
movq -0x8(%rsp), %rax
movq %rax, -0x60(%rsp)
movl $0x7, -0x64(%rsp)
cmpl $0x0, -0x64(%rsp)
jl 0xe144c
movq -0x60(%rsp), %rax
movl (%rax), %eax
movq -0x60(%rsp), %rcx
addl 0x1c(%rcx), %eax
movl %eax, -0xc(%rsp)
movq -0x60(%rsp), %rax
movl (%rax), %eax
movq -0x60(%rsp), %rcx
subl 0x1c(%rcx), %eax
movl %eax, -0x28(%rsp)
movq -0x60(%rsp), %rax
movl 0x4(%rax), %eax
movq -0x60(%rsp), %rcx
addl 0x18(%rcx), %eax
movl %eax, -0x10(%rsp)
movq -0x60(%rsp), %rax
movl 0x4(%rax), %eax
movq -0x60(%rsp), %rcx
subl 0x18(%rcx), %eax
movl %eax, -0x24(%rsp)
movq -0x60(%rsp), %rax
movl 0x8(%rax), %eax
movq -0x60(%rsp), %rcx
addl 0x14(%rcx), %eax
movl %eax, -0x14(%rsp)
movq -0x60(%rsp), %rax
movl 0x8(%rax), %eax
movq -0x60(%rsp), %rcx
subl 0x14(%rcx), %eax
movl %eax, -0x20(%rsp)
movq -0x60(%rsp), %rax
movl 0xc(%rax), %eax
movq -0x60(%rsp), %rcx
addl 0x10(%rcx), %eax
movl %eax, -0x18(%rsp)
movq -0x60(%rsp), %rax
movl 0xc(%rax), %eax
movq -0x60(%rsp), %rcx
subl 0x10(%rcx), %eax
movl %eax, -0x1c(%rsp)
movl -0xc(%rsp), %eax
addl -0x18(%rsp), %eax
movl %eax, -0x2c(%rsp)
movl -0xc(%rsp), %eax
subl -0x18(%rsp), %eax
movl %eax, -0x38(%rsp)
movl -0x10(%rsp), %eax
addl -0x14(%rsp), %eax
movl %eax, -0x30(%rsp)
movl -0x10(%rsp), %eax
subl -0x14(%rsp), %eax
movl %eax, -0x34(%rsp)
movl -0x2c(%rsp), %ecx
addl -0x30(%rsp), %ecx
movq -0x60(%rsp), %rax
movl %ecx, (%rax)
movl -0x2c(%rsp), %ecx
subl -0x30(%rsp), %ecx
movq -0x60(%rsp), %rax
movl %ecx, 0x10(%rax)
movl -0x34(%rsp), %eax
addl -0x38(%rsp), %eax
cltq
imulq $0xb5, %rax, %rax
sarq $0x8, %rax
movl %eax, -0x3c(%rsp)
movl -0x38(%rsp), %ecx
addl -0x3c(%rsp), %ecx
movq -0x60(%rsp), %rax
movl %ecx, 0x8(%rax)
movl -0x38(%rsp), %ecx
subl -0x3c(%rsp), %ecx
movq -0x60(%rsp), %rax
movl %ecx, 0x18(%rax)
movl -0x1c(%rsp), %eax
addl -0x20(%rsp), %eax
movl %eax, -0x2c(%rsp)
movl -0x20(%rsp), %eax
addl -0x24(%rsp), %eax
movl %eax, -0x30(%rsp)
movl -0x24(%rsp), %eax
addl -0x28(%rsp), %eax
movl %eax, -0x34(%rsp)
movl -0x2c(%rsp), %eax
subl -0x34(%rsp), %eax
cltq
imulq $0x62, %rax, %rax
sarq $0x8, %rax
movl %eax, -0x4c(%rsp)
movslq -0x2c(%rsp), %rax
imulq $0x8b, %rax, %rax
sarq $0x8, %rax
addl -0x4c(%rsp), %eax
movl %eax, -0x40(%rsp)
movslq -0x34(%rsp), %rax
imulq $0x14e, %rax, %rax      # imm = 0x14E
sarq $0x8, %rax
addl -0x4c(%rsp), %eax
movl %eax, -0x48(%rsp)
movslq -0x30(%rsp), %rax
imulq $0xb5, %rax, %rax
sarq $0x8, %rax
movl %eax, -0x44(%rsp)
movl -0x28(%rsp), %eax
addl -0x44(%rsp), %eax
movl %eax, -0x50(%rsp)
movl -0x28(%rsp), %eax
subl -0x44(%rsp), %eax
movl %eax, -0x54(%rsp)
movl -0x54(%rsp), %ecx
addl -0x40(%rsp), %ecx
movq -0x60(%rsp), %rax
movl %ecx, 0x14(%rax)
movl -0x54(%rsp), %ecx
subl -0x40(%rsp), %ecx
movq -0x60(%rsp), %rax
movl %ecx, 0xc(%rax)
movl -0x50(%rsp), %ecx
addl -0x48(%rsp), %ecx
movq -0x60(%rsp), %rax
movl %ecx, 0x4(%rax)
movl -0x50(%rsp), %ecx
subl -0x48(%rsp), %ecx
movq -0x60(%rsp), %rax
movl %ecx, 0x1c(%rax)
movq -0x60(%rsp), %rax
addq $0x20, %rax
movq %rax, -0x60(%rsp)
movl -0x64(%rsp), %eax
addl $-0x1, %eax
movl %eax, -0x64(%rsp)
jmp 0xe1227
movq -0x8(%rsp), %rax
movq %rax, -0x60(%rsp)
movl $0x7, -0x64(%rsp)
cmpl $0x0, -0x64(%rsp)
jl 0xe16a7
movq -0x60(%rsp), %rax
movl (%rax), %eax
movq -0x60(%rsp), %rcx
addl 0xe0(%rcx), %eax
movl %eax, -0xc(%rsp)
movq -0x60(%rsp), %rax
movl (%rax), %eax
movq -0x60(%rsp), %rcx
subl 0xe0(%rcx), %eax
movl %eax, -0x28(%rsp)
movq -0x60(%rsp), %rax
movl 0x20(%rax), %eax
movq -0x60(%rsp), %rcx
addl 0xc0(%rcx), %eax
movl %eax, -0x10(%rsp)
movq -0x60(%rsp), %rax
movl 0x20(%rax), %eax
movq -0x60(%rsp), %rcx
subl 0xc0(%rcx), %eax
movl %eax, -0x24(%rsp)
movq -0x60(%rsp), %rax
movl 0x40(%rax), %eax
movq -0x60(%rsp), %rcx
addl 0xa0(%rcx), %eax
movl %eax, -0x14(%rsp)
movq -0x60(%rsp), %rax
movl 0x40(%rax), %eax
movq -0x60(%rsp), %rcx
subl 0xa0(%rcx), %eax
movl %eax, -0x20(%rsp)
movq -0x60(%rsp), %rax
movl 0x60(%rax), %eax
movq -0x60(%rsp), %rcx
addl 0x80(%rcx), %eax
movl %eax, -0x18(%rsp)
movq -0x60(%rsp), %rax
movl 0x60(%rax), %eax
movq -0x60(%rsp), %rcx
subl 0x80(%rcx), %eax
movl %eax, -0x1c(%rsp)
movl -0xc(%rsp), %eax
addl -0x18(%rsp), %eax
movl %eax, -0x2c(%rsp)
movl -0xc(%rsp), %eax
subl -0x18(%rsp), %eax
movl %eax, -0x38(%rsp)
movl -0x10(%rsp), %eax
addl -0x14(%rsp), %eax
movl %eax, -0x30(%rsp)
movl -0x10(%rsp), %eax
subl -0x14(%rsp), %eax
movl %eax, -0x34(%rsp)
movl -0x2c(%rsp), %ecx
addl -0x30(%rsp), %ecx
movq -0x60(%rsp), %rax
movl %ecx, (%rax)
movl -0x2c(%rsp), %ecx
subl -0x30(%rsp), %ecx
movq -0x60(%rsp), %rax
movl %ecx, 0x80(%rax)
movl -0x34(%rsp), %eax
addl -0x38(%rsp), %eax
cltq
imulq $0xb5, %rax, %rax
sarq $0x8, %rax
movl %eax, -0x3c(%rsp)
movl -0x38(%rsp), %ecx
addl -0x3c(%rsp), %ecx
movq -0x60(%rsp), %rax
movl %ecx, 0x40(%rax)
movl -0x38(%rsp), %ecx
subl -0x3c(%rsp), %ecx
movq -0x60(%rsp), %rax
movl %ecx, 0xc0(%rax)
movl -0x1c(%rsp), %eax
addl -0x20(%rsp), %eax
movl %eax, -0x2c(%rsp)
movl -0x20(%rsp), %eax
addl -0x24(%rsp), %eax
movl %eax, -0x30(%rsp)
movl -0x24(%rsp), %eax
addl -0x28(%rsp), %eax
movl %eax, -0x34(%rsp)
movl -0x2c(%rsp), %eax
subl -0x34(%rsp), %eax
cltq
imulq $0x62, %rax, %rax
sarq $0x8, %rax
movl %eax, -0x4c(%rsp)
movslq -0x2c(%rsp), %rax
imulq $0x8b, %rax, %rax
sarq $0x8, %rax
addl -0x4c(%rsp), %eax
movl %eax, -0x40(%rsp)
movslq -0x34(%rsp), %rax
imulq $0x14e, %rax, %rax      # imm = 0x14E
sarq $0x8, %rax
addl -0x4c(%rsp), %eax
movl %eax, -0x48(%rsp)
movslq -0x30(%rsp), %rax
imulq $0xb5, %rax, %rax
sarq $0x8, %rax
movl %eax, -0x44(%rsp)
movl -0x28(%rsp), %eax
addl -0x44(%rsp), %eax
movl %eax, -0x50(%rsp)
movl -0x28(%rsp), %eax
subl -0x44(%rsp), %eax
movl %eax, -0x54(%rsp)
movl -0x54(%rsp), %ecx
addl -0x40(%rsp), %ecx
movq -0x60(%rsp), %rax
movl %ecx, 0xa0(%rax)
movl -0x54(%rsp), %ecx
subl -0x40(%rsp), %ecx
movq -0x60(%rsp), %rax
movl %ecx, 0x60(%rax)
movl -0x50(%rsp), %ecx
addl -0x48(%rsp), %ecx
movq -0x60(%rsp), %rax
movl %ecx, 0x20(%rax)
movl -0x50(%rsp), %ecx
subl -0x48(%rsp), %ecx
movq -0x60(%rsp), %rax
movl %ecx, 0xe0(%rax)
movq -0x60(%rsp), %rax
addq $0x4, %rax
movq %rax, -0x60(%rsp)
movl -0x64(%rsp), %eax
addl $-0x1, %eax
movl %eax, -0x64(%rsp)
jmp 0xe145e
retq
nopl (%rax,%rax)