// File: /workspace/github_c_makefile_star2_O0/akumrao[P]videoAnalyzer/encoder/macroblock.c
// Function: x264_cabac_mb_mv(x264_t*, x264_macroblock_t*, int, int, int)
static void x264_cabac_mb_mv(x264_t *h, x264_macroblock_t *mb, int i_list, int i_part, int i_sub) {LOG_CALL;
    x264_macroblock_t *mbn;

    int mvd[2];
    int x, y, xn, yn;
    int i_ctxIdxInc;

    int i_absmv0 = 0;
    int i_absmv1 = 0;

    /* get and update mvd */
    x264_mb_partition_mvd(mb, i_list, i_part, i_sub, mvd);

    /* get context */
    x264_mb_partition_getxy(mb, i_part, i_sub, &x, &y);

    /* FIXME not complete for B frame (B_DIRECT and B_DIRECT 8x8 sub */
    /* Left  pixel (-1,0)*/
    xn = x - 1;
    mbn = mb;
    if (xn < 0)
    {
        xn += 4;
        mbn = mb->context->mba;
    }
    if (mbn && !IS_INTRA(mbn->i_type) && !IS_SKIP(mbn->i_type))
    {
        i_absmv0 += abs(mbn->partition[xn][y].mvd[i_list][0]);
        i_absmv1 += abs(mbn->partition[xn][y].mvd[i_list][1]);
    }

    /* Up ( pixel(0,-1)*/
    yn = y - 1;
    mbn = mb;
    if (yn < 0)
    {
        yn += 4;
        mbn = mb->context->mbb;
    }
    if (mbn && !IS_INTRA(mbn->i_type) && !IS_SKIP(mbn->i_type))
    {
        i_absmv0 += abs(mbn->partition[x][yn].mvd[i_list][0]);
        i_absmv1 += abs(mbn->partition[x][yn].mvd[i_list][1]);
    }

    /* x component */
    if (i_absmv0 < 3)
    {
        i_ctxIdxInc = 0;
    } else if (i_absmv0 > 32)
    {
        i_ctxIdxInc = 2;
    } else
    {
        i_ctxIdxInc = 1;
    }

    x264_cabac_mb_mvd(h, 40, i_ctxIdxInc, mvd[0]);

    /* y component */
    if (i_absmv1 < 3)
    {
        i_ctxIdxInc = 0;
    } else if (i_absmv1 > 32)
    {
        i_ctxIdxInc = 2;
    } else
    {
        i_ctxIdxInc = 1;
    }
    x264_cabac_mb_mvd(h, 47, i_ctxIdxInc, mvd[1]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
leaq 0x98bf(%rip), %rdi      # 0x28eb0
leaq 0x104dc(%rip), %rsi     # 0x2fad4
leaq 0x10a97(%rip), %rdx     # 0x30096
movb $0x0, %al
callq 0x4d20
movl $0x0, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
movl -0x1c(%rbp), %ecx
leaq -0x30(%rbp), %r8
callq 0x1a980
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %esi
movl -0x1c(%rbp), %edx
leaq -0x34(%rbp), %rcx
leaq -0x38(%rbp), %r8
callq 0x1ab20
movl -0x34(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpl $0x0, -0x3c(%rbp)
jge 0x1f670
movl -0x3c(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x1f717
movq -0x28(%rbp), %rax
cmpl $0x0, 0x18(%rax)
je 0x1f717
movq -0x28(%rbp), %rax
cmpl $0x1, 0x18(%rax)
je 0x1f717
movq -0x28(%rbp), %rax
cmpl $0x5, 0x18(%rax)
je 0x1f717
movq -0x28(%rbp), %rax
cmpl $0x11, 0x18(%rax)
je 0x1f717
movq -0x28(%rbp), %rax
addq $0x30, %rax
movslq -0x3c(%rbp), %rcx
imulq $0xa0, %rcx, %rcx
addq %rcx, %rax
movslq -0x38(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
movl 0x18(%rax,%rcx,8), %eax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
addl -0x48(%rbp), %eax
movl %eax, -0x48(%rbp)
movq -0x28(%rbp), %rax
addq $0x30, %rax
movslq -0x3c(%rbp), %rcx
imulq $0xa0, %rcx, %rcx
addq %rcx, %rax
movslq -0x38(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
movl 0x1c(%rax,%rcx,8), %eax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
addl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x38(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpl $0x0, -0x40(%rbp)
jge 0x1f747
movl -0x40(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x1f7ee
movq -0x28(%rbp), %rax
cmpl $0x0, 0x18(%rax)
je 0x1f7ee
movq -0x28(%rbp), %rax
cmpl $0x1, 0x18(%rax)
je 0x1f7ee
movq -0x28(%rbp), %rax
cmpl $0x5, 0x18(%rax)
je 0x1f7ee
movq -0x28(%rbp), %rax
cmpl $0x11, 0x18(%rax)
je 0x1f7ee
movq -0x28(%rbp), %rax
addq $0x30, %rax
movslq -0x34(%rbp), %rcx
imulq $0xa0, %rcx, %rcx
addq %rcx, %rax
movslq -0x40(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
movl 0x18(%rax,%rcx,8), %eax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
addl -0x48(%rbp), %eax
movl %eax, -0x48(%rbp)
movq -0x28(%rbp), %rax
addq $0x30, %rax
movslq -0x34(%rbp), %rcx
imulq $0xa0, %rcx, %rcx
addq %rcx, %rax
movslq -0x40(%rbp), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
movl 0x1c(%rax,%rcx,8), %eax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
addl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
cmpl $0x3, -0x48(%rbp)
jge 0x1f7fd
movl $0x0, -0x44(%rbp)
jmp 0x1f815
cmpl $0x20, -0x48(%rbp)
jle 0x1f80c
movl $0x2, -0x44(%rbp)
jmp 0x1f813
movl $0x1, -0x44(%rbp)
jmp 0x1f815
movq -0x8(%rbp), %rdi
movl -0x44(%rbp), %edx
movl -0x30(%rbp), %ecx
movl $0x28, %esi
callq 0x209a0
cmpl $0x3, -0x4c(%rbp)
jge 0x1f838
movl $0x0, -0x44(%rbp)
jmp 0x1f850
cmpl $0x20, -0x4c(%rbp)
jle 0x1f847
movl $0x2, -0x44(%rbp)
jmp 0x1f84e
movl $0x1, -0x44(%rbp)
jmp 0x1f850
movq -0x8(%rbp), %rdi
movl -0x44(%rbp), %edx
movl -0x2c(%rbp), %ecx
movl $0x2f, %esi
callq 0x209a0
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)