// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/token.c
// Function: get_token_llvm
int get_token_llvm(char *line, char *token)
{
    char *p,*ptk,str;
    char *pp;

    // ポインタの初期化
    p   = line;
    ptk = token;

    // 空白かタブの場合、読み飛ばす
    while(*p == ' ' || *p == '\t') ++p;
    // バッファが空の場合は終了する
    if(*p == '\0'){
		pp = malloc(strlen(p)+1);	// 残りの文字列をlineに戻す
		strcpy(pp,p);
		strcpy(line,pp);
		free(pp);
        token[0] = '\0';
        return 1;
    }

    if(iskanji(p)){                // 漢字の判定
        do{
            *ptk++ = *p++;          // 1バイト目
            if(!iskanji(p)){       // 2バイト目
                //printf("can't decode 2Byte Character(KANJI).\n");
                //exit(1);
            }
            //*ptk++ = *p++;
        }while(iskanji(p) && *p != '\0');
        strcpy(token, "KANJI");     // 漢字を検出した場合はポインタを戻して、NULL文字とする
    }else if(*p == 'c' && *(p+1) == '"'){
		*ptk++ = *p++;
		// c"で始まる(これはキャラクター宣言である)
		do{
			*ptk++ = *p++;
		}while(*p != '"' && *p !='\0');
		*ptk++ = *p++;
    }else if(isalpha(*p)){          // 1文字目は英字、2文字目以降は英数字
        do{
            *ptk++ = *p++;
        }while((isalnum(*p) || *p == '_' || *p == '*' || *p =='.') && *p !='\0');    // 2文字目以降は英数字、又は"_"である
    }else if(*p == '0'){                                    // 数字(0で始まる数字)
        *ptk++ = *p++;
        if(*p == 'x' || *p == 'X'){
            do{
                *ptk++ = *p++;
            }while((isdigit(*p) || *p =='.' ||
                            (*p >= 'a' && *p <= 'f') ||
                            (*p >= 'A' && *p <= 'F')) && *p !='\0');
        }else if(isdigit(*p)){
            do{
                *ptk++ = *p++;
            }while((isdigit(*p) || *p =='.') && *p !='\0');
        }else if(*p == '.'){	// 小数点以下の数値
            do{
                *ptk++ = *p++;
            }while((isdigit(*p) || *p =='.') && *p !='\0');
        }
    }else if(isdigit(*p)){      // 数字(0以外で始まる数字)
        do{
            *ptk++ = *p++;
        }while((isdigit(*p) || *p =='.') && *p !='\0');
    }else if(*p == '-'){      // マイナス値
        do{
            *ptk++ = *p++;
        }while((isdigit(*p) || *p =='.') && *p !='\0');
    }else if(*p == '.'){		// ラベル名
        str = *p;
        do{
            *ptk++ = *p++;
        }while((isalnum(*p) || *p == '_' || *p == '.') && *p !='\0');
    }else if(*p == '@'){
        str = *p;
        do{
            *ptk++ = *p++;
        }while((isalnum(*p) || *p == '_' || *p == '.') && *p !='\0');
    }else if(*p == '%'){
        str = *p;
        do{
            *ptk++ = *p++;
        }while((isalnum(*p) || *p == '_' || *p == '.' || *p == '*') && *p !='\0');
    }else if(*p == '!'){
        str = *p;
        do{
            *ptk++ = *p++;
        }while((isalnum(*p) || *p == '_' || *p == '.') && *p !='\0');
    }else if(*p == '#'){
        str = *p;
        do{
            *ptk++ = *p++;
        }while((isalnum(*p) || *p == '_' || *p == '.') && *p !='\0');
    }else if(*p == '='){    // 等しい: =, ==
        str = *p;
        *ptk++ = *p++;
        if(*p == str){
            *ptk++ = *p++;
        }
    }else if(*p == '>' || *p == ']'){    // ポインタ: >*, ]*
        str = *p;
        *ptk++ = *p++;
        if(*p == '*'){
            *ptk++ = *p++;
        }
    }else if(*p == '.'){    // ...
        str = *p;
        *ptk++ = *p++;
        do{
            *ptk++ = *p++;
        }while((*p == str) && *p !='\0');
    }else if(*p == '\\'){
        do{
            *ptk++ = *p++;
        }while(isalnum(*p) && *p !='\0');    // 2文字目以降は英数字
    }else if((*p == '\r') || (*p == '\n')){    // 改行
        str = '\0';
        *ptk++ = *p++;
    }else{    // その他の文字
		*ptk++ = *p++;
	}
    *ptk = '\0';            // 文字の終端
    pp = malloc(strlen(p)+1);	// 残りの文字列をlineに戻す
    strcpy(pp,p);
    strcpy(line,pp);
    free(pp);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x1(%rdi), %r14
movzbl -0x1(%r14), %eax
cmpl $0x9, %eax
je 0xc4d1
cmpl $0x20, %eax
jne 0xc4d6
incq %r14
jmp 0xc4c2
testl %eax, %eax
jne 0xc51b
decq %r14
movq %r14, %rdi
callq 0x1090
leaq 0x1(%rax), %rdi
callq 0x1130
movq %rax, %r12
movq %rax, %rdi
movq %r14, %rsi
callq 0x1060
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1060
movq %r12, %rdi
callq 0x1030
movb $0x0, (%r15)
pushq $0x1
popq %rax
jmp 0xc5b0
leaq -0x1(%r14), %r12
movq %r12, %rdi
callq 0xbdc0
movb -0x1(%r14), %r13b
testl %eax, %eax
je 0xc5bf
leaq 0x1(%r15), %rax
movq %r14, %rcx
movq %rcx, %r14
movq %rax, %r12
movb %r13b, -0x1(%rax)
movq %rcx, %rdi
callq 0xbdc0
movq %r14, %rdi
callq 0xbdc0
testl %eax, %eax
je 0xc569
movb (%r14), %r13b
leaq 0x1(%r14), %rcx
leaq 0x1(%r12), %rax
testb %r13b, %r13b
jne 0xc53a
movw $0x49, 0x4(%r15)
movl $0x4a4e414b, (%r15)     # imm = 0x4A4E414B
movb $0x0, (%r12)
movq %r14, %rdi
callq 0x1090
leaq 0x1(%rax), %rdi
callq 0x1130
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
callq 0x1060
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1060
movq %r15, %rdi
callq 0x1030
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1(%r14), %rbp
cmpb $0x63, %r13b
jne 0xc602
cmpb $0x22, (%r14)
jne 0xc602
movb $0x63, (%r15)
movb (%r14), %al
addq $0x2, %r15
movq %r15, %r12
movq %rbp, %r14
movb %al, -0x1(%r12)
movzbl (%r14), %eax
incq %r14
incq %r12
cmpl $0x22, %eax
je 0xc5f8
testl %eax, %eax
jne 0xc5e0
movb %al, -0x1(%r12)
jmp 0xc577
movq %rbx, (%rsp)
movsbq %r13b, %rbx
callq 0x11d0
movq (%rax), %rcx
movzwl (%rcx,%rbx,2), %ecx
btl $0xa, %ecx
jb 0xc697
cmpb $0x30, %r13b
movq (%rsp), %rbx
jne 0xc6ed
movb $0x30, (%r15)
movzbl (%r14), %ecx
movl %ecx, %edx
orl $0x20, %edx
cmpl $0x78, %edx
jne 0xc7d9
addq $0x2, %r15
movabsq $0x1f8000000000001, %rdx # imm = 0x1F8000000000001
movq %r15, %r12
movb %cl, -0x1(%r12)
movq (%rax), %rdi
movsbq (%rbp), %rcx
movzbl %cl, %esi
movzwl (%rdi,%rcx,2), %edi
btl $0xb, %edi
jb 0xc687
addl $-0x2e, %esi
cmpl $0x38, %esi
ja 0xc679
btq %rsi, %rdx
jb 0xc68f
leal -0x47(%rcx), %esi
cmpb $-0x6, %sil
jae 0xc68f
jmp 0xc797
testl %esi, %esi
je 0xc797
incq %rbp
incq %r12
jmp 0xc651
incq %r15
movabsq $0x20000000000011, %rcx # imm = 0x20000000000011
movq %r15, %r12
movq (%rsp), %rbx
movb %r13b, -0x1(%r12)
movq (%rax), %rsi
movsbq (%r14), %r13
movzbl %r13b, %edx
movzwl (%rsi,%r13,2), %esi
testb $0x8, %sil
jne 0xc6dd
addl $-0x2a, %edx
cmpl $0x35, %edx
ja 0xc577
btq %rdx, %rcx
jb 0xc6e5
jmp 0xc577
testl %edx, %edx
je 0xc577
incq %r14
incq %r12
jmp 0xc6ab
btl $0xb, %ecx
jb 0xc79f
movzbl %r13b, %ecx
cmpl $0xa, %ecx
je 0xc865
cmpl $0xd, %ecx
je 0xc865
cmpl $0x21, %ecx
je 0xc9f3
cmpl $0x23, %ecx
je 0xc97a
cmpl $0x25, %ecx
je 0xc887
cmpl $0x2d, %ecx
je 0xc9b9
cmpl $0x2e, %ecx
je 0xc8d9
cmpl $0x3d, %ecx
je 0xc957
cmpl $0x3e, %ecx
je 0xc86d
cmpl $0x40, %ecx
je 0xc918
cmpl $0x5d, %ecx
je 0xc86d
cmpl $0x5c, %ecx
jne 0xc865
movq %r12, %r14
movq %r15, %r12
movb %r13b, (%r12)
incq %r12
movsbq 0x1(%r14), %r13
incq %r14
testq %r13, %r13
je 0xc577
movq (%rax), %rcx
movzwl (%rcx,%r13,2), %ecx
andl $0x8, %ecx
jne 0xc76d
jmp 0xc577
movq %rbp, %r14
jmp 0xc577
movq %r12, %r14
movq %r15, %r12
movb %r13b, (%r12)
incq %r12
movq (%rax), %rdx
movsbq 0x1(%r14), %r13
incq %r14
cmpq $0x2e, %r13
setne %cl
testb $0x8, 0x1(%rdx,%r13,2)
sete %dl
testq %r13, %r13
je 0xc577
andb %dl, %cl
je 0xc7a5
jmp 0xc577
incq %r15
movsbq %cl, %rdx
movq (%rax), %rsi
testb $0x8, 0x1(%rsi,%rdx,2)
jne 0xc82d
cmpb $0x2e, %cl
jne 0xc972
movb $0x2e, %cl
movq %r15, %r12
movb %cl, (%r12)
incq %r12
movq (%rax), %rsi
movsbq 0x1(%r14), %rcx
incq %r14
cmpq $0x2e, %rcx
setne %dl
testb $0x8, 0x1(%rsi,%rcx,2)
sete %sil
testq %rcx, %rcx
je 0xc577
andb %sil, %dl
je 0xc7f8
jmp 0xc577
movq %r15, %r12
movb %cl, (%r12)
incq %r12
movq (%rax), %rsi
movsbq 0x1(%r14), %rcx
incq %r14
cmpq $0x2e, %rcx
setne %dl
testb $0x8, 0x1(%rsi,%rcx,2)
sete %sil
testq %rcx, %rcx
je 0xc577
andb %sil, %dl
je 0xc830
jmp 0xc577
movb %r13b, (%r15)
jmp 0xc96f
movb %r13b, (%r15)
cmpb $0x2a, (%r14)
jne 0xc96f
incq %r14
movb $0x2a, 0x1(%r15)
jmp 0xc969
incq %r15
movabsq $0x20000000000011, %rcx # imm = 0x20000000000011
movq %r15, %r12
movb %r13b, -0x1(%r12)
movq (%rax), %rsi
movsbq (%r14), %r13
movzbl %r13b, %edx
movzwl (%rsi,%r13,2), %esi
testb $0x8, %sil
jne 0xc8c9
addl $-0x2a, %edx
cmpl $0x35, %edx
ja 0xc577
btq %rdx, %rcx
jb 0xc8d1
jmp 0xc577
testl %edx, %edx
je 0xc577
incq %r14
incq %r12
jmp 0xc897
incq %r15
movq %r15, %r12
movb %r13b, -0x1(%r12)
movq (%rax), %rdx
movsbq (%r14), %r13
movzbl %r13b, %ecx
movzwl (%rdx,%r13,2), %edx
testb $0x8, %dl
jne 0xc908
cmpl $0x2e, %ecx
je 0xc910
cmpl $0x5f, %ecx
je 0xc910
jmp 0xc577
testl %ecx, %ecx
je 0xc577
incq %r14
incq %r12
jmp 0xc8df
incq %r15
movq %r15, %r12
movb %r13b, -0x1(%r12)
movq (%rax), %rdx
movsbq (%r14), %r13
movzbl %r13b, %ecx
movzwl (%rdx,%r13,2), %edx
testb $0x8, %dl
jne 0xc947
cmpl $0x2e, %ecx
je 0xc94f
cmpl $0x5f, %ecx
je 0xc94f
jmp 0xc577
testl %ecx, %ecx
je 0xc577
incq %r14
incq %r12
jmp 0xc91e
movb $0x3d, (%r15)
cmpb $0x3d, (%r14)
jne 0xc96f
incq %r14
movb $0x3d, 0x1(%r15)
addq $0x2, %r15
jmp 0xc972
incq %r15
movq %r15, %r12
jmp 0xc577
incq %r15
movq %r15, %r12
movb %r13b, -0x1(%r12)
movq (%rax), %rdx
movsbq (%r14), %r13
movzbl %r13b, %ecx
movzwl (%rdx,%r13,2), %edx
testb $0x8, %dl
jne 0xc9a9
cmpl $0x2e, %ecx
je 0xc9b1
cmpl $0x5f, %ecx
je 0xc9b1
jmp 0xc577
testl %ecx, %ecx
je 0xc577
incq %r14
incq %r12
jmp 0xc980
movq %r12, %r14
movq %r15, %r12
movb %r13b, (%r12)
incq %r12
movq (%rax), %rdx
movsbq 0x1(%r14), %r13
incq %r14
cmpq $0x2e, %r13
setne %cl
testb $0x8, 0x1(%rdx,%r13,2)
sete %dl
testq %r13, %r13
je 0xc577
andb %dl, %cl
je 0xc9bf
jmp 0xc577
incq %r15
movq %r15, %r12
movb %r13b, -0x1(%r12)
movq (%rax), %rdx
movsbq (%r14), %r13
movzbl %r13b, %ecx
movzwl (%rdx,%r13,2), %edx
testb $0x8, %dl
jne 0xca22
cmpl $0x2e, %ecx
je 0xca2a
cmpl $0x5f, %ecx
je 0xca2a
jmp 0xc577
testl %ecx, %ecx
je 0xc577
incq %r14
incq %r12
jmp 0xc9f9