Function at 0x51f9d8
Capabilities:
Encode data using xor

Disassembly:
push ebx
push esi
push edi
push ebp
add esp, 0xffffffb8
mov edi, edx
mov ebx, eax
mov bp, word [ebx + 0x22]
mov ax, word [ebx + 0x20]
mov word [esp], ax
push 0x40
push 0
lea ecx, [esp + 0xe]
lea eax, [ebx + 0x20]
mov edx, 0x1f
call fcn.0051f840
mov al, byte [esp + 0xa]
mov word [esp + 2], 0x26
xor esi, esi
movzx edx, si
add edx, 0x26
mov byte [esp + edx + 6], al
xor al, 0xa7
sub al, 0x35
inc word [esp + 2]
inc esi
cmp si, 7
jne 0x51fa11
add eax, 0xa7
mov byte [esp + 0x33], al
push 0x40
push 1
lea ecx, [esp + 0xe]
lea eax, [ebx + 0x20]
mov edx, 0x1f
call fcn.0051f840
call fcn.0051f8b4
mov ecx, edi
mov dx, word [esp]
mov ax, 7
call fcn.0051f820
mov eax, ebp
call fcn.0051f7d8
push ebx
push edi
lea eax, [esp + 0xa]
push eax
lea edx, [esp + 0x12]
mov ecx, 0x40
mov ax, 0x10
call fcn.0051f8bc
mov eax, ebp
call fcn.0051f7d8
or word [ebx + 0x3e], 0xf
push 0x40
push 0
lea ecx, [esp + 0xe]
lea eax, [ebx + 0x20]
mov edx, 0x1f
call fcn.0051f840
push ebx
push edi
lea eax, [esp + 0xa]
push eax
lea edx, [esp + 0x12]
mov ecx, 0x40
mov ax, 8
call fcn.0051f8bc
cmp ax, 0x96
jne 0x51fad7
xor word [ebx + 0x3e], 5
push 0x40
push 0
lea ecx, [esp + 0xe]
lea eax, [ebx + 0x20]
mov edx, 0x1f
call fcn.0051f840
mov eax, ebp
call fcn.0051f7d8
push ebx
push edi
lea eax, [esp + 0xa]
push eax
lea edx, [esp + 0x12]
mov ecx, 0x40
mov ax, 8
call fcn.0051f8bc
and ax, 3
mov word [ebx + 0x28], ax
push 0x40
push 0
lea ecx, [esp + 0xe]
lea eax, [ebx + 0x20]
mov edx, 0x1f
call fcn.0051f840
mov ax, word [ebx + 0x3e]
and ax, 0xf
cmp ax, 0xa
je 0x51fb48
mov word [ebx + 0x2a], 0x80
mov ecx, edi
mov dx, word [esp]
mov ax, 0xb
call fcn.0051f820
mov eax, ebp
call fcn.0051f7d8
call fcn.0051f8b8
jmp 0x51fe41
mov edx, ebx
mov ecx, edi
mov ax, 0x28
call fcn.0051f968
test ax, ax
jne 0x51fb80
mov word [ebx + 0x2a], 0x81
mov ecx, edi
mov dx, word [esp]
mov ax, 0xb
call fcn.0051f820
mov eax, ebp
call fcn.0051f7d8
call fcn.0051f8b8
jmp 0x51fe41
or word [ebx + 0x34], 0xf
push 0x40
push 0
lea ecx, [esp + 0xe]
lea eax, [ebx + 0x20]
mov edx, 0x1f
call fcn.0051f840
push ebx
push edi
lea eax, [esp + 0xa]
push eax
lea edx, [esp + 0x12]
mov ecx, 0x40
mov ax, 8
call fcn.0051f8bc
cmp ax, 0x96
jne 0x51fbd3
xor word [ebx + 0x34], 5
push 0x40
push 0
lea ecx, [esp + 0xe]
lea eax, [ebx + 0x20]
mov edx, 0x1f
call fcn.0051f840
mov eax, ebp
call fcn.0051f7d8
push ebx
push edi
lea eax, [esp + 0xa]
push eax
lea edx, [esp + 0x12]
mov ecx, 0x40
mov ax, 8
call fcn.0051f8bc
mov esi, eax
test byte [ebx + 0x26], 1
je 0x51fc18
mov eax, esi
mov byte [esp + 0x1b], al
push 0x40
push 1
lea ecx, [esp + 0xe]
lea eax, [ebx + 0x20]
mov edx, 0x1f
call fcn.0051f840
jmp 0x51fc39
cmp si, 0x96
je 0x51fc39
or word [ebx + 0x34], 0xf
push 0x40
push 0
lea ecx, [esp + 0xe]
lea eax, [ebx + 0x20]
mov edx, 0x1f
call fcn.0051f840
mov eax, ebp
call fcn.0051f7d8
push ebx
push edi
lea eax, [esp + 0xa]
push eax
lea edx, [esp + 0x12]
mov ecx, 0x40
mov ax, 4
call fcn.0051f8bc
and ax, 0xe
add eax, eax
or word [ebx + 0x28], ax
push 0x40
push 0
lea ecx, [esp + 0xe]
lea eax, [ebx + 0x20]
mov edx, 0x1f
call fcn.0051f840
mov ax, word [ebx + 0x34]
and ax, 0xf
cmp ax, 0xa
je 0x51fcac
mov word [ebx + 0x2a], 0x82
mov ecx, edi
mov dx, word [esp]
mov ax, 0xb
call fcn.0051f820
mov eax, ebp
call fcn.0051f7d8
call fcn.0051f8b8
jmp 0x51fe41
mov ax, word [ebx + 0x26]
test al, 2
jne 0x51fce7
mov edx, ebx
mov ecx, edi
mov ax, 0x28
call fcn.0051f968
mov word [ebx + 0x2a], 0
mov ecx, edi
mov dx, word [esp]
mov ax, 0xb
call fcn.0051f820
mov eax, ebp
call fcn.0051f7d8
call fcn.0051f8b8
jmp 0x51fe41
test al, 1
je 0x51fcf1
mov si, 0x190
jmp 0x51fcf5
mov si, 0x640
mov edx, ebx
mov ecx, edi
mov eax, esi
call fcn.0051f968
test ax, ax
jne 0x51fd2b
mov word [ebx + 0x2a], 0x83
mov ecx, edi
mov dx, word [esp]
mov ax, 0xb
call fcn.0051f820
mov eax, ebp
call fcn.0051f7d8
call fcn.0051f8b8
jmp 0x51fe41
push ebx
push edi
lea eax, [esp + 0xa]
push eax
lea edx, [esp + 0x12]
mov ecx, 0x40
mov ax, 8
call fcn.0051f8bc
xor ax, 0x40
mov word [ebx + 0x2a], ax
push 0x40
push 0
lea ecx, [esp + 0xe]
lea eax, [ebx + 0x20]
mov edx, 0x1f
call fcn.0051f840
test byte [ebx + 0x2a], 0xc0
je 0x51fd8d
mov word [ebx + 0x2a], 0x84
mov ecx, edi
mov dx, word [esp]
mov ax, 0xb
call fcn.0051f820
mov eax, ebp
call fcn.0051f7d8
call fcn.0051f8b8
jmp 0x51fe41
test byte [ebx + 0x2a], 4
je 0x51fdf3
add word [esp + 2], 0x16
mov ax, word [ebx + 0x2a]
and ax, 3
test ax, ax
jb 0x51fdf3
inc eax
mov word [esp + 4], ax
xor esi, esi
push ebx
push edi
lea eax, [esp + 0xa]
push eax
lea edx, [esp + 0x12]
mov ecx, 0x40
mov ax, 0x10
call fcn.0051f8bc
movzx edx, si
mov ecx, 9
sub ecx, edx
mov word [ebx + ecx*2 + 0x20], ax
push 0x40
push 0
lea ecx, [esp + 0xe]
lea eax, [ebx + 0x20]
mov edx, 0x1f
call fcn.0051f840
inc esi
dec word [esp + 4]
jne 0x51fdae
test byte [ebx + 0x26], 1
je 0x51fe41
test byte [ebx + 0x2a], 8
je 0x51fe41
mov ecx, edi
mov dx, word [esp]
mov ax, 0xff
call fcn.0051f820
mov edx, ebx
mov ecx, edi
mov ax, 0x190
call fcn.0051f968
test ax, ax
jne 0x51fe41
mov word [ebx + 0x2a], 0x85
mov ecx, edi
mov dx, word [esp]
mov ax, 0xb
call fcn.0051f820
mov eax, ebp
call fcn.0051f7d8
call fcn.0051f8b8
add esp, 0x48
pop ebp
pop edi
pop esi
pop ebx
ret