Function at 0x1012975
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, 0x120
mov dword [ebp - 0x118], eax
mov dword [ebp - 0x110], ecx
lea eax, [ebp + 4]
mov dword [ebp - 0x11c], edx
mov dword [ebp - 0x114], ebx
mov dword [ebp - 0x120], esi
mov dword [ebp - 0x10c], edi
mov esi, dword [eax + 4]
sub eax, 4
mov ebx, dword [0x10d4588]
mov dword [ebp - 0xc0], eax
mov eax, dword [esi + 4]
and eax, 0xfffffff
xor edx, edx
lea ecx, [ebx + eax - 1]
mov eax, ecx
div ebx
mov eax, dword [0x10d4588]
sub ecx, edx
mov dword [ebp - 0x68], ecx
mov eax, dword [0x10f17c8]
mov dword [ebp - 0x60], eax
mov eax, dword [0x10d4588]
mov eax, dword [0x10f17c8]
test eax, eax
je 0x1012a67
mov eax, dword [0x10f17c8]
xor edi, edi
dec eax
lea ecx, [eax + 1]
mov edx, ecx
xor eax, eax
test ecx, ecx
je 0x1012a24
mov ebx, dword [0x113b250]
imul ebx, ebx, 0x343fd
add ebx, 0x269ec3
mov dword [0x113b250], ebx
shr ebx, 0x10
shl eax, 0x10
shr edx, 0x10
or eax, ebx
test edx, edx
jne 0x10129fd
xor edx, edx
div ecx
cmp dword [ebp - 0x60], 0
jbe 0x1012a61
inc edi
mov ecx, 0xffffdc52
lea ebx, [edx*4 + 0x113b06c]
mov eax, 0x23ad
lock cmpxchg dword [ebx], ecx
cmp eax, 0x23ad
je 0x1012ee5
lea eax, [edx + 1]
xor edx, edx
mov ecx, dword [0x10f17c8]
div ecx
cmp edi, dword [ebp - 0x60]
jb 0x1012a2e
xor edi, edi
test edi, edi
jne 0x1012add
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ebx, eax
xor edi, edi
push 0x40
inc edi
push 0x1000
push dword [ebp - 0x68]
push 0
call dword [sym.imp.KERNEL32.dll_VirtualAlloc]
test eax, eax
jne 0x1012ef9
push eax
call dword [sym.imp.KERNEL32.dll_Sleep]
cmp edi, 0x11
jb 0x1012a71
xor edi, edi
cmp edi, 0x10000
jb 0x1012aaa
test edi, 3
je 0x1012abe
test edi, edi
je 0x1012abc
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 0x10129d4
mov ecx, dword [ebp - 0x68]
mov eax, edi
test ecx, ecx
je 0x1012add
mov byte [eax], 0
inc eax
dec ecx
jne 0x1012ad6
mov eax, 0xca174572
mov eax, dword [esi]
shr eax, 2
and eax, 7
lea ebx, [eax + esi + 8]
mov esi, dword [esi + 4]
and esi, 0xfffffff
lea eax, [esi + ebx]
mov dword [ebp - 0xac], eax
mov eax, dword [0x10d4588]
sub eax, esi
lea ecx, [eax + 1]
mov dword [ebp - 0x64], ebx
sub dword [ebp - 0x64], 0x1000000
xor eax, eax
mov dword [ebp - 0xb0], ebx
test ecx, ecx
mov dword [ebp - 0xbc], esi
mov dword [ebp - 0x5c], ecx
je 0x1012b53
mov edx, dword [0x113b250]
shr dword [ebp - 0x5c], 0x10
imul edx, edx, 0x343fd
add edx, 0x269ec3
mov dword [0x113b250], edx
shr edx, 0x10
shl eax, 0x10
or eax, edx
cmp dword [ebp - 0x5c], 0
jne 0x1012b29
xor edx, edx
div ecx
add edi, edx
push esi
mov eax, edi
push dword [ebp - 0x64]
mov dword [ebp - 0x5c], edi
mov eax, 0x50efdf22
pop ecx
test esi, esi
pop ecx
mov byte [ebp - 0x55], 0
mov dword [ebp - 0xb8], esi
mov dword [ebp - 0x68], ebx
mov dword [ebp - 0x60], edi
je 0x1012f39
mov esi, dword [ebp - 0xac]
lea edi, [ebp - 0x54]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
mov eax, dword [ebp - 0x54]
mov esi, dword [ebp - 0x48]
mov edx, dword [ebp - 0x4c]
mov ecx, dword [ebp - 0x50]
mov dword [ebp - 0x104], eax
mov dword [ebp - 0xdc], eax
xor eax, eax
mov dword [ebp - 0xf0], eax
mov dword [ebp - 0xec], eax
mov dword [ebp - 0xe8], eax
mov dword [ebp - 0xe4], eax
mov eax, dword [0x1009a74]
mov dword [ebp - 0x108], eax
mov eax, dword [0x1009a78]
mov dword [ebp - 0xf4], eax
mov eax, dword [0x1009a7c]
mov dword [ebp - 0xe0], eax
mov eax, dword [0x1009a80]
mov dword [ebp - 0xcc], eax
mov eax, dword [ebp - 0x5c]
mov dword [ebp - 0x100], ecx
mov dword [ebp - 0xd8], ecx
lea ecx, [ebp - 0x44]
sub eax, ecx
sub ebx, dword [ebp - 0x5c]
mov dword [ebp - 0xfc], edx
mov dword [ebp - 0xf8], esi
mov dword [ebp - 0xd4], edx
mov dword [ebp - 0xd0], esi
mov dword [ebp - 0xc8], eax
mov dword [ebp - 0xb4], ebx
push 0x10
lea edi, [ebp - 0xa8]
pop ecx
lea esi, [ebp - 0x108]
rep movsd dword es:[edi], dword [esi]
mov esi, dword [ebp - 0xa8]
mov ecx, dword [ebp - 0x88]
mov edx, dword [ebp - 0x78]
mov eax, dword [ebp - 0x98]
mov dword [ebp - 0xc4], 3
lea edi, [edx + esi]
mov ebx, dword [ebp - 0xa4]
rol edi, 7
xor eax, edi
lea edi, [esi + eax]
rol edi, 9
xor ecx, edi
lea edi, [eax + ecx]
rol edi, 0xd
xor edx, edi
lea edi, [ecx + edx]
ror edi, 0xe
xor esi, edi
mov edi, dword [ebp - 0x94]
add ebx, edi
rol ebx, 7
xor dword [ebp - 0x84], ebx
mov ebx, dword [ebp - 0x84]
add edi, ebx
rol edi, 9
xor dword [ebp - 0x74], edi
mov edi, ebx
mov ebx, dword [ebp - 0x74]
add ebx, edi
rol ebx, 0xd
mov edi, dword [ebp - 0x74]
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 - 0x70], edi
mov edi, ebx
mov ebx, dword [ebp - 0x70]
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
mov ebx, dword [ebp - 0x6c]
ror edi, 0xe
xor dword [ebp - 0x80], edi
mov edi, dword [ebp - 0x7c]
add edi, ebx
rol edi, 7
xor dword [ebp - 0x9c], edi
mov edi, ebx
mov ebx, dword [ebp - 0x9c]
add edi, ebx
rol edi, 9
xor dword [ebp - 0x8c], edi
mov edi, ebx
mov ebx, dword [ebp - 0x8c]
add ebx, edi
mov edi, dword [ebp - 0x8c]
rol ebx, 0xd
xor dword [ebp - 0x7c], ebx
mov ebx, dword [ebp - 0x7c]
add edi, ebx
ror edi, 0xe
xor dword [ebp - 0x6c], edi
mov edi, dword [ebp - 0x9c]
add edi, esi
rol edi, 7
xor dword [ebp - 0xa4], edi
mov edi, dword [ebp - 0xa4]
add edi, esi
rol edi, 9
xor dword [ebp - 0xa0], edi
mov edi, dword [ebp - 0xa4]
mov ebx, dword [ebp - 0xa0]
add ebx, edi
mov edi, dword [ebp - 0xa0]
rol ebx, 0xd
xor dword [ebp - 0x9c], ebx
mov ebx, dword [ebp - 0x9c]
add ebx, edi
mov edi, dword [ebp - 0x94]
add edi, eax
ror ebx, 0xe
xor esi, ebx
rol edi, 7
xor dword [ebp - 0x90], edi
mov edi, dword [ebp - 0x94]
mov ebx, dword [ebp - 0x90]
add ebx, edi
mov edi, dword [ebp - 0x90]
rol ebx, 9
xor dword [ebp - 0x8c], ebx
mov ebx, dword [ebp - 0x8c]
add ebx, edi
mov edi, dword [ebp - 0x8c]
rol ebx, 0xd
xor eax, ebx
mov ebx, dword [ebp - 0x84]
add edi, eax
ror edi, 0xe
xor dword [ebp - 0x94], edi
mov edi, dword [ebp - 0x80]
add edi, ebx
rol edi, 7
xor dword [ebp - 0x7c], edi
mov edi, dword [ebp - 0x80]
mov ebx, dword [ebp - 0x7c]
add ebx, edi
rol ebx, 9
xor ecx, ebx
mov edi, dword [ebp - 0x7c]
mov ebx, dword [ebp - 0x70]
add edi, ecx
rol edi, 0xd
xor dword [ebp - 0x84], edi
mov edi, dword [ebp - 0x84]
add edi, ecx
ror edi, 0xe
xor dword [ebp - 0x80], edi
mov edi, dword [ebp - 0x6c]
add edi, ebx
rol edi, 7
xor edx, edi
mov edi, dword [ebp - 0x6c]
add edi, edx
rol edi, 9
xor dword [ebp - 0x74], edi
mov edi, dword [ebp - 0x74]
add edi, edx
rol edi, 0xd
xor dword [ebp - 0x70], edi
mov edi, dword [ebp - 0x74]
mov ebx, dword [ebp - 0x70]
add ebx, edi
ror ebx, 0xe
xor dword [ebp - 0x6c], ebx
dec dword [ebp - 0xc4]
jne 0x1012c57
mov dword [ebp - 0x78], edx
push 0x40
xor edx, edx
mov dword [ebp - 0x98], eax
xor eax, eax
mov dword [ebp - 0x88], ecx
mov dword [ebp - 0xa8], esi
pop ebx
mov ecx, dword [ebp + eax - 0x108]
add dword [ebp + eax - 0xa8], ecx
add eax, 4
cmp eax, ebx
jl 0x1012e78
lea edi, [ebp - 0x44]
lea esi, [ebp - 0xa8]
inc dword [ebp - 0xe8]
push 0x10
pop ecx
rep movsd dword es:[edi], dword [esi]
cmp dword [ebp - 0xb8], ebx
jbe 0x1012f00
mov eax, dword [ebp - 0xb4]
mov esi, dword [ebp - 0xc8]
lea edi, [esi + eax]
lea ecx, [ebp + edx - 0x44]
mov al, byte [edi + ecx]
xor al, byte [ecx]
xor byte [ebp - 0x55], al
inc edx
cmp edx, ebx
mov byte [esi + ecx], al
jb 0x1012eb8
sub dword [ebp - 0xb8], ebx
add dword [ebp - 0x60], ebx
add esi, ebx
add dword [ebp - 0x68], ebx
mov dword [ebp - 0xc8], esi
jmp 0x1012c27
mov edi, dword [0x10d4588]
imul edi, edx
lea edi, [edi + 0x1109044]
jmp 0x1012a63
mov edi, eax
jmp 0x1012a9a
cmp dword [ebp - 0xb8], edx
jbe 0x1012f2d
mov edi, dword [ebp - 0x60]
lea eax, [ebp - 0x44]
mov esi, dword [ebp - 0x68]
sub esi, eax
sub edi, eax
lea ecx, [ebp + edx - 0x44]
mov al, byte [esi + ecx]
xor al, byte [ecx]
xor byte [ebp - 0x55], al
inc edx
mov byte [edi + ecx], al
cmp edx, dword [ebp - 0xb8]
jb 0x1012f15
mov esi, dword [ebp - 0xbc]
mov ebx, dword [ebp - 0xb0]
movzx ecx, byte [ebp - 0x55]
mov eax, dword [ebp - 0xac]
movzx eax, byte [eax + 0x10]
sub ecx, eax
je 0x1012fe9
lea ebp, [ebp - 0x63b27828]
call fcn.01020e87
mov ebx, eax
mov eax, 0xfffff000
mov edx, dword [ebp - 0xc0]
lea ecx, [edx + 0xc]
and ecx, 0xfffffffc
and ebx, eax
lea esi, [ecx + 0xfff]
and esi, eax
mov dword [edx + 8], 0x10fe507
mov edx, 0xffff
xor eax, eax
mov edi, dword [0x113b250]
imul edi, edi, 0x343fd
add edi, 0x269ec3
mov dword [0x113b250], edi
shr edi, 0x10
shl eax, 0x10
shr edx, 0x10
or eax, edi
test edx, edx
jne 0x1012f85
mov edi, 0xffff
div edi
mov dword [ebp - 0x11c], ebx
inc edx
cmp ecx, esi
mov dword [ebp - 0x110], edx
mov eax, ecx
mov dword [ebp - 0xb4], 0
jae 0x1012fdf
mov ecx, dword [ebp - 0xb4]
mov dword [eax], ecx
add eax, 4
cmp eax, esi
jb 0x1012fd0
mov eax, 0x10fe507
jmp 0x10130cd
mov ecx, 0x1000000
mov eax, ebx
mov edx, dword [0x100b3f0]
mov edi, dword [ebp - 0x5c]
sub eax, edi
mov dword [ebp - 0xb0], eax
sub ecx, edx
mov dword [ebp - 0xac], ecx
jne 0x1013013
test eax, eax
je 0x10130c0
sub edi, ebx
mov eax, dword [ebp - 0x64]
add eax, esi
xor ebx, ebx
mov ecx, dword [0x10b82b8]
mov dword [ebp - 0xb4], eax
dec ecx
js 0x1013053
lea eax, [ecx + ebx]
cdq
sub eax, edx
sar eax, 1
mov edx, dword [eax*4 + 0x10b82bc]
and edx, 0xfffffff
cmp dword [ebp - 0x64], edx
jae 0x101304a
lea ecx, [eax - 1]
jmp 0x101304f
jbe 0x1013057
lea ebx, [eax + 1]
cmp ecx, ebx
jge 0x101302b
mov esi, ebx
jmp 0x10130b8
mov esi, eax
jmp 0x10130b8
mov eax, dword [esi*4 + 0x10b82bc]
mov ecx, eax
and ecx, 0xfffffff
cmp ecx, dword [ebp - 0xb4]
jae 0x10130c0
lea edx, [ecx + edi + 0x1000000]
mov ecx, eax
shl ecx, 2
sar ecx, 0x1e
sar eax, 0x1e
and ecx, 3
and eax, 3
xor ebx, ebx
dec ecx
je 0x10130a5
dec ecx
je 0x101309d
dec ecx
jne 0x10130b1
mov ebx, dword [ebp - 0xac]
jmp 0x10130b1
mov ebx, dword [ebp - 0xb0]
jmp 0x10130b1
mov ebx, dword [ebp - 0xac]
sub ebx, dword [ebp - 0xb0]
dec eax
dec eax
jne 0x10130b7
add dword [edx], ebx
inc esi
cmp esi, dword [0x10b82b8]
jb 0x101305b
mov eax, dword [0x10d4588]
mov eax, 0x11643b43
mov eax, dword [ebp - 0x5c]
mov ecx, dword [ebp - 0xc0]
mov dword [ecx + 8], eax
mov edi, dword [ebp - 0x10c]
mov ebx, dword [ebp - 0x114]
mov eax, dword [ebp - 0x118]
mov esi, dword [ebp - 0x120]
mov ecx, dword [ebp - 0x110]
mov edx, dword [ebp - 0x11c]
mov esp, ebp
pop ebp
popfd
ret