// File: /workspace/github_c_makefile_star2_O2/akumrao[P]videoAnalyzer/core/frame.c
// Function: deblocking_filter_edgecv(x264_t*, unsigned char*, int, int*, int)
static inline void deblocking_filter_edgecv( x264_t *h, uint8_t *pix, int i_pix_stride, int bS[4], int i_QP )
{
    int i, d;
    const int i_index_a = x264_clip3( i_QP + h->sh.i_alpha_c0_offset, 0, 51 );
    const int alpha = i_alpha_table[i_index_a];
    const int beta  = i_beta_table[x264_clip3( i_QP + h->sh.i_beta_offset, 0, 51 )];

    for( i = 0; i < 4; i++ )
    {
        if( bS[i] == 0 )
        {
            pix += 2 * i_pix_stride;
            continue;
        }

        if( bS[i] < 4 )
        {
            const int tc = i_tc0_table[i_index_a][bS[i] - 1] + 1;
            /* 2px edge length (because we use same bS than the one for luma) */
            for( d = 0; d < 2; d++ )
            {
                const int p0 = pix[-1];
                const int p1 = pix[-2];
                const int q0 = pix[0];
                const int q1 = pix[1];

                if( abs( p0 - q0 ) < alpha &&
                    abs( p1 - p0 ) < beta &&
                    abs( q1 - q0 ) < beta )
                {
                    const int i_delta = x264_clip3( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc );

                    pix[-1] = clip_uint8( p0 + i_delta );    /* p0' */
                    pix[0]  = clip_uint8( q0 - i_delta );    /* q0' */
                }
                pix += i_pix_stride;
            }
        }
        else
        {
            /* 2px edge length (because we use same bS than the one for luma) */
            for( d = 0; d < 2; d++ )
            {
                const int p0 = pix[-1];
                const int p1 = pix[-2];
                const int q0 = pix[0];
                const int q1 = pix[1];

                if( abs( p0 - q0 ) < alpha &&
                    abs( p1 - p0 ) < beta &&
                    abs( q1 - q0 ) < beta )
                {
                    pix[-1] = ( 2*p1 + p0 + q1 + 2 ) >> 2;   /* p0' */
                    pix[0]  = ( 2*q1 + q0 + p1 + 2 ) >> 2;   /* q0' */
                }
                pix += i_pix_stride;
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, -0x40(%rbp)
movl 0x10db54(%rdi), %r10d
addl %r8d, %r10d
movl $0x33, %r11d
cmpl %r11d, %r10d
cmovgel %r11d, %r10d
xorl %eax, %eax
testl %r10d, %r10d
cmovlel %eax, %r10d
leaq 0x16465(%rip), %r9      # 0x1b420
movl (%r9,%r10,4), %r9d
addl 0x10db58(%rdi), %r8d
cmpl %r11d, %r8d
cmovgel %r11d, %r8d
testl %r8d, %r8d
cmovlel %eax, %r8d
leaq 0x16515(%rip), %rdi     # 0x1b4f0
movl (%rdi,%r8,4), %edi
movslq %edx, %rdx
leal (%rdx,%rdx), %r8d
movslq %r8d, %rcx
movq %rcx, -0x38(%rbp)
imulq $0xc, %r10, %r8
leaq 0x165c8(%rip), %rcx     # 0x1b5c0
addq %r8, %rcx
movq %rcx, -0x30(%rbp)
cmpq $0x4, %rax
je 0x518e
movq -0x40(%rbp), %rcx
movslq (%rcx,%rax,4), %r8
testq %r8, %r8
je 0x50fc
cmpl $0x4, %r8d
jge 0x5108
movq -0x30(%rbp), %rcx
movl -0x4(%rcx,%r8,4), %r14d
leal 0x1(%r14), %r15d
notl %r14d
movl $0x2, %r12d
subl $0x1, %r12d
jb 0x5100
movzbl -0x1(%rsi), %r11d
movzbl (%rsi), %r13d
movl %r11d, %r8d
subl %r13d, %r8d
movl %r8d, %r10d
negl %r10d
cmovsl %r8d, %r10d
movzbl %r10b, %r8d
cmpl %r9d, %r8d
jge 0x50f4
movzbl -0x2(%rsi), %r8d
movl %r8d, %ebx
subl %r11d, %ebx
movl %ebx, %r10d
negl %r10d
cmovsl %ebx, %r10d
cmpl %edi, %r10d
jge 0x50f4
movzbl 0x1(%rsi), %ecx
movl %ecx, %r10d
subl %r13d, %r10d
movl %r10d, %ebx
negl %ebx
cmovsl %r10d, %ebx
cmpl %edi, %ebx
jae 0x50f4
movl %r13d, %r10d
subl %r11d, %r10d
subl %ecx, %r8d
leal (%r8,%r10,4), %ecx
addl $0x4, %ecx
sarl $0x3, %ecx
cmpl %r15d, %ecx
movl %r15d, %r8d
cmovll %ecx, %r8d
cmpl %r14d, %ecx
cmovll %r14d, %r8d
addl %r8d, %r11d
testl %r11d, %r11d
setg %cl
negb %cl
movl $0x100, %r10d           # imm = 0x100
cmpl %r10d, %r11d
movzbl %cl, %ecx
cmovbl %r11d, %ecx
movb %cl, -0x1(%rsi)
subl %r8d, %r13d
testl %r13d, %r13d
setg %cl
negb %cl
cmpl %r10d, %r13d
movzbl %cl, %ecx
cmovbl %r13d, %ecx
movb %cl, (%rsi)
addq %rdx, %rsi
jmp 0x503a
addq -0x38(%rbp), %rsi
incq %rax
jmp 0x4fff
movl $0x2, %r14d
subl $0x1, %r14d
jb 0x5100
movzbl -0x1(%rsi), %r15d
movzbl (%rsi), %r11d
movl %r15d, %ecx
subl %r11d, %ecx
movl %ecx, %r8d
negl %r8d
cmovsl %ecx, %r8d
movzbl %r8b, %ecx
cmpl %r9d, %ecx
jge 0x5189
movzbl -0x2(%rsi), %r12d
movl %r12d, %ecx
subl %r15d, %ecx
movl %ecx, %r8d
negl %r8d
cmovsl %ecx, %r8d
cmpl %edi, %r8d
jge 0x5189
movzbl 0x1(%rsi), %r8d
movl %r8d, %ecx
subl %r11d, %ecx
movl %ecx, %r10d
negl %r10d
cmovsl %ecx, %r10d
cmpl %edi, %r10d
jae 0x5189
leal (%r15,%r12,2), %ecx
addl %r8d, %ecx
addl $0x2, %ecx
shrl $0x2, %ecx
movb %cl, -0x1(%rsi)
addl %r12d, %r11d
leal (%r11,%r8,2), %ecx
addl $0x2, %ecx
shrl $0x2, %ecx
movb %cl, (%rsi)
addq %rdx, %rsi
jmp 0x510e
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq