Function at 0x5151c0
Capabilities:
Encode data using xor

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x14
mov eax, dword [ebp + 8]
push ebx
push esi
mov esi, dword [eax + 8]
push edi
mov eax, esi
mov dword [esp + 0xc], 0
call fcn.004f6dc0
mov ebx, dword [esi + 0x1c]
mov dword [esp + 0x10], eax
cmp dword [esi + 0x20], ebx
jg 0x5151f8
mov edi, esi
call fcn.004f69d0
test eax, eax
jne 0x515227
mov edx, dword [esi + 4]
inc dword [esi + 0x1c]
lea ecx, [ebx + ebx*4]
lea eax, [edx + ecx*4]
mov ecx, dword [ebp + 0x10]
mov edx, dword [esp + 0x10]
mov dword [eax + 4], ecx
mov ecx, dword [ebp + 0x14]
mov byte [eax + 3], 0
mov dword [eax + 8], edx
mov dword [eax + 0xc], ecx
mov dword [eax + 0x10], 0
mov word [eax], 0x36
mov edx, dword [ebp + 8]
mov eax, dword [edx]
test dword [eax + 0x18], 0x4000000
mov ebx, dword [ebp + 0xc]
je 0x515248
mov ecx, ebx
call fcn.00519a10
test eax, eax
jne 0x515252
cmp dword [ebx + 0x24], eax
jne 0x515252
cmp dword [ebp + 0x1c], 0
je 0x51539e
mov ecx, dword [ebp + 0x20]
mov edi, dword [ebp + 8]
mov eax, dword [ebp + 0x1c]
push ecx
push ebx
push 3
push 0
push 0
push edi
call fcn.0052d0a0
push ebx
push edi
mov dword [esp + 0x34], eax
call fcn.0051a170
or dword [esp + 0x34], eax
mov eax, dword [edi + 0x4c]
mov ecx, dword [ebx + 8]
lea edx, [eax + 1]
mov dword [esp + 0x2c], edx
lea edx, [eax + ecx + 1]
mov dword [edi + 0x4c], edx
mov eax, dword [esi + 0x1c]
add esp, 0x20
mov dword [esp + 0x1c], eax
cmp dword [esi + 0x20], eax
jg 0x5152aa
mov edi, esi
call fcn.004f69d0
test eax, eax
jne 0x5152d4
mov eax, dword [esp + 0x1c]
mov ecx, dword [esi + 4]
inc dword [esi + 0x1c]
mov edx, dword [ebp + 0x14]
lea eax, [eax + eax*4]
lea eax, [ecx + eax*4]
mov ecx, dword [esp + 0xc]
mov dword [eax + 8], ecx
xor ecx, ecx
mov byte [eax + 3], 0
mov dword [eax + 4], edx
mov dword [eax + 0xc], ecx
mov dword [eax + 0x10], ecx
mov word [eax], 0xe
xor edi, edi
cmp dword [ebx + 8], edi
jle 0x515319
jmp 0x5152e0
mov eax, dword [esp + 0x14]
cmp eax, 0xffffffff
je 0x5152f6
mov edx, 1
mov ecx, edi
shl edx, cl
test eax, edx
je 0x515313
mov eax, dword [esp + 0xc]
mov edx, dword [ebp + 0x10]
lea ecx, [edi + eax + 1]
push ecx
push edx
push ebx
mov ebx, edi
mov eax, esi
call fcn.00508c70
mov ebx, dword [ebp + 0xc]
add esp, 0xc
inc edi
cmp edi, dword [ebx + 8]
jl 0x5152e0
mov eax, dword [esp + 0x10]
mov ecx, dword [ebp + 0x20]
mov edx, dword [esp + 0xc]
push eax
mov eax, dword [ebp + 0x1c]
push ecx
mov ecx, dword [ebp + 8]
push edx
push ebx
push 1
push 0
push 0x6a
push eax
push ecx
call fcn.0052d030
mov eax, dword [esi + 0x1c]
add esp, 0x24
mov dword [esp + 0x1c], eax
cmp dword [esi + 0x20], eax
jg 0x515359
mov edi, esi
call fcn.004f69d0
test eax, eax
jne 0x515388
mov eax, dword [esp + 0x1c]
inc dword [esi + 0x1c]
mov ecx, dword [ebp + 0x10]
lea edx, [eax + eax*4]
mov eax, dword [esi + 4]
lea eax, [eax + edx*4]
mov edx, dword [esp + 0x10]
mov dword [eax + 4], ecx
mov ecx, dword [ebp + 0x14]
mov byte [eax + 3], 0
mov dword [eax + 8], edx
mov dword [eax + 0xc], ecx
mov dword [eax + 0x10], 0
mov word [eax], 0x36
mov edx, dword [esp + 0xc]
push 0
push edx
push ebx
mov ebx, dword [ebp + 8]
call fcn.00519c10
mov ebx, dword [ebp + 0xc]
add esp, 0xc
cmp dword [ebx + 0x1c], 0
jne 0x51547c
mov eax, dword [ebp + 0x10]
mov ecx, dword [ebp + 8]
push 0
push eax
push ecx
mov eax, ebx
call fcn.005155a0
mov eax, dword [esi + 0x1c]
add esp, 0xc
mov dword [esp + 0x1c], eax
cmp dword [esi + 0x20], eax
jg 0x5153d7
mov edi, esi
call fcn.004f69d0
test eax, eax
jne 0x515405
mov eax, dword [esp + 0x1c]
inc dword [esi + 0x1c]
mov ecx, dword [ebp + 0x10]
lea edx, [eax + eax*4]
mov eax, dword [esi + 4]
lea eax, [eax + edx*4]
xor edi, edi
xor edx, edx
cmp dword [ebp + 0x18], edi
mov byte [eax + 3], 0
setne dl
mov dword [eax + 4], ecx
mov dword [eax + 0xc], edi
mov dword [eax + 0x10], edi
mov word [eax], 0x3b
mov dword [eax + 8], edx
cmp dword [ebp + 0x18], 0
je 0x51547c
mov ecx, dword [esi + 4]
mov eax, dword [ebx]
mov edi, dword [esi]
mov dword [esp + 0x1c], eax
test ecx, ecx
je 0x515473
cmp byte [edi + 0x36], 0
jne 0x515473
mov eax, dword [esi + 0x1c]
lea eax, [eax + eax*4 - 5]
lea ecx, [ecx + eax*4]
movsx eax, byte [ecx + 1]
mov dword [esp + 0x14], ecx
mov ecx, dword [ecx + 0x10]
call fcn.004f7010
mov ecx, dword [esp + 0x1c]
mov eax, dword [esp + 0x14]
xor edx, edx
mov dword [eax + 0x10], edx
cmp ecx, edx
jne 0x515453
mov dword [eax + 0x10], edx
mov byte [eax + 1], dl
jmp 0x51547c
call fcn.004dd0f0
mov edx, dword [esi]
mov edi, eax
mov ebx, ecx
call fcn.004db2c0
mov ecx, dword [esp + 0x14]
mov ebx, dword [ebp + 0xc]
mov dword [ecx + 0x10], eax
mov byte [ecx + 1], 0xff
jmp 0x51547c
mov ecx, eax
xor eax, eax
call fcn.004f7010
mov ecx, dword [ebp + 8]
mov edx, dword [ecx]
test dword [edx + 0x18], 0x4000000
je 0x515551
mov ecx, dword [ebx]
mov eax, ecx
test ecx, ecx
jne 0x51549e
xor edi, edi
mov dword [esp + 0x18], edi
jmp 0x5154b6
cmp byte [ecx], 0
je 0x5154a9
inc eax
cmp byte [eax], 0
jne 0x5154a3
sub eax, ecx
and eax, 0x3fffffff
mov edi, eax
mov dword [esp + 0x18], eax
mov eax, dword [ebx + 0x44]
add eax, 0x38
cmp dword [eax + 0xc], 0
mov dword [esp + 0x1c], eax
je 0x515501
xor eax, eax
mov dword [esp + 0x14], edi
test edi, edi
jle 0x5154f7
movzx edx, byte [ecx]
movzx edx, byte [edx + 0x66da38]
lea edi, [eax*8]
xor edx, edi
xor eax, edx
mov edx, dword [esp + 0x14]
dec edx
inc ecx
mov dword [esp + 0x14], edx
test edx, edx
jg 0x5154d0
mov edi, dword [esp + 0x18]
mov ecx, dword [esp + 0x1c]
xor edx, edx
div dword [ecx]
jmp 0x515503
xor edx, edx
mov eax, dword [ebx]
push edi
push eax
mov eax, dword [esp + 0x24]
call fcn.004de500
add esp, 8
test eax, eax
je 0x515551
mov edi, dword [eax + 8]
test edi, edi
je 0x515551
mov edi, edi
mov eax, dword [ebp + 8]
push 0
push edi
push ebx
call fcn.0051a4d0
add esp, 0xc
test eax, eax
je 0x51554a
mov edx, dword [esp + 0xc]
push 0
push 2
push edx
push ebx
push eax
mov eax, dword [ebp + 8]
push eax
call fcn.0052cef0
add esp, 0x18
mov edi, dword [edi + 0xc]
test edi, edi
jne 0x515520
mov edi, dword [esp + 0x10]
mov ecx, dword [ebp + 0x20]
mov edx, dword [esp + 0xc]
mov eax, dword [ebp + 0x1c]
push edi
push ecx
mov ecx, dword [ebp + 8]
push edx
push ebx
push 2
push 0
push 0x6a
push eax
push ecx
call fcn.0052d030
mov eax, dword [esi + 0x28]
add esp, 0x24
test eax, eax
je 0x51558b
mov ecx, dword [esi + 0x1c]
lea edx, [edi*4 + 4]
sub eax, edx
mov dword [eax], ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret