// File: /workspace/github_c_makefile_star2_O0/tvlabs[P]edge264/./edge264_slice.c
// Function: parse_P_mb_cabac
static inline void CAFUNC(parse_P_mb)
{
	// Inter initializations
	mb->mbIsInterFlag = 1;
	mb->Intra4x4PredMode_v = (i8x16){2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2};
	mb->refIdx_l = (int64_t)(i8x8){0, 0, 0, 0, -1, -1, -1, -1};
	#if CABAC
		mb->absMvd_v[0] = mb->absMvd_v[1] = (i8x16){};
	#endif
	
	// parse mb_skip_run/flag
	#if !CABAC
		if (ctx->mb_skip_run < 0) {
			ctx->mb_skip_run = get_ue32(&ctx->t._gb, 139264);
			log_mb(ctx, "    mb_skip_run: %u\n", ctx->mb_skip_run);
		}
		int mb_skip_flag = ctx->mb_skip_run-- > 0;
	#else
		int mb_skip_flag = get_ae(ctx, 13 - ctx->inc.mb_skip_flag);
		log_mb(ctx, "    mb_skip_flag: %u\n", mb_skip_flag);
	#endif
	
	// earliest handling for P_Skip
	if (mb_skip_flag) {
		#if CABAC
			mb->f.mb_skip_flag = 1;
			ctx->mb_qp_delta_nz = 0;
		#endif
		decode_P_skip(ctx);
		return;
	}
	ctx->transform_8x8_mode_flag = ctx->t.pps.transform_8x8_mode_flag;
	
	// initializations and jumps for mb_type
	#if !CABAC
		int mb_type = get_ue16(&ctx->t._gb, 30);
		log_mb(ctx, "    mb_type: %u\n", mb_type);
		if (mb_type > 4)
			CAJUMP(parse_I_mb, mb_type - 5);
		mb->mvs_v[4] = mb->mvs_v[5] = mb->mvs_v[6] = mb->mvs_v[7] = (i16x8){};
		if (mb_type > 2)
			CAJUMP(parse_P_sub_mb, (mb_type + 12) & 15); // 3->15, 4->0
		CACALL(parse_ref_idx, 0x351 >> (mb_type << 2) & 15); // 0->1, 1->5, 2->3
	#else
		if (get_ae(ctx, 14)) { // Intra
			CAJUMP(parse_I_mb, 17);
		}
		int mb_type = get_ae(ctx, 15); // actually 1 and 3 are swapped
		mb_type += mb_type + get_ae(ctx, 16 + mb_type);
		log_mb(ctx, "    mb_type: %u\n", (4 - mb_type) & 3);
		mb->mvs_v[4] = mb->mvs_v[5] = mb->mvs_v[6] = mb->mvs_v[7] = (i16x8){};
		if (mb_type == 1)
			CAJUMP(parse_P_sub_mb, 15);
		CACALL(parse_ref_idx, (mb_type + 1) | 1); // 0->1, 2->3, 3->5
	#endif
	
	// decoding large blocks
	log_mb(ctx, "    mvds: [");
	if (mb_type == 0) { // 16x16
		mb->f.inter_eqs_s = little_endian32(0x1b5fbbff);
		i16x8 mvd = CACALL(parse_mvd_pair, mb->absMvd, 0);
		decode_inter_16x16(ctx, mvd, 0);
	} else if (mb_type == 2) { // 8x16
		mb->f.inter_eqs_s = little_endian32(0x1b1bbbbb);
		i16x8 mvd0 = CACALL(parse_mvd_pair, mb->absMvd, 0);
		decode_inter_8x16_left(ctx, mvd0, 0);
		i16x8 mvd1 = CACALL(parse_mvd_pair, mb->absMvd, 4);
		decode_inter_8x16_right(ctx, mvd1, 0);
	} else { // 16x8
		mb->f.inter_eqs_s = little_endian32(0x1b5f1b5f);
		i16x8 mvd0 = CACALL(parse_mvd_pair, mb->absMvd, 0);
		decode_inter_16x8_top(ctx, mvd0, 0);
		i16x8 mvd1 = CACALL(parse_mvd_pair, mb->absMvd, 8);
		decode_inter_16x8_bottom(ctx, mvd1, 0);
	}
	log_mb(ctx, "]\n");
	CAJUMP(parse_inter_residual);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x680(%rax), %rax
movb $0x1, 0x2(%rax)
vmovdqa 0x1cf3a(%rip), %xmm0    # 0xc9270
vmovdqa %xmm0, -0x20(%rbp)
vmovdqa -0x20(%rbp), %xmm0
movq -0x8(%rbp), %rax
movq 0x680(%rax), %rax
vmovdqa %xmm0, 0x30(%rax)
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rcx
movq -0x8(%rbp), %rax
movq 0x680(%rax), %rax
movq %rcx, 0x10(%rax)
vpxor %xmm0, %xmm0, %xmm0
vmovdqa %xmm0, -0x40(%rbp)
vmovdqa -0x40(%rbp), %xmm0
movq -0x8(%rbp), %rax
movq 0x680(%rax), %rax
vmovdqa %xmm0, 0x80(%rax)
movq -0x8(%rbp), %rax
movq 0x680(%rax), %rax
vmovdqa %xmm0, 0x70(%rax)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movsbl 0x6c1(%rax), %eax
movl $0xd, %esi
subl %eax, %esi
callq 0xae5c0
movl %eax, -0x44(%rbp)
movq -0x8(%rbp), %rax
movswq 0x1cd0(%rax), %rax
cmpq $0x1000, %rax           # imm = 0x1000
jae 0xac42a
movq -0x8(%rbp), %rdi
addq $0x1cd2, %rdi           # imm = 0x1CD2
movq -0x8(%rbp), %rax
movswl 0x1cd0(%rax), %eax
cltq
addq %rax, %rdi
movq -0x8(%rbp), %rax
movswq 0x1cd0(%rax), %rax
movl $0x1000, %esi           # imm = 0x1000
subq %rax, %rsi
movl -0x44(%rbp), %ecx
leaq 0x2477d(%rip), %rdx     # 0xd0b8a
movb $0x0, %al
callq 0x7070
movl %eax, %edx
movq -0x8(%rbp), %rax
movswl 0x1cd0(%rax), %ecx
addl %edx, %ecx
movw %cx, 0x1cd0(%rax)
cmpl $0x0, -0x44(%rbp)
je 0xac458
movq -0x8(%rbp), %rax
movq 0x680(%rax), %rax
movb $0x1, 0x21(%rax)
movq -0x8(%rbp), %rax
movb $0x0, 0x651(%rax)
movq -0x8(%rbp), %rdi
callq 0x7f9a0
jmp 0xac7e7
movq -0x8(%rbp), %rax
movb 0x22a(%rax), %cl
movq -0x8(%rbp), %rax
movb %cl, 0xdc0(%rax)
movq -0x8(%rbp), %rdi
movl $0xe, %esi
callq 0xae5c0
cmpl $0x0, %eax
je 0xac492
movq -0x8(%rbp), %rdi
movl $0x11, %esi
callq 0xad160
jmp 0xac7e7
movq -0x8(%rbp), %rdi
movl $0xf, %esi
callq 0xae5c0
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
movl %eax, -0xb4(%rbp)
movq -0x8(%rbp), %rdi
movl -0x48(%rbp), %esi
addl $0x10, %esi
callq 0xae5c0
movl %eax, %ecx
movl -0xb4(%rbp), %eax
addl %ecx, %eax
addl -0x48(%rbp), %eax
movl %eax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movswq 0x1cd0(%rax), %rax
cmpq $0x1000, %rax           # imm = 0x1000
jae 0xac53d
movq -0x8(%rbp), %rdi
addq $0x1cd2, %rdi           # imm = 0x1CD2
movq -0x8(%rbp), %rax
movswl 0x1cd0(%rax), %eax
cltq
addq %rax, %rdi
movq -0x8(%rbp), %rax
movswq 0x1cd0(%rax), %rax
movl $0x1000, %esi           # imm = 0x1000
subq %rax, %rsi
movl $0x4, %ecx
subl -0x48(%rbp), %ecx
andl $0x3, %ecx
leaq 0x243f6(%rip), %rdx     # 0xd0916
movb $0x0, %al
callq 0x7070
movl %eax, %edx
movq -0x8(%rbp), %rax
movswl 0x1cd0(%rax), %ecx
addl %edx, %ecx
movw %cx, 0x1cd0(%rax)
vpxor %xmm0, %xmm0, %xmm0
vmovdqa %xmm0, -0x60(%rbp)
vmovdqa -0x60(%rbp), %xmm0
movq -0x8(%rbp), %rax
movq 0x680(%rax), %rax
vmovdqa %xmm0, 0x120(%rax)
movq -0x8(%rbp), %rax
movq 0x680(%rax), %rax
vmovdqa %xmm0, 0x110(%rax)
movq -0x8(%rbp), %rax
movq 0x680(%rax), %rax
vmovdqa %xmm0, 0x100(%rax)
movq -0x8(%rbp), %rax
movq 0x680(%rax), %rax
vmovdqa %xmm0, 0xf0(%rax)
cmpl $0x1, -0x48(%rbp)
jne 0xac5b0
movq -0x8(%rbp), %rdi
movl $0xf, %esi
callq 0xae740
jmp 0xac7e7
movq -0x8(%rbp), %rdi
movl -0x48(%rbp), %esi
addl $0x1, %esi
orl $0x1, %esi
callq 0xaf5c0
movq -0x8(%rbp), %rax
movswq 0x1cd0(%rax), %rax
cmpq $0x1000, %rax           # imm = 0x1000
jae 0xac629
movq -0x8(%rbp), %rdi
addq $0x1cd2, %rdi           # imm = 0x1CD2
movq -0x8(%rbp), %rax
movswl 0x1cd0(%rax), %eax
cltq
addq %rax, %rdi
movq -0x8(%rbp), %rax
movswq 0x1cd0(%rax), %rax
movl $0x1000, %esi           # imm = 0x1000
subq %rax, %rsi
leaq 0x24330(%rip), %rdx     # 0xd093c
movb $0x0, %al
callq 0x7070
movl %eax, %edx
movq -0x8(%rbp), %rax
movswl 0x1cd0(%rax), %ecx
addl %edx, %ecx
movw %cx, 0x1cd0(%rax)
cmpl $0x0, -0x48(%rbp)
jne 0xac675
movq -0x8(%rbp), %rax
movq 0x680(%rax), %rax
movl $0x1b5fbbff, 0x2c(%rax) # imm = 0x1B5FBBFF
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x680(%rax), %rsi
addq $0x70, %rsi
xorl %edx, %edx
callq 0xafc70
vmovdqa %xmm0, -0x70(%rbp)
movq -0x8(%rbp), %rdi
vmovdqa -0x70(%rbp), %xmm0
xorl %esi, %esi
callq 0x813b0
jmp 0xac777
cmpl $0x2, -0x48(%rbp)
jne 0xac6f6
movq -0x8(%rbp), %rax
movq 0x680(%rax), %rax
movl $0x1b1bbbbb, 0x2c(%rax) # imm = 0x1B1BBBBB
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x680(%rax), %rsi
addq $0x70, %rsi
xorl %edx, %edx
callq 0xafc70
vmovdqa %xmm0, -0x80(%rbp)
movq -0x8(%rbp), %rdi
vmovdqa -0x80(%rbp), %xmm0
xorl %esi, %esi
callq 0x81950
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x680(%rax), %rsi
addq $0x70, %rsi
movl $0x4, %edx
callq 0xafc70
vmovdqa %xmm0, -0x90(%rbp)
movq -0x8(%rbp), %rdi
vmovdqa -0x90(%rbp), %xmm0
xorl %esi, %esi
callq 0x81f70
jmp 0xac775
movq -0x8(%rbp), %rax
movq 0x680(%rax), %rax
movl $0x1b5f1b5f, 0x2c(%rax) # imm = 0x1B5F1B5F
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x680(%rax), %rsi
addq $0x70, %rsi
xorl %edx, %edx
callq 0xafc70
vmovdqa %xmm0, -0xa0(%rbp)
movq -0x8(%rbp), %rdi
vmovdqa -0xa0(%rbp), %xmm0
xorl %esi, %esi
callq 0x82560
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x680(%rax), %rsi
addq $0x70, %rsi
movl $0x8, %edx
callq 0xafc70
vmovdqa %xmm0, -0xb0(%rbp)
movq -0x8(%rbp), %rdi
vmovdqa -0xb0(%rbp), %xmm0
xorl %esi, %esi
callq 0x82b90
jmp 0xac777
movq -0x8(%rbp), %rax
movswq 0x1cd0(%rax), %rax
cmpq $0x1000, %rax           # imm = 0x1000
jae 0xac7de
movq -0x8(%rbp), %rdi
addq $0x1cd2, %rdi           # imm = 0x1CD2
movq -0x8(%rbp), %rax
movswl 0x1cd0(%rax), %eax
cltq
addq %rax, %rdi
movq -0x8(%rbp), %rax
movswq 0x1cd0(%rax), %rax
movl $0x1000, %esi           # imm = 0x1000
subq %rax, %rsi
leaq 0x243f7(%rip), %rdx     # 0xd0bb8
movb $0x0, %al
callq 0x7070
movl %eax, %edx
movq -0x8(%rbp), %rax
movswl 0x1cd0(%rax), %ecx
addl %edx, %ecx
movw %cx, 0x1cd0(%rax)
movq -0x8(%rbp), %rdi
callq 0xb0080
addq $0xc0, %rsp
popq %rbp
retq