// File: /workspace/github_cpp_makefile_star2_O1/readmapping[P]alfalfa/src/main.cpp
// Function: paired_thread1(mapOptions_t const*)
void paired_thread1(const mapOptions_t * opt) {
    long total_seq_cnt = 0;
    long seq_mapped1 = 0;
    long alignments_printed1 = 0;
    long seq_mapped2 = 0;
    long alignments_printed2 = 0;
#ifndef NDEBUG
    if (opt->alnOptions.debugFile != NULL)
        fprintf(opt->alnOptions.debugFile, "#ALN\n");
#endif
    //init fields
    vector<read_t> mates1;
    vector<read_t> mates2;
    int bpCount = opt->query_threads * BUFFER_SIZE;
    //read reads
    while (readBatchPaired(bpCount, mates1, mates2) > 0) {
        //count reads, init fields
        int seq_cnt = mates1.size();
        total_seq_cnt += seq_cnt;
        cerr << "Progress " << seq_cnt << " reads ..." << endl;
        clock_t start = clock();
        paired_data pairedData(opt, sa, &mates1, &mates2);
        //parallel loop
        kt_for(opt->query_threads, seq_cnt, map_paired, &pairedData);
        //output
        for(int i = 0; i < mates1.size(); i++){
            if (mates1[i].alignments.empty())
                fprintf(outfile, "%s", mates1[i].emptyAlingment(true, mates2[i].alignments.empty(), true).c_str());
            else{
                seq_mapped1++;
                int mate1AlnCount;
                if (opt->pairedOpt.mixed)
                    mate1AlnCount = min(mates1[i].alignmentCount(), opt->alnOptions.alignmentCount);
                else
                    mate1AlnCount = min(mates1[i].pairedAlignmentCount, opt->alnOptions.alignmentCount);
                alignments_printed1 += mate1AlnCount;
                for (int k = 0; k < mate1AlnCount; k++)
                    fprintf(outfile, "%s", mates1[i].printPairedAlignments(k, true).c_str());
            }
            if (mates2[i].alignments.empty())
                fprintf(outfile, "%s", mates2[i].emptyAlingment(true, mates1[i].alignments.empty(), false).c_str());
            else {
                seq_mapped2++;
                int mate2AlnCount;
                if (opt->pairedOpt.mixed)
                    mate2AlnCount = min(mates2[i].alignmentCount(), opt->alnOptions.alignmentCount);
                else
                    mate2AlnCount = min(mates2[i].pairedAlignmentCount, opt->alnOptions.alignmentCount);
                alignments_printed2 += mate2AlnCount;
                for (int k = 0; k < mate2AlnCount; k++)
                    fprintf(outfile, "%s", mates2[i].printPairedAlignments(k, false).c_str());
            }
        }
        mates1.clear(); mates2.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
    mates1.clear();
    mates2.clear();
    //report statistics
    printf("sequences read: %ld\n", total_seq_cnt);
    printf("sequences mapped (mate1): %ld\n", seq_mapped1);
    printf("sequences mapped (mate2): %ld\n", seq_mapped2);
    printf("alignments printed (mate1): %ld\n", alignments_printed1);
    printf("alignments printed (mate2): %ld\n", alignments_printed2);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdi, %rbx
xorpd %xmm0, %xmm0
movq %rsp, %r15
movapd %xmm0, (%r15)
xorl %eax, %eax
movq %rax, 0x10(%r15)
leaq 0x20(%rsp), %rcx
movq $0x0, 0x78(%rsp)
movq %rax, 0x10(%rcx)
movapd %xmm0, (%rcx)
imull $0x989680, 0x8(%rdi), %eax # imm = 0x989680
movl %eax, 0x6c(%rsp)
leaq 0x38(%rsp), %r13
movq $0x0, 0x70(%rsp)
movq $0x0, 0x88(%rsp)
movq $0x0, 0x80(%rsp)
xorl %r12d, %r12d
movq %rdi, 0x18(%rsp)
movl 0x6c(%rsp), %edi
movq %r15, %rsi
leaq 0x20(%rsp), %rdx
callq 0x9199
testl %eax, %eax
jle 0x97b3
movq 0x8(%rsp), %r14
subq (%rsp), %r14
movl $0x9, %edx
movq 0x4ac98(%rip), %rdi     # 0x53fe8
leaq 0x36d2d(%rip), %rsi     # 0x40084
callq 0x7340
movq %r14, %rsi
sarq $0x4, %rsi
movabsq $0x4ec4ec4ec4ec4ec5, %rax # imm = 0x4EC4EC4EC4EC4EC5
imulq %rax, %rsi
movq 0x4ac70(%rip), %rdi     # 0x53fe8
movq %rsi, 0x60(%rsp)
callq 0x75d0
movq %rax, %r14
movl $0xa, %edx
movq %rax, %rdi
leaq 0x36cfa(%rip), %rsi     # 0x4008e
callq 0x7340
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x71d0
movq %r12, 0x90(%rsp)
callq 0x71b0
movq %rax, 0x58(%rsp)
movq 0x4b02f(%rip), %rax     # 0x54408
movq %rbx, 0x98(%rsp)
movq %rax, 0xa0(%rsp)
movq %r15, 0xa8(%rsp)
leaq 0x20(%rsp), %rax
movq %rax, 0xb0(%rsp)
movl 0x8(%rbx), %edi
movq 0x60(%rsp), %rsi
leaq 0x4ad(%rip), %rdx       # 0x98ba
leaq 0x98(%rsp), %rcx
callq 0x3f998
movq (%rsp), %r15
movq 0x8(%rsp), %r12
cmpq %r15, %r12
je 0x96a1
xorl %ebx, %ebx
imulq $0xd0, %rbx, %rbp
leaq (%r15,%rbp), %rsi
movq 0xb0(%r15,%rbp), %rax
cmpq 0xb8(%r15,%rbp), %rax
je 0x9475
movq 0x18(%rsp), %r15
cmpb $0x1, 0x1a0(%r15)
jne 0x94e0
movq 0xb8(%rsi), %r12
subq %rax, %r12
shrq $0x3, %r12
movl 0x150(%r15), %eax
jmp 0x94ee
movq 0x4af94(%rip), %r14     # 0x54410
movq 0x20(%rsp), %rax
movq 0xb0(%rax,%rbp), %rdx
xorl %ecx, %ecx
cmpq 0xb8(%rax,%rbp), %rdx
sete %cl
movq %r13, %rdi
movl $0x1, %edx
movl $0x1, %r8d
callq 0xb1cc
movq 0x18(%rsp), %r15
movq 0x38(%rsp), %rdi
movq %r14, %rsi
callq 0x7330
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x9563
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x72f0
jmp 0x9563
movl 0x150(%r15), %eax
movl 0xc8(%rsi), %r12d
cmpl %r12d, %eax
cmovll %eax, %r12d
incq 0x80(%rsp)
movslq %r12d, %rax
addq %rax, 0x88(%rsp)
testl %eax, %eax
jle 0x9563
xorl %r14d, %r14d
movq 0x4aefa(%rip), %r15     # 0x54410
movq (%rsp), %rsi
addq %rbp, %rsi
movq %r13, %rdi
movl %r14d, %edx
movl $0x1, %ecx
callq 0xb62e
movq 0x38(%rsp), %rdi
movq %r15, %rsi
callq 0x7330
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x9556
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x72f0
incl %r14d
cmpl %r14d, %r12d
jne 0x950f
movq 0x18(%rsp), %r15
movq 0x20(%rsp), %rcx
leaq (%rcx,%rbp), %rsi
movq 0xb0(%rcx,%rbp), %rax
cmpq 0xb8(%rcx,%rbp), %rax
je 0x959f
cmpb $0x1, 0x1a0(%r15)
jne 0x95fe
movq 0xb8(%rsi), %r12
subq %rax, %r12
shrq $0x3, %r12
movl 0x150(%r15), %eax
jmp 0x960c
movq 0x4ae6a(%rip), %r14     # 0x54410
movq (%rsp), %rax
movq 0xb0(%rax,%rbp), %rdx
xorl %ecx, %ecx
cmpq 0xb8(%rax,%rbp), %rdx
sete %cl
movq %r13, %rdi
movl $0x1, %edx
xorl %r8d, %r8d
callq 0xb1cc
movq 0x38(%rsp), %rdi
movq %r14, %rsi
callq 0x7330
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x9674
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x72f0
jmp 0x9674
movl 0x150(%r15), %eax
movl 0xc8(%rsi), %r12d
cmpl %r12d, %eax
cmovll %eax, %r12d
incq 0x70(%rsp)
movslq %r12d, %rax
addq %rax, 0x78(%rsp)
testl %eax, %eax
jle 0x9674
xorl %r14d, %r14d
movq 0x4ade2(%rip), %r15     # 0x54410
movq 0x20(%rsp), %rsi
addq %rbp, %rsi
movq %r13, %rdi
movl %r14d, %edx
xorl %ecx, %ecx
callq 0xb62e
movq 0x38(%rsp), %rdi
movq %r15, %rsi
callq 0x7330
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x966c
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x72f0
incl %r14d
cmpl %r14d, %r12d
jne 0x9627
incq %rbx
movq (%rsp), %r15
movq 0x8(%rsp), %r12
movq %r12, %rax
subq %r15, %rax
sarq $0x4, %rax
movabsq $0x4ec4ec4ec4ec4ec5, %rcx # imm = 0x4EC4EC4EC4EC4EC5
imulq %rcx, %rax
cmpq %rbx, %rax
ja 0x942e
cmpq %r15, %r12
je 0x96c2
movq %r15, %r14
movq %r14, %rdi
callq 0xb024
addq $0xd0, %r14
cmpq %r12, %r14
jne 0x96a9
movq %r15, 0x8(%rsp)
movq 0x20(%rsp), %rbx
movq 0x28(%rsp), %r15
cmpq %rbx, %r15
movq 0x90(%rsp), %r12
je 0x96f5
movq %rbx, %r14
movq %r14, %rdi
callq 0xb024
addq $0xd0, %r14
cmpq %r15, %r14
jne 0x96dc
movq %rbx, 0x28(%rsp)
callq 0x71b0
subq 0x58(%rsp), %rax
cvtsi2sd %rax, %xmm0
divsd 0x368fc(%rip), %xmm0    # 0x40008
movsd %xmm0, 0x58(%rsp)
movl $0x9, %edx
movq 0x4a8ca(%rip), %rdi     # 0x53fe8
leaq 0x3695f(%rip), %rsi     # 0x40084
callq 0x7340
movq 0x4a8b7(%rip), %rdi     # 0x53fe8
movq 0x60(%rsp), %rsi
callq 0x75d0
movq %rax, %r14
movl $0x10, %edx
movq %rax, %rdi
leaq 0x3694c(%rip), %rsi     # 0x40099
callq 0x7340
movq %r14, %rdi
movsd 0x58(%rsp), %xmm0
callq 0x7560
movq %rax, %r14
movl $0x8, %edx
movq %rax, %rdi
leaq 0x36938(%rip), %rsi     # 0x400aa
callq 0x7340
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x72b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x7040
movq %rax, %rdi
callq 0x71d0
movslq 0x60(%rsp), %rax
addq %rax, %r12
movq 0x18(%rsp), %rbx
movq %rsp, %r15
jmp 0x9322
movq (%rsp), %r14
movq 0x8(%rsp), %r15
cmpq %r14, %r15
je 0x97dd
movq %r14, %rbx
movq %rbx, %rdi
callq 0xb024
addq $0xd0, %rbx
cmpq %r15, %rbx
jne 0x97c4
movq %r14, 0x8(%rsp)
movq 0x20(%rsp), %r14
movq 0x28(%rsp), %r15
cmpq %r14, %r15
je 0x9808
movq %r14, %rbx
movq %rbx, %rdi
callq 0xb024
addq $0xd0, %rbx
cmpq %r15, %rbx
jne 0x97ef
movq %r14, 0x28(%rsp)
leaq 0x368a4(%rip), %rdi     # 0x400b3
movq %r12, %rsi
xorl %eax, %eax
callq 0x7060
leaq 0x368d8(%rip), %rdi     # 0x400f8
movq 0x80(%rsp), %rsi
xorl %eax, %eax
callq 0x7060
leaq 0x368e1(%rip), %rdi     # 0x40117
movq 0x70(%rsp), %rsi
xorl %eax, %eax
callq 0x7060
leaq 0x368ed(%rip), %rdi     # 0x40136
movq 0x88(%rsp), %rsi
xorl %eax, %eax
callq 0x7060
leaq 0x368f8(%rip), %rdi     # 0x40157
movq 0x78(%rsp), %rsi
xorl %eax, %eax
callq 0x7060
leaq 0x20(%rsp), %rdi
callq 0xb5ea
movq %rsp, %rdi
callq 0xb5ea
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x989d
jmp 0x989d
jmp 0x989d
jmp 0x989d
jmp 0x989d
jmp 0x989d
jmp 0x989d
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0xb5ea
movq %rsp, %rdi
callq 0xb5ea
movq %rbx, %rdi
callq 0x7600