// File: /workspace/github_cpp_makefile_star2_O1/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
movaps %xmm0, 0x40(%r15)
movaps %xmm0, 0x30(%r15)
movaps %xmm0, 0x20(%r15)
movaps %xmm0, 0x10(%r15)
movaps %xmm0, (%r15)
movl $0x0, 0x50(%r15)
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x16317(%rip), %rsi     # 0x2ee09
leaq 0x16317(%rip), %rdx     # 0x2ee10
leaq 0x28(%rsp), %rdi
callq 0x8f6e
movzwl 0x2(%r14), %eax
incl %eax
movl %eax, (%r15)
movzwl 0x4(%r14), %eax
incl %eax
movl %eax, 0x4(%r15)
movq %r15, %rdi
callq 0x3c2c
movl 0x128(%rsp), %ebp
movl $0x1, %eax
cmpl $0xa, %ebp
jb 0x18b75
movl $0x4, %eax
movl $0xd1b71759, %ecx       # imm = 0xD1B71759
movl %ebp, %edx
cmpl $0x63, %edx
jbe 0x18b6e
cmpl $0x3e7, %edx            # imm = 0x3E7
jbe 0x18b73
cmpl $0x2710, %edx           # imm = 0x2710
jb 0x18b75
movl %edx, %esi
imulq %rcx, %rsi
shrq $0x2d, %rsi
addl $0x4, %eax
cmpl $0x1869f, %edx          # imm = 0x1869F
movl %esi, %edx
ja 0x18b3d
addl $-0x3, %eax
jmp 0x18b75
addl $-0x2, %eax
jmp 0x18b75
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 0x8c91
leaq 0x84df(%rip), %rsi      # 0x21085
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 0x18bd5
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x18bdc
movups (%rcx), %xmm0
movups %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 0x18c49
movl $0x4, %eax
movl $0xd1b71759, %ecx       # imm = 0xD1B71759
movl %ebp, %edx
cmpl $0x63, %edx
jbe 0x18c42
cmpl $0x3e7, %edx            # imm = 0x3E7
jbe 0x18c47
cmpl $0x2710, %edx           # imm = 0x2710
jb 0x18c49
movl %edx, %esi
imulq %rcx, %rsi
shrq $0x2d, %rsi
addl $0x4, %eax
cmpl $0x1869f, %edx          # imm = 0x1869F
movl %esi, %edx
ja 0x18c11
addl $-0x3, %eax
jmp 0x18c49
addl $-0x2, %eax
jmp 0x18c49
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 0x8c91
movq 0x8(%rsp), %rcx
movq 0x10(%rsp), %r8
movq 0x50(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
cmpq %r15, %rcx
je 0x18c93
movq 0x18(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x18cae
movl $0xf, %esi
cmpq %r12, 0x48(%rsp)
je 0x18ca9
movq 0x58(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x18cbf
movq 0x48(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x30b0
jmp 0x18ccd
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 0x18cfa
movq %rsi, 0x88(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x98(%rsp)
jmp 0x18d00
movups (%rcx), %xmm0
movups %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 0x18d5b
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
je 0x18d72
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x18d89
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0x18da0
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x3260
movzbl (%r14), %eax
shrl $0x5, %eax
andl $0x3, %eax
leaq 0x15977(%rip), %rcx     # 0x2e728
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x1607a(%rip), %rsi     # 0x2ee3b
jmp 0x18df6
leaq 0x1608c(%rip), %rsi     # 0x2ee56
jmp 0x18df6
leaq 0x117ac(%rip), %rsi     # 0x2a57f
leaq 0x28(%rsp), %rdi
callq 0x3420
leaq 0x16095(%rip), %rsi     # 0x2ee79
xorl %edi, %edi
xorl %eax, %eax
callq 0x37ec
jmp 0x18e00
leaq 0x16054(%rip), %rsi     # 0x2ee4a
leaq 0x28(%rsp), %rdi
callq 0x3420
testb $0x10, (%r14)
je 0x18e17
leaq 0x168ab(%rip), %rsi     # 0x2f6b8
leaq 0x28(%rsp), %rdi
callq 0x3420
movl $0x2, 0x134(%rsp)
movzbl (%r14), %eax
andl $0x3, %eax
je 0x18e4e
cmpl $0x1, %eax
jne 0x18e3b
leaq 0x168a8(%rip), %rsi     # 0x2f6df
movb $0x1, %al
jmp 0x18e44
leaq 0x168cb(%rip), %rsi     # 0x2f70d
xorl %eax, %eax
movzbl %al, %edi
xorl %eax, %eax
callq 0x37ec
movzbl 0x6(%r14), %esi
incl %esi
leaq 0x120(%rsp), %rdx
movq %rbx, %rdi
callq 0x1fd24
cmpb $0x0, (%r14)
jns 0x18f27
leaq 0x16028(%rip), %rsi     # 0x2ee9e
leaq 0x28(%rsp), %rdi
callq 0x3420
leaq 0x8(%rsp), %rdi
movq %r15, (%rdi)
leaq 0x17eff(%rip), %rsi     # 0x30d8e
leaq 0x17efb(%rip), %rdx     # 0x30d91
callq 0x8f6e
leaq 0x88(%rsp), %rdi
leaq 0x120(%rsp), %rsi
leaq 0x8(%rsp), %rdx
leaq 0x28(%rsp), %rcx
callq 0xdce2
leaq 0x928(%rbx), %rdi
leaq 0x88(%rsp), %rsi
callq 0x16042
leaq 0x110(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x18eef
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x3260
leaq 0xf0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x18f10
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x18f27
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x28(%rsp), %r8
movl $0x1, (%rsp)
leaq 0xc50d(%rip), %rsi      # 0x25447
leaq 0x17e4d(%rip), %rcx     # 0x30d8e
leaq 0x120(%rsp), %rdx
movq %rbx, %rdi
xorl %r9d, %r9d
callq 0x3ebe
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x18f70
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 0xdd9e
jmp 0x18f97
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x1902d
movq 0x18(%rsp), %rsi
jmp 0x1901e
jmp 0x1902a
movq %rax, %rbx
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x18fd7
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x18fd7
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
je 0x18ff3
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x18ff3
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x1900f
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x1900f
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0x1902d
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x1902d
jmp 0x1902a
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x19049
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x3260
movq %rbx, %rdi
callq 0x3400
nop