// File: /workspace/github_cpp_makefile_star2_O2/kingufl[P]Rmapper/src/buildgraph.cpp
// Function: extract_bilabels(int, int, int, std::vector<int, std::allocator<int>>&, std::vector<int, std::allocator<int>>&, int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int)
vector<bilabel> extract_bilabels(int kmer_size, int dsize, int start_locus, vector<int>& temp, vector<int>& temp_sum, int orientation, int chromosome, string rmapname,int rmap_id){

    vector<bilabel> retvar;
    int locus=start_locus;

    for(int i=0;i<temp.size()-(2*kmer_size+3)+1;i++){

        bilabel tembi;

        tembi.rmap_from=rmapname;
        tembi.rmap_id=rmap_id;
        tembi.i_rmap=i;
        tembi.chromosome=chromosome;
        tembi.locus=locus;
        tembi.orientation=orientation;

        int k1_end=i+kmer_size-1;
        int p_rmap=k1_end+1;
        int q_rmap=p_rmap;

        if(i>0)
            tembi.sums[0]=temp_sum[k1_end]-temp_sum[i-1];
        else
            tembi.sums[0]=temp_sum[k1_end];


        while(temp_sum[q_rmap]-temp_sum[k1_end]<dsize){
            q_rmap++;
            if(q_rmap+kmer_size>=temp.size())
                return(retvar);
        }

        tembi.sums[1]=temp_sum[q_rmap]-temp_sum[k1_end];
        tembi.q_rmap=q_rmap;
        tembi.sums[2]=temp_sum[q_rmap+kmer_size]-temp_sum[q_rmap];
        locus+=(temp[i]);

        point_t thisbib=uncover_frags(kmer_size,tembi.i_rmap,tembi.q_rmap, temp);

        retvar.push_back(tembi);

    }

    return(retvar);


}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %r9, -0x58(%rbp)
movq %r8, %r15
movl %ecx, -0x2c(%rbp)
movl %edx, %r13d
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq %rdi, -0x38(%rbp)
andq $0x0, 0x10(%rdi)
pushq $-0x3
popq %rcx
subl %esi, %ecx
subl %esi, %ecx
movslq %ecx, %rax
incq %rax
movq %rax, -0x60(%rbp)
movslq %esi, %r12
xorl %r14d, %r14d
movq %rsi, -0x48(%rbp)
movl %esi, %ebx
movq $0x0, -0x40(%rbp)
movq %r12, -0x50(%rbp)
movq 0x8(%r15), %rax
subq (%r15), %rax
sarq $0x2, %rax
addq -0x60(%rbp), %rax
cmpq %r14, %rax
jbe 0x6707
leaq -0xa0(%rbp), %rax
movq %rax, -0xb0(%rbp)
andq $0x0, -0xa8(%rbp)
movb $0x0, -0xa0(%rbp)
xorps %xmm0, %xmm0
leaq -0xb0(%rbp), %rdi
movups %xmm0, 0x38(%rdi)
andq $0x0, 0x48(%rdi)
movq 0x20(%rbp), %rsi
callq 0x3130
movl 0x28(%rbp), %eax
movl %eax, -0x90(%rbp)
movl %r14d, -0x8c(%rbp)
movl 0x18(%rbp), %eax
movl %eax, -0xb4(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0xbc(%rbp)
movl 0x10(%rbp), %eax
movl %eax, -0xb8(%rbp)
movq -0x58(%rbp), %rax
movq (%rax), %rax
leaq (%rax,%r14,4), %rcx
movl -0x4(%rcx,%r12,4), %edx
testq %r14, %r14
je 0x6644
subl -0x4(%rax,%r14,4), %edx
movl %edx, -0x84(%rbp)
movl -0x4(%rcx,%r12,4), %edx
jmp 0x664a
movl %edx, -0x84(%rbp)
movslq %ebx, %rsi
leaq (%r12,%rsi), %r8
shlq $0x2, %rsi
movq (%r15), %rdi
movq 0x8(%r15), %r9
subq %rdi, %r9
sarq $0x2, %r9
addq %rax, %rsi
movl %ebx, %ecx
movl (%rsi), %r12d
subl %edx, %r12d
cmpl %r13d, %r12d
jge 0x6689
addq $0x4, %rsi
incl %ecx
incq %r8
cmpq %r8, %r9
ja 0x6668
movb $0x1, %al
movq %rax, -0x40(%rbp)
jmp 0x66da
movl %r12d, -0x80(%rbp)
movl %ecx, -0x88(%rbp)
movslq %r8d, %rdx
movl (%rax,%rdx,4), %eax
subl (%rsi), %eax
movl %eax, -0x7c(%rbp)
movl -0x2c(%rbp), %eax
addl (%rdi,%r14,4), %eax
movl %eax, -0x2c(%rbp)
leaq -0xd8(%rbp), %rdi
movq -0x48(%rbp), %rsi
movl %r14d, %edx
movq %r15, %r8
callq 0x63ba
movq -0x38(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0xb78a
leaq -0xd8(%rbp), %rdi
callq 0x552c
leaq -0xc0(%rbp), %rdi
callq 0xb766
incq %r14
incl %ebx
cmpl %r13d, %r12d
movq -0x50(%rbp), %r12
jge 0x65a1
testb $0x1, -0x40(%rbp)
jne 0x6707
movq -0x38(%rbp), %rdi
callq 0xb7c6
movq -0x38(%rbp), %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0xd8(%rbp), %rdi
callq 0x552c
jmp 0x6733
jmp 0x6730
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
callq 0xb766
movq -0x38(%rbp), %rdi
callq 0xb7c6
movq %rbx, %rdi
callq 0x3380