// File: /workspace/github_cpp_makefile_star2_O3/readmapping[P]alfalfa/src/main.cpp
// Function: unpaired_thread(mapOptions_t const*)
void unpaired_thread(const mapOptions_t * opt) {
    long total_seq_cnt = 0;
    long seq_mapped = 0;
    long alignments_printed = 0;
#ifndef NDEBUG
    if (opt->alnOptions.debugFile != NULL)
        fprintf(opt->alnOptions.debugFile, "#ALN\n");
#endif
    //init fields
    vector<read_t> reads;
    int bpCount = opt->query_threads * BUFFER_SIZE;
    //read reads
    while(readBatch(bpCount, reads) > 0){// have reads
        //count reads, init fields
        int seq_cnt = reads.size();
        total_seq_cnt += seq_cnt;
        cerr << "Progress " << seq_cnt << " reads ..." << endl;
        clock_t start = clock();
        unpaired_data unpairedData(opt, sa, &reads);
        //parallel loop
        kt_for(opt->query_threads, seq_cnt, map_unpaired, &unpairedData);
        //output
        for(int i = 0; i < reads.size(); i++){
            if (reads[i].alignments.empty())
                fprintf(outfile, "%s", reads[i].emptyAlingment(false, false, true).c_str());
            else{
                seq_mapped++;
                alignments_printed += min(reads[i].alignmentCount(), opt->alnOptions.alignmentCount);
                for (int k = 0; k < min(reads[i].alignmentCount(), opt->alnOptions.alignmentCount); k++)
                    fprintf(outfile, "%s", reads[i].printUnpairedAlignment(k).c_str());
            }
        }
        reads.clear();
        clock_t end = clock();
        double cpu_time = (double) (end - start) / CLOCKS_PER_SEC;
        cerr << "Progress " << seq_cnt << " reads: done in " << cpu_time << " seconds" << endl;
    }
    //clean up
    reads.clear();
    //report statistics
    printf("sequences read: %ld\n", total_seq_cnt);
    printf("sequences mapped: %ld\n", seq_mapped);
    printf("alignments printed: %ld\n", alignments_printed);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdi, %r12
xorpd %xmm0, %xmm0
movq %rsp, %rbx
movapd %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
imull $0x989680, 0x8(%rdi), %eax # imm = 0x989680
movl %eax, 0x34(%rsp)
movq $0x0, 0x40(%rsp)
movq 0x4b366(%rip), %r14     # 0x53fe8
leaq 0x48(%rsp), %rbp
movq $0x0, 0x38(%rsp)
xorl %r13d, %r13d
movl 0x34(%rsp), %edi
movq %rbx, %rsi
callq 0x8b8c
testl %eax, %eax
jle 0x8f87
movq 0x8(%rsp), %r15
subq (%rsp), %r15
movl $0x9, %edx
movq %r14, %rdi
leaq 0x373c5(%rip), %rsi     # 0x40084
callq 0x7340
movq %r15, %rsi
sarq $0x4, %rsi
movabsq $0x4ec4ec4ec4ec4ec5, %rax # imm = 0x4EC4EC4EC4EC4EC5
imulq %rax, %rsi
movq %r14, %rdi
movq %rsi, 0x28(%rsp)
callq 0x75d0
movq %rax, %r15
movl $0xa, %edx
movq %rax, %rdi
leaq 0x37396(%rip), %rsi     # 0x4008e
callq 0x7340
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %r15, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x71d0
callq 0x71b0
movq %rax, 0x20(%rsp)
movq 0x4b6d3(%rip), %rax     # 0x54408
movq %r12, 0x70(%rsp)
movq %rax, 0x78(%rsp)
movq %rbx, 0x80(%rsp)
movl 0x8(%r12), %edi
movq 0x28(%rsp), %rsi
leaq 0x2c7(%rip), %rdx       # 0x901f
leaq 0x70(%rsp), %rcx
callq 0x3f8a8
movq %r13, 0x68(%rsp)
movq (%rsp), %rbx
movq 0x8(%rsp), %r14
cmpq %rbx, %r14
je 0x8ea9
xorl %r13d, %r13d
imulq $0xd0, %r13, %r14
leaq (%rbx,%r14), %rsi
movq 0xb0(%rbx,%r14), %rcx
movq 0xb8(%rbx,%r14), %rax
cmpq %rax, %rcx
je 0x8e3a
incq 0x38(%rsp)
subq %rcx, %rax
shrq $0x3, %rax
movl 0x150(%r12), %ecx
cmpl %eax, %ecx
cmovll %ecx, %eax
cltq
addq %rax, 0x40(%rsp)
testl %eax, %eax
jle 0x8e80
xorl %r15d, %r15d
movq 0x4b63e(%rip), %rbx     # 0x54410
movq %rbp, %rdi
movl %r15d, %edx
callq 0xb30c
movq 0x48(%rsp), %rdi
movq %rbx, %rsi
callq 0x7330
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x8e06
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x72f0
movq (%rsp), %rbx
movq 0xb8(%rbx,%r14), %rax
subq 0xb0(%rbx,%r14), %rax
shrq $0x3, %rax
movl 0x150(%r12), %ecx
cmpl %eax, %ecx
jl 0x8e2c
movl %eax, %ecx
incl %r15d
leaq (%rbx,%r14), %rsi
cmpl %ecx, %r15d
jl 0x8dcb
jmp 0x8e80
movq 0x4b5cf(%rip), %r15     # 0x54410
movq %rbp, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
movl $0x1, %r8d
callq 0xb1be
movq 0x48(%rsp), %rdi
movq %r15, %rsi
callq 0x7330
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x8e7c
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x72f0
movq (%rsp), %rbx
incq %r13
movq 0x8(%rsp), %r14
movq %r14, %rax
subq %rbx, %rax
sarq $0x4, %rax
movabsq $0x4ec4ec4ec4ec4ec5, %rcx # imm = 0x4EC4EC4EC4EC4EC5
imulq %rcx, %rax
cmpq %r13, %rax
ja 0x8d7c
cmpq %rbx, %r14
movq 0x68(%rsp), %r13
je 0x8ecf
movq %rbx, %r15
movq %r15, %rdi
callq 0xb016
addq $0xd0, %r15
cmpq %r14, %r15
jne 0x8eb6
movq %rbx, 0x8(%rsp)
callq 0x71b0
subq 0x20(%rsp), %rax
cvtsi2sd %rax, %xmm0
divsd 0x37122(%rip), %xmm0    # 0x40008
movsd %xmm0, 0x20(%rsp)
movl $0x9, %edx
movq 0x4b0f0(%rip), %r14     # 0x53fe8
movq %r14, %rdi
leaq 0x37182(%rip), %rsi     # 0x40084
callq 0x7340
movq %r14, %rdi
movq 0x28(%rsp), %rsi
callq 0x75d0
movq %rax, %r15
movl $0x10, %edx
movq %rax, %rdi
leaq 0x37173(%rip), %rsi     # 0x40099
callq 0x7340
movq %r15, %rdi
movsd 0x20(%rsp), %xmm0
callq 0x7560
movq %rax, %r15
movl $0x8, %edx
movq %rax, %rdi
leaq 0x3715f(%rip), %rsi     # 0x400aa
callq 0x7340
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %r15, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x71d0
movslq 0x28(%rsp), %rax
addq %rax, %r13
movq %rsp, %rbx
jmp 0x8c93
movq (%rsp), %r14
movq 0x8(%rsp), %r15
cmpq %r14, %r15
je 0x8fb1
movq %r14, %rbx
movq %rbx, %rdi
callq 0xb016
addq $0xd0, %rbx
cmpq %r15, %rbx
jne 0x8f98
movq %r14, 0x8(%rsp)
leaq 0x370fb(%rip), %rdi     # 0x400b3
movq %r13, %rsi
xorl %eax, %eax
callq 0x7060
leaq 0x370ff(%rip), %rdi     # 0x400c8
movq 0x38(%rsp), %rsi
xorl %eax, %eax
callq 0x7060
leaq 0x37103(%rip), %rdi     # 0x400df
movq 0x40(%rsp), %rsi
xorl %eax, %eax
callq 0x7060
movq %rsp, %rdi
callq 0xb5dc
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x900c
jmp 0x900c
jmp 0x900c
jmp 0x900c
jmp 0x900c
movq %rax, %rbx
movq %rsp, %rdi
callq 0xb5dc
movq %rbx, %rdi
callq 0x7600