// File: /workspace/github_c_makefile_star2_O2/tvlabs[P]edge264/edge264_test.c
// Function: decode_file
static int decode_file(const char *name0)
{
	// process file names
	if (trace_file)
		fprintf(trace_file, "\n--- # %s\n", name0);
	int len = strrchr(name0, '.') - name0;
	if (strcmp(name0 + len + 1, "264") != 0)
		return 0;
	char name1[len + 5], name2[len + 7];
	snprintf(name1, sizeof(name1), "%.*s.yuv", len, name0);
	snprintf(name2, sizeof(name2), "%.*s.1.yuv", len, name0);
	
	// open and memory map all input files
	int quit = 0;
	conf[0] = conf[1] = NULL;
	#ifdef _WIN32
		HANDLE f0 = NULL, f1 = NULL, f2 = NULL, m0 = NULL, m1 = NULL, m2 = NULL;
		void *v0 = NULL, *v1 = NULL, *v2 = NULL;
		if ((f0 = CreateFileA(name0, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE ||
			(m0 = CreateFileMappingA(f0, NULL, PAGE_READONLY, 0, 0, NULL)) == NULL ||
			(v0 = MapViewOfFile(m0, FILE_MAP_READ, 0, 0, 0)) == NULL) {
			printf("Error opening file %s: %lu\n", name0, GetLastError());
			quit = 1;
		}
		if (enable_yuv) {
			if ((f1 = CreateFileA(name1, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) {
				printf("%s%s not found\n", moveup, name1);
				moveup = "";
			} else if ((m1 = CreateFileMappingA(f1, NULL, PAGE_READONLY, 0, 0, NULL)) == NULL ||
				(conf[0] = v1 = MapViewOfFile(m1, FILE_MAP_READ, 0, 0, 0)) == NULL) {
				printf("Error opening file %s: %lu\n", name1, GetLastError());
				quit = 1;
			}
			f2 = CreateFileA(name2, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
			if (f2 != INVALID_HANDLE_VALUE &&
				((m2 = CreateFileMappingA(f2, NULL, PAGE_READONLY, 0, 0, NULL)) == NULL ||
				(conf[1] = v2 = MapViewOfFile(m2, FILE_MAP_READ, 0, 0, 0)) == NULL)) {
				printf("Error opening file %s: %lu\n", name2, GetLastError());
				quit = 1;
			}
		}
		const uint8_t *nal = v0;
		const uint8_t *end0 = v0 + GetFileSize(f0, NULL);
		const uint8_t *end1 = v1 + GetFileSize(f1, NULL);
	#else
		int fd0 = -1, fd1 = -1, fd2 = -1;
		struct stat st0, st1, st2;
		uint8_t *mm0 = MAP_FAILED, *mm1 = MAP_FAILED, *mm2 = MAP_FAILED;
		if ((fd0 = open(name0, O_RDONLY)) < 0 ||
			fstat(fd0, &st0) < 0 ||
			(mm0 = mmap(NULL, st0.st_size, PROT_READ, MAP_SHARED, fd0, 0)) == MAP_FAILED) {
			perror(name0);
			quit = 1;
		}
		if (enable_yuv) {
			if ((fd1 = open(name1, O_RDONLY)) < 0) {
				printf("%s%s not found\n", moveup, name1);
				moveup = "";
			} else if (fstat(fd1, &st1) < 0 ||
				(conf[0] = mm1 = mmap(NULL, st1.st_size, PROT_READ, MAP_SHARED, fd1, 0)) == MAP_FAILED) {
				perror(name1);
				quit = 1;
			}
			fd2 = open(name2, O_RDONLY);
			if (fd2 >= 0 && (fstat(fd2, &st2) < 0 ||
				(conf[1] = mm2 = mmap(NULL, st2.st_size, PROT_READ, MAP_SHARED, fd2, 0)) == MAP_FAILED)) {
				perror(name2);
				quit = 1;
			}
		}
		const uint8_t *nal = mm0;
		const uint8_t *end0 = mm0 + st0.st_size;
		const uint8_t *end1 = mm1 + st1.st_size;
	#endif
	
	// print the success counts
	if (!quit) {
		if (count_flag > 0)
			printf("%s%d " GREEN "PASS" RESET ", %d " YELLOW "UNSUPPORTED" RESET ", %d " RED "FAIL" RESET ", %d " BLUE "FLAGGED" RESET " (%s)\n", moveup, count_pass, count_unsup, count_fail, count_flag, name0);
		else
			printf("%s%d " GREEN "PASS" RESET ", %d " YELLOW "UNSUPPORTED" RESET ", %d " RED "FAIL" RESET " (%s)\n", moveup, count_pass, count_unsup, count_fail, name0);
		moveup = "\e[A\e[K";
		
		// decode the entire file and FAIL on any error
		nal += 3 + (nal[2] == 0); // skip the [0]001 delimiter
		int res;
		do {
			res = edge264_decode_NAL(d, nal, end0, 0, NULL, NULL, &nal);
			while (!edge264_get_frame(d, &out, 0)) {
				if (conf[0] != NULL && check_frame()) {
					res = EBADMSG;
					break;
				} else if (display && draw_frame()) {
					res = ENODATA;
					quit = 1;
					break;
				}
			}
		} while (res == 0 || res == ENOBUFS);
		edge264_flush(d);
		if (res == ENOBUFS || (res == ENODATA && conf[0] != NULL && conf[0] != end1))
			res = EBADMSG;
		// FIXME interrupt all threads before closing the files!
		
		// print the file that was decoded
		count_pass += res == ENODATA;
		count_unsup += res == ENOTSUP;
		count_fail += res == EBADMSG;
		count_flag += res == ESRCH;
		if (res == ENODATA && print_passed) {
			printf("%s%s: " GREEN "PASS" RESET "\n", moveup, name0);
			moveup = "";
		} else if (res == ENOTSUP && print_unsupported) {
			printf("%s%s: " YELLOW "UNSUPPORTED" RESET "\n", moveup, name0);
			moveup = "";
		} else if (res == EBADMSG && print_failed) {
			printf("%s%s: " RED "FAIL" RESET "\n", moveup, name0);
			moveup = "";
		} else if (res == ESRCH) {
			printf("%s%s: " BLUE "FLAGGED" RESET "\n", moveup, name0);
			moveup = "";
		}
	}
	
	// close everything
	#ifdef _WIN32
		UnmapViewOfFile(v0);
		UnmapViewOfFile(v1);
		UnmapViewOfFile(v2);
		CloseHandle(m0);
		CloseHandle(m1);
		CloseHandle(m2);
		CloseHandle(f0);
		CloseHandle(f1);
		CloseHandle(f2);
	#else
		munmap(mm0, st0.st_size);
		munmap(mm1, st1.st_size);
		munmap(mm2, st2.st_size);
		close(fd0);
		close(fd1);
		close(fd2);
	#endif
	return quit;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x328, %rsp            # imm = 0x328
movq %rdi, %r13
movq 0x3763(%rip), %rdi      # 0x5140
testq %rdi, %rdi
je 0x19f3
leaq 0x1b33(%rip), %rsi      # 0x351c
movq %r13, %rdx
xorl %eax, %eax
callq 0x1160
pushq $0x2e
popq %rsi
movq %r13, %rdi
callq 0x10f0
movq %rax, %r12
subq %r13, %r12
movslq %r12d, %rax
leaq (%rax,%r13), %rdi
incq %rdi
leaq 0x1cf2(%rip), %rsi      # 0x3707
callq 0x1140
xorl %ecx, %ecx
testl %eax, %eax
jne 0x2702
movq %rsp, -0x138(%rbp)
leal 0x5(%r12), %esi
movq %rsp, %r15
leaq 0xf(%rsi), %rax
andq $-0x10, %rax
subq %rax, %r15
movq %r15, %rsp
leal 0x7(%r12), %ebx
movq %rsp, %r14
leaq 0xf(%rbx), %rax
andq $-0x10, %rax
subq %rax, %r14
movq %r14, %rsp
leaq 0x1ac9(%rip), %rdx      # 0x3527
movq %r15, %rdi
movl %r12d, %ecx
movq %r13, %r8
xorl %eax, %eax
callq 0x10e0
leaq 0x1abb(%rip), %rdx      # 0x3530
movq %r14, %rdi
movq %rbx, %rsi
movl %r12d, %ecx
movq %r13, %r8
xorl %eax, %eax
callq 0x10e0
xorps %xmm0, %xmm0
movaps %xmm0, 0x379e(%rip)     # 0x5230
movq %r13, -0x48(%rbp)
movq %r13, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x11a0
testl %eax, %eax
movl %eax, -0x70(%rbp)
js 0x1c7a
leaq -0x2b8(%rbp), %rsi
movl %eax, %edi
callq 0x1210
testl %eax, %eax
js 0x1c7a
movq -0x288(%rbp), %rsi
xorl %ebx, %ebx
pushq $0x1
popq %rcx
xorl %edi, %edi
movl %ecx, %edx
movl -0x70(%rbp), %r8d
xorl %r9d, %r9d
callq 0x10c0
movq %rax, %rdi
cmpq $-0x1, %rax
je 0x1c7a
pushq $-0x1
popq %r13
cmpb $0x0, 0x3661(%rip)      # 0x5158
je 0x1b0b
pushq $-0x1
popq %rax
movl %eax, -0x34(%rbp)
movl %eax, -0x6c(%rbp)
movq %r13, -0x50(%rbp)
jmp 0x1bf4
movq %rdi, %r12
movq %r15, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x11a0
testl %eax, %eax
movl %eax, -0x34(%rbp)
js 0x1b6b
leaq -0x228(%rbp), %rsi
movl %eax, %edi
callq 0x1210
testl %eax, %eax
js 0x1b5e
movq -0x1f8(%rbp), %rsi
pushq $0x1
popq %rcx
xorl %edi, %edi
movl %ecx, %edx
movl -0x34(%rbp), %r8d
xorl %r9d, %r9d
callq 0x10c0
movq %rax, 0x36dc(%rip)      # 0x5230
movq %rax, -0x50(%rbp)
cmpq $-0x1, %rax
jne 0x1b98
pushq $0x1
popq %rbx
movq %r15, %rdi
callq 0x11d0
jmp 0x1b91
movq 0x35ae(%rip), %rsi      # 0x5120
leaq 0x19c2(%rip), %rdi      # 0x353b
movq %r15, %rdx
xorl %eax, %eax
callq 0x10d0
leaq 0x1b0f(%rip), %rax      # 0x3699
movq %rax, 0x358f(%rip)      # 0x5120
pushq $-0x1
popq %rax
movq %rax, -0x50(%rbp)
movq %r14, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x11a0
testl %eax, %eax
movl %eax, -0x6c(%rbp)
js 0x1bf1
leaq -0x348(%rbp), %rsi
movl %eax, %r15d
movl %eax, %edi
callq 0x1210
testl %eax, %eax
js 0x25a3
movq -0x318(%rbp), %rsi
pushq $0x1
popq %rcx
xorl %edi, %edi
movl %ecx, %edx
movl %r15d, %r8d
xorl %r9d, %r9d
callq 0x10c0
movq %rax, 0x3654(%rip)      # 0x5238
cmpq $-0x1, %rax
je 0x25a3
movq %rax, %r13
movq %r12, %rdi
movq %rdi, -0xb0(%rbp)
testl %ebx, %ebx
movq %r13, -0x130(%rbp)
je 0x1c11
pushq $0x1
popq %rax
movl %eax, -0x30(%rbp)
jmp 0x26b1
movq -0x288(%rbp), %rax
movq %rdi, -0x108(%rbp)
addq %rdi, %rax
movq %rax, -0x120(%rbp)
movq -0x1f8(%rbp), %rax
addq -0x50(%rbp), %rax
movq %rax, -0x118(%rbp)
movl 0x3526(%rip), %r9d      # 0x5168
movq 0x34d7(%rip), %rsi      # 0x5120
movl 0x351d(%rip), %edx      # 0x516c
movl 0x351b(%rip), %ecx      # 0x5170
movl 0x3518(%rip), %r8d      # 0x5174
testl %r9d, %r9d
jle 0x1c8e
subq $0x8, %rsp
leaq 0x18df(%rip), %rdi      # 0x354b
xorl %eax, %eax
pushq -0x48(%rbp)
callq 0x10d0
popq %rcx
popq %rdx
jmp 0x1ca0
movq -0x48(%rbp), %rdi
callq 0x11d0
pushq $-0x1
popq %rdi
pushq $0x1
popq %rbx
jmp 0x1aec
leaq 0x190f(%rip), %rdi      # 0x35a4
movq -0x48(%rbp), %r9
xorl %eax, %eax
callq 0x10d0
leaq 0x1941(%rip), %rax      # 0x35e8
movq %rax, 0x3472(%rip)      # 0x5120
leaq -0xb0(%rbp), %r10
movq (%r10), %rsi
cmpb $0x1, 0x2(%rsi)
adcq $0x3, %rsi
movq %rsi, (%r10)
pushq $0x1
popq %rax
movl %eax, -0x30(%rbp)
movq 0x3490(%rip), %rdi      # 0x5160
subq $0x8, %rsp
movq -0x120(%rbp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq %r10
callq 0x1060
popq %rcx
popq %rdx
movl %eax, -0xb4(%rbp)
movq 0x3467(%rip), %rdi      # 0x5160
leaq 0x3540(%rip), %rsi      # 0x5240
xorl %edx, %edx
callq 0x11f0
testl %eax, %eax
jne 0x2352
cmpq $0x0, 0x3519(%rip)      # 0x5230
je 0x20f6
movq 0x3534(%rip), %rax      # 0x5258
testq %rax, %rax
setne %dl
movq 0x3507(%rip), %rcx      # 0x5238
testq %rcx, %rcx
setne %sil
cmpb %sil, %dl
jne 0x25b3
movswl 0x3548(%rip), %eax      # 0x5290
movswl 0x3543(%rip), %ecx      # 0x5292
movswl 0x353e(%rip), %edx      # 0x5294
movswl 0x3539(%rip), %esi      # 0x5296
movswl 0x3516(%rip), %edi      # 0x527a
movl %esi, -0xc8(%rbp)
addl %esi, %ecx
addl %edi, %ecx
sarl $0x4, %ecx
movswl 0x3506(%rip), %esi      # 0x527e
movl %eax, -0xc0(%rbp)
addl %eax, %edx
addl %esi, %edx
sarl $0x4, %edx
testl %edx, %edx
movl $0x0, %eax
cmovlel %eax, %edx
movl %edx, -0xcc(%rbp)
testl %ecx, %ecx
cmovlel %eax, %ecx
movl %ecx, -0xc4(%rbp)
movsbl 0x34d1(%rip), %ecx      # 0x5278
movsbl 0x34cb(%rip), %eax      # 0x5279
movswl 0x34c7(%rip), %edx      # 0x527c
movl %edi, -0x78(%rbp)
movl %ecx, -0xf4(%rbp)
shll %cl, %edi
movl %edx, -0xec(%rbp)
movl %eax, -0xf0(%rbp)
movl %eax, %ecx
shll %cl, %edx
movswl 0x34a9(%rip), %ecx      # 0x5280
movl %edi, -0xe8(%rbp)
movl %edi, %eax
movl %esi, -0x74(%rbp)
imull %esi, %eax
movl %ecx, -0xe0(%rbp)
movl %edx, -0xe4(%rbp)
imull %edx, %ecx
leal (%rax,%rcx,2), %eax
cltq
movq %rax, -0x110(%rbp)
movl 0x3486(%rip), %eax      # 0x528c
movl %eax, -0xbc(%rbp)
movl 0x3476(%rip), %eax      # 0x5288
movl %eax, -0xb8(%rbp)
movzwl 0x3463(%rip), %eax      # 0x5282
movl %eax, -0xdc(%rbp)
movzwl 0x3458(%rip), %eax      # 0x5284
movl %eax, -0xd8(%rbp)
xorl %eax, %eax
cmpq $0x2, %rax
je 0x20f6
movq %rax, -0x80(%rbp)
leaq 0x33e7(%rip), %rax      # 0x5230
movq -0x80(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movq -0x80(%rbp), %rax
movq %rcx, -0x90(%rbp)
testq %rcx, %rcx
je 0x20f6
testq %rax, %rax
leaq 0x33e9(%rip), %rcx      # 0x5258
leaq 0x33ca(%rip), %rax      # 0x5240
cmoveq %rax, %rcx
movq %rcx, -0x150(%rbp)
xorl %eax, %eax
cmpl -0xc4(%rbp), %eax
je 0x20ce
movl %eax, -0x64(%rbp)
shll $0x4, %eax
subl -0xc0(%rbp), %eax
testl %eax, %eax
movl $0x0, %ecx
cmovgl %eax, %ecx
movl %ecx, -0xd4(%rbp)
leal 0x10(%rax), %ecx
movl -0x74(%rbp), %edx
cmpl %edx, %ecx
movl %ecx, -0x38(%rbp)
cmovll %ecx, %edx
movl %edx, -0xd0(%rbp)
xorl %ecx, %ecx
movq %rax, -0x88(%rbp)
cmpl -0xcc(%rbp), %ecx
je 0x20c4
movl %ecx, -0x68(%rbp)
shll $0x4, %ecx
subl -0xc8(%rbp), %ecx
testl %ecx, %ecx
movl $0x0, %edx
cmovgl %ecx, %edx
movl %edx, -0xfc(%rbp)
movq %rcx, -0x128(%rbp)
addl $0x10, %ecx
movl -0x78(%rbp), %edx
cmpl %edx, %ecx
movl %ecx, -0x3c(%rbp)
cmovll %ecx, %edx
movl %edx, -0xf8(%rbp)
xorl %r9d, %r9d
cmpq $0x3, %r9
je 0x20ba
movl $0x0, -0x58(%rbp)
testq %r9, %r9
movl -0xf0(%rbp), %r11d
cmovel -0xf4(%rbp), %r11d
movl -0xd8(%rbp), %ecx
movq %r9, -0x98(%rbp)
movl %ecx, %edx
cmovel -0xdc(%rbp), %edx
setne %cl
movl $0x0, %esi
cmovnel -0xe8(%rbp), %esi
movl -0x74(%rbp), %edi
movl -0xe0(%rbp), %ebx
cmpw %di, %bx
setl %r8b
movl -0x78(%rbp), %r14d
cmpw %r14w, -0xec(%rbp)
setl %r10b
andb %cl, %r10b
andb %cl, %r8b
imull %edi, %esi
cmpq $0x2, %r9
movl $0x0, %edi
cmovel -0xe4(%rbp), %edi
movl -0xfc(%rbp), %eax
movl %r10d, %ecx
shrl %cl, %eax
movl -0xf8(%rbp), %r9d
sarl %cl, %r9d
movslq %esi, %r12
movl -0xd4(%rbp), %ecx
movl %ecx, %r15d
movl %r8d, %ecx
shrl %cl, %r15d
movl -0xd0(%rbp), %esi
movb %r8b, -0x2a(%rbp)
sarl %cl, %esi
imull %ebx, %edi
movslq %edi, %r13
movl %eax, %edi
movl %r11d, %ecx
shll %cl, %edi
movb %r10b, -0x29(%rbp)
movl %r10d, %ecx
sarl %cl, %r14d
movl %r11d, %ecx
shll %cl, %r14d
movslq %edi, %rcx
movslq %r14d, %rdi
movq %rdi, -0x160(%rbp)
imulq %r15, %rdi
leaq (%rcx,%r13), %rbx
addq %r12, %rbx
movq -0x90(%rbp), %r8
addq %r8, %rbx
addq %rdi, %rbx
movq %r8, %rdi
movswq %dx, %r14
movq %r14, -0xa8(%rbp)
imulq %r15, %r14
movq -0x150(%rbp), %rdx
movq -0x98(%rbp), %r8
movq (%rdx,%r8,8), %rdx
movq %rdx, -0x60(%rbp)
addq %rdx, %r14
addq %rcx, %r14
movl %r9d, -0x100(%rbp)
movl %eax, -0xa0(%rbp)
subl %eax, %r9d
movl %r11d, %ecx
shll %cl, %r9d
movq %r12, -0x148(%rbp)
leaq (%rdi,%r12), %rax
movq %r13, -0x140(%rbp)
addq %r13, %rax
movq %rax, -0x158(%rbp)
movslq %r9d, %r13
movslq %esi, %r12
movl -0x100(%rbp), %eax
cmpl -0xa0(%rbp), %eax
jle 0x20a1
cmpq %r12, %r15
jge 0x20a1
movq %r14, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x1130
orl %eax, -0x58(%rbp)
incq %r15
addq -0x160(%rbp), %rbx
addq -0xa8(%rbp), %r14
jmp 0x206a
cmpl $0x0, -0x58(%rbp)
jne 0x237b
movq -0x98(%rbp), %r9
incq %r9
jmp 0x1f0e
movl -0x68(%rbp), %ecx
incl %ecx
jmp 0x1ec8
movl -0x64(%rbp), %eax
incl %eax
jmp 0x1e83
movq -0x90(%rbp), %rdx
addq -0x110(%rbp), %rdx
leaq 0x314d(%rip), %rax      # 0x5230
movq -0x80(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq %rcx, %rax
incq %rax
jmp 0x1e34
cmpb $0x1, 0x304b(%rip)      # 0x5148
jne 0x1cf2
xorl %eax, %eax
cmpq $0x0, 0x314b(%rip)      # 0x5258
setne %al
movswl 0x3163(%rip), %esi      # 0x527a
movswl 0x3160(%rip), %edx      # 0x527e
cmpl %esi, 0x317c(%rip)      # 0x52a0
jne 0x213a
cmpl %edx, 0x3178(%rip)      # 0x52a4
jne 0x213a
cmpl %eax, 0x3174(%rip)      # 0x52a8
je 0x2254
movl %esi, 0x3160(%rip)      # 0x52a0
movl %edx, 0x315e(%rip)      # 0x52a4
movl %eax, 0x315c(%rip)      # 0x52a8
movq 0x3055(%rip), %rdi      # 0x51a8
testq %rdi, %rdi
je 0x2198
callq *0x307a(%rip)           # 0x51d8
movq 0x3043(%rip), %rdi      # 0x51a8
movl $0x2fff0000, %esi       # imm = 0x2FFF0000
movl $0x2fff0000, %edx       # imm = 0x2FFF0000
callq *0x306b(%rip)           # 0x51e0
movq 0x3004(%rip), %rdi      # 0x5180
callq *0x2ff6(%rip)           # 0x5178
movq 0x2fff(%rip), %rdi      # 0x5188
callq *0x2fe9(%rip)           # 0x5178
movq 0x3002(%rip), %rdi      # 0x5198
jmp 0x21eb
movl $0x4020, %edi           # imm = 0x4020
callq *0x301d(%rip)           # 0x51c0
movl 0x30f7(%rip), %ecx      # 0x52a0
movl 0x30f4(%rip), %r8d      # 0x52a4
leaq 0x1542(%rip), %rdi      # 0x36f9
movl $0x2fff0000, %esi       # imm = 0x2FFF0000
movl $0x2fff0000, %edx       # imm = 0x2FFF0000
pushq $0x14
popq %r9
callq *0x2ffd(%rip)           # 0x51c8
movq %rax, 0x2fd6(%rip)      # 0x51a8
movq %rax, %rdi
pushq $-0x1
popq %rsi
pushq $0x6
popq %rdx
callq *0x2fef(%rip)           # 0x51d0
movq %rax, %rdi
movq %rax, 0x2fad(%rip)      # 0x5198
movl 0x30af(%rip), %ecx      # 0x52a0
movl 0x30ac(%rip), %r8d      # 0x52a4
movl $0x56555949, %esi       # imm = 0x56555949
pushq $0x1
popq %rbx
movl %ebx, %edx
callq *0x2fe0(%rip)           # 0x51e8
movq %rax, 0x2f71(%rip)      # 0x5180
movq 0x2f82(%rip), %rdi      # 0x5198
movl 0x3084(%rip), %ecx      # 0x52a0
movl 0x3081(%rip), %r8d      # 0x52a4
movl $0x56555949, %esi       # imm = 0x56555949
movl %ebx, %edx
callq *0x2fb8(%rip)           # 0x51e8
movq %rax, 0x2f51(%rip)      # 0x5188
movq %rax, %rdi
movl %ebx, %esi
callq *0x2fae(%rip)           # 0x51f0
movq 0x2f3f(%rip), %rdi      # 0x5188
movl $0x80, %esi
callq *0x2fa4(%rip)           # 0x51f8
movq 0x2f25(%rip), %rdi      # 0x5180
movq 0x2fde(%rip), %rdx      # 0x5240
movswl 0x3019(%rip), %ecx      # 0x5282
movq 0x2fd8(%rip), %r8       # 0x5248
movswl 0x300c(%rip), %r9d      # 0x5284
xorl %esi, %esi
pushq %r9
pushq 0x2fce(%rip)            # 0x5250
callq *0x2f78(%rip)           # 0x5200
addq $0x10, %rsp
movq 0x2f05(%rip), %rdi      # 0x5198
callq *0x2f6f(%rip)           # 0x5208
movq 0x2ef8(%rip), %rdi      # 0x5198
movq 0x2ed9(%rip), %rsi      # 0x5180
xorl %edx, %edx
xorl %ecx, %ecx
callq *0x2f5f(%rip)           # 0x5210
cmpl $0x0, 0x2ff0(%rip)      # 0x52a8
je 0x230a
movq 0x2ec7(%rip), %rdi      # 0x5188
movq 0x2f90(%rip), %rdx      # 0x5258
movswl 0x2fb3(%rip), %ecx      # 0x5282
movq 0x2f8a(%rip), %r8       # 0x5260
movswl 0x2fa6(%rip), %r9d      # 0x5284
xorl %esi, %esi
pushq %r9
pushq 0x2f80(%rip)            # 0x5268
callq *0x2f12(%rip)           # 0x5200
addq $0x10, %rsp
movq 0x2e9f(%rip), %rdi      # 0x5198
movq 0x2e88(%rip), %rsi      # 0x5188
xorl %edx, %edx
xorl %ecx, %ecx
callq *0x2f06(%rip)           # 0x5210
movq 0x2e87(%rip), %rdi      # 0x5198
callq *0x2f01(%rip)           # 0x5218
leaq -0x198(%rbp), %rdi
callq *0x2efc(%rip)           # 0x5220
testl %eax, %eax
je 0x1cf2
movl -0x198(%rbp), %eax
cmpl $0x100, %eax            # imm = 0x100
je 0x259a
cmpl $0x300, %eax            # imm = 0x300
jne 0x2317
cmpl $0x1b, -0x184(%rbp)
jne 0x2317
jmp 0x259a
movl -0xb4(%rbp), %r14d
cmpl $0x69, %r14d
leaq -0xb0(%rbp), %r10
je 0x236f
testl %r14d, %r14d
jne 0x274a
movq -0xb0(%rbp), %rsi
jmp 0x1cc9
cmpq $0x0, -0x80(%rbp)
movl -0xbc(%rbp), %esi
cmovel -0xb8(%rbp), %esi
movq -0x98(%rbp), %rdx
cmpq $0x1, %rdx
leaq 0x133c(%rip), %rax      # 0x36db
leaq 0x1338(%rip), %rcx      # 0x36de
cmoveq %rax, %rcx
testq %rdx, %rdx
leaq 0x1322(%rip), %r8       # 0x36d6
cmovneq %rcx, %r8
leaq 0x12db(%rip), %rdi      # 0x369a
movl -0x64(%rbp), %edx
movl -0x68(%rbp), %ecx
xorl %eax, %eax
callq 0x10d0
movb -0x2a(%rbp), %cl
movq -0x88(%rbp), %rax
sarl %cl, %eax
movl -0x38(%rbp), %edx
sarl %cl, %edx
movb -0x29(%rbp), %cl
movq -0x128(%rbp), %rdi
sarl %cl, %edi
movl -0x3c(%rbp), %esi
sarl %cl, %esi
movslq %edi, %rcx
movq %rcx, -0x58(%rbp)
movl %esi, -0x3c(%rbp)
movslq %esi, %r15
movq %rax, -0x88(%rbp)
movslq %eax, %r12
movl %edx, -0x38(%rbp)
movslq %edx, %rax
movq %rax, -0xa0(%rbp)
movq %r12, %rax
imulq -0xa8(%rbp), %rax
addq %rax, -0x60(%rbp)
leaq 0x12b9(%rip), %r14      # 0x36e1
leaq 0x12b7(%rip), %r13      # 0x36e6
cmpq -0xa0(%rbp), %r12
jge 0x24d8
movq -0x58(%rbp), %rbx
cmpq %r15, %rbx
jge 0x24b9
movq %r14, %rdi
testq %r12, %r12
js 0x24a5
movswl 0x2e2a(%rip), %eax      # 0x527e
movb -0x2a(%rbp), %cl
sarl %cl, %eax
movq %r14, %rdi
testq %rbx, %rbx
js 0x24a5
cltq
movq %r14, %rdi
cmpq %rax, %r12
jge 0x24a5
movswl 0x2e08(%rip), %eax      # 0x527a
movb -0x29(%rbp), %cl
sarl %cl, %eax
movslq %eax, %rcx
movq %r14, %rdi
cmpq %rcx, %rbx
jge 0x24a5
movq -0x60(%rbp), %rcx
movb (%rcx,%rbx), %cl
imull %r12d, %eax
addl %ebx, %eax
movq %r13, %rdi
movq -0x158(%rbp), %rdx
cmpb (%rdx,%rax), %cl
je 0x24a5
leaq 0x1246(%rip), %rdi      # 0x36eb
movq -0x60(%rbp), %rax
movzbl (%rax,%rbx), %esi
xorl %eax, %eax
callq 0x10d0
incq %rbx
jmp 0x2440
pushq $0xa
popq %rdi
callq 0x1040
incq %r12
movq -0x60(%rbp), %rax
addq -0xa8(%rbp), %rax
movq %rax, -0x60(%rbp)
jmp 0x242f
leaq 0x12b5(%rip), %rdi      # 0x3794
callq 0x1070
movq -0x140(%rbp), %rax
addq -0x148(%rbp), %rax
movq -0x90(%rbp), %r13
addq %rax, %r13
leaq 0x11de(%rip), %r15      # 0x36e1
movq -0x88(%rbp), %r14
cmpl -0x38(%rbp), %r14d
jge 0x25d4
movq -0x58(%rbp), %rbx
movq %r14, %r12
cmpl -0x3c(%rbp), %ebx
jge 0x2587
testl %r14d, %r14d
js 0x255b
movswl 0x2d52(%rip), %edx      # 0x527e
movb -0x2a(%rbp), %cl
sarl %cl, %edx
movzwl 0x2d42(%rip), %eax      # 0x527a
testl %ebx, %ebx
js 0x2562
cmpl %edx, %r14d
jge 0x2562
movswl %ax, %edx
movb -0x29(%rbp), %cl
sarl %cl, %edx
cmpl %edx, %ebx
movq %r15, %rdi
leaq 0x1191(%rip), %rcx      # 0x36e6
cmovlq %rcx, %rdi
jmp 0x2565
movzwl 0x2d18(%rip), %eax      # 0x527a
movq %r15, %rdi
cwtl
movb -0x29(%rbp), %cl
sarl %cl, %eax
movq %r12, %r14
imull %r14d, %eax
cltq
addq %r13, %rax
movzbl (%rbx,%rax), %esi
xorl %eax, %eax
callq 0x10d0
incq %rbx
jmp 0x251b
pushq $0xa
popq %rdi
callq 0x1040
movq %r12, %r14
incl %r14d
jmp 0x250a
pushq $0x3d
popq %r14
pushq $0x4a
popq %rbx
jmp 0x25ef
movq %r14, %rdi
callq 0x11d0
pushq $0x1
popq %rbx
jmp 0x1bf1
cmpq $0x1, %rax
pushq $0x1
popq %rdx
movl %edx, %esi
sbbl $-0x1, %esi
cmpq $0x1, %rcx
sbbl $-0x1, %edx
leaq 0x1080(%rip), %rdi      # 0x364d
xorl %eax, %eax
callq 0x10d0
leaq 0x10be(%rip), %rax      # 0x3699
movq %rax, 0x2b3e(%rip)      # 0x5120
movl $0x0, -0x30(%rbp)
pushq $0x4a
popq %rbx
movl %ebx, %r14d
movq 0x2b6a(%rip), %rdi      # 0x5160
callq 0x1170
movq 0x2c2e(%rip), %rax      # 0x5230
cmpq -0x118(%rbp), %rax
pushq $0x3d
popq %rcx
cmovel %ecx, %ebx
testq %rax, %rax
cmovel %r14d, %ebx
cmpl $0x3d, %r14d
cmovnel %r14d, %ebx
xorl %eax, %eax
cmpl $0x3d, %ebx
sete %al
addl %eax, 0x2b40(%rip)      # 0x516c
xorl %eax, %eax
cmpl $0x5f, %ebx
sete %al
addl %eax, 0x2b36(%rip)      # 0x5170
xorl %eax, %eax
cmpl $0x4a, %ebx
sete %al
addl %eax, 0x2b2c(%rip)      # 0x5174
xorl %eax, %eax
cmpl $0x3, %ebx
sete %al
addl %eax, 0x2b12(%rip)      # 0x5168
cmpl $0x3d, %ebx
jne 0x266d
testb $0x1, 0x2aee(%rip)      # 0x5150
je 0x266d
leaq 0xf84(%rip), %rdi       # 0x35ef
jmp 0x268a
cmpl $0x5f, %ebx
jne 0x2713
testb $0x1, 0x2ad7(%rip)      # 0x5154
je 0x2713
leaq 0xf7a(%rip), %rdi       # 0x3604
movq -0x48(%rbp), %rdx
movq 0x2a8b(%rip), %rsi      # 0x5120
xorl %eax, %eax
callq 0x10d0
leaq 0xff6(%rip), %rax       # 0x3699
movq %rax, 0x2a76(%rip)      # 0x5120
movq -0x108(%rbp), %rdi
movq -0x288(%rbp), %rsi
callq 0x1180
movq -0x1f8(%rbp), %rsi
movq -0x50(%rbp), %rdi
callq 0x1180
movq -0x318(%rbp), %rsi
movq -0x130(%rbp), %rdi
callq 0x1180
movl -0x70(%rbp), %edi
callq 0x1110
movl -0x34(%rbp), %edi
callq 0x1110
movl -0x6c(%rbp), %edi
callq 0x1110
movq -0x138(%rbp), %rsp
movl -0x30(%rbp), %ecx
movl %ecx, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x3, %ebx
setne %al
cmpl $0x4a, %ebx
sete %cl
andb 0x2a27(%rip), %cl       # 0x514c
notb %cl
leaq 0xef2(%rip), %rdx       # 0x3620
leaq 0xf00(%rip), %rdi       # 0x3635
cmovneq %rdx, %rdi
testb %al, %cl
movq -0x48(%rbp), %rdx
jne 0x26aa
jmp 0x268e
movl $0x0, -0x30(%rbp)
jmp 0x259e