Function at 0x10012e6
Capabilities:
Check if file exists
Create process on windows
Get common file path
Get file attributes
Query environment variable
Set current directory
Terminate process
Write and execute a file
Write file on windows

Disassembly:
mov edi, edi
push ebp
mov ebp, esp
sub esp, 0x88
push ebx
xor ebx, ebx
push esi
push edi
mov dword [0x10028a0], 0x100200c
mov dword [0x10028a4], 0x1002000
mov dword [0x10028a8], 0x1002018
mov dword [ebp - 0x1c], ebx
mov dword [ebp - 0x20], ebx
mov dword [ebp - 0xc], ebx
mov eax, dword fs:[0x18]
add eax, 0xbf8
cmp dword [ebp + 8], 1
mov dword [ebp - 0x24], eax
jle 0x100140c
dec dword [ebp + 8]
je 0x100140c
mov esi, dword [ebp + 0xc]
add esi, 4
cmp dword [ebp - 0x1c], ebx
mov edi, dword [esi]
jne 0x10013b4
mov al, byte [edi]
cmp al, 0x2f
je 0x1001387
cmp al, 0x2d
je 0x1001387
mov eax, edi
mov dword [ebp - 0x1c], edi
lea edx, [eax + 1]
mov cl, byte [eax]
inc eax
test cl, cl
jne 0x100135d
sub eax, edx
mov ebx, eax
cmp ebx, 0x7fffffff
ja 0x1001381
push ebx
push edi
push 0x105
push 0x10028c0
call fcn.010011ab
inc ebx
mov dword [ebp - 0xc], ebx
jmp 0x10013f8
inc edi
mov al, byte [edi]
cmp al, 0x3f
je 0x100140c
cmp al, 0x44
je 0x1001396
cmp al, 0x64
jne 0x100140c
inc edi
cmp byte [edi], 0
je 0x10013a1
mov dword [ebp - 0x20], edi
jmp 0x10013fa
dec dword [ebp + 8]
cmp dword [ebp + 8], 1
jle 0x100140c
add esi, 4
mov eax, dword [esi]
mov dword [ebp - 0x20], eax
jmp 0x10013fa
mov eax, edi
lea edx, [eax + 1]
mov cl, byte [eax]
inc eax
test cl, cl
jne 0x10013b9
sub eax, edx
cmp dword [ebp - 0xc], 0
mov ebx, eax
je 0x10013de
push 0x10010d8
push 0x105
push 0x10028c0
call fcn.010012ae
push edi
push 0x105
push 0x10028c0
call fcn.010012ae
mov eax, dword [ebp - 0xc]
lea eax, [eax + ebx + 1]
mov dword [ebp - 0xc], eax
xor ebx, ebx
dec dword [ebp + 8]
jne 0x1001341
cmp dword [ebp - 0x1c], ebx
jne 0x1001493
push 0x14
mov word [ebp - 8], bx
mov word [ebp - 6], 0x200
mov dword [ebp - 4], 0x10024a0
mov word [ebp - 0x14], bx
mov dword [ebp - 0x10], 0x10026a0
mov word [ebp - 0x12], 0x200
pop edi
push 0x100
push dword [ebp - 0x10]
push edi
push ebx
call dword [sym.imp.USER32.dll_LoadStringW]
shl eax, 1
mov word [ebp - 0x14], ax
push ebx
lea eax, [ebp - 0x14]
push eax
lea eax, [ebp - 8]
push eax
call dword [sym.imp.ntdll.dll_RtlUnicodeStringToOemString]
test eax, eax
jl 0x1001489
push ebx
lea eax, [ebp - 0x18]
push eax
movzx eax, word [ebp - 8]
push eax
push dword [ebp - 4]
push 0xfffffffffffffff5
call dword [sym.imp.KERNEL32.dll_GetStdHandle]
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x1001489
movzx eax, word [ebp - 8]
cmp dword [ebp - 0x18], eax
jne 0x1001489
inc edi
cmp edi, 0x18
jbe 0x1001431
push 0xff
jmp 0x1001677
cmp dword [ebp - 0x20], ebx
mov edi, dword [sym.imp.ntdll.dll_RtlInitString]
mov ebx, dword [sym.imp.ntdll.dll_RtlOemStringToUnicodeString]
je 0x10014f5
push dword [ebp - 0x20]
lea eax, [ebp - 8]
push eax
call edi
and word [ebp - 0x14], 0
push 0
lea eax, [ebp - 8]
push eax
lea eax, [ebp - 0x14]
mov esi, 0x1002060
push eax
mov word [ebp - 0x12], 0x20a
mov dword [ebp - 0x10], esi
call ebx
test eax, eax
jge 0x10014dc
push 0xff
push 3
jmp 0x10015bf
push esi
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
cmp eax, 0xffffffff
je 0x10014d0
test al, 0x10
je 0x10014d0
push esi
call dword [sym.imp.KERNEL32.dll_SetCurrentDirectoryW]
jmp 0x1001505
push 0x1002060
push 0x105
call dword [sym.imp.KERNEL32.dll_GetCurrentDirectoryW]
push dword [ebp - 0x1c]
mov esi, 0x10029e0
push 0x105
push esi
call fcn.01001169
push 0x103
push 0x1002284
push 0x10010cc
mov word [0x1002280], 0x2e
mov word [0x1002282], 0x3b
call dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableW]
push esi
lea eax, [ebp - 8]
push eax
call edi
mov esi, dword [ebp - 0x24]
push 0
lea eax, [ebp - 8]
push eax
push esi
call ebx
test eax, eax
jge 0x100155f
push 0xff
push 1
jmp 0x10015bf
and dword [ebp + 8], 0
push 0x2e
push dword [esi + 4]
call dword [sym.imp.ntdll.dll_wcschr]
neg eax
sbb eax, eax
and eax, 0xfffffffe
pop ecx
add eax, 3
pop ecx
mov dword [ebp - 0x18], eax
je 0x10015b8
mov esi, 0x1002b00
lea eax, [ebp - 0x2c]
push eax
mov eax, dword [ebp + 8]
push esi
push 0x105
push dword [eax*4 + 0x10028a0]
mov eax, dword [ebp - 0x24]
push dword [eax + 4]
push 0x1002280
call dword [sym.imp.KERNEL32.dll_SearchPathW]
test eax, eax
jne 0x10015c4
inc dword [ebp + 8]
mov eax, dword [ebp + 8]
cmp eax, dword [ebp - 0x18]
jb 0x1001584
push 0xff
push 0
call fcn.01001234
push esi
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
cmp eax, 0xffffffff
je 0x10015b8
test al, 0x10
jne 0x10015b8
movzx eax, word [ebp - 8]
add eax, dword [ebp - 0xc]
cmp eax, 0x7d
jbe 0x10015e9
push 0xff
push 2
jmp 0x10015bf
push 0x10028c0
lea eax, [ebp - 0x34]
push eax
call edi
push 0
lea eax, [ebp - 0x34]
push eax
push dword [ebp - 0x24]
call ebx
test eax, eax
jl 0x10015e0
push 0x11
pop ecx
xor eax, eax
lea edi, [ebp - 0x88]
rep stosd dword es:[edi], eax
lea eax, [ebp - 0x44]
push eax
lea eax, [ebp - 0x88]
push eax
push 0x1002060
xor eax, eax
push eax
push 0x2000
push 1
push eax
push eax
mov eax, dword [ebp - 0x24]
mov dword [ebp - 0x88], 0x44
push dword [eax + 4]
push esi
call dword [sym.imp.KERNEL32.dll_CreateProcessW]
test eax, eax
jne 0x1001653
push 0xff
push 8
jmp 0x10015bf
push 0xffffffffffffffff
push dword [ebp - 0x44]
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
lea eax, [ebp - 0x28]
push eax
push dword [ebp - 0x44]
call dword [sym.imp.KERNEL32.dll_GetExitCodeProcess]
push dword [ebp - 0x44]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push dword [ebp - 0x28]
call dword [sym.imp.KERNEL32.dll_ExitProcess]