Function at 0x101817d0
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x38
push esi
mov eax, dword [ebp + 8]
push eax
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll__get_osfhandle]
add esp, 4
mov dword [ebp - 0x24], eax
mov dword [ebp - 4], 0
mov ecx, dword [ebp - 0x24]
push ecx
call fcn.10186ef0
add esp, 4
test eax, eax
je 0x10181816
push 0
mov edx, dword [ebp + 0x10]
push edx
mov eax, dword [ebp + 0xc]
push eax
mov ecx, dword [ebp + 8]
push ecx
call sym.ruby.dll__rb_w32_send_16
jmp 0x10181b69
mov edx, dword [ebp + 8]
push edx
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll__get_osfhandle]
add esp, 4
cmp eax, 0xffffffff
jne 0x10181830
or eax, 0xffffffff
jmp 0x10181b69
mov eax, dword [ebp + 8]
push eax
call fcn.10186ec0
add esp, 4
movzx ecx, byte [eax + 0x28]
and ecx, 0x80
je 0x101818ab
mov edx, dword [ebp + 8]
push edx
call fcn.10186ec0
add esp, 4
movzx eax, byte [eax + 0x28]
and eax, 8
je 0x10181891
push 1
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
add esp, 4
push eax
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll__fileno]
add esp, 4
cmp dword [ebp + 8], eax
je 0x10181891
push 2
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
add esp, 4
push eax
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll__fileno]
add esp, 4
cmp dword [ebp + 8], eax
jne 0x101818ab
mov ecx, dword [ebp + 0x10]
push ecx
mov edx, dword [ebp + 0xc]
push edx
mov eax, dword [ebp + 8]
push eax
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll__write]
add esp, 0xc
jmp 0x10181b69
mov ecx, dword [ebp + 8]
push ecx
call fcn.10186ec0
add esp, 4
push eax
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
cmp dword [ebp + 0x10], 0
je 0x101818d9
mov edx, dword [ebp + 8]
push edx
call fcn.10186ec0
add esp, 4
movzx eax, byte [eax + 0x28]
and eax, 2
je 0x101818f3
mov ecx, dword [ebp + 8]
push ecx
call fcn.10186ec0
add esp, 4
push eax
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
xor eax, eax
jmp 0x10181b69
mov dword [ebp - 0x14], 0
mov edx, dword [ebp + 8]
push edx
call fcn.10186ec0
add esp, 4
movzx eax, byte [eax + 0x28]
and eax, 0x40
je 0x1018192f
cmp dword [ebp + 0x10], 0x8000
jbe 0x10181921
mov dword [ebp - 0x18], 0x8000
jmp 0x10181927
mov ecx, dword [ebp + 0x10]
mov dword [ebp - 0x18], ecx
mov edx, dword [ebp - 0x18]
mov dword [ebp - 0x1c], edx
jmp 0x10181935
mov eax, dword [ebp + 0x10]
mov dword [ebp - 0x1c], eax
mov ecx, dword [ebp - 0x1c]
mov dword [ebp - 0x10], ecx
mov edx, dword [ebp + 0x10]
sub edx, dword [ebp - 0x10]
mov dword [ebp + 0x10], edx
cmp dword [0x1026cda4], 0
je 0x10181982
mov eax, dword [ebp + 8]
push eax
lea ecx, [ebp - 0x38]
push ecx
call fcn.1018a160
add esp, 8
test eax, eax
je 0x1018197c
mov edx, dword [ebp + 8]
push edx
call fcn.10186ec0
add esp, 4
push eax
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
or eax, 0xffffffff
jmp 0x10181b69
lea eax, [ebp - 0x38]
mov dword [ebp - 4], eax
mov ecx, dword [ebp - 4]
push ecx
lea edx, [ebp - 0xc]
push edx
mov eax, dword [ebp - 0x10]
push eax
mov ecx, dword [ebp + 0xc]
push ecx
mov edx, dword [ebp + 8]
push edx
call fcn.10186ec0
add esp, 4
mov eax, dword [eax + 0x18]
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x10181b14
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [ebp - 8], eax
cmp dword [ebp - 8], 0x3e5
je 0x10181a17
cmp dword [ebp - 4], 0
je 0x101819d2
mov ecx, dword [ebp - 0x28]
push ecx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
cmp dword [ebp - 8], 5
jne 0x101819e6
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
mov dword [eax], 9
jmp 0x101819fc
mov edx, dword [ebp - 8]
push edx
call sym.ruby.dll_rb_w32_map_errno
add esp, 4
mov esi, eax
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
mov dword [eax], esi
mov eax, dword [ebp + 8]
push eax
call fcn.10186ec0
add esp, 4
push eax
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
or eax, 0xffffffff
jmp 0x10181b69
cmp dword [ebp - 4], 0
je 0x10181b14
push 0xffffffffffffffff
push 1
lea ecx, [ebp - 0x28]
push ecx
call sym.ruby.dll_rb_w32_wait_events_blocking
add esp, 0xc
mov dword [ebp - 0x20], eax
cmp dword [ebp - 0x20], 0
je 0x10181aa2
cmp dword [ebp - 0x20], 1
jne 0x10181a4e
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
mov dword [eax], 4
jmp 0x10181a67
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
call sym.ruby.dll_rb_w32_map_errno
add esp, 4
mov esi, eax
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
mov dword [eax], esi
mov edx, dword [ebp - 0x28]
push edx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [ebp + 8]
push eax
call fcn.10186ec0
add esp, 4
mov ecx, dword [eax + 0x18]
push ecx
call dword [0x1026cda4]
mov edx, dword [ebp + 8]
push edx
call fcn.10186ec0
add esp, 4
push eax
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
or eax, 0xffffffff
jmp 0x10181b69
push 1
lea eax, [ebp - 0xc]
push eax
lea ecx, [ebp - 0x38]
push ecx
mov edx, dword [ebp + 8]
push edx
call fcn.10186ec0
add esp, 4
mov eax, dword [eax + 0x18]
push eax
call dword [sym.imp.KERNEL32.dll_GetOverlappedResult]
test eax, eax
jne 0x10181b14
mov ecx, dword [ebp - 8]
push ecx
call sym.ruby.dll_rb_w32_map_errno
add esp, 4
mov esi, eax
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
mov dword [eax], esi
mov edx, dword [ebp - 0x28]
push edx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [ebp + 8]
push eax
call fcn.10186ec0
add esp, 4
mov ecx, dword [eax + 0x18]
push ecx
call dword [0x1026cda4]
mov edx, dword [ebp + 8]
push edx
call fcn.10186ec0
add esp, 4
push eax
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
or eax, 0xffffffff
jmp 0x10181b69
cmp dword [ebp - 4], 0
je 0x10181b2e
mov eax, dword [ebp - 0xc]
push eax
mov ecx, dword [ebp + 8]
push ecx
lea edx, [ebp - 0x38]
push edx
call fcn.1018a270
add esp, 0xc
mov eax, dword [ebp - 0x14]
add eax, dword [ebp - 0xc]
mov dword [ebp - 0x14], eax
mov ecx, dword [ebp - 0xc]
cmp ecx, dword [ebp - 0x10]
jne 0x10181b53
mov edx, dword [ebp + 0xc]
add edx, dword [ebp - 0x10]
mov dword [ebp + 0xc], edx
cmp dword [ebp + 0x10], 0
jbe 0x10181b53
jmp 0x101818fa
mov eax, dword [ebp + 8]
push eax
call fcn.10186ec0
add esp, 4
push eax
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, dword [ebp - 0x14]
pop esi
mov esp, ebp
pop ebp
ret