// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/annot-tsv.c
// Function: parse_tab_with_payload
int parse_tab_with_payload(const char *line, char **chr_beg, char **chr_end, hts_pos_t *beg, hts_pos_t *end, void *payload, void *usr)
{
    static int beg_end_warned = 0;

    if ( line[0]=='#' )
    {
        *((cols_t**)payload) = NULL;
        return -1;
    }

    dat_t *dat = (dat_t*) usr;

    cols_t *cols = cols_split(line, NULL, dat->delim);
    *((cols_t**)payload) = cols;

    if ( cols->n < dat->core_idx[0] ) error("Expected at least %d columns, found %d: %s\n",dat->core_idx[0]+1,cols->n,line);
    *chr_beg = cols->off[ dat->core_idx[0] ];
    *chr_end = *chr_beg + strlen(*chr_beg) - 1;

    if ( cols->n < dat->core_idx[1] ) error("Expected at least %d columns, found %d: %s\n",dat->core_idx[1]+1,cols->n,line);
    char *tmp, *ptr = cols->off[ dat->core_idx[1] ];
    *beg = strtod(ptr, &tmp);
    if ( tmp==ptr ) error("Expected numeric value, found \"%s\": %s\n",ptr,line);

    if ( cols->n < dat->core_idx[2] ) error("Expected at least %d columns, found %d: %s\n",dat->core_idx[2]+1,cols->n,line);
    ptr = cols->off[ dat->core_idx[2] ];
    *end = strtod(ptr, &tmp);
    if ( tmp==ptr ) error("Expected numeric value, found \"%s\": %s\n",ptr,line);

    // NB: for indexing we leave the coordinates 1-based when 1-based, otherwise 0-coordinate would underflow. This
    // means the biggest hts coordinate will overflow, which is less common than the 0 underflow. This does not affect the output,
    // only indexing.
    // The following code will make beg+=1 for BED file (-C 01)
    (*beg) -= dat->coor_base[0] - 1;
    (*end) -= dat->coor_base[1] - 1;

    if ( *end < *beg )
    {
        if ( !beg_end_warned )
            fprintf(stderr,"Warning: the start coordinate is bigger than the end coordinate:\n\t%s\nThis message is printed only once.\n",line);
        beg_end_warned = 1;
        hts_pos_t tmp = *beg; *beg = *end; *end = tmp;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %rbp
cmpb $0x23, (%rdi)
jne 0x61c5
movq $0x0, (%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x62e4
movq %rcx, %r15
movq %rdx, %r13
movq %rsi, %rbx
movq %r8, 0x8(%rsp)
movq 0x50(%rsp), %r14
movsbl 0x78(%r14), %edx
movq %rdi, (%rsp)
xorl %esi, %esi
callq 0x5dec
movq %rax, %r12
movq %rax, (%rbp)
movl (%rax), %ebp
movq 0x48(%r14), %rax
movslq (%rax), %rsi
cmpl %esi, %ebp
jb 0x6318
movq 0x8(%r12), %rax
movq (%rax,%rsi,8), %r14
movq %r14, (%rbx)
movq %r14, %rdi
callq 0x41d0
addq %r14, %rax
decq %rax
movq %rax, (%r13)
movq 0x50(%rsp), %r13
movq 0x48(%r13), %rax
movslq 0x4(%rax), %rsi
cmpl %esi, %ebp
jb 0x6318
movq 0x8(%r12), %rax
movq (%rax,%rsi,8), %rbx
leaq 0x10(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4350
cvttsd2si %xmm0, %rax
movq %rax, (%r15)
cmpq %rbx, (%r14)
je 0x6325
movl (%r12), %edx
movq 0x48(%r13), %rax
movslq 0x8(%rax), %rsi
cmpl %esi, %edx
jb 0x633a
movq 0x8(%r12), %rax
movq (%rax,%rsi,8), %rbx
leaq 0x10(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4350
cvttsd2si %xmm0, %rax
movq 0x8(%rsp), %r12
movq %rax, (%r12)
cmpq %rbx, (%r14)
je 0x6325
movslq 0x70(%r13), %rax
movq (%r15), %rcx
subq %rax, %rcx
incq %rcx
movq %rcx, (%r15)
movslq 0x74(%r13), %rcx
movq (%r12), %rax
subq %rcx, %rax
incq %rax
movq %rax, (%r12)
movq (%r15), %rcx
cmpq %rcx, %rax
jge 0x62e2
cmpb $0x0, 0xb04d2(%rip)     # 0xb67a4
je 0x62f3
movb $0x1, 0xb04c9(%rip)     # 0xb67a4
movq %rax, (%r15)
movq %rcx, (%r12)
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xafcde(%rip), %rax     # 0xb5fd8
movq (%rax), %rdi
leaq 0x8cf3c(%rip), %rsi     # 0x93240
movq (%rsp), %rdx
xorl %eax, %eax
callq 0x4700
movq (%r15), %rcx
movq (%r12), %rax
jmp 0x62d4
incl %esi
leaq 0x8cecb(%rip), %rdi     # 0x931ec
movl %ebp, %edx
jmp 0x6343
leaq 0x8ceec(%rip), %rdi     # 0x93218
movq %rbx, %rsi
movq (%rsp), %rdx
xorl %eax, %eax
callq 0x5edc
incl %esi
leaq 0x8cea9(%rip), %rdi     # 0x931ec
movq (%rsp), %rcx
xorl %eax, %eax
callq 0x5edc