Function at 0x40afdf
Capabilities:
Check mutex and terminate process on windows
Check mutex on windows
Set thread local storage value
Terminate process

Disassembly:
push ebp
sub esp, 0x410
lea ebp, [esp - 4]
mov eax, dword [0x43b690]
xor eax, ebp
mov dword [ebp + 0x410], eax
push 0x14
mov eax, 0x42b7e4
call fcn.00413ea5
mov eax, dword [ebp + 0x420]
mov edi, dword [ebp + 0x41c]
mov dword [ebp - 0x18], eax
mov eax, dword [0x43cc08]
xor ebx, ebx
mov dword [ebp - 0x20], edi
cmp eax, ebx
je 0x40b04b
mov eax, dword [eax + 8]
test eax, eax
jle 0x40b04b
mov esi, dword [sym.imp.KERNEL32.dll_TlsSetValue]
push edi
push dword [0x43b250]
call esi
push dword [ebp - 0x18]
push dword [0x43b254]
call esi
mov eax, dword [0x43cc08]
jmp 0x40b436
mov eax, dword [0x43e89c]
test eax, eax
je 0x40b077
push ebx
push 0x43048c
push 0x430480
push ebx
call dword [sym.imp.USER32.dll_MessageBoxW]
push 0xffffffffffffffff
call dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
push eax
call dword [sym.imp.KERNEL32.dll_TerminateProcess]
jmp 0x40b041
xor eax, eax
mov esi, 0x43c9e0
mov dword [ebp - 0x10], ebx
cmp eax, esi
je 0x40b08f
push esi
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov dword [ebp - 0x10], esi
mov dword [ebp - 4], ebx
cmp dword [0x43cc08], ebx
je 0x40b0b9
mov esi, dword [sym.imp.KERNEL32.dll_TlsSetValue]
push edi
push dword [0x43b250]
call esi
push dword [ebp - 0x18]
push dword [0x43b254]
call esi
jmp 0x40b419
call fcn.004015c8
push 0x103
push 0x43c9f8
push eax
mov dword [0x43cc0c], eax
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
push 8
pop ecx
mov esi, str.mutexTSLOGTSLOG
lea edi, [ebp]
rep movsd dword es:[edi], dword [esi]
push 0x1e6
lea eax, [ebp + 0x22]
push ebx
push eax
movsw word es:[edi], word [esi]
call fcn.00415aa0
push 9
pop ecx
mov esi, str.filemapTSLOGTSLOG
lea edi, [ebp + 0x208]
rep movsd dword es:[edi], dword [esi]
push 0x1e2
lea eax, [ebp + 0x22e]
push ebx
push eax
movsw word es:[edi], word [esi]
call fcn.00415aa0
add esp, 0x18
call dword [sym.imp.KERNEL32.dll_GetCurrentProcessId]
push eax
mov edi, 0x42d5e8
push edi
mov dword [ebp - 0x1c], eax
mov esi, 0x82
lea eax, [ebp]
push esi
push eax
call fcn.00414000
pop ecx
lea eax, [ebp + eax*2]
push eax
call fcn.004157dd
add esp, 0x10
push dword [ebp - 0x1c]
lea eax, [ebp + 0x208]
push edi
push esi
push eax
call fcn.00414000
pop ecx
lea eax, [ebp + eax*2 + 0x208]
push eax
call fcn.004157dd
add esp, 0x10
lea eax, [ebp]
push eax
push 1
push ebx
call dword [sym.imp.KERNEL32.dll_CreateMutexW]
mov dword [0x43cc00], eax
cmp eax, ebx
jne 0x40b199
push 0x10
push 0x43c9f8
push str.CreateMutex_failure
push ebx
call dword [sym.imp.USER32.dll_MessageBoxW]
push 0xffffffffffffffff
call dword [sym.imp.KERNEL32.dll_ExitProcess]
mov esi, dword [sym.imp.KERNEL32.dll_GetLastError]
call esi
cmp eax, 0xb7
jne 0x40b1b6
push 0xffffffffffffffff
push dword [0x43cc00]
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
lea eax, [ebp + 0x208]
push eax
mov edi, 0x24c
push edi
push ebx
push 4
push ebx
push 0xffffffffffffffff
call dword [sym.imp.KERNEL32.dll_CreateFileMappingW]
mov dword [0x43cc04], eax
cmp eax, ebx
jne 0x40b20b
push 0x10
push 0x43c9f8
push str.CreateFileMapping_failure
push ebx
call dword [sym.imp.USER32.dll_MessageBoxW]
push dword [0x43cc00]
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
push dword [0x43cc00]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [0x43cc00], ebx
jmp 0x40b191
call esi
push edi
push ebx
push ebx
push 0xf001f
push dword [0x43cc04]
cmp eax, 0xb7
sete byte [ebp - 0x11]
call dword [sym.imp.KERNEL32.dll_MapViewOfFile]
mov dword [0x43cc08], eax
cmp eax, ebx
jne 0x40b270
push 0x10
push 0x43c9f8
push str.MapViewOfFile_failure
push ebx
call dword [sym.imp.USER32.dll_MessageBoxW]
push dword [0x43cc04]
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
call esi
push dword [0x43cc00]
mov dword [0x43cc04], ebx
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
push dword [0x43cc00]
call esi
jmp 0x40b203
push dword [ebp - 0x20]
mov esi, dword [sym.imp.KERNEL32.dll_TlsSetValue]
push dword [0x43b250]
call esi
push dword [ebp - 0x18]
push dword [0x43b254]
call esi
mov dword [0x43e89c], ebx
cmp byte [ebp - 0x11], bl
je 0x40b32d
mov eax, dword [0x43cc08]
mov edi, 0x1000
cmp dword [eax + 0x244], edi
jae 0x40b3c2
mov esi, dword [eax + 0x240]
cmp esi, ebx
je 0x40b2df
push esi
call dword [sym.imp.KERNEL32.dll_GlobalUnlock]
push esi
call dword [sym.imp.KERNEL32.dll_GlobalFree]
mov eax, dword [0x43cc08]
mov dword [eax + 0x244], ebx
mov eax, dword [0x43cc08]
mov dword [eax + 0x240], ebx
mov esi, 0x2000
push esi
push ebx
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
push eax
call dword [sym.imp.KERNEL32.dll_GlobalLock]
mov ecx, dword [0x43cc08]
mov dword [ecx + 0x240], eax
mov eax, dword [0x43cc08]
add eax, 0x240
cmp dword [eax], ebx
je 0x40b3c2
push esi
push ebx
push dword [eax]
call fcn.00415aa0
mov eax, dword [0x43cc08]
add esp, 0xc
mov dword [eax + 0x244], edi
jmp 0x40b3c2
push edi
push ebx
push dword [0x43cc08]
call fcn.00415aa0
add esp, 0xc
mov esi, 0x2000
push esi
push ebx
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
push eax
call dword [sym.imp.KERNEL32.dll_GlobalLock]
mov ecx, dword [0x43cc08]
mov dword [ecx + 0x240], eax
mov eax, dword [0x43cc08]
add eax, 0x240
cmp dword [eax], ebx
je 0x40b386
push esi
push ebx
push dword [eax]
call fcn.00415aa0
mov eax, dword [0x43cc08]
add esp, 0xc
mov dword [eax + 0x244], 0x1000
mov eax, dword [0x43cc08]
add eax, 0xc
push eax
call dword [sym.imp.KERNEL32.dll_InitializeCriticalSection]
mov eax, dword [0x43cc08]
mov dword [eax], 0x27200
mov eax, dword [0x43cc08]
mov dword [eax + 4], edi
mov ecx, dword [0x43cc08]
push 1
call fcn.004084fa
mov ecx, dword [0x43cc08]
push 1
call fcn.0040a719
mov eax, dword [0x43cc08]
push 1
add eax, 8
push eax
call dword [sym.imp.KERNEL32.dll_InterlockedExchangeAdd]
mov eax, dword [0x43cc08]
mov eax, dword [eax + 8]
mov ecx, dword [0x43cc08]
mov dword [0x43cc14], eax
cmp dword [ecx + 0xe8], 0xffffffff
jne 0x40b3fd
cmp dword [ecx + 0x2c], ebx
je 0x40b3fd
mov eax, dword [ecx + 0x23c]
inc eax
jmp 0x40b403
mov eax, dword [ecx + 0x23c]
mov dword [0x43cc10], eax
call fcn.00406d79
push dword [0x43cc00]
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
mov esi, dword [0x43cc08]
or dword [ebp - 4], 0xffffffff
cmp dword [ebp - 0x10], ebx
je 0x40b434
push dword [ebp - 0x10]
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov dword [ebp - 0x10], ebx
mov eax, esi
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp + 0x410]
xor ecx, ebp
call fcn.00413e96
add ebp, 0x414
leave
ret