// File: /workspace/github_c_makefile_star2_O3/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 0x5d39
movl %eax, %ebp
incl %ebp
testq %r14, %r14
je 0x1566b
leaq 0xdd10(%rip), %rsi      # 0x23349
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x65ff
leaq 0xc9e1(%rip), %rsi      # 0x2202e
movq %r14, %rdi
callq 0x52e0
movq %rax, 0x10(%rsp)
testq %rax, %rax
jne 0x15689
leaq 0xdcec(%rip), %rsi      # 0x23352
jmp 0x15794
leaq 0xdcd0(%rip), %rsi      # 0x23342
movq %rbx, %rdi
callq 0x656b
movq 0x1a94f(%rip), %rax     # 0x2ffd0
movq (%rax), %rax
movq %rax, 0x10(%rsp)
leaq 0x8(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0x15824
testl %eax, %eax
je 0x156ad
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 0x156f9
movq 0x10(%rsp), %rdx
leaq 0xdc80(%rip), %rsi      # 0x2334d
movq %r14, %rdi
callq 0x52f0
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x1578d
leaq 0x8(%rsp), %rdi
leaq 0x4(%rsp), %r12
movq %r12, %rsi
callq 0x15824
movl (%r12), %eax
cmpl $-0x1, %eax
je 0x1570e
movslq 0x8(%rsp), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x8(%rsp)
movb %al, 0x18(%rsp,%rcx)
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edx, %edx
callq 0x6359
leaq 0x1a3(%rip), %rsi       # 0x158c7
leaq 0x8(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rdx
movq %rax, %rcx
movq %r15, %r8
callq 0x70d3
movl %eax, %r15d
movq 0x8(%r12), %r12
movq %r12, %rdi
callq 0x50c0
movl %eax, %r13d
testq %r14, %r14
je 0x1575a
movq %r12, %rdi
callq 0x5130
movq %rbx, %rdi
testl %r13d, %r13d
je 0x15772
movl %ebp, %esi
callq 0x5d4d
leaq 0xd5c6(%rip), %rsi      # 0x22d36
jmp 0x15794
movl %ebp, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x5eb2
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x5d4d
jmp 0x157a4
leaq 0xdbbc(%rip), %rsi      # 0x23350
movq %rbx, %rdi
movl %ebp, %edx
callq 0x157b9
movl $0x7, %r15d
movl %r15d, %eax
addq $0x2018, %rsp           # imm = 0x2018
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq