// File: /workspace/github_c_makefile_star2_O0/tvlabs[P]edge264/./edge264_mvpred.c
// Function: decode_inter_16x16
static inline void decode_inter_16x16(Edge264Context *ctx, i16x8 mvd, int lx)
{
	// compare neighbouring indices and compute mvp
	int refIdx = mb->refIdx[lx * 4];
	int refIdxA = mbA->refIdx[lx * 4 + 1];
	int refIdxB = mbB->refIdx[lx * 4 + 2];
	int eqA = refIdx == refIdxA;
	int refIdxC;
	i16x8 mvp;
	if (__builtin_expect(ctx->unavail4x4[5] & 4, 0)) {
		refIdxC = mbD->refIdx[lx * 4 + 3];
		mvp = (i32x4){mbD->mvs_s[lx * 16 + 15]};
		eqA |= ctx->unavail4x4[0] == 14;
	} else {
		refIdxC = mbC->refIdx[lx * 4 + 2];
		mvp = (i32x4){mbC->mvs_s[lx * 16 + 10]};
	}
	int eq = eqA + (refIdx==refIdxB) * 2 + (refIdx==refIdxC) * 4;
	if (__builtin_expect(0xe9 >> eq & 1, 1)) {
		i16x8 mvA = (i32x4){mbA->mvs_s[lx * 16 + 5]};
		i16x8 mvB = (i32x4){mbB->mvs_s[lx * 16 + 10]};
		mvp = median16(mvA, mvB, mvp);
	} else if (eq == 1) {
		mvp = (i32x4){mbA->mvs_s[lx * 16 + 5]};
	} else if (eq == 2) {
		mvp = (i32x4){mbB->mvs_s[lx * 16 + 10]};
	}
	
	// sum mvp and mvd, broadcast everything to memory and tail-jump to decoding
	i16x8 mv = mvp + mvd;
	i16x8 mvs = broadcast32(mv, 0);
	mb->absMvd_v[lx * 2] = mb->absMvd_v[lx * 2 + 1] = pack_absMvd(mvd);
	mb->mvs_v[lx * 4] = mb->mvs_v[lx * 4 + 1] = mb->mvs_v[lx * 4 + 2] = mb->mvs_v[lx * 4 + 3] = mvs;
	decode_inter(ctx, lx * 16, 16, 16);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x200, %rsp            # imm = 0x200
movq %rdi, -0x108(%rbp)
vmovdqa %xmm0, -0x120(%rbp)
movl %esi, -0x124(%rbp)
movq -0x108(%rbp), %rax
movq 0x680(%rax), %rax
movl -0x124(%rbp), %ecx
shll $0x2, %ecx
movslq %ecx, %rcx
movsbl 0x10(%rax,%rcx), %eax
movl %eax, -0x128(%rbp)
movq -0x108(%rbp), %rax
movq 0x688(%rax), %rax
movl -0x124(%rbp), %ecx
shll $0x2, %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movsbl 0x10(%rax,%rcx), %eax
movl %eax, -0x12c(%rbp)
movq -0x108(%rbp), %rax
movq 0x690(%rax), %rax
movl -0x124(%rbp), %ecx
shll $0x2, %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movsbl 0x10(%rax,%rcx), %eax
movl %eax, -0x130(%rbp)
movl -0x128(%rbp), %eax
cmpl -0x12c(%rbp), %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x134(%rbp)
movq -0x108(%rbp), %rax
movsbl 0x6d5(%rax), %eax
andl $0x4, %eax
cltq
cmpq $0x0, %rax
je 0x1f6d3
movq -0x108(%rbp), %rax
movq 0x6a0(%rax), %rax
movl -0x124(%rbp), %ecx
shll $0x2, %ecx
movslq %ecx, %rcx
movsbl 0x13(%rax,%rcx), %eax
movl %eax, -0x138(%rbp)
movq -0x108(%rbp), %rax
movq 0x6a0(%rax), %rax
movl -0x124(%rbp), %ecx
shll $0x4, %ecx
movslq %ecx, %rcx
vmovd 0xec(%rax,%rcx,4), %xmm0
vmovdqa %xmm0, -0x160(%rbp)
vmovdqa -0x160(%rbp), %xmm0
vmovdqa %xmm0, -0x150(%rbp)
movq -0x108(%rbp), %rax
movsbl 0x6d0(%rax), %eax
cmpl $0xe, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
orl -0x134(%rbp), %eax
movl %eax, -0x134(%rbp)
jmp 0x1f733
movq -0x108(%rbp), %rax
movq 0x698(%rax), %rax
movl -0x124(%rbp), %ecx
shll $0x2, %ecx
movslq %ecx, %rcx
movsbl 0x12(%rax,%rcx), %eax
movl %eax, -0x138(%rbp)
movq -0x108(%rbp), %rax
movq 0x698(%rax), %rax
movl -0x124(%rbp), %ecx
shll $0x4, %ecx
movslq %ecx, %rcx
vmovd 0xd8(%rax,%rcx,4), %xmm0
vmovdqa %xmm0, -0x170(%rbp)
vmovdqa -0x170(%rbp), %xmm0
vmovdqa %xmm0, -0x150(%rbp)
movl -0x134(%rbp), %eax
movl -0x128(%rbp), %ecx
cmpl -0x130(%rbp), %ecx
sete %cl
andb $0x1, %cl
movzbl %cl, %ecx
shll %ecx
addl %ecx, %eax
movl -0x128(%rbp), %ecx
cmpl -0x138(%rbp), %ecx
sete %cl
andb $0x1, %cl
movzbl %cl, %ecx
shll $0x2, %ecx
addl %ecx, %eax
movl %eax, -0x174(%rbp)
movl -0x174(%rbp), %ecx
movl $0xe9, %eax
sarl %cl, %eax
andl $0x1, %eax
cltq
cmpq $0x0, %rax
je 0x1f8e7
movq -0x108(%rbp), %rax
movq 0x688(%rax), %rax
movl -0x124(%rbp), %ecx
shll $0x4, %ecx
movslq %ecx, %rcx
vmovd 0xc4(%rax,%rcx,4), %xmm0
vmovdqa %xmm0, -0x1a0(%rbp)
vmovdqa -0x1a0(%rbp), %xmm0
vmovdqa %xmm0, -0x190(%rbp)
movq -0x108(%rbp), %rax
movq 0x690(%rax), %rax
movl -0x124(%rbp), %ecx
shll $0x4, %ecx
movslq %ecx, %rcx
vmovd 0xd8(%rax,%rcx,4), %xmm0
vmovdqa %xmm0, -0x1c0(%rbp)
vmovdqa -0x1c0(%rbp), %xmm0
vmovdqa %xmm0, -0x1b0(%rbp)
vmovdqa -0x190(%rbp), %xmm2
vmovdqa -0x1b0(%rbp), %xmm1
vmovdqa -0x150(%rbp), %xmm0
vmovdqa %xmm2, -0xe0(%rbp)
vmovdqa %xmm1, -0xf0(%rbp)
vmovdqa %xmm0, -0x100(%rbp)
vmovdqa -0xe0(%rbp), %xmm1
vmovdqa -0xf0(%rbp), %xmm0
vmovdqa %xmm1, -0xa0(%rbp)
vmovdqa %xmm0, -0xb0(%rbp)
vmovdqa -0xa0(%rbp), %xmm0
vmovdqa -0xb0(%rbp), %xmm1
vpmaxsw %xmm1, %xmm0, %xmm1
vmovdqa -0x100(%rbp), %xmm0
vmovdqa %xmm1, -0x60(%rbp)
vmovdqa %xmm0, -0x70(%rbp)
vmovdqa -0x60(%rbp), %xmm0
vmovdqa -0x70(%rbp), %xmm1
vpminsw %xmm1, %xmm0, %xmm1
vmovdqa -0xe0(%rbp), %xmm2
vmovdqa -0xf0(%rbp), %xmm0
vmovdqa %xmm2, -0x80(%rbp)
vmovdqa %xmm0, -0x90(%rbp)
vmovdqa -0x80(%rbp), %xmm0
vmovdqa -0x90(%rbp), %xmm2
vpminsw %xmm2, %xmm0, %xmm0
vmovdqa %xmm1, -0xc0(%rbp)
vmovdqa %xmm0, -0xd0(%rbp)
vmovdqa -0xc0(%rbp), %xmm0
vmovdqa -0xd0(%rbp), %xmm1
vpmaxsw %xmm1, %xmm0, %xmm0
vmovdqa %xmm0, -0x150(%rbp)
jmp 0x1f975
cmpl $0x1, -0x174(%rbp)
jne 0x1f92d
movq -0x108(%rbp), %rax
movq 0x688(%rax), %rax
movl -0x124(%rbp), %ecx
shll $0x4, %ecx
movslq %ecx, %rcx
vmovd 0xc4(%rax,%rcx,4), %xmm0
vmovdqa %xmm0, -0x1d0(%rbp)
vmovdqa -0x1d0(%rbp), %xmm0
vmovdqa %xmm0, -0x150(%rbp)
jmp 0x1f973
cmpl $0x2, -0x174(%rbp)
jne 0x1f971
movq -0x108(%rbp), %rax
movq 0x690(%rax), %rax
movl -0x124(%rbp), %ecx
shll $0x4, %ecx
movslq %ecx, %rcx
vmovd 0xd8(%rax,%rcx,4), %xmm0
vmovdqa %xmm0, -0x1e0(%rbp)
vmovdqa -0x1e0(%rbp), %xmm0
vmovdqa %xmm0, -0x150(%rbp)
jmp 0x1f973
jmp 0x1f975
vmovdqa -0x150(%rbp), %xmm0
vmovdqa -0x120(%rbp), %xmm1
vpaddw %xmm1, %xmm0, %xmm0
vmovdqa %xmm0, -0x1f0(%rbp)
vpbroadcastd -0x1f0(%rbp), %xmm0
vmovdqa %xmm0, -0x200(%rbp)
vmovdqa -0x120(%rbp), %xmm0
vmovdqa %xmm0, -0x40(%rbp)
vpbroadcastd -0x40(%rbp), %xmm0
vmovdqa %xmm0, -0x50(%rbp)
vmovdqa -0x50(%rbp), %xmm1
vmovdqa -0x50(%rbp), %xmm0
vmovdqa %xmm1, -0x20(%rbp)
vmovdqa %xmm0, -0x30(%rbp)
vmovdqa -0x20(%rbp), %xmm0
vmovdqa -0x30(%rbp), %xmm1
vpacksswb %xmm1, %xmm0, %xmm0
vmovdqa %xmm0, -0x10(%rbp)
vmovdqa -0x10(%rbp), %xmm0
vpabsb %xmm0, %xmm0
movq -0x108(%rbp), %rax
movq 0x680(%rax), %rax
addq $0x70, %rax
movl -0x124(%rbp), %ecx
shll %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
vmovdqa %xmm0, (%rax)
movq -0x108(%rbp), %rax
movq 0x680(%rax), %rax
addq $0x70, %rax
movl -0x124(%rbp), %ecx
shll %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
vmovdqa %xmm0, (%rax)
vmovdqa -0x200(%rbp), %xmm0
movq -0x108(%rbp), %rax
movq 0x680(%rax), %rax
addq $0xb0, %rax
movl -0x124(%rbp), %ecx
shll $0x2, %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
vmovdqa %xmm0, (%rax)
movq -0x108(%rbp), %rax
movq 0x680(%rax), %rax
addq $0xb0, %rax
movl -0x124(%rbp), %ecx
shll $0x2, %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
vmovdqa %xmm0, (%rax)
movq -0x108(%rbp), %rax
movq 0x680(%rax), %rax
addq $0xb0, %rax
movl -0x124(%rbp), %ecx
shll $0x2, %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
vmovdqa %xmm0, (%rax)
movq -0x108(%rbp), %rax
movq 0x680(%rax), %rax
addq $0xb0, %rax
movl -0x124(%rbp), %ecx
shll $0x2, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
vmovdqa %xmm0, (%rax)
movq -0x108(%rbp), %rdi
movl -0x124(%rbp), %esi
shll $0x4, %esi
movl $0x10, %ecx
movl %ecx, %edx
callq 0x21380
addq $0x200, %rsp            # imm = 0x200
popq %rbp
retq