Function at 0x401290
Capabilities:
Get common file path
Query environment variable
Write file on windows

Disassembly:
push ebp
xor eax, eax
mov ebp, esp
push edi
push esi
push ebx
sub esp, 0x22c
mov ecx, dword [ebp + 8]
mov ebx, dword [ebp + 0xc]
test ecx, ecx
jg 0x4012b7
jmp 0x4012d8
add eax, 1
cmp ecx, eax
je 0x4012f0
mov edx, dword [ebx + eax*4]
cmp word [edx], 0x2f
jne 0x4012b0
test byte [section..data], 1
jne 0x4014e5
mov eax, 1
jmp 0x4012e8
mov ecx, dword [section..bss]
test ecx, ecx
je 0x4014b3
xor eax, eax
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret
cmp ecx, 1
je 0x4012d8
lea eax, [ebx + ecx*4]
lea edi, [ebx + 4]
mov dword [ebp - 0x220], eax
jmp 0x401313
add edi, 4
cmp dword [ebp - 0x220], edi
je 0x4012d8
mov eax, dword [edi]
mov dword [ebp - 0x21c], eax
mov dword [esp + 4], 0x3a
mov dword [esp], eax
call dword [sym.imp.ucrtbase.dll_wcsrchr]
mov ebx, eax
test eax, eax
je 0x4013f0
xor edx, edx
lea eax, [eax + 2]
mov word [eax - 2], dx
mov dword [ebp - 0x218], eax
mov dword [esp + 4], str.__r_n
mov dword [esp], eax
call dword [sym.imp.ucrtbase.dll_wcspbrk]
test eax, eax
jne 0x401308
mov dword [ebp - 0x224], ebx
mov esi, dword [ebp - 0x21c]
lea esi, [esi]
lea esi, [esi]
mov dword [esp + 4], 0x3b
mov dword [esp], esi
call dword [sym.imp.ucrtbase.dll_wcschr]
mov ebx, eax
test eax, eax
je 0x4013a0
xor eax, eax
mov word [ebx], ax
cmp word [esi], 0
jne 0x4013d0
lea esi, [ebx + 2]
jmp 0x401370
cmp word [esi], 0
mov ebx, dword [ebp - 0x224]
jne 0x4013e0
test ebx, ebx
jne 0x401308
mov eax, dword [ebp - 0x21c]
mov dword [esp], eax
call dword [sym.imp.ucrtbase.dll_free]
jmp 0x401308
mov edx, dword [ebp - 0x218]
mov eax, esi
call sym._search
jmp 0x401392
mov edx, dword [ebp - 0x218]
mov eax, esi
call sym._search
jmp 0x4013ac
mov dword [esp + 8], 0
mov dword [esp + 4], 0
mov dword [esp], str.PATH
call dword [sym.imp.kernel32.dll_GetEnvironmentVariableW]
mov edx, eax
sub esp, 0xc
lea eax, [eax + eax]
mov dword [ebp - 0x218], edx
mov dword [esp], eax
call dword [sym.imp.ucrtbase.dll_malloc]
mov edx, dword [ebp - 0x218]
test eax, eax
mov esi, eax
je 0x401524
mov dword [esp + 8], edx
mov dword [esp + 4], eax
mov dword [esp], str.PATH
call dword [sym.imp.kernel32.dll_GetEnvironmentVariableW]
sub esp, 0xc
mov dword [esp + 4], str.__r_n
mov eax, dword [ebp - 0x21c]
mov dword [esp], eax
call dword [sym.imp.ucrtbase.dll_wcspbrk]
test eax, eax
je 0x401478
mov dword [esp], esi
call dword [sym.imp.ucrtbase.dll_free]
jmp 0x401308
lea ecx, [ebp - 0x214]
mov dword [esp], 0x104
mov dword [esp + 4], ecx
call dword [sym.imp.kernel32.dll_GetCurrentDirectoryW]
lea ecx, [ebp - 0x214]
sub esp, 8
test eax, eax
jne 0x401512
mov eax, dword [ebp - 0x21c]
mov dword [ebp - 0x21c], esi
mov dword [ebp - 0x218], eax
jmp 0x40135a
mov dword [esp], 2
call dword [sym.imp.ucrtbase.dll___acrt_iob_func]
mov dword [esp + 8], 0xf
mov dword [esp + 0xc], eax
mov dword [esp + 4], 1
mov dword [esp], str.File_not_found_n
call sym._fwrite
jmp 0x4012cd
mov dword [esp + 0x10], edx
mov dword [esp + 0xc], str.Unsupported_option__ls_n
mov dword [esp + 8], str.wmain
mov dword [esp + 4], 0x402000
mov dword [esp], 0
call sym._wine_dbg_log.constprop.0
jmp 0x4012cd
mov edx, dword [ebp - 0x21c]
mov eax, ecx
call sym._search
jmp 0x40149c
test byte [section..data], 2
je 0x4012cd
mov dword [esp + 0xc], str.Out_of_memory_n
mov dword [esp + 8], str.wmain
mov dword [esp + 4], 0x402000
mov dword [esp], 1
call sym._wine_dbg_log.constprop.0
jmp 0x4012cd