// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/parse-base-block.cpp
// Function: edid_state::detailed_epi(unsigned char const*)
void edid_state::detailed_epi(const unsigned char *x)
{
	data_block = "EPI Descriptor";
	printf("    %s:\n", data_block.c_str());

	unsigned v = x[5] & 0x07;

	printf("      Bits per pixel: %u\n", 18 + v * 6);
	if (v > 2)
		fail("Invalid bits per pixel.\n");
	v = (x[5] & 0x18) >> 3;
	printf("      Pixels per clock: %u\n", 1 << v);
	if (v > 2)
		fail("Invalid pixels per clock.\n");
	v = (x[5] & 0x60) >> 5;
	printf("      Data color mapping: %sconventional\n", v ? "non-" : "");
	if (v > 1)
		fail("Unknown data color mapping (0x%02x).\n", v);
	if (x[5] & 0x80)
		fail("Non-zero reserved field in byte 5.\n");

	v = x[6] & 0x0f;
	printf("      Interface type: ");
	switch (v) {
	case 0x00: printf("LVDS TFT\n"); break;
	case 0x01: printf("monoSTN 4/8 Bit\n"); break;
	case 0x02: printf("colorSTN 8/16 Bit\n"); break;
	case 0x03: printf("18 Bit TFT\n"); break;
	case 0x04: printf("24 Bit TFT\n"); break;
	case 0x05: printf("TMDS\n"); break;
	default:
		   printf("Unknown (0x%02x)\n", v);
		   fail("Invalid interface type 0x%02x.\n", v);
		   break;
	}
	printf("      DE polarity: DE %s active\n",
	       (x[6] & 0x10) ? "low" : "high");
	printf("      FPSCLK polarity: FPSCLK %sinverted\n",
	       (x[6] & 0x20) ? "" : "not ");
	if (x[6] & 0xc0)
		fail("Non-zero reserved field in byte 6.\n");

	printf("      Vertical display mode: %s\n",
	       (x[7] & 0x01) ? "Up/Down reverse mode" : "normal");
	printf("      Horizontal display mode: %s\n",
	       (x[7] & 0x02) ? "Left/Right reverse mode" : "normal");
	if (x[7] & 0xfc)
		fail("Non-zero reserved field in byte 7.\n");

	v = x[8] & 0x0f;
	printf("      Total power on sequencing delay: ");
	if (v)
		printf("%u ms\n", v * 10);
	else
		printf("VGA controller default\n");
	v = (x[8] & 0xf0) >> 4;
	printf("      Total power off sequencing delay: ");
	if (v)
		printf("%u ms\n", v * 10);
	else
		printf("VGA controller default\n");

	v = x[9] & 0x0f;
	printf("      Contrast power on sequencing delay: ");
	if (v)
		printf("%u ms\n", v * 10);
	else
		printf("VGA controller default\n");
	v = (x[9] & 0xf0) >> 4;
	printf("      Contrast power off sequencing delay: ");
	if (v)
		printf("%u ms\n", v * 10);
	else
		printf("VGA controller default\n");

	v = x[10] & 0x2f;
	const char *s = (x[10] & 0x80) ? "" : " (ignored)";

	printf("      Backlight brightness control: %u steps%s\n", v, s);
	printf("      Backlight enable at boot: %s%s\n",
	       (x[10] & 0x40) ? "off" : "on", s);
	printf("      Backlight control enable: %s\n",
	       (x[10] & 0x80) ? "enabled" : "disabled");

	v = x[11] & 0x2f;
	s = (x[11] & 0x80) ? "" : " (ignored)";

	printf("      Contrast voltable control: %u steps%s\n", v, s);
	if (x[11] & 0x40)
		fail("Non-zero reserved field in byte 11.\n");
	printf("      Contrast control enable: %s\n",
	       (x[11] & 0x80) ? "enabled" : "disabled");

	if (x[12] || x[13] || x[14] || x[15] || x[16])
		fail("Non-zero values in reserved bytes 12-16.\n");

	printf("      EPI Version: %u.%u\n", (x[17] & 0xf0) >> 4, x[17] & 0x0f);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
addq $0x30, %rdi
leaq 0x15b20(%rip), %rsi     # 0x1edfa
callq 0x3460
movq 0x30(%r14), %rsi
leaq 0x15b1f(%rip), %rdi     # 0x1ee09
xorl %eax, %eax
callq 0x3030
movzbl 0x5(%rbx), %ebp
andl $0x7, %ebp
imull $0x6, %ebp, %esi
addl $0x12, %esi
leaq 0x15b0d(%rip), %rdi     # 0x1ee12
xorl %eax, %eax
callq 0x3030
cmpb $0x3, %bpl
jb 0x9322
leaq 0x15b13(%rip), %rsi     # 0x1ee2c
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
movb 0x5(%rbx), %bpl
shrb $0x3, %bpl
andb $0x3, %bpl
pushq $0x1
popq %rsi
movl %ebp, %ecx
shll %cl, %esi
leaq 0x15b09(%rip), %rdi     # 0x1ee45
xorl %eax, %eax
callq 0x3030
cmpb $0x3, %bpl
jne 0x9359
leaq 0x15b11(%rip), %rsi     # 0x1ee61
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
movzbl 0x5(%rbx), %ebp
shrl $0x5, %ebp
andl $0x3, %ebp
leaq 0x1191f(%rip), %r14     # 0x1ac89
leaq 0x15b35(%rip), %rsi     # 0x1eea6
cmoveq %r14, %rsi
leaq 0x15b00(%rip), %rdi     # 0x1ee7c
xorl %eax, %eax
callq 0x3030
cmpb $0x2, %bpl
jb 0x939b
leaq 0x15b1b(%rip), %rsi     # 0x1eeab
xorl %edi, %edi
movl %ebp, %edx
xorl %eax, %eax
callq 0x362c
cmpb $0x0, 0x5(%rbx)
jns 0x93b1
leaq 0x15b29(%rip), %rsi     # 0x1eed1
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
movzbl 0x6(%rbx), %r15d
andl $0xf, %r15d
leaq 0x15b34(%rip), %rdi     # 0x1eef5
xorl %eax, %eax
callq 0x3030
cmpb $0x5, %r15b
ja 0x96c6
leaq 0x1310b(%rip), %rax     # 0x1c4e4
movslq (%rax,%r15,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0x17193(%rip), %rdi     # 0x2057c
jmp 0x9416
leaq 0x17152(%rip), %rdi     # 0x20544
jmp 0x9416
leaq 0x1715f(%rip), %rdi     # 0x2055a
jmp 0x9416
leaq 0x1714b(%rip), %rdi     # 0x2054f
jmp 0x9416
leaq 0x1715f(%rip), %rdi     # 0x2056c
jmp 0x9416
leaq 0x17220(%rip), %rdi     # 0x20636
callq 0x33b0
testb $0x10, 0x6(%rbx)
leaq 0x15b3d(%rip), %rax     # 0x1ef63
leaq 0x15b32(%rip), %rsi     # 0x1ef5f
cmoveq %rax, %rsi
leaq 0x15b06(%rip), %rdi     # 0x1ef3e
xorl %eax, %eax
callq 0x3030
testb $0x20, 0x6(%rbx)
leaq 0x2294a(%rip), %rsi     # 0x2bd94
cmovneq %r14, %rsi
leaq 0x15b13(%rip), %rdi     # 0x1ef68
xorl %eax, %eax
callq 0x3030
cmpb $0x40, 0x6(%rbx)
jb 0x9472
leaq 0x15b29(%rip), %rsi     # 0x1ef92
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
testb $0x1, 0x7(%rbx)
leaq 0x15b6f(%rip), %r15     # 0x1efec
leaq 0x15b53(%rip), %rsi     # 0x1efd7
cmoveq %r15, %rsi
leaq 0x15b27(%rip), %rdi     # 0x1efb6
xorl %eax, %eax
callq 0x3030
testb $0x2, 0x7(%rbx)
leaq 0x15b75(%rip), %rsi     # 0x1f016
cmoveq %r15, %rsi
leaq 0x15b47(%rip), %rdi     # 0x1eff3
xorl %eax, %eax
callq 0x3030
cmpb $0x4, 0x7(%rbx)
jb 0x94c9
leaq 0x15b6e(%rip), %rsi     # 0x1f02e
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
movzbl 0x8(%rbx), %ebp
leaq 0x15b7e(%rip), %rdi     # 0x1f052
xorl %eax, %eax
callq 0x3030
andl $0xf, %ebp
je 0x94f3
imull $0xa, %ebp, %esi
leaq 0x1fcdd(%rip), %rdi     # 0x291c7
xorl %eax, %eax
callq 0x3030
jmp 0x94ff
leaq 0x1708b(%rip), %rdi     # 0x20585
callq 0x33b0
movzbl 0x8(%rbx), %ebp
leaq 0x15b70(%rip), %rdi     # 0x1f07a
xorl %eax, %eax
callq 0x3030
cmpl $0x10, %ebp
jae 0x9524
leaq 0x17068(%rip), %rdi     # 0x20585
callq 0x33b0
jmp 0x9538
shrl $0x4, %ebp
imull $0xa, %ebp, %esi
leaq 0x1fc96(%rip), %rdi     # 0x291c7
xorl %eax, %eax
callq 0x3030
movzbl 0x9(%rbx), %ebp
leaq 0x15b60(%rip), %rdi     # 0x1f0a3
xorl %eax, %eax
callq 0x3030
andl $0xf, %ebp
je 0x9562
imull $0xa, %ebp, %esi
leaq 0x1fc6e(%rip), %rdi     # 0x291c7
xorl %eax, %eax
callq 0x3030
jmp 0x956e
leaq 0x1701c(%rip), %rdi     # 0x20585
callq 0x33b0
movzbl 0x9(%rbx), %ebp
leaq 0x15b55(%rip), %rdi     # 0x1f0ce
xorl %eax, %eax
callq 0x3030
cmpl $0x10, %ebp
jae 0x9593
leaq 0x16ff9(%rip), %rdi     # 0x20585
callq 0x33b0
jmp 0x95a7
shrl $0x4, %ebp
imull $0xa, %ebp, %esi
leaq 0x1fc27(%rip), %rdi     # 0x291c7
xorl %eax, %eax
callq 0x3030
movzbl 0xa(%rbx), %eax
movl %eax, %esi
andl $0x2f, %esi
testb %al, %al
leaq 0x15b41(%rip), %r13     # 0x1f0fa
movq %r14, %r15
cmovnsq %r13, %r15
leaq 0x15b3e(%rip), %rdi     # 0x1f105
movq %r15, %rdx
xorl %eax, %eax
callq 0x3030
testb $0x40, 0xa(%rbx)
leaq 0x16411(%rip), %rax     # 0x1f9ed
leaq 0x21ce7(%rip), %rsi     # 0x2b2ca
cmoveq %rax, %rsi
leaq 0x15b47(%rip), %rdi     # 0x1f135
movq %r15, %rdx
xorl %eax, %eax
callq 0x3030
cmpb $0x0, 0xa(%rbx)
leaq 0x15b84(%rip), %r12     # 0x1f187
leaq 0x15b75(%rip), %r15     # 0x1f17f
movq %r15, %rsi
cmovnsq %r12, %rsi
leaq 0x15b43(%rip), %rdi     # 0x1f15b
xorl %eax, %eax
callq 0x3030
movzbl 0xb(%rbx), %eax
movl %eax, %esi
andl $0x2f, %esi
testb %al, %al
cmovnsq %r13, %r14
leaq 0x15b5b(%rip), %rdi     # 0x1f190
movq %r14, %rdx
xorl %eax, %eax
callq 0x3030
movb 0xb(%rbx), %al
testb $0x40, %al
je 0x9659
leaq 0x15b70(%rip), %rsi     # 0x1f1bd
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
movb 0xb(%rbx), %al
testb %al, %al
cmovnsq %r12, %r15
leaq 0x15b7c(%rip), %rdi     # 0x1f1e2
movq %r15, %rsi
xorl %eax, %eax
callq 0x3030
cmpb $0x0, 0xc(%rbx)
jne 0x968e
cmpb $0x0, 0xd(%rbx)
jne 0x968e
cmpb $0x0, 0xe(%rbx)
jne 0x968e
cmpb $0x0, 0xf(%rbx)
jne 0x968e
cmpb $0x0, 0x10(%rbx)
je 0x969e
leaq 0x15b70(%rip), %rsi     # 0x1f205
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
movzbl 0x11(%rbx), %edx
movl %edx, %esi
shrl $0x4, %esi
andl $0xf, %edx
leaq 0x15b7e(%rip), %rdi     # 0x1f22f
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3030
leaq 0x1583f(%rip), %rdi     # 0x1ef0c
movl %r15d, %esi
xorl %eax, %eax
callq 0x3030
leaq 0x15840(%rip), %rsi     # 0x1ef1e
xorl %edi, %edi
movl %r15d, %edx
xorl %eax, %eax
callq 0x362c
jmp 0x941b
nop