Function at 0x4160a0
Capabilities:
Encode data using xor

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x20
push ebx
push esi
push edi
xor ebx, ebx
push 0x1000
mov esi, ecx
push ebx
mov dword [ebp - 0xc], esi
mov dword [ebp - 4], ebx
call dword [0x547224]
mov edi, eax
lea eax, [esi + 0x1510]
push eax
push edi
mov dword [ebp - 0x20], edi
call dword [0x547218]
push str.system.dat
push edi
call dword [0x5471f8]
lea ecx, [ebp - 0x1c]
push ecx
push edi
call fcn.00407270
mov edi, eax
xor ecx, ecx
cmp edi, ecx
je 0x41638b
mov edx, dword [edi + 0x64]
mov eax, dword [ebp - 0x1c]
add edx, 2
cmp edx, eax
jne 0x41616e
sub eax, 2
mov dword [ebp - 0x10], ecx
mov dword [ebp - 0x14], ecx
mov dword [ebp - 0x1c], eax
movzx ecx, word [eax + edi]
lea edx, [eax - 0x168]
mov dword [ebp - 0x18], ecx
xor ecx, ecx
lea eax, [edi + 0x168]
cmp edx, 2
jl 0x41614e
lea ecx, [edx - 2]
shr ecx, 1
inc ecx
lea esi, [ecx + ecx]
mov dword [ebp - 8], esi
movzx esi, byte [eax]
sub word [ebp - 0x10], si
movzx esi, byte [eax + 1]
sub word [ebp - 0x14], si
add eax, 2
dec ecx
jne 0x416133
mov esi, dword [ebp - 0xc]
mov ecx, dword [ebp - 8]
cmp ecx, edx
jae 0x416159
movzx edx, byte [eax]
sub word [ebp - 0x18], dx
mov eax, dword [ebp - 0x10]
add eax, dword [ebp - 0x14]
add eax, dword [ebp - 0x18]
test ax, ax
je 0x41616e
or dword [esi + 0x2918], 4
mov eax, dword [edi + 0x44]
test eax, eax
je 0x416184
cmp dword [esi + 0x638], eax
je 0x416184
or dword [esi + 0x2918], 4
cmp dword [esi + 0x2918], 0
jne 0x41638b
movzx eax, word [edi + 0x4c]
dec eax
jne 0x41623d
mov edx, dword [edi + 0x60]
mov eax, dword [edi + 0x5c]
push str.YUKO_KAWAI_PURPLE_SYSTEM_SAVE_CHECK
mov dword [ebp - 0x14], edx
mov dword [ebp - 8], eax
call dword [0x54721c]
movzx ecx, word [edi + 0x4e]
movzx esi, word [edi + 0x52]
shr ecx, 1
and ecx, 7
shr esi, cl
xor edx, edx
mov dword [ebp - 0x10], eax
lea ebx, [edi + 0x168]
and esi, 3
add esi, 2
cmp esi, 6
jbe 0x4161db
lea esi, [edx + 6]
mov eax, dword [ebp - 0x14]
test eax, eax
je 0x416210
mov dword [ebp - 0x18], eax
mov al, byte [ebx]
mov ecx, esi
ror al, cl
inc ebx
mov byte [ebx - 1], al
mov cl, byte [edx + str.YUKO_KAWAI_PURPLE_SYSTEM_SAVE_CHECK]
sub al, byte [edi + 0x4e]
add cl, byte [edi + 0x50]
xor cl, al
sub cl, 0x40
lea eax, [edx + 1]
xor edx, edx
div dword [ebp - 0x10]
dec dword [ebp - 0x18]
mov byte [ebx - 1], cl
jne 0x4161e5
mov esi, dword [ebp - 8]
lea edx, [esi + 0x400]
push edx
push 0
call dword [0x547224]
mov ecx, dword [ebp - 0x14]
push ecx
push esi
lea ecx, [edi + 0x168]
push ecx
push eax
mov dword [ebp - 4], eax
call fcn.0047a650
mov ebx, dword [ebp - 4]
add esp, 0x10
push 0x7f00
push 0x100
push ebx
call fcn.00473cf0
push 0x800
push 0x800
lea edx, [ebx + 0x7f00]
push edx
call fcn.00473d30
push 0x400
push 0x400
lea eax, [ebx + 0x9f00]
push eax
call fcn.00473d70
push 0x40
mov esi, 0xaf00
call fcn.00473cb0
mov dword [ebp - 0x18], eax
mov dword [ebp - 0x14], 0x40
jmp 0x416294
mov ebx, dword [ebp - 4]
mov ecx, dword [ebp - 0x18]
add ebx, esi
push ebx
push ecx
call dword [0x547218]
push ebx
call dword [0x54721c]
add dword [ebp - 0x18], 0x400
dec dword [ebp - 0x14]
lea esi, [esi + eax + 1]
jne 0x416291
cmp dword [edi + 0x58], 0
jbe 0x416318
mov eax, dword [ebp - 0xc]
mov ebx, dword [eax + 0x28f8]
mov dword [eax + 0x28f8], 0
test ebx, ebx
je 0x4162e3
push ebx
mov ebx, dword [ebx + 4]
call dword [0x547228]
test ebx, ebx
jne 0x4162d5
cmp dword [edi + 0x58], 0
mov dword [ebp - 8], 0
jbe 0x416318
mov edx, dword [ebp - 4]
mov ecx, dword [ebp - 0xc]
lea ebx, [esi + edx]
push ebx
push 0
call fcn.00415f30
push ebx
call dword [0x54721c]
lea esi, [esi + eax + 1]
mov eax, dword [ebp - 8]
inc eax
mov dword [ebp - 8], eax
cmp eax, dword [edi + 0x58]
jb 0x4162f0
cmp dword [edi + 0x54], 0
jbe 0x416388
mov eax, dword [ebp - 0xc]
mov ebx, dword [eax + 0x28fc]
mov ecx, eax
mov dword [ecx + 0x28fc], 0
test ebx, ebx
je 0x41634e
jmp 0x416340
push ebx
mov ebx, dword [ebx + 4]
call dword [0x547228]
test ebx, ebx
jne 0x416340
cmp dword [edi + 0x54], 0
mov dword [ebp - 8], 0
jbe 0x416388
jmp 0x416360
mov edx, dword [ebp - 4]
mov ecx, dword [ebp - 0xc]
lea ebx, [esi + edx]
push ebx
push 1
call fcn.00415f30
push ebx
call dword [0x54721c]
lea esi, [esi + eax + 1]
mov eax, dword [ebp - 8]
inc eax
mov dword [ebp - 8], eax
cmp eax, dword [edi + 0x54]
jb 0x416360
mov ebx, dword [ebp - 4]
mov eax, dword [ebp - 0x20]
mov esi, dword [0x547228]
test eax, eax
je 0x41639b
push eax
call esi
test edi, edi
je 0x4163a2
push edi
call esi
test ebx, ebx
je 0x4163a9
push ebx
call esi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret