// File: /workspace/github_c_makefile_star2_O2/tvlabs[P]edge264/./edge264_sei.c
// Function: parse_buffering_period
static int parse_buffering_period(Edge264Decoder *dec) {
	get_ue16(&dec->_gb, 31);
	if (!dec->sps.DPB_format) // if SPS wasn't initialized
		return EBADMSG;
	log_dec(dec, "    delay_bits: %u\n", dec->sps.initial_cpb_removal_delay_length);
	if (dec->sps.nal_hrd_cpb_cnt)
		log_dec(dec, "    nal_hrd_cpbs:\n");
	for (int i = dec->sps.nal_hrd_cpb_cnt; i--; ) {
		int initial_cpb_removal_delay = get_uv(&dec->_gb, dec->sps.initial_cpb_removal_delay_length);
		int initial_cpb_removal_delay_offset = get_uv(&dec->_gb, dec->sps.initial_cpb_removal_delay_length);
		log_dec(dec, "    - initial_cpb_removal_delay: %u\n"
			"      initial_cpb_removal_delay_offset: %u\n",
			initial_cpb_removal_delay, initial_cpb_removal_delay_offset);
	}
	if (dec->sps.vcl_hrd_cpb_cnt)
		log_dec(dec, "    vcl_hrd_cpbs:\n");
	for (int i = dec->sps.vcl_hrd_cpb_cnt; i--; ) {
		int initial_cpb_removal_delay = get_uv(&dec->_gb, dec->sps.initial_cpb_removal_delay_length);
		int initial_cpb_removal_delay_offset = get_uv(&dec->_gb, dec->sps.initial_cpb_removal_delay_length);
		log_dec(dec, "    - initial_cpb_removal_delay: %u\n"
			"      initial_cpb_removal_delay_offset: %u\n",
			initial_cpb_removal_delay, initial_cpb_removal_delay_offset);
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
pushq $0x1f
popq %rsi
callq 0x1f4be
cmpq $0x0, 0x530(%rbx)
je 0x14dad
movzwl 0x7cb0(%rbx), %eax
cmpq $0x2541, %rax           # imm = 0x2541
ja 0x14d61
leaq (%rbx,%rax), %rdi
addq $0x7cb2, %rdi           # imm = 0x7CB2
movl $0x2542, %esi           # imm = 0x2542
subq %rax, %rsi
movsbl 0x547(%rbx), %ecx
leaq 0x1f5bc(%rip), %rdx     # 0x34308
xorl %eax, %eax
callq 0x1070
addw 0x7cb0(%rbx), %ax
movw %ax, 0x7cb0(%rbx)
movb 0x545(%rbx), %cl
testb %cl, %cl
je 0x14dc1
cmpw $0x2541, %ax            # imm = 0x2541
ja 0x14dc3
movzwl %ax, %ecx
leaq (%rbx,%rcx), %rdi
addq $0x7cb2, %rdi           # imm = 0x7CB2
movl $0x2542, %ecx           # imm = 0x2542
subl %eax, %ecx
movzwl %cx, %esi
leaq 0x1f58c(%rip), %rdx     # 0x3431c
xorl %eax, %eax
callq 0x1070
addw 0x7cb0(%rbx), %ax
movw %ax, 0x7cb0(%rbx)
movb 0x545(%rbx), %cl
jmp 0x14dc3
pushq $0x4a
popq %rbp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ecx, %ecx
movsbl %cl, %r15d
leaq 0x7cb2(%rbx), %r12
leaq 0x1f55a(%rip), %r14     # 0x3432f
subl $0x1, %r15d
jb 0x14e35
movsbl 0x547(%rbx), %esi
movq %rbx, %rdi
callq 0x1539a
movl %eax, %ebp
movsbl 0x547(%rbx), %esi
movq %rbx, %rdi
callq 0x1539a
movl %eax, %r8d
movzwl 0x7cb0(%rbx), %eax
cmpq $0x2541, %rax           # imm = 0x2541
ja 0x14dd5
leaq (%r12,%rax), %rdi
movl $0x2542, %esi           # imm = 0x2542
subq %rax, %rsi
movq %r14, %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x1070
addw 0x7cb0(%rbx), %ax
movw %ax, 0x7cb0(%rbx)
jmp 0x14dd5
movb 0x546(%rbx), %cl
testb %cl, %cl
je 0x14e72
cmpw $0x2541, %ax            # imm = 0x2541
ja 0x14e74
movzwl %ax, %edi
addq %r12, %rdi
movl $0x2542, %ecx           # imm = 0x2542
subl %eax, %ecx
movzwl %cx, %esi
leaq 0x1f523(%rip), %rdx     # 0x3437f
xorl %eax, %eax
callq 0x1070
addw %ax, 0x7cb0(%rbx)
movb 0x546(%rbx), %cl
jmp 0x14e74
xorl %ecx, %ecx
movsbl %cl, %r13d
leaq 0x1f4b0(%rip), %r14     # 0x3432f
xorl %ebp, %ebp
subl $0x1, %r13d
jb 0x14db0
movsbl 0x547(%rbx), %esi
movq %rbx, %rdi
callq 0x1539a
movl %eax, %r15d
movsbl 0x547(%rbx), %esi
movq %rbx, %rdi
callq 0x1539a
movzwl 0x7cb0(%rbx), %ecx
cmpq $0x2541, %rcx           # imm = 0x2541
ja 0x14e81
movq %rcx, %rdi
addq %r12, %rdi
movl $0x2542, %edx           # imm = 0x2542
subl %ecx, %edx
movzwl %dx, %esi
movq %r14, %rdx
movl %r15d, %ecx
movl %eax, %r8d
xorl %eax, %eax
callq 0x1070
addw %ax, 0x7cb0(%rbx)
jmp 0x14e81