Function at 0x505910
Capabilities:
Encode data using xor

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x458
mov eax, dword [0x12173220]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 8]
mov ecx, 0xff
push ebx
push esi
push edi
push 4
pop edi
cmp dword [eax + 0x18], edi
mov dword [ebp - 0x454], eax
cmovl edi, dword [eax + 0x18]
xor esi, esi
mov eax, dword [ebp + 0xc]
mov ebx, esi
mov dword [ebp - 0x458], edi
mov dword [ebp - 0x44c], ecx
cmp dword [eax + ebx*4], esi
jne 0x50595b
inc ebx
cmp ebx, ecx
jle 0x505951
mov dword [ebp - 0x450], ebx
cmp ebx, ecx
jge 0x505975
cmp dword [eax + ecx*4], esi
jne 0x50596f
dec ecx
cmp ecx, ebx
jg 0x505965
mov dword [ebp - 0x44c], ecx
mov eax, ecx
sub eax, ebx
mov dword [ebp - 0x444], eax
test edi, edi
jle 0x5059bd
mov ecx, dword [ebp - 0x444]
lea eax, [edi + edi]
mov dword [ebp - 0x43c], eax
lea eax, [ecx + ecx]
mov dword [ebp - 0x444], eax
mov eax, ecx
add ecx, dword [ebp - 0x444]
cdq
idiv dword [ebp - 0x43c]
add eax, ebx
mov dword [ebp + esi*4 - 0x14], eax
inc esi
cmp esi, edi
jl 0x50599b
mov ecx, dword [ebp - 0x44c]
xor esi, esi
mov dword [ebp - 0x444], esi
test edi, edi
jle 0x5059ee
mov edx, edi
xor eax, eax
shl edx, 2
lea edi, [ebp - 0x24]
mov ecx, edx
shr ecx, 2
rep stosd dword es:[edi], eax
shr edx, 2
lea edi, [ebp - 0x34]
mov ecx, edx
rep stosd dword es:[edi], eax
mov edi, dword [ebp - 0x458]
mov ecx, dword [ebp - 0x44c]
mov dword [ebp - 0x438], esi
mov dword [ebp - 0x448], ebx
cmp ebx, ecx
jg 0x505a9d
mov eax, dword [ebp + 0xc]
lea edx, [eax + ebx*4]
lea ebx, [ebp - 0x434]
mov dword [ebp - 0x43c], edx
sub ebx, eax
mov dword [ebp - 0x440], ebx
mov ebx, dword [ebp - 0x448]
mov eax, dword [edx]
test eax, eax
je 0x505a87
lea eax, [esi + 1]
mov dword [ebp - 0x438], eax
cmp eax, edi
jge 0x505a6f
mov eax, ebx
sub eax, dword [ebp + esi*4 - 0x10]
cdq
mov ecx, eax
mov eax, ebx
sub eax, dword [ebp + esi*4 - 0x14]
xor ecx, edx
sub ecx, edx
cdq
xor eax, edx
sub eax, edx
cmp ecx, eax
jge 0x505a63
mov eax, dword [ebp - 0x438]
inc esi
inc eax
mov dword [ebp - 0x438], eax
cmp eax, edi
jl 0x505a35
mov ecx, dword [ebp - 0x44c]
mov edx, dword [ebp - 0x43c]
mov eax, dword [ebp - 0x440]
mov dword [eax + edx], esi
mov eax, dword [edx]
imul eax, ebx
add dword [ebp + esi*4 - 0x34], eax
mov eax, dword [edx]
add dword [ebp + esi*4 - 0x24], eax
inc ebx
add edx, 4
mov dword [ebp - 0x43c], edx
cmp ebx, ecx
jle 0x505a22
mov ebx, dword [ebp - 0x450]
xor esi, esi
mov dword [ebp - 0x438], esi
mov edx, esi
mov dword [ebp - 0x43c], esi
mov eax, esi
mov dword [ebp - 0x448], edx
mov dword [ebp - 0x440], eax
test edi, edi
jle 0x505b4e
mov ebx, esi
mov ecx, dword [ebp + eax*4 - 0x24]
mov dword [ebp - 0x438], ecx
test ecx, ecx
je 0x505b23
mov eax, ecx
cdq
sub eax, edx
mov ecx, eax
mov eax, dword [ebp - 0x440]
sar ecx, 1
mov eax, dword [ebp + eax*4 - 0x34]
add eax, ecx
cdq
idiv dword [ebp - 0x438]
mov ecx, eax
mov eax, dword [ebp - 0x440]
mov eax, dword [ebp + eax*4 - 0x14]
sub eax, ecx
cdq
xor eax, edx
sub eax, edx
add esi, eax
mov eax, dword [ebp - 0x440]
mov edx, dword [ebp + eax*4 - 0x24]
mov dword [ebp + eax*4 - 0x14], ecx
mov eax, edx
imul eax, ecx
add dword [ebp - 0x43c], eax
add ebx, edx
mov eax, dword [ebp - 0x440]
inc eax
mov dword [ebp - 0x440], eax
cmp eax, edi
jl 0x505ac3
mov ecx, dword [ebp - 0x44c]
mov dword [ebp - 0x448], ebx
mov ebx, dword [ebp - 0x450]
mov edx, dword [ebp - 0x448]
mov dword [ebp - 0x438], esi
xor esi, esi
mov eax, edx
cdq
sub eax, edx
sar eax, 1
add eax, dword [ebp - 0x43c]
cdq
idiv dword [ebp - 0x448]
cmp dword [ebp - 0x438], 5
mov dword [ebp - 0x43c], eax
jl 0x505b87
mov eax, dword [ebp - 0x444]
inc eax
mov dword [ebp - 0x444], eax
cmp eax, 6
jl 0x5059c3
mov ebx, dword [ebp - 0x454]
mov eax, dword [ebx + 0x28]
imul eax, dword [ebx + 0x2c]
test eax, eax
jle 0x505bcc
mov edx, dword [ebx + 0x5558]
movzx eax, byte [edx + esi*8 + 4]
mov ecx, dword [ebp + eax*4 - 0x434]
mov eax, ecx
shl eax, 5
xor eax, dword [edx + esi*8]
and eax, 0x60
xor dword [edx + esi*8], eax
mov al, byte [ebp + ecx*4 - 0x14]
mov byte [edx + esi*8 + 4], al
inc esi
mov eax, dword [ebx + 0x28]
imul eax, dword [ebx + 0x2c]
cmp esi, eax
jl 0x505b98
cmp edi, 1
jle 0x505be0
mov eax, dword [ebx]
test byte [eax + 0x44], 1
je 0x505be0
push ebx
call fcn.00506183
pop ecx
push dword [ebp - 0x43c]
lea eax, [ebp - 0x14]
push eax
push ebx
call fcn.005060c4
mov ecx, dword [ebp - 4]
add esp, 0xc
xor ecx, ebp
pop edi
pop esi
pop ebx
call 0xec9ec
mov esp, ebp
pop ebp
ret