// File: /workspace/github_cpp_makefile_star2_O1/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 0x154e(%rip), %rdx      # 0x53fa
movl %ebp, %edi
movq %rbx, %rsi
callq 0x2070
testl %eax, %eax
js 0x41fa
movq 0x4103(%rip), %rax      # 0x7fc8
movq (%rax), %r14
leaq 0x152e(%rip), %rsi      # 0x53fd
movq %r14, %rdi
callq 0x21d0
testl %eax, %eax
je 0x3fbe
leaq 0x1521(%rip), %rsi      # 0x5407
movq %r14, %rdi
callq 0x21d0
testl %eax, %eax
je 0x4027
leaq 0x1520(%rip), %rsi      # 0x541d
movq %r14, %rdi
callq 0x21d0
testl %eax, %eax
jne 0x41fa
leaq 0x14fa(%rip), %rdx      # 0x540e
movl %ebp, %edi
movq %rbx, %rsi
callq 0x2070
movb $0x1, %r15b
xorl %r14d, %r14d
testl %eax, %eax
js 0x40e2
leaq 0x14db(%rip), %r13      # 0x540e
cmpl $0x71, %eax
jg 0x3f6c
cmpl $0x3f, %eax
je 0x3f82
cmpl $0x6e, %eax
jne 0x3f9e
movq 0x407f(%rip), %rax      # 0x7fc8
movq (%rax), %r12
movq %r12, %rdi
leaq 0x14bf(%rip), %rsi      # 0x5415
callq 0x21d0
testl %eax, %eax
je 0x3fb4
movq %r12, %rdi
movq %rsp, %rsi
callq 0x3c10
jmp 0x3f9b
cmpl $0x74, %eax
je 0x3f87
cmpl $0x72, %eax
jne 0x3f9e
movq 0x404b(%rip), %rax      # 0x7fc8
movq (%rax), %r14
jmp 0x3f9e
xorl %r15d, %r15d
jmp 0x3f9e
movq 0x403a(%rip), %rax      # 0x7fc8
movq (%rax), %rdi
leaq 0x20(%rsp), %rsi
callq 0x3c10
andb %al, %r15b
movl %ebp, %edi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x2070
testl %eax, %eax
jns 0x3f33
jmp 0x40e2
movq %rsp, %rdi
callq 0x3d28
jmp 0x3f9e
leaq 0x143d(%rip), %rdx      # 0x5402
movl %ebp, %edi
movq %rbx, %rsi
callq 0x2070
movb $0x1, %r13b
testl %eax, %eax
js 0x4124
xorl %r14d, %r14d
leaq 0x141e(%rip), %r12      # 0x5402
xorl %r15d, %r15d
cmpl $0x3f, %eax
je 0x400e
cmpl $0x74, %eax
je 0x4002
cmpl $0x72, %eax
jne 0x4011
movq 0x3fcb(%rip), %rax      # 0x7fc8
movq (%rax), %r15
jmp 0x4011
movq 0x3fbf(%rip), %rax      # 0x7fc8
movq (%rax), %r14
jmp 0x4011
xorl %r13d, %r13d
movl %ebp, %edi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x2070
testl %eax, %eax
jns 0x3fe7
jmp 0x412a
leaq 0x13e0(%rip), %rdx      # 0x540e
movl %ebp, %edi
movq %rbx, %rsi
callq 0x2070
movb $0x1, %r14b
testl %eax, %eax
js 0x4151
movq $0x0, 0x18(%rsp)
leaq 0x13bb(%rip), %r12      # 0x540e
xorl %r15d, %r15d
cmpl $0x71, %eax
jg 0x4092
cmpl $0x3f, %eax
je 0x40a8
cmpl $0x6e, %eax
jne 0x40c6
movq 0x3f5c(%rip), %rax      # 0x7fc8
movq (%rax), %r13
movq %r13, %rdi
leaq 0x139c(%rip), %rsi      # 0x5415
callq 0x21d0
testl %eax, %eax
je 0x40be
movq %r13, %rdi
movq %rsp, %rsi
callq 0x3c10
andb %al, %r14b
jmp 0x40c6
cmpl $0x74, %eax
je 0x40ad
cmpl $0x72, %eax
jne 0x40c6
movq 0x3f25(%rip), %rax      # 0x7fc8
movq (%rax), %r15
jmp 0x40c6
xorl %r14d, %r14d
jmp 0x40c6
movq 0x3f14(%rip), %rax      # 0x7fc8
movq (%rax), %rax
movq %rax, 0x18(%rsp)
jmp 0x40c6
movq %rsp, %rdi
callq 0x3d28
movl %ebp, %edi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x2070
testl %eax, %eax
jns 0x4056
movq 0x18(%rsp), %rsi
jmp 0x4156
testq %r14, %r14
setne %al
andb %r15b, %al
cmpb $0x1, %al
jne 0x41fa
movq 0x28(%rsp), %rax
cmpq 0x20(%rsp), %rax
je 0x41fa
movq 0x8(%rsp), %rax
cmpq (%rsp), %rax
je 0x41fa
leaq 0x20(%rsp), %rsi
movq %rsp, %rdx
movq %r14, %rdi
callq 0x38a2
jmp 0x4186
xorl %r15d, %r15d
xorl %r14d, %r14d
testq %r15, %r15
setne %al
andb %r13b, %al
testq %r14, %r14
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x41fa
movq %r15, %rdi
movq %r14, %rsi
callq 0x3508
jmp 0x4186
xorl %r15d, %r15d
xorl %esi, %esi
testq %r15, %r15
setne %al
andb %r14b, %al
testq %rsi, %rsi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x41fa
movq 0x8(%rsp), %rax
cmpq (%rsp), %rax
je 0x41fa
movq %rsp, %rdx
movq %r15, %rdi
callq 0x3652
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 0xe76(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0xe7e(%rip), %xmm1      # 0x5040
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movsd 0xe42(%rip), %xmm2      # 0x5018
divsd %xmm2, %xmm0
movapd %xmm0, %xmm1
divsd %xmm2, %xmm1
divsd 0xe36(%rip), %xmm1      # 0x5020
leaq 0x1230(%rip), %rdi      # 0x5421
movb $0x2, %al
callq 0x2040
jmp 0x41ff
callq 0x3d72
leaq 0x20(%rsp), %rdi
callq 0x4334
movq %rsp, %rdi
callq 0x4334
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4226
jmp 0x4226
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x4334
movq %rsp, %rdi
callq 0x4334
movq %rbx, %rdi
callq 0x2260