// File: EDDRSoftware[P]libdefsEval/main.cpp
// Function: parse(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, boost::filesystem::path const&, boost::filesystem::path*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, int)
bool parse(const string &varIn, const path &pathIn, path *pathOut,
           const string &line = string(), int lineNum = 0)
{
    bool retVal = true;
    wordexp_t par;
    memset(&par, 0, sizeof(par));

    wordexp(varIn.c_str(), &par, WRDE_SHOWERR | WRDE_UNDEF);

    char **wp = par.we_wordv;

    if(par.we_wordc==0){
        if(lineNum==0) {
            cerr << "INVALID FILE: " << varIn << endl;
        } else {
            cerr << "ERROR LINE: " << pathIn.string() << ":" << lineNum << " => " << line << endl;
        }

        retVal = false;
    }

    for(size_t i = 0; i<par.we_wordc; ++i) {
        path current = pathIn;

        // check for comment at end of a line
        if (*(wp[i]) == '#') {
            break;
        }

        if(!is_directory(current)) {
            current = pathIn.parent_path();
        }

        if(fullPath(wp[i], current, pathOut)) {

            if(lineNum==0) {
                cerr << "INVALID FILE: " << varIn << endl;
            } else {
                cerr << "INVALID LINE: " << pathIn.string() << ":" << lineNum << " => " << line << endl;
            }

            retVal = false;
            break;
        }
    }

    wordfree(&par);
    return retVal;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movb $0x1, -0x25(%rbp)
leaq -0x40(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x6230
movq -0x8(%rbp), %rdi
callq 0x6170
movq %rax, %rdi
leaq -0x40(%rbp), %rsi
movl $0x30, %edx
callq 0x6700
movq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x6e20
cmpl $0x0, -0x24(%rbp)
jne 0x6da6
movq 0x1a273(%rip), %rdi     # 0x20ff0
leaq 0xf2e6(%rip), %rsi      # 0x1606a
callq 0x6440
movq %rax, %rdi
movq -0x8(%rbp), %rsi
callq 0x63f0
movq %rax, %rdi
movq 0x1a1e1(%rip), %rsi     # 0x20f80
callq 0x6490
jmp 0x6e1c
movq 0x1a243(%rip), %rdi     # 0x20ff0
leaq 0xf2c5(%rip), %rsi      # 0x16079
callq 0x6440
movq %rax, -0xb0(%rbp)
movq -0x10(%rbp), %rdi
callq 0xa5b0
movq -0xb0(%rbp), %rdi
movq %rax, %rsi
callq 0x63f0
movq %rax, %rdi
leaq 0xf2a4(%rip), %rsi      # 0x16086
callq 0x6440
movq %rax, %rdi
movl -0x24(%rbp), %esi
callq 0x6750
movq %rax, %rdi
leaq 0xf336(%rip), %rsi      # 0x16132
callq 0x6440
movq %rax, %rdi
movq -0x20(%rbp), %rsi
callq 0x63f0
movq %rax, %rdi
movq 0x1a169(%rip), %rsi     # 0x20f80
callq 0x6490
movb $0x0, -0x25(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x40(%rbp), %rax
jae 0x7057
movq -0x10(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0xa5c0
movq -0x48(%rbp), %rax
movq -0x50(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
jne 0x6e63
movl $0x2, -0x74(%rbp)
jmp 0x7030
leaq -0x70(%rbp), %rdi
callq 0xa5f0
movb %al, -0xb1(%rbp)
jmp 0x6e74
movb -0xb1(%rbp), %al
testb $0x1, %al
jne 0x6ecd
jmp 0x6e80
movq -0x10(%rbp), %rsi
leaq -0xa8(%rbp), %rdi
callq 0x67e0
jmp 0x6e92
leaq -0x70(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0xa410
leaq -0xa8(%rbp), %rdi
callq 0xa440
jmp 0x6ecd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x70(%rbp), %rdi
callq 0xa440
jmp 0x706e
movq -0x48(%rbp), %rax
movq -0x50(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x18(%rbp), %rdx
leaq -0x70(%rbp), %rsi
callq 0x6a90
movl %eax, -0xb8(%rbp)
jmp 0x6eee
movl -0xb8(%rbp), %eax
cmpl $0x0, %eax
je 0x7029
cmpl $0x0, -0x24(%rbp)
jne 0x6f52
movq 0x1a0e6(%rip), %rdi     # 0x20ff0
leaq 0xf159(%rip), %rsi      # 0x1606a
callq 0x6440
movq %rax, -0xc0(%rbp)
jmp 0x6f1f
movq -0xc0(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x63f0
movq %rax, -0xc8(%rbp)
jmp 0x6f38
movq -0xc8(%rbp), %rdi
movq 0x1a03a(%rip), %rsi     # 0x20f80
callq 0x6490
jmp 0x6f4d
jmp 0x701c
movq 0x1a097(%rip), %rdi     # 0x20ff0
leaq 0xf128(%rip), %rsi      # 0x16088
callq 0x6440
movq %rax, -0xd0(%rbp)
jmp 0x6f6e
movq -0x10(%rbp), %rdi
callq 0xa5b0
movq %rax, -0xd8(%rbp)
jmp 0x6f80
movq -0xd8(%rbp), %rsi
movq -0xd0(%rbp), %rdi
callq 0x63f0
movq %rax, -0xe0(%rbp)
jmp 0x6f9c
movq -0xe0(%rbp), %rdi
leaq 0xf0dc(%rip), %rsi      # 0x16086
callq 0x6440
movq %rax, -0xe8(%rbp)
jmp 0x6fb8
movq -0xe8(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0x6750
movq %rax, -0xf0(%rbp)
jmp 0x6fd0
movq -0xf0(%rbp), %rdi
leaq 0xf154(%rip), %rsi      # 0x16132
callq 0x6440
movq %rax, -0xf8(%rbp)
jmp 0x6fec
movq -0xf8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x63f0
movq %rax, -0x100(%rbp)
jmp 0x7005
movq -0x100(%rbp), %rdi
movq 0x19f6d(%rip), %rsi     # 0x20f80
callq 0x6490
jmp 0x701a
jmp 0x701c
movb $0x0, -0x25(%rbp)
movl $0x2, -0x74(%rbp)
jmp 0x7030
movl $0x0, -0x74(%rbp)
leaq -0x70(%rbp), %rdi
callq 0xa440
movl -0x74(%rbp), %eax
testl %eax, %eax
je 0x7044
jmp 0x7042
jmp 0x7057
jmp 0x7046
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x6e28
leaq -0x40(%rbp), %rdi
callq 0x6430
movb -0x25(%rbp), %al
andb $0x1, %al
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq -0x80(%rbp), %rdi
callq 0x6780
nopw (%rax,%rax)