// File: /workspace/github_c_makefile_star2_O2/tvlabs[P]edge264/./edge264_slice.c
// Function: parse_residual_block_4x4_cavlc
static noinline int parse_residual_block_4x4_cavlc(Edge264Context *ctx, int i4x4, int nA, int nB, int startIdx) {
		static const uint8_t nC_offset[8] = {184, 184, 80, 80, 0, 0, 0, 0};
		static const int16_t tokens[38 * 8] = {
			543, 539, 535, 531, 527, 522, 517, 512, // 4 <= nC < 8
			661, 662, 657, 658, 653, 675, 654, 649,
			780, 798, 797, 776, 807, 794, 793, 772,
			924, 920, 934, 916, 939, 930, 929, 912,
			1075, 1070, 1065, 1060, 1071, 1066, 1061, 1056,
			1200, 1206, 1201, 1196, 1207, 1202, 1197, 1192,
			1341, 1336, 1339, 1338, 1337, 1332, 1205, 1205,
			1345, 1345, 1340, 1340, 1343, 1343, 1342, 1342,
			1347, 1347, 1347, 1347, 1346, 1346, 1346, 1346,
			1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344,
			261, 261, 261, 261, 256, 256, 256, 256, // 2 <= cN < 4
			531, 531, 527, 527, 394, 394, 394, 394,
			795, 782, 781, 772, 663, 663, 649, 649,
			799, 799, 786, 786, 785, 785, 776, 776,
			931, 931, 918, 918, 917, 917, 908, 908,
			1044, 1044, 1050, 1050, 1049, 1049, 1040, 1040,
			1191, 1191, 1182, 1182, 1181, 1181, 1176, 1176,
			1455, 1446, 1445, 1440, 1451, 1442, 1441, 1436,
			1580, 1582, 1581, 1576, 1587, 1578, 1577, 1572,
			1723, 1718, 1717, 1716, 1719, 1714, 1713, 1712,
			1853, 1852, 1854, 1849, 1722, 1722, 1720, 1720,
			1859, 1859, 1858, 1858, 1857, 1857, 1856, 1856,
			1727, 1727, 1727, 1727, 1727, 1727, 1727, 1727,
			128, 128, 128, 128, 128, 128, 128, 128, // 0 <= nC < 2
			261, 261, 261, 261, 261, 261, 261, 261,
			394, 394, 394, 394, 394, 394, 394, 394,
			777, 777, 772, 772, 655, 655, 655, 655,
			919, 919, 910, 910, 787, 787, 787, 787,
			1051, 1051, 1042, 1042, 1037, 1037, 1032, 1032,
			1183, 1183, 1174, 1174, 1169, 1169, 1164, 1164,
			1315, 1315, 1306, 1306, 1301, 1301, 1296, 1296,
			1447, 1447, 1438, 1438, 1433, 1433, 1428, 1428,
			1696, 1702, 1697, 1692, 1707, 1698, 1693, 1688,
			1843, 1838, 1833, 1832, 1839, 1834, 1829, 1828,
			1979, 1974, 1969, 1968, 1975, 1970, 1965, 1964,
			2115, 2110, 2109, 2104, 2111, 2106, 2105, 2100,
			2112, 2112, 2114, 2114, 2113, 2113, 2108, 2108,
			1973, 1973, 1973, 1973, 1973, 1973, 1973, 1973,
		};
		
		int sum = nA + nB;
		int nC = !(ctx->unavail4x4[i4x4] & 3) ? (sum + 1) >> 1 : sum;
		int coeff_token, v;
		if (__builtin_expect(nC < 8, 1)) {
			int leadingZeroBits = clz(ctx->t._gb.msb_cache | (size_t)1 << (SIZE_BIT - 15));
			unsigned suffix = ctx->t._gb.msb_cache >> (SIZE_BIT - 4 - leadingZeroBits) & 7;
			assert(nC >= 0 && nC_offset[nC] + leadingZeroBits * 8 + suffix < 304);
			int token = tokens[nC_offset[nC] + leadingZeroBits * 8 + suffix];
			coeff_token = token & 127;
			v = token >> 7;
		} else {
			coeff_token = (ctx->t._gb.msb_cache >> (SIZE_BIT - 6)) + 4;
			if (coeff_token == 7)
				coeff_token = 0;
			v = 6;
		}
		ctx->t._gb.msb_cache = shld(ctx->t._gb.lsb_cache, ctx->t._gb.msb_cache, v);
		ctx->t._gb.lsb_cache <<= v;
		if (!ctx->t._gb.lsb_cache)
			refill(&ctx->t._gb, 0);
		if (coeff_token) {
			mb->nC[i4x4] = coeff_token >> 2;
			log_mb(ctx, "    - {nC: %u, c: [", nC);
			return parse_residual_coeffs_cavlc(ctx, startIdx, 15, coeff_token);
		} else {
			log_mb(ctx, "    - {nC: %u}\n", nC);
			return 0;
		}
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %r8d, %r14d
movq %rdi, %rbx
leal (%rcx,%rdx), %eax
movslq %esi, %r12
leal (%rcx,%rdx), %ebp
incl %ebp
sarl %ebp
testb $0x3, 0x6d0(%rdi,%r12)
cmovnel %eax, %ebp
cmpl $0x7, %ebp
jg 0x26d95
testl %ebp, %ebp
js 0x26db5
movq 0x18(%rbx), %rax
movq %rax, %rcx
btsq $0x31, %rcx
lzcntq %rcx, %rcx
movb $0x3c, %dl
subb %cl, %dl
shrxq %rdx, %rax, %rdx
andl $0x7, %edx
movl %ebp, %esi
leaq 0xa5d0(%rip), %rdi      # 0x31258
movzbl (%rsi,%rdi), %esi
leal (%rsi,%rcx,8), %ecx
addl %edx, %ecx
cmpl $0x130, %ecx            # imm = 0x130
jae 0x26db5
movl %ecx, %ecx
leaq 0xbc0a(%rip), %rdx      # 0x328b0
movswl (%rdx,%rcx,2), %ecx
movl %ecx, %r15d
andl $0x7f, %r15d
sarl $0x7, %ecx
movq 0x10(%rbx), %rdx
movq %rax, 0x8(%rsp)
shldq %cl, %rdx, %rax
movq %rax, 0x18(%rbx)
shlxq %rcx, 0x10(%rbx), %rax
movq %rax, 0x10(%rbx)
testq %rax, %rax
jne 0x26cdc
movq %rbx, %rdi
callq 0x15327
testl %r15d, %r15d
je 0x26d44
movl %r15d, %eax
shrl $0x2, %eax
movq 0x680(%rbx), %rcx
movb %al, 0x40(%rcx,%r12)
movzwl 0x1cd0(%rbx), %eax
cmpq $0xfff, %rax            # imm = 0xFFF
ja 0x26d2e
leaq (%rbx,%rax), %rdi
addq $0x1cd2, %rdi           # imm = 0x1CD2
movl $0x1000, %ecx           # imm = 0x1000
subl %eax, %ecx
movzwl %cx, %esi
leaq 0xd98c(%rip), %rdx      # 0x346aa
movl %ebp, %ecx
xorl %eax, %eax
callq 0x1070
addw %ax, 0x1cd0(%rbx)
pushq $0xf
popq %rdx
movq %rbx, %rdi
movl %r14d, %esi
movl %r15d, %ecx
callq 0x27f93
movl %eax, %r14d
jmp 0x26d85
movzwl 0x1cd0(%rbx), %eax
xorl %r14d, %r14d
cmpq $0xfff, %rax            # imm = 0xFFF
ja 0x26d85
leaq (%rbx,%rax), %rdi
addq $0x1cd2, %rdi           # imm = 0x1CD2
movl $0x1000, %ecx           # imm = 0x1000
subl %eax, %ecx
movzwl %cx, %esi
leaq 0xd94c(%rip), %rdx      # 0x346be
xorl %r14d, %r14d
movl %ebp, %ecx
xorl %eax, %eax
callq 0x1070
addw %ax, 0x1cd0(%rbx)
movl %r14d, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x18(%rbx), %rax
movq %rax, %rcx
shrq $0x3a, %rcx
addl $0x4, %ecx
xorl %r15d, %r15d
cmpl $0x7, %ecx
cmovnel %ecx, %r15d
pushq $0x6
popq %rcx
jmp 0x26cb4
leaq 0xa75d(%rip), %rdi      # 0x31519
leaq 0xa794(%rip), %rsi      # 0x31557
leaq 0xa79f(%rip), %rcx      # 0x31569
movl $0xfd, %edx
callq 0x1080