Function at 0x406580
Capabilities:
Read file on windows
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x523ce0
mov eax, dword fs:[0]
push eax
sub esp, 0x5c
mov eax, dword [0x56d3f0]
xor eax, ebp
mov dword [ebp - 0x10], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov eax, dword [ebp + 8]
mov dword [ebp - 0x5c], eax
mov eax, dword [ebp + 0xc]
mov ebx, edx
push 0x54ea80
push eax
mov dword [ebp - 0x64], ebx
mov dword [ebp - 0x4c], ecx
call fcn.004ff35e
mov esi, eax
add esp, 8
mov dword [ebp - 0x50], esi
test esi, esi
jne 0x4065e9
lea edi, [eax + 0x10]
lea esi, [ebx + 0x120]
mov eax, str.File_Open_Fail__
call fcn.00402500
mov esi, dword [ebp - 0x50]
mov edx, dword [ebp - 0x4c]
push 0x54eca0
push edx
call fcn.004ff35e
mov edi, eax
add esp, 8
mov dword [ebp - 0x54], edi
test edi, edi
jne 0x40661c
lea edi, [eax + 0x10]
lea esi, [ebx + 0x120]
mov eax, str.File_Open_Fail__
call fcn.00402500
mov edi, dword [ebp - 0x54]
mov esi, dword [ebp - 0x50]
test esi, esi
je 0x406642
test edi, edi
je 0x406642
push ebx
mov eax, esi
call fcn.004063c0
test al, al
jne 0x406662
push esi
call fcn.004ff649
add esp, 4
push edi
call fcn.004ff649
add esp, 4
xor al, al
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 0x10]
xor ecx, ebp
call fcn.004feee9
mov esp, ebp
pop ebp
ret 8
mov eax, dword [ebx + 0x110]
push eax
push ebx
call fcn.00406480
test al, al
je 0x406642
mov ecx, dword [ebx + 0x110]
mov edx, dword [ebx + 0x11c]
mov eax, dword [ebx + 0x118]
push 0
push ecx
push edx
push eax
call fcn.0050d260
mov ecx, dword [ebp - 0x5c]
lea edi, [ebx + 8]
mov dword [ebp - 0x4c], eax
call fcn.00402030
mov ebx, edi
call fcn.00401f90
mov ebx, dword [ebp - 0x64]
mov eax, dword [ebx + 0x11c]
mov ecx, dword [ebx + 0x118]
xor esi, esi
mov dword [ebp - 0x5c], esi
cmp eax, esi
jl 0x4067b1
jg 0x4066d0
cmp ecx, esi
jbe 0x4067b1
lea ebx, [ebx]
sub ecx, dword [ebp - 0x4c]
mov edx, 0
sbb eax, edx
cmp esi, ecx
jne 0x4066f0
cmp dword [ebp - 0x5c], eax
jne 0x4066f0
call fcn.00406440
test al, al
je 0x406642
mov ecx, dword [ebp - 0x50]
mov edx, dword [ebx + 0x110]
mov eax, dword [ebx + 0x10c]
push ecx
push 1
push edx
push eax
call fcn.004ff5bf
add esp, 0x10
test eax, eax
jne 0x40674c
mov ecx, dword [ebp - 0x50]
push ecx
call fcn.00500223
add esp, 4
test eax, eax
je 0x40674c
mov edx, dword [ebx + 0x10c]
mov ecx, dword [ebp - 0x4c]
push edx
mov eax, edi
call fcn.004020b0
test al, al
je 0x4067de
mov eax, dword [ebp - 0x54]
mov ecx, dword [ebp - 0x4c]
mov edx, dword [ebx + 0x10c]
push eax
push 1
push ecx
push edx
jmp 0x40677c
mov eax, dword [ebx + 0x10c]
mov ecx, dword [ebx + 0x110]
push eax
mov eax, edi
call fcn.004020b0
test al, al
je 0x406808
mov ecx, dword [ebp - 0x54]
mov edx, dword [ebx + 0x110]
mov eax, dword [ebx + 0x10c]
push ecx
push 1
push edx
push eax
call fcn.005003ca
mov edx, dword [ebp - 0x5c]
mov eax, dword [ebx + 0x11c]
mov ecx, dword [ebx + 0x118]
add esp, 0x10
add esi, dword [ebx + 0x110]
adc edx, 0
mov dword [ebp - 0x5c], edx
cmp edx, eax
jl 0x4066d0
jg 0x4067b1
cmp esi, ecx
jb 0x4066d0
mov esi, edi
call fcn.00401e60
mov esi, ebx
call fcn.00406530
mov eax, dword [ebp - 0x50]
push eax
call fcn.004ff649
mov ecx, dword [ebp - 0x54]
add esp, 4
push ecx
call fcn.004ff649
add esp, 4
mov al, 1
jmp 0x406644
push edi
lea esi, [ebp - 0x48]
call fcn.00401ec0
lea esi, [ebx + 0x120]
mov edi, eax
mov dword [ebp - 4], 0
call fcn.00406840
lea esi, [ebp - 0x48]
call fcn.00402160
jmp 0x406642
push edi
lea esi, [ebp - 0x2c]
call fcn.00401ec0
lea esi, [ebx + 0x120]
mov edi, eax
mov dword [ebp - 4], 1
call fcn.00406840
cmp dword [ebp - 0x18], 0x10
jb 0x406642
mov edx, dword [ebp - 0x2c]
push edx
call fcn.0040c415
jmp 0x40663f