// File: /workspace/github_c_makefile_star2_O2/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 $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x10(%rdi), %r15
testq %r15, %r15
je 0x5d61
movq %r14, 0x18(%rsp)
movq %r14, %rdi
callq 0x41d0
movq %rax, %r12
movq 0x8(%rbx), %rcx
movq %rbx, 0x20(%rsp)
movl (%rbx), %ebx
leal -0x1(%rbx), %eax
movq %rcx, (%rsp)
movq (%rcx,%rax,8), %r14
movq %r14, %rdi
callq 0x41d0
movq %r12, 0x10(%rsp)
subq %r15, %r12
addq %rax, %r12
leaq (%r14,%r12), %rdi
addq $0x2, %rdi
pushq $0x1
popq %rsi
callq 0x4300
movq %rax, %r13
leal 0x1(%rbx), %edi
pushq $0x8
popq %rsi
callq 0x4300
testq %r13, %r13
je 0x5daf
movq %rax, %rbp
testq %rax, %rax
je 0x5daf
xorl %r15d, %r15d
movq %r13, 0x8(%rsp)
cmpq %r15, %rbx
je 0x5d1b
movq (%rsp), %rax
movq (%rax,%r15,8), %r12
movq %r12, %rdi
callq 0x41d0
movq %rax, %r14
movq %r13, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x43c0
movq %r13, (%rbp,%r15,8)
addq %r14, %r13
incq %r13
incq %r15
jmp 0x5ce5
movq %r13, %rdi
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x43c0
movq %r13, (%rbp,%rbx,8)
movq (%rsp), %rdi
callq 0x45c0
movq 0x20(%rsp), %rbx
movq 0x10(%rbx), %rdi
callq 0x45c0
movq 0x8(%rsp), %rax
movq %rax, 0x10(%rbx)
movq %rbp, 0x8(%rbx)
movl (%rbx), %eax
incl %eax
movl %eax, (%rbx)
movl %eax, 0x4(%rbx)
jmp 0x5da0
movl (%rbx), %ecx
movl 0x4(%rbx), %eax
leal 0x1(%rcx), %edx
movl %edx, (%rbx)
cmpl %eax, %edx
jbe 0x5d96
leaq 0x1(%rax), %rcx
movl %ecx, 0x4(%rbx)
movq 0x8(%rbx), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0x4840
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x5dbd
movl (%rbx), %ecx
decl %ecx
jmp 0x5d9a
movq 0x8(%rbx), %rax
movl %ecx, %ecx
movq %r14, (%rax,%rcx,8)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6f427(%rip), %rdi     # 0x751dd
xorl %eax, %eax
callq 0x5b9e
movl 0x4(%rbx), %esi
shlq $0x3, %rsi
leaq 0x6f3e5(%rip), %rdi     # 0x751b0
xorl %eax, %eax
callq 0x5b9e