// File: /workspace/github_c_makefile_star2_O1/DavidSM64[P]DKR-Decompressor/GECompression.cpp
// Function: GECompression::CreateGlobalDecompressionTable(int, int, int, int, int, bool&, int&, int&)
void GECompression::CreateGlobalDecompressionTable(int bit1TableChoice, int size2, int bit12STableSChoice, int bit12BTableChoice, int numBits, bool& returnValue, int& numReturnBits, int& returnStartIndex)
{
	//if (bit1TableChoice == 0) bt1Table1 else bt1Table2
	//if (bit12STableSChoice == 0) bt12Table1S else bt12Table2S
	//if (bit12BTableChoice == 0) bt12Table1B else bt12Table2B
	CString temp; // temp var del later

	tableEntry localTableEntry;
	localTableEntry.bits = 0;
	localTableEntry.flags = 0;
	localTableEntry.nextIndex = 0;
	localTableEntry.wordValue = 0;

	int table1Size = 0;

	int returnIndex = -1;

	unsigned long seventeenints1[17];
	for (int x = 0; x < 17; x++)
		seventeenints1[x] = 0;

	if (bit1TableChoice == TABLE1)
	{
		table1Size = 288;
		for (int x = 0; x < 288; x++)
		{
			seventeenints1[bt1Table1[x]]++;
		}
	}
	else if (bit1TableChoice == TABLE2)
	{
		table1Size = 30;
		for (int x = 0; x < 30; x++)
		{
			seventeenints1[bt1Table2[x]]++;
		}
	}
	else if (bit1TableChoice == VARIABLETABLE)
	{
		table1Size = 0x13;		
		for (int x = 0; x < 0x13; x++)
		{
			seventeenints1[variableTable[x]]++;			
		}
	}
	else if (bit1TableChoice == WORDTABLEBEGIN)
	{
		table1Size = tableSize;		
		for (int x = 0; x < table1Size; x++)
		{
			seventeenints1[wordTable[x]]++;			
		}
	}
	else if (bit1TableChoice == WORDTABLEEND)
	{
		table1Size = ((tableSize + fiveBits) - tableSize);
		for (int x = 0; x < table1Size; x++)
		{
			seventeenints1[wordTable[tableSize + x]]++;			
		}
	}

	int firstBit = 1;
	while (seventeenints1[firstBit] == 0)
		firstBit++;

	int lastBit = 16;	
	while (seventeenints1[lastBit] == 0)
		lastBit--;

	if (numBits < firstBit)
		numBits = firstBit;
	if (numBits > lastBit)
		numBits = lastBit;

	unsigned long v1temp = (1<<firstBit);
	if (firstBit != lastBit)
	{
		for (int bitNum = firstBit; bitNum < lastBit; bitNum++)
		{
			v1temp = ((v1temp - seventeenints1[bitNum])*2);
		}	
	}

	int oldLastBitCount = seventeenints1[lastBit];
	seventeenints1[lastBit] = v1temp;
	v1temp = v1temp - oldLastBitCount;

	unsigned long seventeenints2[17];
	for (int x = 0; x < 17; x++)
		seventeenints2[x] = 0;

	int accumulator = 0;
	for (int index = 1; index < lastBit; index++)
	{
		accumulator = accumulator + seventeenints1[index];
		seventeenints2[index+1] = accumulator;
	}


	unsigned long* moreWords;
	moreWords = new unsigned long[table1Size];
	int moreWordsIndex = 0;
	int index = 0;

	for (int x = 0; x < table1Size; x++)
	{
		moreWords[x] = 0;
	}

	for (int x = 0; x < table1Size; x++)
	{

		if (bit1TableChoice == TABLE1)
		{
			if ((bt1Table1[x]) != 0)
			{
				moreWords[seventeenints2[bt1Table1[x]]] = index;
				seventeenints2[bt1Table1[x]]++;
			}
		}
		else if (bit1TableChoice == TABLE2)
		{
			if ((bt1Table2[x]) != 0)
			{
				moreWords[seventeenints2[bt1Table2[x]]] = index;
				seventeenints2[bt1Table2[x]]++;
			}
		}
		else if (bit1TableChoice == VARIABLETABLE)
		{
			if ((variableTable[x]) != 0)
			{
				moreWords[seventeenints2[variableTable[x]]] = index;
				seventeenints2[variableTable[x]]++;	
			}
		}
		else if (bit1TableChoice == WORDTABLEBEGIN)
		{
			if ((wordTable[x]) != 0)
			{
				moreWords[seventeenints2[wordTable[x]]] = index;
				seventeenints2[wordTable[x]]++;
			}
		}
		else if (bit1TableChoice == WORDTABLEEND)
		{
			if ((wordTable[tableSize + x]) != 0)
			{
				moreWords[seventeenints2[wordTable[tableSize + x]]] = index;
				seventeenints2[wordTable[tableSize + x]]++;
			}
		}
		index++;
	}

	int stemp2_v1 = -numBits;
	int blockNum = -1;
	int bitPattern = 0;

	int unpackTableStarts[0x20000];
	int unpackTableStartsIndex = -1;

	unsigned long temp_a3 = 0;
	int thisTableStart = 0;

	for (int bitNum = firstBit; bitNum < (lastBit+1); bitNum++)
	{
		int iterationsLeft = seventeenints1[bitNum];
		unsigned long lv34 = (1<<(bitNum-1));
		int moreWordsIndex2 = table1Size;

		while (iterationsLeft)
		{
			if (iterationsLeft < 0)
				break;
			stemp2_v1 = stemp2_v1 + numBits;
			while (stemp2_v1 < bitNum)
			{
				blockNum++;

				unsigned long temp_t0 = 0;

				if (numBits < (lastBit-stemp2_v1))
					temp_t0=numBits;
				else
					temp_t0 = lastBit-stemp2_v1;

				temp_a3 = bitNum - stemp2_v1;

				if (iterationsLeft < (1<<temp_a3))
				{
					unsigned long another_var_v1= ((1 << temp_a3) - iterationsLeft);
					temp_a3++;

					index = bitNum + 1;
					while (temp_a3 < temp_t0)
					{
						if (seventeenints1[index] < (another_var_v1*2))
						{
							temp_a3++;
							another_var_v1 = another_var_v1*2 - seventeenints1[index];
						}
						index++;
					}
				}
				if (returnIndex==-1)
					returnIndex=unpackTableIndex + 1;
				
				unpackTableStartsIndex++;
				unpackTableStarts[unpackTableStartsIndex] = (unpackTableIndex+1);
				
				thisTableStart = unpackTableIndex + 1;

				if (blockNum != 0)
				{
					seventeenints2[blockNum] = bitPattern;
					localTableEntry.bits = numBits;
					localTableEntry.flags = temp_a3 + 0x10;
					localTableEntry.nextIndex= unpackTableIndex + 1;
					localTableEntry.wordValue = -1;
					unpackTable[(bitPattern>>(stemp2_v1-numBits))+unpackTableStarts[blockNum-1]].bits = localTableEntry.bits;
					unpackTable[(bitPattern>>(stemp2_v1-numBits))+unpackTableStarts[blockNum-1]].flags = localTableEntry.flags;
					unpackTable[(bitPattern>>(stemp2_v1-numBits))+unpackTableStarts[blockNum-1]].wordValue = localTableEntry.wordValue;
					unpackTable[(bitPattern>>(stemp2_v1-numBits))+unpackTableStarts[blockNum-1]].nextIndex = localTableEntry.nextIndex;
				}

				unpackTableIndex=unpackTableIndex + ((1<<temp_a3)+1);
				stemp2_v1+=numBits;
			}
			stemp2_v1 = stemp2_v1 - numBits;

			localTableEntry.bits = bitNum - stemp2_v1;
			localTableEntry.nextIndex = 0;
			if (moreWordsIndex >= moreWordsIndex2)
				localTableEntry.flags = 0x63;
			else
			{
				unsigned long tempWord = moreWords[moreWordsIndex];
				if (tempWord<size2)
				{
					if (tempWord >= 0x100)
						localTableEntry.flags = 0xf;
					else
						localTableEntry.flags = 0x10;
					localTableEntry.wordValue = tempWord;
				}
				else
				{
					if (bit12STableSChoice == TABLE1)
					{
						localTableEntry.flags = bt12Table1B[moreWords[moreWordsIndex]-size2];
						localTableEntry.wordValue = bt12Table1S[moreWords[moreWordsIndex]-size2];
					}
					else if (bit12STableSChoice == TABLE2)
					{
						localTableEntry.flags = bt12Table2B[moreWords[moreWordsIndex]-size2];
						localTableEntry.wordValue = bt12Table2S[moreWords[moreWordsIndex]-size2];
					}
					else if (bit12STableSChoice == VARIABLETABLE)
					{
						// shouldn't happen

					}
				}
				moreWordsIndex++;
			}
		
			unsigned long nu_accum_a3 = (bitPattern >> stemp2_v1);
			unsigned long stride_v0 = (1<<(bitNum - stemp2_v1));
			/*if (thisTableStart==744)
			{
				if thisTableStart+nu_accum_a3==758
				{
					if stride_v0==16:
					{
						debugIt=1
					}
				}
			}*/
			while ((1<<temp_a3) > nu_accum_a3)
			{
				if ((thisTableStart+nu_accum_a3) > 0xFFFF)
				{
					delete [] moreWords;
					return;
				}
				unpackTable[thisTableStart+nu_accum_a3].bits = localTableEntry.bits;
				unpackTable[thisTableStart+nu_accum_a3].flags = localTableEntry.flags;
				unpackTable[thisTableStart+nu_accum_a3].wordValue = localTableEntry.wordValue;
				unpackTable[thisTableStart+nu_accum_a3].nextIndex = localTableEntry.nextIndex;
				nu_accum_a3 = nu_accum_a3 + stride_v0;
			}

			unsigned long tempLv=lv34;
			
			while (bitPattern & tempLv)
			{
				bitPattern = bitPattern ^ tempLv;
				tempLv = tempLv >> 1;
			}
			bitPattern = bitPattern ^ tempLv;
			while((bitPattern & ((1 << stemp2_v1)-1)) != seventeenints2[blockNum])
			{
				blockNum = blockNum- 1;
				stemp2_v1=0;
			}

			iterationsLeft = iterationsLeft - 1;
		}
	}
	delete [] moreWords;
	if (v1temp > 0)
	{
		returnValue = (0<(lastBit^1));
		numReturnBits = numBits;
		returnStartIndex = returnIndex;
	}
	else
	{
		returnValue = 0;
		numReturnBits = numBits;
		returnStartIndex = returnIndex;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x801f8, %rsp          # imm = 0x801F8
movq %r9, -0x70(%rbp)
movl %ecx, -0x8c(%rbp)
movl %edx, -0x34(%rbp)
movl %esi, %r14d
movq %rdi, -0x58(%rbp)
leaq -0xf8(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x220(%rbp), %rdi
xorl %r15d, %r15d
movl $0x88, %edx
xorl %esi, %esi
callq 0x20f0
leaq 0x5f91(%rip), %rbx      # 0xa180
testl %r14d, %r14d
je 0x423e
leal -0x1(%r14), %eax
cmpl $0x3, %eax
movq -0x58(%rbp), %rdx
ja 0x42d6
leaq 0x2ff0(%rip), %rcx      # 0x71fc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %eax, %eax
leaq 0x6082(%rip), %rcx      # 0xa2a0
movzbl (%rax,%rcx), %edx
incq -0x220(%rbp,%rdx,8)
incq %rax
cmpq $0x1e, %rax
jne 0x421e
movl $0x1e, %r15d
jmp 0x42d6
xorl %eax, %eax
movzbl (%rax,%rbx), %ecx
incq -0x220(%rbp,%rcx,8)
incq %rax
cmpq $0x120, %rax            # imm = 0x120
jne 0x4240
movl $0x120, %r15d           # imm = 0x120
jmp 0x42d6
movzwl 0x70(%rdx), %r15d
testl %r15d, %r15d
je 0x42d6
movq 0x78(%rdx), %rax
movl %r15d, %ecx
xorl %edx, %edx
movq (%rax,%rdx,8), %rsi
incq -0x220(%rbp,%rsi,8)
incq %rdx
cmpq %rdx, %rcx
jne 0x4272
jmp 0x42d6
movzbl 0x72(%rdx), %r15d
testl %r15d, %r15d
je 0x42d6
movzwl 0x70(%rdx), %eax
movl %r15d, %ecx
shll $0x3, %eax
addq 0x78(%rdx), %rax
xorl %edx, %edx
movq (%rax,%rdx,8), %rsi
incq -0x220(%rbp,%rsi,8)
incq %rdx
cmpq %rdx, %rcx
jne 0x42a2
jmp 0x42d6
xorl %eax, %eax
movzbl 0x5c(%rdx,%rax), %ecx
incq -0x220(%rbp,%rcx,8)
incq %rax
cmpq $0x13, %rax
jne 0x42ba
movl $0x13, %r15d
leaq -0x218(%rbp), %rax
xorl %ecx, %ecx
incq %rcx
cmpq $0x0, (%rax)
leaq 0x8(%rax), %rax
je 0x42df
movq %rax, -0xa0(%rbp)
addq $-0x8, %rax
movl $0x10, %edx
movq %rdx, %r12
movq -0x220(%rbp,%rdx,8), %rsi
decq %rdx
testq %rsi, %rsi
je 0x42fc
movq -0x70(%rbp), %rdx
cmpl %edx, %ecx
cmovgl %ecx, %edx
cmpl %r12d, %edx
cmovgel %r12d, %edx
movq %rdx, -0x78(%rbp)
movl $0x1, %edx
shll %cl, %edx
movslq %edx, %rdx
cmpq %r12, %rcx
movq %rcx, %r13
movq %rsi, -0xb8(%rbp)
jge 0x434d
subq (%rax), %rdx
addq %rdx, %rdx
addq $0x8, %rax
incl %ecx
cmpl %r12d, %ecx
jl 0x433c
movq %rdx, -0xb0(%rbp)
movq %rdx, -0x220(%rbp,%r12,8)
leaq -0x190(%rbp), %rdi
movl $0x88, %edx
xorl %esi, %esi
callq 0x20f0
cmpq $0x2, %r12
jl 0x439d
movl %r12d, %eax
decq %rax
xorl %ecx, %ecx
xorl %edx, %edx
movslq %edx, %rdx
addq -0x218(%rbp,%rcx,8), %rdx
movslq %edx, %rsi
movq %rsi, -0x180(%rbp,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x437f
movq %r12, -0x88(%rbp)
leal (,%r15,8), %r12d
movq %r12, %rdi
callq 0x2030
movq %rax, -0x40(%rbp)
movq %r15, -0x98(%rbp)
testl %r15d, %r15d
movq -0x58(%rbp), %r11
movq %r13, %r10
je 0x44b4
xorl %r15d, %r15d
movq -0x40(%rbp), %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x20f0
movq %r13, %r10
movq -0x58(%rbp), %r11
movq 0x78(%r11), %rax
movzwl 0x70(%r11), %edx
movl -0x98(%rbp), %ecx
leaq (%rax,%rdx,8), %rdx
leal -0x1(%r14), %esi
leaq 0x2e07(%rip), %rdi      # 0x720c
leaq 0x5e94(%rip), %r8       # 0xa2a0
testl %r14d, %r14d
je 0x442b
cmpl $0x3, %esi
ja 0x44a8
movslq (%rdi,%rsi,4), %r9
addq %rdi, %r9
jmpq *%r9
movzbl (%r15,%r8), %r9d
jmp 0x4484
movzbl (%r15,%rbx), %r9d
jmp 0x4484
movq (%rax,%r15,8), %r9
testq %r9, %r9
je 0x44a8
movq -0x190(%rbp,%r9,8), %r9
movq -0x40(%rbp), %r10
movq %r15, (%r10,%r9,8)
movq (%rax,%r15,8), %r9
jmp 0x446e
movq (%rdx,%r15,8), %r9
testq %r9, %r9
je 0x44a8
movq -0x190(%rbp,%r9,8), %r9
movq -0x40(%rbp), %r10
movq %r15, (%r10,%r9,8)
movq (%rdx,%r15,8), %r9
leaq -0x190(,%r9,8), %r9
addq %rbp, %r9
movq (%r9), %r10
jmp 0x449f
movzbl 0x5c(%r11,%r15), %r9d
testq %r9, %r9
je 0x44a8
leaq -0x190(,%r9,8), %r9
addq %rbp, %r9
movq (%r9), %r10
movq -0x40(%rbp), %r12
movq %r15, (%r12,%r10,8)
incq %r10
movq %r10, (%r9)
movq %r13, %r10
incq %r15
cmpq %r15, %rcx
jne 0x440c
movq -0x88(%rbp), %rax
cmpq %rax, %r10
setg %cl
jle 0x44cf
movl $0xffffffff, -0x34(%rbp) # imm = 0xFFFFFFFF
jmp 0x48d9
movl %ecx, %edx
movq -0x78(%rbp), %rcx
movl %ecx, %r14d
negl %r14d
movslq %ecx, %rcx
movq %rcx, -0xe8(%rbp)
movl %edx, %ecx
movslq -0x34(%rbp), %rdx
movq %rdx, -0xd0(%rbp)
movq -0x70(%rbp), %r13
cmpl %r10d, %r13d
cmovlel %r10d, %r13d
cmpl %eax, %r13d
movl %eax, %edx
cmovll %r13d, %edx
movq %rdx, -0xc8(%rbp)
cmpq %r13, %rax
cmovlq %rax, %r13
movq %r13, -0x70(%rbp)
cltq
movq %rax, -0xc0(%rbp)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq $0x0, -0x50(%rbp)
movl $0x0, -0x30(%rbp)
xorl %r9d, %r9d
xorl %r12d, %r12d
xorl %r13d, %r13d
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
xorl %r8d, %r8d
movl $0xffffffff, -0x34(%rbp) # imm = 0xFFFFFFFF
movb %cl, -0x29(%rbp)
movl -0x220(%rbp,%r10,8), %eax
leal -0x1(%r10), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, -0x90(%rbp)
movslq %edx, %rcx
movq %rcx, -0xd8(%rbp)
movq %r10, -0xa8(%rbp)
movq %rax, -0x80(%rbp)
testl %eax, %eax
jle 0x48af
movq -0x78(%rbp), %rax
addl %r14d, %eax
cltq
cmpq %rax, %r10
jle 0x46e8
movl %r8d, -0x44(%rbp)
movslq %r13d, %rax
movq %rax, -0x68(%rbp)
movq 0x28(%r11), %rdx
movq -0xc8(%rbp), %rcx
addl %r14d, %ecx
movslq %ecx, %rcx
movslq %ebx, %rbx
movslq %r15d, %rdi
movq %rcx, %rsi
movq -0x88(%rbp), %rcx
movl %ecx, %r8d
subl %esi, %r8d
movq -0x78(%rbp), %rcx
cmpl %r8d, %ecx
cmovll %ecx, %r8d
movq %r10, %r12
subq %rsi, %r12
movl $0x1, %r9d
movl %r12d, %ecx
shll %cl, %r9d
subl -0x80(%rbp), %r9d
jle 0x4621
movslq %r8d, %rcx
incq %r12
cmpq %rcx, %r12
jae 0x4621
movslq %r9d, %r8
movq -0xa0(%rbp), %r9
leaq (%r8,%r8), %r10
xorl %r11d, %r11d
subq (%r9), %r10
seta %r11b
cmovaq %r10, %r8
addq %r11, %r12
addq $0x8, %r9
cmpq %rcx, %r12
jb 0x4603
leaq 0x1(%rdi), %r15
movq -0x58(%rbp), %r11
movl 0x30(%r11), %r8d
leal 0x1(%r8), %r9d
movl -0x34(%rbp), %ecx
cmpl $-0x1, %ecx
cmovel %r9d, %ecx
movl %ecx, -0x34(%rbp)
movl %r9d, -0x8021c(%rbp,%rbx,4)
testq %r15, %r15
je 0x46ad
movq -0x68(%rbp), %rcx
movq %rcx, -0x190(%rbp,%r15,8)
leal 0x10(%r12), %r10d
movq %r11, %rax
movl %r9d, %r11d
movl %ecx, %r9d
movl %r14d, %ecx
sarl %cl, %r9d
movslq -0x80220(%rbp,%rdi,4), %rcx
movslq %r9d, %rdi
movl %r11d, %r9d
movq %rax, %r11
addq %rcx, %rdi
leaq (%rdi,%rdi,2), %rcx
movq -0xe8(%rbp), %rdi
movq %rdi, (%rdx,%rcx,8)
movl %r10d, -0x30(%rbp)
movb %r10b, 0x8(%rdx,%rcx,8)
movq $-0x1, 0x10(%rdx,%rcx,8)
movl %r9d, 0xc(%rdx,%rcx,8)
movq $-0x1, -0x50(%rbp)
movl $0x1, %edi
movl %r12d, %ecx
shll %cl, %edi
incq %rbx
leal (%r8,%rdi), %ecx
incl %ecx
movl %ecx, 0x30(%r11)
movq -0x70(%rbp), %rcx
addq %rsi, %rcx
movq %r15, %rdi
movl %esi, %r14d
movq -0xa8(%rbp), %r10
cmpq %r10, %rcx
jl 0x45bb
movl %esi, %r14d
movl -0x44(%rbp), %r8d
cmpl -0x98(%rbp), %r8d
jge 0x471f
movslq %r8d, %rax
movq -0x40(%rbp), %rcx
movq (%rcx,%rax,8), %rcx
movq %rcx, %rax
subq -0xd0(%rbp), %rax
jae 0x4726
cmpq $0x100, %rcx            # imm = 0x100
movl $0x0, %eax
adcb $0xf, %al
movl %eax, -0x30(%rbp)
movq %rcx, -0x50(%rbp)
jmp 0x4767
movb $0x63, %al
movl %eax, -0x30(%rbp)
jmp 0x476a
movl -0x8c(%rbp), %ecx
cmpl $0x1, %ecx
je 0x474b
testl %ecx, %ecx
jne 0x4767
leaq 0x5bc4(%rip), %rcx      # 0xa300
movb (%rcx,%rax,2), %cl
movl %ecx, -0x30(%rbp)
leaq 0x5b77(%rip), %rcx      # 0xa2c0
jmp 0x475f
leaq 0x5c2e(%rip), %rcx      # 0xa380
movb (%rcx,%rax,2), %cl
movl %ecx, -0x30(%rbp)
leaq 0x5be1(%rip), %rcx      # 0xa340
movzwl (%rcx,%rax,2), %eax
movq %rax, -0x50(%rbp)
incl %r8d
movl %r10d, %eax
movl %r13d, %edx
movl %r14d, %ecx
sarl %cl, %edx
subl %r14d, %eax
cltq
movl $0x1, %esi
movl %eax, %ecx
shll %cl, %esi
movl $0x1, %edi
movl %r12d, %ecx
shll %cl, %edi
cmpl %edi, %edx
setb -0x68(%rbp)
jae 0x4842
movl %r8d, -0x44(%rbp)
movslq %edx, %rcx
movl %r9d, -0x5c(%rbp)
movslq %r9d, %rdx
addq %rcx, %rdx
cmpq $0xffff, %rdx           # imm = 0xFFFF
ja 0x4818
movslq %esi, %rsi
movslq %edi, %rdi
movq %rdi, -0xe0(%rbp)
movq 0x28(%r11), %r8
leaq (%rdx,%rdx,2), %r9
leaq (%r8,%r9,8), %r8
addq $0x10, %r8
leaq (,%rsi,8), %r9
leaq (%r9,%r9,2), %r9
addq %rsi, %rcx
movq %rax, -0x10(%r8)
movl -0x30(%rbp), %edi
movb %dil, -0x8(%r8)
movq -0x50(%rbp), %rdi
movq %rdi, (%r8)
movl $0x0, -0x4(%r8)
cmpq -0xe0(%rbp), %rcx
setb -0x68(%rbp)
jae 0x483a
addq %r9, %r8
addq %rsi, %rdx
addq %rsi, %rcx
cmpq $0x10000, %rdx          # imm = 0x10000
jb 0x47df
movq -0x40(%rbp), %rdi
callq 0x21e0
movq -0xa8(%rbp), %r10
movq -0x58(%rbp), %r11
movq -0x80(%rbp), %rax
movl -0x44(%rbp), %r8d
movl -0x5c(%rbp), %r9d
jmp 0x48a5
movl -0x44(%rbp), %r8d
movl -0x5c(%rbp), %r9d
movq -0xd8(%rbp), %rax
movl -0x90(%rbp), %edx
movl %edx, %ecx
testl %r13d, %edx
je 0x4866
xorl %eax, %r13d
shrq %rax
movslq %r13d, %rcx
testq %rcx, %rax
jne 0x4856
movl %eax, %ecx
xorl %ecx, %r13d
movslq %r15d, %rax
leal 0x1(%rax), %r15d
leaq -0x190(,%rax,8), %rax
addq %rbp, %rax
movl %r14d, %ecx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
shll %cl, %edx
notl %edx
andl %r13d, %edx
decl %r15d
leaq -0x8(%rax), %rsi
xorl %r14d, %r14d
cmpq %rdx, (%rax)
movq %rsi, %rax
jne 0x487b
movq -0x80(%rbp), %rax
decl %eax
movl %ecx, %r14d
cmpb $0x0, -0x68(%rbp)
je 0x457b
cmpl $0x0, -0x80(%rbp)
jg 0x48d6
leaq 0x1(%r10), %rax
addq $0x8, -0xa0(%rbp)
cmpq -0xc0(%rbp), %r10
setge %cl
movq %rax, %r10
jl 0x454e
jmp 0x48d9
movb -0x29(%rbp), %cl
testb $0x1, %cl
je 0x4920
movslq -0xb8(%rbp), %rbx
movq -0x40(%rbp), %rdi
callq 0x21e0
cmpq %rbx, -0xb0(%rbp)
setne %al
movq -0x88(%rbp), %rcx
xorl $0x1, %ecx
setg %cl
andb %al, %cl
movq 0x10(%rbp), %rax
movb %cl, (%rax)
movq 0x18(%rbp), %rax
movq -0x78(%rbp), %rcx
movl %ecx, (%rax)
movq 0x20(%rbp), %rax
movl -0x34(%rbp), %ecx
movl %ecx, (%rax)
movq -0x108(%rbp), %rdi
leaq -0xf8(%rbp), %rax
cmpq %rax, %rdi
je 0x4942
movq -0xf8(%rbp), %rsi
incq %rsi
callq 0x2190
addq $0x801f8, %rsp          # imm = 0x801F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq