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

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x583720
mov eax, dword fs:[0]
push eax
sub esp, 0x30
mov eax, dword [0x615000]
xor eax, ebp
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
cmp dword [ebp + 0xc], 0
jne 0x40bd4e
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.0040bb40
add esp, 0x14
jmp 0x40c034
mov dword [ebp - 0x14], 0
mov edx, dword [ebp + 0x10]
push edx
mov eax, dword [ebp + 0xc]
push eax
call fcn.0055af56
add esp, 8
mov dword [ebp - 0x18], eax
cmp dword [ebp - 0x18], 0
jg 0x40bd75
mov dword [ebp - 0x18], 0x800
mov ecx, dword [ebp - 0x18]
lea edx, [ecx + ecx + 2]
push edx
call fcn.0055ba39
add esp, 4
mov dword [ebp - 0x14], eax
cmp dword [ebp - 0x14], 0
jne 0x40bdb6
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.0040bb40
add esp, 0x14
jmp 0x40c034
mov eax, dword [ebp - 0x18]
lea ecx, [eax + eax + 2]
push ecx
push 0
mov edx, dword [ebp - 0x14]
push edx
call fcn.00562540
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.0055c4e5
add esp, 0x10
mov dword [ebp - 0x20], eax
cmp dword [ebp - 0x20], 0
jg 0x40be10
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.0040bb40
add esp, 0x14
lea ecx, [ebp - 0x10]
call fcn.0042e580
mov dword [ebp - 4], 0
call dword [sym.imp.KERNEL32.dll_IsDebuggerPresent]
test eax, eax
je 0x40bed9
cmp dword [ebp + 8], 0
je 0x40be88
lea ecx, [ebp - 0x28]
push ecx
call fcn.0040b9d0
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 0x5fbcc8
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.00407930
add esp, 0x1c
mov byte [ebp - 4], 0
lea ecx, [ebp - 0x28]
call fcn.0042e5a0
jmp 0x40bed7
lea eax, [ebp - 0x2c]
push eax
call fcn.0040b9d0
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 0x5fbcfc
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.00407930
add esp, 0x18
mov byte [ebp - 4], 0
lea ecx, [ebp - 0x2c]
call fcn.0042e5a0
jmp 0x40bf27
cmp dword [ebp + 8], 0
je 0x40bf06
mov ecx, dword [ebp - 0x14]
push ecx
mov edx, dword [ebp + 8]
push edx
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
push eax
push 0x5fbd28
push str._s__d__S__s
lea eax, [ebp - 0x10]
push eax
call fcn.00407930
add esp, 0x18
jmp 0x40bf27
mov ecx, dword [ebp - 0x14]
push ecx
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
push eax
push 0x5fbd50
push str._s__d__s
lea edx, [ebp - 0x10]
push edx
call fcn.00407930
add esp, 0x14
cmp dword [ebp - 0x14], 0
je 0x40bf40
mov eax, dword [ebp - 0x14]
push eax
call fcn.0055b95c
add esp, 4
mov dword [ebp - 0x14], 0
mov ecx, 0x63a9a0
call fcn.00481ff0
push eax
lea ecx, [ebp - 0x1c]
call fcn.00431210
mov byte [ebp - 4], 3
lea ecx, [ebp - 0x10]
call fcn.004027c0
push eax
call dword [sym.imp.KERNEL32.dll_OutputDebugStringW]
push 0
push 0x5fbd74
lea ecx, [ebp - 0x10]
call fcn.0040b2a0
test eax, eax
jl 0x40c019
movzx ecx, word [0x63bb90]
test ecx, ecx
jne 0x40bfe3
push 0x208
push 0x63bb90
push 0
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
push 0x63bb90
call dword [sym.imp.SHLWAPI.dll_PathRemoveFileSpecW]
push 0x5fbd7c
push 0x63bb90
call dword [sym.imp.SHLWAPI.dll_PathAppendW]
push 0x63bb90
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
jne 0x40bfd3
push 0
push 0x63bb90
push 0
call dword [sym.imp.SHELL32.dll_SHCreateDirectoryExW]
push str.HBC_debug_r.log
push 0x63bb90
call dword [sym.imp.SHLWAPI.dll_PathAppendW]
lea edx, [ebp - 0x24]
push edx
call fcn.0040ba80
add esp, 4
push 0x63bb90
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.0042e5a0
mov byte [ebp - 4], 0
lea ecx, [ebp - 0x1c]
call fcn.0040b990
mov dword [ebp - 4], 0xffffffff
lea ecx, [ebp - 0x10]
call fcn.0042e5a0
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
mov esp, ebp
pop ebp
ret