Function at 0x10170e90
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 0x101710f0
mov eax, dword [esp + 0x18]
test eax, eax
je 0x101710f0
mov ecx, dword [esp + 0x1c]
test ecx, ecx
je 0x101710f0
mov dword [ebp + 0x34], eax
mov eax, dword [ebp + 0x60]
cmp ecx, eax
ja 0x10170ec8
mov eax, ecx
test eax, eax
mov dword [ebp + 0x38], eax
mov dword [esp + 0x1c], 0
jne 0x10170ee3
mov eax, dword [ebp + 0x64]
mov byte [esp + 0x18], 1
test eax, eax
ja 0x10170ee8
mov byte [esp + 0x18], 0
mov eax, dword [ebp + 0x38]
test eax, eax
ja 0x10170f06
mov al, byte [esp + 0x18]
test al, al
je 0x101710e4
mov eax, dword [ebp + 0x64]
test eax, eax
jbe 0x101710e4
mov eax, dword [ebp + 0x2c]
test eax, eax
jne 0x10171002
mov eax, dword [ebp + 0x64]
test eax, eax
jbe 0x10171002
mov esi, dword [ebp + 0x74]
cmp eax, esi
mov dword [esp + 0x10], esi
jae 0x10170f2d
mov dword [esp + 0x10], eax
mov esi, eax
test esi, esi
je 0x101710f0
mov eax, dword [ebp + 0x70]
push 0
push esi
push eax
lea ecx, [ebp + 0x78]
call fcn.10174fa0
mov ecx, dword [ebp + 0x114]
call fcn.10174bf0
test al, al
je 0x10170ff1
xor edi, edi
test esi, esi
jbe 0x10170ff1
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.101cfef0
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.101cfef0
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 0x10170f61
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 0x10171081
mov eax, dword [ebp + 0x38]
mov ebx, dword [ebp + 0x2c]
cmp eax, ebx
jae 0x1017101b
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.101cff00
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 0x10170ee8
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.1016bf50
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.101cff00
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 0x101710e4
test edi, edi
je 0x10170ee8
cmp edi, 2
je 0x10170ee8
push edi
mov ecx, ebp
call fcn.10170890
jmp 0x10170ee8
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