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

	t.hact = 1 + (x[2] | (x[3] << 8));
	t.vact = 1 + (x[4] | (x[5] << 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;
	}
	if (x[0] & 0x10)
		s += ", refresh rate * (1000/1001) supported";

	t.rb = RB_CVT_V2;
	if ((x[0] & 0x03) == 1)
		warn("Unexpected use of 'custom reduced blanking'.\n");
	else if ((x[0] & 0x03) > 1)
		fail("Invalid Timing Formula.\n");

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

	if (x[0] & 0x80) {
		s += ", preferred";
		dispid.preferred_timings.push_back(timings_ext(t, "CVT", s));
	}

	print_timings("    ", &t, "CVT", s.c_str());
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x180, %rsp            # imm = 0x180
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq 0x90(%rsp), %r15
movups %xmm0, 0x44(%r15)
movups %xmm0, 0x38(%r15)
movups %xmm0, 0x28(%r15)
movups %xmm0, 0x18(%r15)
movups %xmm0, 0x8(%r15)
leaq 0x147fc(%rip), %rsi     # 0x28e49
leaq 0x10(%rsp), %rdi
leaq 0xe8(%rsp), %rdx
callq 0x75c4
movd 0x2(%r14), %xmm0
punpcklwd 0x14533(%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 0x38fe
movl 0x98(%rsp), %esi
leaq 0x50(%rsp), %rdi
callq 0x7675
leaq 0x69fb(%rip), %rdx      # 0x1b095
leaq 0x30(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x75a4
movl 0x9c(%rsp), %esi
leaq 0x70(%rsp), %rdi
callq 0x7675
leaq 0xe8(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x70(%rsp), %rdx
callq 0x76b4
leaq 0x10(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x3480
leaq 0xe8(%rsp), %rdi
callq 0x3130
leaq 0x70(%rsp), %rdi
callq 0x3130
leaq 0x30(%rsp), %rdi
callq 0x3130
leaq 0x50(%rsp), %rdi
callq 0x3130
movzbl (%r14), %eax
shrl $0x5, %eax
andl $0x3, %eax
leaq 0x14039(%rip), %rcx     # 0x28758
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x1474c(%rip), %rsi     # 0x28e7b
jmp 0x14764
leaq 0x1475e(%rip), %rsi     # 0x28e96
jmp 0x14764
leaq 0xfe66(%rip), %rsi      # 0x245a7
leaq 0x10(%rsp), %rdi
callq 0x3450
leaq 0x14767(%rip), %rsi     # 0x28eb9
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
jmp 0x1476e
leaq 0x14726(%rip), %rsi     # 0x28e8a
leaq 0x10(%rsp), %rdi
callq 0x3450
movb (%r14), %al
testb $0x10, %al
je 0x14789
leaq 0x14f7c(%rip), %rsi     # 0x296f8
leaq 0x10(%rsp), %rdi
callq 0x3450
movb (%r14), %al
movl $0x2, 0xa4(%rsp)
andb $0x3, %al
je 0x147be
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x147ab
leaq 0x14f78(%rip), %rsi     # 0x2971f
movb $0x1, %al
jmp 0x147b4
leaq 0x14f9b(%rip), %rsi     # 0x2974d
xorl %eax, %eax
movzbl %al, %edi
xorl %eax, %eax
callq 0x362c
movzbl 0x6(%r14), %esi
incl %esi
leaq 0x90(%rsp), %rdx
movq %rbx, %rdi
callq 0x19e2a
cmpb $0x0, (%r14)
jns 0x1484c
leaq 0x146fc(%rip), %rsi     # 0x28ede
leaq 0x10(%rsp), %rdi
callq 0x3450
leaq 0x165db(%rip), %rsi     # 0x2adce
leaq 0x30(%rsp), %rdi
leaq 0x50(%rsp), %rdx
callq 0x75c4
leaq 0xe8(%rsp), %rdi
leaq 0x90(%rsp), %rsi
leaq 0x30(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0xbb34
leaq 0x928(%rbx), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x120e8
leaq 0xe8(%rsp), %rdi
callq 0x78cc
leaq 0x30(%rsp), %rdi
callq 0x3130
movq 0x10(%rsp), %r8
movl $0x1, (%rsp)
leaq 0xac38(%rip), %rsi      # 0x1f497
leaq 0x16568(%rip), %rcx     # 0x2adce
leaq 0x90(%rsp), %rdx
movq %rbx, %rdi
xorl %r9d, %r9d
callq 0x3af0
leaq 0x10(%rsp), %rdi
callq 0x3130
addq $0x180, %rsp            # imm = 0x180
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x78cc
jmp 0x148a5
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
jmp 0x148e6
jmp 0x148ef
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x3130
jmp 0x148c3
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x3130
jmp 0x148d2
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x3130
jmp 0x148e1
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x3130
jmp 0x148f2
jmp 0x148ef
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x3130
movq %rbx, %rdi
callq 0x3430