// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/annot-tsv.c
// Function: process_line
void process_line(args_t *args, char *line, size_t size)
{
    char *chr_beg, *chr_end;
    hts_pos_t beg, end;
    cols_t *dst_cols = NULL;
    int i,j;
    int ret = parse_tab_with_payload(line, &chr_beg, &chr_end, &beg, &end, &dst_cols, &args->dst);
    if ( ret==-1 )
    {
        cols_destroy(dst_cols);
        return;
    }

    if ( args->nbp ) nbp_reset(args->nbp,beg,end);

    if ( !regidx_overlap(args->idx, chr_beg,beg,end, args->itr) )
    {
        if ( args->mode & PRINT_NONMATCHING )
        {
            write_string(args, line, size);
            write_annots(args);
            write_string(args, "\n", 1);
        }
        cols_destroy(dst_cols);
        return;
    }

    for (i=0; i<args->src.transfer->n; i++)
    {
        args->src.nannots_added[i] = 0;
        args->tmp_cols[i].n = 0;
        kh_clear(str2int, args->tmp_hash[i]);
    }

    int has_match = 0, annot_len = 0;
    while ( regitr_overlap(args->itr) )
    {
        if ( args->overlap_src || args->overlap_dst )
        {
            double len_dst = end - beg + 1;
            double len_src = args->itr->end - args->itr->beg + 1;
            double isec = (args->itr->end < end ? args->itr->end : end) - (args->itr->beg > beg ? args->itr->beg : beg) + 1;
            int pass_dst = isec/len_dst < args->overlap_dst ? 0 : 1;
            int pass_src = isec/len_src < args->overlap_src ? 0 : 1;
            if ( args->overlap_either )
            {
                if ( !pass_dst && !pass_src ) continue;
            }
            else
            {
                if ( !pass_dst || !pass_src ) continue;
            }
        }
        cols_t *src_cols = regitr_payload(args->itr,cols_t*);
        if ( args->dst.match && args->dst.match->n )
        {
            for (i=0; i<args->dst.match->n; i++)
            {
                if ( args->dst.match_idx[i] > dst_cols->n ) error("Expected at least %d columns, found %d: %s\n",args->dst.match_idx[i],dst_cols->n,line);
                char *dst = dst_cols->off[ args->dst.match_idx[i] ];
                char *src = src_cols->off[ args->src.match_idx[i] ];
                if ( strcmp(dst,src) ) break;
            }
            if ( i != args->dst.match->n ) continue;
        }
        has_match = 1;

        if ( args->nbp )
            nbp_add(args->nbp, args->itr->beg >= beg ? args->itr->beg : beg, args->itr->end <= end ? args->itr->end : end);

        int max_annots_reached = 0;
        for (i=0; i<args->src.transfer->n; i++)
        {
            char *str;
            if ( args->src.transfer_idx[i] >= 0 )
                str = src_cols->off[ args->src.transfer_idx[i] ];                   // transfer a value from the src file
            else
                str = args->src.hdr.cols->off[ -args->src.transfer_idx[i] - 1 ];    // non-existent field in src, use a default value

            if ( !str || !*str ) str = ".";     // provide a nill dot value when the field is empty

            if ( !args->allow_dups )
            {
                if ( khash_str2int_has_key(args->tmp_hash[i],str) ) continue;
                khash_str2int_set(args->tmp_hash[i],str,1);
            }
            if ( args->max_annots )
            {
                if ( ++args->src.nannots_added[i] >= args->max_annots ) max_annots_reached = 1;
            }
            cols_append(&args->tmp_cols[i], str);
            annot_len += strlen(str);
        }
        if ( max_annots_reached ) break;
    }

    if ( !has_match )
    {
        if ( args->mode & PRINT_NONMATCHING )
        {
            write_string(args, line, size);
            write_annots(args);
            write_string(args, "\n", 1);
        }
        cols_destroy(dst_cols);
        return;
    }
    if ( !(args->mode & PRINT_MATCHING) )
    {
        cols_destroy(dst_cols);
        return;
    }

    size_t len;
    args->tmp_kstr.l = 0;
    ks_resize(&args->tmp_kstr, annot_len*3 + args->src.transfer->n*2);
    for (i=0; i<args->src.transfer->n; i++)
    {
        char *off = dst_cols->off[ args->dst.transfer_idx[i] ] = args->tmp_kstr.s + args->tmp_kstr.l;
        cols_t *ann = &args->tmp_cols[i];
        if ( !ann->n ) { off[0] = '.'; off[1] = 0; args->tmp_kstr.l += 2; continue; }
        for (j=0; j<ann->n; j++)
        {
            if ( j>0 ) { off[0] = ','; off++; args->tmp_kstr.l++; }
            len = strlen(ann->off[j]);
            memcpy(off, ann->off[j], len);
            off += len;
            args->tmp_kstr.l += len;
        }
        off[0] = 0;
        args->tmp_kstr.l++;
    }
    write_string(args, dst_cols->off[0], 0);
    for (i=1; i<dst_cols->n; i++)
    {
        write_string(args, &args->dst.delim, 1);
        write_string(args, dst_cols->off[i], 0);
    }
    write_annots(args);
    write_string(args, "\n", 1);
    cols_destroy(dst_cols);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, %r13
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x20(%rsp), %r9
andq $0x0, (%r9)
leaq 0x8(%rdi), %rax
movq %rax, (%rsp)
leaq 0x78(%rsp), %rsi
leaq 0x80(%rsp), %rdx
leaq 0x70(%rsp), %rcx
leaq 0x68(%rsp), %r8
movq %r12, %rdi
callq 0x5e0e
cmpl $-0x1, %eax
je 0x79f1
movq (%rbx), %rax
movq 0x70(%rsp), %r14
movq 0x68(%rsp), %rcx
testq %rax, %rax
je 0x75d8
andq $0x0, (%rax)
movq %r14, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq 0x78(%rsp), %rsi
movq 0x1c0(%rbx), %rdi
movq 0x1c8(%rbx), %r8
movq %r14, %rdx
movq %rcx, 0x38(%rsp)
callq 0x1c234
testl %eax, %eax
je 0x79c0
movq %r14, 0x50(%rsp)
xorl %r14d, %r14d
pushq $0x4
popq %rbp
xorl %r15d, %r15d
movq %rbx, 0x10(%rsp)
movq 0xe0(%rbx), %rax
movl (%rax), %eax
cmpq %rax, %r15
jae 0x767f
movq 0x110(%rbx), %rax
andl $0x0, (%rax,%r15,4)
movq 0x1e8(%rbx), %rax
andl $0x0, (%rax,%r14)
movq 0x1f0(%rbx), %rax
movq (%rax,%r15,8), %rbx
testq %rbx, %rbx
je 0x7671
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x7671
movl (%rbx), %eax
movl %eax, %edx
shrl $0x2, %edx
andl $-0x4, %edx
cmpl $0x10, %eax
cmovbl %ebp, %edx
movl $0xaa, %esi
callq 0x4260
andq $0x0, 0x4(%rbx)
incq %r15
addq $0x18, %r14
movq 0x10(%rsp), %rbx
jmp 0x7613
movq %r13, 0x58(%rsp)
movq %r12, 0x48(%rsp)
movq 0x38(%rsp), %rax
movq 0x50(%rsp), %rbp
subq %rbp, %rax
incq %rax
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x60(%rsp)
movb $0x1, %cl
movq $0x0, 0x18(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x28(%rsp)
movl %ecx, 0x44(%rsp)
movq 0x10(%rsp), %rbx
movq 0x1c8(%rbx), %r14
movq 0x38(%rsp), %r15
movq %r14, %rdi
callq 0x1c7ea
testl %eax, %eax
je 0x7982
movsd 0x1b0(%rbx), %xmm0
movsd 0x1b8(%rbx), %xmm1
ucomisd 0x6d912(%rip), %xmm0    # 0x75008
movq 0x1c8(%rbx), %r14
jne 0x770d
jp 0x770d
ucomisd 0x6d8ff(%rip), %xmm1    # 0x75008
jne 0x770d
jnp 0x776e
movq (%r14), %rax
movq 0x8(%r14), %rcx
movq %rcx, %rdx
subq %rax, %rdx
incq %rdx
cvtsi2sd %rdx, %xmm4
cmpq %r15, %rcx
cmovgeq %r15, %rcx
cmpq %rbp, %rax
cmovleq %rbp, %rax
subq %rax, %rcx
incq %rcx
cvtsi2sd %rcx, %xmm2
movapd %xmm2, %xmm3
divsd 0x60(%rsp), %xmm3
divsd %xmm4, %xmm2
cmpl $0x0, 0x1a8(%rbx)
je 0x775a
ucomisd %xmm3, %xmm1
ja 0x7764
jmp 0x776e
ucomisd %xmm3, %xmm1
ja 0x76ce
ucomisd %xmm2, %xmm0
ja 0x76ce
movq 0x10(%r14), %rax
movq (%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x38(%rbx), %rax
testq %rax, %rax
je 0x77f2
movl (%rax), %ebx
testq %rbx, %rbx
je 0x77f2
movq 0x10(%rsp), %rax
movq 0x58(%rax), %r13
movq 0x28(%rsp), %rax
movl (%rax), %r15d
xorl %r12d, %r12d
cmpq %r12, %rbx
je 0x77f2
movslq (%r13,%r12,4), %rsi
cmpl %r15d, %esi
ja 0x7b88
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rax
movq (%rax,%rsi,8), %rdi
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rsp), %rcx
movq 0xf8(%rcx), %rcx
movslq (%rcx,%r12,4), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x46c0
testl %eax, %eax
jne 0x77e9
incq %r12
jmp 0x779e
cmpl %r12d, %ebx
jne 0x76bd
movq 0x10(%rsp), %rbx
movq (%rbx), %r15
testq %r15, %r15
je 0x7878
movq (%r14), %rbx
movq 0x8(%r14), %r14
cmpq %rbp, %rbx
cmovleq %rbp, %rbx
movq 0x38(%rsp), %rax
cmpq %rax, %r14
cmovgeq %rax, %r14
movq (%r15), %rcx
movq 0x8(%r15), %rax
addq $0x2, %rcx
movq %rcx, (%r15)
cmpq %rax, %rcx
jae 0x7832
movq 0x10(%r15), %rax
jmp 0x785b
leaq 0x2(%rax), %rcx
movq %rcx, 0x8(%r15)
movq 0x10(%r15), %rdi
leaq 0x10(,%rax,8), %rsi
callq 0x4840
movq %rax, 0x10(%r15)
testq %rax, %rax
je 0x7b9e
movq (%r15), %rcx
addq %rbx, %rbx
movq %rbx, -0x10(%rax,%rcx,8)
leaq 0x1(,%r14,2), %rcx
movq (%r15), %rdx
movq %rcx, -0x8(%rax,%rdx,8)
movq 0x10(%rsp), %rbx
xorl %r12d, %r12d
xorl %ebp, %ebp
xorl %r13d, %r13d
movq 0x18(%rsp), %r15
movq 0xe0(%rbx), %rax
movl (%rax), %eax
cmpq %rax, %rbp
jae 0x796b
movq 0x100(%rbx), %rax
movl (%rax,%rbp,4), %eax
testl %eax, %eax
js 0x78ac
movq 0x30(%rsp), %rcx
jmp 0x78b5
movq 0xb8(%rbx), %rcx
notl %eax
movq 0x8(%rcx), %rcx
movl %eax, %eax
movq (%rcx,%rax,8), %r14
testq %r14, %r14
je 0x78ca
cmpb $0x0, (%r14)
jne 0x78d1
leaq 0x6f77b(%rip), %r14     # 0x7704c
cmpl $0x0, 0x198(%rbx)
jne 0x7913
movl %r13d, 0x18(%rsp)
movq %r15, %r13
movq 0x1f0(%rbx), %rax
movq (%rax,%rbp,8), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x8682
cmpl (%r15), %eax
jne 0x7961
movq %r15, %rdi
movq %r14, %rsi
pushq $0x1
popq %rdx
callq 0x6569
movq %r13, %r15
movl 0x18(%rsp), %r13d
cmpl $0x0, 0x19c(%rbx)
je 0x7938
movq 0x110(%rbx), %rax
movl (%rax,%rbp,4), %ecx
incl %ecx
movl %ecx, (%rax,%rbp,4)
cmpl 0x19c(%rbx), %ecx
pushq $0x1
popq %rax
cmovgel %eax, %r13d
movq 0x1e8(%rbx), %rdi
addq %r12, %rdi
movq %r14, %rsi
callq 0x5c50
movq %r14, %rdi
callq 0x41d0
addl %eax, %r15d
incq %rbp
addq $0x18, %r12
jmp 0x7885
movq %r13, %r15
movl 0x18(%rsp), %r13d
jmp 0x7955
movq %r15, 0x18(%rsp)
xorl %ecx, %ecx
testl %r13d, %r13d
movq 0x50(%rsp), %rbp
je 0x76b9
jmp 0x79fb
testb $0x1, 0x44(%rsp)
je 0x79fb
testb $0x2, 0x1a0(%rbx)
je 0x7a04
movq %rbx, %rdi
movq 0x48(%rsp), %rsi
movq 0x58(%rsp), %rdx
callq 0x7bb4
movq %rbx, %rdi
callq 0x7c16
leaq 0x6edd1(%rip), %rsi     # 0x76784
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0x7bb4
jmp 0x7a04
testb $0x2, 0x1a0(%rbx)
je 0x79f1
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x7bb4
movq %rbx, %rdi
callq 0x7c16
leaq 0x6ed9e(%rip), %rsi     # 0x76784
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0x7bb4
movq 0x20(%rsp), %rdi
jmp 0x7b72
testb $0x1, 0x1a0(%rbx)
jne 0x7a0e
movq 0x28(%rsp), %rdi
jmp 0x7b72
leaq 0x1d0(%rbx), %r14
andq $0x0, 0x1d0(%rbx)
movq 0x18(%rsp), %rax
leal (%rax,%rax,2), %eax
movq 0xe0(%rbx), %rcx
movl (%rcx), %ecx
leal (%rax,%rcx,2), %esi
movq %r14, %rdi
callq 0x7d98
xorl %edx, %edx
movq 0xe0(%rbx), %rax
movl (%rax), %eax
cmpq %rax, %rdx
jae 0x7afa
movq 0x60(%rbx), %rax
movq 0x1e0(%rbx), %r15
addq 0x1d0(%rbx), %r15
movq 0x20(%rsp), %rcx
movq 0x8(%rcx), %rcx
movslq (%rax,%rdx,4), %rax
movq %r15, (%rcx,%rax,8)
movq 0x1e8(%rbx), %rbp
movq %rdx, 0x30(%rsp)
imulq $0x18, %rdx, %rcx
movl (%rbp,%rcx), %eax
testl %eax, %eax
je 0x7adc
addq %rcx, %rbp
xorl %ebx, %ebx
movl %eax, %eax
cmpq %rax, %rbx
jae 0x7ad2
testq %rbx, %rbx
je 0x7aa3
movb $0x2c, (%r15)
incq %r15
incq (%r14)
movq 0x8(%rbp), %rax
movq (%rax,%rbx,8), %r12
movq %r12, %rdi
callq 0x41d0
movq %rax, %r13
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x43c0
addq %r13, (%r14)
addq %r13, %r15
incq %rbx
movl (%rbp), %eax
jmp 0x7a8d
pushq $0x1
popq %rax
movq 0x10(%rsp), %rbx
jmp 0x7ae6
movb $0x2e, (%r15)
incq %r15
pushq $0x2
popq %rax
movb $0x0, (%r15)
addq %rax, (%r14)
movq 0x30(%rsp), %rdx
incq %rdx
jmp 0x7a3b
movq 0x20(%rsp), %r14
movq 0x8(%r14), %rax
movq (%rax), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x7bb4
leaq 0x80(%rbx), %r15
pushq $0x1
popq %r12
movq %r12, %rbx
movq 0x10(%rsp), %r13
movl (%r14), %eax
cmpq %rax, %rbx
jae 0x7b50
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x7bb4
movq 0x8(%r14), %rax
movq (%rax,%rbx,8), %rsi
movq %r13, %rdi
xorl %edx, %edx
callq 0x7bb4
incq %rbx
jmp 0x7b23
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x7c16
leaq 0x6ec20(%rip), %rsi     # 0x76784
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0x7bb4
movq %r14, %rdi
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5df6
leaq 0x6d65d(%rip), %rdi     # 0x751ec
movl %r15d, %edx
movq 0x48(%rsp), %rcx
xorl %eax, %eax
callq 0x5b9e
movq 0x8(%r15), %rsi
shlq $0x3, %rsi
leaq 0x6d603(%rip), %rdi     # 0x751b0
xorl %eax, %eax
callq 0x5b9e