// File: /workspace/github_cpp_makefile_star2_O1/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 0x1627c
movq %rbx, %rdi
movl $0xd, %esi
movl $0xd, %edx
xorl %ecx, %ecx
callq 0x165ab
testb %al, %al
je 0x17d9c
leaq 0x172ca(%rip), %rdi     # 0x2efd5
xorl %eax, %eax
callq 0x3030
movzbl 0x3(%rbx), %eax
cmpq $0x21, %rax
ja 0x17d3f
movabsq $0x381ff0007, %rcx      # imm = 0x381FF0007
btq %rax, %rcx
jae 0x17d3f
leaq 0x16c7d(%rip), %rcx     # 0x2e9b0
movslq (%rcx,%rax,4), %rdi
addq %rcx, %rdi
callq 0x3380
movzbl 0x3(%rbx), %eax
addl $-0x30, %eax
cmpl $0xcf, %eax
ja 0x17d6f
shrl $0x4, %eax
movl $0x10ff, %ecx           # imm = 0x10FF
btl %eax, %ecx
jae 0x17d6f
movl %eax, %eax
leaq 0x16cd5(%rip), %rcx     # 0x2ea38
movslq (%rcx,%rax,4), %rdi
addq %rcx, %rdi
callq 0x3380
leaq 0x1727f(%rip), %rdi     # 0x2eff5
xorl %eax, %eax
callq 0x3030
movzbl 0x4(%rbx), %eax
cmpq $0xdf, %rax
ja 0x17da7
shrl $0x4, %eax
leaq 0x16cd9(%rip), %rcx     # 0x2ea6c
movslq (%rcx,%rax,4), %rdi
addq %rcx, %rdi
jmp 0x17dae
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x197d2(%rip), %rdi     # 0x31580
callq 0x3380
testb $0x8, 0x4(%rbx)
je 0x17dc5
leaq 0x194a1(%rip), %rdi     # 0x31261
callq 0x3380
testb $0x4, 0x4(%rbx)
je 0x17dd7
leaq 0x194bc(%rip), %rdi     # 0x3128e
callq 0x3380
movzwl 0x5(%rbx), %r15d
movzwl 0x7(%rbx), %ebp
testl %r15d, %r15d
je 0x17e11
testl %ebp, %ebp
je 0x17e11
incl %r15d
incl %ebp
leaq 0x1721d(%rip), %rdi     # 0x2f012
movl %r15d, %esi
movl %ebp, %edx
xorl %eax, %eax
callq 0x3030
movl %r15d, 0x940(%r14)
movl %ebp, 0x944(%r14)
jmp 0x17e2d
movl %r15d, %eax
orl %ebp, %eax
je 0x17e2d
leaq 0x1721b(%rip), %rsi     # 0x2f03a
xorl %edi, %edi
movl %r15d, %edx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x37ec
leaq 0x1948a(%rip), %rdi     # 0x312be
callq 0x3380
movzbl 0x9(%rbx), %eax
addl $0x64, %eax
cvtsi2sd %eax, %xmm0
divsd 0x81cc(%rip), %xmm0     # 0x20018
leaq 0x1720b(%rip), %rdi     # 0x2f05e
movb $0x1, %al
callq 0x3030
movzbl 0xa(%rbx), %r14d
leaq 0x17212(%rip), %rdi     # 0x2f078
xorl %eax, %eax
callq 0x3030
movl %r14d, %eax
shrl $0x6, %eax
leaq 0x16c2a(%rip), %rcx     # 0x2eaa4
movslq (%rcx,%rax,4), %rdi
addq %rcx, %rdi
callq 0x3380
leaq 0x17207(%rip), %rdi     # 0x2f094
xorl %eax, %eax
callq 0x3030
movl %r14d, %eax
shrl $0x2, %eax
andl $0xc, %eax
leaq 0x16c54(%rip), %rcx     # 0x2eaf8
movslq (%rax,%rcx), %rdi
addq %rcx, %rdi
callq 0x3380
leaq 0x171f9(%rip), %rdi     # 0x2f0b0
xorl %eax, %eax
callq 0x3030
movl %r14d, %eax
andl $0xc, %eax
leaq 0x16be9(%rip), %rcx     # 0x2eab4
movslq (%rax,%rcx), %rdi
addq %rcx, %rdi
callq 0x3380
leaq 0x171ee(%rip), %rdi     # 0x2f0cc
xorl %eax, %eax
callq 0x3030
andl $0x3, %r14d
leaq 0x167a0(%rip), %rax     # 0x2e690
movslq (%rax,%r14,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0x15e70(%rip), %rdi     # 0x2dd70
jmp 0x17f30
leaq 0x15c46(%rip), %rdi     # 0x2db4f
jmp 0x17f30
leaq 0x1966e(%rip), %rdi     # 0x31580
callq 0x3380
leaq 0x14369(%rip), %rsi     # 0x2c287
xorl %edi, %edi
xorl %eax, %eax
callq 0x37ec
jmp 0x17f35
leaq 0x15c69(%rip), %rdi     # 0x2db99
callq 0x3380
leaq 0x171a7(%rip), %rdi     # 0x2f0e3
xorl %eax, %eax
callq 0x3030
movzbl 0xb(%rbx), %eax
cmpq $0xc, %rax
ja 0x17f5d
leaq 0x16b70(%rip), %rcx     # 0x2eac4
movslq (%rcx,%rax,4), %rdi
addq %rcx, %rdi
jmp 0x17f64
leaq 0x1961c(%rip), %rdi     # 0x31580
callq 0x3380
movzbl 0xc(%rbx), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd 0x809c(%rip), %xmm2     # 0x20018
divsd %xmm2, %xmm0
movzbl 0xd(%rbx), %eax
cvtsi2sd %eax, %xmm1
divsd %xmm2, %xmm1
leaq 0x1717b(%rip), %rdi     # 0x2f10e
movb $0x2, %al
callq 0x3030
movzbl 0xe(%rbx), %esi
andl $0xf, %esi
leaq 0x171a1(%rip), %rdi     # 0x2f149
xorl %eax, %eax
callq 0x3030
movzbl 0xf(%rbx), %edx
testb %dl, %dl
leaq 0x171e1(%rip), %rax     # 0x2f19d
leaq 0x171cb(%rip), %rsi     # 0x2f18e
cmovnsq %rax, %rsi
andl $0x7f, %edx
leaq 0x17191(%rip), %rdi     # 0x2f162
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3030