Function at 0x10167440
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x28
mov edx, dword [ebp + 0x10]
mov ecx, edx
push esi
mov esi, dword [ebp + 8]
push edi
sar ecx, 8
mov dword [ebp - 0x18], ecx
mov edi, dword [esi + 0x78]
mov eax, dword [esi + 0x54]
sar edi, 8
cmp edi, eax
jl 0x10167476
cmp ecx, eax
jl 0x10167476
mov eax, dword [ebp + 0xc]
pop edi
mov dword [esi + 0x74], eax
mov dword [esi + 0x78], edx
pop esi
mov esp, ebp
pop ebp
ret
mov eax, dword [esi + 0x50]
cmp edi, eax
jge 0x10167481
cmp ecx, eax
jl 0x10167467
mov eax, dword [esi + 0x74]
mov edx, eax
mov ecx, dword [ebp + 0xc]
push ebx
mov ebx, dword [ebp + 0xc]
sar ebx, 8
mov dword [ebp - 0x20], ebx
movzx ebx, al
mov dword [ebp - 0x10], ecx
sub dword [ebp - 0x10], eax
mov eax, dword [ebp + 0x10]
mov ecx, dword [ebp - 0x18]
mov dword [ebp - 0xc], eax
mov eax, dword [esi + 0x78]
sub dword [ebp - 0xc], eax
sar edx, 8
mov dword [ebp + 8], ebx
mov ebx, dword [esi + 0x78]
mov dword [ebp - 4], edx
movzx ebx, bl
cmp edx, dword [ebp - 0x20]
jne 0x101674c7
cmp edi, ecx
je 0x10167706
mov eax, dword [ebp - 0xc]
test eax, eax
jne 0x101674ee
push ecx
push dword [ebp - 0x20]
push esi
call fcn.10167740
mov eax, dword [ebp + 0xc]
add esp, 0xc
mov dword [esi + 0x74], eax
mov eax, dword [ebp + 0x10]
mov dword [esi + 0x78], eax
pop ebx
pop edi
pop esi
mov esp, ebp
pop ebp
ret
mov ecx, dword [ebp - 0x10]
test ecx, ecx
jne 0x10167563
test eax, eax
jle 0x10167535
nop dword [eax]
mov eax, 0x100
inc edi
sub eax, ebx
add dword [esi + 0x5c], eax
mov eax, 0x100
sub eax, ebx
xor ebx, ebx
imul eax, dword [ebp + 8]
push edi
push edx
push esi
add eax, eax
add dword [esi + 0x58], eax
call fcn.10167740
mov edx, dword [ebp - 4]
add esp, 0xc
cmp edi, dword [ebp - 0x18]
jne 0x10167500
jmp 0x10167706
mov eax, dword [ebp + 8]
dec edi
sub dword [esi + 0x5c], ebx
imul eax, ebx
mov ebx, 0x100
push edi
push edx
push esi
neg eax
add eax, eax
add dword [esi + 0x58], eax
call fcn.10167740
mov edx, dword [ebp - 4]
add esp, 0xc
cmp edi, dword [ebp - 0x18]
jne 0x10167535
jmp 0x10167706
imul eax, dword [ebp + 8]
imul ecx, ebx
sub ecx, eax
mov dword [ebp - 0x14], ecx
mov ecx, dword [ebp - 0x10]
cmp edx, dword [ebp - 0x20]
je 0x10167584
mov eax, 0xffffff
cdq
idiv ecx
mov dword [ebp - 0x24], eax
jmp 0x1016758b
mov dword [ebp - 0x24], 0
cmp edi, dword [ebp - 0x18]
je 0x1016759e
mov eax, 0xffffff
cdq
idiv dword [ebp - 0xc]
mov dword [ebp - 0x28], eax
jmp 0x101675a5
mov dword [ebp - 0x28], 0
mov eax, ecx
shl eax, 8
mov dword [ebp - 0x1c], eax
mov ecx, eax
nop
mov edx, dword [ebp - 0x14]
mov dword [ebp - 8], ecx
test edx, edx
jg 0x10167601
mov ecx, eax
mov dword [ebp - 8], eax
mov eax, edx
sub eax, dword [ebp - 0x1c]
test eax, eax
jle 0x10167601
mov ecx, dword [ebp - 0x24]
mov eax, dword [ebp - 0xc]
neg eax
imul ecx, edx
shl eax, 8
add edx, eax
shr ecx, 0x18
mov eax, ecx
sub eax, ebx
add dword [esi + 0x5c], eax
mov eax, ecx
sub eax, ebx
mov ebx, ecx
imul eax, dword [ebp + 8]
mov dword [ebp + 8], 0x100
add dword [esi + 0x58], eax
dec dword [ebp - 4]
mov eax, dword [ebp - 0x1c]
jmp 0x101676d7
mov dword [ebp - 0x14], ecx
mov eax, edx
sub eax, ecx
mov ecx, dword [ebp - 0xc]
sub ecx, dword [ebp - 0x10]
shl ecx, 8
add ecx, edx
test eax, eax
jg 0x1016765a
test ecx, ecx
jle 0x10167652
mov edx, dword [ebp - 0x28]
mov ecx, eax
imul edx, ecx
mov eax, 0x100
sub eax, ebx
mov dword [ebp - 0x14], ecx
add dword [esi + 0x5c], eax
mov eax, 0x100
mov ecx, dword [ebp + 8]
sub eax, ebx
xor ebx, ebx
neg edx
shr edx, 0x18
add ecx, edx
mov dword [ebp + 8], edx
imul ecx, eax
add dword [esi + 0x58], ecx
inc edi
jmp 0x101676dd
mov eax, dword [ebp - 0x1c]
mov dword [ebp - 8], eax
jmp 0x10167664
mov eax, dword [ebp - 0x14]
mov dword [ebp - 8], eax
test ecx, ecx
jg 0x101676a5
mov ecx, dword [ebp - 0xc]
shl ecx, 8
add ecx, edx
js 0x101676ad
mov edx, dword [ebp - 0x24]
imul edx, ecx
mov dword [ebp - 0x14], ecx
shr edx, 0x18
mov eax, edx
mov ecx, edx
sub eax, ebx
sub ecx, ebx
add dword [esi + 0x5c], eax
mov ebx, edx
mov eax, dword [ebp + 8]
add eax, 0x100
mov dword [ebp + 8], 0
imul ecx, eax
mov eax, dword [ebp - 4]
add dword [esi + 0x58], ecx
inc eax
mov dword [ebp - 4], eax
jmp 0x101676e0
mov eax, dword [ebp - 0x14]
mov dword [ebp - 8], eax
jmp 0x101676b0
mov eax, dword [ebp - 8]
mov ecx, dword [ebp - 0x28]
sub dword [esi + 0x5c], ebx
imul ecx, edx
add edx, eax
mov eax, dword [ebp + 8]
neg ecx
shr ecx, 0x18
add eax, ecx
mov dword [ebp + 8], ecx
imul eax, ebx
mov ebx, 0x100
sub dword [esi + 0x58], eax
dec edi
mov eax, dword [ebp - 8]
mov dword [ebp - 8], eax
mov dword [ebp - 0x14], edx
mov eax, dword [ebp - 4]
push edi
push eax
push esi
call fcn.10167740
mov eax, dword [ebp - 0x20]
add esp, 0xc
cmp dword [ebp - 4], eax
mov ecx, dword [ebp - 8]
mov eax, dword [ebp - 0x1c]
jne 0x101675b0
cmp edi, dword [ebp - 0x18]
jne 0x101675b0
mov edx, dword [ebp + 0x10]
movzx ecx, dl
mov eax, ecx
mov dword [esi + 0x78], edx
sub eax, ebx
sub ecx, ebx
add dword [esi + 0x5c], eax
mov eax, dword [ebp + 0xc]
movzx eax, al
add eax, dword [ebp + 8]
imul eax, ecx
pop ebx
add dword [esi + 0x58], eax
mov eax, dword [ebp + 0xc]
mov dword [esi + 0x74], eax
pop edi
pop esi
mov esp, ebp
pop ebp
ret