// File: /workspace/github_c_makefile_star2_O3/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 %r12
pushq %rbx
movq %rdi, %rbx
movl $0x1f, %esi
callq 0x25872
cmpq $0x0, 0x530(%rbx)
je 0x1852f
movzwl 0x7cb0(%rbx), %eax
cmpq $0x2541, %rax           # imm = 0x2541
ja 0x183ae
leaq (%rbx,%rax), %rdi
addq $0x7cb2, %rdi           # imm = 0x7CB2
movl $0x2542, %esi           # imm = 0x2542
subq %rax, %rsi
movsbl 0x547(%rbx), %ecx
leaq 0x220bf(%rip), %rdx     # 0x3a458
xorl %eax, %eax
callq 0x1070
addw 0x7cb0(%rbx), %ax
movw %ax, 0x7cb0(%rbx)
movb 0x545(%rbx), %cl
testb %cl, %cl
je 0x18470
movzwl %ax, %eax
cmpl $0x2541, %eax           # imm = 0x2541
ja 0x18401
leaq (%rbx,%rax), %rdi
addq $0x7cb2, %rdi           # imm = 0x7CB2
movl $0x2542, %ecx           # imm = 0x2542
subl %eax, %ecx
movzwl %cx, %esi
leaq 0x2208a(%rip), %rdx     # 0x3a46c
xorl %eax, %eax
callq 0x1070
addw 0x7cb0(%rbx), %ax
movw %ax, 0x7cb0(%rbx)
movb 0x545(%rbx), %cl
testb %cl, %cl
je 0x18470
movsbl %cl, %r15d
leaq 0x7cb2(%rbx), %r12
leaq 0x2206c(%rip), %r14     # 0x3a47f
movsbl 0x547(%rbx), %esi
movq %rbx, %rdi
callq 0x18ad7
movl %eax, %ebp
movsbl 0x547(%rbx), %esi
movq %rbx, %rdi
callq 0x18ad7
movl %eax, %r8d
movzwl 0x7cb0(%rbx), %eax
cmpq $0x2541, %rax           # imm = 0x2541
ja 0x1846b
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)
decl %r15d
jne 0x18413
movb 0x546(%rbx), %cl
testb %cl, %cl
je 0x1852b
movzwl %ax, %eax
cmpl $0x2541, %eax           # imm = 0x2541
ja 0x184be
leaq (%rbx,%rax), %rdi
addq $0x7cb2, %rdi           # imm = 0x7CB2
movl $0x2542, %ecx           # imm = 0x2542
subl %eax, %ecx
movzwl %cx, %esi
leaq 0x2202b(%rip), %rdx     # 0x3a4cf
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x1070
addw %ax, 0x7cb0(%rbx)
movb 0x546(%rbx), %cl
testb %cl, %cl
je 0x18534
movsbl %cl, %r15d
leaq 0x7cb2(%rbx), %r12
leaq 0x21faf(%rip), %r14     # 0x3a47f
movsbl 0x547(%rbx), %esi
movq %rbx, %rdi
callq 0x18ad7
movl %eax, %ebp
movsbl 0x547(%rbx), %esi
movq %rbx, %rdi
callq 0x18ad7
movzwl 0x7cb0(%rbx), %ecx
cmpq $0x2541, %rcx           # imm = 0x2541
ja 0x18526
movq %rcx, %rdi
addq %r12, %rdi
movl $0x2542, %edx           # imm = 0x2542
subl %ecx, %edx
movzwl %dx, %esi
movq %r14, %rdx
movl %ebp, %ecx
movl %eax, %r8d
xorl %eax, %eax
callq 0x1070
addw %ax, 0x7cb0(%rbx)
decl %r15d
jne 0x184d0
xorl %ebp, %ebp
jmp 0x18534
movl $0x4a, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq