// File: /workspace/github_c_makefile_star2_O3/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
movq %r8, -0x48(%rbp)
addl %r9d, %edi
movl $0x33, %r8d
cmpl %r8d, %edi
cmovgel %r8d, %edi
xorl %eax, %eax
testl %edi, %edi
cmovlel %eax, %edi
leaq 0x21178(%rip), %r10     # 0x27420
movl (%r10,%rdi,4), %r10d
addl %r9d, %esi
cmpl %r8d, %esi
cmovgel %r8d, %esi
testl %esi, %esi
cmovlel %eax, %esi
leaq 0x2122e(%rip), %r8      # 0x274f0
movl (%r8,%rsi,4), %esi
leal (%rcx,%rcx), %r8d
movslq %ecx, %r9
movq %r9, -0x38(%rbp)
negl %ecx
movslq %ecx, %rcx
negl %r8d
movslq %r8d, %r11
leaq (%rdi,%rdi,2), %rdi
leaq 0x212d9(%rip), %r8      # 0x275c0
leaq (%r8,%rdi,4), %rdi
movq %rdi, -0x40(%rbp)
movq -0x48(%rbp), %rdi
movslq (%rdi,%rax,4), %rdi
testq %rdi, %rdi
je 0x63f4
cmpl $0x4, %edi
jge 0x63fd
movq -0x40(%rbp), %r8
movl -0x4(%r8,%rdi,4), %r14d
leal 0x1(%r14), %edi
movl %edi, -0x2c(%rbp)
notl %r14d
movb $0x1, %r12b
movzbl (%rdx,%rcx), %edi
movzbl (%rdx), %r13d
movl %edi, %r8d
subl %r13d, %r8d
movl %r8d, %ebx
negl %ebx
cmovsl %r8d, %ebx
movzbl %bl, %r8d
cmpl %r10d, %r8d
jge 0x63dc
movzbl (%rdx,%r11), %ebx
movl %ebx, %r9d
subl %edi, %r9d
movl %r9d, %r8d
negl %r8d
cmovsl %r9d, %r8d
cmpl %esi, %r8d
jge 0x63dc
movq -0x38(%rbp), %r8
movzbl (%rdx,%r8), %r15d
movl %r15d, %r8d
subl %r13d, %r8d
movl %r8d, %r9d
negl %r9d
cmovsl %r8d, %r9d
cmpl %esi, %r9d
jae 0x63dc
movl %r13d, %r8d
subl %edi, %r8d
subl %r15d, %ebx
leal (%rbx,%r8,4), %r8d
addl $0x4, %r8d
sarl $0x3, %r8d
movl -0x2c(%rbp), %r9d
cmpl %r9d, %r8d
cmovll %r8d, %r9d
cmpl %r14d, %r8d
cmovll %r14d, %r9d
addl %r9d, %edi
testl %edi, %edi
setg %r8b
negb %r8b
movl $0x100, %ebx            # imm = 0x100
cmpl %ebx, %edi
movzbl %r8b, %r8d
cmovbl %edi, %r8d
movb %r8b, (%rdx,%rcx)
subl %r9d, %r13d
testl %r13d, %r13d
setg %dil
negb %dil
cmpl %ebx, %r13d
movzbl %dil, %edi
cmovbl %r13d, %edi
movb %dil, (%rdx)
incq %rdx
testb $0x1, %r12b
movl $0x0, %r12d
jne 0x631f
jmp 0x648e
addq $0x2, %rdx
jmp 0x648e
movb $0x1, %r14b
movzbl (%rdx,%rcx), %r15d
movzbl (%rdx), %edi
movl %r15d, %r8d
subl %edi, %r8d
movl %r8d, %r9d
negl %r9d
cmovsl %r8d, %r9d
movzbl %r9b, %r8d
cmpl %r10d, %r8d
jge 0x647b
movzbl (%rdx,%r11), %r12d
movl %r12d, %r8d
subl %r15d, %r8d
movl %r8d, %r9d
negl %r9d
cmovsl %r8d, %r9d
cmpl %esi, %r9d
jge 0x647b
movq -0x38(%rbp), %r8
movzbl (%rdx,%r8), %ebx
movl %ebx, %r8d
subl %edi, %r8d
movl %r8d, %r9d
negl %r9d
cmovsl %r8d, %r9d
cmpl %esi, %r9d
jae 0x647b
leal (%r15,%r12,2), %r8d
addl %ebx, %r8d
addl $0x2, %r8d
shrl $0x2, %r8d
movb %r8b, (%rdx,%rcx)
addl %r12d, %edi
leal (%rdi,%rbx,2), %edi
addl $0x2, %edi
shrl $0x2, %edi
movb %dil, (%rdx)
incq %rdx
testb $0x1, %r14b
movl $0x0, %r14d
jne 0x6400
incq %rax
cmpq $0x4, %rax
jne 0x62ef
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop