Function at 0x40a040
Capabilities:
Check if file exists
Get file size
Read file on windows

Disassembly:
push 0xffffffffffffffff
push 0x461568
mov eax, dword fs:[0]
push eax
mov dword fs:[0], esp
sub esp, 0x24
push ebx
push ebp
push esi
push edi
mov dword [esp + 0x28], ecx
mov esi, dword [esp + 0x44]
xor edi, edi
push esi
mov dword [esp + 0x40], edi
mov dword [esp + 0x20], edi
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
je 0x40a319
mov dword [esp + 0x10], edi
lea eax, [esp + 0x10]
mov byte [esp + 0x3c], 1
push eax
push 0x46ff08
push 0x17
push edi
push 0x466ff8
call dword [sym.imp.ole32.dll_CoCreateInstance]
test eax, eax
mov eax, dword [esp + 0x10]
jl 0x40a356
cmp eax, edi
je 0x40a356
push edi
push 0x80
push 3
push edi
push edi
push SysReAllocString
push esi
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov ebp, eax
cmp ebp, 0xffffffff
jne 0x40a10c
mov eax, dword [esp + 0x10]
mov byte [esp + 0x3c], 0
cmp eax, edi
je 0x40a0e2
mov ecx, dword [eax]
push eax
call dword [ecx + 8]
mov eax, dword [0x46f430]
lea edx, [esi - 0xc]
cmp edx, eax
je 0x40a105
add esi, 0xfffffff4
push esi
call dword [sym.imp.KERNEL32.dll_InterlockedDecrement]
test eax, eax
jg 0x40a105
push esi
call fcn.004535f0
add esp, 4
xor eax, eax
jmp 0x40a341
push edi
push ebp
call dword [sym.imp.KERNEL32.dll_GetFileSize]
lea ebx, [eax + 1]
mov dword [esp + 0x18], eax
push ebx
mov dword [esp + 0x28], edi
call fcn.00455403
mov ecx, ebx
mov esi, eax
mov edx, ecx
xor eax, eax
mov edi, esi
add esp, 4
shr ecx, 2
rep stosd dword es:[edi], eax
mov ecx, edx
push 0
and ecx, 3
rep stosb byte es:[edi], al
lea eax, [esp + 0x28]
push eax
push ebx
push esi
push ebp
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov ecx, dword [esp + 0x18]
push ecx
push esi
call fcn.00409be0
add esp, 8
push ebp
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov edi, esi
or ecx, 0xffffffff
xor eax, eax
mov dword [esp + 0x20], 0
repne scasb al, byte es:[edi]
not ecx
dec ecx
mov edi, ecx
lea edx, [edi + edi + 0x14]
push edx
call fcn.00455403
mov ebx, eax
xor ebp, ebp
add esp, 4
cmp ebx, ebp
mov dword [esp + 0x2c], ebx
je 0x40a302
lea eax, [edi + 1]
push eax
push ebx
push eax
push esi
push ebp
push ebp
call dword [sym.imp.KERNEL32.dll_MultiByteToWideChar]
test eax, eax
je 0x40a2f9
mov eax, dword [esp + 0x10]
lea edx, [esp + 0x20]
push edx
push ebx
mov ecx, dword [eax]
push eax
call dword [ecx + 0x104]
test eax, eax
jl 0x40a2f9
cmp word [esp + 0x20], 0xffff
jne 0x40a2f9
mov dword [esp + 0x18], ebp
mov eax, dword [esp + 0x10]
lea edx, [esp + 0x18]
push edx
push 0x46ff00
mov ecx, dword [eax]
push eax
mov byte [esp + 0x48], 2
call dword [ecx + 0x94]
mov eax, dword [esp + 0x18]
cmp eax, ebp
je 0x40a2ea
mov dword [esp + 0x14], ebp
mov ecx, dword [eax]
lea edx, [esp + 0x14]
push edx
push str.node
push eax
mov byte [esp + 0x48], 3
call dword [ecx + 0x90]
mov eax, dword [esp + 0x14]
cmp eax, ebp
je 0x40a2d7
lea edx, [esp + 0x1c]
mov dword [esp + 0x1c], ebp
mov ecx, dword [eax]
push edx
push eax
call dword [ecx + 0x20]
mov eax, dword [esp + 0x1c]
mov edi, dword [esp + 0x48]
xor esi, esi
cmp eax, ebp
jle 0x40a2a6
mov bl, 4
mov dword [esp + 0x48], ebp
mov eax, dword [esp + 0x14]
lea edx, [esp + 0x48]
push edx
push esi
mov ecx, dword [eax]
push eax
mov byte [esp + 0x48], bl
call dword [ecx + 0x1c]
test eax, eax
mov eax, dword [esp + 0x48]
jl 0x40a28a
cmp eax, ebp
je 0x40a28a
push edi
push ecx
lea eax, [esp + 0x50]
mov ecx, esp
mov dword [esp + 0x38], esp
push eax
call fcn.0040abc0
mov ecx, dword [esp + 0x30]
call fcn.0040a370
mov eax, dword [esp + 0x48]
cmp eax, ebp
mov byte [esp + 0x3c], 3
je 0x40a299
mov ecx, dword [eax]
push eax
call dword [ecx + 8]
mov eax, dword [esp + 0x1c]
inc esi
cmp esi, eax
jl 0x40a247
mov ebx, dword [esp + 0x2c]
mov eax, dword [edi + 4]
cmp eax, ebp
jne 0x40a2b1
xor edx, edx
jmp 0x40a2c7
mov ecx, dword [edi + 8]
sub ecx, eax
mov eax, 0x8cf008d
imul ecx
sar edx, 7
mov eax, edx
shr eax, 0x1f
add edx, eax
xor ecx, ecx
cmp ecx, edx
sbb eax, eax
neg eax
mov dword [esp + 0x1c], eax
mov eax, dword [esp + 0x14]
cmp eax, ebp
mov byte [esp + 0x3c], 2
je 0x40a2e6
mov edx, dword [eax]
push eax
call dword [edx + 8]
mov eax, dword [esp + 0x18]
cmp eax, ebp
mov byte [esp + 0x3c], 1
je 0x40a2f9
mov ecx, dword [eax]
push eax
call dword [ecx + 8]
push ebx
call fcn.004535f0
add esp, 4
mov eax, dword [esp + 0x10]
mov byte [esp + 0x3c], 0
cmp eax, ebp
je 0x40a315
mov edx, dword [eax]
push eax
call dword [edx + 8]
mov esi, dword [esp + 0x44]
mov ecx, dword [0x46f430]
lea eax, [esi - 0xc]
cmp eax, ecx
je 0x40a33d
add esi, 0xfffffff4
push esi
call dword [sym.imp.KERNEL32.dll_InterlockedDecrement]
test eax, eax
jg 0x40a33d
push esi
call fcn.004535f0
add esp, 4
mov eax, dword [esp + 0x1c]
mov ecx, dword [esp + 0x34]
pop edi
pop esi
pop ebp
mov dword fs:[0], ecx
pop ebx
add esp, 0x30
ret 8
cmp eax, edi
mov byte [esp + 0x3c], 0
je 0x40a0e2
jmp 0x40a0dc