// File: OpenFirework[P]MyJPEG_Decoder/./jpeg/jpeg_decoder.cpp
// Function: MCU::izigzag()
void izigzag() {
        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++) {
                    //8*8的数组拉直，暂时存储到input数组中
                    int input[64];
                    for (int i = 0; i < 8; i++) {
                        for (int j = 0; j < 8; j++) {
                            input[i*8+j] = mcu[id][h][w][i][j];
                        }
                    }
                    //逆向zaizag,并存回到mcu
                    int k =0;
                    for(int index = 0; index < 15;index++) {
                        for(int i=0;i<8;i++){
                            for(int j=0;j<8;j++) {
                                if(i+j == index) {
                                    if(index%2 == 0) {
                                        mcu[id][h][w][j][i] = input[k];
                                        k++;
                                    } else {
                                        mcu[id][h][w][i][j] = input[k];
                                        k++;
                                    }
                                }
                            }
                        }
                    }
                    //逆向zaizag
                }
            }
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x140(%rbp)
movl $0x1, -0xc(%rbp)
cmpl $0x3, -0xc(%rbp)
jg 0x52ec
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movslq -0xc(%rbp), %rdx
leaq 0x7070(%rip), %rcx      # 0xc0d0
movzbl 0x2(%rcx,%rdx,4), %ecx
cmpl %ecx, %eax
jge 0x52dc
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movslq -0xc(%rbp), %rdx
leaq 0x704e(%rip), %rcx      # 0xc0d0
movzbl 0x1(%rcx,%rdx,4), %ecx
cmpl %ecx, %eax
jge 0x52cc
movl $0x0, -0x124(%rbp)
cmpl $0x8, -0x124(%rbp)
jge 0x513a
movl $0x0, -0x128(%rbp)
cmpl $0x8, -0x128(%rbp)
jge 0x5124
movq -0x140(%rbp), %rax
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 -0x124(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movslq -0x128(%rbp), %rcx
cvttsd2si (%rax,%rcx,8), %ecx
movl -0x124(%rbp), %eax
shll $0x3, %eax
addl -0x128(%rbp), %eax
cltq
movl %ecx, -0x120(%rbp,%rax,4)
movl -0x128(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x128(%rbp)
jmp 0x50b0
jmp 0x5126
movl -0x124(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x124(%rbp)
jmp 0x5099
movl $0x0, -0x12c(%rbp)
movl $0x0, -0x130(%rbp)
cmpl $0xf, -0x130(%rbp)
jge 0x52bc
movl $0x0, -0x134(%rbp)
cmpl $0x8, -0x134(%rbp)
jge 0x52a6
movl $0x0, -0x138(%rbp)
cmpl $0x8, -0x138(%rbp)
jge 0x5290
movl -0x134(%rbp), %eax
addl -0x138(%rbp), %eax
cmpl -0x130(%rbp), %eax
jne 0x527a
movl -0x130(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x5217
movq -0x140(%rbp), %rax
movslq -0x12c(%rbp), %rcx
cvtsi2sdl -0x120(%rbp,%rcx,4), %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 -0x138(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movslq -0x134(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x12c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x12c(%rbp)
jmp 0x5278
movq -0x140(%rbp), %rax
movslq -0x12c(%rbp), %rcx
cvtsi2sdl -0x120(%rbp,%rcx,4), %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 -0x134(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movslq -0x138(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x12c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x12c(%rbp)
jmp 0x527a
jmp 0x527c
movl -0x138(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x138(%rbp)
jmp 0x517c
jmp 0x5292
movl -0x134(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x134(%rbp)
jmp 0x5165
jmp 0x52a8
movl -0x130(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x130(%rbp)
jmp 0x514e
jmp 0x52be
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x5074
jmp 0x52ce
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x5052
jmp 0x52de
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x5041
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop