// File: /workspace/github_cpp_makefile_star2_O3/rpavlik[P]edid-decode/parse-displayid-block.cpp
// Function: edid_state::parse_displayid_type_10_timing(unsigned char const*, bool)
void edid_state::parse_displayid_type_10_timing(const unsigned char *x, bool is_cta)
{
	struct timings t = {};
	std::string s("aspect ");

	t.hact = 1 + (x[1] | (x[2] << 8));
	t.vact = 1 + (x[3] | (x[4] << 8));
	calc_ratio(&t);
	s += std::to_string(t.hratio) + ":" + std::to_string(t.vratio);

	switch ((x[0] >> 5) & 0x3) {
	case 0:
		s += ", no 3D stereo";
		break;
	case 1:
		s += ", 3D stereo";
		break;
	case 2:
		s += ", 3D stereo depends on user action";
		break;
	case 3:
		s += ", reserved";
		fail("Reserved stereo 0x03.\n");
		break;
	}

	switch (x[0] & 0x07) {
	case 1: t.rb = RB_CVT_V1; break;
	case 2: t.rb = RB_CVT_V2; break;
	case 3: t.rb = RB_CVT_V3; break;
	default: break;
	}

	if (x[0] & 0x10) {
		if (t.rb == RB_CVT_V2) {
			s += ", refresh rate * (1000/1001) supported";
			t.rb |= RB_ALT;
		} else if (t.rb == RB_CVT_V3) {
			s += ", hblank is 160 pixels";
			t.rb |= RB_ALT;
		} else {
			fail("VR_HB must be 0.\n");
		}
	}
	if (x[0] & 0x80)
		s += ", YCbCr 4:2:0";

	edid_cvt_mode(1 + x[5], t);

	print_timings("    ", &t, "CVT", s.c_str());
	if (is_cta) {
		timings_ext te(t, "CVT", s);
		cta.vec_vtdbs.push_back(te);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movl %edx, 0x34(%rsp)
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq 0x130(%rsp), %r15
movups %xmm0, 0x44(%r15)
movups %xmm0, 0x38(%r15)
movups %xmm0, 0x28(%r15)
movups %xmm0, 0x18(%r15)
movups %xmm0, 0x8(%r15)
leaq 0x48(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x1467e(%rip), %rsi     # 0x2ee49
leaq 0x1467e(%rip), %rdx     # 0x2ee50
leaq 0x38(%rsp), %rdi
callq 0x8d58
movd 0x1(%r14), %xmm0
punpcklwd 0x143b6(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1],xmm0[2],mem[2],xmm0[3],mem[3]
pcmpeqd %xmm1, %xmm1
psubd %xmm1, %xmm0
movq %xmm0, (%r15)
movq %r15, %rdi
callq 0x3c00
movl 0x138(%rsp), %r15d
movl $0x1, %eax
cmpl $0xa, %r15d
jb 0x1a857
movl $0x4, %eax
movl $0xd1b71759, %ecx       # imm = 0xD1B71759
movl %r15d, %edx
cmpl $0x63, %edx
jbe 0x1a850
cmpl $0x3e7, %edx            # imm = 0x3E7
jbe 0x1a855
cmpl $0x2710, %edx           # imm = 0x2710
jb 0x1a857
movl %edx, %esi
imulq %rcx, %rsi
shrq $0x2d, %rsi
addl $0x4, %eax
cmpl $0x1869f, %edx          # imm = 0x1869F
movl %esi, %edx
ja 0x1a81f
addl $-0x3, %eax
jmp 0x1a857
addl $-0x2, %eax
jmp 0x1a857
decl %eax
movl %eax, %esi
leaq 0x88(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x78(%rsp), %rdi
xorl %edx, %edx
callq 0x32a0
leaq 0x78(%rsp), %r12
movq (%r12), %rdi
movl 0x8(%r12), %esi
movl %r15d, %edx
callq 0x8a6d
leaq 0x6807(%rip), %rsi      # 0x21095
movq %r12, %rdi
callq 0x3420
leaq 0x20(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1a8be
movq %rdx, 0x10(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x20(%rsp)
jmp 0x1a8c8
movdqu (%rcx), %xmm0
movdqu %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, 0x18(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl 0x13c(%rsp), %r15d
movl $0x1, %eax
cmpl $0xa, %r15d
jb 0x1a938
movl $0x4, %eax
movl $0xd1b71759, %ecx       # imm = 0xD1B71759
movl %r15d, %edx
cmpl $0x63, %edx
jbe 0x1a931
cmpl $0x3e7, %edx            # imm = 0x3E7
jbe 0x1a936
cmpl $0x2710, %edx           # imm = 0x2710
jb 0x1a938
movl %edx, %esi
imulq %rcx, %rsi
shrq $0x2d, %rsi
addl $0x4, %eax
cmpl $0x1869f, %edx          # imm = 0x1869F
movl %esi, %edx
ja 0x1a900
addl $-0x3, %eax
jmp 0x1a938
addl $-0x2, %eax
jmp 0x1a938
decl %eax
movl %eax, %esi
leaq 0x68(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x58(%rsp), %rdi
xorl %edx, %edx
callq 0x32a0
movq 0x58(%rsp), %rdi
movl 0x60(%rsp), %esi
movl %r15d, %edx
callq 0x8a6d
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %r8
movq 0x60(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %edi
cmpq %r12, %rcx
je 0x1a982
movq 0x20(%rsp), %rdi
movq 0x58(%rsp), %rsi
cmpq %rdi, %rax
jbe 0x1a9a0
movl $0xf, %edi
cmpq %rbp, %rsi
je 0x1a99b
movq 0x68(%rsp), %rdi
cmpq %rdi, %rax
jbe 0x1a9ac
leaq 0x10(%rsp), %rdi
callq 0x30b0
jmp 0x1a9ba
leaq 0x58(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3290
leaq 0xa8(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0x1a9e7
movq %rsi, 0x98(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xa8(%rsp)
jmp 0x1a9ef
movdqu (%rcx), %xmm0
movdqu %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0xa0(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
movq 0x98(%rsp), %rsi
movq 0xa0(%rsp), %rdx
leaq 0x38(%rsp), %rdi
callq 0x30b0
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1aa4a
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x58(%rsp), %rdi
cmpq %rbp, %rdi
je 0x1aa61
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x1aa78
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x78(%rsp), %rdi
cmpq %r13, %rdi
je 0x1aa92
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x3260
movzbl (%r14), %eax
shrl $0x5, %eax
andl $0x3, %eax
leaq 0x13cdd(%rip), %rcx     # 0x2e780
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x143c8(%rip), %rsi     # 0x2ee7b
jmp 0x1aae8
leaq 0x143da(%rip), %rsi     # 0x2ee96
jmp 0x1aae8
leaq 0xfae2(%rip), %rsi      # 0x2a5a7
leaq 0x38(%rsp), %rdi
callq 0x3420
leaq 0x143e3(%rip), %rsi     # 0x2eeb9
xorl %edi, %edi
xorl %eax, %eax
callq 0x37cc
jmp 0x1aaf2
leaq 0x143a2(%rip), %rsi     # 0x2ee8a
leaq 0x38(%rsp), %rdi
callq 0x3420
movzbl (%r14), %eax
movl %eax, %ecx
andl $0x7, %ecx
leal -0x1(%rcx), %edx
cmpb $0x2, %dl
ja 0x1ab0a
movl %ecx, 0x144(%rsp)
testb $0x10, %al
je 0x1ab53
movl 0x144(%rsp), %eax
cmpl $0x2, %eax
je 0x1ab28
cmpl $0x3, %eax
jne 0x1ab43
leaq 0x15408(%rip), %rsi     # 0x2ff2e
jmp 0x1ab2f
leaq 0x14bc9(%rip), %rsi     # 0x2f6f8
leaq 0x38(%rsp), %rdi
callq 0x3420
orb $-0x80, 0x144(%rsp)
jmp 0x1ab53
leaq 0x153fb(%rip), %rsi     # 0x2ff45
xorl %edi, %edi
xorl %eax, %eax
callq 0x37cc
cmpb $0x0, (%r14)
jns 0x1ab6a
leaq 0x14370(%rip), %rsi     # 0x2eed0
leaq 0x38(%rsp), %rdi
callq 0x3420
movzbl 0x5(%r14), %esi
incl %esi
leaq 0x130(%rsp), %rdx
movq %rbx, %rdi
callq 0x1f964
movq 0x38(%rsp), %r8
movl $0x1, (%rsp)
leaq 0xa903(%rip), %rsi      # 0x25497
leaq 0x16233(%rip), %rcx     # 0x30dce
leaq 0x130(%rsp), %rdx
movq %rbx, %rdi
xorl %r9d, %r9d
callq 0x3e8c
cmpb $0x0, 0x34(%rsp)
je 0x1ac63
leaq 0x10(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x16206(%rip), %rsi     # 0x30dce
leaq 0x16202(%rip), %rdx     # 0x30dd1
callq 0x8d58
leaq 0x98(%rsp), %rdi
leaq 0x130(%rsp), %rsi
leaq 0x10(%rsp), %rdx
leaq 0x38(%rsp), %rcx
callq 0xdb20
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x1ac0a
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3260
addq $0x1a8, %rbx            # imm = 0x1A8
leaq 0x98(%rsp), %rsi
movq %rbx, %rdi
callq 0xdbb0
leaq 0x120(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1ac42
movq 0x120(%rsp), %rsi
incq %rsi
callq 0x3260
leaq 0x100(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1ac63
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x1ac7f
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x3260
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0xdbdc
jmp 0x1ad42
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x1ad42
movq 0x20(%rsp), %rsi
jmp 0x1ad33
jmp 0x1ad3f
movq %rax, %rbx
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1ace9
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x1ace9
movq %rax, %rbx
movq 0x58(%rsp), %rdi
cmpq %rbp, %rdi
je 0x1ad05
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x1ad05
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x1ad21
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x1ad21
movq %rax, %rbx
movq 0x78(%rsp), %rdi
cmpq %r13, %rdi
je 0x1ad42
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x1ad42
jmp 0x1ad3f
movq %rax, %rbx
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x1ad5e
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x3260
movq %rbx, %rdi
callq 0x3400