// File: /workspace/github_c_makefile_star2_O1/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 0x1230e
movq %rax, %r15
movq %r14, %rdi
callq 0xd640
movq %rax, 0x8(%rbx)
leaq 0x1c627(%rip), %rsi     # 0x2e8d5
movq %r15, %rdi
callq 0xd5e0
movq %rax, 0x10(%rbx)
testq %rax, %rax
je 0x122ff
movq (%rbx), %rdi
leaq 0x1c62f(%rip), %rsi     # 0x2e8f8
callq 0xd5e0
movq %rax, 0x18(%rbx)
testq %rax, %rax
je 0x122ff
movq (%rbx), %rdi
leaq 0x1c61f(%rip), %rsi     # 0x2e900
callq 0xd5e0
movq %rax, 0x20(%rbx)
movb $0x1, %bpl
testq %rax, %rax
je 0x12326
movq 0x8(%rbx), %rsi
leaq 0x1c613(%rip), %rdi     # 0x2e910
jmp 0x1231f
movq 0x8(%rbx), %rsi
leaq 0x1c5d3(%rip), %rdi     # 0x2e8dd
xorl %ebp, %ebp
jmp 0x1231f
callq 0xd080
leaq 0x1c5a4(%rip), %rdi     # 0x2e8be
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