Function at 0x40d570
Capabilities:
Check mutex on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x10
mov eax, dword [0x4349a4]
test eax, eax
jne 0x40d584
call fcn.0040e9c0
push ebx
push esi
push edi
mov edi, dword [ebp + 8]
cmp edi, 0xfffffffb
jge 0x40d59b
pop edi
pop esi
mov eax, 0xc0000020
pop ebx
mov esp, ebp
pop ebp
ret
jne 0x40d673
lea eax, [ebp - 4]
push eax
push 0xfffffffffffffffb
call fcn.0040dba0
add esp, 8
test eax, eax
je 0x40d5c3
mov ecx, dword [ebp + 0xc]
pop edi
pop esi
pop ebx
mov dword [ecx], 0
mov esp, ebp
pop ebp
ret
mov eax, dword [0x42d3dc]
cmp eax, 2
jl 0x40d5fd
lea edx, [ebp + 8]
push edx
call fcn.0040ebe0
mov esi, eax
add esp, 4
test esi, esi
je 0x40d616
mov eax, dword [ebp - 4]
push eax
call fcn.0040bd80
mov ecx, dword [ebp + 0xc]
add esp, 4
mov eax, esi
pop edi
pop esi
mov dword [ecx], 0
pop ebx
mov esp, ebp
pop ebp
ret
cmp eax, 1
jl 0x40d60f
push 0x42d3d4
call fcn.0040ec10
add esp, 4
mov dword [ebp + 8], 0x42d3b0
mov edx, dword [ebp + 8]
mov ecx, dword [ebp - 4]
mov eax, dword [edx]
mov dword [ecx + 0x18], eax
mov eax, dword [ebp + 8]
mov edx, dword [ebp - 4]
mov dword [eax], edx
mov eax, dword [0x42d3dc]
cmp eax, 1
jl 0x40d646
mov eax, dword [ebp + 8]
mov ecx, dword [eax + 0x28]
mov edx, dword [eax + 0x24]
push ecx
push edx
call fcn.0040ec40
add esp, 8
mov eax, dword [ebp - 4]
mov cl, byte [ebp + 0x14]
mov byte [eax + 0x123], cl
mov eax, dword [ebp + 0x10]
mov ecx, dword [ebp - 4]
test eax, eax
je 0x40d65f
mov dword [eax + 4], ecx
mov edx, dword [ebp + 0xc]
mov dword [ecx + 0x58], eax
mov eax, dword [ebp - 4]
mov dword [edx], eax
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret
lea eax, [edi + 5]
cmp eax, 0x69
mov dword [ebp - 8], eax
jge 0x40d845
lea esi, [eax*8]
mov ebx, dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
sub esi, eax
shl esi, 2
mov ecx, dword [esi + 0x43870c]
test ecx, ecx
je 0x40d6c3
lea esi, [eax*8]
sub esi, eax
shl esi, 2
call ebx
cmp dword [esi + 0x438708], eax
jne 0x40d6c0
pop edi
pop esi
mov eax, 0xc0000028
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [ebp - 8]
cmp dword [0x42d3dc], 2
jl 0x40d783
mov eax, dword [esi + 0x438700]
lea edi, [esi + 0x438700]
test eax, eax
jne 0x40d74c
lea ecx, [esi + 0x438704]
push ecx
call fcn.0040ec60
add esp, 4
test eax, eax
jne 0x40d777
mov ecx, dword [ebp - 8]
lea eax, [ecx*8]
sub eax, ecx
shl eax, 2
mov edx, dword [eax + 0x438700]
lea edi, [eax + 0x438700]
test edx, edx
jne 0x40d742
lea esi, [ecx*8]
push 0
sub esi, ecx
push 0
shl esi, 2
push 0
lea edi, [esi + 0x438700]
call dword [sym.imp.KERNEL32.dll_CreateMutexA]
mov dword [edi], eax
mov dword [esi + 0x438704], 0
jmp 0x40d74c
mov dword [eax + 0x438704], 0
mov edx, dword [edi]
push 0xffffffffffffffff
push edx
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
mov eax, dword [ebp - 8]
lea ecx, [eax*8]
sub ecx, eax
lea edx, [ecx*4 + 0x438704]
push edx
call fcn.0040ec60
add esp, 4
test eax, eax
je 0x40d799
pop edi
pop esi
mov eax, 0xc0000098
pop ebx
mov esp, ebp
pop ebp
ret
mov ecx, dword [esi + 0x438704]
test ecx, ecx
jne 0x40d777
mov dword [esi + 0x438704], 1
jmp 0x40d79f
mov eax, dword [ebp - 8]
mov edi, dword [ebp + 8]
lea esi, [eax*8]
sub esi, eax
shl esi, 2
call ebx
mov dword [esi + 0x438708], eax
mov dword [esi + 0x43870c], 1
mov eax, dword [esi + 0x438718]
xor ebx, ebx
cmp eax, ebx
jne 0x40d838
lea eax, [ebp - 4]
push eax
push edi
call fcn.0040dba0
mov esi, eax
add esp, 8
cmp esi, ebx
je 0x40d81d
mov ecx, dword [ebp - 8]
lea eax, [ecx*8]
sub eax, ecx
mov ecx, dword [0x42d3dc]
shl eax, 2
cmp ecx, 2
mov dword [eax + 0x43870c], ebx
mov dword [eax + 0x438704], ebx
jl 0x40d80f
mov ecx, dword [eax + 0x438700]
push ecx
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
mov edx, dword [ebp + 0xc]
mov eax, esi
pop edi
pop esi
mov dword [edx], ebx
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [ebp - 8]
lea ecx, [eax*8]
sub ecx, eax
mov eax, dword [ebp - 4]
mov dword [ecx*4 + 0x438718], eax
jmp 0x40db10
mov ebx, 1
mov dword [ebp - 4], eax
jmp 0x40db10
lea edx, [ebp - 0x10]
lea eax, [ebp - 4]
push edx
lea ecx, [ebp - 8]
push eax
push ecx
push edi
call fcn.0040dc60
add esp, 0x10
test eax, eax
je 0x40d86e
mov edx, dword [ebp + 0xc]
pop edi
pop esi
pop ebx
mov dword [edx], 0
mov esp, ebp
pop ebp
ret
mov ecx, dword [ebp - 4]
test ecx, ecx
je 0x40d88a
cmp dword [ecx + 0xbc], edi
jne 0x40d88a
mov edx, dword [ebp - 8]
mov ebx, 1
jmp 0x40d971
lea eax, [ebp - 0xc]
xor ebx, ebx
push eax
push edi
call fcn.0040dba0
mov esi, eax
add esp, 8
test esi, esi
je 0x40d93a
cmp dword [0x42d3dc], 1
jl 0x40d8d0
mov eax, dword [ebp - 8]
lea ecx, [eax*8]
sub ecx, eax
mov edx, dword [ecx*4 + 0x438714]
push edx
mov eax, dword [ecx*4 + 0x438710]
push eax
call fcn.0040ec40
add esp, 8
cmp dword [0x42d3dc], 2
jl 0x40d911
mov ecx, dword [ebp - 8]
lea eax, [ecx*8]
sub eax, ecx
shl eax, 2
mov dword [eax + 0x438704], 0
mov ecx, dword [eax + 0x438700]
push ecx
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
mov eax, dword [ebp + 0xc]
pop edi
mov dword [eax], 0
mov eax, esi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [ebp - 8]
pop edi
lea edx, [eax*8]
sub edx, eax
mov eax, dword [ebp + 0xc]
mov dword [edx*4 + 0x438704], 0
mov dword [eax], 0
mov eax, esi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov edx, dword [ebp - 0xc]
mov ecx, dword [ebp - 4]
mov dword [edx + 0x18], ecx
mov eax, dword [ebp - 0x10]
test eax, eax
je 0x40d955
mov ecx, dword [ebp - 0xc]
mov dword [eax + 0x18], ecx
mov edx, dword [ebp - 8]
jmp 0x40d96b
mov edx, dword [ebp - 8]
mov ecx, dword [ebp - 0xc]
lea eax, [edx*8]
sub eax, edx
mov dword [eax*4 + 0x438718], ecx
mov ecx, dword [ebp - 0xc]
mov dword [ebp - 4], ecx
mov eax, dword [ecx + 0xc]
mov esi, dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
xor edi, edi
cmp eax, edi
je 0x40d9fc
call esi
mov ecx, dword [ebp - 4]
cmp dword [ecx + 8], eax
jne 0x40d9f9
mov edx, dword [ebp - 8]
mov esi, 0xc0000028
cmp dword [0x42d3dc], 1
jl 0x40d9bf
lea eax, [edx*8]
sub eax, edx
mov ecx, dword [eax*4 + 0x438714]
push ecx
mov edx, dword [eax*4 + 0x438710]
push edx
call fcn.0040ec40
mov edx, dword [ebp - 8]
add esp, 8
cmp dword [0x42d3dc], 2
jl 0x40dadc
lea eax, [edx*8]
sub eax, edx
shl eax, 2
mov dword [eax + 0x438704], edi
mov eax, dword [eax + 0x438700]
push eax
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
mov edx, dword [ebp + 0xc]
mov eax, esi
mov dword [edx], edi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov edx, dword [ebp - 8]
cmp dword [0x42d3dc], 2
jl 0x40da62
cmp dword [ecx], edi
jne 0x40da37
add ecx, 4
push ecx
call fcn.0040ec60
add esp, 4
test eax, eax
jne 0x40da55
mov eax, dword [ebp - 4]
cmp dword [eax], edi
jne 0x40da31
push edi
push edi
push edi
call dword [sym.imp.KERNEL32.dll_CreateMutexA]
mov edx, dword [ebp - 4]
mov dword [edx], eax
mov eax, dword [ebp - 4]
mov dword [eax + 4], edi
mov ecx, dword [ebp - 4]
mov ecx, dword [ecx]
push 0xffffffffffffffff
push ecx
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
mov edx, dword [ebp - 4]
add edx, 4
push edx
call fcn.0040ec60
add esp, 4
cmp eax, edi
je 0x40da6e
mov edx, dword [ebp - 8]
mov esi, 0xc0000098
jmp 0x40d992
cmp dword [ecx + 4], edi
jne 0x40da58
mov dword [ecx + 4], 1
call esi
mov ecx, dword [ebp - 4]
mov dword [ecx + 8], eax
mov edx, dword [ebp - 4]
mov eax, 1
mov dword [edx + 0xc], eax
mov ecx, dword [0x42d3dc]
cmp ecx, eax
jl 0x40daaf
mov eax, dword [ebp - 8]
lea ecx, [eax*8]
sub ecx, eax
mov edx, dword [ecx*4 + 0x438714]
push edx
mov eax, dword [ecx*4 + 0x438710]
push eax
call fcn.0040ec40
add esp, 8
cmp dword [0x42d3dc], 2
jl 0x40dafa
mov ecx, dword [ebp - 8]
lea eax, [ecx*8]
sub eax, ecx
shl eax, 2
mov dword [eax + 0x438704], edi
mov ecx, dword [eax + 0x438700]
push ecx
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
jmp 0x40db0d
lea ecx, [edx*8]
mov eax, esi
sub ecx, edx
mov edx, dword [ebp + 0xc]
mov dword [ecx*4 + 0x438704], edi
mov dword [edx], edi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [ebp - 8]
lea edx, [eax*8]
sub edx, eax
mov dword [edx*4 + 0x438704], edi
mov eax, dword [ebp - 4]
mov edi, dword [ebp + 0xc]
mov ecx, dword [ebp + 0x10]
test ecx, ecx
mov dword [edi], eax
je 0x40db1f
mov dword [ecx + 4], eax
mov dword [eax + 0x58], ecx
mov ecx, dword [ebp + 0x14]
mov eax, ecx
sub eax, 4
je 0x40db5c
sub eax, 4
je 0x40db47
sub eax, 2
je 0x40db5c
mov eax, dword [ebp - 4]
mov edx, dword [eax + 0x130]
and edx, 0xffefffff
jmp 0x40db56
mov eax, dword [ebp - 4]
mov edx, dword [eax + 0x130]
or edx, 0x100000
mov dword [eax + 0x130], edx
mov eax, dword [ebp - 4]
test ebx, ebx
mov byte [eax + 0x123], cl
je 0x40d66a
push ecx
mov ecx, dword [ebp - 4]
push ecx
call fcn.0040ddd0
mov esi, eax
add esp, 8
test esi, esi
je 0x40d66a
mov edx, dword [ebp + 8]
push edx
call fcn.0040dfe0
add esp, 4
mov dword [edi], 0
mov eax, esi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret