// File: /workspace/github_cpp_makefile_star2_O2/readmapping[P]alfalfa/src/main.cpp
// Function: createHeader[abi:cxx11](int, char**, long, sparseSA*)
string createHeader(int argc, char* argv[], long refLength, sparseSA *sa) {
    stringstream ss;
    ss << "@HD\tVN:" << SAM_VERSION << endl;
    for (size_t i = 0; i < sa->descr.size() - 1; i++) {
        long length = sa->startpos[i + 1] - sa->startpos[i] - 1;
        ss << "@SQ\tSN:" << sa->descr[i] << "\tLN:" << length << endl; //startpos contains refSequences with '`' in between.
    }
    long length = refLength - sa->startpos[sa->descr.size() - 1];
    ss << "@SQ\tSN:" << sa->descr[sa->descr.size() - 1] << "\tLN:" << length << endl;
    ss << "@PG\tID:" << PROG << "\tCL:";
    for (int i = 0; i < argc; i++) {
        if (i > 0)
            ss << " ";
        ss << argv[i]; //add number to the stream
    }
    ss << "\tVN:" << PROG_VERSION << endl;
    return ss.str();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %r8, %rbp
movq %rcx, 0x10(%rsp)
movq %rdx, 0x8(%rsp)
movq %rsi, (%rsp)
movq %rdi, 0x18(%rsp)
leaq 0x20(%rsp), %rdi
callq 0x71e0
leaq 0x30(%rsp), %r12
leaq 0x29c05(%rip), %rsi     # 0x32178
movq %r12, %rdi
callq 0x72b0
leaq 0x41e16(%rip), %rsi     # 0x4a398
movq %rax, %rdi
callq 0x7280
movq %rax, %rdi
callq 0x7160
xorl %r15d, %r15d
leaq 0x29bec(%rip), %r13     # 0x32188
xorl %ebx, %ebx
movq 0x8(%rbp), %rax
subq (%rbp), %rax
sarq $0x5, %rax
leaq -0x1(%rax), %rcx
cmpq %rcx, %rbx
jae 0x8608
movq 0x18(%rbp), %rax
movq (%rax,%rbx,8), %r14
notq %r14
addq 0x8(%rax,%rbx,8), %r14
movq %r12, %rdi
leaq 0x29bb3(%rip), %rsi     # 0x32180
callq 0x72b0
movq (%rbp), %rsi
addq %r15, %rsi
movq %rax, %rdi
callq 0x7280
movq %rax, %rdi
movq %r13, %rsi
callq 0x72b0
movq %rax, %rdi
movq %r14, %rsi
callq 0x72a0
addq $0x20, %r15
incq %rbx
movq %rax, %rdi
callq 0x7160
jmp 0x859e
movq 0x18(%rbp), %rcx
movq 0x10(%rsp), %rbx
subq -0x8(%rcx,%rax,8), %rbx
leaq 0x29b63(%rip), %rsi     # 0x32180
movq %r12, %rdi
callq 0x72b0
movq 0x18(%rsp), %r15
movq 0x8(%rbp), %rsi
addq $-0x20, %rsi
movq %rax, %rdi
callq 0x7280
leaq 0x29b47(%rip), %rsi     # 0x32188
movq %rax, %rdi
callq 0x72b0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x72a0
movq %rax, %rdi
callq 0x7160
leaq 0x29b2a(%rip), %rsi     # 0x3218d
movq %r12, %rdi
callq 0x72b0
leaq 0x41d06(%rip), %rsi     # 0x4a378
movq %rax, %rdi
callq 0x7280
leaq 0x29b14(%rip), %rsi     # 0x32195
movq %rax, %rdi
callq 0x72b0
xorl %r14d, %r14d
movq (%rsp), %rbp
testl %ebp, %ebp
cmovlel %r14d, %ebp
leaq 0x2fde9(%rip), %rbx     # 0x38486
movq 0x8(%rsp), %r13
cmpq %r14, %rbp
je 0x86c9
testq %r14, %r14
je 0x86b7
movq %r12, %rdi
movq %rbx, %rsi
callq 0x72b0
movq (%r13,%r14,8), %rsi
movq %r12, %rdi
callq 0x72b0
incq %r14
jmp 0x86a2
leaq 0x29aab(%rip), %rsi     # 0x3217b
movq %r12, %rdi
callq 0x72b0
leaq 0x41cd9(%rip), %rsi     # 0x4a3b8
movq %rax, %rdi
callq 0x7280
movq %rax, %rdi
callq 0x7160
leaq 0x38(%rsp), %rsi
movq %r15, %rdi
callq 0x7540
leaq 0x20(%rsp), %rdi
callq 0x7210
movq %r15, %rax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8721
jmp 0x8721
jmp 0x8721
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x7210
movq %rbx, %rdi
callq 0x75e0