// File: /workspace/github_cpp_makefile_star2_O3/rpavlik[P]edid-decode/parse-base-block.cpp
// Function: edid_state::parse_base_block(unsigned char const*)
void edid_state::parse_base_block(const unsigned char *x)
{
	time_t the_time;
	struct tm *ptm;
	int analog;
	unsigned col_x, col_y;
	bool has_preferred_timing = false;

	data_block = "EDID Structure Version & Revision";
	printf("  %s: %hhu.%hhu\n", data_block.c_str(), x[0x12], x[0x13]);
	if (x[0x12] == 1) {
		base.edid_minor = x[0x13];
		if (base.edid_minor > 4)
			warn("Unknown EDID minor version %u, assuming 1.4 conformance.\n", base.edid_minor);
		if (base.edid_minor < 3)
			warn("EDID 1.%u is deprecated, do not use.\n", base.edid_minor);
	} else {
		fail("Unknown EDID major version.\n");
	}

	data_block = "Vendor & Product Identification";
	printf("  %s:\n", data_block.c_str());
	printf("    Manufacturer: %s\n    Model: %u\n",
	       manufacturer_name(x + 0x08),
	       (unsigned short)(x[0x0a] + (x[0x0b] << 8)));
	base.has_serial_number = x[0x0c] || x[0x0d] || x[0x0e] || x[0x0f];
	if (base.has_serial_number) {
		if (hide_serial_numbers)
			printf("    Serial Number: ...\n");
		else
			printf("    Serial Number: %u\n",
			       (unsigned)(x[0x0c] + (x[0x0d] << 8) +
					  (x[0x0e] << 16) + (x[0x0f] << 24)));
	}

	time(&the_time);
	ptm = localtime(&the_time);

	unsigned char week = x[0x10];
	int year = 1990 + x[0x11];

	if (week) {
		if (base.edid_minor <= 3 && week == 0xff)
			fail("EDID 1.3 does not support week 0xff.\n");
		// The max week is 53 in EDID 1.3 and 54 in EDID 1.4.
		// No idea why there is a difference.
		if (base.edid_minor <= 3 && week == 54)
			fail("EDID 1.3 does not support week 54.\n");
		if (week != 0xff && week > 54)
			fail("Invalid week %u of manufacture.\n", week);
		if (week != 0xff)
			printf("    Made in: week %hhu of %d\n", week, year);
	}
	if (week == 0xff)
		printf("    Model year: %d\n", year);
	else if (!week)
		printf("    Made in: %d\n", year);
	if (year - 1 > ptm->tm_year + 1900)
		fail("The year %d is more than one year in the future.\n", year);

	/* display section */

	data_block = "Basic Display Parameters & Features";
	printf("  %s:\n", data_block.c_str());
	if (x[0x14] & 0x80) {
		analog = 0;
		printf("    Digital display\n");
		if (base.edid_minor >= 4) {
			if ((x[0x14] & 0x70) == 0x00)
				printf("    Color depth is undefined\n");
			else if ((x[0x14] & 0x70) == 0x70)
				fail("Color Bit Depth set to reserved value.\n");
			else
				printf("    Bits per primary color channel: %u\n",
				       ((x[0x14] & 0x70) >> 3) + 4);

			printf("    ");
			switch (x[0x14] & 0x0f) {
			case 0x00: printf("Digital interface is not defined\n"); break;
			case 0x01: printf("DVI interface\n"); break;
			case 0x02: printf("HDMI-a interface\n"); break;
			case 0x03: printf("HDMI-b interface\n"); break;
			case 0x04: printf("MDDI interface\n"); break;
			case 0x05: printf("DisplayPort interface\n"); break;
			default:
				   printf("Unknown interface: 0x%02x\n", x[0x14] & 0x0f);
				   fail("Digital Video Interface Standard set to reserved value 0x%02x.\n", x[0x14] & 0x0f);
				   break;
			}
		} else if (base.edid_minor >= 2) {
			if (x[0x14] & 0x01) {
				printf("    DFP 1.x compatible TMDS\n");
			}
			if (x[0x14] & 0x7e)
				fail("Digital Video Interface Standard set to reserved value 0x%02x.\n", x[0x14] & 0x7e);
		} else if (x[0x14] & 0x7f) {
			fail("Digital Video Interface Standard set to reserved value 0x%02x.\n", x[0x14] & 0x7f);
		}
	} else {
		unsigned voltage = (x[0x14] & 0x60) >> 5;
		unsigned sync = (x[0x14] & 0x0f);

		analog = 1;
		printf("    Analog display\n");
		printf("    Input voltage level: %s V\n",
		       voltage == 3 ? "0.7/0.7" :
		       voltage == 2 ? "1.0/0.4" :
		       voltage == 1 ? "0.714/0.286" :
		       "0.7/0.3");

		if (x[0x14] & 0x10)
			printf("    Blank-to-black setup/pedestal\n");
		else
			printf("    Blank level equals black level\n");

		if (sync)
			printf("    Sync:%s%s%s%s\n",
			       sync & 0x08 ? " Separate" : "",
			       sync & 0x04 ? " Composite" : "",
			       sync & 0x02 ? " SyncOnGreen" : "",
			       sync & 0x01 ? " Serration" : "");
	}

	if (x[0x15] && x[0x16]) {
		printf("    Maximum image size: %u cm x %u cm\n", x[0x15], x[0x16]);
		base.max_display_width_mm = x[0x15] * 10;
		base.max_display_height_mm = x[0x16] * 10;
		if (x[0x15] < 10 || x[0x16] < 10)
			warn("Dubious maximum image size (%ux%u is smaller than 10x10 cm).\n",
			     x[0x15], x[0x16]);
	}
	else if (base.edid_minor >= 4 && (x[0x15] || x[0x16])) {
		if (x[0x15])
			printf("    Aspect ratio: %.2f (landscape)\n", (x[0x15] + 99) / 100.0);
		else
			printf("    Aspect ratio: %.2f (portrait)\n", 100.0 / (x[0x16] + 99));
	} else {
		/* Either or both can be zero for 1.3 and before */
		printf("    Image size is variable\n");
	}

	if (x[0x17] == 0xff)
		printf("    Gamma is defined in an extension block\n");
	else
		printf("    Gamma: %.2f\n", ((x[0x17] + 100.0) / 100.0));

	if (x[0x18] & 0xe0) {
		printf("    DPMS levels:");
		if (x[0x18] & 0x80) printf(" Standby");
		if (x[0x18] & 0x40) printf(" Suspend");
		if (x[0x18] & 0x20) printf(" Off");
		printf("\n");
	}

	if (analog || base.edid_minor < 4) {
		printf("    ");
		switch (x[0x18] & 0x18) {
		case 0x00: printf("Monochrome or grayscale display\n"); break;
		case 0x08: printf("RGB color display\n"); break;
		case 0x10: printf("Non-RGB color display\n"); break;
		case 0x18: printf("Undefined display color type\n");
		}
	} else {
		printf("    Supported color formats: RGB 4:4:4");
		if (x[0x18] & 0x08)
			printf(", YCrCb 4:4:4");
		if (x[0x18] & 0x10)
			printf(", YCrCb 4:2:2");
		printf("\n");
	}

	if (x[0x18] & 0x04) {
		/*
		 * The sRGB chromaticities are (x, y):
		 * red:   0.640,  0.330
		 * green: 0.300,  0.600
		 * blue:  0.150,  0.060
		 * white: 0.3127, 0.3290
		 */
		static const unsigned char srgb_chromaticity[10] = {
			0xee, 0x91, 0xa3, 0x54, 0x4c, 0x99, 0x26, 0x0f, 0x50, 0x54
		};
		printf("    Default (sRGB) color space is primary color space\n");
		if (memcmp(x + 0x19, srgb_chromaticity, sizeof(srgb_chromaticity)))
			fail("sRGB is signaled, but the chromaticities do not match.\n");
	}
	if (base.edid_minor >= 4) {
		/* 1.4 always has a preferred timing and this bit means something else. */
		has_preferred_timing = true;
		base.preferred_is_also_native = x[0x18] & 0x02;
		printf("    First detailed timing %s the native pixel format and preferred refresh rate\n",
		       base.preferred_is_also_native ? "includes" : "does not include");
	} else {
		if (x[0x18] & 0x02) {
			printf("    First detailed timing is the preferred timing\n");
			has_preferred_timing = true;
			// 1.3 recommends that the preferred timing corresponds to the
			// native timing, but it is not a requirement.
			// That said, we continue with the assumption that it actually
			// is the native timing.
			base.preferred_is_also_native = true;
		} else if (base.edid_minor == 3) {
			fail("EDID 1.3 requires that the first detailed timing is the preferred timing.\n");
		}
	}

	if (x[0x18] & 0x01) {
		if (base.edid_minor >= 4) {
			base.supports_continuous_freq = true;
			printf("    Display is continuous frequency\n");
		} else {
			printf("    Supports GTF timings within operating range\n");
			base.supports_gtf = true;
		}
	}

	data_block = "Color Characteristics";
	printf("  %s:\n", data_block.c_str());
	col_x = (x[0x1b] << 2) | (x[0x19] >> 6);
	col_y = (x[0x1c] << 2) | ((x[0x19] >> 4) & 3);
	printf("    Red  : 0.%04u, 0.%04u\n",
	       (col_x * 10000) / 1024, (col_y * 10000) / 1024);
	col_x = (x[0x1d] << 2) | ((x[0x19] >> 2) & 3);
	col_y = (x[0x1e] << 2) | (x[0x19] & 3);
	printf("    Green: 0.%04u, 0.%04u\n",
	       (col_x * 10000) / 1024, (col_y * 10000) / 1024);
	col_x = (x[0x1f] << 2) | (x[0x1a] >> 6);
	col_y = (x[0x20] << 2) | ((x[0x1a] >> 4) & 3);
	printf("    Blue : 0.%04u, 0.%04u\n",
	       (col_x * 10000) / 1024, (col_y * 10000) / 1024);
	col_x = (x[0x21] << 2) | ((x[0x1a] >> 2) & 3);
	col_y = (x[0x22] << 2) | (x[0x1a] & 3);
	printf("    White: 0.%04u, 0.%04u\n",
	       (col_x * 10000) / 1024, (col_y * 10000) / 1024);

	data_block = "Established Timings I & II";
	if (x[0x23] || x[0x24] || x[0x25]) {
		printf("  %s:\n", data_block.c_str());
		for (unsigned i = 0; i < ARRAY_SIZE(established_timings12); i++) {
			if (x[0x23 + i / 8] & (1 << (7 - i % 8))) {
				unsigned char dmt_id = established_timings12[i].dmt_id;
				const struct timings *t;
				char type[16];

				if (dmt_id) {
					sprintf(type, "DMT 0x%02x", dmt_id);
					t = find_dmt_id(dmt_id);
				} else {
					t = &established_timings12[i].t;
					sprintf(type, "%-8s", established_timings12[i].type);
				}
				print_timings("    ", t, type);
			}
		}
	} else {
		printf("  %s: none\n", data_block.c_str());
	}
	base.has_640x480p60_est_timing = x[0x23] & 0x20;

	/*
	 * Need to find the Display Range Limit info before reading
	 * the standard timings.
	 */
	preparse_detailed_block(x + 0x36);
	preparse_detailed_block(x + 0x48);
	preparse_detailed_block(x + 0x5a);
	preparse_detailed_block(x + 0x6c);

	data_block = "Standard Timings";
	bool found = false;
	for (unsigned i = 0; i < 8; i++) {
		if (x[0x26 + i * 2] != 0x01 || x[0x26 + i * 2 + 1] != 0x01) {
			found = true;
			break;
		}
	}
	if (found) {
		printf("  %s:\n", data_block.c_str());
		for (unsigned i = 0; i < 8; i++)
			print_standard_timing("    ", x[0x26 + i * 2], x[0x26 + i * 2 + 1]);
	} else {
		printf("  %s: none\n", data_block.c_str());
	}

	/* 18 byte descriptors */
	if (has_preferred_timing && !x[0x36] && !x[0x37])
		fail("Missing preferred timing.\n");

	/* Look for SPWG Noteboook Panel EDID data blocks */
	if ((x[0x36] || x[0x37]) &&
	    (x[0x48] || x[0x49]) &&
	    !x[0x5a] && !x[0x5b] && x[0x5d] == 0xfe &&
	    !x[0x6c] && !x[0x6d] && x[0x6f] == 0xfe &&
	    (x[0x79] == 1 || x[0x79] == 2) && x[0x7a] <= 1)
		base.has_spwg = true;

	for (unsigned i = 0; i < (base.has_spwg ? 2 : 4); i++)
		if (x[0x36 + i * 18] || x[0x37 + i * 18])
			cta.preparsed_total_dtds++;

	data_block = "Detailed Timing Descriptors";
	printf("  %s:\n", data_block.c_str());
	detailed_block(x + 0x36);
	detailed_block(x + 0x48);
	detailed_block(x + 0x5a);
	detailed_block(x + 0x6c);
	base.has_spwg = false;
	if (!base.preferred_is_also_native) {
		cta.native_timings.clear();
		base.preferred_timing = timings_ext();
	}

	data_block = block;
	if (x[0x7e])
		printf("  Extension blocks: %u\n", x[0x7e]);
	if (x[0x7e] + 1U != num_blocks)
		fail("EDID specified %u extension block(s), but found %u extension block(s).\n",
		     x[0x7e], num_blocks - 1);

	block = block_name(0x00);
	data_block.clear();
	do_checksum("", x, EDID_PAGE_SIZE);
	if (base.edid_minor >= 3) {
		if (!base.has_name_descriptor)
			fail("Missing Display Product Name.\n");
		if ((base.edid_minor == 3 || base.supports_continuous_freq) &&
		    !base.has_display_range_descriptor)
			fail("Missing Display Range Limits Descriptor.\n");
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rsi, %rbx
movq %rdi, %r14
addq $0x30, %rdi
movq 0x38(%r14), %rdx
leaq 0x191b2(%rip), %rcx     # 0x259ce
movl $0x21, %r8d
movq %rdi, 0x10(%rsp)
xorl %esi, %esi
callq 0x3390
movq 0x30(%r14), %rsi
movzbl 0x12(%rbx), %edx
movzbl 0x13(%rbx), %ecx
leaq 0x191af(%rip), %rdi     # 0x259f0
xorl %eax, %eax
callq 0x3030
cmpb $0x1, 0x12(%rbx)
jne 0xc892
movzbl 0x13(%rbx), %edx
movl %edx, 0x88(%r14)
cmpl $0x5, %edx
jb 0xc878
leaq 0x1919c(%rip), %rsi     # 0x25a01
movl $0x1, %edi
xorl %eax, %eax
callq 0x37cc
movl 0x88(%r14), %edx
cmpl $0x2, %edx
ja 0xc8a2
leaq 0x191b7(%rip), %rsi     # 0x25a3b
movl $0x1, %edi
xorl %eax, %eax
callq 0x37cc
jmp 0xc8a2
leaq 0x191c8(%rip), %rsi     # 0x25a61
xorl %edi, %edi
xorl %eax, %eax
callq 0x37cc
movq 0x38(%r14), %rdx
leaq 0x191d1(%rip), %rcx     # 0x25a7e
movl $0x1f, %r8d
movq 0x10(%rsp), %rdi
xorl %esi, %esi
callq 0x3390
movq 0x30(%r14), %rsi
leaq 0x18541(%rip), %rdi     # 0x24e0b
xorl %eax, %eax
callq 0x3030
movzbl 0x8(%rbx), %eax
movl %eax, %edi
shrl $0x2, %edi
andl $0x1f, %edi
orl $0x40, %edi
movb %dil, 0x3a959(%rip)     # 0x47240
andl $0x3, %eax
movq %rbx, 0x20(%rsp)
movzbl 0x9(%rbx), %ebp
movl %ebp, %ecx
shrl $0x5, %ecx
leal (%rcx,%rax,8), %ebx
addl $0x40, %ebx
movb %bl, 0x3a93d(%rip)      # 0x47241
andl $0x1f, %ebp
orl $0x40, %ebp
movb %bpl, 0x3a931(%rip)     # 0x47242
movb $0x0, 0x3a92b(%rip)     # 0x47243
callq 0x3190
testl %eax, %eax
je 0xc937
movl %ebx, %edi
callq 0x3190
testl %eax, %eax
je 0xc937
movl %ebp, %edi
callq 0x3190
testl %eax, %eax
jne 0xc947
leaq 0x19a55(%rip), %rsi     # 0x26393
xorl %edi, %edi
xorl %eax, %eax
callq 0x37cc
movq 0x20(%rsp), %r13
movzwl 0xa(%r13), %edx
leaq 0x19146(%rip), %rdi     # 0x25a9e
leaq 0x3a8e1(%rip), %rsi     # 0x47240
xorl %eax, %eax
callq 0x3030
cmpb $0x0, 0xc(%r13)
jne 0xc97f
cmpb $0x0, 0xd(%r13)
jne 0xc97f
cmpb $0x0, 0xe(%r13)
je 0xcca4
leaq 0x88(%r14), %rax
movq %rax, 0x30(%rsp)
movb $0x1, 0x8e(%r14)
cmpb $0x1, 0x52(%r14)
jne 0xc9a8
leaq 0x19bfb(%rip), %rdi     # 0x2659c
callq 0x3380
jmp 0xc9ba
movl 0xc(%r13), %esi
leaq 0x1910f(%rip), %rdi     # 0x25ac2
xorl %eax, %eax
callq 0x3030
movq %r14, 0x28(%rsp)
leaq 0x48(%rsp), %rbx
movq %rbx, %rdi
callq 0x3210
movq %rbx, %rdi
callq 0x3180
movq %rax, %r15
movzbl 0x10(%r13), %r12d
movzbl 0x11(%r13), %ebx
leal 0x7c6(%rbx), %ebp
testl %r12d, %r12d
je 0xca2b
movq 0x30(%rsp), %r13
movl (%r13), %eax
cmpl $0x4, %eax
setae %cl
cmpl $0xff, %r12d
setne %dl
orb %cl, %dl
jne 0xca42
leaq 0x190c9(%rip), %rsi     # 0x25ad9
xorl %edi, %edi
xorl %eax, %eax
callq 0x37cc
leaq 0x19142(%rip), %rdi     # 0x25b62
movl %ebp, %esi
xorl %eax, %eax
callq 0x3030
jmp 0xca9f
leaq 0x19144(%rip), %rdi     # 0x25b76
movl %ebp, %esi
xorl %eax, %eax
callq 0x3030
movq 0x30(%rsp), %r13
jmp 0xca9f
cmpl $0x4, %eax
setae %al
cmpl $0x36, %r12d
setne %cl
orb %al, %cl
jne 0xca65
leaq 0x190a5(%rip), %rsi     # 0x25aff
xorl %edi, %edi
xorl %eax, %eax
callq 0x37cc
jmp 0xca8c
leal -0x37(%r12), %eax
cmpb $-0x39, %al
ja 0xca83
leaq 0x190ae(%rip), %rsi     # 0x25b23
xorl %edi, %edi
movl %r12d, %edx
xorl %eax, %eax
callq 0x37cc
jmp 0xca8c
cmpl $0xff, %r12d
je 0xca19
leaq 0x190b1(%rip), %rdi     # 0x25b44
movl %r12d, %esi
movl %ebp, %edx
xorl %eax, %eax
callq 0x3030
addl $0x59, %ebx
cmpl 0x14(%r15), %ebx
jle 0xcaba
leaq 0x190d8(%rip), %rsi     # 0x25b87
xorl %edi, %edi
movl %ebp, %edx
xorl %eax, %eax
callq 0x37cc
movq 0x28(%rsp), %r14
movq 0x38(%r14), %rdx
leaq 0x190ef(%rip), %rcx     # 0x25bb9
movl $0x23, %r8d
movq 0x10(%rsp), %rdi
xorl %esi, %esi
callq 0x3390
movq 0x30(%r14), %rsi
leaq 0x18324(%rip), %rdi     # 0x24e0b
xorl %eax, %eax
callq 0x3030
movq 0x20(%rsp), %r15
movsbl 0x14(%r15), %ebx
testl %ebx, %ebx
js 0xcb20
movl %ebx, %ebp
shrl $0x5, %ebp
leaq 0x19aab(%rip), %rdi     # 0x265b3
callq 0x3380
cmpl $0x2, %ebp
je 0xcb63
cmpl $0x3, %ebp
jne 0xcb6c
leaq 0x19189(%rip), %rsi     # 0x25ca7
jmp 0xcb81
leaq 0x19ae4(%rip), %rdi     # 0x2660b
callq 0x3380
movl (%r13), %ecx
cmpl $0x4, %ecx
jb 0xcc0b
movzbl 0x14(%r15), %esi
andl $0x70, %esi
cmpl $0x70, %esi
je 0xcc49
testl %esi, %esi
jne 0xcc5b
leaq 0x19ae2(%rip), %rdi     # 0x2663b
callq 0x3380
jmp 0xcc6f
leaq 0x19145(%rip), %rsi     # 0x25caf
jmp 0xcb81
cmpl $0x1, %ebp
leaq 0x19141(%rip), %rax     # 0x25cb7
leaq 0x19146(%rip), %rsi     # 0x25cc3
cmoveq %rax, %rsi
leaq 0x19100(%rip), %rdi     # 0x25c88
xorl %eax, %eax
callq 0x3030
movq 0x20(%rsp), %r15
testb $0x10, 0x14(%r15)
leaq 0x19a26(%rip), %rax     # 0x265c6
leaq 0x19a42(%rip), %rdi     # 0x265e9
cmoveq %rax, %rdi
callq 0x3380
testb $0xf, %bl
je 0xcd20
testb $0x8, %bl
leaq 0x140c6(%rip), %rax     # 0x20c89
leaq 0x24993(%rip), %rsi     # 0x3155d
cmoveq %rax, %rsi
testb $0x4, %bl
leaq 0x19106(%rip), %rdx     # 0x25cde
cmoveq %rax, %rdx
testb $0x2, %bl
leaq 0x19103(%rip), %rcx     # 0x25ce9
cmoveq %rax, %rcx
testb $0x1, %bl
leaq 0x19102(%rip), %r8      # 0x25cf6
cmoveq %rax, %r8
leaq 0x190cc(%rip), %rdi     # 0x25ccb
xorl %eax, %eax
callq 0x3030
jmp 0xcd20
movb 0x14(%r15), %al
cmpl $0x2, %ecx
jb 0xcc38
testb $0x1, %al
je 0xcc28
leaq 0x19a00(%rip), %rdi     # 0x2661f
callq 0x3380
movb 0x14(%r15), %al
andb $0x7e, %al
je 0xcd20
movzbl %al, %edx
jmp 0xcd10
movzbl %al, %edx
andl $0x7f, %edx
jne 0xcd10
jmp 0xcd20
leaq 0x18f8d(%rip), %rsi     # 0x25bdd
xorl %edi, %edi
xorl %eax, %eax
callq 0x37cc
jmp 0xcc6f
shrl $0x3, %esi
addl $0x4, %esi
leaq 0x18f9d(%rip), %rdi     # 0x25c05
xorl %eax, %eax
callq 0x3030
leaq 0x18821(%rip), %rdi     # 0x25497
xorl %eax, %eax
callq 0x3030
movzbl 0x14(%r15), %esi
andl $0xf, %esi
cmpb $0x5, %sil
ja 0xccfa
leaq 0x158ae(%rip), %rax     # 0x22540
movslq (%rax,%rsi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0x19a0b(%rip), %rdi     # 0x266ad
jmp 0xccf3
cmpb $0x0, 0xf(%r13)
leaq 0x88(%r14), %rax
movq %rax, 0x30(%rsp)
setne 0x8e(%r14)
jne 0xc993
jmp 0xc9ba
leaq 0x1999f(%rip), %rdi     # 0x2666e
jmp 0xccf3
leaq 0x199b6(%rip), %rdi     # 0x2668e
jmp 0xccf3
leaq 0x1999c(%rip), %rdi     # 0x2667d
jmp 0xccf3
leaq 0x199b5(%rip), %rdi     # 0x2669f
jmp 0xccf3
leaq 0x19965(%rip), %rdi     # 0x26658
callq 0x3380
jmp 0xcd20
leaq 0x18f2c(%rip), %rdi     # 0x25c2d
xorl %eax, %eax
callq 0x3030
movzbl 0x14(%r15), %edx
andl $0xf, %edx
leaq 0x18f31(%rip), %rsi     # 0x25c48
xorl %edi, %edi
xorl %eax, %eax
callq 0x37cc
movzbl 0x15(%r15), %esi
testl %esi, %esi
je 0xcd9c
movzbl 0x16(%r15), %edx
testl %edx, %edx
je 0xcdc8
leaq 0x18fc4(%rip), %rdi     # 0x25d01
xorl %eax, %eax
callq 0x3030
movzbl 0x15(%r15), %eax
addl %eax, %eax
leal (%rax,%rax,4), %eax
movl %eax, 0x174(%r14)
movzbl 0x16(%r15), %eax
addl %eax, %eax
leal (%rax,%rax,4), %eax
movl %eax, 0x178(%r14)
movzbl 0x15(%r15), %edx
cmpl $0xa, %edx
setb %cl
movb 0x16(%r15), %al
cmpb $0xa, %al
setb %sil
orb %cl, %sil
cmpb $0x1, %sil
jne 0xcdfa
movzbl %al, %ecx
leaq 0x18f9a(%rip), %rsi     # 0x25d28
movl $0x1, %edi
xorl %eax, %eax
callq 0x37cc
jmp 0xcdfa
cmpl $0x3, (%r13)
jbe 0xcdee
movzbl 0x16(%r15), %eax
testl %eax, %eax
je 0xcdee
addl $0x63, %eax
cvtsi2sd %eax, %xmm1
movsd 0x13265(%rip), %xmm0    # 0x20020
divsd %xmm1, %xmm0
leaq 0x18fc4(%rip), %rdi     # 0x25d8a
jmp 0xcde5
cmpl $0x3, (%r13)
jbe 0xcdee
addl $0x63, %esi
cvtsi2sd %esi, %xmm0
divsd 0x13242(%rip), %xmm0    # 0x20020
leaq 0x18f81(%rip), %rdi     # 0x25d66
movb $0x1, %al
callq 0x3030
jmp 0xcdfa
leaq 0x198d9(%rip), %rdi     # 0x266ce
callq 0x3380
movb 0x17(%r15), %al
cmpb $-0x1, %al
je 0xce2c
movzbl %al, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd 0x1320c(%rip), %xmm1    # 0x20020
addsd %xmm1, %xmm0
divsd %xmm1, %xmm0
leaq 0x18f8a(%rip), %rdi     # 0x25dad
movb $0x1, %al
callq 0x3030
jmp 0xce38
leaq 0x198b6(%rip), %rdi     # 0x266e9
callq 0x3380
cmpb $0x20, 0x18(%r15)
jb 0xce99
leaq 0x18f78(%rip), %rdi     # 0x25dbe
xorl %eax, %eax
callq 0x3030
movb 0x18(%r15), %al
testb %al, %al
jns 0xce67
leaq 0x18f73(%rip), %rdi     # 0x25dcf
xorl %eax, %eax
callq 0x3030
movb 0x18(%r15), %al
testb $0x40, %al
je 0xce7d
leaq 0x18f66(%rip), %rdi     # 0x25dd8
xorl %eax, %eax
callq 0x3030
movb 0x18(%r15), %al
testb $0x20, %al
je 0xce8f
leaq 0x18f59(%rip), %rdi     # 0x25de1
xorl %eax, %eax
callq 0x3030
movl $0xa, %edi
callq 0x3310
testb %bl, %bl
jns 0xceea
cmpl $0x3, (%r13)
jbe 0xceea
leaq 0x18f3b(%rip), %rdi     # 0x25de6
xorl %eax, %eax
callq 0x3030
movb 0x18(%r15), %al
testb $0x8, %al
je 0xcecc
leaq 0x18f4c(%rip), %rdi     # 0x25e0d
xorl %eax, %eax
callq 0x3030
movb 0x18(%r15), %al
testb $0x10, %al
je 0xcede
leaq 0x18f44(%rip), %rdi     # 0x25e1b
xorl %eax, %eax
callq 0x3030
movl $0xa, %edi
callq 0x3310
jmp 0xcf3a
leaq 0x185a6(%rip), %rdi     # 0x25497
xorl %eax, %eax
callq 0x3030
movzbl 0x18(%r15), %eax
shrl $0x3, %eax
andl $0x3, %eax
leaq 0x1564e(%rip), %rcx     # 0x22558
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x1982d(%rip), %rdi     # 0x26747
jmp 0xcf35
leaq 0x1980e(%rip), %rdi     # 0x26731
jmp 0xcf35
leaq 0x197e8(%rip), %rdi     # 0x26714
jmp 0xcf35
leaq 0x19800(%rip), %rdi     # 0x26735
callq 0x3380
testb $0x4, 0x18(%r15)
je 0xcf7c
leaq 0x1981f(%rip), %rdi     # 0x26767
callq 0x3380
movabsq $0xf26994c54a391ee, %rax # imm = 0xF26994C54A391EE
xorq 0x19(%r15), %rax
movzwl 0x21(%r15), %ecx
xorq $0x5450, %rcx           # imm = 0x5450
orq %rax, %rcx
je 0xcf7c
leaq 0x18eb6(%rip), %rsi     # 0x25e29
xorl %edi, %edi
xorl %eax, %eax
callq 0x37cc
movl (%r13), %eax
movb 0x18(%r15), %cl
andb $0x2, %cl
cmpl $0x4, %eax
jb 0xcfbb
movl %ecx, %eax
shrb %al
testb %cl, %cl
movb %al, 0xc6(%r14)
leaq 0x18f1b(%rip), %rax     # 0x25ebb
leaq 0x18f0b(%rip), %rsi     # 0x25eb2
cmoveq %rax, %rsi
leaq 0x18eaf(%rip), %rdi     # 0x25e61
xorl %eax, %eax
callq 0x3030
jmp 0xcff6
testb %cl, %cl
jne 0xcfe2
cmpl $0x3, %eax
jne 0xd6dc
leaq 0x18efd(%rip), %rsi     # 0x25ecc
movl $0x0, 0x1c(%rsp)
xorl %edi, %edi
xorl %eax, %eax
callq 0x37cc
jmp 0xcffc
leaq 0x197b4(%rip), %rdi     # 0x2679d
callq 0x3380
movb $0x1, 0xc6(%r14)
movb $0x1, %al
movl %eax, 0x1c(%rsp)
testb $0x1, 0x18(%r15)
je 0xd034
cmpl $0x4, (%r13)
jb 0xd020
movb $0x1, 0x90(%r14)
leaq 0x197e6(%rip), %rdi     # 0x267ff
callq 0x3380
jmp 0xd034
leaq 0x197a8(%rip), %rdi     # 0x267cf
callq 0x3380
movb $0x1, 0x91(%r14)
movq 0x38(%r14), %rdx
leaq 0x18ed8(%rip), %rcx     # 0x25f17
movl $0x15, %r8d
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3390
movq 0x30(%r14), %rsi
leaq 0x17dac(%rip), %rdi     # 0x24e0b
xorl %eax, %eax
callq 0x3030
movzbl 0x1b(%r15), %eax
movzbl 0x19(%r15), %ecx
movl %ecx, %edx
shrl $0x6, %edx
leal (%rdx,%rax,4), %eax
movzbl 0x1c(%r15), %edx
shrl $0x4, %ecx
andl $0x3, %ecx
leal (%rcx,%rdx,4), %ecx
imull $0x2710, %eax, %esi     # imm = 0x2710
shrl $0xa, %esi
imull $0x2710, %ecx, %edx     # imm = 0x2710
shrl $0xa, %edx
leaq 0x18e8e(%rip), %rdi     # 0x25f2d
xorl %eax, %eax
callq 0x3030
movzbl 0x1d(%r15), %eax
movzbl 0x19(%r15), %ecx
movl %ecx, %edx
shrl $0x2, %edx
andl $0x3, %edx
leal (%rdx,%rax,4), %eax
movzbl 0x1e(%r15), %edx
andl $0x3, %ecx
leal (%rcx,%rdx,4), %ecx
imull $0x2710, %eax, %esi     # imm = 0x2710
shrl $0xa, %esi
imull $0x2710, %ecx, %edx     # imm = 0x2710
shrl $0xa, %edx
leaq 0x18e69(%rip), %rdi     # 0x25f48
xorl %eax, %eax
callq 0x3030
movzbl 0x1f(%r15), %eax
movzbl 0x1a(%r15), %ecx
movl %ecx, %edx
shrl $0x6, %edx
leal (%rdx,%rax,4), %eax
movzbl 0x20(%r15), %edx
shrl $0x4, %ecx
andl $0x3, %ecx
leal (%rcx,%rdx,4), %ecx
imull $0x2710, %eax, %esi     # imm = 0x2710
shrl $0xa, %esi
imull $0x2710, %ecx, %edx     # imm = 0x2710
shrl $0xa, %edx
leaq 0x18e44(%rip), %rdi     # 0x25f63
xorl %eax, %eax
callq 0x3030
movzbl 0x21(%r15), %eax
movzbl 0x1a(%r15), %ecx
movl %ecx, %edx
shrl $0x2, %edx
andl $0x3, %edx
leal (%rdx,%rax,4), %eax
movzbl 0x22(%r15), %edx
andl $0x3, %ecx
leal (%rcx,%rdx,4), %ecx
imull $0x2710, %eax, %esi     # imm = 0x2710
shrl $0xa, %esi
imull $0x2710, %ecx, %edx     # imm = 0x2710
shrl $0xa, %edx
leaq 0x18e1f(%rip), %rdi     # 0x25f7e
xorl %eax, %eax
callq 0x3030
movq 0x38(%r14), %rdx
leaq 0x18e28(%rip), %rcx     # 0x25f99
movl $0x1a, %r8d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3390
cmpb $0x0, 0x23(%r15)
jne 0xd19a
cmpb $0x0, 0x24(%r15)
jne 0xd19a
cmpb $0x0, 0x25(%r15)
je 0xd6e9
movq 0x10(%rsp), %rax
movq (%rax), %rsi
leaq 0x17c62(%rip), %rdi     # 0x24e0b
xorl %eax, %eax
callq 0x3030
leaq 0x2c459(%rip), %r14     # 0x39610
leaq 0x50(%rsp), %r12
leaq 0x153ad(%rip), %r13     # 0x22570
xorl %ebp, %ebp
movl %ebp, %eax
shrl $0x3, %eax
movq 0x20(%rsp), %rcx
movzbl 0x23(%rcx,%rax), %eax
movl %ebp, %ecx
notb %cl
movzbl %cl, %ecx
andl $0x7, %ecx
btl %ecx, %eax
jae 0xd279
leaq (,%rbp,2), %r15
addq %rbp, %r15
shlq $0x5, %r15
movzbl (%r15,%r14), %ebx
testl %ebx, %ebx
je 0xd22b
movq %r12, %rdi
leaq 0x136d6(%rip), %rsi     # 0x208df
movl %ebx, %edx
xorl %eax, %eax
callq 0x3070
xorl %eax, %eax
cmpl %ebx, (%rax,%r13)
je 0xd249
addq $0x60, %rax
cmpq $0x2100, %rax           # imm = 0x2100
jne 0xd214
xorl %r15d, %r15d
jmp 0xd251
addq %r14, %r15
movq 0x58(%r15), %rdx
addq $0x4, %r15
movq %r12, %rdi
leaq 0x174e0(%rip), %rsi     # 0x24720
xorl %eax, %eax
callq 0x3070
jmp 0xd251
leaq (%rax,%r13), %r15
addq $0xc, %r15
movl $0x1, (%rsp)
movq 0x28(%rsp), %rdi
leaq 0x18233(%rip), %rsi     # 0x25497
movq %r15, %rdx
movq %r12, %rcx
leaq 0x13a18(%rip), %r8      # 0x20c89
xorl %r9d, %r9d
callq 0x3e8c
incq %rbp
cmpq $0x11, %rbp
jne 0xd1c5
movq 0x20(%rsp), %rbp
movb 0x23(%rbp), %al
shrb $0x5, %al
andb $0x1, %al
movq 0x28(%rsp), %r15
movb %al, 0xc5(%r15)
leaq 0x36(%rbp), %rsi
movq %r15, %rdi
movq %rsi, 0x38(%rsp)
callq 0xbd4c
leaq 0x48(%rbp), %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0xbd4c
leaq 0x5a(%rbp), %r13
movq %r15, %rdi
movq %r13, %rsi
callq 0xbd4c
leaq 0x6c(%rbp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0xbd4c
movq 0x38(%r15), %rdx
leaq 0x18cd8(%rip), %rcx     # 0x25fc0
movl $0x10, %r8d
movq 0x10(%rsp), %rdi
xorl %esi, %esi
callq 0x3390
movl $0x27, %eax
movq %r12, 0x40(%rsp)
cmpb $0x1, -0x1(%rbp,%rax)
jne 0xd337
cmpb $0x1, (%rbp,%rax)
jne 0xd337
addq $0x2, %rax
cmpq $0x37, %rax
jne 0xd304
movq %r14, %r12
movq 0x10(%rsp), %rax
movq (%rax), %rsi
leaq 0x18c86(%rip), %rdi     # 0x25fb4
xorl %eax, %eax
callq 0x3030
jmp 0xd380
movq %r14, %r12
movq 0x10(%rsp), %rax
movq (%rax), %rsi
leaq 0x17ac2(%rip), %rdi     # 0x24e0b
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x3030
leaq 0x1813d(%rip), %rbx     # 0x25497
movzbl 0x26(%rbp,%r14,2), %edx
movzbl 0x27(%rbp,%r14,2), %ecx
movq %r15, %rdi
movq %rbx, %rsi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xa024
incq %r14
cmpq $0x8, %r14
jne 0xd35a
movq 0x38(%rsp), %rax
movb (%rax), %al
cmpb $0x0, 0x1c(%rsp)
je 0xd3b9
testb %al, %al
movq %r12, %r14
movq 0x40(%rsp), %r12
jne 0xd3cb
cmpb $0x0, 0x37(%rbp)
jne 0xd3c5
leaq 0x18c2a(%rip), %rsi     # 0x25fd1
xorl %edi, %edi
xorl %eax, %eax
callq 0x37cc
movq 0x38(%rsp), %rax
movb (%rax), %al
jmp 0xd3c1
movq %r12, %r14
movq 0x40(%rsp), %r12
testb %al, %al
jne 0xd3cb
cmpb $0x0, 0x37(%rbp)
je 0xd414
cmpb $0x0, (%r14)
jne 0xd3d7
cmpb $0x0, 0x49(%rbp)
je 0xd414
cmpb $0x0, (%r13)
jne 0xd414
cmpb $0x0, 0x5b(%rbp)
jne 0xd414
cmpb $-0x2, 0x5d(%rbp)
jne 0xd414
cmpb $0x0, (%r12)
jne 0xd414
cmpb $0x0, 0x6d(%rbp)
jne 0xd414
cmpb $-0x2, 0x6f(%rbp)
jne 0xd414
movb 0x79(%rbp), %al
decb %al
cmpb $0x1, %al
ja 0xd414
cmpb $0x1, 0x7a(%rbp)
ja 0xd414
movb $0x1, 0xb9(%r15)
movzbl 0xb9(%r15), %ecx
movl 0x180(%r15), %eax
xorl $0x1, %ecx
leaq 0x2(,%rcx,2), %rcx
leaq 0x37(%rbp), %rdx
cmpb $0x0, -0x1(%rdx)
jne 0xd43d
cmpb $0x0, (%rdx)
je 0xd446
incl %eax
movl %eax, 0x180(%r15)
addq $0x12, %rdx
decq %rcx
jne 0xd432
movq 0x38(%r15), %rdx
leaq 0x18b92(%rip), %rcx     # 0x25fec
xorl %ebp, %ebp
movl $0x1b, %r8d
movq 0x10(%rsp), %rdi
xorl %esi, %esi
callq 0x3390
movq 0x30(%r15), %rsi
leaq 0x17992(%rip), %rdi     # 0x24e0b
xorl %eax, %eax
callq 0x3030
movq %r15, %rdi
movq 0x38(%rsp), %rsi
callq 0xbe42
movq %r15, %rdi
movq %r14, %rsi
callq 0xbe42
movq %r15, %rdi
movq %r13, %rsi
callq 0xbe42
movq %r15, %rdi
movq %r12, %rsi
callq 0xbe42
movb $0x0, 0xb9(%r15)
cmpb $0x0, 0xc6(%r15)
movq 0x30(%rsp), %r13
jne 0xd5ca
leaq 0x2a8(%r15), %rdi
movq 0x2a8(%r15), %rsi
callq 0xdf82
leaq 0xa8(%rsp), %rsi
leaq 0xb8(%rsp), %r14
movq %r14, -0x10(%r14)
movq %rbp, -0x8(%r14)
movb %bpl, (%r14)
leaq 0xc8(%rsp), %rbx
leaq 0xd8(%rsp), %r12
movq %r12, -0x10(%r12)
movq %rbp, -0x8(%r12)
movb %bpl, (%r12)
xorpd %xmm0, %xmm0
movapd %xmm0, -0x78(%rbx)
movapd %xmm0, -0x78(%r12)
movapd %xmm0, -0x68(%r12)
movapd %xmm0, -0x58(%r12)
movapd %xmm0, -0x48(%r12)
movl %ebp, -0x38(%r12)
movl %ebp, 0x118(%r15)
movupd %xmm0, 0x108(%r15)
movupd %xmm0, 0xf8(%r15)
movupd %xmm0, 0xe8(%r15)
movupd %xmm0, 0xd8(%r15)
movupd %xmm0, 0xc8(%r15)
leaq 0x120(%r15), %rdi
callq 0x32d0
leaq 0x140(%r15), %rdi
movq %rbx, %rsi
callq 0x32d0
movq -0x10(%r12), %rdi
cmpq %r12, %rdi
je 0xd5a8
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0xa8(%rsp), %rdi
cmpq %r14, %rdi
je 0xd5c5
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x28(%rsp), %r15
leaq 0x10(%r15), %r12
movq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x3140
movq 0x20(%rsp), %rbx
movzbl 0x7e(%rbx), %esi
testl %esi, %esi
je 0xd5fa
leaq 0x18a19(%rip), %rdi     # 0x26008
xorl %eax, %eax
callq 0x3030
movzbl 0x7e(%rbx), %ebp
leal 0x1(%rbp), %eax
movq 0x28(%rsp), %rcx
movl 0x4(%rcx), %ecx
cmpl %ecx, %eax
je 0xd61d
decl %ecx
leaq 0x18a0e(%rip), %rsi     # 0x26020
xorl %edi, %edi
movl %ebp, %edx
xorl %eax, %eax
callq 0x37cc
leaq 0x50(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5d3e
movq %r12, %rdi
movq %rbx, %rsi
callq 0x32d0
movq (%rbx), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0xd651
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3260
movq 0x28(%rsp), %rbx
movq $0x0, 0x38(%rbx)
movq 0x30(%rbx), %rax
movb $0x0, (%rax)
leaq 0x1361d(%rip), %rdi     # 0x20c89
movl $0x80, %edx
movq 0x20(%rsp), %rsi
callq 0x3b70
movl 0x88(%rbx), %eax
cmpl $0x3, %eax
jb 0xd6ca
cmpb $0x0, 0x8c(%rbx)
jne 0xd6a3
leaq 0x189d2(%rip), %rsi     # 0x26068
xorl %edi, %edi
xorl %eax, %eax
callq 0x37cc
movl (%r13), %eax
cmpl $0x3, %eax
je 0xd6b1
cmpb $0x1, 0x90(%rbx)
jne 0xd6ca
cmpb $0x0, 0x8d(%rbx)
jne 0xd6ca
leaq 0x189c6(%rip), %rsi     # 0x26087
xorl %edi, %edi
xorl %eax, %eax
callq 0x37cc
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x0, 0x1c(%rsp)
jmp 0xcffc
movq 0x10(%rsp), %rax
movq (%rax), %rsi
leaq 0x188bc(%rip), %rdi     # 0x25fb4
xorl %eax, %eax
callq 0x3030
jmp 0xd286