Function at 0x405a70
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 0x405ae0
call edi
push eax
push 0x421ad4
jmp 0x405af7
push esi
push esi
push 1
push eax
call dword [sym.imp.KERNEL32.dll_HeapSetInformation]
test eax, eax
jne 0x405b00
call edi
push eax
push 0x421aa0
call fcn.004056e0
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 0x405b4d
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea ecx, [esi + str.INPUT]
push ecx
push 0x421a64
mov dword [esi + 0x422064], eax
call fcn.004056e0
add esp, 0xc
jmp 0x405c91
test edi, edi
jne 0x405b62
lea edx, [esi + str.INPUT]
push edx
push 0x421a2c
jmp 0x405c89
cmp dword [ebp - 0x1c], 0
jne 0x405bd1
lea eax, [ebp - 0x58]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_GetConsoleMode]
test eax, eax
je 0x405b86
mov dword [0x422068], 3
jmp 0x405c91
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x4219fc
call fcn.004056e0
add esp, 8
push edi
call dword [sym.imp.KERNEL32.dll_GetFileType]
cmp eax, 2
jne 0x405bb0
mov dword [0x422068], eax
jmp 0x405c91
test eax, eax
jne 0x405c91
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
je 0x405c91
push eax
push 0x4219d0
jmp 0x405c89
push edi
call dword [sym.imp.KERNEL32.dll_FlushFileBuffers]
test eax, eax
je 0x405c5b
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 0x405c1b
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x42199c
jmp 0x405c89
mov eax, dword [ebp - 0x34]
or eax, dword [ebp - 0x30]
jne 0x405c91
push eax
lea ecx, [ebp - 0x3c]
push ecx
push 2
push 0x421998
push edi
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x405c48
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x4216f8
jmp 0x405c89
cmp dword [ebp - 0x3c], 2
je 0x405c91
push 0x421958
call dword [sym.imp.KERNEL32.dll_OutputDebugStringA]
jmp 0x405c91
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 1
jne 0x405c72
mov dword [esi + 0x422068], 0
jmp 0x405c91
cmp eax, 6
jne 0x405c83
mov dword [esi + 0x422068], 3
jmp 0x405c91
push eax
push 0x421924
call fcn.004056e0
add esp, 8
mov esi, 1
sub dword [ebp - 0x1c], esi
jns 0x405b00
mov edi, ebx
cmp word [edi], 0
je 0x405d11
mov ecx, dword [ebp - 0x24]
mov edx, dword [ebp - 0x20]
lea ecx, [ecx]
test edx, edx
jne 0x405cdc
movzx eax, word [ebx]
cmp eax, 0x20
je 0x405cc1
cmp eax, 9
jne 0x405cdc
xor ecx, ecx
movzx eax, word [ebx + 2]
add ebx, 2
cmp eax, 0x20
je 0x405cc3
cmp eax, 9
je 0x405cc3
cmp word [ebx], cx
je 0x405d11
inc esi
jmp 0x405cfc
movzx eax, word [ebx]
cmp eax, 0x5c
jne 0x405ce9
xor ecx, 1
jmp 0x405cf9
test ecx, ecx
jne 0x405cf7
cmp eax, 0x22
jne 0x405cf7
xor edx, 1
jmp 0x405cf9
xor ecx, ecx
add ebx, 2
cmp word [ebx], 0
jne 0x405cb0
test edx, edx
je 0x405d11
push 0x4218f0
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.00406030
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 0x405d32
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 0x405e1a
jmp 0x405d60
cmp dword [ebp - 0x20], 0
jne 0x405da5
cmp si, 0x20
je 0x405d72
cmp si, 9
jne 0x405da5
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 0x405d80
cmp edx, 9
je 0x405d80
cmp word [eax], bx
je 0x405e1a
mov edx, dword [ebp - 0x1c]
inc edi
mov ecx, eax
mov dword [edx + edi*4], eax
jmp 0x405e0e
cmp si, 0x5c
jne 0x405db6
mov edx, 0x5c
inc ebx
mov word [ecx], dx
jmp 0x405e08
cmp si, 0x22
jne 0x405e03
lea edx, [ebx + 1]
shr edx, 1
neg edx
add eax, 2
lea ecx, [ecx + edx*2]
test bl, 1
je 0x405ddd
mov edx, 0x22
mov word [ecx], dx
add ecx, 2
xor ebx, ebx
jmp 0x405e0e
cmp dword [ebp - 0x20], 0
je 0x405dfb
cmp word [eax], 0x22
jne 0x405dfb
mov edx, 0x22
mov word [ecx], dx
add ecx, 2
add eax, 2
xor ebx, ebx
jmp 0x405e0e
xor dword [ebp - 0x20], 1
xor ebx, ebx
jmp 0x405e0e
xor ebx, ebx
mov word [ecx], si
add ecx, 2
add eax, 2
movzx esi, word [eax]
test si, si
jne 0x405d60
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 0x405ee2
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x4218b8
call fcn.004056e0
add esp, 8
mov edi, dword [ebp - 0x2c]
call fcn.00405660
mov edx, dword [ebp - 0x1c]
mov eax, dword [ebp - 0x24]
push edi
push edx
push eax
call fcn.0040191d
add esp, 0xc
mov dword [ebp - 0x24], eax
call fcn.00405660
mov eax, dword [ebp - 0x20]
test eax, eax
je 0x405e95
push eax
call dword [sym.imp.KERNEL32.dll_FreeEnvironmentStringsW]
test eax, eax
jne 0x405e95
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x421880
call fcn.004056e0
add esp, 8
mov eax, dword [ebp - 0x40]
test eax, eax
je 0x405eb6
push 0
push 0
push eax
call dword [sym.imp.KERNEL32.dll_HeapValidate]
test eax, eax
jne 0x405eb6
push 0x421854
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 0x405f6b
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x42181c
jmp 0x40601b
mov ecx, eax
movzx eax, word [eax]
xor edi, edi
test ax, ax
je 0x405e4e
cmp ax, 0x3d
je 0x405ef9
inc edi
mov eax, ecx
lea esi, [eax + 2]
mov edi, edi
mov dx, word [eax]
add eax, 2
test dx, dx
jne 0x405f00
sub eax, esi
sar eax, 1
lea ecx, [ecx + eax*2 + 2]
movzx eax, word [ecx]
test ax, ax
jne 0x405ef2
test edi, edi
je 0x405e4e
lea eax, [edi*4 + 4]
call fcn.00406030
mov ecx, dword [ebp - 0x20]
mov edi, esp
xor ebx, ebx
cmp word [ecx], 0x3d
je 0x405f40
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 0x405f45
sub eax, esi
sar eax, 1
cmp word [ecx + eax*2 + 2], dx
lea ecx, [ecx + eax*2 + 2]
jne 0x405f36
mov dword [edi + ebx*4], 0
jmp 0x405e51
cmp eax, ebx
jne 0x406023
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 0x405f99
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x4217e4
jmp 0x40601b
call dword [sym.imp.KERNEL32.dll_GetConsoleWindow]
mov dword [ebp - 0x50], eax
test eax, eax
jne 0x405fb4
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x4217b0
jmp 0x40601b
push eax
call dword [sym.imp.USER32.dll_IsWindowVisible]
test eax, eax
je 0x406023
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 0x405ff1
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x421788
call fcn.004056e0
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 0x40600f
cmp word [ebp - 0x18], bx
jne 0x405ff7
jmp 0x406023
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x421754
call fcn.004056e0
add esp, 8
mov edx, dword [ebp - 0x24]
push edx
call dword [sym.imp.KERNEL32.dll_ExitProcess]