// File: /workspace/github_c_makefile_star2_O2/akumrao[P]videoAnalyzer/core/frame.c
// Function: x264_frame_expand_border(x264_frame_t*)
void x264_frame_expand_border( x264_frame_t *frame )
{
    int w;
    int i, y;
    for( i = 0; i < frame->i_plane; i++ )
    {
#define PPIXEL(x, y) ( frame->plane[i] + (x) +(y)*frame->i_stride[i] )
        w = ( i == 0 ) ? 32 : 16;

        for( y = 0; y < w; y++ )
        {
            /* upper band */
            memcpy( PPIXEL(0,-y-1), PPIXEL(0,0), frame->i_stride[i] - 2 * w);
            /* up left corner */
            memset( PPIXEL(-w,-y-1 ), PPIXEL(0,0)[0], w );
            /* up right corner */
            memset( PPIXEL(frame->i_stride[i] - 2*w,-y-1), PPIXEL( frame->i_stride[i]-1-2*w,0)[0], w );

            /* lower band */
            memcpy( PPIXEL(0, frame->i_lines[i]+y), PPIXEL(0,frame->i_lines[i]-1), frame->i_stride[i] - 2 * w );
            /* low left corner */
            memset( PPIXEL(-w, frame->i_lines[i]+y), PPIXEL(0,frame->i_lines[i]-1)[0], w);
            /* low right corner */
            memset( PPIXEL(frame->i_stride[i]-2*w, frame->i_lines[i]+y), PPIXEL(frame->i_stride[i]-1-2*w,frame->i_lines[i]-1)[0], w);

        }
        for( y = 0; y < frame->i_lines[i]; y++ )
        {
            /* left band */
            memset( PPIXEL( -w, y ), PPIXEL( 0, y )[0], w );
            /* right band */
            memset( PPIXEL( frame->i_stride[i]-2*w, y ), PPIXEL( frame->i_stride[i] - 1-2*w, y )[0], w );
        }
#undef PPIXEL
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
xorl %r15d, %r15d
movslq 0x20(%rbx), %rax
cmpq %rax, %r15
jge 0x41e4
xorl %r14d, %r14d
xorl %eax, %eax
testq %r15, %r15
sete %r14b
setne %al
shll $0x4, %eax
orq $-0x20, %rax
movq %rax, -0x40(%rbp)
shll $0x4, %r14d
leal 0x20(,%r14,2), %eax
movl %r14d, %r13d
movl %eax, %r14d
addl $0x10, %r13d
notl %eax
movq %rax, -0x38(%rbp)
xorl %ecx, %ecx
pushq $-0x1
popq %rax
movl %eax, %r12d
cmpl %ecx, %r13d
je 0x416f
movq 0x48(%rbx,%r15,8), %rsi
movl 0x24(%rbx,%r15,4), %eax
movq %rcx, -0x30(%rbp)
movl %eax, %ecx
imull %r12d, %ecx
movslq %ecx, %rdi
addq %rsi, %rdi
subl %r14d, %eax
movslq %eax, %rdx
callq 0x20a0
movq 0x48(%rbx,%r15,8), %rax
movq -0x40(%rbp), %rcx
addq %rax, %rcx
movslq 0x24(%rbx,%r15,4), %rdi
movslq %r12d, %r12
imulq %r12, %rdi
addq %rcx, %rdi
movzbl (%rax), %esi
movq %r13, %rdx
callq 0x2070
movq 0x48(%rbx,%r15,8), %rax
movl 0x24(%rbx,%r15,4), %ecx
movl %ecx, %edx
subl %r14d, %edx
movslq %edx, %rdx
addq %rax, %rdx
movl %ecx, %esi
imull %r12d, %esi
movslq %esi, %rdi
addq %rdx, %rdi
addl -0x38(%rbp), %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %esi
movq %r13, %rdx
callq 0x2070
movq 0x48(%rbx,%r15,8), %rax
movl 0x24(%rbx,%r15,4), %ecx
movl 0x34(%rbx,%r15,4), %edx
movq -0x30(%rbp), %rsi
addl %edx, %esi
imull %ecx, %esi
movslq %esi, %rdi
addq %rax, %rdi
decl %edx
imull %ecx, %edx
movslq %edx, %rsi
addq %rax, %rsi
subl %r14d, %ecx
movslq %ecx, %rdx
callq 0x20a0
movq 0x48(%rbx,%r15,8), %rax
movq -0x40(%rbp), %rcx
addq %rax, %rcx
movl 0x24(%rbx,%r15,4), %edx
movl 0x34(%rbx,%r15,4), %esi
movq -0x30(%rbp), %rdi
addl %esi, %edi
imull %edx, %edi
movslq %edi, %rdi
addq %rcx, %rdi
decl %esi
imull %edx, %esi
movslq %esi, %rcx
movzbl (%rax,%rcx), %esi
movq %r13, %rdx
callq 0x2070
movq 0x48(%rbx,%r15,8), %rax
movl 0x24(%rbx,%r15,4), %edx
movl 0x34(%rbx,%r15,4), %ecx
movq -0x30(%rbp), %rsi
addl %ecx, %esi
imull %edx, %esi
movq -0x38(%rbp), %rdi
leal (%rdx,%rdi), %r8d
decl %ecx
imull %edx, %ecx
subl %r14d, %edx
movslq %edx, %rdx
addq %rax, %rdx
movslq %esi, %rdi
addq %rdx, %rdi
movslq %r8d, %rdx
addq %rax, %rdx
movslq %ecx, %rax
movzbl (%rax,%rdx), %esi
movq %r13, %rdx
callq 0x2070
movq -0x30(%rbp), %rcx
incl %ecx
decl %r12d
jmp 0x4024
xorl %r12d, %r12d
cmpl 0x34(%rbx,%r15,4), %r12d
jge 0x41dc
movq 0x48(%rbx,%r15,8), %rax
movslq 0x24(%rbx,%r15,4), %rcx
movslq %r12d, %rdx
imulq %rcx, %rdx
movq -0x40(%rbp), %rcx
leaq (%rax,%rcx), %rdi
addq %rdx, %rdi
movzbl (%rax,%rdx), %esi
movq %r13, %rdx
callq 0x2070
movq 0x48(%rbx,%r15,8), %rax
movl 0x24(%rbx,%r15,4), %ecx
movl %ecx, %edx
subl %r14d, %edx
movslq %edx, %rdi
addq %rax, %rdi
movl %ecx, %edx
imull %r12d, %edx
movslq %edx, %rdx
addq %rdx, %rdi
addl -0x38(%rbp), %ecx
movslq %ecx, %rcx
addq %rax, %rcx
movzbl (%rdx,%rcx), %esi
movq %r13, %rdx
callq 0x2070
incl %r12d
jmp 0x4172
incq %r15
jmp 0x3fd9
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq