Function at 0x507f60
Capabilities:
Encode data using xor
Generate random numbers using the delphi lcg

Disassembly:
push ebp
mov ebp, esp
push ebx
push edi
push esi
sub esp, 0x1c
mov eax, dword [ebp + 8]
mov edi, 0xffffff9a
test eax, eax
je 0x50827b
mov ecx, dword [eax + 0xe0]
test ecx, ecx
je 0x50827b
cmp dword [ecx], 0
je 0x508276
mov edx, dword [ebp + 0x10]
xor edi, edi
test edx, edx
je 0x50827b
mov eax, dword [ebp + 0xc]
mov dword [ecx + 0x10], eax
mov dword [ecx + 0x14], edx
mov dword [ebp - 0x10], ecx
mov eax, dword [ebp - 0x10]
mov esi, dword [eax + 0x7c]
mov eax, dword [ebp - 0x10]
mov eax, dword [eax + 8]
mov ecx, dword [ebp - 0x10]
mov ecx, dword [ecx + 0x78]
mov ebx, ecx
add ebx, eax
adc esi, 0
cmp ebx, edx
sbb esi, 0
mov esi, dword [ebp - 0x10]
jae 0x507fe0
cmp dword [esi + 0xc8], 0
je 0x507fe0
add ecx, eax
mov dword [esi + 0x14], ecx
je 0x50827b
lea eax, [esi + 4]
mov dword [ebp - 0x24], eax
lea eax, [esi + 0x88]
mov dword [ebp - 0x28], eax
xor edi, edi
xor eax, eax
dec eax
mov dword [ebp - 0x1c], eax
mov ebx, dword [esi + 8]
test ebx, ebx
je 0x50808e
mov eax, dword [esi + 0xb8]
test eax, eax
je 0x508019
cmp dword [esi + 0xc8], 0
je 0x5081f0
test ebx, ebx
jne 0x508029
mov eax, dword [esi + 0x78]
or eax, dword [esi + 0x7c]
je 0x508285
mov eax, dword [esi + 0x14]
cmp eax, ebx
cmovb ebx, eax
test ebx, ebx
je 0x508048
xor eax, eax
mov ecx, dword [esi + 4]
mov edx, dword [esi + 0x10]
mov cl, byte [ecx + eax]
mov byte [edx + eax], cl
inc eax
cmp ebx, eax
jne 0x508037
add dword [esi + 0x68], ebx
adc dword [esi + 0x6c], 0
push ebx
push dword [esi + 0x10]
push dword [esi + 0x70]
call fcn.0042cc40
add esp, 0xc
mov dword [esi + 0x70], eax
sub dword [esi + 0x80], ebx
sbb dword [esi + 0x84], 0
sub dword [esi + 8], ebx
sub dword [esi + 0x14], ebx
add dword [esi + 0x10], ebx
add dword [esi + 4], ebx
add dword [esi + 0x18], ebx
add edi, ebx
cmp dword [esi + 0x14], 0
jne 0x507ff7
jmp 0x50827b
mov ebx, dword [esi + 0x78]
mov eax, dword [esi + 0x7c]
mov ecx, ebx
or ecx, eax
je 0x50826f
mov ecx, 0x4000
cmp ebx, ecx
cmovae ebx, ecx
test eax, eax
cmovne ebx, ecx
mov eax, dword [esi + 0xc0]
add eax, dword [esi + 0x40]
mov ecx, dword [esi + 0xc4]
adc ecx, dword [esi + 0x44]
push 0
push ecx
push eax
push dword [esi + 0xb4]
push dword [ebp - 0x28]
call fcn.00516130
add esp, 0x14
test eax, eax
jne 0x508288
mov eax, dword [esi]
mov dword [ebp - 0x18], eax
mov ecx, dword [esi + 0x8c]
mov dword [ebp - 0x14], ebx
mov ebx, dword [esi + 0xb4]
mov esi, dword [esi + 0xa4]
call dword [section..00cfg]
push dword [ebp - 0x14]
push dword [ebp - 0x18]
push ebx
mov ebx, dword [ebp - 0x14]
push esi
call ecx
add esp, 0x10
cmp eax, ebx
jne 0x508288
mov dword [ebp - 0x20], edi
mov edx, dword [ebp + 8]
cmp dword [edx + 0xe4], 0
mov edi, dword [ebp - 0x10]
je 0x5081d0
xor esi, esi
mov eax, dword [edx + 0xf4]
mov ecx, eax
and ecx, 0xfffd
or eax, 2
xor ecx, 3
imul ecx, eax
mov eax, dword [edi]
xor ch, byte [eax + esi]
mov byte [eax + esi], ch
mov edi, dword [edx + 0xf8]
mov dword [ebp - 0x18], edi
mov eax, dword [edx + 0xec]
mov edx, dword [ebp + 8]
mov ebx, dword [edx + 0xf4]
mov edx, eax
xor dl, ch
movzx edx, dl
shr eax, 8
xor eax, dword [edi + edx*4]
mov edx, dword [ebp + 8]
mov dword [edx + 0xec], eax
mov edx, 0xff
and eax, edx
mov edx, dword [ebp + 8]
add eax, dword [edx + 0xf0]
imul eax, eax, 0x8088405
inc eax
mov edx, dword [ebp + 8]
mov dword [edx + 0xf0], eax
shr eax, 0x18
mov edx, ebx
mov edi, 0xff
and edx, edi
xor edx, eax
shr ebx, 8
mov eax, dword [ebp - 0x18]
xor ebx, dword [eax + edx*4]
mov edi, dword [ebp - 0x10]
mov eax, dword [ebp + 8]
mov dword [eax + 0xf4], ebx
mov ebx, dword [ebp - 0x14]
mov edx, dword [ebp + 8]
mov eax, dword [edi]
mov byte [eax + esi], ch
inc esi
cmp ebx, esi
jne 0x50812c
add dword [edi + 0x40], ebx
adc dword [edi + 0x44], 0
sub dword [edi + 0x78], ebx
sbb dword [edi + 0x7c], 0
mov eax, dword [edi]
mov dword [edi + 4], eax
mov dword [edi + 8], ebx
mov esi, edi
mov edi, dword [ebp - 0x20]
jmp 0x508002
cmp eax, 0xc
je 0x50807f
mov ebx, dword [esi + 0x10]
mov eax, dword [esi + 0x18]
mov dword [ebp - 0x14], eax
push 2
push dword [ebp - 0x24]
call fcn.0045f360
add esp, 8
mov ecx, eax
test eax, eax
mov dword [ebp - 0x20], edi
js 0x508224
cmp dword [esi + 0x1c], 0
mov eax, 0xfffffffd
cmovne ecx, eax
mov dword [ebp - 0x18], ecx
mov ecx, ebx
mov eax, dword [ebp - 0x14]
mov edi, dword [esi + 0x18]
sub edi, eax
mov ebx, 0
sbb ebx, ebx
mov eax, dword [esi + 0x70]
add dword [esi + 0x68], edi
adc dword [esi + 0x6c], ebx
push edi
push ecx
push eax
call fcn.0042cc40
add esp, 0xc
mov dword [esi + 0x70], eax
sub dword [esi + 0x80], edi
sbb dword [esi + 0x84], ebx
mov eax, dword [ebp - 0x20]
add edi, eax
mov eax, dword [ebp - 0x18]
test eax, eax
jne 0x50828d
mov esi, dword [ebp - 0x10]
jmp 0x50807f
xor ebx, ebx
jmp 0x508002
mov edi, 0xffffff9c
mov eax, edi
add esp, 0x1c
pop esi
pop edi
pop ebx
pop ebp
ret
mov dword [ebp - 0x1c], edi
mov edi, dword [ebp - 0x1c]
jmp 0x50827b
mov dword [ebp - 0x1c], edi
mov edi, eax
cmp eax, 1
jne 0x50827b
jmp 0x508288