Function at 0x40565a
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x83c
push ebx
mov ebx, dword [ebp + 8]
and dword [ebx + 0x11b4], 0
push esi
mov esi, dword [ebx + 0x11c4]
mov eax, dword [esi + 4]
push edi
mov dword [ebx + 0x11f0], eax
mov eax, dword [esi + 8]
push ebx
mov dword [ebx + 0x11f4], eax
call fcn.0041ace7
mov eax, dword [esi + 0x20]
test eax, eax
je 0x40569a
mov dword [ebp - 4], eax
jmp 0x4056a5
mov cl, byte [esi + 0xe]
xor eax, eax
inc eax
shl eax, cl
mov dword [ebp - 4], eax
cmp eax, 0x100
mov ecx, 0x300
mov word [ebp - 0x412], ax
mov word [ebp - 0x414], cx
lea edi, [ebp - 0x410]
jle 0x40582e
cmp dword [0x43a82c], 8
jg 0x40592f
and dword [ebp - 8], 0
mov ecx, 0xd8
lea eax, [ebp - 0x814]
mov word [ebp - 0x412], cx
and dword [ebp + 8], 0
xor ecx, ecx
mov dl, byte [ebp + 8]
mov byte [edi + 1], dl
mov byte [eax + 1], dl
mov edx, dword [ebp - 8]
mov byte [edi], cl
mov byte [eax + 2], cl
mov byte [edi + 2], dl
mov byte [eax], dl
mov byte [edi + 3], 0
mov byte [eax + 3], 0
add ecx, 0x33
add eax, 4
add edi, 4
cmp ecx, 0xff
jle 0x4056f2
add dword [ebp + 8], 0x33
cmp dword [ebp + 8], 0xff
jle 0x4056f0
add edx, 0x33
cmp edx, 0xff
mov dword [ebp - 8], edx
jle 0x4056ec
cmp word [esi + 0xe], 0x18
jne 0x40591c
mov eax, dword [ebx + 0x11f4]
imul eax, dword [ebx + 0x11f0]
mov edi, dword [ebx + 0x11b8]
mov dword [esi + 0x14], eax
xor eax, eax
cmp dword [ebx + 0x11f4], eax
mov dword [ebp - 4], edi
mov dword [ebp - 8], eax
jle 0x4057e3
cmp dword [esi + 4], eax
mov dword [ebp - 0xc], eax
jle 0x4057c1
movzx eax, byte [edi]
add eax, 0x19
cdq
push 0x33
pop ecx
idiv ecx
inc edi
mov dword [ebp - 0x10], eax
movzx eax, byte [edi]
add eax, 0x19
cdq
idiv ecx
inc edi
mov dword [ebp + 8], eax
movzx eax, byte [edi]
add eax, 0x19
cdq
idiv ecx
mov dl, 6
mov ecx, eax
mov al, byte [ebp - 0x10]
imul dl
add al, byte [ebp + 8]
imul dl
add cl, al
mov eax, dword [ebp - 4]
inc dword [ebp - 4]
inc edi
inc dword [ebp - 0xc]
mov byte [eax], cl
mov eax, dword [ebp - 0xc]
cmp eax, dword [esi + 4]
jl 0x405775
xor eax, eax
mov ecx, edi
neg ecx
and ecx, 3
add edi, ecx
mov ecx, dword [ebp - 4]
neg ecx
and ecx, 3
add dword [ebp - 4], ecx
inc dword [ebp - 8]
mov ecx, dword [ebp - 8]
cmp ecx, dword [ebx + 0x11f4]
jl 0x40576d
push 8
pop ecx
push 0xa
mov word [esi + 0xe], cx
pop ecx
mov dword [esi + 0x10], eax
mov dword [esi + 0x20], 0xd8
mov dword [esi + 0x24], eax
push dword [ebx + 0x11c4]
lea edi, [ebp - 0x83c]
push 0
push dword [0x43b608]
rep movsd dword es:[edi], dword [esi]
call dword [sym.imp.KERNEL32.dll_HeapFree]
and dword [ebx + 0x11c8], 0
lea eax, [ebp - 0x83c]
mov dword [ebx + 0x11c4], eax
jmp 0x40591c
mov edi, dword [esi]
shl eax, 2
push eax
add edi, esi
push edi
mov byte [ebp + 0xb], 0
call dword [sym.imp.KERNEL32.dll_IsBadReadPtr]
test eax, eax
jne 0x40592f
mov ecx, dword [ebp - 4]
cmp ecx, 2
jne 0x405868
cmp dword [edi], eax
jne 0x405868
cmp dword [edi + 4], 0xffffff
jne 0x405868
mov dword [0x436888], 1
test ecx, ecx
jle 0x40591c
lea eax, [ebp - 0x40e]
mov dl, byte [edi + 2]
mov byte [eax - 2], dl
mov dl, byte [edi + 1]
mov byte [eax - 1], dl
mov dl, byte [edi]
mov byte [eax], dl
mov byte [eax + 1], 0
mov dl, byte [edi + 3]
or byte [ebp + 0xb], dl
add edi, 4
add eax, 4
dec ecx
jne 0x405876
cmp byte [ebp + 0xb], 0x80
jbe 0x40591c
mov edi, dword [esi]
xor eax, eax
mov dword [ebp - 0xc], eax
mov dword [ebp - 8], eax
add edi, esi
mov byte [ebp + 0xb], 0x60
mov byte [ebx + 0x11d4], al
mov byte [ebx + 0x11d5], 1
mov cl, byte [edi + 3]
cmp byte [ebp + 0xb], cl
jbe 0x4058cd
mov byte [ebp + 0xb], cl
mov dword [ebx + 0x11d0], eax
mov esi, dword [ebp - 0xc]
cmp esi, 0x280
jae 0x405913
movzx edx, byte [edi + 1]
movzx ecx, byte [edi + 2]
add ecx, edx
movzx edx, byte [edi]
add ecx, edx
cmp esi, ecx
jae 0x405905
mov dword [ebp - 0xc], ecx
mov cl, byte [ebx + 0x11d4]
mov dword [ebp - 8], esi
mov byte [ebx + 0x11d5], cl
mov byte [ebx + 0x11d4], al
jmp 0x405913
cmp dword [ebp - 8], ecx
jae 0x405913
mov dword [ebp - 8], ecx
mov byte [ebx + 0x11d5], al
inc eax
add edi, 4
cmp eax, dword [ebp - 4]
jl 0x4058bc
lea eax, [ebp - 0x414]
push eax
call dword [sym.imp.GDI32.dll_CreatePalette]
mov dword [ebx + 0x11b4], eax
pop edi
pop esi
pop ebx
leave
ret 4