// File: rpavlik[P]edid-decode/parse-base-block.cpp
// Function: edid_state::detailed_display_range_limits(unsigned char const*)
void edid_state::detailed_display_range_limits(const unsigned char *x)
{
	int h_max_offset = 0, h_min_offset = 0;
	int v_max_offset = 0, v_min_offset = 0;
	int is_cvt = 0;
	bool has_sec_gtf = false;
	std::string range_class;

	data_block = "Display Range Limits";
	printf("  %s:\n", data_block.c_str());
	base.has_display_range_descriptor = 1;

	if (base.edid_minor >= 4) {
		if (x[4] & 0x02) {
			v_max_offset = 255;
			if (x[4] & 0x01) {
				v_min_offset = 255;
			}
		}
		if (x[4] & 0x08) {
			h_max_offset = 255;
			if (x[4] & 0x04) {
				h_min_offset = 255;
			}
		}
	}

	/*
	 * despite the values, this is not a bitfield.
	 */
	switch (x[10]) {
	case 0x00: /* default gtf */
		range_class = "GTF";
		if (base.edid_minor >= 4 && !base.supports_continuous_freq)
			fail("GTF can't be combined with non-continuous frequencies.\n");
		if (base.edid_minor >= 4)
			warn("GTF support is deprecated in EDID 1.4.\n");
		break;
	case 0x01: /* range limits only */
		range_class = "Bare Limits";
		if (base.edid_minor < 4)
			fail("'%s' is not allowed for EDID < 1.4.\n", range_class.c_str());
		break;
	case 0x02: /* secondary gtf curve */
		range_class = "Secondary GTF";
		if (base.edid_minor >= 4 && !base.supports_continuous_freq)
			fail("GTF can't be combined with non-continuous frequencies.\n");
		if (base.edid_minor >= 4)
			warn("GTF support is deprecated in EDID 1.4.\n");
		has_sec_gtf = true;
		break;
	case 0x04: /* cvt */
		range_class = "CVT";
		is_cvt = 1;
		if (base.edid_minor < 4)
			fail("'%s' is not allowed for EDID < 1.4.\n", range_class.c_str());
		else if (!base.supports_continuous_freq)
			fail("CVT can't be combined with non-continuous frequencies.\n");
		break;
	default: /* invalid */
		fail("Unknown range class (0x%02x).\n", x[10]);
		range_class = std::string("Unknown (") + utohex(x[10]) + ")";
		break;
	}

	if (x[5] + v_min_offset > x[6] + v_max_offset)
		fail("Min vertical rate > max vertical rate.\n");
	base.min_display_vert_freq_hz = x[5] + v_min_offset;
	base.max_display_vert_freq_hz = x[6] + v_max_offset;
	if (x[7] + h_min_offset > x[8] + h_max_offset)
		fail("Min horizontal freq > max horizontal freq.\n");
	base.min_display_hor_freq_hz = (x[7] + h_min_offset) * 1000;
	base.max_display_hor_freq_hz = (x[8] + h_max_offset) * 1000;
	printf("    Monitor ranges (%s): %d-%d Hz V, %d-%d kHz H",
	       range_class.c_str(),
	       x[5] + v_min_offset, x[6] + v_max_offset,
	       x[7] + h_min_offset, x[8] + h_max_offset);

	// For EDID 1.3 the horizontal frequency maxes out at 255 kHz.
	// So to avoid false range-check warnings due to this limitation,
	// just double the max_display_hor_freq_hz in this case.
	if (base.edid_minor < 4 && x[8] == 0xff)
		base.max_display_hor_freq_hz *= 2;

	// For EDID 1.3 the vertical frequency maxes out at 255 Hz.
	// So to avoid false range-check warnings due to this limitation,
	// just double the max_display_vert_freq_hz in this case.
	if (base.edid_minor < 4 && x[6] == 0xff)
		base.max_display_vert_freq_hz *= 2;

	if (x[9]) {
		base.max_display_pixclk_khz = x[9] * 10000;
		printf(", max dotclock %d MHz\n", x[9] * 10);
	} else {
		if (base.edid_minor >= 4)
			fail("EDID 1.4 block does not set max dotclock.\n");
		printf("\n");
	}

	if (has_sec_gtf) {
		if (x[11])
			fail("Byte 11 is 0x%02x instead of 0x00.\n", x[11]);
		if (memchk(x + 12, 6)) {
			fail("Zeroed Secondary Curve Block.\n");
		} else {
			printf("    GTF Secondary Curve Block:\n");
			printf("      Start frequency: %u kHz\n", x[12] * 2);
			printf("      C: %.1f%%\n", x[13] / 2.0);
			printf("      M: %u%%/kHz\n", (x[15] << 8) | x[14]);
			printf("      K: %u\n", x[16]);
			printf("      J: %.1f%%\n", x[17] / 2.0);
		}
	} else if (is_cvt) {
		int max_h_pixels = 0;

		printf("    CVT version %d.%d\n", (x[11] & 0xf0) >> 4, x[11] & 0x0f);

		if (x[12] & 0xfc) {
			unsigned raw_offset = (x[12] & 0xfc) >> 2;

			printf("    Real max dotclock: %.2f MHz\n",
			       (x[9] * 10) - (raw_offset * 0.25));
			if (raw_offset >= 40)
				warn("CVT block corrects dotclock by more than 9.75 MHz.\n");
		}

		max_h_pixels = x[12] & 0x03;
		max_h_pixels <<= 8;
		max_h_pixels |= x[13];
		max_h_pixels *= 8;
		if (max_h_pixels)
			printf("    Max active pixels per line: %d\n", max_h_pixels);

		printf("    Supported aspect ratios:%s%s%s%s%s\n",
		       x[14] & 0x80 ? " 4:3" : "",
		       x[14] & 0x40 ? " 16:9" : "",
		       x[14] & 0x20 ? " 16:10" : "",
		       x[14] & 0x10 ? " 5:4" : "",
		       x[14] & 0x08 ? " 15:9" : "");
		if (x[14] & 0x07)
			fail("Reserved bits of byte 14 are non-zero.\n");

		printf("    Preferred aspect ratio: ");
		switch ((x[15] & 0xe0) >> 5) {
		case 0x00:
			printf("4:3");
			break;
		case 0x01:
			printf("16:9");
			break;
		case 0x02:
			printf("16:10");
			break;
		case 0x03:
			printf("5:4");
			break;
		case 0x04:
			printf("15:9");
			break;
		default:
			printf("Unknown (0x%02x)", (x[15] & 0xe0) >> 5);
			fail("Invalid preferred aspect ratio 0x%02x.\n",
			     (x[15] & 0xe0) >> 5);
			break;
		}
		printf("\n");

		if (x[15] & 0x08)
			printf("    Supports CVT standard blanking\n");
		if (x[15] & 0x10)
			printf("    Supports CVT reduced blanking\n");

		if (x[15] & 0x07)
			fail("Reserved bits of byte 15 are non-zero.\n");

		if (x[16] & 0xf0) {
			printf("    Supported display scaling:\n");
			if (x[16] & 0x80)
				printf("      Horizontal shrink\n");
			if (x[16] & 0x40)
				printf("      Horizontal stretch\n");
			if (x[16] & 0x20)
				printf("      Vertical shrink\n");
			if (x[16] & 0x10)
				printf("      Vertical stretch\n");
		}

		if (x[16] & 0x0f)
			fail("Reserved bits of byte 16 are non-zero.\n");

		if (x[17])
			printf("    Preferred vertical refresh: %d Hz\n", x[17]);
		else
			warn("CVT block does not set preferred refresh rate.\n");
	} else {
		if (x[11] != 0x0a)
			fail("Byte 11 is 0x%02x instead of 0x0a.\n", x[11]);
		for (unsigned i = 12; i <= 17; i++) {
			if (x[i] != 0x20) {
				fail("Bytes 12-17 must be 0x20.\n");
				break;
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xf8(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movb $0x0, -0x25(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x4430
movq -0xf8(%rbp), %rdi
addq $0x30, %rdi
leaq 0x23eae(%rip), %rsi     # 0x33b3e
callq 0x4420
jmp 0xfc97
movq -0xf8(%rbp), %rdi
addq $0x30, %rdi
callq 0x4150
movq %rax, %rsi
leaq 0x24440(%rip), %rdi     # 0x340f1
xorl %eax, %eax
callq 0x4050
jmp 0xfcba
movq -0xf8(%rbp), %rax
movb $0x1, 0x8d(%rax)
cmpl $0x4, 0x88(%rax)
jb 0xfd46
movq -0x10(%rbp), %rax
movzbl 0x4(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0xfd14
movl $0xff, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x4(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xfd12
movl $0xff, -0x20(%rbp)
jmp 0xfd12
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x10820
jmp 0xfd14
movq -0x10(%rbp), %rax
movzbl 0x4(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0xfd44
movl $0xff, -0x14(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x4(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0xfd42
movl $0xff, -0x18(%rbp)
jmp 0xfd44
jmp 0xfd46
movq -0x10(%rbp), %rax
movzbl 0xa(%rax), %eax
movq %rax, -0x100(%rbp)
subq $0x4, %rax
ja 0xff1e
movq -0x100(%rbp), %rax
leaq 0x218e7(%rip), %rcx     # 0x31654
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x23e71(%rip), %rsi     # 0x33bee
leaq -0x48(%rbp), %rdi
callq 0x4420
jmp 0xfd88
movq -0xf8(%rbp), %rax
cmpl $0x4, 0x88(%rax)
jb 0xfdbd
movq -0xf8(%rbp), %rax
testb $0x1, 0x90(%rax)
jne 0xfdbd
leaq 0x23da4(%rip), %rsi     # 0x33b53
xorl %edi, %edi
movb %dil, %al
callq 0x47d0
jmp 0xfdbb
jmp 0xfdbd
movq -0xf8(%rbp), %rax
cmpl $0x4, 0x88(%rax)
jb 0xfde4
leaq 0x23db7(%rip), %rsi     # 0x33b8b
xorl %eax, %eax
movl $0x1, %edi
callq 0x47d0
jmp 0xfde2
jmp 0xfde4
jmp 0x10066
leaq 0x23dc3(%rip), %rsi     # 0x33bb3
leaq -0x48(%rbp), %rdi
callq 0x4420
jmp 0xfdfb
movq -0xf8(%rbp), %rax
cmpl $0x4, 0x88(%rax)
jae 0xfe2c
leaq -0x48(%rbp), %rdi
callq 0x4150
movq %rax, %rdx
leaq 0x23da1(%rip), %rsi     # 0x33bbf
xorl %edi, %edi
movb %dil, %al
callq 0x47d0
jmp 0xfe2a
jmp 0xfe2c
jmp 0x10066
leaq 0x23dac(%rip), %rsi     # 0x33be4
leaq -0x48(%rbp), %rdi
callq 0x4420
jmp 0xfe43
movq -0xf8(%rbp), %rax
cmpl $0x4, 0x88(%rax)
jb 0xfe78
movq -0xf8(%rbp), %rax
testb $0x1, 0x90(%rax)
jne 0xfe78
leaq 0x23ce9(%rip), %rsi     # 0x33b53
xorl %edi, %edi
movb %dil, %al
callq 0x47d0
jmp 0xfe76
jmp 0xfe78
movq -0xf8(%rbp), %rax
cmpl $0x4, 0x88(%rax)
jb 0xfe9f
leaq 0x23cfc(%rip), %rsi     # 0x33b8b
xorl %eax, %eax
movl $0x1, %edi
callq 0x47d0
jmp 0xfe9d
jmp 0xfe9f
movb $0x1, -0x25(%rbp)
jmp 0x10066
leaq 0x1ffc4(%rip), %rsi     # 0x2fe73
leaq -0x48(%rbp), %rdi
callq 0x4420
jmp 0xfeba
movq -0xf8(%rbp), %rax
movl $0x1, -0x24(%rbp)
cmpl $0x4, 0x88(%rax)
jae 0xfef2
leaq -0x48(%rbp), %rdi
callq 0x4150
movq %rax, %rdx
leaq 0x23cdb(%rip), %rsi     # 0x33bbf
xorl %edi, %edi
movb %dil, %al
callq 0x47d0
jmp 0xfef0
jmp 0xff19
movq -0xf8(%rbp), %rax
testb $0x1, 0x90(%rax)
jne 0xff17
leaq 0x23ce9(%rip), %rsi     # 0x33bf2
xorl %edi, %edi
movb %dil, %al
callq 0x47d0
jmp 0xff15
jmp 0xff17
jmp 0xff19
jmp 0x10066
movq -0x10(%rbp), %rax
movzbl 0xa(%rax), %edx
leaq 0x23cfd(%rip), %rsi     # 0x33c2a
xorl %edi, %edi
movb %dil, %al
callq 0x47d0
jmp 0xff39
leaq -0xb9(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0x4560
movq -0x108(%rbp), %rdx
leaq 0x23cef(%rip), %rsi     # 0x33c49
leaq -0xb8(%rbp), %rdi
callq 0xb510
jmp 0xff68
movq -0x10(%rbp), %rax
movzbl 0xa(%rax), %esi
leaq -0xe0(%rbp), %rdi
callq 0x7530
jmp 0xff7e
leaq -0x98(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
leaq -0xe0(%rbp), %rdx
callq 0xb7b0
jmp 0xff9a
leaq 0x2c974(%rip), %rdx     # 0x3c915
leaq -0x78(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0xb4c0
jmp 0xffb3
leaq -0x48(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x43d0
leaq -0x78(%rbp), %rdi
callq 0x41f0
leaq -0x98(%rbp), %rdi
callq 0x41f0
leaq -0xe0(%rbp), %rdi
callq 0x41f0
leaq -0xb8(%rbp), %rdi
callq 0x41f0
leaq -0xb9(%rbp), %rdi
callq 0x4370
jmp 0x10066
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x10055
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x10049
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x1003d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x41f0
leaq -0xe0(%rbp), %rdi
callq 0x41f0
leaq -0xb8(%rbp), %rdi
callq 0x41f0
leaq -0xb9(%rbp), %rdi
callq 0x4370
jmp 0x10820
movq -0x10(%rbp), %rax
movzbl 0x5(%rax), %eax
addl -0x20(%rbp), %eax
movq -0x10(%rbp), %rcx
movzbl 0x6(%rcx), %ecx
addl -0x1c(%rbp), %ecx
cmpl %ecx, %eax
jle 0x10095
leaq 0x23bcc(%rip), %rsi     # 0x33c53
xorl %edi, %edi
movb %dil, %al
callq 0x47d0
jmp 0x10093
jmp 0x10095
movq -0xf8(%rbp), %rax
movq -0x10(%rbp), %rcx
movzbl 0x5(%rcx), %ecx
addl -0x20(%rbp), %ecx
movl %ecx, 0x168(%rax)
movq -0x10(%rbp), %rcx
movzbl 0x6(%rcx), %ecx
addl -0x1c(%rbp), %ecx
movl %ecx, 0x16c(%rax)
movq -0x10(%rbp), %rax
movzbl 0x7(%rax), %eax
addl -0x18(%rbp), %eax
movq -0x10(%rbp), %rcx
movzbl 0x8(%rcx), %ecx
addl -0x14(%rbp), %ecx
cmpl %ecx, %eax
jle 0x100ed
leaq 0x23b9c(%rip), %rsi     # 0x33c7b
xorl %edi, %edi
movb %dil, %al
callq 0x47d0
jmp 0x100eb
jmp 0x100ed
movq -0xf8(%rbp), %rax
movq -0x10(%rbp), %rcx
movzbl 0x7(%rcx), %ecx
movl -0x18(%rbp), %edx
addl %edx, %ecx
imull $0x3e8, %ecx, %ecx      # imm = 0x3E8
movl %ecx, 0x160(%rax)
movq -0x10(%rbp), %rcx
movzbl 0x8(%rcx), %ecx
movl -0x14(%rbp), %edx
addl %edx, %ecx
imull $0x3e8, %ecx, %ecx      # imm = 0x3E8
movl %ecx, 0x164(%rax)
leaq -0x48(%rbp), %rdi
callq 0x4150
movq %rax, %rsi
movq -0x10(%rbp), %rax
movzbl 0x5(%rax), %edx
movl -0x20(%rbp), %ecx
addl %ecx, %edx
movzbl 0x6(%rax), %ecx
movl -0x1c(%rbp), %edi
addl %edi, %ecx
movzbl 0x7(%rax), %r8d
movl -0x18(%rbp), %edi
addl %edi, %r8d
movzbl 0x8(%rax), %r9d
movl -0x14(%rbp), %eax
addl %eax, %r9d
leaq 0x23b42(%rip), %rdi     # 0x33ca7
xorl %eax, %eax
callq 0x4050
jmp 0x1016e
movq -0xf8(%rbp), %rax
cmpl $0x4, 0x88(%rax)
jae 0x101a2
movq -0x10(%rbp), %rax
movzbl 0x8(%rax), %eax
cmpl $0xff, %eax
jne 0x101a2
movq -0xf8(%rbp), %rax
movl 0x164(%rax), %ecx
shll %ecx
movl %ecx, 0x164(%rax)
movq -0xf8(%rbp), %rax
cmpl $0x4, 0x88(%rax)
jae 0x101d6
movq -0x10(%rbp), %rax
movzbl 0x6(%rax), %eax
cmpl $0xff, %eax
jne 0x101d6
movq -0xf8(%rbp), %rax
movl 0x16c(%rax), %ecx
shll %ecx
movl %ecx, 0x16c(%rax)
movq -0x10(%rbp), %rax
cmpb $0x0, 0x9(%rax)
je 0x1021c
movq -0xf8(%rbp), %rax
movq -0x10(%rbp), %rcx
movzbl 0x9(%rcx), %ecx
imull $0x2710, %ecx, %ecx     # imm = 0x2710
movl %ecx, 0x170(%rax)
movq -0x10(%rbp), %rax
movzbl 0x9(%rax), %ecx
addl %ecx, %ecx
movl %ecx, %eax
leal (%rax,%rax,4), %esi
leaq 0x23ac7(%rip), %rdi     # 0x33cd8
xorl %eax, %eax
callq 0x4050
jmp 0x1021a
jmp 0x10253
movq -0xf8(%rbp), %rax
cmpl $0x4, 0x88(%rax)
jb 0x10241
leaq 0x23abc(%rip), %rsi     # 0x33cef
xorl %edi, %edi
movb %dil, %al
callq 0x47d0
jmp 0x1023f
jmp 0x10241
leaq 0x1f6c1(%rip), %rdi     # 0x2f909
xorl %eax, %eax
callq 0x4050
jmp 0x10251
jmp 0x10253
testb $0x1, -0x25(%rbp)
je 0x10375
movq -0x10(%rbp), %rax
cmpb $0x0, 0xb(%rax)
je 0x10284
movq -0x10(%rbp), %rax
movzbl 0xb(%rax), %edx
leaq 0x23aa4(%rip), %rsi     # 0x33d1a
xorl %edi, %edi
movb %dil, %al
callq 0x47d0
jmp 0x10282
jmp 0x10284
movq -0x10(%rbp), %rdi
addq $0xc, %rdi
movl $0x6, %esi
xorl %edx, %edx
callq 0x7810
movb %al, -0x109(%rbp)
jmp 0x102a0
movb -0x109(%rbp), %al
testb $0x1, %al
jne 0x102ac
jmp 0x102c4
leaq 0x23a8b(%rip), %rsi     # 0x33d3e
xorl %edi, %edi
movb %dil, %al
callq 0x47d0
jmp 0x102bf
jmp 0x10370
leaq 0x23a92(%rip), %rdi     # 0x33d5d
xorl %eax, %eax
callq 0x4050
jmp 0x102d4
movq -0x10(%rbp), %rax
movzbl 0xc(%rax), %esi
addl %esi, %esi
leaq 0x23a98(%rip), %rdi     # 0x33d7d
xorl %eax, %eax
callq 0x4050
jmp 0x102ee
movq -0x10(%rbp), %rax
movzbl 0xd(%rax), %eax
cvtsi2sd %eax, %xmm0
movsd 0x1ed16(%rip), %xmm1    # 0x2f018
mulsd %xmm1, %xmm0
leaq 0x23a8f(%rip), %rdi     # 0x33d9c
movb $0x1, %al
callq 0x4050
jmp 0x10316
movq -0x10(%rbp), %rax
movzwl 0xe(%rax), %esi
leaq 0x23a88(%rip), %rdi     # 0x33dad
xorl %eax, %eax
callq 0x4050
jmp 0x1032e
movq -0x10(%rbp), %rax
movzbl 0x10(%rax), %esi
leaq 0x23a83(%rip), %rdi     # 0x33dc0
xorl %eax, %eax
callq 0x4050
jmp 0x10346
movq -0x10(%rbp), %rax
movzbl 0x11(%rax), %eax
cvtsi2sd %eax, %xmm0
movsd 0x1ecbe(%rip), %xmm1    # 0x2f018
mulsd %xmm1, %xmm0
leaq 0x23a68(%rip), %rdi     # 0x33dcd
movb $0x1, %al
callq 0x4050
jmp 0x1036e
jmp 0x10370
jmp 0x1080e
cmpl $0x0, -0x24(%rbp)
je 0x10792
movl $0x0, -0xe4(%rbp)
movq -0x10(%rbp), %rax
movzbl 0xb(%rax), %edx
movl %edx, %esi
shrl $0x4, %esi
andl $0xf, %edx
leaq 0x23a3e(%rip), %rdi     # 0x33dde
xorl %eax, %eax
callq 0x4050
jmp 0x103a9
movq -0x10(%rbp), %rax
movzbl 0xc(%rax), %eax
andl $0xfc, %eax
cmpl $0x0, %eax
je 0x1042c
movq -0x10(%rbp), %rax
movzbl 0xc(%rax), %eax
shrl $0x2, %eax
movl %eax, -0xe8(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x9(%rax), %ecx
addl %ecx, %ecx
movl %ecx, %eax
leal (%rax,%rax,4), %eax
cvtsi2sd %eax, %xmm0
movl -0xe8(%rbp), %eax
cvtsi2sd %rax, %xmm1
movsd 0x2348e(%rip), %xmm2    # 0x33880
mulsd %xmm2, %xmm1
addsd %xmm1, %xmm0
leaq 0x239f4(%rip), %rdi     # 0x33df5
movb $0x1, %al
callq 0x4050
jmp 0x1040a
cmpl $0x28, -0xe8(%rbp)
jb 0x1042a
leaq 0x239fc(%rip), %rsi     # 0x33e16
xorl %eax, %eax
movl $0x1, %edi
callq 0x47d0
jmp 0x10428
jmp 0x1042a
jmp 0x1042c
movq -0x10(%rbp), %rax
movzbl 0xc(%rax), %eax
andl $0x3, %eax
movl %eax, -0xe4(%rbp)
movl -0xe4(%rbp), %eax
shll $0x8, %eax
movl %eax, -0xe4(%rbp)
movq -0x10(%rbp), %rax
movzbl 0xd(%rax), %eax
orl -0xe4(%rbp), %eax
movl %eax, -0xe4(%rbp)
movl -0xe4(%rbp), %eax
shll $0x3, %eax
movl %eax, -0xe4(%rbp)
cmpl $0x0, -0xe4(%rbp)
je 0x10490
movl -0xe4(%rbp), %esi
leaq 0x239c5(%rip), %rdi     # 0x33e4a
xorl %eax, %eax
callq 0x4050
jmp 0x1048e
jmp 0x10490
movq -0x10(%rbp), %rax
movzbl 0xe(%rax), %eax
movb %al, %dil
testb %dil, %dil
leaq 0x239f1(%rip), %rax     # 0x33e96
leaq 0x1fa0d(%rip), %r9      # 0x2feb9
movq %r9, %rsi
cmovsq %rax, %rsi
leaq 0x239e1(%rip), %rax     # 0x33e9b
testb $0x40, %dil
movq %r9, %rdx
cmovneq %rax, %rdx
leaq 0x239d5(%rip), %rax     # 0x33ea1
testb $0x20, %dil
movq %r9, %rcx
cmovneq %rax, %rcx
leaq 0x239ca(%rip), %rax     # 0x33ea8
testb $0x10, %dil
movq %r9, %r8
cmovneq %rax, %r8
leaq 0x239bd(%rip), %rax     # 0x33ead
testb $0x8, %dil
cmovneq %rax, %r9
leaq 0x2396f(%rip), %rdi     # 0x33e6e
xorl %eax, %eax
callq 0x4050
jmp 0x10508
movq -0x10(%rbp), %rax
movzbl 0xe(%rax), %eax
andl $0x7, %eax
cmpl $0x0, %eax
je 0x1052d
leaq 0x23994(%rip), %rsi     # 0x33eb3
xorl %edi, %edi
movb %dil, %al
callq 0x47d0
jmp 0x1052b
jmp 0x1052d
leaq 0x239a7(%rip), %rdi     # 0x33edb
xorl %eax, %eax
callq 0x4050
jmp 0x1053d
movq -0x10(%rbp), %rax
movzbl 0xf(%rax), %eax
shrl $0x5, %eax
movl %eax, %ecx
movq %rcx, -0x118(%rbp)
subl $0x4, %eax
ja 0x105ca
movq -0x118(%rbp), %rax
leaq 0x21104(%rip), %rcx     # 0x31668
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x23923(%rip), %rdi     # 0x33e97
xorl %eax, %eax
callq 0x4050
jmp 0x1057d
jmp 0x10605
leaq 0x23913(%rip), %rdi     # 0x33e9c
xorl %eax, %eax
callq 0x4050
jmp 0x10592
jmp 0x10605
leaq 0x23907(%rip), %rdi     # 0x33ea2
xorl %eax, %eax
callq 0x4050
jmp 0x105a4
jmp 0x10605
leaq 0x238fc(%rip), %rdi     # 0x33ea9
xorl %eax, %eax
callq 0x4050
jmp 0x105b6
jmp 0x10605
leaq 0x238ef(%rip), %rdi     # 0x33eae
xorl %eax, %eax
callq 0x4050
jmp 0x105c8
jmp 0x10605
movq -0x10(%rbp), %rax
movzbl 0xf(%rax), %esi
shrl $0x5, %esi
leaq 0x2391c(%rip), %rdi     # 0x33ef8
xorl %eax, %eax
callq 0x4050
jmp 0x105e5
movq -0x10(%rbp), %rax
movzbl 0xf(%rax), %edx
shrl $0x5, %edx
leaq 0x23912(%rip), %rsi     # 0x33f09
xorl %edi, %edi
movb %dil, %al
callq 0x47d0
jmp 0x10603
jmp 0x10605
leaq 0x1f2fd(%rip), %rdi     # 0x2f909
xorl %eax, %eax
callq 0x4050
jmp 0x10615
movq -0x10(%rbp), %rax
movzbl 0xf(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x10637
leaq 0x23905(%rip), %rdi     # 0x33f31
xorl %eax, %eax
callq 0x4050
jmp 0x10635
jmp 0x10637
movq -0x10(%rbp), %rax
movzbl 0xf(%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x10659
leaq 0x23907(%rip), %rdi     # 0x33f55
xorl %eax, %eax
callq 0x4050
jmp 0x10657
jmp 0x10659
movq -0x10(%rbp), %rax
movzbl 0xf(%rax), %eax
andl $0x7, %eax
cmpl $0x0, %eax
je 0x1067e
leaq 0x23908(%rip), %rsi     # 0x33f78
xorl %edi, %edi
movb %dil, %al
callq 0x47d0
jmp 0x1067c
jmp 0x1067e
movq -0x10(%rbp), %rax
movzbl 0x10(%rax), %eax
andl $0xf0, %eax
cmpl $0x0, %eax
je 0x10730
leaq 0x23905(%rip), %rdi     # 0x33fa0
xorl %eax, %eax
callq 0x4050
jmp 0x106a4
movq -0x10(%rbp), %rax
movzbl 0x10(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x106c8
leaq 0x23903(%rip), %rdi     # 0x33fc0
xorl %eax, %eax
callq 0x4050
jmp 0x106c6
jmp 0x106c8
movq -0x10(%rbp), %rax
movzbl 0x10(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x106ea
leaq 0x238fa(%rip), %rdi     # 0x33fd9
xorl %eax, %eax
callq 0x4050
jmp 0x106e8
jmp 0x106ea
movq -0x10(%rbp), %rax
movzbl 0x10(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x1070c
leaq 0x238f2(%rip), %rdi     # 0x33ff3
xorl %eax, %eax
callq 0x4050
jmp 0x1070a
jmp 0x1070c
movq -0x10(%rbp), %rax
movzbl 0x10(%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x1072e
leaq 0x238e7(%rip), %rdi     # 0x3400a
xorl %eax, %eax
callq 0x4050
jmp 0x1072c
jmp 0x1072e
jmp 0x10730
movq -0x10(%rbp), %rax
movzbl 0x10(%rax), %eax
andl $0xf, %eax
cmpl $0x0, %eax
je 0x10755
leaq 0x238db(%rip), %rsi     # 0x34022
xorl %edi, %edi
movb %dil, %al
callq 0x47d0
jmp 0x10753
jmp 0x10755
movq -0x10(%rbp), %rax
cmpb $0x0, 0x11(%rax)
je 0x10779
movq -0x10(%rbp), %rax
movzbl 0x11(%rax), %esi
leaq 0x238dc(%rip), %rdi     # 0x3404a
xorl %eax, %eax
callq 0x4050
jmp 0x10777
jmp 0x10790
leaq 0x238f1(%rip), %rsi     # 0x34071
xorl %eax, %eax
movl $0x1, %edi
callq 0x47d0
jmp 0x1078e
jmp 0x10790
jmp 0x1080c
movq -0x10(%rbp), %rax
movzbl 0xb(%rax), %eax
cmpl $0xa, %eax
je 0x107bc
movq -0x10(%rbp), %rax
movzbl 0xb(%rax), %edx
leaq 0x238f3(%rip), %rsi     # 0x340a1
xorl %edi, %edi
movb %dil, %al
callq 0x47d0
jmp 0x107ba
jmp 0x107bc
movl $0xc, -0xec(%rbp)
cmpl $0x11, -0xec(%rbp)
ja 0x1080a
movq -0x10(%rbp), %rax
movl -0xec(%rbp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x20, %eax
je 0x107f7
leaq 0x238dc(%rip), %rsi     # 0x340c5
xorl %edi, %edi
movb %dil, %al
callq 0x47d0
jmp 0x107f5
jmp 0x1080a
jmp 0x107f9
movl -0xec(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xec(%rbp)
jmp 0x107c6
jmp 0x1080c
jmp 0x1080e
leaq -0x48(%rbp), %rdi
callq 0x41f0
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
leaq -0x48(%rbp), %rdi
callq 0x41f0
movq -0x50(%rbp), %rdi
callq 0x4550
nopw %cs:(%rax,%rax)