// File: /workspace/github_c_makefile_star2_O1/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 0x2536c
cmpq $0x0, 0x530(%rbx)
je 0x18199
movzwl 0x7cb0(%rbx), %eax
cmpq $0x2541, %rax           # imm = 0x2541
ja 0x18021
leaq (%rbx,%rax), %rdi
addq $0x7cb2, %rdi           # imm = 0x7CB2
movl $0x2542, %ecx           # imm = 0x2542
subl %eax, %ecx
movswq %cx, %rsi
movsbl 0x547(%rbx), %ecx
leaq 0x222c5(%rip), %rdx     # 0x3a2d8
xorl %eax, %eax
callq 0x1070
addw %ax, 0x7cb0(%rbx)
cmpb $0x0, 0x545(%rbx)
je 0x18064
movzwl 0x7cb0(%rbx), %eax
cmpq $0x2541, %rax           # imm = 0x2541
ja 0x18064
leaq (%rbx,%rax), %rdi
addq $0x7cb2, %rdi           # imm = 0x7CB2
movl $0x2542, %ecx           # imm = 0x2542
subl %eax, %ecx
movswq %cx, %rsi
leaq 0x22296(%rip), %rdx     # 0x3a2ec
xorl %eax, %eax
callq 0x1070
addw %ax, 0x7cb0(%rbx)
movsbl 0x545(%rbx), %r15d
testl %r15d, %r15d
je 0x180db
leaq 0x7cb2(%rbx), %r12
leaq 0x22280(%rip), %r14     # 0x3a2ff
movsbl 0x547(%rbx), %esi
movq %rbx, %rdi
callq 0x1875d
movl %eax, %ebp
movsbl 0x547(%rbx), %esi
movq %rbx, %rdi
callq 0x1875d
movzwl 0x7cb0(%rbx), %ecx
cmpq $0x2541, %rcx           # imm = 0x2541
ja 0x180d6
movq %rcx, %rdi
addq %r12, %rdi
movl $0x2542, %edx           # imm = 0x2542
subl %ecx, %edx
movswq %dx, %rsi
movq %r14, %rdx
movl %ebp, %ecx
movl %eax, %r8d
xorl %eax, %eax
callq 0x1070
addw %ax, 0x7cb0(%rbx)
decl %r15d
jne 0x1807f
cmpb $0x0, 0x546(%rbx)
je 0x1811e
movzwl 0x7cb0(%rbx), %eax
cmpq $0x2541, %rax           # imm = 0x2541
ja 0x1811e
leaq (%rbx,%rax), %rdi
addq $0x7cb2, %rdi           # imm = 0x7CB2
movl $0x2542, %ecx           # imm = 0x2542
subl %eax, %ecx
movswq %cx, %rsi
leaq 0x2223f(%rip), %rdx     # 0x3a34f
xorl %eax, %eax
callq 0x1070
addw %ax, 0x7cb0(%rbx)
movsbl 0x546(%rbx), %r15d
testl %r15d, %r15d
je 0x18195
leaq 0x7cb2(%rbx), %r12
leaq 0x221c6(%rip), %r14     # 0x3a2ff
movsbl 0x547(%rbx), %esi
movq %rbx, %rdi
callq 0x1875d
movl %eax, %ebp
movsbl 0x547(%rbx), %esi
movq %rbx, %rdi
callq 0x1875d
movzwl 0x7cb0(%rbx), %ecx
cmpq $0x2541, %rcx           # imm = 0x2541
ja 0x18190
movq %rcx, %rdi
addq %r12, %rdi
movl $0x2542, %edx           # imm = 0x2542
subl %ecx, %edx
movswq %dx, %rsi
movq %r14, %rdx
movl %ebp, %ecx
movl %eax, %r8d
xorl %eax, %eax
callq 0x1070
addw %ax, 0x7cb0(%rbx)
decl %r15d
jne 0x18139
xorl %eax, %eax
jmp 0x1819e
movl $0x4a, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq