// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x20(%rbp)
movl %esi, -0x24(%rbp)
movl %edx, -0x28(%rbp)
movl %ecx, -0x2c(%rbp)
movl %r8d, -0x30(%rbp)
movl -0x28(%rbp), %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
movsbl 0x6d0(%rax,%rcx), %eax
andl $0x3, %eax
cmpl $0x0, %eax
jne 0x95e87
movl -0x34(%rbp), %eax
addl $0x1, %eax
sarl %eax
movl %eax, -0x50(%rbp)
jmp 0x95e8d
movl -0x34(%rbp), %eax
movl %eax, -0x50(%rbp)
movl -0x50(%rbp), %eax
movl %eax, -0x38(%rbp)
cmpl $0x8, -0x38(%rbp)
setl %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x95f69
movq -0x20(%rbp), %rcx
movabsq $0x2000000000000, %rax  # imm = 0x2000000000000
orq 0x18(%rcx), %rax
lzcntq %rax, %rax
movl %eax, -0x44(%rbp)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movl $0x3c, %ecx
subl -0x44(%rbp), %ecx
movl %ecx, %ecx
shrq %cl, %rax
andq $0x7, %rax
movl %eax, -0x48(%rbp)
cmpl $0x0, -0x38(%rbp)
jl 0x95f0a
movslq -0x38(%rbp), %rcx
leaq 0x38bde(%rip), %rax     # 0xcead0
movzbl (%rax,%rcx), %eax
movl -0x44(%rbp), %ecx
shll $0x3, %ecx
addl %ecx, %eax
addl -0x48(%rbp), %eax
cmpl $0x130, %eax            # imm = 0x130
jae 0x95f0a
jmp 0x95f29
leaq 0x3788d(%rip), %rdi     # 0xcd79e
leaq 0x378c4(%rip), %rsi     # 0xcd7dc
movl $0xfd, %edx
leaq 0x378ca(%rip), %rcx     # 0xcd7ee
callq 0x7080
movslq -0x38(%rbp), %rcx
leaq 0x38b9c(%rip), %rax     # 0xcead0
movzbl (%rax,%rcx), %eax
movl -0x44(%rbp), %ecx
shll $0x3, %ecx
addl %ecx, %eax
addl -0x48(%rbp), %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x38b92(%rip), %rax     # 0xceae0
movswl (%rax,%rcx,2), %eax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
andl $0x7f, %eax
movl %eax, -0x3c(%rbp)
movl -0x4c(%rbp), %eax
sarl $0x7, %eax
movl %eax, -0x40(%rbp)
jmp 0x95f90
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
shrq $0x3a, %rax
addq $0x4, %rax
movl %eax, -0x3c(%rbp)
cmpl $0x7, -0x3c(%rbp)
jne 0x95f89
movl $0x0, -0x3c(%rbp)
movl $0x6, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdx
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rcx
movl -0x40(%rbp), %eax
movq %rdx, -0x8(%rbp)
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rdx
movl -0x14(%rbp), %ecx
shldq %cl, %rdx, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movl -0x40(%rbp), %ecx
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdx
movl %ecx, %ecx
shlq %cl, %rdx
movq %rdx, %rcx
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x95ffa
movq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0x65d80
cmpl $0x0, -0x3c(%rbp)
je 0x960a2
movl -0x3c(%rbp), %eax
sarl $0x2, %eax
movb %al, %dl
movq -0x20(%rbp), %rax
movq 0x680(%rax), %rax
movslq -0x24(%rbp), %rcx
movb %dl, 0x40(%rax,%rcx)
movq -0x20(%rbp), %rax
movswq 0x1cd0(%rax), %rax
cmpq $0x1000, %rax           # imm = 0x1000
jae 0x96089
movq -0x20(%rbp), %rdi
addq $0x1cd2, %rdi           # imm = 0x1CD2
movq -0x20(%rbp), %rax
movswl 0x1cd0(%rax), %eax
cltq
addq %rax, %rdi
movq -0x20(%rbp), %rax
movswq 0x1cd0(%rax), %rax
movl $0x1000, %esi           # imm = 0x1000
subq %rax, %rsi
movl -0x38(%rbp), %ecx
leaq 0x3a976(%rip), %rdx     # 0xd09e2
movb $0x0, %al
callq 0x7070
movl %eax, %edx
movq -0x20(%rbp), %rax
movswl 0x1cd0(%rax), %ecx
addl %edx, %ecx
movw %cx, 0x1cd0(%rax)
movq -0x20(%rbp), %rdi
movl -0x30(%rbp), %esi
movl -0x3c(%rbp), %ecx
movl $0xf, %edx
callq 0x9f6f0
movl %eax, -0x18(%rbp)
jmp 0x96113
movq -0x20(%rbp), %rax
movswq 0x1cd0(%rax), %rax
cmpq $0x1000, %rax           # imm = 0x1000
jae 0x9610c
movq -0x20(%rbp), %rdi
addq $0x1cd2, %rdi           # imm = 0x1CD2
movq -0x20(%rbp), %rax
movswl 0x1cd0(%rax), %eax
cltq
addq %rax, %rdi
movq -0x20(%rbp), %rax
movswq 0x1cd0(%rax), %rax
movl $0x1000, %esi           # imm = 0x1000
subq %rax, %rsi
movl -0x38(%rbp), %ecx
leaq 0x3a907(%rip), %rdx     # 0xd09f6
movb $0x0, %al
callq 0x7070
movl %eax, %edx
movq -0x20(%rbp), %rax
movswl 0x1cd0(%rax), %ecx
addl %edx, %ecx
movw %cx, 0x1cd0(%rax)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)