Function at 0x406590
Capabilities:
Check for time delay via gettickcount
Check mutex on windows
Create thread

Disassembly:
sub esp, 0x620
mov eax, dword [0x42abd4]
push ebx
push esi
push edi
mov edi, dword [esp + 0x630]
xor ebx, ebx
cmp edi, ebx
mov dword [esp + 0x628], eax
mov esi, ecx
je 0x4065ef
cmp dword [esi + 0x13c], ebx
je 0x4065ef
push 0x104
push edi
lea eax, [esi + 8]
push eax
call dword [sym.imp.KERNEL32.dll_lstrcpynA]
mov ecx, dword [esi + 0x13c]
push 0x2034
push ebx
push ebx
push 0xf001f
push ecx
call dword [sym.imp.KERNEL32.dll_MapViewOfFile]
cmp eax, ebx
jne 0x406609
call dword [sym.imp.KERNEL32.dll_GetLastError]
pop edi
pop esi
xor eax, eax
pop ebx
mov ecx, dword [esp + 0x61c]
call fcn.0040e203
add esp, 0x620
ret 4
mov dword [esi + 0x130], eax
mov dword [esi + 0x138], eax
mov byte [eax + 6], 0
mov edx, dword [esi + 0x130]
mov word [edx + 7], bx
mov eax, dword [esi + 0x130]
mov byte [eax + 0x101d], 0
mov ecx, dword [esi + 0x130]
mov word [ecx + 0x101e], bx
cmp dword [esi + 0x128], 1
jne 0x406653
mov edx, dword [esi + 0x130]
mov word [edx], 0x613
jmp 0x406660
mov eax, dword [esi + 0x130]
cmp word [eax], 0x613
jne 0x4065ef
cmp dword [esi + 0x128], 2
jne 0x406678
mov ecx, dword [esi + 0x130]
cmp dword [ecx + 2], ebx
ja 0x4065ef
push ebp
mov ebp, dword [sym.imp.USER32.dll_wsprintfA]
push edi
lea edx, [esp + 0x428]
push str._s_ServerWrite
push edx
call ebp
push edi
lea eax, [esp + 0x22c]
push str._s_ServerRead
push eax
call ebp
push edi
lea ecx, [esp + 0x30]
push str._s_ClientWrite
push ecx
call ebp
push edi
lea edx, [esp + 0x140]
push str._s_ClientRead
push edx
call ebp
push edi
lea eax, [esp + 0x354]
push str._s_ServerBufMutex
push eax
call ebp
push edi
lea ecx, [esp + 0x568]
push str._s_ClientBufMutex
push ecx
call ebp
mov edi, dword [sym.imp.KERNEL32.dll_CreateEventA]
add esp, 0x48
lea edx, [esp + 0x424]
push edx
push ebx
push ebx
push ebx
call edi
push eax
mov ecx, esi
mov dword [esi + 0x110], eax
call fcn.00404f90
lea eax, [esp + 0x21c]
push eax
push ebx
push ebx
push ebx
call edi
push eax
mov ecx, esi
mov dword [esi + 0x114], eax
call fcn.00404f90
lea ecx, [esp + 0x14]
push ecx
push ebx
push ebx
push ebx
call edi
push eax
mov ecx, esi
mov dword [esi + 0x118], eax
call fcn.00404f90
lea edx, [esp + 0x118]
push edx
push ebx
push ebx
push ebx
call edi
push eax
mov ecx, esi
mov dword [esi + 0x11c], eax
call fcn.00404f90
push ebx
push ebx
push 1
push ebx
call edi
mov dword [esi + 0x120], eax
push eax
mov edi, dword [sym.imp.KERNEL32.dll_ResetEvent]
call edi
mov ebp, dword [sym.imp.KERNEL32.dll_CreateMutexA]
lea eax, [esp + 0x320]
push eax
push ebx
push ebx
call ebp
push eax
mov ecx, esi
mov dword [esi + 0x140], eax
call fcn.00404f90
lea ecx, [esp + 0x528]
push ecx
push ebx
push ebx
call ebp
push eax
mov ecx, esi
mov dword [esi + 0x144], eax
call fcn.00404f90
mov edx, dword [esi + 0x164]
push edx
call edi
push 0x1c
call fcn.0041b5cf
add esp, 4
cmp eax, ebx
je 0x4067c0
push 0xa
mov ecx, eax
call fcn.004051a0
jmp 0x4067c2
xor eax, eax
cmp eax, ebx
mov dword [esi + 0x148], eax
je 0x406953
push 0x1c
call fcn.0041b5cf
add esp, 4
cmp eax, ebx
je 0x4067e9
push 0xa
mov ecx, eax
call fcn.004051a0
jmp 0x4067eb
xor eax, eax
cmp eax, ebx
mov dword [esi + 0x14c], eax
je 0x406953
lea eax, [esp + 0x10]
push eax
push ebx
push esi
push 0x406440
push ebx
push ebx
call dword [sym.imp.KERNEL32.dll_CreateThread]
cmp eax, ebx
mov dword [esi + 0x12c], eax
je 0x406953
cmp dword [esi + 0x128], 2
jne 0x406961
push 1
push 0x170
push esi
call fcn.0041a885
test eax, eax
je 0x406953
mov eax, dword [esi + 0x128]
cmp eax, 1
je 0x406856
cmp eax, 2
jne 0x406953
cmp eax, 1
jne 0x40689d
mov ecx, dword [esi + 0x140]
push 0xffffffffffffffff
push ecx
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
mov eax, dword [esi + 0x130]
mov word [eax + 7], 4
mov byte [eax + 9], 0xaa
mov word [eax + 0xa], bx
mov byte [eax + 0xc], 0xf1
mov edx, dword [esi + 0x130]
mov byte [edx + 6], 1
mov eax, dword [esi + 0x140]
push eax
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
mov ecx, dword [esi + 0x110]
push ecx
jmp 0x4068fa
cmp eax, 2
jne 0x406953
mov edx, dword [esi + 0x144]
push 0xffffffffffffffff
push edx
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
mov eax, dword [esi + 0x130]
mov word [eax + 0x101e], 4
mov byte [eax + 0x1020], 0xaa
mov word [eax + 0x1021], bx
mov byte [eax + 0x1023], 0xf1
mov eax, dword [esi + 0x130]
mov byte [eax + 0x101d], 1
mov ecx, dword [esi + 0x144]
push ecx
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
mov edx, dword [esi + 0x118]
push edx
call dword [sym.imp.KERNEL32.dll_SetEvent]
mov edi, dword [sym.imp.KERNEL32.dll_GetTickCount]
call edi
mov ebp, eax
mov eax, dword [esi + 0x130]
mov cl, byte [eax + 0x101d]
test cl, cl
je 0x40693f
mov ebx, dword [sym.imp.KERNEL32.dll_Sleep]
call edi
sub eax, ebp
cmp eax, 0x4e20
jae 0x40693f
push 0
call ebx
mov ecx, dword [esi + 0x130]
mov al, byte [ecx + 0x101d]
test al, al
jne 0x406920
mov edx, dword [esi + 0x130]
mov al, byte [edx + 0x101d]
test al, al
je 0x406957
call edi
call edi
xor eax, eax
jmp 0x406966
mov dword [esi + 0x124], 2
mov eax, 1
mov ecx, dword [esp + 0x62c]
pop ebp
pop edi
pop esi
pop ebx
call fcn.0040e203
add esp, 0x620
ret 4