// File: /workspace/github_cpp_makefile_star2_O2/CMU-SAFARI[P]optimal-seed-solver/thresholdSolver.cc
// Function: ThresholdSolver::load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void ThresholdSolver::load(string file)
{
	std::ifstream test;
	test.open(file.c_str(), ios::in);
	string line;
	int num = 0;
	if(test.is_open())
	{
		while(std::getline(test,line))
			num++;
	}

	int SIZE = thresholdVec.size();
	std::ifstream f;
	f.open(file.c_str(), ios::in);

	if(f.is_open())
	{
		int i = 0;

		vector< vector <int> > freqTable (num/4, vector<int>(SIZE));
		vector< vector <int> > seedLenTable (num/4, vector<int>(SIZE));

		vector<int> avgFreqTable (SIZE);
		vector<int> avgSeedLenTable (SIZE);
		vector<int> lettersLeft (num/4);

		vector<int> totalFrequency (100000);
		for(int j=0; j<100000; j++) totalFrequency[j] = 0;

		int avgLettersLeft = 0;

		int pass = 0;
		int total = 0;

		this->freqTable = freqTable;
		this->seedLenTable = seedLenTable;
		this->lettersLeft = lettersLeft;
		this->avgFreqTable = avgFreqTable;
		this->avgSeedLenTable = avgSeedLenTable;
		this->totalFrequency = totalFrequency;

		while(!f.eof())
		{
			string id, id2, read, plus, quality;
			f >> id; f >> id2; f >> read; f >> plus; f >> quality;

			this->index = i;
			if(read.find('N') != string::npos)
			{
				if(verbose)
				{
					cout << "Read #" << i << "failed." << endl;
					cout << "Found N ... fail" << endl;
				}
			}
			else if(read.length() > 0){
				int ret = solve(read);
				if(ret != -1)
				{
					for(int j = 0; j < SIZE; j++)
					{
						this->avgFreqTable[j] += this->freqTable[i][j];
						this->avgSeedLenTable[j] += this->seedLenTable[i][j];
					}
					pass++;
				}
				else
					avgLettersLeft += this->lettersLeft[i];
				int s = this->totalFrequency.size();
				if(ret + 1 >= s)
					this->totalFrequency.resize(2*s, 0);
				total++;
				this->totalFrequency[ret + 1]++;
			}

			i++;
		}
		if(verbose)
		{
			cout << "# of Valid reads: " << pass << "/" << total << endl << endl;

			if(pass > 0)
			{
				cout << "For valid reads ... " << endl;
				cout << "Average Frequency Table:" << endl;
				for(int j = 0; j < SIZE; j++)
					cout << this->avgFreqTable[j]/pass << " ";
				cout << endl;
				cout << "Average SeedLength Table:" << endl;
				for(int j = 0; j < SIZE; j++)
					cout << this->avgSeedLenTable[j]/pass << " ";
				cout << endl;
				cout << endl;
			}
			if(total - pass > 0)
			{
				cout << "For invalid reads ... " << endl;
				cout << "Average lettersLeft: " << avgLettersLeft/(total - pass) << endl;
				cout << endl << endl;
			}
		}
	}
	if(verbose)
		printFreqTable();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x5d8, %rsp            # imm = 0x5D8
movq %rsi, %r14
movq %rdi, %r13
leaq 0x3d0(%rsp), %rbx
movq %rbx, %rdi
callq 0x32a0
movq (%r14), %rsi
pushq $0x8
popq %rdx
movq %rbx, %rdi
callq 0x3180
leaq 0x198(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x448(%rsp), %rdi
callq 0x30b0
xorl %ebx, %ebx
testb %al, %al
je 0x49ec
leaq 0x3d0(%rsp), %r15
leaq 0x188(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x3080
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x49e9
incl %ebx
jmp 0x49cc
shrl $0x2, %ebx
movq 0x458(%r13), %r15
subq 0x450(%r13), %r15
leaq 0x1c8(%rsp), %rdi
callq 0x32a0
movq (%r14), %rsi
leaq 0x1c8(%rsp), %rdi
pushq $0x8
popq %rdx
callq 0x3180
leaq 0x240(%rsp), %rdi
callq 0x30b0
testb %al, %al
je 0x50c5
shrq $0x2, %r15
movq %r15, %rbp
movslq %r15d, %r14
leaq 0x20(%rsp), %rdi
leaq 0x78(%rsp), %rdx
movq %r14, %rsi
callq 0x59b0
leaq 0x170(%rsp), %rdi
leaq 0x20(%rsp), %rdx
leaq 0x58(%rsp), %rcx
movq %rbx, %rsi
callq 0x5acc
leaq 0x20(%rsp), %rdi
callq 0x3f42
leaq 0x20(%rsp), %rdi
leaq 0x78(%rsp), %rdx
movq %r14, %rsi
callq 0x59b0
leaq 0x158(%rsp), %rdi
leaq 0x20(%rsp), %rdx
leaq 0x58(%rsp), %rcx
movq %rbx, %rsi
callq 0x5acc
leaq 0x20(%rsp), %rdi
callq 0x3f42
leaq 0x140(%rsp), %rdi
leaq 0x20(%rsp), %rdx
movq %r14, %rsi
callq 0x59b0
leaq 0x128(%rsp), %rdi
leaq 0x20(%rsp), %rdx
movq %r14, %rsi
callq 0x59b0
leaq 0x110(%rsp), %rdi
leaq 0x20(%rsp), %rdx
movq %rbx, %rsi
callq 0x59b0
leaq 0xf8(%rsp), %rdi
leaq 0x20(%rsp), %rdx
movl $0x186a0, %esi          # imm = 0x186A0
callq 0x59b0
movq 0xf8(%rsp), %rax
xorl %ecx, %ecx
cmpq $0x186a0, %rcx          # imm = 0x186A0
je 0x4b17
andl $0x0, (%rax,%rcx,4)
incq %rcx
jmp 0x4b05
leaq 0x30(%r13), %rdi
leaq 0x170(%rsp), %rsi
movq %rdi, 0xb0(%rsp)
callq 0x5b22
leaq 0x48(%r13), %rdi
leaq 0x158(%rsp), %rsi
movq %rdi, 0xa8(%rsp)
callq 0x5b22
leaq 0x90(%r13), %rdi
leaq 0x110(%rsp), %rsi
movq %rdi, 0x98(%rsp)
callq 0x5a02
leaq 0x60(%r13), %rdi
leaq 0x140(%rsp), %rsi
movq %rdi, 0x50(%rsp)
callq 0x5a02
leaq 0x78(%r13), %rdi
leaq 0x128(%rsp), %rsi
movq %rdi, 0x48(%rsp)
callq 0x5a02
leaq 0xa8(%r13), %rdi
leaq 0xf8(%rsp), %rsi
movq %rdi, 0xa0(%rsp)
callq 0x5a02
movq %r13, 0x18(%rsp)
leaq 0x88(%rsp), %r12
leaq 0x68(%rsp), %r13
leaq 0xc8(%rsp), %r15
xorl %eax, %eax
movq %rbp, %rbx
testl %ebx, %ebx
cmovlel %eax, %ebx
leaq 0x1a8(%rsp), %rbp
movq $0x0, 0x8(%rsp)
movl $0x0, 0x4(%rsp)
movl $0x0, (%rsp)
movl $0x0, 0x14(%rsp)
movq 0x1c8(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x1e8(%rsp,%rax)
jne 0x4eba
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
andq $0x0, 0x28(%rsp)
xorl %ecx, %ecx
movb %cl, 0x30(%rsp)
movq %r12, 0x78(%rsp)
andq $0x0, 0x80(%rsp)
movq %r13, 0x58(%rsp)
andq $0x0, 0x60(%rsp)
movq %r15, 0xb8(%rsp)
andq $0x0, 0xc0(%rsp)
movb %cl, 0x88(%rsp)
movb %cl, 0x68(%rsp)
movb %cl, 0xc8(%rsp)
leaq 0xe8(%rsp), %rax
movq %rax, 0xd8(%rsp)
andq $0x0, 0xe0(%rsp)
movb %cl, 0xe8(%rsp)
leaq 0x1c8(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x3310
leaq 0x1c8(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x3310
leaq 0x1c8(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x3310
leaq 0x1c8(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x3310
leaq 0x1c8(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0x3310
movq 0x18(%rsp), %r14
movq 0x8(%rsp), %rax
movl %eax, 0x428(%r14)
leaq 0x58(%rsp), %rdi
pushq $0x4e
popq %rsi
xorl %edx, %edx
callq 0x3340
cmpq $-0x1, %rax
je 0x4d70
cmpb $0x1, 0xcc(%r14)
jne 0x4e78
movq 0xb2a8(%rip), %rdi      # 0xffc8
leaq 0x53a7(%rip), %rsi      # 0xa0ce
callq 0x3250
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x3450
movq %rax, %rdi
leaq 0x5392(%rip), %rsi      # 0xa0d5
callq 0x3250
movq %rax, %rdi
callq 0x3120
movq 0xb271(%rip), %rdi      # 0xffc8
leaq 0x537f(%rip), %rsi      # 0xa0dd
callq 0x3250
movq %rax, %rdi
callq 0x3120
jmp 0x4e78
cmpq $0x0, 0x60(%rsp)
je 0x4e78
movq %rbp, %r14
movq %rbp, %rdi
leaq 0x58(%rsp), %rsi
callq 0x3380
movq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x5250
movq %r14, %rdi
movl %eax, %r14d
callq 0x3110
cmpl $-0x1, %r14d
je 0x4e00
imulq $0x18, 0x8(%rsp), %rax
movq 0xb0(%rsp), %rcx
movq (%rcx), %rcx
addq %rax, %rcx
movq 0x50(%rsp), %rdx
movq (%rdx), %rdx
movq 0xa8(%rsp), %rsi
addq (%rsi), %rax
movq 0x48(%rsp), %rsi
movq (%rsi), %rsi
xorl %edi, %edi
cmpq %rdi, %rbx
je 0x4dfb
movq (%rcx), %r8
movl (%r8,%rdi,4), %r8d
addl %r8d, (%rdx,%rdi,4)
movq (%rax), %r8
movl (%r8,%rdi,4), %r8d
addl %r8d, (%rsi,%rdi,4)
incq %rdi
jmp 0x4ddb
incl (%rsp)
jmp 0x4e1b
movq 0x98(%rsp), %rax
movq (%rax), %rax
movl 0x4(%rsp), %ecx
movq 0x8(%rsp), %rdx
addl (%rax,%rdx,4), %ecx
movl %ecx, 0x4(%rsp)
movq 0x18(%rsp), %rcx
movq 0xa8(%rcx), %rax
movq 0xb0(%rcx), %rcx
subq %rax, %rcx
shrq $0x2, %rcx
incl %r14d
cmpl %ecx, %r14d
jl 0x4e6e
movq %r13, %r15
addl %ecx, %ecx
movslq %ecx, %rsi
andl $0x0, 0x44(%rsp)
movq 0xa0(%rsp), %r13
movq %r13, %rdi
leaq 0x44(%rsp), %rdx
callq 0x3d4a
movq (%r13), %rax
movq %r15, %r13
leaq 0xc8(%rsp), %r15
incl 0x14(%rsp)
movslq %r14d, %rcx
incl (%rax,%rcx,4)
incq 0x8(%rsp)
leaq 0xd8(%rsp), %rdi
callq 0x3110
leaq 0xb8(%rsp), %rdi
callq 0x3110
leaq 0x58(%rsp), %rdi
callq 0x3110
leaq 0x78(%rsp), %rdi
callq 0x3110
leaq 0x20(%rsp), %rdi
callq 0x3110
jmp 0x4bf9
movq 0x18(%rsp), %r13
cmpb $0x1, 0xcc(%r13)
movl 0x14(%rsp), %ebp
jne 0x5077
movq 0xb0f0(%rip), %rdi      # 0xffc8
leaq 0x520f(%rip), %rsi      # 0xa0ee
callq 0x3250
movq %rax, %rdi
movl (%rsp), %esi
callq 0x3450
leaq 0x520b(%rip), %rsi      # 0xa101
movq %rax, %rdi
callq 0x3250
movq %rax, %rdi
movl %ebp, %esi
callq 0x3450
movq %rax, %rdi
callq 0x3120
movq %rax, %rdi
callq 0x3120
cmpl $0x0, (%rsp)
jle 0x5017
movq 0xb09f(%rip), %rdi      # 0xffc8
leaq 0x51d3(%rip), %rsi      # 0xa103
callq 0x3250
movq %rax, %rdi
callq 0x3120
movq 0xb084(%rip), %rdi      # 0xffc8
leaq 0x51cd(%rip), %rsi      # 0xa118
callq 0x3250
movq %rax, %rdi
callq 0x3120
xorl %r15d, %r15d
movq 0xb066(%rip), %r12      # 0xffc8
leaq 0x51ad(%rip), %r14      # 0xa116
cmpq %r15, %rbx
je 0x4f98
movq 0x50(%rsp), %rax
movq (%rax), %rax
movl (%rax,%r15,4), %eax
cltd
idivl (%rsp)
movq %r12, %rdi
movl %eax, %esi
callq 0x3450
movq %rax, %rdi
movq %r14, %rsi
callq 0x3250
incq %r15
jmp 0x4f69
movq 0xb029(%rip), %rdi      # 0xffc8
callq 0x3120
movq 0xb01d(%rip), %rdi      # 0xffc8
leaq 0x517f(%rip), %rsi      # 0xa131
callq 0x3250
movq %rax, %rdi
callq 0x3120
xorl %r15d, %r15d
movq 0xafff(%rip), %r12      # 0xffc8
leaq 0x5146(%rip), %r14      # 0xa116
cmpq %r15, %rbx
je 0x4fff
movq 0x48(%rsp), %rax
movq (%rax), %rax
movl (%rax,%r15,4), %eax
cltd
idivl (%rsp)
movq %r12, %rdi
movl %eax, %esi
callq 0x3450
movq %rax, %rdi
movq %r14, %rsi
callq 0x3250
incq %r15
jmp 0x4fd0
movq 0xafc2(%rip), %rdi      # 0xffc8
callq 0x3120
movq 0xafb6(%rip), %rdi      # 0xffc8
callq 0x3120
subl (%rsp), %ebp
jle 0x5077
movq 0xafa5(%rip), %rdi      # 0xffc8
leaq 0x5121(%rip), %rsi      # 0xa14b
callq 0x3250
movq %rax, %rdi
callq 0x3120
movq 0xaf8a(%rip), %rdi      # 0xffc8
leaq 0x511d(%rip), %rsi      # 0xa162
callq 0x3250
movq %rax, %rdi
movl 0x4(%rsp), %eax
cltd
idivl %ebp
movl %eax, %esi
callq 0x3450
movq %rax, %rdi
callq 0x3120
movq 0xaf5e(%rip), %rdi      # 0xffc8
callq 0x3120
movq %rax, %rdi
callq 0x3120
leaq 0xf8(%rsp), %rdi
callq 0x3f42
leaq 0x110(%rsp), %rdi
callq 0x3f42
leaq 0x128(%rsp), %rdi
callq 0x3f42
leaq 0x140(%rsp), %rdi
callq 0x3f42
leaq 0x158(%rsp), %rdi
callq 0x3e66
leaq 0x170(%rsp), %rdi
callq 0x3e66
cmpb $0x1, 0xcc(%r13)
jne 0x50d7
movq %r13, %rdi
callq 0x5668
leaq 0x1c8(%rsp), %rdi
callq 0x30c0
leaq 0x188(%rsp), %rdi
callq 0x3110
leaq 0x3d0(%rsp), %rdi
callq 0x30c0
addq $0x5d8, %rsp            # imm = 0x5D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x51df
movq %rax, %rbx
jmp 0x51ec
movq %rax, %rbx
jmp 0x51f9
movq %rax, %rbx
jmp 0x5206
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x3f42
jmp 0x5213
movq %rax, %rbx
jmp 0x5213
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x3f42
jmp 0x5220
jmp 0x5168
jmp 0x518f
movq %rax, %rbx
jmp 0x523a
movq %rax, %rbx
jmp 0x5220
jmp 0x5197
movq %rax, %rbx
leaq 0x1a8(%rsp), %rdi
callq 0x3110
jmp 0x519a
jmp 0x5197
jmp 0x518a
jmp 0x518a
movq %rax, %rbx
jmp 0x51d2
movq %rax, %rbx
jmp 0x522d
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0x3110
leaq 0xb8(%rsp), %rdi
callq 0x3110
leaq 0x58(%rsp), %rdi
callq 0x3110
leaq 0x78(%rsp), %rdi
callq 0x3110
leaq 0x20(%rsp), %rdi
callq 0x3110
leaq 0xf8(%rsp), %rdi
callq 0x3f42
leaq 0x110(%rsp), %rdi
callq 0x3f42
leaq 0x128(%rsp), %rdi
callq 0x3f42
leaq 0x140(%rsp), %rdi
callq 0x3f42
leaq 0x158(%rsp), %rdi
callq 0x3e66
leaq 0x170(%rsp), %rdi
callq 0x3e66
leaq 0x1c8(%rsp), %rdi
callq 0x30c0
leaq 0x188(%rsp), %rdi
callq 0x3110
leaq 0x3d0(%rsp), %rdi
callq 0x30c0
movq %rbx, %rdi
callq 0x3470
nop