// File: Ciaxur[P]yagb-emu/include/imgui/imgui_demo.cpp
// Function: ExampleAppConsole::ExecCommand(char const*)
void    ExecCommand(const char* command_line)
    {
        AddLog("# %s\n", command_line);

        // Insert into history. First find match and delete it so it can be pushed to the back.
        // This isn't trying to be smart or optimal.
        HistoryPos = -1;
        for (int i = History.Size - 1; i >= 0; i--)
            if (Stricmp(History[i], command_line) == 0)
            {
                free(History[i]);
                History.erase(History.begin() + i);
                break;
            }
        History.push_back(Strdup(command_line));

        // Process command
        if (Stricmp(command_line, "CLEAR") == 0)
        {
            ClearLog();
        }
        else if (Stricmp(command_line, "HELP") == 0)
        {
            AddLog("Commands:");
            for (int i = 0; i < Commands.Size; i++)
                AddLog("- %s", Commands[i]);
        }
        else if (Stricmp(command_line, "HISTORY") == 0)
        {
            int first = History.Size - 10;
            for (int i = first > 0 ? first : 0; i < History.Size; i++)
                AddLog("%3d: %s\n", i, History[i]);
        }
        else
        {
            AddLog("Unknown command: '%s'\n", command_line);
        }

        // On command input, we scroll to bottom even if AutoScroll==false
        ScrollToBottom = true;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x38(%rbp)
movq -0x10(%rbp), %rdx
leaq 0x7875e(%rip), %rsi     # 0x182c01
movb $0x0, %al
callq 0x109ea0
movq -0x38(%rbp), %rax
movl $0xffffffff, 0x130(%rax) # imm = 0xFFFFFFFF
movl 0x120(%rax), %eax
subl $0x1, %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jl 0x10a553
movq -0x38(%rbp), %rdi
addq $0x120, %rdi            # imm = 0x120
movl -0x14(%rbp), %esi
callq 0x10a030
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x10ad60
cmpl $0x0, %eax
jne 0x10a543
movq -0x38(%rbp), %rdi
addq $0x120, %rdi            # imm = 0x120
movl -0x14(%rbp), %esi
callq 0x10a030
movq (%rax), %rdi
callq 0xd1b0
movq -0x38(%rbp), %rdi
movq %rdi, %rax
addq $0x120, %rax            # imm = 0x120
movq %rax, -0x40(%rbp)
addq $0x120, %rdi            # imm = 0x120
callq 0x10aec0
movq -0x40(%rbp), %rdi
movq %rax, %rsi
movslq -0x14(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x10ade0
jmp 0x10a553
jmp 0x10a545
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x10a4c4
movq -0x38(%rbp), %rax
addq $0x120, %rax            # imm = 0x120
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
callq 0x10a250
movq -0x48(%rbp), %rdi
movq %rax, -0x20(%rbp)
leaq -0x20(%rbp), %rsi
callq 0x10a1f0
movq -0x10(%rbp), %rdi
leaq 0x783ce(%rip), %rsi     # 0x182954
callq 0x10ad60
cmpl $0x0, %eax
jne 0x10a59e
movq -0x38(%rbp), %rdi
callq 0x109dd0
jmp 0x10a6ba
movq -0x10(%rbp), %rdi
leaq 0x7839e(%rip), %rsi     # 0x182947
callq 0x10ad60
cmpl $0x0, %eax
jne 0x10a613
movq -0x38(%rbp), %rdi
leaq 0x78649(%rip), %rsi     # 0x182c07
movb $0x0, %al
callq 0x109ea0
movl $0x0, -0x24(%rbp)
movq -0x38(%rbp), %rcx
movl -0x24(%rbp), %eax
cmpl 0x110(%rcx), %eax
jge 0x10a60e
movq -0x38(%rbp), %rdi
addq $0x110, %rdi            # imm = 0x110
movl -0x24(%rbp), %esi
callq 0x10ace0
movq -0x38(%rbp), %rdi
movq (%rax), %rdx
leaq 0x78615(%rip), %rsi     # 0x182c11
movb $0x0, %al
callq 0x109ea0
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x10a5cc
jmp 0x10a6b8
movq -0x10(%rbp), %rdi
leaq 0x7832e(%rip), %rsi     # 0x18294c
callq 0x10ad60
cmpl $0x0, %eax
jne 0x10a6a0
movq -0x38(%rbp), %rax
movl 0x120(%rax), %eax
subl $0xa, %eax
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jle 0x10a646
movl -0x28(%rbp), %eax
movl %eax, -0x4c(%rbp)
jmp 0x10a64d
xorl %eax, %eax
movl %eax, -0x4c(%rbp)
jmp 0x10a64d
movl -0x4c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x38(%rbp), %rcx
movl -0x2c(%rbp), %eax
cmpl 0x120(%rcx), %eax
jge 0x10a69e
movq -0x38(%rbp), %rdi
movl -0x2c(%rbp), %eax
movl %eax, -0x50(%rbp)
addq $0x120, %rdi            # imm = 0x120
movl -0x2c(%rbp), %esi
callq 0x10a030
movq -0x38(%rbp), %rdi
movl -0x50(%rbp), %edx
movq (%rax), %rcx
leaq 0x7858a(%rip), %rsi     # 0x182c16
movb $0x0, %al
callq 0x109ea0
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x10a653
jmp 0x10a6b6
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rdx
leaq 0x78570(%rip), %rsi     # 0x182c1f
movb $0x0, %al
callq 0x109ea0
jmp 0x10a6b8
jmp 0x10a6ba
movq -0x38(%rbp), %rax
movb $0x1, 0x251(%rax)
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)