Function at 0x512aa4
Capabilities:
Encode data using xor

Disassembly:
push ebp
mov ebp, esp
add esp, 0xffffffe8
push ebx
push esi
xor ebx, ebx
mov dword [ebp - 0x10], ebx
mov dword [ebp - 0x14], ebx
mov dword [ebp - 0x18], ebx
mov dword [ebp - 8], ecx
mov dword [ebp - 4], edx
mov esi, eax
mov eax, dword [ebp - 4]
call fcn.00405cd8
xor eax, eax
push ebp
push 0x512e4d
push dword fs:[eax]
mov dword fs:[eax], esp
mov eax, dword [ebp - 8]
mov edx, dword [0x47e9c0]
call fcn.00405c74
cmp dword [ebp - 4], 0
je 0x512e1e
mov eax, dword [ebp - 4]
call fcn.00405998
mov dword [ebp - 0xc], eax
cmp dword [esi + 0xc], 2
jne 0x512c83
mov eax, dword [ebp - 0xc]
and eax, 0x8000000f
jns 0x512b11
dec eax
or eax, 0xfffffff0
inc eax
test eax, eax
je 0x512b2b
mov ecx, 0x512e64
mov dl, 1
mov eax, dword [0x407d88]
call fcn.0040da34
call fcn.00403d74
mov eax, dword [ebp - 0xc]
push eax
mov eax, dword [ebp - 8]
mov ecx, 1
mov edx, dword [0x47e9c0]
call fcn.00405b54
add esp, 4
push 0x10
lea eax, [ebp - 0x10]
mov ecx, 1
mov edx, dword [0x47e9c0]
call fcn.00405b54
add esp, 4
push 0
lea eax, [ebp - 0x18]
mov ecx, 1
mov edx, dword [0x47e9c0]
call fcn.00405b54
add esp, 4
push 0
lea eax, [ebp - 0x14]
mov ecx, 1
mov edx, dword [0x47e9c0]
call fcn.00405b54
add esp, 4
cmp dword [esi + 4], 1
jne 0x512bba
push 0x10
lea eax, [ebp - 0x18]
mov ecx, 1
mov edx, dword [0x47e9c0]
call fcn.00405b54
add esp, 4
xor eax, eax
mov edx, dword [ebp - 0x18]
mov byte [edx + eax], 0
inc eax
cmp eax, 0x10
jne 0x512bad
xor ebx, ebx
cmp ebx, dword [ebp - 0xc]
jge 0x512c3a
mov eax, dword [ebp - 0x10]
push eax
push 0
push 0x10
mov ecx, ebx
mov edx, dword [ebp - 4]
mov eax, dword [0x480168]
call fcn.00481b90
lea ecx, [ebp - 0x14]
mov edx, dword [ebp - 0x10]
mov eax, esi
call fcn.005123d8
cmp dword [esi + 4], 1
jne 0x512c1a
test ebx, ebx
jle 0x512c03
xor eax, eax
mov edx, dword [ebp - 0x18]
mov dl, byte [edx + eax]
mov ecx, dword [ebp - 0x14]
xor byte [ecx + eax], dl
inc eax
cmp eax, 0x10
jne 0x512bf1
mov eax, dword [ebp - 0x18]
push eax
push 0
push 0x10
xor ecx, ecx
mov edx, dword [ebp - 0x10]
mov eax, dword [0x480168]
call fcn.00481b90
mov eax, dword [ebp - 8]
mov eax, dword [eax]
push eax
push ebx
push 0x10
xor ecx, ecx
mov edx, dword [ebp - 0x14]
mov eax, dword [0x480168]
call fcn.00481b90
add ebx, 0x10
cmp ebx, dword [ebp - 0xc]
jl 0x512bc1
cmp dword [esi + 0x10], 1
je 0x512e1e
mov eax, dword [ebp - 8]
mov eax, dword [eax]
call fcn.00405998
mov edx, dword [ebp - 8]
mov edx, dword [edx]
mov bl, byte [edx + eax - 1]
cmp bl, 0x10
jbe 0x512c5e
mov bl, 1
xor eax, eax
mov al, bl
mov edx, dword [ebp - 0xc]
sub edx, eax
push edx
mov eax, dword [ebp - 8]
mov ecx, 1
mov edx, dword [0x47e9c0]
call fcn.00405b54
add esp, 4
jmp 0x512e1e
mov eax, dword [ebp - 0xc]
dec eax
and eax, 0x8000000f
jns 0x512c93
dec eax
or eax, 0xfffffff0
inc eax
test eax, eax
je 0x512cad
mov ecx, 0x512e64
mov dl, 1
mov eax, dword [0x407d88]
call fcn.0040da34
call fcn.00403d74
mov eax, dword [ebp - 4]
mov edx, dword [ebp - 0xc]
mov bl, byte [eax + edx - 1]
cmp bl, 0x10
jbe 0x512cd2
mov ecx, 0x512e64
mov dl, 1
mov eax, dword [0x407d88]
call fcn.0040da34
call fcn.00403d74
xor eax, eax
mov al, bl
mov edx, dword [ebp - 0xc]
sub edx, eax
push edx
mov eax, dword [ebp - 8]
mov ecx, 1
mov edx, dword [0x47e9c0]
call fcn.00405b54
add esp, 4
push 0x10
lea eax, [ebp - 0x10]
mov ecx, 1
mov edx, dword [0x47e9c0]
call fcn.00405b54
add esp, 4
push 0
lea eax, [ebp - 0x18]
mov ecx, 1
mov edx, dword [0x47e9c0]
call fcn.00405b54
add esp, 4
push 0
lea eax, [ebp - 0x14]
mov ecx, 1
mov edx, dword [0x47e9c0]
call fcn.00405b54
add esp, 4
cmp dword [esi + 4], 1
jne 0x512d67
push 0x10
lea eax, [ebp - 0x18]
mov ecx, 1
mov edx, dword [0x47e9c0]
call fcn.00405b54
add esp, 4
xor eax, eax
mov edx, dword [ebp - 0x18]
mov byte [edx + eax], 0
inc eax
cmp eax, 0x10
jne 0x512d5a
xor ebx, ebx
jmp 0x512e12
mov eax, dword [ebp - 0x10]
push eax
push 0
push 0x10
mov ecx, ebx
mov edx, dword [ebp - 4]
mov eax, dword [0x480168]
call fcn.00481b90
lea ecx, [ebp - 0x14]
mov edx, dword [ebp - 0x10]
mov eax, esi
call fcn.005123d8
cmp dword [esi + 4], 1
jne 0x512dc7
test ebx, ebx
jle 0x512db0
xor eax, eax
mov edx, dword [ebp - 0x18]
mov dl, byte [edx + eax]
mov ecx, dword [ebp - 0x14]
xor byte [ecx + eax], dl
inc eax
cmp eax, 0x10
jne 0x512d9e
mov eax, dword [ebp - 0x18]
push eax
push 0
push 0x10
xor ecx, ecx
mov edx, dword [ebp - 0x10]
mov eax, dword [0x480168]
call fcn.00481b90
mov eax, dword [ebp - 0xc]
dec eax
sub eax, 0x10
cmp ebx, eax
jne 0x512df7
mov eax, dword [ebp - 8]
mov eax, dword [eax]
push eax
push ebx
mov eax, dword [ebp - 8]
mov eax, dword [eax]
call fcn.00405998
sub eax, ebx
push eax
xor ecx, ecx
mov edx, dword [ebp - 0x14]
mov eax, dword [0x480168]
call fcn.00481b90
jmp 0x512e0f
mov eax, dword [ebp - 8]
mov eax, dword [eax]
push eax
push ebx
push 0x10
xor ecx, ecx
mov edx, dword [ebp - 0x14]
mov eax, dword [0x480168]
call fcn.00481b90
add ebx, 0x10
mov eax, dword [ebp - 0xc]
dec eax
cmp ebx, eax
jl 0x512d6e
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
push 0x512e54
lea eax, [ebp - 0x18]
mov edx, dword [0x47e9c0]
mov ecx, 3
call fcn.00405078
lea eax, [ebp - 4]
mov edx, dword [0x47e9c0]
call fcn.00405c74
ret