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

Disassembly:
push 0xffffffffffffffff
push 0x44c170
mov eax, dword fs:[0]
push eax
sub esp, 0xc
push ebx
push ebp
push esi
push edi
mov eax, dword [0x465d3c]
xor eax, esp
push eax
lea eax, [esp + 0x20]
mov dword fs:[0], eax
mov esi, dword [esp + 0x34]
lea ebx, [esi + 0x18]
mov ecx, ebx
mov dword [esp + 0x1c], ebx
call fcn.004016d0
mov eax, dword [esi + 4]
mov ecx, 0x451e9c
test al, 0x40
je 0x40856c
mov ecx, 0x451e98
jmp 0x408575
test al, 0x20
je 0x408575
mov ecx, 0x451e94
mov eax, dword [esp + 0x30]
push ecx
xor edi, edi
push eax
mov dword [esi], edi
call fcn.00433585
add esp, 8
mov dword [esi], eax
cmp eax, edi
jne 0x4085e4
lea ecx, [esp + 0x34]
push ecx
call fcn.004060f0
add esp, 4
push eax
mov ecx, ebx
mov dword [esp + 0x2c], edi
call fcn.00402100
mov eax, dword [esp + 0x34]
add eax, 0xfffffff0
mov dword [esp + 0x28], 0xffffffff
lea edx, [eax + 0xc]
or ecx, 0xffffffff
lock xadd dword [edx], ecx
dec ecx
test ecx, ecx
jg 0x4085ce
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
xor al, al
mov ecx, dword [esp + 0x20]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x18
ret
mov ecx, dword [esi + 4]
mov byte [esp + 0x34], 1
test cl, 0x10
je 0x40878f
push 2
push edi
push eax
call fcn.0043343c
mov ecx, dword [esi]
push ecx
call fcn.00433344
mov edx, dword [esi]
push edi
push edi
push edx
mov dword [esi + 8], eax
call fcn.0043343c
mov eax, dword [esi + 8]
mov ebp, 0x400
add esp, 0x1c
cmp eax, ebp
jge 0x40862c
mov ebp, eax
test ebp, ebp
je 0x40885a
push ebp
call fcn.0040c716
mov ebx, eax
mov eax, dword [esi]
push eax
push 1
push ebp
push ebx
mov dword [esp + 0x28], ebx
call fcn.00432fa6
add esp, 0x14
cmp eax, 1
sete al
mov byte [esp + 0x34], al
test al, al
je 0x408781
and dword [esi + 4], 0xfffffffa
xor ecx, ecx
mov dword [esi + 0x10], 1
cmp dword [0x464560], ecx
je 0x4086de
xor eax, eax
mov edx, dword [eax + 0x464564]
test edx, edx
jle 0x40869b
cmp edi, ebp
jge 0x40869b
mov ebx, dword [esp + 0x14]
mov edx, dword [eax + 0x464560]
mov bl, byte [ebx + edi]
cmp bl, byte [edi + edx]
mov edx, dword [eax + 0x464564]
jne 0x40869b
inc edi
cmp edi, edx
jl 0x40867a
cmp edi, edx
je 0x4086b1
inc ecx
mov eax, ecx
xor edi, edi
shl eax, 4
cmp dword [eax + 0x464560], edi
jne 0x408670
jmp 0x4086da
shl ecx, 4
mov eax, dword [ecx + 0x46456c]
or eax, dword [esi + 4]
sub dword [esi + 8], edi
mov dword [esi + 4], eax
cmp edi, 2
jne 0x4086cb
mov dword [esi + 0x10], edi
mov ecx, dword [ecx + 0x464568]
push ecx
lea ecx, [esi + 0x1c]
call fcn.00402820
mov ebx, dword [esp + 0x14]
cmp ebp, edi
jle 0x4086f0
mov edx, dword [esi]
push 0
push edi
push edx
call fcn.0043343c
add esp, 0xc
test edi, edi
jne 0x408766
lea ecx, [esp + 0x14]
call fcn.004018b0
push ebp
push ebx
push ebp
lea ecx, [esp + 0x20]
mov dword [esp + 0x34], 1
call fcn.00401900
push eax
call fcn.00430eb0
add esp, 0xc
push ebp
lea ecx, [esp + 0x18]
call fcn.004053b0
push ecx
mov ecx, dword [esp + 0x18]
mov dword [esp + 0x1c], esp
mov eax, esp
lea edx, [esp + 0x1c]
push edx
mov dword [eax], ecx
call fcn.00407840
add esp, 8
push eax
lea ecx, [esi + 0x1c]
mov byte [esp + 0x2c], 2
call fcn.004026d0
lea ecx, [esp + 0x18]
call fcn.00401020
lea ecx, [esp + 0x14]
mov dword [esp + 0x28], 0xffffffff
call fcn.00401020
mov eax, dword [esi + 0x1c]
cmp dword [eax - 0xc], 0
lea ecx, [esi + 0x1c]
jne 0x408781
cmp byte [ebx], 0x3c
jne 0x408781
push 0x44fe30
call fcn.00402820
push ebx
call fcn.0040c721
add esp, 4
jmp 0x408827
test cl, 0x20
je 0x40885a
mov dword [esi + 0x10], 1
test cl, 0x40
je 0x4087b0
push eax
call fcn.00433344
add esp, 4
mov dword [esi + 8], eax
cmp dword [esi + 8], edi
jne 0x40885a
xor ecx, ecx
cmp dword [0x464560], edi
je 0x40885a
mov edx, dword [esi + 4]
xor eax, eax
lea esp, [esp]
test dword [eax + 0x46456c], edx
jne 0x4087e8
inc ecx
mov eax, ecx
shl eax, 4
cmp dword [eax + 0x464560], edi
jne 0x4087d0
jmp 0x40885a
shl ecx, 4
mov ebx, ecx
mov edi, dword [ebx + 0x464564]
cmp edi, 2
jne 0x40880a
mov dword [esi + 0x10], edi
mov ecx, dword [ebx + 0x464568]
push ecx
lea ecx, [esi + 0x1c]
call fcn.00402820
mov edx, dword [esi]
mov eax, dword [ebx + 0x464560]
push edx
push 1
push edi
push eax
call fcn.00433125
add esp, 0x10
cmp eax, 1
sete byte [esp + 0x34]
cmp byte [esp + 0x34], 0
jne 0x408856
lea ecx, [esp + 0x18]
push ecx
call fcn.004060f0
add esp, 4
mov ecx, dword [esp + 0x1c]
push eax
mov dword [esp + 0x2c], 3
call fcn.00402100
mov eax, dword [esp + 0x18]
jmp 0x4085aa
mov ebx, dword [esp + 0x1c]
mov ecx, dword [esi + 0x1c]
add esi, 0x1c
cmp dword [ecx - 0xc], 0
je 0x40888a
push esi
mov ecx, ebx
call fcn.00402100
test edi, edi
je 0x40887e
push str._BOM_
mov ecx, ebx
call fcn.00405f10
push 0x44fa0c
mov ecx, ebx
call fcn.00405f10
mov al, byte [esp + 0x34]
mov ecx, dword [esp + 0x20]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x18
ret