// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/annot-tsv.c
// Function: cols_append
void cols_append(cols_t *cols, char *str)
{
    if ( cols->rmme )
    {
        size_t str_len = strlen(str);
        size_t lst_len = strlen(cols->off[ cols->n - 1 ]);
        size_t tot_len = 2 + str_len + lst_len + (cols->off[ cols->n - 1 ] - cols->rmme);

        cols_t *tmp_cols = (cols_t*)calloc(1,sizeof(cols_t));
        if ( !tmp_cols ) error("Out of memory, failed to allocate %zu bytes\n",sizeof(cols_t));
        tmp_cols->rmme = calloc(tot_len,1);
        tmp_cols->off  = calloc(cols->n+1,sizeof(*tmp_cols->off));
        if ( !tmp_cols->rmme || !tmp_cols->off ) error("Out of memory\n");

        char *ptr = tmp_cols->rmme;
        int i;
        for (i=0; i<cols->n; i++)
        {
            size_t len = strlen(cols->off[i]);
            memcpy(ptr, cols->off[i], len);
            tmp_cols->off[i] = ptr;
            ptr += len + 1;
        }
        memcpy(ptr, str, str_len);
        tmp_cols->off[i] = ptr;

        free(cols->off);
        free(cols->rmme);
        cols->rmme = tmp_cols->rmme;
        cols->off  = tmp_cols->off;
        cols->n    = cols->n+1;
        cols->m    = cols->n;
        free(tmp_cols);
        return;
    }
    cols->n++;
    if ( cols->n > cols->m )
    {
        cols->m++;
        cols->off = realloc(cols->off,sizeof(*cols->off)*cols->m);
        if ( !cols->off ) error("Out of memory, failed to allocate %zu bytes\n",sizeof(*cols->off)*cols->m);
    }
    cols->off[cols->n-1] = str;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r14
movq %rdi, %r15
movq 0x10(%rdi), %rbx
testq %rbx, %rbx
je 0x607e
movq %r14, 0x28(%rsp)
movq %r14, %rdi
callq 0x41d0
movq %rax, %rbp
movq 0x8(%r15), %r13
movl (%r15), %r12d
leal -0x1(%r12), %eax
movq (%r13,%rax,8), %r14
movq %r14, %rdi
callq 0x41d0
movq %rbp, 0x20(%rsp)
subq %rbx, %rbp
movq %r12, %rbx
addq %rax, %rbp
leaq (%r14,%rbp), %rdi
addq $0x2, %rdi
movl $0x1, %esi
callq 0x4300
movq %rax, %r14
leal 0x1(%r12), %edi
movl $0x8, %esi
callq 0x4300
testq %r14, %r14
je 0x6111
movq %rax, %r12
testq %rax, %rax
je 0x6111
movq %r13, 0x10(%rsp)
testq %rbx, %rbx
movq %r15, 0x18(%rsp)
movq %r14, 0x8(%rsp)
je 0x60b9
movq 0x8(%r15), %rax
movq %rax, 0x30(%rsp)
movq %rbx, %rbp
xorl %ebx, %ebx
movq %r14, %r13
movq %r12, %r15
movq 0x30(%rsp), %rax
movq (%rax,%rbx,8), %r12
movq %r12, %rdi
callq 0x41d0
movq %rax, %r14
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %r12
movq %rax, %rdx
callq 0x43c0
movq %r13, (%r15,%rbx,8)
addq %r14, %r13
incq %r13
incq %rbx
cmpq %rbx, %rbp
jne 0x6042
jmp 0x60be
movl (%r15), %eax
movl 0x4(%r15), %esi
incl %eax
movl %eax, (%r15)
cmpl %esi, %eax
jbe 0x60aa
incl %esi
movl %esi, 0x4(%r15)
movq 0x8(%r15), %rdi
shlq $0x3, %rsi
callq 0x4840
movq %rax, 0x8(%r15)
testq %rax, %rax
je 0x611f
movq 0x8(%r15), %rax
movl (%r15), %ecx
decl %ecx
movq %r14, (%rax,%rcx,8)
jmp 0x6102
xorl %ebx, %ebx
movq %r14, %r13
movq %r13, %rdi
movq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rdx
callq 0x43c0
movq %r13, (%r12,%rbx,8)
movq 0x10(%rsp), %rdi
callq 0x45c0
movq 0x18(%rsp), %rbx
movq 0x10(%rbx), %rdi
callq 0x45c0
movq 0x8(%rsp), %rax
movq %rax, 0x10(%rbx)
movq %r12, 0x8(%rbx)
movl (%rbx), %eax
incl %eax
movl %eax, (%rbx)
movl %eax, 0x4(%rbx)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x900c5(%rip), %rdi     # 0x961dd
xorl %eax, %eax
callq 0x5ed4
movl 0x4(%r15), %esi
shlq $0x3, %rsi
leaq 0x90082(%rip), %rdi     # 0x961b0
xorl %eax, %eax
callq 0x5ed4