// File: /workspace/github_cpp_makefile_star2_O1/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
movl $0xc0, %edx
movl $0x1, %ecx
callq 0x1627c
movzbl 0x1(%r14), %eax
shrl $0x6, %eax
leaq 0x1636a(%rip), %rcx     # 0x2eb14
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 0x187fd
leaq 0x15f1f(%rip), %rcx     # 0x2e6f0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
testb $0x1, 0x5(%r14)
leaq 0x16e11(%rip), %rax     # 0x2f5f7
leaq 0x16e06(%rip), %rsi     # 0x2f5f3
cmoveq %rax, %rsi
leaq 0x16dcb(%rip), %rdi     # 0x2f5c3
jmp 0x18942
cmpl $0xff, %eax
jne 0x18891
leaq 0x18cdc(%rip), %rdi     # 0x314eb
jmp 0x18898
movzbl 0x5(%r14), %esi
movzbl 0x6(%r14), %edx
leaq 0x16e28(%rip), %rdi     # 0x2f64d
xorl %eax, %eax
callq 0x3030
jmp 0x18949
leaq 0x18d26(%rip), %rdi     # 0x3155e
callq 0x3380
leaq 0xcc01(%rip), %r15      # 0x25445
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 0x18862
movl $0xa, %edi
callq 0x3310
incq %r13
cmpq $0x8, %r13
jne 0x1884c
jmp 0x18949
leaq 0x18ce4(%rip), %rdi     # 0x3157c
callq 0x3380
jmp 0x18949
leaq 0x18c52(%rip), %rdi     # 0x314fb
callq 0x3380
testb $0x1, 0x5(%r14)
leaq 0x1348b(%rip), %rax     # 0x2bd45
leaq 0x13494(%rip), %rsi     # 0x2bd55
cmoveq %rax, %rsi
leaq 0x16d62(%rip), %rdi     # 0x2f62e
xorl %eax, %eax
callq 0x3030
leaq 0xcb6b(%rip), %rdi      # 0x25445
xorl %eax, %eax
callq 0x3030
movzbl 0x5(%r14), %eax
shrl %eax
andl $0x3, %eax
leaq 0x15e16(%rip), %rcx     # 0x2e708
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x18c4f(%rip), %rdi     # 0x31551
jmp 0x18898
testb $0x1, 0x5(%r14)
leaq 0x13435(%rip), %rax     # 0x2bd45
leaq 0x1343e(%rip), %rsi     # 0x2bd55
cmoveq %rax, %rsi
leaq 0x16cd9(%rip), %rdi     # 0x2f5fb
jmp 0x18942
testb $0x1, 0x5(%r14)
leaq 0x13415(%rip), %rax     # 0x2bd45
leaq 0x1341e(%rip), %rsi     # 0x2bd55
cmoveq %rax, %rsi
leaq 0x16d43(%rip), %rdi     # 0x2f685
xorl %eax, %eax
callq 0x3030
testb $0x40, 0x1(%r14)
je 0x18a6c
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 0x18a6c
leaq (%r14,%rdx), %rbp
addq $0x4, %rbp
leaq 0x15d95(%rip), %r14     # 0x2e718
leaq 0x20(%rsp), %r15
movl %esi, 0x14(%rsp)
movl %ecx, %ebx
testl %ecx, %ecx
je 0x18a4e
shrl $0x6, %eax
movl %eax, %r12d
movslq (%r14,%r12,4), %rax
addq %r14, %rax
xorl %r13d, %r13d
jmpq *%rax
movzbl 0x1(%rbp,%r13), %edx
movq %r15, %rdi
leaq 0x7f17(%rip), %rsi      # 0x208cf
xorl %eax, %eax
callq 0x3070
movzbl 0x1(%rbp,%r13), %edi
callq 0x9000
movq %rax, %rdx
movq 0x18(%rsp), %rdi
leaq 0xca6e(%rip), %rsi      # 0x25447
leaq 0x8299(%rip), %r8       # 0x20c79
movl $0x1, (%rsp)
movq %r15, %rcx
xorl %r9d, %r9d
callq 0x3ebe
incq %r13
cmpq %r13, %rbx
je 0x18a4e
movslq (%r14,%r12,4), %rax
addq %r14, %rax
jmpq *%rax
movzbl 0x1(%rbp,%r13), %edx
movq %r15, %rdi
leaq 0x7ee1(%rip), %rsi      # 0x208f4
xorl %eax, %eax
callq 0x3070
movzbl 0x1(%rbp,%r13), %edi
callq 0xe18f
jmp 0x189ca
movzbl 0x1(%rbp,%r13), %edx
movq %r15, %rdi
leaq 0x7edb(%rip), %rsi      # 0x20912
xorl %eax, %eax
callq 0x3070
movzbl 0x1(%rbp,%r13), %edi
callq 0xe1ce
jmp 0x189ca
incq %rbx
movl 0x14(%rsp), %esi
subl %ebx, %esi
movzbl (%rbp,%rbx), %eax
addq %rbx, %rbp
movl %eax, %ecx
andl $0x1f, %ecx
cmpl %esi, %ecx
jb 0x18988
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x18aa5(%rip), %rdi     # 0x31527
jmp 0x18898
leaq 0x18af2(%rip), %rdi     # 0x31580
jmp 0x18898
leaq 0x18aa2(%rip), %rdi     # 0x3153c
jmp 0x18898
nop