// File: 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
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x58(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x1(%rax), %esi
movl $0xc0, %edx
movl $0x1, %ecx
callq 0x21b00
movq -0x10(%rbp), %rax
movzbl 0x1(%rax), %eax
shrl $0x6, %eax
movl %eax, %ecx
movq %rcx, -0x50(%rbp)
subl $0x3, %eax
ja 0x250fa
movq -0x50(%rbp), %rax
leaq 0x18cb9(%rip), %rcx     # 0x3dd6c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x1a316(%rip), %rdi     # 0x3f3d9
movb $0x0, %al
callq 0x4050
jmp 0x250fa
leaq 0x1a338(%rip), %rdi     # 0x3f40b
movb $0x0, %al
callq 0x4050
jmp 0x250fa
leaq 0x1a375(%rip), %rdi     # 0x3f458
movb $0x0, %al
callq 0x4050
jmp 0x250fa
leaq 0x1a37d(%rip), %rdi     # 0x3f470
movb $0x0, %al
callq 0x4050
movq -0x10(%rbp), %rax
movzbl 0x2(%rax), %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x4(%rax), %eax
movl %eax, -0x5c(%rbp)
testl %eax, %eax
je 0x2516f
jmp 0x25116
movl -0x5c(%rbp), %eax
subl $0x1, %eax
je 0x251b0
jmp 0x25124
movl -0x5c(%rbp), %eax
subl $0x2, %eax
je 0x251e3
jmp 0x25132
movl -0x5c(%rbp), %eax
subl $0x3, %eax
je 0x2529a
jmp 0x25140
movl -0x5c(%rbp), %eax
subl $0x4, %eax
je 0x25351
jmp 0x2514e
movl -0x5c(%rbp), %eax
subl $0x5, %eax
je 0x25371
jmp 0x2515c
movl -0x5c(%rbp), %eax
subl $0xff, %eax
je 0x253a1
jmp 0x253b1
movq -0x10(%rbp), %rax
movzbl 0x5(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x2518c
leaq 0x1a33e(%rip), %rax     # 0x3f4c4
movq %rax, -0x68(%rbp)
jmp 0x25199
leaq 0x1a335(%rip), %rax     # 0x3f4c8
movq %rax, -0x68(%rbp)
jmp 0x25199
movq -0x68(%rbp), %rsi
leaq 0x1a2f0(%rip), %rdi     # 0x3f494
movb $0x0, %al
callq 0x4050
jmp 0x253bf
movq -0x10(%rbp), %rax
movzbl 0x5(%rax), %ecx
andl $0x1, %ecx
leaq 0x164ea(%rip), %rsi     # 0x3b6ac
leaq 0x164f3(%rip), %rax     # 0x3b6bc
cmpl $0x0, %ecx
cmovneq %rax, %rsi
leaq 0x1a2f5(%rip), %rdi     # 0x3f4cc
movb $0x0, %al
callq 0x4050
jmp 0x253bf
leaq 0x1a315(%rip), %rdi     # 0x3f4ff
movb $0x0, %al
callq 0x4050
movl $0x0, -0x18(%rbp)
cmpl $0x8, -0x18(%rbp)
jae 0x25295
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
addl $0x5, %ecx
movl %ecx, %ecx
movb (%rax,%rcx), %al
movb %al, -0x19(%rbp)
leaq 0xf5c2(%rip), %rdi      # 0x347dd
movb $0x0, %al
callq 0x4050
movl $0x7, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
jl 0x25279
movzbl -0x19(%rbp), %eax
movl %eax, -0x70(%rbp)
movl -0x20(%rbp), %ecx
movl $0x1, %eax
shll %cl, %eax
movl -0x70(%rbp), %ecx
andl %eax, %ecx
movb $0x4c, %al
movb $0x52, %dl
movb %dl, -0x6a(%rbp)
cmpl $0x0, %ecx
movb %al, -0x69(%rbp)
jne 0x2525a
movb -0x6a(%rbp), %al
movb %al, -0x69(%rbp)
movb -0x69(%rbp), %al
movsbl %al, %esi
leaq 0xa3aa(%rip), %rdi      # 0x2f611
movb $0x0, %al
callq 0x4050
movl -0x20(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x25229
leaq 0xa689(%rip), %rdi      # 0x2f909
movb $0x0, %al
callq 0x4050
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x251f8
jmp 0x253bf
leaq 0x1a27d(%rip), %rdi     # 0x3f51e
xorl %eax, %eax
movb %al, -0x79(%rbp)
callq 0x4050
movb -0x79(%rbp), %al
movq -0x10(%rbp), %rcx
movb 0x5(%rcx), %dl
leaq 0x16400(%rip), %rcx     # 0x3b6bc
leaq 0x163e9(%rip), %rsi     # 0x3b6ac
testb $0x1, %dl
cmovneq %rcx, %rsi
leaq 0x1a27a(%rip), %rdi     # 0x3f54b
callq 0x4050
movb -0x79(%rbp), %al
leaq 0xf4fd(%rip), %rdi      # 0x347dd
callq 0x4050
movq -0x10(%rbp), %rax
movzbl 0x5(%rax), %eax
shrl %eax
andl $0x3, %eax
movl %eax, %ecx
movq %rcx, -0x78(%rbp)
subl $0x3, %eax
ja 0x2534f
movq -0x78(%rbp), %rax
leaq 0x18a74(%rip), %rcx     # 0x3dd7c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x1a252(%rip), %rdi     # 0x3f56a
movb $0x0, %al
callq 0x4050
jmp 0x2534f
leaq 0x1a250(%rip), %rdi     # 0x3f578
movb $0x0, %al
callq 0x4050
jmp 0x2534f
leaq 0x1a256(%rip), %rdi     # 0x3f58e
movb $0x0, %al
callq 0x4050
jmp 0x2534f
leaq 0x1a2dc(%rip), %rdi     # 0x3f624
movb $0x0, %al
callq 0x4050
jmp 0x253bf
movq -0x10(%rbp), %rax
movzbl 0x5(%rax), %esi
movq -0x10(%rbp), %rax
movzbl 0x6(%rax), %edx
leaq 0x1a23c(%rip), %rdi     # 0x3f5a4
movb $0x0, %al
callq 0x4050
jmp 0x253bf
movq -0x10(%rbp), %rax
movzbl 0x5(%rax), %ecx
andl $0x1, %ecx
leaq 0x16329(%rip), %rsi     # 0x3b6ac
leaq 0x16332(%rip), %rax     # 0x3b6bc
cmpl $0x0, %ecx
cmovneq %rax, %rsi
leaq 0x1a244(%rip), %rdi     # 0x3f5dc
movb $0x0, %al
callq 0x4050
jmp 0x253bf
leaq 0x1a267(%rip), %rdi     # 0x3f60f
movb $0x0, %al
callq 0x4050
jmp 0x253bf
leaq 0x1a268(%rip), %rdi     # 0x3f620
movb $0x0, %al
callq 0x4050
movq -0x10(%rbp), %rax
movzbl 0x1(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
jne 0x253d4
jmp 0x255a6
movq -0x10(%rbp), %rax
movzbl 0x3(%rax), %ecx
addl $0x1, %ecx
movl -0x14(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x3(%rax), %ecx
addl $0x4, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
andl $0x1f, %eax
addl $0x1, %eax
cmpl -0x14(%rbp), %eax
ja 0x255a6
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
andl $0x1f, %eax
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
sarl $0x6, %eax
movl %eax, -0x28(%rbp)
movl $0x1, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x24(%rbp), %eax
ja 0x25580
movl -0x28(%rbp), %eax
movl %eax, -0x80(%rbp)
testl %eax, %eax
je 0x2546a
jmp 0x2544f
movl -0x80(%rbp), %eax
subl $0x1, %eax
je 0x254c4
jmp 0x25459
movl -0x80(%rbp), %eax
subl $0x2, %eax
je 0x2551b
jmp 0x25570
leaq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rax
movl -0x44(%rbp), %ecx
movzbl (%rax,%rcx), %edx
leaq 0xa639(%rip), %rsi      # 0x2fab9
movb $0x0, %al
callq 0x40a0
movq -0x10(%rbp), %rax
movl -0x44(%rbp), %ecx
movzbl (%rax,%rcx), %edi
callq 0xe6b0
movq -0x58(%rbp), %rdi
movq %rax, %rdx
leaq -0x40(%rbp), %rcx
leaq 0xf336(%rip), %rsi      # 0x347df
leaq 0xaa09(%rip), %r8       # 0x2feb9
xorl %r9d, %r9d
movl $0x1, (%rsp)
callq 0x50c0
jmp 0x25570
leaq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rax
movl -0x44(%rbp), %ecx
movzbl (%rax,%rcx), %edx
leaq 0xa604(%rip), %rsi      # 0x2fade
movb $0x0, %al
callq 0x40a0
movq -0x10(%rbp), %rax
movl -0x44(%rbp), %ecx
movzbl (%rax,%rcx), %edi
callq 0x154d0
movq -0x58(%rbp), %rdi
movq %rax, %rdx
leaq -0x40(%rbp), %rcx
leaq 0xf2dc(%rip), %rsi      # 0x347df
leaq 0xa9af(%rip), %r8       # 0x2feb9
xorl %r9d, %r9d
movl $0x1, (%rsp)
callq 0x50c0
jmp 0x25570
leaq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rax
movl -0x44(%rbp), %ecx
movzbl (%rax,%rcx), %edx
leaq 0xa5cb(%rip), %rsi      # 0x2fafc
movb $0x0, %al
callq 0x40a0
movq -0x10(%rbp), %rax
movl -0x44(%rbp), %ecx
movzbl (%rax,%rcx), %edi
callq 0x15560
movq -0x58(%rbp), %rdi
movq %rax, %rdx
leaq -0x40(%rbp), %rcx
leaq 0xf285(%rip), %rsi      # 0x347df
leaq 0xa958(%rip), %r8       # 0x2feb9
xorl %r9d, %r9d
movl $0x1, (%rsp)
callq 0x50c0
jmp 0x25572
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x25437
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movl -0x14(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x14(%rbp)
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movq -0x10(%rbp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x25400
addq $0x90, %rsp
popq %rbp
retq
nop