#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
scalar_t__ isalnum(char);
scalar_t__ isalpha(char);
scalar_t__ isdigit(char);
char *skip_whitespace(char *);
scalar_t__ strncasecmp(char *, char *, int);
unsigned char next_token(char *s) {
  s = skip_whitespace(s);
  if (isdigit(*s)) {
    return 2;
  } else if (strncasecmp(s, "then", 4) == 0) {
    return 19;
  } else if (strncasecmp(s, "onerror", 7) == 0) {
    return 20;
  } else if (isalpha(*s)) {
    while (isalnum(*s)) {
      ++s;
    }
    if (*s == '$') {
      return 5;
    } else {
      return 4;
    }
  } else if (*s == '"') {
    return 3;
  } else if (*s == '=') {
    ++s;
    if (*s == '=') {
      return 13;
    }
    return 6;
  } else if (*s == '<') {
    ++s;
    if (*s == '=') {
      return 16;
    }
    return 15;
  } else if (*s == '>') {
    ++s;
    if (*s == '=') {
      return 18;
    }
    return 17;
  } else if (*s == '+') {
    return 7;
  } else if (*s == '-') {
    return 8;
  } else if (*s == '*') {
    return 9;
  } else if (*s == '/') {
    return 10;
  } else if (*s == '%') {
    return 11;
  } else if (*s == ',') {
    return 12;
  } else if (*s == '\0' || *s == ';') {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<next_token>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <skip_whitespace@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1188 <next_token+0x38>
movb   $0x2,-0x1(%rbp)
jmp    1418 <next_token+0x2c8>
mov    -0x10(%rbp),%rdi
lea    0xe6d(%rip),%rsi
mov    $0x4,%edx
call   1060 <strncasecmp@plt>
cmp    $0x0,%rax
jne    11b0 <next_token+0x60>
movb   $0x13,-0x1(%rbp)
jmp    1418 <next_token+0x2c8>
mov    -0x10(%rbp),%rdi
lea    0xe4a(%rip),%rsi
mov    $0x7,%edx
call   1060 <strncasecmp@plt>
cmp    $0x0,%rax
jne    11d8 <next_token+0x88>
movb   $0x14,-0x1(%rbp)
jmp    1418 <next_token+0x2c8>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1070 <isalpha@plt>
cmp    $0x0,%rax
je     123c <next_token+0xec>
jmp    11f3 <next_token+0xa3>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isalnum@plt>
cmp    $0x0,%rax
je     121a <next_token+0xca>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11f3 <next_token+0xa3>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x24,%eax
jne    1233 <next_token+0xe3>
movb   $0x5,-0x1(%rbp)
jmp    1418 <next_token+0x2c8>
movb   $0x4,-0x1(%rbp)
jmp    1418 <next_token+0x2c8>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    1255 <next_token+0x105>
movb   $0x3,-0x1(%rbp)
jmp    1418 <next_token+0x2c8>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
jne    1293 <next_token+0x143>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
jne    128a <next_token+0x13a>
movb   $0xd,-0x1(%rbp)
jmp    1418 <next_token+0x2c8>
movb   $0x6,-0x1(%rbp)
jmp    1418 <next_token+0x2c8>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3c,%eax
jne    12d1 <next_token+0x181>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
jne    12c8 <next_token+0x178>
movb   $0x10,-0x1(%rbp)
jmp    1418 <next_token+0x2c8>
movb   $0xf,-0x1(%rbp)
jmp    1418 <next_token+0x2c8>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3e,%eax
jne    130f <next_token+0x1bf>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
jne    1306 <next_token+0x1b6>
movb   $0x12,-0x1(%rbp)
jmp    1418 <next_token+0x2c8>
movb   $0x11,-0x1(%rbp)
jmp    1418 <next_token+0x2c8>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2b,%eax
jne    1328 <next_token+0x1d8>
movb   $0x7,-0x1(%rbp)
jmp    1418 <next_token+0x2c8>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1341 <next_token+0x1f1>
movb   $0x8,-0x1(%rbp)
jmp    1418 <next_token+0x2c8>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2a,%eax
jne    135a <next_token+0x20a>
movb   $0x9,-0x1(%rbp)
jmp    1418 <next_token+0x2c8>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1373 <next_token+0x223>
movb   $0xa,-0x1(%rbp)
jmp    1418 <next_token+0x2c8>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x25,%eax
jne    138c <next_token+0x23c>
movb   $0xb,-0x1(%rbp)
jmp    1418 <next_token+0x2c8>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2c,%eax
jne    13a5 <next_token+0x255>
movb   $0xc,-0x1(%rbp)
jmp    1418 <next_token+0x2c8>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     13c5 <next_token+0x275>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3b,%eax
jne    13ce <next_token+0x27e>
movb   $0x1,-0x1(%rbp)
jmp    1418 <next_token+0x2c8>
jmp    13d3 <next_token+0x283>
jmp    13d8 <next_token+0x288>
jmp    13dd <next_token+0x28d>
jmp    13e2 <next_token+0x292>
jmp    13e7 <next_token+0x297>
jmp    13ec <next_token+0x29c>
jmp    13f1 <next_token+0x2a1>
jmp    13f6 <next_token+0x2a6>
jmp    13fb <next_token+0x2ab>
jmp    1400 <next_token+0x2b0>
jmp    1405 <next_token+0x2b5>
jmp    140a <next_token+0x2ba>
jmp    140f <next_token+0x2bf>
jmp    1414 <next_token+0x2c4>
movb   $0x0,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_token>:
push   %rbx
call   1050 <skip_whitespace@plt>
mov    %rax,%rbx
movsbl (%rax),%edi
call   1030 <isdigit@plt>
mov    %rax,%rcx
mov    $0x2,%al
test   %rcx,%rcx
je     116d <next_token+0x1d>
pop    %rbx
ret
lea    0xf88(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1060 <strncasecmp@plt>
test   %rax,%rax
je     11cc <next_token+0x7c>
lea    0xf74(%rip),%rsi
mov    %rbx,%rdi
mov    $0x7,%edx
call   1060 <strncasecmp@plt>
test   %rax,%rax
je     11d0 <next_token+0x80>
movsbl (%rbx),%edi
call   1070 <isalpha@plt>
test   %rax,%rax
je     11d4 <next_token+0x84>
nopl   0x0(%rax)
movsbl (%rbx),%edi
call   1040 <isalnum@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    11b0 <next_token+0x60>
cmpb   $0x24,-0x1(%rbx)
sete   %al
or     $0x4,%al
pop    %rbx
ret
mov    $0x13,%al
pop    %rbx
ret
mov    $0x14,%al
pop    %rbx
ret
movzbl (%rbx),%ecx
cmp    $0x3e,%rcx
ja     11f3 <next_token+0xa3>
mov    $0x3,%al
lea    0xe1a(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0x1,%al
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret
mov    $0xb,%al
pop    %rbx
ret
mov    $0x9,%al
pop    %rbx
ret
mov    $0x7,%al
pop    %rbx
ret
mov    $0xc,%al
pop    %rbx
ret
mov    $0x8,%al
pop    %rbx
ret
mov    $0xa,%al
pop    %rbx
ret
cmpb   $0x3d,0x1(%rbx)
sete   %al
add    $0xf,%al
pop    %rbx
ret
cmpb   $0x3d,0x1(%rbx)
mov    $0xd,%ecx
mov    $0x6,%eax
cmove  %ecx,%eax
pop    %rbx
ret
cmpb   $0x3d,0x1(%rbx)
sete   %al
add    $0x11,%al
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"then\00"
@.str.1 = [8 x i8] c"onerror\00"
define zeroext i8 @next_token(i8* %0) {
%2 = alloca i8
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i8* @skip_whitespace(i8* %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = call i64 @isdigit(i8 signext %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %1
store i8 2, i8* %2
br label %152
11: ; preds = %1
%12 = load i8*, i8** %3
%13 = call i64 @strncasecmp(i8* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11
store i8 19, i8* %2
br label %152
16: ; preds = %11
%17 = load i8*, i8** %3
%18 = call i64 @strncasecmp(i8* %17, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 7)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %16
store i8 20, i8* %2
br label %152
21: ; preds = %16
%22 = load i8*, i8** %3
%23 = load i8, i8* %22
%24 = call i64 @isalpha(i8 signext %23)
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %42
26: ; preds = %21
br label %27
27: ; preds = %32, %26
%28 = load i8*, i8** %3
%29 = load i8, i8* %28
%30 = call i64 @isalnum(i8 signext %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %27
%33 = load i8*, i8** %3
%34 = getelementptr inbounds i8, i8* %33, i32 1
store i8* %34, i8** %3
br label %27
35: ; preds = %27
%36 = load i8*, i8** %3
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 36
br i1 %39, label %40, label %41
40: ; preds = %35
store i8 5, i8* %2
br label %152
41: ; preds = %35
store i8 4, i8* %2
br label %152
42: ; preds = %21
%43 = load i8*, i8** %3
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 34
br i1 %46, label %47, label %48
47: ; preds = %42
store i8 3, i8* %2
br label %152
48: ; preds = %42
%49 = load i8*, i8** %3
%50 = load i8, i8* %49
%51 = sext i8 %50 to i32
%52 = icmp eq i32 %51, 61
br i1 %52, label %53, label %62
53: ; preds = %48
%54 = load i8*, i8** %3
%55 = getelementptr inbounds i8, i8* %54, i32 1
store i8* %55, i8** %3
%56 = load i8*, i8** %3
%57 = load i8, i8* %56
%58 = sext i8 %57 to i32
%59 = icmp eq i32 %58, 61
br i1 %59, label %60, label %61
60: ; preds = %53
store i8 13, i8* %2
br label %152
61: ; preds = %53
store i8 6, i8* %2
br label %152
62: ; preds = %48
%63 = load i8*, i8** %3
%64 = load i8, i8* %63
%65 = sext i8 %64 to i32
%66 = icmp eq i32 %65, 60
br i1 %66, label %67, label %76
67: ; preds = %62
%68 = load i8*, i8** %3
%69 = getelementptr inbounds i8, i8* %68, i32 1
store i8* %69, i8** %3
%70 = load i8*, i8** %3
%71 = load i8, i8* %70
%72 = sext i8 %71 to i32
%73 = icmp eq i32 %72, 61
br i1 %73, label %74, label %75
74: ; preds = %67
store i8 16, i8* %2
br label %152
75: ; preds = %67
store i8 15, i8* %2
br label %152
76: ; preds = %62
%77 = load i8*, i8** %3
%78 = load i8, i8* %77
%79 = sext i8 %78 to i32
%80 = icmp eq i32 %79, 62
br i1 %80, label %81, label %90
81: ; preds = %76
%82 = load i8*, i8** %3
%83 = getelementptr inbounds i8, i8* %82, i32 1
store i8* %83, i8** %3
%84 = load i8*, i8** %3
%85 = load i8, i8* %84
%86 = sext i8 %85 to i32
%87 = icmp eq i32 %86, 61
br i1 %87, label %88, label %89
88: ; preds = %81
store i8 18, i8* %2
br label %152
89: ; preds = %81
store i8 17, i8* %2
br label %152
90: ; preds = %76
%91 = load i8*, i8** %3
%92 = load i8, i8* %91
%93 = sext i8 %92 to i32
%94 = icmp eq i32 %93, 43
br i1 %94, label %95, label %96
95: ; preds = %90
store i8 7, i8* %2
br label %152
96: ; preds = %90
%97 = load i8*, i8** %3
%98 = load i8, i8* %97
%99 = sext i8 %98 to i32
%100 = icmp eq i32 %99, 45
br i1 %100, label %101, label %102
101: ; preds = %96
store i8 8, i8* %2
br label %152
102: ; preds = %96
%103 = load i8*, i8** %3
%104 = load i8, i8* %103
%105 = sext i8 %104 to i32
%106 = icmp eq i32 %105, 42
br i1 %106, label %107, label %108
107: ; preds = %102
store i8 9, i8* %2
br label %152
108: ; preds = %102
%109 = load i8*, i8** %3
%110 = load i8, i8* %109
%111 = sext i8 %110 to i32
%112 = icmp eq i32 %111, 47
br i1 %112, label %113, label %114
113: ; preds = %108
store i8 10, i8* %2
br label %152
114: ; preds = %108
%115 = load i8*, i8** %3
%116 = load i8, i8* %115
%117 = sext i8 %116 to i32
%118 = icmp eq i32 %117, 37
br i1 %118, label %119, label %120
119: ; preds = %114
store i8 11, i8* %2
br label %152
120: ; preds = %114
%121 = load i8*, i8** %3
%122 = load i8, i8* %121
%123 = sext i8 %122 to i32
%124 = icmp eq i32 %123, 44
br i1 %124, label %125, label %126
125: ; preds = %120
store i8 12, i8* %2
br label %152
126: ; preds = %120
%127 = load i8*, i8** %3
%128 = load i8, i8* %127
%129 = sext i8 %128 to i32
%130 = icmp eq i32 %129, 0
br i1 %130, label %136, label %131
131: ; preds = %126
%132 = load i8*, i8** %3
%133 = load i8, i8* %132
%134 = sext i8 %133 to i32
%135 = icmp eq i32 %134, 59
br i1 %135, label %136, label %137
136: ; preds = %131, %126
store i8 1, i8* %2
br label %152
137: ; preds = %131
br label %138
138: ; preds = %137
br label %139
139: ; preds = %138
br label %140
140: ; preds = %139
br label %141
141: ; preds = %140
br label %142
142: ; preds = %141
br label %143
143: ; preds = %142
br label %144
144: ; preds = %143
br label %145
145: ; preds = %144
br label %146
146: ; preds = %145
br label %147
147: ; preds = %146
br label %148
148: ; preds = %147
br label %149
149: ; preds = %148
br label %150
150: ; preds = %149
br label %151
151: ; preds = %150
store i8 0, i8* %2
br label %152
152: ; preds = %151, %136, %125, %119, %113, %107, %101, %95, %89, %88, %75, %74, %61, %60, %47, %41, %40, %20, %15, %10
%153 = load i8, i8* %2
ret i8 %153
}

LLVM IR (-O2):
@.str = [5 x i8] c"then\00"
@.str.1 = [8 x i8] c"onerror\00"
define zeroext i8 @next_token(i8* %0) {
%2 = tail call i8* @skip_whitespace(i8* %0)
%3 = load i8, i8* %2
%4 = tail call i64 @isdigit(i8 signext %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %51
6: ; preds = %1
%7 = tail call i64 @strncasecmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%8 = icmp eq i64 %7, 0
br i1 %8, label %51, label %9
9: ; preds = %6
%10 = tail call i64 @strncasecmp(i8* %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 7)
%11 = icmp eq i64 %10, 0
br i1 %11, label %51, label %12
12: ; preds = %9
%13 = load i8, i8* %2
%14 = tail call i64 @isalpha(i8 signext %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %26, label %16
16: ; preds = %12, %16
%17 = phi i8* [ %21, %16 ], [ %2, %12 ]
%18 = load i8, i8* %17
%19 = tail call i64 @isalnum(i8 signext %18)
%20 = icmp eq i64 %19, 0
%21 = getelementptr inbounds i8, i8* %17, i64 1
br i1 %20, label %22, label %16
22: ; preds = %16
%23 = load i8, i8* %17
%24 = icmp eq i8 %23, 36
%25 = select i1 %24, i8 5, i8 4
br label %51
26: ; preds = %12
%27 = load i8, i8* %2
switch i8 %27, label %50 [
i8 34, label %51
i8 61, label %28
i8 60, label %33
i8 62, label %38
i8 43, label %43
i8 45, label %44
i8 42, label %45
i8 47, label %46
i8 37, label %47
i8 44, label %48
i8 0, label %49
i8 59, label %49
]
28: ; preds = %26
%29 = getelementptr inbounds i8, i8* %2, i64 1
%30 = load i8, i8* %29
%31 = icmp eq i8 %30, 61
%32 = select i1 %31, i8 13, i8 6
br label %51
33: ; preds = %26
%34 = getelementptr inbounds i8, i8* %2, i64 1
%35 = load i8, i8* %34
%36 = icmp eq i8 %35, 61
%37 = select i1 %36, i8 16, i8 15
br label %51
38: ; preds = %26
%39 = getelementptr inbounds i8, i8* %2, i64 1
%40 = load i8, i8* %39
%41 = icmp eq i8 %40, 61
%42 = select i1 %41, i8 18, i8 17
br label %51
43: ; preds = %26
br label %51
44: ; preds = %26
br label %51
45: ; preds = %26
br label %51
46: ; preds = %26
br label %51
47: ; preds = %26
br label %51
48: ; preds = %26
br label %51
49: ; preds = %26, %26
br label %51
50: ; preds = %26
br label %51
51: ; preds = %26, %38, %33, %28, %22, %9, %6, %1, %50, %49, %48, %47, %46, %45, %44, %43
%52 = phi i8 [ 7, %43 ], [ 8, %44 ], [ 9, %45 ], [ 10, %46 ], [ 11, %47 ], [ 12, %48 ], [ 1, %49 ], [ 0, %50 ], [ 2, %1 ], [ 19, %6 ], [ 20, %9 ], [ %25, %22 ], [ 3, %26 ], [ %32, %28 ], [ %37, %33 ], [ %42, %38 ]
ret i8 %52
}