// File: /workspace/github_c_makefile_star2_O0/tvlabs[P]edge264/./edge264_slice.c
// Function: parse_Intra16x16_residual_cabac
static void CAFUNC(parse_Intra16x16_residual)
{
	CACALL(parse_mb_qp_delta);
	log_mb(ctx, "    coeffLevels:\n");
	
	// Both AC and DC coefficients are initially parsed to ctx->c[0..15]
	ctx->scan_v[0] = scan_4x4[0];
	#if CABAC
		ctx->sig_inc_v[0] = ctx->last_inc_v[0] = sig_inc_4x4;
	#endif
	for (int iYCbCr = 0; iYCbCr < 3; iYCbCr++) {
		
		// Parse a DC block, then transform it to ctx->c[16..31]
		#if !CABAC
			if (parse_residual_block_4x4_cavlc(ctx, 0, mbA->nC[iYCbCr * 16 + 5], mbB->nC[iYCbCr * 16 + 10], 0)) {
				mb->nC[0] = 0;
				transform_dc4x4(ctx, iYCbCr);
			}
		#else
			ctx->ctxIdxOffsets_l = ctxIdxOffsets_16x16DC[iYCbCr][0];
			if (get_ae(ctx, ctx->ctxIdxOffsets[0] + ctx->inc.coded_block_flags_16x16[iYCbCr])) {
				mb->f.coded_block_flags_16x16[iYCbCr] = 1;
				ctx->coeff_abs_inc_l = (i8x8){6, 7, 8, 9, 9};
				parse_residual_coeffs_cabac(ctx, 0, 15);
				transform_dc4x4(ctx, iYCbCr);
			}
		#endif
		
		// All AC blocks pick a DC coeff, then go to ctx->c[1..15]
		if (mb->bits[0] & 1 << 5) {
			#if CABAC
				ctx->ctxIdxOffsets_l = ctxIdxOffsets_16x16AC[iYCbCr][0];
				ctx->coeff_abs_inc_l = (i8x8){6, 7, 8, 9, 9};
			#endif
			for (int i4x4 = 0; i4x4 < 16; i4x4++) {
				uint8_t *samples = ctx->samples_mb[iYCbCr] + y444[i4x4] * ctx->t.stride[iYCbCr] + x444[i4x4];
				int nA = *((int8_t *)mb->nC + iYCbCr * 16 + ctx->A4x4_int8[i4x4]);
				int nB = *((int8_t *)mb->nC + iYCbCr * 16 + ctx->B4x4_int8[i4x4]);
				#if !CABAC
					if (parse_residual_block_4x4_cavlc(ctx, iYCbCr * 16 + i4x4, nA, nB, 1))
						add_idct4x4(ctx, iYCbCr, i4x4, samples);
					else
						add_dc4x4(ctx, iYCbCr, i4x4, samples);
				#else
					if (get_ae(ctx, ctx->ctxIdxOffsets[0] + ctx->nC_inc[iYCbCr][i4x4] + nA + nB * 2)) {
						mb->nC[iYCbCr * 16 + i4x4] = 1;
						parse_residual_coeffs_cabac(ctx, 1, 15);
						add_idct4x4(ctx, iYCbCr, i4x4, samples);
					} else {
						add_dc4x4(ctx, iYCbCr, i4x4, samples);
					}
				#endif
			}
		}
		ctx->c_v[4] = ctx->c_v[5] = ctx->c_v[6] = ctx->c_v[7] = (i32x4){};
		
		// here is how we share the decoding of luma coefficients with 4:4:4 modes
		if (ctx->t.ChromaArrayType <3)
			CAJUMP(parse_chroma_residual);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0xb0a90
movq -0x8(%rbp), %rax
movswq 0x1cd0(%rax), %rax
cmpq $0x1000, %rax           # imm = 0x1000
jae 0xb2a4c
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 0x1df8c(%rip), %rdx     # 0xd09bb
movb $0x0, %al
callq 0x7070
movl %eax, %edx
movq -0x8(%rbp), %rax
movswl 0x1cd0(%rax), %ecx
addl %edx, %ecx
movw %cx, 0x1cd0(%rax)
vmovdqa 0x1bf9c(%rip), %xmm0    # 0xce9f0
movq -0x8(%rbp), %rax
vmovdqa %xmm0, 0x1aa0(%rax)
movq -0x8(%rbp), %rax
vmovdqa 0x16b54(%rip), %xmm0    # 0xc95c0
vmovdqa %xmm0, 0x1a60(%rax)
movq -0x8(%rbp), %rax
vmovdqa %xmm0, 0x1a20(%rax)
movl $0x0, -0xc(%rbp)
cmpl $0x3, -0xc(%rbp)
jge 0xb2d53
movslq -0xc(%rbp), %rax
shlq $0x4, %rax
leaq 0x1cef0(%rip), %rcx     # 0xcf990
movq (%rax,%rcx), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x1a10(%rax)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movswl 0x1a10(%rax), %esi
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movsbl 0x6c8(%rax,%rcx), %eax
addl %eax, %esi
callq 0xae5c0
cmpl $0x0, %eax
je 0xb2b27
movq -0x8(%rbp), %rax
movq 0x680(%rax), %rax
movslq -0xc(%rbp), %rcx
movb $0x1, 0x28(%rax,%rcx)
movabsq $0x909080706, %rax      # imm = 0x909080706
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x1a18(%rax)
movq -0x8(%rbp), %rdi
xorl %esi, %esi
movl $0xf, %edx
callq 0xb0c50
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xaae40
movq -0x8(%rbp), %rax
movq 0x680(%rax), %rax
movl 0x8(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0xb2ced
movslq -0xc(%rbp), %rax
shlq $0x4, %rax
leaq 0x1ce70(%rip), %rcx     # 0xcf9c0
movq (%rax,%rcx), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x1a10(%rax)
movabsq $0x909080706, %rax      # imm = 0x909080706
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x1a18(%rax)
movl $0x0, -0x24(%rbp)
cmpl $0x10, -0x24(%rbp)
jge 0xb2ceb
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movq 0x668(%rax,%rcx,8), %rax
movslq -0x24(%rbp), %rdx
leaq 0x1bcb8(%rip), %rcx     # 0xce860
movsbl (%rcx,%rdx), %ecx
movq -0x8(%rbp), %rdx
movslq -0xc(%rbp), %rsi
movzwl 0x34(%rdx,%rsi,2), %edx
imull %edx, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movslq -0x24(%rbp), %rdx
leaq 0x1bc83(%rip), %rcx     # 0xce850
movsbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x680(%rax), %rax
addq $0x40, %rax
movl -0xc(%rbp), %ecx
shll $0x4, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq -0x8(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movswl 0xb40(%rcx,%rdx,2), %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rax
movq 0x680(%rax), %rax
addq $0x40, %rax
movl -0xc(%rbp), %ecx
shll $0x4, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq -0x8(%rbp), %rcx
movslq -0x24(%rbp), %rdx
movslq 0xb80(%rcx,%rdx,4), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movswl 0x1a10(%rax), %esi
movq -0x8(%rbp), %rax
addq $0x700, %rax            # imm = 0x700
movslq -0xc(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movslq -0x24(%rbp), %rcx
movsbl (%rax,%rcx), %eax
addl %eax, %esi
addl -0x34(%rbp), %esi
movl -0x38(%rbp), %eax
shll %eax
addl %eax, %esi
callq 0xae5c0
cmpl $0x0, %eax
je 0xb2cc8
movq -0x8(%rbp), %rax
movq 0x680(%rax), %rax
movl -0xc(%rbp), %ecx
shll $0x4, %ecx
addl -0x24(%rbp), %ecx
movslq %ecx, %rcx
movb $0x1, 0x40(%rax,%rcx)
movq -0x8(%rbp), %rdi
movl $0x1, %esi
movl $0xf, %edx
callq 0xb0c50
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x24(%rbp), %edx
movq -0x30(%rbp), %rcx
callq 0x96120
jmp 0xb2cdb
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x24(%rbp), %edx
movq -0x30(%rbp), %rcx
callq 0xa0e10
jmp 0xb2cdd
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xb2b83
jmp 0xb2ced
vpxor %xmm0, %xmm0, %xmm0
vmovdqa %xmm0, -0x50(%rbp)
vmovdqa -0x50(%rbp), %xmm0
movq -0x8(%rbp), %rax
vmovdqa %xmm0, 0x1bd0(%rax)
movq -0x8(%rbp), %rax
vmovdqa %xmm0, 0x1bc0(%rax)
movq -0x8(%rbp), %rax
vmovdqa %xmm0, 0x1bb0(%rax)
movq -0x8(%rbp), %rax
vmovdqa %xmm0, 0x1ba0(%rax)
movq -0x8(%rbp), %rax
movsbl 0x2a(%rax), %eax
cmpl $0x3, %eax
jge 0xb2d43
movq -0x8(%rbp), %rdi
callq 0xb1070
jmp 0xb2d53
jmp 0xb2d45
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xb2a87
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)