// File: /workspace/github_c_makefile_star2_O0/akumrao[P]videoAnalyzer/decoder/macroblock.c
// Function: x264_macroblock_decode(x264_t*, x264_macroblock_t*)
int x264_macroblock_decode(x264_t *h, x264_macroblock_t *mb) {LOG_CALL;
    x264_mb_context_t *ctx = mb->context;

    int i_qscale;
    int ch;
    int i;

    if (!IS_INTRA(mb->i_type))
    {
        /* Motion compensation */
        x264_mb_mc(h, mb);
    }

    /* luma */
    i_qscale = mb->i_qp;
    if (mb->i_type == I_16x16)
    {
        int i_mode = x264_mb_pred_mode16x16_valid(mb, mb->i_intra16x16_pred_mode);
        int16_t luma[16][4][4];
        int16_t dct4x4[16 + 1][4][4];


        /* do the right prediction */
        h->predict_16x16[i_mode](ctx->p_fdec[0], ctx->i_fdec[0]);

        /* get dc coeffs */
        unscan_zigzag_4x4full(dct4x4[0], mb->luma16x16_dc);
        h->dctf.idct4x4dc(dct4x4[0], dct4x4[0]);
        x264_mb_dequant_4x4_dc(dct4x4[0], i_qscale);

        /* decode the 16x16 macroblock */
        for (i = 0; i < 16; i++)
        {
            unscan_zigzag_4x4(dct4x4[1 + i], mb->block[i].residual_ac);
            x264_mb_dequant_4x4(dct4x4[1 + i], i_qscale);

            /* copy dc coeff */
            dct4x4[1 + i][0][0] = dct4x4[0][block_idx_y[i]][block_idx_x[i]];

            h->dctf.idct4x4(luma[i], dct4x4[i + 1]);
        }
        /* put pixels to fdec */
        h->pixf.add16x16(ctx->p_fdec[0], ctx->i_fdec[0], luma);
        dumpByte(ctx->p_fdec[0], 16,16);
       // printLong(ctx->p_fdec[0], 16,16);
    } else if (mb->i_type == I_4x4)
    {
        for (i = 0; i < 16; i++)
        {
            int16_t luma[4][4];
            int16_t dct4x4[4][4];

            uint8_t *p_dst_by;
            int i_mode;
            int b_emu;

            /* Do the right prediction */
            p_dst_by = ctx->p_fdec[0] + 4 * block_idx_x[i] + 4 * block_idx_y[i] * ctx->i_fdec[0];
            i_mode = x264_mb_pred_mode4x4_valid(mb, i, mb->block[i].i_intra4x4_pred_mode, &b_emu);
            if (b_emu)
            {
                fprintf(stderr, "mmmh b_emu\n");
                memset(&p_dst_by[4], p_dst_by[3], 4);
            }
            h->predict_4x4[i_mode](p_dst_by, ctx->i_fdec[0]);

            if (mb->block[i].i_non_zero_count > 0)
            {
                /* decode one 4x4 block */
                unscan_zigzag_4x4full(dct4x4, mb->block[i].luma4x4);

                x264_mb_dequant_4x4(dct4x4, i_qscale);

                h->dctf.idct4x4(luma, dct4x4);

                h->pixf.add4x4(p_dst_by, ctx->i_fdec[0], luma);
            }
        }
    } else /* Inter mb */
    {
        for (i = 0; i < 16; i++)
        {
            uint8_t *p_dst_by;
            int16_t luma[4][4];
            int16_t dct4x4[4][4];

            if (mb->block[i].i_non_zero_count > 0)
            {
                unscan_zigzag_4x4full(dct4x4, mb->block[i].luma4x4);
                x264_mb_dequant_4x4(dct4x4, i_qscale);

                h->dctf.idct4x4(luma, dct4x4);

                p_dst_by = ctx->p_fdec[0] + 4 * block_idx_x[i] + 4 * block_idx_y[i] * ctx->i_fdec[0];
                h->pixf.add4x4(p_dst_by, ctx->i_fdec[0], luma);
            }
        }
    }

    /* chroma */
    i_qscale = i_chroma_qp_table[x264_clip3(i_qscale + h->pps->i_chroma_qp_index_offset, 0, 51)];
    if (IS_INTRA(mb->i_type))
    {
        int i_mode = x264_mb_pred_mode8x8_valid(mb, mb->i_chroma_pred_mode);
        /* do the right prediction */
        h->predict_8x8[i_mode](ctx->p_fdec[1], ctx->i_fdec[1]);
        h->predict_8x8[i_mode](ctx->p_fdec[2], ctx->i_fdec[2]);
    }

    if (mb->i_cbp_chroma != 0)
    {
        for (ch = 0; ch < 2; ch++)
        {
            int16_t chroma[4][4][4];
            int16_t dct2x2[2][2];
            int16_t dct4x4[4][4][4];

            /* get dc chroma */
            unscan_zigzag_2x2_dc(dct2x2, mb->chroma_dc[ch]);
            h->dctf.idct2x2dc(dct2x2, dct2x2);
            x264_mb_dequant_2x2_dc(dct2x2, i_qscale);

            for (i = 0; i < 4; i++)
            {
                unscan_zigzag_4x4(dct4x4[i], mb->block[16 + i + ch * 4].residual_ac);
                x264_mb_dequant_4x4(dct4x4[i], i_qscale);

                /* copy dc coeff */
                dct4x4[i][0][0] = dct2x2[block_idx_y[i]][block_idx_x[i]];

                h->dctf.idct4x4(chroma[i], dct4x4[i]);
            }
            h->pixf.add8x8(ctx->p_fdec[1 + ch], ctx->i_fdec[1 + ch], chroma);
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x610, %rsp            # imm = 0x610
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq 0x16206(%rip), %rdi     # 0x28eb0
leaq 0x18f1f(%rip), %rsi     # 0x2bbd0
leaq 0x19070(%rip), %rdx     # 0x2bd28
movb $0x0, %al
callq 0x4d20
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x18(%rax)
je 0x12cec
movq -0x10(%rbp), %rax
cmpl $0x1, 0x18(%rax)
je 0x12cec
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x8a40
movq -0x10(%rbp), %rax
movl 0x2b0(%rax), %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x1, 0x18(%rax)
jne 0x12eb0
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x2bc(%rax), %esi
callq 0x133c0
movl %eax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movslq -0x28(%rbp), %rcx
movq 0x10f1d8(%rax,%rcx,8), %rax
movq -0x18(%rbp), %rcx
movq 0x40(%rcx), %rdi
movq -0x18(%rbp), %rcx
movl 0x58(%rcx), %esi
callq *%rax
leaq -0x450(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x2c4, %rsi            # imm = 0x2C4
callq 0x134c0
movq -0x8(%rbp), %rax
movq 0x10f3b0(%rax), %rax
leaq -0x450(%rbp), %rdi
leaq -0x450(%rbp), %rsi
callq *%rax
leaq -0x450(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x7770
movl $0x0, -0x24(%rbp)
cmpl $0x10, -0x24(%rbp)
jge 0x12e74
movl -0x24(%rbp), %eax
addl $0x1, %eax
cltq
leaq -0x450(%rbp), %rdi
shlq $0x5, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rsi
addq $0x324, %rsi            # imm = 0x324
movslq -0x24(%rbp), %rax
imulq $0x84, %rax, %rax
addq %rax, %rsi
addq $0x8, %rsi
callq 0x13550
movl -0x24(%rbp), %eax
addl $0x1, %eax
cltq
leaq -0x450(%rbp), %rdi
shlq $0x5, %rax
addq %rax, %rdi
movl -0x1c(%rbp), %esi
callq 0x7900
leaq -0x450(%rbp), %rax
movslq -0x24(%rbp), %rdx
leaq 0x18bd8(%rip), %rcx     # 0x2b9d0
movzbl (%rcx,%rdx), %ecx
shlq $0x3, %rcx
addq %rcx, %rax
movslq -0x24(%rbp), %rdx
leaq 0x18bd2(%rip), %rcx     # 0x2b9e0
movzbl (%rcx,%rdx), %ecx
movw (%rax,%rcx,2), %cx
movl -0x24(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
leaq -0x450(%rbp), %rax
shlq $0x5, %rdx
addq %rdx, %rax
movw %cx, (%rax)
movq -0x8(%rbp), %rax
movq 0x10f3a8(%rax), %rax
movslq -0x24(%rbp), %rcx
leaq -0x230(%rbp), %rdi
shlq $0x5, %rcx
addq %rcx, %rdi
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
leaq -0x450(%rbp), %rsi
shlq $0x5, %rcx
addq %rcx, %rsi
callq *%rax
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x12d86
movq -0x8(%rbp), %rax
movq 0x10f378(%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x40(%rcx), %rdi
movq -0x18(%rbp), %rcx
movl 0x58(%rcx), %esi
leaq -0x230(%rbp), %rdx
callq *%rax
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rdi
movl $0x10, %edx
movl %edx, %esi
callq 0x4f80
jmp 0x1315b
movq -0x10(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jne 0x13058
movl $0x0, -0x24(%rbp)
cmpl $0x10, -0x24(%rbp)
jge 0x13053
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x24(%rbp), %rdx
leaq 0x18afe(%rip), %rcx     # 0x2b9e0
movzbl (%rcx,%rdx), %ecx
shll $0x2, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movslq -0x24(%rbp), %rdx
leaq 0x18ad6(%rip), %rcx     # 0x2b9d0
movzbl (%rcx,%rdx), %ecx
shll $0x2, %ecx
movq -0x18(%rbp), %rdx
imull 0x58(%rdx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x498(%rbp)
movq -0x10(%rbp), %rdi
movl -0x24(%rbp), %esi
movq -0x10(%rbp), %rax
addq $0x324, %rax            # imm = 0x324
movslq -0x24(%rbp), %rcx
imulq $0x84, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %edx
leaq -0x4a0(%rbp), %rcx
callq 0x135e0
movl %eax, -0x49c(%rbp)
cmpl $0x0, -0x4a0(%rbp)
je 0x12f8d
movq 0x23077(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
leaq 0x18ddc(%rip), %rsi     # 0x2bd3f
movb $0x0, %al
callq 0x2160
movq -0x498(%rbp), %rdi
addq $0x4, %rdi
movq -0x498(%rbp), %rax
movzbl 0x3(%rax), %eax
movl $0x4, %edx
movzbl %al, %esi
callq 0x2070
movq -0x8(%rbp), %rax
movslq -0x49c(%rbp), %rcx
movq 0x10f248(%rax,%rcx,8), %rax
movq -0x498(%rbp), %rdi
movq -0x18(%rbp), %rcx
movl 0x58(%rcx), %esi
callq *%rax
movq -0x10(%rbp), %rax
addq $0x324, %rax            # imm = 0x324
movslq -0x24(%rbp), %rcx
imulq $0x84, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x4(%rax)
jle 0x13043
leaq -0x490(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x324, %rsi            # imm = 0x324
movslq -0x24(%rbp), %rax
imulq $0x84, %rax, %rax
addq %rax, %rsi
addq $0x44, %rsi
callq 0x134c0
leaq -0x490(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x7900
movq -0x8(%rbp), %rax
movq 0x10f3a8(%rax), %rax
leaq -0x470(%rbp), %rdi
leaq -0x490(%rbp), %rsi
callq *%rax
movq -0x8(%rbp), %rax
movq 0x10f368(%rax), %rax
movq -0x498(%rbp), %rdi
movq -0x18(%rbp), %rcx
movl 0x58(%rcx), %esi
leaq -0x470(%rbp), %rdx
callq *%rax
jmp 0x13045
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x12ec5
jmp 0x13159
movl $0x0, -0x24(%rbp)
cmpl $0x10, -0x24(%rbp)
jge 0x13157
movq -0x10(%rbp), %rax
addq $0x324, %rax            # imm = 0x324
movslq -0x24(%rbp), %rcx
imulq $0x84, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x4(%rax)
jle 0x13147
leaq -0x4f0(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x324, %rsi            # imm = 0x324
movslq -0x24(%rbp), %rax
imulq $0x84, %rax, %rax
addq %rax, %rsi
addq $0x44, %rsi
callq 0x134c0
leaq -0x4f0(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x7900
movq -0x8(%rbp), %rax
movq 0x10f3a8(%rax), %rax
leaq -0x4d0(%rbp), %rdi
leaq -0x4f0(%rbp), %rsi
callq *%rax
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x24(%rbp), %rdx
leaq 0x188ef(%rip), %rcx     # 0x2b9e0
movzbl (%rcx,%rdx), %ecx
shll $0x2, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movslq -0x24(%rbp), %rdx
leaq 0x188c7(%rip), %rcx     # 0x2b9d0
movzbl (%rcx,%rdx), %ecx
shll $0x2, %ecx
movq -0x18(%rbp), %rdx
imull 0x58(%rdx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x4a8(%rbp)
movq -0x8(%rbp), %rax
movq 0x10f368(%rax), %rax
movq -0x4a8(%rbp), %rdi
movq -0x18(%rbp), %rcx
movl 0x58(%rcx), %esi
leaq -0x4d0(%rbp), %rdx
callq *%rax
jmp 0x13149
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1305f
jmp 0x13159
jmp 0x1315b
movl -0x1c(%rbp), %edi
movq -0x8(%rbp), %rax
movq 0x10dae0(%rax), %rax
addl 0x103c(%rax), %edi
xorl %esi, %esi
movl $0x33, %edx
callq 0x137d0
movslq %eax, %rcx
leaq 0x1886b(%rip), %rax     # 0x2b9f0
movl (%rax,%rcx,4), %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x18(%rax)
je 0x1319f
movq -0x10(%rbp), %rax
cmpl $0x1, 0x18(%rax)
jne 0x13200
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x2c0(%rax), %esi
callq 0x13810
movl %eax, -0x4f4(%rbp)
movq -0x8(%rbp), %rax
movslq -0x4f4(%rbp), %rcx
movq 0x10f210(%rax,%rcx,8), %rax
movq -0x18(%rbp), %rcx
movq 0x48(%rcx), %rdi
movq -0x18(%rbp), %rcx
movl 0x5c(%rcx), %esi
callq *%rax
movq -0x8(%rbp), %rax
movslq -0x4f4(%rbp), %rcx
movq 0x10f210(%rax,%rcx,8), %rax
movq -0x18(%rbp), %rcx
movq 0x50(%rcx), %rdi
movq -0x18(%rbp), %rcx
movl 0x60(%rcx), %esi
callq *%rax
movq -0x10(%rbp), %rax
cmpl $0x0, 0x2b4(%rax)
je 0x133a6
movl $0x0, -0x20(%rbp)
cmpl $0x2, -0x20(%rbp)
jge 0x133a4
leaq -0x588(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x304, %rsi            # imm = 0x304
movslq -0x20(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rsi
callq 0x13910
movq -0x8(%rbp), %rax
movq 0x10f3c0(%rax), %rax
leaq -0x588(%rbp), %rdi
leaq -0x588(%rbp), %rsi
callq *%rax
leaq -0x588(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x7610
movl $0x0, -0x24(%rbp)
cmpl $0x4, -0x24(%rbp)
jge 0x1335f
movslq -0x24(%rbp), %rax
leaq -0x610(%rbp), %rdi
shlq $0x5, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rsi
addq $0x324, %rsi            # imm = 0x324
movl -0x24(%rbp), %eax
addl $0x10, %eax
movl -0x20(%rbp), %ecx
shll $0x2, %ecx
addl %ecx, %eax
cltq
imulq $0x84, %rax, %rax
addq %rax, %rsi
addq $0x8, %rsi
callq 0x13550
movslq -0x24(%rbp), %rax
leaq -0x610(%rbp), %rdi
shlq $0x5, %rax
addq %rax, %rdi
movl -0x1c(%rbp), %esi
callq 0x7900
movslq -0x24(%rbp), %rcx
leaq 0x186ec(%rip), %rax     # 0x2b9d0
movzbl (%rax,%rcx), %eax
movl %eax, %ecx
leaq -0x588(%rbp), %rax
shlq $0x2, %rcx
addq %rcx, %rax
movslq -0x24(%rbp), %rdx
leaq 0x186dd(%rip), %rcx     # 0x2b9e0
movzbl (%rcx,%rdx), %ecx
movw (%rax,%rcx,2), %cx
movslq -0x24(%rbp), %rdx
leaq -0x610(%rbp), %rax
shlq $0x5, %rdx
addq %rdx, %rax
movw %cx, (%rax)
movq -0x8(%rbp), %rax
movq 0x10f3a8(%rax), %rax
movslq -0x24(%rbp), %rcx
leaq -0x580(%rbp), %rdi
shlq $0x5, %rcx
addq %rcx, %rdi
movslq -0x24(%rbp), %rcx
leaq -0x610(%rbp), %rsi
shlq $0x5, %rcx
addq %rcx, %rsi
callq *%rax
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x13275
movq -0x8(%rbp), %rax
movq 0x10f370(%rax), %rax
movq -0x18(%rbp), %rcx
movl -0x20(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
movq 0x40(%rcx,%rdx,8), %rdi
movq -0x18(%rbp), %rcx
movl -0x20(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
movl 0x58(%rcx,%rdx,4), %esi
leaq -0x580(%rbp), %rdx
callq *%rax
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x13218
jmp 0x133a6
xorl %eax, %eax
addq $0x610, %rsp            # imm = 0x610
popq %rbp
retq
nopw %cs:(%rax,%rax)