Function at 0x51f089
Capabilities:
Encode data using xor

Disassembly:
push ecx
mov ecx, dword [esp + 0x10]
push ebx
mov ebx, dword [esp + 0xc]
push ebp
mov ebp, dword [esp + 0x1c]
push esi
cmp dword [ebx + 0xe8], 0
push edi
mov dword [esp + 0x10], ecx
je 0x51f0b2
mov eax, dword [ebx + 0x84]
sub eax, ecx
dec eax
jmp 0x51f0b4
mov eax, ecx
mov esi, dword [ebx + 0xcc]
mov edi, esi
mov edx, dword [ebx + 0xd4]
imul edi, eax
mov eax, edx
imul eax, dword [esp + 0x1c]
add edi, eax
add edi, dword [ebx + 0xc8]
cmp dword [ebx + 0xe8], 0
je 0x51f0df
neg esi
cmp dword [ebx + 0xe0], 0
mov dword [esp + 0x18], esi
jne 0x51f491
cmp dword [ebx + 0xe4], 0
jne 0x51f491
mov eax, dword [ebx + 0xd8]
test al, 2
je 0x51f135
test ebp, ebp
je 0x51f4b4
mov al, byte [ebx + 0xf0]
xor byte [edi + 2], al
mov al, byte [ebx + 0xf4]
xor byte [edi + 1], al
mov al, byte [ebx + 0xf8]
xor byte [edi], al
add edi, esi
sub ebp, 1
jne 0x51f10f
jmp 0x51f4b4
test eax, 0x100
je 0x51f173
test ebp, ebp
je 0x51f4b4
mov al, byte [ebx + 0xf0]
mov byte [edi + 2], al
mov al, byte [ebx + 0xf4]
mov byte [edi + 1], al
mov al, byte [ebx + 0xf8]
mov byte [edi], al
mov al, byte [ebx + 0xfc]
mov byte [edi + 3], al
add edi, esi
sub ebp, 1
jne 0x51f144
jmp 0x51f4b4
test al, 8
je 0x51f19d
cmp edx, 4
jne 0x51f4b4
test ebp, ebp
je 0x51f4b4
mov al, byte [ebx + 0xfc]
mov byte [edi + 3], al
add edi, esi
sub ebp, 1
jne 0x51f188
jmp 0x51f4b4
test al, 0x10
je 0x51f340
test ebp, ebp
je 0x51f4b4
cmp edx, 4
jne 0x51f2ec
movzx edx, byte [edi + 3]
lea ecx, [edi + 2]
mov esi, dword [ebx + 0xfc]
mov dword [esp + 0x1c], edx
test esi, esi
jne 0x51f1d0
movzx eax, byte [ecx]
jmp 0x51f215
mov dword [esp + 0x10], ecx
test edx, edx
jne 0x51f1e0
mov eax, dword [ebx + 0xf0]
jmp 0x51f20e
movzx eax, byte [ecx]
mov esi, dword [ebx + 0x100]
imul ecx, dword [ebx + 0xf0], 0xff
imul eax, esi
imul esi, edx
imul eax, edx
add eax, ecx
imul ecx, dword [ebx + 0xfc], 0xff
add esi, ecx
mov ecx, dword [esp + 0x10]
cdq
idiv esi
mov edx, dword [esp + 0x1c]
mov byte [ecx], al
mov ecx, dword [ebx + 0xfc]
test ecx, ecx
jne 0x51f227
movzx eax, byte [edi + 1]
jmp 0x51f264
test edx, edx
jne 0x51f236
mov eax, dword [ebx + 0xf4]
cdq
idiv ecx
jmp 0x51f264
mov esi, dword [ebx + 0x100]
movzx eax, byte [edi + 1]
imul ecx, dword [ebx + 0xf4], 0xff
imul eax, esi
imul esi, edx
imul eax, edx
add eax, ecx
imul ecx, dword [ebx + 0xfc], 0xff
cdq
add esi, ecx
idiv esi
mov byte [edi + 1], al
mov ecx, dword [ebx + 0xfc]
test ecx, ecx
jne 0x51f276
movzx eax, byte [edi]
jmp 0x51f2b6
mov edx, dword [esp + 0x1c]
test edx, edx
jne 0x51f289
mov eax, dword [ebx + 0xf8]
cdq
idiv ecx
jmp 0x51f2b6
mov esi, dword [ebx + 0x100]
movzx eax, byte [edi]
imul ecx, dword [ebx + 0xf8], 0xff
imul eax, esi
imul esi, edx
imul eax, edx
add eax, ecx
imul ecx, dword [ebx + 0xfc], 0xff
cdq
add esi, ecx
idiv esi
mov byte [edi], al
mov eax, dword [ebx + 0x100]
imul eax, dword [esp + 0x1c]
imul ecx, dword [ebx + 0xfc], 0xff
add eax, ecx
mov ecx, 0xff
cdq
idiv ecx
mov byte [edi + 3], al
add edi, dword [esp + 0x18]
sub ebp, 1
jne 0x51f1b6
jmp 0x51f4b4
mov ecx, 0xff
movzx eax, byte [edi + 2]
imul eax, dword [ebx + 0x100]
add eax, dword [ebx + 0xf0]
cdq
idiv ecx
mov byte [edi + 2], al
movzx eax, byte [edi + 1]
imul eax, dword [ebx + 0x100]
add eax, dword [ebx + 0xf4]
cdq
idiv ecx
mov byte [edi + 1], al
movzx eax, byte [edi]
imul eax, dword [ebx + 0x100]
add eax, dword [ebx + 0xf8]
cdq
idiv ecx
mov byte [edi], al
add edi, esi
sub ebp, 1
jne 0x51f2f1
jmp 0x51f4b4
test al, 0x20
je 0x51f46a
cmp edx, 4
jne 0x51f46a
test ebp, ebp
je 0x51f4b4
movzx edx, byte [edi + 3]
lea ecx, [edi + 2]
mov esi, dword [ebx + 0xfc]
mov dword [esp + 0x1c], edx
test esi, esi
jne 0x51f373
movzx eax, byte [ecx]
jmp 0x51f3b8
mov dword [esp + 0x10], ecx
test edx, edx
jne 0x51f383
mov eax, dword [ebx + 0xf0]
jmp 0x51f3b1
movzx eax, byte [ecx]
mov esi, dword [ebx + 0x100]
imul ecx, dword [ebx + 0xf0], 0xff
imul eax, esi
imul esi, edx
imul eax, edx
add eax, ecx
imul ecx, dword [ebx + 0xfc], 0xff
add esi, ecx
mov ecx, dword [esp + 0x10]
cdq
idiv esi
mov edx, dword [esp + 0x1c]
mov byte [ecx], al
mov ecx, dword [ebx + 0xfc]
test ecx, ecx
jne 0x51f3ca
movzx eax, byte [edi + 1]
jmp 0x51f407
test edx, edx
jne 0x51f3d9
mov eax, dword [ebx + 0xf4]
cdq
idiv ecx
jmp 0x51f407
mov esi, dword [ebx + 0x100]
movzx eax, byte [edi + 1]
imul ecx, dword [ebx + 0xf4], 0xff
imul eax, esi
imul esi, edx
imul eax, edx
add eax, ecx
imul ecx, dword [ebx + 0xfc], 0xff
cdq
add esi, ecx
idiv esi
mov byte [edi + 1], al
mov ecx, dword [ebx + 0xfc]
test ecx, ecx
jne 0x51f419
movzx eax, byte [edi]
jmp 0x51f459
mov edx, dword [esp + 0x1c]
test edx, edx
jne 0x51f42c
mov eax, dword [ebx + 0xf8]
cdq
idiv ecx
jmp 0x51f459
mov esi, dword [ebx + 0x100]
movzx eax, byte [edi]
imul ecx, dword [ebx + 0xf8], 0xff
imul eax, esi
imul esi, edx
imul eax, edx
add eax, ecx
imul ecx, dword [ebx + 0xfc], 0xff
cdq
add esi, ecx
idiv esi
mov byte [edi], al
add edi, dword [esp + 0x18]
sub ebp, 1
jne 0x51f359
jmp 0x51f4b4
test ebp, ebp
je 0x51f4b4
mov al, byte [ebx + 0xf0]
mov byte [edi + 2], al
mov al, byte [ebx + 0xf4]
mov byte [edi + 1], al
mov al, byte [ebx + 0xf8]
mov byte [edi], al
add edi, esi
sub ebp, 1
jne 0x51f46e
jmp 0x51f4b4
test ebp, ebp
je 0x51f4b4
push edi
push ecx
push dword [esp + 0x24]
push ebx
call fcn.0051e752
mov ecx, dword [esp + 0x20]
add esp, 0x10
add edi, esi
inc ecx
mov dword [esp + 0x10], ecx
sub ebp, 1
jne 0x51f495
pop edi
pop esi
pop ebp
pop ebx
pop ecx
ret