// File: BlinfoldKing[P]lisval/src/lib/evaluator.cpp
// Function: Evaluator::or_()
pair<Token*, function<Token*(Token*)>> Evaluator::or_() {
    Token* op = new BinaryOperator(BinaryOperatorType::OR);
    Token* var1 = new Variable("L");
    Token* var2 = new Variable("R");
    List* signature = new List();
    signature->list.push_back(op);
    signature->list.push_back(var1);
    signature->list.push_back(var2);
    Token* token = signature;
    auto res = make_pair(token, [this](Token* input) {
            List* list = static_cast<List*>(input);

            Token* a_token = this->eval(list->list[1]);
            Token* b_token = this->eval(list->list[2]);

            if (a_token->type != TokenType::BOOLEAN) {
                Token* t = new Error("expect a boolean, got: " + a_token->debug() , input);
                return t;
            }

            if (b_token->type != TokenType::BOOLEAN) {
                Token* t = new Error("expect a boolean, got: " + a_token->debug(), input);
                return t;
            }

            Boolean* a = static_cast<Boolean*>(a_token);
            Boolean* b = static_cast<Boolean*>(b_token);

            Token* res = new Boolean(a->value || b->value);
            return res;
    });

    return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0xd0(%rbp)
movq %rdi, %rax
movq %rax, -0xc8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xc0(%rbp)
movl $0x8, %edi
callq 0x32b0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xb8(%rbp)
movl $0x6, %esi
callq 0x11920
jmp 0x6e12
movq -0xb8(%rbp), %rax
movq %rax, -0x18(%rbp)
movl $0x28, %edi
callq 0x32b0
movq %rax, -0xe0(%rbp)
movb $0x1, -0x52(%rbp)
leaq -0x51(%rbp), %rdi
movq %rdi, -0xd8(%rbp)
callq 0x34a0
movq -0xd8(%rbp), %rdx
leaq 0x1c537(%rip), %rsi     # 0x23387
leaq -0x50(%rbp), %rdi
callq 0x33b0
jmp 0x6e5b
movq -0xe0(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x11830
jmp 0x6e6d
movb $0x0, -0x52(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x31c0
leaq -0x51(%rbp), %rdi
callq 0x3300
movq -0xe0(%rbp), %rax
movq %rax, -0x30(%rbp)
movl $0x28, %edi
callq 0x32b0
movq %rax, -0xf0(%rbp)
movb $0x1, -0x82(%rbp)
leaq -0x81(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x34a0
movq -0xe8(%rbp), %rdx
leaq 0x1c6f9(%rip), %rsi     # 0x235c0
leaq -0x80(%rbp), %rdi
callq 0x33b0
jmp 0x6ed2
movq -0xf0(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x11830
jmp 0x6ee4
movb $0x0, -0x82(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x31c0
leaq -0x81(%rbp), %rdi
callq 0x3300
movq -0xf0(%rbp), %rax
movq %rax, -0x60(%rbp)
movl $0x20, %edi
callq 0x32b0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xf8(%rbp)
callq 0x11870
jmp 0x6f29
movq -0xf8(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rdi
addq $0x8, %rdi
leaq -0x18(%rbp), %rsi
callq 0x118b0
movq -0x90(%rbp), %rdi
addq $0x8, %rdi
leaq -0x30(%rbp), %rsi
callq 0x118b0
movq -0x90(%rbp), %rdi
addq $0x8, %rdi
leaq -0x60(%rbp), %rsi
callq 0x118b0
movq -0xc0(%rbp), %rax
movq -0x90(%rbp), %rcx
movq %rcx, -0x98(%rbp)
movq %rax, -0xb0(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x70b0
movq -0xd0(%rbp), %rdi
movq %rax, -0xa8(%rbp)
movq %rdx, -0xa0(%rbp)
leaq -0xa8(%rbp), %rsi
callq 0x70e0
movq -0xc8(%rbp), %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq -0xb8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x8, %esi
callq 0x32c0
jmp 0x70a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x7018
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x31c0
leaq -0x51(%rbp), %rdi
callq 0x3300
testb $0x1, -0x52(%rbp)
jne 0x7029
jmp 0x703a
movq -0xe0(%rbp), %rdi
movl $0x28, %esi
callq 0x32c0
jmp 0x70a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x705f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x31c0
leaq -0x81(%rbp), %rdi
callq 0x3300
testb $0x1, -0x82(%rbp)
jne 0x7076
jmp 0x7087
movq -0xf0(%rbp), %rdi
movl $0x28, %esi
callq 0x32c0
jmp 0x70a6
movq -0xf8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x20, %esi
callq 0x32c0
movq -0x20(%rbp), %rdi
callq 0x3490
nop