// File: /workspace/github_cpp_makefile_star2_O2/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, %r14
movq %rdi, %rbx
pushq $0x28
popq %rdi
callq 0x3200
movq %rax, %r15
leaq 0x8351(%rip), %rsi      # 0xc279
leaq -0xa8(%rbp), %rdi
leaq -0x38(%rbp), %rdx
callq 0x3100
leaq -0xa8(%rbp), %rsi
movq %r15, %rdi
callq 0x74d4
leaq -0xa8(%rbp), %rdi
callq 0x3140
movq %r15, -0x48(%rbp)
pushq $0x28
popq %rdi
callq 0x3200
movq %rax, %r15
leaq 0x8316(%rip), %rsi      # 0xc27f
leaq -0x88(%rbp), %rdi
leaq -0x40(%rbp), %rdx
callq 0x3100
leaq -0x88(%rbp), %rsi
movq %r15, %rdi
callq 0x749c
leaq -0x88(%rbp), %rdi
callq 0x3140
movq %r15, -0x38(%rbp)
pushq $0x28
popq %rdi
callq 0x3200
movq %rax, %r15
leaq 0x82d9(%rip), %rsi      # 0xc283
leaq -0x68(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x3100
leaq -0x68(%rbp), %rsi
movq %r15, %rdi
callq 0x749c
leaq -0x68(%rbp), %rdi
callq 0x3140
leaq -0x40(%rbp), %r12
movq %r15, (%r12)
pushq $0x20
popq %rdi
callq 0x3200
movq %rax, %r15
movl $0x1, (%rax)
leaq 0x8(%rax), %r13
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
andq $0x0, 0x18(%rax)
leaq -0x48(%rbp), %rsi
movq %r13, %rdi
callq 0x74b0
leaq -0x38(%rbp), %rsi
movq %r13, %rdi
callq 0x74b0
movq %r13, %rdi
movq %r12, %rsi
callq 0x74b0
movq %r15, (%rbx)
andq $0x0, 0x10(%rbx)
movq %r14, 0x8(%rbx)
leaq 0x200d(%rip), %rax      # 0x6038
movq %rax, 0x20(%rbx)
leaq 0x21a0(%rip), %rax      # 0x61d6
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
leaq -0x68(%rbp), %rdi
jmp 0x4072
jmp 0x4079
movq %rax, %rbx
leaq -0x88(%rbp), %rdi
jmp 0x4072
jmp 0x4079
movq %rax, %rbx
leaq -0xa8(%rbp), %rdi
callq 0x3140
jmp 0x407c
movq %rax, %rbx
pushq $0x28
popq %rsi
movq %r15, %rdi
callq 0x3210
movq %rbx, %rdi
callq 0x3320
nop