Function at 0x40f640
Capabilities:
Encode data using xor

Disassembly:
mov eax, 4
call fcn.0055ed60
cmp dword [esp + 0x20], 0
mov eax, dword [esp + 0x1c]
push ebx
push ebp
push esi
mov esi, dword [eax]
push edi
mov edi, dword [esp + 0x28]
je 0x40f75e
mov ebx, dword [esp + 0x20]
test esi, esi
je 0x40f69b
jmp 0x40f670
test ebx, ebx
je 0x40f69b
movzx eax, byte [esi + edi]
mov edx, dword [esp + 0x18]
movzx ecx, byte [edx]
xor eax, ecx
mov ecx, dword [esp + 0x1c]
mov byte [esi + edi], al
mov byte [ecx], al
inc ecx
inc edx
inc esi
dec ebx
and esi, 0xf
mov dword [esp + 0x1c], ecx
mov dword [esp + 0x18], edx
jne 0x40f670
cmp ebx, 0x10
jb 0x40f718
mov edx, dword [esp + 0x18]
mov ecx, dword [esp + 0x1c]
mov eax, edx
sub eax, edi
mov dword [esp + 0x30], eax
mov eax, ebx
shr eax, 4
mov ebp, ecx
mov dword [esp + 0x10], eax
shl eax, 4
add ecx, eax
sub ebp, edi
add edx, eax
mov dword [esp + 0x1c], ecx
mov dword [esp + 0x18], edx
lea esp, [esp]
mov edx, dword [esp + 0x24]
push edx
push edi
push edi
call dword [esp + 0x40]
add esp, 0xc
cmp esi, 0x10
jae 0x40f705
mov ecx, 0xf
sub ecx, esi
shr ecx, 2
lea eax, [esi + edi]
inc ecx
mov edx, dword [esp + 0x30]
mov edx, dword [edx + eax]
xor dword [eax], edx
mov edx, dword [eax]
mov dword [eax + ebp], edx
add eax, 4
dec ecx
jne 0x40f6f1
add dword [esp + 0x30], 0x10
sub ebx, 0x10
add ebp, 0x10
xor esi, esi
dec dword [esp + 0x10]
jne 0x40f6d0
test ebx, ebx
je 0x40f752
mov eax, dword [esp + 0x24]
push eax
push edi
push edi
call dword [esp + 0x40]
mov edx, dword [esp + 0x24]
mov ebp, dword [esp + 0x28]
add esp, 0xc
lea eax, [esi + edi]
sub edx, edi
sub ebp, edi
add esi, ebx
jmp 0x40f740
movzx ecx, byte [eax + edx]
movzx edi, byte [eax]
xor ecx, edi
mov byte [eax], cl
mov byte [eax + ebp], cl
inc eax
dec ebx
jne 0x40f740
mov ecx, dword [esp + 0x2c]
pop edi
mov dword [ecx], esi
pop esi
pop ebp
pop ebx
pop ecx
ret
mov ebp, dword [esp + 0x20]
mov ebx, dword [esp + 0x18]
test esi, esi
je 0x40f799
lea ebx, [ebx]
test ebp, ebp
je 0x40f791
mov dl, byte [esi + edi]
mov al, byte [ebx]
mov ecx, dword [esp + 0x1c]
xor dl, al
mov byte [ecx], dl
mov byte [esi + edi], al
inc ecx
inc esi
inc ebx
dec ebp
and esi, 0xf
mov dword [esp + 0x1c], ecx
jne 0x40f770
mov dword [esp + 0x18], ebx
mov dword [esp + 0x20], ebp
cmp ebp, 0x10
jb 0x40f816
mov eax, dword [esp + 0x1c]
sub eax, edi
mov dword [esp + 0x30], eax
mov eax, ebp
shr eax, 4
mov dword [esp + 0x10], eax
mov eax, dword [esp + 0x24]
push eax
push edi
push edi
call dword [esp + 0x40]
add esp, 0xc
cmp esi, 0x10
jae 0x40f7f5
sub ebx, dword [esp + 0x1c]
mov ecx, 0xf
sub ecx, esi
shr ecx, 2
lea eax, [esi + edi]
inc ecx
mov edx, dword [esp + 0x30]
mov ebp, dword [eax]
add edx, eax
mov esi, dword [edx + ebx]
xor ebp, esi
mov dword [edx], ebp
mov dword [eax], esi
add eax, 4
dec ecx
jne 0x40f7d6
mov ebp, dword [esp + 0x20]
mov ebx, dword [esp + 0x18]
mov eax, 0x10
add dword [esp + 0x1c], eax
add dword [esp + 0x30], eax
sub ebp, eax
add ebx, eax
xor esi, esi
dec dword [esp + 0x10]
mov dword [esp + 0x20], ebp
mov dword [esp + 0x18], ebx
jne 0x40f7b1
test ebp, ebp
je 0x40f856
mov eax, dword [esp + 0x24]
push eax
push edi
push edi
call dword [esp + 0x40]
mov ecx, dword [esp + 0x28]
sub ebx, ecx
sub ecx, edi
add esp, 0xc
lea eax, [esi + edi]
mov dword [esp + 0x30], ecx
add esi, ebp
jmp 0x40f844
mov ecx, dword [esp + 0x30]
mov dl, byte [eax]
lea edi, [eax + ecx]
mov cl, byte [edi + ebx]
xor dl, cl
mov byte [edi], dl
mov byte [eax], cl
inc eax
dec ebp
jne 0x40f840
mov eax, dword [esp + 0x2c]
pop edi
mov dword [eax], esi
pop esi
pop ebp
pop ebx
pop ecx
ret