// File: /workspace/github_c_makefile_star2_O2/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
movabsq $-0x20, %rax
testb $0x1, %sil
je 0x4232e
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 0x4221d
movabsq $-0x8, %rax
movdqa 0x2a33d(%rip), %xmm0    # 0x6c690
movdqa 0x2a365(%rip), %xmm3    # 0x6c6c0
movaps 0x2a33e(%rip), %xmm2    # 0x6c6a0
movdqu 0xe0(%rdi,%rax,4), %xmm7
movdqu 0x20(%rdi,%rax,4), %xmm6
movdqu 0x40(%rdi,%rax,4), %xmm10
movdqu 0x60(%rdi,%rax,4), %xmm8
movdqu 0x80(%rdi,%rax,4), %xmm11
movdqa %xmm7, %xmm4
paddd %xmm8, %xmm4
psubd %xmm7, %xmm8
pshufd $0xfe, %xmm8, %xmm7     # xmm7 = xmm8[2,3,3,3]
pshufd $0xd4, %xmm8, %xmm8     # xmm8 = xmm8[0,1,1,3]
pxor %xmm12, %xmm12
pcmpgtd %xmm8, %xmm12
pmuludq %xmm0, %xmm8
pmuludq %xmm0, %xmm12
psllq $0x20, %xmm12
paddq %xmm8, %xmm12
pxor %xmm8, %xmm8
pcmpgtd %xmm7, %xmm8
pmuludq %xmm0, %xmm7
pmuludq %xmm0, %xmm8
psllq $0x20, %xmm8
paddq %xmm7, %xmm8
psrlq $0x1e, %xmm8
psrlq $0x1e, %xmm12
shufps $0x88, %xmm8, %xmm12    # xmm12 = xmm12[0,2],xmm8[0,2]
andps %xmm2, %xmm12
psubd %xmm4, %xmm12
movdqu 0xa0(%rdi,%rax,4), %xmm8
movdqa %xmm8, %xmm7
paddd %xmm6, %xmm7
psubd %xmm8, %xmm6
movdqa %xmm7, %xmm9
paddd %xmm4, %xmm9
psubd %xmm4, %xmm7
movdqa %xmm12, %xmm8
paddd %xmm6, %xmm8
psubd %xmm12, %xmm6
movdqu 0xc0(%rdi,%rax,4), %xmm4
movdqu 0x100(%rdi,%rax,4), %xmm13
movdqa %xmm11, %xmm14
movdqa %xmm11, %xmm12
paddd %xmm4, %xmm12
psubd %xmm4, %xmm11
paddd %xmm10, %xmm4
paddd %xmm13, %xmm14
psubd %xmm14, %xmm4
pshufd $0xf5, %xmm4, %xmm14    # xmm14 = xmm4[1,1,3,3]
pxor %xmm1, %xmm1
pcmpgtd %xmm4, %xmm1
movdqa 0x2a235(%rip), %xmm5    # 0x6c6b0
pmuludq %xmm5, %xmm4
pshufd $0xed, %xmm4, %xmm15    # xmm15 = xmm4[1,3,2,3]
pmuludq %xmm5, %xmm14
pshufd $0xed, %xmm14, %xmm4    # xmm4 = xmm14[1,3,2,3]
punpckldq %xmm4, %xmm15   # xmm15 = xmm15[0],xmm4[0],xmm15[1],xmm4[1]
pand %xmm5, %xmm1
psubd %xmm1, %xmm15
movdqa %xmm13, %xmm14
paddd %xmm10, %xmm14
pshufd $0xfe, %xmm11, %xmm1    # xmm1 = xmm11[2,3,3,3]
pshufd $0xd4, %xmm11, %xmm4    # xmm4 = xmm11[0,1,1,3]
pxor %xmm11, %xmm11
pcmpgtd %xmm4, %xmm11
pmuludq %xmm3, %xmm4
pmuludq %xmm3, %xmm11
psllq $0x20, %xmm11
paddq %xmm4, %xmm11
pxor %xmm4, %xmm4
pcmpgtd %xmm1, %xmm4
pmuludq %xmm3, %xmm1
pmuludq %xmm3, %xmm4
psllq $0x20, %xmm4
paddq %xmm1, %xmm4
psubd %xmm13, %xmm10
pshufd $0xf5, %xmm10, %xmm1    # xmm1 = xmm10[1,1,3,3]
pxor %xmm13, %xmm13
pcmpgtd %xmm10, %xmm13
movdqa 0x2a1d8(%rip), %xmm5    # 0x6c6e0
pmuludq %xmm5, %xmm10
pshufd $0xed, %xmm10, %xmm10   # xmm10 = xmm10[1,3,2,3]
pmuludq %xmm5, %xmm1
pshufd $0xed, %xmm1, %xmm1     # xmm1 = xmm1[1,3,2,3]
punpckldq %xmm1, %xmm10   # xmm10 = xmm10[0],xmm1[0],xmm10[1],xmm1[1]
pand %xmm5, %xmm13
psubd %xmm13, %xmm10
psubd %xmm15, %xmm10
pslld $0x2, %xmm15
psrlq $0x1d, %xmm4
psrlq $0x1d, %xmm11
shufps $0x88, %xmm4, %xmm11    # xmm11 = xmm11[0,2],xmm4[0,2]
movdqa %xmm12, %xmm1
paddd %xmm14, %xmm1
andps 0x2a178(%rip), %xmm11   # 0x6c6d0
psubd %xmm1, %xmm11
paddd %xmm15, %xmm11
psubd %xmm12, %xmm14
pshufd $0xfe, %xmm14, %xmm12   # xmm12 = xmm14[2,3,3,3]
pshufd $0xd4, %xmm14, %xmm13   # xmm13 = xmm14[0,1,1,3]
pxor %xmm4, %xmm4
pcmpgtd %xmm13, %xmm4
pmuludq %xmm0, %xmm13
pmuludq %xmm0, %xmm4
psllq $0x20, %xmm4
paddq %xmm13, %xmm4
pxor %xmm13, %xmm13
pcmpgtd %xmm12, %xmm13
pmuludq %xmm0, %xmm12
pmuludq %xmm0, %xmm13
psllq $0x20, %xmm13
paddq %xmm12, %xmm13
psrlq $0x1e, %xmm13
psrlq $0x1e, %xmm4
shufps $0x88, %xmm13, %xmm4    # xmm4 = xmm4[0,2],xmm13[0,2]
movdqa %xmm1, %xmm12
paddd %xmm9, %xmm12
movdqu %xmm12, 0x20(%rdi,%rax,4)
psubd %xmm1, %xmm9
movdqu %xmm9, 0x100(%rdi,%rax,4)
movdqa %xmm11, %xmm1
paddd %xmm8, %xmm1
movdqu %xmm1, 0x40(%rdi,%rax,4)
andps %xmm2, %xmm4
psubd %xmm11, %xmm4
psubd %xmm11, %xmm8
movdqu %xmm8, 0xe0(%rdi,%rax,4)
movdqa %xmm4, %xmm1
paddd %xmm6, %xmm1
movdqu %xmm1, 0x60(%rdi,%rax,4)
pslld $0x2, %xmm10
paddd %xmm4, %xmm10
psubd %xmm4, %xmm6
movdqu %xmm6, 0xc0(%rdi,%rax,4)
movdqa %xmm10, %xmm1
paddd %xmm7, %xmm1
movdqu %xmm1, 0xa0(%rdi,%rax,4)
psubd %xmm10, %xmm7
movdqu %xmm7, 0x80(%rdi,%rax,4)
addq $0x4, %rax
jne 0x42362
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq