// File: /workspace/github_cpp_makefile_star2_O3/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, -0x60(%rbp)
movl %ecx, -0x2c(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq %rdi, -0x38(%rbp)
movq $0x0, 0x10(%rdi)
movq %rsi, -0x48(%rbp)
movl $0xfffffffd, %ecx       # imm = 0xFFFFFFFD
subl %esi, %ecx
subl %esi, %ecx
movslq %ecx, %rcx
incq %rcx
movq 0x8(%r8), %rax
subq (%r8), %rax
sarq $0x2, %rax
movq %rcx, -0x58(%rbp)
addq %rcx, %rax
je 0x6b6a
movq %r8, %r15
movl %edx, %r13d
movq -0x48(%rbp), %rax
movslq %eax, %r12
xorl %r14d, %r14d
movl %eax, %ebx
movq $0x0, -0x40(%rbp)
movq %r12, -0x50(%rbp)
leaq -0xa0(%rbp), %rax
movq %rax, -0xb0(%rbp)
xorl %eax, %eax
movq %rax, -0xa8(%rbp)
movb $0x0, -0xa0(%rbp)
leaq -0xb0(%rbp), %rdi
movq %rax, 0x48(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rdi)
movq 0x20(%rbp), %rsi
callq 0x3110
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 -0x60(%rbp), %rax
movq (%rax), %rax
leaq (%rax,%r14,4), %rcx
movl -0x4(%rcx,%r12,4), %edx
testq %r14, %r14
je 0x6a72
subl -0x4(%rax,%r14,4), %edx
movl %edx, -0x84(%rbp)
movl -0x4(%rcx,%r12,4), %edx
jmp 0x6a78
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 0x6ab7
addq $0x4, %rsi
incl %ecx
incq %r8
cmpq %r8, %r9
ja 0x6a96
movb $0x1, %al
movq %rax, -0x40(%rbp)
jmp 0x6b0d
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 0x67e3
movq -0x38(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0xe55a
movq -0xd8(%rbp), %rdi
testq %rdi, %rdi
je 0x6b0d
callq 0x3230
movq -0x78(%rbp), %rdi
testq %rdi, %rdi
je 0x6b1b
callq 0x3230
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x6b33
callq 0x3230
cmpl %r13d, %r12d
jl 0x6b5b
incq %r14
movq 0x8(%r15), %rax
subq (%r15), %rax
sarq $0x2, %rax
addq -0x58(%rbp), %rax
incl %ebx
cmpq %r14, %rax
movq -0x50(%rbp), %r12
ja 0x69e7
jmp 0x6b6a
testb $0x1, -0x40(%rbp)
jne 0x6b6a
movq -0x38(%rbp), %rdi
callq 0xe592
movq -0x38(%rbp), %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
testq %rdi, %rdi
je 0x6b9b
callq 0x3230
jmp 0x6b9b
jmp 0x6b98
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
callq 0xe528
movq -0x38(%rbp), %rdi
callq 0xe592
movq %rbx, %rdi
callq 0x33d0