// File: /workspace/github_c_makefile_star2_O3/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 $0xa8, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x38(%rsp), %r9
movq $0x0, (%r9)
leaq 0x8(%rdi), %rax
movq %rax, (%rsp)
leaq 0x98(%rsp), %rsi
leaq 0xa0(%rsp), %rdx
leaq 0x90(%rsp), %rcx
leaq 0x88(%rsp), %r8
movq %r15, %rdi
callq 0x619d
cmpl $-0x1, %eax
je 0x863b
movq (%rbx), %rax
movq 0x90(%rsp), %rbp
movq 0x88(%rsp), %r12
testq %rax, %rax
je 0x7ea1
movq $0x0, (%rax)
movq %rbp, 0x18(%rax)
movq %r12, 0x20(%rax)
movq 0x98(%rsp), %rsi
movq 0x1c0(%rbx), %rdi
movq 0x1c8(%rbx), %r8
movq %rbp, %rdx
movq %r12, %rcx
callq 0x20a30
testl %eax, %eax
je 0x85c7
movq %r12, 0x18(%rsp)
movq %r15, 0x40(%rsp)
movq %r14, 0x78(%rsp)
movq 0xe0(%rbx), %rax
cmpl $0x0, (%rax)
je 0x7f5b
xorl %r14d, %r14d
xorl %r12d, %r12d
xorl %r15d, %r15d
movq 0x110(%rbx), %rcx
movl %r14d, (%rcx,%r15,4)
movq 0x1e8(%rbx), %rcx
movl %r14d, (%rcx,%r12)
movq 0x1f0(%rbx), %rcx
movq (%rcx,%r15,8), %r13
testq %r13, %r13
je 0x7f4d
movq 0x10(%r13), %rdi
testq %rdi, %rdi
je 0x7f4d
movl (%r13), %eax
movl %eax, %edx
shrl $0x2, %edx
andl $-0x4, %edx
cmpl $0x10, %eax
movl $0x4, %eax
cmovbl %eax, %edx
movl $0xaa, %esi
callq 0x4260
movq $0x0, 0x4(%r13)
movq 0xe0(%rbx), %rax
incq %r15
movl (%rax), %ecx
addq $0x18, %r12
cmpq %rcx, %r15
jb 0x7eee
movq 0x18(%rsp), %r14
movq %r14, %rax
subq %rbp, %rax
incq %rax
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x50(%rsp)
movq $0x0, 0x10(%rsp)
movq 0x38(%rsp), %r13
xorl %eax, %eax
movq %r13, 0x20(%rsp)
movq %rbp, 0x30(%rsp)
movl %eax, 0x28(%rsp)
movq 0x1c8(%rbx), %rdi
callq 0x21205
testl %eax, %eax
je 0x83a8
movsd 0x1b0(%rbx), %xmm0
movsd 0x1b8(%rbx), %xmm1
ucomisd 0x8b04a(%rip), %xmm0    # 0x93008
movq 0x1c8(%rbx), %r15
jne 0x7fd5
jp 0x7fd5
ucomisd 0x8b037(%rip), %xmm1    # 0x93008
jne 0x7fd5
jnp 0x803c
movq (%r15), %rax
movq 0x8(%r15), %rcx
movq %rcx, %rdx
subq %rax, %rdx
incq %rdx
xorps %xmm4, %xmm4
cvtsi2sd %rdx, %xmm4
cmpq %r14, %rcx
cmovgeq %r14, %rcx
cmpq %rbp, %rax
cmovleq %rbp, %rax
subq %rax, %rcx
incq %rcx
xorps %xmm2, %xmm2
cvtsi2sd %rcx, %xmm2
movapd %xmm2, %xmm3
divsd 0x50(%rsp), %xmm3
divsd %xmm4, %xmm2
cmpl $0x0, 0x1a8(%rbx)
je 0x8028
ucomisd %xmm3, %xmm1
ja 0x8032
jmp 0x803c
ucomisd %xmm3, %xmm1
ja 0x8173
ucomisd %xmm2, %xmm0
ja 0x8173
movq 0x10(%r15), %rax
movq (%rax), %rax
movq %rax, 0x68(%rsp)
movq 0x38(%rbx), %rax
testq %rax, %rax
je 0x80b5
movl (%rax), %r13d
testq %r13, %r13
je 0x80b5
movq 0x58(%rbx), %r14
movq 0x20(%rsp), %rax
movl (%rax), %r12d
xorl %ebp, %ebp
movslq (%r14,%rbp,4), %rsi
cmpl %r12d, %esi
ja 0x86d4
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rax
movq (%rax,%rsi,8), %rdi
movq 0x68(%rsp), %rax
movq 0x8(%rax), %rax
movq 0xf8(%rbx), %rcx
movslq (%rcx,%rbp,4), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x46c0
testl %eax, %eax
jne 0x80ac
incq %rbp
cmpq %rbp, %r13
jne 0x8067
jmp 0x80b5
cmpl %ebp, %r13d
jne 0x814b
movq (%rbx), %r14
testq %r14, %r14
je 0x8136
movq (%r15), %r12
movq 0x8(%r15), %r15
movq 0x30(%rsp), %rax
cmpq %rax, %r12
cmovleq %rax, %r12
movq 0x18(%rsp), %rax
cmpq %rax, %r15
cmovgeq %rax, %r15
movq (%r14), %rcx
movq 0x8(%r14), %rax
addq $0x2, %rcx
movq %rcx, (%r14)
cmpq %rax, %rcx
jae 0x80f5
movq 0x10(%r14), %rax
jmp 0x811e
leaq 0x2(%rax), %rcx
movq %rcx, 0x8(%r14)
movq 0x10(%r14), %rdi
leaq 0x10(,%rax,8), %rsi
callq 0x4840
movq %rax, 0x10(%r14)
testq %rax, %rax
je 0x8709
movq (%r14), %rcx
addq %r12, %r12
movq %r12, -0x10(%rax,%rcx,8)
leaq 0x1(,%r15,2), %rcx
movq (%r14), %rdx
movq %rcx, -0x8(%rax,%rdx,8)
movq 0xe0(%rbx), %rax
movl (%rax), %ecx
movl $0x1, 0x28(%rsp)
testl %ecx, %ecx
jne 0x817b
movq 0x1c8(%rbx), %rdi
callq 0x21205
testl %eax, %eax
movq 0x20(%rsp), %r13
movq 0x30(%rsp), %rbp
movq 0x18(%rsp), %r14
jne 0x7fa6
jmp 0x83a8
movq %r15, %rdi
jmp 0x7f99
xorl %r12d, %r12d
movl $0x0, 0xc(%rsp)
movq 0x10(%rsp), %r15
movl %ecx, 0x58(%rsp)
movq 0x100(%rbx), %rax
movl (%rax,%r12,4), %eax
testl %eax, %eax
js 0x81a5
movq 0x68(%rsp), %rcx
jmp 0x81ae
movq 0xb8(%rbx), %rcx
notl %eax
movq 0x8(%rcx), %rcx
movl %eax, %eax
movq (%rcx,%rax,8), %rdx
testq %rdx, %rdx
je 0x81c2
cmpb $0x0, (%rdx)
jne 0x81c9
leaq 0x8ced3(%rip), %rdx     # 0x9509c
cmpl $0x0, 0x198(%rbx)
movq %r15, 0x10(%rsp)
jne 0x82f0
movq 0x1f0(%rbx), %rax
movq (%rax,%r12,8), %rax
movq %rax, 0x48(%rsp)
movl (%rax), %esi
testl %esi, %esi
movq %r12, 0x60(%rsp)
je 0x821e
movb (%rdx), %cl
testb %cl, %cl
je 0x8226
leaq 0x1(%rdx), %rax
movl $0x811c9dc5, %r15d      # imm = 0x811C9DC5
movzbl %cl, %ecx
xorl %r15d, %ecx
imull $0x1000193, %ecx, %r15d # imm = 0x1000193
movb (%rax), %cl
incq %rax
testb %cl, %cl
jne 0x8206
jmp 0x822c
xorl %r14d, %r14d
jmp 0x82ca
movl $0x811c9dc5, %r15d      # imm = 0x811C9DC5
movq %rsi, 0x70(%rsp)
decl %esi
andl %esi, %r15d
movq 0x48(%rsp), %rax
movq 0x10(%rax), %rdi
movl $0x1, %r13d
movl %r15d, %r14d
movq %rdx, 0x28(%rsp)
movl %esi, 0x5c(%rsp)
movq %rdi, 0x80(%rsp)
movl %r14d, %eax
shrl $0x4, %eax
movl (%rdi,%rax,4), %ebp
leal (%r14,%r14), %r12d
andl $0x1e, %r12d
movl %ebp, %eax
movl %r12d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x82b8
testb $0x1, %al
jne 0x82a8
movq 0x48(%rsp), %rax
movq 0x18(%rax), %rax
movl %r14d, %ecx
movq (%rax,%rcx,8), %rdi
movq 0x28(%rsp), %rsi
callq 0x46c0
movq 0x80(%rsp), %rdi
movl 0x5c(%rsp), %esi
movq 0x28(%rsp), %rdx
testl %eax, %eax
je 0x82b8
addl %r13d, %r14d
andl %esi, %r14d
incl %r13d
cmpl %r15d, %r14d
jne 0x8259
jmp 0x82d3
movl %r12d, %ecx
shrl %cl, %ebp
testb $0x3, %bpl
movq 0x70(%rsp), %rsi
cmovnel %esi, %r14d
cmpl %esi, %r14d
jne 0x8372
movq 0x48(%rsp), %rdi
movq %rdx, %r14
movq %rdx, %rsi
movl $0x1, %edx
callq 0x69f3
movq %r14, %rdx
movq 0x60(%rsp), %r12
cmpl $0x0, 0x19c(%rbx)
je 0x8320
movq 0x110(%rbx), %rax
movl (%rax,%r12,4), %ecx
incl %ecx
movl %ecx, (%rax,%r12,4)
cmpl 0x19c(%rbx), %ecx
movl $0x1, %eax
movl 0xc(%rsp), %ecx
cmovgel %eax, %ecx
movl %ecx, 0xc(%rsp)
movq 0x20(%rsp), %r13
movq 0x30(%rsp), %rbp
movq 0x18(%rsp), %r14
leaq (%r12,%r12,2), %rdi
shlq $0x3, %rdi
addq 0x1e8(%rbx), %rdi
movq %rdx, %r15
movq %rdx, %rsi
callq 0x5f90
movq %r15, %rdi
callq 0x41d0
movq 0x10(%rsp), %r15
addl %eax, %r15d
movq 0xe0(%rbx), %rax
movl (%rax), %ecx
incq %r12
movl %ecx, %eax
cmpq %rax, %r12
jb 0x818b
jmp 0x8391
movq 0x20(%rsp), %r13
movq 0x30(%rsp), %rbp
movq 0x18(%rsp), %r14
movq 0x10(%rsp), %r15
movq 0x60(%rsp), %r12
movl 0x58(%rsp), %ecx
jmp 0x8362
movq %r15, 0x10(%rsp)
movl $0x1, %eax
cmpl $0x0, 0xc(%rsp)
je 0x7f8e
jmp 0x83b3
cmpl $0x0, 0x28(%rsp)
je 0x8642
testb $0x1, 0x1a0(%rbx)
je 0x86bb
movq $0x0, 0x1d0(%rbx)
movq 0x10(%rsp), %rax
leal (%rax,%rax,2), %eax
movq 0xe0(%rbx), %rcx
movl (%rcx), %ecx
leal (%rax,%rcx,2), %eax
cmpq %rax, 0x1d8(%rbx)
jae 0x8413
movl %eax, %r15d
shrl %r15d
addq %rax, %r15
movq 0x1e0(%rbx), %rdi
movq %r15, %rsi
callq 0x4840
testq %rax, %rax
je 0x8413
movq %rax, 0x1e0(%rbx)
movq %r15, 0x1d8(%rbx)
movq 0xe0(%rbx), %rax
cmpl $0x0, (%rax)
je 0x84f5
movq 0x1d0(%rbx), %r14
xorl %edx, %edx
addq 0x1e0(%rbx), %r14
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x60(%rbx), %rcx
movslq (%rcx,%rdx,4), %rcx
movq %r14, (%rax,%rcx,8)
movq 0x1e8(%rbx), %rax
leaq (%rdx,%rdx,2), %rcx
cmpl $0x0, (%rax,%rcx,8)
je 0x84ba
movq %rdx, 0x50(%rsp)
leaq (%rax,%rcx,8), %rbp
xorl %r13d, %r13d
testq %r13, %r13
je 0x8478
movb $0x2c, (%r14)
incq %r14
incq 0x1d0(%rbx)
movq 0x8(%rbp), %rax
movq (%rax,%r13,8), %r15
movq %r15, %rdi
callq 0x41d0
movq %rax, %r12
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x43c0
addq %r12, 0x1d0(%rbx)
addq %r12, %r14
incq %r13
movl (%rbp), %eax
cmpq %rax, %r13
jb 0x8465
movl $0x1, %eax
movq 0x50(%rsp), %rdx
jmp 0x84c6
movb $0x2e, (%r14)
incq %r14
movl $0x2, %eax
movb $0x0, (%r14)
addq 0x1d0(%rbx), %rax
movq %rax, 0x1d0(%rbx)
incq %rdx
movq 0xe0(%rbx), %rcx
movl (%rcx), %ecx
movq %rax, %r14
cmpq %rcx, %rdx
jb 0x842c
movq 0x38(%rsp), %r13
movq 0x8(%r13), %rax
movq (%rax), %r12
movq %r12, %rdi
callq 0x41d0
movq %rax, %r15
testq %rax, %rax
leaq 0x8cb8b(%rip), %rax     # 0x9509c
cmoveq %rax, %r12
cmpq $0x1, %r15
adcq $0x0, %r15
movq 0x190(%rbx), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0xd005
cmpq %r15, %rax
jne 0x8726
cmpl $0x2, (%r13)
jb 0x8695
leaq 0x80(%rbx), %r15
movl $0x1, %ebp
movq 0x190(%rbx), %rdi
movl $0x1, %edx
movq %r15, %rsi
callq 0xd005
cmpq $0x1, %rax
jne 0x86ea
movq 0x8(%r13), %rax
movq %r13, %r14
movq (%rax,%rbp,8), %r13
movq %r13, %rdi
callq 0x41d0
movq %rax, %r12
testq %rax, %rax
leaq 0x8cb0f(%rip), %rax     # 0x9509c
cmoveq %rax, %r13
cmpq $0x1, %r12
adcq $0x0, %r12
movq 0x190(%rbx), %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0xd005
cmpq %r12, %rax
jne 0x86f8
incq %rbp
movl (%r14), %eax
cmpq %rax, %rbp
movq %r14, %r13
jb 0x854f
jmp 0x8695
testb $0x2, 0x1a0(%rbx)
je 0x863b
testq %r14, %r14
jne 0x85e0
movq %r15, %rdi
callq 0x41d0
movq %rax, %r14
testq %r14, %r14
leaq 0x8cab2(%rip), %rax     # 0x9509c
cmoveq %rax, %r15
cmpq $0x1, %r14
adcq $0x0, %r14
movq 0x190(%rbx), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xd005
cmpq %r14, %rax
jne 0x871a
movq %rbx, %rdi
callq 0x8732
movq 0x190(%rbx), %rdi
leaq 0x8c15d(%rip), %rsi     # 0x94784
movl $0x1, %edx
callq 0xd005
cmpq $0x1, %rax
jne 0x86ea
movq 0x38(%rsp), %rdi
jmp 0x86be
testb $0x2, 0x1a0(%rbx)
je 0x86bb
movq 0x78(%rsp), %r14
testq %r14, %r14
jne 0x8662
movq 0x40(%rsp), %rdi
callq 0x41d0
movq %rax, %r14
testq %r14, %r14
leaq 0x8ca30(%rip), %rax     # 0x9509c
movq 0x40(%rsp), %rsi
cmoveq %rax, %rsi
cmpq $0x1, %r14
adcq $0x0, %r14
movq 0x190(%rbx), %rdi
movq %r14, %rdx
callq 0xd005
cmpq %r14, %rax
jne 0x871a
movq %rbx, %rdi
callq 0x8732
movq 0x190(%rbx), %rdi
leaq 0x8c0d9(%rip), %rsi     # 0x94784
movl $0x1, %edx
callq 0xd005
cmpq $0x1, %rax
jne 0x86ea
movq %r13, %rdi
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6178
leaq 0x8ab11(%rip), %rdi     # 0x931ec
movl %r12d, %edx
movq 0x40(%rsp), %rcx
xorl %eax, %eax
callq 0x5edc
leaq 0x8ac96(%rip), %rdi     # 0x93387
movl $0x1, %esi
jmp 0x8702
leaq 0x8ac88(%rip), %rdi     # 0x93387
movq %r12, %rsi
xorl %eax, %eax
callq 0x5edc
movq 0x8(%r14), %rsi
shlq $0x3, %rsi
leaq 0x8aa98(%rip), %rdi     # 0x931b0
jmp 0x8702
leaq 0x8ac66(%rip), %rdi     # 0x93387
movq %r14, %rsi
jmp 0x8702
leaq 0x8ac5a(%rip), %rdi     # 0x93387
movq %r15, %rsi
jmp 0x8702