Function at 0x4086f0
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
sub esp, 0x50
push ebx
mov ebx, dword [esp + 0x58]
push ebp
push esi
mov eax, dword [ebx + 4]
push edi
mov edi, dword [esp + 0x74]
mov ebp, dword [ebx + 8]
mov dword [esp + 0x38], eax
mov dword [esp + 0x28], 0xffffffff
mov eax, dword [edi + 8]
mov ecx, dword [edi]
mov esi, dword [edi + 0xc]
sub eax, ecx
mov ecx, dword [esp + 0x6c]
mov dword [esp + 0x64], eax
mov eax, dword [edi + 4]
push ecx
mov dword [esp + 0x14], 1
mov dword [esp + 0x20], ebp
sub esi, eax
call fcn.004067e0
push ebx
mov dword [esp + 0x7c], eax
call fcn.004067e0
mov ebx, dword [esp + 0x74]
add esp, 8
test ebp, ebp
mov ecx, dword [ebx + 8]
mov dword [esp + 0x50], eax
jge 0x408764
neg ebp
mov dword [esp + 0x10], 0xffffffff
mov dword [esp + 0x1c], ebp
test ecx, ecx
jge 0x40878e
mov ecx, dword [edi + 4]
mov edx, dword [esp + 0x10]
imul ecx, dword [esp + 0x74]
mov edi, dword [edi]
neg edx
mov dword [esp + 0x10], edx
mov edx, dword [esp + 0x70]
lea edx, [edx + edi*2]
add edi, edx
lea edx, [edi + ecx]
mov dword [esp + 0x70], edx
jmp 0x4087ae
mov edx, dword [edi + 4]
mov edi, dword [edi]
sub ecx, edx
mov edx, dword [esp + 0x70]
sub ecx, esi
dec ecx
lea edx, [edx + edi*2]
imul ecx, dword [esp + 0x74]
add edi, edx
add edi, ecx
mov dword [esp + 0x70], edi
mov edx, edi
xor ecx, ecx
mov cx, word [ebx + 0xe]
cmp ecx, 0x18
je 0x4087cf
cmp ecx, 0x20
je 0x4087c8
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x50
ret
mov ebp, 4
jmp 0x4087d4
mov ebp, 3
mov ecx, dword [esp + 0x74]
lea ebx, [esi - 2]
imul ebx, ecx
add ebx, edx
dec esi
mov edi, esi
mov dword [esp + 0x54], ebx
imul edi, ecx
mov ecx, dword [esp + 0x10]
add edi, edx
test ecx, ecx
mov dword [esp + 0x3c], esi
mov dword [esp + 0x6c], edi
jge 0x408808
mov ecx, dword [esp + 0x1c]
dec ecx
imul ecx, eax
add dword [esp + 0x68], ecx
mov edx, dword [esp + 0x64]
lea esi, [edx*4]
push esi
push 0x40
call dword [sym.imp.KERNEL32.dll_LocalAlloc]
test eax, eax
mov dword [esp + 0x18], eax
jne 0x40882c
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x50
ret
push esi
push 0x40
call dword [sym.imp.KERNEL32.dll_LocalAlloc]
mov ecx, eax
test ecx, ecx
mov dword [esp + 0x2c], ecx
jne 0x408854
mov eax, dword [esp + 0x18]
push eax
call dword [sym.imp.KERNEL32.dll_LocalFree]
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x50
ret
mov edx, dword [esp + 0x64]
xor eax, eax
test edx, edx
mov dword [esp + 0x34], eax
jle 0x408988
mov esi, dword [esp + 0x38]
dec esi
dec edx
mov dword [esp + 0x40], edx
mov edx, dword [esp + 0x68]
add edx, ebp
mov dword [esp + 0x38], esi
mov dword [esp + 0x44], edx
lea edx, [edi + 1]
mov esi, edi
sub edi, edx
sub esi, edx
mov dword [esp + 0x14], edx
mov edx, dword [esp + 0x2c]
mov dword [esp + 0x20], esi
mov esi, dword [esp + 0x18]
add edi, 2
mov dword [esp + 0x24], edi
sub esi, edx
shl eax, 8
imul eax, dword [esp + 0x38]
cdq
idiv dword [esp + 0x40]
add ecx, 4
mov edx, eax
sar edx, 8
mov edi, edx
shl edi, 8
sub eax, edi
mov edi, dword [esp + 0x44]
mov dword [esi + ecx - 4], eax
mov eax, edx
imul eax, ebp
mov edx, dword [esp + 0x68]
mov dword [ecx - 4], eax
mov dl, byte [eax + edx]
mov byte [esp + 0x30], dl
xor edx, edx
mov dl, byte [edi + eax]
mov eax, dword [esp + 0x30]
and eax, 0xff
mov edi, dword [esp + 0x14]
sub edx, eax
mov al, byte [esp + 0x30]
imul edx, dword [esi + ecx - 4]
shr edx, 8
add dl, al
mov eax, dword [esp + 0x20]
mov byte [eax + edi], dl
mov edx, dword [ecx - 4]
mov eax, dword [esp + 0x68]
lea edi, [edx + eax]
xor edx, edx
mov al, byte [edi + 1]
mov dl, byte [edi + ebp + 1]
mov byte [esp + 0x48], al
and eax, 0xff
sub edx, eax
mov al, byte [esp + 0x48]
imul edx, dword [esi + ecx - 4]
shr edx, 8
add dl, al
mov eax, dword [esp + 0x14]
mov byte [eax], dl
mov edx, dword [ecx - 4]
mov eax, dword [esp + 0x68]
lea edi, [edx + eax]
xor edx, edx
mov al, byte [edi + 2]
mov dl, byte [edi + ebp + 2]
mov byte [esp + 0x4c], al
and eax, 0xff
sub edx, eax
mov al, byte [esp + 0x4c]
imul edx, dword [esi + ecx - 4]
mov edi, dword [esp + 0x14]
shr edx, 8
add dl, al
mov eax, dword [esp + 0x24]
mov byte [eax + edi], dl
mov eax, dword [esp + 0x34]
mov edx, dword [esp + 0x64]
inc eax
add edi, ebp
cmp eax, edx
mov dword [esp + 0x34], eax
mov dword [esp + 0x14], edi
jl 0x4088a0
mov edi, dword [esp + 0x6c]
mov ecx, dword [esp + 0x3c]
xor eax, eax
test ecx, ecx
mov dword [esp + 0x38], eax
jle 0x408bed
mov edx, dword [esp + 0x1c]
dec edx
mov dword [esp + 0x4c], edx
shl eax, 8
imul eax, dword [esp + 0x4c]
cdq
idiv ecx
mov ecx, dword [esp + 0x28]
mov edx, eax
mov dword [esp + 0x48], eax
sar edx, 8
cmp edx, ecx
mov dword [esp + 0x28], edx
je 0x408ad8
mov ecx, dword [esp + 0x74]
mov esi, edi
mov eax, ecx
mov edi, ebx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
mov eax, dword [esp + 0x64]
and ecx, 3
rep movsb byte es:[edi], byte [esi]
lea esi, [edx + 1]
mov ecx, dword [esp + 0x68]
imul esi, dword [esp + 0x50]
imul esi, dword [esp + 0x10]
add esi, ecx
test eax, eax
jle 0x408bc6
mov eax, dword [esp + 0x6c]
mov ecx, dword [esp + 0x2c]
mov edx, eax
lea edi, [eax + 1]
sub eax, edi
sub edx, edi
add eax, 2
mov dword [esp + 0x20], edx
mov edx, dword [esp + 0x18]
mov dword [esp + 0x24], eax
mov eax, dword [esp + 0x64]
sub edx, ecx
mov dword [esp + 0x14], eax
mov eax, dword [ecx]
add ecx, 4
add eax, esi
mov bl, byte [eax]
mov byte [esp + 0x34], bl
xor ebx, ebx
mov bl, byte [eax + ebp]
mov eax, dword [esp + 0x34]
and eax, 0xff
sub ebx, eax
mov al, byte [esp + 0x34]
imul ebx, dword [ecx + edx - 4]
shr ebx, 8
add bl, al
mov eax, dword [esp + 0x20]
mov byte [edi + eax], bl
mov eax, dword [ecx - 4]
add eax, esi
mov bl, byte [eax + 1]
mov byte [esp + 0x30], bl
xor ebx, ebx
mov bl, byte [eax + ebp + 1]
mov eax, dword [esp + 0x30]
and eax, 0xff
sub ebx, eax
mov al, byte [esp + 0x30]
imul ebx, dword [ecx + edx - 4]
shr ebx, 8
add bl, al
mov byte [edi], bl
mov eax, dword [ecx - 4]
add eax, esi
mov bl, byte [eax + 2]
mov byte [esp + 0x1c], bl
xor ebx, ebx
mov bl, byte [eax + ebp + 2]
mov eax, dword [esp + 0x1c]
and eax, 0xff
sub ebx, eax
mov al, byte [esp + 0x1c]
imul ebx, dword [ecx + edx - 4]
shr ebx, 8
add bl, al
mov eax, dword [esp + 0x24]
mov byte [edi + eax], bl
mov eax, dword [esp + 0x14]
add edi, ebp
dec eax
mov dword [esp + 0x14], eax
jne 0x408a26
mov eax, dword [esp + 0x48]
mov ebx, dword [esp + 0x54]
mov edi, dword [esp + 0x6c]
mov edx, dword [esp + 0x28]
mov ecx, dword [esp + 0x64]
test ecx, ecx
jle 0x408bca
mov ecx, edi
mov esi, eax
sub ecx, ebx
mov eax, ebx
shl edx, 8
mov dword [esp + 0x48], ecx
mov ecx, dword [esp + 0x70]
sub esi, edx
mov edx, ecx
sub edx, ebx
mov dword [esp + 0x24], 1
mov dword [esp + 0x44], edx
mov edx, edi
sub edx, ebx
sub edi, ebx
inc edx
add edi, 2
mov dword [esp + 0x40], edx
mov edx, ecx
sub edx, ebx
sub ecx, ebx
inc edx
add ecx, 2
mov dword [esp + 0x5c], ecx
mov ecx, dword [esp + 0x64]
mov dword [esp + 0x14], edx
mov dword [esp + 0x58], edi
mov dword [esp + 0x20], ecx
mov edi, dword [esp + 0x48]
mov cl, byte [eax]
xor edx, edx
and ecx, 0xff
mov dl, byte [edi + eax]
mov edi, dword [esp + 0x40]
sub edx, ecx
mov cl, byte [eax]
imul edx, esi
sar edx, 8
add dl, cl
mov ecx, dword [esp + 0x44]
mov byte [ecx + eax], dl
mov edx, dword [esp + 0x24]
mov cl, byte [edx + eax]
xor edx, edx
mov dl, byte [edi + eax]
and ecx, 0xff
sub edx, ecx
mov ecx, dword [esp + 0x24]
imul edx, esi
sar edx, 8
add dl, byte [ecx + eax]
mov ecx, dword [esp + 0x14]
mov edi, dword [esp + 0x58]
mov byte [ecx + eax], dl
mov ecx, 2
xor edx, edx
mov cl, byte [ecx + eax]
mov dl, byte [edi + eax]
and ecx, 0xff
mov edi, 2
sub edx, ecx
imul edx, esi
mov cl, byte [edi + eax]
sar edx, 8
add dl, cl
mov ecx, dword [esp + 0x5c]
mov byte [ecx + eax], dl
mov ecx, dword [esp + 0x20]
add eax, ebp
dec ecx
mov dword [esp + 0x20], ecx
jne 0x408b35
mov edi, dword [esp + 0x6c]
mov edx, dword [esp + 0x74]
mov eax, dword [esp + 0x70]
mov ecx, dword [esp + 0x3c]
add eax, edx
mov dword [esp + 0x70], eax
mov eax, dword [esp + 0x38]
inc eax
cmp eax, ecx
mov dword [esp + 0x38], eax
jl 0x4089a3
mov eax, dword [esp + 0x18]
mov esi, dword [sym.imp.KERNEL32.dll_LocalFree]
push eax
call esi
mov ecx, dword [esp + 0x2c]
push ecx
call esi
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x50
ret