#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() {
  char a = 'A';
  while (1) {
    printf("(Y)es, (N)o or (Q)uit\n");
    printf("Enter choice: ");
    scanf("%c", &a);
    if (a == 'q' || a == 'Q') {
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x41,-0x5(%rbp)
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x71,%eax
je     1175 <main+0x55>
movsbl -0x5(%rbp),%eax
cmp    $0x51,%eax
jne    117a <main+0x5a>
jmp    117f <main+0x5f>
jmp    1133 <main+0x13>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movb   $0x41,0x7(%rsp)
lea    0xece(%rip),%r14
lea    0xeb5(%rip),%r15
lea    0xebd(%rip),%r12
lea    0x7(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
movzbl 0x7(%rsp),%eax
and    $0xdf,%al
cmp    $0x51,%al
jne    1160 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [23 x i8] c"(Y)es, (N)o or (Q)uit\0A\00"
@.str.1 = [15 x i8] c"Enter choice: \00"
@.str.2 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
store i8 65, i8* %2
br label %3
3: ; preds = %0, %15
%4 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 113
br i1 %9, label %14, label %10
10: ; preds = %3
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 81
br i1 %13, label %14, label %15
14: ; preds = %10, %3
br label %16
15: ; preds = %10
br label %3
16: ; preds = %14
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [15 x i8] c"Enter choice: \00"
@.str.2 = [3 x i8] c"%c\00"
@str = [22 x i8] c"(Y)es, (N)o or (Q)uit\00"
define i32 @main() {
%1 = alloca i8
store i8 65, i8* %1
br label %2
2: ; preds = %2, %0
%3 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%4 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %1)
%6 = load i8, i8* %1
%7 = and i8 %6, -33
%8 = icmp eq i8 %7, 81
br i1 %8, label %9, label %2
9: ; preds = %2
ret i32 0
}