// File: /workspace/github_c_makefile_star2_O1/waynebhayes[P]SAHap/src/main.cpp
// Function: main
int main(int argc, char *argv[]) {

	if (argc < 2 || argc > 4) {
		cerr << "Usage: " << argv[0] << " <reads> [gt] [millions of iterations = 10]" << endl;
		return 1;
	}

	ifstream file;
	file.open(argv[1]);
	auto parsed = WIFInputReader::read(file); 

	if (argc > 3) {
		ifstream gtruth;
		gtruth.open(argv[2]);

		WIFInputReader::readGroundTruth(gtruth, parsed);
	}




	iteration_t iterations = argc == 4 ?  atoi(argv[3]) * META_ITER : 10 * META_ITER;
	
	try {
		Genome ge(parsed);
		ge.autoSchedule(iterations);
			try {
				ge.optimize(true);
				cout << ge;
			} catch (const char * e) {
				cerr << e << endl;
			}

	} catch (const char* e) {
		cout << e << endl;
	}

	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x3fc0, %rsp           # imm = 0x3FC0
movq %rsi, %rbx
movl %edi, %r14d
leal -0x5(%r14), %eax
cmpl $-0x4, %eax
ja 0xa299
movq 0x5d96(%rip), %r14      # 0xfff0
leaq 0x15eb(%rip), %rsi      # 0xb84c
movl $0x7, %edx
movq %r14, %rdi
callq 0x22b0
movq (%rbx), %rbx
testq %rbx, %rbx
je 0xa45c
movq %rbx, %rdi
callq 0x20e0
movq 0x5d67(%rip), %rdi      # 0xfff0
movq %rbx, %rsi
movq %rax, %rdx
callq 0x22b0
jmp 0xa474
leaq 0x170(%rsp), %r15
movq %r15, %rdi
callq 0x22a0
movq 0x8(%rbx), %rsi
movq %r15, %rdi
movl $0x8, %edx
callq 0x2160
movq %rsp, %rdi
leaq 0x170(%rsp), %rsi
callq 0x858c
cmpl $0x4, %r14d
jl 0xa310
leaq 0x378(%rsp), %rdi
callq 0x22a0
movq 0x10(%rbx), %rsi
leaq 0x378(%rsp), %rdi
movl $0x8, %edx
callq 0x2160
leaq 0x378(%rsp), %rdi
movq %rsp, %rsi
callq 0x8db8
leaq 0x378(%rsp), %rdi
callq 0x2060
movl $0x186a0, %r15d         # imm = 0x186A0
cmpl $0x4, %r14d
jne 0xa32e
movq 0x18(%rbx), %rdi
callq 0x23b0
imull $0x2710, %eax, %eax     # imm = 0x2710
movslq %eax, %r15
leaq 0xb8(%rsp), %rdi
movq %rsp, %rsi
callq 0xa5b2
leaq 0x378(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x2918
leaq 0x140(%rsp), %rbx
movq %rbx, %rdi
callq 0x61d8
movq -0x18(%rbx), %rdi
testq %rdi, %rdi
je 0xa37c
movq 0x138(%rsp), %rsi
subq %rdi, %rsi
callq 0x2290
leaq 0x110(%rsp), %rbx
movq %rbx, %rdi
callq 0x6226
movq -0x18(%rbx), %rdi
testq %rdi, %rdi
je 0xa3a5
movq 0x108(%rsp), %rsi
subq %rdi, %rsi
callq 0x2290
leaq 0xc0(%rsp), %rdi
callq 0x6274
leaq 0x378(%rsp), %rdi
movq %r15, %rsi
callq 0x4cae
leaq 0x378(%rsp), %rdi
movl $0x1, %esi
callq 0x39f0
movq 0x5bed(%rip), %rdi      # 0xffc8
leaq 0x378(%rsp), %rsi
callq 0x4f89
leaq 0x378(%rsp), %rdi
callq 0x2ece
leaq 0x88(%rsp), %rbx
movq %rbx, %rdi
callq 0x61d8
movq -0x18(%rbx), %rdi
testq %rdi, %rdi
je 0xa41e
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x2290
leaq 0x58(%rsp), %rbx
movq %rbx, %rdi
callq 0x6226
movq -0x18(%rbx), %rdi
testq %rdi, %rdi
je 0xa441
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x2290
leaq 0x8(%rsp), %rdi
callq 0x6274
leaq 0x170(%rsp), %rdi
callq 0x2060
xorl %eax, %eax
jmp 0xa4b4
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x2410
leaq 0x13d9(%rip), %rsi      # 0xb854
movl $0x2b, %edx
movq %r14, %rdi
callq 0x22b0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2250
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x21a0
movl $0x1, %eax
addq $0x3fc0, %rsp           # imm = 0x3FC0
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
jmp 0xa504
movq %rdx, %r14
movq %rax, %rbx
jmp 0xa568
movq %rdx, %r14
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x5220
jmp 0xa575
movq %rdx, %r14
movq %rax, %rbx
jmp 0xa575
movq %rax, %rbx
leaq 0x378(%rsp), %rdi
callq 0x2060
movq %rsp, %rdi
callq 0x5220
jmp 0xa513
jmp 0xa510
movq %rax, %rbx
leaq 0x170(%rsp), %rdi
callq 0x2060
movq %rbx, %rdi
callq 0x2450
movq %rdx, %r14
movq %rax, %rbx
cmpl $0x1, %r14d
jne 0xa568
movq %rbx, %rdi
callq 0x20d0
movq 0x5aad(%rip), %rdi      # 0xfff0
movq %rax, %rsi
callq 0x2260
movq %rax, %rdi
callq 0x20f0
callq 0x23f0
jmp 0xa3e8
movq %rdx, %r14
movq %rax, %rbx
callq 0x23f0
leaq 0x378(%rsp), %rdi
callq 0x2ece
cmpl $0x1, %r14d
jne 0xa504
movq %rbx, %rdi
callq 0x20d0
movq 0x5a3e(%rip), %rdi      # 0xffc8
movq %rax, %rsi
callq 0x2260
movq %rax, %rdi
callq 0x20f0
callq 0x23f0
jmp 0xa3f5
movq %rax, %rbx
callq 0x23f0
jmp 0xa504
nop