#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;
  printf("Let's test some simple unsigned integer expressions.\n");
  while (response != EOF) {
    char c;
    simpleCalc();
    printf("Would you like to enter another expression (Y/N)?\n");
    while ((c = getchar()) != '\n' && c != EOF) {
    }
    response = getchar();
    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)
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
movsbl -0x5(%rbp),%eax
mov    0x2e92(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11e8 <main+0xb8>
mov    $0x0,%al
call   1050 <simpleCalc@plt>
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x6(%rbp)
movsbl %al,%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x7(%rbp)
je     11a5 <main+0x75>
movsbl -0x6(%rbp),%eax
mov    0x2e4e(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0x7(%rbp)
mov    -0x7(%rbp),%al
test   $0x1,%al
jne    11b5 <main+0x85>
jmp    11ba <main+0x8a>
jmp    1174 <main+0x44>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x6e,%eax
je     11de <main+0xae>
movsbl -0x5(%rbp),%eax
cmp    $0x4e,%eax
jne    11e3 <main+0xb3>
jmp    11e8 <main+0xb8>
jmp    114b <main+0x1b>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <simpleCalc@plt>
lea    0xeea(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e91(%rip),%rbx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
je     116f <main+0x3f>
cmp    (%rbx),%al
jne    1160 <main+0x30>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [54 x i8] c"Let's test some simple unsigned integer expressions.\0A\00"
@EOF = global i8 0
@.str.1 = [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
%4 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %37, %0
%6 = load i8, i8* %2
%7 = sext i8 %6 to i32
%8 = load i8, i8* @EOF
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %7, %9
br i1 %10, label %11, label %38
11: ; preds = %5
%12 = call i32 (...) @simpleCalc()
%13 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %26, %11
%15 = call signext i8 (...) @getchar()
store i8 %15, i8* %3
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 10
br i1 %17, label %18, label %24
18: ; preds = %14
%19 = load i8, i8* %3
%20 = sext i8 %19 to i32
%21 = load i8, i8* @EOF
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %20, %22
br label %24
24: ; preds = %18, %14
%25 = phi i1 [ false, %14 ], [ %23, %18 ]
br i1 %25, label %26, label %27
26: ; preds = %24
br label %14
27: ; preds = %24
%28 = call signext i8 (...) @getchar()
store i8 %28, i8* %2
%29 = load i8, i8* %2
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 110
br i1 %31, label %36, label %32
32: ; preds = %27
%33 = load i8, i8* %2
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 78
br i1 %35, label %36, label %37
36: ; preds = %32, %27
br label %38
37: ; preds = %32
br label %5
38: ; preds = %36, %5
ret i32 0
}

LLVM IR (-O2):
@EOF = global i8 0
@str = [53 x i8] c"Let's test some simple unsigned integer expressions.\00"
@str.2 = [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 ([53 x i8], [53 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @simpleCalc()
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.2, i64 0, i64 0))
br label %4
4: ; preds = %4, %0
%5 = tail call signext i8 (...) @getchar()
%6 = icmp ne i8 %5, 10
%7 = load i8, i8* @EOF
%8 = icmp ne i8 %5, %7
%9 = select i1 %6, i1 %8, i1 false
br i1 %9, label %4, label %10
10: ; preds = %4
%11 = tail call signext i8 (...) @getchar()
ret i32 0
}