// File: Mengjintao[P]SWAPCounter/src/sequence.cpp
// Function: parameter::getParameters(int, char**, MPIEnviroment*)
void parameter::getParameters(int argc, char **argv, MPIEnviroment *MPIcontrol)
{
    getopt(argc, argv);

    if(MPIcontrol->rank==0)
    {    
    	int stat = mkdir(this->outputPath, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH);
    	if(stat==-1)	
    	{
		printf("Error: Creating directory %s\n", this->outputPath);
		exit(0);
    	} 
    }

    strcpy(this->contigsPath, this->outputPath);
    strcpy(this->LogPath, this->outputPath);
    strcpy(this->graphPath, this->outputPath);
    strcpy(this->masterContigPath,this->outputPath);
    strcpy(this->JungGraph_arc, this->outputPath);
    strcpy(this->JungGraph_mul, this->outputPath);
    strcpy(this->arcFrequency, this->outputPath);
    strcpy(this->kmerGraph, this->outputPath);
    strcpy(this->kmerCount, this->outputPath);
    
    strcat(this->contigsPath, "/noCEcontigs.fasta");
    strcat(this->LogPath, "/logtime.txt"); 
    strcat(this->graphPath, "/contigGraph.txt");
    strcat(this->masterContigPath,"/CEContig.fasta");
    strcat(this->JungGraph_arc, "/JungGraph_arc.txt");
    strcat(this->JungGraph_mul, "/JungGraph_mul.txt");
    strcat(this->arcFrequency, "/arcFrequency.txt");    
    strcat(this->kmerGraph, "/kmerGraph.txt");
    strcat(this->kmerCount, "/kmerCount.txt");

    MPIcontrol->groupProc = this->groupProc;

    if(MPIcontrol->rank==0)
    {    printf("Runing command: %s -k %d -c %d -i %s -o %s\n", argv[0], this->hashLength, this->cutoffThreshold, this->fastaPath, this->outputPath);
         printf("contigsPath=%s, logPath=%s, graphPath=%s\n", this->contigsPath, this->LogPath, this->graphPath);
    }
//    strcpy(this->LogPath, "logtime.txt");
//    strcpy(this->graphPath, "distGraph.txt");

    char ch0='A', ch1='C', ch2='G', ch3='T';
    this->nucleotideValue[(int)ch0] = 0;
    this->nucleotideValue[(int)ch1] = 1;
    this->nucleotideValue[(int)ch2] = 2;
    this->nucleotideValue[(int)ch3] = 3;

    this->nucleotideArray[0] = 'A';
    this->nucleotideArray[1] = 'C';
    this->nucleotideArray[2] = 'G';
    this->nucleotideArray[3] = 'T';

    this->nucleotideReverse[(int)ch0] = 'T';
    this->nucleotideReverse[(int)ch1] = 'G';
    this->nucleotideReverse[(int)ch2] = 'C';
    this->nucleotideReverse[(int)ch3] = 'A';

    this->MASK = ~(3ull<<(2*hashLength));
    this->filterThreshold = Filter_Threshold;
 //   this->arcThreshold    = 5;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movl %esi, 0x2c(%rsp)
movq %rdx, 0x20(%rsp)
movq %rcx, 0x18(%rsp)
movq 0x30(%rsp), %rdi
movq %rdi, 0x8(%rsp)
movl 0x2c(%rsp), %esi
movq 0x20(%rsp), %rdx
callq 0x14770
movq 0x18(%rsp), %rax
cmpl $0x0, (%rax)
jne 0x14ecd
movq 0x8(%rsp), %rdi
addq $0xff, %rdi
movl $0x1fd, %esi            # imm = 0x1FD
callq 0x8250
movl %eax, 0x14(%rsp)
cmpl $-0x1, 0x14(%rsp)
jne 0x14ecb
movq 0x8(%rsp), %rsi
addq $0xff, %rsi
leaq 0x1da2(%rip), %rdi      # 0x16c5f
movb $0x0, %al
callq 0x8040
xorl %edi, %edi
callq 0x8800
jmp 0x14ecd
movq 0x8(%rsp), %rsi
movq %rsi, %rdi
addq $0x1fe, %rdi            # imm = 0x1FE
addq $0xff, %rsi
callq 0x8600
movq 0x8(%rsp), %rsi
movq %rsi, %rdi
addq $0x2fd, %rdi            # imm = 0x2FD
addq $0xff, %rsi
callq 0x8600
movq 0x8(%rsp), %rsi
movq %rsi, %rdi
addq $0x3fc, %rdi            # imm = 0x3FC
addq $0xff, %rsi
callq 0x8600
movq 0x8(%rsp), %rsi
movq %rsi, %rdi
addq $0x4fb, %rdi            # imm = 0x4FB
addq $0xff, %rsi
callq 0x8600
movq 0x8(%rsp), %rsi
movq %rsi, %rdi
addq $0x5fa, %rdi            # imm = 0x5FA
addq $0xff, %rsi
callq 0x8600
movq 0x8(%rsp), %rsi
movq %rsi, %rdi
addq $0x6f9, %rdi            # imm = 0x6F9
addq $0xff, %rsi
callq 0x8600
movq 0x8(%rsp), %rsi
movq %rsi, %rdi
addq $0x7f8, %rdi            # imm = 0x7F8
addq $0xff, %rsi
callq 0x8600
movq 0x8(%rsp), %rsi
movq %rsi, %rdi
addq $0x8f7, %rdi            # imm = 0x8F7
addq $0xff, %rsi
callq 0x8600
movq 0x8(%rsp), %rsi
movq %rsi, %rdi
addq $0x9f6, %rdi            # imm = 0x9F6
addq $0xff, %rsi
callq 0x8600
movq 0x8(%rsp), %rdi
addq $0x1fe, %rdi            # imm = 0x1FE
leaq 0x1caa(%rip), %rsi      # 0x16c7d
callq 0x8c30
movq 0x8(%rsp), %rdi
addq $0x2fd, %rdi            # imm = 0x2FD
leaq 0x1ca5(%rip), %rsi      # 0x16c90
callq 0x8c30
movq 0x8(%rsp), %rdi
addq $0x3fc, %rdi            # imm = 0x3FC
leaq 0x1c9a(%rip), %rsi      # 0x16c9d
callq 0x8c30
movq 0x8(%rsp), %rdi
addq $0x4fb, %rdi            # imm = 0x4FB
leaq 0x1c93(%rip), %rsi      # 0x16cae
callq 0x8c30
movq 0x8(%rsp), %rdi
addq $0x5fa, %rdi            # imm = 0x5FA
leaq 0x1c8b(%rip), %rsi      # 0x16cbe
callq 0x8c30
movq 0x8(%rsp), %rdi
addq $0x6f9, %rdi            # imm = 0x6F9
leaq 0x1c86(%rip), %rsi      # 0x16cd1
callq 0x8c30
movq 0x8(%rsp), %rdi
addq $0x7f8, %rdi            # imm = 0x7F8
leaq 0x1c81(%rip), %rsi      # 0x16ce4
callq 0x8c30
movq 0x8(%rsp), %rdi
addq $0x8f7, %rdi            # imm = 0x8F7
leaq 0x1c7b(%rip), %rsi      # 0x16cf6
callq 0x8c30
movq 0x8(%rsp), %rdi
addq $0x9f6, %rdi            # imm = 0x9F6
leaq 0x1c72(%rip), %rsi      # 0x16d05
callq 0x8c30
movq 0x8(%rsp), %rax
movl 0xb20(%rax), %ecx
movq 0x18(%rsp), %rax
movl %ecx, 0x278(%rax)
movq 0x18(%rsp), %rax
cmpl $0x0, (%rax)
jne 0x15119
movq 0x8(%rsp), %r8
movq 0x20(%rsp), %rax
movq (%rax), %rsi
movl 0xaf8(%r8), %edx
movl 0xb0c(%r8), %ecx
movq %r8, %r9
addq $0xff, %r9
leaq 0x1c30(%rip), %rdi      # 0x16d14
movb $0x0, %al
callq 0x8040
movq 0x8(%rsp), %rcx
movq %rcx, %rsi
addq $0x1fe, %rsi            # imm = 0x1FE
movq %rcx, %rdx
addq $0x2fd, %rdx            # imm = 0x2FD
addq $0x3fc, %rcx            # imm = 0x3FC
leaq 0x1c2e(%rip), %rdi      # 0x16d40
movb $0x0, %al
callq 0x8040
movq 0x8(%rsp), %rax
movb $0x41, 0x13(%rsp)
movb $0x43, 0x12(%rsp)
movb $0x47, 0x11(%rsp)
movb $0x54, 0x10(%rsp)
movsbl 0x13(%rsp), %ecx
movslq %ecx, %rcx
movb $0x0, 0xb38(%rax,%rcx)
movsbl 0x12(%rsp), %ecx
movslq %ecx, %rcx
movb $0x1, 0xb38(%rax,%rcx)
movsbl 0x11(%rsp), %ecx
movslq %ecx, %rcx
movb $0x2, 0xb38(%rax,%rcx)
movsbl 0x10(%rsp), %ecx
movslq %ecx, %rcx
movb $0x3, 0xb38(%rax,%rcx)
movb $0x41, 0xbb8(%rax)
movb $0x43, 0xbb9(%rax)
movb $0x47, 0xbba(%rax)
movb $0x54, 0xbbb(%rax)
movsbl 0x13(%rsp), %ecx
movslq %ecx, %rcx
movb $0x54, 0xbbc(%rax,%rcx)
movsbl 0x12(%rsp), %ecx
movslq %ecx, %rcx
movb $0x47, 0xbbc(%rax,%rcx)
movsbl 0x11(%rsp), %ecx
movslq %ecx, %rcx
movb $0x43, 0xbbc(%rax,%rcx)
movsbl 0x10(%rsp), %ecx
movslq %ecx, %rcx
movb $0x41, 0xbbc(%rax,%rcx)
movl 0xaf8(%rax), %ecx
shll %ecx
movl %ecx, %ecx
movl $0x3, %edx
shlq %cl, %rdx
movq %rdx, %rcx
xorq $-0x1, %rcx
movq %rcx, 0xb00(%rax)
movl $0x0, 0xb08(%rax)
addq $0x38, %rsp
retq
nopl (%rax)