// File: /workspace/github_cpp_makefile_star2_O2/yuansliu[P]HiRGC/hirgc.cpp
// Function: main
int main(int argc, char *argv[]) {
	vector<string> chr_name_list;
	vector<string> fold_list;

	bool flag = true, compressed = false;
	int oc;
	char *mode = NULL, *ref_file = NULL, *tar_file = NULL, *ref_fold = NULL, *tar_fold = NULL;

	struct  timeval  start;
	struct  timeval  end;
	unsigned long timer;
	gettimeofday(&start,NULL);

	if ((oc = getopt(argc, argv, "m:")) >= 0) {
		mode = optarg;
	} else {
		// printf("arguments error...\n");
		show_usage();
		return 0;
	}

	if (strcmp(mode, "file") == 0) {
		while ((oc = getopt(argc, argv, "r:t:")) >= 0) {
			switch(oc) {
				case 'r':
					ref_file = optarg;
					break;
				case 't':
					tar_file = optarg;
					break;
				case '?':
					flag = false;
					break;
			}
		}

		if (flag && ref_file && tar_file) {
			compressFile(ref_file, tar_file);
			compressed = true;
		}

	} else 
	if (strcmp(mode, "genome") == 0 ){
		while ((oc = getopt(argc, argv, "r:t:n:")) >= 0) {
			switch(oc) {
				case 'r':
					ref_fold = optarg;
					break;
				case 't':
					tar_fold = optarg;
					break;
				case 'n':
					if (strcmp(optarg, "default") == 0) {
						setDefaltName(chr_name_list);
					} else {
						flag &= getList(optarg, chr_name_list);
					}
					break;
				case '?':
					flag = false;
					break;
			}
		}

		if (flag && ref_fold && tar_fold && chr_name_list.size() > 0) {
			compressGenome(ref_fold, tar_fold, chr_name_list);
			compressed = true;
		}

	} else 
	if (strcmp(mode, "set") == 0) {
		while ((oc = getopt(argc, argv, "r:t:n:")) >= 0) {
			switch(oc) {
				case 'r':
					ref_fold = optarg;
					break;
				case 't':
					flag &= getList(optarg, fold_list);
					break;
				case 'n':
					if (strcmp(optarg, "default") == 0) {
						setDefaltName(chr_name_list);
					} else {
						flag &= getList(optarg, chr_name_list);
					}
					break;
				case '?':
					flag = false;
					break;
			}
		}

		if (flag && ref_fold && fold_list.size() > 0 && chr_name_list.size() > 0) {
			compressSet(ref_fold, fold_list, chr_name_list);
			compressed = true;
		}
	}

	if (!compressed) {
		// printf("arguments error...\n");
		show_usage();
		return 0;
	}

	gettimeofday(&end,NULL);
	timer = 1000000 * (end.tv_sec - start.tv_sec) + end.tv_usec - start.tv_usec;
	printf("total compression timer = %lf ms; %lf min\n", timer/1000.0, timer/1000.0/1000.0/60.0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %rbx
movl %edi, %ebp
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
movapd %xmm0, 0x30(%rsp)
andq $0x0, 0x40(%rsp)
leaq 0x48(%rsp), %rdi
xorl %esi, %esi
callq 0x2230
leaq 0x1af0(%rip), %rdx      # 0x546f
movl %ebp, %edi
movq %rbx, %rsi
callq 0x2070
testl %eax, %eax
js 0x3cd4
movq 0x4630(%rip), %rax      # 0x7fc8
movq (%rax), %r14
leaq 0x1ad0(%rip), %rsi      # 0x5472
movq %r14, %rdi
callq 0x21e0
testl %eax, %eax
je 0x3a9d
leaq 0x1ac3(%rip), %rsi      # 0x547c
movq %r14, %rdi
callq 0x21e0
testl %eax, %eax
je 0x3b14
leaq 0x1ac2(%rip), %rsi      # 0x5492
movq %r14, %rdi
callq 0x21e0
testl %eax, %eax
jne 0x3cd4
movb $0x1, %al
movl %eax, 0x4(%rsp)
movq $0x0, 0x8(%rsp)
leaq 0x1a8d(%rip), %r15      # 0x5483
leaq 0x1a8d(%rip), %r12      # 0x548a
leaq 0x10(%rsp), %r13
movl %ebp, %edi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x2070
testl %eax, %eax
js 0x3c17
cmpl $0x6e, %eax
je 0x3a3c
cmpl $0x3f, %eax
je 0x3a5f
cmpl $0x74, %eax
je 0x3a69
cmpl $0x72, %eax
jne 0x3a02
movq 0x4596(%rip), %rax      # 0x7fc8
movq (%rax), %rax
movq %rax, 0x8(%rsp)
jmp 0x3a02
movq 0x4585(%rip), %rax      # 0x7fc8
movq (%rax), %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0x21e0
testl %eax, %eax
jne 0x3a7f
movq %r13, %rdi
callq 0x3835
jmp 0x3a02
movl $0x0, 0x4(%rsp)
jmp 0x3a02
movq 0x4558(%rip), %rax      # 0x7fc8
movq (%rax), %rdi
leaq 0x30(%rsp), %rsi
callq 0x3759
jmp 0x3a8a
movq %r14, %rdi
movq %r13, %rsi
callq 0x3759
cmpb $0x0, 0x4(%rsp)
setne %cl
andb %cl, %al
movl %eax, 0x4(%rsp)
jmp 0x3a02
movb $0x1, %r13b
xorl %r14d, %r14d
leaq 0x19cd(%rip), %r12      # 0x5477
xorl %r15d, %r15d
movl %ebp, %edi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x2070
testl %eax, %eax
js 0x3aea
cmpl $0x3f, %eax
je 0x3ad9
cmpl $0x74, %eax
je 0x3ade
cmpl $0x72, %eax
jne 0x3aad
movq 0x44f4(%rip), %rax      # 0x7fc8
movq (%rax), %r15
jmp 0x3aad
xorl %r13d, %r13d
jmp 0x3aad
movq 0x44e3(%rip), %rax      # 0x7fc8
movq (%rax), %r14
jmp 0x3aad
testq %r15, %r15
setne %al
andb %al, %r13b
testq %r14, %r14
setne %al
andb %r13b, %al
cmpb $0x1, %al
jne 0x3cd4
movq %r15, %rdi
movq %r14, %rsi
callq 0x32b4
jmp 0x3c60
movb $0x1, %al
movl %eax, 0x4(%rsp)
movq $0x0, 0x8(%rsp)
leaq 0x1959(%rip), %r12      # 0x5483
leaq 0x1959(%rip), %r13      # 0x548a
leaq 0x10(%rsp), %r14
movq $0x0, 0x28(%rsp)
movl %ebp, %edi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x2070
testl %eax, %eax
js 0x3bd5
cmpl $0x6e, %eax
je 0x3b79
cmpl $0x3f, %eax
je 0x3b9c
cmpl $0x74, %eax
je 0x3ba6
cmpl $0x72, %eax
jne 0x3b3f
movq 0x4459(%rip), %rax      # 0x7fc8
movq (%rax), %rax
movq %rax, 0x8(%rsp)
jmp 0x3b3f
movq 0x4448(%rip), %rax      # 0x7fc8
movq (%rax), %r15
movq %r15, %rdi
movq %r13, %rsi
callq 0x21e0
testl %eax, %eax
jne 0x3bb7
movq %r14, %rdi
callq 0x3835
jmp 0x3b3f
movl $0x0, 0x4(%rsp)
jmp 0x3b3f
movq 0x441b(%rip), %rax      # 0x7fc8
movq (%rax), %rax
movq %rax, 0x28(%rsp)
jmp 0x3b3f
movq %r15, %rdi
movq %r14, %rsi
callq 0x3759
cmpb $0x0, 0x4(%rsp)
setne %cl
andb %cl, %al
movl %eax, 0x4(%rsp)
jmp 0x3b3f
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
setne %al
movl 0x4(%rsp), %ecx
andb %al, %cl
movq 0x28(%rsp), %rsi
testq %rsi, %rsi
setne %al
andb %cl, %al
cmpb $0x1, %al
jne 0x3cd4
movq 0x18(%rsp), %rax
cmpq 0x10(%rsp), %rax
je 0x3cd4
leaq 0x10(%rsp), %rdx
callq 0x3345
jmp 0x3c60
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
setne %al
movl 0x4(%rsp), %ecx
andb %al, %cl
cmpb $0x1, %cl
jne 0x3cd4
movq 0x38(%rsp), %rax
cmpq 0x30(%rsp), %rax
je 0x3cd4
movq 0x18(%rsp), %rax
cmpq 0x10(%rsp), %rax
je 0x3cd4
leaq 0x30(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x34df
leaq 0x58(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2230
movq (%rbx), %rax
subq 0x48(%rsp), %rax
imulq $0xf4240, %rax, %rax    # imm = 0xF4240
addq 0x8(%rbx), %rax
subq 0x50(%rsp), %rax
movq %rax, %xmm1
punpckldq 0x139c(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x13a4(%rip), %xmm1     # 0x5040
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movsd 0x1368(%rip), %xmm2     # 0x5018
divsd %xmm2, %xmm0
movapd %xmm0, %xmm1
divsd %xmm2, %xmm1
divsd 0x135c(%rip), %xmm1     # 0x5020
leaq 0x17cb(%rip), %rdi      # 0x5496
movb $0x2, %al
callq 0x2040
jmp 0x3cd9
callq 0x3880
leaq 0x30(%rsp), %rdi
callq 0x3f12
leaq 0x10(%rsp), %rdi
callq 0x3f12
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3d06
jmp 0x3d06
jmp 0x3d06
jmp 0x3d06
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x3f12
leaq 0x10(%rsp), %rdi
callq 0x3f12
movq %rbx, %rdi
callq 0x2270
nop