Function at 0x40d960
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
sub esp, 0x14
mov eax, dword [esp + 0x24]
push ebx
push ebp
push esi
mov ecx, dword [eax + 8]
mov edx, dword [eax]
sub ecx, edx
push edi
mov dword [esp + 0x34], ecx
je 0x40dbb0
mov ebx, dword [eax + 0xc]
mov ecx, dword [eax + 4]
sub ebx, ecx
je 0x40dbb0
mov eax, dword [esp + 0x2c]
xor edx, edx
mov ebp, eax
mov dl, ah
shr eax, 0x10
and eax, 0xff
and ebp, 0xff
mov esi, eax
mov eax, dword [esp + 0x30]
mov ecx, eax
and edx, 0xff
and ecx, 0xff
mov dword [esp + 0x10], edx
sub ecx, ebp
mov dword [esp + 0x14], esi
mov dword [esp + 0x18], ecx
xor ecx, ecx
mov cl, ah
shr eax, 0x10
and ecx, 0xff
and eax, 0xff
sub ecx, edx
sub eax, esi
mov dword [esp + 0x1c], ecx
mov dword [esp + 0x20], eax
mov eax, dword [esp + 0x38]
xor ecx, ecx
cmp eax, ecx
je 0x40dad2
mov esi, dword [esp + 0x34]
mov eax, esi
cdq
and edx, 7
add eax, edx
mov edi, eax
sar edi, 3
cmp edi, 5
jge 0x40da13
mov eax, esi
cdq
and edx, 3
add eax, edx
mov edi, eax
sar edi, 2
cmp edi, ecx
je 0x40dbb0
jl 0x40dba1
mov esi, dword [esp + 0x28]
lea edx, [edi + 1]
mov dword [esp + 0x2c], ecx
mov dword [esp + 0x34], ecx
mov dword [esp + 0x28], ecx
mov dword [esp + 0x30], edx
mov eax, dword [esp + 0x28]
cdq
idiv edi
mov ecx, eax
mov eax, dword [esp + 0x34]
cdq
idiv edi
add ecx, ebp
and ecx, 0xff
mov ebx, eax
mov eax, dword [esp + 0x10]
add ebx, eax
mov eax, dword [esp + 0x2c]
cdq
idiv edi
mov edx, dword [esp + 0x14]
add eax, edx
xor edx, edx
mov dh, al
mov eax, dword [esi + 0xce0]
mov dl, bl
mov ebx, dword [esp + 0x34]
shl edx, 8
or edx, ecx
mov dword [esi + eax*4 + 0x830], edx
mov ecx, dword [esi + 0xce0]
mov eax, dword [esp + 0x28]
inc ecx
mov dword [esi + 0xce0], ecx
mov ecx, dword [esp + 0x18]
mov edx, dword [esp + 0x1c]
add eax, ecx
mov ecx, dword [esp + 0x2c]
mov dword [esp + 0x28], eax
mov eax, dword [esp + 0x20]
add ebx, edx
add ecx, eax
mov eax, dword [esp + 0x30]
dec eax
mov dword [esp + 0x34], ebx
mov dword [esp + 0x2c], ecx
mov dword [esp + 0x30], eax
jne 0x40da38
mov eax, 1
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x14
ret 0x14
mov eax, ebx
cdq
and edx, 7
add eax, edx
mov edi, eax
sar edi, 3
cmp edi, 5
jge 0x40daf1
mov eax, ebx
cdq
and edx, 3
add eax, edx
mov edi, eax
sar edi, 2
cmp edi, ecx
je 0x40dbb0
jl 0x40dba1
mov esi, dword [esp + 0x28]
mov dword [esp + 0x2c], ecx
mov dword [esp + 0x34], ecx
mov dword [esp + 0x28], ecx
lea ecx, [edi + 1]
mov dword [esp + 0x30], ecx
mov eax, dword [esp + 0x28]
cdq
idiv edi
mov ecx, eax
mov eax, dword [esp + 0x34]
cdq
idiv edi
add ecx, ebp
and ecx, 0xff
mov ebx, eax
mov eax, dword [esp + 0x10]
add ebx, eax
mov eax, dword [esp + 0x2c]
cdq
idiv edi
mov edx, dword [esp + 0x14]
add eax, edx
xor edx, edx
mov dh, al
mov eax, dword [esi + 0xce0]
mov dl, bl
mov ebx, dword [esp + 0x34]
shl edx, 8
or edx, ecx
mov dword [esi + eax*4 + 0x830], edx
mov ecx, dword [esi + 0xce0]
mov eax, dword [esp + 0x28]
inc ecx
mov dword [esi + 0xce0], ecx
mov ecx, dword [esp + 0x18]
mov edx, dword [esp + 0x1c]
add eax, ecx
mov ecx, dword [esp + 0x2c]
mov dword [esp + 0x28], eax
mov eax, dword [esp + 0x20]
add ebx, edx
add ecx, eax
mov eax, dword [esp + 0x30]
dec eax
mov dword [esp + 0x34], ebx
mov dword [esp + 0x2c], ecx
mov dword [esp + 0x30], eax
jne 0x40db16
mov eax, 1
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x14
ret 0x14
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x14
ret 0x14