Function at 0x407980
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0x144
push ebx
push ebp
mov ebp, dword [esp + 0x150]
push esi
mov esi, dword [esp + 0x158]
push edi
cmp esi, 0x100
jbe 0x4079ac
mov eax, dword [ebp + 0x400]
mov dword [esp + 0x38], eax
jmp 0x4079b4
mov dword [esp + 0x38], 0x10
mov ecx, 0x11
xor eax, eax
lea edi, [esp + 0x48]
mov edx, esi
rep stosd dword es:[edi], eax
mov ecx, ebp
mov eax, dword [ecx]
add ecx, 4
mov ebx, dword [esp + eax*4 + 0x48]
lea eax, [esp + eax*4 + 0x48]
inc ebx
dec edx
mov dword [eax], ebx
jne 0x4079c5
cmp dword [esp + 0x48], esi
jne 0x407a05
mov ecx, dword [esp + 0x16c]
mov edx, dword [esp + 0x170]
pop edi
pop esi
mov dword [ecx], 0
pop ebp
mov dword [edx], 0
xor eax, eax
pop ebx
add esp, 0x144
ret
mov ecx, 1
lea eax, [esp + 0x4c]
mov edx, dword [eax]
xor ebx, ebx
cmp edx, ebx
jne 0x407a1f
inc ecx
add eax, 4
cmp ecx, 0x10
jbe 0x407a0e
mov edi, dword [esp + 0x170]
mov edx, ecx
mov dword [esp + 0x10], edx
cmp dword [edi], ecx
jae 0x407a32
mov dword [edi], ecx
mov eax, 0x10
lea esi, [esp + 0x88]
cmp dword [esi], ebx
jne 0x407a4a
dec eax
sub esi, 4
cmp eax, ebx
jne 0x407a3e
mov esi, dword [edi]
mov dword [esp + 0x24], eax
cmp esi, eax
jbe 0x407a56
mov dword [edi], eax
mov esi, 1
shl esi, cl
cmp ecx, eax
jae 0x407a73
lea edi, [esp + ecx*4 + 0x48]
sub esi, dword [edi]
js 0x407a7f
inc ecx
add edi, 4
shl esi, 1
cmp ecx, eax
jb 0x407a65
mov ecx, dword [esp + eax*4 + 0x48]
sub esi, ecx
mov dword [esp + 0x44], esi
jns 0x407a8f
pop edi
pop esi
pop ebp
mov eax, 2
pop ebx
add esp, 0x144
ret
add ecx, esi
mov dword [esp + 0xd4], ebx
mov dword [esp + eax*4 + 0x48], ecx
xor ecx, ecx
dec eax
je 0x407ab6
xor esi, esi
mov edi, dword [esp + esi + 0x4c]
add esi, 4
add ecx, edi
dec eax
mov dword [esp + esi + 0xd4], ecx
jne 0x407aa3
mov edi, ebp
xor esi, esi
mov eax, dword [edi]
add edi, 4
cmp eax, ebx
je 0x407adb
mov ecx, dword [esp + eax*4 + 0xd0]
lea eax, [esp + eax*4 + 0xd0]
mov dword [ecx*4 + 0x41b880], esi
inc ecx
mov dword [eax], ecx
mov eax, dword [esp + 0x15c]
inc esi
cmp esi, eax
jb 0x407aba
mov eax, dword [esp + 0x24]
xor ebp, ebp
mov ecx, 0x41b880
or esi, 0xffffffff
xor edi, edi
cmp edx, eax
mov dword [esp + 0x2c], ebp
mov dword [esp + 0xd0], ebx
mov dword [esp + 0x14], ecx
mov dword [esp + 0x8c], ebx
mov dword [esp + 0x114], ebx
mov dword [esp + 0x3c], ebx
jg 0x407dec
lea eax, [edx - 1]
lea edx, [esp + edx*4 + 0x48]
mov dword [esp + 0x34], eax
mov dword [esp + 0x20], edx
mov eax, dword [esp + 0x20]
mov eax, dword [eax]
mov edx, eax
dec eax
test edx, edx
mov dword [esp + 0x28], eax
je 0x407dc3
mov eax, dword [esp + esi*4 + 0x90]
mov edx, dword [esp + 0x10]
add eax, ebx
cmp edx, eax
jle 0x407caf
lea ecx, [esp + 0x114]
sub ecx, 4
mov dword [esp + 0x40], ecx
mov ecx, dword [esp + 0x170]
mov edx, dword [esp + 0x24]
mov ebp, eax
inc esi
mov eax, dword [ecx]
sub edx, ebp
cmp edx, eax
mov dword [esp + 0x30], ebp
jbe 0x407b83
mov edx, eax
mov ebx, dword [esp + 0x10]
mov eax, 1
sub ebx, ebp
mov ecx, ebx
shl eax, cl
mov ecx, dword [esp + 0x28]
inc ecx
cmp eax, ecx
jbe 0x407bc2
mov edi, dword [esp + 0x28]
or ecx, 0xffffffff
sub ecx, edi
mov edi, dword [esp + 0x20]
add eax, ecx
inc ebx
cmp ebx, edx
jae 0x407bc2
mov ecx, dword [edi + 4]
add edi, 4
shl eax, 1
cmp eax, ecx
jbe 0x407bc2
sub eax, ecx
inc ebx
cmp ebx, edx
jb 0x407baf
mov eax, dword [esp + 0x38]
lea edx, [ebx + ebp]
cmp edx, eax
jbe 0x407bd5
cmp ebp, eax
jae 0x407bd5
mov ebx, eax
sub ebx, ebp
mov edi, 1
mov ecx, ebx
shl edi, cl
mov dword [esp + esi*4 + 0x90], ebx
lea eax, [edi*8 + 8]
push eax
call fcn.0040db30
add esp, 4
test eax, eax
je 0x407e1e
mov ecx, dword [0x41c6f0]
lea edx, [ecx + edi + 1]
lea ecx, [eax + 8]
mov dword [0x41c6f0], edx
mov edx, dword [esp + 0x16c]
add eax, 4
mov dword [esp + 0x3c], ecx
mov dword [edx], ecx
mov dword [esp + 0x16c], eax
test esi, esi
mov dword [eax], 0
mov dword [esp + esi*4 + 0x114], ecx
je 0x407c8a
mov al, byte [esp + esi*4 + 0x8c]
add bl, 0x10
mov byte [esp + 0x19], al
mov eax, dword [esp + 0x30]
mov ebp, dword [esp + 0x2c]
mov byte [esp + 0x18], bl
mov edx, ecx
mov ebx, 1
mov ecx, eax
mov dword [esp + esi*4 + 0xd0], ebp
shl ebx, cl
mov dword [esp + 0x1c], edx
dec ebx
and ebx, ebp
mov ebp, dword [esp + esi*4 + 0x8c]
sub ecx, ebp
mov ebp, dword [esp + 0x18]
shr ebx, cl
mov ecx, dword [esp + 0x40]
mov ecx, dword [ecx + esi*4]
mov dword [ecx + ebx*8], ebp
mov dword [ecx + ebx*8 + 4], edx
jmp 0x407c8e
mov eax, dword [esp + 0x30]
mov edx, dword [esp + esi*4 + 0x90]
mov ecx, dword [esp + 0x10]
add eax, edx
cmp ecx, eax
jg 0x407b67
mov ebx, dword [esp + 0x30]
mov ebp, dword [esp + 0x2c]
mov ecx, dword [esp + 0x14]
mov al, byte [esp + 0x10]
mov edx, dword [esp + 0x15c]
sub al, bl
mov byte [esp + 0x19], al
lea eax, [edx*4 + 0x41b880]
cmp ecx, eax
jb 0x407cd2
mov byte [esp + 0x18], 0x63
jmp 0x407d19
mov eax, dword [ecx]
mov edx, dword [esp + 0x160]
cmp eax, edx
jae 0x407cf0
cmp eax, 0x100
setb dl
add edx, 0xf
mov byte [esp + 0x18], dl
jmp 0x407d0d
sub eax, edx
mov edx, dword [esp + 0x168]
shl eax, 1
mov dl, byte [eax + edx]
mov byte [esp + 0x18], dl
mov edx, dword [esp + 0x164]
mov ax, word [eax + edx]
add ecx, 4
mov word [esp + 0x1c], ax
mov dword [esp + 0x14], ecx
mov ecx, dword [esp + 0x10]
mov edx, 1
sub ecx, ebx
mov eax, ebp
shl edx, cl
mov ecx, ebx
shr eax, cl
cmp eax, edi
jae 0x407d57
mov ecx, dword [esp + 0x3c]
lea ecx, [ecx + eax*8]
mov ebp, dword [esp + 0x18]
add eax, edx
mov dword [ecx], ebp
mov ebp, dword [esp + 0x1c]
mov dword [ecx + 4], ebp
lea ebp, [edx*8]
add ecx, ebp
cmp eax, edi
jb 0x407d37
mov ebp, dword [esp + 0x2c]
mov ecx, dword [esp + 0x34]
mov eax, 1
shl eax, cl
test ebp, eax
je 0x407d6e
xor ebp, eax
shr eax, 1
test ebp, eax
jne 0x407d66
mov edx, 1
mov ecx, ebx
shl edx, cl
xor ebp, eax
mov eax, dword [esp + esi*4 + 0xd0]
mov dword [esp + 0x2c], ebp
dec edx
and edx, ebp
cmp edx, eax
je 0x407dac
mov eax, dword [esp + esi*4 + 0x8c]
dec esi
sub ebx, eax
mov eax, 1
mov ecx, ebx
shl eax, cl
mov ecx, dword [esp + esi*4 + 0xd0]
dec eax
and eax, ebp
cmp eax, ecx
jne 0x407d8b
mov eax, dword [esp + 0x28]
mov ecx, eax
dec eax
test ecx, ecx
mov ecx, dword [esp + 0x14]
mov dword [esp + 0x28], eax
jne 0x407b44
mov edx, dword [esp + 0x20]
mov eax, dword [esp + 0x10]
add edx, 4
inc eax
mov dword [esp + 0x20], edx
mov edx, dword [esp + 0x34]
inc edx
mov dword [esp + 0x10], eax
mov dword [esp + 0x34], edx
mov edx, dword [esp + 0x24]
cmp eax, edx
jle 0x407b2f
mov eax, dword [esp + 0x170]
mov edx, dword [esp + 0x90]
mov dword [eax], edx
mov eax, dword [esp + 0x44]
test eax, eax
je 0x407e11
mov ecx, dword [esp + 0x24]
mov eax, 1
cmp ecx, eax
jne 0x407e13
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x144
ret
test esi, esi
je 0x407e42
mov eax, dword [esp + 0x114]
test eax, eax
je 0x407e42
mov esi, dword [eax - 4]
sub eax, 8
push eax
call fcn.0040df2e
add esp, 4
mov eax, esi
test esi, esi
jne 0x407e2d
pop edi
pop esi
pop ebp
mov eax, 3
pop ebx
add esp, 0x144
ret