// File: /workspace/github_cpp_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %rsi, %rbx
movq %rdi, %rcx
movzbl (%rsi), %eax
cmpl $0x77, %eax
je 0x978f
cmpl $0x72, %eax
jne 0x98a5
cmpb $0x0, 0x12bea(%rip)     # 0x1c380
jne 0x97ba
movabsq $0x6769666e6f6362, %rax # imm = 0x6769666E6F6362
movq %rax, 0x12bdc(%rip)     # 0x1c385
movabsq $0x6f636274732e2f7e, %rax # imm = 0x6F636274732E2F7E
movq %rax, 0x12bc6(%rip)     # 0x1c380
leaq 0x7173(%rip), %rsi      # 0x10934
leaq 0x12bb8(%rip), %rdx     # 0x1c380
leaq 0x10(%rsp), %r15
movq %r15, %rdi
xorl %eax, %eax
callq 0x2350
pushq $0x18
popq %rsi
xorl %edi, %edi
callq 0x4dcf
movq %rax, %r14
andq $0x0, (%rax)
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x75f1
movq %rax, 0x8(%r14)
testq %rax, %rax
je 0x98b0
movq %rax, %r12
leaq 0x6b64(%rip), %rsi      # 0x10370
pushq $0xc
popq %rdx
movq %rax, %rdi
callq 0x2280
testl %eax, %eax
jne 0x98b0
movq %rbx, (%rsp)
movq %r12, %r13
addq $0xc, %r13
pushq $0x18
popq %rbp
pushq $0x1
popq %r15
addq 0x8(%rsp), %r12
cmpq %r12, %r13
jae 0x98aa
movswq (%r13), %rbx
movslq 0x2(%r13,%rbx), %r12
movq (%r14), %rax
testq %rax, %rax
je 0x985c
movl -0x10(%rax), %ecx
cmpl -0xc(%rax), %ecx
jge 0x985c
incl %ecx
movl %ecx, -0x10(%rax)
jmp 0x986c
movq %r14, %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x521e
movq (%r14), %rax
leaq 0x2(%r13), %rcx
leaq (%rbx,%r13), %rdx
addq $0x2, %rdx
leaq (%rbx,%r13), %rsi
addq $0x6, %rsi
leaq (%r12,%rdx), %r13
addq $0x4, %r13
movslq -0x10(%rax), %rdx
imulq $0x18, %rdx, %rdx
movq %rcx, -0x18(%rax,%rdx)
movq %rsi, -0x10(%rax,%rdx)
movl %r12d, -0x8(%rax,%rdx)
movq 0x8(%r14), %r12
jmp 0x9831
xorl %r14d, %r14d
jmp 0x98ce
movq (%rsp), %rbx
jne 0x98e3
cmpb $0x77, (%rbx)
jne 0x98c8
leaq 0x6eb3(%rip), %rsi      # 0x1076f
leaq 0x10(%rsp), %rdi
callq 0x22f0
jmp 0x98ca
xorl %eax, %eax
movq %rax, 0x10(%r14)
movq %r14, %rax
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7054(%rip), %rdi      # 0x1093e
leaq 0x6b30(%rip), %rsi      # 0x10421
leaq 0x7060(%rip), %rcx      # 0x10958
movl $0x1a14, %edx           # imm = 0x1A14
callq 0x2140