// File: /workspace/github_c_makefile_star2_O3/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 0x2bfd2
movq $0x0, (%r9)
movb (%rdi), %al
xorl %r14d, %r14d
cmpb $0x23, %al
je 0x2bfd8
movl %ecx, %ebp
movl %edx, %r13d
cmpl %ecx, %edx
movl %ecx, %r12d
cmovll %edx, %r12d
movl %ecx, %r11d
cmovgl %edx, %r11d
xorl %r15d, %r15d
movq %rdi, %rbx
testl %r12d, %r12d
js 0x2be65
testb %al, %al
je 0x2bfd2
movq %rbx, %rcx
leaq 0x1(%rbx), %rdx
movq %rdx, %rbx
movzbl (%rbx), %eax
testl %eax, %eax
je 0x2be4f
cmpl $0x9, %eax
je 0x2be4f
incq %rbx
jmp 0x2be3e
leal 0x1(%r15), %r10d
cmpl %r12d, %r15d
movl %r10d, %r15d
jne 0x2be2c
testl %r12d, %r12d
cmoveq %rcx, %rdx
movq %rdx, %r15
movl %esi, 0xc(%rsp)
movq %rdi, 0x10(%rsp)
movq %r9, 0x18(%rsp)
movq %r8, 0x20(%rsp)
cmpl %ebp, %r13d
jne 0x2bec8
movq %rsp, %r14
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0xf673
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 0x2bfd8
movzbl (%rax), %eax
testl %eax, %eax
je 0x2bf82
cmpl $0x9, %eax
je 0x2bf82
jmp 0x2bfd8
movl %r11d, 0x8(%rsp)
movq %rsp, %r14
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0xf673
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 0x2bfd8
movq %rsi, %r8
movzbl (%rax), %eax
cmpl $0x9, %eax
je 0x2bf19
testl %eax, %eax
jne 0x2bfd8
movl 0x8(%rsp), %ecx
cmpl %ecx, %r12d
jge 0x2bf4e
movb (%rbx), %al
testb %al, %al
je 0x2bfd8
movq %rbx, %r15
incq %r15
movq %r15, %rbx
movzbl (%rbx), %eax
testl %eax, %eax
je 0x2bf46
cmpl $0x9, %eax
je 0x2bf46
incq %rbx
jmp 0x2bf35
incl %r12d
cmpl %ecx, %r12d
jne 0x2bf24
movq %rsp, %rsi
movq %r15, %rdi
movq %r8, %r12
movq %rdx, %rbx
xorl %edx, %edx
callq 0xf673
cmpl %ebp, %r13d
cmovgq %r12, %rbx
movq %rax, (%rbx)
movq %rsp, %rax
movq (%rax), %rax
cmpq %rax, %r15
je 0x2bfd8
movzbl (%rax), %eax
cmpl $0x9, %eax
je 0x2bf82
testl %eax, %eax
jne 0x2bfd8
movl 0xc(%rsp), %r10d
testl %r10d, %r10d
js 0x2bfea
movq 0x10(%rsp), %r9
movb (%r9), %dl
xorl %ecx, %ecx
movq %r9, %rax
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %r8
testb %dl, %dl
je 0x2bfd2
leaq 0x1(%rax), %rdx
testl %ecx, %ecx
cmovneq %rdx, %rax
cmovneq %rdx, %r9
movzbl (%rax), %edx
testl %edx, %edx
je 0x2bfc6
cmpl $0x9, %edx
je 0x2bfc6
incq %rax
jmp 0x2bfb5
leal 0x1(%rcx), %esi
cmpl %r10d, %ecx
movl %esi, %ecx
jne 0x2bfa3
jmp 0x2bffc
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), %r9
movq %r9, %rax
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %r8
movq %rax, (%r8)
movq %r9, (%rdi)
movl $0x1, %r14d
jmp 0x2bfd8