Function at 0x497958
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
lea eax, [ebp + 4]
mov dword [ebp - 0x144], ecx
mov dword [ebp - 0x150], edx
mov dword [ebp - 0x148], ebx
mov dword [ebp - 0x13c], esi
mov dword [ebp - 0x140], edi
mov edi, dword [0x4c7398]
mov esi, dword [eax + 4]
sub eax, 4
mov dword [ebp - 0xd4], eax
mov eax, dword [esi]
and eax, 0xfffffff
xor edx, edx
lea ecx, [edi + eax - 1]
mov eax, ecx
div edi
sub ecx, edx
mov eax, dword [0x4c7398]
mov dword [ebp - 0x70], ecx
mov eax, dword [0x403ef8]
mov dword [ebp - 0x68], eax
mov eax, dword [0x4c7398]
mov eax, dword [0x403ef8]
test eax, eax
je 0x497a47
mov eax, dword [0x403ef8]
xor edi, edi
dec eax
lea ecx, [eax + 1]
mov edx, ecx
xor eax, eax
test ecx, ecx
je 0x497a04
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 0x4979df
xor edx, edx
div ecx
cmp dword [ebp - 0x68], 0
jbe 0x497a41
mov eax, 0x3c6f
inc edi
lea ebx, [edx*4 + 0x529524]
mov ecx, 0xffffc390
lock cmpxchg dword [ebx], ecx
cmp eax, 0x3c6f
je 0x497c0f
mov ecx, dword [0x403ef8]
lea eax, [edx + 1]
xor edx, edx
div ecx
cmp edi, dword [ebp - 0x68]
jb 0x497a0e
xor edi, edi
test edi, edi
jne 0x497abd
call dword [sym.imp.kernel32.dll_GetLastError]
mov ebx, eax
xor edi, edi
inc edi
push 0x40
push 0x1000
push dword [ebp - 0x70]
push 0
call dword [sym.imp.kernel32.dll_VirtualAlloc]
test eax, eax
jne 0x497c23
push eax
call dword [sym.imp.kernel32.dll_Sleep]
cmp edi, 0x11
jb 0x497a51
xor edi, edi
cmp dword [0x51b2c4], edi
ja 0x497a8a
test edi, 3
je 0x497a9e
test edi, edi
je 0x497a9c
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 0x4979b6
mov ecx, dword [ebp - 0x70]
test ecx, ecx
mov eax, edi
je 0x497abd
mov byte [eax], 0
inc eax
dec ecx
jne 0x497ab6
mov eax, 0xb16c3685
mov ebx, dword [esi]
mov eax, ebx
shr eax, 0x1d
and ebx, 0xfffffff
lea eax, [eax + esi + 8]
mov dword [ebp - 0x74], eax
mov esi, 0x400000
mov dword [ebp - 0xcc], eax
lea ecx, [ebx + eax]
mov eax, dword [0x4c7398]
sub eax, ebx
mov dword [ebp - 0xb8], ecx
sub dword [ebp - 0x74], esi
mov dword [ebp - 0xc0], ebx
lea ecx, [eax + 1]
mov dword [ebp - 0x68], ecx
xor eax, eax
test ecx, ecx
je 0x497b2c
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 0x497b06
xor edx, edx
div ecx
add edi, edx
push edi
push ebx
push dword [ebp - 0x74]
mov dword [ebp - 0xc4], edi
mov eax, 0x95624187
mov eax, dword [ebp - 0xb8]
mov ecx, dword [eax]
mov eax, dword [eax + 4]
mov dword [ebp - 0xec], eax
mov eax, dword [ebp - 0xcc]
add esp, 0xc
test ebx, ebx
mov dword [ebp - 0x68], edi
mov edi, 0xfffff000
mov dword [ebp - 0xf0], ecx
mov byte [ebp - 0x55], 0
mov dword [ebp - 0xbc], ebx
mov dword [ebp - 0x70], eax
je 0x498216
lea eax, [ebp - 0xf0]
push eax
mov eax, 0xe990e6b5
mov ebx, dword [ebp - 0xf0]
and dword [ebp - 0x60], 0
mov eax, 0xfffffff
and dword [ebp - 0x5c], 0
pop ecx
mov ecx, dword [ebp - 0xec]
and ecx, eax
and ebx, eax
add ebx, esi
mov dword [ebp - 0x64], ecx
mov ecx, dword [0x402600]
mov eax, esi
sub eax, ecx
mov dword [ebp - 0xf4], eax
jne 0x497c2a
xor edx, edx
cmp dword [ebp - 0x64], edx
jbe 0x497e45
mov edi, 0x2f8c177
movzx ecx, byte [edx + ebx]
sub ecx, edi
add dword [ebp - 0x60], ecx
add ecx, dword [ebp - 0x5c]
mov eax, ecx
imul eax, eax, 0x5749
rol eax, 9
ror ecx, 9
xor eax, ecx
imul eax, eax, 0xfd073e89
ror eax, 9
imul eax, eax, 0xfd073e89
ror eax, 9
add dword [ebp - 0x60], eax
inc edx
cmp edx, dword [ebp - 0x64]
mov dword [ebp - 0x5c], eax
jb 0x497bd0
jmp 0x497e45
mov edi, dword [0x4c7398]
imul edi, edx
lea edi, [edi + section..data]
jmp 0x497a43
mov edi, eax
jmp 0x497a7a
mov ecx, ebx
mov eax, dword [ebp - 0x64]
mov edx, dword [0x40003c]
lea edx, [edx + 0x4000a0]
add eax, ebx
mov dword [ebp - 0x6c], eax
mov eax, dword [edx]
mov edx, dword [edx + 4]
mov dword [ebp - 0xc8], edx
add eax, esi
sub ecx, esi
mov esi, ecx
mov edx, ecx
and edx, edi
sub esi, edx
mov dword [ebp - 0xd0], esi
mov esi, dword [ebp - 0x64]
add ecx, esi
mov esi, ecx
and esi, edi
sub ecx, esi
mov dword [ebp - 0xe4], ecx
mov ecx, dword [ebp - 0xc8]
add ecx, eax
cmp eax, ecx
mov dword [ebp - 0xe8], esi
mov dword [ebp - 0xe0], ecx
mov esi, eax
je 0x497c97
cmp dword [esi], edx
jae 0x497c97
add esi, dword [esi + 4]
cmp esi, dword [ebp - 0xe0]
jne 0x497c88
xor ecx, ecx
cmp esi, dword [ebp - 0xe0]
je 0x497cc7
cmp dword [esi], edx
jne 0x497cc7
mov eax, dword [esi + 4]
sub eax, 8
shr eax, 1
je 0x497cc7
movzx edx, word [esi + ecx*2 + 8]
and edx, 0xfff
cmp edx, dword [ebp - 0xd0]
jae 0x497cc7
inc ecx
cmp ecx, eax
jne 0x497caf
mov edi, 0x2f8c177
cmp esi, dword [ebp - 0xe0]
je 0x497e03
mov eax, dword [ebp - 0xe8]
cmp dword [esi], eax
ja 0x497e03
mov eax, dword [esi + 4]
lea edx, [eax - 8]
shr edx, 1
cmp ecx, edx
jne 0x497d12
add esi, eax
cmp esi, dword [ebp - 0xe0]
je 0x497e03
mov eax, dword [ebp - 0xe8]
cmp dword [esi], eax
ja 0x497e03
xor ecx, ecx
jmp 0x497ce6
mov eax, dword [esi]
cmp eax, dword [ebp - 0xe8]
jne 0x497d32
movzx eax, word [esi + ecx*2 + 8]
and eax, 0xfff
cmp eax, dword [ebp - 0xe4]
jae 0x497e03
mov eax, ecx
inc ecx
test word [esi + eax*2 + 8], 0xf000
mov dword [ebp - 0xd8], ecx
je 0x497ccc
mov ecx, dword [esi]
movzx eax, word [esi + eax*2 + 8]
and eax, 0xfff
lea eax, [eax + ecx + 0x400000]
mov dword [ebp - 0x64], eax
xor ecx, ecx
sub dword [ebp - 0x64], ebx
mov dword [ebp - 0xd0], eax
je 0x497da1
movzx edx, byte [ecx + ebx]
sub edx, edi
add dword [ebp - 0x60], edx
add edx, dword [ebp - 0x5c]
mov eax, edx
imul eax, eax, 0x5749
rol eax, 9
ror edx, 9
xor eax, edx
imul eax, eax, 0xfd073e89
ror eax, 9
imul eax, eax, 0xfd073e89
ror eax, 9
add dword [ebp - 0x60], eax
inc ecx
cmp ecx, dword [ebp - 0x64]
mov dword [ebp - 0x5c], eax
jb 0x497d67
mov ebx, dword [ebp - 0xd0]
mov eax, dword [ebx]
sub eax, dword [ebp - 0xf4]
xor ecx, ecx
mov dword [ebp - 0xf8], eax
movzx edx, byte [ebp + ecx - 0xf8]
sub edx, edi
add dword [ebp - 0x60], edx
add edx, dword [ebp - 0x5c]
mov eax, edx
imul eax, eax, 0x5749
rol eax, 9
ror edx, 9
xor eax, edx
imul eax, eax, 0xfd073e89
ror eax, 9
imul eax, eax, 0xfd073e89
ror eax, 9
add dword [ebp - 0x60], eax
inc ecx
cmp ecx, 4
mov dword [ebp - 0x5c], eax
jb 0x497db7
mov ecx, dword [ebp - 0xd8]
add ebx, 4
jmp 0x497ccc
mov esi, dword [ebp - 0x6c]
xor edx, edx
sub esi, ebx
je 0x497e45
movzx ecx, byte [edx + ebx]
sub ecx, edi
add dword [ebp - 0x60], ecx
add ecx, dword [ebp - 0x5c]
mov eax, ecx
imul eax, eax, 0x5749
rol eax, 9
ror ecx, 9
xor eax, ecx
imul eax, eax, 0xfd073e89
ror eax, 9
imul eax, eax, 0xfd073e89
ror eax, 9
add dword [ebp - 0x60], eax
mov dword [ebp - 0x5c], eax
inc edx
cmp edx, esi
jb 0x497e0c
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 0x497e49
mov eax, 0xb4ac2c6
mov ecx, dword [ebp - 0x50]
mov edx, dword [ebp - 0x4c]
mov esi, dword [ebp - 0x48]
mov eax, dword [ebp - 0x54]
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 - 0xc4]
mov dword [ebp - 0x110], ecx
lea ecx, [ebp - 0x44]
sub eax, ecx
mov dword [ebp - 0xc8], eax
mov eax, dword [ebp - 0xcc]
sub eax, dword [ebp - 0xc4]
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 - 0xb4]
push 0x10
lea esi, [ebp - 0x138]
pop ecx
rep movsd dword es:[edi], dword [esi]
mov eax, dword [ebp - 0xa4]
mov edx, dword [ebp - 0x84]
mov esi, dword [ebp - 0xb4]
mov ecx, dword [ebp - 0x94]
mov dword [ebp - 0x64], 2
mov ebx, dword [ebp - 0xb0]
lea edi, [edx + esi]
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 - 0xa0]
add ebx, edi
rol ebx, 7
xor dword [ebp - 0x90], ebx
mov ebx, dword [ebp - 0x90]
add edi, ebx
rol edi, 9
xor dword [ebp - 0x80], edi
mov edi, ebx
mov ebx, dword [ebp - 0x80]
add ebx, edi
rol ebx, 0xd
mov edi, dword [ebp - 0x80]
xor dword [ebp - 0xb0], ebx
mov ebx, dword [ebp - 0xb0]
add edi, ebx
ror edi, 0xe
mov ebx, dword [ebp - 0x8c]
xor dword [ebp - 0xa0], edi
mov edi, dword [ebp - 0x9c]
add edi, ebx
rol edi, 7
xor dword [ebp - 0x7c], edi
mov edi, ebx
mov ebx, dword [ebp - 0x7c]
add edi, ebx
rol edi, 9
xor dword [ebp - 0xac], edi
mov edi, ebx
mov ebx, dword [ebp - 0xac]
add ebx, edi
rol ebx, 0xd
mov edi, dword [ebp - 0xac]
xor dword [ebp - 0x9c], ebx
mov ebx, dword [ebp - 0x9c]
add edi, ebx
mov ebx, dword [ebp - 0x78]
ror edi, 0xe
xor dword [ebp - 0x8c], edi
mov edi, dword [ebp - 0x88]
add edi, ebx
rol edi, 7
xor dword [ebp - 0xa8], edi
mov edi, ebx
mov ebx, dword [ebp - 0xa8]
add edi, ebx
rol edi, 9
xor dword [ebp - 0x98], edi
mov edi, ebx
mov ebx, dword [ebp - 0x98]
add ebx, edi
mov edi, dword [ebp - 0x98]
rol ebx, 0xd
xor dword [ebp - 0x88], ebx
mov ebx, dword [ebp - 0x88]
add edi, ebx
ror edi, 0xe
xor dword [ebp - 0x78], edi
mov edi, dword [ebp - 0xa8]
add edi, esi
rol edi, 7
xor dword [ebp - 0xb0], edi
mov edi, dword [ebp - 0xb0]
add edi, esi
rol edi, 9
xor dword [ebp - 0xac], edi
mov edi, dword [ebp - 0xb0]
mov ebx, dword [ebp - 0xac]
add ebx, edi
mov edi, dword [ebp - 0xac]
rol ebx, 0xd
xor dword [ebp - 0xa8], ebx
mov ebx, dword [ebp - 0xa8]
add ebx, edi
mov edi, dword [ebp - 0xa0]
add edi, eax
ror ebx, 0xe
xor esi, ebx
rol edi, 7
xor dword [ebp - 0x9c], edi
mov edi, dword [ebp - 0xa0]
mov ebx, dword [ebp - 0x9c]
add ebx, edi
rol ebx, 9
mov edi, dword [ebp - 0x9c]
xor dword [ebp - 0x98], ebx
mov ebx, dword [ebp - 0x98]
add ebx, edi
mov edi, dword [ebp - 0x98]
rol ebx, 0xd
xor eax, ebx
add edi, eax
mov ebx, dword [ebp - 0x90]
ror edi, 0xe
xor dword [ebp - 0xa0], edi
mov edi, dword [ebp - 0x8c]
add edi, ebx
rol edi, 7
xor dword [ebp - 0x88], edi
mov ebx, dword [ebp - 0x88]
mov edi, dword [ebp - 0x8c]
add ebx, edi
rol ebx, 9
xor ecx, ebx
mov ebx, dword [ebp - 0x7c]
mov edi, dword [ebp - 0x88]
add edi, ecx
rol edi, 0xd
xor dword [ebp - 0x90], edi
mov edi, dword [ebp - 0x90]
add edi, ecx
ror edi, 0xe
xor dword [ebp - 0x8c], edi
mov edi, dword [ebp - 0x78]
add edi, ebx
rol edi, 7
xor edx, edi
mov edi, dword [ebp - 0x78]
add edi, edx
rol edi, 9
xor dword [ebp - 0x80], edi
mov edi, dword [ebp - 0x80]
add edi, edx
rol edi, 0xd
xor dword [ebp - 0x7c], edi
mov edi, dword [ebp - 0x80]
mov ebx, dword [ebp - 0x7c]
add ebx, edi
ror ebx, 0xe
xor dword [ebp - 0x78], ebx
dec dword [ebp - 0x64]
jne 0x497f2d
mov dword [ebp - 0x84], edx
xor edx, edx
push 0x40
mov dword [ebp - 0xa4], eax
xor eax, eax
mov dword [ebp - 0x94], ecx
mov dword [ebp - 0xb4], esi
pop ebx
mov ecx, dword [ebp + eax - 0x138]
add dword [ebp + eax - 0xb4], ecx
add eax, 4
cmp eax, ebx
jl 0x49816f
lea esi, [ebp - 0xb4]
inc dword [ebp - 0x118]
cmp dword [ebp - 0xbc], ebx
push 0x10
lea edi, [ebp - 0x44]
pop ecx
rep movsd dword es:[edi], dword [esi]
jbe 0x4981d9
mov eax, dword [ebp - 0x6c]
mov esi, dword [ebp - 0xc8]
lea edi, [esi + eax]
lea ecx, [ebp + edx - 0x44]
mov al, byte [ecx + edi]
xor al, byte [ecx]
xor byte [ebp - 0x55], al
inc edx
mov byte [ecx + esi], al
cmp edx, ebx
jb 0x4981ac
sub dword [ebp - 0xbc], ebx
add dword [ebp - 0x68], ebx
add esi, ebx
add dword [ebp - 0x70], ebx
mov dword [ebp - 0xc8], esi
jmp 0x497efd
cmp dword [ebp - 0xbc], edx
jbe 0x498206
mov edi, dword [ebp - 0x68]
mov esi, dword [ebp - 0x70]
lea eax, [ebp - 0x44]
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 - 0xbc]
mov byte [ecx + edi], al
jb 0x4981ee
mov ebx, dword [ebp - 0xc0]
mov edi, 0xfffff000
mov esi, 0x400000
mov eax, dword [ebp - 0xb8]
mov al, byte [eax + 8]
xor al, byte [ebp - 0x55]
je 0x4982b1
call fcn.004a46e1
mov ebx, eax
mov edx, 0xffff
mov eax, dword [ebp - 0xd4]
mov dword [eax + 8], 0x4b3c5b
lea ecx, [eax + 0xc]
and ecx, 0xfffffffc
and ebx, edi
lea esi, [ecx + 0xfff]
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 0x498253
xor edx, edx
mov edi, 0xffff
div edi
mov eax, ecx
inc edx
cmp ecx, esi
mov dword [ebp - 0x150], ebx
mov dword [ebp - 0x144], edx
mov dword [ebp - 0x6c], 0
jae 0x4982a7
mov ecx, dword [ebp - 0x6c]
mov dword [eax], ecx
add eax, 4
cmp eax, esi
jb 0x49829b
mov eax, 0x4b3c5b
jmp 0x49839c
mov ecx, dword [0x402600]
mov eax, dword [ebp - 0xcc]
sub eax, dword [ebp - 0xc4]
sub esi, ecx
mov dword [ebp - 0xc0], eax
mov dword [ebp - 0xb8], esi
jne 0x4982db
test eax, eax
je 0x49838c
mov ecx, dword [0x4bebb0]
mov eax, dword [ebp - 0x74]
mov esi, dword [ebp - 0xc4]
sub esi, dword [ebp - 0xcc]
add eax, ebx
mov dword [ebp - 0x6c], eax
xor ebx, ebx
dec ecx
js 0x498322
lea eax, [ebx + ecx]
cdq
sub eax, edx
sar eax, 1
mov edx, dword [eax*4 + 0x4bebb4]
and edx, 0xfffffff
cmp dword [ebp - 0x74], edx
jae 0x498319
lea ecx, [eax - 1]
jmp 0x49831e
jbe 0x498326
lea ebx, [eax + 1]
cmp ecx, ebx
jge 0x4982fa
mov edi, ebx
jmp 0x498384
mov edi, eax
jmp 0x498384
mov eax, dword [edi*4 + 0x4bebb4]
mov ecx, eax
and ecx, 0xfffffff
cmp ecx, dword [ebp - 0x6c]
jae 0x49838c
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 0x498371
dec ecx
je 0x498369
dec ecx
jne 0x49837d
mov edx, dword [ebp - 0xb8]
jmp 0x49837d
mov edx, dword [ebp - 0xc0]
jmp 0x49837d
mov edx, dword [ebp - 0xb8]
sub edx, dword [ebp - 0xc0]
dec eax
dec eax
jne 0x498383
add dword [ebx], edx
inc edi
cmp edi, dword [0x4bebb0]
jb 0x49832a
mov eax, dword [0x4c7398]
mov eax, 0x657aa09
mov eax, dword [ebp - 0xc4]
mov ecx, dword [ebp - 0xd4]
mov dword [ecx + 8], eax
mov esi, dword [ebp - 0x13c]
mov ebx, dword [ebp - 0x148]
mov eax, dword [ebp - 0x14c]
mov ecx, dword [ebp - 0x144]
mov edi, dword [ebp - 0x140]
mov edx, dword [ebp - 0x150]
mov esp, ebp
pop ebp
popfd
ret