// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/synced_bcf_reader.c
// Function: bcf_sr_next_line
int bcf_sr_next_line(bcf_srs_t *files)
{
    if ( !files->targets_als )
        return next_line(files);

    while (1)
    {
        int i, ret = next_line(files);
        if ( !ret ) return ret;

        for (i=0; i<files->nreaders; i++)
            if ( files->has_line[i] ) break;

        if ( _regions_match_alleles(files->targets, files->targets_als-1, files->readers[i].buffer[0]) ) return ret;

        // Check if there are more duplicate lines in the buffers. If not, return this line as if it
        // matched the targets, even if there is a type mismatch
        for (i=0; i<files->nreaders; i++)
        {
            if ( !files->has_line[i] ) continue;
            if ( files->readers[i].nbuffer==0 || files->readers[i].buffer[1]->pos!=files->readers[i].buffer[0]->pos ) continue;
            break;
        }
        if ( i==files->nreaders ) return ret;   // no more lines left, output even if target alleles are not of the same type
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
cmpl $0x0, 0x58(%rdi)
je 0x2b8d2
movq %rbx, %rdi
callq 0x2b909
testl %eax, %eax
je 0x2b549
movl %eax, %r14d
movl 0x30(%rbx), %eax
testl %eax, %eax
jle 0x2b552
movq 0x18(%rbx), %rdx
xorl %ecx, %ecx
cmpl $0x0, (%rdx,%rcx,4)
jne 0x2b545
incq %rcx
cmpq %rcx, %rax
jne 0x2b535
movl %eax, %ecx
movl %ecx, %eax
jmp 0x2b554
xorl %ebp, %ebp
xorl %ecx, %ecx
jmp 0x2b8b9
xorl %eax, %eax
movq 0x50(%rbx), %r15
cmpq $0x0, 0x80(%r15)
jne 0x2b8e5
movq 0x28(%rbx), %rcx
leaq (%rax,%rax,2), %rax
shlq $0x5, %rax
movq 0x30(%rcx,%rax), %rax
movq (%rax), %rdi
cmpl $0x0, 0x60(%r15)
jne 0x2b858
movl 0x58(%rbx), %eax
movq 0x20(%r15), %r12
cmpl $0x2, %eax
jl 0x2b5ae
decl %eax
xorl %ecx, %ecx
movzbl (%r12), %edx
cmpl $0x9, %edx
je 0x2b5a5
testl %edx, %edx
jne 0x2b5a7
jmp 0x2b5ae
incl %ecx
incq %r12
cmpl %eax, %ecx
jl 0x2b595
movl $0x1, 0x60(%r15)
movl $0x1, %eax
movzbl -0x1(%r12,%rax), %ecx
cmpl $0x2c, %ecx
je 0x2b5d1
testl %ecx, %ecx
je 0x2b5da
cmpl $0x9, %ecx
jne 0x2b5d5
jmp 0x2b5da
incl 0x60(%r15)
incq %rax
jmp 0x2b5bb
movq %rdi, 0x20(%rsp)
movslq 0x60(%r15), %rcx
addq %rax, %rcx
cmpq %rcx, 0x50(%r15)
jae 0x2b625
movq %rcx, %rax
shrq %rax
movabsq $0x3fffffffffffffff, %rdx # imm = 0x3FFFFFFFFFFFFFFF
cmpq %rdx, %rcx
movl $0x0, %r13d
cmovbeq %rax, %r13
addq %rcx, %r13
movq 0x58(%r15), %rdi
movq %r13, %rsi
callq 0x4870
testq %rax, %rax
je 0x2b625
movq %rax, 0x58(%r15)
movq %r13, 0x50(%r15)
movl %ebp, 0x1c(%rsp)
movq $0x0, 0x48(%r15)
movl 0x60(%r15), %edi
movslq 0x64(%r15), %rsi
cmpl %esi, %edi
jle 0x2b66d
cmpl $0x2, %edi
movl $0x1, %eax
cmovll %eax, %edi
leaq 0x40(%r15), %r9
leaq 0x89ccd(%rip), %rax     # 0xb5320
movq %rax, (%rsp)
movl $0x4, %edx
movl $0x8, %ecx
xorl %r8d, %r8d
callq 0x11efc
movl %eax, 0x64(%r15)
movl $0x0, 0x60(%r15)
xorl %ebp, %ebp
xorl %r13d, %r13d
movzbl 0x1(%r12,%r13), %eax
incq %r13
testl %eax, %eax
je 0x2b778
cmpl $0x9, %eax
je 0x2b778
cmpl $0x2c, %eax
jne 0x2b67a
movq 0x40(%r15), %rcx
movq 0x48(%r15), %rax
movq 0x58(%r15), %rdx
addq %rax, %rdx
movslq 0x60(%r15), %rsi
movq %rdx, (%rcx,%rsi,8)
leaq (%rax,%r13), %rcx
addq $0x2, %rcx
cmpq %rax, %rcx
jbe 0x2b732
cmpq %rcx, 0x50(%r15)
jae 0x2b70a
movq %rcx, %rdx
shrq %rdx
movabsq $0x3fffffffffffffff, %rsi # imm = 0x3FFFFFFFFFFFFFFF
cmpq %rsi, %rcx
movl $0x0, %ecx
cmovbeq %rdx, %rcx
addq %rax, %rcx
leaq (%rcx,%r13), %rsi
addq $0x2, %rsi
movq 0x58(%r15), %rdi
movq %rsi, 0x10(%rsp)
callq 0x4870
testq %rax, %rax
je 0x2b73d
movq %rax, 0x58(%r15)
movq 0x10(%rsp), %rax
movq %rax, 0x50(%r15)
movq 0x58(%r15), %rdi
addq 0x48(%r15), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x43c0
movq 0x48(%r15), %rax
addq %r13, %rax
movq %rax, 0x48(%r15)
movq 0x58(%r15), %rcx
movb $0x0, (%rcx,%rax)
jmp 0x2b73d
callq 0x4050
movl $0x4b, (%rax)
movq 0x40(%r15), %rax
movq 0x48(%r15), %rcx
movq 0x58(%r15), %rdx
addq %rcx, %rdx
movslq 0x60(%r15), %rsi
subq (%rax,%rsi,8), %rdx
movslq %ebp, %rax
cmpq %rax, %rdx
cmovlel %ebp, %edx
incq %rcx
movq %rcx, 0x48(%r15)
leal 0x1(%rsi), %eax
movl %eax, 0x60(%r15)
addq %r13, %r12
incq %r12
movl %edx, %ebp
jmp 0x2b677
movq 0x40(%r15), %rcx
movq 0x48(%r15), %rax
movq 0x58(%r15), %rdx
addq %rax, %rdx
movslq 0x60(%r15), %rsi
movq %rdx, (%rcx,%rsi,8)
leaq (%rax,%r13), %rcx
addq $0x2, %rcx
cmpq %rax, %rcx
jbe 0x2b80f
cmpq %rcx, 0x50(%r15)
jae 0x2b7e9
movq %rcx, %rdx
shrq %rdx
movabsq $0x3fffffffffffffff, %rsi # imm = 0x3FFFFFFFFFFFFFFF
cmpq %rsi, %rcx
movl $0x0, %ecx
cmovbeq %rdx, %rcx
addq %rax, %rcx
leaq (%rcx,%r13), %rsi
addq $0x2, %rsi
movq 0x58(%r15), %rdi
movq %rsi, 0x10(%rsp)
callq 0x4870
testq %rax, %rax
je 0x2b81a
movq %rax, 0x58(%r15)
movq 0x10(%rsp), %rax
movq %rax, 0x50(%r15)
movq 0x58(%r15), %rdi
addq 0x48(%r15), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x43c0
addq 0x48(%r15), %r13
movq %r13, 0x48(%r15)
movq 0x58(%r15), %rax
movb $0x0, (%rax,%r13)
jmp 0x2b81a
callq 0x4050
movl $0x4b, (%rax)
movq 0x58(%r15), %rax
addq 0x48(%r15), %rax
movq 0x40(%r15), %rcx
movslq 0x60(%r15), %rdx
subq (%rcx,%rdx,8), %rax
movslq %ebp, %rcx
cmpq %rcx, %rax
cmovlel %ebp, %eax
leal 0x1(%rdx), %ecx
movl %ecx, 0x60(%r15)
xorl %ecx, %ecx
cmpl $0x2, %eax
setge %cl
leal (%rcx,%rcx,2), %eax
incl %eax
movl %eax, 0x68(%r15)
movl 0x1c(%rsp), %ebp
movq 0x20(%rsp), %rdi
callq 0x4480c
xorl 0x68(%r15), %eax
xorl %ecx, %ecx
testb $0x4, %al
jne 0x2b86c
movl %r14d, %ebp
jmp 0x2b8b9
movl 0x30(%rbx), %eax
testl %eax, %eax
jle 0x2b8b0
movq 0x18(%rbx), %rdx
movl $0xe, %esi
xorl %ecx, %ecx
cmpl $0x0, (%rdx,%rcx,4)
je 0x2b8a2
movq 0x28(%rbx), %rdi
cmpl $0x0, (%rdi,%rsi,4)
je 0x2b8a2
movq -0x8(%rdi,%rsi,4), %rdi
movq (%rdi), %r8
movq 0x8(%rdi), %rdi
movq (%rdi), %rdi
cmpq (%r8), %rdi
je 0x2b8b0
incq %rcx
addq $0x18, %rsi
cmpq %rcx, %rax
jne 0x2b87e
movl %eax, %ecx
cmpl %eax, %ecx
setne %cl
cmovel %r14d, %ebp
testb %cl, %cl
jne 0x2b519
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2b909
leaq 0x89a34(%rip), %rsi     # 0xb5320
leaq 0x89a44(%rip), %rdx     # 0xb5337
movl $0x1, %edi
xorl %eax, %eax
callq 0x9e34
movl $0x1, %edi
callq 0x4600