#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 */
char EOF;
char getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ simpleCalc();
int main() {
  char response = 0;
  printf("Let's test some expressions.\n");
  while (response != '\n' || response != EOF) {
    printf("Please enter an expression: ");
    simpleCalc();
    printf("Would you like to enter another expression (Y/N)?\n");
    response = getchar();
    if (response != 'n' || response != 'N') {
      char c;
      while ((c = getchar()) != '\n' && c != EOF) {
      }
    }
    if (response == 'n' || response == 'N')
      break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
movsbl -0x5(%rbp),%ecx
mov    $0x1,%al
cmp    $0xa,%ecx
mov    %al,-0x7(%rbp)
jne    1177 <main+0x47>
movsbl -0x5(%rbp),%eax
mov    0x2e7c(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0x7(%rbp)
mov    -0x7(%rbp),%al
test   $0x1,%al
jne    1187 <main+0x57>
jmp    123e <main+0x10e>
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <simpleCalc@plt>
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x6e,%eax
jne    11ca <main+0x9a>
movsbl -0x5(%rbp),%eax
cmp    $0x4e,%eax
je     121a <main+0xea>
jmp    11cf <main+0x9f>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x6(%rbp)
movsbl %al,%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x8(%rbp)
je     1200 <main+0xd0>
movsbl -0x6(%rbp),%eax
mov    0x2df3(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0x8(%rbp)
mov    -0x8(%rbp),%al
test   $0x1,%al
jne    1210 <main+0xe0>
jmp    1215 <main+0xe5>
jmp    11cf <main+0x9f>
jmp    121a <main+0xea>
movsbl -0x5(%rbp),%eax
cmp    $0x6e,%eax
je     1234 <main+0x104>
movsbl -0x5(%rbp),%eax
cmp    $0x4e,%eax
jne    1239 <main+0x109>
jmp    123e <main+0x10e>
jmp    114f <main+0x1f>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xecf(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e8e(%rip),%rbx
mov    (%rbx),%cl
lea    0xe9d(%rip),%r14
lea    0xed0(%rip),%r15
xor    %ebp,%ebp
jmp    1178 <main+0x38>
xchg   %ax,%ax
mov    %ebp,%eax
and    $0xdf,%al
cmp    $0x4e,%al
je     11c4 <main+0x84>
cmp    $0xa,%bpl
jne    1183 <main+0x43>
cmp    $0xa,%cl
je     11c4 <main+0x84>
mov    %r14,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <simpleCalc@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1050 <getchar@plt>
movzbl (%rbx),%ecx
cmp    $0xa,%al
je     1170 <main+0x30>
cmp    %cl,%al
jne    11b0 <main+0x70>
jmp    1170 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Let's test some expressions.\0A\00"
@EOF = global i8 0
@.str.1 = [29 x i8] c"Please enter an expression: \00"
@.str.2 = [51 x i8] c"Would you like to enter another expression (Y/N)?\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
store i32 0, i32* %1
store i8 0, i8* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %53, %0
%6 = load i8, i8* %2
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %7, 10
br i1 %8, label %15, label %9
9: ; preds = %5
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
%12 = load i8, i8* @EOF
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %11, %13
br label %15
15: ; preds = %9, %5
%16 = phi i1 [ true, %5 ], [ %14, %9 ]
br i1 %16, label %17, label %54
17: ; preds = %15
%18 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%19 = call i32 (...) @simpleCalc()
%20 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0))
%21 = call signext i8 (...) @getchar()
store i8 %21, i8* %2
%22 = load i8, i8* %2
%23 = sext i8 %22 to i32
%24 = icmp ne i32 %23, 110
br i1 %24, label %29, label %25
25: ; preds = %17
%26 = load i8, i8* %2
%27 = sext i8 %26 to i32
%28 = icmp ne i32 %27, 78
br i1 %28, label %29, label %44
29: ; preds = %25, %17
br label %30
30: ; preds = %42, %29
%31 = call signext i8 (...) @getchar()
store i8 %31, i8* %3
%32 = sext i8 %31 to i32
%33 = icmp ne i32 %32, 10
br i1 %33, label %34, label %40
34: ; preds = %30
%35 = load i8, i8* %3
%36 = sext i8 %35 to i32
%37 = load i8, i8* @EOF
%38 = sext i8 %37 to i32
%39 = icmp ne i32 %36, %38
br label %40
40: ; preds = %34, %30
%41 = phi i1 [ false, %30 ], [ %39, %34 ]
br i1 %41, label %42, label %43
42: ; preds = %40
br label %30
43: ; preds = %40
br label %44
44: ; preds = %43, %25
%45 = load i8, i8* %2
%46 = sext i8 %45 to i32
%47 = icmp eq i32 %46, 110
br i1 %47, label %52, label %48
48: ; preds = %44
%49 = load i8, i8* %2
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 78
br i1 %51, label %52, label %53
52: ; preds = %48, %44
br label %54
53: ; preds = %48
br label %5
54: ; preds = %52, %15
ret i32 0
}

LLVM IR (-O2):
@EOF = global i8 0
@.str.1 = [29 x i8] c"Please enter an expression: \00"
@str = [29 x i8] c"Let's test some expressions.\00"
@str.3 = [50 x i8] c"Would you like to enter another expression (Y/N)?\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%2 = load i8, i8* @EOF
br label %3
3: ; preds = %20, %0
%4 = phi i8 [ %2, %0 ], [ %17, %20 ]
%5 = phi i8 [ 0, %0 ], [ %13, %20 ]
%6 = icmp ne i8 %5, 10
%7 = icmp ne i8 %4, 10
%8 = select i1 %6, i1 true, i1 %7
br i1 %8, label %9, label %23
9: ; preds = %3
%10 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%11 = tail call i32 (...) @simpleCalc()
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.3, i64 0, i64 0))
%13 = tail call signext i8 (...) @getchar()
br label %14
14: ; preds = %14, %9
%15 = tail call signext i8 (...) @getchar()
%16 = icmp ne i8 %15, 10
%17 = load i8, i8* @EOF
%18 = icmp ne i8 %15, %17
%19 = select i1 %16, i1 %18, i1 false
br i1 %19, label %14, label %20
20: ; preds = %14
%21 = and i8 %13, -33
%22 = icmp eq i8 %21, 78
br i1 %22, label %23, label %3
23: ; preds = %20, %3
ret i32 0
}