Function at 0x5021d9
Capabilities:
Encode data using xor

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x24
push ebx
push esi
push edi
mov edi, dword [ebp + 0xc]
mov ebx, ecx
mov ecx, dword [ebp + 0x14]
mov eax, dword [ebx + 0x34]
lea esi, [edi + ecx]
mov ecx, dword [ebp + 0x20]
imul esi, eax
add esi, dword [ebp + 0x10]
add edi, ecx
add esi, dword [ebp + 0x18]
imul edi, eax
add edi, dword [ebp + 0x1c]
xor edx, edx
add edi, dword [ebp + 0x24]
cmp dword [ebp + 0x28], edx
mov dword [ebp - 8], ebx
mov dword [ebp - 0x24], edx
mov dword [ebp - 0x20], edx
mov dword [ebp - 0x1c], edx
mov dword [ebp - 0x18], edx
mov dword [ebp - 4], edx
mov dword [ebp + 0xc], esi
mov dword [ebp + 0x10], edi
jne 0x502599
cmp dword [ebp + 0x2c], edx
jne 0x502750
call fcn.005dbdc9
test eax, eax
je 0x502501
cmp dword [ebp + 0x34], 1
jne 0x50244f
call fcn.005dbdda
test eax, eax
je 0x502373
mov eax, dword [ebx + 0x3c]
mov dword [ebp + 0x2c], eax
lea eax, [ebp - 0x24]
mov dword [ebp + 0x34], eax
mov esi, dword [ebp + 0x10]
mov eax, dword [ebp + 0xc]
mov edx, dword [ebp + 0x34]
mov ebx, dword [ebp + 0x2c]
pxor xmm7, xmm7
movdqu xmm6, xmmword [esi]
movdqu xmm1, xmmword [eax]
psadbw xmm6, xmm1
movdqu xmm0, xmmword [esi + ebx]
movdqu xmm1, xmmword [eax + ebx]
psadbw xmm0, xmm1
paddw xmm6, xmm0
movdqu xmm0, xmmword [esi + ebx*2]
movdqu xmm1, xmmword [eax + ebx*2]
psadbw xmm0, xmm1
paddw xmm6, xmm0
lea ebx, [ebx + ebx*2]
movdqu xmm0, xmmword [esi + ebx]
movdqu xmm1, xmmword [eax + ebx]
psadbw xmm0, xmm1
paddw xmm6, xmm0
movdqa xmm0, xmm6
psrldq xmm0, 8
paddd xmm0, xmm6
movd dword [ebp - 4], xmm0
packssdw xmm6, xmm7
movq qword [edx], xmm6
mov ecx, dword [ebp + 0x30]
cmp dword [ebp - 4], ecx
jae 0x50236b
mov eax, dword [ebp - 8]
mov eax, dword [eax + 0x3c]
shl eax, 2
add dword [ebp + 0xc], eax
add edi, eax
lea eax, [ebp - 0x1c]
mov dword [ebp + 0x10], edi
mov dword [ebp + 0x34], eax
mov esi, dword [ebp + 0x10]
mov eax, dword [ebp + 0xc]
mov edx, dword [ebp + 0x34]
mov ebx, dword [ebp + 0x2c]
pxor xmm7, xmm7
movdqu xmm6, xmmword [esi]
movdqu xmm1, xmmword [eax]
psadbw xmm6, xmm1
movdqu xmm0, xmmword [esi + ebx]
movdqu xmm1, xmmword [eax + ebx]
psadbw xmm0, xmm1
paddw xmm6, xmm0
movdqu xmm0, xmmword [esi + ebx*2]
movdqu xmm1, xmmword [eax + ebx*2]
psadbw xmm0, xmm1
paddw xmm6, xmm0
lea ebx, [ebx + ebx*2]
movdqu xmm0, xmmword [esi + ebx]
movdqu xmm1, xmmword [eax + ebx]
psadbw xmm0, xmm1
paddw xmm6, xmm0
movdqa xmm0, xmm6
psrldq xmm0, 8
paddd xmm0, xmm6
movd ebx, xmm0
add dword [ebp - 4], ebx
packssdw xmm6, xmm7
movq qword [edx], xmm6
cmp dword [ebp - 4], ecx
jb 0x5023de
lea eax, [ecx + 1]
jmp 0x502448
xor ecx, ecx
jmp 0x50237d
mov edi, dword [ebp + 0x10]
mov esi, dword [ebp + 0xc]
mov eax, ecx
sar eax, 2
lea eax, [ebp + eax*8 - 0x24]
mov dword [ebp + 0x20], edi
mov dword [ebp + 0x2c], esi
mov dword [ebp + 0x34], eax
lea edi, [ebp - 4]
mov esi, dword [ebp + 0x20]
movq mm0, qword [esi]
mov eax, dword [ebp + 0x2c]
movq mm1, qword [eax]
mov edx, dword [ebp + 0x34]
psadbw mm0, mm1
movd ebx, mm0
add dword [edi], ebx
add dword [edx], ebx
movq mm0, qword [esi + 8]
movq mm1, qword [eax + 8]
psadbw mm0, mm1
movd ebx, mm0
add dword [edi], ebx
add dword [edx + 4], ebx
emms
mov eax, dword [ebp + 0x30]
cmp dword [ebp - 4], eax
jae 0x502806
mov eax, dword [ebp - 8]
mov eax, dword [eax + 0x3c]
add dword [ebp + 0x10], eax
add dword [ebp + 0xc], eax
inc ecx
cmp ecx, 8
jl 0x502377
mov ebx, dword [ebp - 8]
mov eax, dword [ebp + 0x18]
cdq
push 8
pop ecx
idiv ecx
and dword [ebp + 0x34], 0
push 8
pop esi
lea ecx, [ebp - 0x24]
mov dword [ebp + 0x2c], eax
mov eax, dword [ebp + 0x14]
cdq
idiv esi
mov dword [ebp + 0x30], eax
mov eax, dword [ebp + 0x30]
mov esi, dword [ebp + 0x34]
xor edx, edx
add eax, esi
mov dword [ebp + 0x18], eax
mov eax, dword [ebx + 0xac]
imul eax, dword [ebp + 0x18]
add eax, dword [ebp + 0x2c]
mov esi, dword [ecx]
mov edi, dword [ebp + 8]
add eax, edx
imul eax, eax, 0xc
inc edx
add ecx, 4
cmp edx, 2
mov dword [eax + edi + 8], esi
jl 0x50240d
inc dword [ebp + 0x34]
cmp dword [ebp + 0x34], 2
jl 0x502400
mov eax, dword [ebp - 0x1c]
mov ecx, dword [ebp - 0x18]
add eax, ecx
add eax, dword [ebp - 0x20]
add eax, dword [ebp - 0x24]
pop edi
pop esi
pop ebx
leave
ret 0x30
mov eax, dword [ebx + 0x3c]
mov dword [ebp + 0x2c], eax
mov edi, dword [ebp + 0x2c]
mov edx, dword [ebp + 0x30]
mov esi, dword [ebp + 0x10]
mov eax, dword [ebp + 0xc]
movq mm6, qword [esi]
movq mm1, qword [eax]
psadbw mm6, mm1
movd ebx, mm6
cmp ebx, edx
jge 0x5024a9
movq mm7, qword [esi + edi]
movq mm3, qword [eax + edi]
psadbw mm7, mm3
movd ebx, mm7
cmp ebx, edx
jge 0x5024a9
movq mm0, qword [esi + edi*2]
movq mm1, qword [eax + edi*2]
psadbw mm0, mm1
paddw mm6, mm0
movd ebx, mm7
cmp ebx, edx
jge 0x5024a9
lea edi, [edi + edi*2]
movq mm2, qword [esi + edi]
movq mm3, qword [eax + edi]
psadbw mm2, mm3
paddw mm7, mm2
paddw mm6, mm7
movd ebx, mm6
mov dword [ebp - 4], ebx
emms
mov ecx, dword [ebp - 4]
mov eax, dword [ebp + 0x30]
cmp ecx, eax
jae 0x502806
mov ebx, dword [ebp - 8]
mov dword [ebp - 0x24], ecx
cmp dword [ebp + 0x34], 2
jne 0x5023e1
mov eax, dword [ebp + 0x14]
cdq
push 8
pop ecx
idiv ecx
push 8
pop esi
mov ecx, eax
mov eax, dword [ebp + 0x18]
imul ecx, dword [ebx + 0xac]
cdq
idiv esi
mov edx, dword [ebp - 0x24]
add ecx, eax
mov eax, dword [ebp + 8]
imul ecx, ecx, 0xc
mov dword [ecx + eax + 8], edx
jmp 0x50243a
mov ecx, dword [ebp + 0x34]
push 8
pop eax
cdq
idiv ecx
and dword [ebp + 0x1c], 0
test eax, eax
mov dword [ebp - 0xc], eax
jle 0x5024c8
mov dword [ebp + 0x2c], 3
sub dword [ebp + 0x2c], ecx
and dword [ebp + 0x20], 0
mov eax, dword [ebp + 0x20]
push 8
cdq
pop ecx
idiv ecx
mov edx, dword [ebp + 0x2c]
test edx, edx
mov dword [ebp + 0x10], edi
mov dword [ebp + 0xc], esi
jle 0x502572
lea ecx, [ebp + eax*8 - 0x24]
mov dword [ebp + 0x28], edx
mov dword [ebp + 0x24], 8
mov eax, dword [ebp + 0xc]
movzx edx, byte [eax]
mov eax, dword [ebp + 0x10]
movzx eax, byte [eax]
sub eax, edx
inc dword [ebp + 0xc]
inc dword [ebp + 0x10]
cdq
xor eax, edx
sub eax, edx
add dword [ecx], eax
add dword [ebp - 4], eax
dec dword [ebp + 0x24]
jne 0x502547
add ecx, 4
dec dword [ebp + 0x28]
jne 0x502540
mov eax, dword [ebp + 0x30]
cmp dword [ebp - 4], eax
jae 0x502806
mov eax, dword [ebx + 0x3c]
add dword [ebp + 0x20], 2
add edi, eax
add esi, eax
inc dword [ebp + 0x1c]
mov eax, dword [ebp + 0x1c]
cmp eax, dword [ebp - 0xc]
jl 0x502523
jmp 0x5024c8
mov ecx, dword [ebx + 0x34]
push 8
add ecx, edi
cmp dword [ebp + 0x2c], edx
pop eax
mov dword [ebp - 0xc], edx
mov dword [ebp + 0x20], ecx
cdq
je 0x50268c
idiv dword [ebp + 0x34]
test eax, eax
mov dword [ebp + 0x1c], eax
jle 0x5024c8
push 0x10
pop eax
cdq
idiv dword [ebp + 0x34]
and dword [ebp + 0x28], 0
mov dword [ebp + 0x2c], eax
and dword [ebp + 0xc], 0
cmp dword [ebp + 0x2c], 0
jle 0x50264f
mov eax, dword [ebp + 0x28]
cdq
push 8
pop ebx
idiv ebx
mov dword [ebp + 0x10], edi
sub dword [ebp + 0x10], ecx
mov dword [ebp + 0x24], esi
add eax, eax
sub dword [ebp + 0x24], ecx
mov dword [ebp - 0x10], eax
mov eax, dword [ebp + 0xc]
cdq
push 8
pop ebx
idiv ebx
mov edx, dword [ebp + 0x10]
movzx edx, byte [edx + ecx]
push 4
pop ebx
add eax, dword [ebp - 0x10]
lea eax, [ebp + eax*4 - 0x24]
mov dword [ebp - 0x14], eax
mov eax, dword [ebp + 0xc]
movzx eax, byte [edi + eax + 1]
add eax, edx
movzx edx, byte [ecx + 1]
add eax, edx
movzx edx, byte [ecx]
lea eax, [eax + edx + 2]
cdq
idiv ebx
mov edx, dword [ebp + 0x24]
movzx edx, byte [edx + ecx]
sub eax, edx
cdq
mov ebx, eax
mov eax, dword [ebp - 0x14]
xor ebx, edx
sub ebx, edx
add dword [eax], ebx
inc dword [ebp + 0xc]
mov eax, dword [ebp + 0xc]
inc ecx
cmp eax, dword [ebp + 0x2c]
jl 0x5025f1
mov ebx, dword [ebp - 8]
mov ecx, dword [ebp + 0x20]
mov eax, dword [ebp - 0x18]
mov edx, dword [ebp - 0x1c]
add edx, eax
add edx, dword [ebp - 0x20]
mov eax, dword [ebp + 0x30]
add edx, dword [ebp - 0x24]
cmp edx, eax
jae 0x502806
mov eax, dword [ebx + 0x3c]
add dword [ebp + 0x28], 2
add ecx, eax
add edi, eax
add esi, eax
inc dword [ebp - 0xc]
mov eax, dword [ebp - 0xc]
cmp eax, dword [ebp + 0x1c]
mov dword [ebp + 0x20], ecx
jl 0x5025cd
jmp 0x5024c8
idiv dword [ebp + 0x34]
test eax, eax
mov dword [ebp + 0x1c], eax
jle 0x5024c8
push 0x10
pop eax
cdq
idiv dword [ebp + 0x34]
and dword [ebp + 0x28], 0
mov dword [ebp + 0x2c], eax
and dword [ebp + 0x10], 0
cmp dword [ebp + 0x2c], 0
jle 0x502713
mov eax, dword [ebp + 0x28]
cdq
push 8
pop ebx
idiv ebx
mov dword [ebp + 0x24], ecx
sub dword [ebp + 0x24], edi
mov dword [ebp + 0xc], esi
add eax, eax
sub dword [ebp + 0xc], edi
mov dword [ebp - 0x14], eax
mov eax, dword [ebp + 0x10]
lea ecx, [eax + edi]
cdq
push 8
pop ebx
idiv ebx
movzx edx, byte [ecx]
add eax, dword [ebp - 0x14]
lea ebx, [ebp + eax*4 - 0x24]
mov eax, dword [ebp + 0x24]
movzx eax, byte [ecx + eax]
lea eax, [eax + edx + 1]
cdq
sub eax, edx
mov edx, dword [ebp + 0xc]
movzx ecx, byte [ecx + edx]
sar eax, 1
sub eax, ecx
cdq
xor eax, edx
sub eax, edx
add dword [ebx], eax
inc dword [ebp + 0x10]
mov eax, dword [ebp + 0x10]
cmp eax, dword [ebp + 0x2c]
jl 0x5026cc
mov ecx, dword [ebp + 0x20]
mov ebx, dword [ebp - 8]
mov eax, dword [ebp - 0x18]
mov edx, dword [ebp - 0x1c]
add edx, eax
add edx, dword [ebp - 0x20]
mov eax, dword [ebp + 0x30]
add edx, dword [ebp - 0x24]
cmp edx, eax
jae 0x502806
mov eax, dword [ebx + 0x3c]
add dword [ebp + 0x28], 2
add ecx, eax
add edi, eax
add esi, eax
inc dword [ebp - 0xc]
mov eax, dword [ebp - 0xc]
cmp eax, dword [ebp + 0x1c]
mov dword [ebp + 0x20], ecx
jl 0x5026a8
jmp 0x5024c8
push 8
mov dword [ebp + 0x24], edx
pop eax
cdq
idiv dword [ebp + 0x34]
test eax, eax
mov dword [ebp + 0x1c], eax
jle 0x5024c8
push 0x10
pop eax
cdq
idiv dword [ebp + 0x34]
and dword [ebp + 0x20], 0
mov dword [ebp + 0x2c], eax
and dword [ebp + 0x10], 0
cmp dword [ebp + 0x2c], 0
jle 0x5027d2
mov eax, dword [ebp + 0x20]
cdq
push 8
pop ecx
idiv ecx
mov dword [ebp + 0xc], esi
add eax, eax
sub dword [ebp + 0xc], edi
mov dword [ebp + 0x28], eax
mov eax, dword [ebp + 0x10]
lea ecx, [eax + edi]
cdq
push 8
pop ebx
idiv ebx
movzx edx, byte [ecx]
add eax, dword [ebp + 0x28]
lea ebx, [ebp + eax*4 - 0x24]
movzx eax, byte [ecx + 1]
lea eax, [eax + edx + 1]
cdq
sub eax, edx
mov edx, dword [ebp + 0xc]
movzx ecx, byte [ecx + edx]
sar eax, 1
sub eax, ecx
cdq
xor eax, edx
sub eax, edx
add dword [ebx], eax
inc dword [ebp + 0x10]
mov eax, dword [ebp + 0x10]
cmp eax, dword [ebp + 0x2c]
jl 0x502791
mov ebx, dword [ebp - 8]
mov eax, dword [ebp - 0x18]
mov ecx, dword [ebp - 0x1c]
add ecx, eax
add ecx, dword [ebp - 0x20]
mov eax, dword [ebp + 0x30]
add ecx, dword [ebp - 0x24]
cmp ecx, eax
jae 0x502806
mov eax, dword [ebx + 0x3c]
add dword [ebp + 0x20], 2
add edi, eax
add esi, eax
inc dword [ebp + 0x24]
mov eax, dword [ebp + 0x24]
cmp eax, dword [ebp + 0x1c]
jl 0x502773
jmp 0x5024c8
inc eax
jmp 0x502448