// File: /workspace/github_cpp_makefile_star2_O1/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_ps_add
stb_ps *  stb_ps_add   (stb_ps *ps, void *value)
{
   #ifdef STB_DEBUG
   assert(!stb_ps_find(ps,value));
   #endif
   if (value == NULL) return ps; // ignore NULL adds to avoid bad breakage
   assert((3 & (int) value) == STB_ps_direct);
   assert(stb_ps_fastlist_valid(value));
   assert(value != STB_DEL);     // STB_DEL is less likely

   switch (3 & (int) ps) {
      case STB_ps_direct:
         if (ps == NULL) return (stb_ps *) value;
         return EncodeBucket(stb_bucket_create2(ps,value));

      case STB_ps_bucket: {
         stb_ps_bucket *b = GetBucket(ps);
         stb_ps_array  *a;
         assert(STB_BUCKET_SIZE == 4);
         if (b->p[0] == NULL) { b->p[0] = value; return ps; }
         if (b->p[1] == NULL) { b->p[1] = value; return ps; }
         if (b->p[2] == NULL) { b->p[2] = value; return ps; }
         if (b->p[3] == NULL) { b->p[3] = value; return ps; }
         a = (stb_ps_array *) malloc(sizeof(*a) + 7 * sizeof(a->p[0])); // 8 slots, must be 2^k
         memcpy(a->p, b, sizeof(*b));
         a->p[4] = value;
         a->count = 5;
         stb_bucket_free(b);
         return EncodeArray(a);
      }

      case STB_ps_array: {
         stb_ps_array *a = GetArray(ps);
         if (a->count == stb_ps_array_max) {
            // promote from array to hash
            stb_ps_hash *h = stb_ps_makehash(2 << stb_log2_ceil(a->count), a->count, a->p);
            free(a);
            return stb_ps_add(EncodeHash(h), value);
         }
         // do we need to resize the array? the array doubles in size when it
         // crosses a power-of-two
         if ((a->count & (a->count-1))==0) {
            int newsize = a->count*2;
            // clamp newsize to max if:
            //    1. it's larger than max
            //    2. newsize*1.5 is larger than max (to avoid extra resizing)
            if (newsize + a->count > stb_ps_array_max)
               newsize = stb_ps_array_max;
            a = (stb_ps_array *) realloc(a, sizeof(*a) + (newsize-1) * sizeof(a->p[0]));
         }
         a->p[a->count++] = value;
         return EncodeArray(a);
      }
      case STB_ps_hash: {
         stb_ps_hash *h = GetHash(ps);
         stb_uint32 hash = stb_hashptr(value);
         stb_uint32 n = hash & h->mask;
         void **t = h->table;
         // find first NULL or STB_DEL entry
         if (!stb_ps_empty(t[n])) {
            stb_uint32 s = stb_rehash(hash) | 1;
            do {
               n = (n + s) & h->mask;
            } while (!stb_ps_empty(t[n]));
         }
         if (t[n] == STB_DEL)
            -- h->count_deletes;
         t[n] = value;
         ++ h->count;
         if (h->count == h->grow_threshhold) {
            stb_ps_hash *h2 = stb_ps_makehash(h->size*2, h->size, t);
            free(h);
            return EncodeHash(h2);
         }
         if (h->count + h->count_deletes == h->rehash_threshhold) {
            stb_ps_hash *h2 = stb_ps_makehash(h->size, h->size, t);
            free(h);
            return EncodeHash(h2);
         }
         return ps;
      }
   }
   return NULL; /* NOTREACHED */
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
testq %r14, %r14
je 0xb9c5
testb $0x3, %r14b
jne 0xb9ce
cmpq $0x1, %r14
jbe 0xb9ed
movl %ebx, %eax
andl $0x3, %eax
cmpl $0x2, %eax
jne 0xb7fb
leaq -0x2(%rbx), %r15
movl -0x2(%rbx), %esi
cmpl $0xd, %esi
jne 0xb945
addq $0x6, %rbx
movl $0x20, %edi
movq %rbx, %rdx
callq 0xb55a
movq %rax, %rbx
movq %r15, %rdi
callq 0x23d0
addq $0x3, %rbx
jmp 0xb7a2
cmpl $0x3, %eax
je 0xb872
cmpl $0x1, %eax
jne 0xb919
leaq -0x1(%rbx), %r15
cmpq $0x0, -0x1(%rbx)
je 0xb9ab
cmpq $0x0, 0x7(%rbx)
je 0xb9b5
cmpq $0x0, 0xf(%rbx)
je 0xb9bb
cmpq $0x0, 0x17(%rbx)
je 0xb9c1
movl $0x48, %edi
callq 0x2250
movq %rax, %rbx
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movups %xmm0, 0x8(%rax)
movups %xmm1, 0x18(%rax)
movq %r14, 0x28(%rax)
movl $0x5, (%rax)
movq %r15, %rdi
callq 0x23d0
addq $0x2, %rbx
jmp 0xb9c5
movl %r14d, %eax
shrl $0x6, %eax
addl %r14d, %eax
movl %r14d, %ecx
shrl $0x13, %ecx
addl %eax, %ecx
movl %ecx, %eax
shll $0x10, %eax
addl %ecx, %eax
movl %ecx, %edx
shll $0x13, %edx
leal (%rdx,%rcx,8), %ecx
xorl %eax, %ecx
movl %ecx, %eax
shrl $0x5, %eax
addl %ecx, %eax
leal (,%rax,4), %ecx
xorl %eax, %ecx
movl %ecx, %edx
shrl $0xf, %edx
addl %ecx, %edx
movl %edx, %eax
shll $0xa, %eax
xorl %edx, %eax
movl %eax, %ecx
shrl $0x6, %ecx
addl %eax, %ecx
shrl $0x13, %eax
addl %ecx, %eax
movl 0x1(%rbx), %esi
movl %esi, %ecx
andl %eax, %ecx
leaq 0x1d(%rbx), %rdx
testl $0xfffffffe, 0x1d(%rbx,%rcx,8) # imm = 0xFFFFFFFE
je 0xb8ef
movl %eax, %edi
shrl $0x6, %edi
addl %eax, %edi
shrl $0x13, %eax
addl %edi, %eax
orl $0x1, %eax
addl %eax, %ecx
andl %esi, %ecx
testl $0xfffffffe, (%rdx,%rcx,8) # imm = 0xFFFFFFFE
jne 0xb8e2
movl %ecx, %eax
cmpq $0x1, (%rdx,%rax,8)
jne 0xb8fb
decl 0x9(%rbx)
leaq -0x3(%rbx), %r15
movq %r14, 0x1d(%rbx,%rax,8)
movl 0x5(%rbx), %eax
incl %eax
movl %eax, 0x5(%rbx)
cmpl 0xd(%rbx), %eax
jne 0xb988
movl (%r15), %esi
leal (%rsi,%rsi), %edi
jmp 0xb995
testq %rbx, %rbx
je 0xb9b0
movl $0x20, %edi
callq 0x2250
movq %rbx, (%rax)
movq %r14, 0x8(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
incq %rax
movq %rax, %rbx
jmp 0xb9c5
leal -0x1(%rsi), %eax
testl %eax, %esi
jne 0xb971
cmpl $0x5, %esi
leal -0x1(%rsi,%rsi), %eax
movl $0xc, %ecx
cmovll %eax, %ecx
movslq %ecx, %rax
leaq 0x10(,%rax,8), %rsi
movq %r15, %rdi
callq 0x22b0
movq %rax, %r15
movslq (%r15), %rax
leal 0x1(%rax), %ecx
movl %ecx, (%r15)
movq %r14, 0x8(%r15,%rax,8)
addq $0x2, %r15
movq %r15, %rbx
jmp 0xb9c5
addl 0x9(%rbx), %eax
cmpl 0x15(%rbx), %eax
jne 0xb9c5
movl (%r15), %edi
movl %edi, %esi
callq 0xb55a
movq %rax, %rbx
movq %r15, %rdi
callq 0x23d0
addq $0x3, %rbx
jmp 0xb9c5
movq %r14, (%r15)
jmp 0xb9c5
movq %r14, %rbx
jmp 0xb9c5
movq %r14, 0x7(%rbx)
jmp 0xb9c5
movq %r14, 0xf(%rbx)
jmp 0xb9c5
movq %r14, 0x17(%rbx)
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x7199(%rip), %rdi      # 0x12b6e
leaq 0x6b25(%rip), %rsi      # 0x12501
leaq 0x71ed(%rip), %rcx      # 0x12bd0
movl $0x1e2a, %edx           # imm = 0x1E2A
callq 0x2140
leaq 0x71bf(%rip), %rdi      # 0x12bb3
leaq 0x6b06(%rip), %rsi      # 0x12501
leaq 0x71ce(%rip), %rcx      # 0x12bd0
movl $0x1e2b, %edx           # imm = 0x1E2B
callq 0x2140