// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/parse-cta-block.cpp
// Function: edid_state::cta_vfpdb(unsigned char const*, unsigned int)
void edid_state::cta_vfpdb(const unsigned char *x, unsigned length)
{
	unsigned i;

	if (length == 0) {
		fail("Empty Data Block with length %u.\n", length);
		return;
	}
	cta.preferred_timings.clear();
	for (i = 0; i < length; i++)  {
		unsigned char svr = x[i];
		char suffix[16];

		if ((svr > 0 && svr < 128) || (svr > 192 && svr < 254)) {
			const struct timings *t;
			unsigned char vic = svr;

			sprintf(suffix, "VIC %3u", vic);

			t = find_vic_id(vic);
			if (t) {
				print_timings("    ", t, suffix);
				cta.preferred_timings.push_back(timings_ext(*t, suffix, ""));
			} else {
				printf("    %s: Unknown\n", suffix);
				fail("Unknown VIC %u.\n", vic);
			}

		} else if (svr >= 129 && svr <= 144) {
			sprintf(suffix, "DTD %3u", svr - 128);
			if (svr >= cta.preparsed_total_dtds + 129) {
				printf("    %s: Invalid\n", suffix);
				fail("Invalid DTD %u.\n", svr - 128);
			} else {
				printf("    %s\n", suffix);
				cta.preferred_timings.push_back(timings_ext(svr, suffix));
			}
		} else if (svr >= 145 && svr <= 160) {
			sprintf(suffix, "VTDB %3u", svr - 144);
			if (svr >= cta.preparsed_total_vtdbs + 145) {
				printf("    %s: Invalid\n", suffix);
				fail("Invalid VTDB %u.\n", svr - 144);
			} else {
				printf("    %s\n", suffix);
				cta.preferred_timings.push_back(timings_ext(svr, suffix));
			}
		} else if (svr == 254) {
			sprintf(suffix, "T8VTDB");
			if (!cta.preparsed_has_t8vtdb) {
				printf("    %s: Invalid\n", suffix);
				fail("Invalid T8VTDB.\n");
			} else {
				printf("    %s\n", suffix);
				cta.preferred_timings.push_back(timings_ext(svr, suffix));
			}
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rsi, 0x48(%rsp)
testl %edx, %edx
je 0xcc1d
movl %edx, %ebp
movq %rdi, 0x20(%rsp)
addq $0x1c0, %rdi            # imm = 0x1C0
movq %rdi, 0x18(%rsp)
callq 0xbc14
movl %ebp, %r12d
leaq 0x50(%rsp), %r13
leaq 0x28(%rsp), %r14
xorl %r15d, %r15d
cmpq %r15, %r12
je 0xcc0b
movq 0x48(%rsp), %rax
movzbl (%rax,%r15), %ebp
testb %bpl, %bpl
setle %al
leal 0x3f(%rbp), %ecx
cmpb $0x3d, %cl
setae %cl
testb %cl, %al
jne 0xc9de
movq %r13, %rdi
leaq 0xdfd6(%rip), %rsi      # 0x1a904
movl %ebp, %edx
xorl %eax, %eax
callq 0x3070
movl %ebp, %edi
callq 0xbf2b
testq %rax, %rax
je 0xcaf1
movq %rax, %r14
movl $0x1, (%rsp)
movq 0x20(%rsp), %rdi
leaq 0x12b3a(%rip), %rsi     # 0x1f497
movq %rax, %rdx
movq %r13, %rcx
leaq 0xe31f(%rip), %rbp      # 0x1ac89
movq %rbp, %r8
xorl %r9d, %r9d
callq 0x3af0
leaq 0x28(%rsp), %rdi
movq %r13, %rsi
leaq 0x17(%rsp), %rdx
callq 0x75c4
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
leaq 0x16(%rsp), %rdx
callq 0x75c4
leaq 0x80(%rsp), %rbp
movq %rbp, %rdi
movq %r14, %rsi
leaq 0x28(%rsp), %r14
movq %r14, %rdx
movq %rbx, %rcx
callq 0xbb34
movq 0x18(%rsp), %rdi
movq %rbp, %rsi
callq 0x120e8
movq %rbp, %rdi
callq 0x78cc
leaq 0x60(%rsp), %rdi
callq 0x3130
jmp 0xcbad
leal 0x7f(%rbp), %eax
cmpb $0xf, %al
ja 0xca64
leal -0x80(%rbp), %r14d
movq %r13, %rdi
leaq 0x1778f(%rip), %rsi     # 0x24182
movl %r14d, %edx
xorl %eax, %eax
callq 0x3070
movq 0x20(%rsp), %rax
movl 0x180(%rax), %eax
movl $0x81, %ecx
addl %ecx, %eax
cmpl %ebp, %eax
jbe 0xcb12
leaq 0x17d09(%rip), %rdi     # 0x24727
movq %r13, %rsi
xorl %eax, %eax
callq 0x3030
leaq 0x28(%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
leaq 0x60(%rsp), %rdx
callq 0x75c4
leaq 0x80(%rsp), %rbx
movq %rbx, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x11e20
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
callq 0x120e8
jmp 0xcba5
leal 0x6f(%rbp), %eax
cmpb $0xf, %al
ja 0xcb31
leal -0x90(%rbp), %r14d
movq %r13, %rdi
leaq 0x1772c(%rip), %rsi     # 0x241ac
movl %r14d, %edx
xorl %eax, %eax
callq 0x3070
movq 0x20(%rsp), %rax
movl 0x1a0(%rax), %eax
movl $0x91, %ecx
addl %ecx, %eax
cmpl %ebp, %eax
jbe 0xcbb7
leaq 0x17c7c(%rip), %rdi     # 0x24727
movq %r13, %rsi
xorl %eax, %eax
callq 0x3030
leaq 0x28(%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
leaq 0x60(%rsp), %rdx
callq 0x75c4
leaq 0x80(%rsp), %rbx
movq %rbx, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x11e20
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
callq 0x120e8
jmp 0xcba5
leaq 0x17679(%rip), %rdi     # 0x24171
movq %r13, %rsi
xorl %eax, %eax
callq 0x3030
xorl %edi, %edi
leaq 0x1754d(%rip), %rsi     # 0x24058
movl %ebp, %edx
jmp 0xcbd4
leaq 0x17671(%rip), %rdi     # 0x2418a
movq %r13, %rsi
xorl %eax, %eax
callq 0x3030
xorl %edi, %edi
leaq 0x1766f(%rip), %rsi     # 0x2419b
jmp 0xcbd1
cmpl $0xfe, %ebp
jne 0xcbe0
movl $0x424454, 0x53(%rsp)   # imm = 0x424454
movl $0x54563854, 0x50(%rsp) # imm = 0x54563854
movq 0x20(%rsp), %rax
cmpb $0x0, 0x1d8(%rax)
je 0xcbe8
leaq 0x17bc1(%rip), %rdi     # 0x24727
movq %r13, %rsi
xorl %eax, %eax
callq 0x3030
movq %r14, %rdi
movq %r13, %rsi
leaq 0x60(%rsp), %rdx
callq 0x75c4
leaq 0x80(%rsp), %rbx
movq %rbx, %rdi
movl $0xfe, %esi
movq %r14, %rdx
callq 0x11e20
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
callq 0x120e8
movq %rbx, %rdi
callq 0x78cc
movq %r14, %rdi
callq 0x3130
jmp 0xcbe0
leaq 0x175cc(%rip), %rdi     # 0x2418a
movq %r13, %rsi
xorl %eax, %eax
callq 0x3030
xorl %edi, %edi
leaq 0x175e4(%rip), %rsi     # 0x241b5
movl %r14d, %edx
xorl %eax, %eax
callq 0x362c
leaq 0x28(%rsp), %r14
incq %r15
jmp 0xc8fa
leaq 0x1759b(%rip), %rdi     # 0x2418a
movq %r13, %rsi
xorl %eax, %eax
callq 0x3030
xorl %edi, %edi
leaq 0x175cc(%rip), %rsi     # 0x241ce
xorl %eax, %eax
callq 0x362c
jmp 0xcbe0
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1752b(%rip), %rsi     # 0x2414f
xorl %edi, %edi
xorl %edx, %edx
xorl %eax, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x362c
jmp 0xcc4c
jmp 0xcc62
jmp 0xcc67
jmp 0xcc4c
jmp 0xcc62
jmp 0xcc67
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x78cc
jmp 0xcc8b
jmp 0xcc62
jmp 0xcc67
movq %rax, %rbx
jmp 0xcc8b
movq %rax, %rbx
jmp 0xcc95
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x78cc
jmp 0xcc81
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x3130
leaq 0x28(%rsp), %rdi
callq 0x3130
movq %rbx, %rdi
callq 0x3430
nop