Function at 0x417730
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
sub esp, 0x198
mov eax, dword [0x5b0c20]
xor eax, esp
mov dword [esp + 0x194], eax
mov eax, dword [esp + 0x1b8]
mov dword [esp + 8], eax
push ebx
mov ebx, dword [esp + 0x1b0]
mov ecx, dword [esp + 0x1b8]
lea eax, [ebx + 0x3f]
cdq
and edx, 0x3f
add eax, edx
push ebp
mov ebp, dword [esp + 0x1ac]
push esi
mov esi, eax
lea eax, [ebp + 0x3f]
cdq
and edx, 0x3f
add eax, edx
push edi
mov edi, eax
sar esi, 6
sar edi, 6
shl esi, 6
shl edi, 6
lea eax, [edi + esi]
mov dword [esp + 0x10], eax
add eax, 0x40
cmp eax, 0xfa
mov dword [esp + 0x1c], ecx
jg 0x4179e1
cmp dword [esp + 0x1b0], 0
je 0x4179e1
cmp dword [esp + 0x1b8], 0
je 0x4179e1
test ecx, ecx
je 0x4179e1
push 0x40
lea ecx, [esp + 0xa8]
push 3
push ecx
call fcn.00526520
add esp, 0xc
xor ecx, ecx
test esi, esi
jle 0x4177fc
mov eax, ecx
cdq
idiv ebx
mov eax, dword [esp + 0x1b8]
inc ecx
cmp ecx, esi
mov dl, byte [edx + eax]
mov byte [esp + ecx + 0xe3], dl
jl 0x4177e1
xor ecx, ecx
test edi, edi
jle 0x417828
lea esi, [esp + esi + 0xe4]
lea esp, [esp]
mov eax, ecx
cdq
idiv ebp
mov eax, dword [esp + 0x1b0]
inc ecx
cmp ecx, edi
mov dl, byte [edx + eax]
mov byte [esi + ecx - 1], dl
jl 0x417810
cmp dword [esp + 0x1c8], 0
jle 0x4179da
mov ebp, dword [esp + 0x1ac]
lea ecx, [ecx]
mov edi, dword [esp + 0x1c0]
xor esi, esi
test edi, edi
jle 0x41789c
lea ecx, [ecx]
push ebp
call fcn.004172b0
add esp, 4
test eax, eax
je 0x4179e1
push 0x14
lea eax, [esp + 0x28]
test esi, esi
jne 0x41787e
push eax
mov eax, dword [esp + 0x18]
add eax, 0x40
push eax
lea ecx, [esp + 0xb0]
push ecx
jmp 0x417886
lea edx, [esp + 0x28]
push edx
push 0x14
push eax
push ebp
call fcn.004172e0
add esp, 0x14
test eax, eax
je 0x4179e1
inc esi
cmp esi, edi
jl 0x417850
mov ebx, dword [esp + 0x18]
cmp ebx, 0x14
mov esi, 0x14
jg 0x4178ac
mov esi, ebx
mov edi, dword [esp + 0x1c]
push esi
lea ecx, [esp + 0x28]
push ecx
push edi
call fcn.005257e0
add edi, esi
add esp, 0xc
sub ebx, esi
mov dword [esp + 0x1c], edi
mov dword [esp + 0x18], ebx
je 0x4179da
xor ecx, ecx
mov eax, 0xcccccccd
mul ecx
shr edx, 4
lea edx, [edx + edx*4]
add edx, edx
add edx, edx
mov eax, ecx
sub eax, edx
mov dl, byte [esp + eax + 0x24]
mov byte [esp + ecx + 0x64], dl
inc ecx
cmp ecx, 0x40
jl 0x4178d3
xor eax, eax
cmp dword [esp + 0x10], eax
mov dword [esp + 0x20], eax
jle 0x4179d2
lea ecx, [esp + 0x64]
lea edx, [esp + 0xe4]
sub ecx, edx
mov dword [esp + 0x14], ecx
jmp 0x417920
mov edx, 1
xor ecx, ecx
lea esi, [esp + 0xa1]
lea eax, [esp + eax + 0x123]
lea edi, [edx + 0xf]
jmp 0x417940
mov ebx, dword [esp + 0x14]
movzx ebx, byte [eax + ebx]
movzx ebp, byte [eax]
add ebx, ecx
movzx ecx, byte [esi + 1]
add ebp, ebx
add edx, ebp
mov byte [eax], dl
mov ebx, 0xff
cmp ebx, edx
sbb edx, edx
neg edx
add ecx, edx
movzx edx, byte [eax - 1]
add ecx, edx
mov byte [eax - 1], cl
mov edx, ebx
cmp edx, ecx
movzx edx, byte [eax - 2]
sbb ecx, ecx
neg ecx
add ecx, edx
movzx edx, byte [esi]
add ecx, edx
movzx edx, byte [esi - 1]
cmp ebx, ecx
mov byte [eax - 2], cl
sbb ecx, ecx
neg ecx
add edx, ecx
movzx ecx, byte [eax - 3]
add edx, ecx
mov ecx, ebx
cmp ecx, edx
sbb ecx, ecx
mov byte [eax - 3], dl
neg ecx
xor edx, edx
sub eax, 4
sub esi, 4
sub edi, 1
jne 0x417940
mov eax, dword [esp + 0x20]
sub dword [esp + 0x14], 0x40
add eax, 0x40
cmp eax, dword [esp + 0x10]
mov dword [esp + 0x20], eax
jl 0x417920
mov ebp, dword [esp + 0x1ac]
mov ebx, dword [esp + 0x18]
test ebx, ebx
jg 0x417840
mov eax, 1
jmp 0x4179e3
xor eax, eax
mov ecx, dword [esp + 0x1a4]
pop edi
pop esi
pop ebp
pop ebx
xor ecx, esp
call fcn.00524d83
add esp, 0x198
ret 0x20