Function at 0x435799
Capabilities:
Write file on windows

Disassembly:
sub esp, 0x14
and dword [esp + 4], 0
push ebx
mov ebx, dword [esp + 0x20]
push ebp
push esi
push edi
mov eax, dword [ebx + 4]
test eax, eax
jne 0x4357b2
mov eax, dword [ebx]
mov edi, dword [esp + 0x28]
mov dword [esp + 0x10], eax
mov esi, dword [edi + 8]
test esi, esi
mov dword [esp + 0x1c], esi
mov dword [esp + 0x28], esi
jg 0x4357d0
mov eax, esi
jmp 0x4359ea
test byte [ebx + 8], 8
je 0x435931
push ebx
push dword [esp + 0x14]
call fcn.004355b7
push dword [esp + 0x18]
call dword [sym.imp.MSVCRT.dll__fileno]
push eax
call sym.ruby187c.exc_rb_thread_fd_writable
add esp, 0x10
test eax, eax
jne 0x435802
push ebx
call sym.ruby187c.exc_rb_io_check_closed
pop ecx
mov ebx, dword [sym.imp.KERNEL32.dll_InterlockedExchange]
mov esi, dword [sym.imp.MSVCRT.dll__errno]
mov ebp, sym.ruby187c.exc_rb_trap_immediate
mov eax, dword [esp + 0x28]
cmp eax, 0x400
mov dword [esp + 0x18], eax
jle 0x43584a
cmp dword [sym.ruby187c.exc_rb_thread_critical], 0
jne 0x43584a
call sym.ruby187c.exc_rb_thread_alone
test eax, eax
jne 0x43584a
push dword [esp + 0x2c]
call fcn.004359f2
test eax, eax
pop ecx
je 0x43584a
mov dword [esp + 0x18], 0x400
push 1
push ebp
call ebx
push dword [esp + 0x18]
mov dword [esp + 0x24], eax
mov eax, dword [esp + 0x18]
add eax, dword [edi + 0xc]
push eax
push dword [esp + 0x18]
call dword [sym.imp.MSVCRT.dll__fileno]
pop ecx
push eax
call sym.ruby187c.exc_rb_w32_write
add esp, 0xc
mov dword [esp + 0x18], eax
push dword [esp + 0x20]
push ebp
call ebx
call esi
mov eax, dword [eax]
mov dword [esp + 0x20], eax
xor eax, eax
cmp dword [sym.ruby187c.exc_rb_prohibit_interrupt], eax
jne 0x4358be
cmp dword [sym.ruby187c.exc_rb_thread_critical], eax
jne 0x4358be
cmp dword [sym.ruby187c.exc_rb_thread_pending], eax
jne 0x4358af
mov eax, dword [sym.ruby187c.exc_rb_thread_tick]
dec dword [sym.ruby187c.exc_rb_thread_tick]
test eax, eax
jg 0x4358be
mov dword [sym.ruby187c.exc_rb_thread_tick], 0x1f4
call sym.ruby187c.exc_rb_thread_schedule
cmp dword [sym.ruby187c.exc_rb_trap_pending], 0
je 0x4358cc
call sym.ruby187c.exc_rb_trap_exec
call esi
mov ecx, dword [esp + 0x20]
mov dword [eax], ecx
mov eax, dword [esp + 0x18]
cmp eax, dword [esp + 0x28]
je 0x435928
test eax, eax
jl 0x4358f2
add dword [esp + 0x14], eax
sub dword [esp + 0x28], eax
call esi
mov dword [eax], 0xb
push dword [esp + 0x10]
call dword [sym.imp.MSVCRT.dll__fileno]
push eax
call sym.ruby187c.exc_rb_io_wait_writable
pop ecx
test eax, eax
pop ecx
je 0x4359df
push dword [esp + 0x2c]
call sym.ruby187c.exc_rb_io_check_closed
mov eax, dword [esp + 0x18]
pop ecx
cmp eax, dword [edi + 8]
jge 0x4359df
jmp 0x435813
mov eax, dword [esp + 0x1c]
jmp 0x4359ea
mov ebx, dword [sym.imp.MSVCRT.dll__errno]
call ebx
push dword [esp + 0x10]
and dword [eax], 0
push esi
push 1
push dword [edi + 0xc]
call dword [sym.imp.MSVCRT.dll_fwrite]
mov ebp, eax
add esp, 0x10
sub esi, ebp
test esi, esi
jle 0x4359e4
mov eax, dword [esp + 0x10]
test byte [eax + 0xc], 0x20
je 0x4359bb
call ebx
cmp dword [eax], 0
jne 0x43598b
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0xe8
jne 0x435983
call ebx
mov dword [eax], 0x20
jmp 0x43598b
call ebx
mov dword [eax], 9
push dword [esp + 0x10]
call dword [sym.imp.MSVCRT.dll__fileno]
push eax
call sym.ruby187c.exc_rb_io_wait_writable
pop ecx
test eax, eax
pop ecx
je 0x4359df
push dword [esp + 0x2c]
call sym.ruby187c.exc_rb_io_check_closed
push dword [esp + 0x14]
call dword [sym.imp.MSVCRT.dll_clearerr]
cmp ebp, dword [edi + 8]
pop ecx
pop ecx
jge 0x4359df
call ebx
and dword [eax], 0
push dword [esp + 0x10]
mov eax, ebp
add eax, dword [edi + 0xc]
push esi
push 1
push eax
call dword [sym.imp.MSVCRT.dll_fwrite]
add esp, 0x10
add ebp, eax
sub esi, eax
jmp 0x435953
or eax, 0xffffffff
jmp 0x4359ea
mov eax, dword [esp + 0x1c]
sub eax, esi
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x14
ret