Function at 0x40d400
Capabilities:
Create thread

Disassembly:
push ebp
mov ebp, esp
push edi
push esi
push ebx
sub esp, 0x3c
mov esi, dword [ebp + 0x18]
mov ebx, dword [ebp + 8]
cmp esi, 0x10000
ja 0x40d620
mov eax, dword [ebx + 4]
test eax, eax
je 0x40d461
mov dword [esp + 0xc], 0
mov dword [esp + 8], 0xffffffff
mov dword [esp + 4], eax
mov eax, dword [ebx + 8]
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_SignalObjectAndWait]
mov eax, dword [ebx + 8]
mov edi, dword [sym.imp.KERNEL32.dll_CloseHandle]
sub esp, 0x10
mov dword [esp], eax
call edi
mov eax, dword [ebx + 4]
sub esp, 4
mov dword [esp], eax
call edi
sub esp, 4
mov eax, dword [ebx]
test eax, eax
je 0x40d473
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
sub esp, 4
xor eax, eax
test esi, esi
jne 0x40d481
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret
mov eax, dword [ebp + 0x10]
mov dword [esp + 4], 0
mov dword [esp + 8], eax
mov eax, dword [ebp + 0xc]
mov dword [esp], eax
call sym._memset
test bl, 1
mov edx, ebx
mov ecx, 0x1c
jne 0x40d636
test dl, 2
jne 0x40d643
mov edi, ecx
xor eax, eax
and edi, 0xfffffffc
mov dword [edx + eax], 0
add eax, 4
cmp eax, edi
jb 0x40d4bb
add edx, eax
test cl, 2
jne 0x40d610
and ecx, 1
jne 0x40d603
mov eax, dword [ebp + 0xc]
xor edx, edx
mov dword [esp + 8], esi
mov dword [esp + 0xc], 0
mov dword [0x412ac8], eax
mov eax, dword [ebp + 0x14]
mov dword [0x412acc], eax
mov eax, dword [ebp + 0x10]
shr eax, 1
shld edx, eax, 0x10
shl eax, 0x10
mov dword [esp], eax
mov dword [esp + 4], edx
call dbg.__udivdi3
mov ecx, dword [ebp + 0x14]
mov dword [0x412ad4], esi
mov esi, dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
lea eax, [ecx + eax*2]
mov dword [0x412ad0], eax
call esi
mov dword [ebp - 0x2c], eax
call dword [sym.imp.KERNEL32.dll_GetCurrentThread]
mov edi, eax
call esi
mov edx, dword [ebp - 0x2c]
mov dword [esp + 0x18], 2
mov dword [esp + 0x14], 0
mov dword [esp + 0x10], 0
mov dword [esp + 0xc], ebx
mov dword [esp + 8], edx
mov dword [esp + 4], edi
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_DuplicateHandle]
sub esp, 0x1c
test eax, eax
je 0x40d654
mov dword [esp + 0xc], 0
mov dword [esp + 8], 0
mov dword [esp + 4], 1
mov dword [esp], 0
call dword [sym.imp.KERNEL32.dll_CreateEventA]
sub esp, 0x10
test eax, eax
mov dword [ebx + 8], eax
je 0x40d6a1
lea eax, [ebp - 0x1c]
mov dword [esp + 0x14], eax
mov dword [esp + 0x10], 0
mov dword [esp + 0xc], ebx
mov dword [esp + 8], sym._profthr_func_4
mov dword [esp + 4], 0
mov dword [esp], 0
call dword [sym.imp.KERNEL32.dll_CreateThread]
sub esp, 0x18
test eax, eax
mov dword [ebx + 4], eax
je 0x40d66a
mov dword [esp + 4], 0xf
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_SetThreadPriority]
xor eax, eax
sub esp, 8
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret
mov byte [edx], 0
jmp 0x40d4dd
xor edi, edi
add edx, 2
mov word [edx - 2], di
jmp 0x40d4d4
call dword [sym.imp.msvcrt.dll__errno]
mov dword [eax], 0x16
mov eax, 0xffffffff
jmp 0x40d479
mov byte [ebx], 0
lea edx, [ebx + 1]
mov cl, 0x1b
jmp 0x40d4ab
xor eax, eax
add edx, 2
mov word [edx - 2], ax
sub ecx, 2
jmp 0x40d4b4
call dword [sym.imp.msvcrt.dll__errno]
mov dword [eax], 3
mov eax, 0xffffffff
jmp 0x40d479
mov eax, dword [ebx]
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [esp], eax
call esi
mov eax, dword [ebx + 8]
sub esp, 4
mov dword [esp], eax
call esi
sub esp, 4
mov dword [ebx], 0
call dword [sym.imp.msvcrt.dll__errno]
mov dword [eax], 0xb
mov eax, 0xffffffff
jmp 0x40d479
mov dword [esp], 0
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x40d682