// File: 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:
subq $0x98, %rsp
movq %rdi, 0x88(%rsp)
movq %rsi, 0x80(%rsp)
movq 0x80(%rsp), %rax
andl $0x3, %eax
cmpl $0x0, %eax
jne 0x134d9
jmp 0x134f8
leaq 0xc534(%rip), %rdi      # 0x1fa14
leaq 0xbea2(%rip), %rsi      # 0x1f389
movl $0x1e7e, %edx           # imm = 0x1E7E
leaq 0xc5b9(%rip), %rcx      # 0x1faac
callq 0x2140
cmpq $0x0, 0x80(%rsp)
jne 0x13518
movq 0x88(%rsp), %rax
movq %rax, 0x90(%rsp)
jmp 0x13a93
movl 0x88(%rsp), %eax
andl $0x3, %eax
movl %eax, %ecx
movq %rcx, 0x10(%rsp)
subl $0x3, %eax
ja 0x13a83
movq 0x10(%rsp), %rax
leaq 0xbbc6(%rip), %rcx      # 0x1f104
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x88(%rsp), %rax
cmpq 0x80(%rsp), %rax
jne 0x13562
xorl %eax, %eax
movq %rax, 0x8(%rsp)
jmp 0x1356f
movq 0x88(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x90(%rsp)
jmp 0x13a93
movq 0x88(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x78(%rsp)
movl $0x0, 0x74(%rsp)
movq 0x78(%rsp), %rax
movq (%rax), %rax
cmpq 0x80(%rsp), %rax
jne 0x135ba
movq 0x78(%rsp), %rax
movq $0x0, (%rax)
jmp 0x135d3
movq 0x78(%rsp), %rax
cmpq $0x0, (%rax)
setne %al
andb $0x1, %al
movzbl %al, %eax
addl 0x74(%rsp), %eax
movl %eax, 0x74(%rsp)
movq 0x78(%rsp), %rax
movq 0x8(%rax), %rax
cmpq 0x80(%rsp), %rax
jne 0x135f5
movq 0x78(%rsp), %rax
movq $0x0, 0x8(%rax)
jmp 0x1360f
movq 0x78(%rsp), %rax
cmpq $0x0, 0x8(%rax)
setne %al
andb $0x1, %al
movzbl %al, %eax
addl 0x74(%rsp), %eax
movl %eax, 0x74(%rsp)
movq 0x78(%rsp), %rax
movq 0x10(%rax), %rax
cmpq 0x80(%rsp), %rax
jne 0x13631
movq 0x78(%rsp), %rax
movq $0x0, 0x10(%rax)
jmp 0x1364b
movq 0x78(%rsp), %rax
cmpq $0x0, 0x10(%rax)
setne %al
andb $0x1, %al
movzbl %al, %eax
addl 0x74(%rsp), %eax
movl %eax, 0x74(%rsp)
movq 0x78(%rsp), %rax
movq 0x18(%rax), %rax
cmpq 0x80(%rsp), %rax
jne 0x1366d
movq 0x78(%rsp), %rax
movq $0x0, 0x18(%rax)
jmp 0x13687
movq 0x78(%rsp), %rax
cmpq $0x0, 0x18(%rax)
setne %al
andb $0x1, %al
movzbl %al, %eax
addl 0x74(%rsp), %eax
movl %eax, 0x74(%rsp)
cmpl $0x1, 0x74(%rsp)
jne 0x13741
movq 0x78(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x80(%rsp)
cmpq $0x0, 0x80(%rsp)
jne 0x136be
movq 0x78(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x80(%rsp)
cmpq $0x0, 0x80(%rsp)
jne 0x136da
movq 0x78(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x80(%rsp)
cmpq $0x0, 0x80(%rsp)
jne 0x136f6
movq 0x78(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x80(%rsp)
cmpq $0x0, 0x80(%rsp)
je 0x13703
jmp 0x13722
leaq 0xc3ca(%rip), %rdi      # 0x1fad4
leaq 0xbc78(%rip), %rsi      # 0x1f389
movl $0x1e90, %edx           # imm = 0x1E90
leaq 0xc38f(%rip), %rcx      # 0x1faac
callq 0x2140
movq 0x78(%rsp), %rdi
callq 0x12a20
movq 0x80(%rsp), %rax
movq %rax, 0x90(%rsp)
jmp 0x13a93
movq 0x88(%rsp), %rax
movq %rax, 0x90(%rsp)
jmp 0x13a93
movq 0x88(%rsp), %rax
addq $-0x2, %rax
movq %rax, 0x68(%rsp)
movl $0x0, 0x64(%rsp)
movl 0x64(%rsp), %eax
movq 0x68(%rsp), %rcx
cmpl (%rcx), %eax
jge 0x13825
movq 0x68(%rsp), %rax
movslq 0x64(%rsp), %rcx
movq 0x8(%rax,%rcx,8), %rax
cmpq 0x80(%rsp), %rax
jne 0x13813
movq 0x68(%rsp), %rax
movq 0x68(%rsp), %rdx
movl (%rdx), %ecx
addl $-0x1, %ecx
movl %ecx, (%rdx)
movslq %ecx, %rcx
movq 0x8(%rax,%rcx,8), %rdx
movq 0x68(%rsp), %rax
movslq 0x64(%rsp), %rcx
movq %rdx, 0x8(%rax,%rcx,8)
movq 0x68(%rsp), %rax
cmpl $0x3, (%rax)
jne 0x137fe
movq 0x68(%rsp), %rdi
addq $0x8, %rdi
callq 0x13ab0
movq %rax, 0x58(%rsp)
movq 0x68(%rsp), %rdi
callq 0x23c0
movq 0x58(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x90(%rsp)
jmp 0x13a93
movq 0x88(%rsp), %rax
movq %rax, 0x90(%rsp)
jmp 0x13a93
jmp 0x13815
movl 0x64(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x64(%rsp)
jmp 0x1376f
movq 0x88(%rsp), %rax
movq %rax, 0x90(%rsp)
jmp 0x13a93
movq 0x88(%rsp), %rax
addq $-0x3, %rax
movq %rax, 0x50(%rsp)
movq 0x80(%rsp), %rdi
callq 0x8340
movl %eax, 0x4c(%rsp)
movl 0x4c(%rsp), %eax
movq 0x50(%rsp), %rcx
andl 0x4(%rcx), %eax
movl %eax, 0x44(%rsp)
movq 0x50(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rax
movl 0x44(%rsp), %ecx
movq (%rax,%rcx,8), %rax
cmpq 0x80(%rsp), %rax
je 0x138db
movl 0x4c(%rsp), %eax
movl 0x4c(%rsp), %ecx
shrl $0x6, %ecx
addl %ecx, %eax
movl 0x4c(%rsp), %ecx
shrl $0x13, %ecx
addl %ecx, %eax
orl $0x1, %eax
movl %eax, 0x48(%rsp)
movl 0x44(%rsp), %eax
addl 0x48(%rsp), %eax
movq 0x50(%rsp), %rcx
andl 0x4(%rcx), %eax
movl %eax, 0x44(%rsp)
movq 0x38(%rsp), %rax
movl 0x44(%rsp), %ecx
movq (%rax,%rcx,8), %rax
cmpq 0x80(%rsp), %rax
jne 0x138ae
jmp 0x138db
movq 0x38(%rsp), %rax
movl 0x44(%rsp), %ecx
movl $0x1, %edx
movq %rdx, (%rax,%rcx,8)
movq 0x50(%rsp), %rax
movl 0x8(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x8(%rax)
movq 0x50(%rsp), %rax
movl 0xc(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xc(%rax)
movq 0x50(%rsp), %rax
movl 0x8(%rax), %eax
cmpl 0x12a69(%rip), %eax     # 0x26380
jge 0x13a23
movl 0x12a5d(%rip), %edi     # 0x26380
callq 0x46a0
movl %eax, %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, 0x34(%rsp)
movq 0x50(%rsp), %rax
movl 0x8(%rax), %eax
cmpl 0x34(%rsp), %eax
jge 0x13a21
movl 0x34(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rdi
shlq $0x3, %rdi
addq $0x10, %rdi
callq 0x2260
movq %rax, 0x28(%rsp)
movl $0x0, 0x20(%rsp)
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
movq 0x50(%rsp), %rcx
cmpl (%rcx), %eax
jge 0x139ca
movq 0x38(%rsp), %rax
movslq 0x24(%rsp), %rcx
movq (%rax,%rcx,8), %rax
cmpl $0x1, %eax
jbe 0x139bb
movq 0x38(%rsp), %rax
movslq 0x24(%rsp), %rcx
movq (%rax,%rcx,8), %rdx
movq 0x28(%rsp), %rax
movl 0x20(%rsp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, 0x20(%rsp)
movslq %ecx, %rcx
movq %rdx, 0x8(%rax,%rcx,8)
jmp 0x139bd
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0x13973
movl 0x20(%rsp), %eax
movq 0x50(%rsp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x139da
jmp 0x139f9
leaq 0xc101(%rip), %rdi      # 0x1fae2
leaq 0xb9a1(%rip), %rsi      # 0x1f389
movl $0x1ebd, %edx           # imm = 0x1EBD
leaq 0xc0b8(%rip), %rcx      # 0x1faac
callq 0x2140
movl 0x20(%rsp), %ecx
movq 0x28(%rsp), %rax
movl %ecx, (%rax)
movq 0x50(%rsp), %rdi
callq 0x23c0
movq 0x28(%rsp), %rax
addq $0x2, %rax
movq %rax, 0x90(%rsp)
jmp 0x13a93
jmp 0x13a23
movq 0x50(%rsp), %rax
movl 0x8(%rax), %eax
movq 0x50(%rsp), %rcx
cmpl 0x14(%rcx), %eax
jne 0x13a71
movq 0x50(%rsp), %rax
movl (%rax), %edi
sarl %edi
movq 0x50(%rsp), %rax
movl (%rax), %esi
movq 0x38(%rsp), %rdx
callq 0x12bb0
movq %rax, 0x18(%rsp)
movq 0x50(%rsp), %rdi
callq 0x23c0
movq 0x18(%rsp), %rax
addq $0x3, %rax
movq %rax, 0x90(%rsp)
jmp 0x13a93
movq 0x88(%rsp), %rax
movq %rax, 0x90(%rsp)
jmp 0x13a93
movq 0x88(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0x90(%rsp), %rax
addq $0x98, %rsp
retq
nopw %cs:(%rax,%rax)