Function at 0x401240
Capabilities:
Check for debugger via api
Check for peb beingdebugged flag
Check for time delay via queryperformancecounter
Execute anti-debugging instructions

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x154
mov eax, dword [0x40f040]
xor eax, ebp
mov dword [ebp - 4], eax
push ebx
push esi
push edi
call fcn.00402f50
mov bl, al
call dword [sym.imp.KERNEL32.dll_IsDebuggerPresent]
mov esi, dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
test eax, eax
movzx ebx, bl
mov edi, 1
cmovne ebx, edi
call esi
lea ecx, [ebp - 0x11c]
mov dword [ebp - 0x11c], 0
push ecx
push eax
call dword [sym.imp.KERNEL32.dll_CheckRemoteDebuggerPresent]
test eax, eax
je 0x4012a0
cmp dword [ebp - 0x11c], 0
setne al
jmp 0x4012a2
xor al, al
or bl, al
mov dword [ebp - 0x11c], 0
xor eax, eax
mov eax, dword fs:[0x30]
movzx eax, byte [eax + 2]
mov dword [ebp - 0x11c], eax
cmp dword [ebp - 0x11c], 0
movzx ebx, bl
cmovne ebx, edi
call fcn.00402f50
or bl, al
call fcn.00402ec0
or al, bl
mov dword [ebp - 0x11c], 0
push str.Ntdll.dll
mov byte [ebp - 0x14d], al
mov bl, al
call dword [sym.imp.KERNEL32.dll_LoadLibraryW]
mov edi, eax
test edi, edi
je 0x40134b
push 0x40c140
push edi
call dword [sym.imp.KERNEL32.dll_GetProcAddress]
mov dword [ebp - 0x114], eax
test eax, eax
jne 0x40131d
push edi
call dword [sym.imp.KERNEL32.dll_FreeLibrary]
jmp 0x40134b
push 0
push 4
lea eax, [ebp - 0x11c]
push eax
push 0x1e
call esi
push eax
call dword [ebp - 0x114]
push edi
mov esi, eax
call dword [sym.imp.KERNEL32.dll_FreeLibrary]
test esi, esi
js 0x40134b
cmp dword [ebp - 0x11c], 0
je 0x40134b
mov bl, 1
mov byte [ebp - 0x14e], bl
call fcn.004024b0
or bl, al
call fcn.00401ef0
mov esi, dword [sym.imp.KERNEL32.dll_HeapWalk]
xorps xmm0, xmm0
mov edi, dword [sym.imp.KERNEL32.dll_GetProcessHeap]
or bl, al
movups xmmword [ebp - 0x14c], xmm0
mov dword [ebp - 0x134], 0
movq qword [ebp - 0x13c], xmm0
lea eax, [ebp - 0x14c]
push eax
call edi
push eax
call esi
test eax, eax
je 0x4013b9
cmp word [ebp - 0x142], 4
jne 0x401387
mov eax, dword [ebp - 0x14c]
mov ecx, dword [ebp - 0x148]
cmp dword [ecx + eax], 0xabababab
sete al
jmp 0x4013bb
xor al, al
push 4
push 0x3000
push 0x1000
or bl, al
push 0
mov byte [ebp - 0x14d], bl
call dword [sym.imp.KERNEL32.dll_VirtualAlloc]
mov esi, eax
mov dword [ebp - 0x118], esi
test esi, esi
jne 0x4013e7
xor bh, bh
jmp 0x40141e
push 8
lea eax, [ebp - 0x118]
push eax
call dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
push eax
call dword [sym.imp.KERNEL32.dll_K32QueryWorkingSetEx]
test eax, eax
je 0x40140e
test byte [ebp - 0x114], 1
je 0x40140e
mov bh, 1
jmp 0x401410
xor bh, bh
push 0x8000
push 0
push esi
call dword [sym.imp.KERNEL32.dll_VirtualFree]
push 0x1000
or bl, bh
call dword [sym.imp.USER32.dll_GetSystemMetrics]
test eax, eax
movzx ebx, bh
mov edi, 1
cmovne ebx, edi
or bl, byte [ebp - 0x14d]
call fcn.00402a00
or al, bl
push 0x1234
mov byte [ebp - 0x14d], al
mov bl, al
call dword [sym.imp.USER32.dll_CloseWindow]
test eax, eax
jne 0x401469
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x578
je 0x401472
mov bl, byte [ebp - 0x14e]
or bl, 1
mov byte [ebp - 0x150], bl
call fcn.00402a90
mov bh, al
or bl, bh
call fcn.00402b30
mov byte [ebp - 0x152], al
or bl, al
push 0x104
lea eax, [ebp - 0x110]
push eax
push 0
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameA]
test eax, eax
je 0x4014d5
push 0
push pe_nt_image_headers32
push 3
push 0
push 0
push 0x80000000
lea eax, [ebp - 0x110]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
cmp eax, 0xffffffff
je 0x4014d5
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
xor al, al
jmp 0x4014d7
mov al, 1
mov byte [ebp - 0x14e], al
or bl, al
call fcn.00402bc0
mov byte [ebp - 0x151], al
or bl, al
lea eax, [ebp - 0x130]
push eax
call dword [sym.imp.KERNEL32.dll_QueryPerformanceFrequency]
mov esi, dword [sym.imp.KERNEL32.dll_QueryPerformanceCounter]
lea eax, [ebp - 0x120]
push eax
call esi
xor eax, eax
push eax
push ecx
pop eax
pop ecx
sub ecx, eax
shl ecx, 4
lea eax, [ebp - 0x118]
push eax
call esi
mov ecx, dword [ebp - 0x118]
sub ecx, dword [ebp - 0x120]
mov edx, dword [ebp - 0x114]
sbb edx, dword [ebp - 0x11c]
call fcn.00407960
mulsd xmm0, qword [0x40c420]
mov edx, dword [ebp - 0x12c]
mov ecx, dword [ebp - 0x130]
movsd qword [ebp - 0x118], xmm0
call fcn.00407960
movsd xmm1, qword [ebp - 0x118]
divsd xmm1, xmm0
mov esi, dword [sym.imp.KERNEL32.dll_GetSystemTime]
comisd xmm1, xmmword [0x40c418]
seta al
mov byte [ebp - 0x14f], al
or bl, al
lea eax, [ebp - 0x140]
push eax
call esi
xor eax, eax
push eax
push ecx
pop eax
pop ecx
sub ecx, eax
shl ecx, 4
lea eax, [ebp - 0x128]
push eax
call esi
mov esi, dword [sym.imp.KERNEL32.dll_SystemTimeToFileTime]
lea eax, [ebp - 0x118]
push eax
lea eax, [ebp - 0x140]
push eax
call esi
test eax, eax
jne 0x4015ba
xor cl, cl
jmp 0x4015fa
lea eax, [ebp - 0x130]
push eax
lea eax, [ebp - 0x128]
push eax
call esi
test eax, eax
jne 0x4015d2
xor cl, cl
jmp 0x4015fa
mov ecx, dword [ebp - 0x130]
sub ecx, dword [ebp - 0x118]
mov eax, dword [ebp - 0x12c]
sbb eax, dword [ebp - 0x114]
jne 0x4015f8
cmp ecx, 0xc350
ja 0x4015f8
xor cl, cl
jmp 0x4015fa
mov cl, 1
or bl, cl
rdtsc
mov dword [ebp - 0x11c], eax
rdtsc
mov dword [ebp - 0x114], eax
mov eax, dword [ebp - 0x114]
sub eax, dword [ebp - 0x11c]
movzx edx, cl
cmp eax, 0xff
movzx ecx, byte [0x7ffe02d4]
cmovae edx, edi
movzx ebx, bh
mov eax, ecx
and ecx, edi
and eax, 2
cmp cl, al
cmovne ebx, edi
or bl, byte [ebp - 0x150]
or bl, byte [ebp - 0x14e]
or bl, byte [ebp - 0x151]
or bl, byte [ebp - 0x152]
or bl, dl
or bl, byte [ebp - 0x14f]
call fcn.00403140
or bl, al
call fcn.004031c0
or bl, al
call fcn.00403240
or bl, al
call fcn.00403570
or bl, al
mov dword [ebp - 0x114], 0
mov dword [ebp - 0x11c], 0
lea eax, [ebp - 0x114]
push eax
push 4
lea ecx, [ebp - 0x11c]
push ecx
push 7
push 0xffffffffffffffff
call dword [sym.imp.ntdll.dll_NtQueryInformationProcess]
inc dword [ebp - 0x11c]
cmp dword [ebp - 0x11c], edi
setne al
or bl, al
mov eax, dword fs:[0x30]
mov al, byte [eax + 0x68]
and al, 0x70
cmp al, 0x70
je 0x4016ca
mov eax, 0
jmp 0x4016cf
mov eax, 1
mov esi, dword [sym.imp.KERNEL32.dll_GetTickCount64]
or bl, al
mov dword [ebp - 0x114], ebx
call esi
mov edi, eax
mov ebx, edx
xor eax, eax
push eax
push ecx
pop eax
pop ecx
sub ecx, eax
shl ecx, 4
call esi
sub eax, edi
sbb edx, ebx
jne 0x401716
cmp eax, 0xc350
ja 0x401716
xor al, al
or al, byte [ebp - 0x114]
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0040685e
mov esp, ebp
pop ebp
ret
mov ecx, dword [ebp - 4]
mov al, 1
or al, byte [ebp - 0x114]
xor ecx, ebp
pop edi
pop esi
pop ebx
call fcn.0040685e
mov esp, ebp
pop ebp
ret