// File: /workspace/github_cpp_makefile_star2_O2/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 $0xd8, %rsp
movq %rsi, %r14
movq %rdi, %r15
leaq 0x30(%rdi), %r13
leaq 0x15016(%rip), %rsi     # 0x1f9ce
movq %r13, %rdi
callq 0x3460
movq 0x30(%r15), %rsi
movzbl 0x12(%r14), %edx
movzbl 0x13(%r14), %ecx
leaq 0x1501b(%rip), %rdi     # 0x1f9f0
xorl %eax, %eax
callq 0x3030
cmpb $0x1, 0x12(%r14)
jne 0xaa24
movzbl 0x13(%r14), %edx
movl %edx, 0x88(%r15)
cmpl $0x5, %edx
jb 0xaa0c
leaq 0x15006(%rip), %rsi     # 0x1fa01
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x362c
movl 0x88(%r15), %edx
cmpl $0x2, %edx
ja 0xaa34
leaq 0x15023(%rip), %rsi     # 0x1fa3b
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x362c
jmp 0xaa34
leaq 0x15036(%rip), %rsi     # 0x1fa61
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
leaq 0x15043(%rip), %rsi     # 0x1fa7e
movq %r13, %rdi
callq 0x3460
movq (%r13), %rsi
leaq 0x143bd(%rip), %rdi     # 0x1ee0b
xorl %eax, %eax
callq 0x3030
movzbl 0x8(%r14), %eax
movl %eax, %edi
shrl $0x2, %edi
andl $0x1f, %edi
orl $0x40, %edi
movb %dil, 0x367f4(%rip)     # 0x41260
andl $0x3, %eax
movzbl 0x9(%r14), %ebp
movl %ebp, %ecx
shrl $0x5, %ecx
leal (%rcx,%rax,8), %ebx
addl $0x40, %ebx
movb %bl, 0x367dc(%rip)      # 0x41261
andl $0x1f, %ebp
orl $0x40, %ebp
movb %bpl, 0x367d0(%rip)     # 0x41262
movb $0x0, 0x367ca(%rip)     # 0x41263
callq 0x31b0
testl %eax, %eax
je 0xaab8
movl %ebx, %edi
callq 0x31b0
testl %eax, %eax
je 0xaab8
movl %ebp, %edi
callq 0x31b0
testl %eax, %eax
jne 0xaac8
leaq 0x158d4(%rip), %rsi     # 0x20393
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
movzwl 0xa(%r14), %edx
leaq 0x14fca(%rip), %rdi     # 0x1fa9e
leaq 0x36785(%rip), %rsi     # 0x41260
xorl %eax, %eax
callq 0x3030
cmpb $0x0, 0xc(%r14)
jne 0xaafb
cmpb $0x0, 0xd(%r14)
jne 0xaafb
cmpb $0x0, 0xe(%r14)
je 0xadfd
leaq 0x88(%r15), %rbx
movb $0x1, 0x8e(%r15)
cmpb $0x1, 0x52(%r15)
jne 0xab1f
leaq 0x15a84(%rip), %rdi     # 0x2059c
callq 0x33b0
jmp 0xab31
movl 0xc(%r14), %esi
leaq 0x14f98(%rip), %rdi     # 0x1fac2
xorl %eax, %eax
callq 0x3030
movq %rbx, 0x18(%rsp)
movq %r15, 0x10(%rsp)
leaq 0x38(%rsp), %rbx
movq %rbx, %rdi
callq 0x3230
movq %rbx, %rdi
callq 0x31a0
movq %rax, %r15
movzbl 0x10(%r14), %r12d
movzbl 0x11(%r14), %ebx
leal 0x7c6(%rbx), %ebp
testl %r12d, %r12d
je 0xab9c
movq 0x18(%rsp), %rax
movl (%rax), %eax
cmpl $0x4, %eax
setae %cl
cmpl $0xff, %r12d
setne %dl
orb %cl, %dl
jne 0xabae
leaq 0x14f4f(%rip), %rsi     # 0x1fad9
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
leaq 0x14fc8(%rip), %rdi     # 0x1fb62
jmp 0xaba3
leaq 0x14fd3(%rip), %rdi     # 0x1fb76
movl %ebp, %esi
xorl %eax, %eax
callq 0x3030
jmp 0xac0b
cmpl $0x4, %eax
setae %al
cmpl $0x36, %r12d
setne %cl
orb %al, %cl
jne 0xabd1
leaq 0x14f39(%rip), %rsi     # 0x1faff
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
jmp 0xabf8
leal -0x37(%r12), %eax
cmpb $-0x39, %al
ja 0xabef
leaq 0x14f42(%rip), %rsi     # 0x1fb23
xorl %edi, %edi
movl %r12d, %edx
xorl %eax, %eax
callq 0x362c
jmp 0xabf8
cmpl $0xff, %r12d
je 0xab93
leaq 0x14f45(%rip), %rdi     # 0x1fb44
movl %r12d, %esi
movl %ebp, %edx
xorl %eax, %eax
callq 0x3030
movq 0x18(%rsp), %r12
addl $0x59, %ebx
cmpl 0x14(%r15), %ebx
jle 0xac2b
leaq 0x14f67(%rip), %rsi     # 0x1fb87
xorl %edi, %edi
movl %ebp, %edx
xorl %eax, %eax
callq 0x362c
leaq 0x14f87(%rip), %rsi     # 0x1fbb9
movq %r13, %rdi
callq 0x3460
movq (%r13), %rsi
leaq 0x141c6(%rip), %rdi     # 0x1ee0b
xorl %eax, %eax
callq 0x3030
movsbl 0x14(%r14), %ebx
testl %ebx, %ebx
movq 0x10(%rsp), %r15
js 0xac7e
movl %ebx, %ebp
shrl $0x5, %ebp
leaq 0x1594d(%rip), %rdi     # 0x205b3
callq 0x33b0
cmpl $0x2, %ebp
je 0xacc1
cmpl $0x3, %ebp
jne 0xacca
leaq 0x1502b(%rip), %rsi     # 0x1fca7
jmp 0xacdf
leaq 0x15986(%rip), %rdi     # 0x2060b
callq 0x33b0
movl (%r12), %ecx
cmpl $0x4, %ecx
jb 0xad64
movzbl 0x14(%r14), %esi
andl $0x70, %esi
cmpl $0x70, %esi
je 0xada2
testl %esi, %esi
jne 0xadb4
leaq 0x15984(%rip), %rdi     # 0x2063b
callq 0x33b0
jmp 0xadc8
leaq 0x14fe7(%rip), %rsi     # 0x1fcaf
jmp 0xacdf
cmpl $0x1, %ebp
leaq 0x14fe3(%rip), %rax     # 0x1fcb7
leaq 0x14fe8(%rip), %rsi     # 0x1fcc3
cmoveq %rax, %rsi
leaq 0x14fa2(%rip), %rdi     # 0x1fc88
xorl %eax, %eax
callq 0x3030
testb $0x10, 0x14(%r14)
leaq 0x158cd(%rip), %rax     # 0x205c6
leaq 0x158e9(%rip), %rdi     # 0x205e9
cmoveq %rax, %rdi
callq 0x33b0
testb $0xf, %bl
je 0xae74
testb $0x8, %bl
leaq 0xff6d(%rip), %rax      # 0x1ac89
leaq 0x2083a(%rip), %rsi     # 0x2b55d
cmoveq %rax, %rsi
testb $0x4, %bl
leaq 0x14fad(%rip), %rdx     # 0x1fcde
cmoveq %rax, %rdx
testb $0x2, %bl
leaq 0x14faa(%rip), %rcx     # 0x1fce9
cmoveq %rax, %rcx
testb $0x1, %bl
leaq 0x14fa9(%rip), %r8      # 0x1fcf6
cmoveq %rax, %r8
leaq 0x14f73(%rip), %rdi     # 0x1fccb
xorl %eax, %eax
callq 0x3030
jmp 0xae74
movb 0x14(%r14), %al
cmpl $0x2, %ecx
jb 0xad91
testb $0x1, %al
je 0xad81
leaq 0x158a7(%rip), %rdi     # 0x2061f
callq 0x33b0
movb 0x14(%r14), %al
andb $0x7e, %al
je 0xae74
movzbl %al, %edx
jmp 0xae64
movzbl %al, %edx
andl $0x7f, %edx
jne 0xae64
jmp 0xae74
leaq 0x14e34(%rip), %rsi     # 0x1fbdd
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
jmp 0xadc8
shrl $0x3, %esi
addl $0x4, %esi
leaq 0x14e44(%rip), %rdi     # 0x1fc05
xorl %eax, %eax
callq 0x3030
leaq 0x146c8(%rip), %rdi     # 0x1f497
xorl %eax, %eax
callq 0x3030
movzbl 0x14(%r14), %esi
andl $0xf, %esi
cmpb $0x5, %sil
ja 0xae4e
leaq 0x11755(%rip), %rax     # 0x1c540
movslq (%rax,%rsi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0x158b2(%rip), %rdi     # 0x206ad
jmp 0xae47
cmpb $0x0, 0xf(%r14)
leaq 0x88(%r15), %rbx
setne 0x8e(%r15)
jne 0xab0a
jmp 0xab31
leaq 0x1584b(%rip), %rdi     # 0x2066e
jmp 0xae47
leaq 0x15862(%rip), %rdi     # 0x2068e
jmp 0xae47
leaq 0x15848(%rip), %rdi     # 0x2067d
jmp 0xae47
leaq 0x15861(%rip), %rdi     # 0x2069f
jmp 0xae47
leaq 0x15811(%rip), %rdi     # 0x20658
callq 0x33b0
jmp 0xae74
leaq 0x14dd8(%rip), %rdi     # 0x1fc2d
xorl %eax, %eax
callq 0x3030
movzbl 0x14(%r14), %edx
andl $0xf, %edx
leaq 0x14ddd(%rip), %rsi     # 0x1fc48
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
movzbl 0x15(%r14), %esi
testl %esi, %esi
je 0xaeea
movzbl 0x16(%r14), %edx
testl %edx, %edx
je 0xaf16
leaq 0x14e70(%rip), %rdi     # 0x1fd01
xorl %eax, %eax
callq 0x3030
movzbl 0x15(%r14), %eax
imull $0xa, %eax, %eax
movl %eax, 0x174(%r15)
movzbl 0x16(%r14), %eax
imull $0xa, %eax, %eax
movl %eax, 0x178(%r15)
movzbl 0x15(%r14), %edx
cmpl $0xa, %edx
setb %cl
movb 0x16(%r14), %al
cmpb $0xa, %al
setb %sil
orb %cl, %sil
cmpb $0x1, %sil
jne 0xaf48
movzbl %al, %ecx
leaq 0x14e4a(%rip), %rsi     # 0x1fd28
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x362c
jmp 0xaf48
cmpl $0x3, (%r12)
jbe 0xaf3c
movzbl 0x16(%r14), %eax
testl %eax, %eax
je 0xaf3c
addl $0x63, %eax
cvtsi2sd %eax, %xmm1
movsd 0xf117(%rip), %xmm0     # 0x1a020
divsd %xmm1, %xmm0
leaq 0x14e76(%rip), %rdi     # 0x1fd8a
jmp 0xaf33
cmpl $0x3, (%r12)
jbe 0xaf3c
addl $0x63, %esi
cvtsi2sd %esi, %xmm0
divsd 0xf0f4(%rip), %xmm0     # 0x1a020
leaq 0x14e33(%rip), %rdi     # 0x1fd66
movb $0x1, %al
callq 0x3030
jmp 0xaf48
leaq 0x1578b(%rip), %rdi     # 0x206ce
callq 0x33b0
movb 0x17(%r14), %al
cmpb $-0x1, %al
je 0xaf77
movzbl %al, %eax
cvtsi2sd %eax, %xmm0
movsd 0xf0c1(%rip), %xmm1     # 0x1a020
addsd %xmm1, %xmm0
divsd %xmm1, %xmm0
leaq 0x14e3f(%rip), %rdi     # 0x1fdad
movb $0x1, %al
callq 0x3030
jmp 0xaf83
leaq 0x1576b(%rip), %rdi     # 0x206e9
callq 0x33b0
cmpb $0x20, 0x18(%r14)
jb 0xafe2
leaq 0x14e2d(%rip), %rdi     # 0x1fdbe
xorl %eax, %eax
callq 0x3030
movb 0x18(%r14), %al
testb %al, %al
jns 0xafb2
leaq 0x14e28(%rip), %rdi     # 0x1fdcf
xorl %eax, %eax
callq 0x3030
movb 0x18(%r14), %al
testb $0x40, %al
je 0xafc8
leaq 0x14e1b(%rip), %rdi     # 0x1fdd8
xorl %eax, %eax
callq 0x3030
movb 0x18(%r14), %al
testb $0x20, %al
je 0xafda
leaq 0x14e0e(%rip), %rdi     # 0x1fde1
xorl %eax, %eax
callq 0x3030
pushq $0xa
popq %rdi
callq 0x3340
testb %bl, %bl
jns 0xb031
cmpl $0x3, (%r12)
jbe 0xb031
leaq 0x14df2(%rip), %rdi     # 0x1fde6
xorl %eax, %eax
callq 0x3030
movb 0x18(%r14), %al
testb $0x8, %al
je 0xb015
leaq 0x14e03(%rip), %rdi     # 0x1fe0d
xorl %eax, %eax
callq 0x3030
movb 0x18(%r14), %al
testb $0x10, %al
je 0xb027
leaq 0x14dfb(%rip), %rdi     # 0x1fe1b
xorl %eax, %eax
callq 0x3030
pushq $0xa
popq %rdi
callq 0x3340
jmp 0xb081
leaq 0x1445f(%rip), %rdi     # 0x1f497
xorl %eax, %eax
callq 0x3030
movzbl 0x18(%r14), %eax
shrl $0x3, %eax
andl $0x3, %eax
leaq 0x11507(%rip), %rcx     # 0x1c558
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x156e6(%rip), %rdi     # 0x20747
jmp 0xb07c
leaq 0x156c7(%rip), %rdi     # 0x20731
jmp 0xb07c
leaq 0x156a1(%rip), %rdi     # 0x20714
jmp 0xb07c
leaq 0x156b9(%rip), %rdi     # 0x20735
callq 0x33b0
testb $0x4, 0x18(%r14)
je 0xb0bb
leaq 0x156d8(%rip), %rdi     # 0x20767
callq 0x33b0
leaq 0x19(%r14), %rdi
leaq 0x13613(%rip), %rsi     # 0x1e6b2
pushq $0xa
popq %rdx
callq 0x3290
testl %eax, %eax
je 0xb0bb
leaq 0x14d77(%rip), %rsi     # 0x1fe29
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
movl (%r12), %eax
movb 0x18(%r14), %cl
andb $0x2, %cl
cmpl $0x4, %eax
jb 0xb0fa
movl %ecx, %eax
shrb %al
testb %cl, %cl
movb %al, 0xc6(%r15)
leaq 0x14ddc(%rip), %rax     # 0x1febb
leaq 0x14dcc(%rip), %rsi     # 0x1feb2
cmoveq %rax, %rsi
leaq 0x14d70(%rip), %rdi     # 0x1fe61
xorl %eax, %eax
callq 0x3030
jmp 0xb135
testb %cl, %cl
jne 0xb121
cmpl $0x3, %eax
jne 0xb381
leaq 0x14dbe(%rip), %rsi     # 0x1fecc
movl $0x0, 0xc(%rsp)
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
jmp 0xb13b
leaq 0x15675(%rip), %rdi     # 0x2079d
callq 0x33b0
movb $0x1, 0xc6(%r15)
movb $0x1, %al
movl %eax, 0xc(%rsp)
testb $0x1, 0x18(%r14)
je 0xb173
cmpl $0x4, (%r12)
jb 0xb15f
movb $0x1, 0x90(%r15)
leaq 0x156a7(%rip), %rdi     # 0x207ff
callq 0x33b0
jmp 0xb173
leaq 0x15669(%rip), %rdi     # 0x207cf
callq 0x33b0
movb $0x1, 0x91(%r15)
leaq 0x14d9d(%rip), %rsi     # 0x1ff17
movq %r13, %rdi
callq 0x3460
movq (%r13), %rsi
leaq 0x13c7e(%rip), %rdi     # 0x1ee0b
xorl %eax, %eax
callq 0x3030
movzbl 0x1b(%r14), %eax
movzbl 0x19(%r14), %ecx
movl %ecx, %edx
shrl $0x6, %edx
leal (%rdx,%rax,4), %eax
movzbl 0x1c(%r14), %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 0x14d60(%rip), %rdi     # 0x1ff2d
xorl %eax, %eax
callq 0x3030
movzbl 0x1d(%r14), %eax
movzbl 0x19(%r14), %ecx
movl %ecx, %edx
shrl $0x2, %edx
andl $0x3, %edx
leal (%rdx,%rax,4), %eax
movzbl 0x1e(%r14), %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 0x14d3b(%rip), %rdi     # 0x1ff48
xorl %eax, %eax
callq 0x3030
movzbl 0x1f(%r14), %eax
movzbl 0x1a(%r14), %ecx
movl %ecx, %edx
shrl $0x6, %edx
leal (%rdx,%rax,4), %eax
movzbl 0x20(%r14), %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 0x14d16(%rip), %rdi     # 0x1ff63
xorl %eax, %eax
callq 0x3030
movzbl 0x21(%r14), %eax
movzbl 0x1a(%r14), %ecx
movl %ecx, %edx
shrl $0x2, %edx
andl $0x3, %edx
leal (%rdx,%rax,4), %eax
movzbl 0x22(%r14), %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 0x14cf1(%rip), %rdi     # 0x1ff7e
xorl %eax, %eax
callq 0x3030
leaq 0x14cfe(%rip), %rsi     # 0x1ff99
movq %r13, %rdi
callq 0x3460
cmpb $0x0, 0x23(%r14)
movq %r13, 0x20(%rsp)
jne 0xb2c1
cmpb $0x0, 0x24(%r14)
jne 0xb2c1
cmpb $0x0, 0x25(%r14)
je 0xb38e
movq (%r13), %rsi
leaq 0x13b3f(%rip), %rdi     # 0x1ee0b
xorl %eax, %eax
callq 0x3030
leaq 0x28336(%rip), %r15     # 0x33610
leaq 0x40(%rsp), %r12
leaq 0xf9a3(%rip), %rbp      # 0x1ac89
xorl %r13d, %r13d
cmpq $0x11, %r13
je 0xb3a0
movl %r13d, %eax
shrl $0x3, %eax
movzbl 0x23(%r14,%rax), %eax
movl %r13d, %ecx
notb %cl
movzbl %cl, %ecx
andl $0x7, %ecx
btl %ecx, %eax
jae 0xb375
movl (%r15), %eax
testb %al, %al
je 0xb338
movzbl %al, %ebx
movq %r12, %rdi
leaq 0xf5bc(%rip), %rsi      # 0x1a8df
movl %ebx, %edx
xorl %eax, %eax
callq 0x3070
movl %ebx, %edi
callq 0x7d78
movq %rax, %rbx
jmp 0xb351
leaq 0x4(%r15), %rbx
movq 0x58(%r15), %rdx
movq %r12, %rdi
leaq 0x133d6(%rip), %rsi     # 0x1e720
xorl %eax, %eax
callq 0x3070
movl $0x1, (%rsp)
movq 0x10(%rsp), %rdi
leaq 0x14133(%rip), %rsi     # 0x1f497
movq %rbx, %rdx
movq %r12, %rcx
movq %rbp, %r8
xorl %r9d, %r9d
callq 0x3af0
incq %r13
addq $0x60, %r15
jmp 0xb2e9
movl $0x0, 0xc(%rsp)
jmp 0xb13b
movq (%r13), %rsi
leaq 0x14c1b(%rip), %rdi     # 0x1ffb4
xorl %eax, %eax
callq 0x3030
movb 0x23(%r14), %al
shrb $0x5, %al
andb $0x1, %al
movq 0x10(%rsp), %rbx
movb %al, 0xc5(%rbx)
leaq 0x36(%r14), %rbp
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xa026
leaq 0x48(%r14), %rsi
movq %rbx, %rdi
movq %rsi, 0x28(%rsp)
callq 0xa026
leaq 0x5a(%r14), %rsi
movq %rbx, %rdi
movq %rsi, %r13
callq 0xa026
leaq 0x6c(%r14), %rsi
movq %rbx, %rdi
movq %rsi, %r12
callq 0xa026
leaq 0x14bc7(%rip), %rsi     # 0x1ffc0
movq 0x20(%rsp), %rdi
callq 0x3460
pushq $0x13
popq %rax
cmpq $0x1b, %rax
je 0xb468
cmpb $0x1, (%r14,%rax,2)
jne 0xb41f
cmpb $0x1, 0x1(%r14,%rax,2)
leaq 0x1(%rax), %rax
je 0xb406
movq 0x20(%rsp), %rax
movq (%rax), %rsi
leaq 0x139dd(%rip), %rdi     # 0x1ee0b
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x3030
leaq 0x14059(%rip), %r15     # 0x1f497
cmpq $0x8, %rbx
je 0xb47e
movzbl 0x26(%r14,%rbx,2), %edx
movzbl 0x27(%r14,%rbx,2), %ecx
movq 0x10(%rsp), %rdi
movq %r15, %rsi
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x8800
incq %rbx
jmp 0xb43e
movq 0x20(%rsp), %rax
movq (%rax), %rsi
leaq 0x14b3d(%rip), %rdi     # 0x1ffb4
xorl %eax, %eax
callq 0x3030
movq %rbp, 0x30(%rsp)
movb (%rbp), %al
cmpb $0x0, 0xc(%rsp)
je 0xb4be
testb %al, %al
movq 0x10(%rsp), %rbp
movq %r13, %rbx
movq 0x28(%rsp), %r13
jne 0xb4d6
cmpb $0x0, 0x37(%r14)
jne 0xb4cf
leaq 0x14b25(%rip), %rsi     # 0x1ffd1
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
movq 0x30(%rsp), %rax
movb (%rax), %al
jmp 0xb4cb
movq 0x10(%rsp), %rbp
movq %r13, %rbx
movq 0x28(%rsp), %r13
testb %al, %al
jne 0xb4d6
cmpb $0x0, 0x37(%r14)
je 0xb524
cmpb $0x0, (%r13)
jne 0xb4e4
cmpb $0x0, 0x49(%r14)
je 0xb524
cmpb $0x0, (%rbx)
jne 0xb524
cmpb $0x0, 0x5b(%r14)
jne 0xb524
cmpb $-0x2, 0x5d(%r14)
jne 0xb524
cmpb $0x0, (%r12)
jne 0xb524
cmpb $0x0, 0x6d(%r14)
jne 0xb524
cmpb $-0x2, 0x6f(%r14)
jne 0xb524
movb 0x79(%r14), %al
decb %al
cmpb $0x1, %al
ja 0xb524
cmpb $0x1, 0x7a(%r14)
ja 0xb524
movb $0x1, 0xb9(%rbp)
movl 0x180(%rbp), %eax
cmpb $0x0, 0xb9(%rbp)
pushq $0x24
popq %rdx
pushq $0x48
popq %rcx
cmovneq %rdx, %rcx
xorl %edx, %edx
cmpq %rdx, %rcx
je 0xb560
cmpb $0x0, 0x36(%r14,%rdx)
jne 0xb552
cmpb $0x0, 0x37(%r14,%rdx)
je 0xb55a
incl %eax
movl %eax, 0x180(%rbp)
addq $0x12, %rdx
jmp 0xb53d
leaq 0x14a85(%rip), %rsi     # 0x1ffec
movq 0x20(%rsp), %rdi
callq 0x3460
movq 0x30(%rbp), %rsi
leaq 0x1388f(%rip), %rdi     # 0x1ee0b
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x3030
movq %rbp, %rdi
movq 0x30(%rsp), %rsi
callq 0xa112
movq %rbp, %rdi
movq %r13, %rsi
callq 0xa112
movq %rbp, %rdi
movq %rbx, %rsi
callq 0xa112
movq %rbp, %rdi
movq %r12, %rsi
callq 0xa112
movb $0x0, 0xb9(%rbp)
cmpb $0x0, 0xc6(%rbp)
jne 0xb635
leaq 0x2a8(%rbp), %rdi
callq 0xbc14
leaq 0xa8(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
leaq 0xc8(%rsp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %cl, (%rdx)
xorpd %xmm0, %xmm0
movapd %xmm0, -0x68(%rax)
movapd %xmm0, -0x78(%rdx)
movapd %xmm0, -0x68(%rdx)
movapd %xmm0, -0x58(%rdx)
movapd %xmm0, -0x48(%rdx)
andl $0x0, -0x38(%rdx)
leaq 0xc8(%rbp), %rdi
leaq 0x40(%rsp), %rbx
movq %rbx, %rsi
callq 0xbc1c
movq %rbx, %rdi
callq 0x78cc
leaq 0x10(%rbp), %r12
movq 0x20(%rsp), %rdi
movq %r12, %rsi
callq 0x3160
movzbl 0x7e(%r14), %esi
testl %esi, %esi
je 0xb662
leaq 0x149b2(%rip), %rdi     # 0x20008
xorl %eax, %eax
callq 0x3030
movzbl 0x7e(%r14), %r15d
leal 0x1(%r15), %eax
movq 0x10(%rsp), %rcx
movl 0x4(%rcx), %ecx
cmpl %ecx, %eax
je 0xb687
decl %ecx
leaq 0x149a5(%rip), %rsi     # 0x20020
xorl %edi, %edi
movl %r15d, %edx
xorl %eax, %eax
callq 0x362c
leaq 0x40(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x50da
movq %r12, %rdi
movq %rbx, %rsi
callq 0x32f0
movq %rbx, %rdi
callq 0x3130
movq 0x10(%rsp), %rbx
andq $0x0, 0x38(%rbx)
movq 0x30(%rbx), %rax
movb $0x0, (%rax)
leaq 0xf5c8(%rip), %rdi      # 0x1ac89
movl $0x80, %edx
movq %r14, %rsi
callq 0x3876
movl 0x88(%rbx), %eax
cmpl $0x3, %eax
jb 0xb720
cmpb $0x0, 0x8c(%rbx)
jne 0xb6f9
leaq 0x1497f(%rip), %rsi     # 0x20068
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
movq 0x18(%rsp), %rax
movl (%rax), %eax
cmpl $0x3, %eax
je 0xb707
cmpb $0x1, 0x90(%rbx)
jne 0xb720
cmpb $0x0, 0x8d(%rbx)
jne 0xb720
leaq 0x14970(%rip), %rsi     # 0x20087
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq