// File: /workspace/github_c_makefile_star2_O1/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 0xcc4a
cmpl $0x20, %eax
jne 0xcc4f
incq %r14
jmp 0xcc3b
testl %eax, %eax
jne 0xcc96
decq %r14
movq %r14, %rdi
callq 0x1090
leaq 0x1(%rax), %rdi
callq 0x1140
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)
movl $0x1, %eax
jmp 0xcd75
leal 0x1(%rax), %ecx
cmpb $-0x5f, %cl
ja 0xccbd
leaq -0x1(%r14), %rbp
leal 0x7f(%rax), %edx
cmpb $0x1f, %dl
setae %dl
addb $0x20, %al
cmpb $0x1d, %al
setae %al
testb %al, %dl
jne 0xcd84
movb %cl, (%rbp)
leaq 0x1(%r15), %rdx
movq %r14, %rax
movq %rdx, %rcx
movb -0x1(%r14), %dl
movb %dl, -0x1(%rcx)
movb (%r14), %sil
leal 0x1(%rsi), %edx
cmpb $-0x5f, %dl
ja 0xccf7
leal 0x7f(%rsi), %edi
cmpb $0x1f, %dil
setae %dil
addb $0x20, %sil
cmpb $0x1d, %sil
setae %sil
testb %sil, %dil
jne 0xccf7
movb %dl, (%rax)
movb (%rax), %sil
leal 0x1(%rsi), %edx
cmpb $-0x5f, %dl
ja 0xcd20
leal 0x7f(%rsi), %edi
cmpb $0x1f, %dil
setae %dil
addb $0x20, %sil
cmpb $0x1d, %sil
setae %sil
testb %sil, %dil
jne 0xcd2d
movb %dl, (%rax)
leaq 0x1(%rax), %r14
leaq 0x1(%rcx), %rdx
cmpb $0x0, (%rax)
jne 0xccc1
movw $0x49, 0x4(%r15)
movl $0x4a4e414b, (%r15)     # imm = 0x4A4E414B
movq %rax, %r14
movb $0x0, (%rcx)
movq %r14, %rdi
callq 0x1090
leaq 0x1(%rax), %rdi
callq 0x1140
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), %r13
movsbq (%rbp), %r12
cmpq $0x63, %r12
jne 0xcdc8
cmpb $0x22, (%r14)
jne 0xcdc8
movb %r12b, (%r15)
addq $0x2, %r15
movq %r15, %rcx
movq %r13, %r14
movb -0x1(%r14), %al
movb %al, -0x1(%rcx)
movzbl (%r14), %eax
incq %r14
incq %rcx
cmpl $0x22, %eax
je 0xcdc0
testl %eax, %eax
jne 0xcda6
movb %al, -0x1(%rcx)
jmp 0xcd3e
callq 0x11e0
movq (%rax), %rcx
movzwl (%rcx,%r12,2), %ecx
btl $0xa, %ecx
jb 0xce47
cmpb $0x30, %r12b
jne 0xce9c
movb %r12b, (%r15)
movzbl (%r14), %ecx
movl %ecx, %edx
orl $0x20, %edx
cmpl $0x78, %edx
jne 0xcf58
addq $0x2, %r15
movq %r15, %rcx
movb -0x1(%r13), %dl
movb %dl, -0x1(%rcx)
movq (%rax), %rdi
movsbq (%r13), %rdx
movzbl %dl, %esi
movzwl (%rdi,%rdx,2), %edi
btl $0xb, %edi
jb 0xce37
leal -0x61(%rsi), %edi
cmpl $0x6, %edi
jb 0xce3f
cmpl $0x2e, %esi
je 0xce3f
addl $-0x47, %edx
cmpb $-0x6, %dl
jae 0xce3f
jmp 0xcf14
testl %esi, %esi
je 0xcf14
incq %r13
incq %rcx
jmp 0xce01
incq %r15
movabsq $0x20000000000011, %rdx # imm = 0x20000000000011
movq %r15, %rcx
movb -0x1(%r14), %sil
movb %sil, -0x1(%rcx)
movq (%rax), %rdi
movsbq (%r14), %r8
movzbl %r8b, %esi
movzwl (%rdi,%r8,2), %edi
testb $0x8, %dil
jne 0xce8c
addl $-0x2a, %esi
cmpl $0x35, %esi
ja 0xcd3e
btq %rsi, %rdx
jb 0xce94
jmp 0xcd3e
testl %esi, %esi
je 0xcd3e
incq %r14
incq %rcx
jmp 0xce57
btl $0xb, %ecx
jb 0xcf1c
movzbl %r12b, %ecx
cmpl $0x2d, %ecx
jg 0xcfab
cmpl $0x22, %ecx
jg 0xd00d
cmpl $0xa, %ecx
je 0xd0a3
cmpl $0xd, %ecx
je 0xd0a3
cmpl $0x21, %ecx
jne 0xd0a3
incq %r15
movq %r15, %rcx
movb -0x1(%r14), %dl
movb %dl, -0x1(%rcx)
movq (%rax), %rsi
movsbq (%r14), %rdi
movzbl %dil, %edx
movzwl (%rsi,%rdi,2), %esi
testb $0x8, %sil
jne 0xcf04
cmpl $0x2e, %edx
je 0xcf0c
cmpl $0x5f, %edx
je 0xcf0c
jmp 0xcd3e
testl %edx, %edx
je 0xcd3e
incq %r14
incq %rcx
jmp 0xced9
movq %r13, %r14
jmp 0xcd3e
movq %rbp, %r14
movq %r15, %rcx
movb (%r14), %dl
movb %dl, (%rcx)
movsbq 0x1(%r14), %rdi
incq %r14
incq %rcx
movq (%rax), %rsi
cmpq $0x2e, %rdi
setne %dl
testb $0x8, 0x1(%rsi,%rdi,2)
sete %sil
testq %rdi, %rdi
je 0xcd3e
andb %sil, %dl
je 0xcf22
jmp 0xcd3e
incq %r15
movsbq %cl, %rdx
movq (%rax), %rsi
testb $0x8, 0x1(%rsi,%rdx,2)
jne 0xcfd4
cmpb $0x2e, %cl
jne 0xd19d
movq %r15, %rcx
movb (%r14), %dl
movb %dl, (%rcx)
movsbq 0x1(%r14), %rdi
incq %r14
incq %rcx
movq (%rax), %rsi
cmpq $0x2e, %rdi
setne %dl
testb $0x8, 0x1(%rsi,%rdi,2)
sete %sil
testq %rdi, %rdi
je 0xcd3e
andb %sil, %dl
je 0xcf75
jmp 0xcd3e
cmpl $0x3f, %ecx
jg 0xd060
cmpl $0x2e, %ecx
je 0xd0c9
cmpl $0x3d, %ecx
je 0xd18c
cmpl $0x3e, %ecx
je 0xd0ab
jmp 0xd0a3
movq %r15, %rcx
movb (%r14), %dl
movb %dl, (%rcx)
movsbq 0x1(%r14), %rdi
incq %r14
incq %rcx
movq (%rax), %rsi
cmpq $0x2e, %rdi
setne %dl
testb $0x8, 0x1(%rsi,%rdi,2)
sete %sil
testq %rdi, %rdi
je 0xcd3e
andb %sil, %dl
je 0xcfd7
jmp 0xcd3e
cmpl $0x23, %ecx
je 0xd10a
cmpl $0x25, %ecx
je 0xd1a5
cmpl $0x2d, %ecx
jne 0xd0a3
movq %rbp, %r14
movq %r15, %rcx
movb (%r14), %dl
movb %dl, (%rcx)
movsbq 0x1(%r14), %rdi
incq %r14
incq %rcx
movq (%rax), %rsi
cmpq $0x2e, %rdi
setne %dl
testb $0x8, 0x1(%rsi,%rdi,2)
sete %sil
testq %rdi, %rdi
je 0xcd3e
andb %sil, %dl
je 0xd02a
jmp 0xcd3e
cmpl $0x40, %ecx
je 0xd14b
cmpl $0x5d, %ecx
je 0xd0ab
cmpl $0x5c, %ecx
jne 0xd0a3
movq %rbp, %r14
movq %r15, %rcx
movb (%r14), %dl
movb %dl, (%rcx)
movsbq 0x1(%r14), %rdx
incq %r14
incq %rcx
testq %rdx, %rdx
je 0xcd3e
movq (%rax), %rsi
movzwl (%rsi,%rdx,2), %edx
andl $0x8, %edx
jne 0xd079
jmp 0xcd3e
movb %r12b, (%r15)
jmp 0xd19a
movb %r12b, (%r15)
movb (%r14), %al
cmpb $0x2a, %al
jne 0xd19a
incq %r14
movb %al, 0x1(%r15)
addq $0x2, %r15
jmp 0xd19d
incq %r15
movq %r15, %rcx
movb -0x1(%r14), %dl
movb %dl, -0x1(%rcx)
movq (%rax), %rsi
movsbq (%r14), %rdi
movzbl %dil, %edx
movzwl (%rsi,%rdi,2), %esi
testb $0x8, %sil
jne 0xd0fa
cmpl $0x2e, %edx
je 0xd102
cmpl $0x5f, %edx
je 0xd102
jmp 0xcd3e
testl %edx, %edx
je 0xcd3e
incq %r14
incq %rcx
jmp 0xd0cf
incq %r15
movq %r15, %rcx
movb -0x1(%r14), %dl
movb %dl, -0x1(%rcx)
movq (%rax), %rsi
movsbq (%r14), %rdi
movzbl %dil, %edx
movzwl (%rsi,%rdi,2), %esi
testb $0x8, %sil
jne 0xd13b
cmpl $0x2e, %edx
je 0xd143
cmpl $0x5f, %edx
je 0xd143
jmp 0xcd3e
testl %edx, %edx
je 0xcd3e
incq %r14
incq %rcx
jmp 0xd110
incq %r15
movq %r15, %rcx
movb -0x1(%r14), %dl
movb %dl, -0x1(%rcx)
movq (%rax), %rsi
movsbq (%r14), %rdi
movzbl %dil, %edx
movzwl (%rsi,%rdi,2), %esi
testb $0x8, %sil
jne 0xd17c
cmpl $0x2e, %edx
je 0xd184
cmpl $0x5f, %edx
je 0xd184
jmp 0xcd3e
testl %edx, %edx
je 0xcd3e
incq %r14
incq %rcx
jmp 0xd151
movb %r12b, (%r15)
movb (%r14), %al
cmpb $0x3d, %al
je 0xd0b9
incq %r15
movq %r15, %rcx
jmp 0xcd3e
incq %r15
movabsq $0x20000000000011, %rdx # imm = 0x20000000000011
movq %r15, %rcx
movb -0x1(%r14), %sil
movb %sil, -0x1(%rcx)
movq (%rax), %rdi
movsbq (%r14), %r8
movzbl %r8b, %esi
movzwl (%rdi,%r8,2), %edi
testb $0x8, %dil
jne 0xd1ea
addl $-0x2a, %esi
cmpl $0x35, %esi
ja 0xcd3e
btq %rsi, %rdx
jb 0xd1f2
jmp 0xcd3e
testl %esi, %esi
je 0xcd3e
incq %r14
incq %rcx
jmp 0xd1b5