// File: /workspace/github_cpp_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
subq $0x140, %rsp            # imm = 0x140
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 0x17824(%rip), %rsi     # 0x2ee09
leaq 0x17824(%rip), %rdx     # 0x2ee10
leaq 0x10(%rsp), %rdi
callq 0x8f6e
movzbl (%r14), %eax
andl $0xf, %eax
cmpl $0x7, %eax
ja 0x1789e
leaq 0x17063(%rip), %rcx     # 0x2e670
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x177f4(%rip), %rsi     # 0x2ee11
leaq 0x10(%rsp), %rdi
callq 0x3420
leaq 0x3c(%rsp), %rax
movl $0x1, %edx
leaq 0x38(%rsp), %rsi
movl $0x1, %ecx
jmp 0x17735
leaq 0xd5e8(%rip), %rsi      # 0x24c2f
leaq 0x10(%rsp), %rdi
callq 0x3420
leaq 0x38(%rsp), %rax
movl $0x9, %ecx
jmp 0x17709
leaq 0xd5c3(%rip), %rsi      # 0x24c2a
leaq 0x10(%rsp), %rdi
callq 0x3420
leaq 0x38(%rsp), %rax
movl $0x3, %ecx
movl $0x4, %edx
jmp 0x17730
leaq 0xd5b5(%rip), %rsi      # 0x24c41
leaq 0x10(%rsp), %rdi
callq 0x3420
leaq 0x38(%rsp), %rax
movl $0x9, %ecx
movl $0xf, %edx
jmp 0x17730
leaq 0x1776a(%rip), %rsi     # 0x2ee1b
leaq 0x10(%rsp), %rdi
callq 0x3420
leaq 0x38(%rsp), %rax
movl $0x87, %ecx
movl $0x100, %edx            # imm = 0x100
jmp 0x17730
leaq 0xd569(%rip), %rsi      # 0x24c3c
leaq 0x10(%rsp), %rdi
callq 0x3420
leaq 0x38(%rsp), %rax
movl $0x4, %ecx
movl $0x5, %edx
jmp 0x17730
leaq 0xd540(%rip), %rsi      # 0x24c35
leaq 0x10(%rsp), %rdi
callq 0x3420
leaq 0x38(%rsp), %rax
movl $0xa, %ecx
movl $0x10, %edx
jmp 0x17730
leaq 0x176fe(%rip), %rsi     # 0x2ee15
leaq 0x10(%rsp), %rdi
callq 0x3420
leaq 0x38(%rsp), %rax
movl $0x1b, %ecx
movl $0x40, %edx
leaq 0x3c(%rsp), %rsi
movl %edx, (%rax)
movl %ecx, (%rsi)
movb (%r14), %al
andb $0x70, %al
xorl %edx, %edx
cmpb $0x10, %al
sete %dl
leaq 0x30(%rsp), %rcx
movl %edx, 0x14(%rcx)
movzbl 0x1(%r14), %eax
leal 0x8(,%rax,8), %eax
movl %eax, (%rcx)
imull 0xc(%rcx), %eax
xorl %edx, %edx
divl 0x8(%rcx)
movl %eax, 0x4(%rcx)
movzbl 0x2(%r14), %esi
andl $0x7f, %esi
incl %esi
movq %rbx, %rdi
movq %rcx, %rdx
callq 0x1fd24
cmpb $0x0, (%r14)
jns 0x17850
leaq 0x17711(%rip), %rsi     # 0x2ee9e
leaq 0x10(%rsp), %rdi
callq 0x3420
leaq 0x98(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x195e4(%rip), %rsi     # 0x30d8e
leaq 0x195e0(%rip), %rdx     # 0x30d91
leaq 0x88(%rsp), %rdi
callq 0x8f6e
leaq 0xa8(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x88(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0xdce2
leaq 0x928(%rbx), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x16042
leaq 0x130(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x17812
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x3260
leaq 0x110(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x17833
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x88(%rsp), %rdi
cmpq %r14, %rdi
je 0x17850
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x10(%rsp), %r8
movl $0x1, (%rsp)
leaq 0xdbe4(%rip), %rsi      # 0x25447
leaq 0x19524(%rip), %rcx     # 0x30d8e
leaq 0x30(%rsp), %rdx
movq %rbx, %rdi
xorl %r9d, %r9d
callq 0x3ebe
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x17891
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3260
addq $0x140, %rsp            # imm = 0x140
popq %rbx
popq %r14
popq %r15
retq
leaq 0xed59(%rip), %rsi      # 0x265fe
leaq 0x10(%rsp), %rdi
callq 0x3420
movzbl 0x3(%r14), %edx
andl $0xf, %edx
cmpb $0x13, 0x910(%rbx)
movl $0x8, %eax
sbbl $0x0, %eax
cmpl %edx, %eax
jae 0x17739
leaq 0x1754e(%rip), %rsi     # 0x2ee23
xorl %edi, %edi
xorl %eax, %eax
callq 0x37ec
jmp 0x17739
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0xdd9e
jmp 0x178f8
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r14, %rdi
je 0x1791c
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x1791c
jmp 0x17919
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x17933
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3260
movq %rbx, %rdi
callq 0x3400
nop