Function at 0x4707a0
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0x18
mov eax, dword [esp + 0x20]
push ebx
push ebp
push esi
push edi
mov edi, ecx
xor ecx, ecx
cmp eax, ecx
je 0x4709f7
test al, 7
jne 0x4709f7
mov dword [esp + 0x10], ecx
mov dword [esp + 0x14], ecx
mov ecx, dword [esp + 0x34]
cmp ecx, 1
jne 0x4708c0
mov ecx, dword [edi + 0xc]
mov ebx, dword [edi + 8]
cmp eax, 8
mov dword [esp + 0x24], ecx
jb 0x4708b6
mov ebp, dword [esp + 0x2c]
shr eax, 3
lea esi, [ebp + 7]
mov dword [esp + 0x2c], eax
xor eax, eax
xor ecx, ecx
mov al, byte [ebp]
mov cl, byte [esi - 6]
shl eax, 0x18
shl ecx, 0x10
or eax, ecx
xor ecx, ecx
mov cl, byte [esi - 5]
xor edx, edx
shl ecx, 8
or eax, ecx
mov dl, byte [esi - 2]
xor ecx, ecx
mov cl, byte [esi - 4]
or eax, ecx
xor ecx, ecx
mov cl, byte [esi - 3]
mov dword [esp + 0x10], eax
shl ecx, 0x18
shl edx, 0x10
or ecx, edx
xor edx, edx
mov dh, byte [esi - 1]
mov dword [esp + 0x18], eax
or ecx, edx
xor edx, edx
mov dl, byte [esi]
lea eax, [esp + 0x10]
or ecx, edx
push eax
mov dword [esp + 0x18], ecx
mov dword [esp + 0x20], ecx
mov ecx, edi
call fcn.00470130
mov eax, dword [esp + 0x10]
mov ecx, dword [esp + 0x14]
mov edx, dword [esp + 0x1c]
xor eax, ebx
mov ebx, dword [esp + 0x24]
mov dword [esp + 0x24], edx
xor ecx, ebx
add esi, 8
mov edx, ecx
mov ebx, dword [esp + 0x18]
shr edx, 8
mov byte [esi - 8], cl
mov byte [esi - 9], dl
mov edx, ecx
add ebp, 8
shr edx, 0x10
shr ecx, 0x18
mov byte [esi - 0xa], dl
mov byte [esi - 0xb], cl
mov ecx, eax
mov edx, eax
shr ecx, 8
mov byte [esi - 0xc], al
mov byte [esi - 0xd], cl
shr edx, 0x10
shr eax, 0x18
mov byte [esi - 0xe], dl
mov byte [esi - 0xf], al
mov eax, dword [esp + 0x2c]
dec eax
mov dword [esp + 0x2c], eax
jne 0x4707f5
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x18
ret 0xc
cmp ecx, 2
jne 0x4709ad
mov ecx, dword [edi + 8]
mov edx, dword [edi + 0xc]
cmp eax, 8
mov dword [esp + 0x18], ecx
mov dword [esp + 0x1c], edx
jb 0x4708b6
mov ebp, dword [esp + 0x2c]
shr eax, 3
lea esi, [ebp + 7]
mov dword [esp + 0x2c], eax
xor eax, eax
xor ecx, ecx
mov al, byte [ebp]
mov cl, byte [esi - 6]
shl eax, 0x18
shl ecx, 0x10
or eax, ecx
xor ecx, ecx
mov cl, byte [esi - 5]
xor edx, edx
shl ecx, 8
or eax, ecx
xor ecx, ecx
mov cl, byte [esi - 4]
mov dl, byte [esi]
or eax, ecx
xor ecx, ecx
mov cl, byte [esi - 2]
mov dword [esp + 0x10], eax
xor eax, eax
mov al, byte [esi - 3]
shl eax, 0x18
shl ecx, 0x10
or eax, ecx
xor ecx, ecx
mov ch, byte [esi - 1]
or eax, ecx
mov ecx, edi
or eax, edx
mov dword [esp + 0x14], eax
lea eax, [esp + 0x18]
push eax
call fcn.0046fde0
mov ecx, dword [esp + 0x14]
mov eax, dword [esp + 0x10]
mov ebx, ecx
xor ecx, dword [esp + 0x1c]
mov edx, eax
xor eax, dword [esp + 0x18]
mov dword [esp + 0x18], edx
add esi, 8
mov edx, ecx
add ebp, 8
shr edx, 8
mov byte [esi - 8], cl
mov byte [esi - 9], dl
mov edx, ecx
mov dword [esp + 0x1c], ebx
shr edx, 0x10
shr ecx, 0x18
mov byte [esi - 0xa], dl
mov byte [esi - 0xb], cl
mov ecx, eax
mov edx, eax
shr ecx, 8
mov byte [esi - 0xc], al
mov byte [esi - 0xd], cl
shr edx, 0x10
shr eax, 0x18
mov byte [esi - 0xe], dl
mov byte [esi - 0xf], al
mov eax, dword [esp + 0x2c]
dec eax
mov dword [esp + 0x2c], eax
jne 0x4708ea
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x18
ret 0xc
cmp eax, 8
jb 0x4708b6
mov esi, dword [esp + 0x2c]
shr eax, 3
mov ebx, eax
lea eax, [esp + 0x10]
push eax
push esi
call fcn.004706d0
add esp, 8
lea ecx, [esp + 0x10]
push ecx
mov ecx, edi
call fcn.00470130
add esi, 8
lea edx, [esp + 0x10]
push esi
push edx
call fcn.00470750
add esp, 8
dec ebx
jne 0x4709bf
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x18
ret 0xc
lea eax, [esp + 0x2c]
push 0x50b878
push eax
mov dword [esp + 0x34], str.Incorrect_buffer_length
call sub.MSVCRT.dll__CxxThrowException
nop
nop