Function at 0x51d170
Capabilities:
Encode data using xor

Disassembly:
push ebp
mov ebp, esp
mov eax, 0x3c
call fcn.0065cc50
mov eax, dword [0x745694]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 8]
push ebx
push esi
mov esi, ecx
mov dword [ebp - 0x20], eax
push edi
mov edi, edx
mov dword [ebp - 0x34], esi
mov dword [ebp - 0x24], edi
mov bl, byte [esi]
mov ecx, dword [esi + 0x28]
mov eax, dword [esi + 0x2c]
mov byte [ebp - 0x19], bl
mov dword [ebp - 0x28], ecx
mov dword [ebp - 0x2c], eax
test bl, 0x40
jne 0x51d1bb
push eax
lea eax, [esi + 0x10]
push eax
push esi
call ecx
add esp, 0xc
movzx eax, bl
mov edx, 0xf
and eax, 7
xor ecx, ecx
sub edx, eax
mov byte [esi], al
mov dword [ebp - 0x38], edx
cmp edx, 0xf
jae 0x51d1e7
movzx eax, byte [esi + edx]
or ecx, eax
mov byte [esi + edx], 0
inc edx
shl ecx, 8
cmp edx, 0xf
jb 0x51d1d4
movzx eax, byte [esi + 0xf]
mov ebx, dword [ebp + 0xc]
or ecx, eax
mov byte [esi + 0xf], 1
cmp ecx, ebx
je 0x51d20c
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0065cc3a
mov esp, ebp
pop ebp
ret
cmp ebx, 0x10
jb 0x51d2a1
mov edi, 0xfffffff8
mov eax, ebx
sub edi, esi
shr eax, 4
mov dword [ebp - 0x30], eax
push dword [ebp - 0x2c]
lea eax, [ebp - 0x18]
push eax
push esi
call dword [ebp - 0x28]
add esp, 0xc
lea eax, [esi + 0x10]
add byte [eax - 1], 1
lea eax, [eax - 1]
jne 0x51d245
lea ecx, [edi + eax]
test ecx, ecx
jne 0x51d235
mov edx, dword [ebp - 0x24]
mov ecx, dword [ebp - 0x18]
push dword [ebp - 0x2c]
xor ecx, dword [edx]
mov eax, dword [edx + 4]
xor eax, dword [ebp - 0x14]
mov edx, dword [ebp - 0x20]
mov dword [edx + 4], eax
mov dword [edx], ecx
xor dword [esi + 0x10], ecx
xor dword [esi + 0x14], eax
mov edx, dword [ebp - 0x24]
mov ecx, dword [ebp - 0x10]
mov eax, dword [edx + 0xc]
xor ecx, dword [edx + 8]
mov edx, dword [ebp - 0x20]
xor eax, dword [ebp - 0xc]
mov dword [edx + 0xc], eax
mov dword [edx + 8], ecx
xor dword [esi + 0x1c], eax
lea eax, [esi + 0x10]
xor dword [esi + 0x18], ecx
push eax
push eax
call dword [ebp - 0x28]
add dword [ebp - 0x24], 0x10
add esp, 0xc
add dword [ebp - 0x20], 0x10
sub ebx, 0x10
sub dword [ebp - 0x30], 1
jne 0x51d224
mov edi, dword [ebp - 0x24]
test ebx, ebx
je 0x51d2f5
push dword [ebp - 0x2c]
lea eax, [ebp - 0x18]
push eax
push esi
call dword [ebp - 0x28]
add esp, 0xc
test ebx, ebx
je 0x51d2e2
lea ecx, [ebp - 0x18]
mov eax, ecx
lea edx, [esi + 0x10]
sub edi, eax
sub dword [ebp - 0x20], eax
mov esi, dword [ebp - 0x20]
mov al, byte [edi + ecx]
lea ecx, [ecx + 1]
xor al, byte [ecx - 1]
lea edx, [edx + 1]
mov byte [esi + ecx - 1], al
xor byte [edx - 1], al
sub ebx, 1
jne 0x51d2c7
mov esi, dword [ebp - 0x34]
mov edi, dword [ebp - 0x2c]
lea eax, [esi + 0x10]
mov ebx, dword [ebp - 0x28]
push edi
push eax
push eax
call ebx
add esp, 0xc
jmp 0x51d2fb
mov ebx, dword [ebp - 0x28]
mov edi, dword [ebp - 0x2c]
mov ecx, dword [ebp - 0x38]
cmp ecx, 0x10
jae 0x51d319
mov eax, 0x10
sub eax, ecx
push eax
lea eax, [ecx + esi]
push 0
push eax
call fcn.006602b0
add esp, 0xc
push edi
lea eax, [ebp - 0x18]
push eax
push esi
call ebx
mov eax, dword [ebp - 0x18]
add esp, 0xc
xor dword [esi + 0x10], eax
mov eax, dword [ebp - 0x14]
xor dword [esi + 0x14], eax
mov eax, dword [ebp - 0x10]
xor dword [esi + 0x18], eax
mov eax, dword [ebp - 0xc]
xor dword [esi + 0x1c], eax
mov al, byte [ebp - 0x19]
mov ecx, dword [ebp - 4]
pop edi
mov byte [esi], al
xor ecx, ebp
pop esi
xor eax, eax
pop ebx
call fcn.0065cc3a
mov esp, ebp
pop ebp
ret