Function at 0x40e820
Capabilities:
Check mutex and terminate process on windows
Check mutex on windows
Query environment variable
Set environment variable
Set thread local storage value
Terminate process

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x43b768
mov eax, dword fs:[0]
push eax
sub esp, 0x27c
mov eax, dword [0x4b249c]
xor eax, ebp
mov dword [ebp - 0x18], eax
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
cmp dword [0x4b3ed4], 0
je 0x40e88d
mov eax, dword [0x4b3ed4]
cmp dword [eax + 8], 0
jle 0x40e88d
mov ecx, dword [ebp + 8]
push ecx
mov edx, dword [0x4b209c]
push edx
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
mov eax, dword [ebp + 0xc]
push eax
mov ecx, dword [0x4b20a0]
push ecx
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
mov eax, dword [0x4b3ed4]
jmp 0x40eddd
cmp dword [0x4b568c], 0
je 0x40e8c3
push 0
push 0x43e3fc
push 0x43e3f0
push 0
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]
mov eax, dword [0x4b3ed4]
jmp 0x40eddd
push 0
push 0x4b3c58
lea ecx, [ebp - 0x10]
call fcn.0040e090
mov dword [ebp - 4], 0
cmp dword [0x4b3ed4], 0
je 0x40e928
mov edx, dword [ebp + 8]
push edx
mov eax, dword [0x4b209c]
push eax
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
mov ecx, dword [ebp + 0xc]
push ecx
mov edx, dword [0x4b20a0]
push edx
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
mov eax, dword [0x4b3ed4]
mov dword [ebp - 0x280], eax
mov dword [ebp - 4], 0xffffffff
lea ecx, [ebp - 0x10]
call fcn.0040e0d0
mov eax, dword [ebp - 0x280]
jmp 0x40eddd
call fcn.0040ee00
mov dword [0x4b3ed8], eax
push 0x103
push 0x4b3c70
mov ecx, dword [0x4b3ed8]
push ecx
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
mov ecx, 9
mov esi, str.mutexTSLOGV3TSLOG
lea edi, [ebp - 0x224]
rep movsd dword es:[edi], dword [esi]
movsw word es:[edi], word [esi]
push 0x1e2
push 0
lea edx, [ebp - 0x1fe]
push edx
call fcn.00426300
add esp, 0xc
push 0x80
push str.envTSLOGTSLOG
push 0x4b3b58
call fcn.00429814
add esp, 0xc
call dword [sym.imp.KERNEL32.dll_GetCurrentProcessId]
mov dword [ebp - 0x14], eax
mov eax, dword [ebp - 0x14]
push eax
push 0x43e3a0
push 0x82
lea ecx, [ebp - 0x224]
push ecx
call fcn.00426a1b
add esp, 4
lea edx, [ebp + eax*2 - 0x224]
push edx
call fcn.0042934a
add esp, 0x10
mov eax, dword [ebp - 0x14]
push eax
push 0x43e3a0
push 0x82
push 0x4b3b58
call fcn.00426a1b
add esp, 4
lea ecx, [eax*2 + 0x4b3b58]
push ecx
call fcn.0042934a
add esp, 0x10
lea edx, [ebp - 0x224]
push edx
push 1
push 0
call dword [sym.imp.KERNEL32.dll_CreateMutexW]
mov dword [0x4b3ecc], eax
cmp dword [0x4b3ecc], 0
jne 0x40ea26
push 0x10
push 0x4b3c70
push str.CreateMutex_failure
push 0
call dword [sym.imp.USER32.dll_MessageBoxW]
push 0xffffffffffffffff
call dword [sym.imp.KERNEL32.dll_ExitProcess]
call dword [sym.imp.KERNEL32.dll_GetLastError]
xor ecx, ecx
cmp eax, 0xb7
sete cl
mov byte [ebp - 0x229], cl
movzx edx, byte [ebp - 0x229]
test edx, edx
je 0x40ea55
push 0xffffffffffffffff
mov eax, dword [0x4b3ecc]
push eax
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
xor ecx, ecx
mov word [ebp - 0x26c], cx
push 0x3e
push 0
lea edx, [ebp - 0x26a]
push edx
call fcn.00426300
add esp, 0xc
push 0x20
lea eax, [ebp - 0x26c]
push eax
push 0x4b3b58
call dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableW]
mov dword [ebp - 0x228], eax
cmp dword [ebp - 0x228], 0
jne 0x40eb30
push 0x24c
push 0
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
mov dword [0x4b3ed0], eax
cmp dword [0x4b3ed0], 0
jne 0x40eaf3
push 0x10
push 0x4b3c70
push str.GlobalAlloc_failure
push 0
call dword [sym.imp.USER32.dll_MessageBoxW]
mov ecx, dword [0x4b3ecc]
push ecx
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
mov edx, dword [0x4b3ecc]
push edx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [0x4b3ecc], 0
push 0xffffffffffffffff
call dword [sym.imp.KERNEL32.dll_ExitProcess]
mov eax, dword [0x4b3ed0]
push eax
call dword [sym.imp.KERNEL32.dll_GlobalLock]
mov dword [0x4b3ed4], eax
push 0xa
lea ecx, [ebp - 0x26c]
push ecx
mov edx, dword [0x4b3ed4]
push edx
call fcn.004297fa
add esp, 0xc
lea eax, [ebp - 0x26c]
push eax
push 0x4b3b58
call dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
jmp 0x40eb51
lea ecx, [ebp - 0x26c]
push ecx
call fcn.00429785
add esp, 4
mov dword [ebp - 0x270], eax
mov edx, dword [ebp - 0x270]
mov dword [0x4b3ed4], edx
mov eax, dword [ebp + 8]
push eax
mov ecx, dword [0x4b209c]
push ecx
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
mov edx, dword [ebp + 0xc]
push edx
mov eax, dword [0x4b20a0]
push eax
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
mov dword [0x4b568c], 0
movzx ecx, byte [ebp - 0x229]
test ecx, ecx
je 0x40ec6a
mov edx, dword [0x4b3ed4]
cmp dword [edx + 0x244], 0x1000
jae 0x40ec65
mov eax, dword [0x4b3ed4]
mov ecx, dword [eax + 0x240]
mov dword [ebp - 0x274], ecx
cmp dword [ebp - 0x274], 0
je 0x40ebff
mov edx, dword [ebp - 0x274]
push edx
call dword [sym.imp.KERNEL32.dll_GlobalUnlock]
mov eax, dword [ebp - 0x274]
push eax
call dword [sym.imp.KERNEL32.dll_GlobalFree]
mov dword [ebp - 0x274], 0
mov ecx, dword [0x4b3ed4]
mov dword [ecx + 0x244], 0
mov edx, dword [0x4b3ed4]
mov dword [edx + 0x240], 0
push 0x2000
push 0
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
mov dword [ebp - 0x274], eax
mov eax, dword [ebp - 0x274]
push eax
call dword [sym.imp.KERNEL32.dll_GlobalLock]
mov ecx, dword [0x4b3ed4]
mov dword [ecx + 0x240], eax
mov edx, dword [0x4b3ed4]
cmp dword [edx + 0x240], 0
je 0x40ec65
push 0x2000
push 0
mov eax, dword [0x4b3ed4]
mov ecx, dword [eax + 0x240]
push ecx
call fcn.00426300
add esp, 0xc
mov edx, dword [0x4b3ed4]
mov dword [edx + 0x244], 0x1000
jmp 0x40ed36
mov dword [ebp - 0x278], 0x24c
mov eax, dword [ebp - 0x278]
push eax
push 0
mov ecx, dword [0x4b3ed4]
push ecx
call fcn.00426300
add esp, 0xc
push 0x2000
push 0
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
mov dword [ebp - 0x27c], eax
mov edx, dword [ebp - 0x27c]
push edx
call dword [sym.imp.KERNEL32.dll_GlobalLock]
mov ecx, dword [0x4b3ed4]
mov dword [ecx + 0x240], eax
mov edx, dword [0x4b3ed4]
cmp dword [edx + 0x240], 0
je 0x40ecf2
push 0x2000
push 0
mov eax, dword [0x4b3ed4]
mov ecx, dword [eax + 0x240]
push ecx
call fcn.00426300
add esp, 0xc
mov edx, dword [0x4b3ed4]
mov dword [edx + 0x244], 0x1000
mov eax, dword [0x4b3ed4]
add eax, 0xc
push eax
call dword [sym.imp.KERNEL32.dll_InitializeCriticalSection]
mov ecx, dword [0x4b3ed4]
mov dword [ecx], 0x30300
mov edx, dword [0x4b3ed4]
mov eax, dword [ebp - 0x278]
mov dword [edx + 4], eax
push 1
mov ecx, dword [0x4b3ed4]
call fcn.0040f4d0
push 1
mov ecx, dword [0x4b3ed4]
call fcn.0040f900
push 1
mov ecx, dword [0x4b3ed4]
add ecx, 8
push ecx
call dword [sym.imp.KERNEL32.dll_InterlockedExchangeAdd]
mov edx, dword [0x4b3ed4]
mov eax, dword [edx + 8]
mov dword [0x4b3ee0], eax
mov ecx, dword [0x4b3ed4]
cmp dword [ecx + 0xe8], 0xffffffff
jne 0x40ed87
mov edx, dword [0x4b3ed4]
cmp dword [edx + 0x2c], 0
je 0x40ed87
mov eax, dword [0x4b3ed4]
mov ecx, dword [eax + 0x23c]
add ecx, 1
mov dword [ebp - 0x288], ecx
jmp 0x40ed99
mov edx, dword [0x4b3ed4]
mov eax, dword [edx + 0x23c]
mov dword [ebp - 0x288], eax
mov ecx, dword [ebp - 0x288]
mov dword [0x4b3edc], ecx
mov ecx, dword [0x4b3ed4]
call fcn.0040ee50
mov edx, dword [0x4b3ecc]
push edx
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
mov eax, dword [0x4b3ed4]
mov dword [ebp - 0x284], eax
mov dword [ebp - 4], 0xffffffff
lea ecx, [ebp - 0x10]
call fcn.0040e0d0
mov eax, dword [ebp - 0x284]
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
mov ecx, dword [ebp - 0x18]
xor ecx, ebp
call fcn.0042624f
mov esp, ebp
pop ebp
ret