Function at 0x40d120
Capabilities:
Encode data using xor

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x18
push ebx
mov ebx, dword [ebp + 8]
push esi
push edi
push 0x4c0ed0
push ebx
call fcn.0046f500
mov esi, eax
add esp, 8
cmp dword [esi + 0x494], 0
jne 0x40d17b
push dword [esi + 0x18]
mov eax, dword [esi + 0x20]
push dword [esi]
mov dword [esi + 0x494], 1
push dword [eax]
mov eax, dword [esi + 0x1c]
push dword [eax]
push str.color_threshold
push dword [esi + 4]
push str.cmyk
push str.Colorfunc_is__s__d_to__s___s___s___d___d_n
push ebx
push 2
call fcn.0046e0c0
add esp, 0x28
mov esi, dword [esi + 4]
push 0x4c0ed0
push ebx
call fcn.0046f500
mov edi, eax
add esp, 8
cmp esi, 8
mov dword [ebp - 0x10], edi
mov ebx, dword [edi + 8]
mov eax, dword [edi]
mov dword [ebp - 0x18], eax
mov eax, dword [edi + 0x4d0]
lea esi, [ebx + ebx*2]
jne 0x40d27f
add esi, esi
mov dword [ebp - 0x14], ebx
mov dword [ebp - 8], eax
test eax, eax
jne 0x40d1c9
push esi
call fcn.0046e570
add esp, 4
mov dword [edi + 0x4d0], eax
mov dword [ebp - 8], eax
push esi
push 0
push eax
call sub.VCRUNTIME140.dll_memset
mov eax, dword [edi + 0x18]
add esp, 0xc
test ebx, ebx
jle 0x40d327
mov edx, dword [ebp + 0xc]
neg eax
mov edi, dword [ebp - 0x14]
mov ebx, 0xffff
sbb eax, eax
and eax, 0xffff
movzx eax, ax
mov dword [ebp - 4], eax
mov eax, dword [ebp - 8]
add eax, 4
inc edx
mov dword [ebp - 0xc], eax
mov dword [ebp - 8], edx
nop word [eax + eax]
movzx ecx, byte [edx + 2]
movzx eax, byte [edx - 1]
add eax, ecx
imul esi, eax, 0x101
movzx eax, byte [edx]
add eax, ecx
imul edx, eax, 0x101
mov eax, dword [ebp - 8]
movzx eax, byte [eax + 1]
add eax, ecx
imul ecx, eax, 0x101
cmp esi, ebx
mov eax, dword [ebp - 4]
cmova esi, ebx
cmp edx, ebx
cmova edx, ebx
cmp ecx, ebx
cmova ecx, ebx
xor eax, esi
mov esi, dword [ebp - 0xc]
mov word [esi - 4], ax
mov eax, dword [ebp - 4]
xor eax, edx
mov edx, dword [ebp - 8]
mov word [esi - 2], ax
add edx, 4
mov eax, dword [ebp - 4]
xor eax, ecx
mov dword [ebp - 8], edx
mov word [esi], ax
add esi, 6
mov dword [ebp - 0xc], esi
sub edi, 1
jne 0x40d210
jmp 0x40d324
add esi, esi
mov dword [ebp - 4], ebx
mov dword [ebp - 0xc], eax
test eax, eax
jne 0x40d29d
push esi
call fcn.0046e570
add esp, 4
mov dword [edi + 0x4d0], eax
mov dword [ebp - 0xc], eax
push esi
push 0
push eax
call sub.VCRUNTIME140.dll_memset
mov eax, dword [edi + 0x18]
add esp, 0xc
test ebx, ebx
jle 0x40d327
mov ebx, dword [ebp + 0xc]
neg eax
mov edi, 0xffff
sbb eax, eax
and eax, 0xffff
movzx eax, ax
mov dword [ebp - 8], eax
mov eax, dword [ebp - 0xc]
add eax, 4
add ebx, 2
mov dword [ebp - 0xc], eax
movzx eax, word [ebx + 4]
lea ebx, [ebx + 8]
movzx ecx, word [ebx - 0xa]
movzx edx, word [ebx - 8]
add ecx, eax
movzx esi, word [ebx - 6]
add edx, eax
add esi, eax
mov eax, dword [ebp - 8]
cmp ecx, edi
cmova ecx, edi
cmp edx, edi
cmova edx, edi
cmp esi, edi
cmova esi, edi
xor eax, ecx
mov ecx, dword [ebp - 0xc]
mov word [ecx - 4], ax
mov eax, dword [ebp - 8]
xor eax, edx
mov word [ecx - 2], ax
mov eax, dword [ebp - 8]
xor eax, esi
mov word [ecx], ax
add ecx, 6
sub dword [ebp - 4], 1
mov dword [ebp - 0xc], ecx
jne 0x40d2d3
mov edi, dword [ebp - 0x10]
push dword [ebp + 0x10]
mov eax, dword [ebp + 8]
push dword [edi + 0x4d0]
mov dword [edi], 0x10000
push eax
call fcn.0040ead0
mov ecx, dword [ebp - 0x18]
add esp, 0xc
mov dword [edi], ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret