Function at 0x140044990
Capabilities:
Read file on windows

Disassembly:
push rbp
push rbx
push rsi
push r15
lea rbp, [rsp - 0x23a8]
mov eax, 0x24a8
call fcn.14006dcc0
sub rsp, rax
mov rax, qword [0x1400888e8]
xor rax, rsp
mov qword [rbp + 0x2380], rax
mov qword [rsp + 0x24e8], rdi
mov rsi, rdx
mov ebx, r9d
mov qword [rsp + 0x2498], r13
mov qword [rsp + 0x2490], r14
lea rdx, [0x140000000]
mov dword [rsp + 0x30], ebx
mov rdi, r8
cmp dword [rsi + 0x24], 0
mov r15, rcx
mov qword [rsp + 0x48], r8
je 0x1400449fe
mov r14d, 2
jmp 0x140044a0a
movsxd rax, dword [rsi + 0x28]
mov r14d, dword [rdx + rax*4 + 0x76da0]
movsxd rcx, dword [rsi + 0x70]
xor r13d, r13d
mov dword [rsp + 0x3c], r13d
lea eax, [rcx - 1]
cmp eax, 1
ja 0x140044a35
mov r8, qword [rdx + rcx*8 + 0x872c8]
lea rdx, str.cannot_read_on_a_File_opened_in__s_mode
mov rcx, r15
call sym.wluart_static.exe_luaL_error
lea rdx, [rsp + 0x60]
mov qword [rsp + 0x24a0], r12
mov rcx, r15
call sym.wluart_static.exe_luaL_buffinit
cmp dword [rsi + 0x24], r13d
je 0x140044cfe
mov ecx, 0xfffffff6
call qword [sym.imp.KERNEL32.dll_GetStdHandle]
mov rcx, r15
mov qword [rsp + 0x50], rax
call fcn.14002ead0
mov r8d, dword [sym.wluart_static.exe_TFile]
mov edx, 0xffffffff
mov rcx, r15
call sym.wluart_static.exe_lua_toself
mov edx, 0xfffffffe
mov rcx, r15
mov r14, qword [rax + 8]
call sym.wluart_static.exe_lua_settop
cmp word [0x140088c08], r13w
jne 0x140044b8b
test ebx, ebx
je 0x140044b8b
mov rcx, qword [rsi + 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 [rsi + 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 0x140044b72
lea rax, [rbp + 0x380]
mov r8, 0xffffffffffffffff
nop dword [rax]
cmp word [rax + r8*2 + 2], r13w
lea r8, [r8 + 1]
jne 0x140044af0
lea r8, [r8*2 - 2]
lea rdx, [rbp + 0x380]
lea rcx, [rsp + 0x60]
call sym.wluart_static.exe_luaL_addlstring
mov rcx, qword [rsi + 8]
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll__fileno]
mov ecx, eax
mov edx, ebx
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll__setmode]
mov ebx, dword [rsp + 0x30]
lea rcx, [rsp + 0x60]
call sym.wluart_static.exe_luaL_pushresult
cmp qword [rsp + 0x70], 0
mov r14, qword [rsp + 0x2490]
mov r13, qword [rsp + 0x2498]
mov r12, qword [rsp + 0x24a0]
mov rdi, qword [rsp + 0x24e8]
jne 0x140044e29
test ebx, ebx
jne 0x140044e29
xor eax, eax
jmp 0x140044e5f
lea rdx, [0x140070619]
mov rcx, r15
call sym.wluart_static.exe_lua_pushstring
mov rcx, r15
call sym.wluart_static.exe_lua_error
jmp 0x140044b29
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 [rsi + 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 [rsi + 0x18]
and edx, 0xfffffff8
call qword [sym.imp.KERNEL32.dll_SetConsoleMode]
test ebx, ebx
mov r12, r13
mov ebx, dword [rsp + 0x30]
sete r12b
mov rcx, qword [rsi + 0x18]
test r12, r12
je 0x140044bfa
lea r9, [rsp + 0x3c]
mov qword [rsp + 0x20], r13
mov r8d, 2
lea rdx, [rsp + 0x34]
call qword [sym.imp.KERNEL32.dll_ReadFile]
jmp 0x140044c15
lea r9, [rsp + 0x3c]
mov qword [rsp + 0x20], r13
mov r8d, 1
lea rdx, [rsp + 0x34]
call qword [sym.imp.KERNEL32.dll_ReadConsoleW]
movzx ecx, word [rsp + 0x34]
test ebx, ebx
je 0x140044c28
cmp cx, 0xd
je 0x140044cd5
cmp cx, 3
jne 0x140044c4a
lea rdx, [0x140076fec]
mov rcx, r15
call sym.wluart_static.exe_lua_pushstring
mov rcx, r15
call sym.wluart_static.exe_lua_error
movzx ecx, word [rsp + 0x34]
test r12, r12
jne 0x140044cae
cmp cx, 8
jne 0x140044c8e
mov rax, qword [rsp + 0x70]
test rax, rax
je 0x140044c8e
sub rax, 2
inc rdi
cmp word [0x140088c08], r13w
mov qword [rsp + 0x70], rax
je 0x140044c85
mov rdx, r14
lea rcx, [0x140076ff0]
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fputws]
mov rcx, qword [rsi + 0x18]
jmp 0x140044bfa
movzx eax, word [0x140088c08]
test ax, ax
je 0x140044c9f
movzx ecx, ax
jmp 0x140044ca5
cmp cx, 0x1f
jbe 0x140044cae
mov rdx, r14
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fputwc]
mov r8d, 2
lea rdx, [rsp + 0x34]
lea rcx, [rsp + 0x60]
call sym.wluart_static.exe_luaL_addlstring
test ebx, ebx
jne 0x140044bd4
sub rdi, 1
jne 0x140044bd4
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 0x140044b2d
mov r9, qword [rsi + 8]
test r9, r9
je 0x140044e15
movsxd r12, r14d
lea rcx, [rsp + 0x38]
mov rdx, r12
mov r8d, 1
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fread]
test rax, rax
je 0x140044e24
nop dword [rax + rax]
mov r8d, dword [rsi + 0x28]
mov eax, dword [rsp + 0x38]
cmp r8d, 1
jne 0x140044d8b
movzx ecx, al
mov edx, 0xe5000000
shr ecx, 3
and ecx, 0x1e
shr edx, cl
and edx, 3
inc edx
mov ebx, edx
cmp rbx, 1
jbe 0x140044d87
mov r9, qword [rsi + 8]
lea rcx, [rsp + 0x39]
dec rdx
mov r8d, 1
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fread]
mov r8d, ebx
lea rdx, [rsp + 0x38]
lea rcx, [rsp + 0x60]
call sym.wluart_static.exe_luaL_addlstring
jmp 0x140044deb
mov ebx, dword [rsp + 0x30]
cmp r14d, 2
jne 0x140044d9d
cmp ax, 0xa
je 0x140044da7
movzx r13d, ax
jmp 0x140044dcf
cmp r14d, 1
jne 0x140044dcb
cmp al, 0xa
jne 0x140044dcb
test r8d, r8d
je 0x140044db7
cmp r13d, 0xd
jne 0x140044db7
sub qword [rsp + 0x70], r12
test ebx, ebx
jne 0x140044b29
cmp r14d, 2
jne 0x140044dcb
movzx r13d, ax
jmp 0x140044dcf
movsx r13d, al
mov r8, r12
lea rdx, [rsp + 0x38]
lea rcx, [rsp + 0x60]
call sym.wluart_static.exe_luaL_addlstring
sub rdi, 1
je 0x140044b29
mov r9, qword [rsi + 8]
lea rcx, [rsp + 0x38]
mov r8d, 1
mov rdx, r12
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fread]
mov ebx, dword [rsp + 0x30]
test rax, rax
jne 0x140044d30
jmp 0x140044b2d
lea rdx, str.could_not_read__File_is_not_open
mov rcx, r15
call sym.wluart_static.exe_luaL_error
jmp 0x140044b2d
cmp dword [rsi + 0x28], 2
je 0x140044e35
cmp dword [rsi + 0x24], 0
je 0x140044e5a
lea r8, [rsp + 0x48]
mov edx, 0xffffffff
mov rcx, r15
call sym.wluart_static.exe_lua_tolstring
mov r8, qword [rsp + 0x48]
mov rdx, rax
shr r8, 1
mov rcx, r15
call sym.wluart_static.exe_lua_pushlwstring
mov eax, 1
mov rcx, qword [rbp + 0x2380]
xor rcx, rsp
call fcn.14006dc90
add rsp, 0x24a8
pop r15
pop rsi
pop rbx
pop rbp
ret