Function at 0x512210
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0x24
mov eax, dword [0x586220]
xor eax, esp
mov dword [esp + 0x20], eax
mov edx, dword [esp + 0x28]
push ebx
push ebp
push esi
mov ecx, dword [edx]
mov esi, dword [esp + 0x38]
mov dword [esp + 0x10], edx
mov dword [esp + 0x14], ecx
push edi
mov edi, dword [esp + 0x40]
cmp ecx, 0x60
ja case.0x512248.1
movzx eax, byte [ecx + 0x5125ec]
jmp dword [eax*4 + 0x5125d8]
push dword [esp + 0x44]
push edi
push esi
push edx
call fcn.005121a0
add esp, 0x10
jmp case.0x512248.1
mov al, byte [edx + 0x14]
mov ebx, dword [edx + 0x10]
mov ebp, dword [esp + 0x44]
mov byte [esp + 0x13], al
test al, al
je 0x5122d0
cmp ebp, 8
jae 0x512294
pop edi
pop esi
pop ebp
mov eax, 4
pop ebx
mov ecx, dword [esp + 0x20]
xor ecx, esp
call fcn.00535482
add esp, 0x24
ret 0x10
test esi, esi
je 0x5122d0
cmp esi, edi
jne 0x5122d0
cmp ecx, 0x20
je 0x5122bb
cmp ecx, 0x30
jne case.0x512248.1
push ebp
push esi
lea eax, [edx + 0x20]
push eax
push ebx
call fcn.00513200
jmp case.0x512248.1
push ebp
push esi
lea eax, [edx + 0x20]
push eax
push ebx
call fcn.005130c0
jmp case.0x512248.1
cmp ebp, 0x10
jae 0x5122e6
cmp ebp, 8
jb 0x51236c
test al, al
jne 0x51236c
mov eax, dword [edi]
mov dword [esp + 0x20], eax
mov eax, dword [edi + 4]
add edi, 8
mov dword [esp + 0x24], eax
cmp ecx, 0x20
je 0x512323
cmp ecx, 0x30
jne 0x51234c
cmp byte [esp + 0x13], 0
lea eax, [esp + 0x20]
je 0x51231a
push 8
push eax
lea eax, [edx + 0x20]
push eax
push ebx
call fcn.00513200
jmp 0x512344
push eax
push ebx
call fcn.00512ec0
jmp 0x512344
cmp byte [esp + 0x13], 0
lea eax, [esp + 0x20]
je 0x51233d
push 8
push eax
lea eax, [edx + 0x20]
push eax
push ebx
call fcn.005130c0
jmp 0x512344
push eax
push ebx
call fcn.00512e20
mov edx, dword [esp + 0x14]
mov ecx, dword [esp + 0x18]
test esi, esi
je 0x512360
mov eax, dword [esp + 0x20]
mov dword [esi], eax
mov eax, dword [esp + 0x24]
mov dword [esi + 4], eax
add esi, 8
mov al, byte [esp + 0x13]
sub ebp, 8
jmp 0x5122d0
test ebp, ebp
je case.0x512248.1
test al, al
je 0x5123df
push ebp
lea eax, [esp + 0x24]
push edi
push eax
call fcn.005358e0
mov eax, dword [esp + 0x24]
add esp, 0xc
cmp eax, 0x20
je 0x5123ab
cmp eax, 0x30
jne 0x5123bf
push ebp
lea eax, [esp + 0x24]
push eax
mov eax, dword [esp + 0x1c]
add eax, 0x20
push eax
push ebx
call fcn.00513200
jmp 0x5123bf
push ebp
lea eax, [esp + 0x24]
push eax
mov eax, dword [esp + 0x1c]
add eax, 0x20
push eax
push ebx
call fcn.005130c0
test esi, esi
je case.0x512248.1
push ebp
lea eax, [esp + 0x24]
push eax
push esi
call fcn.005358e0
add esp, 0xc
jmp case.0x512248.1
mov ebp, dword [esp + 0x44]
mov eax, dword [edx + 0x10]
mov dword [esp + 0x18], eax
test ebp, ebp
je case.0x512248.1
mov edi, edi
push 8
lea eax, [esp + 0x24]
mov ebx, 8
push eax
push eax
cmp ebp, ebx
xorps xmm0, xmm0
push edx
cmovb ebx, ebp
movq qword [esp + 0x30], xmm0
call fcn.005121a0
add esp, 0x10
lea eax, [esp + 0x20]
push eax
push dword [esp + 0x1c]
call fcn.00512ec0
test esi, esi
je 0x5124b9
xor ecx, ecx
test ebx, ebx
je 0x5124bb
cmp ebx, 0x20
jb 0x5124a4
lea eax, [edi - 1]
lea edx, [esi - 1]
add eax, ebx
add edx, ebx
cmp esi, eax
ja 0x51244b
cmp edx, edi
jae 0x5124a4
lea eax, [esp + ebx + 0x1f]
cmp esi, eax
ja 0x51245b
lea eax, [esp + 0x20]
cmp edx, eax
jae 0x5124a4
mov eax, ebx
mov edx, ebx
and eax, 0x1f
sub edx, eax
lea eax, [esp + 0x30]
jmp 0x512470
movdqu xmm0, xmmword [edi]
add ecx, 0x20
lea eax, [eax + 0x20]
movdqu xmm1, xmmword [eax - 0x30]
pxor xmm1, xmm0
movdqu xmmword [esi], xmm1
movdqu xmm0, xmmword [edi + 0x10]
add edi, 0x20
movdqu xmm1, xmmword [eax - 0x20]
pxor xmm1, xmm0
movdqu xmmword [esi + 0x10], xmm1
add esi, 0x20
cmp ecx, edx
jb 0x512470
cmp ecx, ebx
jae 0x5124bb
mov al, byte [esp + ecx + 0x20]
inc ecx
xor al, byte [edi]
inc edi
mov byte [esi], al
inc esi
cmp ecx, ebx
jb 0x5124a8
jmp 0x5124bb
add edi, ebx
mov edx, dword [esp + 0x14]
sub ebp, ebx
jne 0x5123f0
jmp case.0x512248.1
mov eax, dword [edx + 4]
cmp ecx, 0x40
mov ebp, dword [esp + 0x44]
mov dword [esp + 0x18], eax
sete byte [esp + 0x13]
mov eax, dword [edx + 8]
dec eax
test ebp, eax
jne 0x51227a
test esi, esi
je 0x512502
cmp edi, esi
je 0x512502
push ebp
push edi
push esi
call fcn.005358e0
mov edx, dword [esp + 0x20]
add esp, 0xc
mov ecx, dword [esp + 0x18]
shr ebp, cl
cmp ebp, 2
jl case.0x512248.1
mov eax, dword [edx + 0x18]
dec ebp
cmp byte [esp + 0x13], 0
mov ebx, 1
mov edx, dword [edx + 0x1c]
cmovne ebx, ebp
mov dword [esp + 0x1c], eax
mov dword [esp + 0x20], edx
test ebp, ebp
jle case.0x512248.1
lea eax, [ebx + 1]
mov dword [esp + 0x14], eax
lea esp, [esp]
mov edi, ebx
mov eax, edx
shl edi, cl
add edi, esi
test bl, 1
cmovne eax, dword [esp + 0x1c]
xor edx, edx
div dword [esp + 0x14]
shl edx, cl
add edx, esi
test esi, esi
je case.default.0x512563
cmp ecx, 3
ja case.default.0x512563
jmp dword [ecx*4 + 0x512650]
mov al, byte [edx]
mov cl, byte [edi]
mov byte [edi], al
mov byte [edx], cl
jmp 0x5125a0
mov ax, word [edx]
movzx ecx, word [edi]
mov word [edi], ax
mov word [edx], cx
jmp 0x5125a0
mov ecx, dword [edi]
mov eax, dword [edx]
mov dword [edi], eax
mov dword [edx], ecx
jmp 0x5125a0
mov ecx, dword [edi]
mov eax, dword [edx]
mov dword [edi], eax
mov eax, dword [edx + 4]
mov dword [edx], ecx
mov ecx, dword [edi + 4]
mov dword [edi + 4], eax
mov dword [edx + 4], ecx
mov ecx, dword [esp + 0x18]
cmp byte [esp + 0x13], 0
je 0x5125b2
dec ebx
dec dword [esp + 0x14]
jmp 0x5125b7
inc ebx
inc dword [esp + 0x14]
mov edx, dword [esp + 0x20]
dec ebp
test ebp, ebp
jg 0x512540
mov ecx, dword [esp + 0x30]
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
xor ecx, esp
call fcn.00535482
add esp, 0x24
ret 0x10