// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/deps/lua/src/liolib.c
// Function: g_read
static int g_read (lua_State *L, FILE *f, int first) {
  int nargs = lua_gettop(L) - 1;
  int success;
  int n;
  clearerr(f);
  if (nargs == 0) {  /* no arguments? */
    success = read_line(L, f);
    n = first+1;  /* to return 1 result */
  }
  else {  /* ensure stack space for all results and for auxlib's buffer */
    luaL_checkstack(L, nargs+LUA_MINSTACK, "too many arguments");
    success = 1;
    for (n = first; nargs-- && success; n++) {
      if (lua_type(L, n) == LUA_TNUMBER) {
        size_t l = (size_t)lua_tointeger(L, n);
        success = (l == 0) ? test_eof(L, f) : read_chars(L, f, l);
      }
      else {
        const char *p = lua_tostring(L, n);
        luaL_argcheck(L, p && p[0] == '*', n, "invalid option");
        switch (p[1]) {
          case 'n':  /* number */
            success = read_number(L, f);
            break;
          case 'l':  /* line */
            success = read_line(L, f);
            break;
          case 'a':  /* file */
            read_chars(L, f, ~((size_t)0));  /* read MAX_SIZE_T chars */
            success = 1; /* always success */
            break;
          default:
            return luaL_argerror(L, n, "invalid format");
        }
      }
    }
  }
  if (ferror(f))
    return pushresult(L, 0, NULL);
  if (!success) {
    lua_pop(L, 1);  /* remove last result */
    lua_pushnil(L);  /* push nil instead */
  }
  return n - first;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %r12d
movq %rsi, %r15
movq %rdi, %rbx
callq 0x51ef
movl %eax, %r14d
movq %r15, %rdi
callq 0x42e0
movl %r14d, %ebp
decl %ebp
movq %r12, 0x8(%rsp)
je 0x14c5e
addl $0x13, %r14d
leaq 0x5da3(%rip), %rdx      # 0x1a8d4
movq %rbx, %rdi
movl %r14d, %esi
callq 0xf7ca
pushq $0x1
popq %r14
leaq 0x5c3b(%rip), %r13      # 0x1a782
addl $-0x1, %ebp
jae 0x14c6f
testl %r14d, %r14d
je 0x14c6f
movq %rbx, %rdi
movl %r12d, %esi
callq 0x543c
movq %rbx, %rdi
movl %r12d, %esi
cmpl $0x3, %eax
jne 0x14b8c
callq 0x5612
testq %rax, %rax
je 0x14bf2
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x14ccf
jmp 0x14c32
xorl %edx, %edx
callq 0x5665
movq %rax, %r14
testq %rax, %rax
je 0x14ba1
cmpb $0x2a, (%r14)
je 0x14baf
movq %rbx, %rdi
movl %r12d, %esi
movq %r13, %rdx
callq 0xf3d4
movzbl 0x1(%r14), %eax
cmpl $0x61, %eax
je 0x14c37
cmpl $0x6c, %eax
je 0x14c27
cmpl $0x6e, %eax
jne 0x14cbb
movq %r15, %rdi
leaq 0x5d25(%rip), %rsi      # 0x1a8f6
leaq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x40b0
cmpl $0x1, %eax
jne 0x14c4b
movsd 0x10(%rsp), %xmm0
movq %rbx, %rdi
callq 0x57ea
jmp 0x14c45
movq %r15, %rdi
callq 0x4520
movl %eax, %r13d
movl %eax, %edi
movq %r15, %rsi
callq 0x4360
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5819
xorl %r14d, %r14d
cmpl $-0x1, %r13d
leaq 0x5b61(%rip), %r13      # 0x1a782
setne %r14b
jmp 0x14c56
movq %rbx, %rdi
movq %r15, %rsi
callq 0x14a55
movl %eax, %r14d
jmp 0x14c56
movq %rbx, %rdi
movq %r15, %rsi
pushq $-0x1
popq %rdx
callq 0x14ccf
pushq $0x1
popq %r14
jmp 0x14c56
movq %rbx, %rdi
callq 0x57d9
xorl %r14d, %r14d
incl %r12d
jmp 0x14b47
movq %rbx, %rdi
movq %r15, %rsi
callq 0x14a55
movl %eax, %r14d
incl %r12d
movq %r15, %rdi
callq 0x40c0
testl %eax, %eax
je 0x14c8c
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x148f4
movl %eax, %r12d
jmp 0x14ca9
testl %r14d, %r14d
jne 0x14ca4
pushq $-0x2
popq %rsi
movq %rbx, %rdi
callq 0x51fc
movq %rbx, %rdi
callq 0x57d9
subl 0x8(%rsp), %r12d
movl %r12d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5c25(%rip), %rdx      # 0x1a8e7
movq %rbx, %rdi
movl %r12d, %esi
callq 0xf3d4
jmp 0x14c87