Function at 0x100592d0
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
sub esp, 0x28
push ebx
mov ebx, dword [esp + 0x30]
push ebp
push esi
push edi
mov edi, ecx
mov dword [esp + 0x10], edi
test ebx, ebx
je 0x10059912
mov esi, dword [ebx]
mov ebp, 0x10
mov edx, esi
mov eax, ebp
and edx, 0xf
sub eax, edx
neg edx
sbb edx, edx
and edx, eax
cmp word [edx + esi + 0x146], 0x18
jne 0x10059912
mov dword [edi], ebx
mov eax, ebp
mov edx, dword [ebx]
mov ecx, edx
and ecx, 0xf
sub eax, ecx
neg ecx
sbb ecx, ecx
and ecx, eax
mov eax, dword [ecx + edx + 0x13c]
mov dword [edi + 4], eax
mov eax, ebp
mov edx, dword [ebx]
mov ecx, edx
and ecx, 0xf
sub eax, ecx
neg ecx
sbb ecx, ecx
and ecx, eax
mov eax, dword [ecx + edx + 0x140]
mov dword [edi + 8], eax
mov ecx, dword [ebx]
mov edx, ecx
and edx, 0xf
je 0x1005935c
mov eax, ebp
sub eax, edx
mov edx, dword [ecx + eax + 0x13c]
jmp 0x10059364
mov edx, dword [ecx + 0x13c]
xor eax, eax
movzx eax, word [ecx + eax + 0x146]
mov esi, dword [edi + 0x10]
mov ebx, dword [esp + 0x40]
imul eax, edx
add eax, 7
shr eax, 3
mov dword [edi + 0xc], eax
cmp esi, ebx
jle 0x10059453
sub esi, ebx
xor ebp, ebp
mov dword [edi + 0x10], esi
test esi, esi
jle 0x100593d9
xor ebx, ebx
mov eax, ebp
mov ecx, dword [edi + 0x20]
shl eax, 0xc
lea ebx, [ebx + 0x10]
cdq
idiv esi
mov dword [ecx + ebx - 8], eax
mov dword [ecx + ebx - 0xc], eax
mov dword [ecx + ebx - 0x10], eax
mov eax, 0x10000
cdq
idiv dword [edi + 0x10]
mov ecx, dword [edi + 0x428]
mov dword [ecx + ebp*4], eax
mov eax, dword [edi + 0x424]
mov dword [eax + ebp*4], 0
inc ebp
mov esi, dword [edi + 0x10]
cmp ebp, esi
jl 0x10059394
mov ebx, dword [esp + 0x40]
push ecx
mov ecx, edi
call fcn.10058d90
mov eax, dword [edi + 0x10]
xor esi, esi
test eax, eax
jle 0x1005944e
xor edx, edx
mov ebp, 0xff
mov ecx, dword [edi + 0x20]
lea edx, [edx + 0x10]
mov eax, dword [ecx + edx - 0x10]
add eax, 8
sar eax, 4
cmp eax, 0xff
cmovg eax, ebp
mov dword [ecx + edx - 0x10], eax
mov ecx, dword [edi + 0x20]
mov eax, dword [ecx + edx - 0xc]
add eax, 8
sar eax, 4
cmp eax, 0xff
cmovg eax, ebp
mov dword [ecx + edx - 0xc], eax
mov ecx, dword [edi + 0x20]
mov eax, dword [ecx + edx - 8]
add eax, 8
sar eax, 4
cmp eax, 0xff
cmovg eax, ebp
mov dword [ecx + edx - 8], eax
mov eax, dword [edi + 0x20]
mov dword [edx + eax - 4], esi
inc esi
mov eax, dword [edi + 0x10]
cmp esi, eax
jl 0x100593f1
add eax, ebx
mov dword [edi + 0x10], eax
xor esi, esi
test ebx, ebx
jle 0x100594b5
mov ebp, dword [esp + 0x44]
add ebp, 2
mov ecx, dword [edi + 0x10]
lea ebp, [ebp + 4]
mov eax, dword [edi + 0x20]
sub ecx, ebx
movzx edx, byte [ebp - 6]
add ecx, esi
add ecx, ecx
mov dword [eax + ecx*8], edx
mov ecx, dword [edi + 0x10]
mov eax, dword [edi + 0x20]
sub ecx, ebx
movzx edx, byte [ebp - 5]
add ecx, esi
add ecx, ecx
mov dword [eax + ecx*8 + 4], edx
mov ecx, dword [edi + 0x10]
mov eax, dword [edi + 0x20]
sub ecx, ebx
movzx edx, byte [ebp - 4]
add ecx, esi
add ecx, ecx
mov dword [eax + ecx*8 + 8], edx
mov edx, dword [edi + 0x10]
mov eax, dword [edi + 0x20]
sub edx, ebx
add edx, esi
inc esi
mov ecx, edx
add ecx, ecx
mov dword [eax + ecx*8 + 0xc], edx
cmp esi, ebx
jl 0x10059460
mov eax, dword [edi + 4]
cdq
mov ebp, eax
mov eax, dword [edi + 8]
xor ebp, edx
sub ebp, edx
cdq
mov ebx, eax
xor ebx, edx
sub ebx, edx
test ebp, ebp
jle 0x10059912
test ebx, ebx
jle 0x10059912
push 4
call fcn.102709ea
mov esi, eax
add esp, 4
mov dword [esp + 0x18], esi
test esi, esi
je 0x10059912
push 0
push 8
push ebx
mov edx, ebp
xor ecx, ecx
call fcn.10001ab0
add esp, 0xc
mov dword [esp + 0x40], eax
test eax, eax
jne 0x1005951f
push esi
call fcn.10270662
add esp, 4
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x28
ret 0x10
push 0x10
push eax
call fcn.102705fd
mov esi, eax
add esp, 8
mov eax, dword [esp + 0x18]
mov dword [eax], esi
test esi, esi
je 0x10059909
push dword [esp + 0x40]
push 0
push esi
call fcn.1026c8e0
push 0x100
lea eax, [esi + 8]
mov dword [esi], 1
mov dword [esi + 4], 0
push 0xff
push eax
mov dword [esi + 0x10c], 0
mov dword [esi + 0x108], 0
call fcn.1026c8e0
mov dword [esi + 0x120], 1
xor eax, eax
push 0x103d71d5
push 8
mov dword [esi + 0x114], 0
mov dword [esi + 0x118], 0
mov word [esi + 0x110], ax
call fcn.10269fcd
add esp, 0x20
mov dword [esp + 0x40], eax
test eax, eax
je 0x100595e5
push 0x18
mov dword [eax], 0
mov dword [eax + 4], 0
call fcn.10269f9d
mov ecx, dword [esp + 0x44]
add esp, 4
mov dword [eax], eax
mov dword [eax + 4], eax
mov dword [eax + 8], eax
mov word [eax + 0xc], 0x101
mov dword [ecx], eax
jmp 0x100595e7
xor ecx, ecx
mov dword [esi + 0x11c], ecx
mov eax, 0x10
mov ecx, esi
mov dword [esi + 0x124], 0
and ecx, 0xf
mov dword [esi + 0x128], 0
sub eax, ecx
mov dword [esi + 0x12c], 0
neg ecx
sbb ecx, ecx
and ecx, eax
mov dword [ecx + esi + 0x13c], ebp
mov ebp, dword [esp + 0x18]
push ebp
mov dword [ecx + esi + 0x138], 0x28
mov dword [ecx + esi + 0x140], ebx
mov dword [ecx + esi + 0x144], 0x80001
mov dword [ecx + esi + 0x148], 0
mov dword [ecx + esi + 0x158], 0x100
mov dword [ecx + esi + 0x15c], 0x100
mov dword [ecx + esi + 0x150], 0xb13
mov dword [ecx + esi + 0x154], 0xb13
call sym.FreeImage32.dll__FreeImage_GetPalette_4
xor ecx, ecx
inc eax
mov byte [eax + 1], cl
lea eax, [eax + 4]
mov byte [eax - 4], cl
mov byte [eax - 5], cl
inc ecx
cmp ecx, 0x100
jl 0x10059685
mov esi, dword [ebp]
mov edx, 0x10
mov ecx, esi
mov ebx, edx
and ecx, 0xf
sub edx, ecx
sub ebx, ecx
mov eax, ecx
neg eax
sbb eax, eax
and eax, edx
cmp word [eax + esi + 0x146], 0x10
jae 0x100596d1
xor eax, eax
test ecx, ecx
lea ecx, [esi + 0x162]
cmovne eax, ebx
add ecx, eax
jmp 0x100596d6
mov ecx, 2
xor esi, esi
cmp dword [edi + 0x10], esi
jle 0x10059710
xor edx, edx
mov dword [esp + 0x18], ebp
mov eax, dword [edi + 0x20]
lea edx, [edx + 0x10]
inc esi
lea ecx, [ecx + 4]
movzx eax, byte [edx + eax - 0x10]
mov byte [ecx - 6], al
mov eax, dword [edi + 0x20]
movzx eax, byte [edx + eax - 0xc]
mov byte [ecx - 5], al
mov eax, dword [edi + 0x20]
movzx eax, byte [edx + eax - 8]
mov byte [ecx - 4], al
cmp esi, dword [edi + 0x10]
jl 0x100596e3
mov ecx, edi
call fcn.10058c20
xor ebx, ebx
mov dword [esp + 0x30], ebx
cmp dword [edi + 8], ebx
jle 0x100597f0
xor esi, esi
push esi
push ebp
call sym.FreeImage32.dll__FreeImage_GetScanLine_8
push esi
push dword [edi]
mov dword [esp + 0x3c], eax
call sym.FreeImage32.dll__FreeImage_GetScanLine_8
cmp dword [edi + 4], 0
mov edx, eax
mov dword [esp + 0x24], eax
mov dword [esp + 0x28], 0
jle 0x100597df
mov dword [esp + 0x2c], 0
nop dword [eax + eax]
movzx ecx, byte [edx + 2]
mov ebx, 0x3e8
movzx eax, byte [edx + 1]
mov esi, dword [edi + 0x10]
mov dword [esp + 0x20], ecx
movzx ecx, byte [edx]
or edx, 0xffffffff
mov dword [esp + 0x1c], ecx
mov ecx, dword [edi + eax*4 + 0x24]
mov dword [esp + 0x40], eax
mov dword [esp + 0x44], edx
mov dword [esp + 0x3c], ecx
lea ebp, [ecx - 1]
mov dword [esp + 0x14], esi
jmp 0x100597a0
mov eax, dword [esp + 0x40]
mov edi, dword [esp + 0x10]
nop
cmp ecx, esi
jl 0x100597fc
test ebp, ebp
jns 0x10059888
mov eax, dword [esp + 0x2c]
mov ecx, dword [esp + 0x34]
mov byte [eax + ecx], dl
mov eax, dword [esp + 0x28]
mov edx, dword [esp + 0x24]
inc eax
mov dword [esp + 0x28], eax
add edx, 3
movzx eax, ax
mov dword [esp + 0x24], edx
mov dword [esp + 0x2c], eax
cmp eax, dword [edi + 4]
jl 0x10059760
mov ebx, dword [esp + 0x30]
mov ebp, dword [esp + 0x18]
inc ebx
movzx esi, bx
mov dword [esp + 0x30], ebx
cmp esi, dword [edi + 8]
jl 0x10059728
pop edi
pop esi
mov eax, ebp
pop ebp
pop ebx
add esp, 0x28
ret 0x10
mov esi, ecx
shl esi, 4
add esi, dword [edi + 0x20]
mov edx, dword [esi + 4]
sub edx, eax
cmp edx, ebx
jl 0x10059818
mov esi, dword [edi + 0x10]
mov ecx, esi
mov dword [esp + 0x3c], esi
jmp 0x1005987c
mov edi, dword [esp + 0x1c]
inc ecx
mov eax, dword [esp + 0x40]
mov dword [esp + 0x3c], ecx
mov ecx, dword [esi]
sub ecx, edi
sub edi, dword [esi]
test ecx, ecx
cmovns edi, ecx
sub eax, dword [esi + 4]
test edx, edx
cmovns eax, edx
add edi, eax
mov eax, dword [esp + 0x40]
cmp edi, ebx
jge 0x10059870
mov edx, dword [esi + 8]
mov ecx, dword [esp + 0x20]
sub edx, ecx
sub ecx, dword [esi + 8]
test edx, edx
cmovns ecx, edx
add edi, ecx
mov ecx, dword [esp + 0x3c]
cmp edi, ebx
jge 0x10059874
mov edx, dword [esi + 0xc]
mov ebx, edi
mov edi, dword [esp + 0x10]
mov esi, dword [esp + 0x14]
mov dword [esp + 0x44], edx
jmp 0x10059880
mov ecx, dword [esp + 0x3c]
mov esi, dword [esp + 0x14]
mov edi, dword [esp + 0x10]
mov edx, dword [esp + 0x44]
test ebp, ebp
js 0x100597a0
mov ecx, dword [esp + 0x40]
mov eax, ebp
shl eax, 4
add eax, dword [edi + 0x20]
mov edi, dword [eax + 4]
sub ecx, edi
cmp ecx, ebx
jl 0x100598a9
mov ecx, dword [esp + 0x3c]
or ebp, 0xffffffff
jmp 0x10059797
sub edi, dword [esp + 0x40]
dec ebp
mov esi, dword [eax]
test ecx, ecx
mov edx, dword [esp + 0x44]
cmovns edi, ecx
mov ecx, dword [esp + 0x1c]
sub ecx, esi
sub esi, dword [esp + 0x1c]
cmovns ecx, esi
mov esi, dword [esp + 0x14]
add edi, ecx
mov ecx, dword [esp + 0x3c]
cmp edi, ebx
jge 0x10059797
mov esi, dword [eax + 8]
mov edx, dword [esp + 0x20]
sub esi, edx
sub edx, dword [eax + 8]
test esi, esi
cmovns edx, esi
mov esi, dword [esp + 0x14]
add edi, edx
mov edx, dword [esp + 0x44]
cmp edi, ebx
jge 0x10059797
mov edx, dword [eax + 0xc]
mov ebx, edi
mov dword [esp + 0x44], edx
jmp 0x10059797
push eax
call fcn.10270662
add esp, 4
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x28
ret 0x10