Function at 0x520058
Capabilities:
Encode data using xor

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x10033d71
mov eax, dword fs:[0]
push eax
sub esp, 0x38
mov eax, dword [0x10042170]
xor eax, ebp
mov dword [ebp - 0x10], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov ebx, dword [ebp + 8]
mov edx, dword [ebp + 0xc]
mov dword [ebp - 0x40], ebx
mov dword [ebp - 0x38], 0
call fcn.0051f9b8
mov edx, dword [edx]
push 0
push 0x8000000
push 3
push 0
push 3
push 0x80000000
push edx
call dword [0x10035110]
mov edi, eax
push 0
push edi
call dword [0x10035050]
mov esi, eax
push esi
push 0x20
lea ecx, [ebp - 0x2c]
call fcn.0051f368
mov ecx, 1
mov dword [ebp - 4], ecx
test esi, esi
jns 0x5200e1
push 0x80070057
call fcn.00509828
mov edx, dword [ebp - 0x2c]
mov eax, dword [edx - 8]
sub ecx, dword [edx - 4]
sub eax, esi
or eax, ecx
jge 0x5200fc
push esi
lea ecx, [ebp - 0x2c]
call fcn.0050ac28
mov edx, dword [ebp - 0x2c]
push 0
lea eax, [ebp - 0x44]
push eax
push esi
push edx
push edi
call dword [0x1003504c]
push edi
call dword [0x10035100]
mov eax, dword [ebp - 0x2c]
mov ecx, dword [eax - 8]
push ecx
push eax
call fcn.005286e8
add esp, 8
test eax, eax
js 0x5200d7
mov ecx, dword [ebp - 0x2c]
cmp eax, dword [ecx - 8]
jg 0x5200d7
mov dword [ecx - 0xc], eax
mov edx, dword [ebp - 0x2c]
xor ecx, ecx
mov word [edx + eax*2], cx
mov edx, dword [ebp - 0x2c]
or eax, 0xffffffff
mov ecx, esi
test esi, esi
je 0x520163
mov edi, edi
movzx edi, byte [edx]
mov esi, eax
and esi, 0xff
xor esi, edi
shr eax, 8
xor eax, dword [esi*4 + 0x10043718]
inc edx
dec ecx
jne 0x520148
xor ecx, ecx
mov dword [ebp - 0x23], ecx
mov dword [ebp - 0x1f], ecx
mov dword [ebp - 0x1b], ecx
mov dword [ebp - 0x17], ecx
mov word [ebp - 0x13], cx
mov byte [ebp - 0x11], cl
push 0x10
lea ecx, [ebp - 0x24]
not eax
push ecx
push eax
mov byte [ebp - 0x24], 0
call fcn.005386ef
add esp, 0xc
lea edx, [ebp - 0x24]
push edx
call dword [0x10035090]
lea esi, [eax + 1]
cmp esi, 0x3fffffff
jg 0x5201ce
lea eax, [esi + esi]
call fcn.00529078
mov edi, esp
test edi, edi
je 0x5201ce
push esi
push edi
push 0xffffffffffffffff
lea ecx, [ebp - 0x24]
xor eax, eax
push ecx
push eax
push 3
mov word [edi], ax
call dword [0x100350f0]
neg eax
sbb eax, eax
and eax, edi
jmp 0x5201d0
xor eax, eax
push eax
lea ecx, [ebp - 0x28]
call fcn.0050d108
mov byte [ebp - 4], 2
mov edx, dword [ebp - 0x28]
mov ecx, dword [edx - 0xc]
cmp ecx, 8
jge 0x5202d7
mov eax, 8
sub eax, ecx
test eax, eax
jle 0x5202d7
mov dword [ebp - 0x30], eax
jmp 0x520208
push 0x100362f4
lea ecx, [ebp - 0x34]
call fcn.0050d108
mov byte [ebp - 4], 3
lea edx, [ebp - 0x28]
push edx
push eax
lea eax, [ebp - 0x3c]
push eax
call fcn.0050c648
add esp, 0xc
mov byte [ebp - 4], 4
mov ecx, dword [eax]
mov esi, dword [ebp - 0x28]
lea eax, [ecx - 0x10]
add esi, 0xfffffff0
cmp eax, esi
je 0x520282
cmp dword [esi + 0xc], 0
lea edi, [esi + 0xc]
jl 0x520275
mov edx, dword [eax]
cmp edx, dword [esi]
jne 0x520275
push eax
call fcn.0050ac88
mov ebx, eax
add esp, 4
or eax, 0xffffffff
lock xadd dword [edi], eax
dec eax
test eax, eax
jg 0x52026d
mov ecx, dword [esi]
mov edx, dword [ecx]
mov eax, dword [edx + 4]
push esi
call eax
add ebx, 0x10
mov dword [ebp - 0x28], ebx
jmp 0x520282
mov eax, dword [ecx - 0xc]
push eax
push ecx
lea ecx, [ebp - 0x28]
call fcn.0050b818
mov byte [ebp - 4], 3
mov eax, dword [ebp - 0x3c]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x5202a5
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov byte [ebp - 4], 2
mov eax, dword [ebp - 0x34]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x5202c8
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
dec dword [ebp - 0x30]
jne 0x520208
mov edx, dword [ebp - 0x28]
mov ebx, dword [ebp - 0x40]
mov esi, dword [edx - 0xc]
test esi, esi
jns 0x5202e8
push 0x80070057
call fcn.00509828
mov eax, dword [edx - 8]
mov ecx, 1
sub ecx, dword [edx - 4]
sub eax, esi
or eax, ecx
jge 0x520305
push esi
lea ecx, [ebp - 0x28]
call fcn.0050ac28
mov edx, dword [ebp - 0x28]
lea ecx, [esi + 1]
push ecx
push edx
call fcn.00527cbc
mov eax, dword [ebp - 0x28]
add esp, 8
cmp esi, dword [eax - 8]
jg 0x5200d7
mov dword [eax - 0xc], esi
mov eax, dword [ebp - 0x28]
xor edx, edx
mov word [eax + esi*2], dx
mov esi, dword [ebp - 0x28]
mov ecx, dword [esi - 0x10]
mov edx, dword [ecx]
mov eax, dword [edx + 0x10]
call eax
cmp dword [esi - 4], 0
lea ecx, [esi - 4]
jl 0x520353
cmp eax, dword [esi - 0x10]
jne 0x520353
lea edi, [esi - 0x10]
mov edx, 1
lock xadd dword [ecx], edx
jmp 0x52038c
mov ecx, dword [esi - 0xc]
mov edx, dword [eax]
mov edx, dword [edx]
push 2
push ecx
mov ecx, eax
call edx
mov edi, eax
test edi, edi
jne 0x52036c
call fcn.0050a0f8
mov eax, dword [esi - 0xc]
mov dword [edi + 4], eax
mov eax, dword [esi - 0xc]
lea ecx, [eax + eax + 2]
push ecx
lea edx, [eax + eax + 2]
push esi
push edx
lea eax, [edi + 0x10]
push eax
call fcn.00528708
add esp, 0x10
add edi, 0x10
mov dword [ebx], edi
mov byte [ebp - 4], 2
mov dword [ebp - 0x38], 1
mov byte [ebp - 4], 1
mov eax, dword [ebp - 0x28]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x5203bf
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov dword [ebp - 4], 0
mov eax, dword [ebp - 0x2c]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x5203e5
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov eax, ebx
lea esp, [ebp - 0x54]
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 0x10]
xor ecx, ebp
call fcn.00527746
mov esp, ebp
pop ebp
ret