Function at 0x4040b0
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
sub esp, 0xb88
push ebx
push ebp
push esi
push edi
mov edi, dword [esp + 0xb9c]
mov dword [esp + 0x14], 0
mov edx, dword [edi + 0xc]
mov eax, dword [edi]
cmp edx, 0xfa
mov dword [esp + 0x4c], eax
jne 0x4040ee
mov eax, 4
mov ecx, 2
mov dword [esp + 0x30], eax
mov dword [esp + 0x20], ecx
jmp 0x4040f6
mov eax, dword [esp + 0x30]
mov ecx, dword [esp + 0x20]
cmp edx, 0x1f4
jne 0x404110
mov eax, 8
mov ecx, 3
mov dword [esp + 0x30], eax
mov dword [esp + 0x20], ecx
imul eax, eax
mov ebx, dword [edi + 4]
mov esi, dword [edi + 8]
mov dword [esp + 0x3c], eax
mov eax, ebx
mov edx, esi
mov dword [esp + 0x1c], ebx
sar eax, cl
sar edx, cl
mov dword [esp + 0x34], esi
cmp eax, 0x27
mov dword [esp + 0x28], eax
mov dword [esp + 0x2c], edx
jg 0x404809
cmp edx, 0x2e
jg 0x404809
mov ebp, edx
imul ebp, eax
test ebp, ebp
mov dword [esp + 0x38], ebp
jle 0x404809
mov ecx, dword [edi + 0x14]
push ebp
push 0
push ecx
call fcn.00404040
push 0x400
lea edx, [esp + 0xa4]
push 0
push edx
call fcn.00404040
add esp, 0x18
xor ecx, ecx
test esi, esi
mov dword [esp + 0x24], 0
mov dword [esp + 0x10], ecx
jle 0x4042cd
xor ebp, ebp
test ebx, ebx
jle 0x4042b9
mov eax, dword [esp + 0x30]
lea edx, [ecx + eax]
mov dword [esp + 0x44], edx
jmp 0x4041b0
mov ecx, dword [esp + 0x10]
mov edx, dword [esp + 0x44]
cmp ecx, edx
lea esi, [esp + 0x54]
jge 0x4041e8
mov eax, dword [esp + 0x30]
lea edi, [eax + ebp]
mov eax, ecx
imul eax, ebx
add eax, dword [esp + 0x4c]
sub edx, ecx
cmp ebp, edi
mov ecx, ebp
jge 0x4041e3
or bl, 0xff
sub bl, byte [eax + ecx]
inc esi
inc ecx
mov byte [esi - 1], bl
cmp ecx, edi
jl 0x4041d0
mov ebx, dword [esp + 0x1c]
add eax, ebx
dec edx
jne 0x4041ca
mov ecx, dword [esp + 0x3c]
xor esi, esi
test ecx, ecx
lea eax, [esp + 0x54]
jle 0x404200
xor edx, edx
mov dl, byte [eax]
add esi, edx
inc eax
dec ecx
jne 0x4041f6
mov edx, dword [esp + 0x20]
mov eax, esi
xor esi, esi
lea edi, [esp + 0x54]
lea ebx, [edx + edx]
mov ecx, ebx
sar eax, cl
mov byte [esp + 0x48], al
mov eax, dword [esp + 0x3c]
test eax, eax
jle 0x404256
mov ecx, dword [esp + 0x48]
mov dword [esp + 0x18], eax
and ecx, 0xff
mov dword [esp + 0x50], ecx
mov ecx, dword [esp + 0x50]
xor eax, eax
mov al, byte [edi]
sub eax, ecx
inc edi
push eax
call fcn.00404070
add esi, eax
mov eax, dword [esp + 0x1c]
add esp, 4
dec eax
mov dword [esp + 0x18], eax
jne 0x404231
mov edx, dword [esp + 0x20]
mov eax, esi
mov esi, dword [esp + 0x10]
mov ecx, ebx
mov edi, ebp
sar eax, cl
mov ecx, edx
mov edx, dword [esp + 0x24]
sar esi, cl
sar edi, cl
mov byte [esp + 0x40], al
imul esi, dword [esp + 0x28]
lea ecx, [esp + edi + 0x494]
mov byte [ecx + esi], al
mov eax, dword [esp + 0x40]
mov ecx, dword [esp + 0x30]
and eax, 0xff
add edx, eax
add ebp, ecx
mov esi, dword [esp + eax*4 + 0x94]
mov dword [esp + 0x24], edx
inc esi
mov dword [esp + eax*4 + 0x94], esi
mov eax, dword [esp + 0x1c]
cmp ebp, eax
mov ebx, eax
jl 0x4041a8
mov esi, dword [esp + 0x34]
mov ecx, dword [esp + 0x10]
add ecx, dword [esp + 0x30]
cmp ecx, esi
mov dword [esp + 0x10], ecx
jl 0x404191
mov ebp, dword [esp + 0x38]
mov eax, dword [esp + 0x24]
cdq
idiv ebp
test al, al
mov byte [esp + 0x34], al
je 0x404809
mov ecx, dword [esp + 0x34]
xor esi, esi
xor eax, eax
xor edi, edi
and ecx, 0xff
jle 0x404809
lea ebx, [esp + 0x94]
mov edx, dword [ebx]
mov ebp, edx
add esi, edx
imul ebp, edi
mov edx, esi
add eax, ebp
mov ebp, dword [esp + 0x38]
shl edx, 4
cmp edx, ebp
jg 0x40431d
inc edi
add ebx, 4
cmp edi, ecx
jl 0x4042fd
test esi, esi
jle 0x404809
cdq
idiv esi
xor esi, esi
mov byte [esp + 0x34], al
xor eax, eax
cmp ecx, 0x100
jge 0x404809
lea edi, [esp + ecx*4 + 0x94]
mov edx, dword [edi]
mov ebx, edx
add esi, edx
imul ebx, ecx
mov edx, esi
add eax, ebx
shl edx, 4
cmp edx, ebp
jg 0x404363
inc ecx
add edi, 4
cmp ecx, 0x100
jl 0x404343
test esi, esi
jle 0x404809
cdq
idiv esi
mov ecx, dword [esp + 0x34]
and ecx, 0xff
and eax, 0xff
add eax, ecx
cdq
sub eax, edx
sar eax, 1
test al, al
je 0x40438c
cmp al, 3
jae 0x40438e
mov al, 3
mov edx, dword [esp + 0xb9c]
lea esi, [esp + 0x494]
test ebp, ebp
mov ecx, dword [edx + 0x14]
jle 0x4043b8
mov edi, ebp
mov dl, byte [esi]
inc esi
cmp dl, al
jbe 0x4043b1
mov byte [ecx], 1
jmp 0x4043b4
mov byte [ecx], 0
inc ecx
dec edi
jne 0x4043a5
mov edi, dword [esp + 0x28]
mov dword [esp + 0x24], 0
mov eax, dword [esp + 0xb9c]
push ebp
lea ecx, [esp + 0x498]
mov eax, dword [eax + 0x14]
push eax
push ecx
mov dword [esp + 0x2c], eax
call fcn.00404020
mov edx, dword [esp + 0x38]
add esp, 0xc
mov dword [esp + 0x10], 1
lea eax, [edx - 1]
cmp eax, 1
mov dword [esp + 0x1c], eax
jle 0x4044cc
dec edi
mov dword [esp + 0x18], edi
mov eax, dword [esp + 0x18]
mov esi, 1
cmp eax, esi
jle 0x4044b3
mov ecx, dword [esp + 0x20]
mov edi, dword [esp + 0x10]
lea edx, [edi + 1]
lea ebp, [edi - 1]
cmp ebp, edx
mov dword [esp + 0x14], 0
jg 0x404465
mov eax, ebp
sub edx, ebp
imul eax, dword [esp + 0x28]
add eax, ecx
lea ebx, [esi - 1]
lea edi, [esi + 1]
inc edx
mov ecx, ebx
cmp ecx, edi
jg 0x40445c
mov ebp, dword [esp + 0x14]
cmp byte [eax + ecx], 0
je 0x404453
inc ebp
inc ecx
cmp ecx, edi
jle 0x40444c
mov dword [esp + 0x14], ebp
mov ebp, dword [esp + 0x28]
add eax, ebp
dec edx
jne 0x404442
mov edi, dword [esp + 0x10]
mov ecx, dword [esp + 0x20]
mov eax, edi
imul eax, dword [esp + 0x28]
lea edx, [eax + ecx]
mov bl, byte [edx + esi]
mov edx, dword [esp + 0x14]
test bl, bl
je 0x404493
cmp edx, 4
jg 0x4044a2
add eax, esi
mov byte [esp + eax + 0x494], 0
jmp 0x4044a2
cmp edx, 5
jl 0x4044a2
add eax, esi
mov byte [esp + eax + 0x494], 1
mov eax, dword [esp + 0x18]
inc esi
cmp esi, eax
jl 0x40441e
mov ebp, dword [esp + 0x38]
mov eax, dword [esp + 0x10]
mov ecx, dword [esp + 0x1c]
inc eax
cmp eax, ecx
mov dword [esp + 0x10], eax
jl 0x404405
mov edi, dword [esp + 0x28]
mov esi, dword [esp + 0x20]
lea eax, [esp + 0x494]
push ebp
push eax
push esi
call fcn.00404020
mov edx, dword [esp + 0x30]
add esp, 0xc
cmp edx, 3
jge 0x4044f5
inc edx
mov dword [esp + 0x24], edx
jmp 0x4043c4
jg 0x404534
mov ecx, dword [esp + 0x2c]
test ecx, ecx
jle 0x40450e
mov eax, esi
mov byte [eax], 0
mov byte [edi + eax - 1], 0
add eax, edi
dec ecx
jne 0x404501
xor eax, eax
test edi, edi
jle 0x404525
lea ecx, [esi + ebp - 1]
mov byte [esi + eax], 0
mov byte [ecx], 0
inc eax
dec ecx
cmp eax, edi
jl 0x404518
cmp edx, 4
jge 0x404534
inc edx
mov dword [esp + 0x24], edx
jmp 0x4043c4
mov ecx, dword [esp + 0x2c]
mov ebx, 1
dec ecx
cmp ecx, ebx
mov dword [esp + 0x1c], ecx
jle 0x404667
lea esi, [esi + edi + 1]
mov dword [esp + 0x18], esi
mov edx, 1
lea eax, [edi - 1]
cmp eax, edx
mov dword [esp + 0x10], edx
jle 0x4045d9
mov eax, esi
cmp byte [eax], 0
je 0x4045c4
cmp ebx, 4
jge 0x404572
xor ebp, ebp
jmp 0x404583
lea ecx, [edi*4]
mov esi, eax
sub esi, ecx
xor ecx, ecx
mov cl, byte [esi]
mov ebp, ecx
mov ecx, dword [esp + 0x2c]
add ecx, 0xfffffffc
cmp ebx, ecx
jl 0x404592
xor esi, esi
jmp 0x404599
xor ecx, ecx
mov cl, byte [eax + edi*4]
mov esi, ecx
cmp edx, 4
jge 0x4045a2
xor edx, edx
jmp 0x4045a7
xor edx, edx
mov dl, byte [eax - 4]
lea ecx, [edi - 4]
cmp dword [esp + 0x10], ecx
jl 0x4045b4
xor ecx, ecx
jmp 0x4045b9
xor ecx, ecx
mov cl, byte [eax + 4]
add ecx, edx
add ecx, esi
add ecx, ebp
jne 0x4045c4
mov byte [eax], 0
mov edx, dword [esp + 0x10]
lea ecx, [edi - 1]
inc edx
inc eax
cmp edx, ecx
mov dword [esp + 0x10], edx
jl 0x404564
mov ecx, dword [esp + 0x1c]
mov esi, dword [esp + 0x18]
inc ebx
add esi, edi
cmp ebx, ecx
mov dword [esp + 0x18], esi
jl 0x404552
cmp ecx, 1
jle 0x404667
mov eax, dword [esp + 0x1c]
mov edx, dword [esp + 0x20]
dec eax
lea ebp, [edi - 1]
lea esi, [edx + edi]
mov dword [esp + 0x18], eax
mov edx, 1
xor eax, eax
cmp ebp, edx
jle 0x40465a
cmp byte [esi + edx], 0
je 0x404647
cmp eax, 2
jne 0x404640
mov eax, dword [esp + 0x14]
cmp eax, edx
jge 0x404640
mov ecx, edx
lea edi, [esi + eax]
sub ecx, eax
mov eax, 0x1010101
mov ebx, ecx
shr ecx, 2
rep stosd dword es:[edi], eax
mov ecx, ebx
and ecx, 3
rep stosb byte es:[edi], al
mov edi, dword [esp + 0x28]
mov eax, 1
jmp 0x404655
cmp eax, 1
jne 0x404655
mov eax, 2
mov dword [esp + 0x14], edx
inc edx
cmp edx, ebp
jl 0x40460f
mov eax, dword [esp + 0x18]
add esi, edi
dec eax
mov dword [esp + 0x18], eax
jne 0x404604
mov ecx, 1
lea eax, [edi - 1]
cmp eax, ecx
mov dword [esp + 0x10], ecx
jle 0x404701
mov edx, dword [esp + 0x20]
lea ebp, [edx + edi + 1]
mov dword [esp + 0x18], ebp
mov esi, dword [esp + 0x1c]
mov edx, 1
xor eax, eax
cmp esi, edx
jle 0x4046ec
mov esi, edi
mov ebx, edi
imul esi, dword [esp + 0x14]
cmp byte [ebp], 0
je 0x4046d1
cmp eax, 2
jne 0x4046ca
cmp dword [esp + 0x14], edx
jge 0x4046ca
mov eax, dword [esp + 0x20]
add eax, esi
add eax, ecx
mov ecx, edx
sub ecx, dword [esp + 0x14]
mov byte [eax], 1
add eax, edi
dec ecx
jne 0x4046be
mov ecx, dword [esp + 0x10]
mov eax, 1
jmp 0x4046e1
cmp eax, 1
jne 0x4046e1
mov eax, 2
mov dword [esp + 0x14], edx
mov esi, ebx
inc edx
add ebx, edi
add ebp, edi
cmp edx, dword [esp + 0x1c]
jl 0x40469f
mov ebp, dword [esp + 0x18]
inc ecx
lea eax, [edi - 1]
inc ebp
cmp ecx, eax
mov dword [esp + 0x10], ecx
mov dword [esp + 0x18], ebp
jl 0x404687
mov eax, dword [esp + 0x1c]
mov ecx, 1
xor esi, esi
mov edi, 0x3e8
xor ebp, ebp
cmp eax, ecx
mov dword [esp + 0x2c], esi
mov dword [esp + 0x10], esi
mov dword [esp + 0x14], esi
mov ebx, edi
jle 0x404809
mov eax, dword [esp + 0x20]
mov edx, dword [esp + 0x28]
add eax, edx
mov dword [esp + 0x24], eax
mov eax, 1
dec edx
cmp edx, eax
jle 0x404786
mov edx, dword [esp + 0x24]
cmp byte [edx + eax], 0
je 0x40477c
mov edx, dword [esp + 0x2c]
inc esi
add edx, eax
mov dword [esp + 0x2c], edx
mov edx, dword [esp + 0x10]
add edx, ecx
cmp ecx, edi
mov dword [esp + 0x10], edx
jge 0x404766
mov edi, ecx
cmp ecx, dword [esp + 0x14]
jle 0x404770
mov dword [esp + 0x14], ecx
cmp eax, ebx
jge 0x404776
mov ebx, eax
cmp eax, ebp
jle 0x40477c
mov ebp, eax
mov edx, dword [esp + 0x28]
inc eax
dec edx
cmp eax, edx
jl 0x404741
mov edx, dword [esp + 0x28]
mov eax, dword [esp + 0x24]
add eax, edx
inc ecx
mov dword [esp + 0x24], eax
mov eax, dword [esp + 0x1c]
cmp ecx, eax
jl 0x404737
test esi, esi
je 0x404809
lea eax, [esi + esi*4]
mov ecx, dword [esp + 0xb9c]
lea eax, [eax + eax*4]
shl eax, 2
cdq
idiv dword [esp + 0x38]
xor edx, edx
mov dword [ecx + 0x1c], eax
mov eax, dword [esp + 0x2c]
div esi
xor edx, edx
imul eax, dword [esp + 0x30]
mov dword [ecx + 0x20], eax
mov eax, dword [esp + 0x10]
div esi
mov edx, eax
mov eax, dword [esp + 0x30]
imul edx, eax
imul edi, eax
mov dword [ecx + 0x24], edx
mov edx, dword [esp + 0x14]
imul edx, eax
imul ebx, eax
imul ebp, eax
mov dword [ecx + 0x28], edi
pop edi
mov dword [ecx + 0x34], ebp
pop esi
mov dword [ecx + 0x30], ebx
pop ebp
mov dword [ecx + 0x2c], edx
mov eax, 1
pop ebx
add esp, 0xb88
ret
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0xb88
ret