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

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

	printf("    Display Device Technology: ");
	switch (x[3]) {
	case 0x00: printf("Monochrome CRT\n"); break;
	case 0x01: printf("Standard tricolor CRT\n"); break;
	case 0x02: printf("Other/undefined CRT\n"); break;
	case 0x10: printf("Passive matrix TN\n"); break;
	case 0x11: printf("Passive matrix cholesteric LC\n"); break;
	case 0x12: printf("Passive matrix ferroelectric LC\n"); break;
	case 0x13: printf("Other passive matrix LC type\n"); break;
	case 0x14: printf("Active-matrix TN\n"); break;
	case 0x15: printf("Active-matrix IPS (all types)\n"); break;
	case 0x16: printf("Active-matrix VA (all types)\n"); break;
	case 0x17: printf("Active-matrix OCB\n"); break;
	case 0x18: printf("Active-matrix ferroelectric\n"); break;
	case 0x1f: printf("Other LC type\n"); break;
	case 0x20: printf("DC plasma\n"); break;
	case 0x21: printf("AC plasma\n"); break;
	}
	switch (x[3] & 0xf0) {
	case 0x30: printf("Electroluminescent, except OEL/OLED\n"); break;
	case 0x40: printf("Inorganic LED\n"); break;
	case 0x50: printf("Organic LED/OEL\n"); break;
	case 0x60: printf("FED or sim. \"cold-cathode,\" phosphor-based types\n"); break;
	case 0x70: printf("Electrophoretic\n"); break;
	case 0x80: printf("Electrochromic\n"); break;
	case 0x90: printf("Electromechanical\n"); break;
	case 0xa0: printf("Electrowetting\n"); break;
	case 0xf0: printf("Other type not defined here\n"); break;
	}
	printf("    Display operating mode: ");
	switch (x[4] >> 4) {
	case 0x00: printf("Direct-view reflective, ambient light\n"); break;
	case 0x01: printf("Direct-view reflective, ambient light, also has light source\n"); break;
	case 0x02: printf("Direct-view reflective, uses light source\n"); break;
	case 0x03: printf("Direct-view transmissive, ambient light\n"); break;
	case 0x04: printf("Direct-view transmissive, ambient light, also has light source\n"); break;
	case 0x05: printf("Direct-view transmissive, uses light source\n"); break;
	case 0x06: printf("Direct-view emissive\n"); break;
	case 0x07: printf("Direct-view transflective, backlight off by default\n"); break;
	case 0x08: printf("Direct-view transflective, backlight on by default\n"); break;
	case 0x09: printf("Transparent display, ambient light\n"); break;
	case 0x0a: printf("Transparent emissive display\n"); break;
	case 0x0b: printf("Projection device using reflective light modulator\n"); break;
	case 0x0c: printf("Projection device using transmissive light modulator\n"); break;
	case 0x0d: printf("Projection device using emissive image transducer\n"); break;
	default: printf("Reserved\n"); break;
	}
	if (x[4] & 0x08)
		printf("    The backlight may be switched on and off\n");
	if (x[4] & 0x04)
		printf("    The backlight's intensity can be controlled\n");
	unsigned w = x[5] | (x[6] << 8);
	unsigned h = x[7] | (x[8] << 8);
	if (w && h) {
		printf("    Display native pixel format: %ux%u\n", w + 1, h + 1);
		dispid.native_width = w + 1;
		dispid.native_height = h + 1;
	} else if (w || h) {
		fail("Invalid Native Pixel Format %ux%u.\n", w, h);
	}
	printf("    Aspect ratio and orientation:\n");
	printf("      Aspect Ratio: %.2f\n", (100 + x[9]) / 100.0);
	unsigned char v = x[0x0a];
	printf("      Default Orientation: ");
	switch ((v & 0xc0) >> 6) {
	case 0x00: printf("Landscape\n"); break;
	case 0x01: printf("Portrait\n"); break;
	case 0x02: printf("Not Fixed\n"); break;
	case 0x03: printf("Undefined\n"); break;
	}
	printf("      Rotation Capability: ");
	switch ((v & 0x30) >> 4) {
	case 0x00: printf("None\n"); break;
	case 0x01: printf("Can rotate 90 degrees clockwise\n"); break;
	case 0x02: printf("Can rotate 90 degrees counterclockwise\n"); break;
	case 0x03: printf("Can rotate 90 degrees in either direction)\n"); break;
	}
	printf("      Zero Pixel Location: ");
	switch ((v & 0x0c) >> 2) {
	case 0x00: printf("Upper Left\n"); break;
	case 0x01: printf("Upper Right\n"); break;
	case 0x02: printf("Lower Left\n"); break;
	case 0x03: printf("Lower Right\n"); break;
	}
	printf("      Scan Direction: ");
	switch (v & 0x03) {
	case 0x00: printf("Not defined\n"); break;
	case 0x01: printf("Fast Scan is on the Major (Long) Axis and Slow Scan is on the Minor Axis\n"); break;
	case 0x02: printf("Fast Scan is on the Minor (Short) Axis and Slow Scan is on the Major Axis\n"); break;
	case 0x03: printf("Reserved\n");
		   fail("Scan Direction used the reserved value 0x03.\n");
		   break;
	}
	printf("    Sub-pixel layout/configuration/shape: ");
	switch (x[0x0b]) {
	case 0x00: printf("Not defined\n"); break;
	case 0x01: printf("RGB vertical stripes\n"); break;
	case 0x02: printf("RGB horizontal stripes\n"); break;
	case 0x03: printf("Vertical stripes using primary order\n"); break;
	case 0x04: printf("Horizontal stripes using primary order\n"); break;
	case 0x05: printf("Quad sub-pixels, red at top left\n"); break;
	case 0x06: printf("Quad sub-pixels, red at bottom left\n"); break;
	case 0x07: printf("Delta (triad) RGB sub-pixels\n"); break;
	case 0x08: printf("Mosaic\n"); break;
	case 0x09: printf("Quad sub-pixels, RGB + 1 additional color\n"); break;
	case 0x0a: printf("Five sub-pixels, RGB + 2 additional colors\n"); break;
	case 0x0b: printf("Six sub-pixels, RGB + 3 additional colors\n"); break;
	case 0x0c: printf("Clairvoyante, Inc. PenTile Matrix (tm) layout\n"); break;
	default: printf("Reserved\n"); break;
	}
	printf("    Horizontal and vertical dot/pixel pitch: %.2fx%.2f mm\n",
	       (double)(x[0x0c]) / 100.0, (double)(x[0x0d]) / 100.0);
	printf("    Color bit depth: %u\n", x[0x0e] & 0x0f);
	v = x[0x0f];
	printf("    Response time for %s transition: %u ms\n",
	       (v & 0x80) ? "white-to-black" : "black-to-white", v & 0x7f);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movzbl 0x1(%rsi), %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x1611c
movq %rbx, %rdi
movl $0xd, %esi
movl $0xd, %edx
xorl %ecx, %ecx
callq 0x1644b
testb %al, %al
je 0x17c34
leaq 0x17472(%rip), %rdi     # 0x2f015
xorl %eax, %eax
callq 0x3030
movzbl 0x3(%rbx), %eax
cmpq $0x21, %rax
ja 0x17bd7
movabsq $0x381ff0007, %rcx      # imm = 0x381FF0007
btq %rax, %rcx
jae 0x17bd7
leaq 0x16e0d(%rip), %rcx     # 0x2e9d8
movslq (%rcx,%rax,4), %rdi
addq %rcx, %rdi
callq 0x3380
movzbl 0x3(%rbx), %eax
addl $-0x30, %eax
cmpl $0xcf, %eax
ja 0x17c07
shrl $0x4, %eax
movl $0x10ff, %ecx           # imm = 0x10FF
btl %eax, %ecx
jae 0x17c07
movl %eax, %eax
leaq 0x16e65(%rip), %rcx     # 0x2ea60
movslq (%rcx,%rax,4), %rdi
addq %rcx, %rdi
callq 0x3380
leaq 0x17427(%rip), %rdi     # 0x2f035
xorl %eax, %eax
callq 0x3030
movzbl 0x4(%rbx), %eax
cmpq $0xdf, %rax
ja 0x17c3f
shrl $0x4, %eax
leaq 0x16e69(%rip), %rcx     # 0x2ea94
movslq (%rcx,%rax,4), %rdi
addq %rcx, %rdi
jmp 0x17c46
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1997a(%rip), %rdi     # 0x315c0
callq 0x3380
movb 0x4(%rbx), %al
testb $0x8, %al
je 0x17c61
leaq 0x19648(%rip), %rdi     # 0x312a1
callq 0x3380
movb 0x4(%rbx), %al
testb $0x4, %al
je 0x17c71
leaq 0x19662(%rip), %rdi     # 0x312ce
callq 0x3380
movzwl 0x5(%rbx), %r15d
movzwl 0x7(%rbx), %ebp
testl %r15d, %r15d
je 0x17cab
testl %ebp, %ebp
je 0x17cab
incl %r15d
incl %ebp
leaq 0x173c3(%rip), %rdi     # 0x2f052
movl %r15d, %esi
movl %ebp, %edx
xorl %eax, %eax
callq 0x3030
movl %r15d, 0x940(%r14)
movl %ebp, 0x944(%r14)
jmp 0x17cc7
movl %r15d, %eax
orl %ebp, %eax
je 0x17cc7
leaq 0x173c1(%rip), %rsi     # 0x2f07a
xorl %edi, %edi
movl %r15d, %edx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x37cc
leaq 0x19630(%rip), %rdi     # 0x312fe
callq 0x3380
movzbl 0x9(%rbx), %eax
addl $0x64, %eax
cvtsi2sd %eax, %xmm0
divsd 0x833a(%rip), %xmm0     # 0x20020
leaq 0x173b1(%rip), %rdi     # 0x2f09e
movb $0x1, %al
callq 0x3030
movzbl 0xa(%rbx), %r14d
leaq 0x173b8(%rip), %rdi     # 0x2f0b8
xorl %eax, %eax
callq 0x3030
movl %r14d, %eax
shrl $0x6, %eax
leaq 0x16db8(%rip), %rcx     # 0x2eacc
movslq (%rcx,%rax,4), %rdi
addq %rcx, %rdi
callq 0x3380
leaq 0x173ad(%rip), %rdi     # 0x2f0d4
xorl %eax, %eax
callq 0x3030
movl %r14d, %eax
shrl $0x2, %eax
andl $0xc, %eax
leaq 0x16de2(%rip), %rcx     # 0x2eb20
movslq (%rax,%rcx), %rdi
addq %rcx, %rdi
callq 0x3380
leaq 0x1739f(%rip), %rdi     # 0x2f0f0
xorl %eax, %eax
callq 0x3030
movl %r14d, %eax
andl $0xc, %eax
leaq 0x16d77(%rip), %rcx     # 0x2eadc
movslq (%rax,%rcx), %rdi
addq %rcx, %rdi
callq 0x3380
leaq 0x17394(%rip), %rdi     # 0x2f10c
xorl %eax, %eax
callq 0x3030
andl $0x3, %r14d
leaq 0x1692e(%rip), %rax     # 0x2e6b8
movslq (%rax,%r14,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0x15ffe(%rip), %rdi     # 0x2dd98
jmp 0x17dca
leaq 0x15dd4(%rip), %rdi     # 0x2db77
jmp 0x17dca
leaq 0x19814(%rip), %rdi     # 0x315c0
callq 0x3380
leaq 0x144f7(%rip), %rsi     # 0x2c2af
xorl %edi, %edi
xorl %eax, %eax
callq 0x37cc
jmp 0x17dcf
leaq 0x15df7(%rip), %rdi     # 0x2dbc1
callq 0x3380
leaq 0x1734d(%rip), %rdi     # 0x2f123
xorl %eax, %eax
callq 0x3030
movzbl 0xb(%rbx), %eax
cmpq $0xc, %rax
ja 0x17df7
leaq 0x16cfe(%rip), %rcx     # 0x2eaec
movslq (%rcx,%rax,4), %rdi
addq %rcx, %rdi
jmp 0x17dfe
leaq 0x197c2(%rip), %rdi     # 0x315c0
callq 0x3380
movzbl 0xc(%rbx), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd 0x820a(%rip), %xmm2     # 0x20020
divsd %xmm2, %xmm0
movzbl 0xd(%rbx), %eax
cvtsi2sd %eax, %xmm1
divsd %xmm2, %xmm1
leaq 0x17321(%rip), %rdi     # 0x2f14e
movb $0x2, %al
callq 0x3030
movzbl 0xe(%rbx), %esi
andl $0xf, %esi
leaq 0x17347(%rip), %rdi     # 0x2f189
xorl %eax, %eax
callq 0x3030
movzbl 0xf(%rbx), %edx
testb %dl, %dl
leaq 0x17387(%rip), %rax     # 0x2f1dd
leaq 0x17371(%rip), %rsi     # 0x2f1ce
cmovnsq %rax, %rsi
andl $0x7f, %edx
leaq 0x17337(%rip), %rdi     # 0x2f1a2
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3030