Function at 0x10106040
Capabilities:
Encrypt data using rc4 prga

Disassembly:
sub esp, 0x24
mov eax, dword [esp + 0x2c]
push ebx
push ebp
push esi
mov esi, dword [esp + 0x3c]
lea ecx, [eax + eax*8]
mov eax, dword [esp + 0x34]
lea edx, [eax + ecx*8]
mov eax, esi
mov ecx, dword [edx + 8]
shl eax, 6
add ecx, eax
mov dword [esp + 0x20], edx
mov dword [esp + 0x18], ecx
mov ecx, dword [edx + 4]
add ecx, eax
mov dword [esp + 0x24], ecx
mov cl, byte [esp + 0x40]
cmp cl, 4
je 0x101060a3
cmp cl, 0xc
je 0x101060a3
cmp cl, 0xb
je 0x101060a3
cmp cl, 0x11
je 0x1010609c
cmp cl, 0x12
je 0x1010609c
movzx eax, cl
mov ebx, dword [eax*4 + 0x106cfc30]
jmp 0x101060a8
mov ebx, 0x200
jmp 0x101060a8
mov ebx, 0x400
movzx eax, byte [esp + 0x44]
mov edx, dword [edx + 0x10]
movzx ecx, cl
shl ecx, 4
add ecx, eax
mov dword [esp + 0xc], ebx
lea eax, [esi + esi]
mov dword [esp + 0x34], eax
movzx eax, word [eax + edx]
mov dword [esp + 0x38], eax
lea ebp, [ecx*8 + 0x107edf00]
mov dword [esp + 0x10], ebp
test ax, ax
je 0x10106296
mov ecx, dword [esp + 0x48]
movzx eax, ax
cmp eax, ecx
jle 0x10106296
mov eax, dword [esp + 0x4c]
add eax, ecx
cmp ebx, eax
jle 0x10106296
xor eax, eax
xor ebx, ebx
push edi
xor ecx, ecx
mov dword [esp + 0x48], eax
or edi, 0xffffffff
mov dword [esp + 0x44], eax
xor esi, esi
cmp word [esp + 0x3c], ax
je 0x10106265
mov dword [esp + 0x3c], edx
nop
mov eax, dword [ebp]
mov edx, dword [esp + 0x1c]
movsx eax, word [eax + esi*2]
mov eax, dword [edx + eax*4]
mov dword [esp + 0x20], eax
cdq
xor eax, edx
sub eax, edx
cmp eax, 2
jle 0x10106145
xor ebx, ebx
xor ecx, ecx
or edi, 0xffffffff
jmp 0x10106174
cmp dword [esp + 0x20], 0
jne 0x1010615f
cmp edi, 0xffffffff
lea eax, [ebx + 1]
cmovne eax, ebx
mov ebx, eax
lea eax, [ecx + 1]
cmovne ecx, eax
jmp 0x1010617b
cmp ebx, dword [esp + 0x4c]
jl 0x10106172
mov edx, dword [esp + 0x48]
cmp edi, 0xffffffff
cmove edi, esi
inc edx
jmp 0x1010617f
xor ebx, ebx
lea eax, [esi + 1]
mov dword [esp + 0x44], eax
mov edx, dword [esp + 0x48]
cmp edx, 2
mov eax, 0xffffffff
cmovg edi, eax
lea eax, [esi + 1]
mov dword [esp + 0x18], eax
cmovle eax, dword [esp + 0x44]
mov dword [esp + 0x44], eax
xor eax, eax
cmp edx, 2
mov dword [esp + 0x2c], edi
cmovle eax, edx
mov dword [esp + 0x20], eax
xor eax, eax
cmp edx, 2
cmovle eax, ecx
mov ecx, eax
xor eax, eax
cmp edx, 2
mov dword [esp + 0x48], ecx
mov edx, dword [esp + 0x3c]
cmovle eax, ebx
mov ebx, eax
mov dword [esp + 0x30], ebx
cmp edi, 0xffffffff
je 0x101061ee
mov eax, dword [esp + 0x38]
movzx eax, word [eax + edx]
dec eax
cmp esi, eax
jne 0x101061ee
mov ebp, dword [esp + 0x38]
movzx eax, word [edx + ebp]
mov ebp, dword [esp + 0x14]
sub ecx, eax
add ecx, dword [esp + 0x10]
cmp ecx, dword [esp + 0x50]
jl 0x1010629d
mov eax, edi
cmp edi, esi
jg 0x10106240
mov edx, dword [esp + 0x1c]
mov ebx, dword [esp + 0x28]
nop word [eax + eax]
mov ecx, dword [ebp]
movsx ecx, word [ecx + eax*2]
mov dword [edx + ecx*4], 0
mov ecx, dword [ebp]
movsx ecx, word [ecx + eax*2]
inc eax
mov dword [ebx + ecx*4], 0
cmp eax, esi
jle 0x10106210
mov eax, dword [esp + 0x24]
mov edi, dword [esp + 0x2c]
mov ebx, dword [esp + 0x30]
mov edx, dword [eax + 0x10]
sub ebx, edi
inc esi
add ebx, esi
xor ecx, ecx
xor eax, eax
mov dword [esp + 0x48], eax
mov esi, dword [esp + 0x18]
mov eax, dword [esp + 0x38]
mov dword [esp + 0x3c], edx
movzx eax, word [eax + edx]
cmp esi, eax
jl 0x10106120
mov ebx, dword [esp + 0x38]
mov ecx, dword [esp + 0x44]
pop edi
movzx eax, word [ebx + edx]
cmp ecx, eax
je 0x10106296
push ecx
push ebp
push dword [esp + 0x20]
mov word [ebx + edx], cx
call fcn.100bdaa0
mov ecx, dword [esp + 0x2c]
add esp, 0xc
mov edx, dword [esp + 0x3c]
mov ecx, dword [ecx + 0x14]
mov byte [edx + ecx], al
pop esi
pop ebp
pop ebx
add esp, 0x24
ret
mov eax, dword [esp + 0x20]
mov ebp, dword [esp + 0x40]
mov dword [esp + 0x48], eax
mov eax, dword [esp + 0x44]
mov dword [esp + 0x44], eax
mov eax, dword [esp + 0x3c]
movzx eax, word [eax + ebp*2]
mov ebp, dword [esp + 0x14]
dec eax
cmp esi, eax
jne 0x1010624d
mov esi, dword [esp + 0x18]
mov eax, dword [esp + 0x20]
mov edx, dword [esp + 0x3c]
mov dword [esp + 0x44], esi
mov dword [esp + 0x48], eax
jmp 0x10106251