// File: 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 %rbp
movq %rsp, %rbp
subq $0x160, %rsp            # imm = 0x160
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x158(%rbp)
movq -0x10(%rbp), %rax
xorl %ecx, %ecx
movzbl 0x1(%rax), %esi
movl %ecx, %edx
callq 0x21b00
movq -0x158(%rbp), %rax
movb $0x1, 0x91e(%rax)
movzbl 0x910(%rax), %eax
cmpl $0x20, %eax
jl 0x21c4d
movq -0x10(%rbp), %rcx
movzbl 0x3(%rcx), %eax
shll $0x10, %eax
movzbl 0x4(%rcx), %edx
shll $0x8, %edx
orl %edx, %eax
movzbl 0x5(%rcx), %ecx
orl %ecx, %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %esi
leaq -0x38(%rbp), %rdi
movq %rdi, -0x160(%rbp)
callq 0x7770
movq -0x160(%rbp), %rdi
callq 0x4150
movq %rax, %rsi
leaq 0x1c67a(%rip), %rdi     # 0x3e299
xorl %eax, %eax
callq 0x4050
jmp 0x21c28
leaq -0x38(%rbp), %rdi
callq 0x41f0
jmp 0x21c73
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x41f0
jmp 0x21dc6
movq -0x10(%rbp), %rax
movzbl 0x3(%rax), %esi
movq -0x10(%rbp), %rax
movzbl 0x4(%rax), %edx
movq -0x10(%rbp), %rax
movzbl 0x5(%rax), %ecx
leaq 0x1c640(%rip), %rdi     # 0x3e2ac
movb $0x0, %al
callq 0x4050
movq -0x10(%rbp), %rax
movzbl 0x6(%rax), %esi
movq -0x10(%rbp), %rax
movzbl 0x7(%rax), %eax
shll $0x8, %eax
orl %eax, %esi
leaq 0x1c634(%rip), %rdi     # 0x3e2c3
movb $0x0, %al
callq 0x4050
movq -0x10(%rbp), %rax
movzbl 0x8(%rax), %eax
movq -0x10(%rbp), %rcx
movzbl 0x9(%rcx), %ecx
shll $0x8, %ecx
orl %ecx, %eax
movq -0x10(%rbp), %rcx
movzbl 0xa(%rcx), %ecx
shll $0x10, %ecx
orl %ecx, %eax
movq -0x10(%rbp), %rcx
movzbl 0xb(%rcx), %ecx
shll $0x18, %ecx
orl %ecx, %eax
movl %eax, -0x48(%rbp)
cmpl $0x0, -0x48(%rbp)
je 0x21cfe
movq -0x158(%rbp), %rax
testb $0x1, 0x52(%rax)
je 0x21ceb
leaq 0x13128(%rip), %rdi     # 0x34e0a
movb $0x0, %al
callq 0x4050
jmp 0x21cfc
movl -0x48(%rbp), %esi
leaq 0x1312d(%rip), %rdi     # 0x34e22
movb $0x0, %al
callq 0x4050
jmp 0x21cfe
movq -0x10(%rbp), %rax
movzbl 0xc(%rax), %eax
movl %eax, -0x4c(%rbp)
movq -0x10(%rbp), %rax
movzbl 0xd(%rax), %eax
addl $0x7d0, %eax            # imm = 0x7D0
movl %eax, -0x50(%rbp)
movl -0x4c(%rbp), %ecx
leaq 0x1c5cc(%rip), %rsi     # 0x3e2ef
leaq 0x1c5ba(%rip), %rax     # 0x3e2e4
cmpl $0xff, %ecx
cmoveq %rax, %rsi
movl -0x50(%rbp), %edx
leaq 0x1c59b(%rip), %rdi     # 0x3e2d9
movb $0x0, %al
callq 0x4050
cmpl $0x0, -0x4c(%rbp)
je 0x21d62
cmpl $0x36, -0x4c(%rbp)
ja 0x21d62
movl -0x4c(%rbp), %esi
leaq 0x1c5a8(%rip), %rdi     # 0x3e303
movb $0x0, %al
callq 0x4050
leaq 0xdba0(%rip), %rdi      # 0x2f909
movb $0x0, %al
callq 0x4050
movq -0x10(%rbp), %rax
cmpb $0x0, 0xe(%rax)
je 0x21dbd
leaq -0x150(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0xf, %rsi
movq -0x10(%rbp), %rax
movzbl 0xe(%rax), %eax
movl %eax, %edx
callq 0x42a0
movq -0x10(%rbp), %rax
movzbl 0xe(%rax), %eax
movb $0x0, -0x150(%rbp,%rax)
leaq -0x150(%rbp), %rsi
leaq 0x1c557(%rip), %rdi     # 0x3e30d
movb $0x0, %al
callq 0x4050
addq $0x160, %rsp            # imm = 0x160
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x4550
nop