Function at 0x40f360
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0x58c
push ebx
push ebp
push esi
push 0x44
xor ebp, ebp
lea eax, [esp + 0x54]
push ebp
push eax
call fcn.004e0730
mov ebx, dword [esp + 0x5a8]
mov esi, dword [esp + 0x5ac]
add esp, 0xc
mov ecx, ebx
mov edx, esi
lea ecx, [ecx]
mov eax, dword [ecx]
inc dword [esp + eax*4 + 0x50]
lea eax, [esp + eax*4 + 0x50]
add ecx, 4
sub edx, 1
jne 0x40f390
cmp dword [esp + 0x50], esi
jne 0x40f3b7
pop esi
pop ebp
lea eax, [edx + 2]
pop ebx
add esp, 0x58c
ret 0x1c
mov edx, dword [esp + 0x5b4]
mov esi, dword [edx]
mov dword [esp + 0x10], esi
mov ecx, 1
lea esp, [esp]
cmp dword [esp + ecx*4 + 0x50], ebp
jne 0x40f3dc
inc ecx
cmp ecx, 0x10
jbe 0x40f3d0
mov dword [esp + 0xc], ecx
cmp esi, ecx
jae 0x40f3ea
mov dword [esp + 0x10], ecx
mov esi, ecx
mov eax, 0x10
nop
cmp dword [esp + eax*4 + 0x50], ebp
jne 0x40f3fb
sub eax, 1
jne 0x40f3f0
mov dword [esp + 0x34], eax
cmp esi, eax
jbe 0x40f409
mov dword [esp + 0x10], eax
mov esi, eax
push edi
mov edi, 1
shl edi, cl
mov dword [edx], esi
cmp ecx, eax
jae 0x40f424
sub edi, dword [esp + ecx*4 + 0x54]
js 0x40f430
inc ecx
add edi, edi
cmp ecx, eax
jb 0x40f417
mov ecx, dword [esp + eax*4 + 0x54]
sub edi, ecx
mov dword [esp + 0x4c], edi
jns 0x40f442
pop edi
pop esi
pop ebp
mov eax, 2
pop ebx
add esp, 0x58c
ret 0x1c
add ecx, edi
mov dword [esp + eax*4 + 0x54], ecx
xor ecx, ecx
sub eax, 1
mov dword [esp + 0x9c], ebp
je 0x40f473
xor edx, edx
jmp 0x40f460
add ecx, dword [esp + edx + 0x58]
add edx, 4
sub eax, 1
mov dword [esp + edx + 0x9c], ecx
jne 0x40f460
push 0x480
lea ecx, [esp + 0x120]
push ebp
push ecx
call fcn.004e0730
add esp, 0xc
xor edx, edx
jmp 0x40f490
mov eax, dword [ebx]
add ebx, 4
cmp eax, ebp
je 0x40f4b1
mov ecx, dword [esp + eax*4 + 0x98]
lea eax, [esp + eax*4 + 0x98]
mov dword [esp + ecx*4 + 0x11c], edx
inc ecx
mov dword [eax], ecx
inc edx
cmp edx, dword [esp + 0x5a4]
jb 0x40f490
lea edx, [esp + 0x11c]
mov dword [esp + 0x20], edx
mov edx, dword [esp + 0x10]
mov eax, esi
xor ebx, ebx
neg eax
cmp edx, dword [esp + 0x38]
mov dword [esp + 0x2c], ebx
mov dword [esp + 0x98], ebp
mov dword [esp + 0x18], 0xffffffff
mov dword [esp + 0xdc], ebp
mov dword [esp + 0x48], ebp
mov dword [esp + 0x40], ebp
jg 0x40f76e
lea ecx, [edx - 1]
mov dword [esp + 0x34], ecx
lea ecx, [esp + edx*4 + 0x54]
mov dword [esp + 0x30], ecx
jmp 0x40f510
mov ecx, dword [esp + 0x30]
mov ecx, dword [ecx]
mov dword [esp + 0x1c], ecx
test ecx, ecx
je 0x40f756
dec dword [esp + 0x1c]
lea ecx, [eax + esi]
cmp edx, ecx
jle 0x40f63c
mov edx, dword [esp + 0x1c]
inc edx
mov edi, eax
mov dword [esp + 0x50], edx
mov dword [esp + 0x3c], ecx
sub edi, esi
mov edx, dword [esp + 0x38]
inc dword [esp + 0x18]
add dword [esp + 0x3c], esi
add eax, esi
sub edx, eax
add edi, esi
mov dword [esp + 0x44], eax
cmp edx, esi
jbe 0x40f55e
mov edx, esi
mov ebx, dword [esp + 0x10]
sub ebx, eax
mov eax, 1
mov ecx, ebx
shl eax, cl
cmp eax, dword [esp + 0x50]
jbe 0x40f598
mov esi, dword [esp + 0x30]
or ecx, 0xffffffff
sub ecx, dword [esp + 0x1c]
inc ebx
add eax, ecx
cmp ebx, edx
jae 0x40f598
mov ecx, dword [esi + 4]
add esi, 4
add eax, eax
cmp eax, ecx
jbe 0x40f598
inc ebx
sub eax, ecx
cmp ebx, edx
jb 0x40f585
mov ecx, ebx
mov eax, 1
shl eax, cl
lea edx, [eax*8 + 8]
push edx
mov dword [esp + 0x44], eax
call fcn.004dfec6
add esp, 4
test eax, eax
je 0x40f78f
mov edx, dword [esp + 0x5b4]
lea ecx, [eax + 8]
mov ebp, ecx
mov dword [edx], ecx
mov ecx, dword [esp + 0x18]
add eax, 4
lea esi, [esp + ecx*4 + 0xdc]
mov dword [esp + 0x5b4], eax
mov dword [eax], 0
mov dword [esp + 0x48], ebp
mov dword [esi], ebp
test ecx, ecx
je 0x40f622
mov eax, dword [esp + 0x2c]
mov dword [esp + ecx*4 + 0x98], eax
mov cl, byte [esp + 0x14]
mov byte [esp + 0x25], cl
mov ecx, edi
add bl, 0x10
shr eax, cl
mov ecx, dword [esi - 4]
mov byte [esp + 0x24], bl
mov esi, dword [esp + 0x24]
mov edx, ebp
mov dword [ecx + eax*8], esi
mov dword [esp + 0x28], edx
mov dword [ecx + eax*8 + 4], edx
mov edx, dword [esp + 0x3c]
cmp dword [esp + 0x10], edx
mov eax, dword [esp + 0x44]
mov esi, dword [esp + 0x14]
jg 0x40f542
mov ebx, dword [esp + 0x2c]
mov cl, byte [esp + 0x10]
mov edx, dword [esp + 0x5a4]
sub cl, al
mov byte [esp + 0x25], cl
mov ecx, dword [esp + 0x20]
lea edx, [esp + edx*4 + 0x11c]
cmp ecx, edx
jb 0x40f663
mov byte [esp + 0x24], 0x63
jmp 0x40f6ad
mov ecx, dword [ecx]
mov edx, dword [esp + 0x5a8]
cmp ecx, edx
jae 0x40f682
cmp ecx, 0x100
setb dl
add dl, 0xf
mov byte [esp + 0x24], dl
jmp 0x40f6a4
mov edi, dword [esp + 0x5b0]
test edi, edi
je 0x40f6ad
sub ecx, edx
add ecx, ecx
add ecx, ecx
mov dl, byte [ecx + edi]
mov byte [esp + 0x24], dl
mov edx, dword [esp + 0x5ac]
mov ecx, dword [ecx + edx]
add dword [esp + 0x20], 4
mov dword [esp + 0x28], ecx
mov ecx, dword [esp + 0x10]
sub ecx, eax
mov edi, 1
shl edi, cl
mov edx, ebx
mov ecx, eax
shr edx, cl
cmp edx, dword [esp + 0x40]
jae 0x40f6f0
lea ebx, [edi*8]
lea ecx, [ebp + edx*8]
mov ebp, dword [esp + 0x24]
mov dword [ecx], ebp
mov ebp, dword [esp + 0x28]
mov dword [ecx + 4], ebp
add edx, edi
add ecx, ebx
cmp edx, dword [esp + 0x40]
jb 0x40f6d1
mov ebp, dword [esp + 0x48]
mov ebx, dword [esp + 0x2c]
mov ecx, dword [esp + 0x34]
mov edx, 1
shl edx, cl
test ebx, edx
je 0x40f708
nop
xor ebx, edx
shr edx, 1
test ebx, edx
jne 0x40f700
mov edi, 1
mov ecx, eax
shl edi, cl
xor ebx, edx
mov edx, dword [esp + 0x18]
mov dword [esp + 0x2c], ebx
dec edi
and edi, ebx
cmp edi, dword [esp + edx*4 + 0x98]
je 0x40f743
sub eax, esi
mov edi, 1
mov ecx, eax
shl edi, cl
dec edx
dec edi
and edi, ebx
cmp edi, dword [esp + edx*4 + 0x98]
jne 0x40f727
mov dword [esp + 0x18], edx
cmp dword [esp + 0x1c], 0
mov edx, dword [esp + 0x10]
jne 0x40f522
mov edi, dword [esp + 0x4c]
add dword [esp + 0x30], 4
inc dword [esp + 0x34]
inc edx
cmp edx, dword [esp + 0x38]
mov dword [esp + 0x10], edx
jle 0x40f510
test edi, edi
je 0x40f780
mov eax, 1
cmp dword [esp + 0x5a4], eax
jne 0x40f782
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x58c
ret 0x1c
cmp dword [esp + 0x18], 0
je 0x40f7b6
mov eax, dword [esp + 0xdc]
test eax, eax
je 0x40f7b6
mov esi, dword [eax - 4]
sub eax, 8
push eax
call fcn.004df66f
add esp, 4
mov eax, esi
test esi, esi
jne 0x40f7a1
mov ecx, 0x5275b8
call fcn.0043d5c0
pop edi
pop esi
pop ebp
mov eax, 3
pop ebx
add esp, 0x58c
ret 0x1c