#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__ ft_atoi(char *);
int /*<<< orphan*/ ft_putstr(char *);
int ft_expect(char c) {
  if (c == '*' || c == '/' || c == '%' || c == '+' || c == '-')
    return (1);
  else if (c == '(' || c == ')' || ft_atoi(&c))
    return (1);
  else {
    ft_putstr("Parse error");
    return (0);
  }
}


x86 assembly (clang, -O0):
<ft_expect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x2a,%eax
je     116f <ft_expect+0x4f>
movsbl -0x5(%rbp),%eax
cmp    $0x2f,%eax
je     116f <ft_expect+0x4f>
movsbl -0x5(%rbp),%eax
cmp    $0x25,%eax
je     116f <ft_expect+0x4f>
movsbl -0x5(%rbp),%eax
cmp    $0x2b,%eax
je     116f <ft_expect+0x4f>
movsbl -0x5(%rbp),%eax
cmp    $0x2d,%eax
jne    117b <ft_expect+0x5b>
movl   $0x1,-0x4(%rbp)
jmp    11c7 <ft_expect+0xa7>
movsbl -0x5(%rbp),%eax
cmp    $0x28,%eax
je     11a8 <ft_expect+0x88>
movsbl -0x5(%rbp),%eax
cmp    $0x29,%eax
je     11a8 <ft_expect+0x88>
lea    -0x5(%rbp),%rdi
call   1040 <ft_atoi@plt>
cmp    $0x0,%rax
je     11b4 <ft_expect+0x94>
movl   $0x1,-0x4(%rbp)
jmp    11c7 <ft_expect+0xa7>
lea    0xe45(%rip),%rdi
call   1030 <ft_putstr@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_expect>:
push   %rax
mov    %dil,0x7(%rsp)
lea    -0x25(%rdi),%eax
cmp    $0xb,%al
jae    114b <ft_expect+0x2b>
movzbl %al,%eax
mov    $0x561,%ecx
bt     %eax,%ecx
mov    $0x1,%eax
jb     1149 <ft_expect+0x29>
and    $0xfe,%dil
cmp    $0x28,%dil
jne    115a <ft_expect+0x3a>
pop    %rcx
ret
and    $0xfe,%dil
mov    $0x1,%eax
cmp    $0x28,%dil
je     1149 <ft_expect+0x29>
lea    0x7(%rsp),%rdi
call   1040 <ft_atoi@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    1149 <ft_expect+0x29>
lea    0xe88(%rip),%rdi
call   1030 <ft_putstr@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Parse error\00"
define i32 @ft_expect(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 42
br i1 %6, label %23, label %7
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 47
br i1 %10, label %23, label %11
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 37
br i1 %14, label %23, label %15
15: ; preds = %11
%16 = load i8, i8* %3
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 43
br i1 %18, label %23, label %19
19: ; preds = %15
%20 = load i8, i8* %3
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 45
br i1 %22, label %23, label %24
23: ; preds = %19, %15, %11, %7, %1
store i32 1, i32* %2
br label %38
24: ; preds = %19
%25 = load i8, i8* %3
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 40
br i1 %27, label %35, label %28
28: ; preds = %24
%29 = load i8, i8* %3
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 41
br i1 %31, label %35, label %32
32: ; preds = %28
%33 = call i64 @ft_atoi(i8* %3)
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %36
35: ; preds = %32, %28, %24
store i32 1, i32* %2
br label %38
36: ; preds = %32
%37 = call i32 @ft_putstr(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %38
38: ; preds = %36, %35, %23
%39 = load i32, i32* %2
ret i32 %39
}

LLVM IR (-O2):
@.str = [12 x i8] c"Parse error\00"
define i32 @ft_expect(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = add i8 %0, -37
%4 = icmp ult i8 %3, 11
br i1 %4, label %13, label %5
5: ; preds = %1
%6 = and i8 %0, -2
%7 = icmp eq i8 %6, 40
br i1 %7, label %21, label %8
8: ; preds = %13, %5
%9 = call i64 @ft_atoi(i8* %2)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %21
11: ; preds = %8
%12 = call i32 @ft_putstr(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %21
13: ; preds = %1
%14 = zext i8 %3 to i16
%15 = lshr i16 1377, %14
%16 = and i16 %15, 1
%17 = icmp ne i16 %16, 0
%18 = and i8 %0, -2
%19 = icmp eq i8 %18, 40
%20 = or i1 %17, %19
br i1 %20, label %21, label %8
21: ; preds = %13, %5, %8, %11
%22 = phi i32 [ 0, %11 ], [ 1, %8 ], [ 1, %5 ], [ 1, %13 ]
ret i32 %22
}