// File: /workspace/github_cpp_makefile_star2_O2/WeichenZhou[P]PALMER/./scp/1_samtools.cpp
// Function: samtools(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int samtools(string working_dir, string input_bam, string chr, string start, string end, string fasta){
    
    //cout<<"Samtools Step is now running."<<endl;
    //##########hard code warming########## -q -F ##########
    //std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
    
    string sys;
    sys="samtools view -q 10 -F 0x100 -F 0x200  -F 0x400 -T "+fasta+" "+input_bam+" "+chr+":"+start+"-"+end+" |sed -e 's/[ ][ ]*/_/g'  > "+working_dir+"region.sam";
    
    char *syst = new char[sys.length()+1];
    strcpy(syst, sys.c_str());
    system(syst);
    
    //string sys_replace;
    //sys_replace="sed -e 's/[ ][ ]*/_/g' "+working_dir+"region.pre.sam"+" > "+working_dir+"region.sam";
    
    ///char *syst_replace = new char[sys_replace.length()+1];
    //strcpy(syst_replace, sys_replace.c_str());
    //system(syst_replace);
    
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a0, %rsp            # imm = 0x1A0
movq %r8, %r14
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbx
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x22acd(%rip), %rsi     # 0x25030
leaq 0x20(%rsp), %rdi
movq %r9, %rdx
callq 0x23af5
leaq 0x22c1b(%rip), %rdx     # 0x25192
leaq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x23ab7
leaq 0x60(%rsp), %rdi
leaq 0x40(%rsp), %rsi
movq %r13, %rdx
callq 0x23ad6
leaq 0x22bf3(%rip), %rdx     # 0x25192
leaq 0x80(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x23ab7
leaq 0xa0(%rsp), %rdi
leaq 0x80(%rsp), %rsi
movq %r12, %rdx
callq 0x23ad6
leaq 0x237cb(%rip), %rdx     # 0x25d9b
leaq 0xc0(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x23ab7
leaq 0xe0(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
movq %r15, %rdx
callq 0x23ad6
leaq 0x22a60(%rip), %rdx     # 0x25064
leaq 0x100(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x23ab7
leaq 0x120(%rsp), %rdi
leaq 0x100(%rsp), %rsi
movq %r14, %rdx
callq 0x23ad6
leaq 0x22a2e(%rip), %rdx     # 0x25066
leaq 0x140(%rsp), %rdi
leaq 0x120(%rsp), %rsi
callq 0x23ab7
leaq 0x160(%rsp), %rdi
leaq 0x140(%rsp), %rsi
movq %rbx, %rdx
callq 0x23ad6
leaq 0x22a17(%rip), %rdx     # 0x25083
leaq 0x180(%rsp), %rdi
leaq 0x160(%rsp), %rsi
callq 0x23ab7
movq %rsp, %rbx
leaq 0x180(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2290
movq %r14, %rdi
callq 0x2130
leaq 0x160(%rsp), %rdi
callq 0x2130
leaq 0x140(%rsp), %rdi
callq 0x2130
leaq 0x120(%rsp), %rdi
callq 0x2130
leaq 0x100(%rsp), %rdi
callq 0x2130
leaq 0xe0(%rsp), %rdi
callq 0x2130
leaq 0xc0(%rsp), %rdi
callq 0x2130
leaq 0xa0(%rsp), %rdi
callq 0x2130
leaq 0x80(%rsp), %rdi
callq 0x2130
leaq 0x60(%rsp), %rdi
callq 0x2130
leaq 0x40(%rsp), %rdi
callq 0x2130
leaq 0x20(%rsp), %rdi
callq 0x2130
movq 0x8(%rbx), %rdi
incq %rdi
callq 0x2030
movq %rax, %rbx
movq (%rsp), %rsi
movq %rax, %rdi
callq 0x2210
movq %rbx, %rdi
callq 0x21e0
movq %rsp, %rdi
callq 0x2130
xorl %eax, %eax
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x160(%rsp), %rdi
callq 0x2130
jmp 0x2778
movq %rax, %rbx
leaq 0x140(%rsp), %rdi
callq 0x2130
jmp 0x278a
movq %rax, %rbx
leaq 0x120(%rsp), %rdi
callq 0x2130
jmp 0x279c
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
callq 0x2130
jmp 0x27ae
movq %rax, %rbx
leaq 0xe0(%rsp), %rdi
callq 0x2130
leaq 0xc0(%rsp), %rdi
callq 0x2130
leaq 0xa0(%rsp), %rdi
callq 0x2130
leaq 0x80(%rsp), %rdi
callq 0x2130
leaq 0x60(%rsp), %rdi
callq 0x2130
leaq 0x40(%rsp), %rdi
callq 0x2130
leaq 0x20(%rsp), %rdi
callq 0x2130
jmp 0x2825
movq %rax, %rbx
jmp 0x27bb
movq %rax, %rbx
jmp 0x27c8
movq %rax, %rbx
jmp 0x27d5
movq %rax, %rbx
jmp 0x27e2
movq %rax, %rbx
jmp 0x27ec
movq %rax, %rbx
jmp 0x27f6
jmp 0x2822
movq %rax, %rbx
movq %rsp, %rdi
callq 0x2130
movq %rbx, %rdi
callq 0x23c0