// File: /workspace/github_cpp_makefile_star2_O1/attractivechaos[P]udb2/stb/./stb.h
// Function: stb_cfg_open
STB_EXTERN stb_cfg * stb_cfg_open(char *config, char *mode)
{
   size_t len;
   stb_cfg *z;
   char file[512];
   if (mode[0] != 'r' && mode[0] != 'w') return NULL;

   if (!stb__cfg_dir[0]) {
      #ifdef _WIN32
      strcpy(stb__cfg_dir, "c:/stb");
      #else
      strcpy(stb__cfg_dir, "~/.stbconfig");
      #endif

      #ifdef STB_HAS_REGISTRY
      {
         void *reg = stb_reg_open("rHKLM", "Software\\SilverSpaceship\\stb");
         if (reg) {
            stb_reg_read_string(reg, "config_dir", stb__cfg_dir, sizeof(stb__cfg_dir));
            stb_reg_close(reg);
         }
      }
      #endif
   }

   sprintf(file, "%s/%s.cfg", stb__cfg_dir, config);

   z = (stb_cfg *) stb_malloc(0, sizeof(*z));
   z->data = NULL;

   z->loaded_file = stb_filec(file, &len);
   if (z->loaded_file) {
      char *s = z->loaded_file;
      if (!memcmp(s, stb__cfg_sig, 12)) {
         char *s = z->loaded_file + 12;
         while (s < z->loaded_file + len) {
            stb__cfg_item a;
            int n = *(stb_int16 *) s;
            a.key = s+2;
            s = s+2 + n;
            a.value_len = *(int *) s;
            s += 4;
            a.value = s;
            s += a.value_len;
            stb_arr_push(z->data, a);
         }
         assert(s == z->loaded_file + len);
      }
   }

   if (mode[0] == 'w')
      z->f = fopen(file, "wb");
   else
      z->f = NULL;

   return z;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x210, %rsp            # imm = 0x210
movq %rsi, %rbx
movq %rdi, %rcx
movzbl (%rsi), %eax
cmpl $0x77, %eax
je 0xa898
cmpl $0x72, %eax
jne 0xa9d5
cmpb $0x0, 0x13af1(%rip)     # 0x1e390
jne 0xa8c3
movabsq $0x6769666e6f6362, %rax # imm = 0x6769666E6F6362
movq %rax, 0x13ae3(%rip)     # 0x1e395
movabsq $0x6f636274732e2f7e, %rax # imm = 0x6F636274732E2F7E
movq %rax, 0x13acd(%rip)     # 0x1e390
leaq 0x814a(%rip), %rsi      # 0x12a14
leaq 0x13abf(%rip), %rdx     # 0x1e390
leaq 0x10(%rsp), %r15
movq %r15, %rdi
xorl %eax, %eax
callq 0x2350
movl 0xf94e(%rip), %ecx      # 0x1a234
movl $0x18, %esi
xorl %edi, %edi
movl $0x2, %edx
callq 0x5184
movq %rax, %r14
movq $0x0, (%rax)
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x8465
movq %rax, 0x8(%r14)
testq %rax, %rax
je 0xa9df
movq %rax, %r15
movabsq $0x49664e6f43625473, %rax # imm = 0x49664E6F43625473
xorq (%r15), %rax
movl 0x8(%r15), %ecx
xorq $0x2167, %rcx           # imm = 0x2167
orq %rax, %rcx
jne 0xa9df
addq $0xc, %r15
movq 0x8(%r14), %rax
addq 0x8(%rsp), %rax
cmpq %rax, %r15
jae 0xa9da
movq (%r14), %rax
movl $0x1, %ecx
testq %rax, %rax
je 0xa967
movl -0x10(%rax), %ecx
incl %ecx
testq %rax, %rax
je 0xa971
movl -0xc(%rax), %edx
jmp 0xa973
xorl %edx, %edx
movswq (%r15), %r13
movslq 0x2(%r15,%r13), %r12
cmpl %edx, %ecx
jle 0xa994
movq %r14, %rdi
movl $0x18, %esi
movl $0x1, %edx
callq 0x57e0
jmp 0xa997
incl -0x10(%rax)
movq (%r14), %rax
testq %rax, %rax
je 0xa9a5
movslq -0x10(%rax), %rcx
jmp 0xa9a7
xorl %ecx, %ecx
leaq 0x2(%r15), %rdx
leaq (%r15,%r13), %rsi
addq $0x2, %rsi
leaq 0x6(%r15,%r13), %rdi
leaq 0x4(%r12,%rsi), %r15
leaq (%rcx,%rcx,2), %rcx
movq %rdx, -0x18(%rax,%rcx,8)
movq %rdi, -0x10(%rax,%rcx,8)
movl %r12d, -0x8(%rax,%rcx,8)
jmp 0xa943
xorl %r14d, %r14d
jmp 0xa9fd
cmpq %rax, %r15
jne 0xaa11
cmpb $0x77, (%rbx)
jne 0xa9f7
leaq 0x7e64(%rip), %rsi      # 0x1284f
leaq 0x10(%rsp), %rdi
callq 0x22f0
jmp 0xa9f9
xorl %eax, %eax
movq %rax, 0x10(%r14)
movq %r14, %rax
addq $0x210, %rsp            # imm = 0x210
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x8006(%rip), %rdi      # 0x12a1e
leaq 0x7ae2(%rip), %rsi      # 0x12501
leaq 0x8012(%rip), %rcx      # 0x12a38
movl $0x1a14, %edx           # imm = 0x1A14
callq 0x2140