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

	switch (x[1] >> 6) {
	case 0x00: printf("    Timings that explicitly report 3D capability\n"); break;
	case 0x01: printf("    Timings that explicitly report 3D capability & Timing Codes listed here\n"); break;
	case 0x02: printf("    All listed timings\n"); break;
	case 0x03: printf("    Only Timings Codes listed here\n"); break;
	}

	unsigned len = x[2];

	switch (x[4]) {
	case 0x00:
		printf("    Field Sequential Stereo (L/R Polarity: %s)\n",
		       (x[5] & 1) ? "0/1" : "1/0");
		break;
	case 0x01:
		printf("    Side-by-side Stereo (Left Half = %s Eye View)\n",
		       (x[5] & 1) ? "Right" : "Left");
		break;
	case 0x02:
		printf("    Pixel Interleaved Stereo:\n");
		for (unsigned y = 0; y < 8; y++) {
			unsigned char v = x[5 + y];

			printf("      ");
			for (int x = 7; x >= 0; x--)
				printf("%c", (v & (1 << x)) ? 'L' : 'R');
			printf("\n");
		}
		break;
	case 0x03:
		printf("    Dual Interface, Left and Right Separate\n");
		printf("      Carries the %s-eye view\n",
		       (x[5] & 1) ? "Right" : "Left");
		printf("      ");
		switch ((x[5] >> 1) & 3) {
		case 0x00: printf("No mirroring\n"); break;
		case 0x01: printf("Left/Right mirroring\n"); break;
		case 0x02: printf("Top/Bottom mirroring\n"); break;
		case 0x03: printf("Reserved\n"); break;
		}
		break;
	case 0x04:
		printf("    Multi-View: %u views, Interleaving Method Code: %u\n",
		       x[5], x[6]);
		break;
	case 0x05:
		printf("    Stacked Frame Stereo (Top Half = %s Eye View)\n",
		       (x[5] & 1) ? "Right" : "Left");
		break;
	case 0xff:
		printf("    Proprietary\n");
		break;
	default:
		printf("    Reserved\n");
		break;
	}
	if (!(x[1] & 0x40)) // Has No Timing Codes
		return;
	len -= 1 + x[3];
	x += 4 + x[3];
	while (1U + (x[0] & 0x1f) <= len) {
		unsigned num_codes = x[0] & 0x1f;
		unsigned type = x[0] >> 6;
		char type_name[16];

		for (unsigned i = 1; i <= num_codes; i++) {
			switch (type) {
			case 0x00:
				sprintf(type_name, "DMT 0x%02x", x[i]);
				print_timings("    ", find_dmt_id(x[i]), type_name);
				break;
			case 0x01:
				sprintf(type_name, "VIC %3u", x[i]);
				print_timings("    ", find_vic_id(x[i]), type_name);
				break;
			case 0x02:
				sprintf(type_name, "HDMI VIC %u", x[i]);
				print_timings("    ", find_hdmi_vic_id(x[i]), type_name);
				break;
			}
		}

		len -= 1 + num_codes;
		x += 1 + num_codes;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r14
movq %rdi, 0x18(%rsp)
movzbl 0x1(%rsi), %esi
movl $0xc0, %edx
movl $0x1, %ecx
callq 0x1611c
movzbl 0x1(%r14), %eax
shrl $0x6, %eax
leaq 0x164e4(%rip), %rcx     # 0x2eb3c
movslq (%rcx,%rax,4), %rdi
addq %rcx, %rdi
callq 0x3380
movzbl 0x2(%r14), %edx
movzbl 0x4(%r14), %eax
cmpq $0x5, %rax
movl %edx, 0x14(%rsp)
ja 0x186ab
leaq 0x16099(%rip), %rcx     # 0x2e718
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
testb $0x1, 0x5(%r14)
leaq 0x16fa3(%rip), %rax     # 0x2f637
leaq 0x16f98(%rip), %rsi     # 0x2f633
cmoveq %rax, %rsi
leaq 0x16f5d(%rip), %rdi     # 0x2f603
jmp 0x187f0
cmpl $0xff, %eax
jne 0x1873f
leaq 0x18e6e(%rip), %rdi     # 0x3152b
jmp 0x18746
movzbl 0x5(%r14), %esi
movzbl 0x6(%r14), %edx
leaq 0x16fba(%rip), %rdi     # 0x2f68d
xorl %eax, %eax
callq 0x3030
jmp 0x187f7
leaq 0x18eb8(%rip), %rdi     # 0x3159e
callq 0x3380
leaq 0xcda3(%rip), %r15      # 0x25495
movl $0x52, %ebx
xorl %r13d, %r13d
movzbl 0x5(%r14,%r13), %ebp
movq %r15, %rdi
xorl %eax, %eax
callq 0x3030
movl $0x7, %r12d
btl %r12d, %ebp
movl $0x4c, %edi
cmovael %ebx, %edi
callq 0x3310
addl $-0x1, %r12d
jb 0x18710
movl $0xa, %edi
callq 0x3310
incq %r13
cmpq $0x8, %r13
jne 0x186fa
jmp 0x187f7
leaq 0x18e76(%rip), %rdi     # 0x315bc
callq 0x3380
jmp 0x187f7
leaq 0x18de4(%rip), %rdi     # 0x3153b
callq 0x3380
testb $0x1, 0x5(%r14)
leaq 0x13605(%rip), %rax     # 0x2bd6d
leaq 0x1360e(%rip), %rsi     # 0x2bd7d
cmoveq %rax, %rsi
leaq 0x16ef4(%rip), %rdi     # 0x2f66e
xorl %eax, %eax
callq 0x3030
leaq 0xcd0d(%rip), %rdi      # 0x25495
xorl %eax, %eax
callq 0x3030
movzbl 0x5(%r14), %eax
shrl %eax
andl $0x3, %eax
leaq 0x15f90(%rip), %rcx     # 0x2e730
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x18de1(%rip), %rdi     # 0x31591
jmp 0x18746
testb $0x1, 0x5(%r14)
leaq 0x135af(%rip), %rax     # 0x2bd6d
leaq 0x135b8(%rip), %rsi     # 0x2bd7d
cmoveq %rax, %rsi
leaq 0x16e6b(%rip), %rdi     # 0x2f63b
jmp 0x187f0
testb $0x1, 0x5(%r14)
leaq 0x1358f(%rip), %rax     # 0x2bd6d
leaq 0x13598(%rip), %rsi     # 0x2bd7d
cmoveq %rax, %rsi
leaq 0x16ed5(%rip), %rdi     # 0x2f6c5
xorl %eax, %eax
callq 0x3030
testb $0x40, 0x1(%r14)
je 0x18934
movzbl 0x3(%r14), %edx
movl %edx, %esi
notl %esi
addl 0x14(%rsp), %esi
movzbl 0x4(%r14,%rdx), %eax
movl %eax, %ecx
andl $0x1f, %ecx
cmpl %esi, %ecx
jae 0x18934
leaq (%r14,%rdx), %rbp
addq $0x4, %rbp
leaq 0x15f0f(%rip), %r14     # 0x2e740
leaq 0x30(%rsp), %r15
leal 0x1(%rcx), %edx
testl %ecx, %ecx
je 0x18860
movl %esi, 0x14(%rsp)
shrl $0x6, %eax
movl %edx, 0x24(%rsp)
movl %edx, %edx
movq %rdx, 0x28(%rsp)
movl %ecx, %ebx
movl %eax, %r12d
movslq (%r14,%r12,4), %rax
addq %r14, %rax
xorl %r13d, %r13d
jmpq *%rax
movl $0x1, %ecx
jmp 0x1891d
movzbl 0x1(%rbp,%r13), %edx
movq %r15, %rdi
leaq 0x8065(%rip), %rsi      # 0x208df
xorl %eax, %eax
callq 0x3070
movzbl 0x1(%rbp,%r13), %edi
callq 0x8df0
movq %rax, %rdx
movq 0x18(%rsp), %rdi
leaq 0xcbfc(%rip), %rsi      # 0x25497
leaq 0x83e7(%rip), %r8       # 0x20c89
movl $0x1, (%rsp)
movq %r15, %rcx
xorl %r9d, %r9d
callq 0x3e8c
incq %r13
cmpq %r13, %rbx
je 0x18910
movslq (%r14,%r12,4), %rax
addq %r14, %rax
jmpq *%rax
movzbl 0x1(%rbp,%r13), %edx
movq %r15, %rdi
leaq 0x802f(%rip), %rsi      # 0x20904
xorl %eax, %eax
callq 0x3070
movzbl 0x1(%rbp,%r13), %edi
callq 0xdfcf
jmp 0x1888c
movzbl 0x1(%rbp,%r13), %edx
movq %r15, %rdi
leaq 0x8029(%rip), %rsi      # 0x20922
xorl %eax, %eax
callq 0x3070
movzbl 0x1(%rbp,%r13), %edi
callq 0xe00e
jmp 0x1888c
movl 0x14(%rsp), %esi
movl 0x24(%rsp), %edx
movq 0x28(%rsp), %rcx
subl %edx, %esi
movzbl (%rbp,%rcx), %eax
addq %rcx, %rbp
movl %eax, %ecx
andl $0x1f, %ecx
cmpl %esi, %ecx
jb 0x18836
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x18c1d(%rip), %rdi     # 0x31567
jmp 0x18746
leaq 0x18c6a(%rip), %rdi     # 0x315c0
jmp 0x18746
leaq 0x18c1a(%rip), %rdi     # 0x3157c
jmp 0x18746
nop