// File: /workspace/github_c_makefile_star2_O0/Joy-Division[P]tools-mgs/dat-extract_enc.c
// Function: main
int main( int argc, char **argv ) {
	
	unsigned char datheader[3*4] = {0};
	unsigned char datheaderbig[3*4] = {0};
	char execpath[4096] = {0}, stagename[32];
	unsigned char *stagelist = NULL;
	char builddatestring[32];
	char builddatestringbig[32];
	time_t buildtime;
	struct tm *buildstruct = NULL;
	
	uint16_t overridegame = 0;
	
	unsigned int i = 0;
	unsigned int flags = 0;
	
	tocDatHeader *dathead = NULL;
	tocDatHeader *datheadbig = NULL;
	stageinfo *infolist = NULL;
	tocStageEntry *stages = NULL;
	tocStageEntrySmall *smallstages = NULL;
	tocStageEntryBig *bigstages = NULL;
	
	uint32_t *headvals = NULL;
	
	if ( argc < 2 ) {
		printf("Not enough args!\nUse: %s DAT-file [id-override]\n", argv[0]);
		return 1;
	}
	if( argc == 3 ) {
		overridegame = strtoul(argv[2], NULL, 16);
	}
	
	if(strlen(argv[0]) > 4096) BREAK("Path to executable exceeds 4096 chars!\n")
	strcpy(execpath, argv[0]);
	if(strrchr(execpath, '/') || strrchr(execpath, '\\')) cleanExecPath(execpath);
	else sprintf(execpath, "./");
	
	FILE *f = NULL;
	/* needed for debugging purposes */
	FILE *o = NULL;
	
	if( !(f = fopen( argv[1], "rb" ))) {
		printf("Couldnt open file %s\n", argv[1]);
		return 1;
	}
	
	fread( &initialkey, 4, 1, f );
	initialkeybig = bswap_32(initialkey);
	
	
	fread( datheader, 0x0C, 1, f );
	headvals = (uint32_t *)datheader;
	
	/* the trial edition does bullshit here, meh */
	if(initialkey == 0x00000001) {
		
		flags |= (GAME_MGS2|TRIALSTAGE);
		
		getDictionary(&commondic, &numcommondic, execpath, "common-trial2", flags);
		
		dathead = malloc(sizeof(tocDatHeader));
		
		buildtime = headvals[0];
		buildstruct = gmtime(&buildtime);
		strftime(builddatestring, 32, dateTimeString, buildstruct);
		
		printf("DAT Header info (endianess: little - Trial mode):\n");
		printf("builddate %s (%08x) - numstages %03d (%08x) - headersize %08x\n", builddatestring, headvals[0], headvals[1], headvals[1], headvals[2]);
		dathead->numStages = headvals[1] & 0xFFFF;
	}
	else {
		dathead = (tocDatHeader *)datheader;
		datheadbig = (tocDatHeader *)datheaderbig;
		
		/* decrypt header in BE mode */
		decryptHeader(datheader, 3, GAME_MGS4);
		
		datheadbig->version = bswap_16(dathead->version);
		datheadbig->numblocks = bswap_16(dathead->numblocks);
		datheadbig->numStages = bswap_16(dathead->numStages);
		datheadbig->game = bswap_16(dathead->game);
		datheadbig->unknownhash = bswap_32(dathead->unknownhash);
		
		/* encrypt header in BE mode */
		decryptHeader(datheader, 3, GAME_MGS4);
		/* decrypt header in LE mode */
		decryptHeader(datheader, 3, 0);
		
		buildtime = initialkey;
		buildstruct = gmtime(&buildtime);
		strftime(builddatestring, 32, dateTimeString, buildstruct);
		
		buildtime = initialkeybig;
		buildstruct = gmtime(&buildtime);
		strftime(builddatestringbig, 32, dateTimeString, buildstruct);
		
		if(((dathead->version >> 8) || (dathead->numblocks >> 8)) && ((datheadbig->version != 1))) {
			printf("unencrypted fiel\n");
			/* "encrypt" header in LE mode to turn the "decrypted" data back into usable data, as it never was encrypted */
			decryptHeader(datheader, 3, 0);
			if(!(dathead->unknownhash & 0xFF)) {
				printf("reassigning datheadbig values\n");
				datheadbig->version = bswap_16(dathead->version);
				datheadbig->numblocks = bswap_16(dathead->numblocks);
				datheadbig->numStages = bswap_16(dathead->numStages);
				datheadbig->game = bswap_16(dathead->game);
				datheadbig->unknownhash = bswap_32(dathead->unknownhash);
				dathead = datheadbig;
				flags |= GAME_TTS; /* doing this because TTS is the only BE game with unencrypted data */
			}
		}
		
		else flags |= ENCRYPTED;
		
		if((datheadbig->game == 0x0000) && (datheadbig->version == 1)) {
			dathead = datheadbig;
			flags |= GAME_MGS4;
		}
		
		printf("DAT Header info (endianness %s):\n", (flags & IS_BIGENDIAN)?"BE":"LE");
		printf(datHeaderInfoString, (flags & IS_BIGENDIAN)?builddatestringbig:builddatestring, initialkey, dathead->version, dathead->numblocks, dathead->numStages, dathead->numStages, dathead->game, dathead->unknownhash);
		
		if(!overridegame) overridegame = dathead->game;
		else printf("WARNING: overriding game from file with passed value %04x\n", overridegame);
		
		switch(overridegame) {
			case 0xCCCC: { /* TTS uses 0xCCCC as "game" magic, which conveniently works when interpreted as either LE or BE 16bit value */
				printf("TTS DAT detected based on game hash\n");
				dathead = datheadbig;
				flags |= (GAME_TTS|GAME_MGS2|COMPRESSED);
				
				getDictionary(&commondic, &numcommondic, execpath, "common-tts", flags);
				
				break;
			}
			case 0x4010:
			case 0x4016:
			case 0x610A:
			case 0x2ABB: {
				printf("MGS2 DAT detected based on game hash\n");
				flags |= (GAME_MGS2 | ((flags & ENCRYPTED) ? COMPRESSED : 0));
				
				getDictionary(&commondic, &numcommondic, execpath, "common-mgs2", flags);
				break;
			}
			case 0x0000:	/* THIS MAY EXPLODE HORRIBLY POSSIBLY EVENTUALLY
					   WHO THOUGHT THIS WAS A GOOD IDEA */
					/* AS EXPECTED IT EXPLODED HORRIBLY AND ATE KITTENS */
				if(!(flags & IS_BIGENDIAN)) flags |= GAME_MGS3S;
			case 0x0025:
			case 0x0063:
			case 0x4015:
			case 0x4212: { // FOR THIS ONE AS WELL... (see below)
				if(flags & ENCRYPTED) {
					if(flags & IS_BIGENDIAN) { /* BE thing for MGS4 */
						if(datheadbig->version != 1) BREAK("unexpected version, not 1\n");
						flags |= (GAME_MGS4|COMPRESSED);
						
						getDictionary(&commondic, &numcommondic, execpath, "common-mgs4", flags);
					}
					else { /* LE thing for MGS3, see comment for case 0x0000 */
						printf("MGS3 DAT detected based on game hash\n");
						flags |= (GAME_MGS3|COMPRESSED);
						
						getDictionary(&commondic, &numcommondic, execpath, "common-mgs3", flags);
					}
				}
				else { // WHY DOES THE XBOX ONE SHARE AN ID WITH MGS3 >:(
					printf("MGS2 DAT detected based on game hash\n");
					flags |= GAME_MGS2;
					
					getDictionary(&commondic, &numcommondic, execpath, "common-mgs2", flags);
				}
				break;
			}
			case 0x0806: {
				printf("ZOE2 DAT detected based on game hash\n");
				flags |= (GAME_ZOE2|COMPRESSED);
				
				getDictionary(&commondic, &numcommondic, execpath, "common-zoe2", flags);
				break;
			}
			default: {
				/* change this back, just in case something goes really bad */
				dathead = (tocDatHeader *)datheader;
				printf("DAT Header info:\n");
				printf(datHeaderInfoString, builddatestring, initialkey, dathead->version, dathead->numblocks, dathead->numStages, dathead->numStages, dathead->game, dathead->unknownhash);
				
				printf("DAT Header info BE:\n");
				printf(datHeaderInfoString, builddatestringbig, initialkeybig, datheadbig->version, datheadbig->numblocks, datheadbig->numStages, datheadbig->numStages, datheadbig->game, datheadbig->unknownhash);
				printf("overridegame was %04x\n", overridegame);
				printf("unknown game hash, aborting\n");
				fclose(f);
				return 0;
			}
		}
	}
	
	printf("Flags raw %08x\n", flags);
	printf("Current flags:\n%s%s%s%s%s%s%s%s%s\n", (flags & GAME_MGS2) ? "GAME_MGS2 " : "", (flags & GAME_MGS3) ? "GAME_MGS3 " : "", (flags & GAME_MGS4) ? "GAME_MGS4 " : "", (flags & GAME_ZOE2) ? "GAME_ZOE2 " : "", (flags & GAME_TTS) ? "GAME_TTS " : "", (flags & GAME_MGS3S) ? "GAME_MGS3S " : "", (flags & TRIALSTAGE) ? "TRIALSTAGE " : "", (flags & ENCRYPTED) ? "ENCRYPTED " : "", (flags & COMPRESSED) ? "COMPRESSED " : "");
	
	if(flags & IS_BIGSTAGE) {
		
		stagelist = malloc((3*4)+(sizeof(tocStageEntryBig)*dathead->numStages));
		stages = malloc(sizeof(tocStageEntry)*dathead->numStages);
		bigstages = (tocStageEntryBig *)(stagelist+(3*4));
		fseek(f, 4, SEEK_SET);
		fread( stagelist, (3*4)+(sizeof(tocStageEntryBig)*dathead->numStages), 1, f );
		
		if(flags & ENCRYPTED) decryptHeader(stagelist, 3+(dathead->numStages*5), flags);
		
		for(i = 0; i < dathead->numStages; i++) {
			stages[i].name = bigstages[i].name;
			stages[i].offset = (flags & IS_BIGENDIAN) ? bswap_32(bigstages[i].offset) : bigstages[i].offset;
		}
		/* dumps the stagelist for debugging purposes */
		printf("DAMPSTAGEBIG\n");
		o = fopen("stagedampbig.bin", "wb");
		fwrite(stagelist, (3*4)+(sizeof(tocStageEntryBig)*dathead->numStages), 1, o);
		fclose(o); 
	}
	else {
		stagelist = malloc((3*4)+(sizeof(tocStageEntrySmall)*dathead->numStages));
		stages = malloc(sizeof(tocStageEntry)*dathead->numStages);
		smallstages = (flags & TRIALSTAGE) ? ((tocStageEntrySmall *)stagelist) : ((tocStageEntrySmall *)(stagelist+(3*4)));
		fseek(f, (flags & TRIALSTAGE) ? 0x10 : 4, SEEK_SET); /* trial has its stage list at a different offset */
		fread( stagelist, (3*4)+(sizeof(tocStageEntrySmall)*dathead->numStages), 1, f );
		
		if(flags & ENCRYPTED) decryptHeader(stagelist, 3+(dathead->numStages*3), flags);
		
		for(i = 0; i < dathead->numStages; i++) {
			stages[i].name = smallstages[i].name;
			stages[i].offset = (flags & IS_BIGENDIAN) ? bswap_32(smallstages[i].offset) : smallstages[i].offset;
		}
		/* dumps the stagelist for debugging purposes */
		printf("DAMPSTAGESMALL\n");
		o = fopen("stagedampsmall.bin", "wb");
		fwrite(stagelist, (3*4)+(sizeof(tocStageEntrySmall)*dathead->numStages), 1, o);
		fclose(o);
	}
	
	printf("Stagelist:\n");
	for(i = 0; i < dathead->numStages; i++) printf("idx %04x Name %s - offset %08x(%08x)\n", i, stages[i].name, stages[i].offset, stages[i].offset * 0x800);
	
	infolist = processStages(f, stages, dathead->numStages, flags);
	
	for(i = 0; i < dathead->numStages; i++) {
		createDirectory(stages[i].name);
		if(flags & TRIALSTAGE) strcpy(stagename, "trial2-");
		else if(flags & GAME_TTS) strcpy(stagename, "tts-");
		else if(flags & GAME_MGS2) strcpy(stagename, "mgs2-");
		else if(flags & GAME_MGS3) strcpy(stagename, "mgs3-");
		else if(flags & GAME_MGS4) strcpy(stagename, "mgs4-");
		else if(flags & GAME_ZOE2) strcpy(stagename, "zoe2-");
		strcat(stagename, stages[i].name);
		getDictionary(&stagedic, &numstagedic, execpath, stagename, flags);
		
		processInfoWithStage(f, infolist[i], stages[i], flags);
		if(stagedic) free(stagedic);
		stagedic = NULL;
		if(numstagedic > 0) numdicentries -= numstagedic;
		numstagedic = 0;
	}
	
	for(i = 0; i < dathead->numStages; i++) free(infolist[i].data);
	free(stagelist);
	free(infolist);
	free(stages);
	if(flags & TRIALSTAGE) free(dathead);
	
	if(commondic) free(commondic);
	
	printf("Done.\n");
	
	fclose(f);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x1150, %rsp           # imm = 0x1150
movl $0x0, -0x14(%rbp)
movl %edi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
leaq -0x2c(%rbp), %rdi
xorl %esi, %esi
movl $0xc, %edx
callq 0x5100
leaq -0x38(%rbp), %rdi
xorl %esi, %esi
movl $0xc, %edx
callq 0x5100
leaq -0x1040(%rbp), %rdi
xorl %esi, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x5100
movq $0x0, -0x1068(%rbp)
movq $0x0, -0x10c0(%rbp)
movw $0x0, -0x10c2(%rbp)
movl $0x0, -0x10c8(%rbp)
movl $0x0, -0x10cc(%rbp)
movq $0x0, -0x10d8(%rbp)
movq $0x0, -0x10e0(%rbp)
movq $0x0, -0x10e8(%rbp)
movq $0x0, -0x10f0(%rbp)
movq $0x0, -0x10f8(%rbp)
movq $0x0, -0x1100(%rbp)
movq $0x0, -0x1108(%rbp)
cmpl $0x2, -0x18(%rbp)
jge 0x7ae6
movq -0x20(%rbp), %rax
movq (%rax), %rsi
leaq 0x1cd9(%rip), %rdi      # 0x97ac
movb $0x0, %al
callq 0x50c0
movl $0x1, -0x14(%rbp)
jmp 0x8e98
cmpl $0x3, -0x18(%rbp)
jne 0x7b09
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x10, %edx
callq 0x51f0
movw %ax, -0x10c2(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0x50b0
cmpq $0x1000, %rax           # imm = 0x1000
jbe 0x7b37
leaq 0x1cb9(%rip), %rdi      # 0x97dd
movb $0x0, %al
callq 0x50c0
movl $0x1, -0x14(%rbp)
jmp 0x8e98
leaq -0x1040(%rbp), %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rsi
callq 0x5060
leaq -0x1040(%rbp), %rdi
movl $0x2f, %esi
callq 0x50f0
cmpq $0x0, %rax
jne 0x7b78
leaq -0x1040(%rbp), %rdi
movl $0x5c, %esi
callq 0x50f0
cmpq $0x0, %rax
je 0x7b8e
leaq -0x1040(%rbp), %rdi
movl $0x2f, %esi
callq 0x50f0
movb $0x0, (%rax)
jmp 0x7ba3
leaq -0x1040(%rbp), %rdi
leaq 0x1c69(%rip), %rsi      # 0x9805
movb $0x0, %al
callq 0x5210
movq $0x0, -0x1110(%rbp)
movq $0x0, -0x1118(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x1c40(%rip), %rsi      # 0x9808
callq 0x51b0
movq %rax, -0x1110(%rbp)
cmpq $0x0, %rax
jne 0x7bfc
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0x1a8d(%rip), %rdi      # 0x9676
movb $0x0, %al
callq 0x50c0
movl $0x1, -0x14(%rbp)
jmp 0x8e98
movq -0x1110(%rbp), %rcx
leaq 0x5666(%rip), %rdi      # 0xd270
movl $0x4, %esi
movl $0x1, %edx
callq 0x5080
movl 0x5651(%rip), %edi      # 0xd270
callq 0x6530
movl %eax, 0x564a(%rip)      # 0xd274
leaq -0x2c(%rbp), %rdi
movq -0x1110(%rbp), %rcx
movl $0xc, %esi
movl $0x1, %edx
callq 0x5080
leaq -0x2c(%rbp), %rax
movq %rax, -0x1108(%rbp)
cmpl $0x1, 0x561a(%rip)      # 0xd270
jne 0x7d54
movl -0x10cc(%rbp), %eax
orl $0x41, %eax
movl %eax, -0x10cc(%rbp)
leaq -0x1040(%rbp), %rdx
movl -0x10cc(%rbp), %r8d
leaq 0x55f8(%rip), %rdi      # 0xd278
leaq 0x5601(%rip), %rsi      # 0xd288
leaq 0x1b7d(%rip), %rcx      # 0x980b
callq 0x5880
movl $0xc, %edi
callq 0x5160
movq %rax, -0x10d8(%rbp)
movq -0x1108(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x10b8(%rbp)
leaq -0x10b8(%rbp), %rdi
callq 0x51e0
movq %rax, -0x10c0(%rbp)
leaq -0x1090(%rbp), %rdi
movq 0x5553(%rip), %rdx      # 0xd228
movq -0x10c0(%rbp), %rcx
movl $0x20, %esi
callq 0x51a0
leaq 0x1b2c(%rip), %rdi      # 0x9819
movb $0x0, %al
callq 0x50c0
leaq -0x1090(%rbp), %rsi
movq -0x1108(%rbp), %rax
movl (%rax), %edx
movq -0x1108(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x1108(%rbp), %rax
movl 0x4(%rax), %r8d
movq -0x1108(%rbp), %rax
movl 0x8(%rax), %r9d
leaq 0x1b21(%rip), %rdi      # 0x984c
movb $0x0, %al
callq 0x50c0
movq -0x1108(%rbp), %rax
movl 0x4(%rax), %eax
andl $0xffff, %eax           # imm = 0xFFFF
movw %ax, %cx
movq -0x10d8(%rbp), %rax
movw %cx, 0x4(%rax)
jmp 0x857b
leaq -0x2c(%rbp), %rax
movq %rax, -0x10d8(%rbp)
leaq -0x38(%rbp), %rax
movq %rax, -0x10e0(%rbp)
leaq -0x2c(%rbp), %rdi
movl $0x3, %esi
movl $0x4, %edx
callq 0x5f00
movq -0x10d8(%rbp), %rax
movzwl (%rax), %edi
callq 0x8eb0
movw %ax, %cx
movq -0x10e0(%rbp), %rax
movw %cx, (%rax)
movq -0x10d8(%rbp), %rax
movzwl 0x2(%rax), %edi
callq 0x8eb0
movw %ax, %cx
movq -0x10e0(%rbp), %rax
movw %cx, 0x2(%rax)
movq -0x10d8(%rbp), %rax
movzwl 0x4(%rax), %edi
callq 0x8eb0
movw %ax, %cx
movq -0x10e0(%rbp), %rax
movw %cx, 0x4(%rax)
movq -0x10d8(%rbp), %rax
movzwl 0x6(%rax), %edi
callq 0x8eb0
movw %ax, %cx
movq -0x10e0(%rbp), %rax
movw %cx, 0x6(%rax)
movq -0x10d8(%rbp), %rax
movl 0x8(%rax), %edi
callq 0x6530
movl %eax, %ecx
movq -0x10e0(%rbp), %rax
movl %ecx, 0x8(%rax)
leaq -0x2c(%rbp), %rdi
movl $0x3, %esi
movl $0x4, %edx
callq 0x5f00
leaq -0x2c(%rbp), %rdi
movl $0x3, %esi
xorl %edx, %edx
callq 0x5f00
movl 0x5439(%rip), %eax      # 0xd270
movq %rax, -0x10b8(%rbp)
leaq -0x10b8(%rbp), %rdi
callq 0x51e0
movq %rax, -0x10c0(%rbp)
leaq -0x1090(%rbp), %rdi
movq 0x53c9(%rip), %rdx      # 0xd228
movq -0x10c0(%rbp), %rcx
movl $0x20, %esi
callq 0x51a0
movl 0x53fe(%rip), %eax      # 0xd274
movq %rax, -0x10b8(%rbp)
leaq -0x10b8(%rbp), %rdi
callq 0x51e0
movq %rax, -0x10c0(%rbp)
leaq -0x10b0(%rbp), %rdi
movq 0x538a(%rip), %rdx      # 0xd228
movq -0x10c0(%rbp), %rcx
movl $0x20, %esi
callq 0x51a0
movq -0x10d8(%rbp), %rax
movzwl (%rax), %eax
sarl $0x8, %eax
cmpl $0x0, %eax
jne 0x7ed8
movq -0x10d8(%rbp), %rax
movzwl 0x2(%rax), %eax
sarl $0x8, %eax
cmpl $0x0, %eax
je 0x7fdf
movq -0x10e0(%rbp), %rax
movzwl (%rax), %eax
cmpl $0x1, %eax
je 0x7fdf
leaq 0x1999(%rip), %rdi      # 0x988b
movb $0x0, %al
callq 0x50c0
leaq -0x2c(%rbp), %rdi
movl $0x3, %esi
xorl %edx, %edx
callq 0x5f00
movq -0x10d8(%rbp), %rax
movl 0x8(%rax), %eax
andl $0xff, %eax
cmpl $0x0, %eax
jne 0x7fdd
leaq 0x1975(%rip), %rdi      # 0x989d
movb $0x0, %al
callq 0x50c0
movq -0x10d8(%rbp), %rax
movzwl (%rax), %edi
callq 0x8eb0
movw %ax, %cx
movq -0x10e0(%rbp), %rax
movw %cx, (%rax)
movq -0x10d8(%rbp), %rax
movzwl 0x2(%rax), %edi
callq 0x8eb0
movw %ax, %cx
movq -0x10e0(%rbp), %rax
movw %cx, 0x2(%rax)
movq -0x10d8(%rbp), %rax
movzwl 0x4(%rax), %edi
callq 0x8eb0
movw %ax, %cx
movq -0x10e0(%rbp), %rax
movw %cx, 0x4(%rax)
movq -0x10d8(%rbp), %rax
movzwl 0x6(%rax), %edi
callq 0x8eb0
movw %ax, %cx
movq -0x10e0(%rbp), %rax
movw %cx, 0x6(%rax)
movq -0x10d8(%rbp), %rax
movl 0x8(%rax), %edi
callq 0x6530
movl %eax, %ecx
movq -0x10e0(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x10e0(%rbp), %rax
movq %rax, -0x10d8(%rbp)
movl -0x10cc(%rbp), %eax
orl $0x10, %eax
movl %eax, -0x10cc(%rbp)
jmp 0x7ff0
movl -0x10cc(%rbp), %eax
orl $0x80, %eax
movl %eax, -0x10cc(%rbp)
movq -0x10e0(%rbp), %rax
movzwl 0x6(%rax), %eax
cmpl $0x0, %eax
jne 0x802c
movq -0x10e0(%rbp), %rax
movzwl (%rax), %eax
cmpl $0x1, %eax
jne 0x802c
movq -0x10e0(%rbp), %rax
movq %rax, -0x10d8(%rbp)
movl -0x10cc(%rbp), %eax
orl $0x4, %eax
movl %eax, -0x10cc(%rbp)
movl -0x10cc(%rbp), %ecx
andl $0x14, %ecx
leaq 0x18a5(%rip), %rsi      # 0x98e1
leaq 0x189b(%rip), %rax      # 0x98de
cmpl $0x0, %ecx
cmovneq %rax, %rsi
leaq 0x186b(%rip), %rdi      # 0x98bc
movb $0x0, %al
callq 0x50c0
movq 0x51d1(%rip), %rax      # 0xd230
movq %rax, -0x1120(%rbp)
movl -0x10cc(%rbp), %eax
andl $0x14, %eax
cmpl $0x0, %eax
je 0x8084
leaq -0x10b0(%rbp), %rax
movq %rax, -0x1128(%rbp)
jmp 0x8092
leaq -0x1090(%rbp), %rax
movq %rax, -0x1128(%rbp)
movq -0x1120(%rbp), %rdi
movq -0x1128(%rbp), %rsi
movl 0x51ca(%rip), %edx      # 0xd270
movq -0x10d8(%rbp), %rax
movzwl (%rax), %ecx
movq -0x10d8(%rbp), %rax
movzwl 0x2(%rax), %r8d
movq -0x10d8(%rbp), %rax
movzwl 0x4(%rax), %r9d
movq -0x10d8(%rbp), %rax
movzwl 0x4(%rax), %r11d
movq -0x10d8(%rbp), %rax
movzwl 0x6(%rax), %r10d
movq -0x10d8(%rbp), %rax
movl 0x8(%rax), %eax
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movb $0x0, %al
callq 0x50c0
cmpw $0x0, -0x10c2(%rbp)
jne 0x811c
movq -0x10d8(%rbp), %rax
movw 0x6(%rax), %ax
movw %ax, -0x10c2(%rbp)
jmp 0x8131
movzwl -0x10c2(%rbp), %esi
leaq 0x17ba(%rip), %rdi      # 0x98e4
movb $0x0, %al
callq 0x50c0
movzwl -0x10c2(%rbp), %eax
movl %eax, -0x112c(%rbp)
testl %eax, %eax
je 0x82bb
jmp 0x8148
movl -0x112c(%rbp), %eax
subl $0x25, %eax
je 0x82da
jmp 0x8159
movl -0x112c(%rbp), %eax
subl $0x63, %eax
je 0x82da
jmp 0x816a
movl -0x112c(%rbp), %eax
subl $0x806, %eax            # imm = 0x806
je 0x83f3
jmp 0x817d
movl -0x112c(%rbp), %eax
subl $0x2abb, %eax           # imm = 0x2ABB
je 0x8258
jmp 0x8190
movl -0x112c(%rbp), %eax
subl $0x4010, %eax           # imm = 0x4010
je 0x8258
jmp 0x81a3
movl -0x112c(%rbp), %eax
subl $0x4015, %eax           # imm = 0x4015
je 0x82da
jmp 0x81b6
movl -0x112c(%rbp), %eax
subl $0x4016, %eax           # imm = 0x4016
je 0x8258
jmp 0x81c9
movl -0x112c(%rbp), %eax
subl $0x4212, %eax           # imm = 0x4212
je 0x82da
jmp 0x81dc
movl -0x112c(%rbp), %eax
subl $0x610a, %eax           # imm = 0x610A
je 0x8258
jmp 0x81eb
movl -0x112c(%rbp), %eax
subl $0xcccc, %eax           # imm = 0xCCCC
jne 0x843f
jmp 0x81fe
leaq 0x171a(%rip), %rdi      # 0x991f
movb $0x0, %al
callq 0x50c0
movq -0x10e0(%rbp), %rax
movq %rax, -0x10d8(%rbp)
movl -0x10cc(%rbp), %eax
orl $0x111, %eax            # imm = 0x111
movl %eax, -0x10cc(%rbp)
leaq -0x1040(%rbp), %rdx
movl -0x10cc(%rbp), %r8d
leaq 0x5038(%rip), %rdi      # 0xd278
leaq 0x5041(%rip), %rsi      # 0xd288
leaq 0x16f6(%rip), %rcx      # 0x9944
callq 0x5880
jmp 0x8579
leaq 0x16f0(%rip), %rdi      # 0x994f
movb $0x0, %al
callq 0x50c0
movl -0x10cc(%rbp), %edx
andl $0x80, %edx
xorl %eax, %eax
movl $0x100, %ecx            # imm = 0x100
cmpl $0x0, %edx
cmovnel %ecx, %eax
orl $0x1, %eax
orl -0x10cc(%rbp), %eax
movl %eax, -0x10cc(%rbp)
leaq -0x1040(%rbp), %rdx
movl -0x10cc(%rbp), %r8d
leaq 0x4fd5(%rip), %rdi      # 0xd278
leaq 0x4fde(%rip), %rsi      # 0xd288
leaq 0x16c4(%rip), %rcx      # 0x9975
callq 0x5880
jmp 0x8579
movl -0x10cc(%rbp), %eax
andl $0x14, %eax
cmpl $0x0, %eax
jne 0x82d8
movl -0x10cc(%rbp), %eax
orl $0x20, %eax
movl %eax, -0x10cc(%rbp)
jmp 0x82da
movl -0x10cc(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x83a9
movl -0x10cc(%rbp), %eax
andl $0x14, %eax
cmpl $0x0, %eax
je 0x8360
movq -0x10e0(%rbp), %rax
movzwl (%rax), %eax
cmpl $0x1, %eax
je 0x8325
leaq 0x166f(%rip), %rdi      # 0x9981
movb $0x0, %al
callq 0x50c0
movl $0x1, -0x14(%rbp)
jmp 0x8e98
movl -0x10cc(%rbp), %eax
orl $0x104, %eax            # imm = 0x104
movl %eax, -0x10cc(%rbp)
leaq -0x1040(%rbp), %rdx
movl -0x10cc(%rbp), %r8d
leaq 0x4f2d(%rip), %rdi      # 0xd278
leaq 0x4f36(%rip), %rsi      # 0xd288
leaq 0x1643(%rip), %rcx      # 0x999c
callq 0x5880
jmp 0x83a7
leaq 0x1641(%rip), %rdi      # 0x99a8
movb $0x0, %al
callq 0x50c0
movl -0x10cc(%rbp), %eax
orl $0x102, %eax            # imm = 0x102
movl %eax, -0x10cc(%rbp)
leaq -0x1040(%rbp), %rdx
movl -0x10cc(%rbp), %r8d
leaq 0x4ee4(%rip), %rdi      # 0xd278
leaq 0x4eed(%rip), %rsi      # 0xd288
leaq 0x162c(%rip), %rcx      # 0x99ce
callq 0x5880
jmp 0x83ee
leaq 0x159f(%rip), %rdi      # 0x994f
movb $0x0, %al
callq 0x50c0
movl -0x10cc(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x10cc(%rbp)
leaq -0x1040(%rbp), %rdx
movl -0x10cc(%rbp), %r8d
leaq 0x4e9d(%rip), %rdi      # 0xd278
leaq 0x4ea6(%rip), %rsi      # 0xd288
leaq 0x158c(%rip), %rcx      # 0x9975
callq 0x5880
jmp 0x8579
leaq 0x15e0(%rip), %rdi      # 0x99da
movb $0x0, %al
callq 0x50c0
movl -0x10cc(%rbp), %eax
orl $0x108, %eax            # imm = 0x108
movl %eax, -0x10cc(%rbp)
leaq -0x1040(%rbp), %rdx
movl -0x10cc(%rbp), %r8d
leaq 0x4e51(%rip), %rdi      # 0xd278
leaq 0x4e5a(%rip), %rsi      # 0xd288
leaq 0x15cb(%rip), %rcx      # 0x9a00
callq 0x5880
jmp 0x8579
leaq -0x2c(%rbp), %rax
movq %rax, -0x10d8(%rbp)
leaq 0x15bb(%rip), %rdi      # 0x9a0c
movb $0x0, %al
callq 0x50c0
movq 0x4dd1(%rip), %rdi      # 0xd230
leaq -0x1090(%rbp), %rsi
movl 0x4e04(%rip), %edx      # 0xd270
movq -0x10d8(%rbp), %rax
movzwl (%rax), %ecx
movq -0x10d8(%rbp), %rax
movzwl 0x2(%rax), %r8d
movq -0x10d8(%rbp), %rax
movzwl 0x4(%rax), %r9d
movq -0x10d8(%rbp), %rax
movzwl 0x4(%rax), %r11d
movq -0x10d8(%rbp), %rax
movzwl 0x6(%rax), %r10d
movq -0x10d8(%rbp), %rax
movl 0x8(%rax), %eax
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movb $0x0, %al
callq 0x50c0
leaq 0x1553(%rip), %rdi      # 0x9a1e
movb $0x0, %al
callq 0x50c0
movq 0x4d57(%rip), %rdi      # 0xd230
leaq -0x10b0(%rbp), %rsi
movl 0x4d8e(%rip), %edx      # 0xd274
movq -0x10e0(%rbp), %rax
movzwl (%rax), %ecx
movq -0x10e0(%rbp), %rax
movzwl 0x2(%rax), %r8d
movq -0x10e0(%rbp), %rax
movzwl 0x4(%rax), %r9d
movq -0x10e0(%rbp), %rax
movzwl 0x4(%rax), %r11d
movq -0x10e0(%rbp), %rax
movzwl 0x6(%rax), %r10d
movq -0x10e0(%rbp), %rax
movl 0x8(%rax), %eax
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movb $0x0, %al
callq 0x50c0
movzwl -0x10c2(%rbp), %esi
leaq 0x14e7(%rip), %rdi      # 0x9a33
movb $0x0, %al
callq 0x50c0
leaq 0x14f0(%rip), %rdi      # 0x9a4a
movb $0x0, %al
callq 0x50c0
movq -0x1110(%rbp), %rdi
callq 0x5090
movl $0x0, -0x14(%rbp)
jmp 0x8e98
jmp 0x857b
movl -0x10cc(%rbp), %esi
leaq 0x14df(%rip), %rdi      # 0x9a67
movb $0x0, %al
callq 0x50c0
movl -0x10cc(%rbp), %ecx
andl $0x1, %ecx
leaq 0xac7(%rip), %rsi       # 0x9066
leaq 0x14f4(%rip), %rax      # 0x9a9a
cmpl $0x0, %ecx
cmovneq %rax, %rsi
movl -0x10cc(%rbp), %ecx
andl $0x2, %ecx
leaq 0xaa9(%rip), %rdx       # 0x9066
leaq 0x14e1(%rip), %rax      # 0x9aa5
cmpl $0x0, %ecx
cmovneq %rax, %rdx
movl -0x10cc(%rbp), %edi
andl $0x4, %edi
leaq 0xa8b(%rip), %rcx       # 0x9066
leaq 0x14ce(%rip), %rax      # 0x9ab0
cmpl $0x0, %edi
cmovneq %rax, %rcx
movl -0x10cc(%rbp), %edi
andl $0x8, %edi
leaq 0xa6d(%rip), %r8        # 0x9066
leaq 0x14bb(%rip), %rax      # 0x9abb
cmpl $0x0, %edi
cmovneq %rax, %r8
movl -0x10cc(%rbp), %edi
andl $0x10, %edi
leaq 0xa4f(%rip), %r9        # 0x9066
leaq 0x14a8(%rip), %rax      # 0x9ac6
cmpl $0x0, %edi
cmovneq %rax, %r9
movl -0x10cc(%rbp), %edi
andl $0x20, %edi
leaq 0xa31(%rip), %rbx       # 0x9066
leaq 0x1494(%rip), %rax      # 0x9ad0
cmpl $0x0, %edi
cmovneq %rax, %rbx
movl -0x10cc(%rbp), %edi
andl $0x40, %edi
leaq 0xa13(%rip), %r11       # 0x9066
leaq 0x1482(%rip), %rax      # 0x9adc
cmpl $0x0, %edi
cmovneq %rax, %r11
movl -0x10cc(%rbp), %edi
andl $0x80, %edi
leaq 0x9f2(%rip), %r10       # 0x9066
leaq 0x146d(%rip), %rax      # 0x9ae8
cmpl $0x0, %edi
cmovneq %rax, %r10
movl -0x10cc(%rbp), %r14d
andl $0x100, %r14d           # imm = 0x100
leaq 0x9cf(%rip), %rax       # 0x9066
leaq 0x1455(%rip), %rdi      # 0x9af3
cmpl $0x0, %r14d
cmovneq %rdi, %rax
leaq 0x13ca(%rip), %rdi      # 0x9a77
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movb $0x0, %al
callq 0x50c0
movl -0x10cc(%rbp), %eax
andl $0x2c, %eax
cmpl $0x0, %eax
je 0x88ca
movq -0x10d8(%rbp), %rax
movzwl 0x4(%rax), %eax
imulq $0x14, %rax, %rdi
addq $0xc, %rdi
callq 0x5160
movq %rax, -0x1068(%rbp)
movq -0x10d8(%rbp), %rax
movzwl 0x4(%rax), %eax
movl %eax, %edi
shlq $0x4, %rdi
callq 0x5160
movq %rax, -0x10f0(%rbp)
movq -0x1068(%rbp), %rax
addq $0xc, %rax
movq %rax, -0x1100(%rbp)
movq -0x1110(%rbp), %rdi
movl $0x4, %esi
xorl %edx, %edx
callq 0x5190
movq -0x1068(%rbp), %rdi
movq -0x10d8(%rbp), %rax
movzwl 0x4(%rax), %eax
imulq $0x14, %rax, %rsi
addq $0xc, %rsi
movq -0x1110(%rbp), %rcx
movl $0x1, %edx
callq 0x5080
movl -0x10cc(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x8798
movq -0x1068(%rbp), %rdi
movq -0x10d8(%rbp), %rax
movzwl 0x4(%rax), %eax
imull $0x5, %eax, %esi
addl $0x3, %esi
movl -0x10cc(%rbp), %edx
callq 0x5f00
movl $0x0, -0x10c8(%rbp)
movl -0x10c8(%rbp), %eax
movq -0x10d8(%rbp), %rcx
movzwl 0x4(%rcx), %ecx
cmpl %ecx, %eax
jae 0x8866
movq -0x1100(%rbp), %rcx
movl -0x10c8(%rbp), %eax
imulq $0x14, %rax, %rax
addq %rax, %rcx
movq -0x10f0(%rbp), %rax
movl -0x10c8(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movl -0x10cc(%rbp), %eax
andl $0x14, %eax
cmpl $0x0, %eax
je 0x8818
movq -0x1100(%rbp), %rax
movl -0x10c8(%rbp), %ecx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %edi
callq 0x6530
movl %eax, -0x1130(%rbp)
jmp 0x8835
movq -0x1100(%rbp), %rax
movl -0x10c8(%rbp), %ecx
imulq $0x14, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movl %eax, -0x1130(%rbp)
movl -0x1130(%rbp), %ecx
movq -0x10f0(%rbp), %rax
movl -0x10c8(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movl -0x10c8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10c8(%rbp)
jmp 0x87a2
leaq 0x1292(%rip), %rdi      # 0x9aff
movb $0x0, %al
callq 0x50c0
leaq 0x1292(%rip), %rdi      # 0x9b0d
leaq 0xdc5(%rip), %rsi       # 0x9647
callq 0x51b0
movq %rax, -0x1118(%rbp)
movq -0x1068(%rbp), %rdi
movq -0x10d8(%rbp), %rax
movzwl 0x4(%rax), %eax
imulq $0x14, %rax, %rsi
addq $0xc, %rsi
movq -0x1118(%rbp), %rcx
movl $0x1, %edx
callq 0x5220
movq -0x1118(%rbp), %rdi
callq 0x5090
jmp 0x8af9
movq -0x10d8(%rbp), %rax
movzwl 0x4(%rax), %eax
imulq $0xc, %rax, %rdi
addq $0xc, %rdi
callq 0x5160
movq %rax, -0x1068(%rbp)
movq -0x10d8(%rbp), %rax
movzwl 0x4(%rax), %eax
movl %eax, %edi
shlq $0x4, %rdi
callq 0x5160
movq %rax, -0x10f0(%rbp)
movl -0x10cc(%rbp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x8924
movq -0x1068(%rbp), %rax
movq %rax, -0x1138(%rbp)
jmp 0x8936
movq -0x1068(%rbp), %rax
addq $0xc, %rax
movq %rax, -0x1138(%rbp)
movq -0x1138(%rbp), %rax
movq %rax, -0x10f8(%rbp)
movq -0x1110(%rbp), %rdi
movl -0x10cc(%rbp), %edx
andl $0x40, %edx
movl $0x4, %eax
movl $0x10, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movslq %eax, %rsi
xorl %edx, %edx
callq 0x5190
movq -0x1068(%rbp), %rdi
movq -0x10d8(%rbp), %rax
movzwl 0x4(%rax), %eax
imulq $0xc, %rax, %rsi
addq $0xc, %rsi
movq -0x1110(%rbp), %rcx
movl $0x1, %edx
callq 0x5080
movl -0x10cc(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x89cc
movq -0x1068(%rbp), %rdi
movq -0x10d8(%rbp), %rax
movzwl 0x4(%rax), %eax
imull $0x3, %eax, %esi
addl $0x3, %esi
movl -0x10cc(%rbp), %edx
callq 0x5f00
movl $0x0, -0x10c8(%rbp)
movl -0x10c8(%rbp), %eax
movq -0x10d8(%rbp), %rcx
movzwl 0x4(%rcx), %ecx
cmpl %ecx, %eax
jae 0x8a9a
movq -0x10f8(%rbp), %rcx
movl -0x10c8(%rbp), %eax
imulq $0xc, %rax, %rax
addq %rax, %rcx
movq -0x10f0(%rbp), %rax
movl -0x10c8(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movl -0x10cc(%rbp), %eax
andl $0x14, %eax
cmpl $0x0, %eax
je 0x8a4c
movq -0x10f8(%rbp), %rax
movl -0x10c8(%rbp), %ecx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %edi
callq 0x6530
movl %eax, -0x113c(%rbp)
jmp 0x8a69
movq -0x10f8(%rbp), %rax
movl -0x10c8(%rbp), %ecx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x113c(%rbp)
movl -0x113c(%rbp), %ecx
movq -0x10f0(%rbp), %rax
movl -0x10c8(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movl -0x10c8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10c8(%rbp)
jmp 0x89d6
leaq 0x107d(%rip), %rdi      # 0x9b1e
movb $0x0, %al
callq 0x50c0
leaq 0x107f(%rip), %rdi      # 0x9b2e
leaq 0xb91(%rip), %rsi       # 0x9647
callq 0x51b0
movq %rax, -0x1118(%rbp)
movq -0x1068(%rbp), %rdi
movq -0x10d8(%rbp), %rax
movzwl 0x4(%rax), %eax
imulq $0xc, %rax, %rsi
addq $0xc, %rsi
movq -0x1118(%rbp), %rcx
movl $0x1, %edx
callq 0x5220
movq -0x1118(%rbp), %rdi
callq 0x5090
leaq 0x1041(%rip), %rdi      # 0x9b41
movb $0x0, %al
callq 0x50c0
movl $0x0, -0x10c8(%rbp)
movl -0x10c8(%rbp), %eax
movq -0x10d8(%rbp), %rcx
movzwl 0x4(%rcx), %ecx
cmpl %ecx, %eax
jae 0x8b98
movl -0x10c8(%rbp), %esi
movq -0x10f0(%rbp), %rax
movl -0x10c8(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdx
movq -0x10f0(%rbp), %rax
movl -0x10c8(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
movq -0x10f0(%rbp), %rax
movl -0x10c8(%rbp), %edi
shlq $0x4, %rdi
addq %rdi, %rax
movl 0x8(%rax), %r8d
shll $0xb, %r8d
leaq 0xfd0(%rip), %rdi       # 0x9b4d
movb $0x0, %al
callq 0x50c0
movl -0x10c8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10c8(%rbp)
jmp 0x8b11
movq -0x1110(%rbp), %rdi
movq -0x10f0(%rbp), %rsi
movq -0x10d8(%rbp), %rax
movzwl 0x4(%rax), %edx
movl -0x10cc(%rbp), %ecx
callq 0x6260
movq %rax, -0x10e8(%rbp)
movl $0x0, -0x10c8(%rbp)
movl -0x10c8(%rbp), %eax
movq -0x10d8(%rbp), %rcx
movzwl 0x4(%rcx), %ecx
cmpl %ecx, %eax
jae 0x8dd6
movq -0x10f0(%rbp), %rax
movl -0x10c8(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
movl $0x1ff, %esi            # imm = 0x1FF
callq 0x5070
movl -0x10cc(%rbp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x8c2d
leaq -0x1060(%rbp), %rdi
leaq 0xf50(%rip), %rsi       # 0x9b73
callq 0x5060
jmp 0x8ce7
movl -0x10cc(%rbp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x8c53
leaq -0x1060(%rbp), %rdi
leaq 0xf32(%rip), %rsi       # 0x9b7b
callq 0x5060
jmp 0x8ce5
movl -0x10cc(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x8c76
leaq -0x1060(%rbp), %rdi
leaq 0xf11(%rip), %rsi       # 0x9b80
callq 0x5060
jmp 0x8ce3
movl -0x10cc(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x8c99
leaq -0x1060(%rbp), %rdi
leaq 0xef4(%rip), %rsi       # 0x9b86
callq 0x5060
jmp 0x8ce1
movl -0x10cc(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x8cbc
leaq -0x1060(%rbp), %rdi
leaq 0xed7(%rip), %rsi       # 0x9b8c
callq 0x5060
jmp 0x8cdf
movl -0x10cc(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x8cdd
leaq -0x1060(%rbp), %rdi
leaq 0xeba(%rip), %rsi       # 0x9b92
callq 0x5060
jmp 0x8cdf
jmp 0x8ce1
jmp 0x8ce3
jmp 0x8ce5
jmp 0x8ce7
leaq -0x1060(%rbp), %rdi
movq -0x10f0(%rbp), %rax
movl -0x10c8(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rsi
callq 0x5200
leaq -0x1040(%rbp), %rdx
leaq -0x1060(%rbp), %rcx
movl -0x10cc(%rbp), %r8d
leaq 0x455a(%rip), %rdi      # 0xd280
leaq 0x455f(%rip), %rsi      # 0xd28c
callq 0x5880
movq -0x1110(%rbp), %rdi
movq -0x10e8(%rbp), %rcx
movl -0x10c8(%rbp), %eax
shlq $0x4, %rax
addq %rax, %rcx
movq -0x10f0(%rbp), %rax
movl -0x10c8(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rax
movl -0x10cc(%rbp), %r9d
movl (%rcx), %esi
movq 0x8(%rcx), %rdx
movq (%rax), %rcx
movl 0x8(%rax), %r8d
callq 0x6570
cmpq $0x0, 0x44fe(%rip)      # 0xd280
je 0x8d90
movq 0x44f5(%rip), %rdi      # 0xd280
callq 0x5030
movq $0x0, 0x44e5(%rip) # 0xd280
cmpl $0x0, 0x44ea(%rip)      # 0xd28c
jle 0x8db8
movl 0x44e2(%rip), %ecx      # 0xd28c
movl 0x44e0(%rip), %eax      # 0xd290
subl %ecx, %eax
movl %eax, 0x44d8(%rip)      # 0xd290
movl $0x0, 0x44ca(%rip)      # 0xd28c
movl -0x10c8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10c8(%rbp)
jmp 0x8bcd
movl $0x0, -0x10c8(%rbp)
movl -0x10c8(%rbp), %eax
movq -0x10d8(%rbp), %rcx
movzwl 0x4(%rcx), %ecx
cmpl %ecx, %eax
jae 0x8e23
movq -0x10e8(%rbp), %rax
movl -0x10c8(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
callq 0x5030
movl -0x10c8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10c8(%rbp)
jmp 0x8de0
movq -0x1068(%rbp), %rdi
callq 0x5030
movq -0x10e8(%rbp), %rdi
callq 0x5030
movq -0x10f0(%rbp), %rdi
callq 0x5030
movl -0x10cc(%rbp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x8e61
movq -0x10d8(%rbp), %rdi
callq 0x5030
cmpq $0x0, 0x440f(%rip)      # 0xd278
je 0x8e77
movq 0x4406(%rip), %rdi      # 0xd278
callq 0x5030
leaq 0xd1a(%rip), %rdi       # 0x9b98
movb $0x0, %al
callq 0x50c0
movq -0x1110(%rbp), %rdi
callq 0x5090
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
addq $0x1150, %rsp           # imm = 0x1150
popq %rbx
popq %r14
popq %rbp
retq
nopw (%rax,%rax)