Function at 0x470850
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x48
mov eax, dword [0x58c780]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 8]
push ebx
xor ebx, ebx
push esi
push edi
cmp eax, ebx
je 0x4708aa
push eax
call fcn.004ecf40
mov esi, eax
add esp, 4
mov dword [ebp - 0x34], esi
cmp esi, ebx
je 0x4708aa
push ebx
mov edi, 8
push edi
lea eax, [ebp - 0xc]
push eax
push esi
call fcn.004ed1a0
push edi
lea ecx, [ebp - 0xc]
push ebx
push ecx
call fcn.00511f50
add esp, 0x1c
test eax, eax
je 0x4708c0
push esi
call fcn.004ed0a0
add esp, 4
xor eax, eax
lea esp, [ebp - 0x54]
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.004f3b35
mov esp, ebp
pop ebp
ret
push ebx
push ebx
push esi
call fcn.004ed130
push ebx
push ebx
push ebx
push 0x55f790
call fcn.00515c40
add esp, 0x1c
mov dword [ebp - 0x10], eax
cmp eax, ebx
je 0x4708a1
push eax
call fcn.00512450
add esp, 4
mov dword [ebp - 0x14], eax
cmp eax, ebx
jne 0x470919
push ebx
lea edx, [ebp - 0x10]
push ebx
push edx
call fcn.00516d90
push esi
call fcn.004ed0a0
add esp, 0x10
xor eax, eax
lea esp, [ebp - 0x54]
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.004f3b35
mov esp, ebp
pop ebp
ret
mov eax, dword [ebp - 0x10]
push 0x470830
push esi
push eax
call fcn.0051f960
mov ecx, dword [ebp - 0x10]
push 0x40
push fcn.004f50fc
push ecx
mov dword [ebp - 0x28], ebx
call fcn.0051f660
push ebx
push eax
call fcn.004f523c
add esp, 0x20
test eax, eax
je 0x47098c
push ebx
lea edx, [ebp - 0x14]
push edx
lea eax, [ebp - 0x10]
push eax
call fcn.00516d90
mov eax, dword [ebp - 0x28]
add esp, 0xc
cmp eax, ebx
je 0x47096a
push eax
call fcn.00464d30
add esp, 4
mov ecx, dword [ebp - 0x34]
push ecx
call fcn.004ed0a0
add esp, 4
xor eax, eax
lea esp, [ebp - 0x54]
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.004f3b35
mov esp, ebp
pop ebp
ret
mov edx, dword [ebp - 0x14]
mov eax, dword [ebp - 0x10]
push edx
push eax
call fcn.00515d00
lea ecx, [ebp - 0x48]
push ecx
lea edx, [ebp - 0x40]
push edx
lea eax, [ebp - 0x44]
push eax
lea ecx, [ebp - 0x18]
push ecx
lea edx, [ebp - 0x20]
push edx
mov edx, dword [ebp - 0x14]
lea eax, [ebp - 0x2c]
push eax
mov eax, dword [ebp - 0x10]
lea ecx, [ebp - 0x3c]
push ecx
push edx
push eax
call fcn.0051ebf0
add esp, 0x2c
test eax, eax
jne 0x4709fd
mov ecx, dword [ebp - 0x14]
mov edx, dword [ebp - 0x10]
push ecx
push edx
call fcn.00516960
push ebx
lea eax, [ebp - 0x14]
push eax
lea ecx, [ebp - 0x10]
push ecx
call fcn.00516d90
add esp, 0x14
xor eax, eax
lea esp, [ebp - 0x54]
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.004f3b35
mov esp, ebp
pop ebp
ret
mov eax, dword [ebp - 0x20]
cmp eax, 0x10
jne 0x470a10
mov edx, dword [ebp - 0x10]
push edx
call fcn.00517050
jmp 0x470a23
cmp eax, 2
je 0x470a1a
cmp eax, 4
jne 0x470a29
mov eax, dword [ebp - 0x10]
push eax
call fcn.0051e1c0
mov dword [ebp - 0x20], edi
add esp, 4
mov eax, dword [ebp - 0x18]
cmp eax, 3
jne 0x470b32
mov ecx, dword [ebp - 0x14]
mov edx, dword [ebp - 0x10]
push 0x10
push ecx
push edx
call fcn.0051ebd0
add esp, 0xc
test eax, eax
je 0x470a69
mov eax, dword [ebp - 0x10]
push eax
call fcn.005170b0
mov ecx, dword [ebp - 0x10]
push ecx
call fcn.005170b0
add esp, 8
mov dword [ebp - 0x18], 6
jmp 0x470ac7
mov ecx, dword [ebp - 0x14]
lea edx, [ebp - 0x1c]
push edx
mov edx, dword [ebp - 0x10]
lea eax, [ebp - 0x30]
push eax
push ecx
push edx
call fcn.0051ecd0
mov eax, dword [ebp - 0x20]
add esp, 0x10
mov dword [ebp - 0x24], eax
mov eax, dword [ebp - 0x18]
cmp eax, 2
jne 0x470ac2
mov ecx, dword [ebp - 0x14]
mov edx, dword [ebp - 0x10]
push 0x10
push ecx
push edx
call fcn.0051ebd0
add esp, 0xc
test eax, eax
jne 0x470b90
mov eax, dword [ebp - 0x10]
push eax
mov dword [ebp - 0x24], 0x18
mov dword [ebp - 0x1c], ebx
call fcn.0051e1a0
mov eax, dword [ebp - 0x18]
add esp, 4
cmp eax, 6
jne 0x470add
mov edx, dword [ebp - 0x10]
push edx
mov dword [ebp - 0x24], 0x20
mov dword [ebp - 0x1c], ebx
call fcn.0051e1a0
add esp, 4
mov eax, dword [ebp - 0x24]
mov ecx, dword [ebp - 0x2c]
mov edx, dword [ebp - 0x3c]
push eax
push ecx
push edx
call fcn.004654c0
mov ebx, eax
add esp, 0xc
mov dword [ebp - 0x28], ebx
test ebx, ebx
jne 0x470ba8
mov eax, dword [ebp - 0x14]
mov ecx, dword [ebp - 0x10]
push eax
push ecx
call fcn.00516960
push ebx
lea edx, [ebp - 0x14]
push edx
lea eax, [ebp - 0x10]
push eax
call fcn.00516d90
add esp, 0x14
xor eax, eax
lea esp, [ebp - 0x54]
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.004f3b35
mov esp, ebp
pop ebp
ret
cmp eax, ebx
jne 0x470b6f
mov ecx, dword [ebp - 0x14]
mov edx, dword [ebp - 0x10]
push 0x10
push ecx
push edx
call fcn.0051ebd0
add esp, 0xc
test eax, eax
je 0x470b5a
mov eax, dword [ebp - 0x10]
push eax
call fcn.005170e0
jmp 0x470a54
mov ecx, dword [ebp - 0x20]
mov edx, 1
shl edx, cl
mov dword [ebp - 0x24], ecx
mov dword [ebp - 0x1c], edx
jmp 0x470a87
cmp eax, 4
jne 0x470a8a
mov eax, dword [ebp - 0x10]
push eax
call fcn.005170e0
add esp, 4
mov dword [ebp - 0x18], 6
jmp 0x470ac7
mov ecx, dword [ebp - 0x10]
push ecx
call fcn.005170b0
add esp, 4
mov dword [ebp - 0x18], 6
jmp 0x470ac7
mov eax, dword [ebp - 0x18]
cmp eax, 3
jne 0x470bf1
mov eax, dword [ebx]
xor esi, esi
add eax, 0x28
cmp dword [ebp - 0x1c], esi
jle 0x470c31
xor ecx, ecx
inc eax
nop
mov edx, dword [ebp - 0x30]
movzx edx, byte [ecx + edx]
mov byte [eax + 1], dl
mov edx, dword [ebp - 0x30]
movzx edx, byte [ecx + edx + 1]
mov byte [eax], dl
mov edx, dword [ebp - 0x30]
movzx edx, byte [ecx + edx + 2]
mov byte [eax - 1], dl
mov byte [eax + 2], 0
inc esi
add ecx, 3
add eax, 4
cmp esi, dword [ebp - 0x1c]
jl 0x470bc0
jmp 0x470c31
test eax, eax
jne 0x470c31
mov ecx, dword [ebx]
mov eax, dword [ebp - 0x1c]
add ecx, 0x28
xor edi, edi
test eax, eax
jle 0x470c31
xor esi, esi
add ecx, 2
lea ebx, [eax - 1]
mov eax, esi
cdq
idiv ebx
mov byte [ecx + 1], 0
inc edi
add esi, 0xff
add ecx, 4
mov byte [ecx - 6], al
mov byte [ecx - 5], al
mov byte [ecx - 4], al
mov eax, dword [ebp - 0x1c]
cmp edi, eax
jl 0x470c08
mov ebx, dword [ebp - 0x28]
push 0
push 0
push ebx
call fcn.0041b870
mov edi, dword [ebp - 0x2c]
mov esi, dword [ebx + 0xc]
mov dword [ebp - 0x38], eax
add esp, 0xc
lea eax, [edi*4]
neg esi
call fcn.004f7d00
xor eax, eax
mov edx, esp
test edi, edi
jbe 0x470c6b
mov ecx, dword [ebp - 0x38]
mov dword [edx + eax*4], ecx
inc eax
add ecx, esi
cmp eax, dword [ebp - 0x2c]
jb 0x470c60
mov eax, dword [ebp - 0x10]
push edx
push eax
call fcn.00516870
mov ecx, dword [ebp - 0x14]
mov edx, dword [ebp - 0x10]
push ecx
push edx
call fcn.00516960
push 0
lea eax, [ebp - 0x14]
push eax
lea ecx, [ebp - 0x10]
push ecx
call fcn.00516d90
mov edx, dword [ebp - 0x34]
push edx
call fcn.004ed0a0
add esp, 0x20
mov eax, ebx
lea esp, [ebp - 0x54]
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.004f3b35
mov esp, ebp
pop ebp
ret