LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/parse-cta-block.cpp
// Function: edid_state::cta_displayid_type_8(unsigned char const*, unsigned int)
void edid_state::cta_displayid_type_8(const unsigned char *x, unsigned length)
{
	check_displayid_datablock_revision(x[0], 0xe8, 1);
	if (length < ((x[0] & 0x08) ? 3 : 2)) {
		fail("Empty Data Block with length %u.\n", length);
		return;
	}

	unsigned sz = (x[0] & 0x08) ? 2 : 1;
	unsigned type = x[0] >> 6;

	if (type) {
		fail("Only code type 0 is supported.\n");
		return;
	}

	if (x[0] & 0x20)
		printf("    Also supports YCbCr 4:2:0\n");

	x++;
	length--;
	for (unsigned i = 0; i < length / sz; i++) {
		unsigned id = x[i * sz];

		if (sz == 2)
			id |= x[i * sz + 1] << 8;
		parse_displayid_type_4_8_timing(type, id, true);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
movzbl (%rsi), %esi
pushq $0x1
popq %rcx
movl $0xe8, %edx
callq 0x123f0
movzbl (%r14), %eax
movl %eax, %r13d
andl $0x8, %r13d
cmpl $0x1, %r13d
pushq $0x3
popq %rcx
sbbl $0x0, %ecx
cmpl %ebx, %ecx
jbe 0xde0e
leaq 0x1635a(%rip), %rsi     # 0x2414f
xorl %edi, %edi
movl %ebx, %edx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x362c
cmpb $0x40, %al
jae 0xde6d
cmpb $0x20, %al
jb 0xde22
leaq 0x19b89(%rip), %rdi     # 0x279a6
callq 0x33b0
decl %ebx
movl %r13d, %ebp
shrl $0x3, %ebp
movl %ebp, %ecx
shrl %cl, %ebx
xorl %r12d, %r12d
cmpl %r12d, %ebx
je 0xde8b
movl %r12d, %edx
movl %ebp, %ecx
shll %cl, %edx
movzbl 0x1(%r14,%rdx), %eax
testb %r13b, %r13b
je 0xde58
movl %edx, %ecx
movzbl 0x2(%r14,%rcx), %ecx
shll $0x8, %ecx
movzwl %ax, %eax
orl %ecx, %eax
movzwl %ax, %edx
movq %r15, %rdi
xorl %esi, %esi
pushq $0x1
popq %rcx
callq 0x135f0
incl %r12d
jmp 0xde31
leaq 0x16d65(%rip), %rsi     # 0x24bd9
xorl %edi, %edi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x362c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/parse-cta-block.cpp
// Function: edid_state::cta_displayid_type_10(unsigned char const*, unsigned int)
void edid_state::cta_displayid_type_10(const unsigned char *x, unsigned length)
{
	check_displayid_datablock_revision(x[0], 0x70);
	if (length < 7U + ((x[0] & 0x70) >> 4)) {
		fail("Empty Data Block with length %u.\n", length);
		return;
	}

	unsigned sz = 6U + ((x[0] & 0x70) >> 4);
	x++;
	length--;
	for (unsigned i = 0; i < length / sz; i++)
		parse_displayid_type_10_timing(x + i * sz, true);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
movzbl (%rsi), %esi
pushq $0x70
popq %rdx
xorl %r12d, %r12d
xorl %ecx, %ecx
callq 0x123f0
movzbl (%rbx), %r13d
shrl $0x4, %r13d
andl $0x7, %r13d
leal 0x7(%r13), %eax
cmpl %ebp, %eax
jbe 0xdef1
leaq 0x16277(%rip), %rsi     # 0x2414f
xorl %edi, %edi
movl %ebp, %edx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x362c
addl $0x6, %r13d
incq %rbx
decl %ebp
movl %ebp, %eax
xorl %edx, %edx
divl %r13d
movl %eax, %r15d
pushq $0x1
popq %rbp
subq $0x1, %r15
jb 0xdf22
movl %r12d, %esi
addq %rbx, %rsi
movq %r14, %rdi
movl %ebp, %edx
callq 0x15ad4
addl %r13d, %r12d
jmp 0xdf07
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/parse-cta-block.cpp
// Function: edid_state::cta_resolve_svr(__gnu_cxx::__normal_iterator<timings_ext*, std::vector<timings_ext, std::allocator<timings_ext>>>)
void edid_state::cta_resolve_svr(vec_timings_ext::iterator iter)
{
	if (iter->svr() == 254) {
		iter->flags = cta.t8vtdb.flags;
		iter->t = cta.t8vtdb.t;
	} else if (iter->svr() <= 144) {
		iter->flags = cta.vec_dtds[iter->svr() - 129].flags;
		iter->t = cta.vec_dtds[iter->svr() - 129].t;
	} else {
		iter->flags = cta.vec_vtdbs[iter->svr() - 145].flags;
		iter->t = cta.vec_vtdbs[iter->svr() - 145].t;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl (%rsi), %eax
cmpl $0xfe, %eax
jne 0x118f4
leaq 0x210(%r14), %r15
addq $0x288, %r14            # imm = 0x288
leaq 0x78(%rbx), %rdi
movq %r14, %rsi
callq 0x3160
jmp 0x1196b
leaq 0x78(%rbx), %rdi
cmpl $0x90, %eax
ja 0x11936
movl $0xffffff7f, %r15d      # imm = 0xFFFFFF7F
addl %r15d, %eax
movq 0x188(%r14), %rcx
imulq $0x98, %rax, %rax
leaq (%rcx,%rax), %rsi
addq $0x78, %rsi
callq 0x3160
addl (%rbx), %r15d
imulq $0x98, %r15, %r15
addq 0x188(%r14), %r15
jmp 0x1196b
movl $0xffffff6f, %r15d      # imm = 0xFFFFFF6F
addl %r15d, %eax
movq 0x1a8(%r14), %rcx
imulq $0x98, %rax, %rax
leaq (%rcx,%rax), %rsi
addq $0x78, %rsi
callq 0x3160
addl (%rbx), %r15d
imulq $0x98, %r15, %r15
addq 0x1a8(%r14), %r15
pushq $0x54
popq %rcx
movq %rbx, %rdi
movq %r15, %rsi
rep  movsb (%rsi), %es:(%rdi)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/parse-cta-block.cpp
// Function: edid_state::cta_resolve_svrs()
void edid_state::cta_resolve_svrs()
{
	for (vec_timings_ext::iterator iter = cta.preferred_timings.begin();
	     iter != cta.preferred_timings.end(); ++iter) {
		if (iter->has_svr())
			cta_resolve_svr(iter);
	}

	for (vec_timings_ext::iterator iter = cta.native_timings.begin();
	     iter != cta.native_timings.end(); ++iter) {
		if (iter->has_svr())
			cta_resolve_svr(iter);
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x1c0(%rdi), %r14
cmpq 0x1c8(%rbx), %r14
je 0x119b4
cmpl $0x0, (%r14)
je 0x119ab
cmpl $0x0, 0x4(%r14)
jne 0x119ab
movq %rbx, %rdi
movq %r14, %rsi
callq 0x118c4
addq $0x98, %r14
jmp 0x1198a
movq 0x2a8(%rbx), %r14
cmpq 0x2b0(%rbx), %r14
je 0x119e5
cmpl $0x0, (%r14)
je 0x119dc
cmpl $0x0, 0x4(%r14)
jne 0x119dc
movq %rbx, %rdi
movq %r14, %rsi
callq 0x118c4
addq $0x98, %r14
jmp 0x119bb
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/parse-cta-block.cpp
// Function: audio_format[abi:cxx11](unsigned char)
static std::string audio_format(unsigned char x)
{
	switch (x) {
	case 1: return "Linear PCM";
	case 2: return "AC-3";
	case 3: return "MPEG 1 (Layers 1 & 2)";
	case 4: return "MPEG 1 Layer 3 (MP3)";
	case 5: return "MPEG2 (multichannel)";
	case 6: return "AAC LC";
	case 7: return "DTS";
	case 8: return "ATRAC";
	case 9: return "One Bit Audio";
	case 10: return "Enhanced AC-3 (DD+)";
	case 11: return "DTS-HD";
	case 12: return "MAT (MLP)";
	case 13: return "DST";
	case 14: return "WMA Pro";
	default: break;
	}
	fail("Unknown Audio Format 0x%02x.\n", x);
	return std::string("Unknown Audio Format (") + utohex(x) + ")";
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
leal -0x1(%rsi), %eax
cmpl $0xd, %eax
ja 0x11d6a
leaq 0xede6(%rip), %rcx      # 0x20ab4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x14b55(%rip), %rsi     # 0x26833
jmp 0x11d53
leaq 0x14bcf(%rip), %rsi     # 0x268b6
jmp 0x11d53
leaq 0x14b7e(%rip), %rsi     # 0x2686e
jmp 0x11d53
leaq 0x14bc7(%rip), %rsi     # 0x268c0
jmp 0x11d53
leaq 0x14b99(%rip), %rsi     # 0x2689b
jmp 0x11d53
leaq 0x14b38(%rip), %rsi     # 0x26843
jmp 0x11d53
leaq 0x14b45(%rip), %rsi     # 0x26859
jmp 0x11d53
leaq 0x14b6a(%rip), %rsi     # 0x26887
jmp 0x11d53
leaq 0x14b18(%rip), %rsi     # 0x2683e
jmp 0x11d53
leaq 0x153b0(%rip), %rsi     # 0x270df
jmp 0x11d53
leaq 0x14b8c(%rip), %rsi     # 0x268c4
jmp 0x11d53
leaq 0x14b42(%rip), %rsi     # 0x26883
jmp 0x11d53
leaq 0x14b65(%rip), %rsi     # 0x268af
jmp 0x11d53
leaq 0x14b3a(%rip), %rsi     # 0x2688d
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x75c4
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %rbp
retq
movzbl %sil, %ebp
leaq 0x14b57(%rip), %rsi     # 0x268cc
xorl %edi, %edi
movl %ebp, %edx
xorl %eax, %eax
callq 0x362c
leaq 0x14b63(%rip), %rsi     # 0x268ea
leaq 0x48(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x75c4
leaq 0x28(%rsp), %rdi
movl %ebp, %esi
callq 0x4e28
leaq 0x8(%rsp), %rdi
leaq 0x48(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0x76b4
leaq 0x14af0(%rip), %rdx     # 0x268ad
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x75a4
leaq 0x8(%rsp), %rdi
callq 0x3130
leaq 0x28(%rsp), %rdi
callq 0x3130
leaq 0x48(%rsp), %rdi
callq 0x3130
jmp 0x11d60
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3130
jmp 0x11dff
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x3130
jmp 0x11e0e
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x3130
movq %rbx, %rdi
callq 0x3430
// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/parse-displayid-block.cpp
// Function: edid_state::check_displayid_datablock_revision(unsigned char, unsigned char, unsigned char)
void edid_state::check_displayid_datablock_revision(unsigned char hdr,
						    unsigned char valid_flags,
						    unsigned char rev)
{
	unsigned char revision = hdr & 7;
	unsigned char flags = hdr & ~7 & ~valid_flags;

	if (revision != rev)
		warn("Unexpected revision (%u != %u).\n", revision, rev);
	if (flags)
		warn("Unexpected flags (0x%02x).\n", flags);
}

// Assembly:
pushq %rbx
movl %edx, %ebx
notb %bl
andb %sil, %bl
movl %esi, %eax
andb $0x7, %al
andb $-0x8, %bl
cmpb %cl, %al
je 0x1241a
movzbl %cl, %ecx
movzbl %al, %edx
leaq 0x167a0(%rip), %rsi     # 0x28bb0
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x362c
testb %bl, %bl
je 0x12433
movzbl %bl, %edx
leaq 0x167a9(%rip), %rsi     # 0x28bd1
pushq $0x1
popq %rdi
xorl %eax, %eax
popq %rbx
jmp 0x362c
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/parse-displayid-block.cpp
// Function: edid_state::parse_displayid_product_id(unsigned char const*)
void edid_state::parse_displayid_product_id(const unsigned char *x)
{
	check_displayid_datablock_revision(x[1]);

	dispid.has_product_identification = true;
	if (dispid.version >= 0x20) {
		unsigned oui = (x[3] << 16) | (x[4] << 8) | x[5];
		printf("    Vendor OUI %s\n", ouitohex(oui).c_str());
	} else {
		printf("    Vendor ID: %c%c%c\n", x[3], x[4], x[5]);
	}
	printf("    Product Code: %u\n", x[6] | (x[7] << 8));
	unsigned sn = x[8] | (x[9] << 8) | (x[10] << 16) | (x[11] << 24);
	if (sn) {
		if (hide_serial_numbers)
			printf("    Serial Number: ...\n");
		else
			printf("    Serial Number: %u\n", sn);
	}
	unsigned week = x[12];
	unsigned year = 2000 + x[13];
	printf("    %s: %u",
	       week == 0xff ? "Model Year" : "Year of Manufacture", year);
	if (week && week <= 0x36)
		printf(", Week %u", week);
	printf("\n");
	if (x[14]) {
		char buf[256];

		memcpy(buf, x + 15, x[14]);
		buf[x[14]] = 0;
		printf("    Product ID: %s\n", buf);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movq %rsi, %rbx
movq %rdi, %r14
movzbl 0x1(%rsi), %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x123f0
movb $0x1, 0x91e(%r14)
cmpb $0x20, 0x910(%r14)
movzbl 0x3(%rbx), %esi
jb 0x124a3
shll $0x10, %esi
movzbl 0x4(%rbx), %eax
shll $0x8, %eax
orl %esi, %eax
movzbl 0x5(%rbx), %esi
orl %eax, %esi
movq %rsp, %r15
movq %r15, %rdi
callq 0x4f51
movq (%r15), %rsi
leaq 0x1675b(%rip), %rdi     # 0x28bed
xorl %eax, %eax
callq 0x3030
movq %r15, %rdi
callq 0x3130
jmp 0x124b9
movzbl 0x4(%rbx), %edx
movzbl 0x5(%rbx), %ecx
leaq 0x1674e(%rip), %rdi     # 0x28c00
xorl %eax, %eax
callq 0x3030
movzwl 0x6(%rbx), %esi
leaq 0x16753(%rip), %rdi     # 0x28c17
xorl %eax, %eax
callq 0x3030
movl 0x8(%rbx), %esi
testl %esi, %esi
je 0x124f5
cmpb $0x1, 0x52(%r14)
jne 0x124e7
leaq 0xe0bc(%rip), %rdi      # 0x2059c
callq 0x33b0
jmp 0x124f5
leaq 0xd5d4(%rip), %rdi      # 0x1fac2
xorl %eax, %eax
callq 0x3030
movzbl 0xc(%rbx), %r14d
movzbl 0xd(%rbx), %edx
addl $0x7d0, %edx            # imm = 0x7D0
cmpl $0xff, %r14d
leaq 0x16726(%rip), %rax     # 0x28c38
leaq 0x1672a(%rip), %rsi     # 0x28c43
cmoveq %rax, %rsi
leaq 0x16709(%rip), %rdi     # 0x28c2d
xorl %eax, %eax
callq 0x3030
leal -0x1(%r14), %eax
cmpb $0x35, %al
ja 0x12544
leaq 0x1671d(%rip), %rdi     # 0x28c57
movl %r14d, %esi
xorl %eax, %eax
callq 0x3030
pushq $0xa
popq %rdi
callq 0x3340
movzbl 0xe(%rbx), %r14d
testq %r14, %r14
je 0x12581
addq $0xf, %rbx
movq %rsp, %r15
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x31f0
movb $0x0, (%rsp,%r14)
leaq 0x166ea(%rip), %rdi     # 0x28c61
movq %r15, %rsi
xorl %eax, %eax
callq 0x3030
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/parse-displayid-block.cpp
// Function: edid_state::parse_displayid_parameters(unsigned char const*)
void edid_state::parse_displayid_parameters(const unsigned char *x)
{
	check_displayid_datablock_revision(x[1]);

	if (!check_displayid_datablock_length(x, 12, 12))
		return;

	dispid.has_display_parameters = true;
	printf("    Image size: %.1f mm x %.1f mm\n",
	       ((x[4] << 8) + x[3]) / 10.0,
	       ((x[6] << 8) + x[5]) / 10.0);
	printf("    Pixels: %d x %d\n",
	       (x[8] << 8) + x[7], (x[10] << 8) + x[9]);
	print_flag_lines("      ", "    Feature support flags:",
			 x[11], feature_support_flags);

	if (x[12] != 0xff)
		printf("    Gamma: %.2f\n", ((x[12] + 100.0) / 100.0));
	printf("    Aspect ratio: %.2f\n", ((x[13] + 100.0) / 100.0));
	printf("    Dynamic bpc native: %d\n", (x[14] & 0xf) + 1);
	printf("    Dynamic bpc overall: %d\n", ((x[14] >> 4) & 0xf) + 1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movzbl 0x1(%rsi), %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x123f0
pushq $0xc
popq %rdx
movq %rbx, %rdi
movl %edx, %esi
xorl %ecx, %ecx
callq 0x126fe
testb %al, %al
je 0x12661
movb $0x1, 0x91f(%r14)
movzwl 0x3(%rbx), %eax
cvtsi2sd %eax, %xmm0
movsd 0x16055(%rip), %xmm2    # 0x28630
divsd %xmm2, %xmm0
movzwl 0x5(%rbx), %eax
cvtsi2sd %eax, %xmm1
divsd %xmm2, %xmm1
leaq 0x16683(%rip), %rdi     # 0x28c75
movb $0x2, %al
callq 0x3030
movzwl 0x7(%rbx), %esi
movzwl 0x9(%rbx), %edx
leaq 0x16690(%rip), %rdi     # 0x28c98
xorl %eax, %eax
callq 0x3030
movzbl 0xb(%rbx), %ebp
testl %ebp, %ebp
je 0x12670
leaq 0x1668f(%rip), %rdi     # 0x28cad
callq 0x33b0
leaq 0x21736(%rip), %r12     # 0x33d60
leaq 0xcb24(%rip), %r14      # 0x1f155
leaq 0xce5d(%rip), %r15      # 0x1f495
xorl %r13d, %r13d
cmpq $0x8, %r13
je 0x12670
btl %r13d, %ebp
jae 0x12658
movq (%r12), %rdx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x3030
incq %r13
addq $0x8, %r12
jmp 0x1263b
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb 0xc(%rbx), %al
cmpb $-0x1, %al
je 0x1269c
movzbl %al, %eax
cvtsi2sd %eax, %xmm0
movsd 0x799a(%rip), %xmm1     # 0x1a020
addsd %xmm1, %xmm0
divsd %xmm1, %xmm0
leaq 0xd718(%rip), %rdi      # 0x1fdad
movb $0x1, %al
callq 0x3030
movzbl 0xd(%rbx), %eax
cvtsi2sd %eax, %xmm0
movsd 0x7974(%rip), %xmm1     # 0x1a020
addsd %xmm1, %xmm0
divsd %xmm1, %xmm0
leaq 0x1660d(%rip), %rdi     # 0x28cc8
movb $0x1, %al
callq 0x3030
movzbl 0xe(%rbx), %esi
andl $0xf, %esi
incl %esi
leaq 0x1660e(%rip), %rdi     # 0x28ce0
xorl %eax, %eax
callq 0x3030
movzbl 0xe(%rbx), %esi
shrl $0x4, %esi
incl %esi
leaq 0x16613(%rip), %rdi     # 0x28cfc
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3030
// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/parse-displayid-block.cpp
// Function: check_displayid_datablock_length(unsigned char const*, unsigned int, unsigned int, unsigned int)
static bool check_displayid_datablock_length(const unsigned char *x,
					     unsigned expectedlenmin = 0,
					     unsigned expectedlenmax = 128 - 2 - 5 - 3,
					     unsigned payloaddumpstart = 0)
{
	unsigned char len = x[2];

	if (expectedlenmin == expectedlenmax && len != expectedlenmax)
		fail("DisplayID payload length is different than expected (%d != %d).\n", len, expectedlenmax);
	else if (len > expectedlenmax)
		fail("DisplayID payload length is greater than expected (%d > %d).\n", len, expectedlenmax);
	else if (len < expectedlenmin)
		fail("DisplayID payload length is less than expected (%d < %d).\n", len, expectedlenmin);
	else
		return true;

	if (len > payloaddumpstart)
		hex_block("    ", x + 3 + payloaddumpstart, len - payloaddumpstart);
	return false;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %ecx, %ebp
movl %edx, %eax
movl %esi, %ecx
movq %rdi, %r14
cmpl %edx, %esi
setne %dl
movzbl 0x2(%rdi), %ebx
cmpl %esi, %ebx
sete %sil
orb %dl, %sil
je 0x12732
cmpl %eax, %ebx
jbe 0x1276e
leaq 0x1849e(%rip), %rsi     # 0x2abc8
xorl %edi, %edi
movl %ebx, %edx
movl %eax, %ecx
jmp 0x1273d
leaq 0x1844e(%rip), %rsi     # 0x2ab87
xorl %edi, %edi
movl %ebx, %edx
xorl %eax, %eax
callq 0x362c
subl %ebp, %ebx
jbe 0x12767
movl %ebp, %eax
leaq (%r14,%rax), %rsi
addq $0x3, %rsi
leaq 0xcd3e(%rip), %rdi      # 0x1f497
pushq $0x1
popq %rcx
pushq $0x10
popq %r8
movl %ebx, %edx
callq 0x4fc1
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
movb $0x1, %al
cmpl %ecx, %ebx
jae 0x12769
leaq 0x1848b(%rip), %rsi     # 0x2ac06
jmp 0x12739
nop
// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/parse-displayid-block.cpp
// Function: edid_state::parse_displayid_type_4_8_timing(unsigned char, unsigned short, bool)
void edid_state::parse_displayid_type_4_8_timing(unsigned char type, unsigned short id, bool is_cta)
{
	const struct timings *t = NULL;
	char type_name[16];

	switch (type) {
	case 0: t = find_dmt_id(id); sprintf(type_name, "DMT 0x%02x", id); break;
	case 1: t = find_vic_id(id); sprintf(type_name, "VIC %3u", id); break;
	case 2: t = find_hdmi_vic_id(id); sprintf(type_name, "HDMI VIC %u", id); break;
	default: break;
	}
	if (t)
		print_timings("    ", t, type_name);
	if (t && is_cta && !cta.t8vtdb.is_valid()) {
		timings_ext te(*t, type_name, "");
		cta.t8vtdb = te;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xf8, %rsp
movl %ecx, %ebp
movl %edx, %r15d
movq %rdi, %rbx
cmpl $0x2, %esi
je 0x13641
cmpl $0x1, %esi
je 0x1362c
testl %esi, %esi
jne 0x13716
movzbl %r15b, %edi
callq 0x7d78
movq %rax, %r14
leaq 0x72b5(%rip), %rsi      # 0x1a8df
jmp 0x13654
movzbl %r15b, %edi
callq 0xbf2b
movq %rax, %r14
leaq 0x72c5(%rip), %rsi      # 0x1a904
jmp 0x13654
movzbl %r15b, %edi
callq 0xbf6a
movq %rax, %r14
leaq 0x72ce(%rip), %rsi      # 0x1a922
movzwl %r15w, %edx
leaq 0x10(%rsp), %rdi
xorl %eax, %eax
callq 0x3070
testq %r14, %r14
je 0x13716
movl $0x1, (%rsp)
leaq 0xbe1c(%rip), %rsi      # 0x1f497
leaq 0x7607(%rip), %r8       # 0x1ac89
leaq 0x10(%rsp), %rcx
movq %rbx, %rdi
movq %r14, %rdx
xorl %r9d, %r9d
callq 0x3af0
testb %bpl, %bpl
je 0x13716
cmpl $0x0, 0x210(%rbx)
jne 0x13716
leaq 0x40(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0xf(%rsp), %rdx
callq 0x75c4
leaq 0x75cb(%rip), %rsi      # 0x1ac89
leaq 0x20(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0x75c4
leaq 0x60(%rsp), %rdi
leaq 0x40(%rsp), %rdx
leaq 0x20(%rsp), %rcx
movq %r14, %rsi
callq 0xbb34
addq $0x210, %rbx            # imm = 0x210
leaq 0x20(%rsp), %rdi
callq 0x3130
leaq 0x40(%rsp), %rdi
callq 0x3130
leaq 0x60(%rsp), %rsi
movq %rbx, %rdi
callq 0xbbac
leaq 0x60(%rsp), %rdi
callq 0x78cc
addq $0xf8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x78cc
jmp 0x13754
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x3130
jmp 0x13745
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x3130
jmp 0x13754
movq %rax, %rbx
movq %rbx, %rdi
callq 0x3430
// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/parse-displayid-block.cpp
// Function: edid_state::parse_displayid_video_timing_range_limits(unsigned char const*)
void edid_state::parse_displayid_video_timing_range_limits(const unsigned char *x)
{
	check_displayid_datablock_revision(x[1]);

	if (!check_displayid_datablock_length(x, 15, 15))
		return;
	printf("    Pixel Clock: %.3f-%.3f MHz\n",
	       (double)((x[3] | (x[4] << 8) | (x[5] << 16)) + 1) / 100.0,
	       (double)((x[6] | (x[7] << 8) | (x[8] << 16)) + 1) / 100.0);
	printf("    Horizontal Frequency: %u-%u kHz\n", x[9], x[10]);
	printf("    Minimum Horizontal Blanking: %u pixels\n", x[11] | (x[12] << 8));
	printf("    Vertical Refresh: %u-%u Hz\n", x[13], x[14]);
	printf("    Minimum Vertical Blanking: %u lines\n", x[15] | (x[16] << 8));
	if (x[17] & 0x80)
		printf("    Supports Interlaced\n");
	if (x[17] & 0x40)
		printf("    Supports CVT\n");
	if (x[17] & 0x20)
		printf("    Supports CVT Reduced Blanking\n");
	if (x[17] & 0x10)
		printf("    Discrete frequency display device\n");
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
movzbl 0x1(%rsi), %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x123f0
pushq $0xf
popq %rdx
movq %rbx, %rdi
movl %edx, %esi
xorl %ecx, %ecx
callq 0x126fe
testb %al, %al
je 0x13858
movzwl 0x3(%rbx), %eax
movzbl 0x5(%rbx), %ecx
shll $0x10, %ecx
addl %ecx, %eax
incl %eax
cvtsi2sd %eax, %xmm0
movsd 0x6881(%rip), %xmm2     # 0x1a020
divsd %xmm2, %xmm0
movzwl 0x6(%rbx), %eax
movzbl 0x8(%rbx), %ecx
shll $0x10, %ecx
addl %ecx, %eax
incl %eax
cvtsi2sd %eax, %xmm1
divsd %xmm2, %xmm1
leaq 0x1578a(%rip), %rdi     # 0x28f4b
movb $0x2, %al
callq 0x3030
movzbl 0x9(%rbx), %esi
movzbl 0xa(%rbx), %edx
leaq 0x15794(%rip), %rdi     # 0x28f6b
xorl %eax, %eax
callq 0x3030
movzwl 0xb(%rbx), %esi
leaq 0x157a7(%rip), %rdi     # 0x28f90
xorl %eax, %eax
callq 0x3030
movzbl 0xd(%rbx), %esi
movzbl 0xe(%rbx), %edx
leaq 0x157bd(%rip), %rdi     # 0x28fbc
xorl %eax, %eax
callq 0x3030
movzwl 0xf(%rbx), %esi
leaq 0x157cb(%rip), %rdi     # 0x28fdc
xorl %eax, %eax
callq 0x3030
movb 0x11(%rbx), %al
testb %al, %al
jns 0x1382e
leaq 0x17583(%rip), %rdi     # 0x2ada9
callq 0x33b0
movb 0x11(%rbx), %al
testb $0x40, %al
je 0x13841
leaq 0x17588(%rip), %rdi     # 0x2adc1
callq 0x33b0
movb 0x11(%rbx), %al
testb $0x20, %al
je 0x13854
leaq 0x17586(%rip), %rdi     # 0x2add2
callq 0x33b0
movb 0x11(%rbx), %al
testb $0x10, %al
jne 0x1385a
popq %rbx
retq
leaq 0x17593(%rip), %rdi     # 0x2adf4
popq %rbx
jmp 0x33b0
nop
// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/parse-displayid-block.cpp
// Function: edid_state::parse_displayid_intf_power_sequencing(unsigned char const*)
void edid_state::parse_displayid_intf_power_sequencing(const unsigned char *x)
{
	check_displayid_datablock_revision(x[1]);

	if (!check_displayid_datablock_length(x, 6, 6))
		return;

	printf("    Power Sequence T1 Range: %.1f-%u.0 ms\n", (x[3] >> 4) / 10.0, (x[3] & 0xf) * 2);
	printf("    Power Sequence T2 Range: 0.0-%u.0 ms\n", (x[4] & 0x3f) * 2);
	printf("    Power Sequence T3 Range: 0.0-%u.0 ms\n", (x[5] & 0x3f) * 2);
	printf("    Power Sequence T4 Min: %u.0 ms\n", (x[6] & 0x7f) * 10);
	printf("    Power Sequence T5 Min: %u.0 ms\n", (x[7] & 0x3f) * 10);
	printf("    Power Sequence T6 Min: %u.0 ms\n", (x[8] & 0x3f) * 10);
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
movzbl 0x1(%rsi), %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x123f0
pushq $0x6
popq %rdx
movq %rbx, %rdi
movl %edx, %esi
xorl %ecx, %ecx
callq 0x126fe
testb %al, %al
je 0x13c85
movzbl 0x3(%rbx), %esi
movl %esi, %eax
shrl $0x4, %eax
cvtsi2sd %eax, %xmm0
divsd 0x14a35(%rip), %xmm0    # 0x28630
addl %esi, %esi
andl $0x1e, %esi
leaq 0x155e5(%rip), %rdi     # 0x291ec
movb $0x1, %al
callq 0x3030
movzbl 0x4(%rbx), %esi
addl %esi, %esi
andl $0x7e, %esi
leaq 0x155f9(%rip), %rdi     # 0x29217
xorl %eax, %eax
callq 0x3030
movzbl 0x5(%rbx), %esi
addl %esi, %esi
andl $0x7e, %esi
leaq 0x1560c(%rip), %rdi     # 0x29241
xorl %eax, %eax
callq 0x3030
movzbl 0x6(%rbx), %eax
andl $0x7f, %eax
imull $0xa, %eax, %esi
leaq 0x1561e(%rip), %rdi     # 0x2926b
xorl %eax, %eax
callq 0x3030
movzbl 0x7(%rbx), %eax
andl $0x3f, %eax
imull $0xa, %eax, %esi
leaq 0x1562a(%rip), %rdi     # 0x2928f
xorl %eax, %eax
callq 0x3030
movzbl 0x8(%rbx), %eax
andl $0x3f, %eax
imull $0xa, %eax, %esi
leaq 0x15636(%rip), %rdi     # 0x292b3
xorl %eax, %eax
popq %rbx
jmp 0x3030
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/parse-displayid-block.cpp
// Function: print_flags(char const*, unsigned char, char const**, bool)
static void print_flags(const char *label, unsigned char flag_byte,
			const char **flags, bool reverse = false)
{
	if (!flag_byte)
		return;

	unsigned countflags = 0;

	printf("%s: ", label);
	for (unsigned i = 0; i < 8; i++) {
		if (flag_byte & (1 << (reverse ? 7 - i : i))) {
			if (countflags)
				printf(", ");
			if (flags[i])
				printf("%s", flags[i]);
			else
				printf("Undefined (%u)", i);
			countflags++;
		}
	}
	printf("\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebp
testl %esi, %esi
je 0x142f3
movl %ecx, %ebx
movq %rdx, %r14
movq %rdi, %rsi
leaq 0x17755(%rip), %rdi     # 0x2b9c3
xorl %eax, %eax
callq 0x3030
movzbl %bpl, %r15d
pushq $0x7
popq %r12
xorl %ebp, %ebp
xorl %r13d, %r13d
cmpq $0x8, %rbp
je 0x142dd
testb %bl, %bl
movl %ebp, %eax
cmovnel %r12d, %eax
btl %eax, %r15d
jae 0x142d5
testl %r13d, %r13d
je 0x142a9
leaq 0x687c(%rip), %rdi      # 0x1ab1e
xorl %eax, %eax
callq 0x3030
movq (%r14,%rbp,8), %rsi
testq %rsi, %rsi
je 0x142c2
leaq 0x6ab9(%rip), %rdi      # 0x1ad72
xorl %eax, %eax
callq 0x3030
jmp 0x142d2
leaq 0x16a67(%rip), %rdi     # 0x2ad30
movl %ebp, %esi
xorl %eax, %eax
callq 0x3030
incl %r13d
incq %rbp
decl %r12d
jmp 0x14282
pushq $0xa
popq %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3340
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/parse-displayid-block.cpp
// Function: ieee7542d[abi:cxx11](unsigned short)
static std::string ieee7542d(unsigned short fp)
{
	int exp = ((fp & 0x7c00) >> 10) - 15;
	unsigned fract = (fp & 0x3ff) | 0x400;

	if (fp == 0x8000)
		return "do not use";
	if (fp & 0x8000)
		return "reserved";
	return std::to_string(pow(2, exp) * fract / 1024.0) + " cd/m^2";
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
cmpl $0x8000, %esi           # imm = 0x8000
jne 0x15427
leaq 0x15920(%rip), %rsi     # 0x2ad45
jmp 0x15490
movl %esi, %ebp
testw %bp, %bp
js 0x15489
movl %ebp, %edi
shrl $0xa, %edi
andl $0x1f, %edi
addl $-0xf, %edi
andl $0x3ff, %ebp            # imm = 0x3FF
orl $0x400, %ebp            # imm = 0x400
movsd 0x928b(%rip), %xmm0     # 0x1e6d8
callq 0x33a0
cvtsi2sd %ebp, %xmm1
mulsd %xmm1, %xmm0
mulsd 0x131e6(%rip), %xmm0    # 0x28648
movq %rsp, %r14
movq %r14, %rdi
callq 0x177d4
leaq 0x158dc(%rip), %rdx     # 0x2ad50
movq %rbx, %rdi
movq %r14, %rsi
callq 0x75a4
movq %rsp, %rdi
callq 0x3130
jmp 0x1549b
leaq 0xf119(%rip), %rsi      # 0x245a9
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x75c4
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x3130
movq %rbx, %rdi
callq 0x3430
// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/parse-displayid-block.cpp
// Function: edid_state::parse_displayid_dynamic_video_timings_range_limits(unsigned char const*)
void edid_state::parse_displayid_dynamic_video_timings_range_limits(const unsigned char *x)
{
	check_displayid_datablock_revision(x[1], 0, (x[1] & 7) == 1);

	if (!check_displayid_datablock_length(x, 9, 9))
		return;

	printf("    Minimum Pixel Clock: %u kHz\n",
	       1 + (x[3] | (x[4] << 8) | (x[5] << 16)));
	printf("    Maximum Pixel Clock: %u kHz\n",
	       1 + (x[6] | (x[7] << 8) | (x[8] << 16)));
	printf("    Minimum Vertical Refresh Rate: %u Hz\n", x[9]);
	if (x[1] & 7)
		printf("    Maximum Vertical Refresh Rate: %u Hz\n", x[10] + ((x[11] & 3) << 8));
	else
		printf("    Maximum Vertical Refresh Rate: %u Hz\n", x[10]);
	printf("    Seamless Dynamic Video Timing Support: %s\n",
	       (x[11] & 0x80) ? "Yes" : "No");
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
movzbl 0x1(%rsi), %esi
movl %esi, %eax
andb $0x7, %al
xorl %ecx, %ecx
cmpb $0x1, %al
sete %cl
xorl %edx, %edx
callq 0x123f0
pushq $0x9
popq %rdx
movq %rbx, %rdi
movl %edx, %esi
xorl %ecx, %ecx
callq 0x126fe
testb %al, %al
je 0x157c2
movzwl 0x3(%rbx), %eax
movzbl 0x5(%rbx), %ecx
shll $0x10, %ecx
leal (%rcx,%rax), %esi
incl %esi
leaq 0x144f9(%rip), %rdi     # 0x29c3b
xorl %eax, %eax
callq 0x3030
movzwl 0x6(%rbx), %eax
movzbl 0x8(%rbx), %ecx
shll $0x10, %ecx
leal (%rcx,%rax), %esi
incl %esi
leaq 0x144fc(%rip), %rdi     # 0x29c5c
xorl %eax, %eax
callq 0x3030
movzbl 0x9(%rbx), %esi
leaq 0x1450b(%rip), %rdi     # 0x29c7d
xorl %eax, %eax
callq 0x3030
testb $0x7, 0x1(%rbx)
movzbl 0xa(%rbx), %esi
je 0x1578f
movzbl 0xb(%rbx), %eax
andl $0x3, %eax
shll $0x8, %eax
orl %eax, %esi
leaq 0x14511(%rip), %rdi     # 0x29ca7
xorl %eax, %eax
callq 0x3030
cmpb $0x0, 0xb(%rbx)
leaq 0x10bb7(%rip), %rax     # 0x2635f
leaq 0x10bac(%rip), %rsi     # 0x2635b
cmovnsq %rax, %rsi
leaq 0x14517(%rip), %rdi     # 0x29cd1
xorl %eax, %eax
popq %rbx
jmp 0x3030
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/parse-displayid-block.cpp
// Function: edid_state::parse_displayid_ContainerID(unsigned char const*)
void edid_state::parse_displayid_ContainerID(const unsigned char *x)
{
	check_displayid_datablock_revision(x[1]);

	if (check_displayid_datablock_length(x, 16, 16)) {
		x += 3;
		printf("    Container ID: %s\n", containerid2s(x).c_str());
	}
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movzbl 0x1(%rsi), %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x123f0
pushq $0x10
popq %rdx
movq %rbx, %rdi
movl %edx, %esi
xorl %ecx, %ecx
callq 0x126fe
testb %al, %al
je 0x15acb
addq $0x3, %rbx
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4d58
movq (%r14), %rsi
leaq 0x11925(%rip), %rdi     # 0x273e1
xorl %eax, %eax
callq 0x3030
movq %r14, %rdi
callq 0x3130
addq $0x28, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/parse-displayid-block.cpp
// Function: edid_state::parse_displayid_vesa(unsigned char const*)
void edid_state::parse_displayid_vesa(const unsigned char *x)
{
	check_displayid_datablock_revision(x[1]);

	if (!check_displayid_datablock_length(x, 5, 7))
		return;

	unsigned len = x[2];
	x += 6;
	printf("    Data Structure Type: ");
	switch (x[0] & 0x07) {
	case 0x00: printf("eDP\n"); break;
	case 0x01: printf("DP\n"); break;
	default: printf("Reserved\n"); break;
	}
	printf("    Default Colorspace and EOTF Handling: %s\n",
	       (x[0] & 0x80) ? "Native as specified in the Display Parameters DB" : "sRGB");
	printf("    Number of Pixels in Hor Pix Cnt Overlapping an Adjacent Panel: %u\n",
	       x[1] & 0xf);
	printf("    Multi-SST Operation: ");
	switch ((x[1] >> 5) & 0x03) {
	case 0x00: printf("Not Supported\n"); break;
	case 0x01: printf("Two Streams (number of links shall be 2 or 4)\n"); break;
	case 0x02: printf("Four Streams (number of links shall be 4)\n"); break;
	case 0x03: printf("Reserved\n"); break;
	}
	if (len >= 7) {
		double bpp = (x[2] & 0x3f) + (x[3] & 0x0f) / 16.0;
		printf("    Pass through timing's target DSC bits per pixel: %.4f\n", bpp);
	}
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
movzbl 0x1(%rsi), %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x123f0
pushq $0x5
popq %rsi
pushq $0x7
popq %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x126fe
testb %al, %al
je 0x15ef1
movb 0x2(%rbx), %bpl
leaq 0x1413b(%rip), %rdi     # 0x29f57
xorl %eax, %eax
callq 0x3030
movb 0x6(%rbx), %al
andb $0x7, %al
cmpb $0x1, %al
leaq 0x15a3b(%rip), %rcx     # 0x2b86c
leaq 0x15788(%rip), %rdx     # 0x2b5c0
cmoveq %rcx, %rdx
testb %al, %al
leaq 0x15a26(%rip), %rdi     # 0x2b86b
cmovneq %rdx, %rdi
callq 0x33b0
cmpb $0x0, 0x6(%rbx)
leaq 0x14177(%rip), %rax     # 0x29fd0
leaq 0x1413f(%rip), %rsi     # 0x29f9f
cmovnsq %rax, %rsi
leaq 0x14106(%rip), %rdi     # 0x29f71
xorl %eax, %eax
callq 0x3030
movzbl 0x7(%rbx), %esi
andl $0xf, %esi
leaq 0x14155(%rip), %rdi     # 0x29fd5
xorl %eax, %eax
callq 0x3030
leaq 0x1418e(%rip), %rdi     # 0x2a01c
xorl %eax, %eax
callq 0x3030
movzbl 0x7(%rbx), %eax
shrl $0x3, %eax
andl $0xc, %eax
leaq 0x12cea(%rip), %rcx     # 0x28b90
movslq (%rax,%rcx), %rdi
addq %rcx, %rdi
callq 0x33b0
cmpb $0x7, %bpl
jb 0x15ef1
movb 0x8(%rbx), %al
movb 0x9(%rbx), %cl
andb $0x3f, %al
movzbl %al, %eax
cvtsi2sd %eax, %xmm1
andb $0xf, %cl
movzbl %cl, %eax
cvtsi2sd %eax, %xmm0
mulsd 0x1277f(%rip), %xmm0    # 0x28658
addsd %xmm1, %xmm0
leaq 0x14152(%rip), %rdi     # 0x2a036
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x3030
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/parse-displayid-block.cpp
// Function: edid_state::parse_displayid_cta_data_block(unsigned char const*)
void edid_state::parse_displayid_cta_data_block(const unsigned char *x)
{
	check_displayid_datablock_revision(x[1]);

	unsigned len = x[2];
	unsigned i;

	if (len > 248) {
		fail("Length is > 248.\n");
		len = 248;
	}
	x += 3;

	for (i = 0; i < len; i += (x[i] & 0x1f) + 1) {
		unsigned tag = (x[i] & 0xe0) << 3;

		if (tag == 0x700)
			tag |= x[i + 1];
		bool duplicate = dispid.found_tags.find(tag) != dispid.found_tags.end();

		cta_block(x + i, duplicate);
		if (!duplicate)
			dispid.found_tags.insert(tag);
	}

	if (i != len)
		fail("Length is %u instead of %u.\n", len, i);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, 0x10(%rsp)
movzbl 0x1(%rsi), %esi
xorl %ebx, %ebx
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x123f0
movzbl 0x2(%r14), %eax
movl %eax, 0x8(%rsp)
cmpl $0xf9, %eax
jb 0x15f45
leaq 0x1413d(%rip), %rsi     # 0x2a071
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
movl $0xf8, 0x8(%rsp)
addq $0x3, %r14
movq 0x10(%rsp), %rax
leaq 0x948(%rax), %r12
leaq 0x950(%rax), %rbp
cmpl 0x8(%rsp), %ebx
jae 0x15fd0
movl %ebx, %eax
leaq (%r14,%rax), %r13
movzbl (%r14,%rax), %eax
movl %eax, %ecx
andl $-0x20, %ecx
shll $0x3, %ecx
movl %ecx, 0xc(%rsp)
cmpb $-0x20, %al
jb 0x15f8b
movzbl 0x1(%r13), %eax
orl $0x700, %eax            # imm = 0x700
movl %eax, 0xc(%rsp)
movq %r12, %rdi
leaq 0xc(%rsp), %rsi
callq 0x1224a
movq %rax, %r15
xorl %edx, %edx
cmpq %rbp, %rax
setne %dl
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0xfff8
cmpq %rbp, %r15
jne 0x15fc2
movq %r12, %rdi
leaq 0xc(%rsp), %rsi
callq 0x1229c
movzbl (%r13), %eax
andl $0x1f, %eax
addl %eax, %ebx
incl %ebx
jmp 0x15f5c
je 0x15fe8
leaq 0x140aa(%rip), %rsi     # 0x2a083
xorl %edi, %edi
movl 0x8(%rsp), %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x362c
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/parse-displayid-block.cpp
// Function: edid_state::preparse_displayid_block(unsigned char const*)
void edid_state::preparse_displayid_block(const unsigned char *x)
{
	unsigned length = x[2];

	if (length > 121)
		length = 121;

	unsigned offset = 5;

	dispid.preparsed_displayid_blocks++;
	while (length > 0) {
		unsigned tag = x[offset];
		unsigned len = x[offset + 2];

		switch (tag) {
		case 0x02:
			dispid.preparsed_color_ids |= 1 << ((x[offset + 1] >> 3) & 0x0f);
			break;
		case 0x0e:
			dispid.preparsed_xfer_ids |= 1 << ((x[offset + 1] >> 4) & 0x0f);
			break;
		default:
			break;
		}

		if (length < 3)
			break;

		if (length < len + 3)
			break;

		if (!tag && !len)
			break;

		length -= len + 3;
		offset += len + 3;
	}
}

// Assembly:
movzbl 0x2(%rsi), %eax
cmpb $0x79, %al
pushq $0x79
popq %rcx
cmovbl %eax, %ecx
incl 0x918(%rdi)
movzbl %cl, %eax
movzwl 0x912(%rdi), %ecx
movzwl 0x914(%rdi), %edx
pushq $0x5
popq %r8
testl %eax, %eax
je 0x16462
movl %r8d, %r9d
movzbl (%rsi,%r9), %r9d
leal 0x2(%r8), %r10d
movzbl (%rsi,%r10), %r10d
cmpl $0xe, %r9d
je 0x1642f
cmpl $0x2, %r9d
jne 0x16447
leal 0x1(%r8), %r11d
movb (%rsi,%r11), %r11b
shrb $0x3, %r11b
andb $0xf, %r11b
btsl %r11d, %ecx
movw %cx, 0x912(%rdi)
jmp 0x16447
leal 0x1(%r8), %r11d
movzbl (%rsi,%r11), %r11d
shrl $0x4, %r11d
btsl %r11d, %edx
movw %dx, 0x914(%rdi)
cmpl $0x3, %eax
jb 0x16462
leal 0x3(%r10), %r11d
subl %r11d, %eax
jb 0x16462
orb %r9b, %r10b
je 0x16462
addl %r8d, %r11d
movl %r11d, %r8d
jmp 0x163f1
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/parse-displayid-block.cpp
// Function: edid_state::check_displayid_blocks()
void edid_state::check_displayid_blocks()
{
	data_block = "DisplayID";
	if (!dispid.has_product_identification)
		fail("Missing DisplayID Product Identification Data Block.\n");
	if (dispid.is_display && !dispid.has_display_parameters)
		fail("Missing DisplayID Display Parameters Data Block.\n");
	if (dispid.is_display && !dispid.has_display_interface_features)
		fail("Missing DisplayID Display Interface Features Data Block.\n");
	if (dispid.is_display && !dispid.has_type_1_7)
		fail("Missing DisplayID Type %s Detailed Timing Data Block.\n",
		     dispid.version >= 0x20 ? "VII" : "I");
	if (dispid.preferred_timings.empty())
		fail("DisplayID expects at least one preferred timing.\n");
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
addq $0x30, %rdi
leaq 0x1335d(%rip), %rsi     # 0x2aa6e
callq 0x3460
cmpb $0x0, 0x91e(%rbx)
jne 0x1772f
leaq 0x13352(%rip), %rsi     # 0x2aa78
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
movb 0x91d(%rbx), %al
cmpb $0x1, %al
jne 0x17758
cmpb $0x0, 0x91f(%rbx)
jne 0x17758
leaq 0x13365(%rip), %rsi     # 0x2aaae
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
movb 0x91d(%rbx), %al
testb $0x1, %al
je 0x1777b
cmpb $0x0, 0x921(%rbx)
jne 0x1777b
leaq 0x13374(%rip), %rsi     # 0x2aae0
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
movb 0x91d(%rbx), %al
testb $0x1, %al
je 0x177b1
cmpb $0x0, 0x920(%rbx)
jne 0x177b1
cmpb $0x20, 0x910(%rbx)
leaq 0x133bb(%rip), %rax     # 0x2ab51
leaq 0xfe3d(%rip), %rdx      # 0x275da
cmovaeq %rax, %rdx
leaq 0x13372(%rip), %rsi     # 0x2ab1a
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
movq 0x928(%rbx), %rax
cmpq 0x930(%rbx), %rax
je 0x177c3
popq %rbx
retq
leaq 0x1338b(%rip), %rsi     # 0x2ab55
xorl %edi, %edi
xorl %eax, %eax
popq %rbx
jmp 0x362c
// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/parse-ls-ext-block.cpp
// Function: edid_state::parse_string_table(unsigned char const*)
void edid_state::parse_string_table(const unsigned char *x)
{
	printf("  UTF Type: ");
	switch (x[0] & 7) {
	case 0: printf("UTF 8\n"); break;
	case 1: printf("UTF 16BE\n"); break;
	case 2: printf("UTF 32BE\n"); break;
	default:
		printf("Unknown (0x%02x)\n", x[0] & 7);
		fail("Unknown UTF Type (0x%02x).\n", x[0] & 7);
		break;
	}
	printf("  Country Code ID (ISO 3166-3): %u\n", ((x[1] & 0x3f) << 8) | x[2]);

	if (x[3] || x[4]) {
		char name[4];

		name[0] = ((x[3] & 0x7c) >> 2) + '@';
		name[1] = ((x[3] & 0x03) << 3) + ((x[4] & 0xe0) >> 5) + '@';
		name[2] = (x[4] & 0x1f) + '@';
		name[3] = 0;
		if (name[0] == '@') name[0] = ' ';
		if (name[1] == '@') name[1] = ' ';
		if (name[2] == '@') name[2] = ' ';
		printf("  Language ID: '%s'\n", name);
	}
	x += 5;
	parse_string("Manufacturer Name", x);
	x += x[0] + 1;
	parse_string("Model Name", x);
	x += x[0] + 1;
	if (hide_serial_numbers)
		printf("  Serial Number: ...\n");
	else
		parse_string("Serial Number", x);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x13fa1(%rip), %rdi     # 0x2b8f2
xorl %eax, %eax
callq 0x3030
movzbl (%r14), %esi
andl $0x7, %esi
cmpl $0x2, %esi
je 0x1797f
cmpl $0x1, %esi
je 0x17976
testl %esi, %esi
jne 0x1798d
leaq 0x14066(%rip), %rdi     # 0x2b9da
jmp 0x17986
leaq 0x14054(%rip), %rdi     # 0x2b9d1
jmp 0x17986
leaq 0x14042(%rip), %rdi     # 0x2b9c8
callq 0x33b0
jmp 0x179b2
leaq 0x7578(%rip), %rdi      # 0x1ef0c
xorl %eax, %eax
callq 0x3030
movzbl (%r14), %edx
andl $0x7, %edx
leaq 0x13f56(%rip), %rsi     # 0x2b8ff
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
movzbl 0x1(%r14), %eax
andl $0x3f, %eax
shll $0x8, %eax
movzbl 0x2(%r14), %esi
orl %eax, %esi
leaq 0x13f50(%rip), %rdi     # 0x2b91b
xorl %eax, %eax
callq 0x3030
movb 0x3(%r14), %cl
movb 0x4(%r14), %al
movl %ecx, %edx
orb %al, %dl
je 0x17a44
movl %ecx, %edx
shrb $0x2, %dl
andb $0x1f, %dl
leal 0x40(%rdx), %esi
movb %sil, 0x4(%rsp)
movl %eax, %esi
shrb $0x5, %sil
shlb $0x3, %cl
orb %sil, %cl
andb $0x1f, %cl
leal 0x40(%rcx), %esi
movb %sil, 0x5(%rsp)
andb $0x1f, %al
leal 0x40(%rax), %esi
movb %sil, 0x6(%rsp)
movb $0x0, 0x7(%rsp)
testb %dl, %dl
jne 0x17a1f
movb $0x20, 0x4(%rsp)
testb %cl, %cl
jne 0x17a28
movb $0x20, 0x5(%rsp)
testb %al, %al
jne 0x17a31
movb $0x20, 0x6(%rsp)
leaq 0x13f07(%rip), %rdi     # 0x2b93f
leaq 0x4(%rsp), %rsi
xorl %eax, %eax
callq 0x3030
leaq 0x5(%r14), %rsi
leaq 0x13f05(%rip), %rdi     # 0x2b954
callq 0x17aa2
movzbl 0x5(%r14), %eax
addq %rax, %r14
addq $0x6, %r14
leaq 0x13eff(%rip), %rdi     # 0x2b966
movq %r14, %rsi
callq 0x17aa2
cmpb $0x1, 0x52(%rbx)
jne 0x17a83
leaq 0x8b22(%rip), %rdi      # 0x2059e
callq 0x33b0
jmp 0x17a9a
movzbl (%r14), %eax
leaq (%r14,%rax), %rsi
incq %rsi
leaq 0x7ec1(%rip), %rdi      # 0x1f956
callq 0x17aa2
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/parse-ls-ext-block.cpp
// Function: edid_state::parse_ls_ext_block(unsigned char const*)
void edid_state::parse_ls_ext_block(const unsigned char *x)
{
	const unsigned char *orig = x;

	printf("  Version: %u.%u\n  Unicode Version: %u.%u.%u\n",
	       x[1], x[2], (x[3] >> 4), x[3] & 0x0f, x[4]);
	x += 5;

	while (x[0] && x + x[0] < orig + 127) {
		parse_string_table(x + 1);
		x += x[0];
	}
	if (!memchk(x, orig + 127 - x)) {
		data_block.clear();
		fail("Non-zero values in unused space.\n");
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movzbl 0x1(%rsi), %esi
movzbl 0x2(%r14), %edx
movzbl 0x3(%r14), %r8d
movl %r8d, %ecx
shrl $0x4, %ecx
andl $0xf, %r8d
movzbl 0x4(%r14), %r9d
leaq 0x13e65(%rip), %rdi     # 0x2b971
xorl %eax, %eax
callq 0x3030
pushq $0x5
popq %r12
leaq (%r14,%r12), %r15
movzbl (%r14,%r12), %eax
testq %rax, %rax
je 0x17b43
addq %r12, %rax
cmpq $0x7e, %rax
ja 0x17b43
leaq 0x1(%r15), %rsi
movq %rbx, %rdi
callq 0x17940
movzbl (%r15), %eax
addq %rax, %r12
jmp 0x17b17
pushq $0x7f
popq %rsi
subl %r12d, %esi
movq %r15, %rdi
xorl %edx, %edx
callq 0x4fa5
testb %al, %al
je 0x17b63
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
andq $0x0, 0x38(%rbx)
movq 0x30(%rbx), %rax
movb $0x0, (%rax)
leaq 0x13e29(%rip), %rsi     # 0x2b99f
xorl %edi, %edi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x362c
nop
// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/parse-di-ext-block.cpp
// Function: edid_state::parse_di_ext_block(unsigned char const*)
void edid_state::parse_di_ext_block(const unsigned char *x)
{
	printf("  Version: %u\n", x[1]);
	if (!x[1])
		fail("Invalid version 0.\n");

	parse_digital_interface(x);
	parse_display_device(x);
	parse_display_caps(x);
	if (!memchk(x + 0x27, 16))
		fail("Bytes 0x27-0x36 should be 0.\n");
	if (!memchk(x + 0x37, 17))
		fail("Bytes 0x37-0x47 should be 0.\n");
	if (!memchk(x + 0x48, 9))
		fail("Bytes 0x48-0x50 should be 0.\n");
	parse_display_xfer(x);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movzbl 0x1(%rsi), %esi
leaq 0xd69a(%rip), %rdi      # 0x26739
xorl %eax, %eax
callq 0x3030
cmpb $0x0, 0x1(%rbx)
jne 0x190bc
leaq 0x13b28(%rip), %rsi     # 0x2cbdb
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
movq %r14, %rdi
movq %rbx, %rsi
callq 0x17b8c
movq %r14, %rdi
movq %rbx, %rsi
callq 0x181a8
movq %r14, %rdi
movq %rbx, %rsi
callq 0x18490
leaq 0x27(%rbx), %rdi
pushq $0x10
popq %rsi
xorl %edx, %edx
callq 0x4fa5
testb %al, %al
jne 0x190ff
leaq 0x13af9(%rip), %rsi     # 0x2cbef
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
leaq 0x37(%rbx), %rdi
pushq $0x11
popq %rsi
xorl %edx, %edx
callq 0x4fa5
testb %al, %al
jne 0x19121
leaq 0x13af5(%rip), %rsi     # 0x2cc0d
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
leaq 0x48(%rbx), %rdi
pushq $0x9
popq %rsi
xorl %edx, %edx
callq 0x4fa5
testb %al, %al
jne 0x19143
leaq 0x13af1(%rip), %rsi     # 0x2cc2b
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x18e28
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/parse-vtb-ext-block.cpp
// Function: edid_state::parse_vtb_ext_block(unsigned char const*)
void edid_state::parse_vtb_ext_block(const unsigned char *x)
{
	printf("  Version: %u\n", x[1]);
	if (x[1] != 1)
		fail("Invalid version %u.\n", x[1]);

	unsigned num_dtd = x[2];
	unsigned num_cvt = x[3];
	unsigned num_st = x[4];

	x += 5;
	if (num_dtd) {
		printf("  Detailed Timing Descriptors:\n");
		for (unsigned i = 0; i < num_dtd; i++, x += 18)
			detailed_timings("    ", x, false);
	}
	if (num_cvt) {
		printf("  Coordinated Video Timings:\n");
		for (unsigned i = 0; i < num_cvt; i++, x += 3)
			detailed_cvt_descriptor("    ", x, false);
	}
	if (num_st) {
		// Note: the VTB-EXT standard has a mistake in the example EDID
		// that it provides: there the refresh rate (bits 5-0 of the
		// second byte) is set to 60 for 60 Hz, but this should be 0
		// since the actual refresh rate is the value + 60.
		//
		// The documentation itself is correct, though.
		printf("  Standard Timings:\n");
		for (unsigned i = 0; i < num_st; i++, x += 2)
			print_standard_timing("    ", x[0], x[1], true);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
movzbl 0x1(%rsi), %esi
leaq 0xd5c5(%rip), %rdi      # 0x26739
xorl %eax, %eax
callq 0x3030
movzbl 0x1(%r15), %edx
cmpl $0x1, %edx
je 0x19195
leaq 0x141df(%rip), %rsi     # 0x2d36b
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
movzbl 0x2(%r15), %r13d
leaq 0x5(%r15), %r14
movzbl 0x3(%r15), %ebp
movzbl 0x4(%r15), %r12d
testl %r13d, %r13d
je 0x191dc
leaq 0x141cc(%rip), %rdi     # 0x2d380
callq 0x33b0
leaq 0x62d7(%rip), %r15      # 0x1f497
subl $0x1, %r13d
jb 0x191dc
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0x96f0
addq $0x12, %r14
jmp 0x191c0
testl %ebp, %ebp
je 0x1920e
leaq 0x141b8(%rip), %rdi     # 0x2d39f
callq 0x33b0
leaq 0x62a4(%rip), %r15      # 0x1f497
subl $0x1, %ebp
jb 0x1920e
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0x83d4
addq $0x3, %r14
jmp 0x191f3
testq %r12, %r12
je 0x19252
leaq 0x141a2(%rip), %rdi     # 0x2d3bc
callq 0x33b0
xorl %r13d, %r13d
leaq 0x626e(%rip), %r15      # 0x1f497
pushq $0x1
popq %rbp
cmpl %r13d, %r12d
je 0x19252
movzbl (%r14,%r13,2), %edx
movzbl 0x1(%r14,%r13,2), %ecx
movq %rbx, %rdi
movq %r15, %rsi
movl %ebp, %r8d
xorl %r9d, %r9d
callq 0x8800
incq %r13
jmp 0x1922c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/calc-gtf-cvt.cpp
// Function: edid_state::edid_gtf_mode(unsigned int, timings&)
void edid_state::edid_gtf_mode(unsigned refresh, struct timings &t)
{
	unsigned hratio = t.hratio;
	unsigned vratio = t.vratio;
	t = calc_gtf_mode(t.hact, t.vact, refresh, t.interlaced);
	t.hratio = hratio;
	t.vratio = vratio;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x60, %rsp
movq %rdx, %rbx
movl (%rdx), %edx
movl 0x4(%rbx), %ecx
movl %esi, %eax
cvtsi2sd %rax, %xmm0
movzbl 0x18(%rbx), %r8d
movq 0x8(%rbx), %r15
leaq 0xc(%rsp), %r14
pushq $0x1
popq %r9
movsd 0x84c(%rip), %xmm1      # 0x1a058
movsd 0x83c(%rip), %xmm2      # 0x1a050
movsd 0x82c(%rip), %xmm3      # 0x1a048
movsd 0x81c(%rip), %xmm4      # 0x1a040
movq %r14, %rdi
pushq $0x0
pushq $0x0
callq 0x19264
popq %rax
popq %rcx
pushq $0x15
popq %rcx
movq %rbx, %rdi
movq %r14, %rsi
rep  movsl (%rsi), %es:(%rdi)
movq %r15, 0x8(%rbx)
addq $0x60, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/calc-gtf-cvt.cpp
// Function: edid_state::edid_cvt_mode(unsigned int, timings&)
void edid_state::edid_cvt_mode(unsigned refresh, struct timings &t)
{
	unsigned hratio = t.hratio;
	unsigned vratio = t.vratio;

	t = calc_cvt_mode(t.hact, t.vact, refresh, t.rb & ~RB_ALT, t.interlaced,
			  false, t.rb & RB_ALT);
	t.hratio = hratio;
	t.vratio = vratio;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x60, %rsp
movq %rdx, %rbx
movl (%rdx), %edx
movl 0x4(%rbx), %ecx
movl %esi, %eax
cvtsi2sd %rax, %xmm0
movl 0x14(%rbx), %eax
movl %eax, %r8d
andl $0xffffff7f, %r8d       # imm = 0xFFFFFF7F
movzbl 0x18(%rbx), %r9d
movq 0x8(%rbx), %r15
shrb $0x7, %al
movzbl %al, %eax
leaq 0xc(%rsp), %r14
movq %r14, %rdi
pushq %rax
pushq $0x0
callq 0x1984c
popq %rax
popq %rcx
pushq $0x15
popq %rcx
movq %rbx, %rdi
movq %r14, %rsi
rep  movsl (%rsi), %es:(%rdi)
movq %r15, 0x8(%rbx)
addq $0x60, %rsp
popq %rbx
popq %r14
popq %r15
retq