// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce_app.c
// Function: user_config_init
bool user_config_init(CeUserConfig_t* user_config, const char* filepath){
#if defined(PLATFORM_WINDOWS)
     user_config->library_instance = LoadLibrary(filepath);
     if(user_config->library_instance == NULL){
          ce_log("LoadLibrary() failed\n");
          return false;
     }

     user_config->filepath = strdup(filepath);
     user_config->init_func = (CeUserConfigFunc*)(GetProcAddress(user_config->library_instance,
                                                                "ce_init"));
     if(user_config->init_func == NULL){
          ce_log("missing 'ce_init()' in %s\n", user_config->filepath);
          return false;
     }

     user_config->free_func = (CeUserConfigFunc*)(GetProcAddress(user_config->library_instance,
                                                                "ce_free"));
     if(user_config->free_func == NULL){
          ce_log("missing 'ce_init()' in %s\n", user_config->filepath);
          return false;
     }

     user_config->save_func = (CeOnSaveFunc*)(GetProcAddress(user_config->library_instance,
                                                             "ce_on_save_file"));
     if(user_config->save_func != NULL){
          ce_log("Detected 'ce_on_save_func()' in %s\n", user_config->filepath);
     }
#else
     user_config->handle = dlopen(filepath, RTLD_LAZY);
     if(!user_config->handle){
          ce_log("dlopen() failed: '%s'\n", dlerror());
          return false;
     }

     user_config->filepath = strdup(filepath);
     user_config->init_func = dlsym(user_config->handle, "ce_init");
     if(!user_config->init_func){
          ce_log("missing 'ce_init()' in %s\n", user_config->filepath);
          return false;
     }

     user_config->free_func = dlsym(user_config->handle, "ce_free");
     if(!user_config->free_func){
          ce_log("missing 'ce_init()' in %s\n", user_config->filepath);
          return false;
     }

     user_config->save_func = dlsym(user_config->handle, "ce_on_save_file");
     if(user_config->save_func){
          ce_log("detected 'ce_on_save_file()' in %s\n", user_config->filepath);
     }
#endif
     return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
movl $0x1, %esi
callq 0xd3b0
movq %rax, (%rbx)
testq %rax, %rax
je 0x12108
movq %rax, %r15
movq %r14, %rdi
callq 0xd640
movq %rax, 0x8(%rbx)
leaq 0x1b82f(%rip), %rsi     # 0x2d8d7
movq %r15, %rdi
callq 0xd5e0
movq %rax, 0x10(%rbx)
testq %rax, %rax
je 0x120f9
movq (%rbx), %rdi
leaq 0x1b837(%rip), %rsi     # 0x2d8fa
callq 0xd5e0
movq %rax, 0x18(%rbx)
testq %rax, %rax
je 0x120f9
movq (%rbx), %rdi
leaq 0x1b827(%rip), %rsi     # 0x2d902
callq 0xd5e0
movq %rax, 0x20(%rbx)
movb $0x1, %bpl
testq %rax, %rax
je 0x12120
movq 0x8(%rbx), %rsi
leaq 0x1b81b(%rip), %rdi     # 0x2d912
jmp 0x12119
movq 0x8(%rbx), %rsi
leaq 0x1b7db(%rip), %rdi     # 0x2d8df
xorl %ebp, %ebp
jmp 0x12119
callq 0xd080
leaq 0x1b7ac(%rip), %rdi     # 0x2d8c0
xorl %ebp, %ebp
movq %rax, %rsi
xorl %eax, %eax
callq 0xd954
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq