// File: /workspace/github_cpp_makefile_star2_O1/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 0x53d0
leaq 0x760(%rsp), %rdi
movl %ebp, %esi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x50a0
leaq 0xa5d(%rsp), %rdi
leaq 0x292f(%rip), %rsi      # 0x69ca
callq 0x22f0
movq %rax, %rbx
cmpl $0x0, (%r14)
je 0x40ae
xorl %r14d, %r14d
jmp 0x40b6
callq 0x2180
movq %rax, %r14
leaq 0x38(%rsp), %rdi
callq 0x443c
movsd 0x1288(%rsp), %xmm0
cvttsd2si %xmm0, %rcx
movq %rcx, %rdx
sarq $0x3f, %rdx
subsd 0x1f2b(%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 0x44d8
leaq 0x38(%rsp), %rdi
leaq 0x760(%rsp), %rsi
leaq 0xe0(%rsp), %rdx
leaq 0x8(%rsp), %rcx
callq 0x34d6
leaq 0x38(%rsp), %rdi
leaq 0x760(%rsp), %rsi
leaq 0xe0(%rsp), %rdx
callq 0x3a50
cmpl $0x0, 0xe0(%rsp)
jne 0x4227
leaq 0xe0(%rsp), %r15
xorps %xmm0, %xmm0
cvtsi2ssq 0x248(%r15), %xmm0
divss 0x1e96(%rip), %xmm0     # 0x6004
cvtss2sd %xmm0, %xmm0
leaq 0x23bb(%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 0x54ac
leaq 0xe0(%rsp), %r15
xorps %xmm0, %xmm0
cvtsi2ssq 0x250(%r15), %xmm0
divss 0x1e4f(%rip), %xmm0     # 0x6004
cvtss2sd %xmm0, %xmm0
leaq 0x239f(%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 0x54ac
leaq 0xe0(%rsp), %r15
xorps %xmm0, %xmm0
cvtsi2ssq 0x258(%r15), %xmm0
divss 0x1e08(%rip), %xmm0     # 0x6004
cvtss2sd %xmm0, %xmm0
leaq 0x237c(%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 0x54ac
cmpl $0x0, 0xe0(%rsp)
jne 0x4299
callq 0x2180
subq %r14, %rax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
divss 0x1dbb(%rip), %xmm0     # 0x6004
cvtss2sd %xmm0, %xmm0
leaq 0x22e0(%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 0x54ac
leaq 0x22af(%rip), %rdi      # 0x6534
movsd (%rsp), %xmm0
movb $0x1, %al
callq 0x2050
movq %rbx, %rdi
callq 0x2270
leaq 0xe0(%rsp), %rdi
callq 0x5514
leaq 0x8(%rsp), %rdi
callq 0x4890
leaq 0x70(%rsp), %rdi
callq 0x48b2
leaq 0x38(%rsp), %rdi
callq 0x48b2
xorl %eax, %eax
addq $0x13a0, %rsp           # imm = 0x13A0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x42df
movq %rax, %rbx
jmp 0x42ec
jmp 0x42df
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4890
leaq 0x70(%rsp), %rdi
callq 0x48b2
leaq 0x38(%rsp), %rdi
callq 0x48b2
movq %rbx, %rdi
callq 0x2460