// File: /workspace/github_c_makefile_star2_O2/jsh58[P]Genrich/Genrich.c
// Function: findDupsDc
void findDupsDc(Read** readDc, int readIdxDc,
    int readLenDc, uint64_t* countDc, uint64_t* dupsDc,
    uint64_t* singlePr, bool extendOpt, int extend,
    float asDiff, bool atacOpt, int atacLen5, int atacLen3,
    bool atacAdj, File bed, bool bedOpt, bool gzOut,
    bool ctrl, int sample, HashAln*** table,
    uint32_t* tableMem, HashAln** tableSn,
    uint32_t hashSizeSn, File dups, bool dupsVerb,
    uint32_t* order, uint32_t* order0, uint32_t* order1,
    uint32_t* order2, uint16_t* qual, uint16_t* qual0,
    uint16_t* qual1, uint16_t* qual2, uint64_t* errCount,
    bool verbose) {

  // initialize hashtable
  uint32_t count = readIdxDc * MAX_SIZE + readLenDc;
  uint32_t hashSize = calcHashSize(count);
  if (hashSize > *tableMem) {
    *table = (HashAln**) memrealloc(*table,
      hashSize * sizeof(HashAln*));
    *tableMem = hashSize;
  } else
    hashSize = *tableMem;
  for (uint32_t i = 0; i < hashSize; i++)
    (*table)[i] = NULL;

  // sort reads by qual score sum
  sortReads(readDc, count, order, qual, order0, order1,
    order2, qual0, qual1, qual2);

  // loop through discordant reads
  for (uint32_t i = 0; i < count; i++) {
    Read* r = readDc[order[i] / MAX_SIZE]
      + order[i] % MAX_SIZE;

    // check hashtable for matches
    if (checkHashDc(r, *table, hashSize, dups,
        dupsVerb, gzOut))
      (*dupsDc)++;
    else {
      // add alignments to hashtable(s)
      addHashDc(r, *table, hashSize, dupsVerb,
        tableSn, hashSizeSn);
      // process alignments too (as singletons)
      *singlePr += processSingle(r->name, r->aln,
        r->alnLen, extendOpt, extend, false,
        NULL, NULL, NULL, NULL,
        r->score, asDiff, true,
        atacOpt, atacLen5, atacLen3, atacAdj,
        bed, bedOpt, gzOut, ctrl, sample, errCount,
        verbose);
      *singlePr += processSingle(r->name, r->alnR2,
        r->alnLenR2, extendOpt, extend, false,
        NULL, NULL, NULL, NULL,
        r->scoreR2, asDiff, false,
        atacOpt, atacLen5, atacLen3, atacAdj,
        bed, bedOpt, gzOut, ctrl, sample, errCount,
        verbose);
    }

    // free Read
    free(r->name);
    free(r->aln);
    free(r->alnR2);

    (*countDc)++;
  }

  // free nodes of hashtable
  for (uint32_t i = 0; i < hashSize; i++) {
    HashAln* tmp;
    HashAln* h = (*table)[i];
    while (h != NULL) {
      free(h->name);
      tmp = h->next;
      free(h);
      h = tmp;
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movss %xmm0, 0x8c(%rsp)
movq %r9, 0xb8(%rsp)
movq %r8, 0xd8(%rsp)
movq %rcx, 0xd0(%rsp)
movq %rdi, 0xc0(%rsp)
movq 0x180(%rsp), %r14
movq 0x178(%rsp), %r15
imull $0xfff0, %esi, %ebx     # imm = 0xFFF0
addl %edx, %ebx
movl %ebx, %edi
callq 0x90db
movl (%r14), %r13d
cmpl %r13d, %eax
jbe 0x9e93
movl %eax, %ebp
movq (%r15), %rdi
movl %eax, %eax
movq %rax, 0xa0(%rsp)
leaq (,%rax,8), %rsi
callq 0x2776
movq %rax, (%r15)
movl %ebp, (%r14)
movl %ebp, %eax
movq %rax, 0x98(%rsp)
jmp 0x9ea3
movq %r13, 0x98(%rsp)
movq %r13, 0xa0(%rsp)
movb 0x1f0(%rsp), %r13b
movq 0x1e0(%rsp), %rsi
movq 0x1d8(%rsp), %rdx
movq 0x1d0(%rsp), %rax
movq 0x1c8(%rsp), %rcx
movq 0x1c0(%rsp), %rdi
movq 0x1b8(%rsp), %r9
movq 0x1b0(%rsp), %r8
movb 0x1a0(%rsp), %bpl
movb 0x120(%rsp), %r15b
xorl %r10d, %r10d
cmpq %r10, 0xa0(%rsp)
je 0x9f15
movq 0x178(%rsp), %r11
movq (%r11), %r11
andq $0x0, (%r11,%r10,8)
incq %r10
jmp 0x9ef6
movq %rsi, 0x18(%rsp)
movq %rdx, 0x10(%rsp)
movq %rax, 0x8(%rsp)
movq %rdi, (%rsp)
movq 0xc0(%rsp), %rdi
movl %ebx, %esi
movq 0x1a8(%rsp), %rdx
callq 0x9044
movl %ebx, %eax
movq %rax, 0xe0(%rsp)
xorl %r14d, %r14d
movl $0xfff0, %r12d          # imm = 0xFFF0
movzbl %bpl, %eax
movl %eax, 0x94(%rsp)
movzbl 0x160(%rsp), %eax
movl %eax, 0x90(%rsp)
pushq $0x1
popq %rbx
movzbl %r13b, %eax
movl %eax, 0x88(%rsp)
movzbl 0x168(%rsp), %eax
movl %eax, 0xb4(%rsp)
movzbl 0x158(%rsp), %eax
movl %eax, 0xb0(%rsp)
movzbl 0x148(%rsp), %eax
movl %eax, 0xac(%rsp)
movzbl 0x130(%rsp), %eax
movl %eax, 0xa8(%rsp)
movzbl %r15b, %eax
movl %eax, 0x84(%rsp)
movq 0x98(%rsp), %rbp
movl 0xa8(%rsp), %r13d
cmpq %r14, 0xe0(%rsp)
je 0xa237
movq 0x1a8(%rsp), %rax
movl (%rax,%r14,4), %eax
xorl %edx, %edx
divl %r12d
imulq $0x30, %rdx, %r15
movq 0xc0(%rsp), %rcx
addq (%rcx,%rax,8), %r15
movq 0x178(%rsp), %rax
movq (%rax), %rsi
movq %r15, %rdi
movl %ebp, %edx
movq 0x198(%rsp), %rcx
movl 0x94(%rsp), %r8d
movl 0x90(%rsp), %r9d
callq 0x9b85
movq 0xd8(%rsp), %rdx
movq %rbx, %rcx
testb %al, %al
jne 0xa207
movq 0x178(%rsp), %rax
movq (%rax), %rsi
movq %r15, %rdi
movl %ebp, %edx
movl 0x94(%rsp), %ecx
movq 0x188(%rsp), %r8
movl 0x190(%rsp), %r9d
callq 0x99c6
movq (%r15), %rdi
movq 0x8(%r15), %rsi
movzbl 0x10(%r15), %edx
movss 0x28(%r15), %xmm0
movl 0x88(%rsp), %eax
movl %eax, 0x78(%rsp)
movq 0x1e8(%rsp), %rbx
movq %rbx, 0x70(%rsp)
movl 0x170(%rsp), %r12d
movl %r12d, 0x68(%rsp)
movl 0xb4(%rsp), %r12d
movl %r12d, 0x60(%rsp)
movl 0x90(%rsp), %ebx
movl %ebx, 0x58(%rsp)
movq %r14, 0xc8(%rsp)
movl 0xb0(%rsp), %r14d
movl %r14d, 0x50(%rsp)
movq 0x150(%rsp), %rax
movq %rax, 0x48(%rsp)
movl 0xac(%rsp), %ebp
movl %ebp, 0x40(%rsp)
movl 0x140(%rsp), %eax
movl %eax, 0x38(%rsp)
movl 0x138(%rsp), %eax
movl %eax, 0x30(%rsp)
movl %r13d, 0x28(%rsp)
xorps %xmm1, %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm1, (%rsp)
movl $0x1, 0x20(%rsp)
movl 0x84(%rsp), %ecx
movl 0x128(%rsp), %r8d
xorl %r9d, %r9d
movss 0x8c(%rsp), %xmm1
callq 0x83e9
movl %eax, %eax
movq 0xb8(%rsp), %rcx
addq %rax, (%rcx)
movq (%r15), %rdi
movq 0x18(%r15), %rsi
movzbl 0x20(%r15), %edx
movss 0x2c(%r15), %xmm0
movl 0x88(%rsp), %eax
movl %eax, 0x78(%rsp)
movq 0x1e8(%rsp), %rax
movq %rax, 0x70(%rsp)
movl 0x170(%rsp), %eax
movl %eax, 0x68(%rsp)
movl %r12d, 0x60(%rsp)
movl %ebx, 0x58(%rsp)
pushq $0x1
popq %rbx
movl %r14d, 0x50(%rsp)
movq 0xc8(%rsp), %r14
movq 0x150(%rsp), %rax
movq %rax, 0x48(%rsp)
movl %ebp, 0x40(%rsp)
movl 0x140(%rsp), %eax
movl %eax, 0x38(%rsp)
movl 0x138(%rsp), %eax
movl %eax, 0x30(%rsp)
movl %r13d, 0x28(%rsp)
xorps %xmm1, %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm1, (%rsp)
andl $0x0, 0x20(%rsp)
movl 0x84(%rsp), %ecx
movl 0x128(%rsp), %r8d
xorl %r9d, %r9d
movss 0x8c(%rsp), %xmm1
callq 0x83e9
movl %eax, %ecx
movq 0xb8(%rsp), %rdx
movl $0xfff0, %r12d          # imm = 0xFFF0
movq 0x98(%rsp), %rbp
addq %rcx, (%rdx)
movq (%r15), %rdi
callq 0x2040
movq 0x8(%r15), %rdi
callq 0x2040
movq 0x18(%r15), %rdi
callq 0x2040
movq 0xd0(%rsp), %rax
incq (%rax)
incq %r14
jmp 0x9fd1
xorl %r14d, %r14d
movq 0x178(%rsp), %r12
cmpq 0xa0(%rsp), %r14
je 0xa277
movq (%r12), %rax
movq (%rax,%r14,8), %rbx
testq %rbx, %rbx
je 0xa272
movq (%rbx), %rdi
callq 0x2040
movq 0x28(%rbx), %r15
movq %rbx, %rdi
callq 0x2040
movq %r15, %rbx
jmp 0xa254
incq %r14
jmp 0xa242
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq