Function at 0x4138d0
Capabilities:
Check if file exists
Query environment variable
Read file on windows

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x56f416
mov eax, dword fs:[0]
push eax
mov eax, 0x123c
call fcn.0054f040
mov eax, dword [0x5d2fec]
xor eax, ebp
mov dword [ebp - 0x10], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov edi, ecx
mov eax, dword [0x5dd758]
cmp eax, dword [0x5dd75c]
sete al
test al, al
je 0x413ece
call fcn.00417ce3
mov ecx, eax
test ecx, ecx
jne 0x41392f
push 0x80004005
call fcn.00407010
mov eax, dword [ecx]
call dword [eax + 0xc]
lea esi, [eax + 0x10]
mov dword [ebp - 0x1230], esi
mov dword [ebp - 4], 0
call fcn.00417ce3
mov ecx, eax
test ecx, ecx
jne 0x413959
push 0x80004005
call fcn.00407010
mov eax, dword [ecx]
call dword [eax + 0xc]
add eax, 0x10
mov dword [ebp - 0x122c], eax
mov byte [ebp - 4], 1
mov ecx, 1
mov eax, dword [esi - 8]
sub ecx, dword [esi - 4]
sub eax, 0x105
or eax, ecx
jge 0x413995
push 0x105
lea ecx, [ebp - 0x1230]
call fcn.00406e60
mov esi, dword [ebp - 0x1230]
cmp dword [esi - 8], 0x105
jge 0x4139a8
push 0x80070057
call fcn.00407010
push 0x105
xor eax, eax
mov dword [esi - 0xc], 0x105
push esi
push eax
mov word [esi + 0x20a], ax
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
push 0x5c
push esi
call fcn.005512e5
add esp, 8
test eax, eax
jne 0x4139d9
or eax, 0xffffffff
jmp 0x4139dd
sub eax, esi
sar eax, 1
push eax
lea eax, [ebp - 0x1244]
push eax
lea ecx, [ebp - 0x1230]
call fcn.00405b70
push eax
lea ecx, [ebp - 0x122c]
mov byte [ebp - 4], 2
call fcn.00406cf0
mov byte [ebp - 4], 1
or ecx, 0xffffffff
mov edx, dword [ebp - 0x1244]
mov eax, ecx
add edx, 0xfffffff0
lock xadd dword [edx + 0xc], eax
dec eax
test eax, eax
jg 0x413a24
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
lea eax, [ebp - 0x122c]
mov ecx, 0x5dd64c
push eax
call fcn.00406cf0
push str.data_scanpath.txt
lea eax, [ebp - 0x122c]
mov dword [ebp - 0x1228], 0
push eax
lea eax, [ebp - 0x1228]
push eax
call fcn.00406a20
add esp, 0xc
push str.Wow64DisableWow64FsRedirection
push str.kernel32
mov byte [ebp - 4], 3
call dword [sym.imp.KERNEL32.dll_GetModuleHandleW]
push eax
call dword [sym.imp.KERNEL32.dll_GetProcAddress]
test eax, eax
je 0x413a82
lea ecx, [ebp - 0x1238]
push ecx
call eax
push dword [ebp - 0x1228]
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
jne 0x413aad
push 0x10
push 0x5b2330
push 0x5b2338
mov ecx, edi
call fcn.004239c3
or edi, 0xffffffff
jmp 0x413e4c
push 0
push 0x80
push 3
push 0
push 1
push SysReAllocStringLen
push dword [ebp - 0x1228]
call dword [sym.imp.KERNEL32.dll_CreateFileW]
push 0
push 0
mov ebx, eax
mov dword [ebp - 0x1244], 0
push 2
push ebx
mov dword [ebp - 0x1238], ebx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0x1000
lea eax, [ebp - 0x121c]
push 0
push eax
call fcn.00551910
add esp, 0xc
call fcn.00417ce3
mov ecx, eax
test ecx, ecx
jne 0x413b15
push 0x80004005
call fcn.00407010
mov eax, dword [ecx]
call dword [eax + 0xc]
add eax, 0x10
mov dword [ebp - 0x1224], eax
push 0
lea eax, [ebp - 0x1234]
mov byte [ebp - 4], 4
push eax
push 0x1000
lea eax, [ebp - 0x121c]
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_ReadFile]
lea eax, [ebp - 0x121c]
push eax
lea eax, [ebp - 0x1224]
push 0x5af300
push eax
call fcn.00406ff0
add esp, 0xc
mov dword [ebp - 0x1220], 0
call fcn.00417ce3
mov ecx, eax
test ecx, ecx
jne 0x413b7d
push 0x80004005
call fcn.00407010
mov eax, dword [ecx]
call dword [eax + 0xc]
add eax, 0x10
mov dword [ebp - 0x1220], eax
lea eax, [ebp - 0x1244]
mov byte [ebp - 4], 5
push eax
push 0x5afd40
lea eax, [ebp - 0x1240]
push eax
lea ecx, [ebp - 0x1224]
call fcn.00417550
push eax
lea ecx, [ebp - 0x1220]
mov byte [ebp - 4], 6
call fcn.00406cf0
mov byte [ebp - 4], 5
mov edx, dword [ebp - 0x1240]
or edi, 0xffffffff
add edx, 0xfffffff0
mov eax, edi
lock xadd dword [edx + 0xc], eax
dec eax
test eax, eax
jg 0x413be1
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
lea ecx, [ebp - 0x1220]
call fcn.00416ec0
mov ecx, eax
call fcn.00416e10
mov ecx, 0x5af8f0
mov eax, dword [eax]
nop word [eax + eax]
mov dx, word [eax]
cmp dx, word [ecx]
jne 0x413c26
test dx, dx
je 0x413c22
mov dx, word [eax + 2]
cmp dx, word [ecx + 2]
jne 0x413c26
add eax, 4
add ecx, 4
test dx, dx
jne 0x413c00
xor eax, eax
jmp 0x413c2b
sbb eax, eax
or eax, 1
test eax, eax
setne al
test al, al
je 0x413dfe
mov eax, dword [ebp - 0x1220]
mov ecx, dword [eax - 0xc]
cmp ecx, 1
jle 0x413d5c
test ecx, ecx
jns 0x413c53
or ecx, 0xffffffff
jmp 0x413c76
push 0x5b2374
push eax
call fcn.00550fb4
mov ecx, eax
add esp, 8
mov eax, dword [ebp - 0x1220]
test ecx, ecx
jne 0x413c72
or ecx, 0xffffffff
jmp 0x413c76
sub ecx, eax
sar ecx, 1
test ecx, ecx
jne 0x413cb8
push 0x20a
lea ecx, [ebp - 0x21c]
push ecx
push eax
call dword [sym.imp.KERNEL32.dll_ExpandEnvironmentStringsW]
lea ecx, [ebp - 0x21c]
lea edx, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x413c96
sub ecx, edx
lea eax, [ebp - 0x21c]
sar ecx, 1
push ecx
push eax
lea ecx, [ebp - 0x1220]
call fcn.00406bd0
mov eax, dword [0x5dd75c]
lea ecx, [ebp - 0x1220]
cmp ecx, eax
jae 0x413d11
mov edx, ecx
mov ecx, dword [0x5dd758]
cmp ecx, edx
ja 0x413d11
mov edi, edx
sub edi, ecx
sar edi, 2
cmp eax, dword [0x5dd760]
jne 0x413cf8
push ecx
mov ecx, 0x5dd758
call fcn.00416ba0
mov eax, dword [0x5dd75c]
mov ecx, dword [0x5dd758]
mov dword [ebp - 0x1240], eax
lea ecx, [ecx + edi*4]
mov dword [ebp - 0x123c], eax
mov byte [ebp - 4], 7
test eax, eax
je 0x413d50
jmp 0x413d43
cmp eax, dword [0x5dd760]
jne 0x413d29
push ecx
mov ecx, 0x5dd758
call fcn.00416ba0
mov eax, dword [0x5dd75c]
mov dword [ebp - 0x123c], eax
mov dword [ebp - 0x1240], eax
mov byte [ebp - 4], 8
test eax, eax
je 0x413d50
lea ecx, [ebp - 0x1220]
push ecx
mov ecx, eax
call fcn.004069a0
mov eax, dword [0x5dd75c]
add eax, 4
mov byte [ebp - 4], 5
mov dword [0x5dd75c], eax
lea eax, [ebp - 0x1244]
push eax
push 0x5afd40
lea eax, [ebp - 0x1248]
push eax
lea ecx, [ebp - 0x1224]
call fcn.00417550
mov byte [ebp - 4], 9
mov ecx, dword [eax]
mov edi, dword [ebp - 0x1220]
add edi, 0xfffffff0
lea edx, [ecx - 0x10]
cmp edx, edi
je 0x413def
cmp dword [edi + 0xc], 0
lea ebx, [edi + 0xc]
jl 0x413de0
mov eax, dword [edx]
cmp eax, dword [edi]
jne 0x413de0
push edx
call fcn.00406c80
add esp, 4
mov dword [ebp - 0x1240], eax
or ecx, 0xffffffff
lock xadd dword [ebx], ecx
dec ecx
test ecx, ecx
jg 0x413dc8
mov ecx, dword [edi]
push edi
mov edx, dword [ecx]
call dword [edx + 4]
mov eax, dword [ebp - 0x1240]
add eax, 0x10
mov byte [ebp - 4], 5
mov edx, dword [ebp - 0x1248]
mov dword [ebp - 0x1220], eax
jmp 0x413bc7
push dword [ecx - 0xc]
push ecx
lea ecx, [ebp - 0x1220]
call fcn.00406bd0
mov byte [ebp - 4], 5
mov edx, dword [ebp - 0x1248]
jmp 0x413bc7
push dword [ebp - 0x1238]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov byte [ebp - 4], 4
mov eax, edi
mov edx, dword [ebp - 0x1220]
add edx, 0xfffffff0
lock xadd dword [edx + 0xc], eax
dec eax
test eax, eax
jg 0x413e2b
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
mov byte [ebp - 4], 3
mov eax, edi
mov edx, dword [ebp - 0x1224]
add edx, 0xfffffff0
lock xadd dword [edx + 0xc], eax
dec eax
test eax, eax
jg 0x413e4c
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
push str.Wow64RevertWow64FsRedirection
push str.kernel32
call dword [sym.imp.KERNEL32.dll_GetModuleHandleW]
push eax
call dword [sym.imp.KERNEL32.dll_GetProcAddress]
test eax, eax
je 0x413e70
lea ecx, [ebp - 0x123c]
push ecx
call eax
mov byte [ebp - 4], 1
mov eax, edi
mov edx, dword [ebp - 0x1228]
add edx, 0xfffffff0
lock xadd dword [edx + 0xc], eax
dec eax
test eax, eax
jg 0x413e91
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
mov byte [ebp - 4], 0
mov eax, edi
mov edx, dword [ebp - 0x122c]
add edx, 0xfffffff0
lock xadd dword [edx + 0xc], eax
dec eax
test eax, eax
jg 0x413eb2
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
mov dword [ebp - 4], 0xffffffff
add esi, 0xfffffff0
lock xadd dword [esi + 0xc], edi
dec edi
test edi, edi
jg 0x413ece
mov ecx, dword [esi]
push esi
mov eax, dword [ecx]
call dword [eax + 4]
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 0x10]
xor ecx, ebp
call fcn.0054e73a
mov esp, ebp
pop ebp
ret