Function at 0x404ef0
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 0x404f60
call edi
push eax
push 0x414b1c
jmp 0x404f77
push esi
push esi
push 1
push eax
call dword [sym.imp.KERNEL32.dll_HeapSetInformation]
test eax, eax
jne 0x404f80
call edi
push eax
push 0x414ae8
call fcn.00404b20
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 + 0x406064]
add esi, esi
push eax
call dword [sym.imp.KERNEL32.dll_GetStdHandle]
mov edi, eax
mov dword [esi + 0x406058], edi
cmp edi, 0xffffffff
jne 0x404fcd
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea ecx, [esi + str.INPUT]
push ecx
push 0x414aac
mov dword [esi + 0x406064], eax
call fcn.00404b20
add esp, 0xc
jmp 0x405111
test edi, edi
jne 0x404fe2
lea edx, [esi + str.INPUT]
push edx
push 0x414a74
jmp 0x405109
cmp dword [ebp - 0x1c], 0
jne 0x405051
lea eax, [ebp - 0x58]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_GetConsoleMode]
test eax, eax
je 0x405006
mov dword [0x406068], 3
jmp 0x405111
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x414a44
call fcn.00404b20
add esp, 8
push edi
call dword [sym.imp.KERNEL32.dll_GetFileType]
cmp eax, 2
jne 0x405030
mov dword [0x406068], eax
jmp 0x405111
test eax, eax
jne 0x405111
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
je 0x405111
push eax
push 0x414a18
jmp 0x405109
push edi
call dword [sym.imp.KERNEL32.dll_FlushFileBuffers]
test eax, eax
je 0x4050db
push 1
lea edx, [ebp - 0x34]
push edx
xor ecx, ecx
xor eax, eax
push ecx
push eax
push edi
mov dword [esi + 0x406068], 1
mov dword [esi + 0x40606c], 2
mov dword [ebp - 0x34], eax
mov dword [ebp - 0x30], ecx
call dword [sym.imp.KERNEL32.dll_SetFilePointerEx]
test eax, eax
jne 0x40509b
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x4149e4
jmp 0x405109
mov eax, dword [ebp - 0x34]
or eax, dword [ebp - 0x30]
jne 0x405111
push eax
lea ecx, [ebp - 0x3c]
push ecx
push 2
push 0x4149e0
push edi
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x4050c8
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x414740
jmp 0x405109
cmp dword [ebp - 0x3c], 2
je 0x405111
push 0x4149a0
call dword [sym.imp.KERNEL32.dll_OutputDebugStringA]
jmp 0x405111
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 1
jne 0x4050f2
mov dword [esi + 0x406068], 0
jmp 0x405111
cmp eax, 6
jne 0x405103
mov dword [esi + 0x406068], 3
jmp 0x405111
push eax
push 0x41496c
call fcn.00404b20
add esp, 8
mov esi, 1
sub dword [ebp - 0x1c], esi
jns 0x404f80
mov edi, ebx
cmp word [edi], 0
je 0x405191
mov ecx, dword [ebp - 0x24]
mov edx, dword [ebp - 0x20]
lea ecx, [ecx]
test edx, edx
jne 0x40515c
movzx eax, word [ebx]
cmp eax, 0x20
je 0x405141
cmp eax, 9
jne 0x40515c
xor ecx, ecx
movzx eax, word [ebx + 2]
add ebx, 2
cmp eax, 0x20
je 0x405143
cmp eax, 9
je 0x405143
cmp word [ebx], cx
je 0x405191
inc esi
jmp 0x40517c
movzx eax, word [ebx]
cmp eax, 0x5c
jne 0x405169
xor ecx, 1
jmp 0x405179
test ecx, ecx
jne 0x405177
cmp eax, 0x22
jne 0x405177
xor edx, 1
jmp 0x405179
xor ecx, ecx
add ebx, 2
cmp word [ebx], 0
jne 0x405130
test edx, edx
je 0x405191
push 0x414938
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.004054b0
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 0x4051b2
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 0x40529a
jmp 0x4051e0
cmp dword [ebp - 0x20], 0
jne 0x405225
cmp si, 0x20
je 0x4051f2
cmp si, 9
jne 0x405225
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 0x405200
cmp edx, 9
je 0x405200
cmp word [eax], bx
je 0x40529a
mov edx, dword [ebp - 0x1c]
inc edi
mov ecx, eax
mov dword [edx + edi*4], eax
jmp 0x40528e
cmp si, 0x5c
jne 0x405236
mov edx, 0x5c
inc ebx
mov word [ecx], dx
jmp 0x405288
cmp si, 0x22
jne 0x405283
lea edx, [ebx + 1]
shr edx, 1
neg edx
add eax, 2
lea ecx, [ecx + edx*2]
test bl, 1
je 0x40525d
mov edx, 0x22
mov word [ecx], dx
add ecx, 2
xor ebx, ebx
jmp 0x40528e
cmp dword [ebp - 0x20], 0
je 0x40527b
cmp word [eax], 0x22
jne 0x40527b
mov edx, 0x22
mov word [ecx], dx
add ecx, 2
add eax, 2
xor ebx, ebx
jmp 0x40528e
xor dword [ebp - 0x20], 1
xor ebx, ebx
jmp 0x40528e
xor ebx, ebx
mov word [ecx], si
add ecx, 2
add eax, 2
movzx esi, word [eax]
test si, si
jne 0x4051e0
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 0x405362
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x414900
call fcn.00404b20
add esp, 8
mov edi, dword [ebp - 0x2c]
call fcn.00404aa0
mov edx, dword [ebp - 0x1c]
mov eax, dword [ebp - 0x24]
push edi
push edx
push eax
call fcn.00404859
add esp, 0xc
mov dword [ebp - 0x24], eax
call fcn.00404aa0
mov eax, dword [ebp - 0x20]
test eax, eax
je 0x405315
push eax
call dword [sym.imp.KERNEL32.dll_FreeEnvironmentStringsW]
test eax, eax
jne 0x405315
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x4148c8
call fcn.00404b20
add esp, 8
mov eax, dword [ebp - 0x40]
test eax, eax
je 0x405336
push 0
push 0
push eax
call dword [sym.imp.KERNEL32.dll_HeapValidate]
test eax, eax
jne 0x405336
push 0x41489c
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 0x4053eb
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x414864
jmp 0x40549b
mov ecx, eax
movzx eax, word [eax]
xor edi, edi
test ax, ax
je 0x4052ce
cmp ax, 0x3d
je 0x405379
inc edi
mov eax, ecx
lea esi, [eax + 2]
mov edi, edi
mov dx, word [eax]
add eax, 2
test dx, dx
jne 0x405380
sub eax, esi
sar eax, 1
lea ecx, [ecx + eax*2 + 2]
movzx eax, word [ecx]
test ax, ax
jne 0x405372
test edi, edi
je 0x4052ce
lea eax, [edi*4 + 4]
call fcn.004054b0
mov ecx, dword [ebp - 0x20]
mov edi, esp
xor ebx, ebx
cmp word [ecx], 0x3d
je 0x4053c0
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 0x4053c5
sub eax, esi
sar eax, 1
cmp word [ecx + eax*2 + 2], dx
lea ecx, [ecx + eax*2 + 2]
jne 0x4053b6
mov dword [edi + ebx*4], 0
jmp 0x4052d1
cmp eax, ebx
jne 0x4054a3
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 0x405419
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x41482c
jmp 0x40549b
call dword [sym.imp.KERNEL32.dll_GetConsoleWindow]
mov dword [ebp - 0x50], eax
test eax, eax
jne 0x405434
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x4147f8
jmp 0x40549b
push eax
call dword [sym.imp.USER32.dll_IsWindowVisible]
test eax, eax
je 0x4054a3
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 0x405471
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x4147d0
call fcn.00404b20
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 0x40548f
cmp word [ebp - 0x18], bx
jne 0x405477
jmp 0x4054a3
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x41479c
call fcn.00404b20
add esp, 8
mov edx, dword [ebp - 0x24]
push edx
call dword [sym.imp.KERNEL32.dll_ExitProcess]