// File: /workspace/github_cpp_makefile_star2_O2/CK7[P]abawaca/src/abawaca-build.cpp
// Function: prepare_scgs(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
string prepare_scgs(const string& assembly_file, const string& out_directory)
{
	char cmd[4096];

	sprintf(cmd, "mkdir %s/prodigal", out_directory.c_str());
	system(cmd);
	sprintf(cmd, "mkdir %s/scg", out_directory.c_str());
	system(cmd);

	size_t l = assembly_file.rfind('/');
	string out_name = (l == string::npos)? assembly_file : assembly_file.substr(l+1);
	char scg_name[2048], prodigal_name[2048];

	sprintf(prodigal_name, "%s/prodigal/%s", out_directory.c_str(), out_name.c_str());
	sprintf(scg_name, "%s/scg/%s", out_directory.c_str(), out_name.c_str());

	sprintf(cmd, "%s -i %s -o %s.gff -d %s.genes.fna -a %s.proteins.faa -p meta -f gff 2> %s.log", prodigal, assembly_file.c_str(), prodigal_name, prodigal_name, prodigal_name, prodigal_name);
	system(cmd);
	sprintf(cmd, "ln -s ../prodigal/%s.proteins.faa %s/scg", out_name.c_str(), out_directory.c_str());
	system(cmd);
	sprintf(cmd, "%s %s.proteins.faa 2> %s.stderr > %s.stdout", bacterial_scg, scg_name, scg_name, scg_name);
//	sprintf(cmd, "ruby %s %s.proteins.faa 2> %s.stderr > %s.stdout", bacterial_scg, scg_name, scg_name, scg_name);
	system(cmd);
	sprintf(cmd, "ln -s scg/%s.proteins.faa.bacteria.scg %s", out_name.c_str(), out_directory.c_str());
	system(cmd);

	char scg_file[2048];
	sprintf(scg_file, "%s/%s.proteins.faa.bacteria.scg", out_directory.c_str(), out_name.c_str());

	return scg_file;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x2830, %rsp           # imm = 0x2830
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq (%rdx), %rdx
leaq 0x6485(%rip), %rsi      # 0xe5fc
leaq -0x1050(%rbp), %r12
movq %r12, %rdi
xorl %eax, %eax
callq 0x4060
movq %r12, %rdi
callq 0x41f0
movq (%r14), %rdx
leaq 0x6474(%rip), %rsi      # 0xe60e
movq %r12, %rdi
xorl %eax, %eax
callq 0x4060
movq %r12, %rdi
callq 0x41f0
pushq $0x2f
popq %rsi
pushq $-0x1
popq %rdx
movq %r15, %rdi
callq 0x4550
cmpq $-0x1, %rax
je 0x81d7
incq %rax
leaq -0x48(%rbp), %rdi
pushq $-0x1
popq %rcx
movq %r15, %rsi
movq %rax, %rdx
callq 0x4290
jmp 0x81e3
leaq -0x48(%rbp), %rdi
movq %r15, %rsi
callq 0x43a0
movq (%r14), %rdx
movq -0x48(%rbp), %rcx
leaq 0x642a(%rip), %rsi      # 0xe61b
leaq -0x2850(%rbp), %r12
movq %r12, %rdi
xorl %eax, %eax
callq 0x4060
movq (%r14), %rdx
movq -0x48(%rbp), %rcx
leaq 0x641a(%rip), %rsi      # 0xe62a
leaq -0x1850(%rbp), %rdi
xorl %eax, %eax
callq 0x4060
movq 0xd0c3(%rip), %rdx      # 0x152e8
movq (%r15), %rcx
leaq 0x6405(%rip), %rsi      # 0xe634
leaq -0x1050(%rbp), %r15
movq %r15, %rdi
movq %r12, %r8
movq %r12, %r9
xorl %eax, %eax
pushq %r12
pushq %r12
callq 0x4060
popq %rcx
popq %rdx
movq %r15, %rdi
callq 0x41f0
movq -0x48(%rbp), %rdx
movq (%r14), %rcx
leaq 0x6421(%rip), %rsi      # 0xe683
movq %r15, %rdi
xorl %eax, %eax
callq 0x4060
movq %r15, %rdi
callq 0x41f0
movq 0xd065(%rip), %rdx      # 0x152e0
leaq 0x642a(%rip), %rsi      # 0xe6ac
leaq -0x1850(%rbp), %rcx
movq %r15, %rdi
movq %rcx, %r8
movq %rcx, %r9
xorl %eax, %eax
callq 0x4060
movq %r15, %rdi
callq 0x41f0
movq -0x48(%rbp), %rdx
movq (%r14), %rcx
leaq 0x6429(%rip), %rsi      # 0xe6d8
movq %r15, %rdi
xorl %eax, %eax
callq 0x4060
movq %r15, %rdi
callq 0x41f0
movq (%r14), %rdx
movq -0x48(%rbp), %rcx
leaq 0x6433(%rip), %rsi      # 0xe702
leaq -0x2050(%rbp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x4060
leaq -0x21(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x40f0
leaq -0x48(%rbp), %rdi
callq 0x4130
movq %rbx, %rax
addq $0x2830, %rsp           # imm = 0x2830
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x830d
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x4130
movq %rbx, %rdi
callq 0x44b0