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

	t.hact = 1 + (x[1] | (x[2] << 8));
	t.vact = 1 + (x[3] | (x[4] << 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";

	switch (x[0] & 0x07) {
	case 1: t.rb = RB_CVT_V1; break;
	case 2: t.rb = RB_CVT_V2; break;
	default: break;
	}

	edid_cvt_mode(1 + x[5], t);

	print_timings("    ", &t, "CVT", s.c_str());
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq 0xa8(%rsp), %r15
movups %xmm0, 0x44(%r15)
movups %xmm0, 0x38(%r15)
movups %xmm0, 0x28(%r15)
movups %xmm0, 0x18(%r15)
movups %xmm0, 0x8(%r15)
leaq 0x13952(%rip), %rsi     # 0x28e49
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x75c4
movd 0x1(%r14), %xmm0
punpcklwd 0x1368c(%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 0x38fe
movl 0xb0(%rsp), %esi
leaq 0x68(%rsp), %rdi
callq 0x7675
leaq 0x5b54(%rip), %rdx      # 0x1b095
leaq 0x88(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x75a4
movl 0xb4(%rsp), %esi
leaq 0x48(%rsp), %rdi
callq 0x7675
leaq 0x28(%rsp), %rdi
leaq 0x88(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x76b4
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x3480
leaq 0x28(%rsp), %rdi
callq 0x3130
leaq 0x48(%rsp), %rdi
callq 0x3130
leaq 0x88(%rsp), %rdi
callq 0x3130
leaq 0x68(%rsp), %rdi
callq 0x3130
movzbl (%r14), %eax
shrl $0x5, %eax
andl $0x3, %eax
leaq 0x131b2(%rip), %rcx     # 0x28778
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x138a5(%rip), %rsi     # 0x28e7b
jmp 0x1560b
leaq 0x138b7(%rip), %rsi     # 0x28e96
jmp 0x1560b
leaq 0xefbf(%rip), %rsi      # 0x245a7
leaq 0x8(%rsp), %rdi
callq 0x3450
leaq 0x138c0(%rip), %rsi     # 0x28eb9
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
jmp 0x15615
leaq 0x1387f(%rip), %rsi     # 0x28e8a
leaq 0x8(%rsp), %rdi
callq 0x3450
movb (%r14), %al
testb $0x10, %al
je 0x15630
leaq 0x140d5(%rip), %rsi     # 0x296f8
leaq 0x8(%rsp), %rdi
callq 0x3450
movb (%r14), %al
andb $0x7, %al
movzbl %al, %eax
cmpb $0x1, %al
je 0x15641
cmpl $0x2, %eax
jne 0x15648
pushq $0x2
popq %rax
movl %eax, 0xbc(%rsp)
movzbl 0x5(%r14), %esi
incl %esi
leaq 0xa8(%rsp), %rdx
movq %rbx, %rdi
callq 0x19e2a
movq 0x8(%rsp), %r8
movl $0x1, (%rsp)
leaq 0x9e25(%rip), %rsi      # 0x1f497
leaq 0x15755(%rip), %rcx     # 0x2adce
leaq 0xa8(%rsp), %rdx
movq %rbx, %rdi
xorl %r9d, %r9d
callq 0x3af0
leaq 0x8(%rsp), %rdi
callq 0x3130
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x3130
jmp 0x156b5
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x3130
jmp 0x156c4
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x3130
jmp 0x156d6
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x3130
jmp 0x156e7
jmp 0x156e4
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3130
movq %rbx, %rdi
callq 0x3430
nop