Function at 0x405880
Capabilities:
Encrypt data using rc4 prga

Disassembly:
sub esp, 0x20
push ebx
mov ebx, dword [esp + 0x28]
push ebp
mov ebp, ecx
mov ecx, dword [esp + 0x30]
push esi
add ecx, ebx
mov dword [esp + 0x14], ebp
push edi
lea edi, [ebx + 1]
mov dword [esp + 0x14], ecx
movzx ebx, byte [ebp]
lea esi, [edx + ebp]
movzx ecx, byte [ebp + 1]
xor edx, edx
shl ebx, 8
mov eax, ebp
mov dword [esp + 0x2c], esi
or ebx, ecx
add esi, 0xfffffffe
mov dword [esp + 0x38], edx
mov dword [esp + 0x10], esi
cmp ebp, esi
jae 0x405b50
lea esp, [esp]
movzx ecx, byte [eax + 2]
mov esi, dword [esp + 0x3c]
shl ebx, 8
or ebx, ecx
mov edx, ebx
mov dword [esp + 0x28], ebx
shr edx, 5
xor edx, ebx
shr edx, 3
lea ecx, [ebx + ebx*4]
sub edx, ecx
mov ecx, dword [esp + 0x3c]
and edx, 0xffff
mov ebp, dword [ecx + edx*4]
mov ecx, eax
sub ecx, dword [esp + 0x18]
add ebp, dword [esp + 0x18]
mov dword [esi + edx*4], ecx
mov ecx, eax
mov esi, dword [esp + 0x10]
sub ecx, ebp
dec ecx
mov dword [esp + 0x1c], ecx
cmp ecx, 0x2000
jge 0x405b23
cmp ebp, dword [esp + 0x18]
jbe 0x405b23
mov cl, byte [ebp + 2]
cmp cl, byte [eax + 2]
jne 0x405b23
movzx esi, byte [ebp + 1]
lea edx, [eax + 1]
movzx ecx, byte [ebp]
mov dword [esp + 0x24], edx
movzx edx, byte [edx]
shl esi, 8
or esi, ecx
shl edx, 8
movzx ecx, byte [eax]
or edx, ecx
cmp esi, edx
jne 0x405b1f
mov ecx, dword [esp + 0x10]
mov edx, 0x108
sub ecx, eax
mov ebx, 2
cmp ecx, 0x108
cmova ecx, edx
mov dword [esp + 0x20], ecx
lea ecx, [edi + 4]
cmp ecx, dword [esp + 0x14]
jb 0x4059a2
mov esi, dword [esp + 0x38]
xor edx, edx
test esi, esi
mov ecx, edi
sete dl
sub ecx, edx
add ecx, 4
cmp ecx, dword [esp + 0x14]
jae 0x405ba4
mov esi, dword [esp + 0x38]
mov ecx, edi
mov dl, byte [esp + 0x38]
sub ecx, esi
dec dl
mov byte [ecx - 1], dl
xor ecx, ecx
mov edx, dword [esp + 0x20]
test esi, esi
sete cl
sub edi, ecx
cmp edx, 0x10
jbe 0x405ab9
mov cl, byte [ebp + 3]
mov ebx, 3
cmp cl, byte [eax + 3]
jne 0x405acf
mov cl, byte [ebp + 4]
mov ebx, 4
cmp cl, byte [eax + 4]
jne 0x405acf
mov cl, byte [ebp + 5]
mov ebx, 5
cmp cl, byte [eax + 5]
jne 0x405acf
mov cl, byte [ebp + 6]
mov ebx, 6
cmp cl, byte [eax + 6]
jne 0x405acf
mov cl, byte [ebp + 7]
mov ebx, 7
cmp cl, byte [eax + 7]
jne 0x405acf
mov cl, byte [ebp + 8]
mov ebx, 8
cmp cl, byte [eax + 8]
jne 0x405acf
mov cl, byte [ebp + 9]
mov ebx, 9
cmp cl, byte [eax + 9]
jne 0x405acf
mov cl, byte [ebp + 0xa]
mov ebx, 0xa
cmp cl, byte [eax + 0xa]
jne 0x405acf
mov cl, byte [ebp + 0xb]
mov ebx, 0xb
cmp cl, byte [eax + 0xb]
jne 0x405acf
mov cl, byte [ebp + 0xc]
mov ebx, 0xc
cmp cl, byte [eax + 0xc]
jne 0x405acf
mov cl, byte [ebp + 0xd]
mov ebx, 0xd
cmp cl, byte [eax + 0xd]
jne 0x405acf
mov cl, byte [ebp + 0xe]
mov ebx, 0xe
cmp cl, byte [eax + 0xe]
jne 0x405acf
mov cl, byte [ebp + 0xf]
mov ebx, 0xf
cmp cl, byte [eax + 0xf]
jne 0x405acf
mov cl, byte [ebp + 0x10]
mov ebx, 0x10
cmp cl, byte [eax + 0x10]
jne 0x405acf
mov cl, byte [ebp + 0x11]
mov ebx, 0x11
cmp cl, byte [eax + 0x11]
jne 0x405acf
mov cl, byte [ebp + 0x12]
mov ebx, 0x12
cmp cl, byte [eax + 0x12]
jne 0x405acf
lea ecx, [ebx + eax]
sub ebp, eax
mov edi, edi
inc ebx
lea ecx, [ecx + 1]
cmp ebx, edx
jae 0x405acf
mov al, byte [ecx + ebp]
cmp al, byte [ecx]
je 0x405ac0
mov edx, dword [esp + 0x1c]
sub ebx, 2
cmp ebx, 7
jae 0x405aec
mov ecx, edx
mov al, bl
sar ecx, 8
shl al, 5
add cl, al
mov byte [edi], cl
inc edi
jmp 0x405afe
mov eax, edx
sar eax, 8
sub al, 0x20
mov byte [edi], al
lea eax, [ebx - 7]
mov byte [edi + 1], al
add edi, 2
mov eax, dword [esp + 0x24]
inc eax
mov byte [edi], dl
xor edx, edx
add eax, ebx
add edi, 2
mov dword [esp + 0x38], edx
cmp eax, dword [esp + 0x10]
jae 0x405b50
mov ebx, dword [esp + 0x28]
jmp 0x4058d0
mov esi, dword [esp + 0x10]
cmp edi, dword [esp + 0x14]
jae 0x405ba4
mov edx, dword [esp + 0x38]
mov cl, byte [eax]
inc edx
mov byte [edi], cl
inc eax
inc edi
mov dword [esp + 0x38], edx
cmp edx, 0x20
jne 0x405b48
xor edx, edx
mov byte [edi - 0x21], 0x1f
mov dword [esp + 0x38], edx
inc edi
cmp eax, esi
jb 0x4058d0
lea ecx, [edi + 3]
cmp ecx, dword [esp + 0x14]
ja 0x405ba4
mov ebx, dword [esp + 0x2c]
cmp eax, ebx
jae 0x405b80
mov cl, byte [eax]
inc edx
mov byte [edi], cl
inc eax
inc edi
cmp edx, 0x20
jne 0x405b74
mov byte [edi - 0x21], 0x1f
xor edx, edx
inc edi
cmp eax, ebx
jb 0x405b61
mov dword [esp + 0x38], edx
mov dword [esp + 0x38], edx
mov eax, dword [esp + 0x38]
mov ecx, edi
sub ecx, eax
dec dl
mov byte [ecx - 1], dl
xor ecx, ecx
test eax, eax
sete cl
sub edi, ecx
sub edi, dword [esp + 0x34]
mov eax, edi
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x20
ret
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x20
ret