// File: /workspace/github_c_makefile_star2_O2/phoboslab[P]pl_mpeg/./pl_mpeg.h
// Function: plm_video_idct
void plm_video_idct(int *block) {
	int
		b1, b3, b4, b6, b7, tmp1, tmp2, m0,
		x0, x1, x2, x3, x4, y3, y4, y5, y6, y7;

	// Transform columns
	for (int i = 0; i < 8; ++i) {
		b1 = block[4 * 8 + i];
		b3 = block[2 * 8 + i] + block[6 * 8 + i];
		b4 = block[5 * 8 + i] - block[3 * 8 + i];
		tmp1 = block[1 * 8 + i] + block[7 * 8 + i];
		tmp2 = block[3 * 8 + i] + block[5 * 8 + i];
		b6 = block[1 * 8 + i] - block[7 * 8 + i];
		b7 = tmp1 + tmp2;
		m0 = block[0 * 8 + i];
		x4 = ((b6 * 473 - b4 * 196 + 128) >> 8) - b7;
		x0 = x4 - (((tmp1 - tmp2) * 362 + 128) >> 8);
		x1 = m0 - b1;
		x2 = (((block[2 * 8 + i] - block[6 * 8 + i]) * 362 + 128) >> 8) - b3;
		x3 = m0 + b1;
		y3 = x1 + x2;
		y4 = x3 + b3;
		y5 = x1 - x2;
		y6 = x3 - b3;
		y7 = -x0 - ((b4 * 473 + b6 * 196 + 128) >> 8);
		block[0 * 8 + i] = b7 + y4;
		block[1 * 8 + i] = x4 + y3;
		block[2 * 8 + i] = y5 - x0;
		block[3 * 8 + i] = y6 - y7;
		block[4 * 8 + i] = y6 + y7;
		block[5 * 8 + i] = x0 + y5;
		block[6 * 8 + i] = y3 - x4;
		block[7 * 8 + i] = y4 - b7;
	}

	// Transform rows
	for (int i = 0; i < 64; i += 8) {
		b1 = block[4 + i];
		b3 = block[2 + i] + block[6 + i];
		b4 = block[5 + i] - block[3 + i];
		tmp1 = block[1 + i] + block[7 + i];
		tmp2 = block[3 + i] + block[5 + i];
		b6 = block[1 + i] - block[7 + i];
		b7 = tmp1 + tmp2;
		m0 = block[0 + i];
		x4 = ((b6 * 473 - b4 * 196 + 128) >> 8) - b7;
		x0 = x4 - (((tmp1 - tmp2) * 362 + 128) >> 8);
		x1 = m0 - b1;
		x2 = (((block[2 + i] - block[6 + i]) * 362 + 128) >> 8) - b3;
		x3 = m0 + b1;
		y3 = x1 + x2;
		y4 = x3 + b3;
		y5 = x1 - x2;
		y6 = x3 - b3;
		y7 = -x0 - ((b4 * 473 + b6 * 196 + 128) >> 8);
		block[0 + i] = (b7 + y4 + 128) >> 8;
		block[1 + i] = (x4 + y3 + 128) >> 8;
		block[2 + i] = (y5 - x0 + 128) >> 8;
		block[3 + i] = (y6 - y7 + 128) >> 8;
		block[4 + i] = (y6 + y7 + 128) >> 8;
		block[5 + i] = (x0 + y5 + 128) >> 8;
		block[6 + i] = (y3 - x4 + 128) >> 8;
		block[7 + i] = (y4 - b7 + 128) >> 8;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movabsq $-0x20, %rax
movl $0x80, %ecx
testq %rax, %rax
je 0x53fc
movl 0xa0(%rdi,%rax), %r8d
movl 0x60(%rdi,%rax), %r15d
movl 0xe0(%rdi,%rax), %r12d
leal (%r12,%r15), %r9d
movl 0xc0(%rdi,%rax), %ebx
movl 0x80(%rdi,%rax), %esi
movl %ebx, %r10d
subl %esi, %r10d
movl 0x20(%rdi,%rax), %edx
movl 0x40(%rdi,%rax), %r11d
movl 0x100(%rdi,%rax), %r14d
leal (%r14,%r11), %r13d
addl %esi, %ebx
subl %r14d, %r11d
leal (%rbx,%r13), %esi
imull $0x1d9, %r11d, %ebp     # imm = 0x1D9
imull $0xffffff3c, %r10d, %r14d # imm = 0xFFFFFF3C
addl %ebp, %r14d
addl %ecx, %r14d
sarl $0x8, %r14d
subl %esi, %r14d
subl %ebx, %r13d
imull $0x16a, %r13d, %ebp     # imm = 0x16A
addl %ecx, %ebp
sarl $0x8, %ebp
movl %edx, %ebx
subl %r8d, %ebx
subl %r12d, %r15d
imull $0x16a, %r15d, %r12d    # imm = 0x16A
addl %ecx, %r12d
sarl $0x8, %r12d
subl %r9d, %r12d
leal (%rbx,%r12), %r15d
leal (%r14,%r15), %r13d
subl %r14d, %r15d
subl %ebp, %r14d
addl %r8d, %edx
leal (%rdx,%r9), %r8d
subl %r12d, %ebx
subl %r9d, %edx
imull $0x1d9, %r10d, %r9d     # imm = 0x1D9
imull $0xc4, %r11d, %r10d
addl %r9d, %r10d
addl %ecx, %r10d
sarl $0x8, %r10d
addl %r14d, %r10d
leal (%r8,%rsi), %r9d
movl %r9d, 0x20(%rdi,%rax)
movl %r13d, 0x40(%rdi,%rax)
movl %ebx, %r9d
subl %r14d, %r9d
movl %r9d, 0x60(%rdi,%rax)
leal (%r10,%rdx), %r9d
movl %r9d, 0x80(%rdi,%rax)
subl %r10d, %edx
movl %edx, 0xa0(%rdi,%rax)
addl %r14d, %ebx
movl %ebx, 0xc0(%rdi,%rax)
movl %r15d, 0xe0(%rdi,%rax)
subl %esi, %r8d
movl %r8d, 0x100(%rdi,%rax)
addq $0x4, %rax
jmp 0x52da
xorl %eax, %eax
movl $0x80, %ecx
cmpq $0x40, %rax
jae 0x5545
movl 0x10(%rdi,%rax,4), %r8d
movl 0x8(%rdi,%rax,4), %r15d
movl 0x18(%rdi,%rax,4), %r12d
leal (%r12,%r15), %r9d
movl 0x14(%rdi,%rax,4), %ebx
movl 0xc(%rdi,%rax,4), %edx
movl %ebx, %r10d
subl %edx, %r10d
movl (%rdi,%rax,4), %esi
movl 0x4(%rdi,%rax,4), %r11d
movl 0x1c(%rdi,%rax,4), %r14d
leal (%r14,%r11), %r13d
addl %edx, %ebx
subl %r14d, %r11d
leal (%rbx,%r13), %edx
imull $0x1d9, %r11d, %ebp     # imm = 0x1D9
imull $0xffffff3c, %r10d, %r14d # imm = 0xFFFFFF3C
addl %ebp, %r14d
addl %ecx, %r14d
sarl $0x8, %r14d
subl %edx, %r14d
subl %ebx, %r13d
imull $0x16a, %r13d, %ebp     # imm = 0x16A
addl %ecx, %ebp
sarl $0x8, %ebp
movl %esi, %ebx
subl %r8d, %ebx
subl %r12d, %r15d
imull $0x16a, %r15d, %r15d    # imm = 0x16A
addl %ecx, %r15d
sarl $0x8, %r15d
subl %r9d, %r15d
leal (%rbx,%r15), %r12d
leal (%r14,%r12), %r13d
addl $0x80, %r13d
addl %ecx, %r12d
subl %r14d, %r12d
subl %ebp, %r14d
addl %r8d, %esi
leal (%rsi,%r9), %r8d
subl %r15d, %ebx
subl %r9d, %esi
imull $0x1d9, %r10d, %r9d     # imm = 0x1D9
imull $0xc4, %r11d, %r10d
addl %r9d, %r10d
addl %ecx, %r10d
sarl $0x8, %r10d
addl %r14d, %r10d
leal (%rdx,%r8), %r9d
addl %ecx, %r9d
sarl $0x8, %r9d
movl %r9d, (%rdi,%rax,4)
sarl $0x8, %r13d
movl %r13d, 0x4(%rdi,%rax,4)
leal (%rbx,%rcx), %r9d
subl %r14d, %r9d
sarl $0x8, %r9d
movl %r9d, 0x8(%rdi,%rax,4)
leal (%rsi,%r10), %r9d
addl $0x80, %r9d
addl %ecx, %esi
sarl $0x8, %r9d
movl %r9d, 0xc(%rdi,%rax,4)
subl %r10d, %esi
sarl $0x8, %esi
movl %esi, 0x10(%rdi,%rax,4)
leal (%rbx,%r14), %esi
addl $0x80, %esi
sarl $0x8, %esi
movl %esi, 0x14(%rdi,%rax,4)
sarl $0x8, %r12d
movl %r12d, 0x18(%rdi,%rax,4)
subl %edx, %r8d
addl %ecx, %r8d
sarl $0x8, %r8d
movl %r8d, 0x1c(%rdi,%rax,4)
addq $0x8, %rax
jmp 0x5403
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq