// File: /workspace/github_c_makefile_star2_O2/jsh58[P]Genrich/Genrich.c
// Function: findDups
void findDups(Read** readPr, int readIdxPr, int readLenPr,
    Read** readDc, int readIdxDc, int readLenDc,
    Read** readSn, int readIdxSn, int readLenSn,
    HashAln*** table, uint32_t* tableMem,
    HashAln*** tableSn, uint32_t* tableSnMem,
    uint32_t** order, uint32_t** order0, uint32_t** order1,
    uint32_t** order2, uint16_t** qual, uint16_t** qual0,
    uint16_t** qual1, uint16_t** qual2, uint32_t* arrMem,
    uint64_t* countPr, uint64_t* dupsPr, uint64_t* countDc,
    uint64_t* dupsDc, uint64_t* countSn, uint64_t* dupsSn,
    bool singleOpt, uint64_t* pairedPr, uint64_t* singlePr,
    double* totalLen, bool extendOpt, int extend,
    bool avgExtOpt, float asDiff, bool atacOpt,
    int atacLen5, int atacLen3, bool atacAdj, File bed,
    bool bedOpt, bool gzOut, File dups, bool dupsVerb,
    bool ctrl, int sample, uint64_t* errCount, bool verbose) {

  // initialize hash table for singletons
  uint32_t hashSizeSn = 0;
  if (singleOpt && (readIdxSn || readLenSn)) {
    // calculate hashtable size
    uint32_t sum = MIN(UINT32_MAX,
      2 * (readIdxPr * MAX_SIZE + readLenPr)
      + 2 * (readIdxDc * MAX_SIZE + readLenDc)
      + readIdxSn * MAX_SIZE + readLenSn);
    hashSizeSn = calcHashSize(sum);

    // create/expand hashtable
    if (hashSizeSn > *tableSnMem) {
      *tableSn = (HashAln**) memrealloc(*tableSn,
        hashSizeSn * sizeof(HashAln*));
      *tableSnMem = hashSizeSn;
    } else
      hashSizeSn = *tableSnMem;
    for (uint32_t i = 0; i < hashSizeSn; i++)
      (*tableSn)[i] = NULL;
  }

  // initialize arrays for efficient sorting
  uint32_t count = MIN(UINT32_MAX,
    MAX(readIdxPr * MAX_SIZE + readLenPr,
    MAX(readIdxDc * MAX_SIZE + readLenDc,
    readIdxSn * MAX_SIZE + readLenSn)));
  if (count > *arrMem) {
    *order = (uint32_t*) memrealloc(*order, count * sizeof(uint32_t));
    *order0 = (uint32_t*) memrealloc(*order0, count * sizeof(uint32_t));
    *order1 = (uint32_t*) memrealloc(*order1, count * sizeof(uint32_t));
    *order2 = (uint32_t*) memrealloc(*order2, count * sizeof(uint32_t));
    *qual = (uint16_t*) memrealloc(*qual, count * sizeof(uint16_t));
    *qual0 = (uint16_t*) memrealloc(*qual0, count * sizeof(uint16_t));
    *qual1 = (uint16_t*) memrealloc(*qual1, count * sizeof(uint16_t));
    *qual2 = (uint16_t*) memrealloc(*qual2, count * sizeof(uint16_t));
    *arrMem = count;
  }

  // evaluate and process paired alignments
  if (readIdxPr || readLenPr)
    findDupsPr(readPr, readIdxPr, readLenPr, countPr,
      dupsPr, pairedPr, totalLen, asDiff, atacOpt,
      atacLen5, atacLen3, atacAdj, bed, bedOpt, gzOut,
      ctrl, sample, table, tableMem, *tableSn, hashSizeSn,
      dups, dupsVerb, *order, *order0, *order1, *order2,
      *qual, *qual0, *qual1, *qual2, errCount, verbose);

  if (singleOpt) {
    // with avgExtOpt, calculate average fragment length
    //   and save it as 'extend' with extendOpt=true
    if (avgExtOpt) {
      extend = calcAvgLen(*totalLen, *pairedPr, verbose);
      if (extend)
        extendOpt = true;
    }

    // evaluate and process discordant alignments
    if (readIdxDc || readLenDc)
      findDupsDc(readDc, readIdxDc, readLenDc, countDc,
        dupsDc, singlePr, extendOpt, extend, asDiff,
        atacOpt, atacLen5, atacLen3, atacAdj, bed, bedOpt,
        gzOut, ctrl, sample, table, tableMem, *tableSn,
        hashSizeSn, dups, dupsVerb, *order, *order0,
        *order1, *order2, *qual, *qual0, *qual1, *qual2,
        errCount, verbose);

    // evaluate and process singleton alignments
    if (readIdxSn || readLenSn)
      findDupsSn(readSn, readIdxSn, readLenSn, countSn,
        dupsSn, singlePr, extendOpt, extend, asDiff,
        atacOpt, atacLen5, atacLen3, atacAdj, bed, bedOpt,
        gzOut, ctrl, sample, *tableSn, hashSizeSn, dups,
        dupsVerb, *order, *order0, *order1, *order2, *qual,
        *qual0, *qual1, *qual2, errCount, verbose);
  }

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movss %xmm0, 0x14(%rsp)
movl %r8d, %r13d
movq %rcx, 0x60(%rsp)
movl %edx, %r12d
movl %esi, %r8d
movq %rdi, 0x20(%rsp)
movq 0x118(%rsp), %rdi
movq 0xc8(%rsp), %r14
movl 0xb0(%rsp), %edx
movl 0xa8(%rsp), %esi
movl %edx, %eax
orl %esi, %eax
movl %eax, 0x44(%rsp)
setne %al
testb %al, 0x150(%rsp)
movq %r9, 0x50(%rsp)
je 0xa7cb
movq 0xd0(%rsp), %rbp
movq %r8, 0x8(%rsp)
leal (%r8,%r13), %eax
imull $0xfff0, %eax, %eax     # imm = 0xFFF0
addl %r9d, %eax
addl %r12d, %eax
imull $0xfff0, %esi, %r15d    # imm = 0xFFF0
leal (%r15,%rax,2), %edi
addl %edx, %edi
callq 0x90db
movl (%rbp), %ebp
cmpl %ebp, %eax
jbe 0xab04
movl %eax, %ebx
movq (%r14), %rdi
movl %eax, %ebp
leaq (,%rbp,8), %rsi
callq 0x2776
movq %rax, (%r14)
movq 0xd0(%rsp), %rax
movl %ebx, (%rax)
movl %ebx, %eax
movq %rax, 0x18(%rsp)
jmp 0xab09
imull $0xfff0, %esi, %r15d    # imm = 0xFFF0
movq $0x0, 0x18(%rsp)
movb 0x1d0(%rsp), %sil
movb 0x1a0(%rsp), %r14b
movb 0x188(%rsp), %bpl
imull $0xfff0, %r8d, %eax     # imm = 0xFFF0
addl %r12d, %eax
imull $0xfff0, %r13d, %ecx    # imm = 0xFFF0
addl %r9d, %ecx
addl %edx, %r15d
cmpl %r15d, %ecx
cmovgl %ecx, %r15d
cmpl %r15d, %eax
cmovgl %eax, %r15d
cmpl (%rdi), %r15d
jbe 0xa924
movq 0xd8(%rsp), %rax
movq %r12, 0x8(%rsp)
movq %rax, %r12
movq (%rax), %rdi
movl %r15d, %ebx
leaq (,%rbx,4), %rbp
movq %rbp, %rsi
movq %r8, %r14
callq 0x2776
movq %rax, (%r12)
movq 0xe0(%rsp), %r12
movq (%r12), %rdi
movq %rbp, %rsi
callq 0x2776
movq %rax, (%r12)
movq 0xe8(%rsp), %r12
movq (%r12), %rdi
movq %rbp, %rsi
callq 0x2776
movq %rax, (%r12)
movq 0xf0(%rsp), %r12
movq (%r12), %rdi
movq %rbp, %rsi
movb 0x188(%rsp), %bpl
callq 0x2776
movq %rax, (%r12)
movq 0xf8(%rsp), %r12
movq (%r12), %rdi
addq %rbx, %rbx
movq %rbx, %rsi
callq 0x2776
movq %rax, (%r12)
movq 0x100(%rsp), %r12
movq (%r12), %rdi
movq %rbx, %rsi
callq 0x2776
movq %rax, (%r12)
movq 0x108(%rsp), %r12
movq (%r12), %rdi
movq %rbx, %rsi
callq 0x2776
movq %rax, (%r12)
movq 0x110(%rsp), %r12
movq (%r12), %rdi
movq %rbx, %rsi
callq 0x2776
movb 0x1d0(%rsp), %sil
movq %r14, %r8
movb 0x1a0(%rsp), %r14b
movq %rax, (%r12)
movq 0x8(%rsp), %r12
movq 0x118(%rsp), %rax
movl %r15d, (%rax)
movl 0x1d8(%rsp), %r15d
movq 0x1a8(%rsp), %rbx
movl 0x198(%rsp), %r11d
movl 0x190(%rsp), %r10d
movq 0x168(%rsp), %rdi
movq 0x158(%rsp), %rcx
movl %r12d, %eax
orl %r8d, %eax
movzbl 0x1e8(%rsp), %eax
movzbl 0x1c8(%rsp), %r9d
movzbl %sil, %esi
movzbl 0x1b8(%rsp), %edx
movq %rdx, 0x38(%rsp)
movq %r12, %rdx
movzbl 0x1b0(%rsp), %r12d
movzbl %r14b, %r14d
movzbl %bpl, %ebp
movq %rsi, 0x30(%rsp)
movq %r9, 0x28(%rsp)
movq %rax, 0x8(%rsp)
je 0xaaa3
movq %r8, %rsi
movq 0x128(%rsp), %r8
movq 0x120(%rsp), %rcx
movq 0x20(%rsp), %rdi
movq 0x158(%rsp), %r9
movss 0x14(%rsp), %xmm0
pushq %rax
pushq 0x1e8(%rsp)
movq 0x120(%rsp), %rax
pushq (%rax)
movq 0x120(%rsp), %rax
pushq (%rax)
movq 0x120(%rsp), %rax
pushq (%rax)
movq 0x120(%rsp), %rax
pushq (%rax)
movq 0x120(%rsp), %rax
pushq (%rax)
movq 0x120(%rsp), %rax
pushq (%rax)
movq 0x120(%rsp), %rax
pushq (%rax)
movq 0x120(%rsp), %rax
pushq (%rax)
pushq 0x78(%rsp)
pushq 0x218(%rsp)
pushq 0x78(%rsp)
movq 0x130(%rsp), %rax
pushq (%rax)
pushq 0x130(%rsp)
pushq 0x130(%rsp)
pushq %r15
pushq 0xb8(%rsp)
pushq 0xc8(%rsp)
pushq %r12
pushq %rbx
pushq %r14
pushq %r11
pushq %r10
pushq %rbp
pushq 0x230(%rsp)
movq %r10, %r15
movq %r11, %rbx
callq 0x9729
movq 0x238(%rsp), %rdi
movq 0x228(%rsp), %rcx
movq 0xd8(%rsp), %rax
movq %rbx, %r11
movq 0x278(%rsp), %rbx
movq %r15, %r10
addq $0xd0, %rsp
movq %r14, 0x20(%rsp)
cmpb $0x0, 0x150(%rsp)
movq %r12, 0x48(%rsp)
je 0xad6b
movb 0x170(%rsp), %r12b
cmpb $0x0, 0x180(%rsp)
je 0xab3a
movsd (%rdi), %xmm0
movq (%rcx), %rdi
movl %eax, %esi
movq %r10, %r15
movq %rbp, 0x58(%rsp)
movq %rbx, %rbp
movq %r11, %rbx
callq 0x7750
movq %rbx, %r11
movq %rbp, %rbx
movq 0x58(%rsp), %rbp
movq %r15, %r10
movl %eax, %r15d
testl %eax, %eax
setne %al
orb %al, %r12b
jmp 0xab42
movq %rbp, 0x18(%rsp)
xorl %eax, %eax
movl 0xb0(%rsp), %edx
movq 0x50(%rsp), %r9
movq 0x8(%rsp), %r8
movq 0x118(%rsp), %rdi
cmpq %rax, %rbp
je 0xa7db
movq (%r14), %rcx
andq $0x0, (%rcx,%rax,8)
incq %rax
jmp 0xab24
movl 0x178(%rsp), %r15d
movq 0x160(%rsp), %r9
movq 0x50(%rsp), %rdx
movl %edx, %eax
movq %r13, %rsi
orl %esi, %eax
movzbl %r12b, %r13d
je 0xac75
movq 0x138(%rsp), %r8
movq 0x130(%rsp), %rcx
subq $0x8, %rsp
movq 0x68(%rsp), %rdi
movq 0x168(%rsp), %r9
movss 0x1c(%rsp), %xmm0
pushq 0x10(%rsp)
pushq 0x1f0(%rsp)
movq 0x128(%rsp), %rax
pushq (%rax)
movq 0x128(%rsp), %rax
pushq (%rax)
movq 0x128(%rsp), %rax
pushq (%rax)
movq 0x128(%rsp), %rax
pushq (%rax)
movq 0x128(%rsp), %rax
pushq (%rax)
movq 0x128(%rsp), %rax
pushq (%rax)
movq 0x128(%rsp), %rax
pushq (%rax)
movq 0x128(%rsp), %rax
pushq (%rax)
pushq 0x80(%rsp)
pushq 0x220(%rsp)
pushq 0x80(%rsp)
movq 0x138(%rsp), %rax
pushq (%rax)
pushq 0x138(%rsp)
pushq 0x138(%rsp)
movl 0x260(%rsp), %eax
pushq %rax
pushq 0xc0(%rsp)
pushq 0xd0(%rsp)
pushq 0xe8(%rsp)
pushq %rbx
pushq 0xd0(%rsp)
pushq %r11
pushq %r10
pushq %rbp
pushq %r15
pushq %r13
movq %r15, %r14
movq %r13, %r15
movq %r10, %r13
movq %rbp, %r12
movq %rbx, %rbp
movq %r11, %rbx
callq 0x9e04
movq 0x240(%rsp), %r9
movq %rbx, %r11
movq %rbp, %rbx
movq %r12, %rbp
movq %r13, %r10
movq %r15, %r13
movq %r14, %r15
addq $0xe0, %rsp
cmpl $0x0, 0x44(%rsp)
movl 0x1d8(%rsp), %r12d
movq 0x8(%rsp), %r14
je 0xad6b
movq 0x148(%rsp), %r8
movq 0x140(%rsp), %rcx
movq 0xa0(%rsp), %rdi
subq $0x8, %rsp
movl 0xb0(%rsp), %esi
movl 0xb8(%rsp), %edx
movss 0x1c(%rsp), %xmm0
pushq %r14
pushq 0x1f0(%rsp)
movq 0x128(%rsp), %rax
pushq (%rax)
movq 0x128(%rsp), %rax
pushq (%rax)
movq 0x128(%rsp), %rax
pushq (%rax)
movq 0x128(%rsp), %rax
pushq (%rax)
movq 0x128(%rsp), %rax
pushq (%rax)
movq 0x128(%rsp), %rax
pushq (%rax)
movq 0x128(%rsp), %rax
pushq (%rax)
movq 0x128(%rsp), %rax
pushq (%rax)
pushq 0x80(%rsp)
pushq 0x220(%rsp)
pushq 0x80(%rsp)
movq 0x138(%rsp), %rax
pushq (%rax)
pushq %r12
pushq 0xb0(%rsp)
pushq 0xc0(%rsp)
pushq 0xd8(%rsp)
pushq %rbx
pushq 0xc0(%rsp)
pushq %r11
pushq %r10
pushq %rbp
pushq %r15
pushq %r13
callq 0xa469
addq $0x138, %rsp            # imm = 0x138
jmp 0xad6f
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq