// File: /workspace/github_cpp_makefile_star2_O3/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 0x1a100(%rip), %rcx     # 0x24dfa
movl $0xe, %r8d
xorl %esi, %esi
callq 0x3390
movq 0x30(%r14), %rsi
leaq 0x1a0f7(%rip), %rdi     # 0x24e09
xorl %eax, %eax
callq 0x3030
movzbl 0x5(%rbx), %r14d
andl $0x7, %r14d
leal (%r14,%r14,2), %eax
leal 0x12(,%rax,2), %esi
leaq 0x1a0de(%rip), %rdi     # 0x24e12
xorl %eax, %eax
callq 0x3030
cmpb $0x3, %r14b
jb 0xad51
leaq 0x1a0e4(%rip), %rsi     # 0x24e2c
xorl %edi, %edi
xorl %eax, %eax
callq 0x37cc
movb 0x5(%rbx), %bpl
shrb $0x3, %bpl
andb $0x3, %bpl
movl $0x1, %esi
movl %ebp, %ecx
shll %cl, %esi
leaq 0x1a0d8(%rip), %rdi     # 0x24e45
xorl %eax, %eax
callq 0x3030
cmpb $0x3, %bpl
jne 0xad8a
leaq 0x1a0e0(%rip), %rsi     # 0x24e61
xorl %edi, %edi
xorl %eax, %eax
callq 0x37cc
movzbl 0x5(%rbx), %ebp
shrl $0x5, %ebp
andl $0x3, %ebp
leaq 0x15eee(%rip), %r14     # 0x20c89
leaq 0x1a104(%rip), %rsi     # 0x24ea6
cmoveq %r14, %rsi
leaq 0x1a0cf(%rip), %rdi     # 0x24e7c
xorl %eax, %eax
callq 0x3030
cmpb $0x2, %bpl
jb 0xadcc
leaq 0x1a0ea(%rip), %rsi     # 0x24eab
xorl %edi, %edi
movl %ebp, %edx
xorl %eax, %eax
callq 0x37cc
cmpb $0x0, 0x5(%rbx)
jns 0xade2
leaq 0x1a0f8(%rip), %rsi     # 0x24ed1
xorl %edi, %edi
xorl %eax, %eax
callq 0x37cc
movzbl 0x6(%rbx), %r15d
andl $0xf, %r15d
leaq 0x1a103(%rip), %rdi     # 0x24ef5
xorl %eax, %eax
callq 0x3030
cmpb $0x5, %r15b
ja 0xb113
leaq 0x176da(%rip), %rax     # 0x224e4
movslq (%rax,%r15,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0x1b762(%rip), %rdi     # 0x2657c
jmp 0xae47
leaq 0x1b721(%rip), %rdi     # 0x26544
jmp 0xae47
leaq 0x1b72e(%rip), %rdi     # 0x2655a
jmp 0xae47
leaq 0x1b71a(%rip), %rdi     # 0x2654f
jmp 0xae47
leaq 0x1b72e(%rip), %rdi     # 0x2656c
jmp 0xae47
leaq 0x1b7ef(%rip), %rdi     # 0x26636
callq 0x3380
testb $0x10, 0x6(%rbx)
leaq 0x1a10c(%rip), %rax     # 0x24f63
leaq 0x1a101(%rip), %rsi     # 0x24f5f
cmoveq %rax, %rsi
leaq 0x1a0d5(%rip), %rdi     # 0x24f3e
xorl %eax, %eax
callq 0x3030
testb $0x20, 0x6(%rbx)
leaq 0x26f19(%rip), %rsi     # 0x31d94
cmovneq %r14, %rsi
leaq 0x1a0e2(%rip), %rdi     # 0x24f68
xorl %eax, %eax
callq 0x3030
cmpb $0x40, 0x6(%rbx)
jb 0xaea3
leaq 0x1a0f8(%rip), %rsi     # 0x24f92
xorl %edi, %edi
xorl %eax, %eax
callq 0x37cc
testb $0x1, 0x7(%rbx)
leaq 0x1a13e(%rip), %r15     # 0x24fec
leaq 0x1a122(%rip), %rsi     # 0x24fd7
cmoveq %r15, %rsi
leaq 0x1a0f6(%rip), %rdi     # 0x24fb6
xorl %eax, %eax
callq 0x3030
testb $0x2, 0x7(%rbx)
leaq 0x1a144(%rip), %rsi     # 0x25016
cmoveq %r15, %rsi
leaq 0x1a116(%rip), %rdi     # 0x24ff3
xorl %eax, %eax
callq 0x3030
cmpb $0x4, 0x7(%rbx)
jb 0xaefa
leaq 0x1a13d(%rip), %rsi     # 0x2502e
xorl %edi, %edi
xorl %eax, %eax
callq 0x37cc
movzbl 0x8(%rbx), %r15d
leaq 0x1a14c(%rip), %rdi     # 0x25052
xorl %eax, %eax
callq 0x3030
andl $0xf, %r15d
je 0xaf2a
addl %r15d, %r15d
leal (%r15,%r15,4), %esi
leaq 0x242a6(%rip), %rdi     # 0x2f1c7
xorl %eax, %eax
callq 0x3030
jmp 0xaf36
leaq 0x1b654(%rip), %rdi     # 0x26585
callq 0x3380
movzbl 0x8(%rbx), %r15d
leaq 0x1a138(%rip), %rdi     # 0x2507a
xorl %eax, %eax
callq 0x3030
cmpl $0x10, %r15d
jae 0xaf5d
leaq 0x1b62f(%rip), %rdi     # 0x26585
callq 0x3380
jmp 0xaf77
shrl $0x3, %r15d
andl $-0x2, %r15d
leal (%r15,%r15,4), %esi
leaq 0x24257(%rip), %rdi     # 0x2f1c7
xorl %eax, %eax
callq 0x3030
movzbl 0x9(%rbx), %r15d
leaq 0x1a120(%rip), %rdi     # 0x250a3
xorl %eax, %eax
callq 0x3030
andl $0xf, %r15d
je 0xafa7
addl %r15d, %r15d
leal (%r15,%r15,4), %esi
leaq 0x24229(%rip), %rdi     # 0x2f1c7
xorl %eax, %eax
callq 0x3030
jmp 0xafb3
leaq 0x1b5d7(%rip), %rdi     # 0x26585
callq 0x3380
movzbl 0x9(%rbx), %r15d
leaq 0x1a10f(%rip), %rdi     # 0x250ce
xorl %eax, %eax
callq 0x3030
cmpl $0x10, %r15d
jae 0xafda
leaq 0x1b5b2(%rip), %rdi     # 0x26585
callq 0x3380
jmp 0xaff4
shrl $0x3, %r15d
andl $-0x2, %r15d
leal (%r15,%r15,4), %esi
leaq 0x241da(%rip), %rdi     # 0x2f1c7
xorl %eax, %eax
callq 0x3030
movzbl 0xa(%rbx), %eax
movl %eax, %esi
andl $0x2f, %esi
testb %al, %al
leaq 0x1a0f4(%rip), %r13     # 0x250fa
movq %r14, %r15
cmovnsq %r13, %r15
leaq 0x1a0f1(%rip), %rdi     # 0x25105
movq %r15, %rdx
xorl %eax, %eax
callq 0x3030
testb $0x40, 0xa(%rbx)
leaq 0x1a9c4(%rip), %rax     # 0x259ed
leaq 0x2629a(%rip), %rsi     # 0x312ca
cmoveq %rax, %rsi
leaq 0x1a0fa(%rip), %rdi     # 0x25135
movq %r15, %rdx
xorl %eax, %eax
callq 0x3030
cmpb $0x0, 0xa(%rbx)
leaq 0x1a137(%rip), %r12     # 0x25187
leaq 0x1a128(%rip), %r15     # 0x2517f
movq %r15, %rsi
cmovnsq %r12, %rsi
leaq 0x1a0f6(%rip), %rdi     # 0x2515b
xorl %eax, %eax
callq 0x3030
movzbl 0xb(%rbx), %eax
movl %eax, %esi
andl $0x2f, %esi
testb %al, %al
cmovnsq %r13, %r14
leaq 0x1a10e(%rip), %rdi     # 0x25190
movq %r14, %rdx
xorl %eax, %eax
callq 0x3030
movb 0xb(%rbx), %al
testb $0x40, %al
je 0xb0a6
leaq 0x1a123(%rip), %rsi     # 0x251bd
xorl %edi, %edi
xorl %eax, %eax
callq 0x37cc
movb 0xb(%rbx), %al
testb %al, %al
cmovnsq %r12, %r15
leaq 0x1a12f(%rip), %rdi     # 0x251e2
movq %r15, %rsi
xorl %eax, %eax
callq 0x3030
cmpb $0x0, 0xc(%rbx)
jne 0xb0db
cmpb $0x0, 0xd(%rbx)
jne 0xb0db
cmpb $0x0, 0xe(%rbx)
jne 0xb0db
cmpb $0x0, 0xf(%rbx)
jne 0xb0db
cmpb $0x0, 0x10(%rbx)
je 0xb0eb
leaq 0x1a123(%rip), %rsi     # 0x25205
xorl %edi, %edi
xorl %eax, %eax
callq 0x37cc
movzbl 0x11(%rbx), %edx
movl %edx, %esi
shrl $0x4, %esi
andl $0xf, %edx
leaq 0x1a131(%rip), %rdi     # 0x2522f
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3030
leaq 0x19df2(%rip), %rdi     # 0x24f0c
movl %r15d, %esi
xorl %eax, %eax
callq 0x3030
leaq 0x19df3(%rip), %rsi     # 0x24f1e
xorl %edi, %edi
movl %r15d, %edx
xorl %eax, %eax
callq 0x37cc
jmp 0xae4c