Function at 0x405aa0
Capabilities:
Accept command line arguments
Check if file exists
Print debug messages
Query environment variable
Terminate process
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x58
mov eax, dword [section..data]
xor eax, ebp
mov dword [ebp - 4], eax
push ebx
push esi
push edi
push 0x8001
call dword [sym.imp.KERNEL32.dll_SetErrorMode]
xor esi, esi
mov dword [ebp - 0x54], 0x14
mov dword [ebp - 0x50], esi
mov dword [ebp - 0x4c], 7
mov dword [ebp - 0x48], 0xffffffff
mov dword [ebp - 0x44], esi
mov dword [ebp - 0x2c], esi
call dword [sym.imp.KERNEL32.dll_GetCommandLineW]
mov ebx, eax
mov dword [ebp - 0x24], esi
mov dword [ebp - 0x20], esi
mov dword [ebp - 0x1c], 2
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
mov edi, dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [ebp - 0x40], eax
cmp eax, esi
jne 0x405b10
call edi
push eax
push 0x421bb4
jmp 0x405b27
push esi
push esi
push 1
push eax
call dword [sym.imp.KERNEL32.dll_HeapSetInformation]
test eax, eax
jne 0x405b30
call edi
push eax
push 0x421b80
call fcn.00405700
add esp, 8
nop
mov esi, dword [ebp - 0x1c]
lea esi, [esi + esi*2]
add esi, esi
add esi, esi
mov eax, dword [esi + esi + 0x422064]
add esi, esi
push eax
call dword [sym.imp.KERNEL32.dll_GetStdHandle]
mov edi, eax
mov dword [esi + 0x422058], edi
cmp edi, 0xffffffff
jne 0x405b7d
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea ecx, [esi + str.INPUT]
push ecx
push 0x421b44
mov dword [esi + 0x422064], eax
call fcn.00405700
add esp, 0xc
jmp 0x405cc1
test edi, edi
jne 0x405b92
lea edx, [esi + str.INPUT]
push edx
push 0x421b0c
jmp 0x405cb9
cmp dword [ebp - 0x1c], 0
jne 0x405c01
lea eax, [ebp - 0x58]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_GetConsoleMode]
test eax, eax
je 0x405bb6
mov dword [0x422068], 3
jmp 0x405cc1
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x421adc
call fcn.00405700
add esp, 8
push edi
call dword [sym.imp.KERNEL32.dll_GetFileType]
cmp eax, 2
jne 0x405be0
mov dword [0x422068], eax
jmp 0x405cc1
test eax, eax
jne 0x405cc1
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
je 0x405cc1
push eax
push 0x421ab0
jmp 0x405cb9
push edi
call dword [sym.imp.KERNEL32.dll_FlushFileBuffers]
test eax, eax
je 0x405c8b
push 1
lea edx, [ebp - 0x34]
push edx
xor ecx, ecx
xor eax, eax
push ecx
push eax
push edi
mov dword [esi + 0x422068], 1
mov dword [esi + 0x42206c], 2
mov dword [ebp - 0x34], eax
mov dword [ebp - 0x30], ecx
call dword [sym.imp.KERNEL32.dll_SetFilePointerEx]
test eax, eax
jne 0x405c4b
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x421a7c
jmp 0x405cb9
mov eax, dword [ebp - 0x34]
or eax, dword [ebp - 0x30]
jne 0x405cc1
push eax
lea ecx, [ebp - 0x3c]
push ecx
push 2
push 0x421a78
push edi
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x405c78
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x4217d8
jmp 0x405cb9
cmp dword [ebp - 0x3c], 2
je 0x405cc1
push 0x421a38
call dword [sym.imp.KERNEL32.dll_OutputDebugStringA]
jmp 0x405cc1
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 1
jne 0x405ca2
mov dword [esi + 0x422068], 0
jmp 0x405cc1
cmp eax, 6
jne 0x405cb3
mov dword [esi + 0x422068], 3
jmp 0x405cc1
push eax
push 0x421a04
call fcn.00405700
add esp, 8
mov esi, 1
sub dword [ebp - 0x1c], esi
jns 0x405b30
mov edi, ebx
cmp word [edi], 0
je 0x405d41
mov ecx, dword [ebp - 0x24]
mov edx, dword [ebp - 0x20]
lea ecx, [ecx]
test edx, edx
jne 0x405d0c
movzx eax, word [ebx]
cmp eax, 0x20
je 0x405cf1
cmp eax, 9
jne 0x405d0c
xor ecx, ecx
movzx eax, word [ebx + 2]
add ebx, 2
cmp eax, 0x20
je 0x405cf3
cmp eax, 9
je 0x405cf3
cmp word [ebx], cx
je 0x405d41
inc esi
jmp 0x405d2c
movzx eax, word [ebx]
cmp eax, 0x5c
jne 0x405d19
xor ecx, 1
jmp 0x405d29
test ecx, ecx
jne 0x405d27
cmp eax, 0x22
jne 0x405d27
xor edx, 1
jmp 0x405d29
xor ecx, ecx
add ebx, 2
cmp word [ebx], 0
jne 0x405ce0
test edx, edx
je 0x405d41
push 0x4219d0
call dword [sym.imp.KERNEL32.dll_OutputDebugStringA]
sub ebx, edi
add ebx, 2
sar ebx, 1
lea eax, [ebx + esi*2 + 2]
add eax, eax
call fcn.00406060
mov eax, esp
mov dword [ebp - 0x1c], eax
lea eax, [eax + esi*4 + 4]
mov esi, eax
mov ecx, edi
sub esi, edi
movzx edx, word [ecx]
mov word [esi + ecx], dx
add ecx, 2
test dx, dx
jne 0x405d62
mov edx, dword [ebp - 0x1c]
mov dword [edx], eax
movzx esi, word [eax]
xor edi, edi
xor ebx, ebx
mov ecx, eax
mov dword [ebp - 0x20], edi
cmp si, di
je 0x405e4a
jmp 0x405d90
cmp dword [ebp - 0x20], 0
jne 0x405dd5
cmp si, 0x20
je 0x405da2
cmp si, 9
jne 0x405dd5
xor ebx, ebx
xor edx, edx
mov word [ecx], dx
lea esp, [esp]
movzx edx, word [eax + 2]
add eax, 2
cmp edx, 0x20
je 0x405db0
cmp edx, 9
je 0x405db0
cmp word [eax], bx
je 0x405e4a
mov edx, dword [ebp - 0x1c]
inc edi
mov ecx, eax
mov dword [edx + edi*4], eax
jmp 0x405e3e
cmp si, 0x5c
jne 0x405de6
mov edx, 0x5c
inc ebx
mov word [ecx], dx
jmp 0x405e38
cmp si, 0x22
jne 0x405e33
lea edx, [ebx + 1]
shr edx, 1
neg edx
add eax, 2
lea ecx, [ecx + edx*2]
test bl, 1
je 0x405e0d
mov edx, 0x22
mov word [ecx], dx
add ecx, 2
xor ebx, ebx
jmp 0x405e3e
cmp dword [ebp - 0x20], 0
je 0x405e2b
cmp word [eax], 0x22
jne 0x405e2b
mov edx, 0x22
mov word [ecx], dx
add ecx, 2
add eax, 2
xor ebx, ebx
jmp 0x405e3e
xor dword [ebp - 0x20], 1
xor ebx, ebx
jmp 0x405e3e
xor ebx, ebx
mov word [ecx], si
add ecx, 2
add eax, 2
movzx esi, word [eax]
test si, si
jne 0x405d90
xor eax, eax
mov word [ecx], ax
mov ecx, dword [ebp - 0x1c]
inc edi
mov dword [ebp - 0x24], edi
mov dword [ecx + edi*4], eax
call dword [sym.imp.KERNEL32.dll_GetEnvironmentStringsW]
mov dword [ebp - 0x20], eax
test eax, eax
jne 0x405f12
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x421998
call fcn.00405700
add esp, 8
mov edi, dword [ebp - 0x2c]
call fcn.00405680
mov edx, dword [ebp - 0x1c]
mov eax, dword [ebp - 0x24]
push edi
push edx
push eax
call fcn.00401930
add esp, 0xc
mov dword [ebp - 0x24], eax
call fcn.00405680
mov eax, dword [ebp - 0x20]
test eax, eax
je 0x405ec5
push eax
call dword [sym.imp.KERNEL32.dll_FreeEnvironmentStringsW]
test eax, eax
jne 0x405ec5
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x421960
call fcn.00405700
add esp, 8
mov eax, dword [ebp - 0x40]
test eax, eax
je 0x405ee6
push 0
push 0
push eax
call dword [sym.imp.KERNEL32.dll_HeapValidate]
test eax, eax
jne 0x405ee6
push 0x421934
call dword [sym.imp.KERNEL32.dll_OutputDebugStringA]
mov ebx, 1
push ebx
lea ecx, [ebp - 0x28]
push ecx
call dword [sym.imp.KERNEL32.dll_GetConsoleProcessList]
mov dword [ebp - 0x28], eax
test eax, eax
jne 0x405f9b
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x4218fc
jmp 0x40604b
mov ecx, eax
movzx eax, word [eax]
xor edi, edi
test ax, ax
je 0x405e7e
cmp ax, 0x3d
je 0x405f29
inc edi
mov eax, ecx
lea esi, [eax + 2]
mov edi, edi
mov dx, word [eax]
add eax, 2
test dx, dx
jne 0x405f30
sub eax, esi
sar eax, 1
lea ecx, [ecx + eax*2 + 2]
movzx eax, word [ecx]
test ax, ax
jne 0x405f22
test edi, edi
je 0x405e7e
lea eax, [edi*4 + 4]
call fcn.00406060
mov ecx, dword [ebp - 0x20]
mov edi, esp
xor ebx, ebx
cmp word [ecx], 0x3d
je 0x405f70
mov dword [edi + ebx*4], ecx
inc ebx
mov eax, ecx
lea esi, [eax + 2]
mov dx, word [eax]
add eax, 2
test dx, dx
jne 0x405f75
sub eax, esi
sar eax, 1
cmp word [ecx + eax*2 + 2], dx
lea ecx, [ecx + eax*2 + 2]
jne 0x405f66
mov dword [edi + ebx*4], 0
jmp 0x405e81
cmp eax, ebx
jne 0x406053
push 0xfffffffffffffff6
call dword [sym.imp.KERNEL32.dll_GetStdHandle]
mov esi, eax
push esi
call dword [sym.imp.KERNEL32.dll_FlushConsoleInputBuffer]
test eax, eax
jne 0x405fc9
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x4218c4
jmp 0x40604b
call dword [sym.imp.KERNEL32.dll_GetConsoleWindow]
mov dword [ebp - 0x50], eax
test eax, eax
jne 0x405fe4
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x421890
jmp 0x40604b
push eax
call dword [sym.imp.USER32.dll_IsWindowVisible]
test eax, eax
je 0x406053
lea edx, [ebp - 0x54]
push edx
call dword [sym.imp.USER32.dll_FlashWindowEx]
push 0x12c
push 0x2ee
call dword [sym.imp.KERNEL32.dll_Beep]
test eax, eax
jne 0x406021
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x421868
call fcn.00405700
add esp, 8
mov edi, dword [sym.imp.KERNEL32.dll_ReadConsoleInputW]
lea eax, [ebp - 0x28]
push eax
push ebx
lea ecx, [ebp - 0x18]
push ecx
push esi
call edi
test eax, eax
je 0x40603f
cmp word [ebp - 0x18], bx
jne 0x406027
jmp 0x406053
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x421834
call fcn.00405700
add esp, 8
mov edx, dword [ebp - 0x24]
push edx
call dword [sym.imp.KERNEL32.dll_ExitProcess]