Function at 0x40bee0
Capabilities:
Check if file exists
Create directory
Print debug messages

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x5899c0
mov eax, dword fs:[0]
push eax
sub esp, 0x30
mov eax, dword [0x61b000]
xor eax, ebp
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
cmp dword [ebp + 0xc], 0
jne 0x40bf2e
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
mov eax, dword [ebp + 0xc]
push eax
mov ecx, dword [ebp + 8]
push ecx
push 0
push str.format_string_invalid
call fcn.0040bd20
add esp, 0x14
jmp 0x40c214
mov dword [ebp - 0x14], 0
mov edx, dword [ebp + 0x10]
push edx
mov eax, dword [ebp + 0xc]
push eax
call fcn.00560fcd
add esp, 8
mov dword [ebp - 0x18], eax
cmp dword [ebp - 0x18], 0
jg 0x40bf55
mov dword [ebp - 0x18], 0x800
mov ecx, dword [ebp - 0x18]
lea edx, [ecx + ecx + 2]
push edx
call fcn.00561ab0
add esp, 4
mov dword [ebp - 0x14], eax
cmp dword [ebp - 0x14], 0
jne 0x40bf96
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
mov eax, dword [ebp + 0xc]
push eax
mov ecx, dword [ebp + 8]
push ecx
mov edx, dword [ebp - 0x18]
add edx, 1
push edx
push str.malloc_fail
call fcn.0040bd20
add esp, 0x14
jmp 0x40c214
mov eax, dword [ebp - 0x18]
lea ecx, [eax + eax + 2]
push ecx
push 0
mov edx, dword [ebp - 0x14]
push edx
call fcn.00568440
add esp, 0xc
mov eax, dword [ebp + 0x10]
push eax
mov ecx, dword [ebp + 0xc]
push ecx
mov edx, dword [ebp - 0x18]
push edx
mov eax, dword [ebp - 0x14]
push eax
call fcn.00562555
add esp, 0x10
mov dword [ebp - 0x20], eax
cmp dword [ebp - 0x20], 0
jg 0x40bff0
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
mov ecx, dword [ebp + 0xc]
push ecx
mov edx, dword [ebp + 8]
push edx
mov eax, dword [ebp - 0x18]
add eax, 1
push eax
push str._vsnwprintf_fail
call fcn.0040bd20
add esp, 0x14
lea ecx, [ebp - 0x10]
call fcn.0042eca0
mov dword [ebp - 4], 0
call dword [sym.imp.KERNEL32.dll_IsDebuggerPresent]
test eax, eax
je 0x40c0b9
cmp dword [ebp + 8], 0
je 0x40c068
lea ecx, [ebp - 0x28]
push ecx
call fcn.0040bbb0
add esp, 4
mov dword [ebp - 0x30], eax
mov edx, dword [ebp - 0x30]
mov dword [ebp - 0x34], edx
mov byte [ebp - 4], 1
mov eax, dword [ebp - 0x14]
push eax
mov ecx, dword [ebp + 8]
push ecx
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
push eax
push 0x601d40
mov ecx, dword [ebp - 0x34]
call fcn.004027c0
push eax
push str._s__s__d__S__s_r_n
lea edx, [ebp - 0x10]
push edx
call fcn.00407aa0
add esp, 0x1c
mov byte [ebp - 4], 0
lea ecx, [ebp - 0x28]
call fcn.0042ecc0
jmp 0x40c0b7
lea eax, [ebp - 0x2c]
push eax
call fcn.0040bbb0
add esp, 4
mov dword [ebp - 0x38], eax
mov ecx, dword [ebp - 0x38]
mov dword [ebp - 0x3c], ecx
mov byte [ebp - 4], 2
mov edx, dword [ebp - 0x14]
push edx
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
push eax
push 0x601d74
mov ecx, dword [ebp - 0x3c]
call fcn.004027c0
push eax
push str._s__s__d__s_r_n
lea eax, [ebp - 0x10]
push eax
call fcn.00407aa0
add esp, 0x18
mov byte [ebp - 4], 0
lea ecx, [ebp - 0x2c]
call fcn.0042ecc0
jmp 0x40c107
cmp dword [ebp + 8], 0
je 0x40c0e6
mov ecx, dword [ebp - 0x14]
push ecx
mov edx, dword [ebp + 8]
push edx
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
push eax
push 0x601da0
push str._s__d__S__s
lea eax, [ebp - 0x10]
push eax
call fcn.00407aa0
add esp, 0x18
jmp 0x40c107
mov ecx, dword [ebp - 0x14]
push ecx
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
push eax
push 0x601dc8
push str._s__d__s
lea edx, [ebp - 0x10]
push edx
call fcn.00407aa0
add esp, 0x14
cmp dword [ebp - 0x14], 0
je 0x40c120
mov eax, dword [ebp - 0x14]
push eax
call fcn.005619d3
add esp, 4
mov dword [ebp - 0x14], 0
mov ecx, 0x6409fc
call fcn.0047c500
push eax
lea ecx, [ebp - 0x1c]
call fcn.004321e0
mov byte [ebp - 4], 3
lea ecx, [ebp - 0x10]
call fcn.004027c0
push eax
call dword [sym.imp.KERNEL32.dll_OutputDebugStringW]
push 0
push 0x601dec
lea ecx, [ebp - 0x10]
call fcn.0040b480
test eax, eax
jl 0x40c1f9
movzx ecx, word [0x641cd0]
test ecx, ecx
jne 0x40c1c3
push 0x208
push 0x641cd0
push 0
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
push 0x641cd0
call dword [sym.imp.SHLWAPI.dll_PathRemoveFileSpecW]
push 0x601df4
push 0x641cd0
call dword [sym.imp.SHLWAPI.dll_PathAppendW]
push 0x641cd0
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
jne 0x40c1b3
push 0
push 0x641cd0
push 0
call dword [sym.imp.SHELL32.dll_SHCreateDirectoryExW]
push str.HBC_debug_r.log
push 0x641cd0
call dword [sym.imp.SHLWAPI.dll_PathAppendW]
lea edx, [ebp - 0x24]
push edx
call fcn.0040bc60
add esp, 4
push 0x641cd0
lea ecx, [ebp - 0x10]
call fcn.004027c0
push eax
lea ecx, [ebp - 0x24]
call fcn.004027c0
push eax
push str.dbg_out
call dword [sym.imp.KERNEL32.dll_WritePrivateProfileStringW]
lea ecx, [ebp - 0x24]
call fcn.0042ecc0
mov byte [ebp - 4], 0
lea ecx, [ebp - 0x1c]
call fcn.00432220
mov dword [ebp - 4], 0xffffffff
lea ecx, [ebp - 0x10]
call fcn.0042ecc0
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
mov esp, ebp
pop ebp
ret