// File: BlinfoldKing[P]lisval/src/lib/evaluator.cpp
// Function: compareSignature(Token*, Token*)
bool compareSignature(Token* input, Token* signature) {
        if (signature->type == TokenType::VARIABLE) {
            return input->type != TokenType::VARIABLE;
        }

        if (input->type != signature->type) {
            return false;
        }

        if (input->type == TokenType::LIST) {
            List* input_list = static_cast<List*>(input);
            List* signature_list = static_cast<List*>(signature);

            return compareList(input_list, signature_list);
        }

        if (input->type == TokenType::ATOM) {
            Atom* i = static_cast<Atom*>(input);
            Atom* s = static_cast<Atom*>(signature);
            return i->str == s->str;
        }

        if (input->type == TokenType::VARIABLE) {
            Variable* i = static_cast<Variable*>(input);
            Variable* s = static_cast<Variable*>(signature);
            return i->str == s->str;
        }

        if (input->type == TokenType::NUMBER) {
            Number* i = static_cast<Number*>(input);
            Number* s = static_cast<Number*>(signature);
            return i->value == s->value;
        }

        if (input->type == TokenType::BOOLEAN) {
            Boolean* i = static_cast<Boolean*>(input);
            Boolean* s = static_cast<Boolean*>(signature);
            return i->value == s->value;
        }

        return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x3, (%rax)
jne 0x943d
movq -0x10(%rbp), %rax
cmpl $0x3, (%rax)
setne %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x956c
movq -0x10(%rbp), %rax
movl (%rax), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
je 0x9454
movb $0x0, -0x1(%rbp)
jmp 0x956c
movq -0x10(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x9484
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x9090
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x956c
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x94bc
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
addq $0x8, %rdi
movq -0x38(%rbp), %rsi
addq $0x8, %rsi
callq 0x11f90
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x956c
movq -0x10(%rbp), %rax
cmpl $0x3, (%rax)
jne 0x94f1
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
addq $0x8, %rdi
movq -0x48(%rbp), %rsi
addq $0x8, %rsi
callq 0x11f90
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x956c
movq -0x10(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x952a
movq -0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rax
movss 0x4(%rax), %xmm0
movq -0x58(%rbp), %rax
ucomiss 0x4(%rax), %xmm0
sete %al
setnp %cl
andb %cl, %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x956c
movq -0x10(%rbp), %rax
cmpl $0x7, (%rax)
jne 0x9568
movq -0x10(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rax
movb 0x4(%rax), %al
andb $0x1, %al
movzbl %al, %eax
movq -0x68(%rbp), %rcx
movb 0x4(%rcx), %cl
andb $0x1, %cl
movzbl %cl, %ecx
cmpl %ecx, %eax
sete %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x956c
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)