// File: rpavlik[P]edid-decode/parse-displayid-block.cpp
// Function: edid_state::parse_displayid_parameters(unsigned char const*)
void edid_state::parse_displayid_parameters(const unsigned char *x)
{
	check_displayid_datablock_revision(x[1]);

	if (!check_displayid_datablock_length(x, 12, 12))
		return;

	dispid.has_display_parameters = true;
	printf("    Image size: %.1f mm x %.1f mm\n",
	       ((x[4] << 8) + x[3]) / 10.0,
	       ((x[6] << 8) + x[5]) / 10.0);
	printf("    Pixels: %d x %d\n",
	       (x[8] << 8) + x[7], (x[10] << 8) + x[9]);
	print_flag_lines("      ", "    Feature support flags:",
			 x[11], feature_support_flags);

	if (x[12] != 0xff)
		printf("    Gamma: %.2f\n", ((x[12] + 100.0) / 100.0));
	printf("    Aspect ratio: %.2f\n", ((x[13] + 100.0) / 100.0));
	printf("    Dynamic bpc native: %d\n", (x[14] & 0xf) + 1);
	printf("    Dynamic bpc overall: %d\n", ((x[14] >> 4) & 0xf) + 1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x18(%rbp)
movq -0x10(%rbp), %rax
xorl %ecx, %ecx
movzbl 0x1(%rax), %esi
movl %ecx, %edx
callq 0x21b00
movq -0x10(%rbp), %rdi
movl $0xc, %edx
xorl %ecx, %ecx
movl %edx, %esi
callq 0x21f90
testb $0x1, %al
jne 0x21e14
jmp 0x21f7f
movq -0x18(%rbp), %rax
movb $0x1, 0x91f(%rax)
movq -0x10(%rbp), %rax
movzbl 0x4(%rax), %eax
shll $0x8, %eax
movq -0x10(%rbp), %rcx
movzbl 0x3(%rcx), %ecx
addl %ecx, %eax
cvtsi2sd %eax, %xmm0
movsd 0x1bd18(%rip), %xmm1    # 0x3db58
divsd %xmm1, %xmm0
movq -0x10(%rbp), %rax
movzbl 0x6(%rax), %eax
shll $0x8, %eax
movq -0x10(%rbp), %rcx
movzbl 0x5(%rcx), %ecx
addl %ecx, %eax
cvtsi2sd %eax, %xmm1
movsd 0x1bcf3(%rip), %xmm2    # 0x3db58
divsd %xmm2, %xmm1
leaq 0x1c4b1(%rip), %rdi     # 0x3e321
movb $0x2, %al
callq 0x4050
movq -0x10(%rbp), %rax
movzbl 0x8(%rax), %esi
shll $0x8, %esi
movq -0x10(%rbp), %rax
movzbl 0x7(%rax), %eax
addl %eax, %esi
movq -0x10(%rbp), %rax
movzbl 0xa(%rax), %edx
shll $0x8, %edx
movq -0x10(%rbp), %rax
movzbl 0x9(%rax), %eax
addl %eax, %edx
leaq 0x1c49c(%rip), %rdi     # 0x3e344
movb $0x0, %al
callq 0x4050
movq -0x10(%rbp), %rax
leaq 0x12923(%rip), %rdi     # 0x347dd
leaq 0x1c498(%rip), %rsi     # 0x3e359
leaq 0x29a48(%rip), %rcx     # 0x4b910
movzbl 0xb(%rax), %edx
callq 0x22070
movq -0x10(%rbp), %rax
movzbl 0xc(%rax), %eax
cmpl $0xff, %eax
je 0x21f12
movq -0x10(%rbp), %rax
movzbl 0xc(%rax), %eax
cvtsi2sd %eax, %xmm0
movsd 0xd144(%rip), %xmm1     # 0x2f038
addsd %xmm1, %xmm0
movsd 0xd138(%rip), %xmm1     # 0x2f038
divsd %xmm1, %xmm0
leaq 0x1337b(%rip), %rdi     # 0x35286
movb $0x1, %al
callq 0x4050
movq -0x10(%rbp), %rax
movzbl 0xd(%rax), %eax
cvtsi2sd %eax, %xmm0
movsd 0xd112(%rip), %xmm1     # 0x2f038
addsd %xmm1, %xmm0
movsd 0xd106(%rip), %xmm1     # 0x2f038
divsd %xmm1, %xmm0
leaq 0x1c437(%rip), %rdi     # 0x3e374
movb $0x1, %al
callq 0x4050
movq -0x10(%rbp), %rax
movzbl 0xe(%rax), %esi
andl $0xf, %esi
addl $0x1, %esi
leaq 0x1c433(%rip), %rdi     # 0x3e38c
movb $0x0, %al
callq 0x4050
movq -0x10(%rbp), %rax
movzbl 0xe(%rax), %esi
sarl $0x4, %esi
andl $0xf, %esi
addl $0x1, %esi
leaq 0x1c430(%rip), %rdi     # 0x3e3a8
movb $0x0, %al
callq 0x4050
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)