// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0xd3b0
movq %rax, (%rbx)
testq %rax, %rax
je 0x119b1
movq %rax, %r15
movq %r14, %rdi
callq 0xd640
movq %rax, 0x8(%rbx)
leaq 0x18f86(%rip), %rsi     # 0x2a8d7
movq %r15, %rdi
callq 0xd5e0
movq %rax, 0x10(%rbx)
testq %rax, %rax
je 0x119a2
movq (%rbx), %rdi
leaq 0x18f8e(%rip), %rsi     # 0x2a8fa
callq 0xd5e0
movq %rax, 0x18(%rbx)
testq %rax, %rax
je 0x119a2
movq (%rbx), %rdi
leaq 0x18f7e(%rip), %rsi     # 0x2a902
callq 0xd5e0
movq %rax, 0x20(%rbx)
movb $0x1, %bpl
testq %rax, %rax
je 0x119c9
movq 0x8(%rbx), %rsi
leaq 0x18f72(%rip), %rdi     # 0x2a912
jmp 0x119c2
movq 0x8(%rbx), %rsi
leaq 0x18f32(%rip), %rdi     # 0x2a8df
xorl %ebp, %ebp
jmp 0x119c2
callq 0xd080
leaq 0x18f03(%rip), %rdi     # 0x2a8c0
xorl %ebp, %ebp
movq %rax, %rsi
xorl %eax, %eax
callq 0xd8e5
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq