// File: /workspace/github_c_makefile_star2_O1/jonof[P]jftekwar/jfbuild/src/kplib.c
// Function: invdct8x8
static void invdct8x8 (int *dc, unsigned char dcflag)
{
	#define SQRT2 23726566   //(sqrt(2))<<24
	#define C182 31000253    //(cos(PI/8)*2)<<24
	#define C18S22 43840978  //(cos(PI/8)*sqrt(2)*2)<<24
	#define C38S22 18159528  //(cos(PI*3/8)*sqrt(2)*2)<<24
	int *edc, t0, t1, t2, t3, t4, t5, t6, t7;

	edc = dc+64;
	do
	{
		if (dcflag&1) //pow2char[z])
		{
			t3 = dc[2] + dc[6];
			t2 = (mulshr32(dc[2]-dc[6],SQRT2<<6)<<2) - t3;
			t4 = dc[0] + dc[4]; t5 = dc[0] - dc[4];
			t0 = t4+t3; t3 = t4-t3; t1 = t5+t2; t2 = t5-t2;
			t4 = (mulshr32(dc[5]-dc[3]+dc[1]-dc[7],C182<<6)<<2);
			t7 = dc[1] + dc[7] + dc[5] + dc[3];
			t6 = (mulshr32(dc[3]-dc[5],C18S22<<5)<<3) + t4 - t7;
			t5 = (mulshr32(dc[1]+dc[7]-dc[5]-dc[3],SQRT2<<6)<<2) - t6;
			t4 = (mulshr32(dc[1]-dc[7],C38S22<<6)<<2) - t4 + t5;
			dc[0] = t0+t7; dc[7] = t0-t7; dc[1] = t1+t6; dc[6] = t1-t6;
			dc[2] = t2+t5; dc[5] = t2-t5; dc[4] = t3+t4; dc[3] = t3-t4;
		}
		dc += 8; dcflag >>= 1;
	} while (dc < edc);
	dc -= 32; edc -= 24;
	do
	{
		t3 = dc[2*8-32] + dc[6*8-32];
		t2 = (mulshr32(dc[2*8-32]-dc[6*8-32],SQRT2<<6)<<2) - t3;
		t4 = dc[0*8-32] + dc[4*8-32]; t5 = dc[0*8-32] - dc[4*8-32];
		t0 = t4+t3; t3 = t4-t3; t1 = t5+t2; t2 = t5-t2;
		t4 = (mulshr32(dc[5*8-32]-dc[3*8-32]+dc[1*8-32]-dc[7*8-32],C182<<6)<<2);
		t7 = dc[1*8-32] + dc[7*8-32] + dc[5*8-32] + dc[3*8-32];
		t6 = (mulshr32(dc[3*8-32]-dc[5*8-32],C18S22<<5)<<3) + t4 - t7;
		t5 = (mulshr32(dc[1*8-32]+dc[7*8-32]-dc[5*8-32]-dc[3*8-32],SQRT2<<6)<<2) - t6;
		t4 = (mulshr32(dc[1*8-32]-dc[7*8-32],C38S22<<6)<<2) - t4 + t5;
		dc[0*8-32] = t0+t7; dc[7*8-32] = t0-t7; dc[1*8-32] = t1+t6; dc[6*8-32] = t1-t6;
		dc[2*8-32] = t2+t5; dc[5*8-32] = t2-t5; dc[4*8-32] = t3+t4; dc[3*8-32] = t3-t4;
		dc++;
	} while (dc < edc);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq $-0x20, %rax
testb $0x1, %sil
je 0x488d2
movl 0x28(%rdi,%rax), %ecx
movl 0x38(%rdi,%rax), %edx
leal (%rdx,%rcx), %r8d
subl %edx, %ecx
movslq %ecx, %rcx
imulq $0x5a827980, %rcx, %r11 # imm = 0x5A827980
shrq $0x1e, %r11
andl $-0x4, %r11d
subl %r8d, %r11d
movl 0x30(%rdi,%rax), %r9d
movl 0x20(%rdi,%rax), %edx
movl 0x24(%rdi,%rax), %r10d
leal (%r9,%rdx), %ecx
subl %r9d, %edx
leal (%rcx,%r8), %r9d
subl %r8d, %ecx
leal (%r11,%rdx), %r8d
subl %r11d, %edx
movl 0x34(%rdi,%rax), %r15d
movl 0x2c(%rdi,%rax), %r12d
movl 0x3c(%rdi,%rax), %r11d
leal (%r15,%r10), %ebx
subl %r12d, %ebx
subl %r11d, %ebx
movslq %ebx, %rbx
imulq $0x7641af40, %rbx, %rbx # imm = 0x7641AF40
shrq $0x20, %rbx
leal (%r11,%r10), %r13d
leal (%r12,%r15), %ebp
leal (%rbp,%r13), %r14d
subl %r15d, %r12d
movslq %r12d, %r15
imulq $0x539eba40, %r15, %r15 # imm = 0x539EBA40
shrq $0x1d, %r15
andl $-0x8, %r15d
subl %r14d, %r15d
leal (%r15,%rbx,4), %r12d
subl %ebp, %r13d
movslq %r13d, %r15
imulq $0x5a827980, %r15, %r15 # imm = 0x5A827980
shrq $0x1e, %r15
andl $-0x4, %r15d
subl %r12d, %r15d
subl %r11d, %r10d
movslq %r10d, %r10
imulq $0x4545ea00, %r10, %r10 # imm = 0x4545EA00
shrq $0x20, %r10
subl %ebx, %r10d
leal (%r15,%r10,4), %r10d
leal (%r14,%r9), %r11d
movl %r11d, 0x20(%rdi,%rax)
subl %r14d, %r9d
movl %r9d, 0x3c(%rdi,%rax)
leal (%r12,%r8), %r9d
movl %r9d, 0x24(%rdi,%rax)
subl %r12d, %r8d
movl %r8d, 0x38(%rdi,%rax)
leal (%r15,%rdx), %r8d
movl %r8d, 0x28(%rdi,%rax)
subl %r15d, %edx
movl %edx, 0x34(%rdi,%rax)
leal (%r10,%rcx), %edx
movl %edx, 0x30(%rdi,%rax)
subl %r10d, %ecx
movl %ecx, 0x2c(%rdi,%rax)
shrb %sil
addq $0x20, %rax
cmpq $0xe0, %rax
jb 0x487c1
movl $0x7c, %eax
movl -0x3c(%rdi,%rax), %ecx
movl 0x44(%rdi,%rax), %edx
leal (%rdx,%rcx), %esi
subl %edx, %ecx
movslq %ecx, %rcx
imulq $0x5a827980, %rcx, %r10 # imm = 0x5A827980
shrq $0x1e, %r10
andl $-0x4, %r10d
subl %esi, %r10d
movl 0x4(%rdi,%rax), %r8d
movl -0x7c(%rdi,%rax), %edx
movl -0x5c(%rdi,%rax), %r9d
leal (%r8,%rdx), %ecx
subl %r8d, %edx
leal (%rcx,%rsi), %r8d
subl %esi, %ecx
leal (%r10,%rdx), %esi
subl %r10d, %edx
movl 0x24(%rdi,%rax), %r14d
movl -0x1c(%rdi,%rax), %r15d
movl 0x64(%rdi,%rax), %r10d
leal (%r14,%r9), %r11d
subl %r15d, %r11d
subl %r10d, %r11d
movslq %r11d, %r11
imulq $0x7641af40, %r11, %r11 # imm = 0x7641AF40
shrq $0x20, %r11
leal (%r10,%r9), %r12d
leal (%r15,%r14), %r13d
leal (%r12,%r13), %ebx
subl %r14d, %r15d
movslq %r15d, %r14
imulq $0x539eba40, %r14, %r14 # imm = 0x539EBA40
shrq $0x1d, %r14
andl $-0x8, %r14d
subl %ebx, %r14d
leal (%r14,%r11,4), %r15d
subl %r13d, %r12d
movslq %r12d, %r14
imulq $0x5a827980, %r14, %r14 # imm = 0x5A827980
shrq $0x1e, %r14
andl $-0x4, %r14d
subl %r15d, %r14d
subl %r10d, %r9d
movslq %r9d, %r9
imulq $0x4545ea00, %r9, %r9   # imm = 0x4545EA00
shrq $0x20, %r9
subl %r11d, %r9d
leal (%r14,%r9,4), %r9d
leal (%rbx,%r8), %r10d
movl %r10d, -0x7c(%rdi,%rax)
subl %ebx, %r8d
movl %r8d, 0x64(%rdi,%rax)
leal (%r15,%rsi), %r8d
movl %r8d, -0x5c(%rdi,%rax)
subl %r15d, %esi
movl %esi, 0x44(%rdi,%rax)
leal (%r14,%rdx), %esi
movl %esi, -0x3c(%rdi,%rax)
subl %r14d, %edx
movl %edx, 0x24(%rdi,%rax)
leal (%r9,%rcx), %edx
movl %edx, 0x4(%rdi,%rax)
subl %r9d, %ecx
movl %ecx, -0x1c(%rdi,%rax)
addq $0x4, %rax
cmpq $0x9c, %rax
jb 0x488ea
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq