Function at 0x501fe3
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0x30
push esi
mov esi, ecx
mov eax, dword [esi + 0x40]
sub eax, dword [esi + 0x44]
mov dword [esp + 0x18], esi
cmp eax, 0x20
jae 0x502008
mov ecx, dword [esp + 0x38]
push ecx
mov ecx, esi
call fcn.004a6e40
pop esi
add esp, 0x30
ret 4
push ebx
push ebp
push edi
mov edi, dword [esi + 0x34]
add edi, edi
add edi, edi
push edi
mov dword [esp + 0x40], edi
call fcn.004956b0
add esp, 4
test edi, edi
jne 0x50202b
xor edx, edx
mov dword [esp + 0x2c], edx
jmp 0x502041
lea edx, [edi*4]
push edx
call fcn.004932e0
add esp, 4
mov edx, eax
mov dword [esp + 0x2c], eax
mov eax, dword [esi + 0x34]
lea ecx, [eax + eax*2]
lea ecx, [edx + ecx*4]
mov dword [esp + 0x20], ecx
lea ecx, [eax + eax*2]
lea edi, [edx + eax*8]
mov dword [esp + 0x10], edx
lea ebx, [edx + eax*4]
mov dword [esp + 0x1c], edi
mov dword [esp + 0x14], 1
mov ebp, eax
mov dword [esp + 0x18], 0
test ecx, ecx
je 0x50207f
xor eax, eax
mov edi, edx
rep stosd dword es:[edi], eax
mov edi, dword [esp + 0x1c]
mov ecx, dword [esp + 0x44]
mov dword [edx], 1
mov eax, dword [ecx + 8]
cmp edi, eax
je 0x5020a2
mov edx, dword [ecx + 4]
add edx, edx
add edx, edx
push edx
push eax
push edi
call fcn.00530fb0
add esp, 0xc
mov eax, dword [esi + 0x38]
cmp dword [esp + 0x20], eax
je 0x5020c1
mov ecx, dword [esi + 0x34]
mov edx, dword [esp + 0x20]
add ecx, ecx
add ecx, ecx
push ecx
push eax
push edx
call fcn.00530fb0
add esp, 0xc
mov eax, dword [edi]
test eax, eax
jne 0x5021af
mov eax, dword [esp + 0x14]
lea ecx, [eax - 1]
lea edx, [ebx + eax*4 - 4]
mov dword [esp + 0x30], ebp
mov dword [esp + 0x28], ecx
mov dword [esp + 0x44], edx
jmp 0x5020f0
mov dword [esp + 0x34], 1
lea eax, [esp + 0x30]
cmp ebp, 1
jb 0x502105
lea eax, [esp + 0x34]
mov ecx, dword [eax]
test ecx, ecx
je 0x50213a
cmp ecx, ebp
jae 0x502127
mov eax, dword [esp + 0x1c]
mov edx, ecx
lea esi, [eax + ecx*4]
mov edi, dword [esi]
mov dword [eax], edi
inc edx
add eax, 4
add esi, 4
cmp edx, ebp
jb 0x502118
mov edx, dword [esp + 0x1c]
mov eax, ebp
sub eax, ecx
lea edi, [edx + eax*4]
test ecx, ecx
je 0x50213a
xor eax, eax
rep stosd dword es:[edi], eax
mov eax, dword [esp + 0x44]
cmp dword [eax], 0
mov edx, dword [esp + 0x28]
je 0x502155
inc dword [esp + 0x14]
add dword [esp + 0x44], 4
inc edx
mov dword [esp + 0x28], edx
mov eax, dword [esp + 0x14]
mov dword [esp + 0x34], eax
cmp eax, 1
mov dword [esp + 0x38], 1
lea eax, [esp + 0x34]
jb 0x502172
lea eax, [esp + 0x38]
mov ecx, dword [eax]
test ecx, ecx
je 0x50219a
mov eax, edx
cmp edx, ecx
jb 0x502190
sub edx, ecx
lea edx, [ebx + edx*4]
mov esi, dword [edx]
mov dword [ebx + eax*4], esi
dec eax
sub edx, 4
cmp eax, ecx
jae 0x502183
test ecx, ecx
je 0x50219a
xor eax, eax
mov edi, ebx
rep stosd dword es:[edi], eax
mov ecx, dword [esp + 0x1c]
mov eax, dword [ecx]
add dword [esp + 0x18], 0x20
test eax, eax
je 0x5020f0
mov edi, ecx
xor esi, esi
test al, 1
jne 0x5021bc
shr eax, 1
inc esi
test al, 1
je 0x5021b5
add dword [esp + 0x18], esi
cmp eax, 1
jne 0x5021e4
mov eax, ebp
test ebp, ebp
je 0x5021db
lea ecx, [edi + ebp*4 - 4]
nop
cmp dword [ecx], 0
jne 0x5021db
sub ecx, 4
dec eax
jne 0x5021d0
cmp eax, 1
je 0x5022d2
cmp esi, 1
jne 0x502233
xor edx, edx
mov esi, ebp
test ebp, ebp
je 0x50220e
lea ecx, [edi + ebp*4 - 4]
mov eax, dword [ecx]
mov edi, eax
shr edi, 1
or edi, edx
mov dword [ecx], edi
shl eax, 0x1f
sub ecx, 4
dec esi
mov edx, eax
jne 0x5021f5
mov edi, dword [esp + 0x1c]
xor ecx, ecx
xor edx, edx
cmp dword [esp + 0x14], ecx
jbe 0x50222f
mov eax, dword [ebx + ecx*4]
lea esi, [eax + eax]
or esi, edx
mov dword [ebx + ecx*4], esi
shr eax, 0x1f
inc ecx
mov edx, eax
cmp ecx, dword [esp + 0x14]
jb 0x502218
mov eax, edx
jmp 0x50224a
push esi
push ebp
push edi
call fcn.004e6ea0
mov edx, dword [esp + 0x20]
push esi
push edx
push ebx
call fcn.004e6e50
add esp, 0x18
test eax, eax
je 0x50225a
mov ecx, dword [esp + 0x14]
mov dword [ebx + ecx*4], eax
inc ecx
mov dword [esp + 0x14], ecx
cmp dword [edi + ebp*4 - 4], 0
mov ecx, dword [esp + 0x20]
jne 0x50226d
cmp dword [ecx + ebp*4 - 4], 0
jne 0x50226d
dec ebp
mov eax, dword [edi + ebp*4 - 4]
cmp eax, dword [ecx + ebp*4 - 4]
jae 0x50228f
mov eax, edi
mov edi, ecx
mov ecx, eax
mov eax, dword [esp + 0x10]
mov dword [esp + 0x10], ebx
mov dword [esp + 0x1c], edi
mov dword [esp + 0x20], ecx
mov ebx, eax
test ebp, ebp
je 0x5022ab
mov eax, edi
sub ecx, edi
mov edx, ebp
lea esp, [esp]
mov esi, dword [ecx + eax]
xor dword [eax], esi
add eax, 4
dec edx
jne 0x5022a0
cmp dword [esp + 0x14], 0
jbe 0x5020c1
mov eax, dword [esp + 0x10]
mov edx, dword [esp + 0x14]
mov ecx, ebx
sub ecx, eax
mov esi, dword [ecx + eax]
xor dword [eax], esi
add eax, 4
dec edx
jne 0x5022c2
jmp 0x5020c1
mov eax, dword [esp + 0x18]
mov ebp, dword [esp + 0x24]
mov ebx, 0x1f
cmp eax, 0x20
jb 0x5023ed
shr eax, 5
mov dword [esp + 0x44], eax
nop
mov ecx, dword [ebp + 0x3c]
mov esi, dword [esp + 0x10]
mov eax, dword [esi]
add ecx, ebx
and ecx, 0xffffffe0
cmp ecx, 0x20
jbe 0x502325
mov edx, 1
mov ecx, esi
lea ebx, [ebx]
mov edi, dword [ecx + 4]
mov dword [ecx], edi
mov edi, dword [ebp + 0x3c]
add edi, ebx
inc edx
shr edi, 5
add ecx, 4
cmp edx, edi
jb 0x502310
mov edx, dword [ebp + 0x3c]
add edx, ebx
shr edx, 5
mov dword [esi + edx*4 - 4], 0
mov edi, dword [ebp + 0x44]
cmp edi, 0x20
jae 0x502363
mov esi, 0x20
xor edx, edx
sub esi, edi
je 0x502376
mov ecx, edx
mov ebp, eax
shr ebp, cl
mov ecx, edi
inc edx
inc edi
and ebp, 1
shl ebp, cl
xor eax, ebp
cmp edx, esi
jb 0x502348
mov ebp, dword [esp + 0x24]
jmp 0x502376
mov ecx, edi
mov edx, edi
shr edx, 5
lea edx, [esi + edx*4 - 4]
and ecx, ebx
mov esi, eax
shl esi, cl
xor dword [edx], esi
mov edi, dword [esp + 0x10]
test byte [ebp + 0x44], bl
je 0x502399
mov edx, dword [ebp + 0x44]
mov ecx, edx
shr ecx, 5
lea esi, [edi + ecx*4]
and edx, ebx
mov ecx, 0x20
sub ecx, edx
mov edx, eax
shr edx, cl
xor dword [esi], edx
test byte [ebp + 0x40], bl
je 0x5023cc
mov ecx, dword [ebp + 0x40]
mov edx, ecx
and ecx, ebx
mov esi, eax
shl esi, cl
shr edx, 5
lea edx, [edi + edx*4 - 4]
xor dword [edx], esi
mov edx, dword [ebp + 0x40]
mov ecx, edx
shr ecx, 5
lea esi, [edi + ecx*4]
and edx, ebx
mov ecx, 0x20
sub ecx, edx
shr eax, cl
xor dword [esi], eax
jmp 0x5023da
mov edx, dword [ebp + 0x40]
shr edx, 5
xor dword [edi + edx*4 - 4], eax
lea ecx, [edi + edx*4 - 4]
sub dword [esp + 0x18], 0x20
dec dword [esp + 0x44]
jne 0x5022f0
mov eax, dword [esp + 0x18]
test eax, eax
je 0x5024c8
mov eax, dword [esp + 0x18]
mov edx, dword [esp + 0x10]
mov esi, dword [edx]
push eax
mov ecx, 0x20
sub ecx, eax
mov eax, dword [ebp + 0x3c]
add eax, ebx
shr eax, 5
push eax
push edx
shl esi, cl
call fcn.004e6ea0
mov edi, dword [ebp + 0x44]
add esp, 0xc
cmp edi, 0x20
jae 0x50244b
mov edx, 0x20
xor eax, eax
sub edx, edi
je 0x502462
mov edi, edi
mov ecx, eax
mov ebp, esi
shr ebp, cl
mov ecx, edi
inc eax
inc edi
and ebp, 1
shl ebp, cl
xor esi, ebp
cmp eax, edx
jb 0x502430
mov ebp, dword [esp + 0x24]
jmp 0x502462
mov eax, dword [esp + 0x10]
mov ecx, edi
mov edx, edi
shr edx, 5
lea eax, [eax + edx*4 - 4]
and ecx, ebx
mov edx, esi
shl edx, cl
xor dword [eax], edx
mov edi, dword [esp + 0x10]
test byte [ebp + 0x44], bl
je 0x502485
mov eax, dword [ebp + 0x44]
mov ecx, eax
shr ecx, 5
lea edx, [edi + ecx*4]
and eax, ebx
mov ecx, 0x20
sub ecx, eax
mov eax, esi
shr eax, cl
xor dword [edx], eax
test byte [ebp + 0x40], bl
je 0x5024b8
mov ecx, dword [ebp + 0x40]
mov edx, ecx
shr edx, 5
lea eax, [edi + edx*4 - 4]
and ecx, ebx
mov edx, esi
shl edx, cl
xor dword [eax], edx
mov eax, dword [ebp + 0x40]
mov ecx, eax
shr ecx, 5
lea edx, [edi + ecx*4]
and eax, ebx
mov ecx, 0x20
sub ecx, eax
shr esi, cl
xor dword [edx], esi
jmp 0x5024cc
mov edx, dword [ebp + 0x40]
shr edx, 5
xor dword [edi + edx*4 - 4], esi
lea eax, [edi + edx*4 - 4]
jmp 0x5024cc
mov edi, dword [esp + 0x10]
mov eax, dword [ebp + 0x50]
cmp eax, edi
je 0x5024e5
mov ecx, dword [ebp + 0x4c]
add ecx, ecx
add ecx, ecx
push ecx
push edi
push eax
call fcn.00530fb0
add esp, 0xc
mov edx, dword [esp + 0x2c]
mov ecx, dword [esp + 0x3c]
mov edi, edx
xor eax, eax
push edx
rep stosd dword es:[edi], eax
call fcn.00493190
add esp, 4
pop edi
lea eax, [ebp + 0x48]
pop ebp
pop ebx
pop esi
add esp, 0x30
ret 4