// File: /workspace/github_cpp_makefile_star2_O1/jaldhar[P]Lets-Build-a-Simple-Interpreter/calc6.cc
// Function: Lexer::get_next_token()
Token Lexer::get_next_token() {

    while (_current_char != '\0') {

        if (isspace(_current_char)) {
            skip_whitespace();
            continue;
        }

        if (isdigit(_current_char)) {
            Token token(TOKENTYPE::INTEGER, integer());
            cerr << token << endl;
            return token;
        }

        if (_current_char == '*') {
            advance();
            Token token(TOKENTYPE::MUL, '*');
            cerr << token << endl;
            return token;
        }

        if (_current_char == '/') {
            advance();
            Token token(TOKENTYPE::DIV, '/');
            cerr << token << endl;
            return token;
        }

        if (_current_char == '+') {
            advance();
            Token token(TOKENTYPE::PLUS, '+');
            cerr << token << endl;
            return token;
        }

        if (_current_char == '-') {
            advance();
            Token token(TOKENTYPE::MINUS, '-');
            cerr << token << endl;
            return token;
        }

        if (_current_char == '(') {
            advance();
            Token token(TOKENTYPE::LPAREN, '(');
            cerr << token << endl;
            return token;
        }

        if (_current_char == ')') {
            advance();
            Token token(TOKENTYPE::RPAREN, ')');
            cerr << token << endl;
            return token;
        }

        ostringstream out;
        out << "Error parsing input. Got: " << _current_char;
        throw(out.str().c_str());
    }

    Token token(TOKENTYPE::ENDOFFILE, '\0');
    cerr << token << endl;
    return token;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x1b0, %rsp            # imm = 0x1B0
movb 0x10(%rdi), %r14b
testb %r14b, %r14b
je 0x24a1
movq %rdi, %rbx
movsbl %r14b, %ebp
movl %ebp, %edi
callq 0x2050
testl %eax, %eax
je 0x24ff
movq %rbx, %rdi
callq 0x2786
movb 0x10(%rbx), %r14b
testb %r14b, %r14b
jne 0x2481
movl $0x0, 0x8(%rsp)
xorl %eax, %eax
leaq 0x8(%rsp), %rbx
movq %rax, 0x8(%rbx)
movq 0x2b35(%rip), %r14      # 0x4ff0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x23f0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20c0
movl (%rbx), %eax
movq 0x8(%rbx), %rdx
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbx
popq %r14
popq %rbp
retq
addl $-0x30, %ebp
cmpl $0x9, %ebp
ja 0x2519
movq %rbx, %rdi
callq 0x27d6
movl $0x1, 0x8(%rsp)
jmp 0x24ab
movzbl %r14b, %eax
addl $-0x28, %eax
cmpl $0x7, %eax
ja 0x26b9
leaq 0xad8(%rip), %rcx       # 0x3008
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq (%rbx), %rcx
movq 0x8(%rbx), %rax
incq %rax
movq %rax, 0x8(%rbx)
movq 0x8(%rcx), %rdx
decq %rdx
cmpq %rdx, %rax
jbe 0x264d
xorl %eax, %eax
jmp 0x2653
movq (%rbx), %rcx
movq 0x8(%rbx), %rax
incq %rax
movq %rax, 0x8(%rbx)
movq 0x8(%rcx), %rdx
decq %rdx
cmpq %rdx, %rax
jbe 0x2617
xorl %eax, %eax
jmp 0x261d
movq (%rbx), %rcx
movq 0x8(%rbx), %rax
incq %rax
movq %rax, 0x8(%rbx)
movq 0x8(%rcx), %rdx
decq %rdx
cmpq %rdx, %rax
jbe 0x2632
xorl %eax, %eax
jmp 0x2638
movq (%rbx), %rcx
movq 0x8(%rbx), %rax
incq %rax
movq %rax, 0x8(%rbx)
movq 0x8(%rcx), %rdx
decq %rdx
cmpq %rdx, %rax
jbe 0x2668
xorl %eax, %eax
jmp 0x266e
movq (%rbx), %rcx
movq 0x8(%rbx), %rax
incq %rax
movq %rax, 0x8(%rbx)
movq 0x8(%rcx), %rdx
decq %rdx
cmpq %rdx, %rax
jbe 0x2683
xorl %eax, %eax
jmp 0x2689
movq (%rbx), %rcx
movq 0x8(%rbx), %rax
incq %rax
movq %rax, 0x8(%rbx)
movq 0x8(%rcx), %rdx
decq %rdx
cmpq %rdx, %rax
jbe 0x269e
xorl %eax, %eax
jmp 0x26a4
movq (%rcx), %rcx
movb (%rcx,%rax), %al
movb %al, 0x10(%rbx)
movl $0x3, 0x8(%rsp)
movl $0x2d, %eax
jmp 0x24ab
movq (%rcx), %rcx
movb (%rcx,%rax), %al
movb %al, 0x10(%rbx)
movl $0x7, 0x8(%rsp)
movl $0x29, %eax
jmp 0x24ab
movq (%rcx), %rcx
movb (%rcx,%rax), %al
movb %al, 0x10(%rbx)
movl $0x6, 0x8(%rsp)
movl $0x28, %eax
jmp 0x24ab
movq (%rcx), %rcx
movb (%rcx,%rax), %al
movb %al, 0x10(%rbx)
movl $0x5, 0x8(%rsp)
movl $0x2f, %eax
jmp 0x24ab
movq (%rcx), %rcx
movb (%rcx,%rax), %al
movb %al, 0x10(%rbx)
movl $0x4, 0x8(%rsp)
movl $0x2a, %eax
jmp 0x24ab
movq (%rcx), %rcx
movb (%rcx,%rax), %al
movb %al, 0x10(%rbx)
movl $0x2, 0x8(%rsp)
movl $0x2b, %eax
jmp 0x24ab
leaq 0x38(%rsp), %r14
movq %r14, %rdi
callq 0x2170
leaq 0x9f9(%rip), %rsi       # 0x30c6
movl $0x1a, %edx
movq %r14, %rdi
callq 0x2160
movb 0x10(%rbx), %al
leaq 0x18(%rsp), %rsi
movb %al, (%rsi)
leaq 0x38(%rsp), %rdi
movl $0x1, %edx
callq 0x2160
movl $0x8, %edi
callq 0x2090
movq %rax, %rbx
leaq 0x40(%rsp), %rsi
leaq 0x18(%rsp), %rdi
callq 0x21c0
movq 0x18(%rsp), %rax
movq %rax, (%rbx)
movq 0x2892(%rip), %rsi      # 0x4fb0
movq %rbx, %rdi
xorl %edx, %edx
callq 0x21e0
movq %rax, %r14
leaq 0x28(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2746
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x2150
xorl %eax, %eax
jmp 0x274f
movq %rax, %r14
movb $0x1, %al
testb %al, %al
je 0x2760
movq %rbx, %rdi
callq 0x20e0
jmp 0x2760
movq %rax, %r14
movq 0x2859(%rip), %rsi      # 0x4fc0
leaq 0x38(%rsp), %rdi
callq 0x20a0
leaq 0xa8(%rsp), %rdi
callq 0x2060
movq %r14, %rdi
callq 0x21f0