// File: /workspace/github_cpp_makefile_star2_O3/BlinfoldKing[P]lisval/src/lib/evaluator.cpp
// Function: Evaluator::range()
pair<Token*, function<Token*(Token*)>> Evaluator::range() {
    Token* op = new Atom("range");
    Token* var1 = new Variable("MIN");
    Token* var2 = new Variable("MAX");
    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::NUMBER) {
                Token* t = new Error("expect a number, got: " + a_token->debug(), input);
                return t;
            }

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

            Number* min = static_cast<Number*>(a_token);
            Number* max = static_cast<Number*>(b_token);

            List* result = new List();
            for (int i = min->value; i < max->value; i++) {
                result->list.push_back(new Number(i));
            }

            Token* t = result;
            return t;
    });

    return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, %r13
movq %rdi, %rbx
movl $0x28, %edi
callq 0x31b0
movq %rax, %r15
leaq -0x90(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0xaf2c(%rip), %rsi      # 0xf2c5
leaq 0xaf2a(%rip), %rdx      # 0xf2ca
leaq -0xa0(%rbp), %rdi
callq 0x3bb0
movl $0x0, (%r15)
leaq 0x8(%r15), %rdi
movq %r15, %rax
addq $0x18, %rax
movq %rax, 0x8(%r15)
movq -0xa0(%rbp), %rsi
movq -0x98(%rbp), %rdx
addq %rsi, %rdx
callq 0x3a18
movq -0xa0(%rbp), %rdi
cmpq %r14, %rdi
je 0x43f3
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x31c0
movq %r15, -0xa8(%rbp)
movl $0x28, %edi
callq 0x31b0
movq %rax, %r15
leaq -0x68(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0xaeb5(%rip), %rsi      # 0xf2cb
leaq 0xaeb1(%rip), %rdx      # 0xf2ce
leaq -0x78(%rbp), %rdi
callq 0x3bb0
movl $0x3, (%r15)
leaq 0x8(%r15), %rdi
movq %r15, %rax
addq $0x18, %rax
movq %rax, 0x8(%r15)
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
addq %rsi, %rdx
callq 0x3a18
movq -0x78(%rbp), %rdi
cmpq %r14, %rdi
je 0x4461
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x31c0
movq %r15, -0x80(%rbp)
movl $0x28, %edi
callq 0x31b0
movq %rax, %r12
leaq -0x40(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0xae4e(%rip), %rsi      # 0xf2cf
leaq 0xae4a(%rip), %rdx      # 0xf2d2
leaq -0x50(%rbp), %rdi
callq 0x3bb0
movl $0x3, (%r12)
leaq 0x8(%r12), %rdi
movq %r12, %rax
addq $0x18, %rax
movq %rax, 0x8(%r12)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
addq %rsi, %rdx
callq 0x3a18
movq %r13, -0x30(%rbp)
movq -0x50(%rbp), %rdi
cmpq %r14, %rdi
je 0x44d3
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x31c0
movq %r12, -0x58(%rbp)
movl $0x20, %edi
callq 0x31b0
movq %rax, %r13
movl $0x1, (%rax)
leaq 0x8(%rax), %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
movq $0x0, 0x18(%rax)
leaq -0xa8(%rbp), %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x9afe
movq 0x10(%r13), %rsi
cmpq 0x18(%r13), %rsi
je 0x4529
movq %r15, (%rsi)
movq 0x10(%r13), %rsi
addq $0x8, %rsi
movq %rsi, 0x10(%r13)
jmp 0x4539
leaq -0x80(%rbp), %rdx
movq %r14, %rdi
callq 0x9afe
movq 0x10(%r13), %rsi
cmpq 0x18(%r13), %rsi
je 0x4549
movq %r12, (%rsi)
addq $0x8, 0x10(%r13)
jmp 0x4555
leaq -0x58(%rbp), %rdx
movq %r14, %rdi
callq 0x9afe
movq %r13, (%rbx)
movq $0x0, 0x10(%rbx)
movq -0x30(%rbp), %rax
movq %rax, 0x8(%rbx)
leaq 0x33b7(%rip), %rax      # 0x7926
movq %rax, 0x20(%rbx)
leaq 0x367a(%rip), %rax      # 0x7bf4
movq %rax, 0x18(%rbx)
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r14, %rdi
je 0x45b0
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x31c0
jmp 0x45b0
movq %rax, %rbx
movl $0x28, %esi
movq %r12, %rdi
jmp 0x45f9
movq %rax, %rbx
movq -0x78(%rbp), %rdi
cmpq %r14, %rdi
je 0x45f1
movq -0x68(%rbp), %rsi
jmp 0x45e4
jmp 0x45ee
movq %rax, %rbx
movq -0xa0(%rbp), %rdi
cmpq %r14, %rdi
je 0x45f1
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x31c0
jmp 0x45f1
movq %rax, %rbx
movl $0x28, %esi
movq %r15, %rdi
callq 0x31c0
movq %rbx, %rdi
callq 0x32e0