Function at 0x10051630
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x3f4
mov eax, dword [0x10188068]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 8]
mov dword [ebp - 0x3dc], eax
mov eax, dword [ebp + 0xc]
push ebx
mov dword [ebp - 0x3d0], eax
xor ebx, ebx
mov eax, dword [ebp + 0x1c]
push esi
mov esi, dword [ebp + 0x14]
mov dword [ebp - 0x3f0], eax
mov eax, dword [ebp + 0x20]
push edi
mov edi, dword [ebp + 0x10]
mov dword [ebp - 0x3ec], eax
mov eax, dword [ebp + 0x2c]
push 0x2c
mov dword [ebp - 0x3d4], eax
lea eax, [ebp - 0x3c0]
push ebx
push eax
mov dword [ebp - 0x3e8], edi
mov dword [ebp - 0x3c8], esi
mov dword [ebp - 0x3e0], ebx
call fcn.1002ae80
mov eax, dword [ebp - 0x3dc]
add esp, 0xc
test eax, eax
jne 0x100516c2
push 0
push 0
push 0
push 0
push 0xffffff37
call sym.NBUidai.dll_NBErrorsSetLastA
mov ebx, eax
jmp 0x10051cab
cmp dword [ebp - 0x3d0], ebx
je 0x100516a9
test edi, edi
je 0x100516a9
test esi, esi
je 0x100516a9
cmp dword [ebp + 0x28], ebx
je 0x100516a9
cmp dword [ebp - 0x3d4], ebx
je 0x100516a9
lea ecx, [ebp - 0x3f4]
push ecx
push eax
call fcn.1004ce10
test eax, eax
jne 0x100516bb
lea eax, [ebp - 0x3cc]
mov dword [ebp - 0x3cc], 0xffffffff
push eax
call fcn.1004f2f0
test eax, eax
jne 0x100516bb
mov eax, dword [ebp - 0x3dc]
mov eax, dword [eax + 0x18]
cmp eax, dword [ebp - 0x3cc]
je 0x10051734
push 0
push 0
push 0
push 0
push 0xfffffe6e
call sym.NBUidai.dll_NBErrorsSetLastA
mov ebx, eax
jmp 0x10051cab
mov eax, dword [ebp - 0x3d4]
cmp dword [eax], ebx
jne 0x10051760
mov eax, dword [ebp + 0x28]
xor ecx, ecx
mov edx, dword [ebp - 0x3d0]
mov eax, dword [eax]
cmp eax, dword [edx + 8]
mov eax, dword [ebp - 0x3d4]
setg cl
lea ecx, [ecx*2 + 4]
mov dword [eax], ecx
lea eax, [ebp - 0x3e0]
push eax
push dword [ebp + 0x18]
call fcn.100097c0
test eax, eax
jne 0x100516bb
mov ecx, dword [ebp - 0x3d0]
mov eax, dword [ebp - 0x3e0]
mov ecx, dword [ecx + 4]
mov dword [ebp - 0x3cc], ecx
cmp ecx, 1
je 0x1005179d
cmp ecx, 3
je 0x1005179d
mov eax, 0xfffffda7
jmp 0x100517a6
test eax, eax
jne 0x100517bf
mov eax, 0xffffff37
push 0
push 0
push 0
push 0
push eax
call sym.NBUidai.dll_NBErrorsSetLastA
test eax, eax
je 0x1005182c
mov ebx, eax
jmp 0x10051cab
xor esi, esi
cmp dword [edi + 0x10], ebx
jbe 0x10051826
mov ebx, eax
mov eax, dword [edi + 0x14]
xor edx, edx
test eax, eax
je 0x1005181e
cmp ecx, 3
jne 0x100517f1
imul eax, esi
lea ecx, [edx + 1]
imul ecx, dword [edi + 0x10]
add eax, dword [ebp - 0x3c8]
sub ecx, esi
mov al, byte [eax + edx]
mov byte [ecx + ebx - 1], al
jmp 0x10051810
cmp ecx, 1
jne 0x10051816
mov ecx, eax
sub eax, edx
imul ecx, esi
dec eax
imul eax, dword [edi + 0x10]
add ecx, dword [ebp - 0x3c8]
add eax, esi
mov cl, byte [ecx + edx]
mov byte [eax + ebx], cl
mov ecx, dword [ebp - 0x3cc]
mov eax, dword [edi + 0x14]
inc edx
cmp edx, eax
jb 0x100517d1
inc esi
cmp esi, dword [edi + 0x10]
jb 0x100517c8
xor ebx, ebx
mov esi, dword [ebp - 0x3c8]
push dword [ebp + 0x18]
push dword [ebp - 0x3e0]
push esi
call fcn.10009d90
test eax, eax
jne 0x100516bb
mov edx, dword [ebp - 0x3d4]
cmp dword [edx], 4
je 0x10051a55
mov ecx, dword [ebp - 0x3d0]
mov eax, dword [ecx]
cmp eax, 0x69
je 0x10051b8f
cmp eax, 0x6b
je 0x10051b8f
cmp eax, 0x6c
je 0x10051b8f
lea eax, [ebp - 0x3cc]
mov dword [ebp - 0x3cc], 0
push eax
push 0x190
lea eax, [ebp - 0x394]
push eax
push esi
push edi
call fcn.10050fd0
add esp, 0x14
test eax, eax
jne 0x100516bb
mov eax, dword [ebp - 0x3cc]
test eax, eax
jns 0x100518c4
push 0
push 0
push 0
push 0
push 0xffffffffffffff9c
call sym.NBUidai.dll_NBErrorsSetLastA
mov ebx, eax
jmp 0x10051cab
push 0x200
lea eax, [ebp - 0x204]
push 0
push eax
call fcn.1002ae80
mov edx, dword [ebp - 0x3cc]
add esp, 0xc
xor ecx, ecx
test edx, edx
jle 0x10051908
xor eax, eax
nop dword [eax + eax]
movzx eax, byte [ebp + eax - 0x394]
inc ecx
inc word [ebp + eax*2 - 0x204]
movsx eax, cx
cmp eax, edx
jl 0x100518f0
mov byte [ebp - 0x3c1], 0xff
lea ecx, [ebp - 0x204]
xor edx, edx
mov esi, 0x100
nop dword [eax]
movzx eax, word [ecx]
lea ecx, [ecx + 2]
add edx, eax
sub esi, 1
jne 0x10051920
mov esi, dword [ebp - 0x3c8]
lea ecx, [edx + edx*4]
add ecx, ecx
mov eax, 0x51eb851f
imul ecx
sar edx, 5
mov eax, edx
shr eax, 0x1f
add eax, edx
xor edx, edx
mov dword [ebp - 0x3d8], eax
xor ecx, ecx
movsx eax, cx
movzx eax, word [ebp + eax*2 - 0x204]
add edx, eax
cmp edx, dword [ebp - 0x3d8]
jg 0x1005197b
inc ecx
mov eax, 0x100
cmp cx, ax
jl 0x10051953
mov al, byte [ebp - 0x3c1]
jmp 0x1005197d
mov al, cl
not al
mov edx, dword [ebp - 0x3d0]
movzx eax, al
mov dword [ebp - 0x3e4], eax
mov ecx, dword [edx + 8]
mov dword [ebp - 0x3d8], ecx
cmp eax, ecx
jl 0x10051a35
mov al, byte [edx + 0x18]
xor edx, edx
mov byte [ebp - 0x3c1], al
mov eax, dword [ebp - 0x3cc]
movzx eax, ax
mov dword [ebp - 0x3cc], eax
test eax, eax
je 0x100519f7
xor ebx, ebx
mov edi, eax
xor esi, esi
lea eax, [edx + 1]
movzx ecx, ax
movzx eax, dx
mov dl, byte [ebp - 0x3c1]
cmp byte [ebp + ebx - 0x394], dl
cmova ecx, eax
inc esi
movsx ebx, si
movzx eax, cx
mov edx, eax
cmp ebx, edi
jl 0x100519c3
mov edi, dword [ebp - 0x3e8]
xor ebx, ebx
mov esi, dword [ebp - 0x3c8]
movsx eax, dx
imul eax, eax, 0x64
cdq
idiv dword [ebp - 0x3cc]
movzx ecx, al
xor edx, edx
mov eax, dword [ebp - 0x3d0]
mov eax, dword [eax + 0x10]
cmp ecx, eax
setg dl
jle 0x10051a37
mov ecx, dword [ebp - 0x3d4]
mov eax, dword [ebp - 0x3d8]
cmp dword [ebp - 0x3e4], eax
jge 0x10051a45
mov dword [ecx], 6
jmp 0x10051a55
xor edx, edx
mov ecx, dword [ebp - 0x3d4]
mov dword [ecx], 7
jmp 0x10051a1f
test edx, edx
je 0x10051a55
mov edx, dword [ebp - 0x3d4]
mov dword [edx], 1
mov ecx, dword [ebp - 0x3d0]
mov eax, dword [ecx]
cmp eax, 0x69
je 0x10051c46
cmp eax, 0x6b
je 0x10051c46
cmp eax, 0x6c
je 0x10051c46
lea eax, [ebp - 0x3c8]
mov dword [ebp - 0x3c8], 0
push eax
push edi
push ecx
call fcn.10051360
add esp, 0xc
test eax, eax
jne 0x100516bb
mov eax, dword [ebp - 0x3d4]
cmp dword [eax], 4
mov eax, dword [ebp - 0x3c8]
jne 0x10051bc8
test eax, eax
jne 0x10051b6b
movups xmm0, xmmword [edi]
mov eax, dword [edi + 0x20]
lea ecx, [ebp - 0x39c]
push ecx
mov dword [ebp - 0x3a0], eax
mov eax, dword [ebp + 0x18]
push eax
movups xmmword [ebp - 0x3c0], xmm0
push esi
movups xmm0, xmmword [edi + 0x10]
push 1
mov dword [ebp - 0x398], eax
movups xmmword [ebp - 0x3b0], xmm0
call fcn.10009980
test eax, eax
jne 0x100516bb
push 0x2c
lea eax, [ebp - 0x3c0]
push eax
mov eax, dword [ebp - 0x3d0]
push dword [eax + 0x14]
call fcn.1000adb0
test eax, eax
jne 0x100516bb
mov dword [ebp - 0x39c], eax
lea eax, [ebp - 0x3c8]
push eax
push edi
push dword [ebp - 0x3d0]
call fcn.10051360
add esp, 0xc
test eax, eax
jne 0x100516bb
mov ecx, dword [ebp - 0x3d0]
lea eax, [ecx + 0x18]
push eax
push esi
push edi
push ecx
push dword [ebp - 0x3dc]
call fcn.10051200
add esp, 0x14
test eax, eax
jne 0x100516bb
mov eax, dword [ebp - 0x3c8]
test eax, eax
je 0x100516a9
mov ecx, dword [ebp + 0x18]
cmp dword [eax + 0x28], ecx
je 0x10051ba8
push 0
push 0
push 0
push str.Source_buffer_does_not_match_background_buffer_size
push 0xffffff36
call sym.NBUidai.dll_NBErrorsSetLastA
mov ebx, eax
jmp 0x10051cab
mov eax, dword [ebp + 0x28]
mov eax, dword [eax]
cmp eax, dword [ecx + 8]
jge 0x10051a4f
mov dword [edx], 6
jmp 0x10051a55
mov edx, dword [ebp + 0x28]
cmp dword [edx], 0x14
jg 0x10051bcb
push ecx
push esi
push dword [eax + 0x24]
call fcn.10009d90
test eax, eax
jne 0x100516bb
mov eax, dword [ebp - 0x3c8]
mov ecx, dword [ebp + 0x18]
mov edx, dword [ebp - 0x3dc]
cmp dword [edx + 0xe4], 0
je 0x10051c46
test eax, eax
je 0x10051c3a
xor edx, edx
test ecx, ecx
je 0x10051c46
mov ebx, dword [ebp - 0x3c8]
mov edi, dword [ebp + 0x18]
mov dword [ebp - 0x3e4], 0xff
nop word [eax + eax]
mov eax, dword [ebx + 0x24]
movzx ecx, byte [esi + edx]
movzx eax, byte [edx + eax]
sub cx, ax
mov eax, 0xff
add cx, ax
cmp cx, word [ebp - 0x3e4]
movzx eax, cl
mov ecx, 0xff
cmovg eax, ecx
mov byte [esi + edx], al
inc edx
cmp edx, edi
jb 0x10051c00
mov edi, dword [ebp - 0x3e8]
xor ebx, ebx
jmp 0x10051c46
mov eax, dword [ebp - 0x3d4]
mov dword [eax], 5
mov eax, dword [ebp - 0x3f0]
test eax, eax
je 0x10051cab
cmp dword [ebp - 0x3ec], 0
je 0x10051cab
cmp edi, eax
je 0x10051cab
cmp dword [eax + 4], 0
je 0x10051cab
mov ecx, dword [eax + 0x14]
mov edx, dword [eax + 0x10]
mov eax, edx
imul eax, ecx
cmp dword [ebp + 0x24], eax
jae 0x10051c89
push 0
push 0
push 0
push 0
push 0xffffff34
call sym.NBUidai.dll_NBErrorsSetLastA
mov ebx, eax
jmp 0x10051cab
push dword [ebp - 0x3ec]
mov eax, dword [edi + 0x10]
push ecx
push edx
push esi
push eax
push dword [edi + 0x14]
push eax
push 0
push 0
call fcn.10051e50
add esp, 0x24
test eax, eax
cmovne ebx, eax
push dword [ebp - 0x39c]
call fcn.10009af0
push dword [ebp - 0x3e0]
call fcn.10009af0
mov ecx, dword [ebp - 4]
mov eax, ebx
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.10029ae5
mov esp, ebp
pop ebp
ret 0x28