// File: /workspace/github_cpp_makefile_star2_O1/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
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, -0x60(%rbp)
addq %rcx, %rax
je 0x6b6a
movq %r9, %r12
movq %r8, %r15
movl %edx, %r13d
movq -0x48(%rbp), %rax
movslq %eax, %rcx
movq %rcx, -0x50(%rbp)
xorl %ebx, %ebx
movl %eax, %r14d
movq $0x0, -0x40(%rbp)
movq %r9, -0x58(%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 %ebx, -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 -0x50(%rbp), %rax
leaq (%rbx,%rax), %rcx
movq (%r12), %rdx
movl -0x4(%rdx,%rcx,4), %eax
testq %rbx, %rbx
je 0x6a66
subl -0x4(%rdx,%rbx,4), %eax
movl %eax, -0x84(%rbp)
movslq %r14d, %rax
movq -0x50(%rbp), %rdx
addq %rax, %rdx
shlq $0x2, %rax
movq (%r12), %rsi
movq 0x8(%r15), %rdi
subq (%r15), %rdi
movl -0x4(%rsi,%rcx,4), %r8d
sarq $0x2, %rdi
addq %rsi, %rax
movl %r14d, %ecx
movl (%rax), %r12d
subl %r8d, %r12d
cmpl %r13d, %r12d
jge 0x6ab5
addq $0x4, %rax
incl %ecx
incq %rdx
cmpq %rdx, %rdi
ja 0x6a94
movb $0x1, %al
movq %rax, -0x40(%rbp)
jmp 0x6b0c
movl %r12d, -0x80(%rbp)
movl %ecx, -0x88(%rbp)
movslq %edx, %rdx
movl (%rsi,%rdx,4), %edx
subl (%rax), %edx
movl %edx, -0x7c(%rbp)
movq (%r15), %rax
movl -0x2c(%rbp), %edx
addl (%rax,%rbx,4), %edx
movl %edx, -0x2c(%rbp)
leaq -0xd8(%rbp), %rdi
movq -0x48(%rbp), %rsi
movl %ebx, %edx
movq %r15, %r8
callq 0x67d7
movq -0x38(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0xe608
movq -0xd8(%rbp), %rdi
testq %rdi, %rdi
je 0x6b0c
callq 0x3230
movq -0x78(%rbp), %rdi
testq %rdi, %rdi
je 0x6b1a
callq 0x3230
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x6b32
callq 0x3230
cmpl %r13d, %r12d
jl 0x6b5b
incq %rbx
movq 0x8(%r15), %rax
subq (%r15), %rax
sarq $0x2, %rax
addq -0x60(%rbp), %rax
incl %r14d
cmpq %rbx, %rax
movq -0x58(%rbp), %r12
ja 0x69ea
jmp 0x6b6a
testb $0x1, -0x40(%rbp)
jne 0x6b6a
movq -0x38(%rbp), %rdi
callq 0xe640
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 0xe5d6
movq -0x38(%rbp), %rdi
callq 0xe640
movq %rbx, %rdi
callq 0x33d0