// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6a80
subl $0x1, %eax
movl %eax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0x5300
cmpl $0x0, -0x20(%rbp)
jne 0x2386f
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x23710
movl %eax, -0x24(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x239f4
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %esi
addl $0x14, %esi
leaq 0x905f(%rip), %rdx      # 0x2c8df
callq 0x1ad70
movl $0x1, -0x24(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x20(%rbp), %ecx
movl %ecx, %eax
addl $-0x1, %eax
movl %eax, -0x20(%rbp)
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x39(%rbp)
je 0x238b1
cmpl $0x0, -0x24(%rbp)
setne %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x238bd
jmp 0x239f2
movq -0x10(%rbp), %rdi
movl -0x28(%rbp), %esi
callq 0x6fe0
cmpl $0x3, %eax
jne 0x23916
movq -0x10(%rbp), %rdi
movl -0x28(%rbp), %esi
callq 0x73c0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x238f7
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x23a50
movl %eax, -0x40(%rbp)
jmp 0x2390b
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x23aa0
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
movl %eax, -0x24(%rbp)
jmp 0x239e2
movq -0x10(%rbp), %rdi
movl -0x28(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x74a0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x23942
movq -0x38(%rbp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0x2a, %ecx
movb %al, -0x41(%rbp)
je 0x2395e
movq -0x10(%rbp), %rdi
movl -0x28(%rbp), %esi
leaq 0x8e52(%rip), %rdx      # 0x2c7a2
callq 0x1a7b0
cmpl $0x0, %eax
setne %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
movq -0x38(%rbp), %rax
movsbl 0x1(%rax), %eax
movl %eax, -0x48(%rbp)
subl $0x61, %eax
je 0x239ab
jmp 0x23973
movl -0x48(%rbp), %eax
subl $0x6c, %eax
je 0x23999
jmp 0x2397d
movl -0x48(%rbp), %eax
subl $0x6e, %eax
jne 0x239c8
jmp 0x23987
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x23bb0
movl %eax, -0x24(%rbp)
jmp 0x239e0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x23710
movl %eax, -0x24(%rbp)
jmp 0x239e0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq $-0x1, %rdx
callq 0x23aa0
movl $0x1, -0x24(%rbp)
jmp 0x239e0
movq -0x10(%rbp), %rdi
movl -0x28(%rbp), %esi
leaq 0x8f1c(%rip), %rdx      # 0x2c8f2
callq 0x1a7b0
movl %eax, -0x4(%rbp)
jmp 0x23a3c
jmp 0x239e2
jmp 0x239e4
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x23892
jmp 0x239f4
movq -0x18(%rbp), %rdi
callq 0x50d0
cmpl $0x0, %eax
je 0x23a16
movq -0x10(%rbp), %rdi
xorl %esi, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x23520
movl %eax, -0x4(%rbp)
jmp 0x23a3c
cmpl $0x0, -0x24(%rbp)
jne 0x23a33
movq -0x10(%rbp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x6ab0
movq -0x10(%rbp), %rdi
callq 0x7800
movl -0x28(%rbp), %eax
subl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)