// File: /workspace/github_cpp_makefile_star2_O2/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, %r14
xorpd %xmm0, %xmm0
leaq 0x20(%rsp), %rbx
movapd %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
imull $0x989680, 0x8(%rdi), %eax # imm = 0x989680
movl %eax, 0x1c(%rsp)
movq $0x0, 0x48(%rsp)
leaq 0x68(%rsp), %rbp
movq $0x0, 0x40(%rsp)
movq $0x0, 0x38(%rsp)
movl 0x1c(%rsp), %edi
movq %rbx, %rsi
callq 0x796c
testl %eax, %eax
jle 0x7c8c
movq 0x28(%rsp), %rax
subq 0x20(%rsp), %rax
cqto
movl $0xd0, %ecx
idivq %rcx
movq %rax, 0x10(%rsp)
movq 0x4254e(%rip), %rdi     # 0x49fe8
leaq 0x2a5e3(%rip), %rsi     # 0x32084
callq 0x72b0
movq %rax, %rdi
movq 0x10(%rsp), %rsi
callq 0x75c0
movq %rax, %rdi
leaq 0x2a5d1(%rip), %rsi     # 0x3208e
callq 0x72b0
movq %rax, %rdi
callq 0x7160
callq 0x71c0
movq %rax, 0x8(%rsp)
movq 0x42925(%rip), %rax     # 0x4a400
movq %r14, 0x50(%rsp)
movq %rax, 0x58(%rsp)
movq %rbx, 0x60(%rsp)
movl 0x8(%r14), %edi
movq 0x10(%rsp), %rbx
movl %ebx, %esi
leaq 0x20f(%rip), %rdx       # 0x7d0b
leaq 0x50(%rsp), %rcx
callq 0x3190c
movslq %ebx, %rax
addq %rax, 0x38(%rsp)
xorl %ebx, %ebx
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rax
subq %rsi, %rax
cqto
movl $0xd0, %ecx
idivq %rcx
cmpq %rbx, %rax
jbe 0x7c09
imulq $0xd0, %rbx, %r15
movq 0xb0(%rsi,%r15), %rcx
movq 0xb8(%rsi,%r15), %rax
cmpq %rax, %rcx
je 0x7bd2
incq 0x40(%rsp)
movq %rax, %rdi
subq %rcx, %rdi
shrq $0x3, %rdi
movl 0x150(%r14), %edx
cmpl %edi, %edx
cmovll %edx, %edi
movslq %edi, %rdi
addq %rdi, 0x48(%rsp)
xorl %r12d, %r12d
subq %rcx, %rax
shrq $0x3, %rax
cmpl %eax, %edx
cmovll %edx, %eax
cmpl %eax, %r12d
jge 0x7c01
addq %r15, %rsi
movq 0x42877(%rip), %r13     # 0x4a408
movq %rbp, %rdi
movl %r12d, %edx
callq 0x94ca
movq 0x68(%rsp), %rdi
movq %r13, %rsi
callq 0x7320
movq %rbp, %rdi
callq 0x76a8
incl %r12d
movq 0x20(%rsp), %rsi
movq 0xb0(%rsi,%r15), %rcx
movq 0xb8(%rsi,%r15), %rax
movl 0x150(%r14), %edx
jmp 0x7b76
addq %r15, %rsi
movq 0x4282c(%rip), %r12     # 0x4a408
movq %rbp, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
pushq $0x1
popq %r8
callq 0x93e4
movq 0x68(%rsp), %rdi
movq %r12, %rsi
callq 0x7320
movq %rbp, %rdi
callq 0x76a8
incq %rbx
jmp 0x7b10
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x96e0
callq 0x71c0
subq 0x8(%rsp), %rax
cvtsi2sd %rax, %xmm0
divsd 0x2a3db(%rip), %xmm0    # 0x32008
movsd %xmm0, 0x8(%rsp)
movq 0x423ae(%rip), %rdi     # 0x49fe8
leaq 0x2a443(%rip), %rsi     # 0x32084
callq 0x72b0
movq %rax, %rdi
movq 0x10(%rsp), %rsi
callq 0x75c0
movq %rax, %rdi
leaq 0x2a43c(%rip), %rsi     # 0x32099
callq 0x72b0
movq %rax, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x7560
movq %rax, %rdi
leaq 0x2a430(%rip), %rsi     # 0x320aa
callq 0x72b0
movq %rax, %rdi
callq 0x7160
jmp 0x7a66
leaq 0x20(%rsp), %r14
movq %r14, %rdi
callq 0x96e0
leaq 0x2a413(%rip), %rdi     # 0x320b3
movq 0x38(%rsp), %rsi
xorl %eax, %eax
callq 0x7050
leaq 0x2a415(%rip), %rdi     # 0x320c8
movq 0x40(%rsp), %rsi
xorl %eax, %eax
callq 0x7050
leaq 0x2a419(%rip), %rdi     # 0x320df
movq 0x48(%rsp), %rsi
xorl %eax, %eax
callq 0x7050
movq %r14, %rdi
callq 0x96e8
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7cf6
jmp 0x7cf6
jmp 0x7cf6
jmp 0x7cf6
jmp 0x7cf6
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x96e8
movq %rbx, %rdi
callq 0x75e0