// File: /workspace/github_c_makefile_star2_O2/akumrao[P]videoAnalyzer/core/frame.c
// Function: deblocking_filter_edgech(x264_t*, unsigned char*, int, int*, int)
static inline void deblocking_filter_edgech( 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 )];

    int i_pix_next  = i_pix_stride;

    for( i = 0; i < 4; i++ )
    {
        if( bS[i] == 0 )
        {
            pix += 2;
            continue;
        }
        if( bS[i] < 4 )
        {
            int tc = i_tc0_table[i_index_a][bS[i] - 1] + 1;
            /* 2px edge length (see deblocking_filter_edgecv) */
            for( d = 0; d < 2; d++ )
            {
                const int p0 = pix[-1*i_pix_next];
                const int p1 = pix[-2*i_pix_next];
                const int q0 = pix[0];
                const int q1 = pix[1*i_pix_next];

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

                    pix[-i_pix_next] = clip_uint8( p0 + i_delta );    /* p0' */
                    pix[0]           = clip_uint8( q0 - i_delta );    /* q0' */
                }
                pix++;
            }
        }
        else
        {
            /* 2px edge length (see deblocking_filter_edgecv) */
            for( d = 0; d < 2; d++ )
            {
                const int p0 = pix[-1*i_pix_next];
                const int p1 = pix[-2*i_pix_next];
                const int q0 = pix[0];
                const int q1 = pix[1*i_pix_next];

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl 0x10db54(%rdi), %r11d
addl %r8d, %r11d
movl $0x33, %eax
cmpl %eax, %r11d
cmovgel %eax, %r11d
xorl %r13d, %r13d
testl %r11d, %r11d
cmovlel %r13d, %r11d
leaq 0x16253(%rip), %r9      # 0x1b420
movl (%r9,%r11,4), %r9d
addl 0x10db58(%rdi), %r8d
cmpl %eax, %r8d
cmovgel %eax, %r8d
testl %r8d, %r8d
cmovlel %r13d, %r8d
leaq 0x16303(%rip), %rax     # 0x1b4f0
movl (%rax,%r8,4), %edi
leal (%rdx,%rdx), %eax
movslq %edx, %r8
movq %r8, -0x30(%rbp)
negl %edx
movslq %edx, %rdx
negl %eax
movslq %eax, %r10
imulq $0xc, %r11, %rax
leaq 0x163b0(%rip), %r8      # 0x1b5c0
addq %rax, %r8
movq %r8, -0x38(%rbp)
movq %rcx, -0x40(%rbp)
cmpq $0x4, %r13
je 0x53b6
movslq (%rcx,%r13,4), %rax
testq %rax, %rax
je 0x530e
cmpl $0x4, %eax
jge 0x5317
movq %r13, -0x48(%rbp)
movq -0x38(%rbp), %rcx
movl -0x4(%rcx,%rax,4), %r15d
leal 0x1(%r15), %r12d
notl %r15d
movl $0x2, %r13d
subl $0x1, %r13d
jb 0x53a6
movzbl (%rsi,%rdx), %r11d
movzbl (%rsi), %ebx
movl %r11d, %ecx
subl %ebx, %ecx
movl %ecx, %r14d
negl %r14d
cmovsl %ecx, %r14d
movzbl %r14b, %ecx
cmpl %r9d, %ecx
jge 0x5306
movzbl (%rsi,%r10), %r14d
movl %r14d, %eax
subl %r11d, %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
cmpl %edi, %ecx
jge 0x5306
movq -0x30(%rbp), %rax
movzbl (%rsi,%rax), %r8d
movl %r8d, %ecx
subl %ebx, %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
cmpl %edi, %eax
jae 0x5306
movl %ebx, %eax
subl %r11d, %eax
subl %r8d, %r14d
leal (%r14,%rax,4), %eax
addl $0x4, %eax
sarl $0x3, %eax
cmpl %r12d, %eax
movl %r12d, %ecx
cmovll %eax, %ecx
cmpl %r15d, %eax
cmovll %r15d, %ecx
addl %ecx, %r11d
testl %r11d, %r11d
setg %al
negb %al
movl $0x100, %r8d            # imm = 0x100
cmpl %r8d, %r11d
movzbl %al, %eax
cmovbl %r11d, %eax
movb %al, (%rsi,%rdx)
subl %ecx, %ebx
testl %ebx, %ebx
setg %al
negb %al
cmpl %r8d, %ebx
movzbl %al, %eax
cmovbl %ebx, %eax
movb %al, (%rsi)
incq %rsi
jmp 0x5255
addq $0x2, %rsi
jmp 0x53ae
movl $0x2, %ebx
subl $0x1, %ebx
jb 0x53ae
movzbl (%rsi,%rdx), %r15d
movzbl (%rsi), %r11d
movl %r15d, %eax
subl %r11d, %eax
movl %eax, %r8d
negl %r8d
cmovsl %eax, %r8d
movzbl %r8b, %eax
cmpl %r9d, %eax
jge 0x539e
movzbl (%rsi,%r10), %r12d
movl %r12d, %eax
subl %r15d, %eax
movl %eax, %r8d
negl %r8d
cmovsl %eax, %r8d
cmpl %edi, %r8d
jge 0x539e
movq -0x30(%rbp), %rax
movzbl (%rsi,%rax), %r14d
movl %r14d, %eax
subl %r11d, %eax
movl %eax, %r8d
negl %r8d
cmovsl %eax, %r8d
cmpl %edi, %r8d
jae 0x539e
leal (%r15,%r12,2), %eax
addl %r14d, %eax
addl $0x2, %eax
shrl $0x2, %eax
movb %al, (%rsi,%rdx)
addl %r12d, %r11d
leal (%r11,%r14,2), %eax
addl $0x2, %eax
shrl $0x2, %eax
movb %al, (%rsi)
incq %rsi
jmp 0x531c
movq -0x40(%rbp), %rcx
movq -0x48(%rbp), %r13
incq %r13
jmp 0x521b
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)