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

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x20
mov eax, dword [0x58f860]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 8]
mov dword [ebp - 0x18], eax
mov eax, dword [0x5936b4]
inc eax
push ebx
mov ebx, ecx
mov dword [ebp - 0x1c], ebx
mov dword [0x5936b4], eax
cmp eax, 1
jne 0x4041c1
push 0
call fcn.005196a3
xor eax, 0xbb40e64e
push eax
call fcn.0051ae13
add esp, 8
push ebx
mov ebx, edi
mov ecx, esi
call fcn.00404100
add esp, 4
mov dword [ebp - 0x14], 0
call fcn.0051ae25
mov ecx, dword [esi + 8]
mov edx, ecx
and edx, 0xfffd
or edx, 2
mov dword [ebp - 0x20], edx
mov edx, dword [esi]
mov ebx, edx
shr edx, 8
sar eax, 7
and eax, 0xff
xor ebx, eax
and ebx, 0xff
mov ebx, dword [edi + ebx*4]
xor ebx, edx
movzx edx, bl
add edx, dword [esi + 4]
mov dword [esi], ebx
imul edx, edx, 0x8088405
inc edx
mov dword [esi + 4], edx
shr edx, 0x18
xor edx, ecx
and edx, 0xff
shr ecx, 8
xor ecx, dword [edi + edx*4]
mov dword [esi + 8], ecx
mov ecx, dword [ebp - 0x20]
mov edx, ecx
xor edx, 1
imul edx, ecx
shr edx, 8
xor dl, al
mov eax, dword [ebp - 0x14]
mov byte [ebp + eax - 0x10], dl
inc eax
mov dword [ebp - 0x14], eax
cmp eax, 0xa
jl 0x4041d5
mov eax, dword [ebp - 0x1c]
push eax
mov ebx, edi
mov ecx, esi
call fcn.00404100
mov ecx, dword [ebp - 0x18]
lea edx, [ebp - 0x10]
add esp, 4
xor eax, eax
sub ecx, edx
mov dword [ebp - 0x1c], ecx
lea ebx, [ebx]
mov ecx, dword [esi + 8]
movzx ebx, byte [ebp + eax - 0x10]
mov edx, ecx
and edx, 0xfffd
or edx, 2
mov dword [ebp - 0x14], edx
mov edx, dword [esi]
xor ebx, edx
shr edx, 8
and ebx, 0xff
mov ebx, dword [edi + ebx*4]
xor ebx, edx
movzx edx, bl
add edx, dword [esi + 4]
mov dword [esi], ebx
imul edx, edx, 0x8088405
inc edx
mov dword [esi + 4], edx
shr edx, 0x18
xor edx, ecx
and edx, 0xff
shr ecx, 8
xor ecx, dword [edi + edx*4]
movzx ebx, byte [ebp + eax - 0xf]
mov dword [esi + 8], ecx
mov ecx, dword [ebp - 0x14]
mov edx, ecx
xor edx, 1
imul edx, ecx
mov ecx, dword [ebp - 0x1c]
shr edx, 8
xor dl, byte [ebp + eax - 0x10]
add ecx, eax
mov byte [ebp + ecx - 0x10], dl
mov ecx, dword [esi + 8]
mov edx, ecx
and edx, 0xfffd
or edx, 2
mov dword [ebp - 0x14], edx
mov edx, dword [esi]
xor ebx, edx
shr edx, 8
and ebx, 0xff
mov ebx, dword [edi + ebx*4]
xor ebx, edx
movzx edx, bl
add edx, dword [esi + 4]
mov dword [esi], ebx
imul edx, edx, 0x8088405
inc edx
mov dword [esi + 4], edx
shr edx, 0x18
xor edx, ecx
and edx, 0xff
shr ecx, 8
xor ecx, dword [edi + edx*4]
movzx ebx, byte [ebp + eax - 0xe]
mov dword [esi + 8], ecx
mov ecx, dword [ebp - 0x14]
mov edx, ecx
xor edx, 1
imul edx, ecx
mov ecx, dword [ebp - 0x18]
shr edx, 8
xor dl, byte [ebp + eax - 0xf]
mov byte [ecx + eax + 1], dl
mov ecx, dword [esi + 8]
mov edx, ecx
and edx, 0xfffd
or edx, 2
mov dword [ebp - 0x14], edx
mov edx, dword [esi]
xor ebx, edx
and ebx, 0xff
mov ebx, dword [edi + ebx*4]
shr edx, 8
xor ebx, edx
movzx edx, bl
add edx, dword [esi + 4]
mov dword [esi], ebx
imul edx, edx, 0x8088405
inc edx
mov dword [esi + 4], edx
shr edx, 0x18
xor edx, ecx
and edx, 0xff
shr ecx, 8
xor ecx, dword [edi + edx*4]
movzx ebx, byte [ebp + eax - 0xd]
mov dword [esi + 8], ecx
mov ecx, dword [ebp - 0x14]
mov edx, ecx
xor edx, 1
imul edx, ecx
shr edx, 8
xor dl, byte [ebp + eax - 0xe]
mov ecx, dword [ebp - 0x18]
mov byte [ecx + eax + 2], dl
mov ecx, dword [esi + 8]
mov edx, ecx
and edx, 0xfffd
or edx, 2
mov dword [ebp - 0x14], edx
mov edx, dword [esi]
xor ebx, edx
shr edx, 8
and ebx, 0xff
mov ebx, dword [edi + ebx*4]
xor ebx, edx
movzx edx, bl
add edx, dword [esi + 4]
mov dword [esi], ebx
imul edx, edx, 0x8088405
inc edx
mov dword [esi + 4], edx
shr edx, 0x18
xor edx, ecx
and edx, 0xff
shr ecx, 8
xor ecx, dword [edi + edx*4]
movzx ebx, byte [ebp + eax - 0xc]
mov dword [esi + 8], ecx
mov ecx, dword [ebp - 0x14]
mov edx, ecx
xor edx, 1
imul edx, ecx
mov ecx, dword [ebp - 0x18]
shr edx, 8
xor dl, byte [ebp + eax - 0xd]
mov byte [ecx + eax + 3], dl
mov ecx, dword [esi + 8]
mov edx, ecx
and edx, 0xfffd
or edx, 2
mov dword [ebp - 0x14], edx
mov edx, dword [esi]
xor ebx, edx
shr edx, 8
and ebx, 0xff
mov ebx, dword [edi + ebx*4]
xor ebx, edx
movzx edx, bl
add edx, dword [esi + 4]
mov dword [esi], ebx
imul edx, edx, 0x8088405
inc edx
mov dword [esi + 4], edx
shr edx, 0x18
xor edx, ecx
and edx, 0xff
shr ecx, 8
xor ecx, dword [edi + edx*4]
mov dword [esi + 8], ecx
mov ecx, dword [ebp - 0x14]
mov edx, ecx
xor edx, 1
imul edx, ecx
mov ecx, dword [ebp - 0x18]
shr edx, 8
xor dl, byte [ebp + eax - 0xc]
add eax, 5
mov byte [ecx + eax - 1], dl
cmp eax, 0xa
jl 0x404270
mov ecx, dword [esi + 8]
mov ebx, dword [ebp + 0xc]
mov edx, ecx
and edx, 0xfffd
or edx, 2
mov dword [ebp - 0x1c], edx
mov edx, dword [esi]
shr ebx, 0x10
mov dword [ebp - 0x20], ebx
xor ebx, edx
shr edx, 8
and ebx, 0xff
mov ebx, dword [edi + ebx*4]
xor ebx, edx
movzx edx, bl
add edx, dword [esi + 4]
mov dword [esi], ebx
imul edx, edx, 0x8088405
inc edx
mov dword [esi + 4], edx
shr edx, 0x18
xor edx, ecx
and edx, 0xff
shr ecx, 8
xor ecx, dword [edi + edx*4]
mov ebx, dword [ebp + 0xc]
mov dword [esi + 8], ecx
mov ecx, dword [ebp - 0x1c]
mov edx, ecx
xor edx, 1
imul edx, ecx
mov ecx, dword [ebp - 0x18]
shr edx, 8
xor dl, byte [ebp - 0x20]
shr ebx, 0x18
mov byte [ecx + eax], dl
mov ecx, dword [esi + 8]
mov edx, ecx
and edx, 0xfffd
or edx, 2
mov dword [ebp - 0x1c], edx
mov edx, dword [esi]
mov dword [ebp - 0x20], ebx
xor ebx, edx
shr edx, 8
and ebx, 0xff
mov ebx, dword [edi + ebx*4]
xor ebx, edx
movzx edx, bl
add edx, dword [esi + 4]
mov dword [esi], ebx
imul edx, edx, 0x8088405
inc edx
mov dword [esi + 4], edx
shr edx, 0x18
xor edx, ecx
and edx, 0xff
shr ecx, 8
xor ecx, dword [edi + edx*4]
add eax, 2
mov dword [esi + 8], ecx
mov ecx, dword [ebp - 0x1c]
mov edx, ecx
xor edx, 1
imul edx, ecx
mov ecx, dword [ebp - 0x18]
shr edx, 8
xor dl, byte [ebp - 0x20]
pop ebx
mov byte [ecx + eax - 1], dl
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00512610
mov esp, ebp
pop ebp
ret