LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/test.c
// Function: test_int
uint32_t test_int(uint32_t n, uint32_t x0)
{
	uint32_t i, x, z = 0, size = 0;
	stb_idict *h;
	h = stb_idict_create();
	for (i = 0, x = x0; i < n; ++i) {
		uint32_t key, val = 1;
		x = hash32(x);
		key = get_key(n, x);
		if (stb_idict_get_flag(h, key, &val)) {
			stb_idict_set(h, key, val + 1);
		} else {
			stb_idict_set(h, key, 1);
			++size;
		}
		z += val;
	}
	fprintf(stderr, "# unique keys: %d; checksum: %u\n", size, z);
	stb_idict_destroy(h);
	return size;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, %r12d
movl %edi, %r14d
callq 0x6f4d
movq %rax, %rbx
xorl %r15d, %r15d
movl $0x0, 0xc(%rsp)
testl %r14d, %r14d
je 0x27bf
movl %r14d, %eax
shrl $0x2, %eax
movl %eax, 0x14(%rsp)
movl $0x0, 0xc(%rsp)
xorl %r15d, %r15d
movl $0x1, 0x10(%rsp)
movl %r12d, %eax
shll $0xf, %eax
notl %eax
addl %r12d, %eax
movl %eax, %ecx
shrl $0xa, %ecx
xorl %eax, %ecx
leal (%rcx,%rcx,8), %eax
movl %eax, %ecx
shrl $0x6, %ecx
xorl %eax, %ecx
movl %ecx, %eax
shll $0xb, %eax
notl %eax
addl %ecx, %eax
movl %eax, %r12d
shrl $0x10, %r12d
xorl %eax, %r12d
movl %r12d, %eax
xorl %edx, %edx
divl 0x14(%rsp)
movl %edx, %eax
shll $0xf, %eax
notl %eax
addl %edx, %eax
movl %eax, %ecx
shrl $0xa, %ecx
xorl %eax, %ecx
leal (%rcx,%rcx,8), %eax
movl %eax, %ecx
shrl $0x6, %ecx
xorl %eax, %ecx
movl %ecx, %eax
shll $0xb, %eax
notl %eax
addl %ecx, %eax
movl %eax, %ebp
shrl $0x10, %ebp
xorl %eax, %ebp
movq %rbx, %rdi
movl %ebp, %esi
leaq 0x10(%rsp), %rdx
callq 0x6fa4
testl %eax, %eax
je 0x2798
movl 0x10(%rsp), %r13d
leal 0x1(%r13), %edx
movq %rbx, %rdi
movl %ebp, %esi
pushq $0x1
popq %rcx
movl %ecx, %r8d
callq 0x7157
jmp 0x27b3
movq %rbx, %rdi
movl %ebp, %esi
pushq $0x1
popq %rcx
movl %ecx, %edx
movl %ecx, %r8d
callq 0x7157
incl 0xc(%rsp)
movl 0x10(%rsp), %r13d
addl %r13d, %r15d
decl %r14d
jne 0x2700
movq 0x17832(%rip), %rax     # 0x19ff8
movq (%rax), %rdi
leaq 0x10751(%rip), %rsi     # 0x12f21
movl 0xc(%rsp), %ebp
movl %ebp, %edx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x21f0
movq %rbx, %rdi
callq 0x6f86
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_snprintf
int stb_snprintf(char *s, size_t n, const char *fmt, ...)
{
   int res;
   va_list v;
   va_start(v,fmt);
   res = stb_vsnprintf(s, n, fmt, v);
   va_end(v);
   return res;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0xd8, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x20(%rsp), %rsi
movq %rcx, 0x18(%rsi)
movq %r8, 0x20(%rsi)
movq %r9, 0x28(%rsi)
testb %al, %al
je 0x29f4
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rsp, %rcx
movq %rsi, 0x10(%rcx)
leaq 0xf0(%rsp), %rax
movq %rax, 0x8(%rcx)
movabsq $0x3000000018, %rax     # imm = 0x3000000018
movq %rax, (%rcx)
movq %rbx, %rsi
callq 0x20c0
testq %rbx, %rbx
je 0x2a27
movb $0x0, -0x1(%r14,%rbx)
testl %eax, %eax
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl %eax, %ecx
cmovsl %edx, %ecx
cmpl %ebx, %eax
cmovgel %edx, %ecx
movl %ecx, %eax
addq $0xd8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_sprintf
char *stb_sprintf(const char *fmt, ...)
{
   static char buffer[1024];
   va_list v;
   va_start(v,fmt);
   stb_vsnprintf(buffer,1024,fmt,v);
   va_end(v);
   return buffer;
}

// Assembly:
pushq %rbx
subq $0xd0, %rsp
movq %rdi, %r10
leaq 0x20(%rsp), %rdi
movq %rsi, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
movq %rcx, 0x18(%rdi)
movq %r8, 0x20(%rdi)
movq %r9, 0x28(%rdi)
testb %al, %al
je 0x2aa4
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rsp, %rcx
movq %rdi, 0x10(%rcx)
leaq 0xe0(%rsp), %rax
movq %rax, 0x8(%rcx)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rcx)
leaq 0x177a5(%rip), %rbx     # 0x1a270
movl $0x400, %esi            # imm = 0x400
movq %rbx, %rdi
movq %r10, %rdx
callq 0x20c0
movb $0x0, 0x17b8d(%rip)     # 0x1a66f
movq %rbx, %rax
addq $0xd0, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_mprintf
char *stb_mprintf(const char *fmt, ...)
{
   static char buffer[1024];
   va_list v;
   va_start(v,fmt);
   stb_vsnprintf(buffer,1024,fmt,v);
   va_end(v);
   return strdup(buffer);
}

// Assembly:
pushq %rbx
subq $0xd0, %rsp
movq %rdi, %r10
leaq 0x20(%rsp), %rdi
movq %rsi, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
movq %rcx, 0x18(%rdi)
movq %r8, 0x20(%rdi)
movq %r9, 0x28(%rdi)
testb %al, %al
je 0x2b4d
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rsp, %rcx
movq %rdi, 0x10(%rcx)
leaq 0xe0(%rsp), %rax
movq %rax, 0x8(%rcx)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rcx)
leaq 0x17afc(%rip), %rbx     # 0x1a670
movl $0x400, %esi            # imm = 0x400
movq %rbx, %rdi
movq %r10, %rdx
callq 0x20c0
movb $0x0, 0x17ee4(%rip)     # 0x1aa6f
movq %rbx, %rdi
callq 0x2380
addq $0xd0, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_to_utf8
char * stb_to_utf8(char *buffer, stb__wchar *str, int n)
{
   int i=0;
   --n;
   while (*str) {
      if (*str < 0x80) {
         if (i+1 > n) return NULL;
         buffer[i++] = (char) *str++;
      } else if (*str < 0x800) {
         if (i+2 > n) return NULL;
         buffer[i++] = 0xc0 + (*str >> 6);
         buffer[i++] = 0x80 + (*str & 0x3f);
         str += 1;
      } else if (*str >= 0xd800 && *str < 0xdc00) {
         stb_uint32 c;
         if (i+4 > n) return NULL;
         c = ((str[0] - 0xd800) << 10) + ((str[1]) - 0xdc00) + 0x10000;
         buffer[i++] = 0xf0 + (c >> 18);
         buffer[i++] = 0x80 + ((c >> 12) & 0x3f);
         buffer[i++] = 0x80 + ((c >>  6) & 0x3f);
         buffer[i++] = 0x80 + ((c      ) & 0x3f);
         str += 2;
      } else if (*str >= 0xdc00 && *str < 0xe000) {
         return NULL;
      } else {
         if (i+3 > n) return NULL;
         buffer[i++] = 0xe0 + (*str >> 12);
         buffer[i++] = 0x80 + ((*str >> 6) & 0x3f);
         buffer[i++] = 0x80 + ((*str     ) & 0x3f);
         str += 1;
      }
   }
   buffer[i] = 0;
   return buffer;
}

// Assembly:
pushq %rbx
movzwl (%rsi), %r9d
xorl %eax, %eax
testw %r9w, %r9w
je 0x2fd2
leal -0x1(%rdx), %ecx
xorl %r8d, %r8d
movzwl %r9w, %r9d
cmpw $0x7f, %r9w
ja 0x2ebe
cmpl %ecx, %r8d
jge 0x2fd9
addq $0x2, %rsi
movslq %r8d, %r10
incl %r8d
movb %r9b, (%rdi,%r10)
jmp 0x2fc1
cmpl $0x7ff, %r9d            # imm = 0x7FF
ja 0x2ef8
leal 0x2(%r8), %r10d
cmpl %edx, %r10d
jge 0x2fd9
shrl $0x6, %r9d
orb $-0x40, %r9b
movslq %r8d, %r8
movb %r9b, (%rdi,%r8)
movb (%rsi), %r9b
andb $0x3f, %r9b
orb $-0x80, %r9b
movb %r9b, 0x1(%rdi,%r8)
jmp 0x2fba
movl %r9d, %r10d
andl $0xfc00, %r10d          # imm = 0xFC00
cmpl $0xd800, %r10d          # imm = 0xD800
jne 0x2f70
leal 0x4(%r8), %r10d
cmpl %edx, %r10d
jge 0x2fd9
shll $0xa, %r9d
movzwl 0x2(%rsi), %r11d
addl %r11d, %r9d
addl $0xfca02400, %r9d       # imm = 0xFCA02400
movl %r9d, %ebx
shrl $0x12, %ebx
addb $-0x10, %bl
movslq %r8d, %r8
movb %bl, (%rdi,%r8)
movl %r9d, %ebx
shrl $0xc, %ebx
andb $0x3f, %bl
orb $-0x80, %bl
movb %bl, 0x1(%rdi,%r8)
shrl $0x6, %r9d
andb $0x3f, %r9b
orb $-0x80, %r9b
movb %r9b, 0x2(%rdi,%r8)
andb $0x3f, %r11b
orb $-0x80, %r11b
movb %r11b, 0x3(%rdi,%r8)
addq $0x4, %rsi
jmp 0x2fbe
movzwl %r10w, %r10d
cmpl $0xdc00, %r10d          # imm = 0xDC00
je 0x2fd9
leal 0x3(%r8), %r10d
cmpl %edx, %r10d
jge 0x2fd9
shrl $0xc, %r9d
orb $-0x20, %r9b
movslq %r8d, %r8
movb %r9b, (%rdi,%r8)
movzwl (%rsi), %r9d
shrl $0x6, %r9d
andb $0x3f, %r9b
orb $-0x80, %r9b
movb %r9b, 0x1(%rdi,%r8)
movb (%rsi), %r9b
andb $0x3f, %r9b
orb $-0x80, %r9b
movb %r9b, 0x2(%rdi,%r8)
addq $0x2, %rsi
movl %r10d, %r8d
movzwl (%rsi), %r9d
testw %r9w, %r9w
jne 0x2e97
movslq %r8d, %rax
movb $0x0, (%rdi,%rax)
movq %rdi, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_fatal
void stb_fatal(char *s, ...)
{
   va_list a;
   if (stb__file)
      fprintf(stderr, "[%s:%d] ", stb__file, stb__line);
   va_start(a,s);
   fputs("Fatal error: ", stderr);
   vfprintf(stderr, s, a);
   va_end(a);
   fputs("\n", stderr);
   #ifdef STB_DEBUG
   #ifdef _MSC_VER
   #ifndef STB_PTR64
   __asm int 3;   // trap to debugger!
   #else
   __debugbreak();
   #endif
   #else
   __builtin_trap();
   #endif
   #endif
   exit(1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xd0, %rsp
movq %rdi, %rbx
movq %rsi, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
testb %al, %al
je 0x308a
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq 0x1aa5f(%rip), %rdx     # 0x1daf0
testq %rdx, %rdx
je 0x30b4
movq 0x16f5b(%rip), %rax     # 0x19ff8
movq (%rax), %rdi
movl 0x1aa52(%rip), %ecx     # 0x1daf8
leaq 0xf3b5(%rip), %rsi      # 0x12462
xorl %eax, %eax
callq 0x21f0
leaq 0x20(%rsp), %rax
movq %rsp, %r14
movq %rax, 0x10(%r14)
leaq 0xf0(%rsp), %rax
movq %rax, 0x8(%r14)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%r14)
movq 0x16f18(%rip), %r15     # 0x19ff8
movq (%r15), %rsi
leaq 0xf381(%rip), %rdi      # 0x1246b
callq 0x2150
movq (%r15), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2330
movq (%r15), %rsi
leaq 0xf359(%rip), %rdi      # 0x12460
callq 0x2150
movl $0x1, %edi
callq 0x2360
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_
void stb_(char *s, ...)
{
   if (stb__log_active) {
      FILE *f = fopen(stb__log_filename, "a");
      if (f) {
         va_list a;
         if (stb__log_fileline && stb__file)
            fprintf(f, "[%s:%4d] ", stb__file, stb__line);
         va_start(a,s);
         vfprintf(f, s, a);
         va_end(a);
         fputs("\n", f);
         fclose(f);
      }
   }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0xd8, %rsp
testb %al, %al
je 0x3171
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
cmpl $0x0, 0x1705f(%rip)     # 0x1a1f0
je 0x3231
movq %rdi, %rbx
movq 0x17057(%rip), %rdi     # 0x1a1f8
leaq 0xf2d9(%rip), %rsi      # 0x12481
callq 0x22f0
testq %rax, %rax
je 0x3231
movq %rax, %r14
cmpl $0x0, 0x17038(%rip)     # 0x1a1f4
setne %al
movq 0x1a92a(%rip), %rdx     # 0x1daf0
testq %rdx, %rdx
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x31ea
movl 0x1a91f(%rip), %ecx     # 0x1daf8
leaq 0xf2a3(%rip), %rsi      # 0x12483
movq %r14, %rdi
xorl %eax, %eax
callq 0x21f0
leaq 0x20(%rsp), %rax
movq %rsp, %rdx
movq %rax, 0x10(%rdx)
leaq 0xf0(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rdx)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2330
leaq 0xf23f(%rip), %rdi      # 0x12460
movq %r14, %rsi
callq 0x2150
movq %r14, %rdi
callq 0x20d0
addq $0xd8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_append_to_file
void stb_append_to_file(char *filename, char *s, ...)
{
   FILE *f = fopen(filename, "a");
   if (f) {
      va_list a;
      va_start(a,s);
      vfprintf(f, s, a);
      va_end(a);
      fputs("\n", f);
      fclose(f);
   }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0xd8, %rsp
movq %rsi, %rbx
movq %rdx, 0x30(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
testb %al, %al
je 0x3298
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
leaq 0xf1e2(%rip), %rsi      # 0x12481
callq 0x22f0
testq %rax, %rax
je 0x32f3
movq %rax, %r14
leaq 0x20(%rsp), %rax
movq %rsp, %rdx
movq %rax, 0x10(%rdx)
leaq 0xf0(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rdx)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2330
leaq 0xf17d(%rip), %rdi      # 0x12460
movq %r14, %rsi
callq 0x2150
movq %r14, %rdi
callq 0x20d0
addq $0xd8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_swap
void stb_swap(void *p, void *q, size_t sz)
{
   char buffer[256];
   if (p == q) return;
   if (sz == 4) {
      stb__4 temp    = * ( stb__4 *) p;
      * (stb__4 *) p = * ( stb__4 *) q;
      * (stb__4 *) q = temp;
      return;
   } else if (sz == 8) {
      stb__8 temp    = * ( stb__8 *) p;
      * (stb__8 *) p = * ( stb__8 *) q;
      * (stb__8 *) q = temp;
      return;
   }

   while (sz > sizeof(buffer)) {
      stb_swap(p, q, sizeof(buffer));
      p = (char *) p + sizeof(buffer);
      q = (char *) q + sizeof(buffer);
      sz -= sizeof(buffer);
   }

   memcpy(buffer, p     , sz);
   memcpy(p     , q     , sz);
   memcpy(q     , buffer, sz);
}

// Assembly:
cmpq %rsi, %rdi
je 0x33b0
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
cmpq $0x4, %rdx
je 0x3338
cmpq $0x8, %r14
jne 0x3344
movq (%r15), %rax
movq (%rbx), %rcx
movq %rcx, (%r15)
movq %rax, (%rbx)
jmp 0x33a2
movl (%r15), %eax
movl (%rbx), %ecx
movl %ecx, (%r15)
movl %eax, (%rbx)
jmp 0x33a2
cmpq $0x101, %r14            # imm = 0x101
jb 0x3375
movl $0x100, %r12d           # imm = 0x100
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
movq %rbx, %rsi
callq 0x32fe
addq %r12, %r15
addq %r12, %rbx
addq $-0x100, %r14
cmpq %r12, %r14
ja 0x3353
movq %rsp, %r12
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x2230
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2230
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x2230
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_array_block_alloc
void **stb_array_block_alloc(int count, int blocksize)
{
   int i;
   char *p = (char *) malloc(sizeof(void *) * count + count * blocksize);
   void **q;
   if (p == NULL) return NULL;
   q = (void **) p;
   p += sizeof(void *) * count;
   for (i=0; i < count; ++i)
      q[i] = p + i * blocksize;
   return q;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movl %edi, %ebx
movslq %edi, %r14
movl %esi, %eax
imull %edi, %eax
cltq
leaq (%rax,%r14,8), %rdi
callq 0x2250
testq %rax, %rax
je 0x3445
testl %ebx, %ebx
jle 0x3445
shlq $0x3, %r14
movq %rax, %rcx
addq %r14, %rcx
movslq %ebp, %rdx
movl %ebx, %esi
xorl %edi, %edi
movq %rcx, (%rax,%rdi,8)
incq %rdi
addq %rdx, %rcx
cmpq %rdi, %rsi
jne 0x3436
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_newell_normal
void stb_newell_normal(float *normal, int num_vert, float **vert, int normalize)
{
   int i,j;
   float p;
   normal[0] = normal[1] = normal[2] = 0;
   for (i=num_vert-1,j=0; j < num_vert; i=j++) {
      float *u = vert[i];
      float *v = vert[j];
      normal[0] += (u[1] - v[1]) * (u[2] + v[2]);
      normal[1] += (u[2] - v[2]) * (u[0] + v[0]);
      normal[2] += (u[0] - v[0]) * (u[1] + v[1]);
   }
   if (normalize) {
      p = normal[0]*normal[0] + normal[1]*normal[1] + normal[2]*normal[2];
      p = (float) (1.0 / sqrt(p));
      normal[0] *= p;
      normal[1] *= p;
      normal[2] *= p;
   }
}

// Assembly:
movl $0x0, 0x8(%rdi)
movq $0x0, (%rdi)
testl %esi, %esi
jle 0x3585
movl %esi, %eax
decl %esi
xorps %xmm0, %xmm0
xorl %r8d, %r8d
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
movslq %esi, %rsi
movq (%rdx,%rsi,8), %rsi
movq (%rdx,%r8,8), %r9
movss 0x4(%rsi), %xmm3
movss 0x8(%rsi), %xmm4
subss 0x4(%r9), %xmm3
addss 0x8(%r9), %xmm4
mulss %xmm3, %xmm4
addss %xmm4, %xmm2
movss %xmm2, (%rdi)
movss 0x8(%rsi), %xmm3
subss 0x8(%r9), %xmm3
movss (%rsi), %xmm4
addss (%r9), %xmm4
mulss %xmm3, %xmm4
addss %xmm4, %xmm1
movss %xmm1, 0x4(%rdi)
movss (%rsi), %xmm3
movss 0x4(%rsi), %xmm4
subss (%r9), %xmm3
addss 0x4(%r9), %xmm4
mulss %xmm3, %xmm4
addss %xmm4, %xmm0
movss %xmm0, 0x8(%rdi)
movl %r8d, %esi
leaq 0x1(%r8), %r9
movq %r9, %r8
cmpq %r9, %rax
jne 0x3505
jmp 0x358e
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
testl %ecx, %ecx
je 0x35e4
movaps %xmm1, %xmm3
mulss %xmm1, %xmm3
movaps %xmm2, %xmm4
mulss %xmm2, %xmm4
addss %xmm3, %xmm4
movaps %xmm0, %xmm3
mulss %xmm0, %xmm3
addss %xmm4, %xmm3
cvtss2sd %xmm3, %xmm3
sqrtsd %xmm3, %xmm3
movsd 0xea61(%rip), %xmm4     # 0x12020
divsd %xmm3, %xmm4
xorps %xmm3, %xmm3
cvtsd2ss %xmm4, %xmm3
mulss %xmm3, %xmm2
movss %xmm2, (%rdi)
mulss %xmm3, %xmm1
movss %xmm1, 0x4(%rdi)
mulss %xmm3, %xmm0
movss %xmm0, 0x8(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_box_face_vertex_axis_side
int stb_box_face_vertex_axis_side(int face_number, int vertex_number, int axis)
{
   static int box_vertices[6][4][3] =
   {
      { { 1,1,1 }, { 1,0,1 }, { 1,0,0 }, { 1,1,0 } },
      { { 0,0,0 }, { 0,0,1 }, { 0,1,1 }, { 0,1,0 } },
      { { 0,0,0 }, { 0,1,0 }, { 1,1,0 }, { 1,0,0 } },
      { { 0,0,0 }, { 1,0,0 }, { 1,0,1 }, { 0,0,1 } },
      { { 1,1,1 }, { 0,1,1 }, { 0,0,1 }, { 1,0,1 } },
      { { 1,1,1 }, { 1,1,0 }, { 0,1,0 }, { 0,1,1 } },
   };
   assert(face_number >= 0 && face_number < 6);
   assert(vertex_number >= 0 && vertex_number < 4);
   assert(axis >= 0 && axis < 3);
   return box_vertices[face_number][vertex_number][axis];
}

// Assembly:
pushq %rax
cmpl $0x6, %edi
jae 0x361a
cmpl $0x4, %esi
jae 0x3639
cmpl $0x3, %edx
jae 0x3658
movl %edi, %eax
movl %esi, %ecx
movl %edx, %edx
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
leaq 0xecd6(%rip), %rsi      # 0x122e0
addq %rax, %rsi
leaq (%rcx,%rcx,2), %rax
leaq (%rsi,%rax,4), %rax
movl (%rax,%rdx,4), %eax
popq %rcx
retq
leaq 0xee6c(%rip), %rdi      # 0x1248d
leaq 0xee89(%rip), %rsi      # 0x124b1
leaq 0xee8a(%rip), %rcx      # 0x124b9
movl $0x52e, %edx            # imm = 0x52E
callq 0x2140
leaq 0xeeaa(%rip), %rdi      # 0x124ea
leaq 0xee6a(%rip), %rsi      # 0x124b1
leaq 0xee6b(%rip), %rcx      # 0x124b9
movl $0x52f, %edx            # imm = 0x52F
callq 0x2140
leaq 0xeeb3(%rip), %rdi      # 0x12512
leaq 0xee4b(%rip), %rsi      # 0x124b1
leaq 0xee4c(%rip), %rcx      # 0x124b9
movl $0x530, %edx            # imm = 0x530
callq 0x2140
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_linear_controller
void stb_linear_controller(float *curpos, float target_pos, float acc, float deacc, float dt)
{
   float sign = 1, p, cp = *curpos;
   if (cp == target_pos) return;
   if (target_pos < cp) {
      target_pos = -target_pos;
      cp = -cp;
      sign = -1;
   }
   // first decelerate
   if (cp < 0) {
      p = cp + deacc * dt;
      if (p > 0) {
         p = 0;
         dt = dt - cp / deacc;
         if (dt < 0) dt = 0;
      } else {
         dt = 0;
      }
      cp = p;
   }
   // now accelerate
   p = cp + acc*dt;
   if (p > target_pos) p = target_pos;
   *curpos = p * sign;
   // @TODO: testing
}

// Assembly:
movss (%rdi), %xmm5
ucomiss %xmm0, %xmm5
jne 0x3683
jp 0x3683
retq
movaps 0xe9d6(%rip), %xmm4     # 0x12060
movaps %xmm5, %xmm7
xorps %xmm4, %xmm7
ja 0x3697
movaps %xmm0, %xmm4
jmp 0x369a
xorps %xmm0, %xmm4
cmpltss %xmm5, %xmm0
andps %xmm0, %xmm7
movaps %xmm0, %xmm6
andnps %xmm5, %xmm6
orps %xmm7, %xmm6
xorps %xmm5, %xmm5
ucomiss %xmm6, %xmm5
jbe 0x36db
movaps %xmm2, %xmm7
mulss %xmm3, %xmm7
addss %xmm6, %xmm7
ucomiss %xmm5, %xmm7
jbe 0x36e1
divss %xmm2, %xmm6
subss %xmm6, %xmm3
xorps %xmm7, %xmm7
ucomiss %xmm3, %xmm7
movaps %xmm3, %xmm5
jbe 0x36e1
xorps %xmm5, %xmm5
jmp 0x36e1
movaps %xmm3, %xmm5
movaps %xmm6, %xmm7
mulss %xmm5, %xmm1
addss %xmm7, %xmm1
minss %xmm1, %xmm4
movaps %xmm0, %xmm1
andnps %xmm4, %xmm1
xorps 0xe966(%rip), %xmm4     # 0x12060
andps %xmm0, %xmm4
orps %xmm1, %xmm4
movss %xmm4, (%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_is_prime
int stb_is_prime(unsigned int m)
{
   unsigned int i,j;
   if (m < 2) return 0;
   if (m == 2) return 1;
   if (!(m & 1)) return 0;
   if (m % 3 == 0) return (m == 3);
   for (i=5; (j=i*i), j <= m && j > i; i += 6) {
      if (m %   i   == 0) return 0;
      if (m % (i+2) == 0) return 0;
   }
   return 1;
}

// Assembly:
xorl %ecx, %ecx
cmpl $0x2, %edi
jb 0x37a5
jne 0x374a
movl $0x1, %ecx
jmp 0x37a5
testb $0x1, %dil
je 0x37a5
imull $0xaaaaaaab, %edi, %eax # imm = 0xAAAAAAAB
cmpl $0x55555556, %eax       # imm = 0x55555556
jb 0x379d
cmpl $0x19, %edi
jb 0x3743
movl $0xb, %esi
leal -0x6(%rsi), %r8d
xorl %ecx, %ecx
movl %edi, %eax
xorl %edx, %edx
divl %r8d
testl %edx, %edx
je 0x37a5
leal -0x4(%rsi), %r8d
xorl %ecx, %ecx
movl %edi, %eax
xorl %edx, %edx
divl %r8d
testl %edx, %edx
je 0x37a5
movl %esi, %eax
imull %esi, %eax
cmpl %edi, %eax
ja 0x3743
leal 0x6(%rsi), %ecx
cmpl %esi, %eax
movl %ecx, %esi
ja 0x3767
jmp 0x3743
xorl %ecx, %ecx
cmpl $0x3, %edi
sete %cl
movl %ecx, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_power_of_two_nearest_prime
unsigned int stb_power_of_two_nearest_prime(int n)
{
   static signed char tab[32] = { 0,0,0,0,1,0,-1,0,1,-1,-1,3,-1,0,-1,2,1,
                                   0,2,0,-1,-4,-1,5,-1,18,-2,15,2,-1,2,0 };
   if (!tab[0]) {
      int i;
      for (i=0; i < 32; ++i)
         tab[i] = (1 << i) + 2*tab[i] - 1;
      tab[1] = 2;
      tab[0] = 1;
   }
   if (n >= 32) return 0xfffffffb;
   return tab[n];
}

// Assembly:
cmpb $0x0, 0x16a51(%rip)     # 0x1a200
jne 0x37f2
movdqa 0x16a47(%rip), %xmm0    # 0x1a200
paddb %xmm0, %xmm0
paddb 0xe8bb(%rip), %xmm0     # 0x12080
movdqa %xmm0, 0x16a33(%rip)    # 0x1a200
movdqa 0x16a3b(%rip), %xmm0    # 0x1a210
paddb %xmm0, %xmm0
pcmpeqd %xmm1, %xmm1
paddb %xmm0, %xmm1
movdqa %xmm1, 0x16a27(%rip)    # 0x1a210
movw $0x201, 0x16a0e(%rip)   # imm = 0x201
movl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
cmpl $0x1f, %edi
jg 0x380a
movslq %edi, %rax
leaq 0x169fa(%rip), %rcx     # 0x1a200
movsbl (%rax,%rcx), %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_log2_floor
int stb_log2_floor(unsigned int n)
{
   static signed char log2_4[16] = { -1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3 };

   // 2 compares if n < 16, 3 compares otherwise
   if (n < (1U << 14))
        if (n < (1U <<  4))        return     0 + log2_4[n      ];
        else if (n < (1U <<  9))      return  5 + log2_4[n >>  5];
             else                     return 10 + log2_4[n >> 10];
   else if (n < (1U << 24))
             if (n < (1U << 19))      return 15 + log2_4[n >> 15];
             else                     return 20 + log2_4[n >> 20];
        else if (n < (1U << 29))      return 25 + log2_4[n >> 25];
             else                     return 30 + log2_4[n >> 30];
}

// Assembly:
cmpl $0x3fff, %edi           # imm = 0x3FFF
ja 0x38ff
cmpl $0xf, %edi
ja 0x3921
movl %edi, %eax
leaq 0xe896(%rip), %rcx      # 0x12190
movsbl (%rax,%rcx), %eax
retq
cmpl $0xffffff, %edi         # imm = 0xFFFFFF
ja 0x393b
cmpl $0x7ffff, %edi          # imm = 0x7FFFF
ja 0x3955
shrl $0xf, %edi
leaq 0xe877(%rip), %rax      # 0x12190
movsbl (%rdi,%rax), %eax
addl $0xf, %eax
retq
cmpl $0x1ff, %edi            # imm = 0x1FF
ja 0x3967
shrl $0x5, %edi
leaq 0xe85d(%rip), %rax      # 0x12190
movsbl (%rdi,%rax), %eax
addl $0x5, %eax
retq
cmpl $0x1fffffff, %edi       # imm = 0x1FFFFFFF
ja 0x3979
shrl $0x19, %edi
leaq 0xe843(%rip), %rax      # 0x12190
movsbl (%rdi,%rax), %eax
addl $0x19, %eax
retq
shrl $0x14, %edi
leaq 0xe831(%rip), %rax      # 0x12190
movsbl (%rdi,%rax), %eax
addl $0x14, %eax
retq
shrl $0xa, %edi
leaq 0xe81f(%rip), %rax      # 0x12190
movsbl (%rdi,%rax), %eax
addl $0xa, %eax
retq
shrl $0x1e, %edi
leaq 0xe80d(%rip), %rax      # 0x12190
movsbl (%rdi,%rax), %eax
addl $0x1e, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_lowbit8
int stb_lowbit8(unsigned int n)
{
   static signed char lowbit4[16] = { -1,0,1,0, 2,0,1,0, 3,0,1,0, 2,0,1,0 };
   int k = lowbit4[n & 15];
   if (k >= 0) return k;
   k = lowbit4[(n >> 4) & 15];
   if (k >= 0) return k+4;
   return k;
}

// Assembly:
movl %edi, %eax
andl $0xf, %eax
je 0x39c8
leaq 0xe7dd(%rip), %rcx      # 0x121a0
movsbl (%rax,%rcx), %eax
retq
shrl $0x4, %edi
andl $0xf, %edi
leaq 0xe7cb(%rip), %rax      # 0x121a0
movsbl (%rdi,%rax), %ecx
leal 0x4(%rcx), %eax
testl %edi, %edi
cmovel %ecx, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_probe_guess
static int stb_probe_guess(stb_search *s, int *result)
{
   switch(s->mode) {
      case STB_probe_binary_largest:
         if (s->minval == s->maxval) {
            *result = s->minval;
            return 0;
         }
         assert(s->minval < s->maxval);
         // if a < b, then a < p <= b
         s->guess = s->minval + (((unsigned) s->maxval - s->minval + 1) >> 1);
         break;

      case STB_probe_binary_smallest:
         if (s->minval == s->maxval) {
            *result = s->minval;
            return 0;
         }
         assert(s->minval < s->maxval);
         // if a < b, then a <= p < b
         s->guess = s->minval + (((unsigned) s->maxval - s->minval) >> 1);
         break;
      case STB_probe_open_smallest:
      case STB_probe_open_largest:
         s->guess = s->maxval;  // guess the current maxval
         break;
   }
   *result = s->guess;
   return 1;
}

// Assembly:
pushq %rax
movl 0xc(%rdi), %eax
leal -0x2(%rax), %ecx
cmpl $0x2, %ecx
jb 0x3b6c
testl %eax, %eax
je 0x3b71
cmpl $0x1, %eax
jne 0x3b7e
movl (%rdi), %ecx
movl 0x4(%rdi), %eax
subl %ecx, %eax
je 0x3b7a
jle 0x3b95
incl %eax
jmp 0x3b85
movl 0x4(%rdi), %ecx
jmp 0x3b89
movl (%rdi), %ecx
movl 0x4(%rdi), %eax
subl %ecx, %eax
jne 0x3b83
xorl %eax, %eax
jmp 0x3b91
movl 0x8(%rdi), %ecx
jmp 0x3b8c
jle 0x3bb4
shrl %eax
addl %eax, %ecx
movl %ecx, 0x8(%rdi)
movl $0x1, %eax
movl %ecx, (%rsi)
popq %rcx
retq
leaq 0xf3a6(%rip), %rdi      # 0x12f42
leaq 0xe90e(%rip), %rsi      # 0x124b1
leaq 0xf3ae(%rip), %rcx      # 0x12f58
movl $0x682, %edx            # imm = 0x682
callq 0x2140
leaq 0xf387(%rip), %rdi      # 0x12f42
leaq 0xe8ef(%rip), %rsi      # 0x124b1
leaq 0xf38f(%rip), %rcx      # 0x12f58
movl $0x68c, %edx            # imm = 0x68C
callq 0x2140
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_search_binary
int stb_search_binary(stb_search *s, int minv, int maxv, int find_smallest)
{
   int r;
   if (maxv < minv) return minv-1;
   s->minval = minv;
   s->maxval = maxv;
   s->mode = find_smallest ? STB_probe_binary_smallest : STB_probe_binary_largest;
   stb_probe_guess(s, &r);
   return r;
}

// Assembly:
movl %esi, %eax
cmpl %esi, %edx
jge 0x3bdc
decl %eax
retq
pushq %rbx
subq $0x10, %rsp
movl %eax, (%rdi)
movl %edx, 0x4(%rdi)
xorl %eax, %eax
testl %ecx, %ecx
sete %al
movl %eax, 0xc(%rdi)
leaq 0xc(%rsp), %rbx
movq %rbx, %rsi
callq 0x3b48
movl (%rbx), %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_search_open
int stb_search_open(stb_search *s, int minv, int find_smallest)
{
   int r;
   s->step   = 4;
   s->minval = minv;
   s->maxval = minv+s->step;
   s->mode = find_smallest ? STB_probe_open_smallest : STB_probe_open_largest;
   stb_probe_guess(s, &r);
   return r;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movl $0x4, 0x10(%rdi)
movl %esi, (%rdi)
addl $0x4, %esi
movl %esi, 0x4(%rdi)
xorl %eax, %eax
cmpl $0x1, %edx
adcl $0x2, %eax
movl %eax, 0xc(%rdi)
leaq 0xc(%rsp), %rbx
movq %rbx, %rsi
callq 0x3b48
movl (%rbx), %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_strscpy
size_t stb_strscpy(char *d, const char *s, size_t n)
{
   size_t len = strlen(s);
   if (len >= n) {
      if (n) d[0] = 0;
      return 0;
   }
   strcpy(d,s);
   return len + 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %r14
movq %rsi, %rdi
callq 0x2100
cmpq %r12, %rax
jae 0x3c6a
movq %rax, %rbx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2080
incq %rbx
jmp 0x3c75
testq %r12, %r12
je 0x3c73
movb $0x0, (%r14)
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_prefix_count
int stb_prefix_count(char *s, char *t)
{
   int c=0;
   while (*t) {
      if (*s++ != *t++)
         break;
      ++c;
   }
   return c;
}

// Assembly:
movb (%rsi), %cl
xorl %eax, %eax
testb %cl, %cl
je 0x3cce
cmpb %cl, (%rdi,%rax)
jne 0x3cce
movb 0x1(%rsi,%rax), %cl
incq %rax
jmp 0x3cbc
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_skipnewline
char *stb_skipnewline(char *s)
{
   if (s[0] == '\r' || s[0] == '\n') {
      if (s[0]+s[1] == '\r' + '\n') ++s;
      ++s;
   }
   return s;
}

// Assembly:
movq %rdi, %rax
movzbl (%rdi), %ecx
cmpl $0xd, %ecx
je 0x3d8b
cmpl $0xa, %ecx
jne 0x3da2
leaq 0x1(%rax), %rdx
movsbl 0x1(%rax), %esi
addl %ecx, %esi
cmpl $0x17, %esi
cmovneq %rax, %rdx
incq %rdx
movq %rdx, %rax
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_trimwhite
char *stb_trimwhite(char *s)
{
   int i,n;
   s = stb_skipwhite(s);
   n = (int) strlen(s);
   for (i=n-1; i >= 0; --i)
      if (!isspace(s[i]))
         break;
   s[i+1] = 0;
   return s;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x23b0
movq (%rax), %r14
decq %rbx
movzbl 0x1(%rbx), %eax
incq %rbx
testb $0x20, 0x1(%r14,%rax,2)
jne 0x3db5
movq %rbx, %rdi
callq 0x2100
movl %eax, %edx
movl %eax, %ecx
sarl $0x1f, %ecx
andl %eax, %ecx
addq %rbx, %rdx
decq %rdx
testl %eax, %eax
jle 0x3df4
movsbq (%rdx), %rsi
decl %eax
decq %rdx
testb $0x20, 0x1(%r14,%rsi,2)
jne 0x3ddb
incl %eax
movl %eax, %ecx
movslq %ecx, %rax
movb $0x0, (%rbx,%rax)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_duplower
char *stb_duplower(char *s)
{
   char *p = strdup(s), *q = p;
   while (*q) {
      *q = tolower(*q);
      ++q;
   }
   return p;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
callq 0x2380
movq %rax, %rbx
movb (%rax), %bpl
testb %bpl, %bpl
je 0x3ea0
callq 0x23a0
movq (%rax), %rax
movq %rbx, %rcx
incq %rcx
movsbq %bpl, %rdx
movb (%rax,%rdx,4), %dl
movb %dl, -0x1(%rcx)
movb (%rcx), %bpl
incq %rcx
testb %bpl, %bpl
jne 0x3e8b
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_strrchr2
char *stb_strrchr2(char *s, char x, char y)
{
   char *r = NULL;
   for(; *s; ++s)
      if (*s == x || *s == y)
         r = s;
   return r;
}

// Assembly:
movb (%rdi), %cl
xorl %eax, %eax
testb %cl, %cl
je 0x3f1b
cmpb %dl, %cl
cmoveq %rdi, %rax
cmpb %sil, %cl
cmoveq %rdi, %rax
movb 0x1(%rdi), %cl
incq %rdi
jmp 0x3f02
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_stristr
char *stb_stristr(char *s, char *t)
{
   size_t n = strlen(t);
   char *z;
   if (n==0) return s;
   while ((z = stb_strichr(s, *t)) != NULL) {
      if (0==stb_strnicmp(z, t, n))
         return z;
      s = z+1;
   }
   return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x2100
testq %rax, %rax
je 0x3fe1
movq %rax, %r15
movsbl (%r14), %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x3f1c
testq %rax, %rax
je 0x3fdf
movq %rax, %rbx
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2260
testl %eax, %eax
je 0x3fe1
incq %rbx
movq %rbx, %rdi
movl %ebp, %esi
callq 0x3f1c
movq %rax, %rbx
testq %rax, %rax
jne 0x3fb8
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_strtok_raw
static char *stb_strtok_raw(char *output, char *src, char *delimit, int keep, int invert)
{
   if (invert) {
      while (*src && strchr(delimit, *src) != NULL) {
         *output++ = *src++;
      }
   } else {
      while (*src && strchr(delimit, *src) == NULL) {
         *output++ = *src++;
      }
   }
   *output = 0;
   if (keep)
      return src;
   else
      return *src ? src+1 : src;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebp
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movb (%rsi), %r12b
testl %r8d, %r8d
je 0x4054
testb %r12b, %r12b
je 0x4059
movsbl %r12b, %esi
movq %r15, %rdi
callq 0x2110
testq %rax, %rax
je 0x4059
movb %r12b, (%r14)
incq %r14
movb 0x1(%rbx), %r12b
incq %rbx
jmp 0x4011
movsbl %r12b, %esi
movq %r15, %rdi
callq 0x2110
testq %rax, %rax
jne 0x4059
movb %r12b, (%r14)
incq %r14
movb 0x1(%rbx), %r12b
incq %rbx
testb %r12b, %r12b
jne 0x4036
movb $0x0, (%r14)
testl %ebp, %ebp
jne 0x4068
cmpb $0x1, (%rbx)
sbbq $-0x1, %rbx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_dupreplace
char *stb_dupreplace(char *src, char *find, char *replace)
{
   size_t len_find = strlen(find);
   size_t len_replace = strlen(replace);
   int count = 0;

   char *s,*p,*q;

   s = strstr(src, find);
   if (s == NULL) return strdup(src);
   do {
      ++count;
      s = strstr(s + len_find, find);
   } while (s != NULL);

   p = (char *)  malloc(strlen(src) + count * (len_replace - len_find) + 1);
   if (p == NULL) return p;
   q = p;
   s = src;
   for (;;) {
      char *t = strstr(s, find);
      if (t == NULL) {
         strcpy(q,s);
         assert(strlen(p) == strlen(src) + count*(len_replace-len_find));
         return p;
      }
      memcpy(q, s, t-s);
      q += t-s;
      memcpy(q, replace, len_replace);
      q += len_replace;
      s = t + len_find;
   }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %rbx
movq %rsi, %rbp
movq %rdi, %r14
movq %rsi, %rdi
callq 0x2100
movq %rax, %r12
movq %rbx, %rdi
callq 0x2100
movq %rax, %r15
movq %r14, %rdi
movq %rbp, %rsi
callq 0x2390
testq %rax, %rax
je 0x4821
movq %rax, %r13
movq %rbx, 0x20(%rsp)
movq %r12, %rbx
movq %r15, 0x18(%rsp)
subq %r15, %rbx
movq $-0x1, %r15
addq %rbx, %r15
addq %r12, %rax
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2390
testq %rax, %rax
jne 0x4739
movq %r12, 0x28(%rsp)
movq %rbp, 0x30(%rsp)
movq %r14, %rdi
callq 0x2100
subq %r15, %rax
movq %rax, %rdi
callq 0x2250
testq %rax, %rax
je 0x4837
movq %rax, 0x8(%rsp)
movq %rax, %rbx
movq %r14, 0x10(%rsp)
movq %r14, %rbp
movq 0x18(%rsp), %r12
movq %r13, %r14
subq %rbp, %r14
movq %rbx, %rdi
movq %rbp, %rsi
movq %r14, %rdx
callq 0x2230
addq %r14, %rbx
movq %rbx, %rdi
movq 0x20(%rsp), %rsi
movq %r12, %rdx
callq 0x2230
addq %r12, %rbx
movq %r13, %rbp
addq 0x28(%rsp), %rbp
movq %rbp, %rdi
movq 0x30(%rsp), %rsi
callq 0x2390
movq %rax, %r13
testq %rax, %rax
jne 0x478a
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x2080
movq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x2100
movq %rax, %rbx
movq 0x10(%rsp), %rdi
callq 0x2100
subq %rax, %rbx
addq %r15, %rbx
cmpq $-0x1, %rbx
je 0x483a
leaq 0xdd1f(%rip), %rdi      # 0x12528
leaq 0xdca1(%rip), %rsi      # 0x124b1
leaq 0xdd49(%rip), %rcx      # 0x12560
movl $0x8a7, %edx            # imm = 0x8A7
callq 0x2140
movq %r14, %rdi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2380
xorl %r14d, %r14d
movq %r14, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_replaceinplace
void stb_replaceinplace(char *src, char *find, char *replace)
{
   size_t len_find = strlen(find);
   size_t len_replace = strlen(replace);
   int delta;

   char *s,*p,*q;

   delta = len_replace - len_find;
   assert(delta <= 0);
   if (delta > 0) return;

   p = strstr(src, find);
   if (p == NULL) return;

   s = q = p;
   while (*s) {
      memcpy(q, replace, len_replace);
      p += len_find;
      q += len_replace;
      s = strstr(p, find);
      if (s == NULL) s = p + strlen(p);
      memmove(q, p, s-p);
      q += s-p;
      p = s;
   }
   *q = 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x2100
movq %rax, %r13
movq %r15, 0x10(%rsp)
movq %r15, %rdi
callq 0x2100
movq %rax, %r12
movq %r13, 0x8(%rsp)
subl %r13d, %eax
testl %eax, %eax
jg 0x4916
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2390
testq %rax, %rax
je 0x4907
movq %rax, %r13
cmpb $0x0, (%rax)
je 0x4902
movq %r13, %rbp
movq %r13, %rdi
movq 0x10(%rsp), %rsi
movq %r12, %rdx
callq 0x2230
addq 0x8(%rsp), %rbp
movq %rbp, %rdi
movq %r14, %rsi
callq 0x2390
movq %rax, %r15
testq %rax, %rax
jne 0x48df
movq %rbp, %rdi
callq 0x2100
movq %rax, %r15
addq %rbp, %r15
addq %r12, %r13
movq %r15, %rbx
subq %rbp, %rbx
movq %r13, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x22d0
addq %rbx, %r13
cmpb $0x0, (%r15)
movq %r15, %rbp
jne 0x48a9
movb $0x0, (%r13)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xdc70(%rip), %rdi      # 0x1258d
leaq 0xdb8d(%rip), %rsi      # 0x124b1
leaq 0xdc6d(%rip), %rcx      # 0x12598
movl $0x8bb, %edx            # imm = 0x8BB
callq 0x2140
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb__add_section
void stb__add_section(char *buffer, char *data, int curlen, int newlen)
{
   if (newlen < curlen) {
      int z1 = newlen >> 1, z2 = newlen-z1;
      memcpy(buffer, data, z1-1);
      buffer[z1-1] = '.';
      buffer[z1-0] = '.';
      memcpy(buffer+z1+1, data+curlen-z2+1, z2-1);
   } else
      memcpy(buffer, data, curlen);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %r14d
movq %rsi, %rbx
movq %rdi, %r15
cmpl %edx, %ecx
jge 0x499f
movl %ecx, %ebp
movl %ecx, %eax
sarl %eax
subl %eax, %ebp
movslq %eax, %r12
leaq -0x1(%r12), %rdx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2230
leaq (%r15,%r12), %rdi
incq %rdi
movw $0x2e2e, -0x2(%rdi)     # imm = 0x2E2E
movslq %r14d, %rsi
addq %rbx, %rsi
movslq %ebp, %rax
subq %rax, %rsi
incq %rsi
decl %eax
movslq %eax, %rdx
jmp 0x49a8
movslq %r14d, %rdx
movq %r15, %rdi
movq %rbx, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2230
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb__splitpath_raw
static char *stb__splitpath_raw(char *buffer, char *path, int flag)
{
   int len=0,x,y, n = (int) strlen(path), f1,f2;
   char *s = stb_strrchr2(path, '/', '\\');
   char *t = strrchr(path, '.');
   if (s && t && t < s) t = NULL;
   if (s) ++s;

   if (flag == STB_EXT_NO_PERIOD)
      flag |= STB_EXT;

   if (!(flag & (STB_PATH | STB_FILE | STB_EXT))) return NULL;

   f1 = s == NULL ? 0 : s-path; // start of filename
   f2 = t == NULL ? n : t-path; // just past end of filename

   if (flag & STB_PATH) {
      x = 0; if (f1 == 0 && flag == STB_PATH) len=2;
   } else if (flag & STB_FILE) {
      x = f1;
   } else {
      x = f2;
      if (flag & STB_EXT_NO_PERIOD)
         if (buffer[x] == '.')
            ++x;
   }

   if (flag & STB_EXT)
      y = n;
   else if (flag & STB_FILE)
      y = f2;
   else
      y = f1;

   if (buffer == NULL) {
      buffer = (char *) malloc(y-x + len + 1);
      if (!buffer) return NULL;
   }

   if (len) { strcpy(buffer, "./"); return buffer; }
   strncpy(buffer, path+x, y-x);
   buffer[y-x] = 0;
   return buffer;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x2100
movb (%r14), %dl
xorl %r13d, %r13d
testb %dl, %dl
je 0x4bf2
movq %r14, %rcx
cmpb $0x5c, %dl
cmoveq %rcx, %r13
cmpb $0x2f, %dl
cmoveq %rcx, %r13
movb 0x1(%rcx), %dl
incq %rcx
testb %dl, %dl
jne 0x4bda
cmpl $0x8, %ebp
movl $0xc, %r12d
cmovnel %ebp, %r12d
xorl %r15d, %r15d
testb $0x7, %r12b
je 0x4cd8
movq %rbx, (%rsp)
leal 0x1(%r13), %ebp
testq %r13, %r13
cmovel %r15d, %ebp
subl %r14d, %ebp
testq %r13, %r13
cmovel %r15d, %ebp
movq %r14, %rdi
movq %rax, %rbx
movl $0x2e, %esi
callq 0x2130
movq %rbx, %rsi
cmpq %r13, %rax
cmovaeq %rax, %r15
testq %rax, %rax
cmoveq %rax, %r15
testq %r13, %r13
cmoveq %rax, %r15
movq %r15, %rcx
subq %r14, %rcx
testq %r15, %r15
cmoveq %rbx, %rcx
testb $0x1, %r12b
jne 0x4c7c
xorl %eax, %eax
movb $0x1, %r15b
testb $0x2, %r12b
movq (%rsp), %rbx
jne 0x4ca1
testb $0x8, %r12b
jne 0x4cdc
movl %ebp, %r13d
movl %ecx, %ebp
jmp 0x4ca4
movl %r12d, %edx
xorl $0x1, %edx
xorl %eax, %eax
orl %ebp, %edx
setne %r15b
sete %al
addl %eax, %eax
testb $0x2, %r12b
cmovnel %ecx, %ebp
movl %ebp, %r13d
xorl %ebp, %ebp
movq (%rsp), %rbx
jmp 0x4ca4
movl %ecx, %r13d
testb $0x4, %r12b
cmovnel %esi, %r13d
testq %rbx, %rbx
jne 0x4cc8
addl %r13d, %eax
subl %ebp, %eax
incl %eax
movslq %eax, %rdi
callq 0x2250
movq %rax, %rbx
testq %rax, %rax
je 0x4cd8
testb %r15b, %r15b
jne 0x4cf6
movb $0x0, 0x2(%rbx)
movw $0x2f2e, (%rbx)         # imm = 0x2F2E
jmp 0x4d15
xorl %ebx, %ebx
jmp 0x4d15
movslq %ecx, %rax
movl %ebp, %r13d
xorl %ebp, %ebp
cmpb $0x2e, (%rbx,%rax)
sete %bpl
addl %ecx, %ebp
testb $0x4, %r12b
cmovnel %esi, %r13d
movslq %ebp, %rax
addq %rax, %r14
subl %eax, %r13d
movslq %r13d, %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2060
movb $0x0, (%rbx,%r15)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_replacedir
char *stb_replacedir(char *output, char *src, char *dir)
{
   char buffer[4096];
   stb_splitpath(buffer, src, STB_FILE | STB_EXT);
   if (dir)
      sprintf(output, "%s/%s", dir, buffer);
   else
      strcpy(output, buffer);
   return output;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x1008, %rsp           # imm = 0x1008
movq %rdx, %r14
movq %rdi, %rbx
movq %rsp, %rdi
movl $0x6, %edx
callq 0x4bb2
testq %r14, %r14
je 0x4d6e
leaq 0xd8ae(%rip), %rsi      # 0x1260a
movq %rsp, %rcx
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2350
jmp 0x4d79
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x2080
movq %rbx, %rax
addq $0x1008, %rsp           # imm = 0x1008
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_replaceext
char *stb_replaceext(char *output, char *src, char *ext)
{
   char buffer[4096];
   stb_splitpath(buffer, src, STB_PATH | STB_FILE);
   if (ext)
      sprintf(output, "%s.%s", buffer, ext[0] == '.' ? ext+1 : ext);
   else
      strcpy(output, buffer);
   return output;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x1008, %rsp           # imm = 0x1008
movq %rdx, %r14
movq %rdi, %rbx
movq %rsp, %rdi
movl $0x3, %edx
callq 0x4bb2
testq %r14, %r14
je 0x4dcb
xorl %ecx, %ecx
cmpb $0x2e, (%r14)
sete %cl
addq %r14, %rcx
leaq 0xd854(%rip), %rsi      # 0x12610
movq %rsp, %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2350
jmp 0x4dd6
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x2080
movq %rbx, %rax
addq $0x1008, %rsp           # imm = 0x1008
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_free
void stb_free(void *p)
{
   if (p == NULL) return;

   // count frees so that unit tests can see what's happening
   ++stb_alloc_count_free;

   switch(stb__identify(p)) {
      case STB__chunked:
         // freeing a chunked-block with children does nothing;
         // they only get freed when the parent does
         // surely this is wrong, and it should free them immediately?
         // otherwise how are they getting put on the right chain?
         return;
      case STB__nochildren: {
         stb__nochildren *s = (stb__nochildren *) p - 1;
         // unlink from sibling chain
         *(s->prevn) = s->next;
         if (s->next)
            *stb__prevn(s->next) = s->prevn;
         free(s);
         return;
      }
      case STB__alloc: {
         stb__alloc *s = (stb__alloc *) p - 1;
         stb__chunk *c, *n;
         void *q;

         // unlink from sibling chain, if any
         *(s->prevn) = s->next;
         if (s->next)
            *stb__prevn(s->next) = s->prevn;

         // first free chunks
         c = (stb__chunk *) stb__chunks(s);
         while (c != NULL) {
            n = c->next;
            stb_alloc_count_free += c->alloc;
            free(c);
            c = n;
         }

         // validating
         stb__setchunks(s,NULL);
         s->prevn = NULL;
         s->next = NULL;

         // now free children
         while ((q = s->child) != NULL) {
            stb_free(q);
         }

         // now free self
         free(s);
         return;
      }
      default:
         assert(0); /* NOTREACHED */
   }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x4e49
movq %rdi, %r14
incl 0x19119(%rip)           # 0x1df10
movq -0x8(%rdi), %rcx
movl %ecx, %eax
andl $0x3, %eax
leaq 0xd3b9(%rip), %rdx      # 0x121c0
movslq (%rdx,%rax,4), %rax
addq %rdx, %rax
jmpq *%rax
leaq -0x10(%r14), %rbx
movq -0x10(%r14), %rax
movq %rax, (%rcx)
testq %rax, %rax
je 0x4e3c
movq -0x8(%r14), %rcx
leaq -0x8(%rax), %rdx
movl -0x8(%rax), %esi
andl $0x3, %esi
addq $-0x20, %rax
cmpl $0x2, %esi
cmovneq %rdx, %rax
movq %rcx, (%rax)
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x23c0
popq %rbx
popq %r14
popq %r15
retq
leaq -0x20(%r14), %rbx
movq -0x20(%r14), %rcx
movq -0x10(%r14), %rax
movq %rax, (%rcx)
testq %rax, %rax
je 0x4e7e
movq (%rbx), %rcx
leaq -0x8(%rax), %rdx
movl -0x8(%rax), %esi
andl $0x3, %esi
addq $-0x20, %rax
cmpl $0x2, %esi
cmovneq %rdx, %rax
movq %rcx, (%rax)
movq -0x8(%r14), %rdi
addq $-0x2, %rdi
movq (%rdi), %r15
movl 0xc(%rdi), %eax
addl %eax, 0x1907e(%rip)     # 0x1df10
callq 0x23c0
movq %r15, %rdi
testq %r15, %r15
jne 0x4e86
movq $0x2, -0x8(%r14)
xorl %eax, %eax
movq %rax, -0x20(%r14)
movq %rax, -0x10(%r14)
movq -0x18(%r14), %rdi
testq %rdi, %rdi
je 0x4e3c
callq 0x4de4
jmp 0x4eb1
leaq 0xd90e(%rip), %rdi      # 0x127d6
leaq 0xd5e2(%rip), %rsi      # 0x124b1
leaq 0xd740(%rip), %rcx      # 0x12616
movl $0xa27, %edx            # imm = 0xA27
callq 0x2140