// File: /workspace/github_cpp_makefile_star2_O3/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq 0x120(%rsp), %r15
movups %xmm0, 0x44(%r15)
movups %xmm0, 0x38(%r15)
movups %xmm0, 0x28(%r15)
movups %xmm0, 0x18(%r15)
movups %xmm0, 0x8(%r15)
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x16496(%rip), %rsi     # 0x2ee49
leaq 0x16496(%rip), %rdx     # 0x2ee50
leaq 0x28(%rsp), %rdi
callq 0x8d58
movd 0x2(%r14), %xmm0
punpcklwd 0x161ce(%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 0x128(%rsp), %ebp
movl $0x1, %eax
cmpl $0xa, %ebp
jb 0x18a3c
movl $0x4, %eax
movl $0xd1b71759, %ecx       # imm = 0xD1B71759
movl %ebp, %edx
cmpl $0x63, %edx
jbe 0x18a35
cmpl $0x3e7, %edx            # imm = 0x3E7
jbe 0x18a3a
cmpl $0x2710, %edx           # imm = 0x2710
jb 0x18a3c
movl %edx, %esi
imulq %rcx, %rsi
shrq $0x2d, %rsi
addl $0x4, %eax
cmpl $0x1869f, %edx          # imm = 0x1869F
movl %esi, %edx
ja 0x18a04
addl $-0x3, %eax
jmp 0x18a3c
addl $-0x2, %eax
jmp 0x18a3c
decl %eax
movl %eax, %esi
leaq 0x78(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x68(%rsp), %rdi
xorl %edx, %edx
callq 0x32a0
leaq 0x68(%rsp), %r15
movq (%r15), %rdi
movl 0x8(%r15), %esi
movl %ebp, %edx
callq 0x8a6d
leaq 0x8628(%rip), %rsi      # 0x21095
movq %r15, %rdi
callq 0x3420
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x18a9c
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x18aa5
movdqu (%rcx), %xmm0
movdqu %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl 0x12c(%rsp), %ebp
movl $0x1, %eax
cmpl $0xa, %ebp
jb 0x18b12
movl $0x4, %eax
movl $0xd1b71759, %ecx       # imm = 0xD1B71759
movl %ebp, %edx
cmpl $0x63, %edx
jbe 0x18b0b
cmpl $0x3e7, %edx            # imm = 0x3E7
jbe 0x18b10
cmpl $0x2710, %edx           # imm = 0x2710
jb 0x18b12
movl %edx, %esi
imulq %rcx, %rsi
shrq $0x2d, %rsi
addl $0x4, %eax
cmpl $0x1869f, %edx          # imm = 0x1869F
movl %esi, %edx
ja 0x18ada
addl $-0x3, %eax
jmp 0x18b12
addl $-0x2, %eax
jmp 0x18b12
decl %eax
movl %eax, %esi
leaq 0x58(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x48(%rsp), %rdi
xorl %edx, %edx
callq 0x32a0
movq 0x48(%rsp), %rdi
movl 0x50(%rsp), %esi
movl %ebp, %edx
callq 0x8a6d
movq 0x8(%rsp), %rcx
movq 0x10(%rsp), %r8
movq 0x50(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %edi
cmpq %r15, %rcx
je 0x18b5c
movq 0x18(%rsp), %rdi
movq 0x48(%rsp), %rsi
cmpq %rdi, %rax
jbe 0x18b7a
movl $0xf, %edi
cmpq %r12, %rsi
je 0x18b75
movq 0x58(%rsp), %rdi
cmpq %rdi, %rax
jbe 0x18b86
leaq 0x8(%rsp), %rdi
callq 0x30b0
jmp 0x18b94
leaq 0x48(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3290
leaq 0x98(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0x18bc1
movq %rsi, 0x88(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x98(%rsp)
jmp 0x18bc9
movdqu (%rcx), %xmm0
movdqu %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x90(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
movq 0x88(%rsp), %rsi
movq 0x90(%rsp), %rdx
leaq 0x28(%rsp), %rdi
callq 0x30b0
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x18c24
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
je 0x18c3b
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x18c52
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0x18c69
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x3260
movzbl (%r14), %eax
shrl $0x5, %eax
andl $0x3, %eax
leaq 0x15ad6(%rip), %rcx     # 0x2e750
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x161f1(%rip), %rsi     # 0x2ee7b
jmp 0x18cbf
leaq 0x16203(%rip), %rsi     # 0x2ee96
jmp 0x18cbf
leaq 0x1190b(%rip), %rsi     # 0x2a5a7
leaq 0x28(%rsp), %rdi
callq 0x3420
leaq 0x1620c(%rip), %rsi     # 0x2eeb9
xorl %edi, %edi
xorl %eax, %eax
callq 0x37cc
jmp 0x18cc9
leaq 0x161cb(%rip), %rsi     # 0x2ee8a
leaq 0x28(%rsp), %rdi
callq 0x3420
movb (%r14), %al
testb $0x10, %al
je 0x18ce4
leaq 0x16a21(%rip), %rsi     # 0x2f6f8
leaq 0x28(%rsp), %rdi
callq 0x3420
movb (%r14), %al
movl $0x2, 0x134(%rsp)
andb $0x3, %al
je 0x18d19
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x18d06
leaq 0x16a1d(%rip), %rsi     # 0x2f71f
movb $0x1, %al
jmp 0x18d0f
leaq 0x16a40(%rip), %rsi     # 0x2f74d
xorl %eax, %eax
movzbl %al, %edi
xorl %eax, %eax
callq 0x37cc
movzbl 0x6(%r14), %esi
incl %esi
leaq 0x120(%rsp), %rdx
movq %rbx, %rdi
callq 0x1f964
cmpb $0x0, (%r14)
jns 0x18df2
leaq 0x1619d(%rip), %rsi     # 0x2eede
leaq 0x28(%rsp), %rdi
callq 0x3420
leaq 0x8(%rsp), %rdi
movq %r15, (%rdi)
leaq 0x18074(%rip), %rsi     # 0x30dce
leaq 0x18070(%rip), %rdx     # 0x30dd1
callq 0x8d58
leaq 0x88(%rsp), %rdi
leaq 0x120(%rsp), %rsi
leaq 0x8(%rsp), %rdx
leaq 0x28(%rsp), %rcx
callq 0xdb20
leaq 0x928(%rbx), %rdi
leaq 0x88(%rsp), %rsi
callq 0x15ede
leaq 0x110(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x18dba
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x3260
leaq 0xf0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x18ddb
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x18df2
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x28(%rsp), %r8
movl $0x1, (%rsp)
leaq 0xc692(%rip), %rsi      # 0x25497
leaq 0x17fc2(%rip), %rcx     # 0x30dce
leaq 0x120(%rsp), %rdx
movq %rbx, %rdi
xorl %r9d, %r9d
callq 0x3e8c
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x18e3b
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3260
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0xdbdc
jmp 0x18e62
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x18ef8
movq 0x18(%rsp), %rsi
jmp 0x18ee9
jmp 0x18ef5
movq %rax, %rbx
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x18ea2
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x18ea2
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
je 0x18ebe
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x18ebe
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x18eda
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x18eda
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0x18ef8
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x18ef8
jmp 0x18ef5
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x18f14
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3260
movq %rbx, %rdi
callq 0x3400