Function at 0x46e700
Capabilities:
Encode data using xor

Disassembly:
push ebp
mov ebp, esp
push edi
push esi
push ebx
sub esp, 0xc
mov edx, dword [ebp + 8]
mov edi, dword [ebp + 0xc]
test edx, edx
je 0x46e900
test edi, edi
je 0x46e900
push eax
push eax
mov eax, dword [ebp + 8]
push edi
push eax
call fcn.0046e4b0
mov eax, dword [edi + 8]
add esp, 0x10
test al, 8
jne 0x46e932
cmp byte [edi + 0x19], 3
je 0x46ead4
test al, 0x10
je 0x46e780
mov eax, dword [ebp + 8]
test byte [eax + 0x76], 8
jne 0x46e954
mov dx, word [edi + 0x16]
sub esp, 0xc
xor eax, eax
mov al, byte [edi + 0x19]
push eax
mov eax, edx
and eax, 0xffff
push eax
lea eax, [edi + 0x50]
push eax
mov eax, dword [ebp + 8]
mov edx, dword [edi + 0x4c]
push edx
push eax
call fcn.004758e0
mov eax, dword [edi + 8]
add esp, 0x20
test al, 0x20
jne 0x46e98c
test al, 0x40
jne 0x46e9ae
test ah, 1
jne 0x46e9d4
test ah, 4
jne 0x46e9fa
test ah, 0x40
jne 0x46ea47
test al, al
js 0x46ea85
test ah, 2
jne 0x46eaab
test ah, 0x20
je 0x46e7f5
mov ebx, dword [edi + 0xd8]
test ebx, ebx
jle 0x46e7f5
xor ebx, ebx
lea esi, [esi]
mov eax, ebx
push ecx
push ecx
inc ebx
shl eax, 4
mov edx, dword [edi + 0xd4]
add eax, edx
push eax
mov eax, dword [ebp + 8]
push eax
call fcn.004750c0
add esp, 0x10
cmp dword [edi + 0xd8], ebx
jg 0x46e7d0
mov eax, dword [edi + 0x30]
test eax, eax
jle 0x46e865
xor esi, esi
jmp 0x46e823
push eax
push eax
mov eax, dword [ebp + 8]
push str.Unable_to_write_international_text
push eax
call fcn.00461ac0
mov eax, dword [edi + 0x38]
add esp, 0x10
mov dword [eax + ebx], 0xfffffffd
inc esi
cmp dword [edi + 0x30], esi
jle 0x46e865
mov ebx, esi
mov eax, dword [edi + 0x38]
shl ebx, 4
mov edx, ebx
add edx, eax
mov eax, dword [edx]
cmp eax, 0
jg 0x46e800
je 0x46e908
inc eax
jne 0x46e81d
push 0
inc esi
mov eax, dword [edx + 8]
push eax
mov eax, dword [edx + 4]
push eax
mov eax, dword [ebp + 8]
push eax
call fcn.00474e40
mov eax, dword [edi + 0x38]
add esp, 0x10
mov dword [eax + ebx], 0xfffffffd
cmp dword [edi + 0x30], esi
jg 0x46e823
mov eax, dword [edi + 0xc0]
test eax, eax
je 0x46e900
mov ebx, dword [edi + 0xbc]
lea eax, [eax + eax*4]
lea eax, [ebx + eax*4]
cmp ebx, eax
jb 0x46e89e
jmp 0x46e900
mov eax, dword [edi + 0xc0]
mov edx, dword [edi + 0xbc]
add ebx, 0x14
lea eax, [eax + eax*4]
lea eax, [edx + eax*4]
cmp eax, ebx
jbe 0x46e900
push eax
push eax
mov eax, dword [ebp + 8]
push ebx
push eax
call fcn.0046f4b0
add esp, 0x10
mov ecx, eax
cmp eax, 1
je 0x46e885
mov al, byte [ebx + 0x10]
test al, al
je 0x46e885
xor edx, edx
mov dl, al
mov eax, edx
and eax, 6
cmp eax, 2
jne 0x46e885
and edx, 8
jne 0x46e885
test byte [ebx + 3], 0x20
jne 0x46e8e2
cmp ecx, 3
je 0x46e8e2
mov eax, dword [ebp + 8]
test byte [eax + 0x72], 1
je 0x46e885
mov eax, dword [ebx + 0xc]
mov ecx, dword [ebp + 8]
push eax
mov esi, dword [ebx + 8]
push esi
push ebx
push ecx
call fcn.00475540
add esp, 0x10
jmp 0x46e885
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret
sub esp, 0xc
push 0
push 0
mov eax, dword [edx + 8]
push eax
mov ecx, dword [edx + 4]
mov edx, dword [ebp + 8]
push ecx
push edx
call fcn.00474f00
mov eax, dword [edi + 0x38]
add esp, 0x20
mov dword [eax + ebx], 0xfffffffe
jmp 0x46e81d
push eax
mov eax, dword [edi + 0x14]
and eax, 0xffff
push eax
mov eax, dword [edi + 0x10]
push eax
mov eax, dword [ebp + 8]
push eax
call fcn.00475440
mov eax, dword [edi + 8]
add esp, 0x10
jmp 0x46e743
cmp byte [edi + 0x19], 3
jne 0x46e754
mov dx, word [edi + 0x16]
test dx, dx
je 0x46e758
xor ecx, ecx
mov eax, ecx
mov ebx, dword [edi + 0x4c]
add eax, ebx
inc ecx
xor byte [eax], 0xff
mov dx, word [edi + 0x16]
mov eax, edx
and eax, 0xffff
cmp eax, ecx
jg 0x46e96d
jmp 0x46e758
push eax
xor eax, eax
mov al, byte [edi + 0x19]
push eax
lea eax, [edi + 0x5a]
push eax
mov eax, dword [ebp + 8]
push eax
call fcn.00475770
mov eax, dword [edi + 8]
add esp, 0x10
test al, 0x40
je 0x46e790
push eax
mov eax, dword [edi + 0x14]
and eax, 0xffff
push eax
mov eax, dword [edi + 0x7c]
push eax
mov eax, dword [ebp + 8]
push eax
call fcn.00475020
mov eax, dword [edi + 8]
add esp, 0x10
test ah, 1
je 0x46e799
xor eax, eax
mov ecx, dword [ebp + 8]
mov al, byte [edi + 0x6c]
push eax
mov esi, dword [edi + 0x68]
push esi
mov ebx, dword [edi + 0x64]
push ebx
push ecx
call fcn.00475710
mov eax, dword [edi + 8]
add esp, 0x10
test ah, 4
je 0x46e7a2
mov edx, dword [edi + 0xb0]
push edx
mov eax, dword [edi + 0xac]
push eax
xor eax, eax
mov al, byte [edi + 0xb5]
push eax
xor eax, eax
mov al, byte [edi + 0xb4]
push eax
mov eax, dword [edi + 0xa8]
push eax
mov eax, dword [edi + 0xa4]
push eax
mov eax, dword [edi + 0xa0]
push eax
mov eax, dword [ebp + 8]
push eax
call fcn.00474cb0
mov eax, dword [edi + 8]
add esp, 0x20
test ah, 0x40
je 0x46e7ab
push eax
push eax
mov esi, dword [edi + 0xec]
xor eax, eax
push esi
mov ebx, dword [edi + 0xe8]
push ebx
mov ecx, dword [edi + 0xe4]
push ecx
mov edx, dword [edi + 0xe0]
push edx
mov al, byte [edi + 0xdc]
push eax
mov eax, dword [ebp + 8]
push eax
call fcn.00475680
mov eax, dword [edi + 8]
add esp, 0x20
test al, al
jns 0x46e7b3
xor eax, eax
mov al, byte [edi + 0x78]
push eax
mov eax, dword [edi + 0x74]
push eax
mov eax, dword [edi + 0x70]
push eax
mov eax, dword [ebp + 8]
push eax
call fcn.00475620
mov eax, dword [edi + 8]
add esp, 0x10
test ah, 2
je 0x46e7bc
push eax
push eax
lea eax, [edi + 0x3c]
push eax
mov eax, dword [ebp + 8]
push eax
call fcn.00475590
mov eax, dword [ebp + 8]
add esp, 0x10
mov esi, dword [eax + 0x6c]
or esi, 0x200
mov dword [eax + 0x6c], esi
mov eax, dword [edi + 8]
jmp 0x46e7bc
mov esi, dword [ebp + 8]
push eax
push eax
push str.Valid_palette_required_for_paletted_images
push esi
call fcn.00461be0
mov eax, dword [edi + 8]
add esp, 0x10
jmp 0x46e743