#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 */
bool isArithmetic(int pos, char chr) {
  if (pos == 0) {
    switch (chr) {
    case '+':
    case '-':
    case '*':
    case '/':
    case '%':
      return true;
    default:
      return false;
    }
  } else if (pos == 1) {
    switch (chr) {
    case '=':
    case '+':
    case '-':
    case '*':
      return true;
    default:
      return false;
    }
  }
  return false;
}


x86 assembly (clang, -O0):
<isArithmetic>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %edi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    117a <isArithmetic+0x7a>
movsbl -0x9(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x25,%eax
je     1162 <isArithmetic+0x62>
jmp    112c <isArithmetic+0x2c>
mov    -0x10(%rbp),%eax
add    $0xffffffd6,%eax
sub    $0x2,%eax
jb     1162 <isArithmetic+0x62>
jmp    1140 <isArithmetic+0x40>
mov    -0x10(%rbp),%eax
sub    $0x2d,%eax
je     1162 <isArithmetic+0x62>
jmp    1151 <isArithmetic+0x51>
mov    -0x10(%rbp),%eax
sub    $0x2f,%eax
jne    116e <isArithmetic+0x6e>
jmp    1162 <isArithmetic+0x62>
movl   $0x1,-0x4(%rbp)
jmp    11e2 <isArithmetic+0xe2>
movl   $0x0,-0x4(%rbp)
jmp    11e2 <isArithmetic+0xe2>
cmpl   $0x1,-0x8(%rbp)
jne    11d6 <isArithmetic+0xd6>
movsbl -0x9(%rbp),%eax
mov    %eax,-0x14(%rbp)
add    $0xffffffd6,%eax
sub    $0x2,%eax
jb     11be <isArithmetic+0xbe>
jmp    119c <isArithmetic+0x9c>
mov    -0x14(%rbp),%eax
sub    $0x2d,%eax
je     11be <isArithmetic+0xbe>
jmp    11ad <isArithmetic+0xad>
mov    -0x14(%rbp),%eax
sub    $0x3d,%eax
jne    11ca <isArithmetic+0xca>
jmp    11be <isArithmetic+0xbe>
movl   $0x1,-0x4(%rbp)
jmp    11e2 <isArithmetic+0xe2>
movl   $0x0,-0x4(%rbp)
jmp    11e2 <isArithmetic+0xe2>
jmp    11db <isArithmetic+0xdb>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isArithmetic>:
xor    %eax,%eax
cmp    $0x1,%edi
je     112a <isArithmetic+0x2a>
test   %edi,%edi
jne    1148 <isArithmetic+0x48>
movsbl %sil,%ecx
add    $0xffffffdb,%ecx
mov    $0x0,%eax
cmp    $0xb,%ecx
jae    1148 <isArithmetic+0x48>
movslq %ecx,%rax
lea    0xeda(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret
movsbl %sil,%ecx
cmp    $0x3d,%ecx
ja     1149 <isArithmetic+0x49>
mov    $0x1,%eax
movabs $0x20002c0000000000,%rdx
bt     %rcx,%rdx
jae    1149 <isArithmetic+0x49>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @isArithmetic(i32 %0, i8 signext %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
store i32 %0, i32* %4
store i8 %1, i8* %5
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i8, i8* %5
%10 = sext i8 %9 to i32
switch i32 %10, label %12 [
i32 43, label %11
i32 45, label %11
i32 42, label %11
i32 47, label %11
i32 37, label %11
]
11: ; preds = %8, %8, %8, %8, %8
store i32 1, i32* %3
br label %23
12: ; preds = %8
store i32 0, i32* %3
br label %23
13: ; preds = %2
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %21
16: ; preds = %13
%17 = load i8, i8* %5
%18 = sext i8 %17 to i32
switch i32 %18, label %20 [
i32 61, label %19
i32 43, label %19
i32 45, label %19
i32 42, label %19
]
19: ; preds = %16, %16, %16, %16
store i32 1, i32* %3
br label %23
20: ; preds = %16
store i32 0, i32* %3
br label %23
21: ; preds = %13
br label %22
22: ; preds = %21
store i32 0, i32* %3
br label %23
23: ; preds = %22, %20, %19, %12, %11
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
@switch.table.isArithmetic = [11 x i32] [i32 1, i32 0, i32 0, i32 0, i32 0, i32 1, i32 1, i32 0, i32 1, i32 0, i32 1]
define i32 @isArithmetic(i32 %0, i8 signext %1) {
switch i32 %0, label %14 [
i32 0, label %3
i32 1, label %7
]
3: ; preds = %2
%4 = sext i8 %1 to i32
%5 = add nsw i32 %4, -37
%6 = icmp ult i32 %5, 11
br i1 %6, label %10, label %14
7: ; preds = %2
%8 = sext i8 %1 to i32
switch i32 %8, label %9 [
i32 61, label %14
i32 43, label %14
i32 45, label %14
i32 42, label %14
]
9: ; preds = %7
br label %14
10: ; preds = %3
%11 = sext i32 %5 to i64
%12 = getelementptr inbounds [11 x i32], [11 x i32]* @switch.table.isArithmetic, i64 0, i64 %11
%13 = load i32, i32* %12
br label %14
14: ; preds = %3, %10, %2, %7, %7, %7, %7, %9
%15 = phi i32 [ 0, %9 ], [ 1, %7 ], [ 1, %7 ], [ 1, %7 ], [ 1, %7 ], [ 0, %2 ], [ %13, %10 ], [ 0, %3 ]
ret i32 %15
}