Function at 0x51f0d10
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0x18
xor ecx, ecx
push ebx
mov ebx, eax
mov dword [esp + 0x14], ecx
mov dword [esp + 8], 1
cmp edi, ecx
jne 0x51f0d30
or eax, 0xffffffff
pop ebx
add esp, 0x18
ret
cmp ebx, 8
jb 0x51f0d28
cmp ebx, 0x4000
ja 0x51f0d28
mov eax, dword [edi + 4]
push ebp
mov ebp, dword [edi + 8]
mov dword [esp + 0x14], ebp
mov dword [esp + 8], eax
cmp eax, ecx
jne 0x51f0d59
pop ebp
or eax, 0xffffffff
pop ebx
add esp, 0x18
ret
cmp ebp, 0x80
jne 0x51f0d65
mov dword [esp + 0xc], ecx
push esi
lea esi, [ebx + ebx*4]
add esi, esi
add esi, esi
push esi
call dword [0x53f2e4c]
add esp, 4
mov dword [edi + 4], eax
test eax, eax
jne 0x51f0d8f
mov eax, dword [esp + 0xc]
pop esi
pop ebp
mov dword [edi + 4], eax
or eax, 0xffffffff
pop ebx
add esp, 0x18
ret
push esi
push 0
push eax
call sub.MSVCR90.dll_memset
add esp, 0xc
mov dword [edi + 8], ebx
test ebp, ebp
jbe 0x51f0f98
mov ebx, dword [esp + 0xc]
add ebx, 4
mov dword [esp + 0x14], ebp
cmp dword [ebx + 8], 0
je 0x51f0e6e
cmp dword [esp + 0x10], 0
je 0x51f0dc7
mov ebp, dword [ebx + 0xc]
jmp 0x51f0de8
cmp dword [edi + 8], 0x80
mov edx, dword [ebx + 4]
jne 0x51f0ddc
mov ecx, dword [ebx]
call fcn.051f0a20
jmp 0x51f0de6
mov eax, dword [edi + 0x18]
mov esi, dword [ebx]
call fcn.051f0970
mov ebp, eax
xor edx, edx
mov eax, ebp
div dword [edi + 8]
mov ecx, dword [edi + 4]
lea esi, [edx + edx*4]
add esi, esi
add esi, esi
cmp dword [ecx + esi + 0xc], 0
lea eax, [ecx + esi]
jne 0x51f0e32
mov edx, dword [ebx - 4]
mov dword [eax], edx
mov ecx, dword [ebx]
mov dword [eax + 4], ecx
mov edx, dword [ebx + 4]
mov dword [eax + 8], edx
mov ecx, dword [ebx + 8]
mov dword [eax + 0xc], ecx
mov edx, dword [ebx + 0xc]
mov dword [eax + 0x10], edx
mov eax, dword [edi + 4]
mov dword [esi + eax], 0
mov ecx, dword [edi + 4]
mov dword [ecx + esi + 0x10], ebp
jmp 0x51f0e6e
push 0x14
call dword [0x53f2e4c]
add esp, 4
test eax, eax
je 0x51f0e66
mov edx, dword [ebx]
mov dword [eax + 4], edx
mov ecx, dword [ebx + 4]
mov dword [eax + 8], ecx
mov dword [eax + 0x10], ebp
mov edx, dword [edi + 4]
mov ecx, dword [esi + edx]
mov dword [eax], ecx
mov dword [eax + 0xc], 1
mov edx, dword [edi + 4]
mov dword [esi + edx], eax
jmp 0x51f0e6e
mov dword [esp + 0x1c], 0xffffffff
add ebx, 0x14
sub dword [esp + 0x14], 1
jne 0x51f0db1
mov ebp, dword [esp + 0x18]
test ebp, ebp
jbe 0x51f0f98
mov eax, dword [esp + 0xc]
mov dword [esp + 0x14], eax
mov dword [esp + 0x18], ebp
mov ecx, dword [esp + 0x14]
mov esi, dword [ecx]
test esi, esi
je 0x51f0f88
cmp dword [esp + 0x10], 0
mov ebp, dword [esi]
mov dword [esp + 0x20], ebp
je 0x51f0eb4
mov ebx, dword [esi + 0x10]
jmp 0x51f0f12
cmp dword [edi + 8], 0x80
mov edx, dword [esi + 8]
jne 0x51f0eca
mov ecx, dword [esi + 4]
call fcn.051f0a20
jmp 0x51f0f10
mov ebx, dword [esi + 4]
test edx, edx
jle 0x51f0f0e
test ebx, ebx
je 0x51f0f0e
mov eax, dword [edi + 0x18]
xor ecx, ecx
test edx, edx
jle 0x51f0efc
mov edi, edi
movzx ebp, byte [ecx + ebx]
add ebp, eax
imul ebp, ebp, 0x401
mov eax, ebp
shr ebp, 6
inc ecx
xor eax, ebp
cmp ecx, edx
jl 0x51f0ee0
mov ebp, dword [esp + 0x20]
lea ecx, [eax + eax*8]
mov eax, ecx
shr eax, 0xb
xor eax, ecx
imul eax, eax, 0x8001
jmp 0x51f0f10
xor eax, eax
mov ebx, eax
xor edx, edx
mov eax, ebx
div dword [edi + 8]
lea ecx, [edx + edx*4]
mov edx, dword [edi + 4]
add ecx, ecx
add ecx, ecx
cmp dword [edx + ecx + 0xc], 0
lea eax, [edx + ecx]
jne 0x51f0f71
mov edx, dword [esi]
mov dword [eax], edx
mov edx, dword [esi + 4]
mov dword [eax + 4], edx
mov edx, dword [esi + 8]
mov dword [eax + 8], edx
mov edx, dword [esi + 0xc]
mov dword [eax + 0xc], edx
mov edx, dword [esi + 0x10]
mov dword [eax + 0x10], edx
mov eax, dword [edi + 4]
mov dword [ecx + eax], 0
mov edx, dword [edi + 4]
mov dword [edx + ecx + 0xc], 1
mov eax, dword [edi + 4]
push esi
mov dword [eax + ecx + 0x10], ebx
call dword [0x53f2e48]
add esp, 4
jmp 0x51f0f7e
mov edx, dword [eax]
mov dword [esi], edx
mov dword [esi + 0x10], ebx
mov eax, dword [edi + 4]
mov dword [ecx + eax], esi
mov esi, ebp
test ebp, ebp
jne 0x51f0ea2
add dword [esp + 0x14], 0x14
sub dword [esp + 0x18], 1
jne 0x51f0e94
mov ecx, dword [esp + 0xc]
push ecx
call dword [0x53f2e48]
mov eax, dword [esp + 0x20]
add esp, 4
pop esi
pop ebp
pop ebx
add esp, 0x18
ret