// File: /workspace/github_cpp_makefile_star2_O3/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 $0x2820, %rsp           # imm = 0x2820
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq (%rdx), %rdx
leaq 0x779e(%rip), %rsi      # 0x1166c
leaq -0x1040(%rbp), %r12
movq %r12, %rdi
xorl %eax, %eax
callq 0x4070
movq %r12, %rdi
callq 0x4230
movq (%r14), %rdx
leaq 0x778d(%rip), %rsi      # 0x1167e
movq %r12, %rdi
xorl %eax, %eax
callq 0x4070
movq %r12, %rdi
callq 0x4230
movq %r15, %rdi
movl $0x2f, %esi
movq $-0x1, %rdx
callq 0x4580
cmpq $-0x1, %rax
je 0x9f38
incq %rax
leaq -0x40(%rbp), %rdi
movq %r15, %rsi
movq %rax, %rdx
movq $-0x1, %rcx
callq 0x42d0
jmp 0x9f53
leaq -0x30(%rbp), %rax
movq %rax, -0x10(%rax)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq -0x40(%rbp), %rdi
callq 0x63a2
movq (%r14), %rdx
movq -0x40(%rbp), %rcx
leaq 0x772a(%rip), %rsi      # 0x1168b
leaq -0x2840(%rbp), %r12
movq %r12, %rdi
xorl %eax, %eax
callq 0x4070
movq (%r14), %rdx
movq -0x40(%rbp), %rcx
leaq 0x771a(%rip), %rsi      # 0x1169a
leaq -0x2040(%rbp), %rdi
xorl %eax, %eax
callq 0x4070
movq 0xe363(%rip), %rdx      # 0x182f8
movq (%r15), %rcx
leaq 0x7705(%rip), %rsi      # 0x116a4
leaq -0x1040(%rbp), %r15
movq %r15, %rdi
movq %r12, %r8
movq %r12, %r9
xorl %eax, %eax
pushq %r12
pushq %r12
callq 0x4070
addq $0x10, %rsp
movq %r15, %rdi
callq 0x4230
movq -0x40(%rbp), %rdx
movq (%r14), %rcx
leaq 0x771f(%rip), %rsi      # 0x116f3
movq %r15, %rdi
xorl %eax, %eax
callq 0x4070
movq %r15, %rdi
callq 0x4230
movq 0xe303(%rip), %rdx      # 0x182f0
leaq 0x7728(%rip), %rsi      # 0x1171c
leaq -0x2040(%rbp), %rcx
movq %r15, %rdi
movq %rcx, %r8
movq %rcx, %r9
xorl %eax, %eax
callq 0x4070
movq %r15, %rdi
callq 0x4230
movq -0x40(%rbp), %rdx
movq (%r14), %rcx
leaq 0x7727(%rip), %rsi      # 0x11748
movq %r15, %rdi
xorl %eax, %eax
callq 0x4070
movq %r15, %rdi
callq 0x4230
movq (%r14), %rdx
movq -0x40(%rbp), %rcx
leaq 0x7731(%rip), %rsi      # 0x11772
leaq -0x1840(%rbp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x4070
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq %r14, %rdi
callq 0x4130
leaq (%rax,%rbp), %rdx
addq $-0x1840, %rdx          # imm = 0xE7C0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6440
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa089
callq 0x4280
movq %rbx, %rax
addq $0x2820, %rsp           # imm = 0x2820
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0xa09e
movq %rax, %rbx
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa0b3
callq 0x4280
movq %rbx, %rdi
callq 0x44f0