Function at 0x1002b6a0
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
sub esp, 0x10
push ebx
push ebp
mov bp, word [esp + 0x20]
push esi
mov esi, eax
push edi
mov ebx, ecx
test esi, esi
je 0x1002b6f1
mov eax, dword [esi]
lea ecx, [eax + 0x128]
mov edx, ecx
and edx, 0xf
je 0x1002b6cc
mov eax, 0x10
sub eax, edx
jmp 0x1002b6ce
xor eax, eax
mov edi, 0x10
cmp word [eax + ecx + 0x16], di
jae 0x1002b6f1
mov eax, ecx
and eax, 0xf
je 0x1002b6e9
sub edi, eax
lea edi, [edi + ecx + 0x30]
jmp 0x1002b6f3
xor edi, edi
lea edi, [edi + ecx + 0x30]
jmp 0x1002b6f3
xor edi, edi
movzx eax, bp
test eax, eax
jl 0x1002b8ff
cmp eax, 1
jle 0x1002b839
cmp eax, 3
jne 0x1002b8ff
lea eax, [esp + 0x10]
push eax
mov eax, dword [esp + 0x28]
lea ecx, [esp + 0x18]
push ecx
lea edx, [esp + 0x30]
push edx
push 0x140
push eax
call fcn.100d0760
mov ebp, dword [esp + 0x24]
mov cl, bl
mov ebx, dword [esp + 0x28]
mov esi, 1
shl esi, cl
mov ecx, dword [esp + 0x3c]
push ebx
mov edx, ebp
mov eax, esi
call fcn.1002b300
add esp, 0x18
cmp ax, 0x10
jne 0x1002b7fb
lea ebp, [esi - 1]
test ebp, ebp
jl 0x1002b8ff
mov eax, dword [esp + 0x28]
mov ecx, dword [esp + 0x10]
sub eax, ebx
sub ecx, ebx
lea esi, [ebx + ebp*2]
lea edi, [edi + ebp*4 + 1]
mov dword [esp + 0x18], eax
mov dword [esp + 0x1c], ecx
jmp 0x1002b786
mov eax, dword [esp + 0x18]
movzx ecx, word [eax + esi]
imul ecx, ecx, 0xff
mov eax, 0x80008001
imul ecx
add edx, ecx
sar edx, 0xf
mov ecx, edx
shr ecx, 0x1f
add ecx, edx
mov byte [edi + 1], cl
movzx ecx, word [esi]
imul ecx, ecx, 0xff
mov eax, 0x80008001
imul ecx
add edx, ecx
mov ecx, dword [esp + 0x1c]
sar edx, 0xf
mov eax, edx
shr eax, 0x1f
add eax, edx
mov byte [edi], al
movzx ecx, word [ecx + esi]
imul ecx, ecx, 0xff
mov eax, 0x80008001
imul ecx
add edx, ecx
sar edx, 0xf
mov eax, edx
shr eax, 0x1f
add eax, edx
mov byte [edi - 1], al
dec ebp
sub esi, 2
sub edi, 4
test ebp, ebp
jge 0x1002b782
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x10
ret
add esi, 0xffffffff
js 0x1002b8ff
lea ecx, [edi + esi*4 + 1]
mov edi, dword [esp + 0x28]
sub edi, ebx
lea eax, [ebx + esi*2]
sub ebp, ebx
movzx edx, byte [eax + edi]
mov byte [ecx + 1], dl
movzx edx, byte [eax]
mov byte [ecx], dl
movzx edx, byte [eax + ebp]
mov byte [ecx - 1], dl
dec esi
sub eax, 2
sub ecx, 4
test esi, esi
jge 0x1002b813
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x10
ret
cmp bx, 1
jne 0x1002b882
test bp, bp
jne 0x1002b863
mov byte [edi], 0xff
mov byte [edi + 1], 0xff
mov byte [edi + 2], 0xff
mov byte [edi + 4], 0
mov byte [edi + 5], 0
mov byte [edi + 6], 0
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x10
ret
mov byte [edi], 0
mov byte [edi + 1], 0
mov byte [edi + 2], 0
mov byte [edi + 4], 0xff
mov byte [edi + 5], 0xff
mov byte [edi + 6], 0xff
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x10
ret
cmp bx, 4
je 0x1002b88e
cmp bx, 8
jne 0x1002b8ff
push esi
call sym.FreeImage.dll__FreeImage_GetColorsUsed_4
xor ebx, ebx
mov esi, eax
cmp bp, 1
jne 0x1002b8ce
test esi, esi
jle 0x1002b8ff
mov eax, 0xff
lea ecx, [esi - 1]
cdq
idiv ecx
lea ecx, [edi + 2]
mov edx, eax
mov al, dl
imul bl
mov byte [ecx - 2], al
mov byte [ecx - 1], al
mov byte [ecx], al
inc ebx
add ecx, 4
cmp ebx, esi
jl 0x1002b8b2
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x10
ret
test esi, esi
jle 0x1002b8ff
mov eax, 0xff
cdq
lea ecx, [esi - 1]
idiv ecx
lea edx, [edi + 2]
mov dword [esp + 0x28], eax
mov al, byte [esp + 0x28]
imul bl
or cl, 0xff
sub cl, al
mov byte [edx - 2], cl
mov byte [edx - 1], cl
mov byte [edx], cl
inc ebx
add edx, 4
cmp ebx, esi
jl 0x1002b8e4
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x10
ret