// File: pokorj54[P]Pathfinder-utilities/src/CommandLine.cpp
// Function: GetCommandAndArgument(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, CommandLine::Arguments&)
string _GetCommandAndArgument(string command, CommandLine::Arguments & outArguments)
{
    size_t pos = command.find(" ");
    if(pos == string::npos)
    {   
        return command;
    }
    string result = command.substr(0, pos);
    command = command.substr(pos +1, command.length());
    
    list<string> tmp;

    pos = command.find("\"");
    bool qmark = 0;
    while(pos != string::npos)
    {
        tmp.push_back(command.substr(0, pos));
        command = command.substr(pos, command.length());
        qmark = !qmark;
        pos = command.find("\"", qmark) + qmark;
    }
    tmp.push_back(command);

    for(string & s : tmp)
    {
        if(s == "")
        {
            continue;
        }
        else if(s[0] == '"')
        {
            outArguments.PushBack(s.substr(1, s.length() - 2));
        }
        else
        {
            pos = s.find(" ");
            while(pos != string::npos)
            {
                string tmpstring = s.substr(0, pos);
                if(tmpstring.find_first_not_of(' ') != string::npos)
                {
                    outArguments.PushBack(tmpstring);
                }
                s = s.substr(pos + 1, s.length());
                pos = s.find(" ");
            }
            if(s.find_first_not_of(' ') != string::npos)
            {
                outArguments.PushBack(s);
            }
        }
    }
    return result;
}

// Assembly:
subq $0x198, %rsp            # imm = 0x198
movq %rsi, 0x48(%rsp)
movq %rdi, %rax
movq 0x48(%rsp), %rdi
movq %rax, 0x50(%rsp)
movq %rax, %rcx
movq %rcx, 0x58(%rsp)
movq %rax, 0x190(%rsp)
movq %rdi, 0x188(%rsp)
movq %rdx, 0x180(%rsp)
leaq 0x8cb8(%rip), %rsi      # 0x113f8
xorl %eax, %eax
movl %eax, %edx
callq 0x3500
movq %rax, 0x178(%rsp)
cmpq $-0x1, 0x178(%rsp)
jne 0x8770
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdi
callq 0x31c0
jmp 0x8c8e
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdi
movb $0x0, 0x177(%rsp)
movq 0x178(%rsp), %rcx
xorl %eax, %eax
movl %eax, %edx
callq 0x3300
movq 0x48(%rsp), %rdi
movq 0x178(%rsp), %rax
incq %rax
movq %rax, 0x40(%rsp)
callq 0x33d0
movq 0x48(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq %rax, %rcx
leaq 0x150(%rsp), %rdi
callq 0x3300
jmp 0x87c9
movq 0x48(%rsp), %rdi
leaq 0x150(%rsp), %rsi
callq 0x3330
leaq 0x150(%rsp), %rdi
callq 0x31f0
leaq 0x128(%rsp), %rdi
callq 0x9b00
movq 0x48(%rsp), %rdi
leaq 0x8bde(%rip), %rsi      # 0x113df
xorl %eax, %eax
movl %eax, %edx
callq 0x3500
movq %rax, 0x178(%rsp)
movb $0x0, 0x127(%rsp)
cmpq $-0x1, 0x178(%rsp)
je 0x8965
movq 0x48(%rsp), %rsi
movq 0x178(%rsp), %rcx
xorl %eax, %eax
movl %eax, %edx
leaq 0x100(%rsp), %rdi
callq 0x3300
jmp 0x8849
leaq 0x128(%rsp), %rdi
leaq 0x100(%rsp), %rsi
callq 0x9c80
jmp 0x8860
leaq 0x100(%rsp), %rdi
callq 0x31f0
movq 0x48(%rsp), %rdi
movq 0x178(%rsp), %rax
movq %rax, 0x38(%rsp)
callq 0x33d0
movq 0x48(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq %rax, %rcx
leaq 0xe0(%rsp), %rdi
callq 0x3300
jmp 0x88a0
movq 0x48(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x3330
leaq 0xe0(%rsp), %rdi
callq 0x31f0
movq 0x48(%rsp), %rdi
movb 0x127(%rsp), %al
xorb $-0x1, %al
andb $0x1, %al
movb %al, 0x127(%rsp)
movb 0x127(%rsp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, %edx
leaq 0x8af4(%rip), %rsi      # 0x113df
callq 0x3500
movb 0x127(%rsp), %cl
andb $0x1, %cl
movzbl %cl, %ecx
addq %rcx, %rax
movq %rax, 0x178(%rsp)
jmp 0x881a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x148(%rsp)
movl %eax, 0x144(%rsp)
jmp 0x8c82
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x148(%rsp)
movl %eax, 0x144(%rsp)
jmp 0x8c67
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x148(%rsp)
movl %eax, 0x144(%rsp)
leaq 0x100(%rsp), %rdi
callq 0x31f0
jmp 0x8c67
movq 0x48(%rsp), %rsi
leaq 0x128(%rsp), %rdi
callq 0x9b10
jmp 0x8979
leaq 0x128(%rsp), %rax
movq %rax, 0xd8(%rsp)
movq 0xd8(%rsp), %rdi
callq 0x9cc0
movq %rax, 0xd0(%rsp)
movq 0xd8(%rsp), %rdi
callq 0x9cf0
movq %rax, 0xc8(%rsp)
leaq 0xd0(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x9d20
testb $0x1, %al
jne 0x89d1
jmp 0x8c46
leaq 0xd0(%rsp), %rdi
callq 0x9d40
movq %rax, 0xc0(%rsp)
movq 0xc0(%rsp), %rdi
leaq 0x89c9(%rip), %rsi      # 0x113be
callq 0x7700
movb %al, 0x37(%rsp)
jmp 0x8a00
movb 0x37(%rsp), %al
testb $0x1, %al
jne 0x8a0a
jmp 0x8a0f
jmp 0x8c34
movq 0xc0(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x3510
movq %rax, 0x28(%rsp)
jmp 0x8a27
movq 0x28(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x22, %eax
jne 0x8ac3
movq 0x180(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0xc0(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x33d0
movq 0x20(%rsp), %rsi
movq %rax, %rcx
addq $-0x2, %rcx
leaq 0xa0(%rsp), %rdi
movl $0x1, %edx
callq 0x3300
jmp 0x8a77
movq 0x18(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x82f0
jmp 0x8a8b
leaq 0xa0(%rsp), %rdi
callq 0x31f0
jmp 0x8c30
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x148(%rsp)
movl %eax, 0x144(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x31f0
jmp 0x8c67
movq 0xc0(%rsp), %rdi
leaq 0x8926(%rip), %rsi      # 0x113f8
xorl %eax, %eax
movl %eax, %edx
callq 0x3500
movq %rax, 0x178(%rsp)
cmpq $-0x1, 0x178(%rsp)
je 0x8bf9
movq 0xc0(%rsp), %rsi
movq 0x178(%rsp), %rcx
xorl %eax, %eax
movl %eax, %edx
leaq 0x80(%rsp), %rdi
callq 0x3300
jmp 0x8b15
leaq 0x80(%rsp), %rdi
movl $0x20, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x32a0
cmpq $-0x1, %rax
je 0x8b70
movq 0x180(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x82f0
jmp 0x8b48
jmp 0x8b70
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x148(%rsp)
movl %eax, 0x144(%rsp)
leaq 0x80(%rsp), %rdi
callq 0x31f0
jmp 0x8c67
movq 0xc0(%rsp), %rdi
movq %rdi, 0x8(%rsp)
movq 0x178(%rsp), %rax
incq %rax
movq %rax, 0x10(%rsp)
callq 0x33d0
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rax, %rcx
leaq 0x60(%rsp), %rdi
callq 0x3300
jmp 0x8bab
movq 0xc0(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x3330
leaq 0x60(%rsp), %rdi
callq 0x31f0
movq 0xc0(%rsp), %rdi
leaq 0x8822(%rip), %rsi      # 0x113f8
xorl %eax, %eax
movl %eax, %edx
callq 0x3500
movq %rax, 0x178(%rsp)
leaq 0x80(%rsp), %rdi
callq 0x31f0
jmp 0x8ae3
movq 0xc0(%rsp), %rdi
movl $0x20, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x32a0
cmpq $-0x1, %rax
je 0x8c2e
movq 0x180(%rsp), %rdi
movq 0xc0(%rsp), %rsi
callq 0x82f0
jmp 0x8c2c
jmp 0x8c2e
jmp 0x8c30
jmp 0x8c32
jmp 0x8c34
leaq 0xd0(%rsp), %rdi
callq 0x9d60
jmp 0x89b3
movb $0x1, 0x177(%rsp)
leaq 0x128(%rsp), %rdi
callq 0x9d80
testb $0x1, 0x177(%rsp)
jne 0x8c80
jmp 0x8c76
leaq 0x128(%rsp), %rdi
callq 0x9d80
jmp 0x8c82
movq 0x50(%rsp), %rdi
callq 0x31f0
jmp 0x8c8e
movq 0x50(%rsp), %rdi
callq 0x31f0
jmp 0x8c9b
movq 0x58(%rsp), %rax
addq $0x198, %rsp            # imm = 0x198
retq
movq 0x148(%rsp), %rdi
callq 0x3490
nopl (%rax,%rax)