Function at 0x40e722
Capabilities:
Allocate or change rwx memory
Encode data using xor
Encrypt data using salsa20 or chacha

Disassembly:
pushfd
push ebp
mov ebp, esp
sub esp, 0x150
mov dword [ebp - 0x14c], eax
mov dword [ebp - 0x144], ecx
mov dword [ebp - 0x150], edx
lea eax, [ebp + 4]
mov dword [ebp - 0x148], ebx
mov dword [ebp - 0x13c], esi
mov dword [ebp - 0x140], edi
mov esi, dword [eax + 4]
mov edi, dword [0x4c7398]
sub eax, 4
mov dword [ebp - 0xe8], eax
mov eax, dword [esi]
shr eax, 4
lea ecx, [edi + eax - 1]
mov eax, ecx
xor edx, edx
div edi
sub ecx, edx
mov eax, dword [0x4c7398]
mov dword [ebp - 0x78], ecx
mov eax, dword [0x403ef8]
mov dword [ebp - 0x68], eax
mov eax, dword [0x4c7398]
mov eax, dword [0x403ef8]
test eax, eax
je 0x40e80e
mov eax, dword [0x403ef8]
xor edi, edi
dec eax
lea ecx, [eax + 1]
mov edx, ecx
xor eax, eax
test ecx, ecx
je 0x40e7cb
mov ebx, dword [0x51b214]
imul ebx, ebx, 0x343fd
add ebx, 0x269ec3
mov dword [0x51b214], ebx
shr ebx, 0x10
shl eax, 0x10
or eax, ebx
shr edx, 0x10
jne 0x40e7a6
xor edx, edx
div ecx
cmp dword [ebp - 0x68], 0
jbe 0x40e808
mov eax, 0x3c6f
inc edi
mov ecx, 0xffffc390
lea ebx, [edx*4 + 0x529524]
lock cmpxchg dword [ebx], ecx
cmp eax, 0x3c6f
je 0x40e9e6
mov ecx, dword [0x403ef8]
lea eax, [edx + 1]
xor edx, edx
div ecx
cmp edi, dword [ebp - 0x68]
jb 0x40e7d5
xor edi, edi
test edi, edi
jne 0x40e884
call dword [sym.imp.kernel32.dll_GetLastError]
xor edi, edi
mov ebx, eax
inc edi
push 0x40
push 0x1000
push dword [ebp - 0x78]
push 0
call dword [sym.imp.kernel32.dll_VirtualAlloc]
test eax, eax
jne 0x40e9fa
push eax
call dword [sym.imp.kernel32.dll_Sleep]
cmp edi, 0x11
jb 0x40e818
xor edi, edi
cmp dword [0x51b2c4], edi
ja 0x40e851
test edi, 3
je 0x40e865
test edi, edi
je 0x40e863
push 0x8000
push 0
push edi
call dword [sym.imp.kernel32.dll_VirtualFree]
xor edi, edi
push ebx
call dword [sym.imp.kernel32.dll_SetLastError]
test edi, edi
je 0x40e77d
mov ecx, dword [ebp - 0x78]
mov eax, edi
test ecx, ecx
je 0x40e884
mov byte [eax], 0
inc eax
dec ecx
jne 0x40e87d
mov eax, 0x6737bb1e
mov ebx, dword [esi]
mov eax, ebx
shr eax, 1
and eax, 7
shr ebx, 4
lea eax, [eax + esi + 8]
mov dword [ebp - 0x7c], eax
lea ecx, [ebx + eax]
mov dword [ebp - 0xd0], eax
mov eax, dword [0x4c7398]
sub eax, ebx
mov esi, 0x400000
mov dword [ebp - 0xc0], ecx
sub dword [ebp - 0x7c], esi
lea ecx, [eax + 1]
mov dword [ebp - 0xc4], ebx
xor eax, eax
test ecx, ecx
mov dword [ebp - 0x68], ecx
je 0x40e8f2
mov edx, dword [0x51b214]
imul edx, edx, 0x343fd
add edx, 0x269ec3
mov dword [0x51b214], edx
shr edx, 0x10
shl eax, 0x10
or eax, edx
shr dword [ebp - 0x68], 0x10
jne 0x40e8cc
xor edx, edx
div ecx
add edi, edx
push edi
push ebx
push dword [ebp - 0x7c]
mov dword [ebp - 0xc8], edi
mov eax, 0x2a77b4d0
mov eax, dword [ebp - 0xc0]
mov ecx, dword [eax]
mov eax, dword [eax + 4]
mov dword [ebp - 0xec], eax
mov eax, dword [ebp - 0xd0]
add esp, 0xc
mov dword [ebp - 0x68], edi
test ebx, ebx
mov dword [ebp - 0xf0], ecx
mov edi, 0xfffff000
mov byte [ebp - 0x55], 0
mov dword [ebp - 0xcc], ebx
mov dword [ebp - 0x78], eax
je 0x40f04f
lea eax, [ebp - 0xf0]
push eax
mov eax, 0x2b12323e
mov eax, 0xfffffff
mov ebx, dword [ebp - 0xf0]
and dword [ebp - 0x60], 0
and dword [ebp - 0x5c], 0
pop ecx
mov ecx, dword [ebp - 0xec]
and ecx, eax
mov dword [ebp - 0x70], ecx
and ebx, eax
mov ecx, dword [0x402600]
add ebx, esi
mov eax, esi
sub eax, ecx
mov dword [ebp - 0xf4], eax
jne 0x40ea01
xor edi, edi
cmp dword [ebp - 0x70], edi
jbe 0x40ec66
mov esi, 0x13023717
mov ecx, 0x7fffffff
movzx edx, byte [edi + ebx]
sub edx, esi
add dword [ebp - 0x60], edx
add edx, dword [ebp - 0x5c]
mov eax, edx
imul eax, eax, 0x5858
rol eax, 9
ror edx, 9
xor eax, edx
mov edx, 0xecfdc8e9
mul edx
lea edx, [eax + edx*2 - 0x7fffffff]
sar eax, 0x1f
and eax, ecx
sub edx, eax
mov eax, edx
sar eax, 0x1f
and eax, ecx
add eax, edx
add dword [ebp - 0x60], eax
inc edi
cmp edi, dword [ebp - 0x70]
mov dword [ebp - 0x5c], eax
jb 0x40e99b
jmp 0x40ec66
mov edi, dword [0x4c7398]
imul edi, edx
lea edi, [edi + section..data]
jmp 0x40e80a
mov edi, eax
jmp 0x40e841
mov edx, dword [0x40003c]
mov eax, dword [ebp - 0x70]
mov ecx, ebx
add eax, ebx
mov dword [ebp - 0x6c], eax
lea edx, [edx + 0x4000a0]
mov eax, dword [edx]
add eax, esi
sub ecx, esi
mov edx, dword [edx + 4]
mov dword [ebp - 0x74], edx
mov edx, dword [ebp - 0x70]
mov esi, ecx
and esi, edi
mov dword [ebp - 0x64], esi
mov esi, ecx
sub esi, dword [ebp - 0x64]
add ecx, edx
mov edx, ecx
and edx, edi
sub ecx, edx
mov dword [ebp - 0xe0], ecx
mov edi, eax
mov ecx, dword [ebp - 0x74]
add ecx, eax
mov dword [ebp - 0xe4], edx
mov dword [ebp - 0xdc], ecx
cmp eax, ecx
je 0x40ea65
mov eax, dword [edi]
cmp eax, dword [ebp - 0x64]
jae 0x40ea65
add edi, dword [edi + 4]
cmp edi, ecx
jne 0x40ea57
and dword [ebp - 0xd4], 0
cmp edi, ecx
je 0x40eaa4
mov eax, dword [ebp - 0x64]
cmp dword [edi], eax
jne 0x40eaa4
mov eax, dword [edi + 4]
sub eax, 8
shr eax, 1
je 0x40eaa4
mov ecx, dword [ebp - 0xd4]
movzx ecx, word [edi + ecx*2 + 8]
and ecx, 0xfff
cmp ecx, esi
jae 0x40eaa4
inc dword [ebp - 0xd4]
cmp dword [ebp - 0xd4], eax
jne 0x40ea81
mov ecx, 0x7fffffff
mov esi, 0x13023717
cmp edi, dword [ebp - 0xdc]
je 0x40ec14
cmp dword [edi], edx
ja 0x40ec14
mov eax, dword [edi + 4]
lea edx, [eax - 8]
shr edx, 1
mov eax, dword [ebp - 0xd4]
cmp eax, edx
jne 0x40eafa
add edi, dword [edi + 4]
cmp edi, dword [ebp - 0xdc]
je 0x40ec14
mov eax, dword [ebp - 0xe4]
cmp dword [edi], eax
ja 0x40ec14
and dword [ebp - 0xd4], 0
jmp 0x40eac2
mov edx, dword [ebp - 0xe4]
cmp dword [edi], edx
jne 0x40eb20
movzx eax, word [edi + eax*2 + 8]
and eax, 0xfff
cmp eax, dword [ebp - 0xe0]
jae 0x40ec14
mov eax, dword [ebp - 0xd4]
inc dword [ebp - 0xd4]
test word [edi + eax*2 + 8], 0xf000
mov dword [ebp - 0x74], eax
je 0x40eaae
mov edx, dword [edi]
movzx eax, word [edi + eax*2 + 8]
and dword [ebp - 0x70], 0
and eax, 0xfff
lea eax, [eax + edx + 0x400000]
mov dword [ebp - 0x64], eax
sub dword [ebp - 0x64], ebx
mov dword [ebp - 0x74], eax
je 0x40eba6
mov eax, dword [ebp - 0x70]
movzx edx, byte [eax + ebx]
sub edx, esi
add dword [ebp - 0x60], edx
add edx, dword [ebp - 0x5c]
mov eax, edx
imul eax, eax, 0x5858
rol eax, 9
ror edx, 9
xor eax, edx
mov edx, 0xecfdc8e9
mul edx
lea edx, [eax + edx*2 - 0x7fffffff]
sar eax, 0x1f
and eax, ecx
sub edx, eax
mov eax, edx
sar eax, 0x1f
and eax, ecx
add eax, edx
add dword [ebp - 0x60], eax
inc dword [ebp - 0x70]
mov dword [ebp - 0x5c], eax
mov eax, dword [ebp - 0x70]
cmp eax, dword [ebp - 0x64]
jb 0x40eb58
mov eax, dword [ebp - 0x74]
mov eax, dword [eax]
sub eax, dword [ebp - 0xf4]
xor ebx, ebx
mov dword [ebp - 0xf8], eax
movzx edx, byte [ebp + ebx - 0xf8]
sub edx, esi
add dword [ebp - 0x60], edx
add edx, dword [ebp - 0x5c]
mov eax, edx
imul eax, eax, 0x5858
rol eax, 9
ror edx, 9
xor eax, edx
mov edx, 0xecfdc8e9
mul edx
lea edx, [eax + edx*2 - 0x7fffffff]
sar eax, 0x1f
and eax, ecx
sub edx, eax
mov eax, edx
sar eax, 0x1f
and eax, ecx
add eax, edx
add dword [ebp - 0x60], eax
inc ebx
cmp ebx, 4
mov dword [ebp - 0x5c], eax
jb 0x40ebb9
mov edx, dword [ebp - 0xe4]
mov ebx, dword [ebp - 0x74]
add ebx, 4
jmp 0x40eaae
xor edi, edi
mov eax, dword [ebp - 0x6c]
sub eax, ebx
mov dword [ebp - 0x6c], eax
je 0x40ec66
movzx edx, byte [edi + ebx]
sub edx, esi
add dword [ebp - 0x60], edx
add edx, dword [ebp - 0x5c]
mov eax, edx
imul eax, eax, 0x5858
rol eax, 9
ror edx, 9
xor eax, edx
mov edx, 0xecfdc8e9
mul edx
lea edx, [eax + edx*2 - 0x7fffffff]
sar eax, 0x1f
and eax, ecx
sub edx, eax
mov eax, edx
sar eax, 0x1f
and eax, ecx
add eax, edx
add dword [ebp - 0x60], eax
inc edi
cmp edi, dword [ebp - 0x6c]
mov dword [ebp - 0x5c], eax
jb 0x40ec20
xor edi, edi
xor eax, eax
mov ecx, eax
and ecx, 7
mov cl, byte [ebp + ecx - 0x60]
mov byte [ebp + eax - 0x54], cl
inc eax
cmp eax, 0x10
jb 0x40ec6a
mov eax, 0xfebae86d
mov esi, dword [ebp - 0x48]
mov eax, dword [ebp - 0x54]
mov ecx, dword [ebp - 0x50]
mov edx, dword [ebp - 0x4c]
mov dword [ebp - 0x134], eax
mov dword [ebp - 0x10c], eax
mov eax, dword [0x5294e0]
mov dword [ebp - 0x130], ecx
mov dword [ebp - 0x108], ecx
mov ecx, dword [eax]
mov dword [ebp - 0x138], ecx
mov ecx, dword [eax + 4]
mov dword [ebp - 0x124], ecx
mov ecx, dword [eax + 8]
mov eax, dword [eax + 0xc]
mov dword [ebp - 0xfc], eax
mov eax, dword [ebp - 0xc8]
mov dword [ebp - 0x110], ecx
lea ecx, [ebp - 0x44]
sub eax, ecx
mov dword [ebp - 0x64], eax
mov eax, dword [ebp - 0xd0]
sub eax, dword [ebp - 0xc8]
mov dword [ebp - 0x12c], edx
mov dword [ebp - 0x128], esi
mov dword [ebp - 0x104], edx
mov dword [ebp - 0x100], esi
mov dword [ebp - 0x120], edi
mov dword [ebp - 0x11c], edi
mov dword [ebp - 0x118], edi
mov dword [ebp - 0x114], edi
mov dword [ebp - 0x6c], eax
lea edi, [ebp - 0xbc]
lea esi, [ebp - 0x138]
push 0x10
pop ecx
rep movsd dword es:[edi], dword [esi]
mov ecx, dword [ebp - 0x9c]
mov eax, dword [ebp - 0xac]
mov edx, dword [ebp - 0x8c]
mov esi, dword [ebp - 0xbc]
mov dword [ebp - 0x74], 2
lea edi, [edx + esi]
mov ebx, dword [ebp - 0xb8]
rol edi, 7
xor eax, edi
lea edi, [esi + eax]
rol edi, 9
xor ecx, edi
lea edi, [ecx + eax]
rol edi, 0xd
xor edx, edi
lea edi, [ecx + edx]
ror edi, 0xe
xor esi, edi
mov edi, dword [ebp - 0xa8]
add ebx, edi
rol ebx, 7
xor dword [ebp - 0x98], ebx
mov ebx, dword [ebp - 0x98]
add edi, ebx
rol edi, 9
xor dword [ebp - 0x88], edi
mov edi, ebx
mov ebx, dword [ebp - 0x88]
add ebx, edi
rol ebx, 0xd
mov edi, dword [ebp - 0x88]
xor dword [ebp - 0xb8], ebx
mov ebx, dword [ebp - 0xb8]
add edi, ebx
ror edi, 0xe
mov ebx, dword [ebp - 0x94]
xor dword [ebp - 0xa8], edi
mov edi, dword [ebp - 0xa4]
add edi, ebx
rol edi, 7
xor dword [ebp - 0x84], edi
mov edi, ebx
mov ebx, dword [ebp - 0x84]
add edi, ebx
rol edi, 9
xor dword [ebp - 0xb4], edi
mov edi, ebx
mov ebx, dword [ebp - 0xb4]
add ebx, edi
mov edi, dword [ebp - 0xb4]
rol ebx, 0xd
xor dword [ebp - 0xa4], ebx
mov ebx, dword [ebp - 0xa4]
add edi, ebx
ror edi, 0xe
mov ebx, dword [ebp - 0x80]
xor dword [ebp - 0x94], edi
mov edi, dword [ebp - 0x90]
add edi, ebx
rol edi, 7
xor dword [ebp - 0xb0], edi
mov edi, ebx
mov ebx, dword [ebp - 0xb0]
add edi, ebx
rol edi, 9
xor dword [ebp - 0xa0], edi
mov edi, ebx
mov ebx, dword [ebp - 0xa0]
add ebx, edi
mov edi, dword [ebp - 0xa0]
rol ebx, 0xd
xor dword [ebp - 0x90], ebx
mov ebx, dword [ebp - 0x90]
add edi, ebx
ror edi, 0xe
xor dword [ebp - 0x80], edi
mov edi, dword [ebp - 0xb0]
add edi, esi
rol edi, 7
xor dword [ebp - 0xb8], edi
mov edi, dword [ebp - 0xb8]
add edi, esi
rol edi, 9
xor dword [ebp - 0xb4], edi
mov ebx, dword [ebp - 0xb4]
mov edi, dword [ebp - 0xb8]
add ebx, edi
mov edi, dword [ebp - 0xb4]
rol ebx, 0xd
xor dword [ebp - 0xb0], ebx
mov ebx, dword [ebp - 0xb0]
add ebx, edi
mov edi, dword [ebp - 0xa8]
add edi, eax
ror ebx, 0xe
xor esi, ebx
rol edi, 7
xor dword [ebp - 0xa4], edi
mov edi, dword [ebp - 0xa8]
mov ebx, dword [ebp - 0xa4]
add ebx, edi
mov edi, dword [ebp - 0xa4]
rol ebx, 9
xor dword [ebp - 0xa0], ebx
mov ebx, dword [ebp - 0xa0]
add ebx, edi
rol ebx, 0xd
mov edi, dword [ebp - 0xa0]
xor eax, ebx
mov ebx, dword [ebp - 0x98]
add edi, eax
ror edi, 0xe
xor dword [ebp - 0xa8], edi
mov edi, dword [ebp - 0x94]
add edi, ebx
rol edi, 7
xor dword [ebp - 0x90], edi
mov ebx, dword [ebp - 0x90]
mov edi, dword [ebp - 0x94]
add ebx, edi
mov edi, dword [ebp - 0x90]
rol ebx, 9
xor ecx, ebx
mov ebx, dword [ebp - 0x84]
add edi, ecx
rol edi, 0xd
xor dword [ebp - 0x98], edi
mov edi, dword [ebp - 0x98]
add edi, ecx
ror edi, 0xe
xor dword [ebp - 0x94], edi
mov edi, dword [ebp - 0x80]
add edi, ebx
rol edi, 7
xor edx, edi
mov edi, dword [ebp - 0x80]
add edi, edx
rol edi, 9
xor dword [ebp - 0x88], edi
mov edi, dword [ebp - 0x88]
add edi, edx
rol edi, 0xd
xor dword [ebp - 0x84], edi
mov ebx, dword [ebp - 0x84]
mov edi, dword [ebp - 0x88]
add ebx, edi
ror ebx, 0xe
xor dword [ebp - 0x80], ebx
dec dword [ebp - 0x74]
jne 0x40ed4b
mov dword [ebp - 0x8c], edx
push 0x40
mov dword [ebp - 0xac], eax
mov dword [ebp - 0x9c], ecx
mov dword [ebp - 0xbc], esi
xor edx, edx
pop ebx
xor eax, eax
mov ecx, dword [ebp + eax - 0x138]
add dword [ebp + eax - 0xbc], ecx
add eax, 4
cmp eax, ebx
jl 0x40efae
lea edi, [ebp - 0x44]
lea esi, [ebp - 0xbc]
inc dword [ebp - 0x118]
cmp dword [ebp - 0xcc], ebx
push 0x10
pop ecx
rep movsd dword es:[edi], dword [esi]
jbe 0x40f012
mov esi, dword [ebp - 0x64]
mov eax, dword [ebp - 0x6c]
lea edi, [esi + eax]
lea ecx, [ebp + edx - 0x44]
mov al, byte [ecx + edi]
xor al, byte [ecx]
xor byte [ebp - 0x55], al
mov byte [ecx + esi], al
inc edx
cmp edx, ebx
jb 0x40efe8
sub dword [ebp - 0xcc], ebx
add dword [ebp - 0x68], ebx
add esi, ebx
add dword [ebp - 0x78], ebx
mov dword [ebp - 0x64], esi
jmp 0x40ed1b
cmp dword [ebp - 0xcc], edx
jbe 0x40f03f
mov esi, dword [ebp - 0x78]
lea eax, [ebp - 0x44]
mov edi, dword [ebp - 0x68]
sub esi, eax
sub edi, eax
lea ecx, [ebp + edx - 0x44]
mov al, byte [ecx + esi]
xor al, byte [ecx]
xor byte [ebp - 0x55], al
inc edx
cmp edx, dword [ebp - 0xcc]
mov byte [ecx + edi], al
jb 0x40f027
mov edi, 0xfffff000
mov ebx, dword [ebp - 0xc4]
mov esi, 0x400000
mov eax, dword [ebp - 0xc0]
mov al, byte [eax + 8]
xor al, byte [ebp - 0x55]
je 0x40f0ea
call fcn.004a5a28
mov edx, 0xffff
mov ebx, eax
mov eax, dword [ebp - 0xe8]
lea ecx, [eax + 0xc]
and ecx, 0xfffffffc
lea esi, [ecx + 0xfff]
mov dword [eax + 8], 0x4b3c5b
and ebx, edi
and esi, edi
xor eax, eax
mov edi, dword [0x51b214]
imul edi, edi, 0x343fd
add edi, 0x269ec3
mov dword [0x51b214], edi
shr edi, 0x10
shl eax, 0x10
or eax, edi
shr edx, 0x10
jne 0x40f08c
xor edx, edx
mov edi, 0xffff
div edi
mov dword [ebp - 0x150], ebx
inc edx
mov dword [ebp - 0x144], edx
mov dword [ebp - 0x6c], 0
mov eax, ecx
cmp ecx, esi
jae 0x40f0e0
mov ecx, dword [ebp - 0x6c]
mov dword [eax], ecx
add eax, 4
cmp eax, esi
jb 0x40f0d4
mov eax, 0x4b3c5b
jmp 0x40f1d5
mov eax, dword [ebp - 0xd0]
mov ecx, dword [0x402600]
sub eax, dword [ebp - 0xc8]
mov dword [ebp - 0xc4], eax
sub esi, ecx
mov dword [ebp - 0xc0], esi
jne 0x40f114
test eax, eax
je 0x40f1c5
mov esi, dword [ebp - 0xc8]
mov eax, dword [ebp - 0x7c]
mov ecx, dword [0x4bebb0]
sub esi, dword [ebp - 0xd0]
add eax, ebx
mov dword [ebp - 0x6c], eax
xor ebx, ebx
dec ecx
js 0x40f15b
lea eax, [ebx + ecx]
cdq
sub eax, edx
sar eax, 1
mov edx, dword [eax*4 + 0x4bebb4]
and edx, 0xfffffff
cmp dword [ebp - 0x7c], edx
jae 0x40f152
lea ecx, [eax - 1]
jmp 0x40f157
jbe 0x40f15f
lea ebx, [eax + 1]
cmp ecx, ebx
jge 0x40f133
mov edi, ebx
jmp 0x40f1bd
mov edi, eax
jmp 0x40f1bd
mov eax, dword [edi*4 + 0x4bebb4]
mov ecx, eax
and ecx, 0xfffffff
cmp ecx, dword [ebp - 0x6c]
jae 0x40f1c5
lea ebx, [ecx + esi + 0x400000]
mov ecx, eax
shl ecx, 2
sar ecx, 0x1e
sar eax, 0x1e
and ecx, 3
and eax, 3
xor edx, edx
dec ecx
je 0x40f1aa
dec ecx
je 0x40f1a2
dec ecx
jne 0x40f1b6
mov edx, dword [ebp - 0xc0]
jmp 0x40f1b6
mov edx, dword [ebp - 0xc4]
jmp 0x40f1b6
mov edx, dword [ebp - 0xc0]
sub edx, dword [ebp - 0xc4]
dec eax
dec eax
jne 0x40f1bc
add dword [ebx], edx
inc edi
cmp edi, dword [0x4bebb0]
jb 0x40f163
mov eax, dword [0x4c7398]
mov eax, 0xbf835487
mov eax, dword [ebp - 0xc8]
mov ecx, dword [ebp - 0xe8]
mov dword [ecx + 8], eax
mov ebx, dword [ebp - 0x148]
mov edi, dword [ebp - 0x140]
mov edx, dword [ebp - 0x150]
mov ecx, dword [ebp - 0x144]
mov eax, dword [ebp - 0x14c]
mov esi, dword [ebp - 0x13c]
mov esp, ebp
pop ebp
popfd
ret