// File: /workspace/github_cpp_makefile_star2_O1/richardposner[P]BioNetFit2/src/code/Swarm.cpp
// Function: Swarm::generateTopology(unsigned int)
vector<vector<unsigned int> > Swarm::generateTopology(unsigned int populationSize) {
	Timer tmr;

	vector<vector<unsigned int> > allParticles (populationSize + 1);

	if (options.fitType == "pso" || options.fitType == "de") {

		if (options.verbosity >= 3) {
			cout << "Generating initial particles with a " << options.topology << " topology" << endl;
		}

		if (options.topology == "fullyconnected") {
			for (unsigned int p = 1; p <= populationSize; ++p) {
				vector<unsigned int> connections;
				for (unsigned int c = 1; c <= populationSize; ++c) {
					if (c != p) {
						connections.push_back(c);
					}
				}
				allParticles[p] = connections;
			}
		}
		else if (options.topology == "ring") {

			// Connect the first particle manually
			unsigned int firstConnection[] = {2, populationSize};
			allParticles[1] = vector<unsigned int> (firstConnection, firstConnection + sizeof(firstConnection) / sizeof(firstConnection[0]));

			vector<unsigned int> connections;
			for (unsigned int p = 2; p <= populationSize - 1; ++p) {

				connections.clear();
				// Connect to particle before, and particle after
				connections.push_back(p-1);
				connections.push_back(p+1);
				allParticles[p] = connections;

			}

			// Connect the last particle manually
			unsigned int lastConnection[] = {populationSize - 1, 1};
			allParticles[populationSize] = vector<unsigned int> (lastConnection, lastConnection + sizeof(lastConnection) / sizeof(lastConnection[0]));
		}
		else if (options.topology == "star") {
			vector<unsigned int> connections;

			// First connect the central particle to all others
			for (unsigned int c = 2; c <= populationSize; ++c) {
				connections.push_back(c);
			}
			allParticles[1] = connections;

			// Then connect all particles to the central particles
			for (unsigned int p = 2; p <= populationSize; ++p) {
				connections.clear();
				connections.push_back(1);
				allParticles[p] = connections;
			}
		}
		else if (options.topology == "mesh") {

			unsigned int desiredArea = populationSize;
			unsigned int divisor = ceil(sqrt(desiredArea));
			if (divisor != 0) {
			  while(desiredArea % divisor != 0) {
				  ++divisor;
			  }
			}
			unsigned int length = divisor;
			unsigned int width = desiredArea / divisor;

			// Construct a matrix of dimension length x width
			// and fill it with particles
			int p = 0;
			vector<vector<unsigned int> > matrix(length, vector<unsigned int>(width));
			for (unsigned int x = 0; x < length; ++x) {
				for (unsigned int y = 0; y < width; ++y) {
					matrix[x][y] = ++p;
				}
			}

			// Make our connections
			vector<unsigned int> connections;
			for (unsigned int x = 0; x < length; ++x) {
				for (unsigned int y = 0; y < width; ++y) {
					connections.clear();
					p = matrix[x][y];

					// If we're on the left bound
					if (x == 0) {
						// Add the particle to the right of us
						connections.push_back(matrix[x+1][y]);
					}
					// If we're on the right bound
					else if (x == length - 1) {
						// Add the particle to the left of us
						connections.push_back(matrix[x-1][y]);
					}
					// If we're in a center
					else {
						// Add the particles on either side of us
						connections.push_back(matrix[x-1][y]);
						connections.push_back(matrix[x+1][y]);
					}

					if (y == 0) {
						connections.push_back(matrix[x][y+1]);
					}
					else if (y == width - 1) {
						connections.push_back(matrix[x][y-1]);
					}
					else {
						connections.push_back(matrix[x][y-1]);
						connections.push_back(matrix[x][y+1]);
					}
					allParticles[p] = connections;
				}
			}
		}
		else if (options.topology == "toroidal") {
			unsigned int desiredArea = populationSize;
			unsigned int divisor = ceil(sqrt(desiredArea));
			if (divisor != 0) {
			  while(desiredArea % divisor != 0) {
				  ++divisor;
			  }
			}
			unsigned int length = divisor;
			unsigned int width = desiredArea / divisor;

			// Construct a matrix of dimensions length x width
			// and fill it with particles
			unsigned int p = 0;
			vector<vector<unsigned int> > matrix(length, vector<unsigned int>(width));
			for (unsigned int x = 0; x < length; ++x) {
				for (unsigned int y = 0; y < width; ++y) {
					matrix[x][y] = ++p;
				}
			}

			// Make our connections
			vector<unsigned int> connections;
			for (unsigned int x = 0; x < length; ++x) {
				for (unsigned int y = 0; y < width; ++y) {
					connections.clear();
					p = matrix[x][y];

					if (x == 0) {
						connections.push_back(matrix[x+1][y]);
						connections.push_back(matrix[length-1][y]);
					}
					else if (x == (length - 1)) {
						connections.push_back(matrix[x-1][y]);
						connections.push_back(matrix[0][y]);
					}
					else {
						connections.push_back(matrix[x-1][y]);
						connections.push_back(matrix[x+1][y]);
					}

					if (y == 0) {
						connections.push_back(matrix[x][y+1]);
						connections.push_back(matrix[x][width-1]);
					}
					else if (y == (width - 1)) {
						connections.push_back(matrix[x][y-1]);
						connections.push_back(matrix[x][0]);
					}
					else {
						connections.push_back(matrix[x][y-1]);
						connections.push_back(matrix[x][y+1]);
					}
					allParticles[p] = connections;
				}
			}
		}
		else if (options.topology == "tree") {
			unsigned int usedParticles = 1;
			unsigned int numLevels = 1;
			unsigned int previousLevel = 1;
			unsigned int currentLevel;

			// Determine number of levels in tree
			while (usedParticles < populationSize) {
				currentLevel = previousLevel*2;
				usedParticles += currentLevel;
				previousLevel = currentLevel;
				++numLevels;
			}

			vector<vector<unsigned int> > tree(numLevels, vector<unsigned int>());
			usedParticles = 1;
			currentLevel = 1;
			unsigned int currentParticle = 2;
			bool doneFilling = false;

			// Construct tree and fill it with particles
			tree[0].push_back(1);

			// For each level in tree
			for (unsigned int level = 1; level <= numLevels; ++level) {
				// Current level's particle count is double that of previous level
				currentLevel = currentLevel * 2;

				// For each slot in current level
				for (unsigned int i = 0; i < currentLevel; ++i) {
					// Fill slot with particle
					tree[level].push_back(currentParticle);
					++currentParticle;

					// Make sure we're not filling past our swarm size
					if (currentParticle == populationSize + 1) {
						doneFilling = true;
						break;
					}
				}
				if (doneFilling) {
					break;
				}
			}

			// For each level in tree
			for (unsigned int level = 1; level < numLevels; ++level) {
				int prevGroupCounter = 0;
				int particleCounter = 0;

				// For each particle in level
				for (unsigned int p = 0; p < tree[level].size(); ++p) {

					// Connect current particle (p) with proper particle in last level
					allParticles[tree[level][p]].push_back(tree[level-1][prevGroupCounter]);

					// Connect particle in last level to current particle (p)
					allParticles[tree[level-1][prevGroupCounter]].push_back(tree[level][p]);

					// If our particle counter reaches two, we're in a new pair in (or new particle
					// in previous level)
					if (++particleCounter == 2) {
						particleCounter = 0;
						++prevGroupCounter;
					}
				}
			}
		}
		else {
			outputError("Error: BioNetFit did not recognize your specified topology of: " + options.topology);
		}
	}

	/*
	int p = 0;
	for (auto o = allParticles.begin(); o != allParticles.end(); ++o) {
		cout << p << " is connected to:" << endl;
		for (auto i = (*o).begin(); i != (*o).end(); ++i) {
			cout << *i << endl;
		}
		++p;
	}
	 */

	double t = tmr.elapsed();
	if (options.verbosity >= 3) {
		cout << "Particle creation took " << t << " seconds" << endl;
	}

	return allParticles;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movl %edx, %r12d
movq %rsi, %r14
movq %rdi, %rbx
callq 0x220b0
movq %rax, %r15
movq %r12, 0x38(%rsp)
leal 0x1(%r12), %esi
leaq 0x20(%rsp), %rdx
movq %rbx, 0x40(%rsp)
movq %rbx, %rdi
callq 0xa8478
movq %r14, 0x90(%rsp)
leaq 0x14e0(%r14), %r13
leaq 0x76d0e(%rip), %rsi     # 0xfef02
movq %r13, %rdi
callq 0x22250
testl %eax, %eax
je 0x88217
leaq 0xa5d14(%rip), %rsi     # 0x12df1b
movq %r13, %rdi
callq 0x22250
testl %eax, %eax
jne 0x88edb
movq 0x90(%rsp), %rbx
cmpl $0x3, 0x1614(%rbx)
jb 0x88299
movq 0xedd61(%rip), %rdi     # 0x175f90
leaq 0x76b82(%rip), %rsi     # 0xfedb8
movl $0x24, %edx
callq 0x22ab0
movq 0x16b8(%rbx), %rsi
movq 0x16c0(%rbx), %rdx
movq 0xedd3b(%rip), %rdi     # 0x175f90
callq 0x22ab0
movq %rax, %r13
leaq 0x785eb(%rip), %rsi     # 0x10084f
movl $0x9, %edx
movq %rax, %rdi
callq 0x22ab0
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r13, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
leaq 0x16b8(%rbx), %r13
leaq 0x760f7(%rip), %rsi     # 0xfe39e
movq %r13, %rdi
callq 0x22250
testl %eax, %eax
movq 0x38(%rsp), %rbp
je 0x883c7
leaq 0xa6fa4(%rip), %rsi     # 0x12f267
movq %r13, %rdi
callq 0x22250
testl %eax, %eax
je 0x88473
leaq 0x76b03(%rip), %rsi     # 0xfeddd
movq %r13, %rdi
callq 0x22250
testl %eax, %eax
je 0x885ec
leaq 0x76af1(%rip), %rsi     # 0xfede2
movq %r13, %rdi
callq 0x22250
testl %eax, %eax
movq %r15, 0x60(%rsp)
je 0x886f6
leaq 0x76ada(%rip), %rsi     # 0xfede7
movq %r13, %rdi
callq 0x22250
testl %eax, %eax
je 0x8870d
leaq 0x76acc(%rip), %rsi     # 0xfedf0
movq %r13, %rdi
callq 0x22250
testl %eax, %eax
jne 0x88f80
movl $0x1, %ebx
cmpl $0x2, %ebp
jb 0x88353
movl $0x1, %ecx
movl $0x1, %eax
leal (%rax,%rcx,2), %eax
addl %ecx, %ecx
incl %ebx
cmpl %ebp, %eax
jb 0x88348
movl %ebx, %esi
xorpd %xmm0, %xmm0
movq %rsp, %rdx
movapd %xmm0, (%rdx)
movq $0x0, 0x10(%rdx)
leaq 0x20(%rsp), %rdi
leaq 0x58(%rsp), %rcx
movq %rsi, 0x68(%rsp)
callq 0xa86a2
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x88392
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x229c0
movl $0x2, (%rsp)
movq 0x20(%rsp), %rdi
movl $0x1, 0x58(%rsp)
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x88759
movl $0x1, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x88763
testl %ebp, %ebp
je 0x88edb
movl $0x1, %ebx
leaq 0x20(%rsp), %r13
movq %rsp, %rbp
xorpd %xmm0, %xmm0
movapd %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
movl $0x1, (%rsp)
movl $0x1, %eax
cmpl %ebx, %eax
je 0x88423
movq 0x28(%rsp), %rsi
cmpq 0x30(%rsp), %rsi
je 0x88418
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x28(%rsp)
jmp 0x88423
movq %r13, %rdi
movq %rbp, %rdx
callq 0x6b5ce
movl (%rsp), %eax
incl %eax
movl %eax, (%rsp)
cmpl 0x38(%rsp), %eax
jbe 0x883fb
movl %ebx, %eax
leaq (%rax,%rax,2), %rdi
shlq $0x3, %rdi
movq 0x40(%rsp), %rax
addq (%rax), %rdi
movq %r13, %rsi
callq 0xa8500
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x88462
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x229c0
incl %ebx
cmpl 0x38(%rsp), %ebx
jbe 0x883dc
jmp 0x88edb
leaq 0x60(%rsp), %rdx
movl $0x2, -0x8(%rdx)
movl %ebp, -0x4(%rdx)
leaq 0x20(%rsp), %rdi
leaq 0x58(%rsp), %rsi
movq %rsp, %rcx
callq 0xa85d6
movq %r15, 0x60(%rsp)
movq 0x40(%rsp), %rax
movq (%rax), %rdi
addq $0x18, %rdi
leaq 0x20(%rsp), %r13
movq %r13, %rsi
callq 0xaf9f6
movq (%r13), %rdi
testq %rdi, %rdi
je 0x884c8
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x229c0
xorpd %xmm0, %xmm0
leaq 0x20(%rsp), %r13
movapd %xmm0, (%r13)
movq $0x0, 0x10(%r13)
leal -0x1(%rbp), %ebx
movl $0x1, %r15d
movq %rsp, %rbp
leal 0x1(%r15), %r14d
cmpl %ebx, %r14d
ja 0x88582
movq 0x20(%rsp), %rax
cmpq %rax, 0x28(%rsp)
je 0x88509
movq %rax, 0x28(%rsp)
movl %r15d, (%rsp)
movq 0x28(%rsp), %rsi
cmpq 0x30(%rsp), %rsi
je 0x88527
movl %r15d, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x28(%rsp)
jmp 0x88532
movq %r13, %rdi
movq %rbp, %rdx
callq 0xaf698
addl $0x2, %r15d
movl %r15d, (%rsp)
movq 0x28(%rsp), %rsi
cmpq 0x30(%rsp), %rsi
je 0x88554
movl %r15d, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x28(%rsp)
jmp 0x8855f
movq %r13, %rdi
movq %rbp, %rdx
callq 0xaf698
movl %r14d, %eax
leaq (%rax,%rax,2), %rdi
shlq $0x3, %rdi
movq 0x40(%rsp), %rax
addq (%rax), %rdi
movq %r13, %rsi
callq 0xa8500
movl %r14d, %r15d
jmp 0x884eb
leaq 0x90(%rsp), %rdx
movl %ebx, -0x8(%rdx)
movl $0x1, -0x4(%rdx)
movq %rsp, %rdi
leaq 0x88(%rsp), %rsi
leaq 0x57(%rsp), %rcx
callq 0xa85d6
movl 0x38(%rsp), %eax
leaq (%rax,%rax,2), %rdi
shlq $0x3, %rdi
movq 0x40(%rsp), %rax
addq (%rax), %rdi
movq %rsp, %r12
movq %r12, %rsi
callq 0xaf9f6
movq (%r12), %rdi
testq %rdi, %rdi
movq 0x60(%rsp), %r15
je 0x886d6
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x229c0
jmp 0x886d6
xorpd %xmm0, %xmm0
movapd %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
movl $0x2, (%rsp)
cmpl $0x2, %ebp
jb 0x8864a
movl $0x2, %eax
leaq 0x20(%rsp), %r13
movq %rsp, %rbp
movq 0x28(%rsp), %rsi
cmpq 0x30(%rsp), %rsi
je 0x88631
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x28(%rsp)
jmp 0x8863c
movq %r13, %rdi
movq %rbp, %rdx
callq 0x6b5ce
movl (%rsp), %eax
incl %eax
movl %eax, (%rsp)
cmpl 0x38(%rsp), %eax
jbe 0x88618
movq 0x40(%rsp), %rax
movq (%rax), %rdi
addq $0x18, %rdi
leaq 0x20(%rsp), %rsi
callq 0xa8500
cmpl $0x2, 0x38(%rsp)
jb 0x886d6
movl $0x2, %ebx
leaq 0x20(%rsp), %r13
movq %rsp, %rbp
movq 0x20(%rsp), %rax
cmpq %rax, 0x28(%rsp)
je 0x88685
movq %rax, 0x28(%rsp)
movl $0x1, (%rsp)
movq 0x28(%rsp), %rsi
cmpq 0x30(%rsp), %rsi
je 0x886a9
movl $0x1, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x28(%rsp)
jmp 0x886b4
movq %r13, %rdi
movq %rbp, %rdx
callq 0xaf698
movl %ebx, %eax
leaq (%rax,%rax,2), %rdi
shlq $0x3, %rdi
movq 0x40(%rsp), %rax
addq (%rax), %rdi
movq %r13, %rsi
callq 0xa8500
incl %ebx
cmpl 0x38(%rsp), %ebx
jbe 0x88674
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x88edb
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x229c0
jmp 0x88edb
movl %ebp, %eax
cvtsi2sd %rax, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x8872b
sqrtsd %xmm0, %xmm0
jmp 0x88730
movl %ebp, %eax
cvtsi2sd %rax, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x88b62
sqrtsd %xmm0, %xmm0
jmp 0x88b67
callq 0x22790
callq 0x22170
cvttsd2si %xmm0, %r12
testl %r12d, %r12d
je 0x888f9
movl %ebp, %eax
xorl %edx, %edx
divl %r12d
incl %r12d
testl %edx, %edx
jne 0x88743
decl %r12d
jmp 0x888fc
leaq 0x58(%rsp), %rdx
callq 0xaf698
testl %ebx, %ebx
je 0x887dd
movl $0x1, %r14d
xorl %eax, %eax
movq %rsp, %rbp
movl $0x1, %r15d
addl %r15d, %r15d
je 0x887d1
movl %eax, 0x48(%rsp)
movl %r14d, %eax
leaq (%rax,%rax,2), %r13
movl %r15d, %r12d
movq 0x20(%rsp), %rax
leaq (%rax,%r13,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x887ad
movl (%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x887b5
movq %rbp, %rdx
callq 0x6b5ce
movl (%rsp), %eax
leal 0x1(%rax), %ecx
movl %ecx, (%rsp)
cmpl 0x38(%rsp), %eax
je 0x887cf
decl %r12d
jne 0x8878b
movl 0x48(%rsp), %eax
jmp 0x887d1
movb $0x1, %al
testb $0x1, %al
jne 0x887dd
incl %r14d
cmpl %ebx, %r14d
jbe 0x88778
cmpl $0x2, %ebx
jb 0x88ecc
movl $0x1, %ecx
movq 0x20(%rsp), %rax
movq %rcx, 0x48(%rsp)
leaq (%rcx,%rcx,2), %r14
movq (%rax,%r14,8), %rcx
cmpq %rcx, 0x8(%rax,%r14,8)
je 0x888e1
movq 0x48(%rsp), %rdx
decq %rdx
xorl %r12d, %r12d
movl $0x1, %ebp
leaq (%rdx,%rdx,2), %rdx
movq %rdx, 0x38(%rsp)
xorl %r13d, %r13d
xorl %ebx, %ebx
movl (%rcx,%r12,4), %ecx
movslq %ebx, %r15
leaq (,%r15,4), %rdx
movq 0x38(%rsp), %rsi
addq (%rax,%rsi,8), %rdx
movq 0x40(%rsp), %rax
movq (%rax), %rax
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x88866
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x8886b
callq 0x6b5ce
movq 0x20(%rsp), %rax
movq 0x38(%rsp), %rcx
movq (%rax,%rcx,8), %rcx
movl (%rcx,%r15,4), %ecx
movq 0x40(%rsp), %rdx
movq (%rdx), %rdx
leaq (%rcx,%rcx,2), %rcx
shlq $0x2, %r12
addq (%rax,%r14,8), %r12
leaq (%rdx,%rcx,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x888af
movl (%r12), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x888b7
movq %r12, %rdx
callq 0x6b5ce
addl %r13d, %ebx
xorl $0x1, %r13d
movl %ebp, %r12d
movq 0x20(%rsp), %rax
movq (%rax,%r14,8), %rcx
movq 0x8(%rax,%r14,8), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
incl %ebp
cmpq %r12, %rdx
ja 0x88826
movq 0x48(%rsp), %rcx
incq %rcx
cmpq 0x68(%rsp), %rcx
jne 0x887eb
jmp 0x88ecc
xorl %r12d, %r12d
movl %ebp, %eax
xorl %edx, %edx
divl %r12d
movq %rsp, %rdi
leaq 0x58(%rsp), %rdx
movq %rax, %r14
movq %rax, %rsi
callq 0xa8618
movl %r12d, %esi
leaq 0x20(%rsp), %rdi
movq %rsp, %rdx
leaq 0x88(%rsp), %rcx
callq 0xa86a2
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x88944
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x229c0
movq 0x20(%rsp), %rax
movl %r14d, %ebx
cmpl $0x1, %r12d
movl %r12d, %r10d
adcl $0x0, %r10d
xorl %ecx, %ecx
xorl %edx, %edx
cmpl %ebp, %r12d
ja 0x88983
leaq (%rcx,%rcx,2), %rsi
movq (%rax,%rsi,8), %rsi
movl %edx, %edi
xorl %r8d, %r8d
leal (%rdi,%r8), %r9d
incl %r9d
movl %r9d, (%rsi,%r8,4)
incq %r8
cmpq %rbx, %r8
jb 0x8896d
addl %r8d, %edx
incq %rcx
cmpq %r10, %rcx
jne 0x8895b
xorpd %xmm0, %xmm0
movq %rsp, %rax
movapd %xmm0, (%rax)
movq $0x0, 0x10(%rax)
leal -0x1(%r12), %eax
movq %rax, 0x68(%rsp)
decl %r14d
shlq $0x2, %r14
movq %r14, 0x70(%rsp)
xorl %r14d, %r14d
movq %r12, 0x80(%rsp)
movq %r10, 0x78(%rsp)
cmpl %ebp, %r12d
ja 0x88b3f
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addl %r14d, %eax
movq %rax, 0x48(%rsp)
leaq (%r14,%r14,2), %r15
xorl %r13d, %r13d
xorl %ebp, %ebp
movq (%rsp), %rax
cmpq %rax, 0x8(%rsp)
je 0x889f3
movq %rax, 0x8(%rsp)
movq 0x20(%rsp), %rax
movq (%rax,%r15,8), %rcx
movslq (%rcx,%r13), %r12
testq %r14, %r14
je 0x88a28
movq 0x8(%rsp), %rsi
cmpq 0x68(%rsp), %r14
jne 0x88a31
movq 0x48(%rsp), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (,%rbp,4), %rdx
addq (%rax,%rcx,8), %rdx
jmp 0x88a76
movq 0x18(%rax), %rdx
addq %r13, %rdx
jmp 0x88a71
movq 0x48(%rsp), %rcx
leaq (%rcx,%rcx,2), %rcx
movq (%rax,%rcx,8), %rdx
addq %r13, %rdx
cmpq 0x10(%rsp), %rsi
je 0x88a57
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x88a5f
movq %rsp, %rdi
callq 0x6b5ce
movq 0x20(%rsp), %rax
leaq (,%rbp,4), %rdx
addq 0x18(%rax,%r15,8), %rdx
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x88a8c
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x88a94
movq %rsp, %rdi
callq 0x6b5ce
testq %r13, %r13
je 0x88acc
movq 0x20(%rsp), %rax
movq (%rax,%r15,8), %rax
leaq (%rax,%r13), %rdx
addq $-0x4, %rdx
movq 0x8(%rsp), %rsi
cmpq %r13, 0x70(%rsp)
je 0x88af9
cmpq 0x10(%rsp), %rsi
je 0x88adb
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x88ae3
movq 0x20(%rsp), %rax
movq (%rax,%r15,8), %rdx
addq $0x4, %rdx
jmp 0x88af4
movq %rsp, %rdi
callq 0x6b5ce
movq 0x20(%rsp), %rax
movq (%rax,%r15,8), %rax
leaq (%rax,%rbp,4), %rdx
addq $0x4, %rdx
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x88b0f
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x88b17
movq %rsp, %rdi
callq 0x6b5ce
leaq (%r12,%r12,2), %rdi
shlq $0x3, %rdi
movq 0x40(%rsp), %rax
addq (%rax), %rdi
movq %rsp, %rsi
callq 0xa8500
incq %rbp
addq $0x4, %r13
cmpq %rbx, %rbp
jb 0x889e3
incq %r14
movq 0x78(%rsp), %r10
cmpq %r10, %r14
movq 0x38(%rsp), %rbp
movq 0x80(%rsp), %r12
jne 0x889c4
jmp 0x88eb6
callq 0x22790
callq 0x22170
cvttsd2si %xmm0, %rbx
testl %ebx, %ebx
je 0x88b85
movl %ebp, %eax
xorl %edx, %edx
divl %ebx
incl %ebx
testl %edx, %edx
jne 0x88b75
decl %ebx
jmp 0x88b87
xorl %ebx, %ebx
movl %ebp, %eax
xorl %edx, %edx
divl %ebx
movq %rsp, %rdi
leaq 0x58(%rsp), %rdx
movq %rax, %r14
movq %rax, %rsi
callq 0xa8618
movl %ebx, %esi
leaq 0x20(%rsp), %rdi
movq %rsp, %rdx
leaq 0x88(%rsp), %rcx
callq 0xa86a2
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x88bcd
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x229c0
movq 0x20(%rsp), %rax
movl %r14d, %r10d
cmpl $0x1, %ebx
movl %ebx, %r11d
adcl $0x0, %r11d
xorl %ecx, %ecx
xorl %edx, %edx
cmpl %ebp, %ebx
ja 0x88c0a
leaq (%rcx,%rcx,2), %rsi
movq (%rax,%rsi,8), %rsi
movl %edx, %edi
xorl %r8d, %r8d
leal (%rdi,%r8), %r9d
incl %r9d
movl %r9d, (%rsi,%r8,4)
incq %r8
cmpq %r10, %r8
jb 0x88bf4
addl %r8d, %edx
incq %rcx
cmpq %r11, %rcx
jne 0x88be3
movq %r10, 0x68(%rsp)
xorpd %xmm0, %xmm0
movq %rsp, %rax
movapd %xmm0, (%rax)
movq %rax, %r12
movq $0x0, 0x10(%rax)
leal -0x1(%rbx), %eax
decl %r14d
shlq $0x2, %r14
movq %r14, 0x48(%rsp)
xorl %r15d, %r15d
movq %rax, 0x80(%rsp)
leaq (%rax,%rax,2), %rax
movq %rax, 0x78(%rsp)
movq %rbx, 0xa0(%rsp)
movq %r11, 0x98(%rsp)
cmpl %ebp, %ebx
ja 0x88e95
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addl %r15d, %eax
movq %rax, 0x70(%rsp)
leaq (%r15,%r15,2), %r13
xorl %ebx, %ebx
xorl %ebp, %ebp
movq (%rsp), %rax
cmpq %rax, 0x8(%rsp)
je 0x88c8d
movq %rax, 0x8(%rsp)
movq 0x20(%rsp), %rax
movq (%rax,%r13,8), %rcx
movl (%rcx,%rbx), %r14d
testq %r15, %r15
je 0x88cd4
movq 0x8(%rsp), %rsi
cmpq 0x80(%rsp), %r15
jne 0x88cf6
movq 0x70(%rsp), %rcx
leaq (%rcx,%rcx,2), %rcx
movq (%rax,%rcx,8), %rdx
addq %rbx, %rdx
cmpq 0x10(%rsp), %rsi
je 0x88d37
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x88d3f
movq 0x18(%rax), %rdx
addq %rbx, %rdx
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x88d1c
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x88d24
movq 0x70(%rsp), %rcx
leaq (%rcx,%rcx,2), %rcx
movq (%rax,%rcx,8), %rdx
addq %rbx, %rdx
cmpq 0x10(%rsp), %rsi
je 0x88d51
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x88d59
movq %r12, %rdi
callq 0x6b5ce
movq 0x20(%rsp), %rax
movq 0x78(%rsp), %rcx
movq (%rax,%rcx,8), %rdx
addq %rbx, %rdx
jmp 0x88d6b
movq %r12, %rdi
callq 0x6b5ce
movq 0x20(%rsp), %rax
leaq (,%rbp,4), %rdx
addq (%rax), %rdx
jmp 0x88d6b
movq %r12, %rdi
callq 0x6b5ce
movq 0x20(%rsp), %rax
leaq (,%rbp,4), %rdx
addq 0x18(%rax,%r13,8), %rdx
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x88d86
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x88d8e
movq %r12, %rdi
callq 0x6b5ce
testq %rbx, %rbx
je 0x88dc6
movq 0x20(%rsp), %rax
movq (%rax,%r13,8), %rax
leaq (%rax,%rbx), %rdx
addq $-0x4, %rdx
movq 0x8(%rsp), %rsi
cmpq %rbx, 0x48(%rsp)
jne 0x88dee
cmpq 0x10(%rsp), %rsi
je 0x88e1c
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x88e24
movq 0x20(%rsp), %rax
movq (%rax,%r13,8), %rdx
addq $0x4, %rdx
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x88e04
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x88e0c
cmpq 0x10(%rsp), %rsi
je 0x88e2f
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x88e37
movq %r12, %rdi
callq 0x6b5ce
movq 0x20(%rsp), %rax
movq (%rax,%r13,8), %rdx
addq 0x48(%rsp), %rdx
jmp 0x88e48
movq %r12, %rdi
callq 0x6b5ce
movq 0x20(%rsp), %rax
movq (%rax,%r13,8), %rdx
jmp 0x88e48
movq %r12, %rdi
callq 0x6b5ce
movq 0x20(%rsp), %rax
movq (%rax,%r13,8), %rax
leaq (%rax,%rbx), %rdx
addq $0x4, %rdx
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x88e63
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x88e6b
movq %r12, %rdi
callq 0x6b5ce
leaq (%r14,%r14,2), %rdi
shlq $0x3, %rdi
movq 0x40(%rsp), %rax
addq (%rax), %rdi
movq %r12, %rsi
callq 0xa8500
incq %rbp
addq $0x4, %rbx
cmpq 0x68(%rsp), %rbp
jb 0x88c7d
incq %r15
movq 0x98(%rsp), %r11
cmpq %r11, %r15
movq 0x38(%rsp), %rbp
movq 0xa0(%rsp), %rbx
jne 0x88c60
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x88ecc
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x229c0
leaq 0x20(%rsp), %rdi
callq 0xa7bb4
movq 0x60(%rsp), %r15
callq 0x220b0
movq %rax, %r12
movq 0x90(%rsp), %rax
cmpl $0x3, 0x1614(%rax)
jb 0x88f69
movq 0xed095(%rip), %rdi     # 0x175f90
leaq 0x75f33(%rip), %rsi     # 0xfee35
movl $0x17, %edx
callq 0x22ab0
subq %r15, %r12
xorps %xmm0, %xmm0
cvtsi2sd %r12, %xmm0
divsd 0x75091(%rip), %xmm0    # 0xfdfb0
movq 0xed06a(%rip), %rdi     # 0x175f90
callq 0x23060
movq %rax, %r14
leaq 0x75f18(%rip), %rsi     # 0xfee4d
movl $0x8, %edx
movq %rax, %rdi
callq 0x22ab0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x22940
movsbl %al, %esi
movq %r14, %rdi
callq 0x22050
movq %rax, %rdi
callq 0x22660
movq 0x40(%rsp), %rax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x75e6e(%rip), %rsi     # 0xfedf5
leaq 0xa8(%rsp), %rdi
movq %r13, %rdx
callq 0x319d8
leaq 0xa8(%rsp), %rsi
movq %rbx, %rdi
callq 0x78b66
jmp 0x89006
movq %rax, %r14
leaq 0xb8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8904c
movq 0xb8(%rsp), %rsi
incq %rsi
jmp 0x89020
jmp 0x88fd6
jmp 0x88ffb
jmp 0x88fd6
jmp 0x88ffb
movq %rax, %r14
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x8904c
movq 0x10(%rsp), %rsi
jmp 0x8901d
jmp 0x8900b
jmp 0x8900b
jmp 0x88ffb
jmp 0x8900b
jmp 0x8900b
jmp 0x8900b
jmp 0x8900b
jmp 0x8900b
jmp 0x88ffb
movq %rax, %r14
jmp 0x8904c
jmp 0x8900b
jmp 0x89006
jmp 0x8900b
movq %rax, %r14
jmp 0x89042
movq %rax, %r14
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x8904c
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x229c0
jmp 0x8904c
jmp 0x89029
movq %rax, %r14
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x89042
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x229c0
leaq 0x20(%rsp), %rdi
callq 0xa7bb4
movq 0x40(%rsp), %rdi
callq 0xa7bb4
movq %r14, %rdi
callq 0x23240