// File: /workspace/github_cpp_makefile_star2_O3/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 $0x58, %rsp
movq %rsi, %rbx
movl %edi, %ebp
xorpd %xmm0, %xmm0
movapd %xmm0, (%rsp)
xorl %eax, %eax
movq %rax, 0x10(%rsp)
movq %rax, 0x30(%rsp)
movapd %xmm0, 0x20(%rsp)
leaq 0x38(%rsp), %rdi
xorl %esi, %esi
callq 0x2220
leaq 0x15a2(%rip), %rdx      # 0x53fa
movl %ebp, %edi
movq %rbx, %rsi
callq 0x2070
testl %eax, %eax
js 0x419d
movq 0x4157(%rip), %rax      # 0x7fc8
movq (%rax), %r14
leaq 0x1582(%rip), %rsi      # 0x53fd
movq %r14, %rdi
callq 0x21d0
testl %eax, %eax
je 0x3f6a
leaq 0x1575(%rip), %rsi      # 0x5407
movq %r14, %rdi
callq 0x21d0
testl %eax, %eax
je 0x3ff8
leaq 0x1574(%rip), %rsi      # 0x541d
movq %r14, %rdi
callq 0x21d0
testl %eax, %eax
jne 0x419d
leaq 0x154e(%rip), %rdx      # 0x540e
movl %ebp, %edi
movq %rbx, %rsi
callq 0x2070
testl %eax, %eax
js 0x419d
movb $0x1, %r15b
xorl %r14d, %r14d
leaq 0x152f(%rip), %r13      # 0x540e
cmpl $0x71, %eax
jg 0x3f18
cmpl $0x3f, %eax
je 0x3f2e
cmpl $0x6e, %eax
jne 0x3f4a
movq 0x40d3(%rip), %rax      # 0x7fc8
movq (%rax), %r12
movq %r12, %rdi
leaq 0x1513(%rip), %rsi      # 0x5415
callq 0x21d0
testl %eax, %eax
je 0x3f60
movq %r12, %rdi
movq %rsp, %rsi
callq 0x3bbc
jmp 0x3f47
cmpl $0x74, %eax
je 0x3f33
cmpl $0x72, %eax
jne 0x3f4a
movq 0x409f(%rip), %rax      # 0x7fc8
movq (%rax), %r14
jmp 0x3f4a
xorl %r15d, %r15d
jmp 0x3f4a
movq 0x408e(%rip), %rax      # 0x7fc8
movq (%rax), %rdi
leaq 0x20(%rsp), %rsi
callq 0x3bbc
andb %al, %r15b
movl %ebp, %edi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x2070
testl %eax, %eax
jns 0x3edf
jmp 0x40e7
movq %rsp, %rdi
callq 0x3cd4
jmp 0x3f4a
leaq 0x1491(%rip), %rdx      # 0x5402
movl %ebp, %edi
movq %rbx, %rsi
callq 0x2070
testl %eax, %eax
js 0x419d
movb $0x1, %r13b
xorl %r14d, %r14d
leaq 0x1472(%rip), %r12      # 0x5402
xorl %r15d, %r15d
cmpl $0x3f, %eax
je 0x3fba
cmpl $0x74, %eax
je 0x3fae
cmpl $0x72, %eax
jne 0x3fbd
movq 0x401f(%rip), %rax      # 0x7fc8
movq (%rax), %r15
jmp 0x3fbd
movq 0x4013(%rip), %rax      # 0x7fc8
movq (%rax), %r14
jmp 0x3fbd
xorl %r13d, %r13d
movl %ebp, %edi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x2070
testl %eax, %eax
jns 0x3f93
testq %r15, %r15
setne %al
andb %al, %r13b
testq %r14, %r14
setne %al
andb %r13b, %al
cmpb $0x1, %al
jne 0x419d
movq %r15, %rdi
movq %r14, %rsi
callq 0x34b4
jmp 0x4129
leaq 0x140f(%rip), %rdx      # 0x540e
movl %ebp, %edi
movq %rbx, %rsi
callq 0x2070
testl %eax, %eax
js 0x419d
movb $0x1, %r14b
movq $0x0, 0x18(%rsp)
leaq 0x13ea(%rip), %r12      # 0x540e
xorl %r15d, %r15d
cmpl $0x71, %eax
jg 0x4063
cmpl $0x3f, %eax
je 0x4079
cmpl $0x6e, %eax
jne 0x4097
movq 0x3f8b(%rip), %rax      # 0x7fc8
movq (%rax), %r13
movq %r13, %rdi
leaq 0x13cb(%rip), %rsi      # 0x5415
callq 0x21d0
testl %eax, %eax
je 0x408f
movq %r13, %rdi
movq %rsp, %rsi
callq 0x3bbc
andb %al, %r14b
jmp 0x4097
cmpl $0x74, %eax
je 0x407e
cmpl $0x72, %eax
jne 0x4097
movq 0x3f54(%rip), %rax      # 0x7fc8
movq (%rax), %r15
jmp 0x4097
xorl %r14d, %r14d
jmp 0x4097
movq 0x3f43(%rip), %rax      # 0x7fc8
movq (%rax), %rax
movq %rax, 0x18(%rsp)
jmp 0x4097
movq %rsp, %rdi
callq 0x3cd4
movl %ebp, %edi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x2070
testl %eax, %eax
jns 0x4027
testq %r15, %r15
setne %al
andb %al, %r14b
movq 0x18(%rsp), %rsi
testq %rsi, %rsi
setne %al
andb %r14b, %al
cmpb $0x1, %al
jne 0x419d
movq 0x8(%rsp), %rax
cmpq (%rsp), %rax
je 0x419d
movq %rsp, %rdx
movq %r15, %rdi
callq 0x35fe
jmp 0x4129
testq %r14, %r14
setne %al
andb %al, %r15b
cmpb $0x1, %r15b
jne 0x419d
movq 0x28(%rsp), %rax
cmpq 0x20(%rsp), %rax
je 0x419d
movq 0x8(%rsp), %rax
cmpq (%rsp), %rax
je 0x419d
leaq 0x20(%rsp), %rsi
movq %rsp, %rdx
movq %r14, %rdi
callq 0x384e
leaq 0x48(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2220
movq (%rbx), %rax
subq 0x38(%rsp), %rax
imulq $0xf4240, %rax, %rax    # imm = 0xF4240
addq 0x8(%rbx), %rax
subq 0x40(%rsp), %rax
movq %rax, %xmm1
punpckldq 0xed3(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0xedb(%rip), %xmm1      # 0x5040
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movsd 0xe9f(%rip), %xmm2      # 0x5018
divsd %xmm2, %xmm0
movapd %xmm0, %xmm1
divsd %xmm2, %xmm1
divsd 0xe93(%rip), %xmm1      # 0x5020
leaq 0x128d(%rip), %rdi      # 0x5421
movb $0x2, %al
callq 0x2040
jmp 0x41a2
callq 0x3d1e
leaq 0x20(%rsp), %rdi
callq 0x42d6
movq %rsp, %rdi
callq 0x42d6
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x41c9
jmp 0x41c9
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x42d6
movq %rsp, %rdi
callq 0x42d6
movq %rbx, %rdi
callq 0x2260