Function at 0x501780
Capabilities:
Encode data using xor

Disassembly:
mov eax, dword [esp + 0x34]
mov ecx, dword [esp + 0x30]
mov edx, dword [esp + 0x2c]
sub esp, 0x98
push ebp
mov ebp, dword [esp + 0xac]
push edi
mov edi, dword [esp + 0xa8]
push eax
push ecx
mov ecx, dword [esp + 0xd0]
lea eax, [esp + 0x54]
push edx
mov edx, dword [esp + 0xd0]
push eax
push ecx
push edx
push edi
push ebp
call fcn.00547180
add esp, 0x20
test eax, eax
je 0x5017d6
pop edi
mov eax, 1
pop ebp
add esp, 0x98
ret
mov ecx, dword [esp + 0x68]
mov edx, dword [esp + 0x60]
push ebx
mov ebx, dword [edi + 8]
mov edi, dword [ebp + 8]
mov ebp, dword [esp + 0x54]
sub ebp, dword [esp + 0x5c]
sub ecx, edx
mov dword [esp + 0x1c], edi
mov eax, dword [esp + 0x70]
push esi
mov esi, dword [esp + 0x6c]
lea ebp, [ebx + ebp*2]
sub eax, esi
mov dword [esp + 0x2c], ebp
lea ebp, [ecx + ecx]
sub edi, ebp
imul esi, dword [esp + 0x20]
mov dword [esp + 0x28], edi
mov edi, dword [esp + 0x5c]
imul edi, ebx
mov ebp, dword [esp + 0x58]
lea esi, [esi + edx*2]
mov dword [esp + 0x44], ecx
mov dword [esp + 0x34], ebx
lea edi, [edi + ebp*2]
mov ebp, dword [esp + 0xb0]
add edi, dword [ebp + 4]
mov ebp, dword [esp + 0xb8]
add esi, dword [ebp + 4]
cmp byte [esp + 0x54], 0
je 0x501b36
and dl, 1
mov dword [esp + 0x10], ecx
mov byte [esp + 0x1b], dl
je 0x50185d
dec ecx
mov dword [esp + 0x10], ecx
mov ecx, dword [esp + 0x10]
mov ebx, ecx
sar ecx, 3
and ebx, 7
mov dword [esp + 0x10], ecx
mov cl, bl
and cl, 1
sar ebx, 1
test eax, eax
mov byte [esp + 0x1a], cl
mov dword [esp + 0x1c], ebx
jle 0x501c86
mov dword [esp + 0x24], eax
mov al, byte [esp + 0x1b]
test al, al
je 0x5018e8
mov eax, dword [esp + 0xc4]
xor ecx, ecx
mov cx, word [edi]
and eax, 0xf0
mov dx, word [esi]
add esi, 2
shl eax, 0xc
add eax, ecx
mov ax, word [eax*2 + 0x82ee04]
mov ebp, eax
mov ecx, eax
xor ebp, edx
and ecx, edx
and ebp, 0x7bde
lea ecx, [ebp + ecx*2]
shr ecx, 5
and ecx, 0x421
add ecx, 0x3def
xor ecx, 0x3def
sub eax, ecx
add eax, edx
or eax, ecx
add edi, 2
mov word [esi - 2], ax
mov eax, dword [esp + 0x10]
test eax, eax
jle 0x501a53
mov ebp, dword [esp + 0xc8]
mov dword [esp + 0x20], eax
and ebp, 0xf0
shl ebp, 0xc
mov eax, dword [edi]
xor ecx, ecx
mov edx, eax
and eax, 0xffff
shr edx, 0x10
add edx, ebp
add eax, ebp
mov cx, word [edx*2 + 0x82ee04]
xor edx, edx
mov dx, word [eax*2 + 0x82ee04]
lea eax, [esp + 0x14]
shl ecx, 0x10
add ecx, edx
push eax
mov dword [esp + 0x18], ecx
mov ecx, esi
call fcn.00501ca0
mov ecx, dword [edi + 4]
xor ebx, ebx
mov eax, ecx
and ecx, 0xffff
shr eax, 0x10
add eax, ebp
mov edx, dword [esi + 4]
add ecx, ebp
mov bx, word [eax*2 + 0x82ee04]
mov eax, ebx
xor ebx, ebx
mov bx, word [ecx*2 + 0x82ee04]
shl eax, 0x10
add eax, ebx
mov ecx, eax
mov ebx, eax
xor ecx, edx
and ebx, edx
and ecx, 0x7bde7bde
lea ecx, [ecx + ebx*2]
shr ecx, 5
and ecx, 0x4210421
add ecx, 0x3def3def
xor ecx, 0x3def3def
sub eax, ecx
add eax, edx
or eax, ecx
xor ecx, ecx
mov dword [esi + 4], eax
mov eax, dword [edi + 8]
mov edx, eax
and eax, 0xffff
shr edx, 0x10
add edx, ebp
add eax, ebp
mov cx, word [edx*2 + 0x82ee04]
xor edx, edx
mov dx, word [eax*2 + 0x82ee04]
lea eax, [esp + 0x14]
shl ecx, 0x10
add ecx, edx
push eax
mov dword [esp + 0x18], ecx
lea ecx, [esi + 8]
call fcn.00501ca0
mov ecx, dword [edi + 0xc]
xor ebx, ebx
mov eax, ecx
and ecx, 0xffff
shr eax, 0x10
add eax, ebp
mov edx, dword [esi + 0xc]
add ecx, ebp
mov bx, word [eax*2 + 0x82ee04]
mov eax, ebx
xor ebx, ebx
mov bx, word [ecx*2 + 0x82ee04]
shl eax, 0x10
add eax, ebx
mov ecx, eax
mov ebx, eax
xor ecx, edx
and ecx, 0x7bde7bde
and ebx, edx
lea ecx, [ecx + ebx*2]
add esi, 0x10
shr ecx, 5
and ecx, 0x4210421
add edi, 0x10
add ecx, 0x3def3def
xor ecx, 0x3def3def
sub eax, ecx
add eax, edx
or eax, ecx
mov dword [esi - 4], eax
mov eax, dword [esp + 0x20]
dec eax
mov dword [esp + 0x20], eax
jne 0x501908
mov ebx, dword [esp + 0x1c]
test ebx, ebx
jle 0x501aad
mov ebp, dword [esp + 0xc8]
and ebp, 0xf0
shl ebp, 0xc
mov eax, dword [edi]
xor ecx, ecx
mov edx, eax
and eax, 0xffff
shr edx, 0x10
add edx, ebp
add eax, ebp
mov cx, word [edx*2 + 0x82ee04]
xor edx, edx
mov dx, word [eax*2 + 0x82ee04]
lea eax, [esp + 0x14]
shl ecx, 0x10
add ecx, edx
push eax
mov dword [esp + 0x18], ecx
mov ecx, esi
call fcn.00501ca0
add esi, 4
add edi, 4
dec ebx
jne 0x501a67
mov ebx, dword [esp + 0x1c]
mov al, byte [esp + 0x1a]
test al, al
je 0x501b0e
mov ecx, dword [esp + 0xc4]
xor eax, eax
mov ax, word [edi]
and ecx, 0xf0
mov dx, word [esi]
add esi, 2
shl ecx, 0xc
add ecx, eax
mov ax, word [ecx*2 + 0x82ee04]
mov ebp, eax
mov ecx, eax
xor ebp, edx
and ecx, edx
and ebp, 0x7bde
lea ecx, [ebp + ecx*2]
shr ecx, 5
and ecx, 0x421
add ecx, 0x3def
xor ecx, 0x3def
sub eax, ecx
add eax, edx
or eax, ecx
add edi, 2
mov word [esi - 2], ax
mov edx, dword [esp + 0x28]
mov ecx, dword [esp + 0x2c]
mov eax, dword [esp + 0x24]
add esi, edx
add edi, ecx
dec eax
mov dword [esp + 0x24], eax
jne 0x501888
pop esi
pop ebx
pop edi
xor eax, eax
pop ebp
add esp, 0x98
ret
mov edx, dword [esp + 0x94]
mov ebp, dword [esp + 0x88]
add edx, edx
mov dword [esp + 0x30], ebp
mov ebp, dword [esp + 0x8c]
mov dword [esp + 0x50], edx
mov edx, ebx
mov dword [esp + 0x48], ebp
imul edx, dword [esp + 0xa4]
mov ebp, dword [esp + 0x9c]
mov dword [esp + 0x3c], edx
mov dword [esp + 0x2c], ebp
mov ebp, dword [esp + 0x90]
mov dword [esp + 0x40], ebp
mov ebp, dword [esp + 0xa0]
mov dword [esp + 0x28], ebp
mov ebp, dword [esp + 0x98]
test eax, eax
jle 0x501c86
mov dword [esp + 0x14], eax
jmp 0x501ba1
mov ebp, dword [esp + 0x24]
add ebp, dword [esp + 0x2c]
mov dword [esp + 0x24], ebp
js 0x501bb7
mov eax, dword [esp + 0x28]
add edi, ebx
sub ebp, eax
mov dword [esp + 0x24], ebp
mov eax, dword [esp + 0x30]
mov dword [esp + 0x4c], edi
test ecx, ecx
mov dword [esp + 0x10], eax
jle 0x501c6a
mov eax, dword [esp + 0xc4]
mov ebx, esi
and eax, 0xf0
mov dword [esp + 0x1c], ecx
shl eax, 0xc
mov dword [esp + 0x38], eax
jmp 0x501bea
mov eax, dword [esp + 0x38]
mov ecx, dword [esp + 0x10]
mov edx, dword [esp + 0x48]
add ecx, edx
mov dword [esp + 0x10], ecx
js 0x501c07
mov edx, dword [esp + 0x40]
add edi, 2
sub ecx, edx
mov dword [esp + 0x10], ecx
xor ecx, ecx
mov dx, word [ebx]
mov cx, word [edi]
add ebx, 2
add ecx, eax
mov ax, word [ecx*2 + 0x82ee04]
mov ebp, eax
mov ecx, eax
xor ebp, edx
and ecx, edx
and ebp, 0x7bde
lea ecx, [ebp + ecx*2]
shr ecx, 5
and ecx, 0x421
add ecx, 0x3def
xor ecx, 0x3def
sub eax, ecx
add eax, edx
mov edx, dword [esp + 0x50]
or eax, ecx
add edi, edx
mov word [ebx - 2], ax
mov eax, dword [esp + 0x1c]
dec eax
mov dword [esp + 0x1c], eax
jne 0x501be6
mov ebx, dword [esp + 0x34]
mov edx, dword [esp + 0x3c]
mov ecx, dword [esp + 0x44]
mov eax, dword [esp + 0x4c]
mov ebp, dword [esp + 0x20]
add esi, ebp
lea edi, [eax + edx]
mov eax, dword [esp + 0x14]
dec eax
mov dword [esp + 0x14], eax
jne 0x501b9d
pop esi
pop ebx
pop edi
xor eax, eax
pop ebp
add esp, 0x98
ret