Function at 0x508a90
Capabilities:
Check if file exists
Query environment variable
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x65991c
mov eax, dword fs:[0]
push eax
sub esp, 0x18c
mov eax, dword [0x6dc0b8]
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 eax, dword [ebp + 0x10]
mov esi, dword [ebp + 8]
mov edi, dword [ebp + 0xc]
push 0x104
mov dword [ebp - 0x190], eax
lea eax, [ebp - 0x114]
push 0
push eax
call fcn.005e0dd0
add esp, 0xc
cmp dword [esi + 0x14], 0x10
jb 0x508aeb
mov esi, dword [esi]
push 0x104
lea eax, [ebp - 0x114]
push eax
push esi
call dword [sym.imp.KERNEL32.dll_ExpandEnvironmentStringsA]
lea eax, [ebp - 0x114]
mov bl, 1
push eax
call dword [sym.imp.SHLWAPI.dll_PathFileExistsA]
test eax, eax
je 0x508bcc
sub esp, 0x18
lea edx, [ebp - 0x114]
mov ecx, esp
call fcn.00509630
lea ecx, [ebp - 0x174]
call fcn.005059e0
add esp, 0x18
mov dword [ebp - 4], 0
cmp dword [eax + 0x14], 8
jb 0x508b42
mov eax, dword [eax]
mov edx, eax
lea ecx, [ebp - 0x15c]
call fcn.005094c0
mov dword [ebp - 4], 0xffffffff
mov eax, dword [ebp - 0x160]
cmp eax, 8
jb 0x508b74
inc eax
lea ecx, [ebp - 0x174]
push eax
push dword [ebp - 0x174]
call fcn.00416870
cmp dword [ebp - 0x148], 0x10
lea eax, [ebp - 0x15c]
cmovae eax, dword [ebp - 0x15c]
cmp dword [edi + 0x14], 0x10
jb 0x508b92
mov ecx, dword [edi]
jmp 0x508b94
mov ecx, edi
push eax
push ecx
call dword [sym.imp.SHLWAPI.dll_StrStrIA]
xor ecx, ecx
movzx ebx, bl
test eax, eax
mov eax, dword [ebp - 0x148]
cmovne ebx, ecx
cmp eax, 0x10
jb 0x508bc4
inc eax
lea ecx, [ebp - 0x15c]
push eax
push dword [ebp - 0x15c]
call fcn.00414c80
test bl, bl
je 0x508de2
mov dword [ebp - 0x118], 0xf
mov dword [ebp - 0x11c], 0
mov byte [ebp - 0x12c], 0
mov dword [ebp - 4], 1
xor esi, esi
mov ebx, dword [sym.imp.KERNEL32.dll_Sleep]
nop word [eax + eax]
mov ecx, dword [ebp - 0x190]
lea edx, [ebp - 0x12c]
call fcn.0050b9a0
test al, al
jne 0x508c60
push 0xbb8
call ebx
inc esi
cmp esi, 3
jl 0x508c00
mov eax, dword [ebp - 0x118]
cmp eax, 0x10
jb 0x508c40
inc eax
lea ecx, [ebp - 0x12c]
push eax
push dword [ebp - 0x12c]
call fcn.00414c80
xor al, al
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.00545b50
mov esp, ebp
pop ebp
ret 0xc
cmp esi, 3
jge 0x508c22
cmp dword [ebp - 0x118], 0x10
lea edx, [ebp - 0x12c]
push dword [ebp - 0x11c]
cmovae edx, dword [ebp - 0x12c]
lea ecx, [ebp - 0x144]
call fcn.0050c040
add esp, 4
mov byte [ebp - 4], 2
lea eax, [ebp - 0x144]
cmp dword [ebp - 0x130], 0x10
cmovae eax, dword [ebp - 0x144]
cmp dword [edi + 0x14], 0x10
jb 0x508cad
mov edi, dword [edi]
push eax
push edi
call dword [sym.imp.SHLWAPI.dll_StrStrIA]
test eax, eax
jne 0x508cf7
mov eax, dword [ebp - 0x130]
cmp eax, 0x10
jb 0x508cd7
inc eax
lea ecx, [ebp - 0x144]
push eax
push dword [ebp - 0x144]
call fcn.00414c80
mov dword [ebp - 0x130], 0xf
mov dword [ebp - 0x134], 0
mov byte [ebp - 0x144], 0
jmp 0x508c22
lea edx, [ebp - 0x114]
lea ecx, [ebp - 0x18c]
call fcn.00509630
mov byte [ebp - 4], 3
cmp dword [eax + 0x14], 8
jb 0x508d14
mov eax, dword [eax]
push eax
call fcn.005085f0
mov eax, dword [ebp - 0x178]
cmp eax, 8
jb 0x508d38
inc eax
lea ecx, [ebp - 0x18c]
push eax
push dword [ebp - 0x18c]
call fcn.00416870
push 0
push 0x80
push 2
push 0
push 1
push 0x40000000
lea eax, [ebp - 0x114]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
cmp dword [ebp - 0x118], 0x10
lea ecx, [ebp - 0x12c]
push 0
cmovae ecx, dword [ebp - 0x12c]
mov esi, eax
lea eax, [ebp - 0x198]
push eax
push dword [ebp - 0x11c]
push ecx
push esi
call dword [sym.imp.KERNEL32.dll_WriteFile]
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [ebp - 0x130]
cmp eax, 0x10
jb 0x508da9
inc eax
lea ecx, [ebp - 0x144]
push eax
push dword [ebp - 0x144]
call fcn.00414c80
mov eax, dword [ebp - 0x118]
mov dword [ebp - 0x130], 0xf
mov dword [ebp - 0x134], 0
mov byte [ebp - 0x144], 0
cmp eax, 0x10
jb 0x508de2
inc eax
lea ecx, [ebp - 0x12c]
push eax
push dword [ebp - 0x12c]
call fcn.00414c80
mov al, 1
jmp 0x508c42