// File: /workspace/github_cpp_makefile_star2_O3/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
testb $0x3, %sil
jne 0xbb58
movq %rdi, %rbx
testq %rsi, %rsi
je 0xbb4b
movl %ebx, %eax
andl $0x3, %eax
leaq 0x6955(%rip), %rcx      # 0x12234
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %eax, %eax
cmpq %rsi, %rbx
cmoveq %rax, %rbx
jmp 0xbb4b
movslq -0x2(%rbx), %rax
testq %rax, %rax
jle 0xbb4b
leaq -0x2(%rbx), %r14
xorl %ecx, %ecx
cmpq %rsi, 0x6(%rbx,%rcx,8)
je 0xbae3
incq %rcx
cmpq %rcx, %rax
jne 0xb909
jmp 0xbb4b
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), %r14
cmpq %rsi, 0x1d(%rbx,%rcx,8)
je 0xb995
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, (%r14,%rcx,8)
jne 0xb98b
leaq -0x3(%rbx), %r15
movq $0x1, 0x1d(%rbx,%rcx,8)
movq 0x5(%rbx), %rax
movq %rax, %xmm0
paddd 0x675d(%rip), %xmm0     # 0x12110
movq %xmm0, 0x5(%rbx)
cmpl $0x8, %eax
jg 0xba1e
movdqa %xmm0, (%rsp)
movl $0x48, %edi
callq 0x2250
movq %rax, %rbx
movslq (%r15), %rax
testq %rax, %rax
jle 0xbb2e
xorl %edx, %edx
xorl %ecx, %ecx
movdqa (%rsp), %xmm0
movq (%r14,%rdx,8), %rsi
testl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
je 0xb9fa
movslq %ecx, %rdi
incl %ecx
movq %rsi, 0x8(%rbx,%rdi,8)
incq %rdx
cmpq %rdx, %rax
jne 0xb9e4
jmp 0xbb35
leaq -0x1(%rbx), %rdi
movq -0x1(%rbx), %r14
cmpq %rsi, %r14
je 0xba4e
xorl %eax, %eax
testq %r14, %r14
setne %al
jmp 0xba5a
movd %xmm0, %eax
cmpl 0x11(%rbx), %eax
jne 0xbb4b
movl (%r15), %esi
movl %esi, %edi
sarl %edi
movq %r14, %rdx
callq 0xb3fa
movq %rax, %rbx
movq %r15, %rdi
callq 0x23c0
addq $0x3, %rbx
jmp 0xbb4b
movq $0x0, (%rdi)
xorl %r14d, %r14d
xorl %eax, %eax
movq 0x7(%rbx), %rcx
cmpq %rsi, %rcx
je 0xba6c
cmpq $0x1, %rcx
sbbl $-0x1, %eax
jmp 0xba76
movq $0x0, 0x7(%rbx)
xorl %ecx, %ecx
movq 0xf(%rbx), %rdx
cmpq %rsi, %rdx
je 0xba88
cmpq $0x1, %rdx
sbbl $-0x1, %eax
jmp 0xba92
movq $0x0, 0xf(%rbx)
xorl %edx, %edx
movq 0x17(%rbx), %r8
cmpq %rsi, %r8
je 0xbaa4
cmpq $0x1, %r8
sbbl $-0x1, %eax
jmp 0xbaaf
movq $0x0, 0x17(%rbx)
xorl %r8d, %r8d
cmpl $0x1, %eax
jne 0xbb4b
testq %r14, %r14
jne 0xbad9
movq %rcx, %r14
testq %rcx, %rcx
jne 0xbad9
movq %rdx, %r14
testq %rdx, %rdx
jne 0xbad9
movq %r8, %r14
testq %r8, %r8
je 0xbb96
callq 0x23c0
movq %r14, %rbx
jmp 0xbb4b
leal -0x1(%rax), %edx
movl %edx, -0x2(%rbx)
movq -0x2(%rbx,%rax,8), %rax
movq %rax, 0x6(%rbx,%rcx,8)
cmpl $0x3, %edx
jne 0xbb4b
movl $0x20, %edi
callq 0x2250
movq %rax, %r15
movdqu 0x6(%rbx), %xmm0
movdqu %xmm0, (%rax)
movq 0x16(%rbx), %rax
movq %rax, 0x10(%r15)
movq $0x0, 0x18(%r15)
movq %r14, %rdi
callq 0x23c0
incq %r15
movq %r15, %rbx
jmp 0xbb4b
xorl %ecx, %ecx
movdqa (%rsp), %xmm0
movd %xmm0, %eax
cmpl %eax, %ecx
jne 0xbb77
movl %eax, (%rbx)
movq %r15, %rdi
callq 0x23c0
addq $0x2, %rbx
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x6fbf(%rip), %rdi      # 0x12b1e
leaq 0x694b(%rip), %rsi      # 0x124b1
leaq 0x7038(%rip), %rcx      # 0x12ba5
movl $0x1e7e, %edx           # imm = 0x1E7E
callq 0x2140
leaq 0x705d(%rip), %rdi      # 0x12bdb
leaq 0x692c(%rip), %rsi      # 0x124b1
leaq 0x7019(%rip), %rcx      # 0x12ba5
movl $0x1ebd, %edx           # imm = 0x1EBD
callq 0x2140
leaq 0x7030(%rip), %rdi      # 0x12bcd
leaq 0x690d(%rip), %rsi      # 0x124b1
leaq 0x6ffa(%rip), %rcx      # 0x12ba5
movl $0x1e90, %edx           # imm = 0x1E90
callq 0x2140