// File: /workspace/github_c_makefile_star2_O1/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 0x18(%rsp), %r9
movq $0x0, (%r9)
leaq 0x8(%rdi), %rax
movq %rax, (%rsp)
leaq 0x98(%rsp), %rsi
leaq 0xa0(%rsp), %rdx
leaq 0x78(%rsp), %rcx
leaq 0x70(%rsp), %r8
movq %r15, %rdi
callq 0x6185
cmpl $-0x1, %eax
je 0x8691
movq (%rbx), %rax
testq %rax, %rax
je 0x7e6a
movq 0x78(%rsp), %rcx
movq 0x70(%rsp), %rdx
movq $0x0, (%rax)
movq %rcx, 0x18(%rax)
movq %rdx, 0x20(%rax)
movq 0x98(%rsp), %rsi
movq 0x78(%rsp), %r13
movq 0x70(%rsp), %r12
movq 0x1c0(%rbx), %rdi
movq 0x1c8(%rbx), %r8
movq %r13, %rdx
movq %r12, %rcx
callq 0x213a3
testl %eax, %eax
je 0x85bb
movq %r12, 0x20(%rsp)
movq %r15, 0x30(%rsp)
movq %r14, 0x80(%rsp)
movq 0xe0(%rbx), %rax
cmpl $0x0, (%rax)
movq %rbx, %rcx
movq %rbx, 0x8(%rsp)
je 0x7f3f
xorl %ebx, %ebx
movl $0x4, %ebp
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x110(%rcx), %rax
movl %ebx, (%rax,%r15,4)
movq 0x1e8(%rcx), %rax
movl %ebx, (%rax,%r14)
movq 0x1f0(%rcx), %rax
movq (%rax,%r15,8), %r12
testq %r12, %r12
je 0x7f25
movq 0x10(%r12), %rdi
testq %rdi, %rdi
je 0x7f25
movl (%r12), %eax
movl %eax, %edx
shrl $0x2, %edx
andl $-0x4, %edx
cmpl $0x10, %eax
cmovbl %ebp, %edx
movl $0xaa, %esi
callq 0x4260
movq $0x0, 0x4(%r12)
incq %r15
movq 0x8(%rsp), %rcx
movq 0xe0(%rcx), %rax
movl (%rax), %eax
addq $0x18, %r14
cmpq %rax, %r15
jb 0x7ed0
movq 0x20(%rsp), %r12
movq %r12, %rax
subq %r13, %rax
incq %rax
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x88(%rsp)
xorl %ebp, %ebp
movq 0x18(%rsp), %rax
movq %rax, 0x50(%rsp)
xorl %ebx, %ebx
movq %rcx, %r15
movq 0x1c8(%r15), %rdi
callq 0x21b6b
testl %eax, %eax
je 0x8365
movsd 0x1b0(%r15), %xmm0
ucomisd 0x8e077(%rip), %xmm0    # 0x96008
jne 0x7faa
jp 0x7faa
movsd 0x1b8(%r15), %xmm1
ucomisd 0x8e062(%rip), %xmm1    # 0x96008
jne 0x7faa
jnp 0x8025
movq 0x1c8(%r15), %rax
movq (%rax), %rcx
movq 0x8(%rax), %rax
movq %rax, %rdx
subq %rcx, %rdx
incq %rdx
xorps %xmm4, %xmm4
cvtsi2sd %rdx, %xmm4
cmpq %r12, %rax
cmovgeq %r12, %rax
cmpq %r13, %rcx
cmovleq %r13, %rcx
subq %rcx, %rax
incq %rax
xorps %xmm1, %xmm1
cvtsi2sd %rax, %xmm1
movapd %xmm1, %xmm2
divsd 0x88(%rsp), %xmm2
movsd 0x1b8(%r15), %xmm3
divsd %xmm4, %xmm1
cmpl $0x0, 0x1a8(%r15)
je 0x8011
ucomisd %xmm2, %xmm3
ja 0x801b
jmp 0x8025
ucomisd %xmm2, %xmm3
ja 0x7f6c
ucomisd %xmm1, %xmm0
ja 0x7f6c
movl %ebx, 0x10(%rsp)
movq 0x38(%r15), %rax
movq 0x1c8(%r15), %r14
movq 0x10(%r14), %rcx
movq (%rcx), %rcx
movq %rcx, 0x68(%rsp)
testq %rax, %rax
je 0x80c1
movl (%rax), %ebx
testq %rbx, %rbx
je 0x80c1
movq %rbp, 0x28(%rsp)
movq 0x58(%r15), %r12
movq 0x50(%rsp), %rax
movl (%rax), %ebp
xorl %r15d, %r15d
movslq (%r12,%r15,4), %rsi
cmpl %ebp, %esi
ja 0x86ac
movq 0x50(%rsp), %rax
movq 0x8(%rax), %rax
movq (%rax,%rsi,8), %rdi
movq 0x68(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rsp), %rcx
movq 0xf8(%rcx), %rcx
movslq (%rcx,%r15,4), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x46c0
testl %eax, %eax
jne 0x80a9
incq %r15
cmpq %r15, %rbx
jne 0x805f
movl %ebx, %r15d
cmpl %ebx, %r15d
movq 0x8(%rsp), %r15
movq 0x20(%rsp), %r12
movq 0x28(%rsp), %rbp
jne 0x8355
movq (%r15), %rbx
testq %rbx, %rbx
je 0x813b
movq (%r14), %r15
movq 0x8(%r14), %r14
cmpq %r13, %r15
cmovleq %r13, %r15
cmpq %r12, %r14
cmovgeq %r12, %r14
movq (%rbx), %rcx
movq 0x8(%rbx), %rax
addq $0x2, %rcx
movq %rcx, (%rbx)
cmpq %rax, %rcx
jb 0x8117
leaq 0x2(%rax), %rcx
movq %rcx, 0x8(%rbx)
movq 0x10(%rbx), %rdi
leaq 0x10(,%rax,8), %rsi
callq 0x4840
movq %rax, 0x10(%rbx)
testq %rax, %rax
je 0x86e0
addq %r15, %r15
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
movq %r15, -0x10(%rcx,%rax,8)
leaq 0x1(,%r14,2), %rax
movq (%rbx), %rdx
movq %rax, -0x8(%rcx,%rdx,8)
movq 0x8(%rsp), %r15
movq 0xe0(%r15), %rax
movl $0x1, %ebx
xorl %r14d, %r14d
cmpl $0x0, (%rax)
je 0x835c
xorl %edx, %edx
movq %r13, 0x48(%rsp)
movq 0x100(%r15), %rax
movl (%rax,%rdx,4), %eax
testl %eax, %eax
js 0x816f
movq 0x68(%rsp), %rcx
jmp 0x8178
movq 0xb8(%r15), %rcx
notl %eax
movq 0x8(%rcx), %rcx
movl %eax, %eax
movq (%rcx,%rax,8), %rsi
testq %rsi, %rsi
je 0x818c
cmpb $0x0, (%rsi)
jne 0x8193
leaq 0x8fec9(%rip), %rsi     # 0x9805c
cmpl $0x0, 0x198(%r15)
movq %rdx, 0x10(%rsp)
jne 0x82da
movq 0x1f0(%r15), %rax
movq (%rax,%rdx,8), %rax
movq %rax, 0x38(%rsp)
movl (%rax), %edi
testl %edi, %edi
movq %r14, 0x60(%rsp)
je 0x81ee
movb (%rsi), %cl
testb %cl, %cl
movq %rbp, 0x28(%rsp)
je 0x81f6
leaq 0x1(%rsi), %rax
movl $0x811c9dc5, %r13d      # imm = 0x811C9DC5
movzbl %cl, %ecx
xorl %r13d, %ecx
imull $0x1000193, %ecx, %r13d # imm = 0x1000193
movb (%rax), %cl
incq %rax
testb %cl, %cl
jne 0x81d6
jmp 0x81fc
xorl %r14d, %r14d
jmp 0x82b2
movl $0x811c9dc5, %r13d      # imm = 0x811C9DC5
movq %rdi, 0x58(%rsp)
decl %edi
andl %edi, %r13d
movq 0x38(%rsp), %rax
movq 0x10(%rax), %r8
movl $0x1, %r12d
movl %r13d, %r14d
movl %edi, 0x44(%rsp)
movq %r8, 0x90(%rsp)
movl %r14d, %eax
shrl $0x4, %eax
movl (%r8,%rax,4), %ebx
leal (%r14,%r14), %r15d
andl $0x1e, %r15d
movl %ebx, %eax
movl %r15d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x828d
testb $0x1, %al
jne 0x8275
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rax
movl %r14d, %ecx
movq (%rax,%rcx,8), %rdi
movq %rsi, %rbp
callq 0x46c0
movq 0x90(%rsp), %r8
movl 0x44(%rsp), %edi
movq %rbp, %rsi
movq 0x10(%rsp), %rdx
testl %eax, %eax
je 0x828d
addl %r12d, %r14d
andl %edi, %r14d
incl %r12d
cmpl %r13d, %r14d
jne 0x8224
movq 0x58(%rsp), %rdi
movl %edi, %r14d
jmp 0x829e
movl %r15d, %ecx
shrl %cl, %ebx
testb $0x3, %bl
movq 0x58(%rsp), %rdi
cmovnel %edi, %r14d
movq 0x8(%rsp), %r15
movq 0x48(%rsp), %r13
movq 0x20(%rsp), %r12
movq 0x28(%rsp), %rbp
cmpl %edi, %r14d
jne 0x8340
movq 0x38(%rsp), %rdi
movq %rsi, %r14
movl $0x1, %edx
callq 0x697f
movq %r14, %rsi
movq 0x10(%rsp), %rdx
movq 0x60(%rsp), %r14
cmpl $0x0, 0x19c(%r15)
je 0x8303
movq 0x110(%r15), %rax
movl (%rax,%rdx,4), %ecx
incl %ecx
movl %ecx, (%rax,%rdx,4)
cmpl 0x19c(%r15), %ecx
movl $0x1, %eax
cmovgel %eax, %r14d
leaq (%rdx,%rdx,2), %rdi
shlq $0x3, %rdi
addq 0x1e8(%r15), %rdi
movq %rsi, %rbx
callq 0x5f88
movq %rbx, %rdi
callq 0x41d0
movq 0x10(%rsp), %rdx
addl %eax, %ebp
incq %rdx
movq 0xe0(%r15), %rax
movl (%rax), %eax
cmpq %rax, %rdx
jb 0x815a
jmp 0x8347
movq 0x60(%rsp), %r14
jmp 0x8329
testl %r14d, %r14d
setne %r14b
movl $0x1, %ebx
jmp 0x835c
xorl %r14d, %r14d
movl 0x10(%rsp), %ebx
testb %r14b, %r14b
je 0x7f6c
movl 0x1a0(%r15), %eax
testl %ebx, %ebx
je 0x861a
testb $0x1, %al
je 0x8691
movq $0x0, 0x1d0(%r15)
leal (%rbp,%rbp,2), %eax
movq 0xe0(%r15), %rcx
movl (%rcx), %ecx
leal (%rax,%rcx,2), %eax
cmpq %rax, 0x1d8(%r15)
jae 0x83cb
movl %eax, %r14d
shrl %r14d
addq %rax, %r14
movq 0x1e0(%r15), %rdi
movq %r14, %rsi
callq 0x4840
testq %rax, %rax
je 0x83cb
movq %rax, 0x1e0(%r15)
movq %r14, 0x1d8(%r15)
movq 0xe0(%r15), %rax
cmpl $0x0, (%rax)
je 0x84ac
xorl %edx, %edx
movq 0x60(%r15), %rax
movq 0x1e0(%r15), %r14
addq 0x1d0(%r15), %r14
movq 0x18(%rsp), %rcx
movq 0x8(%rcx), %rcx
movslq (%rax,%rdx,4), %rax
movq %r14, (%rcx,%rax,8)
movq 0x1e8(%r15), %rax
leaq (%rdx,%rdx,2), %rcx
cmpl $0x0, (%rax,%rcx,8)
je 0x8480
leaq (%rax,%rcx,8), %rbx
movl $0x1, %eax
cmpl $0x0, (%rbx)
je 0x848c
movq %rdx, 0x10(%rsp)
xorl %ebp, %ebp
testq %rbp, %rbp
je 0x8439
movb $0x2c, (%r14)
incq %r14
incq 0x1d0(%r15)
movq %r15, %r13
movq 0x8(%rbx), %rax
movq (%rax,%rbp,8), %r15
movq %r15, %rdi
callq 0x41d0
movq %rax, %r12
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x43c0
addq %r12, 0x1d0(%r13)
addq %r12, %r14
incq %rbp
movl (%rbx), %eax
cmpq %rax, %rbp
movq %r13, %r15
jb 0x8426
movq 0x10(%rsp), %rdx
movl $0x1, %eax
jmp 0x848c
movb $0x2e, (%r14)
incq %r14
movl $0x2, %eax
movb $0x0, (%r14)
addq %rax, 0x1d0(%r15)
incq %rdx
movq 0xe0(%r15), %rax
movl (%rax), %eax
cmpq %rax, %rdx
jb 0x83dd
movq 0x18(%rsp), %r14
movq 0x8(%r14), %rax
movq (%rax), %r12
movq %r12, %rdi
callq 0x41d0
movq %r15, %rcx
movq %rax, %r15
testq %rax, %rax
leaq 0x8fb8c(%rip), %rax     # 0x9805c
cmoveq %rax, %r12
cmpq $0x1, %r15
adcq $0x0, %r15
movq 0x190(%rcx), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0xd0bb
cmpq %r15, %rax
jne 0x86f1
cmpl $0x2, (%r14)
jb 0x8584
movq 0x8(%rsp), %rax
leaq 0x80(%rax), %r15
movl $0x1, %ebx
movq 0x8(%rsp), %rbp
movq 0x190(%rbp), %rdi
movl $0x1, %edx
movq %r15, %rsi
callq 0xd0bb
cmpq $0x1, %rax
jne 0x86c1
movq 0x8(%r14), %rax
movq (%rax,%rbx,8), %r13
movq %r13, %rdi
callq 0x41d0
movq %rax, %r12
testq %rax, %rax
leaq 0x8fb0a(%rip), %rax     # 0x9805c
cmoveq %rax, %r13
cmpq $0x1, %r12
adcq $0x0, %r12
movq 0x190(%rbp), %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0xd0bb
cmpq %r12, %rax
jne 0x86cf
incq %rbx
movl (%r14), %eax
cmpq %rax, %rbx
jb 0x8517
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x8715
movq 0x190(%rbx), %rdi
leaq 0x8f1e5(%rip), %rsi     # 0x97784
movl $0x1, %edx
callq 0xd0bb
cmpq $0x1, %rax
jne 0x86c1
movq %r14, %rdi
jmp 0x8696
testb $0x2, 0x1a0(%rbx)
je 0x8691
testq %r14, %r14
jne 0x85d8
movq %r15, %rdi
callq 0x41d0
movq %rax, %r14
testq %r14, %r14
leaq 0x8fa7a(%rip), %rax     # 0x9805c
cmoveq %rax, %r15
cmpq $0x1, %r14
adcq $0x0, %r14
movq 0x190(%rbx), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0xd0bb
cmpq %r14, %rax
jne 0x86fd
movq %rbx, %rdi
callq 0x8715
movq 0x190(%rbx), %rdi
jmp 0x867a
testb $0x2, %al
je 0x8691
movq 0x80(%rsp), %rbx
testq %rbx, %rbx
jne 0x8638
movq 0x30(%rsp), %rdi
callq 0x41d0
movq %rax, %rbx
testq %rbx, %rbx
leaq 0x8fa1a(%rip), %rax     # 0x9805c
movq 0x30(%rsp), %rsi
cmoveq %rax, %rsi
cmpq $0x1, %rbx
adcq $0x0, %rbx
movq 0x190(%r15), %rdi
movq %rbx, %rdx
callq 0xd0bb
cmpq %rbx, %rax
jne 0x8709
movq %r15, %rdi
callq 0x8715
movq 0x190(%r15), %rdi
leaq 0x8f103(%rip), %rsi     # 0x97784
movl $0x1, %edx
callq 0xd0bb
cmpq $0x1, %rax
jne 0x86c1
movq 0x18(%rsp), %rdi
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6159
leaq 0x8db39(%rip), %rdi     # 0x961ec
movl %ebp, %edx
movq 0x30(%rsp), %rcx
xorl %eax, %eax
callq 0x5ed4
leaq 0x8dcbf(%rip), %rdi     # 0x96387
movl $0x1, %esi
jmp 0x86d9
leaq 0x8dcb1(%rip), %rdi     # 0x96387
movq %r12, %rsi
xorl %eax, %eax
callq 0x5ed4
movq 0x8(%rbx), %rsi
shlq $0x3, %rsi
leaq 0x8dac1(%rip), %rdi     # 0x961b0
jmp 0x86d9
leaq 0x8dc8f(%rip), %rdi     # 0x96387
movq %r15, %rsi
jmp 0x86d9
leaq 0x8dc83(%rip), %rdi     # 0x96387
movq %r14, %rsi
jmp 0x86d9
leaq 0x8dc77(%rip), %rdi     # 0x96387
movq %rbx, %rsi
jmp 0x86d9