// File: /workspace/github_cpp_makefile_star2_O3/EnderGed[P]fast-random-walk/WeightedGraph.cpp
// Function: WeightedGraph::readGraph(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned long)
WeightedGraph WeightedGraph::readGraph(std::string const input, uint64_t const flags)
{
	bool isSorted = true;
	read_t numRows;
	uint * data;

	////	Read from file	////
	{
		char const * fileContent = input.c_str();
		char const * fileContentEnd = fileContent + input.size();

		// Trim file content
		while(fileContent < fileContentEnd && *fileContent <= ' ') ++fileContent;
		while(fileContent < fileContentEnd && *(fileContentEnd - 1) <= ' ') --fileContentEnd;

		// Count rows
		numRows = count(fileContent, fileContentEnd, '\n') + 1;

		// Malloc data array (3 dimensions)
		data = (uint *) malloc(numRows * 3 * sizeof(*data));

		// File content to array
		char const * pos = fileContent;
		read_t prev = 0;
		unsigned readLen = 0;

		// For every row/transition ...
		for(read_t i = 0; i < numRows; ++i)
		{
			// Read source node
			uint const from = readInt(pos, fileContentEnd, readLen);

			// Go to next number
			pos += readLen;
			pos += nonDigits(pos, fileContentEnd);

			// Read target node
			uint const to = readInt(pos, fileContentEnd, readLen);

			// Go to next number
			pos += readLen;
			pos += nonDigits(pos, fileContentEnd);

			// Read weight
			uint const weight = readInt(pos, fileContentEnd, readLen);

			// Go to next number/line (or end of file)
			pos += readLen;
			pos += nonDigits(pos, fileContentEnd);

			// Put into data array
			data[3 * i] = from;
			data[3 * i + 1] = to;
			data[3 * i + 2] = weight;

			if(from < prev) isSorted = false;

			prev = from;
		}
	}

	// Sort if necessary
	if(!isSorted) countSort2D(data, 3, numRows);

	////		Render node starts	////
	uint * weights = (uint*)malloc(numRows * sizeof(*weights));
	uint const numIndices = data[3 * numRows - 3] + 1;
	read_t * const indices = (read_t *) malloc((numIndices + 1) * sizeof(*indices));
	
	// Create adjacency list
	uint curr = 0;
	indices[0] = 0;

	for(read_t i = 0; i < numRows; ++i)
	{
		// Set target[curr] for all nodes until the start node of the i-th transition
		while(data[3 * i] > curr) indices[++curr] = i;

		// Copy target node id to new (shrinked) position
		data[i] = data[3 * i + 1];
		// Copy the weight of the transition to weights
		weights[i] = data[3 * i + 2];
	}

	// Set target[curr] to end of data-set for all remaining indices
	while(curr < numIndices) indices[++curr] = numRows;

	// Shrink the size of data to its real content
	data = (uint *) realloc(data, numRows * sizeof(*data));

	////		Convert the graph to an undirected graph	////
	if(flags & (flag_undirected | flag_reflect))
	{
		// Sort the transitions for each source node
		// (Target nodes in increasing order)
		for(uint i = 0; i < numIndices; ++i)
		{
			read_t const start = indices[i];
			read_t const count = indices[i + 1] - start;

			if(count > 1) countSort2D({data + start, weights + start}, count);
		}

		///		Count number of missing transitions for every node		///
		uint * const counters = (uint *) calloc(numIndices, sizeof(*counters));
		std::vector<bool> bitSet(numRows * 2, false);
		read_t acc = 0; // Sum of all counters

		// For every source node ...
		for(uint node = 0; node < numIndices; ++node)
		{
			// For every transition of the node ...
			for(read_t trans = indices[node]; trans < indices[node + 1]; ++trans)
			{
				uint const targetNode = data[trans];
				uint const * const from = data + indices[targetNode];
				uint const * const to = data + indices[targetNode + 1];
				uint const * const found = binaryFind(from, to, node);

				// If has no counterpart ...
				if(found == to || *found != node)
				{
					// Increment counter for target node
					++counters[targetNode];
					// Increment number of transitions
					++acc;
					// Set bit in bitSet
					bitSet[trans] = true;
				}
				else if(flags & flag_reflect)
				{
					read_t const other_trans = found - data;
					if(other_trans > trans) weights[trans] = weights[other_trans] = weights[other_trans] + weights[trans];
				}
			}
		}

		if(acc)
		{
			////	Adapt list (make it undirected)		////
			// Resize transitions lists (data and weights)
			numRows += acc;
			data = (uint *) realloc(data, numRows * sizeof(*data));
			weights = (uint *) realloc(weights, numRows * sizeof(*weights));

			// For every node (from last to first)
			for(uint node = numIndices - 1; node > 0; --node)
			{
				// Get number of transitions
				size_t const len = indices[node + 1] - indices[node];
				// Increase end by accumulative counter
				indices[node + 1] += acc;
				// Subtract own new transitions from accumulative counter
				acc -= counters[node];
				//Move transitions to new position
				memmove(data + indices[node] + acc, data + indices[node], len * sizeof(*data));
				memmove(weights + indices[node] + acc, weights + indices[node], len * sizeof(*weights));
				// Move bits in bitSet
				std::move_backward(bitSet.begin() + indices[node], bitSet.begin() + (indices[node] + len), bitSet.begin() + (indices[node] + len + acc));
				std::fill(bitSet.begin() + (indices[node] + acc - counters[node - 1]), bitSet.begin() + (indices[node] + acc), false);
			}

			// Node 0
			indices[1] += acc;

			////	Add new transitions		////
			// For every node ...
			for(uint node = 0; node < numIndices; ++node)
			{
				// For every transition of that node ...
				for(read_t trans = indices[node]; trans < indices[node + 1]; ++trans)
				{
					if(bitSet[trans])
					{
						uint const targetNode = data[trans];
						uint const weight = weights[trans];
						data[indices[targetNode + 1] - (counters[targetNode])] = node;
						weights[indices[targetNode + 1] - (counters[targetNode])] = weight;

						--counters[targetNode];
					}
				}
			}
		}
		else if(!(flags & flag_reflect)) printf("Graph is already undirected\n");

		free(counters);
	}

	////		Optimize transition order	////
	if((flags & flag_optiTransOrder) && numIndices > 0)
	{
		// Sort each node
		for(uint nodeId = 0; nodeId < numIndices; ++nodeId)
		{
			// Determine sort range
			read_t const start = indices[nodeId];
			read_t const count = indices[nodeId + 1] - start;

			// Sort node (lowest weight first)
			countSort2D({weights + start, data + start}, count);

			// Reverse order (highest weight first)
			std::reverse(data + start, data + start + count);
			std::reverse(weights + start, weights + start + count);
		}
	}

	////		Post-Processing		////
	bool errorFound = false;
	// Accumulate weights
	for(read_t const * posIndices = indices, * indicesEnd = indices + numIndices; posIndices < indicesEnd; ++posIndices)
	{ // For each node ...
		uint newWeight = weights[*posIndices];
	
		// Accumulate weights of this nodes transitions
		for(read_t posWeights = *posIndices + 1; posWeights < *(posIndices + 1); ++posWeights)
		{
			//if(__builtin_add_overflow(weights[posWeights], weights[posWeights - 1], &weights[posWeights])) std::cout << "!!!!!Problem!!!!!" << std::endl;
			newWeight = weights[posWeights] + weights[posWeights - 1];
			if(newWeight < weights[posWeights] || newWeight < weights[posWeights - 1])
			{
				printf("Integer Overflow!!!");
				exit(1);
			}
			weights[posWeights] = newWeight;
		}

		// Check whether sum of weights is 0
		if(newWeight == 0)
		{
			printf("Node %lu has an accumulative weight of 0!\n", posIndices - indices);
			errorFound = true;
		}
	}
	
	if(errorFound) exit(1);

	return WeightedGraph(numIndices, indices, data, weights);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdx, 0x40(%rsp)
movq %rdi, 0x90(%rsp)
movq (%rsi), %rbp
movq 0x8(%rsi), %rcx
leaq (%rcx,%rbp), %rax
testq %rcx, %rcx
jle 0x44c1
cmpb $0x20, (%rbp)
jg 0x44c1
incq %rbp
cmpq %rax, %rbp
jb 0x44a6
jmp 0x44c1
leaq -0x1(%r14), %rax
cmpb $0x21, -0x1(%r14)
jge 0x44c9
movq %rax, %r14
cmpq %rax, %rbp
jb 0x44b6
movq %rbp, %rdi
movq %r14, %rsi
movl $0xa, %edx
callq 0x38cc
movq %rax, %r13
incq %rax
shlq $0x2, %rax
leaq (%rax,%rax,2), %rbx
movq %rbx, %rdi
callq 0x21f0
movq %rax, %r12
movq %r13, %r15
movl $0x0, 0x60(%rsp)
incq %r15
movq %r15, 0x28(%rsp)
je 0x4616
movq %rbx, 0x88(%rsp)
movq %r13, 0x58(%rsp)
movq %r12, 0x48(%rsp)
addq $0x8, %r12
movb $0x1, %cl
xorl %eax, %eax
movq %rax, 0x20(%rsp)
movq %r15, 0x30(%rsp)
movb %cl, 0x10(%rsp)
movq %rbp, %rdi
movq %r14, %rsi
leaq 0x60(%rsp), %rbx
movq %rbx, %rdx
callq 0x26f0
movl %eax, 0x38(%rsp)
movl 0x60(%rsp), %r13d
addq %rbp, %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x26cc
movl %eax, %ebp
addq %r13, %rbp
movq %rbp, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x26f0
movl %eax, %r13d
movl 0x60(%rsp), %r15d
addq %rbp, %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x26cc
movl %eax, %ebp
addq %r15, %rbp
movq %rbp, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x26f0
movl %eax, %r15d
movl 0x60(%rsp), %ebx
addq %rbp, %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x26cc
movl %eax, %ebp
addq %rbx, %rbp
movl 0x38(%rsp), %eax
movl %eax, -0x8(%r12)
movl %r13d, -0x4(%r12)
movl %r15d, (%r12)
movl %eax, %eax
cmpq %rax, 0x20(%rsp)
setbe %cl
andb %cl, 0x10(%rsp)
movb 0x10(%rsp), %cl
addq $0xc, %r12
movq 0x30(%rsp), %r15
decq %r15
jne 0x4525
testb %cl, %cl
movq 0x28(%rsp), %r15
movq 0x48(%rsp), %r12
movq 0x58(%rsp), %r13
movq 0x88(%rsp), %rbx
jne 0x4616
movl $0x3, %esi
movq %r12, %rdi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x3b12
leaq (,%r15,4), %rbp
movq %rbp, %rdi
callq 0x21f0
movq %rax, 0x20(%rsp)
movl -0xc(%r12,%rbx), %eax
leal 0x1(%rax), %ebx
movq %rax, 0x48(%rsp)
leal 0x2(%rax), %edi
shlq $0x3, %rdi
callq 0x21f0
movq $0x0, (%rax)
testq %r15, %r15
movq %rax, 0x10(%rsp)
je 0x4740
addq $0x10, %rax
xorl %edi, %edi
movdqa 0x19a9(%rip), %xmm0     # 0x6010
movdqa 0x19b1(%rip), %xmm1     # 0x6020
pcmpeqd %xmm2, %xmm2
xorl %ecx, %ecx
leaq (,%rcx,4), %rdx
leaq (%rdx,%rdx,2), %rdx
movl (%r12,%rdx), %esi
cmpl %edi, %esi
jbe 0x4718
movl %edi, %r8d
movq %rsi, %r9
subq %r8, %r9
leaq 0x1(%r9), %rdi
andq $-0x2, %rdi
decq %r9
movq %r9, %xmm3
pshufd $0x44, %xmm3, %xmm3     # xmm3 = xmm3[0,1,0,1]
leaq (%rax,%r8,8), %r8
pxor %xmm1, %xmm3
xorl %r9d, %r9d
movq %r9, %xmm4
pshufd $0x44, %xmm4, %xmm4     # xmm4 = xmm4[0,1,0,1]
por %xmm0, %xmm4
pxor %xmm1, %xmm4
movdqa %xmm4, %xmm5
pcmpgtd %xmm3, %xmm5
pcmpeqd %xmm3, %xmm4
pshufd $0xf5, %xmm4, %xmm6     # xmm6 = xmm4[1,1,3,3]
pand %xmm5, %xmm6
pshufd $0xf5, %xmm5, %xmm4     # xmm4 = xmm5[1,1,3,3]
por %xmm6, %xmm4
movd %xmm4, %r10d
notl %r10d
testb $0x1, %r10b
je 0x46f9
movq %rcx, -0x8(%r8,%r9,8)
pxor %xmm2, %xmm4
pextrw $0x4, %xmm4, %r10d
testb $0x1, %r10b
je 0x470d
movq %rcx, (%r8,%r9,8)
addq $0x2, %r9
cmpq %r9, %rdi
jne 0x46b6
movl %esi, %edi
movl 0x4(%r12,%rdx), %esi
movl %esi, (%r12,%rcx,4)
movl 0x8(%r12,%rdx), %edx
movq 0x20(%rsp), %rsi
movl %edx, (%rsi,%rcx,4)
leaq 0x1(%rcx), %rdx
cmpq %r13, %rcx
movq %rdx, %rcx
jne 0x4675
jmp 0x4742
xorl %edi, %edi
cmpl %ebx, %edi
jae 0x47ea
movl %edi, %ecx
movl %ebx, %edx
subq %rcx, %rdx
leaq 0x1(%rdx), %rax
andq $-0x2, %rax
decq %rdx
movq %rdx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movq 0x10(%rsp), %rdx
leaq (%rdx,%rcx,8), %rcx
addq $0x10, %rcx
xorl %edx, %edx
movdqa 0x1893(%rip), %xmm1     # 0x6010
movdqa 0x189b(%rip), %xmm2     # 0x6020
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
movq %rdx, %xmm4
pshufd $0x44, %xmm4, %xmm4     # xmm4 = xmm4[0,1,0,1]
por %xmm1, %xmm4
pxor %xmm2, %xmm4
movdqa %xmm4, %xmm5
pcmpgtd %xmm0, %xmm5
pcmpeqd %xmm0, %xmm4
pshufd $0xf5, %xmm4, %xmm6     # xmm6 = xmm4[1,1,3,3]
pand %xmm5, %xmm6
pshufd $0xf5, %xmm5, %xmm4     # xmm4 = xmm5[1,1,3,3]
por %xmm6, %xmm4
movd %xmm4, %esi
notl %esi
testb $0x1, %sil
je 0x47ce
movq %r15, -0x8(%rcx,%rdx,8)
pxor %xmm3, %xmm4
pextrw $0x4, %xmm4, %esi
testb $0x1, %sil
je 0x47e1
movq %r15, (%rcx,%rdx,8)
addq $0x2, %rdx
cmpq %rdx, %rax
jne 0x478d
movq %r12, %rdi
movq %rbp, %rsi
callq 0x2280
movq %rax, %r13
testb $0x9, 0x40(%rsp)
movl %ebx, 0x1c(%rsp)
je 0x48ad
testl %ebx, %ebx
je 0x48bc
movl %ebx, %edx
movq 0x10(%rsp), %rax
movq (%rax), %rax
xorl %r15d, %r15d
leaq 0xb0(%rsp), %r14
movq %rdx, 0x38(%rsp)
movq 0x10(%rsp), %rcx
movq 0x8(%rcx,%r15,8), %r12
movq %r12, %rbp
subq %rax, %rbp
cmpq $0x2, %rbp
jb 0x489c
leaq (,%rax,4), %rcx
addq %r13, %rcx
movq %rcx, 0x60(%rsp)
movq 0x20(%rsp), %rcx
leaq (%rcx,%rax,4), %rax
movq %rax, 0x68(%rsp)
movl $0x2, %edx
movq %r14, %rdi
leaq 0x60(%rsp), %rsi
leaq 0xf(%rsp), %rcx
callq 0x5072
movq %r14, %rbx
movq %r14, %rdi
movq %rbp, %rsi
callq 0x3f2b
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x4894
callq 0x2160
movq 0x38(%rsp), %rdx
movq %rbx, %r14
incq %r15
movq %r12, %rax
cmpq %r15, %rdx
jne 0x4829
movl 0x1c(%rsp), %ebx
jmp 0x48be
movq 0x20(%rsp), %rbp
movq 0x10(%rsp), %r14
jmp 0x4e13
xorl %edx, %edx
movl $0x4, %esi
movq %rdx, 0x38(%rsp)
movq %rdx, %rdi
callq 0x20f0
movq %rax, 0x30(%rsp)
movq 0x28(%rsp), %rax
leaq (%rax,%rax), %rsi
leaq 0xf(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0x60(%rsp), %rdi
leaq 0x57(%rsp), %rcx
callq 0x3098
movq 0x20(%rsp), %rbp
testl %ebx, %ebx
movq 0x10(%rsp), %r14
je 0x4d36
movabsq $-0x8000000000000000, %r12 # imm = 0x8000000000000000
movq (%r14), %rax
xorl %edx, %edx
xorl %ebx, %ebx
movq %rax, %rcx
movq 0x8(%r14,%rdx,8), %rax
cmpq %rax, %rcx
jae 0x4a88
movq 0x60(%rsp), %rsi
movl (%r13,%rcx,4), %r8d
movq (%r14,%r8,8), %r9
leaq (,%r9,4), %rdi
addq %r13, %rdi
shlq $0x2, %r9
leal 0x1(%r8), %r10d
movq (%r14,%r10,8), %r11
leaq (,%r11,4), %r10
subq %r9, %r10
leaq (,%r11,4), %r9
addq %r13, %r9
movq %r10, %r14
sarq $0x3, %r14
cmpq $0x8, %r14
jb 0x49af
shlq $0x2, %r14
movq %r9, %r11
subq %r14, %r11
movq %r9, %r14
movl (%r11), %r10d
cmpq %r10, %rdx
jb 0x498e
movq %r11, %rdi
movq %r14, %r11
jmp 0x4991
movq %r11, %r14
movq %r14, %r10
subq %rdi, %r10
movq %r10, %r15
sarq $0x3, %r15
leaq (,%r15,4), %r12
subq %r12, %r11
cmpq $0x8, %r15
jae 0x497e
sarq $0x2, %r10
testq %r10, %r10
jle 0x49e6
movq %r10, %r11
shrq %r11
leaq (%rdi,%r11,4), %r14
addq $0x4, %r14
movl -0x4(%r14), %r15d
movq %r11, %r12
notq %r12
addq %r10, %r12
cmpq %r15, %rdx
cmovbeq %r11, %r12
cmovaq %r14, %rdi
movq %r12, %r10
testq %r12, %r12
jg 0x49b8
cmpq %r9, %rdi
je 0x4a2e
movl (%rdi), %r9d
cmpq %r9, %rdx
jne 0x4a2e
testb $0x8, 0x40(%rsp)
movq 0x10(%rsp), %r14
movabsq $-0x8000000000000000, %r12 # imm = 0x8000000000000000
je 0x4a7c
subq %r13, %rdi
movq %rdi, %r8
sarq $0x2, %r8
cmpq %rcx, %r8
jbe 0x4a7c
movl (%rbp,%rcx,4), %r8d
addl (%rbp,%rdi), %r8d
movl %r8d, (%rbp,%rdi)
movl %r8d, (%rbp,%rcx,4)
jmp 0x4a7c
movq 0x30(%rsp), %rdi
incl (%rdi,%r8,4)
leaq 0x3f(%rcx), %rdi
testq %rcx, %rcx
cmovnsq %rcx, %rdi
sarq $0x6, %rdi
leaq (%rsi,%rdi,8), %rdi
movabsq $-0x8000000000000000, %r12 # imm = 0x8000000000000000
leaq 0x3f(%r12), %r8
andq %rcx, %r8
xorl %r9d, %r9d
cmpq %r12, %r8
setbe %r9b
movl $0x1, %r8d
shlq %cl, %r8
incq %rbx
orq %r8, -0x8(%rdi,%r9,8)
movq 0x10(%rsp), %r14
incq %rcx
cmpq %rax, %rcx
jb 0x492e
incq %rdx
cmpq 0x38(%rsp), %rdx
jne 0x4918
testq %rbx, %rbx
je 0x4d36
movq 0x28(%rsp), %r15
addq %rbx, %r15
shlq $0x2, %r15
movq %r13, %rdi
movq %r15, %rsi
callq 0x2280
movq %rax, %r13
movq %rbp, %rdi
movq %r15, %rsi
callq 0x2280
movq %rax, %rbp
movq 0x48(%rsp), %rax
testq %rax, %rax
je 0x4d52
movq %rbp, 0x20(%rsp)
movq 0x30(%rsp), %rcx
movl (%rcx,%rax,4), %esi
incq %rax
leaq 0x3f(%r12), %r15
movq %rax, %r14
movq %r15, 0x28(%rsp)
movl %r14d, %eax
movq %r14, %rcx
movq 0x10(%rsp), %r14
movq (%r14,%rax,8), %r15
movq %rcx, 0x48(%rsp)
movq -0x8(%r14,%rcx,8), %rbp
movq %r15, %r12
subq %rbp, %r12
leaq (%r15,%rbx), %rcx
movq %rcx, (%r14,%rax,8)
movl %esi, %eax
subq %rax, %rbx
leaq (,%rbp,4), %rsi
addq %r13, %rsi
leaq (%rsi,%rbx,4), %rdi
shlq $0x2, %r12
movq %r12, %rdx
callq 0x2270
movq 0x20(%rsp), %rax
leaq (%rax,%rbp,4), %rsi
leaq (%rsi,%rbx,4), %rdi
movq %r12, %rdx
callq 0x2270
movq 0x60(%rsp), %rax
leaq 0x3f(%rbp), %rcx
testq %rbp, %rbp
cmovnsq %rbp, %rcx
sarq $0x6, %rcx
leaq (%rax,%rcx,8), %rcx
movq %rbp, %rdx
andq 0x28(%rsp), %rdx
xorl %esi, %esi
movabsq $-0x8000000000000000, %r12 # imm = 0x8000000000000000
cmpq %r12, %rdx
setbe %sil
leaq (%rcx,%rsi,8), %rdi
addq $-0x8, %rdi
andl $0x3f, %ebp
leaq 0x3f(%r15), %rcx
testq %r15, %r15
cmovnsq %r15, %rcx
sarq $0x6, %rcx
leaq (%rax,%rcx,8), %rcx
movq %r15, %rdx
andq 0x28(%rsp), %rdx
xorl %esi, %esi
cmpq %r12, %rdx
setbe %sil
leaq (%rcx,%rsi,8), %rdx
addq $-0x8, %rdx
movl %r15d, %ecx
andl $0x3f, %ecx
movq %rbx, %r9
addq %r15, %r9
leaq 0x3f(%rbx,%r15), %rsi
movq 0x28(%rsp), %r15
cmovnsq %r9, %rsi
sarq $0x6, %rsi
leaq (%rax,%rsi,8), %rax
movq %r9, %rsi
andq %r15, %rsi
xorl %r8d, %r8d
cmpq %r12, %rsi
setbe %r8b
leaq (%rax,%r8,8), %r8
addq $-0x8, %r8
andl $0x3f, %r9d
movl %ebp, %esi
callq 0x3834
movq 0x48(%rsp), %r11
movq -0x8(%r14,%r11,8), %rdx
leaq (%rdx,%rbx), %rbp
movq 0x30(%rsp), %rax
movl -0x8(%rax,%r11,4), %ecx
movq %rbp, %rax
movq %rcx, 0x58(%rsp)
subq %rcx, %rax
leaq 0x3f(%rax), %rsi
testq %rax, %rax
cmovnsq %rax, %rsi
movq 0x60(%rsp), %rcx
sarq $0x6, %rsi
movq %rax, %rdi
andq %r15, %rdi
xorl %r8d, %r8d
cmpq %r12, %rdi
setbe %r8b
leaq (%rcx,%rsi,8), %rsi
leaq (%rsi,%r8,8), %r9
movl %eax, %edi
andl $0x3f, %edi
leaq (%rdx,%rbx), %r10
addq $0x3f, %r10
testq %rbp, %rbp
cmovnsq %rbp, %r10
movq %r12, %r14
leaq (%rsi,%r8,8), %r12
addq $-0x8, %r12
sarq $0x6, %r10
movq %rbp, %rsi
andq %r15, %rsi
xorl %edx, %edx
cmpq %r14, %rsi
setbe %dl
leaq (%rcx,%r10,8), %rsi
leaq (%rsi,%rdx,8), %rcx
andl $0x3f, %ebp
cmpq %rcx, %r9
movq %r11, %r14
je 0x4cdd
testl %edi, %edi
je 0x4cab
movq $-0x1, %rdi
movl %eax, %ecx
shlq %cl, %rdi
notq %rdi
andq %rdi, (%r12)
addq $0x8, %r12
movq %r12, %rdi
leaq (%rsi,%rdx,8), %r12
addq $-0x8, %r12
movq %r12, %rdx
subq %rdi, %rdx
xorl %esi, %esi
callq 0x20e0
testl %ebp, %ebp
movq 0x58(%rsp), %rsi
je 0x4d04
negb %bpl
movq $-0x1, %rdx
movl %ebp, %ecx
shrq %cl, %rdx
jmp 0x4cfd
cmpl %ebp, %edi
movq 0x58(%rsp), %rsi
je 0x4d04
negb %bpl
movq $-0x1, %rdx
movl %ebp, %ecx
shrq %cl, %rdx
movl %eax, %ecx
shrq %cl, %rdx
shlq %cl, %rdx
notq %rdx
andq %rdx, (%r12)
decq %r14
cmpq $0x1, %r14
jne 0x4af2
movq 0x10(%rsp), %r14
addq %rbx, 0x8(%r14)
movl 0x1c(%rsp), %ebx
testl %ebx, %ebx
movq 0x20(%rsp), %rbp
movabsq $-0x8000000000000000, %r12 # imm = 0x8000000000000000
jne 0x4d5a
jmp 0x4de6
testb $0x8, 0x40(%rsp)
jne 0x4d49
leaq 0x1391(%rip), %rdi      # 0x60d5
callq 0x2250
movl 0x1c(%rsp), %ebx
jmp 0x4de6
addq %rbx, 0x8(%r14)
movl 0x1c(%rsp), %ebx
movq 0x60(%rsp), %rax
movq (%r14), %rcx
xorl %edx, %edx
leaq 0x3f(%r12), %rsi
movq 0x30(%rsp), %r15
movq %rcx, %rdi
movq 0x8(%r14,%rdx,8), %rcx
cmpq %rcx, %rdi
jae 0x4ddc
leaq 0x3f(%rdi), %r8
testq %rdi, %rdi
cmovnsq %rdi, %r8
sarq $0x6, %r8
leaq (%rax,%r8,8), %r8
movq %rdi, %r9
andq %rsi, %r9
xorl %r10d, %r10d
cmpq %r12, %r9
setbe %r10b
movq -0x8(%r8,%r10,8), %r8
btq %rdi, %r8
jae 0x4dd4
movl (%r13,%rdi,4), %r8d
movl (%rbp,%rdi,4), %r9d
leal 0x1(%r8), %r10d
movq (%r14,%r10,8), %r10
movl (%r15,%r8,4), %r11d
subq %r11, %r10
movl %edx, (%r13,%r10,4)
movl %r9d, (%rbp,%r10,4)
leal -0x1(%r11), %r9d
movl %r9d, (%r15,%r8,4)
incq %rdi
cmpq %rdi, %rcx
jne 0x4d7b
incq %rdx
cmpq 0x38(%rsp), %rdx
jne 0x4d6e
movq 0x30(%rsp), %rdi
callq 0x21d0
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x4e13
callq 0x2160
xorl %eax, %eax
movq %rax, 0x60(%rsp)
movl $0x0, 0x68(%rsp)
movq %rax, 0x70(%rsp)
testb $0x2, 0x40(%rsp)
je 0x4f62
testl %ebx, %ebx
je 0x4f62
leaq -0x4(%r13), %rax
movq %rax, 0x28(%rsp)
leaq -0x4(%rbp), %rax
movq %rax, 0x48(%rsp)
movl %ebx, %eax
movq %rax, 0x40(%rsp)
movq (%r14), %rbx
leaq 0x4(%r13), %rax
movq %rax, 0x58(%rsp)
movq %rbp, 0x20(%rsp)
leaq 0x4(%rbp), %rax
movq %rax, 0x88(%rsp)
xorl %r12d, %r12d
leaq 0x98(%rsp), %r15
movq %r13, 0x38(%rsp)
movq %rbx, %rbp
movq 0x8(%r14,%r12,8), %rbx
movq 0x20(%rsp), %rax
leaq (%rax,%rbp,4), %rax
movq %rax, 0x30(%rsp)
movq %rax, 0x60(%rsp)
leaq (%r13,%rbp,4), %r14
movq %r14, 0x68(%rsp)
movl $0x2, %edx
movq %r15, %rdi
leaq 0x60(%rsp), %rsi
leaq 0xf(%rsp), %rcx
callq 0x5072
movq %rbx, %rsi
subq %rbp, %rsi
movq %r15, %r13
movq %r15, %rdi
callq 0x3f2b
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x4ecb
callq 0x2160
cmpq %rbp, %rbx
je 0x4f01
movq 0x28(%rsp), %rax
leaq (%rax,%rbx,4), %rax
cmpq %r14, %rax
jbe 0x4f01
movq 0x58(%rsp), %rcx
leaq (%rcx,%rbp,4), %rcx
movl -0x4(%rcx), %edx
movl (%rax), %esi
movl %esi, -0x4(%rcx)
movl %edx, (%rax)
addq $-0x4, %rax
leaq 0x4(%rcx), %rdx
cmpq %rax, %rcx
movq %rdx, %rcx
jb 0x4ee7
cmpq %rbp, %rbx
movq %r13, %r15
je 0x4f3f
movq 0x48(%rsp), %rax
leaq (%rax,%rbx,4), %rax
cmpq 0x30(%rsp), %rax
jbe 0x4f3f
movq 0x88(%rsp), %rcx
leaq (%rcx,%rbp,4), %rcx
movl -0x4(%rcx), %edx
movl (%rax), %esi
movl %esi, -0x4(%rcx)
movl %edx, (%rax)
addq $-0x4, %rax
leaq 0x4(%rcx), %rdx
cmpq %rax, %rcx
movq %rdx, %rcx
jb 0x4f25
incq %r12
cmpq 0x40(%rsp), %r12
movq 0x10(%rsp), %r14
movq 0x38(%rsp), %r13
jne 0x4e6c
movq 0x20(%rsp), %rbp
movl 0x1c(%rsp), %ebx
jmp 0x4f69
movl %ebx, %eax
movq %rax, 0x40(%rsp)
testl %ebx, %ebx
je 0x4fde
movq 0x10(%rsp), %r14
movq 0x40(%rsp), %rax
leaq (%r14,%rax,8), %r15
xorl %eax, %eax
leaq 0x12d4(%rip), %rbx      # 0x6258
movq %r14, %rsi
movq (%rsi), %rdx
movq 0x8(%rsi), %rdi
movl (%rbp,%rdx,4), %ecx
incq %rdx
cmpq %rdi, %rdx
jae 0x4fac
addl (%rbp,%rdx,4), %ecx
jb 0x501d
movl %ecx, (%rbp,%rdx,4)
incq %rdx
cmpq %rdx, %rdi
jne 0x4f9a
leaq 0x8(%rsi), %r14
testl %ecx, %ecx
je 0x4fbe
movq %r14, %rsi
cmpq %r15, %r14
jb 0x4f87
jmp 0x4fda
subq 0x10(%rsp), %rsi
sarq $0x3, %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2040
movb $0x1, %al
cmpq %r15, %r14
jb 0x4f84
jmp 0x502b
testb $0x1, %al
jne 0x502b
movq 0x90(%rsp), %rbx
movq %rbx, %rdi
movl 0x1c(%rsp), %esi
movq 0x10(%rsp), %rdx
movq %r13, %rcx
callq 0x243c
leaq 0x3d7f(%rip), %rax      # 0x8d80
movq %rax, (%rbx)
movq %rbp, 0x20(%rbx)
movq %rbx, %rax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1220(%rip), %rdi      # 0x6244
xorl %eax, %eax
callq 0x2040
movl $0x1, %edi
callq 0x21e0
jmp 0x5067
movq %rax, %rbx
movq 0x60(%rsp), %rdi
jmp 0x505b
jmp 0x5067
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
jmp 0x505b
movq %rax, %rbx
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x506a
callq 0x2160
jmp 0x506a
movq %rax, %rbx
movq %rbx, %rdi
callq 0x2290