// File: /workspace/github_c_makefile_star2_O3/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 $0x308, %rsp            # imm = 0x308
movq %rdi, %r13
movq 0x36d1(%rip), %rdi      # 0x5140
testq %rdi, %rdi
je 0x1a85
leaq 0x1aa1(%rip), %rsi      # 0x351c
movq %r13, %rdx
xorl %eax, %eax
callq 0x1160
movq %r13, %rdi
movl $0x2e, %esi
callq 0x10f0
movq %rax, %r15
subq %r13, %r15
movslq %r15d, %rax
leaq (%rax,%r13), %rdi
incq %rdi
leaq 0x1c5e(%rip), %rsi      # 0x3707
callq 0x1140
xorl %r14d, %r14d
testl %eax, %eax
jne 0x27cd
movq %rsp, -0x130(%rbp)
leal 0x5(%r15), %esi
movq %rsp, %rbx
leaq 0xf(%rsi), %rax
andq $-0x10, %rax
subq %rax, %rbx
movq %rbx, %rsp
leal 0x7(%r15), %r12d
movq %rsp, %r14
leaq 0xf(%r12), %rax
andq $-0x10, %rax
subq %rax, %r14
movq %r14, %rsp
leaq 0x1a35(%rip), %rdx      # 0x3527
movq %rbx, %rdi
movl %r15d, %ecx
movq %r13, %r8
xorl %eax, %eax
callq 0x10e0
leaq 0x1a27(%rip), %rdx      # 0x3530
movq %r14, %rdi
movq %r12, %rsi
movl %r15d, %ecx
movq %r13, %r8
xorl %eax, %eax
callq 0x10e0
xorps %xmm0, %xmm0
movaps %xmm0, 0x370a(%rip)     # 0x5230
movq %r13, -0x40(%rbp)
movq %r13, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x11a0
testl %eax, %eax
movl %eax, -0x6c(%rbp)
js 0x1d35
leaq -0x298(%rbp), %rsi
movl %eax, %edi
callq 0x1210
testl %eax, %eax
movl -0x6c(%rbp), %r8d
js 0x1d35
movq -0x268(%rbp), %rsi
xorl %r15d, %r15d
xorl %edi, %edi
movl $0x1, %edx
movl $0x1, %ecx
xorl %r9d, %r9d
callq 0x10c0
movq %rax, %rdi
cmpq $-0x1, %rax
je 0x1d35
movq $-0x1, -0x98(%rbp)
movl $0xffffffff, -0x44(%rbp) # imm = 0xFFFFFFFF
cmpb $0x0, 0x35b9(%rip)      # 0x5158
je 0x1bb5
movl $0xffffffff, -0x68(%rbp) # imm = 0xFFFFFFFF
movq $-0x1, -0x58(%rbp)
jmp 0x1cb7
movq %rdi, %r12
movq %rbx, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x11a0
testl %eax, %eax
movl %eax, -0x44(%rbp)
js 0x1c25
leaq -0x208(%rbp), %rsi
movl %eax, %edi
callq 0x1210
testl %eax, %eax
js 0x1c0d
movq -0x1d8(%rbp), %rsi
xorl %edi, %edi
movl $0x1, %edx
movl $0x1, %ecx
movl -0x44(%rbp), %r8d
xorl %r9d, %r9d
callq 0x10c0
movq %rax, 0x362d(%rip)      # 0x5230
movq %rax, -0x58(%rbp)
cmpq $-0x1, %rax
jne 0x1c53
movq %rbx, %rdi
callq 0x11d0
movq $-0x1, -0x58(%rbp)
movl $0x1, %r15d
jmp 0x1c53
movq 0x34f4(%rip), %rsi      # 0x5120
leaq 0x1908(%rip), %rdi      # 0x353b
movq %rbx, %rdx
xorl %eax, %eax
callq 0x10d0
leaq 0x1a55(%rip), %rax      # 0x3699
movq %rax, 0x34d5(%rip)      # 0x5120
movq $-0x1, -0x58(%rbp)
movq %r14, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x11a0
testl %eax, %eax
movl %eax, -0x68(%rbp)
js 0x1cb4
leaq -0x328(%rbp), %rsi
movl %eax, %ebx
movl %eax, %edi
callq 0x1210
testl %eax, %eax
js 0x27df
movq -0x2f8(%rbp), %rsi
xorl %edi, %edi
movl $0x1, %edx
movl $0x1, %ecx
movl %ebx, %r8d
xorl %r9d, %r9d
callq 0x10c0
movq %rax, 0x3595(%rip)      # 0x5238
cmpq $-0x1, %rax
je 0x27df
movq %rax, -0x98(%rbp)
movq %r12, %rdi
movq %rdi, -0x88(%rbp)
movl $0x1, %r14d
testl %r15d, %r15d
jne 0x277f
movq -0x268(%rbp), %rax
movq %rdi, -0x50(%rbp)
addq %rdi, %rax
movq %rax, -0x128(%rbp)
movq -0x1d8(%rbp), %rax
addq -0x58(%rbp), %rax
movq %rax, -0x120(%rbp)
movl 0x346d(%rip), %r9d      # 0x5168
movq 0x341e(%rip), %rsi      # 0x5120
movl 0x3464(%rip), %edx      # 0x516c
movl 0x3462(%rip), %ecx      # 0x5170
movl 0x345f(%rip), %r8d      # 0x5174
testl %r9d, %r9d
jle 0x1d50
subq $0x8, %rsp
leaq 0x1826(%rip), %rdi      # 0x354b
xorl %eax, %eax
pushq -0x40(%rbp)
callq 0x10d0
addq $0x10, %rsp
jmp 0x1d62
movq -0x40(%rbp), %rdi
callq 0x11d0
movq $-0x1, %rdi
movl $0x1, %r15d
jmp 0x1b86
leaq 0x184d(%rip), %rdi      # 0x35a4
movq -0x40(%rbp), %r9
xorl %eax, %eax
callq 0x10d0
leaq 0x187f(%rip), %rax      # 0x35e8
movq %rax, 0x33b0(%rip)      # 0x5120
leaq -0x88(%rbp), %rax
movq (%rax), %rsi
cmpb $0x1, 0x2(%rsi)
adcq $0x3, %rsi
movq %rsi, (%rax)
leaq 0x34b4(%rip), %rbx      # 0x5240
movq 0x33cd(%rip), %rdi      # 0x5160
subq $0x8, %rsp
movq -0x128(%rbp), %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq %rax
callq 0x1060
addq $0x10, %rsp
movl %eax, -0xc0(%rbp)
movq 0x33a3(%rip), %rdi      # 0x5160
movq %rbx, %rsi
xorl %edx, %edx
callq 0x11f0
testl %eax, %eax
jne 0x2435
cmpq $0x0, 0x3459(%rip)      # 0x5230
leaq 0x3462(%rip), %rsi      # 0x5240
je 0x21be
movq 0x346d(%rip), %rcx      # 0x5258
testq %rcx, %rcx
setne %dl
movq 0x3440(%rip), %rax      # 0x5238
testq %rax, %rax
setne %dil
cmpb %dil, %dl
jne 0x2807
movswl 0x3481(%rip), %edx      # 0x5290
movswl 0x347c(%rip), %edi      # 0x5292
movswl 0x3476(%rip), %r8d      # 0x5294
movswl 0x3454(%rip), %r11d     # 0x527a
movswl 0x3450(%rip), %r15d     # 0x527e
movsbl 0x3443(%rip), %ecx      # 0x5278
movsbl 0x343d(%rip), %eax      # 0x5279
movswl 0x3439(%rip), %ebx      # 0x527c
movl %r11d, %r13d
movl %ecx, -0xe0(%rbp)
shll %cl, %r13d
movl %ebx, %r9d
movl %eax, -0xdc(%rbp)
movl %eax, %ecx
shll %cl, %r9d
movswl 0x341c(%rip), %ecx      # 0x5280
movl %r13d, %eax
imull %r15d, %eax
movl %ecx, -0x70(%rbp)
movl %r9d, -0xec(%rbp)
imull %r9d, %ecx
leal (%rax,%rcx,2), %eax
movswl 0x3413(%rip), %ecx      # 0x5296
movl %ecx, -0xbc(%rbp)
addl %ecx, %edi
addl %r11d, %edi
sarl $0x4, %edi
movl %edx, -0xb8(%rbp)
addl %edx, %r8d
addl %r15d, %r8d
sarl $0x4, %r8d
movl %r8d, -0x60(%rbp)
cltq
movq %rax, -0x110(%rbp)
movl 0x33d8(%rip), %eax      # 0x528c
movl %eax, -0xb4(%rbp)
movl 0x33c8(%rip), %eax      # 0x5288
movl %eax, -0xb0(%rbp)
movzwl 0x33b5(%rip), %eax      # 0x5282
movl %eax, -0xd8(%rbp)
movzwl 0x33aa(%rip), %eax      # 0x5284
movl %eax, -0xd4(%rbp)
movb $0x1, %cl
xorl %edx, %edx
leaq 0x3345(%rip), %rax      # 0x5230
movq (%rax,%rdx,8), %rax
movq %rax, -0x100(%rbp)
testq %rax, %rax
je 0x21be
movq %rdx, -0x118(%rbp)
testl %edi, %edi
jle 0x218b
testb $0x1, %cl
leaq 0x3340(%rip), %rax      # 0x5258
cmovneq %rsi, %rax
movq %rax, -0x138(%rbp)
movl $0x0, -0x34(%rbp)
movl %edi, -0xac(%rbp)
movl %r11d, -0xd0(%rbp)
movl %r15d, -0xcc(%rbp)
movl %ebx, -0xc8(%rbp)
movl %r13d, -0xc4(%rbp)
movl %ecx, -0x5c(%rbp)
cmpl $0x0, -0x60(%rbp)
jle 0x216b
movl -0x34(%rbp), %eax
movl %eax, %edx
shll $0x4, %edx
subl -0xb8(%rbp), %edx
xorl %ecx, %ecx
testl %edx, %edx
movl $0x0, %eax
cmovgl %edx, %eax
movl %eax, -0xe8(%rbp)
movq %rdx, -0x90(%rbp)
leal 0x10(%rdx), %eax
cmpl %r15d, %eax
movl %r15d, %edx
movl %eax, -0x38(%rbp)
cmovll %eax, %edx
movl %edx, -0xe4(%rbp)
movl %ecx, -0x64(%rbp)
movl %ecx, %eax
shll $0x4, %eax
subl -0xbc(%rbp), %eax
testl %eax, %eax
movl $0x0, %ecx
cmovgl %eax, %ecx
movl %ecx, -0xf4(%rbp)
movq %rax, -0x78(%rbp)
addl $0x10, %eax
cmpl %r11d, %eax
movl %r11d, %ecx
movl %eax, -0x30(%rbp)
cmovll %eax, %ecx
movl %ecx, -0xf0(%rbp)
xorl %esi, %esi
cmpw %r15w, -0x70(%rbp)
setl %r10b
cmpw %r11w, %bx
setl %cl
testq %rsi, %rsi
movl $0x0, %eax
cmovnel %r13d, %eax
setne %dl
andb %dl, %cl
andb %dl, %r10b
movq %rsi, -0xa0(%rbp)
cmpq $0x2, %rsi
movl $0x0, %r8d
cmovel -0xec(%rbp), %r8d
movl -0xf4(%rbp), %r9d
shrl %cl, %r9d
movl -0xf0(%rbp), %edx
movb %cl, -0x29(%rbp)
sarl %cl, %edx
movl -0xe8(%rbp), %edi
movl %r10d, %ecx
shrl %cl, %edi
movl -0xe4(%rbp), %esi
sarl %cl, %esi
subl %r9d, %edx
jle 0x2149
cmpl %esi, %edi
jge 0x2149
movb %r10b, -0x2a(%rbp)
imull %r15d, %eax
movslq %eax, %r10
movq -0x100(%rbp), %r15
leaq (%r15,%r10), %rax
imull -0x70(%rbp), %r8d
movslq %r8d, %rbx
addq %rbx, %rax
movq %rax, -0x108(%rbp)
movq -0xa0(%rbp), %r12
testq %r12, %r12
movl -0xd4(%rbp), %eax
movl %eax, %r8d
cmovel -0xd8(%rbp), %r8d
movl -0xdc(%rbp), %eax
cmovel -0xe0(%rbp), %eax
movl %eax, %ecx
shll %cl, %r9d
movslq %r9d, %r9
movb -0x29(%rbp), %cl
sarl %cl, %r11d
movl %eax, %ecx
shll %cl, %r11d
movl %edi, %r14d
movslq %r11d, %rcx
addq %r9, %rbx
addq %r10, %rbx
movq %rcx, -0xa8(%rbp)
imulq %r14, %rcx
addq %r15, %rbx
addq %rcx, %rbx
movq -0x138(%rbp), %rcx
movq (%rcx,%r12,8), %rdi
movl %eax, %ecx
shll %cl, %edx
movslq %edx, %rax
movq %rax, -0x140(%rbp)
movswq %r8w, %rcx
movslq %esi, %r15
subq %r14, %r15
imulq %rcx, %r14
addq %r9, %r14
movq %rdi, -0x80(%rbp)
addq %rdi, %r14
xorl %r13d, %r13d
movq %r14, %rdi
movq %rbx, %rsi
movq -0x140(%rbp), %rdx
movq %rcx, %r12
callq 0x1130
movq %r12, %rcx
orl %eax, %r13d
addq -0xa8(%rbp), %rbx
addq %r12, %r14
decq %r15
jne 0x20f7
testl %r13d, %r13d
movb -0x2a(%rbp), %r14b
movl -0xd0(%rbp), %r11d
movl -0xcc(%rbp), %r15d
movl -0xc8(%rbp), %ebx
movl -0xc4(%rbp), %r13d
jne 0x245b
movq -0xa0(%rbp), %rsi
incq %rsi
cmpq $0x3, %rsi
jne 0x1fcd
movl -0x64(%rbp), %ecx
incl %ecx
cmpl -0x60(%rbp), %ecx
jne 0x1f94
movl -0x34(%rbp), %eax
incl %eax
movl -0xac(%rbp), %edi
movl %eax, -0x34(%rbp)
cmpl %edi, %eax
leaq 0x30be(%rip), %rsi      # 0x5240
movl -0x5c(%rbp), %ecx
jne 0x1f4e
movq -0x100(%rbp), %r8
addq -0x110(%rbp), %r8
leaq 0x3090(%rip), %rax      # 0x5230
movq -0x118(%rbp), %rdx
movq %r8, (%rax,%rdx,8)
movl $0x1, %edx
testb $0x1, %cl
movl $0x0, %ecx
jne 0x1ee4
cmpb $0x1, 0x2f83(%rip)      # 0x5148
jne 0x2429
xorl %eax, %eax
cmpq $0x0, 0x3083(%rip)      # 0x5258
setne %al
movswl 0x309b(%rip), %esi      # 0x527a
movswl 0x3098(%rip), %edx      # 0x527e
cmpl %esi, 0x30b4(%rip)      # 0x52a0
jne 0x2202
cmpl %edx, 0x30b0(%rip)      # 0x52a4
jne 0x2202
cmpl %eax, 0x30ac(%rip)      # 0x52a8
je 0x2328
movl %esi, 0x3098(%rip)      # 0x52a0
movl %edx, 0x3096(%rip)      # 0x52a4
movl %eax, 0x3094(%rip)      # 0x52a8
movq 0x2f8d(%rip), %rdi      # 0x51a8
testq %rdi, %rdi
je 0x2260
callq *0x2fb2(%rip)           # 0x51d8
movq 0x2f7b(%rip), %rdi      # 0x51a8
movl $0x2fff0000, %esi       # imm = 0x2FFF0000
movl $0x2fff0000, %edx       # imm = 0x2FFF0000
callq *0x2fa3(%rip)           # 0x51e0
movq 0x2f3c(%rip), %rdi      # 0x5180
callq *0x2f2e(%rip)           # 0x5178
movq 0x2f37(%rip), %rdi      # 0x5188
callq *0x2f21(%rip)           # 0x5178
movq 0x2f3a(%rip), %rdi      # 0x5198
jmp 0x22b9
movl $0x4020, %edi           # imm = 0x4020
callq *0x2f55(%rip)           # 0x51c0
movl 0x302f(%rip), %ecx      # 0x52a0
movl 0x302c(%rip), %r8d      # 0x52a4
leaq 0x147a(%rip), %rdi      # 0x36f9
movl $0x2fff0000, %esi       # imm = 0x2FFF0000
movl $0x2fff0000, %edx       # imm = 0x2FFF0000
movl $0x14, %r9d
callq *0x2f33(%rip)           # 0x51c8
movq %rax, 0x2f0c(%rip)      # 0x51a8
movq %rax, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0x6, %edx
callq *0x2f21(%rip)           # 0x51d0
movq %rax, %rdi
movq %rax, 0x2edf(%rip)      # 0x5198
movl 0x2fe1(%rip), %ecx      # 0x52a0
movl 0x2fde(%rip), %r8d      # 0x52a4
movl $0x56555949, %esi       # imm = 0x56555949
movl $0x1, %edx
callq *0x2f12(%rip)           # 0x51e8
movq %rax, 0x2ea3(%rip)      # 0x5180
movq 0x2eb4(%rip), %rdi      # 0x5198
movl 0x2fb6(%rip), %ecx      # 0x52a0
movl 0x2fb3(%rip), %r8d      # 0x52a4
movl $0x56555949, %esi       # imm = 0x56555949
movl $0x1, %edx
callq *0x2ee7(%rip)           # 0x51e8
movq %rax, 0x2e80(%rip)      # 0x5188
movq %rax, %rdi
movl $0x1, %esi
callq *0x2eda(%rip)           # 0x51f0
movq 0x2e6b(%rip), %rdi      # 0x5188
movl $0x80, %esi
callq *0x2ed0(%rip)           # 0x51f8
movq 0x2e51(%rip), %rdi      # 0x5180
movq 0x2f0a(%rip), %rdx      # 0x5240
movswl 0x2f45(%rip), %ecx      # 0x5282
movq 0x2f04(%rip), %r8       # 0x5248
movswl 0x2f38(%rip), %r9d      # 0x5284
xorl %esi, %esi
pushq %r9
pushq 0x2efa(%rip)            # 0x5250
callq *0x2ea4(%rip)           # 0x5200
addq $0x10, %rsp
movq 0x2e31(%rip), %rdi      # 0x5198
callq *0x2e9b(%rip)           # 0x5208
movq 0x2e24(%rip), %rdi      # 0x5198
movq 0x2e05(%rip), %rsi      # 0x5180
xorl %edx, %edx
xorl %ecx, %ecx
callq *0x2e8b(%rip)           # 0x5210
cmpl $0x0, 0x2f1c(%rip)      # 0x52a8
je 0x23de
movq 0x2df3(%rip), %rdi      # 0x5188
movq 0x2ebc(%rip), %rdx      # 0x5258
movswl 0x2edf(%rip), %ecx      # 0x5282
movq 0x2eb6(%rip), %r8       # 0x5260
movswl 0x2ed2(%rip), %r9d      # 0x5284
xorl %esi, %esi
pushq %r9
pushq 0x2eac(%rip)            # 0x5268
callq *0x2e3e(%rip)           # 0x5200
addq $0x10, %rsp
movq 0x2dcb(%rip), %rdi      # 0x5198
movq 0x2db4(%rip), %rsi      # 0x5188
xorl %edx, %edx
xorl %ecx, %ecx
callq *0x2e32(%rip)           # 0x5210
movq 0x2db3(%rip), %rdi      # 0x5198
callq *0x2e2d(%rip)           # 0x5218
leaq -0x178(%rbp), %rdi
callq *0x2e28(%rip)           # 0x5220
testl %eax, %eax
je 0x2422
movl -0x178(%rbp), %eax
cmpl $0x100, %eax            # imm = 0x100
je 0x273f
cmpl $0x300, %eax            # imm = 0x300
jne 0x23eb
cmpl $0x1b, -0x164(%rbp)
jne 0x23eb
jmp 0x273f
leaq 0x2e17(%rip), %rsi      # 0x5240
movq 0x2d30(%rip), %rdi      # 0x5160
jmp 0x1dc0
movl -0xc0(%rbp), %ebx
cmpl $0x69, %ebx
je 0x2448
testl %ebx, %ebx
jne 0x2832
movq -0x88(%rbp), %rsi
leaq -0x88(%rbp), %rax
jmp 0x1d85
testb $0x1, -0x5c(%rbp)
movl -0xb4(%rbp), %esi
cmovnel -0xb0(%rbp), %esi
movq -0xa0(%rbp), %rdx
cmpq $0x1, %rdx
leaq 0x125d(%rip), %rax      # 0x36db
leaq 0x1259(%rip), %rcx      # 0x36de
cmoveq %rax, %rcx
testq %rdx, %rdx
leaq 0x1243(%rip), %r8       # 0x36d6
cmovneq %rcx, %r8
leaq 0x11fc(%rip), %rdi      # 0x369a
movl -0x34(%rbp), %edx
movl -0x64(%rbp), %ecx
xorl %eax, %eax
callq 0x10d0
movl %r14d, %ecx
movq -0x90(%rbp), %rdx
sarl %cl, %edx
movl -0x38(%rbp), %eax
sarl %cl, %eax
movl %eax, -0x38(%rbp)
cmpl %eax, %edx
jge 0x2658
movb -0x29(%rbp), %cl
movq -0x78(%rbp), %rax
sarl %cl, %eax
sarl %cl, -0x30(%rbp)
movq %rax, -0x78(%rbp)
cltq
movq %rax, -0xa8(%rbp)
movq %rdx, -0x90(%rbp)
movslq %edx, %r14
movq %r14, %rax
imulq %r12, %rax
addq %rax, -0x80(%rbp)
leaq 0x11e5(%rip), %r15      # 0x36e1
leaq 0x11e3(%rip), %r13      # 0x36e6
movq -0xa8(%rbp), %rbx
movl -0x30(%rbp), %eax
cmpl %eax, -0x78(%rbp)
jge 0x2589
movq %r15, %rdi
testq %r14, %r14
js 0x2572
movswl 0x2d5d(%rip), %eax      # 0x527e
movb -0x2a(%rbp), %cl
sarl %cl, %eax
movq %r15, %rdi
testq %rbx, %rbx
js 0x2572
cltq
movq %r15, %rdi
cmpq %rax, %r14
jge 0x2572
movswl 0x2d3b(%rip), %eax      # 0x527a
movb -0x29(%rbp), %cl
sarl %cl, %eax
movslq %eax, %rcx
movq %r15, %rdi
cmpq %rcx, %rbx
jge 0x2572
movq -0x80(%rbp), %rcx
movb (%rcx,%rbx), %cl
imull %r14d, %eax
addl %ebx, %eax
movq %r13, %rdi
movq -0x108(%rbp), %rdx
cmpb (%rdx,%rax), %cl
je 0x2572
leaq 0x1179(%rip), %rdi      # 0x36eb
movq -0x80(%rbp), %rax
movzbl (%rax,%rbx), %esi
xorl %eax, %eax
callq 0x10d0
incq %rbx
cmpl %ebx, -0x30(%rbp)
jne 0x2512
movl $0xa, %edi
callq 0x1040
incq %r14
addq %r12, -0x80(%rbp)
cmpl %r14d, -0x38(%rbp)
jne 0x2503
leaq 0x11e9(%rip), %rdi      # 0x3794
callq 0x1070
leaq 0x112a(%rip), %rbx      # 0x36e1
leaq 0x1128(%rip), %r14      # 0x36e6
movq -0x90(%rbp), %r12
movb -0x2a(%rbp), %r13b
movq -0x78(%rbp), %rax
movl %eax, %r15d
cmpl -0x30(%rbp), %eax
jge 0x263f
testl %r12d, %r12d
js 0x260b
movswl 0x2c9d(%rip), %edx      # 0x527e
movl %r13d, %ecx
sarl %cl, %edx
movzwl 0x2c8d(%rip), %eax      # 0x527a
testl %r15d, %r15d
js 0x2612
cmpl %edx, %r12d
jge 0x2612
movswl %ax, %edx
movb -0x29(%rbp), %cl
sarl %cl, %edx
cmpl %edx, %r15d
movq %rbx, %rdi
cmovlq %r14, %rdi
jmp 0x2615
movzwl 0x2c68(%rip), %eax      # 0x527a
movq %rbx, %rdi
cwtl
movb -0x29(%rbp), %cl
sarl %cl, %eax
imull %r12d, %eax
addl %r15d, %eax
cltq
movq -0x108(%rbp), %rcx
movzbl (%rcx,%rax), %esi
xorl %eax, %eax
callq 0x10d0
incl %r15d
cmpl %r15d, -0x30(%rbp)
jne 0x25d5
movl $0xa, %edi
callq 0x1040
incl %r12d
cmpl -0x38(%rbp), %r12d
jne 0x25c9
jmp 0x2664
leaq 0x1135(%rip), %rdi      # 0x3794
callq 0x1070
leaq 0x102e(%rip), %rax      # 0x3699
movq %rax, 0x2aae(%rip)      # 0x5120
xorl %r14d, %r14d
movl $0x4a, %ebx
movq 0x2adf(%rip), %rdi      # 0x5160
callq 0x1170
movq 0x2ba3(%rip), %rcx      # 0x5230
cmpq -0x120(%rbp), %rcx
movl $0x3d, %edx
movl $0x4a, %eax
cmovel %edx, %eax
testq %rcx, %rcx
cmovel %ebx, %eax
cmpl $0x3d, %ebx
cmovnel %ebx, %eax
xorl %ecx, %ecx
cmpl $0x3d, %eax
sete %cl
addl %ecx, 0x2ab1(%rip)      # 0x516c
xorl %ecx, %ecx
cmpl $0x5f, %eax
sete %cl
addl %ecx, 0x2aa7(%rip)      # 0x5170
xorl %ecx, %ecx
cmpl $0x4a, %eax
sete %cl
addl %ecx, 0x2a9d(%rip)      # 0x5174
xorl %ecx, %ecx
cmpl $0x3, %eax
sete %cl
addl %ecx, 0x2a83(%rip)      # 0x5168
cmpl $0x3d, %eax
jne 0x2703
testb $0x1, 0x2a5f(%rip)      # 0x5150
je 0x2703
movq 0x2a26(%rip), %rsi      # 0x5120
leaq 0xeee(%rip), %rdi       # 0x35ef
jmp 0x2762
cmpl $0x5f, %eax
jne 0x2721
testb $0x1, 0x2a45(%rip)      # 0x5154
je 0x2721
movq 0x2a08(%rip), %rsi      # 0x5120
leaq 0xee5(%rip), %rdi       # 0x3604
jmp 0x2762
cmpl $0x4a, %eax
jne 0x274f
testb $0x1, 0x2a1f(%rip)      # 0x514c
je 0x274f
movq 0x29ea(%rip), %rsi      # 0x5120
leaq 0xee3(%rip), %rdi       # 0x3620
jmp 0x2762
movl $0x1, %r14d
movl $0x3d, %ebx
jmp 0x267a
cmpl $0x3, %eax
jne 0x277b
movq 0x29c5(%rip), %rsi      # 0x5120
leaq 0xed3(%rip), %rdi       # 0x3635
movq -0x40(%rbp), %rdx
xorl %eax, %eax
callq 0x10d0
leaq 0xf25(%rip), %rax       # 0x3699
movq %rax, 0x29a5(%rip)      # 0x5120
movq -0x50(%rbp), %rdi
movq -0x268(%rbp), %rsi
callq 0x1180
movq -0x1d8(%rbp), %rsi
movq -0x58(%rbp), %rdi
callq 0x1180
movq -0x2f8(%rbp), %rsi
movq -0x98(%rbp), %rdi
callq 0x1180
movl -0x6c(%rbp), %edi
callq 0x1110
movl -0x44(%rbp), %edi
callq 0x1110
movl -0x68(%rbp), %edi
callq 0x1110
movq -0x130(%rbp), %rsp
movl %r14d, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0x11d0
movq %r12, %rdi
movq %r12, -0x88(%rbp)
movl $0x1, %r14d
movq $-0x1, -0x98(%rbp)
jmp 0x277f
cmpq $0x1, %rcx
movl $0x1, %esi
sbbl $-0x1, %esi
movl $0x1, %edx
cmpq $0x1, %rax
sbbl $-0x1, %edx
leaq 0xe27(%rip), %rdi       # 0x364d
xorl %eax, %eax
callq 0x10d0
jmp 0x2664
xorl %r14d, %r14d
jmp 0x267a