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

	switch (x[0] & 0xf) {
	case 0:
		s += "1:1";
		t.hratio = t.vratio = 1;
		break;
	case 1:
		s += "5:4";
		t.hratio = 5;
		t.vratio = 4;
		break;
	case 2:
		s += "4:3";
		t.hratio = 4;
		t.vratio = 3;
		break;
	case 3:
		s += "15:9";
		t.hratio = 15;
		t.vratio = 9;
		break;
	case 4:
		s += "16:9";
		t.hratio = 16;
		t.vratio = 9;
		break;
	case 5:
		s += "16:10";
		t.hratio = 16;
		t.vratio = 10;
		break;
	case 6:
		s += "64:27";
		t.hratio = 64;
		t.vratio = 27;
		break;
	case 7:
		s += "256:135";
		t.hratio = 256;
		t.vratio = 135;
		break;
	default:
		s += "undefined";
		if ((x[3] & 0xf) > (dispid.version <= 0x12 ? 7 : 8))
			fail("Unknown aspect 0x%02x.\n", x[3] & 0xf);
		break;
	}

	t.rb = ((x[0] & 0x70) >> 4) == 1 ? RB_CVT_V1 : RB_NONE;
	t.hact = 8 + 8 * x[1];
	t.vact = t.hact * t.vratio / t.hratio;

	edid_cvt_mode(1 + (x[2] & 0x7f), 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 %rbx
subq $0x148, %rsp            # imm = 0x148
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movl $0x0, 0x80(%rsp)
leaq 0x20(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x179db(%rip), %rsi     # 0x2ee49
leaq 0x179db(%rip), %rdx     # 0x2ee50
leaq 0x10(%rsp), %rdi
callq 0x8d58
movzbl (%r14), %eax
andl $0xf, %eax
cmpl $0x7, %eax
ja 0x17728
leaq 0x17202(%rip), %rcx     # 0x2e698
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x179ab(%rip), %rsi     # 0x2ee51
leaq 0x10(%rsp), %rdi
callq 0x3420
leaq 0x3c(%rsp), %rcx
movl $0x1, %ebp
leaq 0x38(%rsp), %rdx
movl $0x1, %eax
jmp 0x175be
leaq 0xd7af(%rip), %rsi      # 0x24c7f
leaq 0x10(%rsp), %rdi
callq 0x3420
leaq 0x38(%rsp), %rcx
movl $0x9, %eax
jmp 0x17592
leaq 0xd78a(%rip), %rsi      # 0x24c7a
leaq 0x10(%rsp), %rdi
callq 0x3420
leaq 0x38(%rsp), %rcx
movl $0x3, %eax
movl $0x4, %ebp
jmp 0x175b9
leaq 0xd77c(%rip), %rsi      # 0x24c91
leaq 0x10(%rsp), %rdi
callq 0x3420
leaq 0x38(%rsp), %rcx
movl $0x9, %eax
movl $0xf, %ebp
jmp 0x175b9
leaq 0x17921(%rip), %rsi     # 0x2ee5b
leaq 0x10(%rsp), %rdi
callq 0x3420
leaq 0x38(%rsp), %rcx
movl $0x87, %eax
movl $0x100, %ebp            # imm = 0x100
jmp 0x175b9
leaq 0xd730(%rip), %rsi      # 0x24c8c
leaq 0x10(%rsp), %rdi
callq 0x3420
leaq 0x38(%rsp), %rcx
movl $0x4, %eax
movl $0x5, %ebp
jmp 0x175b9
leaq 0xd707(%rip), %rsi      # 0x24c85
leaq 0x10(%rsp), %rdi
callq 0x3420
leaq 0x38(%rsp), %rcx
movl $0xa, %eax
movl $0x10, %ebp
jmp 0x175b9
leaq 0x178b5(%rip), %rsi     # 0x2ee55
leaq 0x10(%rsp), %rdi
callq 0x3420
leaq 0x38(%rsp), %rcx
movl $0x1b, %eax
movl $0x40, %ebp
leaq 0x3c(%rsp), %rdx
movl %ebp, (%rcx)
movl %eax, (%rdx)
movb (%r14), %cl
andb $0x70, %cl
xorl %edx, %edx
cmpb $0x10, %cl
sete %dl
leaq 0x30(%rsp), %rcx
movl %edx, 0x14(%rcx)
movzbl 0x1(%r14), %edx
leal 0x8(,%rdx,8), %edx
movl %edx, (%rcx)
imull %edx, %eax
xorl %edx, %edx
divl %ebp
movl %eax, 0x4(%rcx)
movzbl 0x2(%r14), %esi
andl $0x7f, %esi
incl %esi
movq %rbx, %rdi
movq %rcx, %rdx
callq 0x1f964
cmpb $0x0, (%r14)
jns 0x176d9
leaq 0x178c8(%rip), %rsi     # 0x2eede
leaq 0x10(%rsp), %rdi
callq 0x3420
leaq 0xa0(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x1979b(%rip), %rsi     # 0x30dce
leaq 0x19797(%rip), %rdx     # 0x30dd1
leaq 0x90(%rsp), %rdi
callq 0x8d58
leaq 0xb0(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x90(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0xdb20
leaq 0x928(%rbx), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x15ede
leaq 0x138(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1769b
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x3260
leaq 0x118(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x176bc
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x90(%rsp), %rdi
cmpq %r14, %rdi
je 0x176d9
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x10(%rsp), %r8
movl $0x1, (%rsp)
leaq 0xddab(%rip), %rsi      # 0x25497
leaq 0x196db(%rip), %rcx     # 0x30dce
leaq 0x30(%rsp), %rdx
movq %rbx, %rdi
xorl %r9d, %r9d
callq 0x3e8c
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x1771a
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3260
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0xef1f(%rip), %rsi      # 0x2664e
leaq 0x10(%rsp), %rdi
callq 0x3420
movzbl 0x3(%r14), %edx
andl $0xf, %edx
cmpb $0x13, 0x910(%rbx)
movl $0x8, %ecx
sbbl $0x0, %ecx
xorl %ebp, %ebp
movl $0x0, %eax
cmpl %edx, %ecx
jae 0x175c2
xorl %ebp, %ebp
leaq 0x176fb(%rip), %rsi     # 0x2ee63
xorl %edi, %edi
xorl %eax, %eax
callq 0x37cc
xorl %eax, %eax
jmp 0x175c2
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0xdbdc
jmp 0x1778d
movq %rax, %rbx
movq 0x90(%rsp), %rdi
cmpq %r14, %rdi
je 0x177b1
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x177b1
jmp 0x177ae
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x177c8
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3260
movq %rbx, %rdi
callq 0x3400