Function at 0x401870
Capabilities:
Create pipe
Create process on windows
Read file on windows
Resolve function by parsing pe exports
Set current directory

Disassembly:
push ebp
push edi
push esi
mov esi, edx
push ebx
sub esp, 0x8cc
mov dword [esp + 0x3c], ecx
mov ecx, dword [esp + 0x8e0]
lea ebp, [esp + 0x5c]
mov edx, dword [sym.imp.libssp_0.dll___stack_chk_guard]
mov dword [esp + 0x8bc], edx
xor edx, edx
mov dword [esp + 0x38], eax
mov ebx, dword [esp + 0x8e8]
mov dword [esp + 0x60], 0
mov dword [esp + 0x64], 0
mov dword [esp + 0x5c], 0xc
test ecx, ecx
jne 0x401a70
lea eax, [esp + 0x50]
mov dword [esp + 0x64], 1
mov dword [esp + 4], eax
lea eax, [esp + 0x4c]
mov dword [esp + 0xc], 1
mov dword [esp + 8], ebp
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_CreatePipe]
mov ecx, 0x10
sub esp, 0x10
mov eax, dword [esp + 0x8e0]
lea edx, [esp + 0x7c]
mov dword [esp + 0x78], 0x44
mov edi, edx
mov edx, dword [esp + 0x8e4]
rep stosd dword es:[edi], eax
mov eax, dword [esp + 0x50]
mov dword [esp + 0xa4], 0x100
mov dword [esp + 0xb4], eax
test edx, edx
jne 0x401b58
mov dword [esp + 4], esi
lea edi, [esp + 0x68]
mov dword [esp], str.Attempting_to_load_the_program:__s
call sym.unk_10
mov eax, dword [esp + 0x38]
mov ecx, 0xffffffff
mov edx, 0x40a056
mov dword [esp + 0x68], 0
mov dword [esp + 0x6c], 0
mov dword [esp + 0x70], 0
mov dword [esp + 0x74], 0
call sym._output
lea eax, [esp + 0x78]
mov dword [esp + 0x24], edi
mov dword [esp + 0x20], eax
mov eax, dword [esp + 0x3c]
mov dword [esp + 0x1c], 0
mov dword [esp + 0x18], eax
mov eax, dword [esp + 0x64]
mov dword [esp + 0x14], 0x8000000
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], ebp
mov dword [esp + 8], 0
mov dword [esp + 4], esi
mov dword [esp], 0
call dword [sym.imp.KERNEL32.dll_CreateProcessA]
sub esp, 0x28
test eax, eax
je 0x401bfa
mov dword [esp], str.Successfully_created_the_process_
call sym.unk_10
mov eax, dword [esp + 0x50]
mov dword [esp], eax
mov eax, dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [esp + 0x3c], eax
call eax
sub esp, 4
mov dword [esp], str.Attempting_to_read_from_the_pipe
lea ebp, [esp + 0x54]
lea esi, [esp + 0xbc]
call sym.unk_10
mov edi, dword [sym.imp.KERNEL32.dll_ReadFile]
jmp 0x401a19
cmp byte [ebx], 0
je 0x401c60
mov eax, dword [esp + 0x4c]
mov dword [esp + 0x10], 0
mov dword [esp + 0xc], ebp
mov dword [esp + 8], 0x3ff
mov dword [esp + 4], esi
mov dword [esp], eax
call edi
sub esp, 0x14
test eax, eax
jne 0x401a10
mov eax, dword [esp + 0x4c]
mov dword [esp], eax
mov eax, dword [esp + 0x3c]
call eax
sub esp, 4
cmp byte [ebx], 0
jne 0x401c78
mov dword [esp], str.Done_
call sym.unk_10
jmp 0x401b35
lea edx, [esp + 0x7c]
xor eax, eax
lea ebx, [esp + 0x78]
mov ecx, 0x10
mov edi, edx
mov dword [esp + 0x78], 0x44
rep stosd dword es:[edi], eax
mov dword [esp + 4], esi
lea edi, [esp + 0x68]
mov dword [esp], str.Attempting_to_load_the_program:__s
call sym.unk_10
mov eax, dword [esp + 0x38]
mov ecx, 0xffffffff
mov edx, 0x40a056
mov dword [esp + 0x68], 0
mov dword [esp + 0x6c], 0
mov dword [esp + 0x70], 0
mov dword [esp + 0x74], 0
call sym._output
mov eax, dword [esp + 0x3c]
mov dword [esp + 0x24], edi
mov dword [esp + 0x20], ebx
mov dword [esp + 0x18], eax
mov eax, dword [esp + 0x64]
mov dword [esp + 0x1c], 0
mov dword [esp + 0x14], 0x8000000
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], ebp
mov dword [esp + 8], 0
mov dword [esp + 4], esi
mov dword [esp], 0
call dword [sym.imp.KERNEL32.dll_CreateProcessA]
sub esp, 0x28
test eax, eax
jne 0x401c30
mov eax, dword [esp + 0x38]
mov ecx, 0xffffffff
mov edx, str.Failed_to_create_the_process
call sym._output
mov eax, dword [esp + 0x8bc]
sub eax, dword [sym.imp.libssp_0.dll___stack_chk_guard]
jne 0x401d48
add esp, 0x8cc
pop ebx
pop esi
pop edi
pop ebp
ret
mov dword [esp + 4], esi
lea edi, [esp + 0x68]
mov dword [esp], str.Attempting_to_load_the_program:__s
mov dword [esp + 0xb8], eax
call sym.unk_10
mov eax, dword [esp + 0x38]
mov ecx, 0xffffffff
mov edx, 0x40a056
mov dword [esp + 0x68], 0
mov dword [esp + 0x6c], 0
mov dword [esp + 0x70], 0
mov dword [esp + 0x74], 0
call sym._output
mov eax, dword [esp + 0x3c]
lea edx, [esp + 0x78]
mov dword [esp + 0x24], edi
mov dword [esp + 0x20], edx
mov dword [esp + 0x18], eax
mov eax, dword [esp + 0x64]
mov dword [esp + 0x1c], 0
mov dword [esp + 0x14], 0x8000000
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], ebp
mov dword [esp + 8], 0
mov dword [esp + 4], esi
mov dword [esp], 0
call dword [sym.imp.KERNEL32.dll_CreateProcessA]
sub esp, 0x28
test eax, eax
jne 0x4019cd
mov eax, dword [esp + 0x38]
mov ecx, 0xffffffff
mov edx, str.Failed_to_create_the_process
call sym._output
mov eax, dword [esp + 0x50]
mov ebx, dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [esp], eax
call ebx
sub esp, 4
mov eax, dword [esp + 0x4c]
mov dword [esp], eax
call ebx
sub esp, 4
jmp 0x401b35
mov dword [esp], str.Successfully_created_the_process_
call sym.unk_10
mov eax, dword [esp + 0x38]
mov ecx, 0xffffffff
mov edx, str.Process_has_been_created
call sym._output
mov dword [esp], str.Done_
call sym.unk_10
jmp 0x401b35
mov ecx, dword [esp + 0x54]
mov eax, dword [esp + 0x38]
mov edx, esi
call sym._output
jmp 0x401a19
mov dword [esp + 4], ebx
mov dword [esp], str.Trying_to_open_output_file:__s
call sym.unk_10
lea eax, [esp + 0x58]
mov dword [esp + 4], ebx
mov dword [esp + 8], 0x40a0bb
mov dword [esp], eax
call dword [sym.imp.msvcrt.dll_fopen_s]
test eax, eax
jne 0x401d20
mov eax, dword [esp + 0x58]
lea ebx, [esp + 0x4bc]
mov dword [esp + 8], 0x400
mov dword [esp + 4], 1
mov dword [esp + 0xc], eax
mov dword [esp], ebx
call sub.msvcrt.dll_fread
mov ecx, eax
test eax, eax
je 0x401d0f
mov esi, dword [esp + 0x38]
lea esi, [esi]
lea esi, [esi]
mov edx, ebx
mov eax, esi
call sym._output
mov eax, dword [esp + 0x58]
mov dword [esp + 8], 0x400
mov dword [esp + 4], 1
mov dword [esp + 0xc], eax
mov dword [esp], ebx
call sub.msvcrt.dll_fread
mov ecx, eax
test eax, eax
jne 0x401ce0
mov eax, dword [esp + 0x58]
mov dword [esp], eax
call sym._fclose
jmp 0x401a5a
mov dword [esp + 4], eax
mov dword [esp], str.Couldnt_open_the_readfile:__d
call sym.unk_10
mov eax, dword [esp + 0x38]
mov ecx, 0xffffffff
mov edx, str.Couldnt_open_the_output_file
call sym._output
jmp 0x401a5a
call sym.unk_115
lea esi, [esi]