// File: /workspace/github_cpp_makefile_star2_O3/yuansliu[P]HiRGC/hirgc.cpp
// Function: compressGenome(char*, char*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&)
void compressGenome(char *refFold, char *tarFold, vector<string> &chr_name_list) {
    char ref[1020], tar[1020], res[1020];
	char cmd[2048];
	char temp[100];
	sprintf(temp, "%s_ref_%s", tarFold, refFold);
	sprintf(cmd, "rm -r %s", temp);
	system(cmd);
	sprintf(cmd, "mkdir %s", temp);
	system(cmd);

	initial(); //important************* must initial before other operation

	int size = chr_name_list.size();
	for (int i = 0; i < size; i++) {
		sprintf(ref, "%s/%s", refFold, chr_name_list[i].c_str());
		sprintf(tar, "%s/%s", tarFold, chr_name_list[i].c_str());
		printf("compressing %s\n", tar);
		sprintf(res, "%s/%s", temp, chr_name_list[i].c_str());
		compressFile(ref, tar, res);
	}
	
	sprintf(cmd, "./7za a %s.7z %s -m0=PPMd", temp, temp);
	system(cmd);

	sprintf(cmd, "rm -r %s", temp);
	system(cmd);
	
	clear();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1488, %rsp           # imm = 0x1488
movq %rdx, %r12
movq %rsi, %rdx
movq %rdi, %rcx
leaq 0x1a68(%rip), %rsi      # 0x5087
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rdx, 0x8(%rsp)
movq %rcx, (%rsp)
xorl %eax, %eax
callq 0x2060
leaq 0x1a73(%rip), %rsi      # 0x50b1
leaq 0xc80(%rsp), %r15
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2060
movq %r15, %rdi
callq 0x2130
leaq 0x1a58(%rip), %rsi      # 0x50ba
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2060
movq %r15, %rdi
callq 0x2130
movl $0x400, %edi            # imm = 0x400
callq 0x2030
movq %rax, 0x4af0(%rip)      # 0x8178
movl $0x800000, %edi         # imm = 0x800000
callq 0x2030
movq %rax, 0x4ae7(%rip)      # 0x8180
movl $0x2000000, %edi        # imm = 0x2000000
callq 0x2030
movq %rax, 0x4aee(%rip)      # 0x8198
movl $0x800000, %edi         # imm = 0x800000
callq 0x2030
movq %rax, 0x4acd(%rip)      # 0x8188
movl $0x800000, %edi         # imm = 0x800000
callq 0x2030
movq %rax, 0x4ac4(%rip)      # 0x8190
movl $0x40000000, %edi       # imm = 0x40000000
callq 0x2030
movq %rax, 0x4ac3(%rip)      # 0x81a0
movl $0x40000000, %edi       # imm = 0x40000000
callq 0x2030
movq %rax, 0x4aba(%rip)      # 0x81a8
movl $0x40000000, %edi       # imm = 0x40000000
callq 0x2030
movq %rax, 0x4ad1(%rip)      # 0x81d0
movabsq $0x100000000, %rdi      # imm = 0x100000000
callq 0x2030
movq %rax, 0x4ac3(%rip)      # 0x81d8
movl $0x100000, %edi         # imm = 0x100000
callq 0x2030
movq %rax, 0x4aba(%rip)      # 0x81e0
movq 0x8(%r12), %r14
subq (%r12), %r14
shrq $0x5, %r14
testl %r14d, %r14d
jle 0x37ef
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
xorl %r13d, %r13d
movq (%r12), %rax
movq (%rax,%r13), %rcx
leaq 0x80(%rsp), %rdi
leaq 0x1966(%rip), %rbp      # 0x50c3
movq %rbp, %rsi
movq (%rsp), %rdx
xorl %eax, %eax
callq 0x2060
movq (%r12), %rax
movq (%rax,%r13), %rcx
leaq 0x880(%rsp), %r15
movq %r15, %rdi
movq %rbp, %rsi
movq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0x2060
leaq 0x1935(%rip), %rdi      # 0x50c9
movq %r15, %rsi
xorl %eax, %eax
callq 0x2040
movq (%r12), %rax
movq (%rax,%r13), %rcx
leaq 0x480(%rsp), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
leaq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x2060
leaq 0x80(%rsp), %rdi
callq 0x27c0
callq 0x3194
movq %r15, %rdi
callq 0x291d
movq %rbx, %rdi
callq 0x3228
addq $0x20, %r13
decq %r14
jne 0x3746
leaq 0x189b(%rip), %rsi      # 0x5091
leaq 0xc80(%rsp), %rbx
leaq 0x10(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x2060
movq %rbx, %rdi
callq 0x2130
leaq 0x188f(%rip), %rsi      # 0x50b1
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2060
movq %rbx, %rdi
callq 0x2130
callq 0x41e6
addq $0x1488, %rsp           # imm = 0x1488
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq