// File: /workspace/github_cpp_makefile_star2_O2/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 $0x38, %rsp
movq %rsi, %r14
movq %rdi, 0x18(%rsp)
movzbl 0x1(%rsi), %esi
pushq $0x1
popq %rcx
movl $0xc0, %edx
callq 0x123f0
movzbl 0x1(%r14), %eax
shrl $0x6, %eax
leaq 0x1480c(%rip), %rcx     # 0x28b44
movslq (%rcx,%rax,4), %rdi
addq %rcx, %rdi
callq 0x33b0
movzbl 0x2(%r14), %edx
movzbl 0x4(%r14), %eax
cmpq $0x5, %rax
movl %edx, 0xc(%rsp)
ja 0x1438b
leaq 0x143c1(%rip), %rcx     # 0x28720
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
testb $0x1, 0x5(%r14)
leaq 0x152c3(%rip), %rax     # 0x29637
leaq 0x152b8(%rip), %rsi     # 0x29633
cmoveq %rax, %rsi
leaq 0x1527d(%rip), %rdi     # 0x29603
jmp 0x144cc
cmpl $0xff, %eax
jne 0x1441b
leaq 0x1718e(%rip), %rdi     # 0x2b52b
jmp 0x14422
movzbl 0x5(%r14), %esi
movzbl 0x6(%r14), %edx
leaq 0x152da(%rip), %rdi     # 0x2968d
xorl %eax, %eax
callq 0x3030
jmp 0x144d3
leaq 0x171d8(%rip), %rdi     # 0x2b59e
callq 0x33b0
pushq $0x52
popq %r13
pushq $0x4c
popq %r12
xorl %r15d, %r15d
cmpq $0x8, %r15
je 0x144d3
movzbl 0x5(%r14,%r15), %ebx
leaq 0xb0a8(%rip), %rdi      # 0x1f495
xorl %eax, %eax
callq 0x3030
pushq $0x7
popq %rbp
testl %ebp, %ebp
js 0x1440e
btl %ebp, %ebx
movl %r12d, %edi
cmovael %r13d, %edi
callq 0x3340
decl %ebp
jmp 0x143f7
pushq $0xa
popq %rdi
callq 0x3340
incq %r15
jmp 0x143d6
leaq 0x1719a(%rip), %rdi     # 0x2b5bc
callq 0x33b0
jmp 0x144d3
leaq 0x17108(%rip), %rdi     # 0x2b53b
callq 0x33b0
testb $0x1, 0x5(%r14)
leaq 0x11929(%rip), %rax     # 0x25d6d
leaq 0x11932(%rip), %rsi     # 0x25d7d
cmoveq %rax, %rsi
leaq 0x15218(%rip), %rdi     # 0x2966e
xorl %eax, %eax
callq 0x3030
leaq 0xb031(%rip), %rdi      # 0x1f495
xorl %eax, %eax
callq 0x3030
movzbl 0x5(%r14), %eax
shrl %eax
andl $0x3, %eax
leaq 0x142bc(%rip), %rcx     # 0x28738
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x17105(%rip), %rdi     # 0x2b591
jmp 0x14422
testb $0x1, 0x5(%r14)
leaq 0x118d3(%rip), %rax     # 0x25d6d
leaq 0x118dc(%rip), %rsi     # 0x25d7d
cmoveq %rax, %rsi
leaq 0x1518f(%rip), %rdi     # 0x2963b
jmp 0x144cc
testb $0x1, 0x5(%r14)
leaq 0x118b3(%rip), %rax     # 0x25d6d
leaq 0x118bc(%rip), %rsi     # 0x25d7d
cmoveq %rax, %rsi
leaq 0x151f9(%rip), %rdi     # 0x296c5
xorl %eax, %eax
callq 0x3030
testb $0x40, 0x1(%r14)
jne 0x144e9
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movzbl 0x3(%r14), %eax
leaq (%r14,%rax), %rbp
addq $0x4, %rbp
movl %eax, %ecx
notl %ecx
addl 0xc(%rsp), %ecx
leaq 0x14243(%rip), %r14     # 0x28748
leaq 0x20(%rsp), %r15
movzbl (%rbp), %eax
movl %eax, %ebx
andl $0x1f, %ebx
cmpl %ecx, %ebx
jae 0x144da
movl %ecx, 0xc(%rsp)
leaq 0x1(%rbx), %rcx
movq %rcx, 0x10(%rsp)
shrl $0x6, %eax
movl %eax, %r12d
xorl %r13d, %r13d
cmpq %r13, %rbx
je 0x145d9
movslq (%r14,%r12,4), %rax
addq %r14, %rax
jmpq *%rax
movzbl 0x1(%rbp,%r13), %edx
movq %r15, %rdi
leaq 0x6390(%rip), %rsi      # 0x1a8df
xorl %eax, %eax
callq 0x3070
movzbl 0x1(%rbp,%r13), %edi
callq 0x7d78
jmp 0x145a9
movzbl 0x1(%rbp,%r13), %edx
movq %r15, %rdi
leaq 0x6391(%rip), %rsi      # 0x1a904
xorl %eax, %eax
callq 0x3070
movzbl 0x1(%rbp,%r13), %edi
callq 0xbf2b
jmp 0x145a9
movzbl 0x1(%rbp,%r13), %edx
movq %r15, %rdi
leaq 0x638b(%rip), %rsi      # 0x1a922
xorl %eax, %eax
callq 0x3070
movzbl 0x1(%rbp,%r13), %edi
callq 0xbf6a
movl $0x1, (%rsp)
movq 0x18(%rsp), %rdi
leaq 0xaedb(%rip), %rsi      # 0x1f497
movq %rax, %rdx
movq %r15, %rcx
leaq 0x66c0(%rip), %r8       # 0x1ac89
xorl %r9d, %r9d
callq 0x3af0
incq %r13
jmp 0x1452d
movl 0xc(%rsp), %ecx
movq 0x10(%rsp), %rax
subl %eax, %ecx
addq %rax, %rbp
jmp 0x1450a
leaq 0x16f74(%rip), %rdi     # 0x2b567
jmp 0x14422
leaq 0x16fc1(%rip), %rdi     # 0x2b5c0
jmp 0x14422
leaq 0x16f71(%rip), %rdi     # 0x2b57c
jmp 0x14422