// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/synced_bcf_reader.c
// Function: next_line
static int next_line(bcf_srs_t *files)
{
    const char *chr = NULL;
    hts_pos_t min_pos = HTS_POS_MAX;

    // Loop until next suitable line is found or all readers have finished
    while ( 1 )
    {
        // Get all readers ready for the next region.
        if ( files->regions && _readers_next_region(files)<0 ) break;

        // Fill buffers and find the minimum chromosome
        int i, min_rid = INT32_MAX;
        for (i=0; i<files->nreaders; i++)
        {
            _reader_fill_buffer(files, &files->readers[i]);
            if ( files->require_index==ALLOW_NO_IDX_ )
            {
                if ( !files->readers[i].nbuffer ) continue;
                if ( min_rid > files->readers[i].buffer[1]->rid ) min_rid = files->readers[i].buffer[1]->rid;
            }
        }

        for (i=0; i<files->nreaders; i++)
        {
            if ( !files->readers[i].nbuffer ) continue;
            if ( files->require_index==ALLOW_NO_IDX_ && min_rid != files->readers[i].buffer[1]->rid ) continue;

            // Update the minimum coordinate
            if ( min_pos > files->readers[i].buffer[1]->pos )
            {
                min_pos = files->readers[i].buffer[1]->pos;
                chr = bcf_seqname(files->readers[i].header, files->readers[i].buffer[1]);
                assert(chr);
                bcf_sr_sort_set_active(&BCF_SR_AUX(files)->sort, i);
            }
            else if ( min_pos==files->readers[i].buffer[1]->pos )
                bcf_sr_sort_add_active(&BCF_SR_AUX(files)->sort, i);
        }
        if ( min_pos==HTS_POS_MAX )
        {
            if ( !files->regions ) break;
            continue;
        }

        // Skip this position if not present in targets
        if ( files->targets )
        {
            int match = 0;
            for (i=0; i<files->nreaders; i++)
            {
                if ( !files->readers[i].nbuffer || files->readers[i].buffer[1]->pos!=min_pos ) continue;
                hts_pos_t beg, end;
                if ( BCF_SR_AUX(files)->targets_overlap==0 )
                    beg = end = min_pos;
                else if ( BCF_SR_AUX(files)->targets_overlap==1 )
                {
                    beg = min_pos;
                    end = min_pos + files->readers[i].buffer[1]->rlen - 1;
                }
                else if ( BCF_SR_AUX(files)->targets_overlap==2 )
                    _set_variant_boundaries(files->readers[i].buffer[1], &beg,&end);
                else
                {
                    hts_log_error("This should never happen, just to keep clang compiler happy: %d",BCF_SR_AUX(files)->targets_overlap);
                    exit(1);
                }
                int overlap = bcf_sr_regions_overlap(files->targets, chr, beg, end)==0 ? 1 : 0;
                if ( (!files->targets_exclude && !overlap) || (files->targets_exclude && overlap) )
                    _reader_shift_buffer(&files->readers[i]);
                else
                    match = 1;
            }
            if ( !match )
            {
                min_pos = HTS_POS_MAX;
                chr = NULL;
                continue;
            }
        }
        break;  // done: chr and min_pos are set
    }
    if ( !chr ) return 0;

    return bcf_sr_sort_next(files, &BCF_SR_AUX(files)->sort, chr, min_pos);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movabsq $0x7fffffff7fffffff, %rax # imm = 0x7FFFFFFF7FFFFFFF
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x39bf0
movq -0x10(%rbp), %rdi
callq 0x3bea0
cmpl $0x0, %eax
jge 0x39bf0
jmp 0x3a031
movl $0x7fffffff, -0x28(%rbp) # imm = 0x7FFFFFFF
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x30(%rcx), %eax
jge 0x39ca5
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
movslq -0x24(%rbp), %rax
imulq $0x60, %rax, %rax
addq %rax, %rsi
callq 0x3c030
movq -0x10(%rbp), %rax
cmpl $0x2, 0x10(%rax)
jne 0x39c95
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x38(%rax)
jne 0x39c4f
jmp 0x39c97
movl -0x28(%rbp), %eax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
movslq -0x24(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rcx
movq 0x30(%rcx), %rcx
movq 0x8(%rcx), %rcx
cmpl 0x10(%rcx), %eax
jle 0x39c93
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movq 0x30(%rax), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %eax
movl %eax, -0x28(%rbp)
jmp 0x39c95
jmp 0x39c97
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x39bfe
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x30(%rcx), %eax
jge 0x39e17
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x38(%rax)
jne 0x39cda
jmp 0x39e09
movq -0x10(%rbp), %rax
cmpl $0x2, 0x10(%rax)
jne 0x39d0c
movl -0x28(%rbp), %eax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
movslq -0x24(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rcx
movq 0x30(%rcx), %rcx
movq 0x8(%rcx), %rcx
cmpl 0x10(%rcx), %eax
je 0x39d0c
jmp 0x39e09
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
movslq -0x24(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rcx
movq 0x30(%rcx), %rcx
movq 0x8(%rcx), %rcx
cmpq (%rcx), %rax
jle 0x39dce
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movq 0x30(%rax), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movq 0x30(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x3c6a0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x39d9a
jmp 0x39db9
leaq 0xd8540(%rip), %rdi     # 0x1122e1
leaq 0xd837b(%rip), %rsi     # 0x112123
movl $0x32b, %edx            # imm = 0x32B
leaq 0xd8531(%rip), %rcx     # 0x1122e5
callq 0x42d0
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rdi
movl -0x24(%rbp), %esi
callq 0xdf650
jmp 0x39e07
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
movslq -0x24(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rcx
movq 0x30(%rcx), %rcx
movq 0x8(%rcx), %rcx
cmpq (%rcx), %rax
jne 0x39e05
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rdi
movl -0x24(%rbp), %esi
callq 0xdf710
jmp 0x39e07
jmp 0x39e09
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x39cac
movabsq $0x7fffffff7fffffff, %rax # imm = 0x7FFFFFFF7FFFFFFF
cmpq %rax, -0x20(%rbp)
jne 0x39e3c
movq -0x10(%rbp), %rax
cmpq $0x0, 0x48(%rax)
jne 0x39e37
jmp 0x3a031
jmp 0x39bd2
movq -0x10(%rbp), %rax
cmpq $0x0, 0x50(%rax)
je 0x3a02f
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x30(%rcx), %eax
jge 0x3a00c
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x38(%rax)
je 0x39ea6
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movq 0x30(%rax), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
cmpq -0x20(%rbp), %rax
je 0x39eab
jmp 0x39ffe
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rax
cmpl $0x0, 0x1dc(%rax)
jne 0x39ed0
movq -0x20(%rbp), %rax
movq %rax, -0x40(%rbp)
movq %rax, -0x38(%rbp)
jmp 0x39f90
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rax
cmpl $0x1, 0x1dc(%rax)
jne 0x39f19
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rcx
movslq -0x24(%rbp), %rdx
imulq $0x60, %rdx, %rdx
addq %rdx, %rcx
movq 0x30(%rcx), %rcx
movq 0x8(%rcx), %rcx
addq 0x8(%rcx), %rax
subq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x39f8e
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rax
cmpl $0x2, 0x1dc(%rax)
jne 0x39f57
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movq 0x30(%rax), %rax
movq 0x8(%rax), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x3c6f0
jmp 0x39f8c
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rax
movl 0x1dc(%rax), %ecx
movl $0x1, %edi
leaq 0xd838c(%rip), %rsi     # 0x112300
leaq 0xd838f(%rip), %rdx     # 0x11230a
movb $0x0, %al
callq 0xa790
movl $0x1, %edi
callq 0x45d0
jmp 0x39f8e
jmp 0x39f90
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rdi
movq -0x18(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq -0x40(%rbp), %rcx
callq 0x3bca0
movl %eax, %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovel %ecx, %eax
movl %eax, -0x44(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x5c(%rax)
jne 0x39fcb
cmpl $0x0, -0x44(%rbp)
je 0x39fdb
movq -0x10(%rbp), %rax
cmpl $0x0, 0x5c(%rax)
je 0x39ff5
cmpl $0x0, -0x44(%rbp)
je 0x39ff5
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
movslq -0x24(%rbp), %rax
imulq $0x60, %rax, %rax
addq %rax, %rdi
callq 0x3c860
jmp 0x39ffc
movl $0x1, -0x2c(%rbp)
jmp 0x39ffe
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x39e59
cmpl $0x0, -0x2c(%rbp)
jne 0x3a02d
movabsq $0x7fffffff7fffffff, %rax # imm = 0x7FFFFFFF7FFFFFFF
movq %rax, -0x20(%rbp)
movq $0x0, -0x18(%rbp)
jmp 0x39bd2
jmp 0x3a02f
jmp 0x3a031
cmpq $0x0, -0x18(%rbp)
jne 0x3a041
movl $0x0, -0x4(%rbp)
jmp 0x3a060
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0xdf7e0
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)