// File: /workspace/github_cpp_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
testb $0x3, %sil
jne 0xbcc3
movq %rdi, %rbx
testq %rsi, %rsi
je 0xbc5f
movl %ebx, %eax
andl $0x3, %eax
leaq 0x6849(%rip), %rcx      # 0x12284
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %r14d, %r14d
cmpq %rsi, %rbx
cmovneq %rbx, %r14
jmp 0xbc62
movslq -0x2(%rbx), %rax
testq %rax, %rax
jle 0xbc5f
leaq -0x2(%rbx), %r15
xorl %ecx, %ecx
cmpq %rsi, 0x6(%rbx,%rcx,8)
je 0xbc17
incq %rcx
cmpq %rcx, %rax
jne 0xba66
jmp 0xbc5f
movl %esi, %eax
shrl $0x6, %eax
addl %esi, %eax
movl %esi, %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), %edx
movl %edx, %ecx
andl %eax, %ecx
leaq 0x1d(%rbx), %r15
cmpq %rsi, 0x1d(%rbx,%rcx,8)
je 0xbaf2
movl %eax, %edi
shrl $0x6, %edi
addl %eax, %edi
shrl $0x13, %eax
addl %edi, %eax
orl $0x1, %eax
addl %eax, %ecx
andl %edx, %ecx
cmpq %rsi, (%r15,%rcx,8)
jne 0xbae8
leaq -0x3(%rbx), %r12
movl %ecx, %eax
movq $0x1, 0x1d(%rbx,%rax,8)
movq 0x5(%rbx), %r13
movq %r13, %xmm0
paddd 0x665e(%rip), %xmm0     # 0x12170
movq %xmm0, 0x5(%rbx)
cmpl $0xd, %r13d
jg 0xbc97
cmpl $0x8, %r13d
jg 0xbc91
movdqa %xmm0, (%rsp)
movl $0x48, %edi
callq 0x2250
movq %rax, %r14
movslq (%r12), %rcx
testq %rcx, %rcx
jle 0xbc73
xorl %edx, %edx
xorl %eax, %eax
movdqa (%rsp), %xmm0
movq (%r15,%rdx,8), %rsi
testl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
je 0xbb69
movslq %eax, %rdi
incl %eax
movq %rsi, 0x8(%r14,%rdi,8)
incq %rdx
cmpq %rdx, %rcx
jne 0xbb53
jmp 0xbc7a
leaq -0x1(%rbx), %rdi
movq -0x1(%rbx), %rcx
cmpq %rsi, %rcx
je 0xbb8d
xorl %eax, %eax
testq %rcx, %rcx
setne %al
jmp 0xbb96
movq $0x0, (%rdi)
xorl %eax, %eax
movq 0x7(%rbx), %rcx
cmpq %rsi, %rcx
je 0xbba8
cmpq $0x1, %rcx
sbbl $-0x1, %eax
jmp 0xbbb0
movq $0x0, 0x7(%rbx)
movq 0xf(%rbx), %rcx
cmpq %rsi, %rcx
je 0xbbc2
cmpq $0x1, %rcx
sbbl $-0x1, %eax
jmp 0xbbca
movq $0x0, 0xf(%rbx)
movq 0x17(%rbx), %rcx
cmpq %rsi, %rcx
je 0xbbdc
cmpq $0x1, %rcx
sbbl $-0x1, %eax
jmp 0xbbe4
movq $0x0, 0x17(%rbx)
cmpl $0x1, %eax
jne 0xbc5f
movq (%rdi), %r14
testq %r14, %r14
jne 0xbbf5
movq 0x7(%rbx), %r14
testq %r14, %r14
jne 0xbbfe
movq 0xf(%rbx), %r14
testq %r14, %r14
jne 0xbc07
movq 0x17(%rbx), %r14
testq %r14, %r14
je 0xbce2
callq 0x23d0
jmp 0xbc62
leal -0x1(%rax), %edx
movl %edx, -0x2(%rbx)
movq -0x2(%rbx,%rax,8), %rax
movq %rax, 0x6(%rbx,%rcx,8)
cmpl $0x3, %edx
jne 0xbc5f
movl $0x20, %edi
callq 0x2250
movq %rax, %r14
movdqu 0x6(%rbx), %xmm0
movdqu %xmm0, (%rax)
movq 0x16(%rbx), %rax
movq %rax, 0x10(%r14)
movq $0x0, 0x18(%r14)
movq %r15, %rdi
callq 0x23d0
incq %r14
jmp 0xbc62
movq %rbx, %r14
movq %r14, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
xorl %eax, %eax
movdqa (%rsp), %xmm0
movd %xmm0, %ecx
cmpl %ecx, %eax
jne 0xbd01
movl %eax, (%r14)
movq %r12, %rdi
callq 0x23d0
addq $0x2, %r14
cmpl $0x9, %r13d
jl 0xbc62
movl 0x5(%rbx), %eax
movq %rbx, %r14
cmpl 0x11(%rbx), %eax
jne 0xbc62
movl (%r12), %esi
movl %esi, %edi
sarl %edi
movq %r15, %rdx
callq 0xb55a
movq %rax, %r14
movq %r12, %rdi
callq 0x23d0
addq $0x3, %r14
jmp 0xbc62
leaq 0x6ea4(%rip), %rdi      # 0x12b6e
leaq 0x6830(%rip), %rsi      # 0x12501
leaq 0x6f1d(%rip), %rcx      # 0x12bf5
movl $0x1e7e, %edx           # imm = 0x1E7E
callq 0x2140
leaq 0x6f34(%rip), %rdi      # 0x12c1d
leaq 0x6811(%rip), %rsi      # 0x12501
leaq 0x6efe(%rip), %rcx      # 0x12bf5
movl $0x1e90, %edx           # imm = 0x1E90
callq 0x2140
leaq 0x6f23(%rip), %rdi      # 0x12c2b
leaq 0x67f2(%rip), %rsi      # 0x12501
leaq 0x6edf(%rip), %rcx      # 0x12bf5
movl $0x1ebd, %edx           # imm = 0x1EBD
callq 0x2140