// File: rpavlik[P]edid-decode/parse-base-block.cpp
// Function: edid_state::detailed_timings(char const*, unsigned char const*, bool)
void edid_state::detailed_timings(const char *prefix, const unsigned char *x,
				  bool base_or_cta)
{
	struct timings t = {};
	unsigned hbl, vbl;
	std::string s_sync, s_flags;

	// Only count DTDs in base block 0 or CTA-861 extension blocks
	if (base_or_cta)
		base.dtd_cnt++;
	data_block = "Detailed Timing Descriptor #" + std::to_string(base.dtd_cnt);
	t.pixclk_khz = (x[0] + (x[1] << 8)) * 10;
	if (t.pixclk_khz < 10000) {
		printf("%sDetailed mode: ", prefix);
		hex_block("", x, 18, true, 18);
		if (!t.pixclk_khz)
			fail("First two bytes are 0, invalid data.\n");
		else
			fail("Pixelclock < 10 MHz, assuming invalid data 0x%02x 0x%02x.\n",
			     x[0], x[1]);
		return;
	}

	/*
	 * If the borders are non-zero, then it is unclear how to interpret
	 * the DTD blanking parameters.
	 *
	 * According to EDID 1.3 (3.12) the Hor/Vert Blanking includes the
	 * borders, and so does the Hor/Vert Sync Offset.
	 *
	 * According to EDID 1.4 (3.12) the Hor/Vert Blanking excludes the
	 * borders, and they are also excluded from the Hor/Vert Front Porch.
	 *
	 * But looking at what is really done in EDIDs is that the Hor/Vert
	 * Blanking follows EDID 1.3, but the Hor/Vert Front Porch does not
	 * include the border.
	 *
	 * So hbl/vbl includes the borders, so those need to be subtracted,
	 * but hfp/vfp is used as-is.
	 *
	 * In practice you really shouldn't use non-zero borders in DTDs
	 * since clearly nobody knows how to interpret the timing.
	 */
	t.hact = (x[2] + ((x[4] & 0xf0) << 4));
	t.hborder = x[15];
	hbl = (x[3] + ((x[4] & 0x0f) << 8)) - t.hborder * 2;
	t.hfp = (x[8] + ((x[11] & 0xc0) << 2));
	t.hsync = (x[9] + ((x[11] & 0x30) << 4));
	t.hbp = hbl - t.hsync - t.hfp;
	t.vact = (x[5] + ((x[7] & 0xf0) << 4));
	t.vborder = x[16];
	vbl = (x[6] + ((x[7] & 0x0f) << 8)) - t.vborder * 2;
	t.vfp = ((x[10] >> 4) + ((x[11] & 0x0c) << 2));
	t.vsync = ((x[10] & 0x0f) + ((x[11] & 0x03) << 4));
	t.vbp = vbl - t.vsync - t.vfp;

	unsigned char flags = x[17];

	if (base.has_spwg && base.detailed_block_cnt == 2)
		flags = *(x - 1);

	switch ((flags & 0x18) >> 3) {
	case 0x00:
		s_flags = "analog composite";
		/* fall-through */
	case 0x01:
		if (s_flags.empty())
			s_flags = "bipolar analog composite";
		switch ((flags & 0x06) >> 1) {
		case 0x00:
			add_str(s_flags, "sync-on-green");
			break;
		case 0x01:
			break;
		case 0x02:
			add_str(s_flags, "serrate, sync-on-green");
			break;
		case 0x03:
			add_str(s_flags, "serrate");
			break;
		}
		break;
	case 0x02:
		if (flags & (1 << 1))
			t.pos_pol_hsync = true;
		t.no_pol_vsync = true;
		s_flags = "digital composite";
		if (flags & (1 << 2))
		    add_str(s_flags, "serrate");
		break;
	case 0x03:
		if (flags & (1 << 1))
			t.pos_pol_hsync = true;
		if (flags & (1 << 2))
			t.pos_pol_vsync = true;
		s_sync = t.pos_pol_hsync ? "+hsync " : "-hsync ";
		s_sync += t.pos_pol_vsync ? "+vsync " : "-vsync ";
		if (base.has_spwg && (flags & 0x01))
			s_flags = "DE timing only";
		break;
	}
	if (flags & 0x80) {
		t.interlaced = true;
		t.vact *= 2;
		/*
		 * Check if this DTD matches VIC code 39 with special
		 * interlaced timings.
		 */
		if (t.hact == 1920 && t.vact == 1080 && t.pixclk_khz == 72000 &&
		    t.hfp == 32 && t.hsync == 168 && t.hbp == 184 && !t.hborder &&
		    t.vfp == 23 && t.vsync == 5 && t.vbp == 57 && !t.vborder &&
		    !base.has_spwg && cta.preparsed_has_vic[0][39] && (flags & 0x1e) == 0x1a)
			t.even_vtotal = true;
	}
	switch (flags & 0x61) {
	case 0x20:
		add_str(s_flags, "field sequential L/R");
		break;
	case 0x40:
		add_str(s_flags, "field sequential R/L");
		break;
	case 0x21:
		add_str(s_flags, "interleaved right even");
		break;
	case 0x41:
		add_str(s_flags, "interleaved left even");
		break;
	case 0x60:
		add_str(s_flags, "four way interleaved");
		break;
	case 0x61:
		add_str(s_flags, "side by side interleaved");
		break;
	default:
		break;
	}

	t.hsize_mm = x[12] + ((x[14] & 0xf0) << 4);
	t.vsize_mm = x[13] + ((x[14] & 0x0f) << 8);

	calc_ratio(&t);

	std::string s_type = base_or_cta ? dtd_type() : "DTD";
	bool ok = print_timings(prefix, &t, s_type.c_str(), s_flags.c_str(), true);
	timings_ext te(t, s_type, s_flags);

	if (block_nr == 0 && base.dtd_cnt == 1) {
		te.type = "DTD   1";
		base.preferred_timing = te;
		if (has_cta) {
			cta.preferred_timings.push_back(te);
			cta.native_timings.push_back(te);
		}
	}
	if (base_or_cta)
		cta.vec_dtds.push_back(te);

	if (t.hborder || t.vborder)
		warn("The use of non-zero borders in a DTD is not recommended.\n");
	if ((base.max_display_width_mm && !t.hsize_mm) ||
	    (base.max_display_height_mm && !t.vsize_mm)) {
		fail("Mismatch of image size vs display size: image size is not set, but display size is.\n");
	}
	if (base.has_spwg && base.detailed_block_cnt == 2)
		printf("%sSPWG Module Revision: %hhu\n", prefix, x[17]);
	if (!ok) {
		std::string s = prefix;

		s += "               ";
		hex_block(s.c_str(), x, 18, true, 18);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x440, %rsp            # imm = 0x440
movb %cl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
andb $0x1, %al
movb %al, -0x19(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x390(%rbp)
leaq -0x70(%rbp), %rdi
xorl %esi, %esi
movl $0x54, %edx
callq 0x41c0
leaq -0x98(%rbp), %rdi
callq 0x4430
leaq -0xb8(%rbp), %rdi
callq 0x4430
testb $0x1, -0x19(%rbp)
je 0x10e7d
movq -0x390(%rbp), %rax
movl 0xc0(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xc0(%rax)
movq -0x390(%rbp), %rax
movl 0xc0(%rax), %esi
leaq -0xf8(%rbp), %rdi
callq 0xb6d0
jmp 0x10e98
leaq 0x236f2(%rip), %rsi     # 0x34591
leaq -0xd8(%rbp), %rdi
leaq -0xf8(%rbp), %rdx
callq 0x14870
jmp 0x10eb4
movq -0x390(%rbp), %rdi
addq $0x30, %rdi
leaq -0xd8(%rbp), %rsi
callq 0x43d0
leaq -0xd8(%rbp), %rdi
callq 0x41f0
leaq -0xf8(%rbp), %rdi
callq 0x41f0
movq -0x18(%rbp), %rax
movzbl (%rax), %eax
movq -0x18(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
shll $0x8, %ecx
addl %ecx, %eax
imull $0xa, %eax, %eax
movl %eax, -0x60(%rbp)
cmpl $0x2710, -0x60(%rbp)    # imm = 0x2710
jae 0x10fc2
movq -0x10(%rbp), %rsi
leaq 0x23699(%rip), %rdi     # 0x345ae
xorl %eax, %eax
callq 0x4050
jmp 0x10f1e
movq -0x18(%rbp), %rsi
leaq 0x1ef90(%rip), %rdi     # 0x2feb9
movl $0x1, %ecx
movl $0x12, %r8d
movl %r8d, %edx
callq 0x7860
jmp 0x10f3e
cmpl $0x0, -0x60(%rbp)
jne 0x10f93
leaq 0x23675(%rip), %rsi     # 0x345c0
xorl %edi, %edi
movb %dil, %al
callq 0x47d0
jmp 0x10f57
jmp 0x10fb3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
jmp 0x11e9e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x41f0
jmp 0x11e9e
movq -0x18(%rbp), %rax
movzbl (%rax), %edx
movzbl 0x1(%rax), %ecx
leaq 0x23641(%rip), %rsi     # 0x345e6
xorl %edi, %edi
movb %dil, %al
callq 0x47d0
jmp 0x10fb1
jmp 0x10fb3
movl $0x1, -0x108(%rbp)
jmp 0x11e65
movq -0x390(%rbp), %rax
movq -0x18(%rbp), %rcx
movzbl 0x2(%rcx), %ecx
movq -0x18(%rbp), %rdx
movzbl 0x4(%rdx), %edx
andl $0xf0, %edx
shll $0x4, %edx
addl %edx, %ecx
movl %ecx, -0x70(%rbp)
movq -0x18(%rbp), %rcx
movzbl 0xf(%rcx), %ecx
movl %ecx, -0x34(%rbp)
movq -0x18(%rbp), %rcx
movzbl 0x3(%rcx), %ecx
movq -0x18(%rbp), %rdx
movzbl 0x4(%rdx), %edx
andl $0xf, %edx
shll $0x8, %edx
addl %edx, %ecx
movl -0x34(%rbp), %edx
shll %edx
subl %edx, %ecx
movl %ecx, -0x74(%rbp)
movq -0x18(%rbp), %rcx
movzbl 0x8(%rcx), %ecx
movq -0x18(%rbp), %rdx
movzbl 0xb(%rdx), %edx
andl $0xc0, %edx
shll $0x2, %edx
addl %edx, %ecx
movl %ecx, -0x54(%rbp)
movq -0x18(%rbp), %rcx
movzbl 0x9(%rcx), %ecx
movq -0x18(%rbp), %rdx
movzbl 0xb(%rdx), %edx
andl $0x30, %edx
shll $0x4, %edx
addl %edx, %ecx
movl %ecx, -0x50(%rbp)
movl -0x74(%rbp), %ecx
subl -0x50(%rbp), %ecx
subl -0x54(%rbp), %ecx
movl %ecx, -0x4c(%rbp)
movq -0x18(%rbp), %rcx
movzbl 0x5(%rcx), %ecx
movq -0x18(%rbp), %rdx
movzbl 0x7(%rdx), %edx
andl $0xf0, %edx
shll $0x4, %edx
addl %edx, %ecx
movl %ecx, -0x6c(%rbp)
movq -0x18(%rbp), %rcx
movzbl 0x10(%rcx), %ecx
movl %ecx, -0x30(%rbp)
movq -0x18(%rbp), %rcx
movzbl 0x6(%rcx), %ecx
movq -0x18(%rbp), %rdx
movzbl 0x7(%rdx), %edx
andl $0xf, %edx
shll $0x8, %edx
addl %edx, %ecx
movl -0x30(%rbp), %edx
shll %edx
subl %edx, %ecx
movl %ecx, -0x78(%rbp)
movq -0x18(%rbp), %rcx
movzbl 0xa(%rcx), %ecx
sarl $0x4, %ecx
movq -0x18(%rbp), %rdx
movzbl 0xb(%rdx), %edx
andl $0xc, %edx
shll $0x2, %edx
addl %edx, %ecx
movl %ecx, -0x44(%rbp)
movq -0x18(%rbp), %rcx
movzbl 0xa(%rcx), %ecx
andl $0xf, %ecx
movq -0x18(%rbp), %rdx
movzbl 0xb(%rdx), %edx
andl $0x3, %edx
shll $0x4, %edx
addl %edx, %ecx
movl %ecx, -0x40(%rbp)
movl -0x78(%rbp), %ecx
subl -0x40(%rbp), %ecx
subl -0x44(%rbp), %ecx
movl %ecx, -0x3c(%rbp)
movq -0x18(%rbp), %rcx
movb 0x11(%rcx), %cl
movb %cl, -0x109(%rbp)
testb $0x1, 0xb9(%rax)
je 0x1111f
movq -0x390(%rbp), %rax
cmpl $0x2, 0xbc(%rax)
jne 0x1111f
movq -0x18(%rbp), %rax
movb -0x1(%rax), %al
movb %al, -0x109(%rbp)
movzbl -0x109(%rbp), %eax
andl $0x18, %eax
shrl $0x3, %eax
movl %eax, %ecx
movq %rcx, -0x398(%rbp)
subl $0x3, %eax
ja 0x11576
movq -0x398(%rbp), %rax
leaq 0x20548(%rip), %rcx     # 0x31694
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x234cd(%rip), %rsi     # 0x34629
leaq -0xb8(%rbp), %rdi
callq 0x4420
jmp 0x1116a
jmp 0x1116c
leaq -0xb8(%rbp), %rdi
callq 0x4510
testb $0x1, %al
jne 0x1117e
jmp 0x11195
leaq 0x2349c(%rip), %rsi     # 0x34621
leaq -0xb8(%rbp), %rdi
callq 0x4420
jmp 0x11193
jmp 0x11195
movzbl -0x109(%rbp), %eax
andl $0x6, %eax
shrl %eax
movl %eax, %ecx
movq %rcx, -0x3a0(%rbp)
subl $0x3, %eax
ja 0x113b8
movq -0x3a0(%rbp), %rax
leaq 0x204e3(%rip), %rcx     # 0x316a4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0x131(%rbp), %rdi
movq %rdi, -0x3a8(%rbp)
callq 0x4560
movq -0x3a8(%rbp), %rdx
leaq 0x23458(%rip), %rsi     # 0x34643
leaq -0x130(%rbp), %rdi
callq 0xb510
jmp 0x111f9
leaq -0xb8(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0xf000
jmp 0x1120e
leaq -0x130(%rbp), %rdi
callq 0x41f0
leaq -0x131(%rbp), %rdi
callq 0x4370
jmp 0x113b8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
jmp 0x1125d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
leaq -0x130(%rbp), %rdi
callq 0x41f0
leaq -0x131(%rbp), %rdi
callq 0x4370
jmp 0x11e9e
jmp 0x113b8
leaq -0x159(%rbp), %rdi
movq %rdi, -0x3b0(%rbp)
callq 0x4560
movq -0x3b0(%rbp), %rdx
leaq 0x233a6(%rip), %rsi     # 0x3463a
leaq -0x158(%rbp), %rdi
callq 0xb510
jmp 0x112a2
leaq -0xb8(%rbp), %rdi
leaq -0x158(%rbp), %rsi
callq 0xf000
jmp 0x112b7
leaq -0x158(%rbp), %rdi
callq 0x41f0
leaq -0x159(%rbp), %rdi
callq 0x4370
jmp 0x113b8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
jmp 0x11306
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x41f0
leaq -0x159(%rbp), %rdi
callq 0x4370
jmp 0x11e9e
leaq -0x181(%rbp), %rdi
movq %rdi, -0x3b8(%rbp)
callq 0x4560
movq -0x3b8(%rbp), %rdx
leaq 0x23319(%rip), %rsi     # 0x34651
leaq -0x180(%rbp), %rdi
callq 0xb510
jmp 0x11346
leaq -0xb8(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0xf000
jmp 0x1135b
leaq -0x180(%rbp), %rdi
callq 0x41f0
leaq -0x181(%rbp), %rdi
callq 0x4370
jmp 0x113b8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
jmp 0x113a7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
leaq -0x180(%rbp), %rdi
callq 0x41f0
leaq -0x181(%rbp), %rdi
callq 0x4370
jmp 0x11e9e
jmp 0x11576
movzbl -0x109(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x113d0
movb $0x1, -0x48(%rbp)
movb $0x1, -0x2b(%rbp)
leaq 0x2327e(%rip), %rsi     # 0x34659
leaq -0xb8(%rbp), %rdi
callq 0x4420
jmp 0x113e9
movzbl -0x109(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x1149d
leaq -0x1a9(%rbp), %rdi
movq %rdi, -0x3c0(%rbp)
callq 0x4560
movq -0x3c0(%rbp), %rdx
leaq 0x23234(%rip), %rsi     # 0x34651
leaq -0x1a8(%rbp), %rdi
callq 0xb510
jmp 0x1142b
leaq -0xb8(%rbp), %rdi
leaq -0x1a8(%rbp), %rsi
callq 0xf000
jmp 0x11440
leaq -0x1a8(%rbp), %rdi
callq 0x41f0
leaq -0x1a9(%rbp), %rdi
callq 0x4370
jmp 0x1149d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
jmp 0x1148c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
leaq -0x1a8(%rbp), %rdi
callq 0x41f0
leaq -0x1a9(%rbp), %rdi
callq 0x4370
jmp 0x11e9e
jmp 0x11576
movzbl -0x109(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x114b5
movb $0x1, -0x48(%rbp)
movzbl -0x109(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x114c8
movb $0x1, -0x38(%rbp)
testb $0x1, -0x48(%rbp)
je 0x114de
leaq 0x23196(%rip), %rax     # 0x3466b
movq %rax, -0x3c8(%rbp)
jmp 0x114ee
leaq 0x2318e(%rip), %rax     # 0x34673
movq %rax, -0x3c8(%rbp)
jmp 0x114ee
movq -0x3c8(%rbp), %rsi
leaq -0x98(%rbp), %rdi
callq 0x4420
jmp 0x11503
testb $0x1, -0x38(%rbp)
je 0x11519
leaq 0x2316b(%rip), %rax     # 0x3467b
movq %rax, -0x3d0(%rbp)
jmp 0x11529
leaq 0x23163(%rip), %rax     # 0x34683
movq %rax, -0x3d0(%rbp)
jmp 0x11529
movq -0x3d0(%rbp), %rsi
leaq -0x98(%rbp), %rdi
callq 0x4300
jmp 0x1153e
movq -0x390(%rbp), %rax
testb $0x1, 0xb9(%rax)
je 0x11574
movzbl -0x109(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x11574
leaq 0x23127(%rip), %rsi     # 0x3468b
leaq -0xb8(%rbp), %rdi
callq 0x4420
jmp 0x11572
jmp 0x11574
jmp 0x11576
movzbl -0x109(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x1161d
movb $0x1, -0x58(%rbp)
movl -0x6c(%rbp), %eax
shll %eax
movl %eax, -0x6c(%rbp)
cmpl $0x780, -0x70(%rbp)     # imm = 0x780
jne 0x1161b
cmpl $0x438, -0x6c(%rbp)     # imm = 0x438
jne 0x1161b
cmpl $0x11940, -0x60(%rbp)   # imm = 0x11940
jne 0x1161b
cmpl $0x20, -0x54(%rbp)
jne 0x1161b
cmpl $0xa8, -0x50(%rbp)
jne 0x1161b
cmpl $0xb8, -0x4c(%rbp)
jne 0x1161b
cmpl $0x0, -0x34(%rbp)
jne 0x1161b
cmpl $0x17, -0x44(%rbp)
jne 0x1161b
cmpl $0x5, -0x40(%rbp)
jne 0x1161b
cmpl $0x39, -0x3c(%rbp)
jne 0x1161b
cmpl $0x0, -0x30(%rbp)
jne 0x1161b
movq -0x390(%rbp), %rax
testb $0x1, 0xb9(%rax)
jne 0x1161b
movq -0x390(%rbp), %rax
testb $0x1, 0x707(%rax)
je 0x1161b
movzbl -0x109(%rbp), %eax
andl $0x1e, %eax
cmpl $0x1a, %eax
jne 0x1161b
movb $0x1, -0x2c(%rbp)
jmp 0x1161d
movzbl -0x109(%rbp), %eax
andl $0x61, %eax
movl %eax, -0x3d4(%rbp)
subl $0x20, %eax
je 0x1168c
jmp 0x11634
movl -0x3d4(%rbp), %eax
subl $0x21, %eax
je 0x117d4
jmp 0x11645
movl -0x3d4(%rbp), %eax
subl $0x40, %eax
je 0x11730
jmp 0x11656
movl -0x3d4(%rbp), %eax
subl $0x41, %eax
je 0x11878
jmp 0x11667
movl -0x3d4(%rbp), %eax
subl $0x60, %eax
je 0x1191c
jmp 0x11678
movl -0x3d4(%rbp), %eax
subl $0x61, %eax
je 0x119c0
jmp 0x11a61
leaq -0x1d1(%rbp), %rdi
movq %rdi, -0x3e0(%rbp)
callq 0x4560
movq -0x3e0(%rbp), %rdx
leaq 0x22fed(%rip), %rsi     # 0x3469a
leaq -0x1d0(%rbp), %rdi
callq 0xb510
jmp 0x116bb
leaq -0xb8(%rbp), %rdi
leaq -0x1d0(%rbp), %rsi
callq 0xf000
jmp 0x116d0
leaq -0x1d0(%rbp), %rdi
callq 0x41f0
leaq -0x1d1(%rbp), %rdi
callq 0x4370
jmp 0x11a63
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
jmp 0x1171f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0x41f0
leaq -0x1d1(%rbp), %rdi
callq 0x4370
jmp 0x11e9e
leaq -0x1f9(%rbp), %rdi
movq %rdi, -0x3e8(%rbp)
callq 0x4560
movq -0x3e8(%rbp), %rdx
leaq 0x22f5e(%rip), %rsi     # 0x346af
leaq -0x1f8(%rbp), %rdi
callq 0xb510
jmp 0x1175f
leaq -0xb8(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0xf000
jmp 0x11774
leaq -0x1f8(%rbp), %rdi
callq 0x41f0
leaq -0x1f9(%rbp), %rdi
callq 0x4370
jmp 0x11a63
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
jmp 0x117c3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
leaq -0x1f8(%rbp), %rdi
callq 0x41f0
leaq -0x1f9(%rbp), %rdi
callq 0x4370
jmp 0x11e9e
leaq -0x221(%rbp), %rdi
movq %rdi, -0x3f0(%rbp)
callq 0x4560
movq -0x3f0(%rbp), %rdx
leaq 0x22ecf(%rip), %rsi     # 0x346c4
leaq -0x220(%rbp), %rdi
callq 0xb510
jmp 0x11803
leaq -0xb8(%rbp), %rdi
leaq -0x220(%rbp), %rsi
callq 0xf000
jmp 0x11818
leaq -0x220(%rbp), %rdi
callq 0x41f0
leaq -0x221(%rbp), %rdi
callq 0x4370
jmp 0x11a63
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
jmp 0x11867
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x41f0
leaq -0x221(%rbp), %rdi
callq 0x4370
jmp 0x11e9e
leaq -0x249(%rbp), %rdi
movq %rdi, -0x3f8(%rbp)
callq 0x4560
movq -0x3f8(%rbp), %rdx
leaq 0x22e42(%rip), %rsi     # 0x346db
leaq -0x248(%rbp), %rdi
callq 0xb510
jmp 0x118a7
leaq -0xb8(%rbp), %rdi
leaq -0x248(%rbp), %rsi
callq 0xf000
jmp 0x118bc
leaq -0x248(%rbp), %rdi
callq 0x41f0
leaq -0x249(%rbp), %rdi
callq 0x4370
jmp 0x11a63
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
jmp 0x1190b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x41f0
leaq -0x249(%rbp), %rdi
callq 0x4370
jmp 0x11e9e
leaq -0x271(%rbp), %rdi
movq %rdi, -0x400(%rbp)
callq 0x4560
movq -0x400(%rbp), %rdx
leaq 0x22db4(%rip), %rsi     # 0x346f1
leaq -0x270(%rbp), %rdi
callq 0xb510
jmp 0x1194b
leaq -0xb8(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0xf000
jmp 0x11960
leaq -0x270(%rbp), %rdi
callq 0x41f0
leaq -0x271(%rbp), %rdi
callq 0x4370
jmp 0x11a63
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
jmp 0x119af
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
leaq -0x270(%rbp), %rdi
callq 0x41f0
leaq -0x271(%rbp), %rdi
callq 0x4370
jmp 0x11e9e
leaq -0x299(%rbp), %rdi
movq %rdi, -0x408(%rbp)
callq 0x4560
movq -0x408(%rbp), %rdx
leaq 0x22d25(%rip), %rsi     # 0x34706
leaq -0x298(%rbp), %rdi
callq 0xb510
jmp 0x119ef
leaq -0xb8(%rbp), %rdi
leaq -0x298(%rbp), %rsi
callq 0xf000
jmp 0x11a04
leaq -0x298(%rbp), %rdi
callq 0x41f0
leaq -0x299(%rbp), %rdi
callq 0x4370
jmp 0x11a63
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
jmp 0x11a50
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
leaq -0x298(%rbp), %rdi
callq 0x41f0
leaq -0x299(%rbp), %rdi
callq 0x4370
jmp 0x11e9e
jmp 0x11a63
movq -0x18(%rbp), %rcx
movzbl 0xc(%rcx), %eax
movzbl 0xe(%rcx), %ecx
andl $-0x10, %ecx
shll $0x4, %ecx
orl %ecx, %eax
movl %eax, -0x28(%rbp)
movq -0x18(%rbp), %rcx
movzbl 0xd(%rcx), %eax
movzbl 0xe(%rcx), %ecx
andl $0xf, %ecx
shll $0x8, %ecx
orl %ecx, %eax
movl %eax, -0x24(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x4c30
jmp 0x11a9c
movb -0x19(%rbp), %al
movb $0x0, -0x2c2(%rbp)
testb $0x1, %al
je 0x11ac1
movq -0x390(%rbp), %rsi
leaq -0x2c0(%rbp), %rdi
callq 0x148c0
jmp 0x11abf
jmp 0x11af9
leaq -0x2c1(%rbp), %rdi
movq %rdi, -0x410(%rbp)
callq 0x4560
movq -0x410(%rbp), %rdx
movb $0x1, -0x2c2(%rbp)
leaq 0x1d906(%rip), %rsi     # 0x2f3ef
leaq -0x2c0(%rbp), %rdi
callq 0xb510
jmp 0x11af7
jmp 0x11af9
testb $0x1, -0x2c2(%rbp)
jne 0x11b04
jmp 0x11b10
leaq -0x2c1(%rbp), %rdi
callq 0x4370
movq -0x10(%rbp), %rax
movq %rax, -0x428(%rbp)
leaq -0x2c0(%rbp), %rdi
callq 0x4150
movq %rax, -0x420(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x4150
movq -0x390(%rbp), %rdi
movq -0x428(%rbp), %rsi
movq -0x420(%rbp), %rcx
movq %rax, %r8
movq %rsp, %rax
movl $0x1, (%rax)
leaq -0x70(%rbp), %rdx
movl $0x1, %r9d
callq 0x50c0
movb %al, -0x411(%rbp)
jmp 0x11b72
movb -0x411(%rbp), %al
andb $0x1, %al
movb %al, -0x2c3(%rbp)
leaq -0x360(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x2c0(%rbp), %rdx
leaq -0xb8(%rbp), %rcx
callq 0x148f0
jmp 0x11ba0
movq -0x390(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jne 0x11c9f
movq -0x390(%rbp), %rax
cmpl $0x1, 0xc0(%rax)
jne 0x11c9f
leaq -0x308(%rbp), %rdi
leaq 0x22b4c(%rip), %rsi     # 0x3471f
callq 0x4420
jmp 0x11bda
movq -0x390(%rbp), %rdi
addq $0xc8, %rdi
leaq -0x360(%rbp), %rsi
callq 0x149c0
jmp 0x11bf6
movq -0x390(%rbp), %rax
testb $0x1, 0x50(%rax)
je 0x11c9d
movq -0x390(%rbp), %rdi
addq $0x1c0, %rdi            # imm = 0x1C0
leaq -0x360(%rbp), %rsi
callq 0x14a20
jmp 0x11c23
movq -0x390(%rbp), %rdi
addq $0x2a8, %rdi            # imm = 0x2A8
leaq -0x360(%rbp), %rsi
callq 0x14a20
jmp 0x11c3f
jmp 0x11c9d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
testb $0x1, -0x2c2(%rbp)
jne 0x11c5e
jmp 0x11c6a
leaq -0x2c1(%rbp), %rdi
callq 0x4370
jmp 0x11e9e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
jmp 0x11e92
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
jmp 0x11e86
jmp 0x11c9f
testb $0x1, -0x19(%rbp)
je 0x11cc3
movq -0x390(%rbp), %rdi
addq $0x188, %rdi            # imm = 0x188
leaq -0x360(%rbp), %rsi
callq 0x14a20
jmp 0x11cc1
jmp 0x11cc3
cmpl $0x0, -0x34(%rbp)
jne 0x11ccf
cmpl $0x0, -0x30(%rbp)
je 0x11ce6
leaq 0x22a51(%rip), %rsi     # 0x34727
xorl %eax, %eax
movl $0x1, %edi
callq 0x47d0
jmp 0x11ce4
jmp 0x11ce6
movq -0x390(%rbp), %rax
cmpl $0x0, 0x174(%rax)
je 0x11cfc
cmpl $0x0, -0x28(%rbp)
je 0x11d12
movq -0x390(%rbp), %rax
cmpl $0x0, 0x178(%rax)
je 0x11d27
cmpl $0x0, -0x24(%rbp)
jne 0x11d27
leaq 0x22a48(%rip), %rsi     # 0x34761
xorl %edi, %edi
movb %dil, %al
callq 0x47d0
jmp 0x11d25
jmp 0x11d27
movq -0x390(%rbp), %rax
testb $0x1, 0xb9(%rax)
je 0x11d65
movq -0x390(%rbp), %rax
cmpl $0x2, 0xbc(%rax)
jne 0x11d65
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rax
movzbl 0x11(%rax), %edx
leaq 0x22a5c(%rip), %rdi     # 0x347b6
xorl %eax, %eax
callq 0x4050
jmp 0x11d63
jmp 0x11d65
testb $0x1, -0x2c3(%rbp)
jne 0x11e43
movq -0x10(%rbp), %rax
movq %rax, -0x438(%rbp)
leaq -0x381(%rbp), %rdi
movq %rdi, -0x430(%rbp)
callq 0x4560
movq -0x438(%rbp), %rsi
movq -0x430(%rbp), %rdx
leaq -0x380(%rbp), %rdi
callq 0xb510
jmp 0x11dac
leaq -0x381(%rbp), %rdi
callq 0x4370
leaq 0x22a15(%rip), %rsi     # 0x347d4
leaq -0x380(%rbp), %rdi
callq 0x4300
jmp 0x11dcd
leaq -0x380(%rbp), %rdi
callq 0x4150
movq %rax, %rdi
movq -0x18(%rbp), %rsi
movl $0x1, %ecx
movl $0x12, %r8d
movl %r8d, %edx
callq 0x7860
jmp 0x11df5
leaq -0x380(%rbp), %rdi
callq 0x41f0
jmp 0x11e43
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
leaq -0x381(%rbp), %rdi
callq 0x4370
jmp 0x11e86
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x100(%rbp)
movl %eax, -0x104(%rbp)
leaq -0x380(%rbp), %rdi
callq 0x41f0
jmp 0x11e86
leaq -0x360(%rbp), %rdi
callq 0xc3d0
leaq -0x2c0(%rbp), %rdi
callq 0x41f0
movl $0x0, -0x108(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x41f0
leaq -0x98(%rbp), %rdi
callq 0x41f0
addq $0x440, %rsp            # imm = 0x440
popq %rbp
retq
leaq -0x360(%rbp), %rdi
callq 0xc3d0
leaq -0x2c0(%rbp), %rdi
callq 0x41f0
leaq -0xb8(%rbp), %rdi
callq 0x41f0
leaq -0x98(%rbp), %rdi
callq 0x41f0
movq -0x100(%rbp), %rdi
callq 0x4550
nopw %cs:(%rax,%rax)