// File: /workspace/github_c_makefile_star2_O2/tylerneylon[P]APIsWithLua/lua/lauxlib.c
// Function: luaL_loadfilex
LUALIB_API int luaL_loadfilex (lua_State *L, const char *filename,
                                             const char *mode) {
  LoadF lf;
  int status, readstatus;
  int c;
  int fnameindex = lua_gettop(L) + 1;  /* index of filename on the stack */
  if (filename == NULL) {
    lua_pushliteral(L, "=stdin");
    lf.f = stdin;
  }
  else {
    lua_pushfstring(L, "@%s", filename);
    lf.f = fopen(filename, "r");
    if (lf.f == NULL) return errfile(L, "open", fnameindex);
  }
  if (skipcomment(&lf, &c))  /* read initial portion */
    lf.buff[lf.n++] = '\n';  /* add line to correct line numbers */
  if (c == LUA_SIGNATURE[0] && filename) {  /* binary file? */
    lf.f = freopen(filename, "rb", lf.f);  /* reopen in binary mode */
    if (lf.f == NULL) return errfile(L, "reopen", fnameindex);
    skipcomment(&lf, &c);  /* re-read initial portion */
  }
  if (c != EOF)
    lf.buff[lf.n++] = c;  /* 'c' is the first character of the stream */
  status = lua_load(L, getF, &lf, lua_tostring(L, -1), mode);
  readstatus = ferror(lf.f);
  if (filename) fclose(lf.f);  /* close file (even in case of errors) */
  if (readstatus) {
    lua_settop(L, fnameindex);  /* ignore results from 'lua_load' */
    return errfile(L, "read", fnameindex);
  }
  lua_remove(L, fnameindex);
  return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2018, %rsp           # imm = 0x2018
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
callq 0x5b1d
movl %eax, %ebp
incl %ebp
testq %r14, %r14
je 0x1371c
leaq 0xcc9b(%rip), %rsi      # 0x20385
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x6261
leaq 0xb938(%rip), %rsi      # 0x1f036
movq %r14, %rdi
callq 0x52d0
movq %rax, 0x10(%rsp)
testq %rax, %rax
jne 0x1373a
leaq 0xcc77(%rip), %rsi      # 0x2038e
jmp 0x13842
leaq 0xcc5b(%rip), %rsi      # 0x2037e
movq %rbx, %rdi
callq 0x61d0
movq 0x1b89e(%rip), %rax     # 0x2efd0
movq (%rax), %rax
movq %rax, 0x10(%rsp)
leaq 0x8(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0x138cc
testl %eax, %eax
je 0x1375e
movslq 0x8(%rsp), %rax
leal 0x1(%rax), %ecx
movl %ecx, 0x8(%rsp)
movb $0xa, 0x18(%rsp,%rax)
movl 0x4(%rsp), %eax
cmpl $0x1b, %eax
setne %cl
testq %r14, %r14
sete %dl
orb %cl, %dl
jne 0x137aa
movq 0x10(%rsp), %rdx
leaq 0xcc0b(%rip), %rsi      # 0x20389
movq %r14, %rdi
callq 0x52e0
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x1383b
leaq 0x8(%rsp), %rdi
leaq 0x4(%rsp), %r12
movq %r12, %rsi
callq 0x138cc
movl (%r12), %eax
cmpl $-0x1, %eax
je 0x137bf
movslq 0x8(%rsp), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x8(%rsp)
movb %al, 0x18(%rsp,%rcx)
pushq $-0x1
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x5fca
leaq 0x199(%rip), %rsi       # 0x1396c
leaq 0x8(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rdx
movq %rax, %rcx
movq %r15, %r8
callq 0x6d1c
movl %eax, %r15d
movq 0x8(%r12), %r12
movq %r12, %rdi
callq 0x50c0
movl %eax, %r13d
testq %r14, %r14
je 0x13809
movq %r12, %rdi
callq 0x5130
testl %r13d, %r13d
je 0x13821
movq %rbx, %rdi
movl %ebp, %esi
callq 0x5b31
leaq 0xc53f(%rip), %rsi      # 0x1fd5e
jmp 0x13842
pushq $-0x1
popq %rdx
movq %rbx, %rdi
movl %ebp, %esi
callq 0x5b7f
pushq $-0x2
popq %rsi
movq %rbx, %rdi
callq 0x5b31
jmp 0x13850
leaq 0xcb4a(%rip), %rsi      # 0x2038c
movq %rbx, %rdi
movl %ebp, %edx
callq 0x13865
pushq $0x7
popq %r15
movl %r15d, %eax
addq $0x2018, %rsp           # imm = 0x2018
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq