Function at 0x1400383ac
Capabilities:
Read file on windows

Disassembly:
mov qword [rsp + 0x20], rbx
push rbp
push rsi
push rdi
push r12
push r13
push r14
push r15
lea rbp, [rsp - 0x2390]
mov eax, 0x2490
call fcn.1400474e0
sub rsp, rax
mov rax, qword [0x1400593d8]
xor rax, rsp
mov qword [rbp + 0x2380], rax
mov rdi, rdx
mov dword [rsp + 0x38], r9d
mov rsi, rcx
mov qword [rsp + 0x48], r8
xor ecx, ecx
lea rdx, [0x140000000]
mov r13d, r9d
mov r15, r8
cmp dword [rdi + 0x24], ecx
je 0x14003840b
lea ebx, [rcx + 2]
jmp 0x140038416
movsxd rax, dword [rdi + 0x28]
mov ebx, dword [rdx + rax*4 + 0x50530]
mov dword [rsp + 0x3c], ecx
mov r12d, ecx
movsxd rcx, dword [rdi + 0x70]
lea eax, [rcx - 1]
cmp eax, 1
ja 0x140038440
mov r8, qword [rdx + rcx*8 + 0x59288]
lea rdx, str.cannot_read_on_a_File_opened_in__s_mode
mov rcx, rsi
call sym.luart_static.exe_luaL_error
lea rdx, [rsp + 0x60]
mov rcx, rsi
call sym.luart_static.exe_luaL_buffinit
xor eax, eax
cmp dword [rdi + 0x24], eax
je 0x1400386b6
mov ecx, 0xfffffff6
call qword [sym.imp.KERNEL32.dll_GetStdHandle]
mov rcx, rsi
mov qword [rsp + 0x50], rax
call fcn.140025884
mov r8d, dword [sym.luart_static.exe_TFile]
or edx, 0xffffffff
mov rcx, rsi
call sym.luart_static.exe_lua_toself
mov edx, 0xfffffffe
mov rcx, rsi
mov r14, qword [rax + 8]
call sym.luart_static.exe_lua_settop
cmp word [0x1400596e8], r12w
jne 0x140038539
test r13d, r13d
je 0x140038539
mov rcx, qword [rdi + 8]
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll__fileno]
mov ecx, eax
mov edx, 0x20000
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll__setmode]
mov r8, qword [rdi + 8]
lea rcx, [rbp + 0x380]
mov edx, 0x1000
mov ebx, eax
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fgetws]
test rax, rax
je 0x14003851d
lea rax, [rbp + 0x380]
or r8, 0xffffffffffffffff
inc r8
cmp word [rax + r8*2], r12w
jne 0x1400384e9
lea r8, [r8*2 - 2]
lea rdx, [rbp + 0x380]
lea rcx, [rsp + 0x60]
call sym.luart_static.exe_luaL_addlstring
mov rcx, qword [rdi + 8]
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll__fileno]
mov edx, ebx
jmp 0x1400386a9
lea rdx, [0x14004a080]
mov rcx, rsi
call sym.luart_static.exe_lua_pushstring
mov rcx, rsi
call sym.luart_static.exe_lua_error
jmp 0x1400387dc
mov rcx, r14
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll__fileno]
mov ecx, eax
mov edx, 0x20000
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll__setmode]
mov rcx, qword [rdi + 0x18]
lea rdx, [rsp + 0x40]
mov dword [rsp + 0x44], eax
call qword [sym.imp.KERNEL32.dll_GetConsoleMode]
mov edx, dword [rsp + 0x40]
mov ebx, eax
mov rcx, qword [rdi + 0x18]
and edx, 0xfffffff8
call qword [sym.imp.KERNEL32.dll_SetConsoleMode]
xor edx, edx
test ebx, ebx
sete r12b
lea ebx, [rdx + 0xd]
mov rcx, qword [rdi + 0x18]
test r12, r12
je 0x1400385a6
mov qword [rsp + 0x20], rdx
lea r9, [rsp + 0x3c]
lea rdx, [rsp + 0x30]
mov r8d, 2
call qword [sym.imp.KERNEL32.dll_ReadFile]
jmp 0x1400385c1
mov qword [rsp + 0x20], rdx
lea r9, [rsp + 0x3c]
lea rdx, [rsp + 0x30]
mov r8d, 1
call qword [sym.imp.KERNEL32.dll_ReadConsoleW]
movzx ecx, word [rsp + 0x30]
xor edx, edx
test r13d, r13d
je 0x1400385d6
cmp cx, bx
je 0x14003868d
mov eax, 3
cmp cx, ax
jne 0x1400385fe
lea rdx, [0x14005099c]
mov rcx, rsi
call sym.luart_static.exe_lua_pushstring
mov rcx, rsi
call sym.luart_static.exe_lua_error
movzx ecx, word [rsp + 0x30]
xor edx, edx
test r12, r12
jne 0x140038663
cmp cx, 8
jne 0x140038643
mov rax, qword [rsp + 0x70]
test rax, rax
je 0x140038643
sub rax, 2
inc r15
cmp word [0x1400596e8], dx
mov qword [rsp + 0x70], rax
je 0x14003863a
mov rdx, r14
lea rcx, [0x1400509a0]
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fputws]
xor edx, edx
mov rcx, qword [rdi + 0x18]
jmp 0x1400385a6
movzx eax, word [0x1400596e8]
test ax, ax
je 0x140038654
movzx ecx, ax
jmp 0x14003865a
cmp cx, 0x1f
jbe 0x140038663
mov rdx, r14
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fputwc]
mov r8d, 2
lea rdx, [rsp + 0x30]
lea rcx, [rsp + 0x60]
call sym.luart_static.exe_luaL_addlstring
xor edx, edx
test r13d, r13d
jne 0x140038580
sub r15, 1
jne 0x140038580
mov edx, dword [rsp + 0x40]
mov rcx, qword [rsp + 0x50]
call qword [sym.imp.KERNEL32.dll_SetConsoleMode]
mov rcx, r14
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll__fileno]
mov edx, dword [rsp + 0x44]
mov ecx, eax
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll__setmode]
jmp 0x1400387dc
mov r9, qword [rdi + 8]
test r9, r9
je 0x1400387cd
movsxd r14, ebx
lea rcx, [rsp + 0x34]
mov rdx, r14
mov r8d, 1
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fread]
xor edx, edx
test rax, rax
je 0x1400387dc
lea ecx, [rdx + 0xd]
lea r8d, [rdx + 3]
mov eax, dword [rsp + 0x34]
mov r10d, 1
cmp dword [rdi + 0x28], r10d
jne 0x14003874f
movzx ecx, al
mov edx, 0xe5000000
shr ecx, 3
and ecx, 0x1e
shr edx, cl
and edx, r8d
add edx, r10d
mov r13d, edx
cmp r13, r10
jbe 0x140038743
mov r9, qword [rdi + 8]
lea rcx, [rsp + 0x35]
dec rdx
mov r8d, r10d
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fread]
mov r8d, r13d
lea rdx, [rsp + 0x34]
lea rcx, [rsp + 0x60]
call sym.luart_static.exe_luaL_addlstring
jmp 0x14003879c
mov r13d, dword [rsp + 0x38]
mov ecx, reloc.WS2_32.dll_listen
xor edx, edx
cmp ebx, 2
jne 0x14003875a
cmp ax, 0xa
je 0x140038763
cmp ebx, r10d
jne 0x140038777
cmp al, 0xa
jne 0x140038780
cmp dword [rdi + 0x28], edx
je 0x140038772
cmp r12d, ecx
jne 0x140038772
sub qword [rsp + 0x70], r14
test r13d, r13d
jne 0x1400387dc
movzx r12d, ax
cmp ebx, 2
je 0x140038784
movsx r12d, al
mov r8, r14
lea rdx, [rsp + 0x34]
lea rcx, [rsp + 0x60]
call sym.luart_static.exe_luaL_addlstring
sub r15, 1
je 0x1400387dc
mov r9, qword [rdi + 8]
lea rcx, [rsp + 0x34]
mov r8d, 1
mov rdx, r14
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fread]
mov r13d, dword [rsp + 0x38]
xor edx, edx
lea ecx, [rdx + 0xd]
lea r8d, [rdx + 3]
test rax, rax
jne 0x1400386ec
jmp 0x1400387dc
lea rdx, str.could_not_read__File_is_not_open
mov rcx, rsi
call sym.luart_static.exe_luaL_error
lea rcx, [rsp + 0x60]
call sym.luart_static.exe_luaL_pushresult
xor eax, eax
cmp qword [rsp + 0x70], rax
jne 0x1400387f5
cmp dword [rsp + 0x38], eax
je 0x140038828
cmp dword [rdi + 0x28], 2
je 0x140038800
cmp dword [rdi + 0x24], eax
je 0x140038823
lea r8, [rsp + 0x48]
or edx, 0xffffffff
mov rcx, rsi
call sym.luart_static.exe_lua_tolstring
mov r8, qword [rsp + 0x48]
mov rdx, rax
shr r8, 1
mov rcx, rsi
call sym.luart_static.exe_lua_pushlwstring
mov eax, 1
mov rcx, qword [rbp + 0x2380]
xor rcx, rsp
call fcn.1400474b0
mov rbx, qword [rsp + 0x24e8]
add rsp, 0x2490
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbp
ret