Function at 0x509e40
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x5bec88
mov eax, dword fs:[0]
push eax
sub esp, 0x2c
mov eax, dword [0x6ac30c]
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 ebx, dword [ebp + 8]
xor eax, eax
mov esi, ecx
cmp ebx, 0xffffffff
je 0x50a00f
mov ecx, dword [esi + 0x24]
mov edx, dword [ecx]
cmp edx, eax
je 0x509ea4
mov ecx, dword [esi + 0x34]
mov edi, dword [ecx]
add edi, edx
cmp edx, edi
jae 0x509ea4
dec dword [ecx]
mov esi, dword [esi + 0x24]
mov eax, dword [esi]
lea ecx, [eax + 1]
mov dword [esi], ecx
mov byte [eax], bl
mov eax, ebx
jmp 0x50a00f
cmp dword [esi + 0x54], eax
je 0x50a00c
mov edx, dword [esi + 0x10]
lea edi, [esi + 0x48]
cmp dword [edx], edi
jne 0x509ecb
mov ecx, dword [esi + 0x40]
mov edi, dword [esi + 0x3c]
mov dword [edx], edi
mov edx, dword [esi + 0x20]
mov dword [edx], ecx
mov edx, dword [esi + 0x30]
sub ecx, ecx
mov dword [edx], ecx
cmp dword [esi + 0x44], eax
jne 0x509ef0
mov esi, dword [esi + 0x54]
movsx eax, bl
push esi
push eax
call fcn.0059bf4d
add esp, 8
cmp eax, 0xffffffff
je 0x50a00c
mov eax, ebx
jmp 0x50a00f
mov ecx, 0xf
mov edx, eax
mov byte [ebp - 0x2c], al
mov byte [ebp - 0x30], bl
mov dword [ebp - 0x18], ecx
mov dword [ebp - 0x2c], edx
mov dword [ebp - 0x28], eax
mov dword [ebp - 0x1c], 8
cmp ecx, 0x10
jae 0x509f15
lea edx, [ebp - 0x2c]
mov byte [edx + 8], al
mov dword [ebp - 4], eax
mov eax, dword [ebp - 0x2c]
mov ebx, dword [ebp - 0x18]
mov edx, eax
cmp ebx, 0x10
jae 0x509f2d
lea edx, [ebp - 0x2c]
mov eax, edx
add edx, dword [ebp - 0x1c]
mov ecx, dword [esi + 0x44]
mov edi, dword [ecx]
lea ebx, [ebp - 0x34]
push ebx
push edx
push eax
lea edx, [ebp - 0x38]
push edx
lea eax, [ebp - 0x2f]
push eax
lea edx, [ebp - 0x30]
push edx
lea eax, [esi + 0x4c]
push eax
mov eax, dword [edi + 0x14]
call eax
test eax, eax
js 0x50a004
cmp eax, 1
jg 0x509fc0
mov ebx, dword [ebp - 0x18]
mov eax, dword [ebp - 0x2c]
mov ecx, eax
cmp ebx, 0x10
jae 0x509f6d
lea ecx, [ebp - 0x2c]
mov edi, dword [ebp - 0x34]
sub edi, ecx
je 0x509f96
cmp ebx, 0x10
jae 0x509f7c
lea eax, [ebp - 0x2c]
mov ecx, dword [esi + 0x54]
push ecx
push edi
push 1
push eax
call fcn.0059b033
add esp, 0x10
cmp edi, eax
jne 0x50a004
mov ebx, dword [ebp - 0x18]
mov eax, dword [ebp - 0x2c]
lea edx, [ebp - 0x30]
mov byte [esi + 0x49], 1
cmp dword [ebp - 0x38], edx
jne 0x509ff7
test edi, edi
jne 0x509f21
cmp dword [ebp - 0x1c], 0x20
lea ecx, [ebp - 0x2c]
jae 0x50a007
push edi
push 8
call fcn.0044cb50
jmp 0x509f1b
cmp eax, 3
jne 0x50a004
mov eax, dword [esi + 0x54]
mov ecx, dword [ebp - 0x30]
push eax
push ecx
call fcn.00509560
add esp, 8
test al, al
je 0x509fe8
mov esi, dword [ebp + 8]
lea ecx, [ebp - 0x2c]
call fcn.00477ae0
mov eax, esi
jmp 0x50a00f
lea ecx, [ebp - 0x2c]
or esi, 0xffffffff
call fcn.00477ae0
mov eax, esi
jmp 0x50a00f
lea ecx, [ebp - 0x2c]
call fcn.00477ae0
mov eax, dword [ebp + 8]
jmp 0x50a00f
lea ecx, [ebp - 0x2c]
call fcn.00477ae0
or eax, 0xffffffff
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.00599821
mov esp, ebp
pop ebp
ret 4