// File: /workspace/github_cpp_makefile_star2_O1/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 $0x98, %rsp
movq %rdx, %r14
movq %rdi, %rbx
leaq 0x40(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0xcaf5(%rip), %rdx      # 0x10256
leaq 0x30(%rsp), %rdi
movq %rdx, %rsi
callq 0x299a
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq %rbx, 0x28(%rsp)
movq $0x0, 0x10(%rbx)
leaq 0xcac3(%rip), %rsi      # 0x1024b
movq %r14, %rdi
callq 0x2330
cmpq $0x0, 0x8(%r14)
je 0x3bd0
leaq 0x18(%rsp), %r12
leaq 0x60(%rsp), %r15
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
xorl %ebx, %ebx
movq %r14, 0x70(%rsp)
movq (%r14), %rax
movsbl (%rax,%rbx), %ebp
movl %ebp, %esi
callq 0x3e52
cmpl %r13d, %eax
jne 0x37db
leaq 0x30(%rsp), %rdi
movl %ebp, %esi
callq 0x2170
movq 0x70(%rsp), %rbp
jmp 0x3a8f
movl %eax, %r14d
cmpq $0x0, 0x38(%rsp)
je 0x3a68
cmpl $0x2, %r13d
je 0x3a68
cmpl $0x1, %r13d
jne 0x394b
cmpq $0x0, 0x38(%rsp)
je 0x3a68
xorl %ebp, %ebp
movq 0x30(%rsp), %r13
leaq 0x88(%rsp), %rax
movq %rax, 0x78(%rsp)
movq $0x0, 0x80(%rsp)
movb $0x0, 0x88(%rsp)
movsbl (%r13,%rbp), %r8d
movl $0x1, %ecx
leaq 0x78(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2320
movq %r15, 0x50(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x386e
movq %rdx, 0x50(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x60(%rsp)
jmp 0x3875
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, 0x58(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movb (%r13,%rbp), %al
movb %al, (%rsp)
movq %r12, 0x8(%rsp)
movq 0x50(%rsp), %rax
cmpq %r15, %rax
je 0x38b5
movq %rax, 0x8(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x18(%rsp)
jmp 0x38be
movups (%r15), %xmm0
movups %xmm0, (%r12)
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movq %r15, 0x50(%rsp)
movq $0x0, 0x58(%rsp)
movb $0x0, 0x60(%rsp)
movq 0x28(%rsp), %rdi
movq %rsp, %rsi
callq 0x3f76
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x38ff
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21b0
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0x3916
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21b0
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x3938
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x21b0
incq %rbp
cmpq %rbp, 0x38(%rsp)
ja 0x380c
jmp 0x3a68
leaq 0x30(%rsp), %r13
movq %r13, %rdi
leaq 0xc722(%rip), %rsi      # 0x1007c
callq 0x2090
testl %eax, %eax
je 0x3a24
movq %r13, %rdi
leaq 0xc70f(%rip), %rsi      # 0x10080
callq 0x2090
testl %eax, %eax
je 0x3a24
movq %r13, %rdi
leaq 0xc6ff(%rip), %rsi      # 0x10087
callq 0x2090
testl %eax, %eax
je 0x3aa4
movq %r13, %rdi
leaq 0xc6eb(%rip), %rsi      # 0x1008a
callq 0x2090
testl %eax, %eax
je 0x3ad6
movq %r13, %rdi
leaq 0xc6d9(%rip), %rsi      # 0x1008f
callq 0x2090
testl %eax, %eax
je 0x3b08
movq %r13, %rdi
leaq 0xc6c8(%rip), %rsi      # 0x10095
callq 0x2090
testl %eax, %eax
je 0x3b3a
movq 0x30(%rsp), %rsi
movb (%rsi), %al
addb $-0x30, %al
cmpb $0x9, %al
ja 0x3b6c
movq 0x38(%rsp), %rdx
testq %rdx, %rdx
je 0x3b99
xorl %ecx, %ecx
xorl %eax, %eax
movb (%rsi,%rcx), %dil
leal -0x30(%rdi), %r8d
cmpb $0xa, %r8b
jb 0x3a17
cmpb $0x2e, %dil
jne 0x3c03
incl %eax
incq %rcx
cmpq %rcx, %rdx
jne 0x39fd
jmp 0x3b9b
movb $0x54, (%rsp)
movq %r12, 0x8(%rsp)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x2854
movq 0x28(%rsp), %rdi
movq %rsp, %rsi
callq 0x3f76
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x3a68
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21b0
movq 0x70(%rsp), %rbp
movq (%rbp), %rax
movsbl (%rax,%rbx), %r8d
movq 0x38(%rsp), %rdx
movl $0x1, %ecx
leaq 0x30(%rsp), %rdi
xorl %esi, %esi
callq 0x2320
movl %r14d, %r13d
incq %rbx
cmpq %rbx, 0x8(%rbp)
movq %rbp, %r14
ja 0x37b2
jmp 0x3bd0
movb $0x57, (%rsp)
movq %r12, 0x8(%rsp)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x2854
movq 0x28(%rsp), %rdi
movq %rsp, %rsi
callq 0x3f76
jmp 0x3a51
movb $0x55, (%rsp)
movq %r12, 0x8(%rsp)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x2854
movq 0x28(%rsp), %rdi
movq %rsp, %rsi
callq 0x3f76
jmp 0x3a51
movb $0x4c, (%rsp)
movq %r12, 0x8(%rsp)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x2854
movq 0x28(%rsp), %rdi
movq %rsp, %rsi
callq 0x3f76
jmp 0x3a51
movb $0x47, (%rsp)
movq %r12, 0x8(%rsp)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x2854
movq 0x28(%rsp), %rdi
movq %rsp, %rsi
callq 0x3f76
jmp 0x3a51
movb $0x4e, (%rsp)
movq %r12, 0x8(%rsp)
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x2854
movq 0x28(%rsp), %rdi
movq %rsp, %rsi
callq 0x3f76
jmp 0x3a51
xorl %eax, %eax
cmpl $0x1, %eax
jg 0x3ca6
sete %al
addb $0x49, %al
movb %al, (%rsp)
movq %r12, 0x8(%rsp)
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x2854
movq 0x28(%rsp), %rdi
movq %rsp, %rsi
callq 0x3f76
jmp 0x3a51
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x3bec
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x21b0
movq 0x28(%rsp), %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x28, %edi
callq 0x20e0
movq %rax, %r12
leaq 0xc485(%rip), %rsi      # 0x1009c
leaq 0x50(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x3e92
leaq 0xc543(%rip), %rsi      # 0x10170
leaq 0x50(%rsp), %rdi
callq 0x2330
leaq 0x10(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x3c59
movups (%rcx), %xmm0
movups %xmm0, (%r13)
jmp 0x3c65
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
movq 0x8(%rax), %rdx
movq %rsp, %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movb $0x1, %bl
movq %r12, %rdi
callq 0x27bc
xorl %ebx, %ebx
leaq 0x12116(%rip), %rsi     # 0x15da8
leaq -0x1493(%rip), %rdx     # 0x2806
movq %r12, %rdi
callq 0x22e0
jmp 0x3d44
movl $0x28, %edi
callq 0x20e0
movq %rax, %r12
leaq 0xc3e2(%rip), %rsi      # 0x1009c
leaq 0x50(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x3e92
leaq 0xc4a0(%rip), %rsi      # 0x10170
leaq 0x50(%rsp), %rdi
callq 0x2330
leaq 0x10(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x3cfc
movups (%rcx), %xmm0
movups %xmm0, (%r13)
jmp 0x3d08
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
movq 0x8(%rax), %rdx
movq %rsp, %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movb $0x1, %bl
movq %r12, %rdi
callq 0x27bc
xorl %ebx, %ebx
leaq 0x12073(%rip), %rsi     # 0x15da8
leaq -0x1536(%rip), %rdx     # 0x2806
movq %r12, %rdi
callq 0x22e0
jmp 0x3d5a
jmp 0x3d75
jmp 0x3d9b
jmp 0x3db0
jmp 0x3dc6
jmp 0x3db0
jmp 0x3dc6
jmp 0x3db0
jmp 0x3dc6
jmp 0x3db0
jmp 0x3dc6
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x3d7a
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21b0
jmp 0x3d7a
movq %rax, %r14
movb $0x1, %bl
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0x3da0
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21b0
jmp 0x3da0
jmp 0x3db0
jmp 0x3dc6
jmp 0x3db0
jmp 0x3dc6
movq %rax, %r14
movb $0x1, %bl
testb %bl, %bl
je 0x3e23
movq %r12, %rdi
callq 0x2140
jmp 0x3e23
jmp 0x3dc6
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x3e23
movq 0x18(%rsp), %rsi
jmp 0x3e1b
jmp 0x3dc6
movq %rax, %r14
jmp 0x3e23
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x3de5
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21b0
movq 0x50(%rsp), %rdi
cmpq %r15, %rdi
je 0x3e01
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21b0
jmp 0x3e01
movq %rax, %r14
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x3e23
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x21b0
movq 0x28(%rsp), %rdi
callq 0x3f1a
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x3e49
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x21b0
movq %r14, %rdi
callq 0x22f0
nop