// File: /workspace/github_c_makefile_star2_O0/akumrao[P]videoAnalyzer/core/frame.c
// Function: x264_frame_deblocking_filter(x264_t*, int)
void x264_frame_deblocking_filter( x264_t *h, int i_slice_type )
{
    int mb_xy;

    for( mb_xy = 0; mb_xy < h->sps->i_mb_width * h->sps->i_mb_height; mb_xy++ )
    {
        x264_macroblock_t *mb;  /* current macroblock */
        int i_edge;
        int i_dir;

        mb = &h->mb[mb_xy];

        /* i_dir == 0 -> vertical edge
         * i_dir == 1 -> horizontal edge */
        for( i_dir = 0; i_dir < 2; i_dir++ )
        {
            int i_start;
            int i_QP;

            i_start = (( i_dir == 0 && mb->i_mb_x != 0 ) || ( i_dir == 1 && mb->i_mb_y != 0 ) ) ? 0 : 1;

            for( i_edge = i_start; i_edge < 4; i_edge++ )
            {
                x264_macroblock_t *mbn;
                int bS[4];  /* filtering strength */

                /* *** neighbour macroblock for the current edge (or current) *** */
                mbn = i_edge > 0 ? mb : ( i_dir == 0 ? mb - 1 : mb - h->sps->i_mb_width );

                /* *** Get bS for each 4px for the current edge *** */
                if( IS_INTRA( mb->i_type ) || IS_INTRA( mbn->i_type ) )
                {
                    bS[0] = bS[1] = bS[2] = bS[3] = ( i_edge == 0 ? 4 : 3 );
                }
                else
                {
                    int i;
                    for( i = 0; i < 4; i++ )
                    {
                        int x, y;
                        int xn, yn;

                        x = i_dir == 0 ? i_edge : i;
                        y = i_dir == 0 ? i      : i_edge;

                        xn = (x - (i_dir == 0 ? 1 : 0 ))&0x03;
                        yn = (y - (i_dir == 0 ? 0 : 1 ))&0x03;

                        if( mb->block[block_idx_xy[x][y]].i_non_zero_count != 0 ||
                            mbn->block[block_idx_xy[xn][yn]].i_non_zero_count != 0 )
                        {
                            bS[i] = 2;
                        }
                        else if( i_slice_type == SLICE_TYPE_B )
                        {
                            /* FIXME */
                            fprintf( stderr, "deblocking filter doesn't work yet with B slice\n" );
                            return;
                        }
                        else    /* SLICE_TYPE_P */
                        {
                            if( mb->partition[x][y].i_ref[0]  != mbn->partition[xn][yn].i_ref[0] ||
                                abs( mb->partition[x][y].mv[0][0] - mbn->partition[xn][yn].mv[0][0] ) >= 4 ||
                                abs( mb->partition[x][y].mv[0][1] - mbn->partition[xn][yn].mv[0][1] ) >= 4 )
                            {
                                bS[i] = 1;
                            }
                            else
                            {
                                bS[i] = 0;
                            }
                        }
                    }
                }

                /* *** filter *** */
                /* Y plane */
                i_QP = ( mb->i_qp + mbn->i_qp + 1 ) >> 1;
                if( i_dir == 0 )
                {
                    /* vertical edge */
                    deblocking_filter_edgev( h, &h->fdec->plane[0][16 * mb->i_mb_y * h->fdec->i_stride[0]+ 16 * mb->i_mb_x + 4 * i_edge],
                                                h->fdec->i_stride[0], bS, i_QP );
                    if( (i_edge % 2) == 0  )
                    {
                        /* U/V planes */
                        i_QP = ( i_chroma_qp_table[mb->i_qp] + i_chroma_qp_table[mbn->i_qp] + 1 ) >> 1;
                        deblocking_filter_edgecv( h, &h->fdec->plane[1][8*(mb->i_mb_y*h->fdec->i_stride[1]+mb->i_mb_x)+i_edge*2],
                                                      h->fdec->i_stride[1], bS, i_QP );
                        deblocking_filter_edgecv( h, &h->fdec->plane[2][8*(mb->i_mb_y*h->fdec->i_stride[2]+mb->i_mb_x)+i_edge*2],
                                                  h->fdec->i_stride[2], bS, i_QP );
                    }
                }
                else
                {
                    /* horizontal edge */
                    deblocking_filter_edgeh( h, &h->fdec->plane[0][(16*mb->i_mb_y + 4 * i_edge) * h->fdec->i_stride[0]+ 16 * mb->i_mb_x],
                                                h->fdec->i_stride[0], bS, i_QP );
                    /* U/V planes */
                    if( ( i_edge % 2  ) == 0 )
                    {
                        i_QP = ( i_chroma_qp_table[mb->i_qp] + i_chroma_qp_table[mbn->i_qp] + 1 ) >> 1;
                        deblocking_filter_edgech( h, &h->fdec->plane[1][8*(mb->i_mb_y*h->fdec->i_stride[1]+mb->i_mb_x)+i_edge*2*h->fdec->i_stride[1]],
                                                 h->fdec->i_stride[1], bS, i_QP );
                        deblocking_filter_edgech( h, &h->fdec->plane[2][8*(mb->i_mb_y*h->fdec->i_stride[2]+mb->i_mb_x)+i_edge*2*h->fdec->i_stride[2]],
                                                 h->fdec->i_stride[2], bS, i_QP );
                    }
                }
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movq -0x8(%rbp), %rcx
movq 0x8ed8(%rcx), %rcx
movl 0x43c(%rcx), %ecx
movq -0x8(%rbp), %rdx
movq 0x8ed8(%rdx), %rdx
imull 0x440(%rdx), %ecx
cmpl %ecx, %eax
jge 0x6167
movq -0x8(%rbp), %rax
movq 0x10efe8(%rax), %rax
movslq -0x10(%rbp), %rcx
imulq $0xf88, %rcx, %rcx      # imm = 0xF88
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0x20(%rbp)
cmpl $0x2, -0x20(%rbp)
jge 0x6157
cmpl $0x0, -0x20(%rbp)
jne 0x5b16
movq -0x18(%rbp), %rcx
movb $0x1, %al
cmpl $0x0, (%rcx)
movb %al, -0x55(%rbp)
jne 0x5b35
xorl %eax, %eax
cmpl $0x1, -0x20(%rbp)
movb %al, -0x56(%rbp)
jne 0x5b2f
movq -0x18(%rbp), %rax
cmpl $0x0, 0x4(%rax)
setne %al
movb %al, -0x56(%rbp)
movb -0x56(%rbp), %al
movb %al, -0x55(%rbp)
movb -0x55(%rbp), %dl
movl $0x1, %eax
xorl %ecx, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x1c(%rbp)
cmpl $0x4, -0x1c(%rbp)
jge 0x6147
cmpl $0x0, -0x1c(%rbp)
jle 0x5b68
movq -0x18(%rbp), %rax
movq %rax, -0x60(%rbp)
jmp 0x5baf
cmpl $0x0, -0x20(%rbp)
jne 0x5b7e
movq -0x18(%rbp), %rax
addq $-0xf88, %rax           # imm = 0xF078
movq %rax, -0x68(%rbp)
jmp 0x5ba7
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x8ed8(%rcx), %rcx
movslq 0x43c(%rcx), %rdx
xorl %ecx, %ecx
subq %rdx, %rcx
imulq $0xf88, %rcx, %rcx      # imm = 0xF88
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x18(%rax)
je 0x5bdf
movq -0x18(%rbp), %rax
cmpl $0x1, 0x18(%rax)
je 0x5bdf
movq -0x30(%rbp), %rax
cmpl $0x0, 0x18(%rax)
je 0x5bdf
movq -0x30(%rbp), %rax
cmpl $0x1, 0x18(%rax)
jne 0x5c03
movl -0x1c(%rbp), %edx
movl $0x3, %eax
movl $0x4, %ecx
cmpl $0x0, %edx
cmovel %ecx, %eax
movl %eax, -0x34(%rbp)
movl %eax, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl %eax, -0x40(%rbp)
jmp 0x5e3e
movl $0x0, -0x44(%rbp)
cmpl $0x4, -0x44(%rbp)
jge 0x5e3c
cmpl $0x0, -0x20(%rbp)
jne 0x5c22
movl -0x1c(%rbp), %eax
movl %eax, -0x6c(%rbp)
jmp 0x5c28
movl -0x44(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movl %eax, -0x48(%rbp)
cmpl $0x0, -0x20(%rbp)
jne 0x5c3c
movl -0x44(%rbp), %eax
movl %eax, -0x70(%rbp)
jmp 0x5c42
movl -0x1c(%rbp), %eax
movl %eax, -0x70(%rbp)
movl -0x70(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x48(%rbp), %eax
movl -0x20(%rbp), %esi
xorl %ecx, %ecx
movl $0x1, %edx
cmpl $0x0, %esi
cmovel %edx, %ecx
subl %ecx, %eax
andl $0x3, %eax
movl %eax, -0x50(%rbp)
movl -0x4c(%rbp), %eax
movl -0x20(%rbp), %esi
movl $0x1, %ecx
xorl %edx, %edx
cmpl $0x0, %esi
cmovel %edx, %ecx
subl %ecx, %eax
andl $0x3, %eax
movl %eax, -0x54(%rbp)
movq -0x18(%rbp), %rax
addq $0x324, %rax            # imm = 0x324
movslq -0x48(%rbp), %rdx
leaq 0x2332d(%rip), %rcx     # 0x28fc0
shlq $0x2, %rdx
addq %rdx, %rcx
movslq -0x4c(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
imulq $0x84, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x4(%rax)
jne 0x5ce6
movq -0x30(%rbp), %rax
addq $0x324, %rax            # imm = 0x324
movslq -0x50(%rbp), %rdx
leaq 0x232f9(%rip), %rcx     # 0x28fc0
shlq $0x2, %rdx
addq %rdx, %rcx
movslq -0x54(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
imulq $0x84, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x4(%rax)
je 0x5cf7
movslq -0x44(%rbp), %rax
movl $0x2, -0x40(%rbp,%rax,4)
jmp 0x5e2c
cmpl $0x1, -0xc(%rbp)
jne 0x5d1a
movq 0x302cc(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
leaq 0x237a2(%rip), %rsi     # 0x294b0
movb $0x0, %al
callq 0x2160
jmp 0x6167
movq -0x18(%rbp), %rax
addq $0x30, %rax
movslq -0x48(%rbp), %rcx
imulq $0xa0, %rcx, %rcx
addq %rcx, %rax
movslq -0x4c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
movq -0x30(%rbp), %rcx
addq $0x30, %rcx
movslq -0x50(%rbp), %rdx
imulq $0xa0, %rdx, %rdx
addq %rdx, %rcx
movslq -0x54(%rbp), %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rcx
cmpl (%rcx), %eax
jne 0x5e0e
movq -0x18(%rbp), %rax
addq $0x30, %rax
movslq -0x48(%rbp), %rcx
imulq $0xa0, %rcx, %rcx
addq %rcx, %rax
movslq -0x4c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq -0x30(%rbp), %rcx
addq $0x30, %rcx
movslq -0x50(%rbp), %rdx
imulq $0xa0, %rdx, %rdx
addq %rdx, %rcx
movslq -0x54(%rbp), %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rcx
subl 0x8(%rcx), %eax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
cmpl $0x4, %eax
jge 0x5e0e
movq -0x18(%rbp), %rax
addq $0x30, %rax
movslq -0x48(%rbp), %rcx
imulq $0xa0, %rcx, %rcx
addq %rcx, %rax
movslq -0x4c(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movq -0x30(%rbp), %rcx
addq $0x30, %rcx
movslq -0x50(%rbp), %rdx
imulq $0xa0, %rdx, %rdx
addq %rdx, %rcx
movslq -0x54(%rbp), %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rcx
subl 0xc(%rcx), %eax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
cmpl $0x4, %eax
jl 0x5e1c
movslq -0x44(%rbp), %rax
movl $0x1, -0x40(%rbp,%rax,4)
jmp 0x5e28
movslq -0x44(%rbp), %rax
movl $0x0, -0x40(%rbp,%rax,4)
jmp 0x5e2a
jmp 0x5e2c
jmp 0x5e2e
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x5c0a
jmp 0x5e3e
movq -0x18(%rbp), %rax
movl 0x2b0(%rax), %eax
movq -0x30(%rbp), %rcx
addl 0x2b0(%rcx), %eax
addl $0x1, %eax
sarl %eax
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x20(%rbp)
jne 0x5fc0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x10efe0(%rax), %rax
movq 0x48(%rax), %rsi
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
shll $0x4, %eax
movq -0x8(%rbp), %rcx
movq 0x10efe0(%rcx), %rcx
imull 0x24(%rcx), %eax
movq -0x18(%rbp), %rcx
movl (%rcx), %ecx
shll $0x4, %ecx
addl %ecx, %eax
movl -0x1c(%rbp), %ecx
shll $0x2, %ecx
addl %ecx, %eax
cltq
addq %rax, %rsi
movq -0x8(%rbp), %rax
movq 0x10efe0(%rax), %rax
movl 0x24(%rax), %edx
leaq -0x40(%rbp), %rcx
movl -0x28(%rbp), %r8d
callq 0x6170
movl -0x1c(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x5fbb
movq -0x18(%rbp), %rax
movslq 0x2b0(%rax), %rcx
leaq 0x230e7(%rip), %rax     # 0x28fd0
movl (%rax,%rcx,4), %eax
movq -0x30(%rbp), %rcx
movslq 0x2b0(%rcx), %rdx
leaq 0x230d2(%rip), %rcx     # 0x28fd0
addl (%rcx,%rdx,4), %eax
addl $0x1, %eax
sarl %eax
movl %eax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x10efe0(%rax), %rax
movq 0x50(%rax), %rsi
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x8(%rbp), %rcx
movq 0x10efe0(%rcx), %rcx
imull 0x28(%rcx), %eax
movq -0x18(%rbp), %rcx
addl (%rcx), %eax
shll $0x3, %eax
movl -0x1c(%rbp), %ecx
shll %ecx
addl %ecx, %eax
cltq
addq %rax, %rsi
movq -0x8(%rbp), %rax
movq 0x10efe0(%rax), %rax
movl 0x28(%rax), %edx
leaq -0x40(%rbp), %rcx
movl -0x28(%rbp), %r8d
callq 0x6680
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x10efe0(%rax), %rax
movq 0x58(%rax), %rsi
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x8(%rbp), %rcx
movq 0x10efe0(%rcx), %rcx
imull 0x2c(%rcx), %eax
movq -0x18(%rbp), %rcx
addl (%rcx), %eax
shll $0x3, %eax
movl -0x1c(%rbp), %ecx
shll %ecx
addl %ecx, %eax
cltq
addq %rax, %rsi
movq -0x8(%rbp), %rax
movq 0x10efe0(%rax), %rax
movl 0x2c(%rax), %edx
leaq -0x40(%rbp), %rcx
movl -0x28(%rbp), %r8d
callq 0x6680
jmp 0x6137
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x10efe0(%rax), %rax
movq 0x48(%rax), %rsi
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
shll $0x4, %eax
movl -0x1c(%rbp), %ecx
shll $0x2, %ecx
addl %ecx, %eax
movq -0x8(%rbp), %rcx
movq 0x10efe0(%rcx), %rcx
imull 0x24(%rcx), %eax
movq -0x18(%rbp), %rcx
movl (%rcx), %ecx
shll $0x4, %ecx
addl %ecx, %eax
cltq
addq %rax, %rsi
movq -0x8(%rbp), %rax
movq 0x10efe0(%rax), %rax
movl 0x24(%rax), %edx
leaq -0x40(%rbp), %rcx
movl -0x28(%rbp), %r8d
callq 0x6930
movl -0x1c(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x6135
movq -0x18(%rbp), %rax
movslq 0x2b0(%rax), %rcx
leaq 0x22f8b(%rip), %rax     # 0x28fd0
movl (%rax,%rcx,4), %eax
movq -0x30(%rbp), %rcx
movslq 0x2b0(%rcx), %rdx
leaq 0x22f76(%rip), %rcx     # 0x28fd0
addl (%rcx,%rdx,4), %eax
addl $0x1, %eax
sarl %eax
movl %eax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x10efe0(%rax), %rax
movq 0x50(%rax), %rsi
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x8(%rbp), %rcx
movq 0x10efe0(%rcx), %rcx
imull 0x28(%rcx), %eax
movq -0x18(%rbp), %rcx
addl (%rcx), %eax
shll $0x3, %eax
movl -0x1c(%rbp), %ecx
shll %ecx
movq -0x8(%rbp), %rdx
movq 0x10efe0(%rdx), %rdx
imull 0x28(%rdx), %ecx
addl %ecx, %eax
cltq
addq %rax, %rsi
movq -0x8(%rbp), %rax
movq 0x10efe0(%rax), %rax
movl 0x28(%rax), %edx
leaq -0x40(%rbp), %rcx
movl -0x28(%rbp), %r8d
callq 0x6f20
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x10efe0(%rax), %rax
movq 0x58(%rax), %rsi
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x8(%rbp), %rcx
movq 0x10efe0(%rcx), %rcx
imull 0x2c(%rcx), %eax
movq -0x18(%rbp), %rcx
addl (%rcx), %eax
shll $0x3, %eax
movl -0x1c(%rbp), %ecx
shll %ecx
movq -0x8(%rbp), %rdx
movq 0x10efe0(%rdx), %rdx
imull 0x2c(%rdx), %ecx
addl %ecx, %eax
cltq
addq %rax, %rsi
movq -0x8(%rbp), %rax
movq 0x10efe0(%rax), %rax
movl 0x2c(%rax), %edx
leaq -0x40(%rbp), %rcx
movl -0x28(%rbp), %r8d
callq 0x6f20
jmp 0x6137
jmp 0x6139
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x5b4e
jmp 0x6149
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x5af8
jmp 0x6159
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x5aa6
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)