Function at 0x4182b0
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
sub esp, 0x34
push ebx
push ebp
push esi
push edi
lea edi, [ecx + ecx*2]
mov esi, eax
mov eax, edi
mov edx, eax
and edx, 0x80000003
mov dword [esp + 0x30], edi
jns 0x4182d1
dec edx
or edx, 0xfffffffc
inc edx
je 0x4182e5
inc eax
mov edx, eax
and edx, 0x80000003
jns 0x4182e3
dec edx
or edx, 0xfffffffc
inc edx
jne 0x4182d3
mov ebp, dword [esp + 0x48]
imul ecx, esi
mov edx, eax
imul eax, esi
sub edx, edi
lea ebx, [ecx + ecx*2]
mov dword [esp + 0x34], edx
mov dword [esp + 0x20], eax
xor edi, edi
lea ecx, [ebp + 0x1404]
lea esi, [ebp + 8]
lea esp, [esp]
mov eax, edi
shl eax, 0xc
cdq
and edx, 0xff
add eax, edx
sar eax, 8
mov dword [esi + 4], eax
mov dword [esi], eax
mov dword [esi - 4], eax
mov dword [ecx + 0x400], 0x100
mov dword [ecx], 0
inc edi
add ecx, 4
add esi, 0x10
cmp edi, 0x100
jl 0x418310
mov esi, dword [esp + 0x50]
lea ecx, [esi - 1]
mov eax, 0x55555556
imul ecx
mov eax, edx
shr eax, 0x1f
lea ecx, [edx + eax + 0x1e]
mov edx, dword [esp + 0x20]
mov dword [esp + 0x40], ecx
mov ecx, dword [esp + 0x4c]
add edx, ecx
mov dword [esp + 0x38], edx
mov eax, ebx
cdq
lea esi, [esi + esi*2]
idiv esi
mov dword [esp + 0x50], ecx
mov dword [esp + 0x4c], 0x400
mov dword [esp + 0x24], 0x800
mov dword [esp + 0x10], 0x20
lea edi, [ebp + 0x1c04]
mov edx, eax
mov dword [esp + 0x28], edx
mov eax, 0x51eb851f
imul edx
sar edx, 5
mov eax, edx
shr eax, 0x1f
add eax, edx
mov dword [esp + 0x3c], eax
xor esi, esi
jmp 0x4183c0
mov edx, esi
imul edx, esi
mov eax, 0x400
sub eax, edx
shl eax, 8
cdq
and edx, 0x3ff
add eax, edx
sar eax, 0xa
shl eax, 0xa
mov dword [edi], eax
inc esi
add edi, 4
cmp esi, 0x20
jl 0x4183c0
mov eax, 0x20d56b39
imul ebx
sar edx, 6
mov eax, edx
shr eax, 0x1f
add eax, edx
imul eax, eax, 0x1f3
mov edx, ebx
sub edx, eax
je 0x418410
mov dword [esp + 0x14], 0x5d9
jmp 0x418461
mov eax, 0x42bcbdc9
imul ebx
sar edx, 7
mov eax, edx
shr eax, 0x1f
add eax, edx
imul eax, eax, 0x1eb
mov edx, ebx
sub edx, eax
je 0x418437
mov dword [esp + 0x14], 0x5c1
jmp 0x418461
mov eax, 0x43491159
imul ebx
sar edx, 7
mov eax, edx
shr eax, 0x1f
add eax, edx
imul eax, eax, 0x1e7
sub ebx, eax
neg ebx
sbb ebx, ebx
and ebx, 0xffffffd0
add ebx, 0x5e5
mov dword [esp + 0x14], ebx
xor eax, eax
cmp dword [esp + 0x28], eax
mov dword [esp + 0x18], eax
mov dword [esp + 0x1c], eax
jle 0x418602
jmp 0x418484
mov ecx, dword [esp + 0x50]
movzx ebx, byte [ecx + 2]
movzx edi, byte [ecx + 1]
movzx esi, byte [ecx]
shl ebx, 4
push ebx
shl edi, 4
push edi
shl esi, 4
push esi
push ebp
call fcn.00418690
mov dword [esp + 0x2c], eax
shl eax, 4
lea ecx, [eax + ebp + 4]
mov ebp, dword [ecx]
mov eax, ebp
sub eax, esi
imul eax, dword [esp + 0x4c]
cdq
and edx, 0x3ff
add eax, edx
sar eax, 0xa
sub ebp, eax
mov dword [ecx], ebp
mov ebp, dword [ecx + 4]
add ecx, 4
mov eax, ebp
sub eax, edi
imul eax, dword [esp + 0x4c]
cdq
and edx, 0x3ff
add eax, edx
sar eax, 0xa
sub ebp, eax
mov dword [ecx], ebp
mov ebp, dword [ecx + 4]
add ecx, 4
mov eax, ebp
sub eax, ebx
imul eax, dword [esp + 0x4c]
cdq
and edx, 0x3ff
add eax, edx
mov edx, dword [esp + 0x10]
sar eax, 0xa
sub ebp, eax
mov dword [ecx], ebp
test edx, edx
je 0x41851d
mov eax, dword [esp + 0x2c]
mov ecx, dword [esp + 0x48]
push ebx
push edi
push esi
call fcn.00418890
mov edx, dword [esp + 0x14]
mov ecx, dword [esp + 0x50]
mov eax, dword [esp + 0x18]
add ecx, edx
add eax, edx
mov edx, dword [esp + 0x30]
cmp eax, edx
mov dword [esp + 0x50], ecx
mov dword [esp + 0x18], eax
jl 0x418552
lea ecx, [ecx]
add ecx, dword [esp + 0x34]
sub eax, edx
cmp eax, edx
jge 0x418540
mov dword [esp + 0x50], ecx
mov dword [esp + 0x18], eax
cmp ecx, dword [esp + 0x38]
jb 0x418560
sub ecx, dword [esp + 0x20]
mov dword [esp + 0x50], ecx
mov eax, dword [esp + 0x1c]
inc eax
mov dword [esp + 0x1c], eax
cdq
idiv dword [esp + 0x3c]
test edx, edx
jne 0x4185f0
mov ebp, dword [esp + 0x4c]
mov eax, ebp
cdq
idiv dword [esp + 0x40]
mov ecx, dword [esp + 0x24]
sub ebp, eax
mov eax, 0x77777777
imul ecx
sub edx, ecx
sar edx, 4
mov eax, edx
shr eax, 0x1f
add eax, edx
add ecx, eax
mov eax, ecx
sar eax, 6
cmp eax, 1
mov dword [esp + 0x4c], ebp
mov dword [esp + 0x24], ecx
mov dword [esp + 0x10], eax
jg 0x4185ba
mov dword [esp + 0x10], 0
mov eax, dword [esp + 0x10]
xor ecx, ecx
test eax, eax
jle 0x4185f0
mov ebx, dword [esp + 0x10]
mov edi, dword [esp + 0x48]
mov esi, ebx
imul esi, ebx
add edi, 0x1c04
mov edx, ecx
imul edx, ecx
mov eax, esi
sub eax, edx
shl eax, 8
cdq
idiv esi
inc ecx
add edi, 4
imul eax, ebp
cmp ecx, ebx
mov dword [edi - 4], eax
jl 0x4185d3
mov eax, dword [esp + 0x1c]
cmp eax, dword [esp + 0x28]
mov ebp, dword [esp + 0x48]
jl 0x418480
mov eax, ebp
call fcn.00418620
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x34
ret 0xc