// File: /workspace/github_c_makefile_star2_O0/tvlabs[P]edge264/./edge264_slice.c
// Function: parse_mb_qp_delta_cabac
static void CAFUNC(parse_mb_qp_delta)
{
	#if !CABAC
		int mb_qp_delta = get_se16(&ctx->t._gb, -26, 25); // FIXME QpBdOffset
		if (mb_qp_delta) {
			int sum = ctx->t.QP[0] + mb_qp_delta;
			int QP_Y = (sum < 0) ? sum + 52 : (sum >= 52) ? sum - 52 : sum;
			mb->QP_s = ctx->t.QP_s = (i8x4){QP_Y, ctx->QP_C[0][QP_Y], ctx->QP_C[1][QP_Y]};
		}
	#else
		int mb_qp_delta_nz = get_ae(ctx, 60 + ctx->mb_qp_delta_nz);
		ctx->mb_qp_delta_nz = mb_qp_delta_nz;
		int mb_qp_delta = 0;
		if (mb_qp_delta_nz) {
			unsigned count = 1, ctxIdx = 62;
			while (get_ae(ctx, ctxIdx) && count < 52) // FIXME QpBdOffset
				count++, ctxIdx = 63;
			mb_qp_delta = count & 1 ? count / 2 + 1 : -(count / 2);
			int sum = ctx->t.QP[0] + mb_qp_delta;
			int QP_Y = (sum < 0) ? sum + 52 : (sum >= 52) ? sum - 52 : sum;
			mb->QP_s = ctx->t.QP_s = (i8x4){QP_Y, ctx->QP_C[0][QP_Y], ctx->QP_C[1][QP_Y]};
		}
	#endif
	log_mb(ctx, "    mb_qp_delta: %d\n", mb_qp_delta);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movsbl 0x651(%rax), %esi
addl $0x3c, %esi
callq 0xae5c0
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, 0x651(%rax)
movl $0x0, -0x10(%rbp)
cmpl $0x0, -0xc(%rbp)
je 0xb0bd5
movl $0x1, -0x14(%rbp)
movl $0x3e, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0xae5c0
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x25(%rbp)
je 0xb0b06
cmpl $0x34, -0x14(%rbp)
setb %al
movb %al, -0x25(%rbp)
movb -0x25(%rbp), %al
testb $0x1, %al
jne 0xb0b0f
jmp 0xb0b21
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movl $0x3f, -0x18(%rbp)
jmp 0xb0ae4
movl -0x14(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xb0b39
movl -0x14(%rbp), %eax
shrl %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xb0b45
movl -0x14(%rbp), %ecx
shrl %ecx
xorl %eax, %eax
subl %ecx, %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movsbl 0x50(%rax), %eax
addl -0x10(%rbp), %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jge 0xb0b6a
movl -0x1c(%rbp), %eax
addl $0x34, %eax
movl %eax, -0x30(%rbp)
jmp 0xb0b87
cmpl $0x34, -0x1c(%rbp)
jl 0xb0b7b
movl -0x1c(%rbp), %eax
subl $0x34, %eax
movl %eax, -0x34(%rbp)
jmp 0xb0b81
movl -0x1c(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x20(%rbp)
movslq -0x20(%rbp), %rdx
movq -0x8(%rbp), %rcx
movzbl 0x1b20(%rcx,%rdx), %eax
movzbl 0x1ae0(%rcx,%rdx), %ecx
movzbl %dl, %edx
vmovd %edx, %xmm0
vpinsrb $0x1, %ecx, %xmm0, %xmm0
vpinsrb $0x2, %eax, %xmm0, %xmm0
vmovd %xmm0, -0x24(%rbp)
movl -0x24(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x50(%rax)
movq -0x8(%rbp), %rax
movq 0x680(%rax), %rax
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rax
movswq 0x1cd0(%rax), %rax
cmpq $0x1000, %rax           # imm = 0x1000
jae 0xb0c3f
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 -0x10(%rbp), %ecx
leaq 0x1fdab(%rip), %rdx     # 0xd09cd
movb $0x0, %al
callq 0x7070
movl %eax, %edx
movq -0x8(%rbp), %rax
movswl 0x1cd0(%rax), %ecx
addl %edx, %ecx
movw %cx, 0x1cd0(%rax)
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)