// File: /workspace/github_cpp_makefile_star2_O1/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, %r13
movq %rcx, 0x8(%rsp)
movq %rdx, 0x18(%rsp)
movl %esi, 0x4(%rsp)
movq %rdi, 0x10(%rsp)
leaq 0x20(%rsp), %rdi
callq 0x71e0
leaq 0x30(%rsp), %r14
leaq 0x36657(%rip), %rsi     # 0x40178
movl $0x7, %edx
movq %r14, %rdi
callq 0x7340
movq 0x4a86b(%rip), %rsi     # 0x543a0
movq 0x4a86c(%rip), %rdx     # 0x543a8
movq %r14, %rdi
callq 0x7340
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x71d0
movl $0x8, %ebx
xorl %ebp, %ebp
movq 0x8(%r13), %rax
subq (%r13), %rax
sarq $0x5, %rax
leaq -0x1(%rax), %rcx
cmpq %rcx, %rbp
jae 0x9c1f
movq 0x18(%r13), %rax
movq (%rax,%rbp,8), %r12
notq %r12
addq 0x8(%rax,%rbp,8), %r12
movl $0x7, %edx
movq %r14, %rdi
leaq 0x365d3(%rip), %rsi     # 0x40180
callq 0x7340
movq (%r13), %rax
movq -0x8(%rax,%rbx), %rsi
movq (%rax,%rbx), %rdx
movq %r14, %rdi
callq 0x7340
movq %rax, %r15
movl $0x4, %edx
movq %rax, %rdi
leaq 0x365af(%rip), %rsi     # 0x40188
callq 0x7340
movq %r15, %rdi
movq %r12, %rsi
callq 0x72a0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %r12, %rdi
callq 0x7040
addq $0x20, %rbx
incq %rbp
movq %rax, %rdi
callq 0x71d0
jmp 0x9b75
movq 0x18(%r13), %rcx
movq 0x8(%rsp), %r15
subq -0x8(%rcx,%rax,8), %r15
leaq 0x3654c(%rip), %rsi     # 0x40180
movl $0x7, %edx
movq %r14, %rdi
callq 0x7340
movq 0x10(%rsp), %rbp
movq 0x8(%r13), %rax
movq -0x20(%rax), %rsi
movq -0x18(%rax), %rdx
movq %r14, %rdi
callq 0x7340
movq %rax, %rbx
leaq 0x36524(%rip), %rsi     # 0x40188
movl $0x4, %edx
movq %rax, %rdi
callq 0x7340
movq %rbx, %rdi
movq %r15, %rsi
callq 0x72a0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x71d0
leaq 0x364e0(%rip), %rsi     # 0x4018d
movl $0x7, %edx
movq %r14, %rdi
callq 0x7340
movq 0x4a6bf(%rip), %rsi     # 0x54380
movq 0x4a6c0(%rip), %rdx     # 0x54388
movq %r14, %rdi
callq 0x7340
leaq 0x364be(%rip), %rsi     # 0x40195
movl $0x4, %edx
movq %rax, %rdi
callq 0x7340
movl 0x4(%rsp), %eax
testl %eax, %eax
jle 0x9d55
movl %eax, %r12d
xorl %r13d, %r13d
leaq 0x3c7cd(%rip), %rbx     # 0x464c6
testq %r13, %r13
je 0x9d0e
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7340
movq 0x18(%rsp), %rax
movq (%rax,%r13,8), %r15
testq %r15, %r15
je 0x9d34
movq %r15, %rdi
callq 0x7140
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x7340
jmp 0x9d4d
movq 0x30(%rsp), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x50(%rsp,%rax), %esi
orl $0x1, %esi
callq 0x75c0
incq %r13
cmpq %r13, %r12
jne 0x9cf9
leaq 0x3641f(%rip), %rsi     # 0x4017b
movl $0x4, %edx
movq %r14, %rdi
callq 0x7340
movq 0x4a650(%rip), %rsi     # 0x543c0
movq 0x4a651(%rip), %rdx     # 0x543c8
movq %r14, %rdi
callq 0x7340
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x71d0
leaq 0x38(%rsp), %rsi
movq %rbp, %rdi
callq 0x7540
movq 0x4a1db(%rip), %rsi     # 0x53f98
leaq 0x20(%rsp), %rdi
callq 0x7210
leaq 0xa0(%rsp), %rdi
callq 0x7100
movq %rbp, %rax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x9def
jmp 0x9def
jmp 0x9def
movq %rax, %rbx
movq 0x4a19f(%rip), %rsi     # 0x53f98
leaq 0x20(%rsp), %rdi
callq 0x7210
leaq 0xa0(%rsp), %rdi
callq 0x7100
movq %rbx, %rdi
callq 0x7600