Function at 0x100397b0
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
push ebp
mov ebp, esp
sub esp, 0xc8
push ebx
push esi
push edi
mov edi, ecx
mov dword [ebp - 0x40], edx
mov dword [ebp - 0x38], edi
mov eax, dword [edi]
mov dword [eax + 8], 0
call fcn.10038dd0
test eax, eax
je 0x10039c2b
mov eax, dword [edi]
mov ecx, dword [eax + 8]
mov dword [ebp - 0x28], ecx
cmp ecx, 3
jne 0x1003980a
cmp dword [edi + 0x47ec], ecx
je 0x10039801
cmp dword [edi + 0x47e8], 0
jne 0x1003980a
cmp dword [edi + 0x47e4], 0
jne 0x1003980a
mov dword [ebp - 0x30], 1
jmp 0x10039811
mov dword [ebp - 0x30], 0
mov dword [ebp - 8], 0
xorps xmm0, xmm0
movups xmmword [ebp - 0x24], xmm0
test ecx, ecx
jle 0x10039902
lea ebx, [edi + 0x46a0]
lea esi, [ebp - 0xb4]
mov dword [ebp - 0x14], ebx
mov eax, dword [eax]
add eax, 3
push eax
call fcn.1007ada5
add esp, 4
mov dword [ebx + 0x34], eax
test eax, eax
je 0x10039c2b
mov eax, dword [edi + 0x4684]
cdq
idiv dword [ebx]
mov dword [esi + 0xc], 0
mov dword [ebp - 0xc], eax
mov dword [esi - 4], eax
mov eax, dword [edi + 0x4688]
cdq
idiv dword [ebx + 4]
xor edx, edx
mov ebx, eax
mov eax, dword [edi]
mov ecx, ebx
mov dword [esi], ebx
sar ecx, 1
mov dword [esi + 8], ecx
mov ecx, dword [eax]
mov eax, dword [ebp - 0xc]
dec eax
add eax, ecx
mov ecx, dword [ebp - 0xc]
div ecx
mov dword [esi + 4], eax
mov eax, dword [ebp - 0x14]
mov eax, dword [eax + 0x28]
mov dword [esi - 8], eax
mov dword [esi - 0xc], eax
cmp ecx, 1
jne 0x100398ba
cmp ebx, ecx
jne 0x100398ac
mov dword [esi - 0x10], 0x10039030
jmp 0x100398e4
cmp ebx, 2
jne 0x100398ba
mov dword [esi - 0x10], 0x10039040
jmp 0x100398e4
cmp ecx, 2
jne 0x100398dd
cmp ebx, 1
jne 0x100398cd
mov dword [esi - 0x10], 0x10039090
jmp 0x100398e4
cmp ebx, 2
jne 0x100398dd
mov eax, dword [edi + 0x4814]
mov dword [esi - 0x10], eax
jmp 0x100398e4
mov dword [esi - 0x10], 0x100393e0
mov eax, dword [ebp - 8]
add esi, 0x20
mov ebx, dword [ebp - 0x14]
inc eax
add ebx, 0x48
mov dword [ebp - 8], eax
cmp eax, dword [ebp - 0x28]
mov eax, dword [edi]
mov dword [ebp - 0x14], ebx
jl 0x10039836
mov eax, dword [edi]
mov ecx, 4
push 1
mov ebx, dword [eax + 4]
mov esi, dword [eax]
mov edx, esi
push ebx
call fcn.100342a0
add esp, 8
test eax, eax
je 0x10039c2b
imul esi, ebx
lea eax, [esi*4 + 1]
push eax
call fcn.1007ada5
mov esi, eax
add esp, 4
mov dword [ebp - 0x34], esi
test esi, esi
je 0x10039c2b
mov ecx, dword [edi]
xor edx, edx
mov dword [ebp - 0x14], edx
cmp dword [ecx + 4], edx
jbe 0x10039c00
mov ebx, dword [ebp - 0x24]
mov eax, dword [ecx]
imul eax, edx
cmp dword [ebp - 0x28], 0
mov dword [ebp - 8], 0
lea ecx, [esi + eax*4]
mov dword [ebp - 0xc], ecx
jle 0x100399f7
lea eax, [edi + 0x46bc]
mov dword [ebp - 0x10], eax
lea esi, [ebp - 0xac]
mov edi, eax
mov eax, dword [esi - 8]
xor ecx, ecx
mov ebx, dword [esi - 0x10]
sar eax, 1
cmp dword [esi], eax
setge cl
test ecx, ecx
je 0x1003999d
mov eax, dword [esi - 0x14]
mov ecx, ebx
jmp 0x100399a2
mov ecx, dword [esi - 0x14]
mov eax, ebx
push dword [esi - 0xc]
push dword [esi - 4]
push eax
push ecx
push dword [edi + 0x18]
call dword [esi - 0x18]
mov edx, dword [ebp - 8]
add esp, 0x14
mov dword [ebp + edx*4 - 0x24], eax
mov eax, dword [esi]
inc eax
mov dword [esi], eax
cmp eax, dword [esi - 8]
jl 0x100399df
inc dword [esi + 4]
mov eax, dword [esi + 4]
mov dword [esi], 0
mov dword [esi - 0x14], ebx
cmp eax, dword [edi]
jge 0x100399df
mov eax, dword [edi + 4]
add eax, ebx
mov dword [esi - 0x10], eax
inc edx
add esi, 0x20
add edi, 0x48
mov dword [ebp - 8], edx
cmp edx, dword [ebp - 0x28]
jl 0x10039983
mov ebx, dword [ebp - 0x24]
mov edi, dword [ebp - 0x38]
mov ecx, dword [ebp - 0xc]
mov eax, dword [edi]
mov edx, dword [eax + 8]
cmp edx, 3
jne 0x10039a72
cmp dword [ebp - 0x30], 0
je 0x10039a56
xor esi, esi
cmp dword [eax], esi
jbe 0x10039beb
mov edx, dword [ebp - 0x20]
add ecx, 2
mov eax, dword [ebp - 0x1c]
mov dword [ebp - 0x10], ebx
sub ebx, edx
sub eax, edx
mov dword [ebp - 0x10], eax
movzx eax, byte [ebx + edx]
lea ecx, [ecx + 4]
mov byte [ecx - 6], al
lea edx, [edx + 1]
movzx eax, byte [edx - 1]
inc esi
mov byte [ecx - 5], al
mov eax, dword [ebp - 0x10]
movzx eax, byte [eax + edx - 1]
mov byte [ecx - 4], al
mov byte [ecx - 3], 0xff
mov eax, dword [edi]
cmp esi, dword [eax]
jb 0x10039a24
mov ebx, dword [ebp - 0x24]
jmp 0x10039beb
push 4
push dword [eax]
mov eax, dword [edi + 0x4810]
push dword [ebp - 0x1c]
push dword [ebp - 0x20]
push ebx
push ecx
call eax
add esp, 0x18
jmp 0x10039beb
cmp edx, 4
jne 0x10039bca
mov edx, dword [edi + 0x47e8]
test edx, edx
jne 0x10039b26
mov dword [ebp - 8], edx
cmp dword [eax], edx
jbe 0x10039beb
mov eax, dword [ebp - 0x18]
lea esi, [ecx + 2]
mov ecx, dword [ebp - 0x20]
sub eax, ebx
sub ecx, ebx
mov dword [ebp - 0x10], ebx
mov dword [ebp - 0xc], ecx
mov ecx, dword [ebp - 0x1c]
sub ecx, ebx
mov dword [ebp - 0x2c], eax
mov dword [ebp - 0x3c], ecx
mov al, byte [eax + ebx]
lea esi, [esi + 4]
movzx ecx, byte [ebx]
lea ebx, [ebx + 1]
movzx edx, al
imul ecx, edx
sub ecx, 0xffffff80
mov eax, ecx
shr eax, 8
add eax, ecx
shr eax, 8
mov byte [esi - 6], al
mov eax, dword [ebp - 0xc]
movzx ecx, byte [eax + ebx - 1]
imul ecx, edx
sub ecx, 0xffffff80
mov eax, ecx
shr eax, 8
add eax, ecx
shr eax, 8
mov byte [esi - 5], al
mov eax, dword [ebp - 0x3c]
movzx ecx, byte [eax + ebx - 1]
imul ecx, edx
mov byte [esi - 3], 0xff
sub ecx, 0xffffff80
mov eax, ecx
shr eax, 8
add eax, ecx
mov ecx, dword [ebp - 8]
shr eax, 8
inc ecx
mov byte [esi - 4], al
mov eax, dword [edi]
mov dword [ebp - 8], ecx
cmp ecx, dword [eax]
mov eax, dword [ebp - 0x2c]
jb 0x10039ab2
mov ebx, dword [ebp - 0x24]
jmp 0x10039beb
push 4
push dword [eax]
mov eax, dword [edi + 0x4810]
push dword [ebp - 0x1c]
push dword [ebp - 0x20]
push ebx
push ecx
cmp edx, 2
jne 0x10039a68
call eax
mov eax, dword [edi]
add esp, 0x18
mov dword [ebp - 0x2c], 0
cmp dword [eax], 0
jbe 0x10039beb
mov esi, dword [ebp - 0xc]
mov ebx, dword [ebp - 0x2c]
add esi, 2
mov eax, dword [ebp - 0x18]
lea esi, [esi + 4]
mov al, byte [ebx + eax]
inc ebx
movzx edx, al
or al, 0xff
sub al, byte [esi - 6]
movzx ecx, al
imul ecx, edx
sub ecx, 0xffffff80
mov eax, ecx
shr eax, 8
add eax, ecx
shr eax, 8
mov byte [esi - 6], al
or al, 0xff
sub al, byte [esi - 5]
movzx ecx, al
imul ecx, edx
sub ecx, 0xffffff80
mov eax, ecx
shr eax, 8
add eax, ecx
shr eax, 8
mov byte [esi - 5], al
or al, 0xff
sub al, byte [esi - 4]
movzx ecx, al
imul ecx, edx
sub ecx, 0xffffff80
mov eax, ecx
shr eax, 8
add eax, ecx
shr eax, 8
mov byte [esi - 4], al
mov eax, dword [edi]
cmp ebx, dword [eax]
jb 0x10039b61
mov ebx, dword [ebp - 0x24]
jmp 0x10039beb
xor edx, edx
cmp dword [eax], edx
jbe 0x10039beb
inc ecx
mov al, byte [edx + ebx]
lea ecx, [ecx + 4]
mov byte [ecx - 3], al
inc edx
mov byte [ecx - 4], al
mov byte [ecx - 5], al
mov byte [ecx - 2], 0xff
mov eax, dword [edi]
cmp edx, dword [eax]
jb 0x10039bd1
mov edx, dword [ebp - 0x14]
mov ecx, dword [edi]
inc edx
mov esi, dword [ebp - 0x34]
mov dword [ebp - 0x14], edx
cmp edx, dword [ecx + 4]
jb 0x10039956
mov edx, dword [edi]
mov ecx, edi
push 0
mov edx, dword [edx + 8]
call fcn.10038690
mov ecx, dword [edi]
add esp, 4
mov edx, dword [ebp - 0x40]
mov eax, dword [ecx]
mov ecx, dword [ecx + 4]
mov dword [edx], eax
mov eax, dword [ebp + 8]
mov dword [eax], ecx
mov eax, esi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov edx, dword [edi]
mov ecx, edi
push 0
mov edx, dword [edx + 8]
call fcn.10038690
add esp, 4
xor eax, eax
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret