// File: fulhax[P]ncpamixer/src/config.cpp
// Function: Config::getDefaultConfigFile()
bool Config::getDefaultConfigFile()
{
    std::error_code ec{};
    std::string f{FILENAME};
    const auto xdg{getenv(XDG_CONFIG)};
    fs::path config_dir{xdg == nullptr ? "" : xdg};
    if (!fs::is_directory(config_dir, ec))
    {
        const auto home{getHomeDir()};
        if (home) config_dir = fs::path(home);
        f.insert(0, 1, '.');
    }

    if (fs::is_directory(config_dir, ec))
    {
        full_path = fs::absolute(config_dir / f, ec);
        if (!fs::exists(full_path, ec))
        {
            fprintf(
              stderr,
              "Default file '%s' does not exist, creating one for you ;)\n",
              full_path.c_str()
            );
            return createDefault();
        }
        return true;
    }

    fprintf(
      stderr,
      "Unable to find 'HOME' and/or '%s' folders.\n",
        XDG_CONFIG
    );
    return false;
}

// Assembly:
subq $0x178, %rsp            # imm = 0x178
movq %rdi, 0x168(%rsp)
movq 0x168(%rsp), %rax
movq %rax, 0x28(%rsp)
leaq 0x158(%rsp), %rdi
callq 0x10ea0
leaq 0x137(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x7c50
movq 0x30(%rsp), %rdx
leaq 0x11cf5(%rip), %rsi     # 0x215cc
leaq 0x138(%rsp), %rdi
callq 0x10940
jmp 0xf8e6
leaq 0x137(%rsp), %rdi
callq 0x7760
leaq 0x11ce6(%rip), %rdi     # 0x215e0
callq 0x7850
movq %rax, 0x118(%rsp)
cmpq $0x0, 0x118(%rsp)
jne 0xf920
leaq 0x10be2(%rip), %rax     # 0x204fb
movq %rax, 0x20(%rsp)
jmp 0xf92d
movq 0x118(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0xe8(%rsp)
leaq 0xf0(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
movl $0x2, %edx
callq 0x10ed0
jmp 0xf956
leaq 0xf0(%rsp), %rdi
leaq 0x158(%rsp), %rsi
callq 0x10fd0
testb $0x1, %al
jne 0xfa52
callq 0xf760
movq %rax, 0x18(%rsp)
jmp 0xf97f
movq 0x18(%rsp), %rax
movq %rax, 0xe0(%rsp)
cmpq $0x0, 0xe0(%rsp)
je 0xfa33
leaq 0xb8(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
movl $0x2, %edx
callq 0x10ed0
jmp 0xf9b7
leaq 0xf0(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x87f0
leaq 0xb8(%rsp), %rdi
callq 0x8460
jmp 0xfa33
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x128(%rsp)
movl %eax, 0x124(%rsp)
leaq 0x137(%rsp), %rdi
callq 0x7760
jmp 0xfc36
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x128(%rsp)
movl %eax, 0x124(%rsp)
jmp 0xfc29
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x128(%rsp)
movl %eax, 0x124(%rsp)
jmp 0xfc1c
xorl %eax, %eax
movl %eax, %esi
leaq 0x138(%rsp), %rdi
movl $0x1, %edx
movl $0x2e, %ecx
callq 0x7da0
jmp 0xfa50
jmp 0xfa52
leaq 0xf0(%rsp), %rdi
leaq 0x158(%rsp), %rsi
callq 0x10fd0
testb $0x1, %al
jne 0xfa70
jmp 0xfbc2
leaq 0x40(%rsp), %rdi
leaq 0x138(%rsp), %rsi
movl $0x2, %edx
callq 0x110a0
jmp 0xfa89
leaq 0x68(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
leaq 0x40(%rsp), %rdx
callq 0x11010
jmp 0xfaa2
leaq 0x90(%rsp), %rdi
leaq 0x68(%rsp), %rsi
leaq 0x158(%rsp), %rdx
callq 0x7570
jmp 0xfabe
movq 0x28(%rsp), %rdi
addq $0x30, %rdi
leaq 0x90(%rsp), %rsi
callq 0x87f0
leaq 0x90(%rsp), %rdi
callq 0x8460
leaq 0x68(%rsp), %rdi
callq 0x8460
leaq 0x40(%rsp), %rdi
callq 0x8460
movq 0x28(%rsp), %rdi
addq $0x30, %rdi
leaq 0x158(%rsp), %rsi
callq 0x111a0
testb $0x1, %al
jne 0xfbb0
movq 0x28(%rsp), %rdi
movq 0x1b489(%rip), %rax     # 0x2afa8
movq (%rax), %rax
movq %rax, 0x8(%rsp)
addq $0x30, %rdi
callq 0x11210
movq 0x8(%rsp), %rdi
movq %rax, %rdx
leaq 0x108dc(%rip), %rsi     # 0x2041b
xorl %eax, %eax
callq 0x79b0
movq 0x28(%rsp), %rdi
callq 0xfc50
movb %al, 0x17(%rsp)
jmp 0xfb56
movb 0x17(%rsp), %al
andb $0x1, %al
movb %al, 0x177(%rsp)
movl $0x1, 0x3c(%rsp)
jmp 0xfbf1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x128(%rsp)
movl %eax, 0x124(%rsp)
jmp 0xfba4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x128(%rsp)
movl %eax, 0x124(%rsp)
leaq 0x68(%rsp), %rdi
callq 0x8460
leaq 0x40(%rsp), %rdi
callq 0x8460
jmp 0xfc1c
movb $0x1, 0x177(%rsp)
movl $0x1, 0x3c(%rsp)
jmp 0xfbf1
movq 0x1b3df(%rip), %rax     # 0x2afa8
movq (%rax), %rdi
leaq 0x10883(%rip), %rsi     # 0x20456
leaq 0x11a06(%rip), %rdx     # 0x215e0
movb $0x0, %al
callq 0x79b0
movb $0x0, 0x177(%rsp)
movl $0x1, 0x3c(%rsp)
leaq 0xf0(%rsp), %rdi
callq 0x8460
leaq 0x138(%rsp), %rdi
callq 0x7480
movb 0x177(%rsp), %al
andb $0x1, %al
addq $0x178, %rsp            # imm = 0x178
retq
leaq 0xf0(%rsp), %rdi
callq 0x8460
leaq 0x138(%rsp), %rdi
callq 0x7480
movq 0x128(%rsp), %rdi
callq 0x7c40
nopw %cs:(%rax,%rax)