// File: /workspace/github_c_makefile_star2_O3/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, %r13d
movq %rsi, %r15
movq %rdi, %rbx
callq 0x54dc
movl %eax, %r12d
movq %r15, %rdi
callq 0x42f0
cmpl $0x1, %r12d
movq %r13, 0x8(%rsp)
jne 0x16689
movq %rbx, %rdi
movq %r15, %rsi
callq 0x16581
movl %eax, %r14d
leal 0x1(%r13), %ebp
jmp 0x167b2
leal 0x13(%r12), %esi
leaq 0x627f(%rip), %rdx      # 0x1c914
movq %rbx, %rdi
callq 0x10c49
addl $-0x2, %r12d
movl %r13d, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x584a
movq %rbx, %rdi
movl %ebp, %esi
cmpl $0x3, %eax
jne 0x166d5
callq 0x5a33
testq %rax, %rax
je 0x1673e
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x16810
jmp 0x16777
xorl %edx, %edx
callq 0x5a88
movq %rax, %r14
testq %rax, %rax
je 0x166ea
cmpb $0x2a, (%r14)
je 0x166fb
movq %rbx, %rdi
movl %ebp, %esi
leaq 0x60cc(%rip), %rdx      # 0x1c7c2
callq 0x10820
movzbl 0x1(%r14), %eax
cmpl $0x61, %eax
je 0x1677c
cmpl $0x6c, %eax
je 0x1676c
cmpl $0x6e, %eax
jne 0x167fd
movq %r15, %rdi
leaq 0x6219(%rip), %rsi      # 0x1c936
leaq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x40b0
cmpl $0x1, %eax
jne 0x16796
movsd 0x10(%rsp), %xmm0
movq %rbx, %rdi
callq 0x5c2b
jmp 0x1678e
movq %r15, %rdi
callq 0x4530
movl %eax, %r13d
movl %eax, %edi
movq %r15, %rsi
callq 0x4370
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5c5a
xorl %r14d, %r14d
cmpl $-0x1, %r13d
setne %r14b
jmp 0x167a1
movq %rbx, %rdi
movq %r15, %rsi
callq 0x16581
movl %eax, %r14d
jmp 0x167a1
movq %rbx, %rdi
movq %r15, %rsi
movq $-0x1, %rdx
callq 0x16810
movl $0x1, %r14d
jmp 0x167a1
movq %rbx, %rdi
callq 0x5c17
xorl %r14d, %r14d
incl %ebp
addl $-0x1, %r12d
jae 0x167b2
testl %r14d, %r14d
jne 0x166a4
movq %r15, %rdi
callq 0x40c0
testl %eax, %eax
je 0x167ce
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x163ff
movl %eax, %ebp
jmp 0x167ec
testl %r14d, %r14d
jne 0x167e8
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x54e9
movq %rbx, %rdi
callq 0x5c17
subl 0x8(%rsp), %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6123(%rip), %rdx      # 0x1c927
movq %rbx, %rdi
movl %ebp, %esi
callq 0x10820
jmp 0x167ca