// File: /workspace/github_cpp_makefile_star2_O3/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 0x91a9
testl %eax, %eax
jle 0x97b7
movq 0x8(%rsp), %r14
subq (%rsp), %r14
movl $0x9, %edx
movq 0x4ac88(%rip), %rdi     # 0x53fe8
leaq 0x36d1d(%rip), %rsi     # 0x40084
callq 0x7340
movq %r14, %rsi
sarq $0x4, %rsi
movabsq $0x4ec4ec4ec4ec4ec5, %rax # imm = 0x4EC4EC4EC4EC4EC5
imulq %rax, %rsi
movq 0x4ac60(%rip), %rdi     # 0x53fe8
movq %rsi, 0x60(%rsp)
callq 0x75d0
movq %rax, %r14
movl $0xa, %edx
movq %rax, %rdi
leaq 0x36cea(%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 0x4b01f(%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 0x4a1(%rip), %rdx       # 0x98be
leaq 0x98(%rsp), %rcx
callq 0x3f8a8
movq (%rsp), %r15
movq 0x8(%rsp), %r12
cmpq %r15, %r12
je 0x96a5
xorl %ebx, %ebx
imulq $0xd0, %rbx, %rbp
leaq (%r15,%rbp), %rsi
movq 0xb0(%r15,%rbp), %rax
movq 0xb8(%r15,%rbp), %r12
cmpq %r12, %rax
je 0x947d
movq 0x18(%rsp), %r15
cmpb $0x1, 0x1a0(%r15)
jne 0x94e8
subq %rax, %r12
shrq $0x3, %r12
movl 0x150(%r15), %eax
jmp 0x94f6
movq 0x4af8c(%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 0xb1be
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 0x956b
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x72f0
jmp 0x956b
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 0x956b
xorl %r14d, %r14d
movq 0x4aef2(%rip), %r15     # 0x54410
movq (%rsp), %rsi
addq %rbp, %rsi
movq %r13, %rdi
movl %r14d, %edx
movl $0x1, %ecx
callq 0xb626
movq 0x38(%rsp), %rdi
movq %r15, %rsi
callq 0x7330
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x955e
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x72f0
incl %r14d
cmpl %r14d, %r12d
jne 0x9517
movq 0x18(%rsp), %r15
movq 0x20(%rsp), %rcx
leaq (%rcx,%rbp), %rsi
movq 0xb0(%rcx,%rbp), %rax
movq 0xb8(%rcx,%rbp), %r12
cmpq %r12, %rax
je 0x95a3
cmpb $0x1, 0x1a0(%r15)
jne 0x9602
subq %rax, %r12
shrq $0x3, %r12
movl 0x150(%r15), %eax
jmp 0x9610
movq 0x4ae66(%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 0xb1be
movq 0x38(%rsp), %rdi
movq %r14, %rsi
callq 0x7330
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x9678
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x72f0
jmp 0x9678
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 0x9678
xorl %r14d, %r14d
movq 0x4adde(%rip), %r15     # 0x54410
movq 0x20(%rsp), %rsi
addq %rbp, %rsi
movq %r13, %rdi
movl %r14d, %edx
xorl %ecx, %ecx
callq 0xb626
movq 0x38(%rsp), %rdi
movq %r15, %rsi
callq 0x7330
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x9670
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x72f0
incl %r14d
cmpl %r14d, %r12d
jne 0x962b
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 0x943e
cmpq %r15, %r12
je 0x96c6
movq %r15, %r14
movq %r14, %rdi
callq 0xb016
addq $0xd0, %r14
cmpq %r12, %r14
jne 0x96ad
movq %r15, 0x8(%rsp)
movq 0x20(%rsp), %rbx
movq 0x28(%rsp), %r15
cmpq %rbx, %r15
movq 0x90(%rsp), %r12
je 0x96f9
movq %rbx, %r14
movq %r14, %rdi
callq 0xb016
addq $0xd0, %r14
cmpq %r15, %r14
jne 0x96e0
movq %rbx, 0x28(%rsp)
callq 0x71b0
subq 0x58(%rsp), %rax
cvtsi2sd %rax, %xmm0
divsd 0x368f8(%rip), %xmm0    # 0x40008
movsd %xmm0, 0x58(%rsp)
movl $0x9, %edx
movq 0x4a8c6(%rip), %rdi     # 0x53fe8
leaq 0x3695b(%rip), %rsi     # 0x40084
callq 0x7340
movq 0x4a8b3(%rip), %rdi     # 0x53fe8
movq 0x60(%rsp), %rsi
callq 0x75d0
movq %rax, %r14
movl $0x10, %edx
movq %rax, %rdi
leaq 0x36948(%rip), %rsi     # 0x40099
callq 0x7340
movq %r14, %rdi
movsd 0x58(%rsp), %xmm0
callq 0x7560
movq %rax, %r14
movl $0x8, %edx
movq %rax, %rdi
leaq 0x36934(%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 0x9332
movq (%rsp), %r14
movq 0x8(%rsp), %r15
cmpq %r14, %r15
je 0x97e1
movq %r14, %rbx
movq %rbx, %rdi
callq 0xb016
addq $0xd0, %rbx
cmpq %r15, %rbx
jne 0x97c8
movq %r14, 0x8(%rsp)
movq 0x20(%rsp), %r14
movq 0x28(%rsp), %r15
cmpq %r14, %r15
je 0x980c
movq %r14, %rbx
movq %rbx, %rdi
callq 0xb016
addq $0xd0, %rbx
cmpq %r15, %rbx
jne 0x97f3
movq %r14, 0x28(%rsp)
leaq 0x368a0(%rip), %rdi     # 0x400b3
movq %r12, %rsi
xorl %eax, %eax
callq 0x7060
leaq 0x368d4(%rip), %rdi     # 0x400f8
movq 0x80(%rsp), %rsi
xorl %eax, %eax
callq 0x7060
leaq 0x368dd(%rip), %rdi     # 0x40117
movq 0x70(%rsp), %rsi
xorl %eax, %eax
callq 0x7060
leaq 0x368e9(%rip), %rdi     # 0x40136
movq 0x88(%rsp), %rsi
xorl %eax, %eax
callq 0x7060
leaq 0x368f4(%rip), %rdi     # 0x40157
movq 0x78(%rsp), %rsi
xorl %eax, %eax
callq 0x7060
leaq 0x20(%rsp), %rdi
callq 0xb5dc
movq %rsp, %rdi
callq 0xb5dc
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x98a1
jmp 0x98a1
jmp 0x98a1
jmp 0x98a1
jmp 0x98a1
jmp 0x98a1
jmp 0x98a1
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0xb5dc
movq %rsp, %rdi
callq 0xb5dc
movq %rbx, %rdi
callq 0x7600