Function at 0x40f020
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.004e7df0
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 0x40f050
cmp dword [esp + 0x50], esi
jne 0x40f077
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 0x40f09c
inc ecx
cmp ecx, 0x10
jbe 0x40f090
mov dword [esp + 0xc], ecx
cmp esi, ecx
jae 0x40f0aa
mov dword [esp + 0x10], ecx
mov esi, ecx
mov eax, 0x10
nop
cmp dword [esp + eax*4 + 0x50], ebp
jne 0x40f0bb
sub eax, 1
jne 0x40f0b0
mov dword [esp + 0x34], eax
cmp esi, eax
jbe 0x40f0c9
mov dword [esp + 0x10], eax
mov esi, eax
push edi
mov edi, 1
shl edi, cl
mov dword [edx], esi
cmp ecx, eax
jae 0x40f0e4
sub edi, dword [esp + ecx*4 + 0x54]
js 0x40f0f0
inc ecx
add edi, edi
cmp ecx, eax
jb 0x40f0d7
mov ecx, dword [esp + eax*4 + 0x54]
sub edi, ecx
mov dword [esp + 0x4c], edi
jns 0x40f102
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 0x40f133
xor edx, edx
jmp 0x40f120
add ecx, dword [esp + edx + 0x58]
add edx, 4
sub eax, 1
mov dword [esp + edx + 0x9c], ecx
jne 0x40f120
push 0x480
lea ecx, [esp + 0x120]
push ebp
push ecx
call fcn.004e7df0
add esp, 0xc
xor edx, edx
jmp 0x40f150
mov eax, dword [ebx]
add ebx, 4
cmp eax, ebp
je 0x40f171
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 0x40f150
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 0x40f42e
lea ecx, [edx - 1]
mov dword [esp + 0x34], ecx
lea ecx, [esp + edx*4 + 0x54]
mov dword [esp + 0x30], ecx
jmp 0x40f1d0
mov ecx, dword [esp + 0x30]
mov ecx, dword [ecx]
mov dword [esp + 0x1c], ecx
test ecx, ecx
je 0x40f416
dec dword [esp + 0x1c]
lea ecx, [eax + esi]
cmp edx, ecx
jle 0x40f2fc
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 0x40f21e
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 0x40f258
mov esi, dword [esp + 0x30]
or ecx, 0xffffffff
sub ecx, dword [esp + 0x1c]
inc ebx
add eax, ecx
cmp ebx, edx
jae 0x40f258
mov ecx, dword [esi + 4]
add esi, 4
add eax, eax
cmp eax, ecx
jbe 0x40f258
inc ebx
sub eax, ecx
cmp ebx, edx
jb 0x40f245
mov ecx, ebx
mov eax, 1
shl eax, cl
lea edx, [eax*8 + 8]
push edx
mov dword [esp + 0x44], eax
call fcn.004e7f56
add esp, 4
test eax, eax
je 0x40f44f
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 0x40f2e2
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 0x40f202
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 0x40f323
mov byte [esp + 0x24], 0x63
jmp 0x40f36d
mov ecx, dword [ecx]
mov edx, dword [esp + 0x5a8]
cmp ecx, edx
jae 0x40f342
cmp ecx, 0x100
setb dl
add dl, 0xf
mov byte [esp + 0x24], dl
jmp 0x40f364
mov edi, dword [esp + 0x5b0]
test edi, edi
je 0x40f36d
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 0x40f3b0
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 0x40f391
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 0x40f3c8
nop
xor ebx, edx
shr edx, 1
test ebx, edx
jne 0x40f3c0
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 0x40f403
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 0x40f3e7
mov dword [esp + 0x18], edx
cmp dword [esp + 0x1c], 0
mov edx, dword [esp + 0x10]
jne 0x40f1e2
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 0x40f1d0
test edi, edi
je 0x40f440
mov eax, 1
cmp dword [esp + 0x5a4], eax
jne 0x40f442
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x58c
ret 0x1c
cmp dword [esp + 0x18], 0
je 0x40f476
mov eax, dword [esp + 0xdc]
test eax, eax
je 0x40f476
mov esi, dword [eax - 4]
sub eax, 8
push eax
call fcn.004e7061
add esp, 4
mov eax, esi
test esi, esi
jne 0x40f461
mov ecx, 0x531158
call fcn.0043f310
pop edi
pop esi
pop ebp
mov eax, 3
pop ebx
add esp, 0x58c
ret 0x1c