Function at 0x40a6e0
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0x5c8
push ebx
push ebp
push esi
mov esi, dword [esp + 0x5dc]
cmp esi, 0x100
push edi
jbe 0x40a70c
mov eax, dword [esp + 0x5dc]
mov ecx, dword [eax + 0x400]
mov dword [esp + 0x40], ecx
jmp 0x40a714
mov dword [esp + 0x40], 0x10
mov ecx, 0x11
xor eax, eax
lea edi, [esp + 0x4c]
mov edx, esi
rep stosd dword es:[edi], eax
mov ecx, dword [esp + 0x5dc]
mov eax, dword [ecx]
add ecx, 4
mov ebx, dword [esp + eax*4 + 0x4c]
lea eax, [esp + eax*4 + 0x4c]
inc ebx
dec edx
mov dword [eax], ebx
jne 0x40a72a
cmp dword [esp + 0x4c], esi
jne 0x40a76a
mov ecx, dword [esp + 0x5f0]
mov edx, dword [esp + 0x5f4]
pop edi
pop esi
mov dword [ecx], 0
pop ebp
mov dword [edx], 0
xor eax, eax
pop ebx
add esp, 0x5c8
ret
mov ecx, 1
lea eax, [esp + 0x50]
mov edx, dword [eax]
xor ebx, ebx
cmp edx, ebx
jne 0x40a784
inc ecx
add eax, 4
cmp ecx, 0x10
jbe 0x40a773
mov edi, dword [esp + 0x5f4]
mov edx, ecx
mov dword [esp + 0x10], edx
cmp dword [edi], ecx
jae 0x40a797
mov dword [edi], ecx
mov eax, 0x10
lea esi, [esp + 0x8c]
cmp dword [esi], ebx
jne 0x40a7af
dec eax
sub esi, 4
cmp eax, ebx
jne 0x40a7a3
mov esi, dword [edi]
mov dword [esp + 0x20], eax
cmp esi, eax
jbe 0x40a7bb
mov dword [edi], eax
mov esi, 1
shl esi, cl
cmp ecx, eax
jae 0x40a7d8
lea edi, [esp + ecx*4 + 0x4c]
sub esi, dword [edi]
js 0x40a7eb
inc ecx
add edi, 4
shl esi, 1
cmp ecx, eax
jb 0x40a7ca
lea ebp, [eax*4]
mov ecx, dword [esp + ebp + 0x4c]
sub esi, ecx
mov dword [esp + 0x48], esi
jns 0x40a7fb
pop edi
pop esi
pop ebp
mov eax, 2
pop ebx
add esp, 0x5c8
ret
add ecx, esi
mov dword [esp + 0x94], ebx
mov dword [esp + ebp + 0x4c], ecx
xor ecx, ecx
dec eax
je 0x40a822
xor esi, esi
mov edi, dword [esp + esi + 0x50]
add esi, 4
add ecx, edi
dec eax
mov dword [esp + esi + 0x94], ecx
jne 0x40a80f
mov ecx, 0x120
xor eax, eax
lea edi, [esp + 0x158]
xor esi, esi
rep stosd dword es:[edi], eax
mov edi, dword [esp + 0x5dc]
mov eax, dword [edi]
add edi, 4
cmp eax, ebx
je 0x40a85c
mov ecx, dword [esp + eax*4 + 0x90]
lea eax, [esp + eax*4 + 0x90]
mov dword [esp + ecx*4 + 0x158], esi
inc ecx
mov dword [eax], ecx
mov eax, dword [esp + 0x5e0]
inc esi
cmp esi, eax
jb 0x40a83b
mov eax, dword [esp + ebp + 0x90]
lea ebp, [esp + 0x158]
mov dword [esp + 0x5e0], eax
mov eax, dword [esp + 0x20]
or esi, 0xffffffff
xor edi, edi
cmp edx, eax
mov dword [esp + 0x28], ebx
mov dword [esp + 0x90], ebx
mov dword [esp + 0x18], ebp
mov dword [esp + 0xd4], ebx
mov dword [esp + 0x14], ebx
mov dword [esp + 0x118], edi
mov dword [esp + 0x44], edi
jg 0x40ab9e
lea ecx, [edx - 1]
lea eax, [esp + edx*4 + 0x4c]
mov dword [esp + 0x38], ecx
mov dword [esp + 0x24], eax
mov ecx, dword [esp + 0x24]
mov eax, dword [ecx]
mov ecx, eax
dec eax
test ecx, ecx
mov dword [esp + 0x1c], eax
je 0x40ab79
mov eax, dword [esp + esi*4 + 0xd8]
add eax, ebx
cmp edx, eax
jle 0x40aa45
lea ecx, [esp + 0x118]
sub ecx, 4
mov dword [esp + 0x3c], ecx
mov ecx, dword [esp + 0x5f4]
mov edx, dword [esp + 0x20]
mov ebp, eax
inc esi
mov eax, dword [ecx]
sub edx, ebp
cmp edx, eax
mov dword [esp + 0x14], ebp
jbe 0x40a912
mov edx, eax
mov ebx, dword [esp + 0x10]
mov eax, 1
sub ebx, ebp
mov ecx, ebx
shl eax, cl
mov ecx, dword [esp + 0x1c]
inc ecx
cmp eax, ecx
jbe 0x40a951
mov edi, dword [esp + 0x1c]
or ecx, 0xffffffff
sub ecx, edi
mov edi, dword [esp + 0x24]
add eax, ecx
inc ebx
cmp ebx, edx
jae 0x40a951
mov ecx, dword [edi + 4]
add edi, 4
shl eax, 1
cmp eax, ecx
jbe 0x40a951
sub eax, ecx
inc ebx
cmp ebx, edx
jb 0x40a93e
mov eax, dword [esp + 0x40]
lea edx, [ebx + ebp]
cmp edx, eax
jbe 0x40a964
cmp ebp, eax
jae 0x40a964
mov ebx, eax
sub ebx, ebp
mov edi, 1
mov ecx, ebx
shl edi, cl
mov dword [esp + esi*4 + 0xd8], ebx
lea eax, [edi + edi*2 + 3]
shl eax, 2
push eax
call fcn.0042937f
add esp, 4
test eax, eax
je 0x40abd0
mov ecx, dword [0x4660fc]
mov edx, dword [esp + 0x5f0]
mov dword [eax], ecx
mov dword [0x4660fc], eax
lea ecx, [eax + 0xc]
add eax, 8
mov dword [edx], ecx
mov dword [esp + 0x5f0], eax
test esi, esi
mov dword [eax], 0
mov dword [esp + 0x44], ecx
mov dword [esp + esi*4 + 0x118], ecx
je 0x40aa21
mov al, byte [esp + esi*4 + 0xd4]
mov edx, dword [esp + 0x14]
add bl, 0x10
mov ebp, dword [esp + 0x28]
mov byte [esp + 0x30], bl
mov byte [esp + 0x31], al
mov ebx, ecx
mov eax, 1
mov ecx, edx
mov dword [esp + esi*4 + 0x90], ebp
shl eax, cl
mov dword [esp + 0x34], ebx
dec eax
and eax, ebp
mov ebp, dword [esp + esi*4 + 0xd4]
sub ecx, ebp
shr eax, cl
lea ecx, [eax + eax*2]
mov eax, dword [esp + 0x3c]
mov eax, dword [eax + esi*4]
lea ecx, [eax + ecx*4]
mov eax, dword [esp + 0x2c]
mov dword [ecx], eax
mov eax, dword [esp + 0x30]
mov dword [ecx + 4], eax
mov dword [ecx + 8], ebx
jmp 0x40aa25
mov edx, dword [esp + 0x14]
mov ecx, dword [esp + esi*4 + 0xd8]
lea eax, [ecx + edx]
mov ecx, dword [esp + 0x10]
cmp ecx, eax
jg 0x40a8f6
mov ebx, dword [esp + 0x14]
mov ebp, dword [esp + 0x18]
mov edx, ecx
mov ecx, dword [esp + 0x5e0]
mov al, dl
sub al, bl
mov byte [esp + 0x31], al
lea eax, [esp + ecx*4 + 0x158]
cmp ebp, eax
jb 0x40aa66
mov byte [esp + 0x30], 0x63
jmp 0x40aaae
mov eax, dword [ebp]
mov ecx, dword [esp + 0x5e4]
cmp eax, ecx
jae 0x40aa85
cmp eax, 0x100
setb cl
add ecx, 0xf
mov byte [esp + 0x30], cl
jmp 0x40aaa2
sub eax, ecx
mov ecx, dword [esp + 0x5ec]
shl eax, 1
mov cl, byte [eax + ecx]
mov byte [esp + 0x30], cl
mov ecx, dword [esp + 0x5e8]
mov ax, word [eax + ecx]
add ebp, 4
mov word [esp + 0x34], ax
mov dword [esp + 0x18], ebp
mov ebp, dword [esp + 0x28]
mov ecx, edx
sub ecx, ebx
mov edx, 1
shl edx, cl
mov eax, ebp
mov ecx, ebx
shr eax, cl
cmp eax, edi
jae 0x40ab05
mov ebx, dword [esp + 0x44]
lea ecx, [edx + edx*2]
shl ecx, 2
mov dword [esp + 0x3c], ecx
lea ecx, [eax + eax*2]
lea ecx, [ebx + ecx*4]
mov ebp, dword [esp + 0x2c]
mov ebx, ecx
add eax, edx
mov dword [ebx], ebp
mov ebp, dword [esp + 0x30]
mov dword [ebx + 4], ebp
mov ebp, dword [esp + 0x34]
mov dword [ebx + 8], ebp
mov ebp, dword [esp + 0x3c]
add ecx, ebp
cmp eax, edi
jb 0x40aadb
mov ebx, dword [esp + 0x14]
mov ebp, dword [esp + 0x28]
mov ecx, dword [esp + 0x38]
mov eax, 1
shl eax, cl
test ebp, eax
je 0x40ab1c
xor ebp, eax
shr eax, 1
test ebp, eax
jne 0x40ab14
mov edx, 1
mov ecx, ebx
shl edx, cl
xor ebp, eax
mov eax, dword [esp + esi*4 + 0x90]
mov dword [esp + 0x28], ebp
dec edx
and edx, ebp
cmp edx, eax
je 0x40ab5e
mov eax, dword [esp + esi*4 + 0xd4]
dec esi
sub ebx, eax
mov eax, 1
mov ecx, ebx
shl eax, cl
mov ecx, dword [esp + esi*4 + 0x90]
dec eax
and eax, ebp
cmp eax, ecx
jne 0x40ab39
mov dword [esp + 0x14], ebx
mov eax, dword [esp + 0x1c]
mov edx, dword [esp + 0x10]
mov ebp, dword [esp + 0x18]
mov ecx, eax
dec eax
test ecx, ecx
mov dword [esp + 0x1c], eax
jne 0x40a8d7
mov eax, dword [esp + 0x24]
mov ecx, dword [esp + 0x38]
add eax, 4
inc edx
mov dword [esp + 0x24], eax
mov eax, dword [esp + 0x20]
inc ecx
cmp edx, eax
mov dword [esp + 0x10], edx
mov dword [esp + 0x38], ecx
jle 0x40a8c2
mov eax, dword [esp + 0x5f4]
mov edx, dword [esp + 0xd8]
mov dword [eax], edx
mov eax, dword [esp + 0x48]
test eax, eax
je 0x40abc3
mov ecx, dword [esp + 0x20]
mov eax, 1
cmp ecx, eax
jne 0x40abc5
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x5c8
ret
pop edi
pop esi
pop ebp
mov eax, 3
pop ebx
add esp, 0x5c8
ret