Function at 0x476980
Capabilities:
Encode data using xor
Encrypt data using rc4 prga

Disassembly:
push ebx
mov ebx, dword [esp + 0x10]
push ebp
push esi
mov esi, dword [esp + 0x10]
push edi
mov eax, dword [esi + 0x1f0]
mov ebp, dword [esi + 0xaa0]
and ebp, dword [esp + 0x24]
shl eax, 4
add eax, 0x3556
add eax, ebp
lea ecx, [esi + eax*2]
mov eax, dword [esi + 0x18]
lea eax, [esi + eax*4]
cmp ebx, 0xffffffff
jne 0x476ae8
mov ebx, dword [esp + 0x18]
lea ebp, [esi + 0xaac]
mov dword [eax + 0x20], 0
mov eax, dword [esi + 0x18]
mov dword [esi + eax*4 + 0x108], ecx
inc dword [esi + 0x18]
mov edi, dword [ebx]
mov eax, edi
mov edx, dword [ebx + 0x18]
sub eax, edx
mov ecx, dword [ebx + 0x14]
mov dword [esp + 0x14], edx
movzx edx, byte [eax + ecx - 1]
mov ecx, 8
sub cl, byte [esi + 0xaa4]
mov eax, dword [esi + 0xaa8]
and eax, dword [esp + 0x24]
shr edx, cl
mov ecx, dword [esi + 0xaa4]
shl eax, cl
mov ecx, dword [ebx + 0x14]
add edx, eax
imul eax, edx, 0x600
add ebp, eax
mov eax, edi
sub eax, dword [ebx + 0x18]
cmp dword [esi + 0x1f0], 7
movzx edx, byte [eax + ecx]
jge 0x476a38
push edx
push 8
push ebp
push esi
call fcn.00477af0
add esp, 0x10
jmp 0x476a9a
sub edi, dword [esi + 0x1f4]
mov ebx, 0x100
sub edi, dword [esp + 0x14]
add edx, ebx
movzx edi, byte [edi + ecx - 1]
nop
mov eax, dword [esi + 0x18]
mov ecx, edx
shr ecx, 7
add edi, edi
and ecx, 1
mov dword [esi + eax*4 + 0x20], ecx
mov ecx, ebx
and ecx, edi
mov eax, edx
shr eax, 8
add ecx, ebx
add eax, ecx
add edx, edx
lea ecx, [eax*2]
mov eax, dword [esi + 0x18]
add ecx, ebp
mov dword [esi + eax*4 + 0x108], ecx
mov eax, edi
inc dword [esi + 0x18]
xor eax, edx
not eax
and ebx, eax
cmp edx, 0x10000
jb 0x476a50
mov ebx, dword [esp + 0x18]
mov eax, dword [esi + 0x1f0]
cmp eax, 3
jg 0x476ab9
xor eax, eax
pop edi
mov dword [esi + 0x1f0], eax
mov eax, dword [esp + 0x1c]
sub dword [ebx + 0x18], eax
pop esi
pop ebp
pop ebx
ret
cmp eax, 9
jg 0x476ad3
add eax, 0xfffffffd
pop edi
mov dword [esi + 0x1f0], eax
mov eax, dword [esp + 0x1c]
sub dword [ebx + 0x18], eax
pop esi
pop ebp
pop ebx
ret
add eax, 0xfffffffa
pop edi
mov dword [esi + 0x1f0], eax
mov eax, dword [esp + 0x1c]
sub dword [ebx + 0x18], eax
pop esi
pop ebp
pop ebx
ret
mov edi, dword [esp + 0x20]
mov dword [eax + 0x20], 1
mov eax, dword [esi + 0x18]
mov dword [esi + eax*4 + 0x108], ecx
inc dword [esi + 0x18]
mov edx, dword [esi + 0x1f0]
mov eax, dword [esi + 0x18]
add edx, 0x3616
lea ecx, [esi + eax*4]
lea edx, [esi + edx*2]
cmp ebx, 4
jae 0x476cc1
mov dword [ecx + 0x20], 1
mov eax, dword [esi + 0x18]
mov dword [esi + eax*4 + 0x108], edx
inc dword [esi + 0x18]
mov eax, dword [esi + 0x18]
lea edx, [esi + eax*4]
test ebx, ebx
jne 0x476b8e
mov eax, dword [esi + 0x1f0]
add eax, 0x3622
mov dword [edx + 0x20], ebx
lea ecx, [esi + eax*2]
mov eax, dword [esi + 0x18]
mov dword [esi + eax*4 + 0x108], ecx
inc dword [esi + 0x18]
mov eax, dword [esi + 0x1f0]
mov edx, dword [esi + 0x18]
shl eax, 4
add eax, 0x3646
add eax, ebp
lea ecx, [esi + eax*2]
xor eax, eax
cmp edi, 1
setne al
mov dword [esi + edx*4 + 0x20], eax
mov eax, dword [esi + 0x18]
mov dword [esi + eax*4 + 0x108], ecx
inc dword [esi + 0x18]
jmp 0x476c57
mov eax, dword [esi + ebx*4 + 0x1f4]
mov dword [esp + 0x20], eax
mov eax, dword [esi + 0x1f0]
add eax, 0x3622
mov dword [edx + 0x20], 1
lea ecx, [esi + eax*2]
mov eax, dword [esi + 0x18]
mov dword [esi + eax*4 + 0x108], ecx
inc dword [esi + 0x18]
mov edx, dword [esi + 0x1f0]
mov eax, dword [esi + 0x18]
add edx, 0x362e
lea ecx, [esi + eax*4]
lea edx, [esi + edx*2]
cmp ebx, 1
jne 0x476beb
mov dword [ecx + 0x20], 0
mov eax, dword [esi + 0x18]
mov dword [esi + eax*4 + 0x108], edx
inc dword [esi + 0x18]
jmp 0x476c41
mov dword [ecx + 0x20], 1
mov eax, dword [esi + 0x18]
mov dword [esi + eax*4 + 0x108], edx
inc dword [esi + 0x18]
mov eax, dword [esi + 0x1f0]
mov ecx, dword [esi + 0x18]
add eax, 0x363a
lea edx, [esi + eax*2]
lea eax, [ebx - 2]
mov dword [esi + ecx*4 + 0x20], eax
mov eax, dword [esi + 0x18]
mov dword [esi + eax*4 + 0x108], edx
inc dword [esi + 0x18]
cmp ebx, 3
jne 0x476c35
mov eax, dword [esi + 0x1fc]
mov dword [esi + 0x200], eax
mov eax, dword [esi + 0x1f8]
mov dword [esi + 0x1fc], eax
mov eax, dword [esi + 0x1f4]
mov dword [esi + 0x1f8], eax
mov eax, dword [esp + 0x20]
mov dword [esi + 0x1f4], eax
cmp edi, 1
jne 0x476c81
xor eax, eax
cmp dword [esi + 0x1f0], 7
setge al
lea eax, [eax*2 + 9]
mov dword [esi + 0x1f0], eax
mov eax, dword [esp + 0x18]
sub dword [eax + 0x18], edi
pop edi
pop esi
pop ebp
pop ebx
ret
movzx eax, byte [esi + 0xa9c]
push eax
push edi
push ebp
lea eax, [esi + 0xb958]
push eax
push esi
call fcn.00476cf0
add esp, 0x14
mov eax, 0xb
cmp dword [esi + 0x1f0], 7
mov ecx, 8
cmovl eax, ecx
mov dword [esi + 0x1f0], eax
mov eax, dword [esp + 0x18]
sub dword [eax + 0x18], edi
pop edi
pop esi
pop ebp
pop ebx
ret
mov dword [ecx + 0x20], 0
mov eax, dword [esi + 0x18]
push edi
mov dword [esi + eax*4 + 0x108], edx
lea eax, [ebx - 4]
inc dword [esi + 0x18]
push eax
push ebp
push esi
call fcn.004779a0
mov eax, dword [esp + 0x28]
add esp, 0x10
sub dword [eax + 0x18], edi
pop edi
pop esi
pop ebp
pop ebx
ret