Function at 0x40d367
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0x54
push ebp
push edi
mov edi, dword [esp + 0x64]
mov ebp, ecx
mov dword [esp + 0x1c], ebp
test edi, edi
je 0x40d821
shr edi, 4
cmp byte [ebp], 0
mov dword [esp + 0x64], edi
je 0x40d39e
push dword [esp + 0x68]
push edi
push dword [esp + 0x68]
call fcn.0040d829
jmp 0x40d821
lea eax, [ebp + 8]
push 0x10
push eax
mov dword [esp + 0x30], eax
lea eax, [esp + 0x54]
push eax
call fcn.0041dd50
add esp, 0xc
test edi, edi
je 0x40d80e
mov edx, dword [esp + 0x60]
push ebx
push esi
lea eax, [edx + 8]
mov dword [esp + 0x1c], eax
mov eax, dword [esp + 0x70]
sub edx, eax
mov dword [esp + 0x2c], edx
lea ecx, [eax + 8]
mov dword [esp + 0x20], ecx
mov esi, dword [ebp + 4]
add edx, 0xfffffff8
mov eax, esi
add ecx, edx
shl eax, 4
add eax, 0x18
mov dword [esp + 0x28], ecx
add eax, ebp
push eax
push ecx
lea eax, [esp + 0x4c]
push eax
call fcn.0040d335
mov edx, dword [esp + 0x44]
movzx ecx, byte [esp + 0x4b]
movzx eax, dl
mov ebx, dword [eax*4 + 0x43fe58]
xor ebx, dword [ecx*4 + 0x440a58]
movzx eax, byte [esp + 0x4e]
xor ebx, dword [eax*4 + 0x440658]
mov dword [esp + 0x68], ebx
mov ebx, dword [esp + 0x50]
mov ecx, dword [esp + 0x68]
movzx eax, bh
xor ecx, dword [eax*4 + 0x440258]
mov dword [esp + 0x68], ecx
mov dword [esp + 0x34], ecx
movzx ecx, dh
mov edx, dword [esp + 0x48]
movzx eax, dl
mov ecx, dword [ecx*4 + 0x440258]
xor ecx, dword [eax*4 + 0x43fe58]
movzx eax, byte [esp + 0x4f]
xor ecx, dword [eax*4 + 0x440a58]
movzx eax, byte [esp + 0x52]
xor ecx, dword [eax*4 + 0x440658]
movzx eax, byte [esp + 0x46]
mov dword [esp + 0x70], ecx
mov dword [esp + 0x38], ecx
movzx ecx, dh
mov eax, dword [eax*4 + 0x440658]
mov edx, dword [esp + 0x4c]
xor eax, dword [ecx*4 + 0x440258]
mov dword [esp + 0x10], eax
mov ecx, dword [esp + 0x10]
movzx eax, dl
xor ecx, dword [eax*4 + 0x43fe58]
movzx eax, byte [esp + 0x53]
xor ecx, dword [eax*4 + 0x440a58]
movzx eax, byte [esp + 0x47]
mov dword [esp + 0x10], ecx
mov dword [esp + 0x3c], ecx
movzx ecx, byte [esp + 0x4a]
mov eax, dword [eax*4 + 0x440a58]
xor eax, dword [ecx*4 + 0x440658]
mov dword [esp + 0x14], eax
mov ecx, dword [esp + 0x14]
movzx eax, dh
xor ecx, dword [eax*4 + 0x440258]
movzx eax, bl
xor ecx, dword [eax*4 + 0x43fe58]
dec esi
mov dword [esp + 0x14], ecx
mov dword [esp + 0x40], ecx
cmp esi, 1
jle 0x40d650
mov edi, dword [esp + 0x68]
lea eax, [esi + 2]
shl eax, 4
add eax, ebp
dec esi
mov dword [esp + 0x14], eax
mov ebp, eax
mov dword [esp + 0x18], esi
mov eax, dword [ebp - 8]
xor eax, edi
mov edx, dword [ebp]
mov dword [esp + 0x68], eax
lea ebp, [ebp - 0x10]
mov eax, dword [ebp + 0x14]
xor eax, ecx
xor edx, dword [esp + 0x10]
mov dword [esp + 0x14], eax
shr eax, 8
movzx ecx, al
mov eax, edx
mov ebx, dword [ebp + 0xc]
xor ebx, dword [esp + 0x70]
shr eax, 0x10
mov edi, dword [ecx*4 + 0x440258]
mov ecx, edx
movzx eax, al
shr ecx, 0x18
xor edi, dword [eax*4 + 0x440658]
mov eax, ebx
shr eax, 0x18
xor edi, dword [eax*4 + 0x440a58]
mov eax, dword [esp + 0x68]
movzx eax, al
xor edi, dword [eax*4 + 0x43fe58]
mov eax, dword [esp + 0x14]
shr eax, 0x10
movzx eax, al
mov dword [esp + 0x34], edi
mov eax, dword [eax*4 + 0x440658]
xor eax, dword [ecx*4 + 0x440a58]
mov dword [esp + 0x70], eax
mov eax, dword [esp + 0x68]
mov ecx, dword [esp + 0x70]
shr eax, 8
movzx eax, al
xor ecx, dword [eax*4 + 0x440258]
movzx eax, bl
xor ecx, dword [eax*4 + 0x43fe58]
mov eax, ebx
mov dword [esp + 0x70], ecx
mov dword [esp + 0x38], ecx
mov ecx, dword [esp + 0x14]
shr eax, 8
shr ecx, 0x18
movzx eax, al
shr ebx, 0x10
mov ecx, dword [ecx*4 + 0x440a58]
xor ecx, dword [eax*4 + 0x440258]
mov eax, dword [esp + 0x68]
shr eax, 0x10
movzx eax, al
xor ecx, dword [eax*4 + 0x440658]
movzx eax, dl
shr edx, 8
xor ecx, dword [eax*4 + 0x43fe58]
mov dword [esp + 0x10], ecx
mov dword [esp + 0x3c], ecx
movzx ecx, dl
movzx eax, bl
mov ecx, dword [ecx*4 + 0x440258]
xor ecx, dword [eax*4 + 0x440658]
mov eax, dword [esp + 0x68]
shr eax, 0x18
xor ecx, dword [eax*4 + 0x440a58]
mov eax, dword [esp + 0x14]
movzx eax, al
xor ecx, dword [eax*4 + 0x43fe58]
sub dword [esp + 0x18], 1
mov dword [esp + 0x40], ecx
jne 0x40d516
mov ebp, dword [esp + 0x24]
mov dword [esp + 0x68], edi
mov edi, dword [esp + 0x6c]
mov dword [esp + 0x14], ecx
mov eax, dword [ebp + 0x28]
xor eax, dword [esp + 0x68]
mov dword [esp + 0x6c], eax
mov dword [esp + 0x44], eax
movzx eax, al
mov ecx, dword [ebp + 0x34]
xor ecx, dword [esp + 0x14]
mov edx, dword [ebp + 0x30]
mov al, byte [eax + 0x43ed38]
mov byte [esp + 0x34], al
mov eax, ecx
shr eax, 8
movzx eax, al
xor edx, dword [esp + 0x10]
mov ebx, dword [ebp + 0x2c]
xor ebx, dword [esp + 0x70]
mov al, byte [eax + 0x43ed38]
mov byte [esp + 0x35], al
mov eax, edx
shr eax, 0x10
movzx eax, al
mov esi, dword [esp + 0x6c]
mov dword [esp + 0x4c], edx
mov dword [esp + 0x48], ebx
mov al, byte [eax + 0x43ed38]
mov byte [esp + 0x36], al
mov eax, ebx
shr eax, 0x18
mov dword [esp + 0x50], ecx
mov al, byte [eax + 0x43ed38]
mov byte [esp + 0x37], al
movzx eax, bl
mov al, byte [eax + 0x43ed38]
mov byte [esp + 0x38], al
mov eax, esi
shr eax, 8
movzx eax, al
mov al, byte [eax + 0x43ed38]
mov byte [esp + 0x39], al
mov eax, ecx
shr eax, 0x10
movzx eax, al
mov al, byte [eax + 0x43ed38]
mov byte [esp + 0x3a], al
mov eax, edx
shr eax, 0x18
mov al, byte [eax + 0x43ed38]
mov byte [esp + 0x3b], al
movzx eax, dl
shr edx, 8
mov al, byte [eax + 0x43ed38]
mov byte [esp + 0x3c], al
mov eax, ebx
shr eax, 8
movzx eax, al
shr ebx, 0x10
mov al, byte [eax + 0x43ed38]
mov byte [esp + 0x3d], al
mov eax, esi
shr eax, 0x10
movzx eax, al
shr esi, 0x18
mov al, byte [eax + 0x43ed38]
mov byte [esp + 0x3e], al
mov eax, ecx
shr eax, 0x18
mov al, byte [eax + 0x43ed38]
mov byte [esp + 0x3f], al
movzx eax, cl
mov al, byte [eax + 0x43ed38]
mov byte [esp + 0x40], al
movzx eax, dl
mov edx, dword [esp + 0x34]
xor edx, dword [ebp + 0x18]
mov al, byte [eax + 0x43ed38]
mov byte [esp + 0x41], al
movzx eax, bl
mov al, byte [eax + 0x43ed38]
mov byte [esp + 0x42], al
mov al, byte [esi + 0x43ed38]
mov byte [esp + 0x43], al
mov esi, dword [esp + 0x38]
mov ebx, dword [esp + 0x3c]
mov eax, dword [esp + 0x40]
xor eax, dword [ebp + 0x24]
xor esi, dword [ebp + 0x1c]
xor ebx, dword [ebp + 0x20]
cmp byte [ebp + 1], 0
mov dword [esp + 0x6c], eax
je 0x40d7b8
xor edx, dword [esp + 0x54]
xor esi, dword [esp + 0x58]
xor ebx, dword [esp + 0x5c]
xor eax, dword [esp + 0x60]
mov dword [esp + 0x6c], eax
mov eax, dword [esp + 0x28]
mov eax, dword [eax]
mov dword [esp + 0x54], eax
mov eax, dword [esp + 0x1c]
mov ecx, dword [eax - 4]
mov dword [esp + 0x58], ecx
mov ecx, dword [eax]
mov dword [esp + 0x5c], ecx
mov ecx, dword [eax + 4]
add eax, 0x10
mov dword [esp + 0x60], ecx
mov ecx, dword [esp + 0x20]
mov dword [esp + 0x1c], eax
mov dword [ecx - 8], edx
mov edx, dword [esp + 0x6c]
mov dword [ecx + 4], edx
mov edx, dword [esp + 0x2c]
mov dword [ecx - 4], esi
mov dword [ecx], ebx
add ecx, 0x10
sub edi, 1
mov dword [esp + 0x20], ecx
mov dword [esp + 0x6c], edi
jne 0x40d3db
pop esi
pop ebx
push 0x10
lea eax, [esp + 0x50]
push eax
push dword [esp + 0x30]
call fcn.0041dd50
add esp, 0xc
pop edi
pop ebp
add esp, 0x54
ret 0xc