// File: /workspace/github_cpp_makefile_star2_O1/havluj[P]spreadsheet/src/CExpressionParser.cpp
// Function: CExpressionParser::InfixToRPN(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&)
bool CExpressionParser::InfixToRPN(std::vector<std::string>& inputs) {
    std::list<std::string> infix;
    Tokenize(infix, " ");

    typedef std::list<std::string>::const_iterator tok_iter;
    std::stack<std::string> stack;
    std::queue<std::string> outputQueue;

    bool success = true;

    // For each token
    for (tok_iter it = infix.begin(); it != infix.end(); it++) {
	  // Read a token.
	  std::string token = *it;

	  // If the token is a number, then add it to the output queue.
	  if (IsNumber(token) || IsFloat(token) || IsPi(token) || IsE(token)) {
		outputQueue.push(token);
	  }// If the token is a function token, then push it onto the stack.
	  else if (IsFunction(token)) {
		stack.push(token);
	  } else if (IsComma(token)) {
		// Until token at the top of stack is left parenthesis, pop operators 
		// off the stack onto the output queue.             
		std::string stackToken = stack.top();

		while (stackToken != "(") {
		    outputQueue.push(stackToken);
		    stack.pop();
		    stackToken = stack.top();
		}

		if (stackToken == "(") {
		    success = true;
		} else {
		    success = false;
		}
	  }// If the token (o1) is an operator, then:
	  else if (IsOperator(token)) {
		// While there is operator token, o2, at the top of the stack, and:
		// either o1 is left-associative and its precedence is equal to that of o2,
		// or o1 has precedence less than that of o2
		while (!stack.empty() && IsOperator(stack.top()) &&
			  ((OpLeftAssoc(token) && OpPrecedence(token) == OpPrecedence(stack.top())) ||
			  (OpPrecedence(token) < OpPrecedence(stack.top())))) {
		    // Pop o2 off the stack, onto the output queue
		    std::string stackToken = stack.top();
		    stack.pop();
		    outputQueue.push(stackToken);
		}

		// Push o1 onto the stack
		stack.push(token);

	  }// If the token is a left parenthesis, then push it onto the stack.
	  else if (token == "(") {
		// Push token to top of the stack  
		stack.push(token);
	  }// If the token is a right parenthesis:
	  else if (token == ")") {
		// Until the token at the top of the stack is a left parenthesis, pop operators 
		// off the stack onto the output queue.
		while (!stack.empty() && stack.top() != "(") {
		    // Add to end of list  
		    outputQueue.push(stack.top());
		    stack.pop();
		}

		// If stack runs out without finding a left parenthesis, 
		// there are mismatched parentheses
		if (!stack.empty()) {
		    std::string stackToken = stack.top();

		    // Mismatched parentheses
		    if (stackToken != "(") {
			  success = false;
		    }
		} else {
		    return false;
		}

		// Pop left parenthesis from the stack, but not onto output queue.
		stack.pop();

		// If token at top of stack is function token, pop it onto output queue
		if (!stack.empty()) {
		    std::string stackToken = stack.top();
		    if (IsFunction(stackToken)) {
			  outputQueue.push(stackToken);
			  stack.pop();
		    }
		}
	  }
    }

    // While there are still operator tokens in the stack:
    while (!stack.empty()) {
	  // Pop the operator onto the output queue
	  outputQueue.push(stack.top());
	  stack.pop();
    }

    while (!outputQueue.empty()) {
	  std::string token = outputQueue.front();
	  inputs.push_back(token);
	  outputQueue.pop();
    }

    return success;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rsi, %rbx
movq %rdi, %r15
leaq 0xa0(%rsp), %rax
movq %rax, 0x8(%rax)
movq %rax, (%rax)
movq $0x0, 0x10(%rax)
leaq 0x20(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x23c1(%rip), %rsi      # 0xe883
leaq 0x23bb(%rip), %rdx      # 0xe884
leaq 0x10(%rsp), %rdi
callq 0x84ba
leaq 0xa0(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %r15, %rdi
callq 0xaae2
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0xc4ff
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x42d0
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdi
movaps %xmm0, 0x40(%rdi)
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
xorl %esi, %esi
callq 0xcfbc
leaq 0xc0(%rsp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rdi)
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
xorl %esi, %esi
callq 0xcfbc
movq %rbx, 0xb8(%rsp)
leaq 0x70(%rsp), %r15
movb $0x1, %al
movl %eax, 0xc(%rsp)
leaq 0x80(%rsp), %r13
leaq 0x60(%rsp), %r12
leaq 0xa0(%rsp), %r14
movq (%r14), %r14
leaq 0xa0(%rsp), %rax
cmpq %rax, %r14
je 0xca41
leaq 0x90(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x10(%r14), %rsi
movq 0x18(%r14), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x5370
movq %r13, %rdi
callq 0xa987
leaq 0xc0(%rsp), %rdi
testb %al, %al
jne 0xc606
movq %r13, %rdi
callq 0xa8e8
leaq 0xc0(%rsp), %rdi
testb %al, %al
jne 0xc606
movq %r13, %rdi
callq 0xa53c
leaq 0xc0(%rsp), %rdi
testb %al, %al
jne 0xc606
movq %r13, %rdi
callq 0xa62d
leaq 0xc0(%rsp), %rdi
testb %al, %al
jne 0xc606
movq %r13, %rdi
callq 0xa71e
leaq 0x10(%rsp), %rdi
testb %al, %al
je 0xc642
movb $0x1, %bl
movq %r13, %rsi
callq 0xd150
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0xc635
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x42d0
testb %bl, %bl
jne 0xc56e
jmp 0xca41
movq %r13, %rdi
leaq 0x22b0(%rip), %rsi      # 0xe8fc
callq 0x40a0
testl %eax, %eax
je 0xc7a7
movq %r13, %rdi
callq 0xa418
testb %al, %al
je 0xc873
movq 0x40(%rsp), %rax
leaq 0x10(%rsp), %rdi
cmpq 0x20(%rsp), %rax
je 0xc606
leaq 0x10(%rsp), %rbx
cmpq 0x48(%rsp), %rax
jne 0xc697
movq 0x58(%rsp), %rax
movq -0x8(%rax), %rax
movl $0x200, %ecx            # imm = 0x200
addq %rcx, %rax
addq $-0x20, %rax
movq %rax, %rdi
callq 0xa418
testb %al, %al
je 0xc79f
movq %r13, %rdi
callq 0xa386
testb %al, %al
je 0xc6eb
movq %r13, %rdi
callq 0xa2e3
movl %eax, %ebx
movq 0x40(%rsp), %rdi
cmpq 0x48(%rsp), %rdi
jne 0xc6de
movq 0x58(%rsp), %rax
movq -0x8(%rax), %rdi
movl $0x200, %eax            # imm = 0x200
addq %rax, %rdi
addq $-0x20, %rdi
callq 0xa2e3
cmpl %eax, %ebx
je 0xc723
movq %r13, %rdi
callq 0xa2e3
movl %eax, %ebx
movq 0x40(%rsp), %rdi
cmpq 0x48(%rsp), %rdi
jne 0xc712
movq 0x58(%rsp), %rax
movq -0x8(%rax), %rdi
movl $0x200, %eax            # imm = 0x200
addq %rax, %rdi
addq $-0x20, %rdi
callq 0xa2e3
cmpl %eax, %ebx
jae 0xca30
movq 0x40(%rsp), %rax
cmpq 0x48(%rsp), %rax
jne 0xc740
movq 0x58(%rsp), %rax
movq -0x8(%rax), %rax
movl $0x200, %ecx            # imm = 0x200
addq %rcx, %rax
movq %r15, 0x60(%rsp)
movq -0x20(%rax), %rsi
movq -0x18(%rax), %rdx
addq %rsi, %rdx
movq %r12, %rbp
movq %r12, %rdi
callq 0x5370
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0xd3ea
leaq 0xc0(%rsp), %rdi
movq %rbp, %rsi
callq 0xd150
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0xc78f
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0x40(%rsp), %rax
cmpq 0x20(%rsp), %rax
jne 0xc67f
movq %rbx, %rdi
jmp 0xc606
movq 0x40(%rsp), %rax
cmpq 0x48(%rsp), %rax
jne 0xc7c4
movq 0x58(%rsp), %rax
movq -0x8(%rax), %rax
movl $0x200, %ecx            # imm = 0x200
addq %rcx, %rax
movq %r15, 0x60(%rsp)
movq -0x20(%rax), %rsi
movq -0x18(%rax), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x5370
leaq 0x10(%rsp), %rbx
movq %r12, %rbp
movq %rbp, %rdi
leaq 0x2102(%rip), %rsi      # 0xe8f0
callq 0x40a0
testl %eax, %eax
je 0xc83d
leaq 0xc0(%rsp), %rdi
movq %rbp, %rsi
callq 0xd150
movq %rbx, %rdi
callq 0xd3ea
movq 0x40(%rsp), %rsi
cmpq 0x48(%rsp), %rsi
jne 0xc82c
movq 0x58(%rsp), %rax
movq -0x8(%rax), %rsi
movl $0x200, %eax            # imm = 0x200
addq %rax, %rsi
addq $-0x20, %rsi
movq %r12, %rbp
movq %r12, %rdi
callq 0x4190
jmp 0xc7e4
movq %rbp, %rdi
leaq 0x20a9(%rip), %rsi      # 0xe8f0
callq 0x40a0
testl %eax, %eax
sete %al
movl %eax, 0xc(%rsp)
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0xc86c
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x42d0
movb $0x1, %bl
jmp 0xc610
movq %r13, %rdi
leaq 0x2073(%rip), %rsi      # 0xe8f0
callq 0x40a0
leaq 0x10(%rsp), %rdi
testl %eax, %eax
je 0xc606
movq %r13, %rdi
leaq 0x20bb(%rip), %rsi      # 0xe954
callq 0x40a0
movb $0x1, %bl
testl %eax, %eax
jne 0xc610
jmp 0xc8e2
movq 0x40(%rsp), %rsi
cmpq 0x48(%rsp), %rsi
jne 0xc8c7
movq 0x58(%rsp), %rax
movq -0x8(%rax), %rsi
movl $0x200, %eax            # imm = 0x200
addq %rax, %rsi
addq $-0x20, %rsi
leaq 0xc0(%rsp), %rdi
callq 0xd150
leaq 0x10(%rsp), %rdi
callq 0xd3ea
movq 0x40(%rsp), %rdi
cmpq 0x20(%rsp), %rdi
je 0xc91a
cmpq 0x48(%rsp), %rdi
jne 0xc906
movq 0x58(%rsp), %rax
movq -0x8(%rax), %rdi
movl $0x200, %eax            # imm = 0x200
addq %rax, %rdi
addq $-0x20, %rdi
leaq 0x1fdf(%rip), %rsi      # 0xe8f0
callq 0x40a0
testl %eax, %eax
jne 0xc8aa
movq 0x40(%rsp), %rax
cmpq 0x20(%rsp), %rax
je 0xca3a
cmpq 0x48(%rsp), %rax
jne 0xc942
movq 0x58(%rsp), %rax
movq -0x8(%rax), %rax
movl $0x200, %ecx            # imm = 0x200
addq %rcx, %rax
movq %r15, 0x60(%rsp)
movq -0x20(%rax), %rsi
movq -0x18(%rax), %rdx
addq %rsi, %rdx
movq %r12, %rbp
movq %r12, %rdi
callq 0x5370
movq %rbp, %rdi
leaq 0x1f89(%rip), %rsi      # 0xe8f0
callq 0x40a0
testl %eax, %eax
movl 0xc(%rsp), %eax
movzbl %al, %eax
movl $0x0, %ecx
cmovnel %ecx, %eax
movl %eax, 0xc(%rsp)
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0xc99d
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x42d0
leaq 0x10(%rsp), %rdi
callq 0xd3ea
movq 0x40(%rsp), %rax
cmpq 0x20(%rsp), %rax
je 0xc610
cmpq 0x48(%rsp), %rax
jne 0xc9cf
movq 0x58(%rsp), %rax
movq -0x8(%rax), %rax
movl $0x200, %ecx            # imm = 0x200
addq %rcx, %rax
movq %r15, 0x60(%rsp)
movq -0x20(%rax), %rsi
movq -0x18(%rax), %rdx
addq %rsi, %rdx
movq %r12, %rbp
movq %r12, %rdi
callq 0x5370
movq %rbp, %rdi
callq 0xa71e
testb %al, %al
je 0xca10
leaq 0xc0(%rsp), %rdi
movq %r12, %rsi
callq 0xd150
leaq 0x10(%rsp), %rdi
callq 0xd3ea
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0xc610
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x42d0
jmp 0xc610
leaq 0x10(%rsp), %rdi
jmp 0xc606
xorl %ebx, %ebx
jmp 0xc610
leaq 0xa0(%rsp), %rax
cmpq %rax, %r14
je 0xca55
xorl %ebx, %ebx
jmp 0xcb40
movq 0x40(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0xcaa6
movl $0x200, %ebx            # imm = 0x200
leaq 0xc0(%rsp), %r14
leaq 0x10(%rsp), %r15
cmpq 0x48(%rsp), %rsi
jne 0xca86
movq 0x58(%rsp), %rax
movq -0x8(%rax), %rsi
addq %rbx, %rsi
addq $-0x20, %rsi
movq %r14, %rdi
callq 0xd150
movq %r15, %rdi
callq 0xd3ea
movq 0x40(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
jne 0xca73
movq 0xd0(%rsp), %rax
cmpq %rax, 0xf0(%rsp)
movq 0xb8(%rsp), %rbx
je 0xcb3c
leaq 0x80(%rsp), %r14
leaq 0xc0(%rsp), %r15
leaq 0x90(%rsp), %rcx
movq %rcx, 0x80(%rsp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x5370
movq %rbx, %rdi
movq %r14, %rsi
callq 0xcd12
movq %r15, %rdi
callq 0xd960
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0xcb2a
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x42d0
movq 0xd0(%rsp), %rax
cmpq %rax, 0xf0(%rsp)
jne 0xcad0
movl 0xc(%rsp), %ebx
leaq 0xc0(%rsp), %rdi
callq 0xcd50
leaq 0x10(%rsp), %rdi
callq 0xcd50
leaq 0xa0(%rsp), %rdi
callq 0xceee
andb $0x1, %bl
movl %ebx, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xcbdb
jmp 0xcbba
jmp 0xcbdb
jmp 0xcbdb
jmp 0xcbdb
movq %rax, %rbx
jmp 0xcc10
jmp 0xcbab
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0xcc1a
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x42d0
jmp 0xcc1a
movq %rax, %rbx
jmp 0xcc1a
jmp 0xcbba
jmp 0xcbdb
jmp 0xcbd6
jmp 0xcbdb
jmp 0xcbd6
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0xcbde
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x42d0
jmp 0xcbde
movq %rax, %rbx
jmp 0xcc03
movq %rax, %rbx
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0xcc03
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x42d0
leaq 0xc0(%rsp), %rdi
callq 0xcd50
leaq 0x10(%rsp), %rdi
callq 0xcd50
leaq 0xa0(%rsp), %rdi
callq 0xceee
movq %rbx, %rdi
callq 0x45a0