Function at 0x520370
Capabilities:
Print debug messages

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x57858b
mov eax, dword fs:[0]
push eax
sub esp, 0xd4
mov eax, dword [0x5cb464]
xor eax, ebp
mov dword [ebp - 0x10], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov ebx, ecx
mov edx, dword [ebx]
mov eax, dword [ebp + 8]
push eax
call dword [edx]
cmp byte [ebx + 0xc], 0
je 0x5204a6
mov edi, dword [ebx + 0x14]
lea esi, [ebx + 0x20]
push 0x180
push 0x40
push 0x8109
push edi
push esi
call fcn.005182d6
add esp, 0x14
mov dword [ebp - 0xb0], eax
test eax, eax
je 0x520486
push 0x98
lea eax, [ebp - 0xa8]
push 0
push eax
call fcn.004cc090
add esp, 0xc
lea ecx, [ebp - 0xa8]
push 1
push 2
call fcn.0051c960
push 0x59c05c
push dword [ebp - 0xb0]
lea eax, [ebp - 0xa8]
mov dword [ebp - 4], 0
push str._error.__
push edi
push str.open
push eax
call fcn.0051c080
add esp, 8
push eax
call fcn.0051c080
add esp, 8
push eax
call fcn.0051c080
add esp, 8
mov ecx, eax
call fcn.0051cde0
push eax
call fcn.0051c080
add esp, 8
lea eax, [ebp - 0xe0]
lea ecx, [ebp - 0xa8]
push eax
call fcn.005202b0
cmp dword [eax + 0x14], 8
jb 0x520469
mov eax, dword [eax]
push eax
call dword [sym.imp.KERNEL32.dll_OutputDebugStringW]
lea ecx, [ebp - 0xe0]
call fcn.0041a710
lea ecx, [ebp - 0xa8]
call fcn.00495f60
mov eax, dword [esi]
cmp eax, 0xffffffff
je 0x52049c
push 2
push 0
push eax
call fcn.0051867e
add esp, 0xc
jmp 0x52049f
or eax, 0xffffffff
mov dword [ebx + 8], eax
mov byte [ebx + 0xc], 0
mov eax, dword [ebx + 4]
mov dword [ebp - 0xc8], eax
test eax, eax
je 0x5205f6
mov esi, dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
push 0
push eax
mov byte [ebp - 0xa9], 0
call esi
movzx ecx, byte [ebp - 0xa9]
test eax, eax
mov edx, 1
cmove ecx, edx
mov dword [ebp - 0xb0], ecx
test cl, cl
jne 0x520502
cmp dword [ebp + 0xc], 0
je 0x5204fa
push 0xffffffffffffffff
push dword [ebx + 4]
call esi
mov byte [ebp - 0xb0], 1
jmp 0x520502
test cl, cl
je 0x5205f6
lea edi, [ebx + 0x24]
mov dword [ebp - 0xc4], 0
mov dword [ebp - 0xc0], 0
mov dword [ebp - 0xbc], 0
test edi, edi
je 0x52052e
push edi
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
lea ecx, [ebx + 0x3c]
xor esi, esi
xor eax, eax
mov dword [ebp - 0xb8], esi
lea edx, [ebp - 0xc4]
mov dword [ebp - 0xb4], eax
cmp edx, ecx
je 0x52057f
mov esi, dword [ecx]
mov dword [ecx], eax
mov edx, dword [ecx + 4]
mov dword [ecx + 4], eax
mov eax, dword [ecx + 8]
mov dword [ebp - 0xbc], eax
mov eax, edx
mov dword [ebp - 0xc4], esi
mov dword [ebp - 0xb8], edx
mov dword [ebp - 0xc0], edx
mov dword [ecx + 8], 0
mov dword [ebp - 0xb4], eax
test edi, edi
je 0x520590
push edi
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, dword [ebp - 0xb4]
cmp esi, eax
je 0x5205cf
cmp dword [esi + 0x14], 0x10
mov ecx, esi
jb 0x52059e
mov ecx, dword [esi]
mov eax, dword [ebx + 0x20]
cmp eax, 0xffffffff
je 0x5205b7
push dword [esi + 0x10]
push ecx
push eax
call fcn.0050b8a7
add esp, 0xc
mov ecx, eax
jmp 0x5205ba
or ecx, 0xffffffff
mov edi, dword [ebx + 8]
add esi, 0x18
add edi, ecx
mov dword [ebx + 8], edi
cmp esi, dword [ebp - 0xb8]
jne 0x520594
jmp 0x5205d2
mov edi, dword [ebx + 8]
lea ecx, [ebp - 0xc4]
call fcn.004af000
cmp byte [ebp - 0xb0], 0
je 0x5205f2
push dword [ebp - 0xc8]
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
mov eax, edi
jmp 0x5205f9
mov eax, dword [ebx + 8]
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 0x10]
xor ecx, ebp
call fcn.0046997a
mov esp, ebp
pop ebp
ret 8