// File: /workspace/github_cpp_makefile_star2_O2/cssartori[P]ga-qap/src/main.cpp
// Function: main
int main(int argc, char **argv){
	/*Read input parameters*/
	read_parameter(argc, argv);

	DataFile data;
	if(data.read(input_file) == -1){
		printf("Error opening file \'%s\'.\n", input_file);
		return -1;
	}

	if(pop_size == 0) pop_size = data.n*0.1;

	if(seed == -1) seed = time(NULL);

	Timer t;
	t.start();

	//create and run GA
	GeneticAlgorithm ga(data, pop_size, max_iterations, tournament_size, cross_p, seed, prints);
	Solution best = ga.run();

	t.stop();
	
	if(prints){
		printf("Initial Solution = %i\n", ga.get_initial_solution().fitness());
		printf("Best Solution Found = %i \n", best.fitness());
		printf("Iterations = %li \n", ga.get_iter_best());
		printf("Time = %.2f \n", t.elapsed_seconds());
	}
	
	if(output_file != NULL){
		if(data.write_solution(output_file, best) < 0){
			printf("Failed to save solution to \'%s\'.\n", output_file);
			return -1;
		}
		if(prints)
			printf("Solution saved to \'%s\'.\n", output_file);
	}
	
	if(prints)
		printf("Success!\n");

	return 0;
}

// Assembly:
pushq %rbx
subq $0x130, %rsp            # imm = 0x130
callq 0x305d
leaq 0x70(%rsp), %rdi
callq 0x23fc
movq 0x8422(%rip), %rsi      # 0xb188
leaq 0xa8(%rsp), %rdi
leaq 0x50(%rsp), %rdx
callq 0x3216
leaq 0x70(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x240c
movl %eax, %ebx
leaq 0xa8(%rsp), %rdi
callq 0x2090
cmpl $-0x1, %ebx
je 0x2f93
cmpq $0x0, 0x83ee(%rip)      # 0xb198
jne 0x2dfe
movsd 0xa0(%rsp), %xmm0
unpcklps 0x42c4(%rip), %xmm0     # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x42cc(%rip), %xmm0     # 0x7090
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x42c8(%rip), %xmm1     # 0x70a0
cvttsd2si %xmm1, %rax
movq %rax, %rcx
subsd 0x42c0(%rip), %xmm1     # 0x70a8
cvttsd2si %xmm1, %rdx
sarq $0x3f, %rcx
andq %rcx, %rdx
orq %rax, %rdx
movq %rdx, 0x839a(%rip)      # 0xb198
cmpl $-0x1, 0x836b(%rip)     # 0xb170
jne 0x2e14
xorl %edi, %edi
callq 0x2140
movl %eax, 0x835c(%rip)      # 0xb170
movb $0x0, 0x48(%rsp)
andq $0x0, 0x40(%rsp)
callq 0x2040
movq %rax, 0x38(%rsp)
movq 0x8368(%rip), %rdx      # 0xb198
movq 0x8321(%rip), %rcx      # 0xb158
movq 0x8322(%rip), %r8       # 0xb160
movsd 0x8322(%rip), %xmm0     # 0xb168
movslq 0x8323(%rip), %r9       # 0xb170
movzbl 0x834c(%rip), %eax      # 0xb1a0
movl %eax, (%rsp)
leaq 0xa8(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x4734
leaq 0x50(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x47d4
callq 0x2040
movq %rax, 0x40(%rsp)
movb $0x1, 0x48(%rsp)
cmpb $0x1, 0x830f(%rip)      # 0xb1a0
jne 0x2f1d
leaq 0x18(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x5688
leaq 0x18(%rsp), %rdi
callq 0x33d6
leaq 0x425c(%rip), %rdi      # 0x7116
movl %eax, %esi
xorl %eax, %eax
callq 0x2030
leaq 0x18(%rsp), %rdi
callq 0x280c
leaq 0x50(%rsp), %rdi
callq 0x33d6
leaq 0x424f(%rip), %rdi      # 0x712d
movl %eax, %esi
xorl %eax, %eax
callq 0x2030
leaq 0xa8(%rsp), %rdi
callq 0x56ac
leaq 0x424d(%rip), %rdi      # 0x7148
movq %rax, %rsi
xorl %eax, %eax
callq 0x2030
leaq 0x38(%rsp), %rdi
callq 0x3252
leaq 0x4245(%rip), %rdi      # 0x715b
movb $0x1, %al
callq 0x2030
movq 0x826c(%rip), %rsi      # 0xb190
testq %rsi, %rsi
je 0x2f7a
leaq 0x18(%rsp), %rdi
leaq 0x17(%rsp), %rdx
callq 0x3216
leaq 0x70(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x25ac
movl %eax, %ebx
leaq 0x18(%rsp), %rdi
callq 0x2090
testl %ebx, %ebx
js 0x2fad
cmpb $0x1, 0x823d(%rip)      # 0xb1a0
jne 0x2f7a
movq 0x8224(%rip), %rsi      # 0xb190
leaq 0x4218(%rip), %rdi      # 0x718b
xorl %eax, %eax
callq 0x2030
xorl %ebx, %ebx
cmpb $0x1, 0x821d(%rip)      # 0xb1a0
jne 0x2fc5
leaq 0x42ae(%rip), %rdi      # 0x723a
callq 0x2200
jmp 0x2fc5
movq 0x81ee(%rip), %rsi      # 0xb188
leaq 0x415b(%rip), %rdi      # 0x70fc
xorl %eax, %eax
callq 0x2030
pushq $-0x1
popq %rbx
jmp 0x2fdc
movq 0x81dc(%rip), %rsi      # 0xb190
leaq 0x41ae(%rip), %rdi      # 0x7169
xorl %eax, %eax
callq 0x2030
pushq $-0x1
popq %rbx
leaq 0x50(%rsp), %rdi
callq 0x280c
leaq 0xa8(%rsp), %rdi
callq 0x327e
leaq 0x70(%rsp), %rdi
callq 0x3298
movl %ebx, %eax
addq $0x130, %rsp            # imm = 0x130
popq %rbx
retq
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x280c
jmp 0x301d
jmp 0x301a
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x2090
jmp 0x301d
jmp 0x301a
movq %rax, %rbx
jmp 0x3027
jmp 0x3048
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x280c
leaq 0xa8(%rsp), %rdi
callq 0x327e
jmp 0x304b
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x2090
jmp 0x304b
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x3298
movq %rbx, %rdi
callq 0x2250