#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 */
int expression();
int /*<<< orphan*/ get();
int number();
char peek();
int factor() {
  if (peek() >= '0' && peek() <= '9')
    return number();
  else if (peek() == '(') {
    get();
    int result = expression();
    get();
    return result;
  } else if (peek() == '-') {
    get();
    return -expression();
  }
  return 0;
}


x86 assembly (clang, -O0):
<factor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <peek@plt>
movsbl %al,%eax
cmp    $0x30,%eax
jl     117d <factor+0x3d>
mov    $0x0,%al
call   1030 <peek@plt>
movsbl %al,%eax
cmp    $0x39,%eax
jg     117d <factor+0x3d>
mov    $0x0,%al
call   1050 <number@plt>
mov    %eax,-0x4(%rbp)
jmp    11f3 <factor+0xb3>
mov    $0x0,%al
call   1030 <peek@plt>
movsbl %al,%eax
cmp    $0x28,%eax
jne    11b3 <factor+0x73>
mov    $0x0,%al
call   1060 <get@plt>
mov    $0x0,%al
call   1040 <expression@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1060 <get@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11f3 <factor+0xb3>
mov    $0x0,%al
call   1030 <peek@plt>
movsbl %al,%eax
cmp    $0x2d,%eax
jne    11e2 <factor+0xa2>
mov    $0x0,%al
call   1060 <get@plt>
mov    $0x0,%al
call   1040 <expression@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    11f3 <factor+0xb3>
jmp    11e7 <factor+0xa7>
jmp    11ec <factor+0xac>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<factor>:
push   %rbx
xor    %eax,%eax
call   1030 <peek@plt>
cmp    $0x30,%al
jl     115f <factor+0x1f>
xor    %eax,%eax
call   1030 <peek@plt>
cmp    $0x39,%al
jg     115f <factor+0x1f>
xor    %eax,%eax
pop    %rbx
jmp    1050 <number@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <peek@plt>
cmp    $0x28,%al
jne    1185 <factor+0x45>
xor    %eax,%eax
call   1060 <get@plt>
xor    %eax,%eax
call   1040 <expression@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <get@plt>
jmp    11a2 <factor+0x62>
xor    %eax,%eax
call   1030 <peek@plt>
cmp    $0x2d,%al
jne    11a2 <factor+0x62>
xor    %eax,%eax
call   1060 <get@plt>
xor    %eax,%eax
call   1040 <expression@plt>
mov    %eax,%ebx
neg    %ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @factor() {
%1 = alloca i32
%2 = alloca i32
%3 = call signext i8 (...) @peek()
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 48
br i1 %5, label %6, label %12
6: ; preds = %0
%7 = call signext i8 (...) @peek()
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 57
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = call i32 (...) @number()
store i32 %11, i32* %1
br label %32
12: ; preds = %6, %0
%13 = call signext i8 (...) @peek()
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 40
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = call i32 (...) @get()
%18 = call i32 (...) @expression()
store i32 %18, i32* %2
%19 = call i32 (...) @get()
%20 = load i32, i32* %2
store i32 %20, i32* %1
br label %32
21: ; preds = %12
%22 = call signext i8 (...) @peek()
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 45
br i1 %24, label %25, label %29
25: ; preds = %21
%26 = call i32 (...) @get()
%27 = call i32 (...) @expression()
%28 = sub nsw i32 0, %27
store i32 %28, i32* %1
br label %32
29: ; preds = %21
br label %30
30: ; preds = %29
br label %31
31: ; preds = %30
store i32 0, i32* %1
br label %32
32: ; preds = %31, %25, %16, %10
%33 = load i32, i32* %1
ret i32 %33
}

LLVM IR (-O2):
define i32 @factor() {
%1 = tail call signext i8 (...) @peek()
%2 = icmp sgt i8 %1, 47
br i1 %2, label %3, label %8
3: ; preds = %0
%4 = tail call signext i8 (...) @peek()
%5 = icmp slt i8 %4, 58
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 (...) @number()
br label %22
8: ; preds = %3, %0
%9 = tail call signext i8 (...) @peek()
%10 = icmp eq i8 %9, 40
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = tail call i32 (...) @get()
%13 = tail call i32 (...) @expression()
%14 = tail call i32 (...) @get()
br label %22
15: ; preds = %8
%16 = tail call signext i8 (...) @peek()
%17 = icmp eq i8 %16, 45
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = tail call i32 (...) @get()
%20 = tail call i32 (...) @expression()
%21 = sub nsw i32 0, %20
br label %22
22: ; preds = %15, %18, %11, %6
%23 = phi i32 [ %7, %6 ], [ %13, %11 ], [ %21, %18 ], [ 0, %15 ]
ret i32 %23
}