// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_ps_remove_any
stb_ps *stb_ps_remove_any(stb_ps *ps, void **value)
{
   assert(ps != NULL);
   switch (3 & (int) ps) {
      case STB_ps_direct:
         *value = ps;
         return NULL;
      case STB_ps_bucket: {
         stb_ps_bucket *b = GetBucket(ps);
         int count=0, slast=0, last=0;
         assert(STB_BUCKET_SIZE == 4);
         if (b->p[0]) { ++count;               last = 0; }
         if (b->p[1]) { ++count; slast = last; last = 1; }
         if (b->p[2]) { ++count; slast = last; last = 2; }
         if (b->p[3]) { ++count; slast = last; last = 3; }
         *value = b->p[last];
         b->p[last] = 0;
         if (count == 2) {
            void *leftover = b->p[slast]; // second to last
            stb_bucket_free(b);
            return (stb_ps *) leftover; 
         }
         return ps;
      }
      case STB_ps_array: {
         stb_ps_array *a = GetArray(ps);
         *value = a->p[a->count-1];
         if (a->count == 4)
            return stb_ps_remove(ps, *value);
         --a->count;
         return ps;
      }
      case STB_ps_hash: {
         stb_ps_hash *h = GetHash(ps);
         void **t = h->table;
         stb_uint32 n = h->any_offset;
         while (stb_ps_empty(t[n]))
            n = (n + 1) & h->mask;
         *value = t[n];
         h->any_offset = (n+1) & h->mask;
         // check if we need to skip down to the previous type
         if (h->count-1 < stb_ps_array_max || h->count-1 == h->shrink_threshhold)
            return stb_ps_remove(ps, *value);
         t[n] = STB_DEL;
         -- h->count;
         ++ h->count_deletes;
         return ps;
      }
   }
   return ps; /* NOTREACHED */
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0xbcd7
movl %edi, %eax
andl $0x3, %eax
leaq 0x6679(%rip), %rcx      # 0x12244
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rdi, (%rsi)
xorl %edi, %edi
jmp 0xbcd2
movslq -0x2(%rdi), %rcx
movq -0x2(%rdi,%rcx,8), %rax
movq %rax, (%rsi)
cmpq $0x4, %rcx
je 0xbc32
decq %rcx
movl %ecx, -0x2(%rdi)
jmp 0xbcd2
movl 0x1(%rdi), %edx
movl 0x19(%rdi), %ecx
movq 0x1d(%rdi,%rcx,8), %rax
testl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jne 0xbc13
incl %ecx
andl %edx, %ecx
jmp 0xbc01
movq %rax, (%rsi)
movl %ecx, %esi
incl %esi
andl %esi, %edx
movl %edx, 0x19(%rdi)
movl 0x5(%rdi), %edx
cmpl $0xe, %edx
jl 0xbc32
decl %edx
cmpl 0x11(%rdi), %edx
jne 0xbcc3
movq %rax, %rsi
popq %rbx
jmp 0xb8b4
xorl %ecx, %ecx
cmpq $0x0, -0x1(%rdi)
setne %cl
xorl %eax, %eax
cmpq $0x0, 0x7(%rdi)
leal 0x1(%rcx), %r9d
setne %al
cmovel %ecx, %r9d
movq 0xf(%rdi), %rdx
movq 0x17(%rdi), %rcx
xorl %r10d, %r10d
testq %rdx, %rdx
setne %r10b
movl $0x2, %r8d
cmovel %eax, %r8d
xorl %r11d, %r11d
testq %rcx, %rcx
setne %r11b
movl $0x3, %ebx
cmovel %r8d, %ebx
addl %r10d, %r11d
addl %r9d, %r11d
movq -0x1(%rdi,%rbx,8), %r9
movq %r9, (%rsi)
movq $0x0, -0x1(%rdi,%rbx,8)
cmpl $0x2, %r11d
jne 0xbcd2
decq %rdi
xorl %esi, %esi
testq %rdx, %rdx
cmovnel %eax, %esi
testq %rcx, %rcx
cmovnel %r8d, %esi
movq (%rdi,%rsi,8), %rbx
callq 0x23c0
movq %rbx, %rdi
jmp 0xbcd2
movq $0x1, 0x1d(%rdi,%rcx,8)
movl %edx, 0x5(%rdi)
incl 0x9(%rdi)
movq %rdi, %rax
popq %rbx
retq
leaq 0x6f0b(%rip), %rdi      # 0x12be9
leaq 0x67cc(%rip), %rsi      # 0x124b1
leaq 0x6f08(%rip), %rcx      # 0x12bf4
movl $0x1ed0, %edx           # imm = 0x1ED0
callq 0x2140