// File: mbottini[P]CS250lab2/main.cpp
// Function: getTokens(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
stringVector getTokens(const string& inputString) {
    stringVector tokenVector;
    string currentString = "";

    int i = 0;

    while(i < inputString.length()) {

        currentString = "";

        // Test for "implies" operator.
        if(inputString[i] == '-' && inputString.length() - i > 1) {
            if(inputString.substr(i, 2) == "->") {
                tokenVector.push_back("->");
                i += 2;
            }

            else {
                i++;
            }
        }

        // Test for "XOR" operator.
        else if(inputString[i] == 'X' && inputString.length() - i > 2) {
            if(inputString.substr(i, 3) == "XOR") {
                tokenVector.push_back("XOR");
                i += 3;
            }

            else {
                i++;
            }
        }

        // Test for "iff" operator.

        else if(inputString[i] == '<' && inputString.length() - i > 2) {
            if(inputString.substr(i, 3) == "<->") {
                tokenVector.push_back("<->");
                i += 3;
            }

            else {
                i++;
            }
        }

        // Otherwise, it's hopefully an operator ('v', '^', '!', '(', or ')')
        // or a character.      
        else if(isOperator(inputString[i]) || isParentheses(inputString[i]) 
                                           || isalpha(inputString[i])) {
            currentString += inputString[i];
            tokenVector.push_back(currentString);
            i++;
        }

        // If it's not, then it's just ignored.
        else {
            i++;
        }
    }

    return tokenVector;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq %rdi, -0x140(%rbp)
movq %rdi, %rax
movq %rax, -0x138(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x0, -0x11(%rbp)
callq 0x4d90
leaq -0x39(%rbp), %rdi
movq %rdi, -0x130(%rbp)
callq 0x22d0
movq -0x130(%rbp), %rdx
leaq 0x934a(%rip), %rsi      # 0xc105
leaq -0x38(%rbp), %rdi
callq 0x2230
jmp 0x2dc6
leaq -0x39(%rbp), %rdi
callq 0x21d0
movl $0x0, -0x50(%rbp)
movslq -0x50(%rbp), %rax
movq %rax, -0x148(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2270
movq %rax, %rcx
movq -0x148(%rbp), %rax
cmpq %rcx, %rax
jae 0x32d0
leaq 0x9301(%rip), %rsi      # 0xc105
leaq -0x38(%rbp), %rdi
callq 0x2220
jmp 0x2e0f
movq -0x10(%rbp), %rdi
movslq -0x50(%rbp), %rsi
callq 0x21e0
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x2f7e
movq -0x10(%rbp), %rdi
callq 0x2270
movslq -0x50(%rbp), %rcx
subq %rcx, %rax
cmpq $0x1, %rax
jbe 0x2f7e
movq -0x10(%rbp), %rsi
movslq -0x50(%rbp), %rdx
leaq -0x70(%rbp), %rdi
movl $0x2, %ecx
callq 0x21b0
jmp 0x2e5a
leaq 0x9252(%rip), %rsi      # 0xc0b3
leaq -0x70(%rbp), %rdi
callq 0x5140
movb %al, -0x149(%rbp)
jmp 0x2e72
leaq -0x70(%rbp), %rdi
callq 0x2100
movb -0x149(%rbp), %al
testb $0x1, %al
jne 0x2e8a
jmp 0x2f70
leaq -0x91(%rbp), %rdi
movq %rdi, -0x158(%rbp)
callq 0x22d0
movq -0x158(%rbp), %rdx
leaq 0x9208(%rip), %rsi      # 0xc0b3
leaq -0x90(%rbp), %rdi
callq 0x2230
jmp 0x2eb9
movq -0x140(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x5170
jmp 0x2ece
leaq -0x90(%rbp), %rdi
callq 0x2100
leaq -0x91(%rbp), %rdi
callq 0x21d0
movl -0x50(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x50(%rbp)
jmp 0x2f79
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x39(%rbp), %rdi
callq 0x21d0
jmp 0x330c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x32e5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x2100
jmp 0x32e5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x2f5f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x2100
leaq -0x91(%rbp), %rdi
callq 0x21d0
jmp 0x32e5
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x32cb
movq -0x10(%rbp), %rdi
movslq -0x50(%rbp), %rsi
callq 0x21e0
movsbl (%rax), %eax
cmpl $0x58, %eax
jne 0x30cb
movq -0x10(%rbp), %rdi
callq 0x2270
movslq -0x50(%rbp), %rcx
subq %rcx, %rax
cmpq $0x2, %rax
jbe 0x30cb
movq -0x10(%rbp), %rsi
movslq -0x50(%rbp), %rdx
leaq -0xb8(%rbp), %rdi
movl $0x3, %ecx
callq 0x21b0
jmp 0x2fcc
leaq 0x90db(%rip), %rsi      # 0xc0ae
leaq -0xb8(%rbp), %rdi
callq 0x5140
movb %al, -0x159(%rbp)
jmp 0x2fe7
leaq -0xb8(%rbp), %rdi
callq 0x2100
movb -0x159(%rbp), %al
testb $0x1, %al
jne 0x3002
jmp 0x30bd
leaq -0xd9(%rbp), %rdi
movq %rdi, -0x168(%rbp)
callq 0x22d0
movq -0x168(%rbp), %rdx
leaq 0x908b(%rip), %rsi      # 0xc0ae
leaq -0xd8(%rbp), %rdi
callq 0x2230
jmp 0x3031
movq -0x140(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x5170
jmp 0x3046
leaq -0xd8(%rbp), %rdi
callq 0x2100
leaq -0xd9(%rbp), %rdi
callq 0x21d0
movl -0x50(%rbp), %eax
addl $0x3, %eax
movl %eax, -0x50(%rbp)
jmp 0x30c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x2100
jmp 0x32e5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x30ac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x2100
leaq -0xd9(%rbp), %rdi
callq 0x21d0
jmp 0x32e5
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x32c9
movq -0x10(%rbp), %rdi
movslq -0x50(%rbp), %rsi
callq 0x21e0
movsbl (%rax), %eax
cmpl $0x3c, %eax
jne 0x3218
movq -0x10(%rbp), %rdi
callq 0x2270
movslq -0x50(%rbp), %rcx
subq %rcx, %rax
cmpq $0x2, %rax
jbe 0x3218
movq -0x10(%rbp), %rsi
movslq -0x50(%rbp), %rdx
leaq -0x100(%rbp), %rdi
movl $0x3, %ecx
callq 0x21b0
jmp 0x3119
leaq 0x8f92(%rip), %rsi      # 0xc0b2
leaq -0x100(%rbp), %rdi
callq 0x5140
movb %al, -0x169(%rbp)
jmp 0x3134
leaq -0x100(%rbp), %rdi
callq 0x2100
movb -0x169(%rbp), %al
testb $0x1, %al
jne 0x314f
jmp 0x320a
leaq -0x121(%rbp), %rdi
movq %rdi, -0x178(%rbp)
callq 0x22d0
movq -0x178(%rbp), %rdx
leaq 0x8f42(%rip), %rsi      # 0xc0b2
leaq -0x120(%rbp), %rdi
callq 0x2230
jmp 0x317e
movq -0x140(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x5170
jmp 0x3193
leaq -0x120(%rbp), %rdi
callq 0x2100
leaq -0x121(%rbp), %rdi
callq 0x21d0
movl -0x50(%rbp), %eax
addl $0x3, %eax
movl %eax, -0x50(%rbp)
jmp 0x3213
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x2100
jmp 0x32e5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x31f9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x2100
leaq -0x121(%rbp), %rdi
callq 0x21d0
jmp 0x32e5
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x32c7
movq -0x10(%rbp), %rdi
movslq -0x50(%rbp), %rsi
callq 0x21e0
movq %rax, %rdi
callq 0x42c0
movb %al, -0x179(%rbp)
jmp 0x3235
movb -0x179(%rbp), %al
testb $0x1, %al
jne 0x3284
jmp 0x3241
movq -0x10(%rbp), %rdi
movslq -0x50(%rbp), %rsi
callq 0x21e0
movq %rax, %rdi
callq 0x4320
movb %al, -0x17a(%rbp)
jmp 0x325e
movb -0x17a(%rbp), %al
testb $0x1, %al
jne 0x3284
jmp 0x326a
movq -0x10(%rbp), %rdi
movslq -0x50(%rbp), %rsi
callq 0x21e0
movsbl (%rax), %edi
callq 0x2290
cmpl $0x0, %eax
je 0x32bc
movq -0x10(%rbp), %rdi
movslq -0x50(%rbp), %rsi
callq 0x21e0
movsbl (%rax), %esi
leaq -0x38(%rbp), %rdi
callq 0x2110
jmp 0x329f
movq -0x140(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x51a0
jmp 0x32b1
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x32c5
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x32c7
jmp 0x32c9
jmp 0x32cb
jmp 0x2dd6
movb $0x1, -0x11(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x2100
testb $0x1, -0x11(%rbp)
jne 0x32fc
jmp 0x32f0
leaq -0x38(%rbp), %rdi
callq 0x2100
jmp 0x330c
movq -0x140(%rbp), %rdi
callq 0x4e00
movq -0x138(%rbp), %rax
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
movq -0x140(%rbp), %rdi
callq 0x4e00
movq -0x48(%rbp), %rdi
callq 0x22c0
nopw %cs:(%rax,%rax)