// File: /workspace/github_c_makefile_star2_O1/hikalium[P]compilium/tokenizer.c
// Function: CreateNextToken
static struct Node *CreateNextToken(const char *p, const char *src, int *line) {
  assert(line);
  if (!*p) return NULL;
  if (*p == ' ') {
    return AllocToken(src, *line, p, 1, kTokenDelimiter);
  }
  if (*p == '\n') {
    (*line)++;
    return AllocToken(src, *line, p, 1, kTokenDelimiter);
  }
  if (p[0] == '\\' && p[1] == '\n') {
    (*line)++;
    return AllocToken(src, *line, p, 2, kTokenZeroWidthNoBreakSpace);
  }
  if ('1' <= *p && *p <= '9') {
    int length = 0;
    while ('0' <= p[length] && p[length] <= '9') {
      length++;
    }
    return AllocToken(src, *line, p, length, kTokenIntegerConstant);
  } else if ('0' == *p) {
    int length = 0;
    if (p[1] == 'x') {
      // Hexadecimal
      length += 2;
      while (('0' <= p[length] && p[length] <= '9') ||
             ('A' <= p[length] && p[length] <= 'F') ||
             ('a' <= p[length] && p[length] <= 'f')) {
        length++;
      }
    } else {
      // Octal
      while ('0' <= p[length] && p[length] <= '7') {
        length++;
      }
    }
    return AllocToken(src, *line, p, length, kTokenIntegerConstant);
  } else if (('A' <= *p && *p <= 'Z') || ('a' <= *p && *p <= 'z') ||
             *p == '_') {
    int length = 0;
    while (('A' <= p[length] && p[length] <= 'Z') ||
           ('a' <= p[length] && p[length] <= 'z') || p[length] == '_' ||
           ('0' <= p[length] && p[length] <= '9')) {
      length++;
    }
    struct Node *t = AllocToken(src, *line, p, length, kTokenIdent);
    if (IsEqualTokenWithCStr(t, "break")) t->token_type = kTokenKwBreak;
    if (IsEqualTokenWithCStr(t, "char")) t->token_type = kTokenKwChar;
    if (IsEqualTokenWithCStr(t, "const")) t->token_type = kTokenKwConst;
    if (IsEqualTokenWithCStr(t, "continue")) t->token_type = kTokenKwContinue;
    if (IsEqualTokenWithCStr(t, "else")) t->token_type = kTokenKwElse;
    if (IsEqualTokenWithCStr(t, "extern")) t->token_type = kTokenKwExtern;
    if (IsEqualTokenWithCStr(t, "for")) t->token_type = kTokenKwFor;
    if (IsEqualTokenWithCStr(t, "if")) t->token_type = kTokenKwIf;
    if (IsEqualTokenWithCStr(t, "int")) t->token_type = kTokenKwInt;
    if (IsEqualTokenWithCStr(t, "long")) t->token_type = kTokenKwLong;
    if (IsEqualTokenWithCStr(t, "return")) t->token_type = kTokenKwReturn;
    if (IsEqualTokenWithCStr(t, "sizeof")) t->token_type = kTokenKwSizeof;
    if (IsEqualTokenWithCStr(t, "static")) t->token_type = kTokenKwStatic;
    if (IsEqualTokenWithCStr(t, "struct")) t->token_type = kTokenKwStruct;
    if (IsEqualTokenWithCStr(t, "typedef")) t->token_type = kTokenKwTypedef;
    if (IsEqualTokenWithCStr(t, "unsigned")) t->token_type = kTokenKwUnsigned;
    if (IsEqualTokenWithCStr(t, "void")) t->token_type = kTokenKwVoid;
    if (IsEqualTokenWithCStr(t, "while")) t->token_type = kTokenKwWhile;
    return t;
  } else if ('\'' == *p) {
    int length = 1;
    while (p[length] && p[length] != '\'') {
      if (p[length] == '\\' && p[length + 1]) {
        length++;
      }
      length++;
    }
    if (p[length] != '\'') {
      Error("Expected end of char literal (')");
    }
    length++;
    return AllocToken(src, *line, p, length, kTokenCharLiteral);
  } else if ('"' == *p) {
    int length = 1;
    while (p[length] && p[length] != '"') {
      if (p[length] == '\\' && p[length + 1]) {
        length++;
      }
      length++;
    }
    if (p[length] != '"') {
      Error("Expected end of string literal (\")");
    }
    length++;
    return AllocToken(src, *line, p, length, kTokenStringLiteral);
  } else if ('#' == *p) {
    if (p[1] == '#') {
      return AllocToken(src, *line, p, 2, kTokenPunctuator);
    }
    return AllocToken(src, *line, p, 1, kTokenPunctuator);
  } else if ('&' == *p) {
    if (p[1] == '&') {
      return AllocToken(src, *line, p, 2, kTokenPunctuator);
    }
    return AllocToken(src, *line, p, 1, kTokenPunctuator);
  } else if ('|' == *p) {
    if (p[1] == '|') {
      return AllocToken(src, *line, p, 2, kTokenPunctuator);
    }
    return AllocToken(src, *line, p, 1, kTokenPunctuator);
  } else if ('<' == *p) {
    if (p[1] == '<') {
      if (p[2] == '=') {
        return AllocToken(src, *line, p, 3, kTokenPunctuator);
      }
      return AllocToken(src, *line, p, 2, kTokenPunctuator);
    } else if (p[1] == '=') {
      return AllocToken(src, *line, p, 2, kTokenPunctuator);
    }
    return AllocToken(src, *line, p, 1, kTokenPunctuator);
  } else if ('>' == *p) {
    if (p[1] == '>') {
      if (p[2] == '=') {
        return AllocToken(src, *line, p, 3, kTokenPunctuator);
      }
      return AllocToken(src, *line, p, 2, kTokenPunctuator);
    } else if (p[1] == '=') {
      return AllocToken(src, *line, p, 2, kTokenPunctuator);
    }
    return AllocToken(src, *line, p, 1, kTokenPunctuator);
  } else if ('=' == *p) {
    if (p[1] == '=') {
      return AllocToken(src, *line, p, 2, kTokenPunctuator);
    }
    return AllocToken(src, *line, p, 1, kTokenPunctuator);
  } else if ('!' == *p) {
    if (p[1] == '=') {
      return AllocToken(src, *line, p, 2, kTokenPunctuator);
    }
    return AllocToken(src, *line, p, 1, kTokenPunctuator);
  } else if ('^' == *p) {
    return AllocToken(src, *line, p, 1, kTokenPunctuator);
  } else if ('+' == *p) {
    if (p[1] == '+') {
      return AllocToken(src, *line, p, 2, kTokenPunctuator);
    }
    if (p[1] == '=') {
      return AllocToken(src, *line, p, 2, kTokenPunctuator);
    }
    return AllocToken(src, *line, p, 1, kTokenPunctuator);
  } else if ('-' == *p) {
    if (p[1] == '-' || p[1] == '=' || p[1] == '>') {
      return AllocToken(src, *line, p, 2, kTokenPunctuator);
    }
    return AllocToken(src, *line, p, 1, kTokenPunctuator);
  } else if ('*' == *p) {
    if (p[1] == '/') {
      return AllocToken(src, *line, p, 2, kTokenBlockCommentEnd);
    }
    if (p[1] == '=') {
      return AllocToken(src, *line, p, 2, kTokenPunctuator);
    }
    return AllocToken(src, *line, p, 1, kTokenPunctuator);
  } else if ('/' == *p) {
    if (p[1] == '/') {
      return AllocToken(src, *line, p, 2, kTokenLineComment);
    }
    if (p[1] == '*') {
      return AllocToken(src, *line, p, 2, kTokenBlockCommentBegin);
    }
    if (p[1] == '=') {
      return AllocToken(src, *line, p, 2, kTokenPunctuator);
    }
    return AllocToken(src, *line, p, 1, kTokenPunctuator);
  } else if ('%' == *p) {
    if (p[1] == '=') {
      return AllocToken(src, *line, p, 2, kTokenPunctuator);
    }
    return AllocToken(src, *line, p, 1, kTokenPunctuator);
  } else if ('~' == *p) {
    return AllocToken(src, *line, p, 1, kTokenPunctuator);
  } else if ('?' == *p) {
    return AllocToken(src, *line, p, 1, kTokenPunctuator);
  } else if (':' == *p) {
    return AllocToken(src, *line, p, 1, kTokenPunctuator);
  } else if (',' == *p) {
    return AllocToken(src, *line, p, 1, kTokenPunctuator);
  } else if (';' == *p) {
    return AllocToken(src, *line, p, 1, kTokenPunctuator);
  } else if ('{' == *p) {
    return AllocToken(src, *line, p, 1, kTokenPunctuator);
  } else if ('}' == *p) {
    return AllocToken(src, *line, p, 1, kTokenPunctuator);
  } else if ('(' == *p) {
    return AllocToken(src, *line, p, 1, kTokenPunctuator);
  } else if (')' == *p) {
    return AllocToken(src, *line, p, 1, kTokenPunctuator);
  } else if ('.' == *p) {
    if (p[1] == '.' && p[2] == '.') {
      return AllocToken(src, *line, p, 3, kTokenPunctuator);
    }
    return AllocToken(src, *line, p, 1, kTokenPunctuator);
  } else if ('[' == *p) {
    return AllocToken(src, *line, p, 1, kTokenPunctuator);
  } else if (']' == *p) {
    return AllocToken(src, *line, p, 1, kTokenPunctuator);
  }
  return AllocToken(src, *line, p, 1, kTokenUnknownChar);
}

// Assembly:
pushq %rbx
testq %rdx, %rdx
je 0x9eed
movq %rdi, %rax
movzbl (%rdi), %ecx
cmpl $0x1f, %ecx
jg 0x9938
testl %ecx, %ecx
je 0x9959
cmpl $0xa, %ecx
jne 0x9981
movl (%rdx), %ecx
incl %ecx
movl %ecx, (%rdx)
jmp 0x9944
cmpl $0x5c, %ecx
je 0x9960
cmpl $0x20, %ecx
jne 0x9981
movl (%rdx), %ecx
movq %rsi, %rdi
movl %ecx, %esi
movq %rax, %rdx
movl $0x1, %ecx
movl $0x1, %r8d
jmp 0x99af
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
retq
cmpb $0xa, 0x1(%rax)
jne 0x9981
movl (%rdx), %ecx
incl %ecx
movl %ecx, (%rdx)
movq %rsi, %rdi
movl %ecx, %esi
movq %rax, %rdx
movl $0x2, %ecx
movl $0x2, %r8d
jmp 0x99af
leal -0x31(%rcx), %edi
cmpb $0x8, %dil
ja 0x99b5
xorl %ecx, %ecx
movb (%rax,%rcx), %dil
addb $-0x30, %dil
incq %rcx
cmpb $0xa, %dil
jb 0x998c
decl %ecx
movl (%rdx), %edx
movq %rsi, %rdi
movl %edx, %esi
movq %rax, %rdx
movl $0x3, %r8d
popq %rbx
jmp 0x9156
cmpl $0x30, %ecx
jne 0x99fa
cmpb $0x78, 0x1(%rax)
jne 0x9c68
movl $0x2, %ecx
movabsq $0x3f0000003f, %rdi     # imm = 0x3F0000003F
movb (%rax,%rcx), %r8b
leal -0x30(%r8), %r9d
cmpb $0xa, %r9b
jb 0x99f5
movzbl %r8b, %r8d
addl $-0x41, %r8d
cmpl $0x25, %r8d
ja 0x999f
btq %r8, %rdi
jae 0x999f
incq %rcx
jmp 0x99d3
movl %ecx, %edi
andb $-0x21, %dil
addb $-0x41, %dil
cmpb $0x1a, %dil
jae 0x9c86
xorl %ecx, %ecx
movb (%rax,%rcx), %dil
leal -0x41(%rdi), %r8d
cmpb $0x1a, %r8b
jb 0x9a38
leal -0x30(%rdi), %r8d
cmpb $0xa, %r8b
jb 0x9a38
cmpb $0x5f, %dil
je 0x9a38
addb $-0x61, %dil
cmpb $0x19, %dil
ja 0x9a3d
incq %rcx
jmp 0x9a10
movl (%rdx), %edx
movq %rsi, %rdi
movl %edx, %esi
movq %rax, %rdx
movl $0x4, %r8d
callq 0x9156
movq %rax, %rbx
leaq 0x2d85(%rip), %rsi      # 0xc7e1
movq %rax, %rdi
callq 0x9278
testl %eax, %eax
je 0x9a72
movl $0x5, 0x108(%rbx)
leaq 0x15f3(%rip), %rsi      # 0xb06c
movq %rbx, %rdi
callq 0x9278
testl %eax, %eax
je 0x9a8f
movl $0x6, 0x108(%rbx)
leaq 0x2d51(%rip), %rsi      # 0xc7e7
movq %rbx, %rdi
callq 0x9278
testl %eax, %eax
je 0x9aac
movl $0x7, 0x108(%rbx)
leaq 0x2d3a(%rip), %rsi      # 0xc7ed
movq %rbx, %rdi
callq 0x9278
testl %eax, %eax
je 0x9ac9
movl $0x8, 0x108(%rbx)
leaq 0x291f(%rip), %rsi      # 0xc3ef
movq %rbx, %rdi
callq 0x9278
testl %eax, %eax
je 0x9ae6
movl $0x9, 0x108(%rbx)
leaq 0x2d09(%rip), %rsi      # 0xc7f6
movq %rbx, %rdi
callq 0x9278
testl %eax, %eax
je 0x9b03
movl $0xa, 0x108(%rbx)
leaq 0x2cf3(%rip), %rsi      # 0xc7fd
movq %rbx, %rdi
callq 0x9278
testl %eax, %eax
je 0x9b20
movl $0xb, 0x108(%rbx)
leaq 0x28d0(%rip), %rsi      # 0xc3f7
movq %rbx, %rdi
callq 0x9278
testl %eax, %eax
je 0x9b3d
movl $0xc, 0x108(%rbx)
leaq 0x1524(%rip), %rsi      # 0xb068
movq %rbx, %rdi
callq 0x9278
testl %eax, %eax
je 0x9b5a
movl $0xd, 0x108(%rbx)
leaq 0x2ca0(%rip), %rsi      # 0xc801
movq %rbx, %rdi
callq 0x9278
testl %eax, %eax
je 0x9b77
movl $0xe, 0x108(%rbx)
leaq 0x2c88(%rip), %rsi      # 0xc806
movq %rbx, %rdi
callq 0x9278
testl %eax, %eax
je 0x9b94
movl $0xf, 0x108(%rbx)
leaq 0x2c72(%rip), %rsi      # 0xc80d
movq %rbx, %rdi
callq 0x9278
testl %eax, %eax
je 0x9bb1
movl $0x10, 0x108(%rbx)
leaq 0x2c5c(%rip), %rsi      # 0xc814
movq %rbx, %rdi
callq 0x9278
testl %eax, %eax
je 0x9bce
movl $0x11, 0x108(%rbx)
leaq 0x1500(%rip), %rsi      # 0xb0d5
movq %rbx, %rdi
callq 0x9278
testl %eax, %eax
je 0x9beb
movl $0x12, 0x108(%rbx)
leaq 0x2c29(%rip), %rsi      # 0xc81b
movq %rbx, %rdi
callq 0x9278
testl %eax, %eax
je 0x9c08
movl $0x13, 0x108(%rbx)
leaq 0x2c14(%rip), %rsi      # 0xc823
movq %rbx, %rdi
callq 0x9278
testl %eax, %eax
je 0x9c25
movl $0x14, 0x108(%rbx)
leaq 0x2c00(%rip), %rsi      # 0xc82c
movq %rbx, %rdi
callq 0x9278
testl %eax, %eax
je 0x9c42
movl $0x15, 0x108(%rbx)
leaq 0x2be8(%rip), %rsi      # 0xc831
movq %rbx, %rdi
callq 0x9278
testl %eax, %eax
je 0x995b
movl $0x16, 0x108(%rbx)
jmp 0x995b
movq $-0x1, %rcx
movb 0x1(%rax,%rcx), %dil
andb $-0x8, %dil
incq %rcx
cmpb $0x30, %dil
je 0x9c6f
jmp 0x999f
leal -0x21(%rcx), %edi
cmpl $0x1e, %edi
ja 0x9ca7
leaq 0x2a9b(%rip), %rcx      # 0xc730
movslq (%rcx,%rdi,4), %rdi
addq %rcx, %rdi
jmpq *%rdi
cmpb $0x3d, 0x1(%rax)
jmp 0x9e5a
leal -0x5b(%rcx), %edi
cmpl $0x4, %edi
jbe 0x9cd0
addl $-0x7b, %ecx
cmpl $0x3, %ecx
ja 0x9cf4
leaq 0x2b02(%rip), %rdi      # 0xc7c0
movslq (%rdi,%rcx,4), %rcx
addq %rdi, %rcx
jmpq *%rcx
cmpb $0x7c, 0x1(%rax)
jmp 0x9e5a
leaq 0x2ad5(%rip), %rcx      # 0xc7ac
movslq (%rcx,%rdi,4), %rdi
addq %rcx, %rdi
jmpq *%rdi
movl (%rdx), %ecx
movq %rsi, %rdi
movl %ecx, %esi
movq %rax, %rdx
movl $0x1, %ecx
jmp 0x9e9c
movl (%rdx), %ecx
movq %rsi, %rdi
movl %ecx, %esi
movq %rax, %rdx
movl $0x1, %ecx
xorl %r8d, %r8d
jmp 0x99af
movzbl 0x1(%rax), %edi
movl (%rdx), %ecx
cmpl $0x2a, %edi
je 0x9ed5
cmpl $0x3d, %edi
je 0x9e8f
cmpl $0x2f, %edi
jne 0x9ce2
movq %rsi, %rdi
movl %ecx, %esi
movq %rax, %rdx
movl $0x2, %ecx
movl $0x1a, %r8d
jmp 0x99af
movzbl 0x1(%rax), %edi
movl (%rdx), %ecx
cmpl $0x3d, %edi
je 0x9e8f
cmpl $0x2f, %edi
jne 0x9ce2
movq %rsi, %rdi
movl %ecx, %esi
movq %rax, %rdx
movl $0x2, %ecx
movl $0x1c, %r8d
jmp 0x99af
cmpb $0x2e, 0x1(%rax)
jne 0x9ce0
cmpb $0x2e, 0x2(%rax)
jne 0x9ce0
movl (%rdx), %ecx
jmp 0x9e7e
movzbl 0x1(%rax), %ecx
cmpl $0x3d, %ecx
je 0x9e8d
cmpl $0x3e, %ecx
je 0x9e76
jmp 0x9ce0
movl $0x1, %ecx
movslq %ecx, %r8
movzbl (%rax,%r8), %edi
cmpl $0x5c, %edi
je 0x9dc6
cmpl $0x22, %edi
je 0x9ea7
testl %edi, %edi
jne 0x9dd5
jmp 0x9f05
cmpb $0x0, 0x1(%rax,%r8)
leaq 0x1(%r8), %rdi
cmovel %ecx, %edi
movl %edi, %ecx
incl %ecx
jmp 0x9da7
movzbl 0x1(%rax), %edi
movl (%rdx), %ecx
cmpl $0x3d, %edi
je 0x9e8f
cmpl $0x2b, %edi
je 0x9e8f
jmp 0x9ce2
movl $0x1, %ecx
movslq %ecx, %r8
movzbl (%rax,%r8), %edi
cmpl $0x5c, %edi
je 0x9e1a
cmpl $0x27, %edi
je 0x9ebe
testl %edi, %edi
jne 0x9e29
jmp 0x9f0e
cmpb $0x0, 0x1(%rax,%r8)
leaq 0x1(%r8), %rdi
cmovel %ecx, %edi
movl %edi, %ecx
incl %ecx
jmp 0x9dfb
cmpb $0x23, 0x1(%rax)
jmp 0x9e5a
movzbl 0x1(%rax), %ecx
cmpq $0x3e, %rcx
ja 0x9ce0
movabsq $0x6000200000000000, %rdi # imm = 0x6000200000000000
btq %rcx, %rdi
jb 0x9e8d
jmp 0x9ce0
cmpb $0x26, 0x1(%rax)
movl (%rdx), %ecx
jne 0x9ce2
jmp 0x9e8f
movzbl 0x1(%rax), %ecx
cmpl $0x3d, %ecx
je 0x9e8d
cmpl $0x3c, %ecx
jne 0x9ce0
cmpb $0x3d, 0x2(%rax)
movl (%rdx), %ecx
jne 0x9e8f
movq %rsi, %rdi
movl %ecx, %esi
movq %rax, %rdx
movl $0x3, %ecx
jmp 0x9e9c
movl (%rdx), %ecx
movq %rsi, %rdi
movl %ecx, %esi
movq %rax, %rdx
movl $0x2, %ecx
movl $0x19, %r8d
jmp 0x99af
incl %ecx
movl (%rdx), %edx
movq %rsi, %rdi
movl %edx, %esi
movq %rax, %rdx
movl $0x18, %r8d
jmp 0x99af
incl %ecx
movl (%rdx), %edx
movq %rsi, %rdi
movl %edx, %esi
movq %rax, %rdx
movl $0x17, %r8d
jmp 0x99af
movq %rsi, %rdi
movl %ecx, %esi
movq %rax, %rdx
movl $0x2, %ecx
movl $0x1b, %r8d
jmp 0x99af
leaq 0x28dc(%rip), %rdi      # 0xc7d0
leaq 0x28da(%rip), %rsi      # 0xc7d5
movl $0x4, %edx
callq 0x4704
leaq 0x294c(%rip), %rdi      # 0xc858
jmp 0x9f15
leaq 0x2922(%rip), %rdi      # 0xc837
xorl %eax, %eax
callq 0x4630