Function at 0x50c040
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
sub esp, 0x50
push ebp
mov ebp, dword [esp + 0x58]
mov eax, dword [ebp + 0x18]
mov dword [esp + 0x14], ecx
mov dword [esp + 0x24], eax
cmp eax, 0x10
jne 0x50c06f
mov eax, dword [esp + 0x60]
mov edx, dword [esp + 0x5c]
push eax
push edx
push ebp
call fcn.0050ba30
pop ebp
add esp, 0x50
ret 0xc
movzx eax, word [ebp + 0x1e]
push ebx
movzx ebx, word [ebp + 0x22]
push esi
mov esi, dword [0x547224]
push edi
movzx edi, word [ebp + 0x20]
imul edi, eax
add edi, edi
add edi, edi
push edi
lea ecx, [eax*4]
shr ebx, 3
push 0
mov dword [esp + 0x30], ebx
mov dword [esp + 0x34], ecx
mov dword [esp + 0x64], edi
call esi
movzx edx, word [ebp + 0x1e]
mov dword [esp + 0x3c], eax
movzx eax, word [ebp + 0x20]
imul edx, eax
push edx
push 0
call esi
xor edx, edx
mov esi, eax
mov dword [esp + 0x1c], esi
mov dword [esp + 0x14], edx
test ebx, ebx
jbe 0x50c3e8
jmp 0x50c0d4
mov edx, dword [esp + 0x14]
mov eax, dword [ebp + 0x2c]
add eax, ebp
xor esi, esi
xor edi, edi
xor ecx, ecx
cmp edx, 2
lea ebp, [ebx*4]
jl 0x50c102
dec edx
lea esp, [esp]
add esi, dword [eax + ecx*4]
add edi, dword [eax + ecx*4 + 4]
add ecx, 2
cmp ecx, edx
jb 0x50c0f0
mov edx, dword [esp + 0x14]
cmp ecx, edx
jae 0x50c109
add ebp, dword [eax + ecx*4]
add esi, edi
mov edi, dword [esp + 0x14]
add esi, ebp
mov ebx, dword [eax + esi + 8]
add eax, esi
mov esi, dword [eax + 4]
add esi, dword [eax]
mov dword [esp + 0x44], eax
lea eax, [eax + esi + 0xc]
mov dword [esp + 0x10], eax
mov eax, dword [esp + 0x64]
mov ebp, dword [eax + 0x30]
add ebp, eax
mov eax, dword [esp + 0x28]
add eax, eax
add eax, eax
mov esi, eax
xor ecx, ecx
xor edx, edx
xor eax, eax
cmp edi, 2
mov dword [esp + 0x48], ebx
jl 0x50c163
dec edi
jmp 0x50c150
add ecx, dword [ebp + eax*4]
add edx, dword [ebp + eax*4 + 4]
add eax, 2
cmp eax, edi
jb 0x50c150
mov edi, dword [esp + 0x14]
cmp eax, edi
jae 0x50c16b
add esi, dword [ebp + eax*4]
add ecx, edx
add ecx, esi
push 0x7de
add ebp, ecx
mov ecx, dword [esp + 0x24]
push 0
push ecx
call fcn.0052b220
add esp, 0xc
xor edi, edi
mov edx, 0x80
mov eax, 0x7de
mov dword [esp + 0x24], edx
test ebx, ebx
jbe 0x50c23a
lea ecx, [ecx]
test edx, edx
jne 0x50c1b1
inc dword [esp + 0x10]
mov edx, 0x80
mov dword [esp + 0x24], edx
mov ecx, dword [esp + 0x10]
test byte [ecx], dl
je 0x50c20c
movzx ecx, word [ebp]
mov esi, ecx
shr ecx, 5
and esi, 0x1f
add esi, 3
mov dword [esp + 0x4c], ecx
xor ecx, ecx
test esi, esi
jbe 0x50c207
mov edx, dword [esp + 0x4c]
mov ebx, dword [esp + 0x20]
add edx, ecx
and edx, 0x7ff
mov dl, byte [edx + ebx]
mov ebx, dword [esp + 0x1c]
mov byte [edi + ebx], dl
mov ebx, dword [esp + 0x20]
mov byte [eax + ebx], dl
inc eax
inc ecx
and eax, 0x7ff
inc edi
cmp ecx, esi
jb 0x50c1d2
mov ebx, dword [esp + 0x48]
mov edx, dword [esp + 0x24]
add ebp, 2
jmp 0x50c22c
movzx ecx, byte [ebp]
mov esi, dword [esp + 0x1c]
mov byte [edi + esi], cl
mov ecx, esi
movzx ecx, byte [edi + ecx]
mov esi, dword [esp + 0x20]
mov byte [eax + esi], cl
inc eax
inc ebp
and eax, 0x7ff
inc edi
shr edx, 1
mov dword [esp + 0x24], edx
cmp edi, ebx
jb 0x50c1a0
mov ecx, dword [esp + 0x64]
movzx eax, word [ecx + 0x1e]
mov edi, dword [esp + 0x30]
xor edx, edx
div edi
mov ebp, eax
mov dword [esp + 0x48], eax
test edx, edx
je 0x50c259
inc ebp
mov dword [esp + 0x48], ebp
movzx eax, word [ecx + 0x20]
xor edx, edx
div edi
test edx, edx
je 0x50c266
inc eax
mov ecx, dword [esp + 0x44]
mov edx, dword [ecx]
mov ebx, dword [esp + 0x1c]
lea edx, [edx + ecx + 0xc]
add ecx, 0xc
mov dword [esp + 0x18], 0x80
mov dword [esp + 0x40], edx
mov dword [esp + 0x10], ecx
test eax, eax
jbe 0x50c3c7
mov edx, dword [esp + 0x3c]
mov esi, dword [esp + 0x14]
mov ecx, edi
imul ecx, dword [esp + 0x2c]
add esi, edx
mov dword [esp + 0x38], esi
mov esi, dword [esp + 0x64]
mov dword [esp + 0x24], 0
mov dword [esp + 0x58], ecx
mov dword [esp + 0x4c], eax
test ebp, ebp
jbe 0x50c3b4
mov eax, dword [esp + 0x24]
mov ecx, dword [esp + 0x38]
add eax, edi
mov dword [esp + 0x50], eax
xor eax, eax
mov dword [esp + 0x34], ecx
mov dword [esp + 0x44], ebp
jmp 0x50c2e0
movzx ecx, word [esi + 0x1e]
lea edx, [eax + edi]
mov dword [esp + 0x54], edx
cmp edx, ecx
ja 0x50c2f3
mov ebp, edi
jmp 0x50c2f7
sub ecx, eax
mov ebp, ecx
movzx eax, word [esi + 0x20]
cmp dword [esp + 0x50], eax
ja 0x50c305
mov eax, edi
jmp 0x50c309
sub eax, dword [esp + 0x24]
cmp dword [esp + 0x18], 0
jne 0x50c31c
inc dword [esp + 0x10]
mov dword [esp + 0x18], 0x80
mov edx, dword [esp + 0x10]
mov cl, byte [esp + 0x18]
mov esi, dword [esp + 0x34]
test byte [edx], cl
je 0x50c35d
mov ecx, dword [esp + 0x40]
mov dl, byte [ecx]
inc ecx
mov dword [esp + 0x40], ecx
test eax, eax
jbe 0x50c38a
mov edi, eax
lea ecx, [ecx]
mov eax, esi
test ebp, ebp
jbe 0x50c352
mov ecx, ebp
mov byte [eax], dl
add eax, 4
sub ecx, 1
jne 0x50c348
add esi, dword [esp + 0x2c]
sub edi, 1
jne 0x50c340
jmp 0x50c386
test eax, eax
jbe 0x50c38a
mov edi, eax
mov eax, esi
test ebp, ebp
jbe 0x50c37d
mov ecx, ebp
jmp 0x50c370
mov dl, byte [ebx]
mov byte [eax], dl
inc ebx
add eax, 4
sub ecx, 1
jne 0x50c370
add esi, dword [esp + 0x2c]
sub edi, 1
jne 0x50c363
mov edi, dword [esp + 0x30]
shr dword [esp + 0x18], 1
mov eax, dword [esp + 0x54]
mov esi, dword [esp + 0x64]
lea ecx, [edi*4]
add dword [esp + 0x34], ecx
sub dword [esp + 0x44], 1
jne 0x50c2e0
mov ebp, dword [esp + 0x48]
mov ecx, dword [esp + 0x58]
add dword [esp + 0x24], edi
add dword [esp + 0x38], ecx
sub dword [esp + 0x4c], 1
jne 0x50c2b8
mov eax, dword [esp + 0x14]
mov ebx, dword [esp + 0x28]
mov ebp, dword [esp + 0x64]
inc eax
mov dword [esp + 0x14], eax
cmp eax, ebx
jb 0x50c0d0
mov esi, dword [esp + 0x1c]
mov edi, dword [esp + 0x5c]
cmp ebx, 4
je 0x50c40e
movzx eax, word [ebp + 0x1e]
movzx edx, word [ebp + 0x20]
mov ecx, dword [esp + 0x3c]
imul eax, edx
add ecx, 3
test eax, eax
je 0x50c40e
mov byte [ecx], 0xff
add ecx, 4
sub eax, 1
jne 0x50c403
mov eax, dword [esp + 0x68]
xor ecx, ecx
cmp eax, ecx
je 0x50c45f
mov dword [eax], 0x28
movzx edx, word [ebp + 0x1e]
mov dword [eax + 4], edx
movzx edx, word [ebp + 0x20]
mov dword [eax + 8], edx
mov edx, 1
mov word [eax + 0xc], dx
mov edx, 0x20
mov word [eax + 0xe], dx
mov dword [eax + 0x20], ecx
mov dword [eax + 0x10], ecx
mov dword [eax + 0x24], ecx
movzx edx, word [ebp + 0x1e]
movzx ebx, word [ebp + 0x20]
imul edx, ebx
add edx, edx
add edx, edx
mov dword [eax + 0x14], edx
mov dword [eax + 0x18], ecx
mov dword [eax + 0x1c], ecx
mov eax, dword [esp + 0x6c]
cmp eax, ecx
je 0x50c469
mov dword [eax], edi
cmp esi, ecx
je 0x50c474
push esi
call dword [0x547228]
mov eax, dword [esp + 0x3c]
pop edi
pop esi
pop ebx
pop ebp
add esp, 0x50
ret 0xc