// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/synced_bcf_reader.c
// Function: regions_parse_line
static int _regions_parse_line(char *line, int ichr, int ifrom, int ito, char **chr, char **chr_end, hts_pos_t *from, hts_pos_t *to)
{
    if (ifrom < 0 || ito < 0) return -1;
    *chr_end = NULL;

    if ( line[0]=='#' ) return 0;

    int k,l;    // index of the start and end column of the tab-delimited file
    if ( ifrom <= ito )
        k = ifrom, l = ito;
    else
        l = ifrom, k = ito;

    int i;
    char *se = line, *ss = NULL; // start and end
    char *tmp;
    for (i=0; i<=k && *se; i++)
    {
        ss = i==0 ? se++ : ++se;
        while (*se && *se!='\t') se++;
    }
    if ( i<=k ) return -1;
    if ( k==l )
    {
        *from = *to = hts_parse_decimal(ss, &tmp, 0);
        if ( tmp==ss || (*tmp && *tmp!='\t') ) return -1;
    }
    else
    {
        if ( k==ifrom )
            *from = hts_parse_decimal(ss, &tmp, 0);
        else
            *to = hts_parse_decimal(ss, &tmp, 0);
        if ( ss==tmp || (*tmp && *tmp!='\t') ) return -1;

        for (i=k; i<l && *se; i++)
        {
            ss = ++se;
            while (*se && *se!='\t') se++;
        }
        if ( i<l ) return -1;
        if ( k==ifrom )
            *to = hts_parse_decimal(ss, &tmp, 0);
        else
            *from = hts_parse_decimal(ss, &tmp, 0);
        if ( ss==tmp || (*tmp && *tmp!='\t') ) return -1;
    }

    ss = se = line;
    for (i=0; i<=ichr && *se; i++)
    {
        if ( i>0 ) ss = ++se;
        while (*se && *se!='\t') se++;
    }
    if ( i<=ichr ) return -1;
    *chr_end = se;
    *chr = ss;
    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %ecx, %eax
orl %edx, %eax
js 0x2cd0c
movq $0x0, (%r9)
xorl %r14d, %r14d
cmpb $0x23, (%rdi)
je 0x2cd12
movl %ecx, %ebp
movl %edx, %r13d
cmpl %ecx, %edx
movl %ecx, %r12d
cmovll %edx, %r12d
movl %ecx, %r10d
cmovgl %edx, %r10d
xorl %r15d, %r15d
movq %rdi, %rbx
testl %r12d, %r12d
js 0x2cba2
cmpb $0x0, (%rbx)
je 0x2cd0c
movq %rbx, %rax
leaq 0x1(%rbx), %rcx
movq %rcx, %rbx
movzbl (%rbx), %edx
testl %edx, %edx
je 0x2cb8c
cmpl $0x9, %edx
je 0x2cb8c
incq %rbx
jmp 0x2cb7b
leal 0x1(%r15), %edx
cmpl %r12d, %r15d
movl %edx, %r15d
jne 0x2cb68
testl %r12d, %r12d
cmoveq %rax, %rcx
movq %rcx, %r15
movl %esi, 0xc(%rsp)
movq %rdi, 0x10(%rsp)
movq %r9, 0x18(%rsp)
movq %r8, 0x20(%rsp)
cmpl %ebp, %r13d
jne 0x2cc05
movq %rsp, %r14
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0xf942
movq 0x68(%rsp), %rcx
movq %rax, (%rcx)
movq 0x60(%rsp), %rcx
movq %rax, (%rcx)
movq (%r14), %rax
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
cmpq %r15, %rax
je 0x2cd12
movzbl (%rax), %eax
testl %eax, %eax
je 0x2ccbe
cmpl $0x9, %eax
je 0x2ccbe
jmp 0x2cd12
movl %r10d, 0x8(%rsp)
movq %rsp, %r14
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0xf942
cmpl %ebp, %r13d
movq 0x60(%rsp), %rsi
movq %rsi, %rcx
movq 0x68(%rsp), %rdx
cmovgq %rdx, %rcx
movq %rax, (%rcx)
movq (%r14), %rax
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
cmpq %rax, %r15
je 0x2cd12
movq %rsi, %r8
movzbl (%rax), %eax
cmpl $0x9, %eax
je 0x2cc56
testl %eax, %eax
jne 0x2cd12
movl 0x8(%rsp), %ecx
cmpl %ecx, %r12d
jge 0x2cc8a
cmpb $0x0, (%rbx)
je 0x2cd12
movq %rbx, %r15
incq %r15
movq %r15, %rbx
movzbl (%rbx), %eax
testl %eax, %eax
je 0x2cc82
cmpl $0x9, %eax
je 0x2cc82
incq %rbx
jmp 0x2cc71
incl %r12d
cmpl %ecx, %r12d
jne 0x2cc5f
movq %rsp, %rsi
movq %r15, %rdi
movq %r8, %r12
movq %rdx, %rbx
xorl %edx, %edx
callq 0xf942
cmpl %ebp, %r13d
cmovgq %r12, %rbx
movq %rax, (%rbx)
movq %rsp, %rax
movq (%rax), %rax
cmpq %rax, %r15
je 0x2cd12
movzbl (%rax), %eax
cmpl $0x9, %eax
je 0x2ccbe
testl %eax, %eax
jne 0x2cd12
movl 0xc(%rsp), %r9d
testl %r9d, %r9d
js 0x2cd24
xorl %ecx, %ecx
movq 0x10(%rsp), %r8
movq %r8, %rax
movq 0x20(%rsp), %rsi
movq 0x18(%rsp), %rdi
cmpb $0x0, (%rax)
je 0x2cd0c
leaq 0x1(%rax), %rdx
testl %ecx, %ecx
cmovneq %rdx, %rax
cmovneq %rdx, %r8
movzbl (%rax), %edx
testl %edx, %edx
je 0x2cd00
cmpl $0x9, %edx
je 0x2cd00
incq %rax
jmp 0x2ccef
leal 0x1(%rcx), %edx
cmpl %r9d, %ecx
movl %edx, %ecx
jne 0x2ccdc
jmp 0x2cd36
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%rsp), %r8
movq %r8, %rax
movq 0x20(%rsp), %rsi
movq 0x18(%rsp), %rdi
movq %rax, (%rdi)
movq %r8, (%rsi)
movl $0x1, %r14d
jmp 0x2cd12