// File: /workspace/github_c_makefile_star2_O1/zenkj[P]luajit-arm64/src/host/minilua.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){
success=read_line(L,f);
n=first+1;
}
else{
luaL_checkstack(L,nargs+20,"too many arguments");
success=1;
for(n=first;nargs--&&success;n++){
if(lua_type(L,n)==3){
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':
success=read_number(L,f);
break;
case'l':
success=read_line(L,f);
break;
case'a':
read_chars(L,f,~((size_t)0));
success=1;
break;
default:
return luaL_argerror(L,n,"invalid format");
}
}
}
}
if(ferror(f))
return pushresult(L,0,NULL);
if(!success){
lua_pop(L,1);
lua_pushnil(L);
}
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
movq 0x10(%rdi), %r13
subq 0x18(%rdi), %r13
shrq $0x4, %r13
movq %rsi, %rdi
callq 0x31a0
cmpl $0x1, %r13d
movq %r12, 0x8(%rsp)
jne 0x10de2
movq %rbx, %rdi
movq %r15, %rsi
callq 0x10ca2
movl %eax, %r14d
leal 0x1(%r12), %ebp
jmp 0x10f3c
leal 0x13(%r13), %esi
leaq 0x41ea(%rip), %rdx      # 0x14fd7
movq %rbx, %rdi
callq 0x10148
addl $-0x2, %r13d
leaq 0x3620(%rip), %rcx      # 0x14420
movl %r12d, %ebp
movq %rcx, %r12
movq %rbx, %rdi
movl %ebp, %esi
callq 0x975f
cmpq %r12, %rax
je 0x10e41
cmpl $0x3, 0x8(%rax)
jne 0x10e41
movq %rbx, %rdi
movl %ebp, %esi
callq 0xa7af
testq %rax, %rax
je 0x10ee0
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x10fa3
jmp 0x10ec1
movq %rbx, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0x3c5a
testq %rax, %rax
je 0x10f89
cmpb $0x2a, (%rax)
jne 0x10f89
movzbl 0x1(%rax), %eax
cmpl $0x61, %eax
je 0x10ec6
cmpl $0x6c, %eax
je 0x10eb6
cmpl $0x6e, %eax
jne 0x10f9a
movq %r15, %rdi
leaq 0x4188(%rip), %rsi      # 0x15008
leaq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x3080
cmpl $0x1, %eax
jne 0x10f15
movsd 0x10(%rsp), %xmm0
movq 0x10(%rbx), %rax
movsd %xmm0, (%rax)
movl $0x3, 0x8(%rax)
movq 0x10(%rbx), %rax
movl $0x1, %r14d
jmp 0x10f23
movq %rbx, %rdi
movq %r15, %rsi
callq 0x10ca2
movl %eax, %r14d
jmp 0x10f2b
movq %rbx, %rdi
movq %r15, %rsi
movq $-0x1, %rdx
callq 0x10fa3
movl $0x1, %r14d
jmp 0x10f2b
movq %r15, %rdi
callq 0x32d0
movl %eax, %r12d
movl %eax, %edi
movq %r15, %rsi
callq 0x31f0
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x90a1
xorl %r14d, %r14d
cmpl $-0x1, %r12d
leaq 0x3511(%rip), %r12      # 0x14420
setne %r14b
jmp 0x10f2b
movq 0x10(%rbx), %rax
movl $0x0, 0x8(%rax)
xorl %r14d, %r14d
addq $0x10, %rax
movq %rax, 0x10(%rbx)
incl %ebp
addl $-0x1, %r13d
jae 0x10f3c
testl %r14d, %r14d
jne 0x10e06
movq %r15, %rdi
callq 0x3090
testl %eax, %eax
je 0x10f58
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x10a99
movl %eax, %ebp
jmp 0x10f78
testl %r14d, %r14d
jne 0x10f74
movq 0x10(%rbx), %rax
leaq -0x10(%rax), %rcx
movq %rcx, 0x10(%rbx)
movl $0x0, -0x8(%rax)
movq %rax, 0x10(%rbx)
subl 0x8(%rsp), %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x405a(%rip), %rdx      # 0x14fea
movq %rbx, %rdi
movl %ebp, %esi
callq 0xa173
leaq 0x4058(%rip), %rdx      # 0x14ff9
jmp 0x10f90