#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__ isalpha(char);
scalar_t__ strchr(char *, char);
int checkExpression(char *expr) {
  int pointer = 0;
  while (*(expr + pointer) != 0) {
    if (!(isalpha(*(expr + pointer)) || strchr("+-*/ #", *(expr + pointer)))) {
      return 0;
    }
    pointer++;
  }
  return 1;
}


x86 assembly (clang, -O0):
<checkExpression>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     119f <checkExpression+0x7f>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <isalpha@plt>
cmp    $0x0,%rax
jne    1191 <checkExpression+0x71>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
lea    0xe8e(%rip),%rdi
movsbl (%rax,%rcx,1),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
jne    1191 <checkExpression+0x71>
movl   $0x0,-0x4(%rbp)
jmp    11a6 <checkExpression+0x86>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1133 <checkExpression+0x13>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkExpression>:
push   %rbp
push   %r14
push   %rbx
mov    (%rdi),%al
mov    $0x1,%r14d
test   %al,%al
je     116c <checkExpression+0x4c>
mov    %rdi,%rbx
add    $0x1,%rbx
lea    0xec2(%rip),%rbp
jmp    114b <checkExpression+0x2b>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     116c <checkExpression+0x4c>
movsbl %al,%edi
call   1040 <isalpha@plt>
test   %rax,%rax
jne    1140 <checkExpression+0x20>
movsbl -0x1(%rbx),%esi
mov    %rbp,%rdi
call   1030 <strchr@plt>
test   %rax,%rax
jne    1140 <checkExpression+0x20>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"+-*/ #\00"
define i32 @checkExpression(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
br label %5
5: ; preds = %30, %1
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %6, i64 %8
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %33
13: ; preds = %5
%14 = load i8*, i8** %3
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = call i64 @isalpha(i8 signext %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %30, label %21
21: ; preds = %13
%22 = load i8*, i8** %3
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
%26 = load i8, i8* %25
%27 = call i64 @strchr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8 signext %26)
%28 = icmp ne i64 %27, 0
br i1 %28, label %30, label %29
29: ; preds = %21
store i32 0, i32* %2
br label %34
30: ; preds = %21, %13
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
store i32 %32, i32* %4
br label %5
33: ; preds = %5
store i32 1, i32* %2
br label %34
34: ; preds = %33, %29
%35 = load i32, i32* %2
ret i32 %35
}

LLVM IR (-O2):
@.str = [7 x i8] c"+-*/ #\00"
define i32 @checkExpression(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %19, label %4
4: ; preds = %1, %14
%5 = phi i64 [ %15, %14 ], [ 0, %1 ]
%6 = phi i8 [ %17, %14 ], [ %2, %1 ]
%7 = phi i8* [ %16, %14 ], [ %0, %1 ]
%8 = tail call i64 @isalpha(i8 signext %6)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %4
%11 = load i8, i8* %7
%12 = tail call i64 @strchr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8 signext %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %19, label %14
14: ; preds = %10, %4
%15 = add nuw i64 %5, 1
%16 = getelementptr inbounds i8, i8* %0, i64 %15
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %4
19: ; preds = %10, %14, %1
%20 = phi i32 [ 1, %1 ], [ 1, %14 ], [ 0, %10 ]
ret i32 %20
}