// File: /workspace/github_c_makefile_star2_O3/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 %r8, -0x40(%rbp)
addl %r9d, %edi
movl $0x33, %r11d
cmpl %r11d, %edi
cmovgel %r11d, %edi
xorl %eax, %eax
testl %edi, %edi
cmovlel %eax, %edi
leaq 0x2138f(%rip), %r10     # 0x27420
movl (%r10,%rdi,4), %r10d
addl %r9d, %esi
cmpl %r11d, %esi
cmovgel %r11d, %esi
testl %esi, %esi
cmovlel %eax, %esi
leaq 0x21445(%rip), %r9      # 0x274f0
movl (%r9,%rsi,4), %esi
movslq %ecx, %rcx
leal (%rcx,%rcx), %r9d
movslq %r9d, %r8
movq %r8, -0x38(%rbp)
leaq (%rdi,%rdi,2), %rdi
leaq 0x214f8(%rip), %r9      # 0x275c0
leaq (%r9,%rdi,4), %rdi
movq %rdi, -0x30(%rbp)
movq -0x40(%rbp), %rdi
movslq (%rdi,%rax,4), %rdi
testq %rdi, %rdi
je 0x61cd
cmpl $0x4, %edi
jge 0x61d6
movq -0x30(%rbp), %r8
movl -0x4(%r8,%rdi,4), %ebx
leal 0x1(%rbx), %r14d
notl %ebx
movb $0x1, %r15b
movzbl -0x1(%rdx), %r13d
movzbl (%rdx), %r12d
movl %r13d, %edi
subl %r12d, %edi
movl %edi, %r9d
negl %r9d
cmovsl %edi, %r9d
movzbl %r9b, %edi
cmpl %r10d, %edi
jge 0x61b5
movzbl -0x2(%rdx), %edi
movl %edi, %r11d
subl %r13d, %r11d
movl %r11d, %r9d
negl %r9d
cmovsl %r11d, %r9d
cmpl %esi, %r9d
jge 0x61b5
movzbl 0x1(%rdx), %r8d
movl %r8d, %r9d
subl %r12d, %r9d
movl %r9d, %r11d
negl %r11d
cmovsl %r9d, %r11d
cmpl %esi, %r11d
jae 0x61b5
movl %r12d, %r9d
subl %r13d, %r9d
subl %r8d, %edi
leal (%rdi,%r9,4), %edi
addl $0x4, %edi
sarl $0x3, %edi
cmpl %r14d, %edi
movl %r14d, %r8d
cmovll %edi, %r8d
cmpl %ebx, %edi
cmovll %ebx, %r8d
addl %r8d, %r13d
testl %r13d, %r13d
setg %dil
negb %dil
movl $0x100, %r9d            # imm = 0x100
cmpl %r9d, %r13d
movzbl %dil, %edi
cmovbl %r13d, %edi
movb %dil, -0x1(%rdx)
subl %r8d, %r12d
testl %r12d, %r12d
setg %dil
negb %dil
cmpl %r9d, %r12d
movzbl %dil, %edi
cmovbl %r12d, %edi
movb %dil, (%rdx)
addq %rcx, %rdx
testb $0x1, %r15b
movl $0x0, %r15d
jne 0x60fc
jmp 0x6261
addq -0x38(%rbp), %rdx
jmp 0x6261
movb $0x1, %bl
movzbl -0x1(%rdx), %r15d
movzbl (%rdx), %r14d
movl %r15d, %edi
subl %r14d, %edi
movl %edi, %r8d
negl %r8d
cmovsl %edi, %r8d
movzbl %r8b, %edi
cmpl %r10d, %edi
jge 0x6250
movzbl -0x2(%rdx), %r12d
movl %r12d, %edi
subl %r15d, %edi
movl %edi, %r8d
negl %r8d
cmovsl %edi, %r8d
cmpl %esi, %r8d
jge 0x6250
movzbl 0x1(%rdx), %edi
movl %edi, %r8d
subl %r14d, %r8d
movl %r8d, %r9d
negl %r9d
cmovsl %r8d, %r9d
cmpl %esi, %r9d
jae 0x6250
leal (%r15,%r12,2), %r8d
addl %edi, %r8d
addl $0x2, %r8d
shrl $0x2, %r8d
movb %r8b, -0x1(%rdx)
addl %r12d, %r14d
leal (%r14,%rdi,2), %edi
addl $0x2, %edi
shrl $0x2, %edi
movb %dil, (%rdx)
addq %rcx, %rdx
testb $0x1, %bl
movl $0x0, %ebx
jne 0x61d8
incq %rax
cmpq $0x4, %rax
jne 0x60d0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq