Function at 0x501870
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push ebx
push edi
push esi
sub esp, 0x3c
mov edi, dword [ebp + 0xc]
mov esi, ecx
test edi, edi
je 0x501898
push edx
call sub.kernel32.dll_GetStdHandle
test eax, eax
je 0x5018a4
cmp eax, 0xffffffff
jne 0x5018b7
call sub.kernel32.dll_GetLastError
jmp 0x5018a9
mov dword [esi + 4], 0
mov byte [esi], 4
jmp 0x5018af
mov eax, 6
mov byte [esi], 0
mov dword [esi + 4], eax
add esp, 0x3c
pop esi
pop edi
pop ebx
pop ebp
ret
mov dword [ebp - 0x28], 0
lea ecx, [ebp - 0x28]
push ecx
mov dword [ebp - 0x10], eax
push eax
call sub.kernel32.dll_GetConsoleMode
test eax, eax
je 0x501922
mov ebx, dword [ebp + 0x10]
movzx eax, byte [ebx + 4]
test eax, eax
je 0x501942
cmp al, 4
jae 0x501a8f
mov ecx, dword [ebp + 8]
movzx ecx, byte [ecx]
mov edx, ecx
and dl, 0xc0
neg dl
jno 0x501999
mov byte [ebx + eax], cl
movzx ecx, byte [ebx + 4]
inc cl
mov byte [ebx + 4], cl
movzx eax, byte [ebx]
movzx eax, byte [eax + 0x5b2b04]
cmp cl, al
mov dword [ebp - 0x38], eax
jae 0x5019c6
mov dword [esi + 4], 1
mov byte [esi], 4
jmp 0x5018af
mov edx, dword [ebp - 0x10]
lea ecx, [ebp - 0x28]
push edi
push dword [ebp + 8]
call sym.std::sys::pal::windows::handle::Handle::synchronous_write::h162a8adb1385b5a7
add esp, 8
movsd xmm0, qword [ebp - 0x28]
movsd qword [esi], xmm0
jmp 0x5018af
cmp edi, 0x1000
mov eax, 0x1000
cmovb eax, edi
mov edx, dword [ebp + 8]
lea ecx, [ebp - 0x34]
push eax
call sym.core::str::converts::from_utf8::h614587554aa91dbb
add esp, 4
test byte [ebp - 0x34], 1
je 0x5019ac
mov eax, dword [ebp - 0x30]
test eax, eax
je 0x501a42
cmp eax, edi
ja 0x501ad0
mov edx, dword [ebp + 8]
lea ecx, [ebp - 0x28]
push eax
call sym.core::str::converts::from_utf8::h614587554aa91dbb
add esp, 4
cmp dword [ebp - 0x28], 1
je 0x501ade
mov eax, dword [ebp - 0x24]
mov edi, dword [ebp - 0x20]
jmp 0x5019b2
mov byte [ebx + 4], 0
mov byte [esi], 2
mov dword [esi + 4], 0x5b2c54
jmp 0x5018af
mov eax, dword [ebp - 0x30]
mov edi, dword [ebp - 0x2c]
mov edx, dword [ebp - 0x10]
mov ecx, esi
push edi
push eax
call sym.std::sys::pal::windows::stdio::write_valid_utf8_to_console::h689fd6e0ca9f50b5
add esp, 8
jmp 0x5018af
mov edi, eax
movzx eax, cl
cmp cl, 5
jae 0x501abf
lea ecx, [ebp - 0x34]
mov edx, ebx
push eax
call sym.core::str::converts::from_utf8::h614587554aa91dbb
add esp, 4
test byte [ebp - 0x34], 1
mov byte [ebx + 4], 0
jne 0x50199d
mov ecx, dword [ebp - 0x2c]
mov eax, dword [ebp - 0x30]
cmp ecx, edi
mov dword [ebp - 0x3c], ecx
jne 0x501b05
mov ebx, edi
mov edx, dword [ebp - 0x10]
lea edi, [ebp - 0x28]
mov ecx, edi
push ebx
push eax
call sym.std::sys::pal::windows::stdio::write_valid_utf8_to_console::h689fd6e0ca9f50b5
add esp, 8
movzx eax, byte [ebp - 0x28]
cmp al, 4
jne 0x501a62
mov eax, dword [ebp - 0x24]
mov dword [ebp - 0x48], ebx
cmp eax, ebx
mov dword [ebp - 0x40], eax
je 0x501916
mov dword [ebp - 0x28], 0
lea ecx, [ebp - 0x40]
lea edx, [ebp - 0x48]
push 0x5b2cf4
push edi
call sym.core::panicking::assert_failed::ha93b9b84e0318e5d
mov eax, dword [ebp + 8]
movzx eax, byte [eax]
movzx ecx, byte [eax + 0x5b2b04]
cmp ecx, edi
jbe 0x501a7e
mov byte [ebx], al
mov byte [ebx + 4], 1
mov al, 4
mov ecx, 1
jmp 0x501a85
movzx ecx, byte [ebp - 0x25]
movzx edi, word [ebp - 0x27]
mov edx, dword [ebp - 0x24]
mov byte [esi + 3], cl
mov word [esi + 1], di
mov byte [esi], al
mov dword [esi + 4], edx
jmp 0x5018af
mov al, 2
mov ecx, 0x5b2c54
mov dword [esi + 4], ecx
mov byte [esi], al
jmp 0x5018af
mov dword [ebp - 0x28], 0x5b2cbc
mov dword [ebp - 0x24], 1
mov dword [ebp - 0x18], 0
mov dword [ebp - 0x20], 4
mov dword [ebp - 0x1c], 0
lea ecx, [ebp - 0x28]
mov edx, 0x5b2cc4
call sym.core::panicking::panic_fmt::hced28cb7137b21e1
mov ecx, eax
mov edx, 4
push 0x5b2cd4
call sym.core::slice::index::slice_end_index_len_fail::h31017dc9c470f2c8
mov ecx, eax
mov edx, edi
push 0x5b2c60
call sym.core::slice::index::slice_end_index_len_fail::h31017dc9c470f2c8
movsd xmm0, qword [ebp - 0x24]
movsd qword [ebp - 0x48], xmm0
lea eax, [ebp - 0x48]
mov ecx, str.called__Result::unwrap____on_an__Err__value
mov edx, 0x2b
push 0x5b2c70
push 0x5b09a0
push eax
call sym.core::result::unwrap_failed::h534a40e08cfe968a
mov dword [ebp - 0x28], 0
lea ecx, [ebp - 0x38]
lea edx, [ebp - 0x3c]
push 0x5b2ce4
lea eax, [ebp - 0x28]
push eax
call sym.core::panicking::assert_failed::ha93b9b84e0318e5d
mov esi, eax
push dword [ebp - 0x10]
call sub.kernel32.dll_CloseHandle
push esi
call sym.__Unwind_Resume