// File: /workspace/github_c_makefile_star2_O0/akumrao[P]videoAnalyzer/core/predict.c
// Function: predict_8x8_dc(unsigned char*, int)
static void predict_8x8_dc( uint8_t *src, int i_stride )
{
    int x,y;
    int s0 = 0, s1 = 0, s2 = 0, s3 = 0;
    int dc0, dc1, dc2, dc3;
    int i;

    /* First do :
          s0 s1
       s2
       s3
    */
    for( i = 0; i < 4; i++ )
    {
        s0 += src[i - i_stride];
        s1 += src[i + 4 - i_stride];
        s2 += src[-1 + i * i_stride];
        s3 += src[-1 + (i+4)*i_stride];
    }
    /* now calculate
       dc0 dc1
       dc2 dc3
     */
    dc0 = ( s0 + s2 + 4 ) >> 3;
    dc1 = ( s1 + 2 ) >> 2;
    dc2 = ( s3 + 2 ) >> 2;
    dc3 = ( s1 + s3 + 4 ) >> 3;

    for( y = 0; y < 4; y++ )
    {
        for( x = 0; x < 4; x++ )
        {
            src[             x    ] = dc0;
            src[             x + 4] = dc1;
            src[4*i_stride + x    ] = dc2;
            src[4*i_stride + x + 4] = dc3;
        }
        src += i_stride;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x38(%rbp)
cmpl $0x4, -0x38(%rbp)
jge 0xd252
movq -0x8(%rbp), %rax
movl -0x38(%rbp), %ecx
subl -0xc(%rbp), %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
addl -0x18(%rbp), %eax
movl %eax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movl -0x38(%rbp), %ecx
addl $0x4, %ecx
subl -0xc(%rbp), %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movl -0x38(%rbp), %ecx
imull -0xc(%rbp), %ecx
addl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movl -0x38(%rbp), %ecx
addl $0x4, %ecx
imull -0xc(%rbp), %ecx
addl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
addl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0xd1ce
movl -0x18(%rbp), %eax
addl -0x20(%rbp), %eax
addl $0x4, %eax
sarl $0x3, %eax
movl %eax, -0x28(%rbp)
movl -0x1c(%rbp), %eax
addl $0x2, %eax
sarl $0x2, %eax
movl %eax, -0x2c(%rbp)
movl -0x24(%rbp), %eax
addl $0x2, %eax
sarl $0x2, %eax
movl %eax, -0x30(%rbp)
movl -0x1c(%rbp), %eax
addl -0x24(%rbp), %eax
addl $0x4, %eax
sarl $0x3, %eax
movl %eax, -0x34(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x4, -0x14(%rbp)
jge 0xd328
movl $0x0, -0x10(%rbp)
cmpl $0x4, -0x10(%rbp)
jge 0xd309
movl -0x28(%rbp), %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x2c(%rbp), %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movl -0x10(%rbp), %ecx
addl $0x4, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x30(%rbp), %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movl -0xc(%rbp), %ecx
shll $0x2, %ecx
addl -0x10(%rbp), %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x34(%rbp), %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movl -0xc(%rbp), %ecx
shll $0x2, %ecx
addl -0x10(%rbp), %ecx
addl $0x4, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xd2a0
movl -0xc(%rbp), %ecx
movq -0x8(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xd28f
popq %rbp
retq
nopw (%rax,%rax)