#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 getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int num;
  char reply, trash;
  do {
    printf("Enter a number -- ");
    scanf("%d", &num);
    printf("The number was %d\n", num);
    do {
      trash = getchar();
    } while (trash != '\n');
    printf("Would you like to enter another number? (y or n) ");
    scanf("%c", &reply);
  } while (reply == 'y' || reply == 'Y');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x8(%rbp),%esi
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0xa(%rbp)
movsbl -0xa(%rbp),%eax
cmp    $0xa,%eax
jne    1170 <main+0x40>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
lea    -0x9(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movsbl -0x9(%rbp),%ecx
mov    $0x1,%al
cmp    $0x79,%ecx
mov    %al,-0xb(%rbp)
je     11c6 <main+0x96>
movsbl -0x9(%rbp),%eax
cmp    $0x59,%eax
sete   %al
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%al
test   $0x1,%al
jne    113f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xed1(%rip),%r15
lea    0x4(%rsp),%r12
lea    0xec8(%rip),%r13
lea    0xed4(%rip),%rbx
lea    0xeff(%rip),%rbp
lea    0x3(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xe89(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x4(%rsp),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
jne    11a0 <main+0x70>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x3(%rsp),%al
and    $0xdf,%al
cmp    $0x59,%al
je     1170 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Enter a number -- \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [19 x i8] c"The number was %d\0A\00"
@.str.3 = [50 x i8] c"Would you like to enter another number? (y or n) \00"
@.str.4 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
%4 = alloca i8
store i32 0, i32* %1
br label %5
5: ; preds = %27, %0
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %8)
br label %10
10: ; preds = %12, %5
%11 = call signext i8 (...) @getchar()
store i8 %11, i8* %4
br label %12
12: ; preds = %10
%13 = load i8, i8* %4
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 10
br i1 %15, label %10, label %16
16: ; preds = %12
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %3)
br label %19
19: ; preds = %16
%20 = load i8, i8* %3
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 121
br i1 %22, label %27, label %23
23: ; preds = %19
%24 = load i8, i8* %3
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 89
br label %27
27: ; preds = %23, %19
%28 = phi i1 [ true, %19 ], [ %26, %23 ]
br i1 %28, label %5, label %29
29: ; preds = %27
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Enter a number -- \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [19 x i8] c"The number was %d\0A\00"
@.str.3 = [50 x i8] c"Would you like to enter another number? (y or n) \00"
@.str.4 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = bitcast i32* %1 to i8*
br label %4
4: ; preds = %12, %0
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %9, %4
%10 = call signext i8 (...) @getchar()
%11 = icmp eq i8 %10, 10
br i1 %11, label %12, label %9
12: ; preds = %9
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %2)
%15 = load i8, i8* %2
%16 = and i8 %15, -33
%17 = icmp eq i8 %16, 89
br i1 %17, label %4, label %18
18: ; preds = %12
ret i32 0
}