Function at 0x476e80
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
mov eax, dword [esp + 0x18]
mov ecx, dword [0x58a5a0]
sub esp, 0x834
test eax, eax
push ebx
push ebp
push esi
push edi
jge 0x476eae
mov eax, ecx
mov dword [esp + 0x38], 0x52
neg eax
mov dword [esp + 0x30], eax
mov dword [esp + 0x34], eax
jmp 0x476ebe
mov dword [esp + 0x30], ecx
mov dword [esp + 0x34], ecx
mov dword [esp + 0x38], 0x50
lea eax, [ecx*4]
and eax, 0x3ff
shl ecx, 3
mov eax, dword [eax*4 + 0x4ca918]
and ecx, 0x3ff
cdq
and edx, 0x1fff
add eax, edx
mov ebp, eax
mov eax, dword [ecx*4 + 0x4ca918]
cdq
mov ecx, dword [esp + 0x858]
and edx, 0x3ff
add eax, edx
sar eax, 0xa
add eax, 0x50
shl ecx, 8
mov dword [esp + 0x40], eax
mov eax, ecx
cdq
idiv dword [esp + 0x850]
sar ebp, 0xd
add ebp, 0x28
mov dword [esp + 0x85c], ebp
mov edi, eax
mov eax, ecx
cdq
idiv dword [esp + 0x854]
mov ecx, dword [esp + 0x848]
mov dword [esp + 0x3c], edi
lea esi, [edi + ecx]
test esi, esi
mov ebx, eax
mov dword [esp + 0x14], ebx
jl 0x4772ca
mov eax, dword [0x60879c]
mov edx, ecx
sub edx, edi
cmp edx, eax
jge 0x4772ca
mov edx, dword [esp + 0x84c]
lea eax, [ebx + edx]
test eax, eax
mov dword [esp + 0x2c], eax
jl 0x4772ca
mov eax, dword [0x608798]
sub edx, ebx
cmp edx, eax
jge 0x4772ca
mov edx, edi
neg edx
mov eax, edx
mov dword [esp + 0x20], eax
add eax, ecx
test eax, eax
jge 0x476f96
mov eax, ecx
neg eax
mov dword [esp + 0x20], eax
mov eax, dword [esp + 0x84c]
neg ebx
add eax, ebx
test eax, eax
jge 0x476fae
mov ebx, dword [esp + 0x84c]
neg ebx
mov eax, dword [0x60879c]
mov dword [esp + 0x28], edi
cmp esi, eax
jl 0x476fc1
sub eax, ecx
mov dword [esp + 0x28], eax
mov esi, dword [esp + 0x2c]
mov eax, dword [esp + 0x14]
cmp esi, dword [0x608798]
mov dword [esp + 0x10], eax
jl 0x476fe7
mov eax, dword [0x608798]
mov esi, dword [esp + 0x84c]
sub eax, esi
mov dword [esp + 0x10], eax
cmp edx, edi
jge 0x47703a
mov esi, edx
lea ecx, [edi + edx]
imul esi, dword [esp + 0x850]
shl ecx, 2
sub edi, edx
mov eax, esi
add ecx, 4
cdq
and edx, 0xff
add eax, edx
sar eax, 8
mov edx, eax
imul edx, eax
imul eax, ebp
mov dword [esp + ecx + 0x440], edx
mov edx, dword [esp + 0x850]
shl eax, 1
mov dword [esp + ecx + 0x40], eax
add esi, edx
dec edi
jne 0x476ffd
mov ecx, dword [esp + 0x848]
mov eax, dword [esp + 0x10]
mov edx, dword [esp + 0x858]
imul edx, edx
mov dword [esp + 0x2c], edx
mov edx, dword [0x608764]
cmp edx, 8
mov edx, dword [esp + 0x84c]
jne 0x477192
lea edi, [ebx + edx]
mov ebp, dword [esp + 0x20]
imul edi, dword [0x6087a0]
mov edx, dword [0x6087a4]
add edi, ebp
add edi, ecx
add edi, edx
cmp ebx, eax
mov dword [esp + 0x24], edi
jge 0x4772ca
mov ecx, ebx
imul ecx, dword [esp + 0x854]
sub eax, ebx
mov dword [esp + 0x18], ecx
mov dword [esp + 0x1c], eax
mov eax, ecx
cdq
and edx, 0xff
add eax, edx
mov edx, dword [esp + 0x28]
sar eax, 8
mov ebp, eax
imul ebp, eax
imul eax, dword [esp + 0x85c]
shl eax, 1
mov dword [esp + 0x10], eax
mov eax, dword [esp + 0x20]
cmp eax, edx
jge 0x47715f
mov ecx, dword [esp + 0x3c]
lea esi, [eax + ecx]
shl esi, 2
sub eax, edi
mov dword [esp + 0x14], eax
mov ecx, dword [esp + 0x2c]
mov ebx, dword [esp + esi + 0x444]
mov eax, dword [esp + esi + 0x44]
sub ecx, ebx
sub ecx, ebp
js 0x477145
mov ebx, dword [esp + 0x40]
xor edx, edx
mov dl, byte [ecx + 0x4cb918]
mov ecx, edx
cdq
add ecx, ebx
idiv ecx
mov edx, dword [esp + 0x30]
mov ebx, eax
mov eax, dword [esp + 0x10]
add ebx, edx
cdq
idiv ecx
mov edx, dword [esp + 0x34]
and ebx, 0x7f
xor ecx, ecx
add eax, edx
and eax, 0x7f
shl eax, 7
mov cl, byte [ebx + eax + 0x5c08a0]
mov eax, ecx
cmp eax, 4
jge 0x477145
mov edx, dword [esp + 0x38]
add edx, eax
shl edx, 8
xor eax, eax
mov al, byte [edi]
mov cl, byte [edx + eax + 0x5b0880]
mov byte [edi], cl
mov edx, dword [esp + 0x14]
mov eax, dword [esp + 0x28]
add esi, 4
inc edi
add edx, edi
cmp edx, eax
jl 0x4770d9
mov edi, dword [esp + 0x24]
mov ecx, dword [esp + 0x18]
mov esi, dword [0x6087a0]
mov edx, dword [esp + 0x854]
mov eax, dword [esp + 0x1c]
add edi, esi
add ecx, edx
dec eax
mov dword [esp + 0x24], edi
mov dword [esp + 0x18], ecx
mov dword [esp + 0x1c], eax
jne 0x477098
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x834
ret
add edx, ebx
mov esi, dword [esp + 0x20]
imul edx, dword [0x6087a0]
add esi, ecx
mov ecx, dword [0x6087a4]
add ecx, edx
cmp ebx, eax
lea edi, [ecx + esi*2]
mov dword [esp + 0x18], edi
jge 0x4772ca
mov ecx, ebx
imul ecx, dword [esp + 0x854]
sub eax, ebx
mov dword [esp + 0x24], ecx
mov dword [esp + 0x14], eax
mov eax, ecx
cdq
and edx, 0xff
add eax, edx
mov edx, dword [esp + 0x28]
sar eax, 8
mov ebp, eax
imul ebp, eax
imul eax, dword [esp + 0x85c]
shl eax, 1
mov dword [esp + 0x10], eax
mov eax, dword [esp + 0x20]
cmp eax, edx
jge 0x47729e
mov ecx, dword [esp + 0x3c]
lea esi, [eax + ecx]
shl esi, 2
sub edx, eax
mov dword [esp + 0x1c], edx
mov ecx, dword [esp + 0x2c]
mov ebx, dword [esp + esi + 0x444]
mov eax, dword [esp + esi + 0x44]
sub ecx, ebx
sub ecx, ebp
js 0x477285
mov ebx, dword [esp + 0x40]
xor edx, edx
mov dl, byte [ecx + 0x4cb918]
mov ecx, edx
cdq
add ecx, ebx
idiv ecx
mov edx, dword [esp + 0x30]
mov ebx, eax
mov eax, dword [esp + 0x10]
add ebx, edx
cdq
idiv ecx
mov edx, dword [esp + 0x34]
and ebx, 0x7f
xor ecx, ecx
add eax, edx
and eax, 0x7f
shl eax, 7
mov cl, byte [ebx + eax + 0x5c08a0]
mov eax, ecx
cmp eax, 4
jge 0x477285
mov edx, dword [esp + 0x38]
mov ebx, dword [0x5f9144]
add edx, eax
mov ax, word [edi]
shr ax, 1
mov cx, word [edx*4 + 0x5cb920]
and eax, ebx
add cx, ax
mov word [edi], cx
mov eax, dword [esp + 0x1c]
add esi, 4
add edi, 2
dec eax
mov dword [esp + 0x1c], eax
jne 0x47720d
mov ecx, dword [esp + 0x24]
mov edi, dword [esp + 0x18]
mov esi, dword [0x6087a0]
mov edx, dword [esp + 0x854]
mov eax, dword [esp + 0x14]
add edi, esi
add ecx, edx
dec eax
mov dword [esp + 0x18], edi
mov dword [esp + 0x24], ecx
mov dword [esp + 0x14], eax
jne 0x4771cc
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x834
ret