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

Disassembly:
push ecx
push ebx
push ebp
mov ebp, ecx
push esi
push edi
cmp byte [ebp + 0xe8], 0xff
jne 0x470720
mov eax, dword [esp + 0x18]
test eax, eax
je 0x470720
mov ecx, dword [esp + 0x1c]
test ecx, ecx
je 0x470720
mov dword [ebp + 0x34], eax
mov eax, dword [ebp + 0x60]
cmp ecx, eax
ja 0x4704f8
mov eax, ecx
test eax, eax
mov dword [ebp + 0x38], eax
mov dword [esp + 0x1c], 0
jne 0x470513
mov eax, dword [ebp + 0x64]
mov byte [esp + 0x18], 1
test eax, eax
ja 0x470518
mov byte [esp + 0x18], 0
mov eax, dword [ebp + 0x38]
test eax, eax
ja 0x470536
mov al, byte [esp + 0x18]
test al, al
je 0x470714
mov eax, dword [ebp + 0x64]
test eax, eax
jbe 0x470714
mov eax, dword [ebp + 0x2c]
test eax, eax
jne 0x470632
mov eax, dword [ebp + 0x64]
test eax, eax
jbe 0x470632
mov esi, dword [ebp + 0x74]
cmp eax, esi
mov dword [esp + 0x10], esi
jae 0x47055d
mov dword [esp + 0x10], eax
mov esi, eax
test esi, esi
je 0x470720
mov eax, dword [ebp + 0x70]
push 0
push esi
push eax
lea ecx, [ebp + 0x78]
call fcn.00473b20
mov ecx, dword [ebp + 0x114]
call fcn.0046fa50
test al, al
je 0x470621
xor edi, edi
test esi, esi
jbe 0x470621
mov ecx, dword [ebp + 0x1c]
mov eax, dword [ebp + 0x70]
and ecx, 0xfffd
add eax, edi
or ecx, 2
mov edx, ecx
mov bl, byte [eax]
xor edx, 1
imul edx, ecx
sar edx, 8
xor bl, dl
mov byte [eax], bl
mov esi, dword [ebp + 0x14]
call fcn.005aa170
mov ecx, esi
and ebx, 0xff
and ecx, 0xff
xor ebx, ecx
shr esi, 8
mov eax, dword [eax + ebx*4]
mov ebx, dword [ebp + 0x18]
xor eax, esi
mov esi, dword [ebp + 0x1c]
mov dword [ebp + 0x14], eax
and eax, 0xff
add eax, ebx
imul eax, eax, 0x8088405
inc eax
mov ebx, eax
mov dword [ebp + 0x18], eax
shr ebx, 0x18
call fcn.005aa170
mov edx, esi
and ebx, 0xff
and edx, 0xff
xor ebx, edx
shr esi, 8
mov eax, dword [eax + ebx*4]
xor eax, esi
inc edi
mov dword [ebp + 0x1c], eax
mov eax, dword [esp + 0x10]
cmp edi, eax
jb 0x470591
mov esi, eax
mov eax, dword [ebp + 0x64]
sub eax, esi
mov dword [ebp + 0x64], eax
mov ecx, dword [ebp + 0x70]
mov dword [ebp + 0x28], ecx
mov dword [ebp + 0x2c], esi
mov edx, dword [ebp + 0x114]
cmp word [edx + 0xe], 0
jne 0x4706b1
mov eax, dword [ebp + 0x38]
mov ebx, dword [ebp + 0x2c]
cmp eax, ebx
jae 0x47064b
mov ebx, eax
mov esi, dword [ebp + 0x28]
mov edi, dword [ebp + 0x34]
mov ecx, ebx
push ebx
mov eax, ecx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov ecx, dword [ebp + 0x34]
mov edx, dword [ebp + 0x68]
push ecx
push edx
call fcn.005aa180
mov ecx, dword [ebp + 0x60]
mov edi, dword [ebp + 0x38]
mov esi, dword [ebp + 0x34]
mov edx, dword [ebp + 0x28]
mov dword [ebp + 0x68], eax
mov eax, dword [ebp + 0x2c]
sub ecx, ebx
sub eax, ebx
mov dword [ebp + 0x60], ecx
mov ecx, dword [ebp + 0x3c]
mov dword [ebp + 0x2c], eax
mov eax, dword [esp + 0x1c]
sub edi, ebx
add esi, ebx
add edx, ebx
add ecx, ebx
add eax, ebx
mov dword [ebp + 0x38], edi
mov dword [ebp + 0x34], esi
mov dword [ebp + 0x28], edx
mov dword [ebp + 0x3c], ecx
mov dword [esp + 0x1c], eax
jmp 0x470518
mov eax, dword [ebp + 0x34]
mov ebx, dword [ebp + 0x3c]
lea ecx, [ebp + 0x28]
push 2
push ecx
mov dword [esp + 0x18], eax
call fcn.005a9ba0
mov esi, dword [ebp + 0x3c]
mov edx, dword [esp + 0x10]
sub esi, ebx
mov edi, eax
mov eax, dword [ebp + 0x68]
push esi
push edx
push eax
call fcn.005aa180
mov edx, dword [ebp + 0x60]
mov ecx, dword [esp + 0x1c]
sub edx, esi
add ecx, esi
cmp edi, 1
mov dword [ebp + 0x68], eax
mov dword [ebp + 0x60], edx
mov dword [esp + 0x1c], ecx
je 0x470714
test edi, edi
je 0x470518
cmp edi, 2
je 0x470518
push edi
mov ecx, ebp
call fcn.0046fec0
jmp 0x470518
mov eax, dword [esp + 0x1c]
pop edi
pop esi
pop ebp
pop ebx
pop ecx
ret 8
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
pop ecx
ret 8