// File: /workspace/github_cpp_makefile_star2_O1/DCTewi[P]Truthtable-Calculator/functions.cpp
// Function: toReverseNotation(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
std::string toReverseNotation(const std::string &expr)
{
    if (!isLegal(expr))
    {
        throw std::overflow_error("Illegal Expression!");
    }

    // Result
    std::string res;
    // Stack of operators, Stack for cache data
    std::stack<char> soper, smid;
    // For every char in expressions
    for (int i = 0; i < static_cast<int>(expr.size()); i++)
    {
        const char &now = expr[i];
        // variables
        if (isalpha(now))
        {
            smid.push(now);
        }
        // operators
        else if (operators.count(now))
        {
            int flag = 0;
            while (!flag)
            {
                // Empty or top with (
                if (soper.empty() || soper.top() == '(')
                {
                    soper.push(now); flag = 1;
                }
                // Higher priority than top
                else if (getPriority(now) > getPriority(soper.top()))
                {
                    soper.push(now); flag = 1;
                }
                // Lower
                else
                {
                    smid.push(soper.top());
                    soper.pop();
                }
            }
        }
        // braces
        else if (now == '(')
        {
            soper.push(now);
        }
        else if (now == ')')
        {
            // pop!!!
            while (soper.size() && soper.top() != '(')
            {
                smid.push(soper.top());
                soper.pop();
            }
            if (soper.top() == '(') soper.pop();
        }
        else
        {
            throw std::overflow_error("Illegal Expression!");
        }
    }
    // Summary
    while (soper.size())
    {
        smid.push(soper.top());
        soper.pop();
    }
    while (smid.size())
    {
        res += smid.top();
        smid.pop();
    }
    std::reverse(res.begin(), res.end());

    return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x27ff
testb %al, %al
je 0x2fb6
leaq 0x10(%rbx), %r12
movq %r12, (%rbx)
movq $0x0, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
xorps %xmm0, %xmm0
movq %rsp, %r15
movaps %xmm0, 0x40(%r15)
movaps %xmm0, 0x30(%r15)
movaps %xmm0, 0x20(%r15)
movaps %xmm0, 0x10(%r15)
movaps %xmm0, (%r15)
movq %r15, %rdi
xorl %esi, %esi
movq %rbx, 0xa8(%rsp)
movq %r12, 0xb0(%rsp)
callq 0x4a9e
leaq 0x50(%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 0x4a9e
cmpl $0x0, 0x8(%r14)
jle 0x2e0c
xorl %r13d, %r13d
movl $0x200, %r12d           # imm = 0x200
movq (%r14), %rbp
movb (%rbp,%r13), %bl
addq %r13, %rbp
movsbl %bl, %edi
callq 0x2210
testl %eax, %eax
je 0x2a0a
movq 0x80(%rsp), %rax
movq 0x90(%rsp), %rcx
decq %rcx
leaq 0x50(%rsp), %rdi
cmpq %rcx, %rax
je 0x2d08
movb %bl, (%rax)
incq 0x80(%rsp)
jmp 0x2d10
leaq 0x675f(%rip), %rdi      # 0x9170
movq %rbp, %rsi
callq 0x43e6
testq %rax, %rax
je 0x2beb
xorl %ebx, %ebx
movq 0x30(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x2a4f
movq 0x38(%rsp), %rax
movq %rsi, %rcx
cmpq %rax, %rsi
jne 0x2a49
movq 0x48(%rsp), %rcx
movq -0x8(%rcx), %rcx
addq %r12, %rcx
cmpb $0x28, -0x1(%rcx)
jne 0x2a7c
movq 0x40(%rsp), %rax
decq %rax
cmpq %rax, %rsi
je 0x2b3b
movb (%rbp), %al
movb %al, (%rsi)
movq 0x30(%rsp), %rax
incq %rax
movl $0x1, %ebx
movq %rax, 0x30(%rsp)
jmp 0x2b4b
movb (%rbp), %cl
movzbl %cl, %edi
cmpl $0x2c, %edi
jle 0x2aa2
cmpl $0x7c, %edi
je 0x2ab0
movl $0xfffffffd, %edx       # imm = 0xFFFFFFFD
cmpl $0x3d, %edi
je 0x2ac3
cmpl $0x2d, %edi
jne 0x2abe
movl $0xfffffffe, %edx       # imm = 0xFFFFFFFE
jmp 0x2ac3
cmpl $0x21, %edi
je 0x2ab7
cmpl $0x26, %edi
jne 0x2abe
xorl %edx, %edx
jmp 0x2ac3
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
jmp 0x2ac3
movl $0x1, %edx
jmp 0x2ac3
movl $0xfffffff6, %edx       # imm = 0xFFFFFFF6
movq %rsi, %rdi
cmpq %rax, %rsi
jne 0x2ad7
movq 0x48(%rsp), %rdi
movq -0x8(%rdi), %rdi
addq %r12, %rdi
movzbl -0x1(%rdi), %r8d
cmpl $0x2c, %r8d
jle 0x2b00
cmpl $0x7c, %r8d
je 0x2b10
movl $0xfffffffd, %edi       # imm = 0xFFFFFFFD
cmpl $0x3d, %r8d
je 0x2b23
cmpl $0x2d, %r8d
jne 0x2b1e
movl $0xfffffffe, %edi       # imm = 0xFFFFFFFE
jmp 0x2b23
cmpl $0x21, %r8d
je 0x2b17
cmpl $0x26, %r8d
jne 0x2b1e
xorl %edi, %edi
jmp 0x2b23
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
jmp 0x2b23
movl $0x1, %edi
jmp 0x2b23
movl $0xfffffff6, %edi       # imm = 0xFFFFFFF6
cmpl %edi, %edx
jle 0x2b58
movq 0x40(%rsp), %rax
decq %rax
cmpq %rax, %rsi
je 0x2b3b
movb %cl, (%rsi)
jmp 0x2a65
movl $0x1, %ebx
movq %r15, %rdi
movq %rbp, %rsi
callq 0x4c16
testl %ebx, %ebx
je 0x2a24
jmp 0x2d10
cmpq %rax, %rsi
jne 0x2b69
movq 0x48(%rsp), %rax
movq -0x8(%rax), %rsi
addq %r12, %rsi
decq %rsi
movq 0x80(%rsp), %rax
movq 0x90(%rsp), %rcx
decq %rcx
cmpq %rcx, %rax
je 0x2b92
movb (%rsi), %cl
movb %cl, (%rax)
incq 0x80(%rsp)
jmp 0x2b9c
leaq 0x50(%rsp), %rdi
callq 0x4c16
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rdi
cmpq %rdi, %rax
je 0x2bb3
decq %rax
jmp 0x2a72
movl $0x200, %esi            # imm = 0x200
callq 0x2180
movq 0x48(%rsp), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x48(%rsp)
movq -0x8(%rax), %rax
movq %rax, 0x38(%rsp)
leaq 0x200(%rax), %rcx
movq %rcx, 0x40(%rsp)
addq $0x1ff, %rax            # imm = 0x1FF
jmp 0x2a72
movzbl (%rbp), %eax
cmpl $0x28, %eax
je 0x2cea
cmpl $0x29, %eax
jne 0x2f84
movq 0x48(%rsp), %rax
movq %rax, %rcx
subq 0x28(%rsp), %rcx
shrq $0x3, %rcx
cmpq $0x1, %rax
adcq $-0x1, %rcx
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdi
movq %rsi, %rdx
subq %rdi, %rdx
addq 0x20(%rsp), %rdx
shlq $0x9, %rcx
addq %rcx, %rdx
cmpq 0x10(%rsp), %rdx
je 0x2d25
movq %rsi, %rcx
cmpq %rdi, %rsi
jne 0x2c50
movq -0x8(%rax), %rcx
addq %r12, %rcx
cmpb $0x28, -0x1(%rcx)
je 0x2d25
cmpq %rdi, %rsi
jne 0x2c66
movq -0x8(%rax), %rsi
addq %r12, %rsi
decq %rsi
movq 0x80(%rsp), %rax
movq 0x90(%rsp), %rcx
decq %rcx
cmpq %rcx, %rax
je 0x2c8f
movb (%rsi), %cl
movb %cl, (%rax)
incq 0x80(%rsp)
jmp 0x2c99
leaq 0x50(%rsp), %rdi
callq 0x4c16
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rdi
cmpq %rdi, %rax
je 0x2cad
decq %rax
jmp 0x2ce0
movl $0x200, %esi            # imm = 0x200
callq 0x2180
movq 0x48(%rsp), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x48(%rsp)
movq -0x8(%rax), %rax
movq %rax, 0x38(%rsp)
leaq 0x200(%rax), %rcx
movq %rcx, 0x40(%rsp)
addq $0x1ff, %rax            # imm = 0x1FF
movq %rax, 0x30(%rsp)
jmp 0x2c01
movq 0x30(%rsp), %rcx
movq 0x40(%rsp), %rdx
decq %rdx
movq %r15, %rdi
cmpq %rdx, %rcx
je 0x2d08
movb %al, (%rcx)
incq 0x30(%rsp)
jmp 0x2d10
movq %rbp, %rsi
callq 0x4c16
incq %r13
movslq 0x8(%r14), %rax
cmpq %rax, %r13
jl 0x29c3
jmp 0x2e0c
movq %rsi, %rcx
cmpq %rdi, %rsi
jne 0x2d34
movq -0x8(%rax), %rcx
addq %r12, %rcx
cmpb $0x28, -0x1(%rcx)
jne 0x2d10
cmpq %rdi, %rsi
je 0x2d44
decq %rsi
jmp 0x2d78
movl $0x200, %esi            # imm = 0x200
callq 0x2180
movq 0x48(%rsp), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x48(%rsp)
movq -0x8(%rax), %rsi
movq %rsi, 0x38(%rsp)
leaq 0x200(%rsi), %rax
movq %rax, 0x40(%rsp)
addq $0x1ff, %rsi            # imm = 0x1FF
movq %rsi, 0x30(%rsp)
jmp 0x2d10
cmpq %rcx, %rsi
jne 0x2d8d
movl $0x200, %esi            # imm = 0x200
addq -0x8(%rax), %rsi
decq %rsi
movq 0x80(%rsp), %rax
movq 0x90(%rsp), %rcx
decq %rcx
cmpq %rcx, %rax
je 0x2db6
movb (%rsi), %cl
movb %cl, (%rax)
incq 0x80(%rsp)
jmp 0x2dc0
leaq 0x50(%rsp), %rdi
callq 0x4c16
movq 0x30(%rsp), %rax
movq 0x38(%rsp), %rdi
cmpq %rdi, %rax
je 0x2dd4
decq %rax
jmp 0x2e07
movl $0x200, %esi            # imm = 0x200
callq 0x2180
movq 0x48(%rsp), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x48(%rsp)
movq -0x8(%rax), %rax
movq %rax, 0x38(%rsp)
leaq 0x200(%rax), %rcx
movq %rcx, 0x40(%rsp)
addq $0x1ff, %rax            # imm = 0x1FF
movq %rax, 0x30(%rsp)
movq 0x48(%rsp), %rax
movq %rax, %rdx
subq 0x28(%rsp), %rdx
shrq $0x3, %rdx
cmpq $0x1, %rax
adcq $-0x1, %rdx
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rcx
movq %rsi, %rdi
subq %rcx, %rdi
addq 0x20(%rsp), %rdi
shlq $0x9, %rdx
addq %rdx, %rdi
cmpq 0x10(%rsp), %rdi
jne 0x2d7f
movl $0x200, %ebx            # imm = 0x200
movq 0xa8(%rsp), %r14
movq 0x98(%rsp), %rax
movq %rax, %rsi
subq 0x78(%rsp), %rsi
shrq $0x3, %rsi
cmpq $0x1, %rax
adcq $-0x1, %rsi
movq 0x80(%rsp), %rcx
movq 0x88(%rsp), %rdx
movq %rcx, %rdi
subq %rdx, %rdi
addq 0x70(%rsp), %rdi
shlq $0x9, %rsi
addq %rsi, %rdi
cmpq 0x60(%rsp), %rdi
je 0x2f1c
cmpq %rdx, %rcx
jne 0x2eaa
movq -0x8(%rax), %rcx
addq %rbx, %rcx
movsbl -0x1(%rcx), %esi
movq %r14, %rdi
callq 0x2130
movq 0x80(%rsp), %rax
movq 0x88(%rsp), %rdi
cmpq %rdi, %rax
je 0x2ed0
decq %rax
jmp 0x2f0f
movl $0x200, %esi            # imm = 0x200
callq 0x2180
movq 0x98(%rsp), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x98(%rsp)
movq -0x8(%rax), %rax
movq %rax, 0x88(%rsp)
leaq 0x200(%rax), %rcx
movq %rcx, 0x90(%rsp)
addq $0x1ff, %rax            # imm = 0x1FF
movq %rax, 0x80(%rsp)
jmp 0x2e59
movq (%r14), %rax
movq 0x8(%r14), %rcx
testq %rcx, %rcx
setne %dl
addq %rax, %rcx
decq %rcx
cmpq %rax, %rcx
seta %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x2f5d
incq %rax
movb -0x1(%rax), %dl
movb (%rcx), %sil
movb %sil, -0x1(%rax)
movb %dl, (%rcx)
decq %rcx
leaq 0x1(%rax), %rdx
cmpq %rcx, %rax
movq %rdx, %rax
jb 0x2f42
leaq 0x50(%rsp), %rdi
callq 0x47e8
movq %rsp, %rdi
callq 0x47e8
movq %r14, %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x20b0
movq %rax, %r15
leaq 0x30f6(%rip), %rsi      # 0x608e
movq %rax, %rdi
callq 0x2050
movq 0x6011(%rip), %rsi      # 0x8fb8
movq 0x6002(%rip), %rdx      # 0x8fb0
movq %r15, %rdi
callq 0x2240
movl $0x10, %edi
callq 0x20b0
movq %rax, %rbx
leaq 0x30c4(%rip), %rsi      # 0x608e
movq %rax, %rdi
callq 0x2050
movq 0x5fdf(%rip), %rsi      # 0x8fb8
movq 0x5fd0(%rip), %rdx      # 0x8fb0
movq %rbx, %rdi
callq 0x2240
movq %rax, %r14
movq %rbx, %rdi
callq 0x2110
jmp 0x304e
jmp 0x3016
movq %rax, %r14
movq %r15, %rdi
callq 0x2110
jmp 0x3019
movq %rax, %r14
jmp 0x3023
movq %rax, %r14
jmp 0x302b
jmp 0x3016
jmp 0x3016
jmp 0x3016
jmp 0x3016
movq %rax, %r14
leaq 0x50(%rsp), %rdi
callq 0x47e8
movq %rsp, %rdi
callq 0x47e8
movq 0xa8(%rsp), %rax
movq (%rax), %rdi
movq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x304e
movq (%rax), %rsi
incq %rsi
callq 0x2180
movq %r14, %rdi
callq 0x2270