// File: OpenFirework[P]MyJPEG_Decoder/./jpeg/jpeg_decoder.cpp
// Function: MCU::idct()
void idct() {
        for (int id = 1; id <= 3; id++) {
            for (int h = 0; h < subVector[id].height; h++) {
                for (int w = 0; w < subVector[id].width; w++) {
                    //逆离散余弦变换的结果暂存到out数组
                    double out[8][8] = {0};
		    //逆离散余弦变换计算过程
		   /*
                    for(int i=0; i<8; i++) {
                        for(int j=0; j<8; j++) {
                            float temp = 0.0;
                            for(int u=0; u<8; u++) {
                                for(int v=0; v<8; v++) {
                                    temp += cu[u]*cv[v]*mcu[id][h][w][u][v]*cos_cache[(2*i+1)*u]*cos_cache[(2*j+1)*v];
                                }
                            }       
                            out[i][j] = temp;
                        }
                    }*/
	           //优化
		    double s[8][8] = {};
		    for (int j = 0; j < 8; j++) {
			for (int x = 0; x < 8; x++) {
			    for (int y = 0; y < 8; y++) {
				s[j][x] += cu[y] * mcu[id][h][w][x][y] * cos_cache[(j + j + 1) * y];
			    }
			}
		    }                    
		    for (int i = 0; i < 8; i++) {
			for (int j = 0; j < 8; j++) {
			    for (int x = 0; x < 8; x++) {
				out[i][j] += cu[x] * s[j][x] * cos_cache[(i + i + 1) * x];
			    }
			}
		    }
                    //存回mcu中
                    for (int i = 0; i < 8; i++) {
                        for (int j = 0; j < 8; j++) {
                            mcu[id][h][w][i][j] = out[i][j];
                        }
                    }
                }
            }
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x450, %rsp            # imm = 0x450
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x448(%rbp)
movl $0x1, -0xc(%rbp)
cmpl $0x3, -0xc(%rbp)
jg 0x56b2
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movslq -0xc(%rbp), %rdx
leaq 0x6d90(%rip), %rcx      # 0xc0d0
movzbl 0x2(%rcx,%rdx,4), %ecx
cmpl %ecx, %eax
jge 0x56a2
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movslq -0xc(%rbp), %rdx
leaq 0x6d6e(%rip), %rcx      # 0xc0d0
movzbl 0x1(%rcx,%rdx,4), %ecx
cmpl %ecx, %eax
jge 0x5692
leaq -0x220(%rbp), %rdi
xorl %esi, %esi
movl $0x200, %edx            # imm = 0x200
callq 0x20c0
leaq -0x420(%rbp), %rdi
xorl %esi, %esi
movl $0x200, %edx            # imm = 0x200
callq 0x20c0
movl $0x0, -0x424(%rbp)
cmpl $0x8, -0x424(%rbp)
jge 0x54c2
movl $0x0, -0x428(%rbp)
cmpl $0x8, -0x428(%rbp)
jge 0x54ac
movl $0x0, -0x42c(%rbp)
cmpl $0x8, -0x42c(%rbp)
jge 0x5496
movq -0x448(%rbp), %rax
movslq -0x42c(%rbp), %rdx
leaq 0x5da1(%rip), %rcx      # 0xb190
movsd (%rcx,%rdx,8), %xmm0
movslq -0xc(%rbp), %rcx
shlq $0xb, %rcx
addq %rcx, %rax
movslq -0x10(%rbp), %rcx
shlq $0xa, %rcx
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
shlq $0x9, %rcx
addq %rcx, %rax
movslq -0x428(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movslq -0x42c(%rbp), %rcx
mulsd (%rax,%rcx,8), %xmm0
movl -0x424(%rbp), %eax
addl -0x424(%rbp), %eax
addl $0x1, %eax
imull -0x42c(%rbp), %eax
movslq %eax, %rcx
leaq 0x5dc1(%rip), %rax      # 0xb210
movsd (%rax,%rcx,8), %xmm2
movslq -0x424(%rbp), %rcx
leaq -0x420(%rbp), %rax
shlq $0x6, %rcx
addq %rcx, %rax
movslq -0x428(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x42c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x42c(%rbp)
jmp 0x53cd
jmp 0x5498
movl -0x428(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x428(%rbp)
jmp 0x53b6
jmp 0x54ae
movl -0x424(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x424(%rbp)
jmp 0x539f
movl $0x0, -0x430(%rbp)
cmpl $0x8, -0x430(%rbp)
jge 0x55ce
movl $0x0, -0x434(%rbp)
cmpl $0x8, -0x434(%rbp)
jge 0x55b8
movl $0x0, -0x438(%rbp)
cmpl $0x8, -0x438(%rbp)
jge 0x55a2
movslq -0x438(%rbp), %rcx
leaq 0x5c7b(%rip), %rax      # 0xb190
movsd (%rax,%rcx,8), %xmm0
movslq -0x434(%rbp), %rcx
leaq -0x420(%rbp), %rax
shlq $0x6, %rcx
addq %rcx, %rax
movslq -0x438(%rbp), %rcx
mulsd (%rax,%rcx,8), %xmm0
movl -0x430(%rbp), %eax
addl -0x430(%rbp), %eax
addl $0x1, %eax
imull -0x438(%rbp), %eax
movslq %eax, %rcx
leaq 0x5cb5(%rip), %rax      # 0xb210
movsd (%rax,%rcx,8), %xmm2
movslq -0x430(%rbp), %rcx
leaq -0x220(%rbp), %rax
shlq $0x6, %rcx
addq %rcx, %rax
movslq -0x434(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x438(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x438(%rbp)
jmp 0x54fa
jmp 0x55a4
movl -0x434(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x434(%rbp)
jmp 0x54e3
jmp 0x55ba
movl -0x430(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x430(%rbp)
jmp 0x54cc
movl $0x0, -0x43c(%rbp)
cmpl $0x8, -0x43c(%rbp)
jge 0x5682
movl $0x0, -0x440(%rbp)
cmpl $0x8, -0x440(%rbp)
jge 0x566c
movq -0x448(%rbp), %rax
movslq -0x43c(%rbp), %rdx
leaq -0x220(%rbp), %rcx
shlq $0x6, %rdx
addq %rdx, %rcx
movslq -0x440(%rbp), %rdx
movsd (%rcx,%rdx,8), %xmm0
movslq -0xc(%rbp), %rcx
shlq $0xb, %rcx
addq %rcx, %rax
movslq -0x10(%rbp), %rcx
shlq $0xa, %rcx
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
shlq $0x9, %rcx
addq %rcx, %rax
movslq -0x43c(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movslq -0x440(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x440(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x440(%rbp)
jmp 0x55ef
jmp 0x566e
movl -0x43c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x43c(%rbp)
jmp 0x55d8
jmp 0x5684
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x5354
jmp 0x5694
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x5332
jmp 0x56a4
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x5321
addq $0x450, %rsp            # imm = 0x450
popq %rbp
retq
nopl (%rax,%rax)