// File: /workspace/github_c_makefile_star2_O3/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, %r13
leaq 0x1(%rdi), %r14
movsbq -0x1(%r14), %r12
cmpq $0x9, %r12
je 0xcad0
movzbl %r12b, %ebp
cmpl $0x20, %ebp
jne 0xcad5
incq %r14
jmp 0xcabc
testl %ebp, %ebp
jne 0xcb1c
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 %r13, %rdi
movq %r12, %rsi
callq 0x1060
movq %r12, %rdi
callq 0x1030
movb $0x0, (%r15)
movl $0x1, %eax
jmp 0xcbb7
leal 0x1(%r12), %eax
cmpb $-0x5f, %al
ja 0xcb3b
leaq -0x1(%r14), %rbx
leal 0x7f(%r12), %ecx
cmpb $0x1e, %cl
ja 0xcbc6
movb %al, (%rbx)
jmp 0xcb3e
movl %r12d, %eax
leaq 0x1(%r15), %rcx
movb %al, -0x1(%rcx)
movb (%r14), %dl
leal 0x7f(%rdx), %eax
cmpb $0x1e, %al
ja 0xcb54
incb %dl
movb %dl, (%r14)
leal 0x1(%rdx), %eax
cmpb $-0x5e, %al
jae 0xcb68
addb $0x7f, %dl
cmpb $0x1e, %dl
ja 0xcb72
movb %al, (%r14)
jmp 0xcb6a
movl %edx, %eax
incq %r14
incq %rcx
jmp 0xcb42
movw $0x49, 0x4(%r15)
movl $0x4a4e414b, (%r15)     # imm = 0x4A4E414B
movb $0x0, (%rcx)
movq %r14, %rdi
callq 0x1090
leaq 0x1(%rax), %rdi
callq 0x1130
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
callq 0x1060
movq %r13, %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
movq %r13, (%rsp)
leaq 0x1(%r14), %r13
cmpb $0x63, %r12b
jne 0xcc09
cmpb $0x22, (%r14)
jne 0xcc09
movb $0x63, (%r15)
movb (%r14), %al
addq $0x2, %r15
movq %r15, %rcx
movq %r13, %r14
movb %al, -0x1(%rcx)
movzbl (%r14), %eax
incq %r14
incq %rcx
cmpl $0x22, %eax
je 0xcc01
testl %eax, %eax
jne 0xcbeb
movb %al, -0x1(%rcx)
jmp 0xcd54
callq 0x11d0
movq (%rax), %rcx
movzwl (%rcx,%r12,2), %ecx
btl $0xa, %ecx
jb 0xcc86
cmpb $0x30, %r12b
jne 0xccdb
movb $0x30, (%r15)
movzbl (%r14), %edx
movl %edx, %ecx
orl $0x20, %ecx
cmpl $0x78, %ecx
jne 0xcd9c
addq $0x2, %r15
movq %r15, %rcx
movb %dl, -0x1(%rcx)
movq (%rax), %rdi
movsbq (%r13), %rdx
movzbl %dl, %esi
movzwl (%rdi,%rdx,2), %edi
btl $0xb, %edi
jb 0xcc76
leal -0x61(%rsi), %edi
cmpl $0x6, %edi
jb 0xcc7e
cmpl $0x2e, %esi
je 0xcc7e
leal -0x47(%rdx), %esi
cmpb $-0x6, %sil
jae 0xcc7e
jmp 0xcd51
testl %esi, %esi
je 0xcd51
incq %r13
incq %rcx
jmp 0xcc43
incq %r15
movabsq $0x20000000000011, %rdx # imm = 0x20000000000011
movq %r15, %rcx
movq (%rsp), %r13
movb %r12b, -0x1(%rcx)
movq (%rax), %rdi
movsbq (%r14), %r12
movzbl %r12b, %esi
movzwl (%rdi,%r12,2), %edi
testb $0x8, %dil
jne 0xcccb
addl $-0x2a, %esi
cmpl $0x35, %esi
ja 0xcb80
btq %rsi, %rdx
jb 0xccd3
jmp 0xcb80
testl %esi, %esi
je 0xcb80
incq %r14
incq %rcx
jmp 0xcc9a
btl $0xb, %ecx
jb 0xcd5d
cmpl $0x2d, %ebp
movq (%rsp), %r13
jg 0xcdf3
cmpl $0x22, %ebp
jg 0xce57
cmpl $0xa, %ebp
je 0xceeb
cmpl $0xd, %ebp
je 0xceeb
cmpl $0x21, %ebp
jne 0xceeb
incq %r15
movq %r15, %rcx
movb %r12b, -0x1(%rcx)
movq (%rax), %rsi
movsbq (%r14), %r12
movzbl %r12b, %edx
movzwl (%rsi,%r12,2), %esi
testb $0x8, %sil
jne 0xcd41
cmpl $0x2e, %edx
je 0xcd49
cmpl $0x5f, %edx
je 0xcd49
jmp 0xcb80
testl %edx, %edx
je 0xcb80
incq %r14
incq %rcx
jmp 0xcd18
movq %r13, %r14
movq (%rsp), %r13
jmp 0xcb80
movq %rbx, %r14
movq %r15, %rcx
movq (%rsp), %r13
movb %r12b, (%rcx)
incq %rcx
movq (%rax), %rsi
movsbq 0x1(%r14), %r12
incq %r14
cmpq $0x2e, %r12
setne %dl
testb $0x8, 0x1(%rsi,%r12,2)
sete %sil
testq %r12, %r12
je 0xcb80
andb %sil, %dl
je 0xcd67
jmp 0xcb80
incq %r15
movsbq %dl, %rcx
movq (%rax), %rsi
testb $0x8, 0x1(%rsi,%rcx,2)
jne 0xce1c
cmpb $0x2e, %dl
movq (%rsp), %r13
jne 0xcfe5
movb $0x2e, %dl
movq %r15, %rcx
movb %dl, (%rcx)
incq %rcx
movq (%rax), %rdi
movsbq 0x1(%r14), %rdx
incq %r14
cmpq $0x2e, %rdx
setne %sil
testb $0x8, 0x1(%rdi,%rdx,2)
sete %dil
testq %rdx, %rdx
je 0xcb80
andb %dil, %sil
je 0xcdbf
jmp 0xcb80
cmpl $0x3f, %ebp
jg 0xcea9
cmpl $0x2e, %ebp
je 0xcf0d
cmpl $0x3d, %ebp
je 0xcfca
cmpl $0x3e, %ebp
je 0xcef3
jmp 0xceeb
movq %r15, %rcx
movq (%rsp), %r13
movb %dl, (%rcx)
incq %rcx
movq (%rax), %rdi
movsbq 0x1(%r14), %rdx
incq %r14
cmpq $0x2e, %rdx
setne %sil
testb $0x8, 0x1(%rdi,%rdx,2)
sete %dil
testq %rdx, %rdx
je 0xcb80
andb %dil, %sil
je 0xce23
jmp 0xcb80
cmpl $0x23, %ebp
je 0xcf4c
cmpl $0x25, %ebp
je 0xcfed
cmpl $0x2d, %ebp
jne 0xceeb
movq %rbx, %r14
movq %r15, %rcx
movb %r12b, (%rcx)
incq %rcx
movq (%rax), %rsi
movsbq 0x1(%r14), %r12
incq %r14
cmpq $0x2e, %r12
setne %dl
testb $0x8, 0x1(%rsi,%r12,2)
sete %sil
testq %r12, %r12
je 0xcb80
andb %sil, %dl
je 0xce74
jmp 0xcb80
cmpl $0x40, %ebp
je 0xcf8b
cmpl $0x5d, %ebp
je 0xcef3
cmpl $0x5c, %ebp
jne 0xceeb
movq %rbx, %r14
movq %r15, %rcx
movb %r12b, (%rcx)
incq %rcx
movsbq 0x1(%r14), %r12
incq %r14
testq %r12, %r12
je 0xcb80
movq (%rax), %rdx
movzwl (%rdx,%r12,2), %edx
andl $0x8, %edx
jne 0xcec2
jmp 0xcb80
movb %r12b, (%r15)
jmp 0xcfe2
movb %r12b, (%r15)
cmpb $0x2a, (%r14)
jne 0xcfe2
incq %r14
movb $0x2a, 0x1(%r15)
jmp 0xcfdc
incq %r15
movq %r15, %rcx
movb %r12b, -0x1(%rcx)
movq (%rax), %rsi
movsbq (%r14), %r12
movzbl %r12b, %edx
movzwl (%rsi,%r12,2), %esi
testb $0x8, %sil
jne 0xcf3c
cmpl $0x2e, %edx
je 0xcf44
cmpl $0x5f, %edx
je 0xcf44
jmp 0xcb80
testl %edx, %edx
je 0xcb80
incq %r14
incq %rcx
jmp 0xcf13
incq %r15
movq %r15, %rcx
movb %r12b, -0x1(%rcx)
movq (%rax), %rsi
movsbq (%r14), %r12
movzbl %r12b, %edx
movzwl (%rsi,%r12,2), %esi
testb $0x8, %sil
jne 0xcf7b
cmpl $0x2e, %edx
je 0xcf83
cmpl $0x5f, %edx
je 0xcf83
jmp 0xcb80
testl %edx, %edx
je 0xcb80
incq %r14
incq %rcx
jmp 0xcf52
incq %r15
movq %r15, %rcx
movb %r12b, -0x1(%rcx)
movq (%rax), %rsi
movsbq (%r14), %r12
movzbl %r12b, %edx
movzwl (%rsi,%r12,2), %esi
testb $0x8, %sil
jne 0xcfba
cmpl $0x2e, %edx
je 0xcfc2
cmpl $0x5f, %edx
je 0xcfc2
jmp 0xcb80
testl %edx, %edx
je 0xcb80
incq %r14
incq %rcx
jmp 0xcf91
movb $0x3d, (%r15)
cmpb $0x3d, (%r14)
jne 0xcfe2
incq %r14
movb $0x3d, 0x1(%r15)
addq $0x2, %r15
jmp 0xcfe5
incq %r15
movq %r15, %rcx
jmp 0xcb80
incq %r15
movabsq $0x20000000000011, %rdx # imm = 0x20000000000011
movq %r15, %rcx
movb %r12b, -0x1(%rcx)
movq (%rax), %rdi
movsbq (%r14), %r12
movzbl %r12b, %esi
movzwl (%rdi,%r12,2), %edi
testb $0x8, %dil
jne 0xd02e
addl $-0x2a, %esi
cmpl $0x35, %esi
ja 0xcb80
btq %rsi, %rdx
jb 0xd036
jmp 0xcb80
testl %esi, %esi
je 0xcb80
incq %r14
incq %rcx
jmp 0xcffd