// File: /workspace/github_cpp_makefile_star2_O1/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
movq 0x38(%r14), %rdx
leaq 0x19e76(%rip), %rcx     # 0x24daa
movl $0xe, %r8d
xorl %esi, %esi
callq 0x3390
movq 0x30(%r14), %rsi
leaq 0x19e6d(%rip), %rdi     # 0x24db9
xorl %eax, %eax
callq 0x3030
movzbl 0x5(%rbx), %r14d
andl $0x7, %r14d
leal (%r14,%r14,2), %eax
leal 0x12(,%rax,2), %esi
leaq 0x19e54(%rip), %rdi     # 0x24dc2
xorl %eax, %eax
callq 0x3030
cmpb $0x3, %r14b
jb 0xaf8b
leaq 0x19e5a(%rip), %rsi     # 0x24ddc
xorl %edi, %edi
xorl %eax, %eax
callq 0x37ec
movb 0x5(%rbx), %bpl
shrb $0x3, %bpl
andb $0x3, %bpl
movl $0x1, %esi
movl %ebp, %ecx
shll %cl, %esi
leaq 0x19e4e(%rip), %rdi     # 0x24df5
xorl %eax, %eax
callq 0x3030
cmpb $0x3, %bpl
jne 0xafc4
leaq 0x19e56(%rip), %rsi     # 0x24e11
xorl %edi, %edi
xorl %eax, %eax
callq 0x37ec
movzbl 0x5(%rbx), %ebp
shrl $0x5, %ebp
andl $0x3, %ebp
leaq 0x15ca4(%rip), %r14     # 0x20c79
leaq 0x19e7a(%rip), %rsi     # 0x24e56
cmoveq %r14, %rsi
leaq 0x19e45(%rip), %rdi     # 0x24e2c
xorl %eax, %eax
callq 0x3030
cmpb $0x2, %bpl
jb 0xb006
leaq 0x19e60(%rip), %rsi     # 0x24e5b
xorl %edi, %edi
movl %ebp, %edx
xorl %eax, %eax
callq 0x37ec
cmpb $0x0, 0x5(%rbx)
jns 0xb01c
leaq 0x19e6e(%rip), %rsi     # 0x24e81
xorl %edi, %edi
xorl %eax, %eax
callq 0x37ec
movzbl 0x6(%rbx), %r15d
andl $0xf, %r15d
leaq 0x19e79(%rip), %rdi     # 0x24ea5
xorl %eax, %eax
callq 0x3030
cmpb $0x5, %r15b
ja 0xb34b
leaq 0x17490(%rip), %rax     # 0x224d4
movslq (%rax,%r15,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0x1b4d8(%rip), %rdi     # 0x2652c
jmp 0xb081
leaq 0x1b497(%rip), %rdi     # 0x264f4
jmp 0xb081
leaq 0x1b4a4(%rip), %rdi     # 0x2650a
jmp 0xb081
leaq 0x1b490(%rip), %rdi     # 0x264ff
jmp 0xb081
leaq 0x1b4a4(%rip), %rdi     # 0x2651c
jmp 0xb081
leaq 0x1b565(%rip), %rdi     # 0x265e6
callq 0x3380
testb $0x10, 0x6(%rbx)
leaq 0x19e82(%rip), %rax     # 0x24f13
leaq 0x19e77(%rip), %rsi     # 0x24f0f
cmoveq %rax, %rsi
leaq 0x19e4b(%rip), %rdi     # 0x24eee
xorl %eax, %eax
callq 0x3030
testb $0x20, 0x6(%rbx)
leaq 0x26c9f(%rip), %rsi     # 0x31d54
cmovneq %r14, %rsi
leaq 0x19e58(%rip), %rdi     # 0x24f18
xorl %eax, %eax
callq 0x3030
cmpb $0x40, 0x6(%rbx)
jb 0xb0dd
leaq 0x19e6e(%rip), %rsi     # 0x24f42
xorl %edi, %edi
xorl %eax, %eax
callq 0x37ec
testb $0x1, 0x7(%rbx)
leaq 0x19eb4(%rip), %r15     # 0x24f9c
leaq 0x19e98(%rip), %rsi     # 0x24f87
cmoveq %r15, %rsi
leaq 0x19e6c(%rip), %rdi     # 0x24f66
xorl %eax, %eax
callq 0x3030
testb $0x2, 0x7(%rbx)
leaq 0x19eba(%rip), %rsi     # 0x24fc6
cmoveq %r15, %rsi
leaq 0x19e8c(%rip), %rdi     # 0x24fa3
xorl %eax, %eax
callq 0x3030
cmpb $0x4, 0x7(%rbx)
jb 0xb134
leaq 0x19eb3(%rip), %rsi     # 0x24fde
xorl %edi, %edi
xorl %eax, %eax
callq 0x37ec
movzbl 0x8(%rbx), %r15d
leaq 0x19ec2(%rip), %rdi     # 0x25002
xorl %eax, %eax
callq 0x3030
andl $0xf, %r15d
je 0xb164
addl %r15d, %r15d
leal (%r15,%r15,4), %esi
leaq 0x2402c(%rip), %rdi     # 0x2f187
xorl %eax, %eax
callq 0x3030
jmp 0xb170
leaq 0x1b3ca(%rip), %rdi     # 0x26535
callq 0x3380
movzbl 0x8(%rbx), %r15d
leaq 0x19eae(%rip), %rdi     # 0x2502a
xorl %eax, %eax
callq 0x3030
cmpl $0x10, %r15d
jae 0xb197
leaq 0x1b3a5(%rip), %rdi     # 0x26535
callq 0x3380
jmp 0xb1b1
shrl $0x3, %r15d
andl $-0x2, %r15d
leal (%r15,%r15,4), %esi
leaq 0x23fdd(%rip), %rdi     # 0x2f187
xorl %eax, %eax
callq 0x3030
movzbl 0x9(%rbx), %r15d
leaq 0x19e96(%rip), %rdi     # 0x25053
xorl %eax, %eax
callq 0x3030
andl $0xf, %r15d
je 0xb1e1
addl %r15d, %r15d
leal (%r15,%r15,4), %esi
leaq 0x23faf(%rip), %rdi     # 0x2f187
xorl %eax, %eax
callq 0x3030
jmp 0xb1ed
leaq 0x1b34d(%rip), %rdi     # 0x26535
callq 0x3380
movzbl 0x9(%rbx), %r15d
leaq 0x19e85(%rip), %rdi     # 0x2507e
xorl %eax, %eax
callq 0x3030
cmpl $0x10, %r15d
jae 0xb214
leaq 0x1b328(%rip), %rdi     # 0x26535
callq 0x3380
jmp 0xb22e
shrl $0x3, %r15d
andl $-0x2, %r15d
leal (%r15,%r15,4), %esi
leaq 0x23f60(%rip), %rdi     # 0x2f187
xorl %eax, %eax
callq 0x3030
movzbl 0xa(%rbx), %eax
movl %eax, %esi
andl $0x2f, %esi
testb %al, %al
leaq 0x19e6a(%rip), %r12     # 0x250aa
movq %r14, %r15
cmovnsq %r12, %r15
leaq 0x19e67(%rip), %rdi     # 0x250b5
movq %r15, %rdx
xorl %eax, %eax
callq 0x3030
testb $0x40, 0xa(%rbx)
leaq 0x1a73a(%rip), %rax     # 0x2599d
leaq 0x26020(%rip), %rsi     # 0x3128a
cmoveq %rax, %rsi
leaq 0x19e70(%rip), %rdi     # 0x250e5
movq %r15, %rdx
xorl %eax, %eax
callq 0x3030
cmpb $0x0, 0xa(%rbx)
leaq 0x19ead(%rip), %r13     # 0x25137
leaq 0x19e9e(%rip), %r15     # 0x2512f
movq %r15, %rsi
cmovnsq %r13, %rsi
leaq 0x19e6c(%rip), %rdi     # 0x2510b
xorl %eax, %eax
callq 0x3030
movzbl 0xb(%rbx), %eax
movl %eax, %esi
andl $0x2f, %esi
testb %al, %al
cmovnsq %r12, %r14
leaq 0x19e84(%rip), %rdi     # 0x25140
movq %r14, %rdx
xorl %eax, %eax
callq 0x3030
testb $0x40, 0xb(%rbx)
je 0xb2dc
leaq 0x19e9a(%rip), %rsi     # 0x2516d
xorl %edi, %edi
xorl %eax, %eax
callq 0x37ec
cmpb $0x0, 0xb(%rbx)
cmovnsq %r13, %r15
leaq 0x19ea7(%rip), %rdi     # 0x25192
movq %r15, %rsi
xorl %eax, %eax
callq 0x3030
cmpb $0x0, 0xc(%rbx)
jne 0xb313
cmpb $0x0, 0xd(%rbx)
jne 0xb313
cmpb $0x0, 0xe(%rbx)
jne 0xb313
cmpb $0x0, 0xf(%rbx)
jne 0xb313
cmpb $0x0, 0x10(%rbx)
je 0xb323
leaq 0x19e9b(%rip), %rsi     # 0x251b5
xorl %edi, %edi
xorl %eax, %eax
callq 0x37ec
movzbl 0x11(%rbx), %edx
movl %edx, %esi
shrl $0x4, %esi
andl $0xf, %edx
leaq 0x19ea9(%rip), %rdi     # 0x251df
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3030
leaq 0x19b6a(%rip), %rdi     # 0x24ebc
movl %r15d, %esi
xorl %eax, %eax
callq 0x3030
leaq 0x19b6b(%rip), %rsi     # 0x24ece
xorl %edi, %edi
movl %r15d, %edx
xorl %eax, %eax
callq 0x37ec
jmp 0xb086