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

Disassembly:
sub esp, 0xc
push ebx
push esi
mov eax, edx
xor ebx, ebx
mov edx, dword [0x246d5b4]
mov dword [esp + 8], ebx
mov dword [esp + 0xc], edx
push edi
mov edi, dword [esp + 0x1c]
test edx, edx
je 0x46434a
mov esi, dword [edx + 0x9c]
test esi, esi
je 0x46434a
cmp dword [esi], ebx
jne 0x464100
pop edi
pop esi
lea eax, [ebx - 0x64]
pop ebx
add esp, 0xc
ret
mov dword [esi + 0x10], eax
mov edx, edi
mov eax, dword [esi + 0x5c]
mov dword [esi + 0x14], edi
cmp edi, eax
jbe 0x46411c
cmp dword [esi + 0x8c], ebx
jne 0x46411c
mov dword [esi + 0x14], eax
mov edx, eax
mov eax, dword [esi + 8]
add eax, dword [esi + 0x58]
cmp edi, eax
jbe 0x464133
cmp dword [esi + 0x8c], ebx
je 0x464133
mov dword [esi + 0x14], eax
mov edx, eax
push ebp
test edx, edx
je 0x464340
mov ebp, dword [esi + 8]
mov edi, 0xfffffffd
test ebp, ebp
jne 0x464268
mov eax, dword [esi + 0x58]
test eax, eax
je 0x464268
mov ebp, 0x4000
cmp eax, ebp
push 0
cmovb ebp, eax
mov eax, dword [esi + 0x88]
add eax, dword [esi + 0x3c]
push eax
push dword [esi + 0x80]
mov eax, dword [esi + 0x70]
push dword [esi + 0x7c]
call eax
add esp, 0x10
test eax, eax
jne 0x464335
mov eax, dword [esi + 0x64]
push ebp
push dword [esi]
push dword [esi + 0x80]
push dword [esi + 0x7c]
call eax
add esp, 0x10
cmp eax, ebp
jne 0x464335
mov edx, dword [esp + 0x14]
cmp dword [edx + 0xa0], 0
je 0x46425a
xor edi, edi
mov dword [esp + 0x18], edi
test ebp, ebp
je 0x464255
mov ecx, dword [edx + 0xac]
mov eax, dword [esi]
and ecx, 0xfffd
or ecx, 2
mov ebx, ecx
xor ebx, 1
imul ebx, ecx
shr ebx, 8
xor bl, byte [eax + edi]
mov byte [eax + edi], bl
mov edi, dword [edx + 0xb0]
mov edx, dword [edx + 0xa4]
mov eax, edx
movsx ecx, bl
xor eax, ecx
shr edx, 8
movzx eax, al
mov eax, dword [edi + eax*4]
xor eax, edx
mov edx, dword [esp + 0x14]
mov ecx, dword [edx + 0xac]
mov dword [edx + 0xa4], eax
movzx eax, al
add eax, dword [edx + 0xa8]
imul eax, eax, 0x8088405
inc eax
mov dword [edx + 0xa8], eax
shr eax, 0x18
xor eax, ecx
shr ecx, 8
movzx eax, al
xor ecx, dword [edi + eax*4]
mov edi, dword [esp + 0x18]
mov dword [edx + 0xac], ecx
mov eax, dword [esi]
mov byte [edi + eax], bl
inc edi
mov dword [esp + 0x18], edi
cmp edi, ebp
jb 0x4641c1
mov ebx, dword [esp + 0x10]
mov edi, 0xfffffffd
add dword [esi + 0x3c], ebp
mov eax, dword [esi]
sub dword [esi + 0x58], ebp
mov dword [esi + 4], eax
mov dword [esi + 8], ebp
cmp dword [esi + 0x84], 0
je 0x4642d9
cmp dword [esi + 0x8c], 0
jne 0x4642d9
mov eax, dword [esi + 0x10]
mov ebp, dword [esi + 0x18]
mov dword [esp + 0x18], eax
lea eax, [esi + 4]
push 2
push eax
call fcn.00405e40
mov ebx, eax
add esp, 8
test ebx, ebx
js 0x46429f
cmp dword [esi + 0x1c], 0
cmovne ebx, edi
mov edi, dword [esi + 0x18]
sub edi, ebp
push edi
push dword [esp + 0x1c]
push dword [esi + 0x50]
call fcn.004051b0
sub dword [esi + 0x5c], edi
add esp, 0xc
mov dword [esi + 0x50], eax
mov eax, dword [esp + 0x10]
add eax, edi
mov dword [esp + 0x10], eax
cmp ebx, 1
je 0x464338
test ebx, ebx
jne 0x464340
mov ebx, eax
mov eax, dword [esi + 0x14]
test eax, eax
jmp 0x464136
test ebp, ebp
jne 0x4642e2
cmp dword [esi + 0x58], ebp
je 0x464340
mov edi, dword [esi + 0x14]
cmp edi, ebp
cmovae edi, ebp
xor edx, edx
test edi, edi
je 0x464301
mov eax, dword [esi + 4]
mov ecx, dword [esi + 0x10]
mov al, byte [edx + eax]
mov byte [edx + ecx], al
inc edx
cmp edx, edi
jb 0x4642f0
push edi
push dword [esi + 0x10]
push dword [esi + 0x50]
call fcn.004051b0
sub dword [esi + 0x5c], edi
add ebx, edi
sub dword [esi + 8], edi
add esp, 0xc
sub dword [esi + 0x14], edi
add dword [esi + 0x10], edi
add dword [esi + 4], edi
add dword [esi + 0x18], edi
mov dword [esi + 0x50], eax
mov eax, dword [esi + 0x14]
test eax, eax
mov dword [esp + 0x10], ebx
jmp 0x464136
or eax, 0xffffffff
pop ebp
pop edi
pop esi
pop ebx
add esp, 0xc
ret
pop ebp
pop edi
pop esi
mov eax, ebx
pop ebx
add esp, 0xc
ret
pop edi
pop esi
mov eax, 0xffffff9a
pop ebx
add esp, 0xc
ret