// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_dupe_finish
void stb_dupe_finish(stb_dupe *sd)
{
   int i,j,k;
   assert(sd->dupes == NULL);
   for (i=0; i < sd->hash_size; ++i) {
      void ** list = sd->hash_table[i];
      if (list != NULL) {                                          
         int n = stb_arr_len(list);
         // @TODO: measure to find good numbers instead of just making them up!
         int thresh = (sd->ineq ? 200 : 20);
         // if n is large enough to be worth it, and n is smaller than
         // before (so we can guarantee we'll use a smaller hash table);
         // and there are enough hash bits left, assuming full 32-bit hash
         if (n > thresh && n < (sd->population >> 3) && sd->hash_shift + sd->size_log2*2 < 32) {

            // recursively process this row using stb_dupe, O(N log log N)

            stb_dupe *d = stb_dupe_create(sd->hash, sd->eq, n, sd->ineq);
            d->hash_shift = stb_randLCG_explicit(sd->hash_shift);
            for (j=0; j < n; ++j)
               stb_dupe_add(d, list[j]);
            stb_arr_free(sd->hash_table[i]);
            stb_dupe_finish(d);
            for (j=0; j < stb_arr_len(d->dupes); ++j) {
               stb_arr_push(sd->dupes, d->dupes[j]);
               d->dupes[j] = NULL; // take over ownership
            }
            stb_dupe_free(d);

         } else if (sd->ineq) {

            // process this row using qsort(), O(N log N)
            stb__compare = sd->ineq;
            qsort(list, n, sizeof(list[0]), stb__dupe_compare);

            // find equal subsequences of the list
            for (j=0; j < n-1; ) {
               // find a subsequence from j..k
               for (k=j; k < n; ++k)
                  // only use ineq so eq can be left undefined
                  if (sd->ineq(list[j], list[k]))
                     break;
               // k is the first one not in the subsequence
               if (k-j > 1) {
                  void **mylist = NULL;
                  stb_arr_setlen(mylist, k-j);
                  memcpy(mylist, list+j, sizeof(list[j]) * (k-j));
                  stb_arr_push(sd->dupes, mylist);
               }
               j = k;
            }
            stb_arr_free(sd->hash_table[i]);
         } else {

            // process this row using eq(), O(N^2)
            for (j=0; j < n; ++j) {
               if (list[j] != NULL) {
                  void **output  = NULL;
                  for (k=j+1; k < n; ++k) {
                     if (sd->eq(list[j], list[k])) {
                        if (output == NULL)
                           stb_arr_push(output, list[j]);
                        stb_arr_push(output, list[k]);
                        list[k] = NULL;
                     }
                  }
                  list[j] = NULL;
                  if (output)
                     stb_arr_push(sd->dupes, output);
               }
            }
            stb_arr_free(sd->hash_table[i]);
         }
      }
   }
   free(sd->hash_table);
   sd->hash_table = NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
cmpq $0x0, 0x30(%rdi)
jne 0xcbb9
movq %rdi, %r15
cmpl $0x0, 0x8(%rdi)
jle 0xcb9b
leaq 0x30(%r15), %r13
xorl %r14d, %r14d
movq %r15, 0x30(%rsp)
movq %r13, 0x20(%rsp)
movq (%r15), %rax
movq (%rax,%r14,8), %rbp
testq %rbp, %rbp
je 0xcb7c
movl -0x10(%rbp), %edi
movq 0x28(%r15), %rcx
testq %rcx, %rcx
movl $0xc8, %edx
movl $0x14, %esi
cmovel %esi, %edx
movq %rdi, 0x8(%rsp)
cmpl %edx, %edi
jle 0xc887
movl 0x10(%r15), %edx
sarl $0x3, %edx
cmpl %edx, 0x8(%rsp)
jge 0xc887
movl 0xc(%r15), %edx
addl %edx, %edx
addl 0x14(%r15), %edx
cmpl $0x1f, %edx
jg 0xc887
movq 0x18(%r15), %rdi
movq 0x20(%r15), %rsi
movq 0x8(%rsp), %r12
movl %r12d, %edx
callq 0xc5cc
imull $0x7ff8a3ed, 0x14(%r15), %ecx # imm = 0x7FF8A3ED
movq %rax, %r13
addl $0x2aa01d31, %ecx       # imm = 0x2AA01D31
movl %ecx, 0x14(%rax)
xorl %ebx, %ebx
movq (%rbp,%rbx,8), %rsi
movq %r13, %rdi
callq 0xc666
incq %rbx
cmpq %rbx, %r12
jne 0xc7e5
movq %r14, %rbp
leaq (,%r14,8), %rdi
addq (%r15), %rdi
callq 0x55ba
movq %r13, %rdi
callq 0xc72b
movq 0x30(%r13), %rbx
xorl %r14d, %r14d
movq %r13, %r12
movq 0x20(%rsp), %r13
testq %rbx, %rbx
je 0xc82f
movslq -0x10(%rbx), %rax
jmp 0xc831
xorl %eax, %eax
cmpq %rax, %r14
jge 0xcb8e
movq (%rbx,%r14,8), %r15
movq (%r13), %rax
testq %rax, %rax
je 0xc856
movl -0x10(%rax), %ecx
cmpl -0xc(%rax), %ecx
jge 0xc856
incl %ecx
movl %ecx, -0x10(%rax)
jmp 0xc86c
movq %r13, %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x56ce
movq (%r13), %rax
movslq -0x10(%rax), %rcx
movq %r15, -0x8(%rax,%rcx,8)
movq $0x0, (%rbx,%r14,8)
incq %r14
movq 0x30(%rsp), %r15
jmp 0xc824
movq %r14, 0x38(%rsp)
testq %rcx, %rcx
movq %rbp, 0x18(%rsp)
je 0xc9d9
movq 0x8(%rsp), %rbx
movslq %ebx, %rsi
movq %rcx, 0x13527(%rip)     # 0x1fdd0
movl $0x8, %edx
movq %rbp, %rdi
movq %rsi, 0x28(%rsp)
leaq 0x31b(%rip), %rcx       # 0xcbd8
callq 0x20a0
movq %rbx, %rax
cmpl $0x2, %eax
jl 0xc9bf
leal -0x1(%rax), %ebp
xorl %r12d, %r12d
xorl %r14d, %r14d
movslq %r12d, %rbx
cmpl %eax, %r12d
jge 0xc930
movq 0x18(%rsp), %rax
leaq (%rax,%rbx,8), %r15
movq 0x28(%rsp), %r13
subq %rbx, %r13
xorl %r14d, %r14d
movq 0x18(%rsp), %rax
movq (%rax,%rbx,8), %rdi
movq (%r15,%r14,8), %rsi
movq 0x30(%rsp), %rax
callq *0x28(%rax)
testl %eax, %eax
jne 0xc923
incq %r14
cmpq %r14, %r13
jne 0xc8f3
movq 0x8(%rsp), %rax
movl %eax, %r14d
movq 0x20(%rsp), %r13
jmp 0xc930
addl %r12d, %r14d
movq 0x20(%rsp), %r13
movq 0x8(%rsp), %rax
movl %r14d, %r15d
subl %r12d, %r15d
cmpl $0x2, %r15d
jl 0xc9b3
movq $0x0, 0x10(%rsp)
leaq 0x10(%rsp), %rdi
movl $0x8, %esi
movl %r15d, %edx
movl %r15d, %ecx
callq 0x55f6
movq 0x10(%rsp), %r12
movq 0x18(%rsp), %rax
leaq (%rax,%rbx,8), %rsi
movl %r15d, %edx
shlq $0x3, %rdx
movq %r12, %rdi
callq 0x2230
movq (%r13), %rax
testq %rax, %rax
je 0xc98f
movl -0x10(%rax), %ecx
cmpl -0xc(%rax), %ecx
jge 0xc98f
incl %ecx
movl %ecx, -0x10(%rax)
jmp 0xc9a5
movq %r13, %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x56ce
movq (%r13), %rax
movslq -0x10(%rax), %rcx
movq %r12, -0x8(%rax,%rcx,8)
movq 0x8(%rsp), %rax
movl %r14d, %r12d
cmpl %ebp, %r14d
jl 0xc8d7
movq 0x38(%rsp), %r14
leaq (,%r14,8), %rdi
movq 0x30(%rsp), %r15
addq (%r15), %rdi
jmp 0xcb77
movq 0x8(%rsp), %rcx
testl %ecx, %ecx
jle 0xcb6e
movq %rcx, 0x28(%rsp)
movq %rbp, %r12
xorl %r14d, %r14d
movq %rcx, %rax
cmpq $0x0, (%rbp,%r14,8)
je 0xcb1a
movq $0x0, 0x10(%rsp)
leaq 0x1(%r14), %rcx
movq %rcx, 0x40(%rsp)
cmpq %rax, %rcx
jge 0xcb22
movl $0x1, %ebp
xorl %r13d, %r13d
xorl %ebx, %ebx
movq 0x18(%rsp), %rax
movq (%rax,%r14,8), %rdi
movq (%r12,%rbp,8), %rsi
callq *0x20(%r15)
testl %eax, %eax
je 0xcad2
testq %rbx, %rbx
je 0xca48
movl -0x10(%rbx), %eax
jmp 0xca7b
movq 0x18(%rsp), %rax
movq (%rax,%r14,8), %rbx
leaq 0x10(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x56ce
movq 0x10(%rsp), %r13
testq %r13, %r13
je 0xca8b
movslq -0x10(%r13), %rax
movq %rbx, -0x8(%r13,%rax,8)
movq %r13, %rbx
movq (%r12,%rbp,8), %r15
cmpl -0xc(%rbx), %eax
jge 0xca97
incl %eax
movl %eax, -0x10(%rbx)
jmp 0xcab0
movq %rbx, -0x8
movq (%r12,%rbp,8), %r15
leaq 0x10(%rsp), %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x56ce
movq 0x10(%rsp), %r13
testq %r13, %r13
je 0xcabb
movslq -0x10(%r13), %rax
jmp 0xcabd
xorl %eax, %eax
movq %r15, -0x8(%r13,%rax,8)
movq $0x0, (%r12,%rbp,8)
movq %r13, %rbx
movq 0x30(%rsp), %r15
incq %rbp
cmpq %rbp, 0x28(%rsp)
jne 0xca25
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %rbp
movq $0x0, (%rbp,%r14,8)
testq %rbx, %rbx
movq 0x20(%rsp), %r13
movq 0x8(%rsp), %rax
je 0xcb51
movq (%r13), %rax
testq %rax, %rax
je 0xcb2d
movl -0x10(%rax), %ecx
cmpl -0xc(%rax), %ecx
jge 0xcb2d
incl %ecx
movl %ecx, -0x10(%rax)
jmp 0xcb43
incq %r14
movq %r14, %rcx
jmp 0xcb59
movq $0x0, (%rbp,%r14,8)
jmp 0xcb51
movq %r13, %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x56ce
movq (%r13), %rax
movslq -0x10(%rax), %rcx
movq %rbx, -0x8(%rax,%rcx,8)
movq 0x8(%rsp), %rax
movq 0x40(%rsp), %rcx
movq %rcx, %r14
addq $0x8, %r12
decq 0x28(%rsp)
cmpq %rax, %rcx
jne 0xc9f4
movq (%r15), %rax
movq 0x38(%rsp), %r14
leaq (%rax,%r14,8), %rdi
callq 0x55ba
incq %r14
movslq 0x8(%r15), %rax
cmpq %rax, %r14
jl 0xc762
jmp 0xcb9b
movq %r12, %rdi
callq 0xc6ce
movq %rbp, %r14
jmp 0xcb7c
movq (%r15), %rdi
callq 0x23c0
movq $0x0, (%r15)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x60e6(%rip), %rdi      # 0x12ca6
leaq 0x58ea(%rip), %rsi      # 0x124b1
leaq 0x60ea(%rip), %rcx      # 0x12cb8
movl $0x20e8, %edx           # imm = 0x20E8
callq 0x2140