// File: /workspace/github_cpp_makefile_star2_O3/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 %rdi, %rbx
testq %rsi, %rsi
je 0xb86d
movq %rsi, %r14
testb $0x3, %r14b
jne 0xb876
cmpq $0x2, %r14
jb 0xb895
movl %ebx, %eax
andl $0x3, %eax
cmpl $0x2, %eax
jne 0xb6a0
leaq -0x2(%rbx), %r15
movl -0x2(%rbx), %eax
cmpl $0xd, %eax
jne 0xb7ec
addq $0x6, %rbx
movl $0x20, %edi
movl $0xd, %esi
movq %rbx, %rdx
callq 0xb3fa
movq %rax, %rbx
movq %r15, %rdi
callq 0x23c0
addq $0x3, %rbx
jmp 0xb65f
testl %eax, %eax
je 0xb716
cmpl $0x1, %eax
jne 0xb742
leaq -0x1(%rbx), %r15
cmpq $0x0, -0x1(%rbx)
je 0xb853
cmpq $0x0, 0x7(%rbx)
je 0xb85d
cmpq $0x0, 0xf(%rbx)
je 0xb863
cmpq $0x0, 0x17(%rbx)
je 0xb869
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 0x23c0
addq $0x2, %rbx
jmp 0xb86d
testq %rbx, %rbx
je 0xb858
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 0xb86d
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
movq 0x1d(%rbx,%rcx,8), %rdi
testl $0xfffffffe, %edi       # imm = 0xFFFFFFFE
je 0xb7c5
movl %eax, %edi
shrl $0x6, %edi
addl %eax, %edi
shrl $0x13, %eax
addl %edi, %eax
orl $0x1, %eax
addl %eax, %ecx
andl %esi, %ecx
movq (%rdx,%rcx,8), %rdi
testl $0xfffffffe, %edi       # imm = 0xFFFFFFFE
jne 0xb7b5
cmpq $0x1, %rdi
jne 0xb7ce
decl 0x9(%rbx)
leaq -0x3(%rbx), %r15
movq %r14, 0x1d(%rbx,%rcx,8)
movl 0x5(%rbx), %eax
incl %eax
movl %eax, 0x5(%rbx)
cmpl 0xd(%rbx), %eax
jne 0xb830
movl (%r15), %esi
leal (%rsi,%rsi), %edi
jmp 0xb83d
leal -0x1(%rax), %ecx
testl %ecx, %eax
jne 0xb81a
cmpl $0x5, %eax
leal -0x1(%rax,%rax), %eax
movl $0xc, %ecx
cmovll %eax, %ecx
movslq %ecx, %rax
leaq 0x10(,%rax,8), %rsi
movq %r15, %rdi
callq 0x22b0
movq %rax, %r15
movl (%rax), %eax
leal 0x1(%rax), %ecx
movl %ecx, (%r15)
cltq
movq %r14, 0x8(%r15,%rax,8)
addq $0x2, %r15
movq %r15, %rbx
jmp 0xb86d
addl 0x9(%rbx), %eax
cmpl 0x15(%rbx), %eax
jne 0xb86d
movl (%r15), %edi
movl %edi, %esi
callq 0xb3fa
movq %rax, %rbx
movq %r15, %rdi
callq 0x23c0
addq $0x3, %rbx
jmp 0xb86d
movq %r14, (%r15)
jmp 0xb86d
movq %r14, %rbx
jmp 0xb86d
movq %r14, 0x7(%rbx)
jmp 0xb86d
movq %r14, 0xf(%rbx)
jmp 0xb86d
movq %r14, 0x17(%rbx)
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x72a1(%rip), %rdi      # 0x12b1e
leaq 0x6c2d(%rip), %rsi      # 0x124b1
leaq 0x72f5(%rip), %rcx      # 0x12b80
movl $0x1e2a, %edx           # imm = 0x1E2A
callq 0x2140
leaq 0x72c7(%rip), %rdi      # 0x12b63
leaq 0x6c0e(%rip), %rsi      # 0x124b1
leaq 0x72d6(%rip), %rcx      # 0x12b80
movl $0x1e2b, %edx           # imm = 0x1E2B
callq 0x2140