// File: /workspace/github_c_makefile_star2_O3/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, %r15d
leal -0x5(%r15), %eax
cmpl $-0x4, %eax
ja 0xa26d
movq 0x5dc2(%rip), %r14      # 0xfff0
leaq 0x16e7(%rip), %rsi      # 0xb91c
movl $0x7, %edx
movq %r14, %rdi
callq 0x22b0
movq (%rbx), %rbx
testq %rbx, %rbx
je 0xa42a
movq %rbx, %rdi
callq 0x20e0
movq 0x5d93(%rip), %rdi      # 0xfff0
movq %rbx, %rsi
movq %rax, %rdx
callq 0x22b0
jmp 0xa442
leaq 0x170(%rsp), %r14
movq %r14, %rdi
callq 0x22a0
movq 0x8(%rbx), %rsi
movq %r14, %rdi
movl $0x8, %edx
callq 0x2160
movq %rsp, %rdi
leaq 0x170(%rsp), %rsi
callq 0x860c
movl $0x186a0, %r14d         # imm = 0x186A0
cmpl $0x4, %r15d
jb 0xa2fc
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 0x8dd4
leaq 0x378(%rsp), %rdi
callq 0x2060
movq 0x18(%rbx), %rdi
callq 0x23b0
imull $0x2710, %eax, %eax     # imm = 0x2710
movslq %eax, %r14
leaq 0xb8(%rsp), %rdi
movq %rsp, %rsi
callq 0xa580
leaq 0x378(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x2948
leaq 0x140(%rsp), %rbx
movq %rbx, %rdi
callq 0x6200
movq -0x18(%rbx), %rdi
testq %rdi, %rdi
je 0xa34a
movq 0x138(%rsp), %rsi
subq %rdi, %rsi
callq 0x2290
leaq 0x110(%rsp), %rbx
movq %rbx, %rdi
callq 0x6254
movq -0x18(%rbx), %rdi
testq %rdi, %rdi
je 0xa373
movq 0x108(%rsp), %rsi
subq %rdi, %rsi
callq 0x2290
leaq 0xc0(%rsp), %rdi
callq 0x62a8
leaq 0x378(%rsp), %rdi
movq %r14, %rsi
callq 0x4c4c
leaq 0x378(%rsp), %rdi
movl $0x1, %esi
callq 0x39a0
movq 0x5c1f(%rip), %rdi      # 0xffc8
leaq 0x378(%rsp), %rsi
callq 0x4f27
leaq 0x378(%rsp), %rdi
callq 0x2eac
leaq 0x88(%rsp), %rbx
movq %rbx, %rdi
callq 0x6200
movq -0x18(%rbx), %rdi
testq %rdi, %rdi
je 0xa3ec
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x2290
leaq 0x58(%rsp), %rbx
movq %rbx, %rdi
callq 0x6254
movq -0x18(%rbx), %rdi
testq %rdi, %rdi
je 0xa40f
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x2290
leaq 0x8(%rsp), %rdi
callq 0x62a8
leaq 0x170(%rsp), %rdi
callq 0x2060
xorl %eax, %eax
jmp 0xa482
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x2410
leaq 0x14db(%rip), %rsi      # 0xb924
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 0xa4d2
movq %rdx, %r14
movq %rax, %rbx
jmp 0xa536
movq %rdx, %r14
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x51c0
jmp 0xa543
movq %rdx, %r14
movq %rax, %rbx
jmp 0xa543
movq %rax, %rbx
leaq 0x378(%rsp), %rdi
callq 0x2060
movq %rsp, %rdi
callq 0x51c0
jmp 0xa4e1
jmp 0xa4de
movq %rax, %rbx
leaq 0x170(%rsp), %rdi
callq 0x2060
movq %rbx, %rdi
callq 0x2450
movq %rdx, %r14
movq %rax, %rbx
cmpl $0x1, %r14d
jne 0xa536
movq %rbx, %rdi
callq 0x20d0
movq 0x5adf(%rip), %rdi      # 0xfff0
movq %rax, %rsi
callq 0x2260
movq %rax, %rdi
callq 0x20f0
callq 0x23f0
jmp 0xa3b6
movq %rdx, %r14
movq %rax, %rbx
callq 0x23f0
leaq 0x378(%rsp), %rdi
callq 0x2eac
cmpl $0x1, %r14d
jne 0xa4d2
movq %rbx, %rdi
callq 0x20d0
movq 0x5a70(%rip), %rdi      # 0xffc8
movq %rax, %rsi
callq 0x2260
movq %rax, %rdi
callq 0x20f0
callq 0x23f0
jmp 0xa3c3
movq %rax, %rbx
callq 0x23f0
jmp 0xa4d2
nop