// File: rpavlik[P]edid-decode/parse-base-block.cpp
// Function: edid_state::detailed_block(unsigned char const*)
void edid_state::detailed_block(const unsigned char *x)
{
	static const unsigned char zero_descr[18] = { 0 };
	unsigned cnt;
	unsigned i;

	base.detailed_block_cnt++;
	if (x[0] || x[1]) {
		detailed_timings("    ", x);
		if (base.seen_non_detailed_descriptor)
			fail("Invalid detailed timing descriptor ordering.\n");
		return;
	}

	data_block = "Display Descriptor #" + std::to_string(base.detailed_block_cnt);
	/* Monitor descriptor block, not detailed timing descriptor. */
	if (x[2] != 0) {
		/* 1.3, 3.10.3 */
		fail("Monitor descriptor block has byte 2 nonzero (0x%02x).\n", x[2]);
	}
	if ((base.edid_minor < 4 || x[3] != 0xfd) && x[4] != 0x00) {
		/* 1.3, 3.10.3 */
		fail("Monitor descriptor block has byte 4 nonzero (0x%02x).\n", x[4]);
	}

	base.seen_non_detailed_descriptor = true;
	if (base.edid_minor == 0)
		fail("Has descriptor blocks other than detailed timings.\n");

	if (!memcmp(x, zero_descr, sizeof(zero_descr))) {
		data_block = "Empty Descriptor";
		printf("    %s\n", data_block.c_str());
		fail("Use Dummy Descriptor instead of all zeroes.\n");
		return;
	}

	switch (x[3]) {
	case 0x0e:
		detailed_epi(x);
		return;
	case 0x10:
		data_block = "Dummy Descriptor";
		printf("    %s:\n", data_block.c_str());
		for (i = 5; i < 18; i++) {
			if (x[i]) {
				fail("Dummy block filled with garbage.\n");
				break;
			}
		}
		return;
	case 0xf7:
		data_block = "Established timings III";
		printf("    %s:\n", data_block.c_str());
		for (i = 0; i < ARRAY_SIZE(established_timings3_dmt_ids); i++)
			if (x[6 + i / 8] & (1 << (7 - i % 8))) {
				unsigned char dmt_id = established_timings3_dmt_ids[i];
				char type[16];

				sprintf(type, "DMT 0x%02x", dmt_id);
				print_timings("      ", find_dmt_id(dmt_id), type);
			}
		return;
	case 0xf8:
		data_block = "CVT 3 Byte Timing Codes";
		printf("    %s:\n", data_block.c_str());
		if (x[5] != 0x01) {
			fail("Invalid version number %u.\n", x[5]);
			return;
		}
		for (i = 0; i < 4; i++)
			detailed_cvt_descriptor("      ", x + 6 + (i * 3), !i);
		return;
	case 0xf9:
		data_block = "Display Color Management Data";
		printf("    %s:\n", data_block.c_str());
		printf("      Version : %d\n", x[5]);
		printf("      Red a3  : %.2f\n", (short)(x[6] | (x[7] << 8)) / 100.0);
		printf("      Red a2  : %.2f\n", (short)(x[8] | (x[9] << 8)) / 100.0);
		printf("      Green a3: %.2f\n", (short)(x[10] | (x[11] << 8)) / 100.0);
		printf("      Green a2: %.2f\n", (short)(x[12] | (x[13] << 8)) / 100.0);
		printf("      Blue a3 : %.2f\n", (short)(x[14] | (x[15] << 8)) / 100.0);
		printf("      Blue a2 : %.2f\n", (short)(x[16] | (x[17] << 8)) / 100.0);
		return;
	case 0xfa:
		data_block = "Standard Timing Identifications";
		printf("    %s:\n", data_block.c_str());
		for (cnt = i = 0; i < 6; i++) {
			if (x[5 + i * 2] != 0x01 || x[5 + i * 2 + 1] != 0x01)
				cnt++;
			print_standard_timing("      ", x[5 + i * 2], x[5 + i * 2 + 1]);
		}
		if (!cnt)
			warn("%s block without any timings.\n", data_block.c_str());
		return;
	case 0xfb: {
		unsigned w_x, w_y;
		unsigned gamma;

		data_block = "Color Point Data";
		printf("    %s:\n", data_block.c_str());
		w_x = (x[7] << 2) | ((x[6] >> 2) & 3);
		w_y = (x[8] << 2) | (x[6] & 3);
		gamma = x[9];
		printf("      Index: %u White: 0.%04u, 0.%04u", x[5],
		       (w_x * 10000) / 1024, (w_y * 10000) / 1024);
		if (gamma == 0xff)
			printf(" Gamma: is defined in an extension block");
		else
			printf(" Gamma: %.2f", ((gamma + 100.0) / 100.0));
		printf("\n");
		if (x[10] == 0)
			return;
		w_x = (x[12] << 2) | ((x[11] >> 2) & 3);
		w_y = (x[13] << 2) | (x[11] & 3);
		gamma = x[14];
		printf("      Index: %u White: 0.%04u, 0.%04u", x[10],
		       (w_x * 10000) / 1024, (w_y * 10000) / 1024);
		if (gamma == 0xff)
			printf(" Gamma: is defined in an extension block");
		else
			printf(" Gamma: %.2f", ((gamma + 100.0) / 100.0));
		printf("\n");
		return;
	}
	case 0xfc:
		data_block = "Display Product Name";
		base.has_name_descriptor = 1;
		printf("    %s: '%s'\n", data_block.c_str(), extract_string(x + 5, 13));
		return;
	case 0xfd:
		detailed_display_range_limits(x);
		return;
	case 0xfe:
		if (!base.has_spwg || base.detailed_block_cnt < 3) {
			data_block = "Alphanumeric Data String";
			printf("    %s: '%s'\n", data_block.c_str(),
			       extract_string(x + 5, 13));
			return;
		}
		if (base.detailed_block_cnt == 3) {
			char buf[6] = { 0 };

			data_block = "SPWG Descriptor #3";
			printf("    %s:\n", data_block.c_str());
			memcpy(buf, x + 5, 5);
			if (strlen(buf) != 5)
				fail("Invalid PC Maker P/N length.\n");
			printf("      SPWG PC Maker P/N: '%s'\n", buf);
			printf("      SPWG LCD Supplier EEDID Revision: %hhu\n", x[10]);
			printf("      SPWG Manufacturer P/N: '%s'\n", extract_string(x + 11, 7));
		} else {
			data_block = "SPWG Descriptor #4";
			printf("    %s:\n", data_block.c_str());
			printf("      SMBUS Values: 0x%02hhx 0x%02hhx 0x%02hhx 0x%02hhx"
			       " 0x%02hhx 0x%02hhx 0x%02hhx 0x%02hhx\n",
			       x[5], x[6], x[7], x[8], x[9], x[10], x[11], x[12]);
			printf("      LVDS Channels: %hhu\n", x[13]);
			printf("      Panel Self Test %sPresent\n", x[14] ? "" : "Not ");
			if (x[15] != 0x0a || x[16] != 0x20 || x[17] != 0x20)
				fail("Invalid trailing data.\n");
		}
		return;
	case 0xff: {
		data_block = "Display Product Serial Number";
		char *sn = extract_string(x + 5, 13);
		if (hide_serial_numbers)
			printf("    %s: ...\n", data_block.c_str());
		else
			printf("    %s: '%s'\n", data_block.c_str(), sn);
		base.has_serial_string = 1;
		return;
	}
	default:
		printf("    %s Display Descriptor (0x%02hhx):",
		       x[3] <= 0x0f ? "Manufacturer-Specified" : "Unknown", x[3]);
		hex_block(" ", x + 2, 16);
		if (x[3] > 0x0f)
			fail("Unknown Type 0x%02hhx.\n", x[3]);
		return;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movl 0xbc(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xbc(%rax)
movq -0x10(%rbp), %rax
cmpb $0x0, (%rax)
jne 0x12060
movq -0x10(%rbp), %rax
cmpb $0x0, 0x1(%rax)
je 0x120a1
movq -0xa8(%rbp), %rdi
movq -0x10(%rbp), %rdx
leaq 0x2276d(%rip), %rsi     # 0x347df
movl $0x1, %ecx
callq 0x10e10
movq -0xa8(%rbp), %rax
testb $0x1, 0xc4(%rax)
je 0x1209c
xorl %edi, %edi
leaq 0x2274f(%rip), %rsi     # 0x347e4
movb $0x0, %al
callq 0x47d0
jmp 0x12db3
movq -0xa8(%rbp), %rax
movl 0xbc(%rax), %esi
leaq -0x58(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0xb6d0
movq -0xb0(%rbp), %rdx
leaq 0x22746(%rip), %rsi     # 0x34812
leaq -0x38(%rbp), %rdi
callq 0x14870
jmp 0x120d7
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
leaq -0x38(%rbp), %rsi
callq 0x43d0
leaq -0x38(%rbp), %rdi
callq 0x41f0
leaq -0x58(%rbp), %rdi
callq 0x41f0
movq -0x10(%rbp), %rax
movzbl 0x2(%rax), %eax
cmpl $0x0, %eax
je 0x1213e
movq -0x10(%rbp), %rax
movzbl 0x2(%rax), %edx
xorl %edi, %edi
leaq 0x2270c(%rip), %rsi     # 0x34827
movb $0x0, %al
callq 0x47d0
jmp 0x1213e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x41f0
jmp 0x12dbc
movq -0xa8(%rbp), %rax
cmpl $0x4, 0x88(%rax)
jb 0x1215d
movq -0x10(%rbp), %rax
movzbl 0x3(%rax), %eax
cmpl $0xfd, %eax
je 0x12182
movq -0x10(%rbp), %rax
movzbl 0x4(%rax), %eax
cmpl $0x0, %eax
je 0x12182
movq -0x10(%rbp), %rax
movzbl 0x4(%rax), %edx
xorl %edi, %edi
leaq 0x226e3(%rip), %rsi     # 0x3485e
movb $0x0, %al
callq 0x47d0
movq -0xa8(%rbp), %rax
movb $0x1, 0xc4(%rax)
cmpl $0x0, 0x88(%rax)
jne 0x121a9
xorl %edi, %edi
leaq 0x226f3(%rip), %rsi     # 0x34895
movb $0x0, %al
callq 0x47d0
movq -0x10(%rbp), %rdi
leaq 0x216ac(%rip), %rsi     # 0x33860
movl $0x12, %edx
callq 0x4190
cmpl $0x0, %eax
jne 0x12210
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
leaq 0x226f4(%rip), %rsi     # 0x348c9
callq 0x4420
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
callq 0x4150
movq %rax, %rsi
leaq 0x27d23(%rip), %rdi     # 0x39f17
movb $0x0, %al
callq 0x4050
xorl %edi, %edi
leaq 0x226d6(%rip), %rsi     # 0x348da
movb $0x0, %al
callq 0x47d0
jmp 0x12db3
movq -0x10(%rbp), %rax
movzbl 0x3(%rax), %eax
movl %eax, -0xb4(%rbp)
subl $0xe, %eax
je 0x122e8
jmp 0x12229
movl -0xb4(%rbp), %eax
subl $0x10, %eax
je 0x122fd
jmp 0x1223a
movl -0xb4(%rbp), %eax
subl $0xf7, %eax
je 0x12373
jmp 0x1224d
movl -0xb4(%rbp), %eax
subl $0xf8, %eax
je 0x12460
jmp 0x12260
movl -0xb4(%rbp), %eax
subl $0xf9, %eax
je 0x12512
jmp 0x12273
movl -0xb4(%rbp), %eax
subl $0xfa, %eax
je 0x1269d
jmp 0x12286
movl -0xb4(%rbp), %eax
subl $0xfb, %eax
je 0x127a8
jmp 0x12299
movl -0xb4(%rbp), %eax
subl $0xfc, %eax
je 0x129a7
jmp 0x122ac
movl -0xb4(%rbp), %eax
subl $0xfd, %eax
je 0x12a0b
jmp 0x122bf
movl -0xb4(%rbp), %eax
subl $0xfe, %eax
je 0x12a20
jmp 0x122d2
movl -0xb4(%rbp), %eax
subl $0xff, %eax
je 0x12c9c
jmp 0x12d37
movq -0xa8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x10840
jmp 0x12db3
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
leaq 0x225f8(%rip), %rsi     # 0x34907
callq 0x4420
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
callq 0x4150
movq %rax, %rsi
leaq 0x21dc1(%rip), %rdi     # 0x340ef
movb $0x0, %al
callq 0x4050
movl $0x5, -0x18(%rbp)
cmpl $0x12, -0x18(%rbp)
jae 0x1236e
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
cmpb $0x0, (%rax,%rcx)
je 0x12361
xorl %edi, %edi
leaq 0x225c0(%rip), %rsi     # 0x34918
movb $0x0, %al
callq 0x47d0
jmp 0x1236e
jmp 0x12363
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x1233c
jmp 0x12db3
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
leaq 0x225b5(%rip), %rsi     # 0x3493a
callq 0x4420
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
callq 0x4150
movq %rax, %rsi
leaq 0x21d4b(%rip), %rdi     # 0x340ef
movb $0x0, %al
callq 0x4050
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpq $0x2c, %rax
jae 0x1245b
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
shrl $0x3, %ecx
addl $0x6, %ecx
movl %ecx, %ecx
movzbl (%rax,%rcx), %eax
movl -0x18(%rbp), %edx
andl $0x7, %edx
movl $0x7, %ecx
subl %edx, %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
andl %ecx, %eax
cmpl $0x0, %eax
je 0x1244b
movl -0x18(%rbp), %eax
movl %eax, %ecx
leaq 0x21435(%rip), %rax     # 0x33830
movb (%rax,%rcx), %al
movb %al, -0x65(%rbp)
leaq -0x80(%rbp), %rdi
movzbl -0x65(%rbp), %edx
leaq 0x1d6a9(%rip), %rsi     # 0x2fab9
movb $0x0, %al
callq 0x40a0
movzbl -0x65(%rbp), %edi
callq 0xe6b0
movq -0xa8(%rbp), %rdi
movq %rax, %rdx
leaq -0x80(%rbp), %rcx
leaq 0x223a8(%rip), %rsi     # 0x347dd
leaq 0x1da7d(%rip), %r8      # 0x2feb9
xorl %r9d, %r9d
movl $0x1, (%rsp)
callq 0x50c0
jmp 0x1244d
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x123b2
jmp 0x12db3
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
leaq 0x224e0(%rip), %rsi     # 0x34952
callq 0x4420
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
callq 0x4150
movq %rax, %rsi
leaq 0x21c5e(%rip), %rdi     # 0x340ef
movb $0x0, %al
callq 0x4050
movq -0x10(%rbp), %rax
movzbl 0x5(%rax), %eax
cmpl $0x1, %eax
je 0x124c2
movq -0x10(%rbp), %rax
movzbl 0x5(%rax), %edx
xorl %edi, %edi
leaq 0x224b4(%rip), %rsi     # 0x3496a
movb $0x0, %al
callq 0x47d0
jmp 0x12db3
movl $0x0, -0x18(%rbp)
cmpl $0x4, -0x18(%rbp)
jae 0x1250d
movq -0xa8(%rbp), %rdi
movq -0x10(%rbp), %rdx
addq $0x6, %rdx
imull $0x3, -0x18(%rbp), %eax
movl %eax, %eax
addq %rax, %rdx
cmpl $0x0, -0x18(%rbp)
setne %al
xorb $-0x1, %al
movzbl %al, %ecx
andl $0x1, %ecx
leaq 0x222e0(%rip), %rsi     # 0x347dd
callq 0xf0b0
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x124c9
jmp 0x12db3
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
leaq 0x22462(%rip), %rsi     # 0x34986
callq 0x4420
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
callq 0x4150
movq %rax, %rsi
leaq 0x21bac(%rip), %rdi     # 0x340ef
movb $0x0, %al
callq 0x4050
movq -0x10(%rbp), %rax
movzbl 0x5(%rax), %esi
leaq 0x2244b(%rip), %rdi     # 0x349a4
movb $0x0, %al
callq 0x4050
movq -0x10(%rbp), %rax
movzbl 0x6(%rax), %eax
movq -0x10(%rbp), %rcx
movzbl 0x7(%rcx), %ecx
shll $0x8, %ecx
orl %ecx, %eax
cwtl
cvtsi2sd %eax, %xmm0
movsd 0x1cab6(%rip), %xmm1    # 0x2f038
divsd %xmm1, %xmm0
leaq 0x2242b(%rip), %rdi     # 0x349b8
movb $0x1, %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
cwtl
cvtsi2sd %eax, %xmm0
movsd 0x1ca82(%rip), %xmm1    # 0x2f038
divsd %xmm1, %xmm0
leaq 0x2240d(%rip), %rdi     # 0x349ce
movb $0x1, %al
callq 0x4050
movq -0x10(%rbp), %rax
movzbl 0xa(%rax), %eax
movq -0x10(%rbp), %rcx
movzbl 0xb(%rcx), %ecx
shll $0x8, %ecx
orl %ecx, %eax
cwtl
cvtsi2sd %eax, %xmm0
movsd 0x1ca4e(%rip), %xmm1    # 0x2f038
divsd %xmm1, %xmm0
leaq 0x223ef(%rip), %rdi     # 0x349e4
movb $0x1, %al
callq 0x4050
movq -0x10(%rbp), %rax
movzbl 0xc(%rax), %eax
movq -0x10(%rbp), %rcx
movzbl 0xd(%rcx), %ecx
shll $0x8, %ecx
orl %ecx, %eax
cwtl
cvtsi2sd %eax, %xmm0
movsd 0x1ca1a(%rip), %xmm1    # 0x2f038
divsd %xmm1, %xmm0
leaq 0x223d1(%rip), %rdi     # 0x349fa
movb $0x1, %al
callq 0x4050
movq -0x10(%rbp), %rax
movzbl 0xe(%rax), %eax
movq -0x10(%rbp), %rcx
movzbl 0xf(%rcx), %ecx
shll $0x8, %ecx
orl %ecx, %eax
cwtl
cvtsi2sd %eax, %xmm0
movsd 0x1c9e6(%rip), %xmm1    # 0x2f038
divsd %xmm1, %xmm0
leaq 0x223b3(%rip), %rdi     # 0x34a10
movb $0x1, %al
callq 0x4050
movq -0x10(%rbp), %rax
movzbl 0x10(%rax), %eax
movq -0x10(%rbp), %rcx
movzbl 0x11(%rcx), %ecx
shll $0x8, %ecx
orl %ecx, %eax
cwtl
cvtsi2sd %eax, %xmm0
movsd 0x1c9b2(%rip), %xmm1    # 0x2f038
divsd %xmm1, %xmm0
leaq 0x22395(%rip), %rdi     # 0x34a26
movb $0x1, %al
callq 0x4050
jmp 0x12db3
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
leaq 0x2238d(%rip), %rsi     # 0x34a3c
callq 0x4420
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
callq 0x4150
movq %rax, %rsi
leaq 0x21a21(%rip), %rdi     # 0x340ef
movb $0x0, %al
callq 0x4050
movl $0x0, -0x18(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x6, -0x18(%rbp)
jae 0x12777
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
shll %ecx
addl $0x5, %ecx
movl %ecx, %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x1, %eax
jne 0x1271e
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
shll %ecx
addl $0x5, %ecx
addl $0x1, %ecx
movl %ecx, %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x1, %eax
je 0x12727
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movq -0xa8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
shll %ecx
addl $0x5, %ecx
movl %ecx, %ecx
movb (%rax,%rcx), %dl
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
shll %ecx
addl $0x5, %ecx
addl $0x1, %ecx
movl %ecx, %ecx
leaq 0x22086(%rip), %rsi     # 0x347dd
xorl %r9d, %r9d
movzbl %dl, %edx
movzbl (%rax,%rcx), %ecx
movl %r9d, %r8d
callq 0xf6f0
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x126e3
cmpl $0x0, -0x14(%rbp)
jne 0x127a3
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
callq 0x4150
movq %rax, %rdx
movl $0x1, %edi
leaq 0x222c0(%rip), %rsi     # 0x34a5c
movb $0x0, %al
callq 0x47d0
jmp 0x12db3
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
leaq 0x222c1(%rip), %rsi     # 0x34a7b
callq 0x4420
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
callq 0x4150
movq %rax, %rsi
leaq 0x21916(%rip), %rdi     # 0x340ef
movb $0x0, %al
callq 0x4050
movq -0x10(%rbp), %rax
movzbl 0x7(%rax), %eax
shll $0x2, %eax
movq -0x10(%rbp), %rcx
movzbl 0x6(%rcx), %ecx
sarl $0x2, %ecx
andl $0x3, %ecx
orl %ecx, %eax
movl %eax, -0x84(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x8(%rax), %eax
shll $0x2, %eax
movq -0x10(%rbp), %rcx
movzbl 0x6(%rcx), %ecx
andl $0x3, %ecx
orl %ecx, %eax
movl %eax, -0x88(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x9(%rax), %eax
movl %eax, -0x8c(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x5(%rax), %esi
imull $0x2710, -0x84(%rbp), %edx # imm = 0x2710
shrl $0xa, %edx
imull $0x2710, -0x88(%rbp), %ecx # imm = 0x2710
shrl $0xa, %ecx
leaq 0x22236(%rip), %rdi     # 0x34a8c
movb $0x0, %al
callq 0x4050
cmpl $0xff, -0x8c(%rbp)
jne 0x12879
leaq 0x22242(%rip), %rdi     # 0x34ab2
movb $0x0, %al
callq 0x4050
jmp 0x128aa
movl -0x8c(%rbp), %eax
cvtsi2sd %rax, %xmm0
movsd 0x1c7ac(%rip), %xmm1    # 0x2f038
addsd %xmm1, %xmm0
movsd 0x1c7a0(%rip), %xmm1    # 0x2f038
divsd %xmm1, %xmm0
leaq 0x22238(%rip), %rdi     # 0x34adb
movb $0x1, %al
callq 0x4050
leaq 0x1d058(%rip), %rdi     # 0x2f909
movb $0x0, %al
callq 0x4050
movq -0x10(%rbp), %rax
movzbl 0xa(%rax), %eax
cmpl $0x0, %eax
jne 0x128ca
jmp 0x12db3
movq -0x10(%rbp), %rax
movzbl 0xc(%rax), %eax
shll $0x2, %eax
movq -0x10(%rbp), %rcx
movzbl 0xb(%rcx), %ecx
sarl $0x2, %ecx
andl $0x3, %ecx
orl %ecx, %eax
movl %eax, -0x84(%rbp)
movq -0x10(%rbp), %rax
movzbl 0xd(%rax), %eax
shll $0x2, %eax
movq -0x10(%rbp), %rcx
movzbl 0xb(%rcx), %ecx
andl $0x3, %ecx
orl %ecx, %eax
movl %eax, -0x88(%rbp)
movq -0x10(%rbp), %rax
movzbl 0xe(%rax), %eax
movl %eax, -0x8c(%rbp)
movq -0x10(%rbp), %rax
movzbl 0xa(%rax), %esi
imull $0x2710, -0x84(%rbp), %edx # imm = 0x2710
shrl $0xa, %edx
imull $0x2710, -0x88(%rbp), %ecx # imm = 0x2710
shrl $0xa, %ecx
leaq 0x2214c(%rip), %rdi     # 0x34a8c
movb $0x0, %al
callq 0x4050
cmpl $0xff, -0x8c(%rbp)
jne 0x12963
leaq 0x22158(%rip), %rdi     # 0x34ab2
movb $0x0, %al
callq 0x4050
jmp 0x12994
movl -0x8c(%rbp), %eax
cvtsi2sd %rax, %xmm0
movsd 0x1c6c2(%rip), %xmm1    # 0x2f038
addsd %xmm1, %xmm0
movsd 0x1c6b6(%rip), %xmm1    # 0x2f038
divsd %xmm1, %xmm0
leaq 0x2214e(%rip), %rdi     # 0x34adb
movb $0x1, %al
callq 0x4050
leaq 0x1cf6e(%rip), %rdi     # 0x2f909
movb $0x0, %al
callq 0x4050
jmp 0x12db3
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
leaq 0x2212f(%rip), %rsi     # 0x34ae8
callq 0x4420
movq -0xa8(%rbp), %rdi
movb $0x1, 0x8c(%rdi)
addq $0x30, %rdi
callq 0x4150
movq %rax, -0xc0(%rbp)
movq -0x10(%rbp), %rdi
addq $0x5, %rdi
movl $0xd, %esi
callq 0xf540
movq -0xc0(%rbp), %rsi
movq %rax, %rdx
leaq 0x220fe(%rip), %rdi     # 0x34afd
movb $0x0, %al
callq 0x4050
jmp 0x12db3
movq -0xa8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xfc30
jmp 0x12db3
movq -0xa8(%rbp), %rax
testb $0x1, 0xb9(%rax)
je 0x12a40
movq -0xa8(%rbp), %rax
cmpl $0x3, 0xbc(%rax)
jae 0x12a9d
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
leaq 0x220b9(%rip), %rsi     # 0x34b0b
callq 0x4420
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
callq 0x4150
movq %rax, -0xc8(%rbp)
movq -0x10(%rbp), %rdi
addq $0x5, %rdi
movl $0xd, %esi
callq 0xf540
movq -0xc8(%rbp), %rsi
movq %rax, %rdx
leaq 0x2206c(%rip), %rdi     # 0x34afd
movb $0x0, %al
callq 0x4050
jmp 0x12db3
movq -0xa8(%rbp), %rax
cmpl $0x3, 0xbc(%rax)
jne 0x12b87
leaq -0x92(%rbp), %rdi
xorl %esi, %esi
movl $0x6, %edx
callq 0x41c0
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
leaq 0x2204e(%rip), %rsi     # 0x34b24
callq 0x4420
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
callq 0x4150
movq %rax, %rsi
leaq 0x215fa(%rip), %rdi     # 0x340ef
movb $0x0, %al
callq 0x4050
movq -0x10(%rbp), %rax
movl 0x5(%rax), %ecx
movl %ecx, -0x92(%rbp)
movb 0x9(%rax), %al
movb %al, -0x8e(%rbp)
leaq -0x92(%rbp), %rdi
callq 0x4180
cmpq $0x5, %rax
je 0x12b34
xorl %edi, %edi
leaq 0x2200a(%rip), %rsi     # 0x34b37
movb $0x0, %al
callq 0x47d0
leaq -0x92(%rbp), %rsi
leaq 0x22013(%rip), %rdi     # 0x34b55
movb $0x0, %al
callq 0x4050
movq -0x10(%rbp), %rax
movzbl 0xa(%rax), %esi
leaq 0x2201c(%rip), %rdi     # 0x34b74
movb $0x0, %al
callq 0x4050
movq -0x10(%rbp), %rdi
addq $0xb, %rdi
movl $0x7, %esi
callq 0xf540
movq %rax, %rsi
leaq 0x22027(%rip), %rdi     # 0x34ba2
movb $0x0, %al
callq 0x4050
jmp 0x12c97
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
leaq 0x2202c(%rip), %rsi     # 0x34bc5
callq 0x4420
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
callq 0x4150
movq %rax, %rsi
leaq 0x21537(%rip), %rdi     # 0x340ef
movb $0x0, %al
callq 0x4050
movq -0x10(%rbp), %rax
movzbl 0x5(%rax), %esi
movq -0x10(%rbp), %rax
movzbl 0x6(%rax), %edx
movq -0x10(%rbp), %rax
movzbl 0x7(%rax), %ecx
movq -0x10(%rbp), %rax
movzbl 0x8(%rax), %r8d
movq -0x10(%rbp), %rax
movzbl 0x9(%rax), %r9d
movq -0x10(%rbp), %rax
movzbl 0xa(%rax), %r11d
movq -0x10(%rbp), %rax
movzbl 0xb(%rax), %r10d
movq -0x10(%rbp), %rax
movzbl 0xc(%rax), %eax
leaq 0x21fce(%rip), %rdi     # 0x34bd8
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movb $0x0, %al
callq 0x4050
movq -0x10(%rbp), %rax
movzbl 0xd(%rax), %esi
leaq 0x22008(%rip), %rdi     # 0x34c35
movb $0x0, %al
callq 0x4050
movq -0x10(%rbp), %rax
movb 0xe(%rax), %cl
leaq 0x2202f(%rip), %rsi     # 0x34c71
leaq 0x1d270(%rip), %rax     # 0x2feb9
cmpb $0x0, %cl
cmovneq %rax, %rsi
leaq 0x21ff9(%rip), %rdi     # 0x34c50
movb $0x0, %al
callq 0x4050
movq -0x10(%rbp), %rax
movzbl 0xf(%rax), %eax
cmpl $0xa, %eax
jne 0x12c85
movq -0x10(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x20, %eax
jne 0x12c85
movq -0x10(%rbp), %rax
movzbl 0x11(%rax), %eax
cmpl $0x20, %eax
je 0x12c95
xorl %edi, %edi
leaq 0x21fe8(%rip), %rsi     # 0x34c76
movb $0x0, %al
callq 0x47d0
jmp 0x12c97
jmp 0x12db3
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
leaq 0x21fe0(%rip), %rsi     # 0x34c8e
callq 0x4420
movq -0x10(%rbp), %rdi
addq $0x5, %rdi
movl $0xd, %esi
callq 0xf540
movq %rax, %rcx
movq -0xa8(%rbp), %rax
movq %rcx, -0xa0(%rbp)
testb $0x1, 0x52(%rax)
je 0x12cff
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
callq 0x4150
movq %rax, %rsi
leaq 0x21fb6(%rip), %rdi     # 0x34cac
movb $0x0, %al
callq 0x4050
jmp 0x12d27
movq -0xa8(%rbp), %rdi
addq $0x30, %rdi
callq 0x4150
movq %rax, %rsi
movq -0xa0(%rbp), %rdx
leaq 0x21ddd(%rip), %rdi     # 0x34afd
movb $0x0, %al
callq 0x4050
movq -0xa8(%rbp), %rax
movb $0x1, 0x8f(%rax)
jmp 0x12db3
movq -0x10(%rbp), %rax
movzbl 0x3(%rax), %ecx
leaq 0x21fb0(%rip), %rsi     # 0x34cf6
leaq 0x21f92(%rip), %rax     # 0x34cdf
cmpl $0xf, %ecx
cmovleq %rax, %rsi
movq -0x10(%rbp), %rax
movzbl 0x3(%rax), %edx
leaq 0x21f56(%rip), %rdi     # 0x34cb9
movb $0x0, %al
callq 0x4050
movq -0x10(%rbp), %rsi
addq $0x2, %rsi
leaq 0x21a69(%rip), %rdi     # 0x347e2
movl $0x10, %r8d
movl $0x1, %ecx
movl %r8d, %edx
callq 0x7860
movq -0x10(%rbp), %rax
movzbl 0x3(%rax), %eax
cmpl $0xf, %eax
jle 0x12db1
movq -0x10(%rbp), %rax
movzbl 0x3(%rax), %edx
xorl %edi, %edi
leaq 0x21f54(%rip), %rsi     # 0x34cfe
movb $0x0, %al
callq 0x47d0
jmp 0x12db3
addq $0xe0, %rsp
popq %rbp
retq
movq -0x60(%rbp), %rdi
callq 0x4550
nopw %cs:(%rax,%rax)