Function at 0x51aa50
Capabilities:
Encode data using xor

Disassembly:
push ecx
push ebx
push ebp
push esi
mov esi, dword [esp + 0x14]
push edi
mov edx, 7
mov bp, word [esi + 0x20]
mov bx, word [esi + 0x22]
mov al, byte [esi + 0x24]
lea ecx, [esi + 0x46]
mov dword [esp + 0x10], ebp
mov dword [esp + 0x18], ecx
mov byte [ecx], al
mov ecx, dword [esp + 0x18]
xor al, 0xa7
sub al, 0x35
inc ecx
dec edx
mov dword [esp + 0x18], ecx
jne 0x51aa74
sub al, 0x59
mov byte [ecx], al
call fcn.0051b030
mov edi, dword [esp + 0x1c]
push edi
push ebp
push 7
call fcn.0051b010
push ebx
call fcn.0051adf0
push edi
lea eax, [esp + 0x2c]
push esi
push eax
push 0x10
call fcn.0051ad40
push ebx
call fcn.0051adf0
push edi
lea ecx, [esp + 0x40]
push esi
mov ebp, 0xf
or word [esi + 0x3e], bp
push ecx
push 8
call fcn.0051ad40
add esp, 0x34
cmp ax, 0x96
jne 0x51aadb
xor word [esi + 0x3e], 5
push ebx
call fcn.0051adf0
push edi
lea edx, [esp + 0x20]
push esi
push edx
push 8
call fcn.0051ad40
and eax, 3
add esp, 0x14
mov word [esi + 0x28], ax
mov al, byte [esi + 0x3e]
and al, 0xf
cmp al, 0xa
je 0x51ab0d
mov word [esi + 0x2a], 0x80
jmp 0x51acb2
push edi
push esi
push 0x28
call fcn.0051ace0
add esp, 0xc
test ax, ax
jne 0x51ab29
mov word [esi + 0x2a], 0x81
jmp 0x51acb2
or word [esi + 0x34], bp
push edi
lea ecx, [esp + 0x1c]
push esi
push ecx
push 8
call fcn.0051ad40
add esp, 0x10
cmp ax, 0x96
jne 0x51ab49
xor word [esi + 0x34], 5
push ebx
call fcn.0051adf0
push edi
lea edx, [esp + 0x20]
push esi
push edx
push 8
call fcn.0051ad40
mov cl, byte [esi + 0x26]
add esp, 0x14
test cl, 1
je 0x51ab6d
mov byte [esi + 0x35], al
jmp 0x51ab77
cmp ax, 0x96
je 0x51ab77
or word [esi + 0x34], bp
push ebx
call fcn.0051adf0
push edi
lea eax, [esp + 0x20]
push esi
push eax
push 4
call fcn.0051ad40
mov cl, byte [esi + 0x34]
and eax, 0xe
shl eax, 1
or word [esi + 0x28], ax
and cl, 0xf
add esp, 0x14
cmp cl, 0xa
je 0x51abad
mov word [esi + 0x2a], 0x82
jmp 0x51acb2
mov ax, word [esi + 0x26]
test al, 2
jne 0x51abcc
push edi
push esi
push 0x28
call fcn.0051ace0
add esp, 0xc
mov word [esi + 0x2a], 0
jmp 0x51acb2
and al, 1
push edi
neg al
sbb eax, eax
push esi
and eax, 0xfffffb50
add eax, 0x640
push eax
call fcn.0051ace0
add esp, 0xc
test ax, ax
jne 0x51abf7
mov word [esi + 0x2a], 0x83
jmp 0x51acb2
push edi
lea edx, [esp + 0x1c]
push esi
push edx
push 8
call fcn.0051ad40
xor eax, 0x40
add esp, 0x10
test al, 0xc0
mov word [esi + 0x2a], ax
je 0x51ac1e
mov word [esi + 0x2a], 0x84
jmp 0x51acb2
test al, 4
je 0x51ac5f
mov eax, dword [esp + 0x18]
add eax, 0x16
xor ebp, ebp
mov dword [esp + 0x18], eax
push edi
lea eax, [esp + 0x1c]
push esi
push eax
push 0x10
call fcn.0051ad40
mov ecx, ebp
mov edx, 0x19
and ecx, 0xffff
add esp, 0x10
sub edx, ecx
inc ebp
mov word [esi + edx*2], ax
mov al, byte [esi + 0x2a]
and eax, 3
cmp bp, ax
jbe 0x51ac2f
test byte [esi + 0x26], 1
je 0x51acb2
test byte [esi + 0x2a], 8
je 0x51acb2
mov ecx, dword [esp + 0x10]
push edi
push ecx
push 0xff
call fcn.0051b010
push edi
push esi
push 0x190
call fcn.0051ace0
add esp, 0x18
test ax, ax
jne 0x51ac97
mov word [esi + 0x2a], 0x85
jmp 0x51acb2
push edi
lea edx, [esp + 0x1c]
push esi
push edx
push 1
call fcn.0051ad40
and eax, 1
add esp, 0x10
shl eax, 6
or word [esi + 0x2a], ax
mov eax, dword [esp + 0x10]
push edi
push eax
push 0xb
call fcn.0051b010
push ebx
call fcn.0051adf0
add esp, 0x10
call fcn.0051b040
pop edi
pop esi
pop ebp
pop ebx
pop ecx
ret