// File: /workspace/github_c_makefile_star2_O0/tvlabs[P]edge264/./edge264_sei.c
// Function: parse_pic_timing
static int parse_pic_timing(Edge264Decoder *dec) {
	static const char * const pic_struct_names[16] = {
		"progressive frame", "top field", "bottom field", "top then bottom",
		"bottom then top", "top then bottom then top",
		"bottom then top then bottom", "frame doubling", "frame tripling",
		[9 ... 15] = "Unknown"};
	static const char * const ct_type_names[4] = {
		"progressive", "interlaced", [2 ... 3] = "unknown"};
	
	if (dec->sps.nal_hrd_cpb_cnt | dec->sps.vcl_hrd_cpb_cnt) {
		int cpb_removal_delay = get_uv(&dec->_gb, dec->sps.cpb_removal_delay_length);
		int dpb_output_delay = get_uv(&dec->_gb, dec->sps.dpb_output_delay_length);
		log_dec(dec, "    cpb_removal_delay: %u\n"
			"    dpb_output_delay: %u\n",
			cpb_removal_delay, dpb_output_delay);
	}
	if (dec->sps.pic_struct_present_flag) {
		int pic_struct = get_uv(&dec->_gb, 4);
		int NumClockTS = 0x3be95 >> (pic_struct * 2) & 3;
		log_dec(dec, "    pic_struct: %s (%u)\n",
			pic_struct_names[pic_struct], pic_struct);
		log_dec(dec, "    clock_timestamps:\n");
		while (NumClockTS--) {
			if (!get_u1(&dec->_gb)) // clock_timestamp_flag
				continue;
			unsigned u = get_uv(&dec->_gb, 19);
			if (u & 1 << 10) {
				unsigned v = get_uv(&dec->_gb, 17);
				dec->sS = v >> 11;
				dec->mM = v >> 5 & 0x3f;
				dec->hH = v & 0x1f;
			} else if (get_u1(&dec->_gb)) { // seconds_flag
				unsigned w = get_uv(&dec->_gb, 7);
				dec->sS = w >> 1;
				if (w & 1) {
					unsigned x = get_uv(&dec->_gb, 7);
					dec->mM = x >> 1;
					if (x & 1)
						dec->hH = get_uv(&dec->_gb, 5);
				}
			}
			int tOffset = 0;
			if (dec->sps.time_offset_length)
				tOffset = get_uv(&dec->_gb, dec->sps.time_offset_length);
			log_dec(dec, "      - scan_type: %s (%u)\n"
				"        discontinuity_flag: %u\n"
				"        clockTimestamp: \"%02u:%02u:%02u+%u/%u\"\n",
				ct_type_names[u >> 17], u >> 17,
				u >> 9 & 1,
				dec->hH, dec->mM, dec->sS, (u & 0xff) * (dec->sps.num_units_in_tick * (1 + (u >> 16 & 1))) + tOffset, dec->sps.time_scale);
		}
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x60, %rsp
movq %rdi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movsbl 0x535(%rax), %eax
movq -0x18(%rbp), %rcx
movsbl 0x536(%rcx), %ecx
orl %ecx, %eax
cmpl $0x0, %eax
je 0x6579e
movq -0x18(%rbp), %rdi
movq -0x18(%rbp), %rax
movsbl 0x538(%rax), %esi
callq 0x65e90
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rdi
movq -0x18(%rbp), %rax
movsbl 0x539(%rax), %esi
callq 0x65e90
movl %eax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movswq 0x7ca0(%rax), %rax
cmpq $0x2542, %rax           # imm = 0x2542
jae 0x6579c
movq -0x18(%rbp), %rdi
addq $0x7ca2, %rdi           # imm = 0x7CA2
movq -0x18(%rbp), %rax
movswl 0x7ca0(%rax), %eax
cltq
addq %rax, %rdi
movq -0x18(%rbp), %rax
movswq 0x7ca0(%rax), %rax
movl $0x2542, %esi           # imm = 0x2542
subq %rax, %rsi
movl -0x1c(%rbp), %ecx
movl -0x20(%rbp), %r8d
leaq 0x6afe6(%rip), %rdx     # 0xd0765
movb $0x0, %al
callq 0x7070
movl %eax, %edx
movq -0x18(%rbp), %rax
movswl 0x7ca0(%rax), %ecx
addl %edx, %ecx
movw %cx, 0x7ca0(%rax)
jmp 0x6579e
movq -0x18(%rbp), %rax
cmpb $0x0, 0x53b(%rax)
je 0x65ae5
movq -0x18(%rbp), %rdi
movl $0x4, %esi
callq 0x65e90
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %ecx
shll %ecx
movl $0x3be95, %eax          # imm = 0x3BE95
sarl %cl, %eax
andl $0x3, %eax
movl %eax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movswq 0x7ca0(%rax), %rax
cmpq $0x2542, %rax           # imm = 0x2542
jae 0x6584c
movq -0x18(%rbp), %rdi
addq $0x7ca2, %rdi           # imm = 0x7CA2
movq -0x18(%rbp), %rax
movswl 0x7ca0(%rax), %eax
cltq
addq %rax, %rdi
movq -0x18(%rbp), %rax
movswq 0x7ca0(%rax), %rax
movl $0x2542, %esi           # imm = 0x2542
subq %rax, %rsi
movslq -0x24(%rbp), %rcx
leaq 0x71290(%rip), %rax     # 0xd6ab0
movq (%rax,%rcx,8), %rcx
movl -0x24(%rbp), %r8d
leaq 0x6af6a(%rip), %rdx     # 0xd0799
movb $0x0, %al
callq 0x7070
movl %eax, %edx
movq -0x18(%rbp), %rax
movswl 0x7ca0(%rax), %ecx
addl %edx, %ecx
movw %cx, 0x7ca0(%rax)
movq -0x18(%rbp), %rax
movswq 0x7ca0(%rax), %rax
cmpq $0x2542, %rax           # imm = 0x2542
jae 0x658b3
movq -0x18(%rbp), %rdi
addq $0x7ca2, %rdi           # imm = 0x7CA2
movq -0x18(%rbp), %rax
movswl 0x7ca0(%rax), %eax
cltq
addq %rax, %rdi
movq -0x18(%rbp), %rax
movswq 0x7ca0(%rax), %rax
movl $0x2542, %esi           # imm = 0x2542
subq %rax, %rsi
leaq 0x6af1c(%rip), %rdx     # 0xd07b2
movb $0x0, %al
callq 0x7070
movl %eax, %edx
movq -0x18(%rbp), %rax
movswl 0x7ca0(%rax), %ecx
addl %edx, %ecx
movw %cx, 0x7ca0(%rax)
jmp 0x658b5
movl -0x28(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x28(%rbp)
cmpl $0x0, %eax
je 0x65ae3
movq -0x18(%rbp), %rdi
callq 0x77060
cmpl $0x0, %eax
jne 0x658d9
jmp 0x658b5
movq -0x18(%rbp), %rdi
movl $0x13, %esi
callq 0x65e90
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x6593a
movq -0x18(%rbp), %rdi
movl $0x11, %esi
callq 0x65e90
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
shrl $0xb, %eax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x28(%rax)
movl -0x30(%rbp), %eax
shrl $0x5, %eax
andl $0x3f, %eax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x27(%rax)
movl -0x30(%rbp), %eax
andl $0x1f, %eax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x26(%rax)
jmp 0x659b9
movq -0x18(%rbp), %rdi
callq 0x77060
cmpl $0x0, %eax
je 0x659b7
movq -0x18(%rbp), %rdi
movl $0x7, %esi
callq 0x65e90
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
shrl %eax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x28(%rax)
movl -0x34(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x659b5
movq -0x18(%rbp), %rdi
movl $0x7, %esi
callq 0x65e90
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
shrl %eax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x27(%rax)
movl -0x38(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x659b3
movq -0x18(%rbp), %rdi
movl $0x5, %esi
callq 0x65e90
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x26(%rax)
jmp 0x659b5
jmp 0x659b7
jmp 0x659b9
movl $0x0, -0x3c(%rbp)
movq -0x18(%rbp), %rax
cmpb $0x0, 0x53a(%rax)
je 0x659e4
movq -0x18(%rbp), %rdi
movq -0x18(%rbp), %rax
movsbl 0x53a(%rax), %esi
callq 0x65e90
movl %eax, -0x3c(%rbp)
movq -0x18(%rbp), %rax
movswq 0x7ca0(%rax), %rax
cmpq $0x2542, %rax           # imm = 0x2542
jae 0x65ade
movq -0x18(%rbp), %rdi
addq $0x7ca2, %rdi           # imm = 0x7CA2
movq -0x18(%rbp), %rax
movswl 0x7ca0(%rax), %eax
cltq
addq %rax, %rdi
movq -0x18(%rbp), %rax
movswq 0x7ca0(%rax), %rax
movl $0x2542, %esi           # imm = 0x2542
subq %rax, %rsi
movl -0x2c(%rbp), %eax
shrl $0x11, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x710f4(%rip), %rax     # 0xd6b30
movq (%rax,%rcx,8), %rcx
movl -0x2c(%rbp), %r8d
shrl $0x11, %r8d
movl -0x2c(%rbp), %r9d
shrl $0x9, %r9d
andl $0x1, %r9d
movq -0x18(%rbp), %rax
movsbl 0x26(%rax), %r14d
movq -0x18(%rbp), %rax
movsbl 0x27(%rax), %ebx
movq -0x18(%rbp), %rax
movsbl 0x28(%rax), %r11d
movl -0x2c(%rbp), %r10d
andl $0xff, %r10d
movq -0x18(%rbp), %rax
movl 0x540(%rax), %eax
movl -0x2c(%rbp), %edx
shrl $0x10, %edx
andl $0x1, %edx
addl $0x1, %edx
imull %edx, %eax
imull %eax, %r10d
addl -0x3c(%rbp), %r10d
movq -0x18(%rbp), %rax
movl 0x544(%rax), %eax
leaq 0x6ad1e(%rip), %rdx     # 0xd07c9
movl %r14d, (%rsp)
movl %ebx, 0x8(%rsp)
movl %r11d, 0x10(%rsp)
movl %r10d, 0x18(%rsp)
movl %eax, 0x20(%rsp)
movb $0x0, %al
callq 0x7070
movl %eax, %edx
movq -0x18(%rbp), %rax
movswl 0x7ca0(%rax), %ecx
addl %edx, %ecx
movw %cx, 0x7ca0(%rax)
jmp 0x658b5
jmp 0x65ae5
xorl %eax, %eax
addq $0x60, %rsp
popq %rbx
popq %r14
popq %rbp
retq