Function at 0x10046010
Capabilities:
Encode data using xor

Disassembly:
push ebp
mov ebp, esp
push ebx
push esi
push edi
push es
mov edx, dword [ebp + 8]
mov ebx, dword [ebp + 0xc]
mov eax, dword [ebp + 0x10]
mov ecx, dword [ebp + 0x14]
cmp ecx, ebx
jge 0x1004602a
xchg ebx, ecx
cmp dword [edx + 8], 0
je 0x10046065
cmp eax, dword [edx + 0x14]
jl 0x1004627e
cmp eax, dword [edx + 0x18]
jge 0x1004627e
cmp ebx, dword [edx + 0xc]
jge 0x10046053
cmp ecx, dword [edx + 0xc]
jl 0x1004627e
mov ebx, dword [edx + 0xc]
cmp ecx, dword [edx + 0x10]
jl 0x10046065
cmp ebx, dword [edx + 0x10]
jge 0x1004627e
mov ecx, dword [edx + 0x10]
dec ecx
sub ecx, ebx
inc ecx
mov es, word [edx + 0x3c]
call dword [edx + 0x20]
push ebx
lea ebx, [ebx + ebx*2]
lea edi, [eax + ebx]
pop ebx
cmp dword [sym.alleg40.dll__drawing_mode], 0
je 0x1004623c
cmp dword [sym.alleg40.dll__drawing_mode], 1
jne 0x10046110
mov eax, dword [ebp + 0x10]
call dword [edx + 0x24]
lea ebx, [ebx + ebx*2]
lea esi, [eax + ebx]
mov eax, dword [ebp + 0x18]
mov ebx, eax
mov dword [ebp + 0xc], eax
mov dword [ebp + 0xf], eax
mov dword [ebp + 0x12], eax
mov word [ebp + 0x15], ax
shr eax, 0x10
mov byte [ebp + 0x17], al
cmp ecx, 4
jb 0x100460f0
sub ecx, 4
mov eax, dword es:[esi]
xor eax, dword [ebp + 0xc]
mov dword es:[edi], eax
mov eax, dword es:[esi + 4]
xor eax, dword [ebp + 0x10]
mov dword es:[edi + 4], eax
mov eax, dword es:[esi + 8]
xor eax, dword [ebp + 0x14]
mov dword es:[edi + 8], eax
add esi, 0xc
add edi, 0xc
sub ecx, 4
jns 0x100460bc
add ecx, 4
je 0x1004627e
nop
mov eax, dword es:[esi]
xor eax, dword [ebp + 0x18]
mov word es:[edi], ax
shr eax, 0x10
mov byte es:[edi + 2], al
add esi, 3
add edi, 3
dec ecx
jg 0x100460f0
jmp 0x1004627e
cmp dword [sym.alleg40.dll__drawing_mode], 5
jne 0x10046158
mov eax, dword [ebp + 0x10]
call dword [edx + 0x24]
lea ebx, [ebx + ebx*2]
lea esi, [eax + ebx]
mov dword [ebp + 0x14], ecx
push dword [sym.alleg40.dll__blender_alpha]
push dword es:[esi]
push dword [ebp + 0x18]
call dword [sym.alleg40.dll__blender_func24]
add esp, 0xc
mov word es:[edi], ax
shr eax, 0x10
mov byte es:[edi + 2], al
add esi, 3
add edi, 3
dec dword [ebp + 0x14]
jg 0x10046128
jmp 0x1004627e
mov eax, dword [ebp + 0x10]
mov ebx, dword [ebp + 0xc]
sub ebx, dword [sym.alleg40.dll__drawing_x_anchor]
and ebx, dword [sym.alleg40.dll__drawing_x_mask]
sub eax, dword [sym.alleg40.dll__drawing_y_anchor]
and eax, dword [sym.alleg40.dll__drawing_y_mask]
mov edx, dword [sym.alleg40.dll__drawing_pattern]
mov eax, dword [edx + eax*4 + 0x40]
mov esi, eax
mov edx, dword [sym.alleg40.dll__drawing_x_mask]
cmp dword [sym.alleg40.dll__drawing_mode], 2
je 0x100461ca
cmp dword [sym.alleg40.dll__drawing_mode], 3
je 0x100461f8
mov esi, esi
lea eax, [ebx + ebx*2]
mov eax, dword [esi + eax]
and eax, 0xffffff
cmp eax, 0xff00ff
je 0x100461bc
mov eax, dword [ebp + 0x18]
mov word es:[edi], ax
shr eax, 0x10
mov byte es:[edi + 2], al
inc ebx
and ebx, edx
add edi, 3
dec ecx
jg 0x1004619c
jmp 0x1004627e
dec ecx
je 0x100461e2
lea esi, [esi]
lea eax, [ebx + ebx*2]
mov eax, dword [esi + eax]
mov dword es:[edi], eax
inc ebx
and ebx, edx
add edi, 3
dec ecx
jg 0x100461d0
lea eax, [ebx + ebx*2]
mov eax, dword [esi + eax]
mov word es:[edi], ax
shr eax, 0x10
mov byte es:[edi + 2], al
jmp 0x1004627e
lea eax, [ebx + ebx*2]
mov eax, dword [esi + eax]
and eax, 0xffffff
cmp eax, 0xff00ff
je 0x10046224
mov eax, dword [ebp + 0x18]
mov word es:[edi], ax
shr eax, 0x10
mov byte es:[edi + 2], al
inc ebx
and ebx, edx
add edi, 3
dec ecx
jg 0x100461f8
jmp 0x1004627e
mov word es:[edi], 0
mov byte es:[edi + 2], 0
inc ebx
and ebx, edx
add edi, 3
dec ecx
jg 0x100461f8
jmp 0x1004627e
mov eax, dword [ebp + 0x18]
mov dword [ebp + 0xc], eax
mov dword [ebp + 0xf], eax
mov eax, dword [ebp + 0xc]
mov ebx, dword [ebp + 0xd]
mov edx, dword [ebp + 0xe]
cmp ecx, 4
jb 0x10046270
sub ecx, 4
cld
nop
mov dword es:[edi], eax
mov dword es:[edi + 4], ebx
mov dword es:[edi + 8], edx
add edi, 0xc
sub ecx, 4
jns 0x10046258
add ecx, 4
je 0x1004627e
mov word es:[edi], ax
mov byte es:[edi + 2], dl
add edi, 3
dec ecx
jg 0x10046270
pop es
mov edx, dword [ebp + 8]
mov eax, dword [edx + 0x1c]
call dword [eax + 8]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret