Function at 0x40c46b
Capabilities:
Write file on windows

Disassembly:
push ebp
push ebx
push edi
push esi
sub esp, 0x3c
mov ebp, dword [esp + 0x54]
mov esi, ecx
test ebp, ebp
je 0x40c49a
push edx
call dword [sym.imp.KERNEL32.dll_GetStdHandle]
cmp eax, 0xffffffff
je 0x40c4a9
mov edi, eax
test eax, eax
jne 0x40c4cb
mov eax, edi
push 6
pop edi
mov dword [esi + 4], edi
mov dword [esi], eax
jmp 0x40c4a1
and dword [esi + 4], 0
mov byte [esi], 4
add esp, 0x3c
pop esi
pop edi
pop ebx
pop ebp
ret
lea edi, [esp + 0x14]
mov ecx, edi
call fcn.0040c38d
cmp byte [edi], 4
jne 0x40c4bf
mov edi, dword [esp + 0x18]
jmp 0x40c4cb
mov eax, dword [esp + 0x14]
mov edi, dword [esp + 0x18]
cmp al, 4
jne 0x40c493
lea eax, [esp + 0x14]
mov ebx, dword [esp + 0x50]
and dword [eax], 0
push eax
push edi
call dword [sym.imp.KERNEL32.dll_GetConsoleMode]
test eax, eax
je 0x40c58e
mov eax, dword [esp + 0x58]
movzx eax, byte [eax + 4]
test eax, eax
je 0x40c5e2
cmp al, 4
jae 0x40c6bb
mov cl, byte [ebx]
mov edx, ecx
and dl, 0xc0
neg dl
jno 0x40c637
mov ebx, dword [esp + 0x58]
mov byte [ebx + eax], cl
mov al, byte [ebx + 4]
inc al
mov byte [ebx + 4], al
movzx ecx, byte [ebx]
movzx ecx, byte [ecx + 0x40fe93]
cmp cl, al
ja 0x40c6ab
movzx eax, al
mov dword [esp + 0x10], ecx
cmp al, 5
jae 0x40c6bb
lea ebp, [esp + 0x14]
mov edx, ebx
mov ecx, ebp
push eax
call fcn.0040a191
pop eax
test byte [ebp], 1
mov byte [ebx + 4], 0
jne 0x40c63f
mov eax, dword [esp + 0x10]
cmp dword [esp + 0x1c], eax
jne 0x40c6bb
lea ebx, [esp + 4]
mov edx, edi
mov ecx, ebx
push eax
push dword [esp + 0x1c]
call fcn.0040c70a
pop eax
pop ecx
cmp byte [ebx], 4
jne 0x40c698
mov eax, dword [esp + 8]
jmp 0x40c6a5
lea eax, [esp + 0x2c]
mov ecx, 0x103
and dword [eax + 4], 0
mov dword [eax], ecx
push 0
push 0
push ebp
push ebx
push eax
push 0
push 0
push 0
push edi
call dword [sym.imp.ntdll.dll_NtWriteFile]
mov ecx, 0x103
cmp eax, ecx
jne 0x40c5d2
push 0xffffffffffffffff
push edi
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
mov eax, dword [esp + 0x2c]
cmp eax, 0x103
je 0x40c6bd
test eax, eax
js 0x40c651
mov eax, dword [esp + 0x30]
mov dword [esi + 4], eax
jmp 0x40c49e
mov eax, 0x1000
lea ecx, [esp + 4]
mov edx, ebx
cmp ebp, eax
cmovb eax, ebp
push eax
call fcn.0040a191
pop eax
lea eax, [esp + 4]
test byte [eax], 1
je 0x40c663
cmp dword [esp + 8], 0
je 0x40c67e
mov eax, dword [esp + 8]
cmp eax, ebp
ja 0x40c6bb
mov edx, ebx
lea ebx, [esp + 0x14]
mov ecx, ebx
push eax
call fcn.0040a191
pop eax
cmp dword [ebx], 1
je 0x40c6bb
mov eax, dword [esp + 0x18]
mov ebx, dword [esp + 0x1c]
jmp 0x40c66b
mov eax, dword [esp + 0x58]
mov byte [eax + 4], 0
mov dword [esi + 4], str.Windows_stdio_in_console_mode_does_not_support_writing_non_UTF_8_byte_sequences
mov dword [esi], 2
jmp 0x40c4a1
push eax
call dword [sym.imp.ntdll.dll_RtlNtStatusToDosError]
and dword [esi], 0
mov dword [esi + 4], eax
jmp 0x40c4a1
mov eax, dword [esp + 8]
mov ebx, dword [esp + 0xc]
mov ecx, esi
mov edx, edi
push ebx
push eax
call fcn.0040c70a
add esp, 0x44
jmp 0x40c4a4
movzx eax, byte [ebx]
movzx ecx, byte [eax + 0x40fe93]
cmp ecx, ebp
jbe 0x40c63f
mov ecx, dword [esp + 0x58]
mov byte [ecx], al
mov byte [ecx + 4], 1
jmp 0x40c6ab
mov ecx, dword [esp + 4]
mov eax, dword [esp + 8]
cmp cl, 4
jne 0x40c6b7
cmp eax, dword [esp + 0x10]
jne 0x40c6bb
mov dword [esi + 4], 1
jmp 0x40c49e
mov dword [esi], ecx
jmp 0x40c65b
ud2
lea edx, [esp + 0x34]
mov eax, esp
mov dword [esp + 0x14], 0x410080
mov dword [esp + 0x18], 1
and dword [esp + 0x24], 0
lea esi, [esp + 4]
mov dword [esp + 0x1c], eax
and dword [edx], 0
and dword [esp + 0x20], 0
lea eax, [esp + 0x14]
mov byte [edx + 4], 0
mov ecx, esi
push eax
call fcn.0040c8c8
pop eax
mov ecx, dword [esi]
mov edx, dword [esi + 4]
call fcn.0040c45c
push 7
pop ecx
int 0x29
ud2