// File: /workspace/github_cpp_makefile_star2_O2/pokorj54[P]Pathfinder-utilities/src/CommandLine.cpp
// Function: CommandLine::HandleCommands()
void CommandLine::HandleCommands()
{
    while(!input->eof() && !input->fail())
    {
        string fullCommand;
        getline(*input, fullCommand);
        if(fullCommand.find_first_not_of(" \t") == string::npos)
        {
            continue; //no command given
        }
        else if(count(fullCommand.begin(), fullCommand.end(), '"') % 2 == 1)
        {
            *output << "Invalid command - odd number of \"" << endl;
            continue;
        }

        Arguments arguments;
        string cmdName = _GetCommandAndArgument(fullCommand, arguments);
        transform(cmdName.begin(), cmdName.end(), cmdName.begin(), ::tolower);

        if(cmdName == "exit") //it's the only command that can affect the command cycle 
        {
            break;
        }

        HandleCmd method;
        if(cmdTranslation.count(cmdName) > 0)
        {
            method = cmdTranslation.at(cmdName).first;
        }
        else if (aliases.count(cmdName) > 0)
        {
            method = cmdTranslation.at(aliases.at(cmdName)).first;
        }
        else
        {
            *output << "Unknown command" << endl;
            continue;
        }

        try
        {
            ((*this).*method)(arguments);
        }
        catch(const Exception & e)
        {
            e.Message(*output);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdi, (%rsp)
leaq 0x18(%rsp), %r15
leaq 0x8(%rsp), %rbp
leaq 0x2a54(%rip), %r14      # 0x83b6
leaq 0x28(%rsp), %rbx
leaq 0x48(%rsp), %r13
movq (%rsp), %rax
movq (%rax), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
testb $0x7, 0x20(%rdi,%rax)
jne 0x5b94
movq %r15, 0x8(%rsp)
andq $0x0, 0x10(%rsp)
movb $0x0, 0x18(%rsp)
movq %rbp, %rsi
callq 0x3080
movq %rbp, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x3170
cmpq $-0x1, %rax
je 0x5b0b
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
addq %rdi, %rsi
movb $0x22, 0x28(%rsp)
movq %rbx, %rdx
callq 0x6d3f
movabsq $-0x7fffffffffffffff, %rcx # imm = 0x8000000000000001
andq %rcx, %rax
cmpq $0x1, %rax
jne 0x5a02
movq (%rsp), %rax
movq 0x8(%rax), %rdi
leaq 0x29c9(%rip), %rsi      # 0x83b9
callq 0x3240
movq %rax, %rdi
callq 0x3120
jmp 0x5b0b
movq %rbx, 0x30(%rsp)
movq %rbx, 0x28(%rsp)
andq $0x0, 0x38(%rsp)
andl $0x0, 0x40(%rsp)
leaq 0x68(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rsi
callq 0x32c0
movq %rbx, %rdx
movq %r13, %r12
movq %r13, %rdi
movq %r14, %rsi
movq %rdx, %rbx
callq 0x5680
movq %r14, %rdi
callq 0x3110
movq 0x48(%rsp), %rbp
movq 0x50(%rsp), %r15
xorl %r13d, %r13d
cmpq %r13, %r15
je 0x5a6a
movsbl (%rbp,%r13), %edi
callq 0x32f0
movb %al, (%rbp,%r13)
incq %r13
jmp 0x5a50
movq %r12, %r13
movq %r12, %rdi
leaq 0x2964(%rip), %rsi      # 0x83db
callq 0x4ec3
testb %al, %al
jne 0x5b76
leaq 0x77bd(%rip), %rdi      # 0xd248
movq %r13, %rsi
callq 0x6d5a
leaq 0x18(%rsp), %r15
leaq 0x2917(%rip), %r14      # 0x83b6
leaq 0x8(%rsp), %rbp
movq %r13, %rsi
testq %rax, %rax
jne 0x5ad2
leaq 0x77cd(%rip), %rdi      # 0xd280
movq %r13, %rsi
callq 0x6de8
testq %rax, %rax
je 0x5b18
leaq 0x77b9(%rip), %rdi      # 0xd280
movq %r13, %rsi
callq 0x6e2a
movq %rax, %rsi
leaq 0x776f(%rip), %rdi      # 0xd248
callq 0x6d9c
movq (%rax), %rcx
movq 0x8(%rax), %rdi
addq (%rsp), %rdi
testb $0x1, %cl
je 0x5af6
movq (%rdi), %rax
movq -0x1(%rax,%rcx), %rcx
movq %rbx, %rsi
callq *%rcx
movq %r13, %rdi
callq 0x3110
movq %rbx, %rdi
callq 0x611c
movq %rbp, %rdi
callq 0x3110
jmp 0x596c
movq (%rsp), %rax
movq 0x8(%rax), %rdi
leaq 0x28b9(%rip), %rsi      # 0x83e0
callq 0x3240
movq %rax, %rdi
callq 0x3120
jmp 0x5afb
movq %rax, %r14
cmpl $0x1, %edx
jne 0x5bce
movq %r14, %rdi
callq 0x30e0
movq (%rsp), %rcx
movq 0x8(%rcx), %rsi
movq (%rax), %rcx
movq %rax, %rdi
callq *0x18(%rcx)
callq 0x3370
leaq 0x18(%rsp), %r15
leaq 0x284a(%rip), %r14      # 0x83b6
leaq 0x8(%rsp), %rbp
movq %r12, %r13
jmp 0x5afb
leaq 0x48(%rsp), %rdi
callq 0x3110
leaq 0x28(%rsp), %rdi
callq 0x611c
leaq 0x8(%rsp), %rdi
callq 0x3110
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5bcb
movq %rax, %r14
callq 0x3370
jmp 0x5bce
movq %rax, %rdi
callq 0x4094
movq %rax, %r14
jmp 0x5bd8
movq %rax, %r14
leaq 0x68(%rsp), %rdi
jmp 0x5bd3
jmp 0x5be4
movq %rax, %r14
leaq 0x48(%rsp), %rdi
callq 0x3110
leaq 0x28(%rsp), %rdi
callq 0x611c
jmp 0x5be7
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x3110
movq %r14, %rdi
callq 0x33c0
nop