// File: /workspace/github_cpp_makefile_star2_O2/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_ps_remove
stb_ps *stb_ps_remove(stb_ps *ps, void *value)
{
   #ifdef STB_DEBUG
   assert(stb_ps_find(ps, value));
   #endif
   assert((3 & (int) value) == STB_ps_direct);
   if (value == NULL) return ps; // ignore NULL removes to avoid bad breakage
   switch (3 & (int) ps) {
      case STB_ps_direct:
         return ps == value ? NULL : ps;
      case STB_ps_bucket: {
         stb_ps_bucket *b = GetBucket(ps);
         int count=0;
         assert(STB_BUCKET_SIZE == 4);
         if (b->p[0] == value) b->p[0] = NULL; else count += (b->p[0] != NULL);
         if (b->p[1] == value) b->p[1] = NULL; else count += (b->p[1] != NULL);
         if (b->p[2] == value) b->p[2] = NULL; else count += (b->p[2] != NULL);
         if (b->p[3] == value) b->p[3] = NULL; else count += (b->p[3] != NULL);
         if (count == 1) { // shrink bucket at size 1
            value = b->p[0];
            if (value == NULL) value = b->p[1];
            if (value == NULL) value = b->p[2];
            if (value == NULL) value = b->p[3];
            assert(value != NULL);
            stb_bucket_free(b);
            return (stb_ps *) value; // return STB_ps_direct of value
         }
         return ps;
      }
      case STB_ps_array: {
         stb_ps_array *a = GetArray(ps);
         int i;
         for (i=0; i < a->count; ++i) {
            if (a->p[i] == value) {
               a->p[i] = a->p[--a->count];
               if (a->count == 3) { // shrink to bucket!
                  stb_ps_bucket *b = stb_bucket_create3(a->p);
                  free(a);
                  return EncodeBucket(b);
               }
               return ps;
            }
         }
         return ps;
      }
      case STB_ps_hash: {
         stb_ps_hash *h = GetHash(ps);
         stb_uint32 hash = stb_hashptr(value);
         stb_uint32 s, n = hash & h->mask;
         void **t = h->table;
         if (t[n] != value) {
            s = stb_rehash(hash) | 1;
            do {
               n = (n + s) & h->mask;
            } while (t[n] != value);
         }
         t[n] = STB_DEL;
         -- h->count;
         ++ h->count_deletes;
         // should we shrink down to an array?
         if (h->count < stb_ps_array_max) {
            int n = 1 << stb_log2_floor(stb_ps_array_max);
            if (h->count < n) {
               stb_ps_array *a = (stb_ps_array *) malloc(sizeof(*a) + (n-1) * sizeof(a->p[0]));
               int i,j=0;
               for (i=0; i < h->size; ++i)
                  if (!stb_ps_empty(t[i]))
                     a->p[j++] = t[i];
               assert(j == h->count);
               a->count = j;
               free(h);
               return EncodeArray(a);
            }
         }
         if (h->count == h->shrink_threshhold) {
            stb_ps_hash *h2 = stb_ps_makehash(h->size >> 1, h->size, t);
            free(h);
            return EncodeHash(h2);
         }
         return ps;
      }
   }
   return ps; /* NOTREACHED */
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
testb $0x3, %r14b
jne 0xa919
movq %rdi, %rbx
testq %r14, %r14
je 0xa90c
movl %ebx, %eax
andl $0x3, %eax
leaq 0x5ab4(%rip), %rcx      # 0x101b4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %eax, %eax
cmpq %r14, %rbx
cmoveq %rax, %rbx
jmp 0xa90c
leaq -0x2(%rbx), %r15
movslq -0x2(%rbx), %rax
xorl %ecx, %ecx
testl %eax, %eax
movl $0x0, %edx
cmovgl %eax, %edx
cmpq %rcx, %rdx
je 0xa90c
leaq 0x1(%rcx), %rsi
cmpq %r14, 0x6(%rbx,%rcx,8)
movq %rsi, %rcx
jne 0xa72b
leal -0x1(%rax), %ecx
movl %ecx, -0x2(%rbx)
movq -0x2(%rbx,%rax,8), %rax
movq %rax, -0x2(%rbx,%rsi,8)
cmpl $0x3, %ecx
jne 0xa90c
pushq $0x20
popq %rdi
callq 0x2250
movq %rax, %r14
movdqu 0x6(%rbx), %xmm0
movdqu %xmm0, (%rax)
movq 0x16(%rbx), %rax
movq %rax, 0x10(%r14)
andq $0x0, 0x18(%r14)
movq %r15, %rdi
callq 0x23c0
incq %r14
movq %r14, %rbx
jmp 0xa90c
movq %r14, %rdi
callq 0x5355
movl 0x1(%rbx), %edx
movl %edx, %ecx
andl %eax, %ecx
leaq 0x1d(%rbx), %r15
cmpq %r14, 0x1d(%rbx,%rcx,8)
je 0xa7c2
movl %eax, %esi
shrl $0x6, %esi
addl %eax, %esi
shrl $0x13, %eax
addl %esi, %eax
orl $0x1, %eax
addl %eax, %ecx
andl %edx, %ecx
cmpq %r14, (%r15,%rcx,8)
jne 0xa7b8
leaq -0x3(%rbx), %r14
movq $0x1, 0x1d(%rbx,%rcx,8)
movq 0x5(%rbx), %rax
movq %rax, %xmm0
paddd 0x58e0(%rip), %xmm0     # 0x100c0
movq %xmm0, 0x5(%rbx)
cmpl $0x8, %eax
jg 0xa842
pushq $0x48
popq %rdi
movdqa %xmm0, (%rsp)
callq 0x2250
movdqa (%rsp), %xmm0
movq %rax, %rbx
movl (%r14), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
xorl %edx, %edx
cmpq %rcx, %rax
je 0xa872
movq (%r15,%rcx,8), %rsi
testl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
je 0xa826
movslq %edx, %rdi
incl %edx
movq %rsi, 0x8(%rbx,%rdi,8)
incq %rcx
jmp 0xa80b
leaq -0x1(%rbx), %rdi
movq -0x1(%rbx), %r15
cmpq %r14, %r15
je 0xa88e
xorl %eax, %eax
testq %r15, %r15
setne %al
jmp 0xa897
movd %xmm0, %eax
cmpl 0x11(%rbx), %eax
jne 0xa90c
movl (%r14), %esi
movl %esi, %edi
sarl %edi
movq %r15, %rdx
callq 0xa283
movq %rax, %rbx
movq %r14, %rdi
callq 0x23c0
addq $0x3, %rbx
jmp 0xa90c
movd %xmm0, %eax
cmpl %eax, %edx
jne 0xa938
movl %eax, (%rbx)
movq %r14, %rdi
callq 0x23c0
addq $0x2, %rbx
jmp 0xa90c
andq $0x0, (%rdi)
xorl %r15d, %r15d
xorl %eax, %eax
movq 0x7(%rbx), %rcx
cmpq %r14, %rcx
je 0xa8a9
cmpq $0x1, %rcx
sbbl $-0x1, %eax
jmp 0xa8b0
andq $0x0, 0x7(%rbx)
xorl %ecx, %ecx
movq 0xf(%rbx), %rdx
cmpq %r14, %rdx
je 0xa8c2
cmpq $0x1, %rdx
sbbl $-0x1, %eax
jmp 0xa8c9
andq $0x0, 0xf(%rbx)
xorl %edx, %edx
movq 0x17(%rbx), %rsi
cmpq %r14, %rsi
je 0xa8db
cmpq $0x1, %rsi
sbbl $-0x1, %eax
jmp 0xa8e2
andq $0x0, 0x17(%rbx)
xorl %esi, %esi
cmpl $0x1, %eax
jne 0xa90c
testq %r15, %r15
jne 0xa904
movq %rcx, %r15
testq %rcx, %rcx
jne 0xa904
movq %rdx, %r15
testq %rdx, %rdx
jne 0xa904
movq %rsi, %r15
testq %rsi, %rsi
je 0xa957
callq 0x23c0
movq %r15, %rbx
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x616e(%rip), %rdi      # 0x10a8e
leaq 0x5afa(%rip), %rsi      # 0x10421
leaq 0x61e7(%rip), %rcx      # 0x10b15
movl $0x1e7e, %edx           # imm = 0x1E7E
callq 0x2140
leaq 0x620c(%rip), %rdi      # 0x10b4b
leaq 0x5adb(%rip), %rsi      # 0x10421
leaq 0x61c8(%rip), %rcx      # 0x10b15
movl $0x1ebd, %edx           # imm = 0x1EBD
callq 0x2140
leaq 0x61df(%rip), %rdi      # 0x10b3d
leaq 0x5abc(%rip), %rsi      # 0x10421
leaq 0x61a9(%rip), %rcx      # 0x10b15
movl $0x1e90, %edx           # imm = 0x1E90
callq 0x2140