// File: DCTewi[P]Truthtable-Calculator/functions.cpp
// Function: getResultOf(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::map<char, int, std::less<char>, std::allocator<std::pair<char const, int>>>&)
bool getResultOf(const std::string &expr, std::map<char, int> &valueof)
{
    // Cache
    std::stack<bool> s;
    for (int i = 0; i < static_cast<int>(expr.size()); i++)
    {
        const char &now = expr[i];
        // Variables
        if (isalpha(now))
        {
            s.push(valueof[now]);
        }
        // Operators
        else if (now == '!')
        {
            if (s.size() < 1)
            {
                throw std::overflow_error("Illegal Expression!");
            }
            bool top = s.top(); s.pop();
            s.push(!top);
        }
        else if (now == '&' || now == '*')
        {
            if (s.size() < 2)
            {
                throw std::overflow_error("Illegal Expression!");
            }
            bool a = s.top(); s.pop();
            bool b = s.top(); s.pop();
            s.push(a && b);
        }
        else if (now == '|' || now == '+')
        {
            if (s.size() < 2)
            {
                throw std::overflow_error("Illegal Expression!");
            }
            bool a = s.top(); s.pop();
            bool b = s.top(); s.pop();
            s.push(a || b);
        }
        else if (now == '-')
        {
            if (s.size() < 2)
            {
                throw std::overflow_error("Illegal Expression!");
            }
            bool a = s.top(); s.pop();
            bool b = s.top(); s.pop();
            s.push((!a) || b);
        }
        else if (now == '=')
        {
            if (s.size() < 2)
            {
                throw std::overflow_error("Illegal Expression!");
            }
            bool a = s.top(); s.pop();
            bool b = s.top(); s.pop();
            s.push(a == b);
        }
    }
    if (s.size() == 1)
    {
        return s.top();
    }
    else
    {
        throw std::overflow_error("Illegal Expression!");
    }
}

// Assembly:
subq $0x178, %rsp            # imm = 0x178
movq %rdi, 0x170(%rsp)
movq %rsi, 0x168(%rsp)
leaq 0x118(%rsp), %rdi
callq 0x4bd0
movl $0x0, 0x114(%rsp)
movl 0x114(%rsp), %eax
movl %eax, 0xe0(%rsp)
movq 0x170(%rsp), %rdi
callq 0x2160
movq %rax, %rcx
movl 0xe0(%rsp), %eax
cmpl %ecx, %eax
jge 0x38d2
movq 0x170(%rsp), %rdi
movslq 0x114(%rsp), %rsi
callq 0x2220
movq %rax, 0x108(%rsp)
movq 0x108(%rsp), %rax
movsbl (%rax), %edi
callq 0x22b0
cmpl $0x0, %eax
je 0x3256
movq 0x168(%rsp), %rdi
movq 0x108(%rsp), %rsi
callq 0x4c30
movq %rax, 0xd8(%rsp)
jmp 0x320d
movq 0xd8(%rsp), %rax
movl (%rax), %eax
testl %eax, %eax
setne 0x107(%rsp)
leaq 0x118(%rsp), %rdi
leaq 0x107(%rsp), %rsi
callq 0x4c00
jmp 0x3238
jmp 0x38ba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
jmp 0x3986
movq 0x108(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x21, %eax
jne 0x3362
leaq 0x118(%rsp), %rdi
callq 0x4d20
movq %rax, 0xd0(%rsp)
jmp 0x3281
movq 0xd0(%rsp), %rax
cmpq $0x1, %rax
jae 0x32fb
movl $0x10, %edi
callq 0x20c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0xc8(%rsp)
leaq 0x9d64(%rip), %rsi      # 0xd012
callq 0x2060
jmp 0x32b5
movq 0xc8(%rsp), %rdi
movq 0xfcf4(%rip), %rsi      # 0x12fb8
movq 0xfce5(%rip), %rdx      # 0x12fb0
callq 0x22f0
jmp 0x39a0
movq 0xc8(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
callq 0x2170
jmp 0x3986
leaq 0x118(%rsp), %rdi
callq 0x4d30
movq %rax, 0xc0(%rsp)
jmp 0x3312
movq 0xc0(%rsp), %rax
movb (%rax), %al
andb $0x1, %al
movb %al, 0xf3(%rsp)
leaq 0x118(%rsp), %rdi
callq 0x4d40
jmp 0x3334
movb 0xf3(%rsp), %al
notb %al
andb $0x1, %al
movb %al, 0xf2(%rsp)
leaq 0x118(%rsp), %rdi
leaq 0xf2(%rsp), %rsi
callq 0x4c00
jmp 0x335d
jmp 0x38b8
movq 0x108(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x26, %eax
je 0x3386
movq 0x108(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x2a, %eax
jne 0x34d6
leaq 0x118(%rsp), %rdi
callq 0x4d20
movq %rax, 0xb8(%rsp)
jmp 0x339d
movq 0xb8(%rsp), %rax
cmpq $0x2, %rax
jae 0x3417
movl $0x10, %edi
callq 0x20c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0xb0(%rsp)
leaq 0x9c48(%rip), %rsi      # 0xd012
callq 0x2060
jmp 0x33d1
movq 0xb0(%rsp), %rdi
movq 0xfbd8(%rip), %rsi      # 0x12fb8
movq 0xfbc9(%rip), %rdx      # 0x12fb0
callq 0x22f0
jmp 0x39a0
movq 0xb0(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
callq 0x2170
jmp 0x3986
leaq 0x118(%rsp), %rdi
callq 0x4d30
movq %rax, 0xa8(%rsp)
jmp 0x342e
movq 0xa8(%rsp), %rax
movb (%rax), %al
andb $0x1, %al
movb %al, 0xf1(%rsp)
leaq 0x118(%rsp), %rdi
callq 0x4d40
jmp 0x3450
leaq 0x118(%rsp), %rdi
callq 0x4d30
movq %rax, 0xa0(%rsp)
jmp 0x3467
movq 0xa0(%rsp), %rax
movb (%rax), %al
andb $0x1, %al
movb %al, 0xf0(%rsp)
leaq 0x118(%rsp), %rdi
callq 0x4d40
jmp 0x3489
xorl %eax, %eax
testb $0x1, 0xf1(%rsp)
movb %al, 0x9f(%rsp)
je 0x34aa
movb 0xf0(%rsp), %al
movb %al, 0x9f(%rsp)
movb 0x9f(%rsp), %al
andb $0x1, %al
movb %al, 0xef(%rsp)
leaq 0x118(%rsp), %rdi
leaq 0xef(%rsp), %rsi
callq 0x4c00
jmp 0x34d1
jmp 0x38b6
movq 0x108(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x7c, %eax
je 0x34fa
movq 0x108(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
jne 0x363b
leaq 0x118(%rsp), %rdi
callq 0x4d20
movq %rax, 0x90(%rsp)
jmp 0x3511
movq 0x90(%rsp), %rax
cmpq $0x2, %rax
jae 0x358b
movl $0x10, %edi
callq 0x20c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x88(%rsp)
leaq 0x9ad4(%rip), %rsi      # 0xd012
callq 0x2060
jmp 0x3545
movq 0x88(%rsp), %rdi
movq 0xfa64(%rip), %rsi      # 0x12fb8
movq 0xfa55(%rip), %rdx      # 0x12fb0
callq 0x22f0
jmp 0x39a0
movq 0x88(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
callq 0x2170
jmp 0x3986
leaq 0x118(%rsp), %rdi
callq 0x4d30
movq %rax, 0x80(%rsp)
jmp 0x35a2
movq 0x80(%rsp), %rax
movb (%rax), %al
andb $0x1, %al
movb %al, 0xee(%rsp)
leaq 0x118(%rsp), %rdi
callq 0x4d40
jmp 0x35c4
leaq 0x118(%rsp), %rdi
callq 0x4d30
movq %rax, 0x78(%rsp)
jmp 0x35d8
movq 0x78(%rsp), %rax
movb (%rax), %al
andb $0x1, %al
movb %al, 0xed(%rsp)
leaq 0x118(%rsp), %rdi
callq 0x4d40
jmp 0x35f7
movb $0x1, %al
testb $0x1, 0xee(%rsp)
movb %al, 0x77(%rsp)
jne 0x3612
movb 0xed(%rsp), %al
movb %al, 0x77(%rsp)
movb 0x77(%rsp), %al
andb $0x1, %al
movb %al, 0xec(%rsp)
leaq 0x118(%rsp), %rdi
leaq 0xec(%rsp), %rsi
callq 0x4c00
jmp 0x3636
jmp 0x38b4
movq 0x108(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x377b
leaq 0x118(%rsp), %rdi
callq 0x4d20
movq %rax, 0x68(%rsp)
jmp 0x3663
movq 0x68(%rsp), %rax
cmpq $0x2, %rax
jae 0x36d1
movl $0x10, %edi
callq 0x20c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x60(%rsp)
leaq 0x9988(%rip), %rsi      # 0xd012
callq 0x2060
jmp 0x3691
movq 0x60(%rsp), %rdi
movq 0xf91b(%rip), %rsi      # 0x12fb8
movq 0xf90c(%rip), %rdx      # 0x12fb0
callq 0x22f0
jmp 0x39a0
movq 0x60(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
callq 0x2170
jmp 0x3986
leaq 0x118(%rsp), %rdi
callq 0x4d30
movq %rax, 0x58(%rsp)
jmp 0x36e5
movq 0x58(%rsp), %rax
movb (%rax), %al
andb $0x1, %al
movb %al, 0xeb(%rsp)
leaq 0x118(%rsp), %rdi
callq 0x4d40
jmp 0x3704
leaq 0x118(%rsp), %rdi
callq 0x4d30
movq %rax, 0x50(%rsp)
jmp 0x3718
movq 0x50(%rsp), %rax
movb (%rax), %al
andb $0x1, %al
movb %al, 0xea(%rsp)
leaq 0x118(%rsp), %rdi
callq 0x4d40
jmp 0x3737
movb $0x1, %al
testb $0x1, 0xeb(%rsp)
movb %al, 0x4f(%rsp)
je 0x3752
movb 0xea(%rsp), %al
movb %al, 0x4f(%rsp)
movb 0x4f(%rsp), %al
andb $0x1, %al
movb %al, 0xe9(%rsp)
leaq 0x118(%rsp), %rdi
leaq 0xe9(%rsp), %rsi
callq 0x4c00
jmp 0x3776
jmp 0x38b2
movq 0x108(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x3d, %eax
jne 0x38b0
leaq 0x118(%rsp), %rdi
callq 0x4d20
movq %rax, 0x40(%rsp)
jmp 0x37a3
movq 0x40(%rsp), %rax
cmpq $0x2, %rax
jae 0x3811
movl $0x10, %edi
callq 0x20c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x38(%rsp)
leaq 0x9848(%rip), %rsi      # 0xd012
callq 0x2060
jmp 0x37d1
movq 0x38(%rsp), %rdi
movq 0xf7db(%rip), %rsi      # 0x12fb8
movq 0xf7cc(%rip), %rdx      # 0x12fb0
callq 0x22f0
jmp 0x39a0
movq 0x38(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
callq 0x2170
jmp 0x3986
leaq 0x118(%rsp), %rdi
callq 0x4d30
movq %rax, 0x30(%rsp)
jmp 0x3825
movq 0x30(%rsp), %rax
movb (%rax), %al
andb $0x1, %al
movb %al, 0xe8(%rsp)
leaq 0x118(%rsp), %rdi
callq 0x4d40
jmp 0x3844
leaq 0x118(%rsp), %rdi
callq 0x4d30
movq %rax, 0x28(%rsp)
jmp 0x3858
movq 0x28(%rsp), %rax
movb (%rax), %al
andb $0x1, %al
movb %al, 0xe7(%rsp)
leaq 0x118(%rsp), %rdi
callq 0x4d40
jmp 0x3877
movzbl 0xe8(%rsp), %eax
andl $0x1, %eax
movzbl 0xe7(%rsp), %ecx
andl $0x1, %ecx
subl %ecx, %eax
sete 0xe6(%rsp)
leaq 0x118(%rsp), %rdi
leaq 0xe6(%rsp), %rsi
callq 0x4c00
jmp 0x38ae
jmp 0x38b0
jmp 0x38b2
jmp 0x38b4
jmp 0x38b6
jmp 0x38b8
jmp 0x38ba
jmp 0x38bc
movl 0x114(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x114(%rsp)
jmp 0x318f
leaq 0x118(%rsp), %rdi
callq 0x4d20
movq %rax, 0x20(%rsp)
jmp 0x38e6
movq 0x20(%rsp), %rax
cmpq $0x1, %rax
jne 0x392b
leaq 0x118(%rsp), %rdi
callq 0x4d30
movq %rax, 0x18(%rsp)
jmp 0x3905
movq 0x18(%rsp), %rax
movb (%rax), %al
movb %al, 0x17(%rsp)
leaq 0x118(%rsp), %rdi
callq 0x4d50
movb 0x17(%rsp), %al
andb $0x1, %al
addq $0x178, %rsp            # imm = 0x178
retq
movl $0x10, %edi
callq 0x20c0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x8(%rsp)
leaq 0x96cb(%rip), %rsi      # 0xd012
callq 0x2060
jmp 0x394e
movq 0x8(%rsp), %rdi
movq 0xf65e(%rip), %rsi      # 0x12fb8
movq 0xf64f(%rip), %rdx      # 0x12fb0
callq 0x22f0
jmp 0x39a0
movq 0x8(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
callq 0x2170
leaq 0x118(%rsp), %rdi
callq 0x4d50
movq 0xf8(%rsp), %rdi
callq 0x2310