// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/extended/luahelper.c
// Function: gt_lua_set_modules_path
int gt_lua_set_modules_path(lua_State *L, GtError *err)
{
  GtStr *modules_path = NULL, *external_modules_path = NULL,
         *package_path = NULL;
  int had_err = 0;
  gt_error_check(err);
  gt_assert(L);
  if (!(modules_path = gt_get_gtdata_path(gt_error_get_progname(err), err)))
    had_err = -1;
  if (!had_err) {
    external_modules_path = gt_str_clone(modules_path);
    gt_str_append_cstr(modules_path, "/modules/?.lua");
    gt_str_append_cstr(external_modules_path, "/modules/external/?.lua");
    lua_getglobal(L, "package");
    gt_assert(lua_istable(L, -1));
    lua_getfield(L, -1, "path");
    gt_assert(lua_isstring(L, -1));
    package_path = gt_str_new_cstr(lua_tostring(L, -1));
    lua_pop(L, 1);
    gt_str_append_char(package_path, ';');
    gt_str_append_str(package_path, modules_path);
    gt_str_append_char(package_path, ';');
    gt_str_append_str(package_path, external_modules_path);
    lua_pushstring(L, gt_str_get(package_path));
    lua_setfield(L, -2, "path");
    lua_pop(L, 1);
  }
  gt_str_delete(package_path);
  gt_str_delete(modules_path);
  gt_str_delete(external_modules_path);
  return had_err;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
testq %rsi, %rsi
je 0xa82a8
movq %r14, %rdi
callq 0x3566a
testb %al, %al
jne 0xa8413
testq %rbx, %rbx
je 0xa840e
movq %r14, %rdi
callq 0x356f2
movq %rax, %rdi
movq %r14, %rsi
callq 0xd5a14
movq %rax, %r15
xorl %r14d, %r14d
testq %rax, %rax
je 0xa83dc
movq %r15, %rdi
callq 0x3c4fb
movq %rax, %r12
leaq 0x53508(%rip), %rsi     # 0xfb7ed
movq %r15, %rdi
callq 0x3c067
leaq 0x53508(%rip), %rsi     # 0xfb7fc
movq %r12, %rdi
callq 0x3c067
leaq 0x447ef(%rip), %rdx     # 0xecaf2
movq %rbx, %rdi
movl $0xffffd8ee, %esi       # imm = 0xFFFFD8EE
callq 0x58b98
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x57c5c
cmpl $0x5, %eax
jne 0xa8418
leaq 0x48a1d(%rip), %rdx     # 0xf0d4a
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x58b98
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x57d30
testl %eax, %eax
je 0xa841d
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edx, %edx
callq 0x58042
movq %rax, %rdi
callq 0x3c03d
movq %rax, %r13
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x578d2
movq %r13, %rdi
movl $0x3b, %esi
callq 0x3c28d
movq %r13, %rdi
movq %r15, %rsi
callq 0x3c12b
movq %r13, %rdi
movl $0x3b, %esi
callq 0x3c28d
movq %r13, %rdi
movq %r12, %rsi
callq 0x3c12b
movq %r13, %rdi
callq 0x3c40b
movq %rbx, %rdi
movq %rax, %rsi
callq 0x58568
leaq 0x4898a(%rip), %rdx     # 0xf0d4a
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x59137
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x578d2
jmp 0xa83e2
xorl %r12d, %r12d
xorl %r13d, %r13d
cmpq $0x1, %r15
sbbl %r14d, %r14d
movq %r13, %rdi
callq 0x3d1eb
movq %r15, %rdi
callq 0x3d1eb
movq %r12, %rdi
callq 0x3d1eb
movl %r14d, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
callq 0x23902
callq 0x2385d
callq 0x23894
callq 0x238cb