// File: /workspace/github_cpp_makefile_star2_O3/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 0xa740
cmpl $0x72, %eax
jne 0xa864
cmpb $0x0, 0x13c39(%rip)     # 0x1e380
jne 0xa76b
movabsq $0x6769666e6f6362, %rax # imm = 0x6769666E6F6362
movq %rax, 0x13c2b(%rip)     # 0x1e385
movabsq $0x6f636274732e2f7e, %rax # imm = 0x6F636274732E2F7E
movq %rax, 0x13c15(%rip)     # 0x1e380
leaq 0x8252(%rip), %rsi      # 0x129c4
leaq 0x13c07(%rip), %rdx     # 0x1e380
leaq 0x10(%rsp), %r15
movq %r15, %rdi
xorl %eax, %eax
callq 0x2350
movl 0xfa96(%rip), %ecx      # 0x1a224
movl $0x18, %esi
xorl %edi, %edi
movl $0x2, %edx
callq 0x508a
movq %rax, %r14
movq $0x0, (%rax)
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x8377
movq %rax, 0x8(%r14)
testq %rax, %rax
je 0xa871
movabsq $0x49664e6f43625473, %rcx # imm = 0x49664E6F43625473
xorq (%rax), %rcx
movl 0x8(%rax), %edx
xorq $0x2167, %rdx           # imm = 0x2167
orq %rcx, %rdx
jne 0xa871
leaq 0xc(%rax), %r15
movq 0x8(%rsp), %rcx
cmpq $0xd, %rcx
jl 0xa869
movswq (%r15), %r13
movslq 0x2(%r15,%r13), %r12
movq (%r14), %rax
testq %rax, %rax
je 0xa812
movl -0x10(%rax), %ecx
cmpl -0xc(%rax), %ecx
jge 0xa812
incl %ecx
movl %ecx, -0x10(%rax)
jmp 0xa827
movq %r14, %rdi
movl $0x18, %esi
movl $0x1, %edx
callq 0x56ce
movq (%r14), %rax
leaq 0x2(%r15), %rcx
leaq (%r15,%r13), %rdx
addq $0x2, %rdx
leaq 0x6(%r15,%r13), %rsi
leaq 0x4(%r12,%rdx), %r15
movslq -0x10(%rax), %rdx
leaq (%rdx,%rdx,2), %rdx
movq %rcx, -0x18(%rax,%rdx,8)
movq %rsi, -0x10(%rax,%rdx,8)
movl %r12d, -0x8(%rax,%rdx,8)
movq 0x8(%r14), %rax
addq 0x8(%rsp), %rax
cmpq %rax, %r15
jb 0xa7f2
jmp 0xa86c
xorl %r14d, %r14d
jmp 0xa88f
addq %rcx, %rax
cmpq %rax, %r15
jne 0xa8a3
cmpb $0x77, (%rbx)
jne 0xa889
leaq 0x7f82(%rip), %rsi      # 0x127ff
leaq 0x10(%rsp), %rdi
callq 0x22f0
jmp 0xa88b
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 0x8124(%rip), %rdi      # 0x129ce
leaq 0x7c00(%rip), %rsi      # 0x124b1
leaq 0x8130(%rip), %rcx      # 0x129e8
movl $0x1a14, %edx           # imm = 0x1A14
callq 0x2140