Function at 0x4042ef
Capabilities:
Encode data using xor
Generate random numbers using the delphi lcg
Read file via mapping
Resolve function by parsing pe exports

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0xcc4
push ebx
push esi
push edi
call fcn.00403e65
call dword [sym.imp.KERNEL32.dll_GetTickCount]
and eax, 0x11
xor ebx, ebx
cmp eax, 0x111
je 0x404696
lea eax, [esp + 0x30]
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_GetModuleHandleA]
call fcn.00403f41
pop ecx
call fcn.00403fbc
mov ecx, eax
sub ecx, dword [0x405014]
push 3
xor edx, edx
mov eax, ecx
pop esi
mov edi, 0xfffff000
div esi
test edi, ecx
jne 0x404579
lea eax, [esp + 0x34]
push eax
push 0x18
lea eax, [esp + 0x78]
push eax
push ebx
mov dword [esp + 0x8c4], ebx
mov word [esp + 0x4b0], bx
mov dword [esp + 0x4ac], ebx
mov word [esp + 0x98], bx
call dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
push eax
call dword [0x405004]
mov ecx, eax
mov dword [esp + 0x14], eax
mov eax, 0x80000000
and ecx, eax
cmp ecx, eax
je 0x40477d
call fcn.00403fbc
mov ecx, eax
sub ecx, dword [0x405014]
xor edx, edx
mov eax, ecx
div esi
test edi, ecx
jne 0x404579
mov esi, dword [esp + 0x84]
push 0x401160
lea eax, [esp + 0x8bc]
call fcn.00404a08
push 0x10
mov eax, esi
lea ecx, [esp + 0x8bc]
call fcn.00404950
push 0x401178
mov esi, ecx
call fcn.004049b4
mov eax, dword [esp + 0x30]
push 0x10
mov ecx, esi
call fcn.00404950
mov eax, esi
push eax
push ebx
push 4
call dword [sym.imp.KERNEL32.dll_OpenFileMappingW]
mov esi, eax
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp esi, ebx
mov dword [esp + 0x14], eax
je 0x40444e
push ebx
push ebx
push ebx
push 4
push esi
call dword [sym.imp.KERNEL32.dll_MapViewOfFile]
mov edi, eax
cmp edi, ebx
je 0x404795
lea eax, [edi + 4]
push eax
lea eax, [esp + 0x4a4]
call fcn.004049ed
push edi
call dword [sym.imp.KERNEL32.dll_UnmapViewOfFile]
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov edi, 0xfffff000
jmp 0x40447e
cmp eax, 2
jne 0x4048d1
push 0x104
lea eax, [esp + 0x4a4]
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
lea ecx, [esp + 0x4a0]
call fcn.0040493f
mov dword [esp + 0x8b4], eax
call fcn.00403fbc
mov ecx, eax
sub ecx, dword [0x405014]
push 3
xor edx, edx
mov eax, ecx
pop esi
div esi
test edi, ecx
jne 0x404579
lea eax, [esp + 0x4a0]
push eax
lea esi, [esp + 0x8c]
call fcn.004049b4
push 0x4011a8
call fcn.004049b4
push ebx
push ebx
push 3
push ebx
push 7
push 0x80000000
lea eax, [esp + 0x4b8]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
cmp eax, 0xffffffff
mov dword [esp + 0x18], eax
je 0x4047b7
call fcn.00403f0b
test eax, eax
jne 0x404319
push ebx
push ebx
push ebx
push 2
push ebx
push dword [esp + 0x2c]
call dword [sym.imp.KERNEL32.dll_CreateFileMappingW]
cmp eax, ebx
mov dword [esp + 0x1c], eax
je 0x4047c4
push 0x1000
push ebx
push ebx
push 4
push eax
call dword [sym.imp.KERNEL32.dll_MapViewOfFile]
mov esi, eax
cmp esi, ebx
je 0x4047d1
mov edi, esi
call fcn.00403ed9
mov edi, eax
push esi
mov esi, dword [sym.imp.KERNEL32.dll_UnmapViewOfFile]
mov dword [esp + 0x30], edi
call esi
add edi, 0x1000
push edi
push ebx
push ebx
push 4
push dword [esp + 0x2c]
call dword [sym.imp.KERNEL32.dll_MapViewOfFile]
cmp eax, ebx
mov dword [esp + 0x24], eax
je 0x4047de
call fcn.00403fbc
mov ecx, eax
sub ecx, dword [0x405014]
push 3
xor edx, edx
mov eax, ecx
pop edi
div edi
test ecx, 0xfffff000
je 0x40458f
cmp edx, ebx
je 0x404882
cmp edx, 1
je 0x404319
jmp 0x404696
mov edi, dword [esp + 0x24]
call fcn.00403f71
mov ecx, dword [eax]
mov edi, ecx
imul edi, edi, 0x8088405
add eax, 4
mov edx, dword [eax]
inc edi
mov dword [esp + 0x10], edx
mov edx, edi
xor edx, ecx
add eax, 4
cmp edx, dword [esp + 0x10]
jne 0x4047eb
mov edx, dword [eax]
mov ecx, edi
imul ecx, ecx, 0x8088405
inc ecx
mov dword [esp + 0x10], edx
mov edx, ecx
xor edx, edi
add eax, 4
cmp edx, dword [esp + 0x10]
jne 0x404806
mov edx, dword [eax]
imul ecx, ecx, 0x8088405
push dword [esp + 0x24]
inc ecx
xor edx, ecx
imul ecx, ecx, 0x8088405
inc ecx
xor ecx, dword [eax + 4]
mov dword [esp + 0x14], edx
mov dword [esp + 0x24], ecx
call esi
push dword [esp + 0x1c]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push ebx
push ebx
push ebx
push 8
push ebx
push dword [esp + 0x2c]
call dword [sym.imp.KERNEL32.dll_CreateFileMappingW]
cmp eax, ebx
mov dword [esp + 0x1c], eax
je 0x404821
mov esi, dword [esp + 0x2c]
mov ecx, dword [esp + 0x20]
lea ecx, [ecx + esi + 0x14]
push ecx
push ebx
push ebx
push 1
push eax
call dword [sym.imp.KERNEL32.dll_MapViewOfFile]
cmp eax, ebx
mov dword [esp + 0x24], eax
je 0x404831
lea eax, [esi + eax + 0x14]
mov esi, dword [esp + 0x20]
cmp esi, ebx
mov dword [esp + 0x28], eax
jbe 0x404671
imul edi, edi, 0x343fd
add edi, 0x269ec3
mov ecx, edi
shr ecx, 0x10
xor byte [eax], cl
inc eax
dec esi
jne 0x40465a
lea esi, [esp + 0x38]
mov dword [esp + 0x58], ebx
mov dword [esp + 0x5c], ebx
mov dword [esp + 0x60], ebx
mov dword [esp + 0x3c], ebx
mov dword [esp + 0x38], ebx
call fcn.00403df0
test eax, eax
jne 0x404841
push 4
push 0x1000
push dword [esp + 0x18]
push ebx
call dword [sym.imp.KERNEL32.dll_VirtualAlloc]
mov esi, eax
call fcn.00403fbc
mov ecx, eax
sub ecx, dword [0x405014]
push 3
xor edx, edx
mov eax, ecx
pop edi
div edi
test ecx, 0xfffff000
je 0x4046da
cmp edx, ebx
je 0x404882
cmp edx, 1
jne 0x404696
jmp 0x404319
mov eax, dword [esp + 0x20]
mov dword [esp + 0x3c], eax
mov eax, dword [esp + 0x28]
mov dword [esp + 0x38], eax
mov eax, dword [esp + 0x10]
mov dword [esp + 0x48], eax
lea eax, [esp + 0x38]
push eax
mov dword [esp + 0x48], esi
call fcn.00402e40
cmp eax, 1
pop ecx
jne 0x40485c
push dword [esp + 0x24]
call dword [sym.imp.KERNEL32.dll_UnmapViewOfFile]
push dword [esp + 0x1c]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
call fcn.00403fbc
mov ecx, eax
sub ecx, dword [0x405014]
push 3
xor edx, edx
mov eax, ecx
pop edi
div edi
test ecx, 0xfffff000
jne 0x404579
push esi
call fcn.00404077
cmp eax, ebx
pop ecx
je 0x404912
push eax
call fcn.00403fdd
cmp eax, ebx
pop ecx
mov dword [esp + 0x28], eax
jne 0x404877
mov esi, 0x405018
push 0x4010d0
mov eax, esi
call fcn.004049ed
push 0x4012a8
jmp 0x40490d
push 0x4010bc
lea esi, [esp + 0x8c]
call fcn.004049b4
push 0x10
jmp 0x4048e4
call dword [sym.imp.KERNEL32.dll_GetLastError]
push 0x401180
lea esi, [esp + 0x8c]
mov edi, eax
call fcn.004049b4
push 0xa
mov eax, edi
jmp 0x4048e8
call dword [sym.imp.KERNEL32.dll_GetLastError]
push 0x4011b0
jmp 0x4047a0
call dword [sym.imp.KERNEL32.dll_GetLastError]
push 0x4011fc
jmp 0x4047a0
call dword [sym.imp.KERNEL32.dll_GetLastError]
push 0x401210
jmp 0x4047a0
call dword [sym.imp.KERNEL32.dll_GetLastError]
push 0x401224
jmp 0x4047a0
mov esi, 0x405018
push 0x4010d0
mov eax, esi
call fcn.004049ed
push 0x401238
jmp 0x40490d
mov esi, 0x405018
push 0x4010d0
mov eax, esi
call fcn.004049ed
push 0x401248
jmp 0x40490d
call dword [sym.imp.KERNEL32.dll_GetLastError]
push 0x401258
jmp 0x4047a0
call dword [sym.imp.KERNEL32.dll_GetLastError]
push 0x40126c
jmp 0x4047a0
mov esi, 0x405018
push 0x4010d0
mov eax, esi
call fcn.004049ed
push 0x401280
jmp 0x40490d
mov esi, 0x405018
push 0x4010d0
mov eax, esi
call fcn.004049ed
push 0x401290
jmp 0x40490d
push ebx
call dword [sym.imp.KERNEL32.dll_GetModuleHandleA]
mov dword [esp + 0x14], eax
push ebx
push ebx
push ebx
push 2
push ebx
push dword [esp + 0x2c]
call dword [sym.imp.KERNEL32.dll_CreateFileMappingW]
mov esi, eax
cmp esi, ebx
jne 0x4048a8
call dword [sym.imp.KERNEL32.dll_GetLastError]
push 0x4012b8
jmp 0x4047a0
push dword [esp + 0x18]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push dword [esp + 0x30]
mov ecx, dword [esp + 0x24]
mov eax, dword [esp + 0x30]
lea eax, [ecx + eax + 0x14]
push eax
push esi
push dword [esp + 0x20]
call dword [esp + 0x38]
add esp, 0x10
jmp 0x404912
push 0x401194
lea esi, [esp + 0x8c]
call fcn.004049b4
push 0xa
mov eax, dword [esp + 0x18]
lea ecx, [esp + 0x8c]
call fcn.00404950
mov esi, 0x405018
push 0x4010d0
mov eax, esi
call fcn.004049ed
lea eax, [esp + 0x88]
push eax
call fcn.004049b4
push 0x4012cc
push 0x4012d8
call dword [sym.imp.KERNEL32.dll_LoadLibraryW]
push eax
call dword [sym.imp.KERNEL32.dll_GetProcAddress]
push 0x10
push 0x4012f0
push 0x405018
push ebx
call eax
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret