// File: /workspace/github_c_makefile_star2_O1/aquaxis[P]synverll/src/token.c
// Function: get_token
int get_token(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(isalpha(*p)){          // 1文字目は英字、2文字目以降は英数字
        do{
            *ptk++ = *p++;
        }while((isalnum(*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 == '\'' || *p == '"'){  // 文字・文字列定数: ', ", '', "",
        str = *p;
        do{
            *ptk++ = *p++;
        }while(*p != str && *p !='\0');
        *ptk++ = *p++;
    }else if(*p == '*'){    // 乗算、コメント: *, *=, **, */
        str = *p;
        *ptk++ = *p++;
        if(*p == str || *p == '/' || *p == '='){
            *ptk++ = *p++;
        }else{
			// ポインター
			do{
				*ptk++ = *p++;
			}while((isalnum(*p) || *p == '_') && *p !='\0');    // 2文字目以降は英数字、又は"_"である
		}
    }else if(*p == '+'){    // 加算: +, ++, +=
        str = *p;
        *ptk++ = *p++;
        if(*p == str || *p == '='){
            *ptk++ = *p++;
        }
    }else if(*p == '-'){    // 減算: -, --, ->, -=
        str = *p;
        *ptk++ = *p++;
        if(*p == str || *p == '>' || *p == '='){
            *ptk++ = *p++;
        }
    }else if(*p == '/'){    // 除算、コメント: /, /=, //, /*
        str = *p;
        *ptk++ = *p++;
        if(*p == str || *p == '*' || *p == '='){
            *ptk++ = *p++;
        }
    }else if(*p == '&' || *p == '|'){   // 論理演算子: &, |, &&, ||, &=, |=
        str = *p;
        *ptk++ = *p++;
        if(*p == str || *p == '='){
            *ptk++ = *p++;
        }
    }else if(*p == '>' || *p == '<'){   // 比較、シフト: >, <, >>, <<, >=, <=
        str = *p;
        *ptk++ = *p++;
        if(*p == str || *p == '='){
            *ptk++ = *p++;
        }
    }else if(*p == '!'){    // 等しくない: !, !=
        str = *p;
        *ptk++ = *p++;
        if(*p == '='){
            *ptk++ = *p++;
        }
    }else if(*p == '='){    // 等しい: =, ==
        str = *p;
        *ptk++ = *p++;
        if(*p == str){
            *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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x1(%rdi), %r14
movzbl -0x1(%r14), %eax
cmpl $0x9, %eax
je 0xc4ec
cmpl $0x20, %eax
jne 0xc4f1
incq %r14
jmp 0xc4dd
testl %eax, %eax
jne 0xc538
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 0xc618
leal 0x1(%rax), %ecx
cmpb $-0x5f, %cl
ja 0xc560
leaq -0x1(%r14), %r12
leal 0x7f(%rax), %edx
cmpb $0x1f, %dl
setae %dl
addb $0x20, %al
cmpb $0x1d, %al
setae %al
testb %al, %dl
jne 0xc624
movb %cl, (%r12)
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 0xc59a
leal 0x7f(%rsi), %edi
cmpb $0x1f, %dil
setae %dil
addb $0x20, %sil
cmpb $0x1d, %sil
setae %sil
testb %sil, %dil
jne 0xc59a
movb %dl, (%rax)
movb (%rax), %sil
leal 0x1(%rsi), %edx
cmpb $-0x5f, %dl
ja 0xc5c3
leal 0x7f(%rsi), %edi
cmpb $0x1f, %dil
setae %dil
addb $0x20, %sil
cmpb $0x1d, %sil
setae %sil
testb %sil, %dil
jne 0xc5d0
movb %dl, (%rax)
leaq 0x1(%rax), %r14
leaq 0x1(%rcx), %rdx
cmpb $0x0, (%rax)
jne 0xc564
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 %r14
popq %r15
retq
callq 0x11e0
movq (%rax), %rcx
movsbq (%r12), %rdx
movzwl (%rcx,%rdx,2), %ecx
btl $0xa, %ecx
jb 0xc6a8
cmpb $0x30, %dl
jne 0xc6e3
movb %dl, (%r15)
movzbl (%r14), %ecx
movl %ecx, %edx
orl $0x20, %edx
cmpl $0x78, %edx
jne 0xc773
incq %r14
addq $0x2, %r15
movq %r15, %rcx
movb -0x1(%r14), %dl
movb %dl, -0x1(%rcx)
movq (%rax), %rdi
movsbq (%r14), %rdx
movzbl %dl, %esi
movzwl (%rdi,%rdx,2), %edi
btl $0xb, %edi
jb 0xc698
leal -0x61(%rsi), %edi
cmpl $0x6, %edi
jb 0xc6a0
cmpl $0x2e, %esi
je 0xc6a0
addl $-0x47, %edx
cmpb $-0x6, %dl
jae 0xc6a0
jmp 0xc5e1
testl %esi, %esi
je 0xc5e1
incq %r14
incq %rcx
jmp 0xc663
movq %r12, %r14
movq %r15, %rcx
movb (%r14), %dl
movb %dl, (%rcx)
movsbq 0x1(%r14), %rdi
incq %r14
incq %rcx
movq (%rax), %rsi
cmpq $0x5f, %rdi
setne %dl
testb $0x8, (%rsi,%rdi,2)
sete %sil
testq %rdi, %rdi
je 0xc5e1
andb %sil, %dl
je 0xc6ae
jmp 0xc5e1
btl $0xb, %ecx
jb 0xc737
movzbl %dl, %ecx
cmpl $0x3b, %ecx
jg 0xc7c6
addl $-0x21, %ecx
cmpl $0xe, %ecx
ja 0xc923
leaq 0x3b24(%rip), %rsi      # 0x1022c
movslq (%rsi,%rcx,4), %rcx
addq %rsi, %rcx
jmpq *%rcx
incq %r15
movq %r15, %rcx
movb -0x1(%r14), %al
movb %al, -0x1(%rcx)
movb (%r14), %al
incq %r14
incq %rcx
cmpb %dl, %al
je 0xc72f
testb %al, %al
jne 0xc717
movb %al, -0x1(%rcx)
jmp 0xc5e1
movq %r12, %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 0xc5e1
andb %sil, %dl
je 0xc73d
jmp 0xc5e1
incq %r15
movsbq %cl, %rdx
movq (%rax), %rsi
testb $0x8, 0x1(%rsi,%rdx,2)
jne 0xc7e8
cmpb $0x2e, %cl
jne 0xc929
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 0xc5e1
andb %sil, %dl
je 0xc790
jmp 0xc5e1
cmpl $0x3d, %ecx
jg 0xc821
cmpl $0x3c, %ecx
je 0xc82f
cmpl $0x3d, %ecx
jne 0xc923
movb %dl, (%r15)
movb (%r14), %al
cmpb $0x3d, %al
je 0xc847
jmp 0xc926
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 0xc5e1
andb %sil, %dl
je 0xc7eb
jmp 0xc5e1
cmpl $0x3e, %ecx
je 0xc82f
cmpl $0x7c, %ecx
jne 0xc923
movb %dl, (%r15)
movb (%r14), %al
cmpb %dl, %al
setne %cl
cmpb $0x3d, %al
setne %dl
testb %dl, %cl
jne 0xc926
incq %r14
movb %al, 0x1(%r15)
jmp 0xc91d
leaq 0x1(%r15), %rcx
movb %dl, (%r15)
movzbl (%r14), %eax
cmpq $0x3d, %rax
ja 0xc5e1
movabsq $0x2000840000000000, %rdx # imm = 0x2000840000000000
jmp 0xc893
leaq 0x1(%r15), %rcx
movb %dl, (%r15)
movzbl (%r14), %eax
cmpq $0x3e, %rax
ja 0xc5e1
movabsq $0x6000200000000000, %rdx # imm = 0x6000200000000000
btq %rax, %rdx
jae 0xc5e1
incq %r14
movb %al, 0x1(%r15)
jmp 0xc91d
leaq 0x1(%r15), %rcx
movb %dl, (%r15)
movzbl (%r14), %edx
cmpq $0x3d, %rdx
ja 0xc8d9
movabsq $0x2000840000000000, %rsi # imm = 0x2000840000000000
btq %rdx, %rsi
jae 0xc8d9
incq %r14
movb %dl, 0x1(%r15)
jmp 0xc91d
andb %sil, %dl
jne 0xc5e1
movb (%r14), %dl
movb %dl, (%rcx)
movsbq 0x1(%r14), %rdi
incq %r14
incq %rcx
movq (%rax), %rsi
cmpq $0x5f, %rdi
setne %dl
testb $0x8, (%rsi,%rdi,2)
sete %sil
testq %rdi, %rdi
jne 0xc8d0
jmp 0xc5e1
movb %dl, (%r15)
movzbl (%r14), %eax
cmpl $0x2b, %eax
je 0xc916
cmpl $0x3d, %eax
jne 0xc926
incq %r14
movb %al, 0x1(%r15)
addq $0x2, %r15
jmp 0xc929
movb %dl, (%r15)
incq %r15
movq %r15, %rcx
jmp 0xc5e1