// File: /workspace/github_c_makefile_star2_O0/akumrao[P]videoAnalyzer/core/macroblock.c
// Function: x264_mb_mc_partition_bi(x264_t*, x264_macroblock_t*, int, int)
static void x264_mb_mc_partition_bi(x264_t *h, x264_macroblock_t *mb, int i_part, int i_sub) {LOG_CALL;
    const x264_mb_context_t *ctx = mb->context;

    int mx, my;
    int i_ref;
    int i_width, i_height;
    int x, y;
    int i_dst;
    uint8_t *p_dst;
    int i_src;
    uint8_t *p_src;

    int ch;

    uint8_t tmp[16 * 16];

    x264_mb_partition_getxy(mb, i_part, i_sub, &x, &y);
    x264_mb_partition_size(mb, i_part, i_sub, &i_width, &i_height);

    /* first do l0 */
    x264_mb_partition_get(mb, 0, i_part, i_sub, &i_ref, &mx, &my);
    if (i_ref > h->i_ref0 || i_ref < 0)
    {
        fprintf(stderr, "invalid ref frame\n");
        return;
    }
    i_dst = ctx->i_fdec[0];
    p_dst = ctx->p_fdec[0];
    i_src = ctx->i_fref0[i_ref][0];
    p_src = ctx->p_fref0[i_ref][0];
    h->mc[MC_LUMA](&p_src[4 * (x + y * i_src)], i_src,
            &p_dst[4 * (x + y * i_dst)], i_dst,
            mx, my, 4 * i_width, 4 * i_height);
    for (ch = 0; ch < 2; ch++)
    {
        i_dst = ctx->i_fdec[1 + ch];
        p_dst = ctx->p_fdec[1 + ch];
        i_src = ctx->i_fref0[i_ref][1 + ch];
        p_src = ctx->p_fref0[i_ref][1 + ch];

        h->mc[MC_CHROMA](&p_src[2 * (x + y * i_src)], i_src,
                &p_dst[2 * (x + y * i_dst)], i_dst,
                mx, my, 2 * i_width, 2 * i_height);
    }


    /* next avg with l1 */
    x264_mb_partition_get(mb, 1, i_part, i_sub, &i_ref, &mx, &my);
    if (i_ref > h->i_ref1 || i_ref < 0)
    {
        fprintf(stderr, "invalid ref frame\n");
        return;
    }

    i_dst = ctx->i_fdec[0];
    p_dst = ctx->p_fdec[0];
    i_src = ctx->i_fref1[i_ref][0];
    p_src = ctx->p_fref1[i_ref][0];
    h->mc[MC_LUMA](&p_src[4 * (x + y * i_src)], i_src,
            tmp, 16,
            mx, my, 4 * i_width, 4 * i_height);

    if (mb->i_partition == D_16x16)
    {
        h->pixf.avg[PIXEL_16x16](&p_dst[4 * (x + y * i_dst)], i_dst, tmp, 16);
    } else if (mb->i_partition == D_16x8)
    {
        h->pixf.avg[PIXEL_16x8](&p_dst[4 * (x + y * i_dst)], i_dst, tmp, 16);
    } else if (mb->i_partition == D_8x16)
    {
        h->pixf.avg[PIXEL_8x16](&p_dst[4 * (x + y * i_dst)], i_dst, tmp, 16);
    } else
    {
        fprintf(stderr, "MC BI with D_8x8 unsupported\n");
    }
    for (ch = 0; ch < 2; ch++)
    {
        i_dst = ctx->i_fdec[1 + ch];
        p_dst = ctx->p_fdec[1 + ch];
        i_src = ctx->i_fref1[i_ref][1 + ch];
        p_src = ctx->p_fref1[i_ref][1 + ch];

        h->mc[MC_CHROMA](&p_src[2 * (x + y * i_src)], i_src,
                tmp, 8,
                mx, my, 2 * i_width, 2 * i_height);

        if (mb->i_partition == D_16x16)
        {
            h->pixf.avg[PIXEL_8x8](&p_dst[2 * (x + y * i_dst)], i_dst, tmp, 8);
        } else if (mb->i_partition == D_16x8)
        {
            h->pixf.avg[PIXEL_8x4](&p_dst[2 * (x + y * i_dst)], i_dst, tmp, 8);
        } else if (mb->i_partition == D_8x16)
        {
            h->pixf.avg[PIXEL_4x8](&p_dst[2 * (x + y * i_dst)], i_dst, tmp, 8);
        } else
        {
            fprintf(stderr, "MC BI with D_8x8 unsupported\n");
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
leaq 0x1f800(%rip), %rdi     # 0x28eb0
leaq 0x1fe2a(%rip), %rsi     # 0x294e1
leaq 0x200b1(%rip), %rdx     # 0x2976f
movb $0x0, %al
callq 0x4d20
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
leaq -0x38(%rbp), %rcx
leaq -0x3c(%rbp), %r8
callq 0x7be0
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
leaq -0x30(%rbp), %rcx
leaq -0x34(%rbp), %r8
callq 0x7d70
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
xorl %esi, %esi
leaq -0x2c(%rbp), %r8
leaq -0x24(%rbp), %r9
leaq -0x28(%rbp), %rax
movq %rax, (%rsp)
callq 0x7ef0
movl -0x2c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x10f078(%rcx), %eax
jg 0x9735
cmpl $0x0, -0x2c(%rbp)
jge 0x9752
movq 0x2c894(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
leaq 0x20016(%rip), %rsi     # 0x2975c
movb $0x0, %al
callq 0x2160
jmp 0x9c9c
movq -0x20(%rbp), %rax
movl 0x58(%rax), %eax
movl %eax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
addq $0x1e8, %rax            # imm = 0x1E8
movslq -0x2c(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x4c(%rbp)
movq -0x20(%rbp), %rax
addq $0x68, %rax
movslq -0x2c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movq 0x10f380(%rax), %rax
movq -0x58(%rbp), %rdi
movl -0x38(%rbp), %ecx
movl -0x3c(%rbp), %edx
imull -0x4c(%rbp), %edx
addl %edx, %ecx
shll $0x2, %ecx
movslq %ecx, %rcx
addq %rcx, %rdi
movl -0x4c(%rbp), %esi
movq -0x48(%rbp), %rdx
movl -0x38(%rbp), %ecx
movl -0x3c(%rbp), %r8d
imull -0x40(%rbp), %r8d
addl %r8d, %ecx
shll $0x2, %ecx
movslq %ecx, %rcx
addq %rcx, %rdx
movl -0x40(%rbp), %ecx
movl -0x24(%rbp), %r8d
movl -0x28(%rbp), %r9d
movl -0x30(%rbp), %r11d
shll $0x2, %r11d
movl -0x34(%rbp), %r10d
shll $0x2, %r10d
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
callq *%rax
movl $0x0, -0x5c(%rbp)
cmpl $0x2, -0x5c(%rbp)
jge 0x98fb
movq -0x20(%rbp), %rax
movl -0x5c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl 0x58(%rax,%rcx,4), %eax
movl %eax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movl -0x5c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq 0x40(%rax,%rcx,8), %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
addq $0x1e8, %rax            # imm = 0x1E8
movslq -0x2c(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl -0x5c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x4c(%rbp)
movq -0x20(%rbp), %rax
addq $0x68, %rax
movslq -0x2c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl -0x5c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movq 0x10f388(%rax), %rax
movq -0x58(%rbp), %rdi
movl -0x38(%rbp), %ecx
movl -0x3c(%rbp), %edx
imull -0x4c(%rbp), %edx
addl %edx, %ecx
shll %ecx
movslq %ecx, %rcx
addq %rcx, %rdi
movl -0x4c(%rbp), %esi
movq -0x48(%rbp), %rdx
movl -0x38(%rbp), %ecx
movl -0x3c(%rbp), %r8d
imull -0x40(%rbp), %r8d
addl %r8d, %ecx
shll %ecx
movslq %ecx, %rcx
addq %rcx, %rdx
movl -0x40(%rbp), %ecx
movl -0x24(%rbp), %r8d
movl -0x28(%rbp), %r9d
movl -0x30(%rbp), %r11d
shll %r11d
movl -0x34(%rbp), %r10d
shll %r10d
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
callq *%rax
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x980c
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
movl $0x1, %esi
leaq -0x2c(%rbp), %r8
leaq -0x24(%rbp), %r9
leaq -0x28(%rbp), %rax
movq %rax, (%rsp)
callq 0x7ef0
movl -0x2c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x10f100(%rcx), %eax
jg 0x9934
cmpl $0x0, -0x2c(%rbp)
jge 0x9951
movq 0x2c695(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
leaq 0x1fe17(%rip), %rsi     # 0x2975c
movb $0x0, %al
callq 0x2160
jmp 0x9c9c
movq -0x20(%rbp), %rax
movl 0x58(%rax), %eax
movl %eax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
addq $0x428, %rax            # imm = 0x428
movslq -0x2c(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x4c(%rbp)
movq -0x20(%rbp), %rax
addq $0x2a8, %rax            # imm = 0x2A8
movslq -0x2c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movq 0x10f380(%rax), %rax
movq -0x58(%rbp), %rdi
movl -0x38(%rbp), %ecx
movl -0x3c(%rbp), %edx
imull -0x4c(%rbp), %edx
addl %edx, %ecx
shll $0x2, %ecx
movslq %ecx, %rcx
addq %rcx, %rdi
movl -0x4c(%rbp), %esi
leaq -0x160(%rbp), %rdx
movl -0x24(%rbp), %r8d
movl -0x28(%rbp), %r9d
movl -0x30(%rbp), %r11d
shll $0x2, %r11d
movl -0x34(%rbp), %r10d
shll $0x2, %r10d
movl $0x10, %ecx
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
callq *%rax
movq -0x10(%rbp), %rax
cmpl $0x10, 0x1c(%rax)
jne 0x9a37
movq -0x8(%rbp), %rax
movq 0x10f318(%rax), %rax
movq -0x48(%rbp), %rdi
movl -0x38(%rbp), %ecx
movl -0x3c(%rbp), %edx
imull -0x40(%rbp), %edx
addl %edx, %ecx
shll $0x2, %ecx
movslq %ecx, %rcx
addq %rcx, %rdi
movl -0x40(%rbp), %esi
leaq -0x160(%rbp), %rdx
movl $0x10, %ecx
callq *%rax
jmp 0x9ad5
movq -0x10(%rbp), %rax
cmpl $0xe, 0x1c(%rax)
jne 0x9a78
movq -0x8(%rbp), %rax
movq 0x10f320(%rax), %rax
movq -0x48(%rbp), %rdi
movl -0x38(%rbp), %ecx
movl -0x3c(%rbp), %edx
imull -0x40(%rbp), %edx
addl %edx, %ecx
shll $0x2, %ecx
movslq %ecx, %rcx
addq %rcx, %rdi
movl -0x40(%rbp), %esi
leaq -0x160(%rbp), %rdx
movl $0x10, %ecx
callq *%rax
jmp 0x9ad3
movq -0x10(%rbp), %rax
cmpl $0xf, 0x1c(%rax)
jne 0x9ab9
movq -0x8(%rbp), %rax
movq 0x10f328(%rax), %rax
movq -0x48(%rbp), %rdi
movl -0x38(%rbp), %ecx
movl -0x3c(%rbp), %edx
imull -0x40(%rbp), %edx
addl %edx, %ecx
shll $0x2, %ecx
movslq %ecx, %rcx
addq %rcx, %rdi
movl -0x40(%rbp), %esi
leaq -0x160(%rbp), %rdx
movl $0x10, %ecx
callq *%rax
jmp 0x9ad1
movq 0x2c510(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
leaq 0x1fcbd(%rip), %rsi     # 0x29787
movb $0x0, %al
callq 0x2160
jmp 0x9ad3
jmp 0x9ad5
movl $0x0, -0x5c(%rbp)
cmpl $0x2, -0x5c(%rbp)
jge 0x9c9c
movq -0x20(%rbp), %rax
movl -0x5c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl 0x58(%rax,%rcx,4), %eax
movl %eax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movl -0x5c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq 0x40(%rax,%rcx,8), %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
addq $0x428, %rax            # imm = 0x428
movslq -0x2c(%rbp), %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl -0x5c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x4c(%rbp)
movq -0x20(%rbp), %rax
addq $0x2a8, %rax            # imm = 0x2A8
movslq -0x2c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl -0x5c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movq 0x10f388(%rax), %rax
movq -0x58(%rbp), %rdi
movl -0x38(%rbp), %ecx
movl -0x3c(%rbp), %edx
imull -0x4c(%rbp), %edx
addl %edx, %ecx
shll %ecx
movslq %ecx, %rcx
addq %rcx, %rdi
movl -0x4c(%rbp), %esi
leaq -0x160(%rbp), %rdx
movl -0x24(%rbp), %r8d
movl -0x28(%rbp), %r9d
movl -0x30(%rbp), %r11d
shll %r11d
movl -0x34(%rbp), %r10d
shll %r10d
movl $0x8, %ecx
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
callq *%rax
movq -0x10(%rbp), %rax
cmpl $0x10, 0x1c(%rax)
jne 0x9bf0
movq -0x8(%rbp), %rax
movq 0x10f330(%rax), %rax
movq -0x48(%rbp), %rdi
movl -0x38(%rbp), %ecx
movl -0x3c(%rbp), %edx
imull -0x40(%rbp), %edx
addl %edx, %ecx
shll %ecx
movslq %ecx, %rcx
addq %rcx, %rdi
movl -0x40(%rbp), %esi
leaq -0x160(%rbp), %rdx
movl $0x8, %ecx
callq *%rax
jmp 0x9c8c
movq -0x10(%rbp), %rax
cmpl $0xe, 0x1c(%rax)
jne 0x9c30
movq -0x8(%rbp), %rax
movq 0x10f338(%rax), %rax
movq -0x48(%rbp), %rdi
movl -0x38(%rbp), %ecx
movl -0x3c(%rbp), %edx
imull -0x40(%rbp), %edx
addl %edx, %ecx
shll %ecx
movslq %ecx, %rcx
addq %rcx, %rdi
movl -0x40(%rbp), %esi
leaq -0x160(%rbp), %rdx
movl $0x8, %ecx
callq *%rax
jmp 0x9c8a
movq -0x10(%rbp), %rax
cmpl $0xf, 0x1c(%rax)
jne 0x9c70
movq -0x8(%rbp), %rax
movq 0x10f340(%rax), %rax
movq -0x48(%rbp), %rdi
movl -0x38(%rbp), %ecx
movl -0x3c(%rbp), %edx
imull -0x40(%rbp), %edx
addl %edx, %ecx
shll %ecx
movslq %ecx, %rcx
addq %rcx, %rdi
movl -0x40(%rbp), %esi
leaq -0x160(%rbp), %rdx
movl $0x8, %ecx
callq *%rax
jmp 0x9c88
movq 0x2c359(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
leaq 0x1fb06(%rip), %rsi     # 0x29787
movb $0x0, %al
callq 0x2160
jmp 0x9c8a
jmp 0x9c8c
jmp 0x9c8e
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x9adc
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
nopw %cs:(%rax,%rax)