Function at 0x1005b520
Capabilities:
Read file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x28
push esi
mov dword [ebp - 4], 0
mov eax, dword [ebp + 8]
push eax
call sym.ruby.dll_rb_io_check_closed
add esp, 4
mov ecx, dword [ebp + 8]
cmp dword [ecx + 0x34], 0
je 0x1005b54e
mov edx, dword [ebp + 8]
mov eax, dword [edx + 8]
and eax, 0x20
je 0x1005b553
jmp 0x1005b7cd
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
mov dword [eax], 0
mov ecx, dword [ebp + 8]
mov edx, dword [ecx]
push edx
call sym.ruby.dll_rb_w32_fd_is_text
add esp, 4
movsx eax, al
test eax, eax
jne 0x1005b5e7
push 1
mov ecx, dword [ebp + 8]
mov eax, dword [ecx + 0x34]
neg eax
cdq
push edx
push eax
mov edx, dword [ebp + 8]
mov eax, dword [edx]
push eax
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll__lseeki64]
add esp, 0x10
mov dword [ebp - 0x20], eax
mov dword [ebp - 0x1c], edx
cmp dword [ebp - 0x1c], 0
jg 0x1005b5ce
jl 0x1005b5a4
cmp dword [ebp - 0x20], 0
jae 0x1005b5ce
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
cmp dword [eax], 0
je 0x1005b5ce
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
cmp dword [eax], 0x1d
jne 0x1005b5c9
mov ecx, dword [ebp + 8]
mov edx, dword [ecx + 8]
or edx, 0x20
mov eax, dword [ebp + 8]
mov dword [eax + 8], edx
jmp 0x1005b7cd
mov ecx, dword [ebp + 8]
mov dword [ecx + 0x30], 0
mov edx, dword [ebp + 8]
mov dword [edx + 0x34], 0
jmp 0x1005b7cd
push 1
push 0
push 0
mov eax, dword [ebp + 8]
mov ecx, dword [eax]
push ecx
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll__lseeki64]
add esp, 0x10
mov dword [ebp - 0x28], eax
mov dword [ebp - 0x24], edx
cmp dword [ebp - 0x24], 0
jg 0x1005b63a
jl 0x1005b610
cmp dword [ebp - 0x28], 0
jae 0x1005b63a
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
cmp dword [eax], 0
je 0x1005b63a
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
cmp dword [eax], 0x1d
jne 0x1005b635
mov edx, dword [ebp + 8]
mov eax, dword [edx + 8]
or eax, 0x20
mov ecx, dword [ebp + 8]
mov dword [ecx + 8], eax
jmp 0x1005b7cd
mov edx, dword [ebp + 8]
mov eax, dword [edx + 0x34]
cdq
mov ecx, dword [ebp - 0x28]
sub ecx, eax
mov dword [ebp - 0x18], ecx
mov edx, dword [ebp + 8]
mov eax, dword [edx + 0x2c]
mov ecx, dword [ebp + 8]
add eax, dword [ecx + 0x30]
mov dword [ebp - 0xc], eax
mov edx, dword [ebp + 8]
mov eax, dword [edx + 0x2c]
mov ecx, dword [ebp + 8]
mov edx, dword [ecx + 0x38]
movsx eax, byte [eax + edx - 1]
cmp eax, 0xd
jne 0x1005b677
mov ecx, dword [ebp - 4]
add ecx, 1
mov dword [ebp - 4], ecx
mov dword [ebp - 8], 0
jmp 0x1005b689
mov edx, dword [ebp - 8]
add edx, 1
mov dword [ebp - 8], edx
mov eax, dword [ebp + 8]
mov ecx, dword [ebp - 8]
cmp ecx, dword [eax + 0x34]
jge 0x1005b6bd
mov edx, dword [ebp - 0xc]
movsx eax, byte [edx]
cmp eax, 0xa
jne 0x1005b6a8
mov ecx, dword [ebp - 4]
add ecx, 1
mov dword [ebp - 4], ecx
mov edx, dword [ebp - 0x18]
cmp edx, dword [ebp - 4]
jne 0x1005b6b2
jmp 0x1005b6bd
mov eax, dword [ebp - 0xc]
add eax, 1
mov dword [ebp - 0xc], eax
jmp 0x1005b680
push 1
mov ecx, dword [ebp + 8]
mov edx, dword [ecx + 0x34]
add edx, dword [ebp - 4]
push edx
call sym.ruby.dll_ruby_xmalloc2
add esp, 8
mov dword [ebp - 0x10], eax
cmp dword [ebp - 4], 0
jl 0x1005b7ad
push 0
mov eax, dword [ebp + 8]
mov eax, dword [eax + 0x34]
cdq
mov ecx, dword [ebp - 0x28]
sub ecx, eax
mov esi, dword [ebp - 0x24]
sbb esi, edx
mov eax, dword [ebp - 4]
cdq
sub ecx, eax
sbb esi, edx
push esi
push ecx
mov edx, dword [ebp + 8]
mov eax, dword [edx]
push eax
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll__lseeki64]
add esp, 0x10
mov dword [ebp - 0x20], eax
mov dword [ebp - 0x1c], edx
cmp dword [ebp - 4], 0
jne 0x1005b71b
jmp 0x1005b7ad
cmp dword [ebp - 0x1c], 0
jg 0x1005b734
jl 0x1005b729
cmp dword [ebp - 0x20], 0
jae 0x1005b734
mov ecx, dword [ebp - 4]
sub ecx, 1
mov dword [ebp - 4], ecx
jmp 0x1005b6d4
mov edx, dword [ebp + 8]
mov eax, dword [edx + 0x34]
add eax, dword [ebp - 4]
push eax
mov ecx, dword [ebp - 0x10]
push ecx
mov edx, dword [ebp + 8]
mov eax, dword [edx]
push eax
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll__read]
add esp, 0xc
mov dword [ebp - 0x14], eax
cmp dword [ebp - 0x14], 0
jge 0x1005b777
mov ecx, dword [ebp - 0x10]
push ecx
call sym.ruby.dll_ruby_xfree
add esp, 4
mov edx, dword [ebp + 8]
mov eax, dword [edx + 0x14]
push eax
push str.io_unread
call sym.ruby.dll_rb_sys_fail_path_in
mov ecx, dword [ebp + 8]
mov edx, dword [ebp - 0x14]
cmp edx, dword [ecx + 0x34]
jne 0x1005b79f
push 0
mov eax, dword [ebp - 0x1c]
push eax
mov ecx, dword [ebp - 0x20]
push ecx
mov edx, dword [ebp + 8]
mov eax, dword [edx]
push eax
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll__lseeki64]
add esp, 0x10
jmp 0x1005b7ad
mov ecx, dword [ebp - 4]
sub ecx, 1
mov dword [ebp - 4], ecx
jmp 0x1005b6d4
mov edx, dword [ebp - 0x10]
push edx
call sym.ruby.dll_ruby_xfree
add esp, 4
mov eax, dword [ebp + 8]
mov dword [eax + 0x30], 0
mov ecx, dword [ebp + 8]
mov dword [ecx + 0x34], 0
pop esi
mov esp, ebp
pop ebp
ret