// File: /workspace/github_cpp_makefile_star2_O3/Mengjintao[P]SWAPCounter/src/kmerGraph.cpp
// Function: main
int main(int argc, char *argv[])
{
	MPIEnviroment MPIcontrol;
	MPIcontrol.init(argc, argv);
	
	parameter parameters;
	parameters.getParameters(argc, argv, &MPIcontrol);	

	FILE *FP=NULL;
    	FP = fopen(parameters.LogPath, "a");
    	clock_t t0=0, t1=0;
    	if(MPIcontrol.rank==0)
	{
		t0 = clock();
    //		FP = fopen(parameters.LogPath, "w");
	}

	kmerGraph mygraph;
	bloomFilter bFilter((unsigned long long) parameters.refSize*4/MPIcontrol.nprocs, 3);
	if(DEBUG)   printf("Proc %d: MPIcontrol->groupProc %d\n", MPIcontrol.rank, MPIcontrol.groupProc);
	
	mygraph.constructKmerGraph(&parameters, &MPIcontrol, &bFilter);
	mygraph.printKmerFreq(&parameters, &MPIcontrol);
//	fflush(stdout);	
//	mygraph.printKmerCounting(&parameters, &MPIcontrol);	
    
    	if(MPIcontrol.rank==0)
   	{
		char message[1024];
		sprintf(message,"Time spend in I/O part in MPIcontrol %.5f\n", MPIcontrol.elapsedTime/(float)CLOCKS_PER_SEC);
 		MPIcontrol.print(message, FP);	
		sprintf(message, "Time spend in locate function %.5f\n", MPIcontrol.locateTime/(float)CLOCKS_PER_SEC);
		MPIcontrol.print(message,FP);
		sprintf(message,"Time spend in read function %.5f\n", MPIcontrol.readTime/(float)CLOCKS_PER_SEC);
		MPIcontrol.print(message,FP);
    	}

	if(MPIcontrol.rank==0)
	{
		t1 = clock();
		char message[1024];
		sprintf(message,"Time spend in I/O part in MPIcontrol %.5f\n", (t1-t0)/(float)CLOCKS_PER_SEC);
 		MPIcontrol.print(message, FP);	
		printf("Time spend in I/O part in MPIcontrol %.5f\n", (t1-t0)/(float)CLOCKS_PER_SEC);
		fclose(FP);
	}

	MPIcontrol.finalize();
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x13a0, %rsp           # imm = 0x13A0
movq %rsi, %rbx
movl %edi, %ebp
leaq 0xe0(%rsp), %r14
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x5484
leaq 0x760(%rsp), %rdi
movl %ebp, %esi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x5154
leaq 0xa5d(%rsp), %rdi
leaq 0x28cd(%rip), %rsi      # 0x69ca
callq 0x22f0
movq %rax, %rbx
cmpl $0x0, (%r14)
je 0x4110
xorl %r14d, %r14d
jmp 0x4118
callq 0x2180
movq %rax, %r14
leaq 0x38(%rsp), %rdi
callq 0x44b4
movsd 0x1288(%rsp), %xmm0
cvttsd2si %xmm0, %rcx
movq %rcx, %rdx
sarq $0x3f, %rdx
subsd 0x1ec9(%rip), %xmm0     # 0x6008
cvttsd2si %xmm0, %rax
andq %rdx, %rax
orq %rcx, %rax
shlq $0x2, %rax
movslq 0xe4(%rsp), %rcx
xorl %edx, %edx
divq %rcx
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
movl $0x3, %edx
callq 0x4550
leaq 0x38(%rsp), %rdi
leaq 0x760(%rsp), %rsi
leaq 0xe0(%rsp), %rdx
leaq 0x8(%rsp), %rcx
callq 0x34f6
leaq 0x38(%rsp), %rdi
leaq 0x760(%rsp), %rsi
leaq 0xe0(%rsp), %rdx
callq 0x3a60
cmpl $0x0, 0xe0(%rsp)
jne 0x42fb
leaq 0xe0(%rsp), %r15
xorps %xmm0, %xmm0
cvtsi2ssq 0x248(%r15), %xmm0
divss 0x1e34(%rip), %xmm0     # 0x6004
cvtss2sd %xmm0, %xmm0
leaq 0x2359(%rip), %rsi      # 0x6534
leaq 0x360(%rsp), %r12
movq %r12, %rdi
movb $0x1, %al
callq 0x2070
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x5560
leaq 0xe0(%rsp), %r15
xorps %xmm0, %xmm0
cvtsi2ssq 0x250(%r15), %xmm0
divss 0x1ded(%rip), %xmm0     # 0x6004
cvtss2sd %xmm0, %xmm0
leaq 0x233d(%rip), %rsi      # 0x655f
leaq 0x360(%rsp), %r12
movq %r12, %rdi
movb $0x1, %al
callq 0x2070
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x5560
leaq 0xe0(%rsp), %r15
xorps %xmm0, %xmm0
cvtsi2ssq 0x258(%r15), %xmm0
divss 0x1da6(%rip), %xmm0     # 0x6004
cvtss2sd %xmm0, %xmm0
leaq 0x231a(%rip), %rsi      # 0x6583
leaq 0x360(%rsp), %r12
movq %r12, %rdi
movb $0x1, %al
callq 0x2070
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x5560
cmpl $0x0, 0xe0(%rsp)
jne 0x42fb
callq 0x2180
subq %r14, %rax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
divss 0x1d59(%rip), %xmm0     # 0x6004
cvtss2sd %xmm0, %xmm0
leaq 0x227e(%rip), %rsi      # 0x6534
leaq 0x360(%rsp), %r14
movq %r14, %rdi
movsd %xmm0, (%rsp)
movb $0x1, %al
callq 0x2070
leaq 0xe0(%rsp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x5560
leaq 0x224d(%rip), %rdi      # 0x6534
movsd (%rsp), %xmm0
movb $0x1, %al
callq 0x2050
movq %rbx, %rdi
callq 0x2270
leaq 0xe0(%rsp), %rdi
callq 0x55c8
leaq 0x8(%rsp), %rdi
callq 0x491a
leaq 0x70(%rsp), %rdi
callq 0x493c
leaq 0x38(%rsp), %rdi
callq 0x493c
xorl %eax, %eax
addq $0x13a0, %rsp           # imm = 0x13A0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4341
movq %rax, %rbx
jmp 0x434e
jmp 0x4341
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x491a
leaq 0x70(%rsp), %rdi
callq 0x493c
leaq 0x38(%rsp), %rdi
callq 0x493c
movq %rbx, %rdi
callq 0x2460