// File: /workspace/github_c_makefile_star2_O3/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, %r13
movq %rdi, %r12
movq 0x10(%rdi), %r15
testq %r15, %r15
je 0x607c
movq %r13, %rdi
callq 0x41d0
movq %rax, %rbp
movq 0x8(%r12), %rcx
movl (%r12), %ebx
leal -0x1(%rbx), %eax
movq %rcx, (%rsp)
movq (%rcx,%rax,8), %r14
movq %r14, %rdi
callq 0x41d0
movq %rbp, 0x20(%rsp)
subq %r15, %rbp
addq %rax, %rbp
leaq (%r14,%rbp), %rdi
addq $0x2, %rdi
movl $0x1, %esi
callq 0x4300
movq %rax, %r14
leal 0x1(%rbx), %edi
movl $0x8, %esi
callq 0x4300
testq %r14, %r14
je 0x612f
movq %rax, %rbp
testq %rax, %rax
je 0x612f
movq %r13, 0x18(%rsp)
testq %rbx, %rbx
je 0x60c5
movq %r12, 0x10(%rsp)
xorl %r15d, %r15d
movq %r14, 0x8(%rsp)
movq %r14, %r13
movq (%rsp), %r14
movq (%r14,%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
movq (%rsp), %r14
incq %r15
cmpq %r15, %rbx
jne 0x603c
movq 0x10(%rsp), %r12
movq 0x8(%rsp), %r15
jmp 0x60d1
movl (%r12), %ecx
movl 0x4(%r12), %eax
leal 0x1(%rcx), %edx
movl %edx, (%r12)
cmpl %eax, %edx
jbe 0x6115
leaq 0x1(%rax), %rcx
movl %ecx, 0x4(%r12)
movq 0x8(%r12), %rdi
leaq 0x8(,%rax,8), %rsi
callq 0x4840
movq %rax, 0x8(%r12)
testq %rax, %rax
je 0x613d
movl (%r12), %ecx
decl %ecx
jmp 0x611a
xorl %ebx, %ebx
movq %r14, %r13
movq %r14, %r15
movq (%rsp), %r14
movq %r13, %rdi
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
callq 0x43c0
movq %r13, (%rbp,%rbx,8)
movq %r14, %rdi
callq 0x45c0
movq 0x10(%r12), %rdi
callq 0x45c0
movq %r15, 0x10(%r12)
movq %rbp, 0x8(%r12)
movl (%r12), %eax
incl %eax
movl %eax, (%r12)
movl %eax, 0x4(%r12)
jmp 0x6120
movq 0x8(%r12), %rax
movl %ecx, %ecx
movq %r13, (%rax,%rcx,8)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8d0a7(%rip), %rdi     # 0x931dd
xorl %eax, %eax
callq 0x5edc
movl 0x4(%r12), %esi
shlq $0x3, %rsi
leaq 0x8d063(%rip), %rdi     # 0x931b0
xorl %eax, %eax
callq 0x5edc