// File: /workspace/github_cpp_makefile_star2_O2/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 %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)
andl $0x0, 0x80(%rsp)
leaq 0x15b15(%rip), %rsi     # 0x28e49
leaq 0x10(%rsp), %rdi
leaq 0xa8(%rsp), %rdx
callq 0x75c4
movzbl (%r14), %eax
andl $0xf, %eax
cmpl $0x7, %eax
ja 0x13566
leaq 0x15343(%rip), %rcx     # 0x286a0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x15ae4(%rip), %rsi     # 0x28e51
leaq 0x10(%rsp), %rdi
callq 0x3450
leaq 0x3c(%rsp), %rcx
pushq $0x1
popq %rbp
leaq 0x38(%rsp), %rdx
movl %ebp, %eax
jmp 0x13462
leaq 0xb8ed(%rip), %rsi      # 0x1ec7f
leaq 0x10(%rsp), %rdi
callq 0x3450
leaq 0x38(%rsp), %rcx
pushq $0x9
jmp 0x1343c
leaq 0xb8cb(%rip), %rsi      # 0x1ec7a
leaq 0x10(%rsp), %rdi
callq 0x3450
leaq 0x38(%rsp), %rcx
pushq $0x3
popq %rax
pushq $0x4
jmp 0x1345c
leaq 0xb8c2(%rip), %rsi      # 0x1ec91
leaq 0x10(%rsp), %rdi
callq 0x3450
leaq 0x38(%rsp), %rcx
pushq $0x9
popq %rax
pushq $0xf
jmp 0x1345c
leaq 0x15a6f(%rip), %rsi     # 0x28e5b
leaq 0x10(%rsp), %rdi
callq 0x3450
leaq 0x38(%rsp), %rcx
movl $0x87, %eax
movl $0x100, %ebp            # imm = 0x100
jmp 0x1345d
leaq 0xb87e(%rip), %rsi      # 0x1ec8c
leaq 0x10(%rsp), %rdi
callq 0x3450
leaq 0x38(%rsp), %rcx
pushq $0x4
popq %rax
pushq $0x5
jmp 0x1345c
leaq 0xb85a(%rip), %rsi      # 0x1ec85
leaq 0x10(%rsp), %rdi
callq 0x3450
leaq 0x38(%rsp), %rcx
pushq $0xa
popq %rax
pushq $0x10
jmp 0x1345c
leaq 0x15a0d(%rip), %rsi     # 0x28e55
leaq 0x10(%rsp), %rdi
callq 0x3450
leaq 0x38(%rsp), %rcx
pushq $0x1b
popq %rax
pushq $0x40
popq %rbp
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 0x19e2a
cmpb $0x0, (%r14)
jns 0x13526
leaq 0x15a28(%rip), %rsi     # 0x28ede
leaq 0x10(%rsp), %rdi
callq 0x3450
leaq 0x17907(%rip), %rsi     # 0x2adce
leaq 0x88(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x75c4
leaq 0xa8(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x88(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0xbb34
leaq 0x928(%rbx), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x120e8
leaq 0xa8(%rsp), %rdi
callq 0x78cc
leaq 0x88(%rsp), %rdi
callq 0x3130
movq 0x10(%rsp), %r8
movl $0x1, (%rsp)
leaq 0xbf5e(%rip), %rsi      # 0x1f497
leaq 0x1788e(%rip), %rcx     # 0x2adce
leaq 0x30(%rsp), %rdx
movq %rbx, %rdi
xorl %r9d, %r9d
callq 0x3af0
leaq 0x10(%rsp), %rdi
callq 0x3130
addq $0x140, %rsp            # imm = 0x140
popq %rbx
popq %r14
popq %rbp
retq
leaq 0xd0e1(%rip), %rsi      # 0x2064e
leaq 0x10(%rsp), %rdi
callq 0x3450
movzbl 0x3(%r14), %edx
andl $0xf, %edx
cmpb $0x13, 0x910(%rbx)
pushq $0x8
popq %rcx
sbbl $0x0, %ecx
xorl %ebp, %ebp
movl $0x0, %eax
cmpl %edx, %ecx
jae 0x13466
xorl %ebp, %ebp
leaq 0x158bf(%rip), %rsi     # 0x28e63
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
xorl %eax, %eax
jmp 0x13466
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x78cc
jmp 0x135c9
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x3130
jmp 0x135dd
jmp 0x135da
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x3130
movq %rbx, %rdi
callq 0x3430
nop