Function at 0x10166ad0
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 0x10166b06
cmp ecx, eax
jl 0x10166b06
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 0x10166b11
cmp ecx, eax
jl 0x10166af7
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 0x10166b57
cmp edi, ecx
je 0x10166d96
mov eax, dword [ebp - 0xc]
test eax, eax
jne 0x10166b7e
push ecx
push dword [ebp - 0x20]
push esi
call fcn.10166dd0
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 0x10166bf3
test eax, eax
jle 0x10166bc5
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.10166dd0
mov edx, dword [ebp - 4]
add esp, 0xc
cmp edi, dword [ebp - 0x18]
jne 0x10166b90
jmp 0x10166d96
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.10166dd0
mov edx, dword [ebp - 4]
add esp, 0xc
cmp edi, dword [ebp - 0x18]
jne 0x10166bc5
jmp 0x10166d96
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 0x10166c14
mov eax, 0xffffff
cdq
idiv ecx
mov dword [ebp - 0x24], eax
jmp 0x10166c1b
mov dword [ebp - 0x24], 0
cmp edi, dword [ebp - 0x18]
je 0x10166c2e
mov eax, 0xffffff
cdq
idiv dword [ebp - 0xc]
mov dword [ebp - 0x28], eax
jmp 0x10166c35
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 0x10166c91
mov ecx, eax
mov dword [ebp - 8], eax
mov eax, edx
sub eax, dword [ebp - 0x1c]
test eax, eax
jle 0x10166c91
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 0x10166d67
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 0x10166cea
test ecx, ecx
jle 0x10166ce2
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 0x10166d6d
mov eax, dword [ebp - 0x1c]
mov dword [ebp - 8], eax
jmp 0x10166cf4
mov eax, dword [ebp - 0x14]
mov dword [ebp - 8], eax
test ecx, ecx
jg 0x10166d35
mov ecx, dword [ebp - 0xc]
shl ecx, 8
add ecx, edx
js 0x10166d3d
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 0x10166d70
mov eax, dword [ebp - 0x14]
mov dword [ebp - 8], eax
jmp 0x10166d40
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.10166dd0
mov eax, dword [ebp - 0x20]
add esp, 0xc
cmp dword [ebp - 4], eax
mov ecx, dword [ebp - 8]
mov eax, dword [ebp - 0x1c]
jne 0x10166c40
cmp edi, dword [ebp - 0x18]
jne 0x10166c40
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