// File: /workspace/github_cpp_makefile_star2_O2/davidsun[P]TinyCompiler/LexicalAnalytics.cpp
// Function: LexicalAnalytics::parse(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>) const
vector <pair <char, string> > LexicalAnalytics::parse(string input) const{
    int last_type = -1;
    string last_token = "";
    vector <pair <char, string> > ret;
    input += " ";
    for (int i = 0; i < input.size(); i ++){
        int cur_type = getType_p(input[i]);
        if (cur_type != last_type){
            if (last_token.length() > 0 && last_type != TYPE_BLANK){
                if (last_type == TYPE_TOKEN){
                    for (int j = 0; j < last_token.length(); j ++){
                        ret.push_back(make_pair(last_token[j], string() + last_token[j]));
                    }
                }  else if (last_token == "int" || last_token == "double"){
                    ret.push_back(make_pair('T', last_token));
                }  else if (last_token == "if"){
                    ret.push_back(make_pair('W', last_token));
                }  else if (last_token == "else"){
                    ret.push_back(make_pair('U', last_token));
                }  else if (last_token == "while"){
                    ret.push_back(make_pair('L', last_token));
                }  else if (last_token == "return"){
                    ret.push_back(make_pair('G', last_token));
                }  else if (last_token[0] <= '9' && last_token[0] >= '0'){
                    int point_count = 0;
                    for (int j = 0; j < last_token.length(); j ++){
                        if (last_token[j] <= '9' && last_token[j] >= '0'){
                        }  else if (last_token[j] == '.'){
                            point_count ++;
                        }  else {
                            throw Exception("Lexical analytics: error on token " + last_token + ".");
                        }
                    }
                    if (point_count > 1){
                        throw Exception("Lexical analytics: error on token " + last_token + ".");
                    }
                    ret.push_back(make_pair((point_count > 0) ? 'J' : 'I', last_token));
                }  else {
                    ret.push_back(make_pair('N', last_token));
                }
            }
            last_token = input[i];
            last_type = cur_type; 
        }  else {
            last_token += input[i];
        }
    }
    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdx, %r14
movq %rdi, %rbx
leaq 0xa08e(%rip), %rsi      # 0xd256
leaq 0x40(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x25ae
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq %rbx, 0x8(%rsp)
andq $0x0, 0x10(%rbx)
leaq 0xa05d(%rip), %rsi      # 0xd24b
movq %r14, 0x60(%rsp)
movq %r14, %rdi
callq 0x2360
pushq $-0x1
popq %rbp
xorl %r14d, %r14d
leaq 0x68(%rsp), %r12
leaq 0x88(%rsp), %r13
leaq 0x10(%rsp), %r15
movq 0x60(%rsp), %rax
cmpq %r14, 0x8(%rax)
jbe 0x34d9
movq (%rax), %rax
movsbl (%rax,%r14), %ebx
movl %ebx, %esi
callq 0x3666
cmpl %ebp, %eax
jne 0x3246
leaq 0x40(%rsp), %rdi
movl %ebx, %esi
callq 0x2190
jmp 0x34d1
movl %eax, 0x3c(%rsp)
movq 0x48(%rsp), %rax
testq %rax, %rax
je 0x34b6
cmpl $0x2, %ebp
je 0x34b6
cmpl $0x1, %ebp
jne 0x32ec
xorl %ebp, %ebp
cmpq %rbp, %rax
jbe 0x34b6
leaq 0x98(%rsp), %rax
movq %rax, 0x88(%rsp)
andq $0x0, 0x90(%rsp)
movq 0x40(%rsp), %rbx
movb $0x0, 0x98(%rsp)
movsbl (%rbx,%rbp), %edx
movq %r12, %rdi
movq %r13, %rsi
callq 0x36a2
addq %rbp, %rbx
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x3788
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x37fa
leaq 0x18(%rsp), %rdi
callq 0x20f0
movq %r12, %rdi
callq 0x20f0
movq %r13, %rdi
callq 0x20f0
incq %rbp
movq 0x48(%rsp), %rax
jmp 0x326c
leaq 0x40(%rsp), %rbp
movq %rbp, %rdi
leaq 0x9d81(%rip), %rsi      # 0xd07c
callq 0x36c4
testb %al, %al
jne 0x3317
movq %rbp, %rdi
leaq 0x9d72(%rip), %rsi      # 0xd080
callq 0x36c4
testb %al, %al
je 0x3341
movb $0x54, 0x10(%rsp)
leaq 0x18(%rsp), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x2260
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x37fa
movq %rbx, %rdi
jmp 0x34b1
movq %rbp, %rdi
leaq 0x9d3c(%rip), %rsi      # 0xd087
callq 0x36c4
testb %al, %al
je 0x3378
movb $0x57, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
movq %rbp, %rsi
callq 0x2260
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x37fa
jmp 0x34ac
movq %rbp, %rdi
leaq 0x9d08(%rip), %rsi      # 0xd08a
callq 0x36c4
testb %al, %al
je 0x33af
movb $0x55, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
movq %rbp, %rsi
callq 0x2260
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x37fa
jmp 0x34ac
movq %rbp, %rdi
leaq 0x9cd6(%rip), %rsi      # 0xd08f
callq 0x36c4
testb %al, %al
je 0x33e6
movb $0x4c, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
movq %rbp, %rsi
callq 0x2260
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x37fa
jmp 0x34ac
movq %rbp, %rdi
leaq 0x9ca5(%rip), %rsi      # 0xd095
callq 0x36c4
testb %al, %al
je 0x341d
movb $0x47, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
movq %rbp, %rsi
callq 0x2260
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x37fa
jmp 0x34ac
movq 0x40(%rsp), %rax
movb (%rax), %cl
addb $-0x30, %cl
cmpb $0x9, %cl
ja 0x345f
xorl %ecx, %ecx
movq 0x48(%rsp), %rdx
xorl %esi, %esi
cmpq %rcx, %rdx
je 0x3480
movb (%rax,%rcx), %dil
cmpb $0x39, %dil
jg 0x34fa
cmpb $0x2f, %dil
jg 0x345a
cmpb $0x2e, %dil
jne 0x34fa
incl %esi
incq %rcx
jmp 0x3435
movb $0x4e, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
movq %rbp, %rsi
callq 0x2260
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x37fa
jmp 0x34ac
cmpl $0x1, %esi
jg 0x355a
sete %al
addb $0x49, %al
movb %al, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
movq %rbp, %rsi
callq 0x2260
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x37fa
leaq 0x18(%rsp), %rdi
callq 0x20f0
movq 0x60(%rsp), %rax
movq (%rax), %rax
movsbl (%rax,%r14), %esi
leaq 0x40(%rsp), %rdi
callq 0x2310
movl 0x3c(%rsp), %ebp
incq %r14
jmp 0x3213
leaq 0x40(%rsp), %rdi
callq 0x20f0
movq 0x8(%rsp), %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x28
popq %rdi
callq 0x2100
movq %rax, %r15
leaq 0x9b90(%rip), %rsi      # 0xd09c
leaq 0x68(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x36f0
leaq 0x9c4e(%rip), %rdx      # 0xd170
leaq 0x10(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x36d1
movb $0x1, %bl
leaq 0x10(%rsp), %rsi
movq %r15, %rdi
callq 0x249c
xorl %ebx, %ebx
leaq 0x1085f(%rip), %rsi     # 0x13da8
leaq -0x107e(%rip), %rdx     # 0x24d2
movq %r15, %rdi
callq 0x2320
jmp 0x35b8
pushq $0x28
popq %rdi
callq 0x2100
movq %rax, %r15
leaq 0x9b30(%rip), %rsi      # 0xd09c
leaq 0x68(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x36f0
leaq 0x9bee(%rip), %rdx      # 0xd170
leaq 0x10(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x36d1
movb $0x1, %bl
leaq 0x10(%rsp), %rsi
movq %r15, %rdi
callq 0x249c
xorl %ebx, %ebx
leaq 0x107ff(%rip), %rsi     # 0x13da8
leaq -0x10de(%rip), %rdx     # 0x24d2
movq %r15, %rdi
callq 0x2320
jmp 0x35d2
jmp 0x35e1
jmp 0x3602
jmp 0x35f6
jmp 0x361b
jmp 0x361b
jmp 0x35f6
jmp 0x361b
jmp 0x35f6
jmp 0x35f6
jmp 0x361b
jmp 0x35f6
jmp 0x361b
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x20f0
jmp 0x35e6
movq %rax, %r14
movb $0x1, %bl
leaq 0x68(%rsp), %rdi
callq 0x20f0
testb %bl, %bl
jne 0x3605
jmp 0x3649
movq %rax, %r14
leaq 0x18(%rsp), %rdi
jmp 0x3644
jmp 0x361b
movq %rax, %r14
movq %r15, %rdi
callq 0x2160
jmp 0x3649
jmp 0x361b
movq %rax, %r14
movq %rbx, %rdi
jmp 0x3644
jmp 0x361b
movq %rax, %r14
jmp 0x3649
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0x20f0
leaq 0x68(%rsp), %rdi
callq 0x20f0
jmp 0x363c
movq %rax, %r14
leaq 0x88(%rsp), %rdi
callq 0x20f0
movq 0x8(%rsp), %rdi
callq 0x3766
leaq 0x40(%rsp), %rdi
callq 0x20f0
movq %r14, %rdi
callq 0x2330
nop