// File: rpavlik[P]edid-decode/parse-cta-block.cpp
// Function: edid_state::cta_ext_block(unsigned char const*, unsigned int, bool)
void edid_state::cta_ext_block(const unsigned char *x, unsigned length,
			       bool duplicate)
{
	const char *name;
	unsigned oui;
	bool reverse = false;
	bool audio_block = false;

	switch (x[0]) {
	case 0x00: data_block = "Video Capability Data Block"; break;
	case 0x01: data_block.clear(); break;
	case 0x02: data_block = "VESA Video Display Device Data Block"; break;
	case 0x03: data_block = "VESA Video Timing Block Extension"; break;
	case 0x04: data_block = "Reserved for HDMI Video Data Block"; break;
	case 0x05: data_block = "Colorimetry Data Block"; break;
	case 0x06: data_block = "HDR Static Metadata Data Block"; break;
	case 0x07: data_block = "HDR Dynamic Metadata Data Block"; break;

	case 0x0d: data_block = "Video Format Preference Data Block"; break;
	case 0x0e: data_block = "YCbCr 4:2:0 Video Data Block"; break;
	case 0x0f: data_block = "YCbCr 4:2:0 Capability Map Data Block"; break;
	case 0x10: data_block = "Reserved for CTA-861 Miscellaneous Audio Fields"; break;
	case 0x11: data_block.clear(); audio_block = true; break;
	case 0x12: data_block = "HDMI Audio Data Block"; audio_block = true; break;
	case 0x13: data_block = "Room Configuration Data Block"; audio_block = true; break;
	case 0x14: data_block = "Speaker Location Data Block"; audio_block = true; break;

	case 0x20: data_block = "InfoFrame Data Block"; break;

	case 0x34: data_block = "DisplayID Type VII Video Timing Data Block"; break;
	case 0x35: data_block = "DisplayID Type VIII Video Timing Data Block"; break;
	case 0x42: data_block = "DisplayID Type X Video Timing Data Block"; break;

	case 0x78: data_block = "HDMI Forum EDID Extension Override Data Block"; break;
	case 0x79: data_block = "HDMI Forum Sink Capability Data Block"; break;
	default:
		if (x[0] <= 12)
			printf("  Unknown CTA-861 Video-Related");
		else if (x[0] <= 31)
			printf("  Unknown CTA-861 Audio-Related");
		else if (x[0] >= 120 && x[0] <= 127)
			printf("  Unknown CTA-861 HDMI-Related");
		else
			printf("  Unknown CTA-861");
		printf(" Data Block (extended tag 0x%02x, length %u)\n", x[0], length);
		hex_block("    ", x + 1, length);
		data_block.clear();
		warn("Unknown Extended CTA-861 Data Block 0x%02x.\n", x[0]);
		return;
	}

	switch (x[0]) {
	case 0x00:
	case 0x02:
	case 0x05:
	case 0x06:
	case 0x0d:
	case 0x0f:
	case 0x12:
	case 0x13:
	case 0x78:
	case 0x79:
		if (duplicate)
			fail("Only one instance of this Data Block is allowed.\n");
		break;
	}


	// See Table 52 of CTA-861-G for a description of Byte 3
	if (audio_block && !(cta.byte3 & 0x40))
		fail("audio information is present, but bit 6 of Byte 3 of the CTA-861 Extension header indicates no Basic Audio support.\n");

	if (data_block.length())
		printf("  %s:\n", data_block.c_str());

	switch (x[0]) {
	case 0x00: cta_vcdb(x + 1, length); return;
	case 0x01:
		if (length < 3) {
			data_block = std::string("Vendor-Specific Video Data Block");
			fail("Invalid length %u < 3.\n", length);
			return;
		}
		oui = (x[3] << 16) + (x[2] << 8) + x[1];
		name = oui_name(oui);
		if (!name) {
			name = oui_name(oui, true);
			if (name)
				reverse = true;
		}
		if (!name) {
			printf("  Vendor-Specific Video Data Block, OUI %s:\n",
			       ouitohex(oui).c_str());
			hex_block("    ", x + 4, length - 3);
			data_block.clear();
			warn("Unknown Extended Vendor-Specific Video Data Block, OUI %s.\n",
			     ouitohex(oui).c_str());
			return;
		}
		data_block = std::string("Vendor-Specific Video Data Block (") + name + ")";
		if (reverse)
			fail((std::string("OUI ") + ouitohex(oui) + " is in the wrong byte order\n").c_str());
		printf("  %s, OUI %s:\n", data_block.c_str(), ouitohex(oui).c_str());
		if (oui == 0x90848b)
			cta_hdr10plus(x + 4, length - 3);
		else if (oui == 0x00d046)
			cta_dolby_video(x + 4, length - 3);
		else
			hex_block("    ", x + 4, length - 3);
		return;
	case 0x02: cta_vesa_vdddb(x + 1, length); return;
	case 0x05: cta_colorimetry_block(x + 1, length); return;
	case 0x06: cta_hdr_static_metadata_block(x + 1, length); return;
	case 0x07: cta_hdr_dyn_metadata_block(x + 1, length); return;
	case 0x0d: cta_vfpdb(x + 1, length); return;
	case 0x0e: cta_svd(x + 1, length, true); return;
	case 0x0f: cta_y420cmdb(x + 1, length); return;
	case 0x11:
		if (length < 3) {
			data_block = std::string("Vendor-Specific Audio Data Block");
			fail("Invalid length %u < 3.\n", length);
			return;
		}
		oui = (x[3] << 16) + (x[2] << 8) + x[1];
		name = oui_name(oui);
		if (!name) {
			name = oui_name(oui, true);
			if (name)
				reverse = true;
		}
		if (!name) {
			printf("  Vendor-Specific Audio Data Block, OUI %s:\n",
			       ouitohex(oui).c_str());
			hex_block("    ", x + 4, length - 3);
			data_block.clear();
			warn("Unknown Extended Vendor-Specific Audio Data Block, OUI %s.\n",
			     ouitohex(oui).c_str());
			return;
		}
		data_block = std::string("Vendor-Specific Audio Data Block (") + name + ")";
		if (reverse)
			fail((std::string("OUI ") + ouitohex(oui) + " is in the wrong byte order\n").c_str());
		printf("  %s, OUI %s:\n", data_block.c_str(), ouitohex(oui).c_str());
		if (oui == 0x00d046)
			cta_dolby_audio(x + 4, length - 3);
		else
			hex_block("    ", x + 4, length - 3);
		return;
	case 0x12: cta_hdmi_audio_block(x + 1, length); return;
	case 0x13: cta_rcdb(x + 1, length); return;
	case 0x14: cta_sldb(x + 1, length); return;
	case 0x20: cta_ifdb(x + 1, length); return;
	case 0x34: cta_displayid_type_7(x + 1, length); return;
	case 0x35: cta_displayid_type_8(x + 1, length); return;
	case 0x42: cta_displayid_type_10(x + 1, length); return;
	case 0x78:
		cta_hf_eeodb(x + 1, length);
		// This must be the first CTA-861 block
		if (!cta.first_block)
			fail("Block starts at a wrong offset.\n");
		return;
	case 0x79:
		if (!cta.last_block_was_hdmi_vsdb)
			fail("HDMI Forum SCDB did not immediately follow the HDMI VSDB.\n");
		if (cta.have_hf_scdb || cta.have_hf_vsdb)
			fail("Duplicate HDMI Forum VSDB/SCDB.\n");
		if (length < 2) {
			data_block = std::string("HDMI Forum SCDB");
			fail("Invalid length %u < 2.\n", length);
			return;
		}
		if (x[1] || x[2])
			printf("  Non-zero SCDB reserved fields!\n");
		cta_hf_scdb(x + 3, length - 2);
		cta.have_hf_scdb = 1;
		return;
	}

	hex_block("    ", x + 1, length);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x400, %rsp            # imm = 0x400
movb %cl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
andb $0x1, %al
movb %al, -0x15(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x360(%rbp)
movb $0x0, -0x25(%rbp)
movb $0x0, -0x26(%rbp)
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
movq %rax, -0x358(%rbp)
subq $0x79, %rax
ja 0x18c89
movq -0x358(%rbp), %rax
leaq 0x1d0b6(%rip), %rcx     # 0x35acc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
leaq 0x21a74(%rip), %rsi     # 0x3a4a5
callq 0x4420
jmp 0x18d64
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
callq 0x4400
jmp 0x18d64
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
leaq 0x21a5f(%rip), %rsi     # 0x3a4c1
callq 0x4420
jmp 0x18d64
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
leaq 0x21a68(%rip), %rsi     # 0x3a4e6
callq 0x4420
jmp 0x18d64
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
leaq 0x21a6e(%rip), %rsi     # 0x3a508
callq 0x4420
jmp 0x18d64
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
leaq 0x21a75(%rip), %rsi     # 0x3a52b
callq 0x4420
jmp 0x18d64
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
leaq 0x21a70(%rip), %rsi     # 0x3a542
callq 0x4420
jmp 0x18d64
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
leaq 0x21a73(%rip), %rsi     # 0x3a561
callq 0x4420
jmp 0x18d64
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
leaq 0x21a77(%rip), %rsi     # 0x3a581
callq 0x4420
jmp 0x18d64
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
leaq 0x21a7e(%rip), %rsi     # 0x3a5a4
callq 0x4420
jmp 0x18d64
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
leaq 0x21a7f(%rip), %rsi     # 0x3a5c1
callq 0x4420
jmp 0x18d64
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
leaq 0x21a89(%rip), %rsi     # 0x3a5e7
callq 0x4420
jmp 0x18d64
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
callq 0x4400
movb $0x1, -0x26(%rbp)
jmp 0x18d64
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
leaq 0x21a84(%rip), %rsi     # 0x3a617
callq 0x4420
movb $0x1, -0x26(%rbp)
jmp 0x18d64
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
leaq 0x21a7a(%rip), %rsi     # 0x3a62d
callq 0x4420
movb $0x1, -0x26(%rbp)
jmp 0x18d64
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
leaq 0x21a78(%rip), %rsi     # 0x3a64b
callq 0x4420
movb $0x1, -0x26(%rbp)
jmp 0x18d64
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
leaq 0x21a74(%rip), %rsi     # 0x3a667
callq 0x4420
jmp 0x18d64
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
leaq 0x21a6d(%rip), %rsi     # 0x3a67c
callq 0x4420
jmp 0x18d64
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
leaq 0x21a7c(%rip), %rsi     # 0x3a6a7
callq 0x4420
jmp 0x18d64
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
leaq 0x21a8c(%rip), %rsi     # 0x3a6d3
callq 0x4420
jmp 0x18d64
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
leaq 0x21a99(%rip), %rsi     # 0x3a6fc
callq 0x4420
jmp 0x18d64
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
leaq 0x21aab(%rip), %rsi     # 0x3a72a
callq 0x4420
jmp 0x18d64
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xc, %eax
jg 0x18ca5
leaq 0x21ab4(%rip), %rdi     # 0x3a750
movb $0x0, %al
callq 0x4050
jmp 0x18cfb
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x1f, %eax
jg 0x18cc1
leaq 0x21ab8(%rip), %rdi     # 0x3a770
movb $0x0, %al
callq 0x4050
jmp 0x18cf9
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x78, %eax
jl 0x18ce9
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x7f, %eax
jg 0x18ce9
leaq 0x21ab0(%rip), %rdi     # 0x3a790
movb $0x0, %al
callq 0x4050
jmp 0x18cf7
leaq 0x21abf(%rip), %rdi     # 0x3a7af
movb $0x0, %al
callq 0x4050
jmp 0x18cf9
jmp 0x18cfb
movq -0x10(%rbp), %rax
movzbl (%rax), %esi
movl -0x14(%rbp), %edx
leaq 0x21ab5(%rip), %rdi     # 0x3a7c1
movb $0x0, %al
callq 0x4050
movq -0x10(%rbp), %rsi
addq $0x1, %rsi
movl -0x14(%rbp), %edx
leaq 0x1baba(%rip), %rdi     # 0x347df
movl $0x1, %ecx
movl $0x10, %r8d
callq 0x7860
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
callq 0x4400
movq -0x10(%rbp), %rax
movzbl (%rax), %edx
movl $0x1, %edi
leaq 0x21a97(%rip), %rsi     # 0x3a7ef
movb $0x0, %al
callq 0x47d0
jmp 0x19bcc
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x364(%rbp)
testl %eax, %eax
je 0x18dce
jmp 0x18d77
movl -0x364(%rbp), %eax
subl $0x2, %eax
je 0x18dce
jmp 0x18d84
movl -0x364(%rbp), %eax
addl $-0x5, %eax
subl $0x2, %eax
jb 0x18dce
jmp 0x18d94
movl -0x364(%rbp), %eax
subl $0xd, %eax
je 0x18dce
jmp 0x18da1
movl -0x364(%rbp), %eax
subl $0xf, %eax
je 0x18dce
jmp 0x18dae
movl -0x364(%rbp), %eax
addl $-0x12, %eax
subl $0x2, %eax
jb 0x18dce
jmp 0x18dbe
movl -0x364(%rbp), %eax
addl $-0x78, %eax
subl $0x1, %eax
ja 0x18de6
jmp 0x18dce
testb $0x1, -0x15(%rbp)
je 0x18de4
xorl %edi, %edi
leaq 0x21a3f(%rip), %rsi     # 0x3a81c
movb $0x0, %al
callq 0x47d0
jmp 0x18de6
testb $0x1, -0x26(%rbp)
je 0x18e12
movq -0x360(%rbp), %rax
movzbl 0x2c2(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
jne 0x18e12
xorl %edi, %edi
leaq 0x21a43(%rip), %rsi     # 0x3a84e
movb $0x0, %al
callq 0x47d0
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
callq 0x4490
cmpq $0x0, %rax
je 0x18e49
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
callq 0x4150
movq %rax, %rsi
leaq 0x1b2af(%rip), %rdi     # 0x340f1
movb $0x0, %al
callq 0x4050
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
movq %rax, -0x370(%rbp)
subq $0x79, %rax
ja 0x19baa
movq -0x370(%rbp), %rax
leaq 0x1ce45(%rip), %rcx     # 0x35cb4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x360(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x1, %rsi
movl -0x14(%rbp), %edx
callq 0x183e0
jmp 0x19bcc
cmpl $0x3, -0x14(%rbp)
jae 0x18f1f
leaq -0x49(%rbp), %rdi
movq %rdi, -0x378(%rbp)
callq 0x4560
movq -0x378(%rbp), %rdx
leaq 0x21a07(%rip), %rsi     # 0x3a8c3
leaq -0x48(%rbp), %rdi
callq 0xb510
jmp 0x18ec7
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
leaq -0x48(%rbp), %rsi
callq 0x43d0
leaq -0x48(%rbp), %rdi
callq 0x41f0
leaq -0x49(%rbp), %rdi
callq 0x4370
movl -0x14(%rbp), %edx
xorl %edi, %edi
leaq 0x219eb(%rip), %rsi     # 0x3a8e4
movb $0x0, %al
callq 0x47d0
jmp 0x19bcc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x49(%rbp), %rdi
callq 0x4370
jmp 0x19bd5
movq -0x10(%rbp), %rax
movzbl 0x3(%rax), %eax
shll $0x10, %eax
movq -0x10(%rbp), %rcx
movzbl 0x2(%rcx), %ecx
shll $0x8, %ecx
addl %ecx, %eax
movq -0x10(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
addl %ecx, %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %edi
xorl %esi, %esi
callq 0x75c0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x18f77
movl -0x24(%rbp), %edi
movl $0x1, %esi
callq 0x75c0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x18f75
movb $0x1, -0x25(%rbp)
jmp 0x18f77
cmpq $0x0, -0x20(%rbp)
jne 0x1907b
movl -0x24(%rbp), %esi
leaq -0x80(%rbp), %rdi
movq %rdi, -0x380(%rbp)
callq 0x7770
movq -0x380(%rbp), %rdi
callq 0x4150
movq %rax, %rsi
leaq 0x21951(%rip), %rdi     # 0x3a8fc
xorl %eax, %eax
callq 0x4050
jmp 0x18fb4
leaq -0x80(%rbp), %rdi
callq 0x41f0
movq -0x10(%rbp), %rsi
addq $0x4, %rsi
movl -0x14(%rbp), %edx
addl $-0x3, %edx
leaq 0x1b80d(%rip), %rdi     # 0x347df
movl $0x1, %ecx
movl %ecx, -0x384(%rbp)
movl $0x10, %r8d
callq 0x7860
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
callq 0x4400
movl -0x24(%rbp), %esi
leaq -0xa0(%rbp), %rdi
movq %rdi, -0x390(%rbp)
callq 0x7770
movq -0x390(%rbp), %rdi
callq 0x4150
movl -0x384(%rbp), %edi
movq %rax, %rdx
leaq 0x218ff(%rip), %rsi     # 0x3a929
xorl %eax, %eax
callq 0x47d0
jmp 0x19033
leaq -0xa0(%rbp), %rdi
callq 0x41f0
jmp 0x19bcc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x41f0
jmp 0x19bd5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x41f0
jmp 0x19bd5
leaq -0x101(%rbp), %rdi
movq %rdi, -0x398(%rbp)
callq 0x4560
movq -0x398(%rbp), %rdx
leaq 0x218c9(%rip), %rsi     # 0x3a965
leaq -0x100(%rbp), %rdi
callq 0xb510
jmp 0x190aa
movq -0x20(%rbp), %rdx
leaq -0xe0(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0xb4c0
jmp 0x190c3
leaq 0x2384b(%rip), %rdx     # 0x3c915
leaq -0xc0(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0xb4c0
jmp 0x190df
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
leaq -0xc0(%rbp), %rsi
callq 0x43d0
leaq -0xc0(%rbp), %rdi
callq 0x41f0
leaq -0xe0(%rbp), %rdi
callq 0x41f0
leaq -0x100(%rbp), %rdi
callq 0x41f0
leaq -0x101(%rbp), %rdi
callq 0x4370
testb $0x1, -0x25(%rbp)
je 0x192da
leaq -0x169(%rbp), %rdi
movq %rdi, -0x3a0(%rbp)
callq 0x4560
movq -0x3a0(%rbp), %rdx
leaq 0x27972(%rip), %rsi     # 0x40ac3
leaq -0x168(%rbp), %rdi
callq 0xb510
jmp 0x1915f
movl -0x24(%rbp), %esi
leaq -0x190(%rbp), %rdi
callq 0x7770
jmp 0x19170
leaq -0x148(%rbp), %rdi
leaq -0x168(%rbp), %rsi
leaq -0x190(%rbp), %rdx
callq 0xb7b0
jmp 0x1918c
leaq 0x217f5(%rip), %rdx     # 0x3a988
leaq -0x128(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0xb4c0
jmp 0x191a8
leaq -0x128(%rbp), %rdi
callq 0x4150
movq %rax, %rsi
xorl %edi, %edi
movb %dil, %al
callq 0x47d0
jmp 0x191c3
leaq -0x128(%rbp), %rdi
callq 0x41f0
leaq -0x148(%rbp), %rdi
callq 0x41f0
leaq -0x190(%rbp), %rdi
callq 0x41f0
leaq -0x168(%rbp), %rdi
callq 0x41f0
leaq -0x169(%rbp), %rdi
callq 0x4370
jmp 0x192da
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x19244
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x19238
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x41f0
leaq -0x100(%rbp), %rdi
callq 0x41f0
leaq -0x101(%rbp), %rdi
callq 0x4370
jmp 0x19bd5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x192c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x192bd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x192b1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x192a5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x41f0
leaq -0x148(%rbp), %rdi
callq 0x41f0
leaq -0x190(%rbp), %rdi
callq 0x41f0
leaq -0x168(%rbp), %rdi
callq 0x41f0
leaq -0x169(%rbp), %rdi
callq 0x4370
jmp 0x19bd5
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
callq 0x4150
movq %rax, -0x3a8(%rbp)
movl -0x24(%rbp), %esi
leaq -0x1b0(%rbp), %rdi
movq %rdi, -0x3b0(%rbp)
callq 0x7770
movq -0x3b0(%rbp), %rdi
callq 0x4150
movq -0x3a8(%rbp), %rsi
movq %rax, %rdx
leaq 0x21681(%rip), %rdi     # 0x3a9a5
xorl %eax, %eax
callq 0x4050
jmp 0x1932d
leaq -0x1b0(%rbp), %rdi
callq 0x41f0
cmpl $0x90848b, -0x24(%rbp)  # imm = 0x90848B
jne 0x19374
movq -0x10(%rbp), %rdi
addq $0x4, %rdi
movl -0x14(%rbp), %esi
subl $0x3, %esi
callq 0x19be0
jmp 0x193b9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x41f0
jmp 0x19bd5
cmpl $0xd046, -0x24(%rbp)    # imm = 0xD046
jne 0x19392
movq -0x10(%rbp), %rdi
addq $0x4, %rdi
movl -0x14(%rbp), %esi
subl $0x3, %esi
callq 0x19c50
jmp 0x193b7
movq -0x10(%rbp), %rsi
addq $0x4, %rsi
movl -0x14(%rbp), %edx
subl $0x3, %edx
leaq 0x1b438(%rip), %rdi     # 0x347df
movl $0x1, %ecx
movl $0x10, %r8d
callq 0x7860
jmp 0x193b9
jmp 0x19bcc
movq -0x10(%rbp), %rdi
addq $0x1, %rdi
movl -0x14(%rbp), %esi
callq 0x1a660
jmp 0x19bcc
movq -0x10(%rbp), %rdi
addq $0x1, %rdi
movl -0x14(%rbp), %esi
callq 0x1b170
jmp 0x19bcc
movq -0x10(%rbp), %rdi
addq $0x1, %rdi
movl -0x14(%rbp), %esi
callq 0x1b240
jmp 0x19bcc
movq -0x10(%rbp), %rdi
addq $0x1, %rdi
movl -0x14(%rbp), %esi
callq 0x1b4a0
jmp 0x19bcc
movq -0x360(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x1, %rsi
movl -0x14(%rbp), %edx
callq 0x164c0
jmp 0x19bcc
movq -0x360(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x1, %rsi
movl -0x14(%rbp), %edx
movl $0x1, %ecx
callq 0x15860
jmp 0x19bcc
movq -0x360(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x1, %rsi
movl -0x14(%rbp), %edx
callq 0x162d0
jmp 0x19bcc
cmpl $0x3, -0x14(%rbp)
jae 0x19508
leaq -0x1d1(%rbp), %rdi
movq %rdi, -0x3b8(%rbp)
callq 0x4560
movq -0x3b8(%rbp), %rdx
leaq 0x2151e(%rip), %rsi     # 0x3a9b4
leaq -0x1d0(%rbp), %rdi
callq 0xb510
jmp 0x194a4
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
leaq -0x1d0(%rbp), %rsi
callq 0x43d0
leaq -0x1d0(%rbp), %rdi
callq 0x41f0
leaq -0x1d1(%rbp), %rdi
callq 0x4370
movl -0x14(%rbp), %edx
xorl %edi, %edi
leaq 0x21405(%rip), %rsi     # 0x3a8e4
movb $0x0, %al
callq 0x47d0
jmp 0x19bcc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x1d1(%rbp), %rdi
callq 0x4370
jmp 0x19bd5
movq -0x10(%rbp), %rax
movzbl 0x3(%rax), %eax
shll $0x10, %eax
movq -0x10(%rbp), %rcx
movzbl 0x2(%rcx), %ecx
shll $0x8, %ecx
addl %ecx, %eax
movq -0x10(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
addl %ecx, %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %edi
xorl %esi, %esi
callq 0x75c0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x19560
movl -0x24(%rbp), %edi
movl $0x1, %esi
callq 0x75c0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x1955e
movb $0x1, -0x25(%rbp)
jmp 0x19560
cmpq $0x0, -0x20(%rbp)
jne 0x1966d
movl -0x24(%rbp), %esi
leaq -0x1f8(%rbp), %rdi
movq %rdi, -0x3c0(%rbp)
callq 0x7770
movq -0x3c0(%rbp), %rdi
callq 0x4150
movq %rax, %rsi
leaq 0x2143e(%rip), %rdi     # 0x3a9d5
xorl %eax, %eax
callq 0x4050
jmp 0x195a0
leaq -0x1f8(%rbp), %rdi
callq 0x41f0
movq -0x10(%rbp), %rsi
addq $0x4, %rsi
movl -0x14(%rbp), %edx
addl $-0x3, %edx
leaq 0x1b21e(%rip), %rdi     # 0x347df
movl $0x1, %ecx
movl %ecx, -0x3c4(%rbp)
movl $0x10, %r8d
callq 0x7860
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
callq 0x4400
movl -0x24(%rbp), %esi
leaq -0x218(%rbp), %rdi
movq %rdi, -0x3d0(%rbp)
callq 0x7770
movq -0x3d0(%rbp), %rdi
callq 0x4150
movl -0x3c4(%rbp), %edi
movq %rax, %rdx
leaq 0x213e9(%rip), %rsi     # 0x3aa02
xorl %eax, %eax
callq 0x47d0
jmp 0x19622
leaq -0x218(%rbp), %rdi
callq 0x41f0
jmp 0x19bcc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x1f8(%rbp), %rdi
callq 0x41f0
jmp 0x19bd5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x41f0
jmp 0x19bd5
leaq -0x279(%rbp), %rdi
movq %rdi, -0x3d8(%rbp)
callq 0x4560
movq -0x3d8(%rbp), %rdx
leaq 0x213b0(%rip), %rsi     # 0x3aa3e
leaq -0x278(%rbp), %rdi
callq 0xb510
jmp 0x1969c
movq -0x20(%rbp), %rdx
leaq -0x258(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0xb4c0
jmp 0x196b5
leaq 0x23259(%rip), %rdx     # 0x3c915
leaq -0x238(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0xb4c0
jmp 0x196d1
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
leaq -0x238(%rbp), %rsi
callq 0x43d0
leaq -0x238(%rbp), %rdi
callq 0x41f0
leaq -0x258(%rbp), %rdi
callq 0x41f0
leaq -0x278(%rbp), %rdi
callq 0x41f0
leaq -0x279(%rbp), %rdi
callq 0x4370
testb $0x1, -0x25(%rbp)
je 0x198cc
leaq -0x2e1(%rbp), %rdi
movq %rdi, -0x3e0(%rbp)
callq 0x4560
movq -0x3e0(%rbp), %rdx
leaq 0x27380(%rip), %rsi     # 0x40ac3
leaq -0x2e0(%rbp), %rdi
callq 0xb510
jmp 0x19751
movl -0x24(%rbp), %esi
leaq -0x308(%rbp), %rdi
callq 0x7770
jmp 0x19762
leaq -0x2c0(%rbp), %rdi
leaq -0x2e0(%rbp), %rsi
leaq -0x308(%rbp), %rdx
callq 0xb7b0
jmp 0x1977e
leaq 0x21203(%rip), %rdx     # 0x3a988
leaq -0x2a0(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
callq 0xb4c0
jmp 0x1979a
leaq -0x2a0(%rbp), %rdi
callq 0x4150
movq %rax, %rsi
xorl %edi, %edi
movb %dil, %al
callq 0x47d0
jmp 0x197b5
leaq -0x2a0(%rbp), %rdi
callq 0x41f0
leaq -0x2c0(%rbp), %rdi
callq 0x41f0
leaq -0x308(%rbp), %rdi
callq 0x41f0
leaq -0x2e0(%rbp), %rdi
callq 0x41f0
leaq -0x2e1(%rbp), %rdi
callq 0x4370
jmp 0x198cc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x19836
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x1982a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x258(%rbp), %rdi
callq 0x41f0
leaq -0x278(%rbp), %rdi
callq 0x41f0
leaq -0x279(%rbp), %rdi
callq 0x4370
jmp 0x19bd5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x198bb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x198af
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x198a3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x19897
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x2a0(%rbp), %rdi
callq 0x41f0
leaq -0x2c0(%rbp), %rdi
callq 0x41f0
leaq -0x308(%rbp), %rdi
callq 0x41f0
leaq -0x2e0(%rbp), %rdi
callq 0x41f0
leaq -0x2e1(%rbp), %rdi
callq 0x4370
jmp 0x19bd5
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
callq 0x4150
movq %rax, -0x3e8(%rbp)
movl -0x24(%rbp), %esi
leaq -0x328(%rbp), %rdi
movq %rdi, -0x3f0(%rbp)
callq 0x7770
movq -0x3f0(%rbp), %rdi
callq 0x4150
movq -0x3e8(%rbp), %rsi
movq %rax, %rdx
leaq 0x2108f(%rip), %rdi     # 0x3a9a5
xorl %eax, %eax
callq 0x4050
jmp 0x1991f
leaq -0x328(%rbp), %rdi
callq 0x41f0
cmpl $0xd046, -0x24(%rbp)    # imm = 0xD046
jne 0x19966
movq -0x10(%rbp), %rdi
addq $0x4, %rdi
movl -0x14(%rbp), %esi
subl $0x3, %esi
callq 0x1b630
jmp 0x1998b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x328(%rbp), %rdi
callq 0x41f0
jmp 0x19bd5
movq -0x10(%rbp), %rsi
addq $0x4, %rsi
movl -0x14(%rbp), %edx
subl $0x3, %edx
leaq 0x1ae64(%rip), %rdi     # 0x347df
movl $0x1, %ecx
movl $0x10, %r8d
callq 0x7860
jmp 0x19bcc
movq -0x10(%rbp), %rdi
addq $0x1, %rdi
movl -0x14(%rbp), %esi
callq 0x1b710
jmp 0x19bcc
movq -0x360(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x1, %rsi
movl -0x14(%rbp), %edx
callq 0x17e80
jmp 0x19bcc
movq -0x360(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x1, %rsi
movl -0x14(%rbp), %edx
callq 0x18190
jmp 0x19bcc
movq -0x10(%rbp), %rdi
addq $0x1, %rdi
movl -0x14(%rbp), %esi
callq 0x1bab0
jmp 0x19bcc
movq -0x360(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x1, %rsi
movl -0x14(%rbp), %edx
callq 0x18700
jmp 0x19bcc
movq -0x360(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x1, %rsi
movl -0x14(%rbp), %edx
callq 0x18780
jmp 0x19bcc
movq -0x360(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x1, %rsi
movl -0x14(%rbp), %edx
callq 0x188f0
jmp 0x19bcc
movq -0x10(%rbp), %rdi
addq $0x1, %rdi
movl -0x14(%rbp), %esi
callq 0x1bc60
movq -0x360(%rbp), %rax
testb $0x1, 0x2d5(%rax)
jne 0x19a76
xorl %edi, %edi
leaq 0x20ff2(%rip), %rsi     # 0x3aa61
movb $0x0, %al
callq 0x47d0
jmp 0x19bcc
movq -0x360(%rbp), %rax
testb $0x1, 0x2d2(%rax)
jne 0x19a9b
xorl %edi, %edi
leaq 0x20fee(%rip), %rsi     # 0x3aa82
movb $0x0, %al
callq 0x47d0
movq -0x360(%rbp), %rax
testb $0x1, 0x2d4(%rax)
jne 0x19abb
movq -0x360(%rbp), %rax
testb $0x1, 0x2d3(%rax)
je 0x19acb
xorl %edi, %edi
leaq 0x20ff9(%rip), %rsi     # 0x3aabd
movb $0x0, %al
callq 0x47d0
cmpl $0x2, -0x14(%rbp)
jae 0x19b65
leaq -0x349(%rbp), %rdi
movq %rdi, -0x3f8(%rbp)
callq 0x4560
movq -0x3f8(%rbp), %rdx
leaq 0x20fe8(%rip), %rsi     # 0x3aade
leaq -0x348(%rbp), %rdi
callq 0xb510
jmp 0x19b04
movq -0x360(%rbp), %rdi
addq $0x30, %rdi
leaq -0x348(%rbp), %rsi
callq 0x43d0
leaq -0x348(%rbp), %rdi
callq 0x41f0
leaq -0x349(%rbp), %rdi
callq 0x4370
movl -0x14(%rbp), %edx
xorl %edi, %edi
leaq 0x20faf(%rip), %rsi     # 0x3aaee
movb $0x0, %al
callq 0x47d0
jmp 0x19bcc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x349(%rbp), %rdi
callq 0x4370
jmp 0x19bd5
movq -0x10(%rbp), %rax
cmpb $0x0, 0x1(%rax)
jne 0x19b79
movq -0x10(%rbp), %rax
cmpb $0x0, 0x2(%rax)
je 0x19b87
leaq 0x20f86(%rip), %rdi     # 0x3ab06
movb $0x0, %al
callq 0x4050
movq -0x10(%rbp), %rdi
addq $0x3, %rdi
movl -0x14(%rbp), %esi
subl $0x2, %esi
callq 0x1bcb0
movq -0x360(%rbp), %rax
movb $0x1, 0x2d4(%rax)
jmp 0x19bcc
movq -0x10(%rbp), %rsi
addq $0x1, %rsi
movl -0x14(%rbp), %edx
leaq 0x1ac23(%rip), %rdi     # 0x347df
movl $0x1, %ecx
movl $0x10, %r8d
callq 0x7860
addq $0x400, %rsp            # imm = 0x400
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x4550
nop