#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 /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  int done = 0;
  char reply, trash;
  while (!done) {
    printf("Do you want to stop the loop? (y or n) ");
    scanf("%c", &reply);
    scanf("%c", &trash);
    if (reply == 'y')
      done = 1;
  }
  printf("You said to stop, goodbye!");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    114c <main+0x2c>
jmp    1191 <main+0x71>
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
lea    -0x9(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeb9(%rip),%rdi
lea    -0xa(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x9(%rbp),%eax
cmp    $0x79,%eax
jne    118c <main+0x6c>
movl   $0x1,-0x8(%rbp)
jmp    1136 <main+0x16>
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xed1(%rip),%r14
lea    0xef2(%rip),%rbx
lea    0x6(%rsp),%r15
lea    0x7(%rsp),%r12
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
cmpb   $0x79,0x6(%rsp)
jne    1140 <main+0x20>
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [40 x i8] c"Do you want to stop the loop? (y or n) \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [27 x i8] c"You said to stop, goodbye!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
%4 = alloca i8
store i32 0, i32* %1
store i32 0, i32* %2
br label %5
5: ; preds = %17, %0
%6 = load i32, i32* %2
%7 = icmp ne i32 %6, 0
%8 = xor i1 %7, true
br i1 %8, label %9, label %18
9: ; preds = %5
%10 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 121
br i1 %15, label %16, label %17
16: ; preds = %9
store i32 1, i32* %2
br label %17
17: ; preds = %16, %9
br label %5
18: ; preds = %5
%19 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [40 x i8] c"Do you want to stop the loop? (y or n) \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [27 x i8] c"You said to stop, goodbye!\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca i8
br label %3
3: ; preds = %0, %3
%4 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%7 = load i8, i8* %1
%8 = icmp eq i8 %7, 121
br i1 %8, label %9, label %3
9: ; preds = %3
%10 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}