#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 lower(char);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *, char *);
char getYesNo(void) {
  char response, enter;
  do {
    printf("Enter Y)es or N)o: ");
    scanf("%c%c", &response, &enter);
    response = lower(response);
  } while (response != 'y' && response != 'n');
  return response;
}


x86 assembly (clang, -O0):
<getYesNo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
lea    -0x1(%rbp),%rsi
lea    -0x2(%rbp),%rdx
call   1040 <scanf@plt>
movsbl -0x1(%rbp),%edi
call   1050 <lower@plt>
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x79,%ecx
mov    %al,-0x3(%rbp)
je     1183 <getYesNo+0x53>
movsbl -0x1(%rbp),%eax
cmp    $0x6e,%eax
setne  %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
test   $0x1,%al
jne    1138 <getYesNo+0x8>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getYesNo>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xec1(%rip),%r14
lea    0xece(%rip),%r15
lea    0x6(%rsp),%r12
lea    0x7(%rsp),%rbx
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1040 <scanf@plt>
movsbl 0x6(%rsp),%edi
call   1050 <lower@plt>
mov    %al,0x6(%rsp)
cmp    $0x79,%al
je     117c <getYesNo+0x4c>
cmp    $0x6e,%al
jne    1150 <getYesNo+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Enter Y)es or N)o: \00"
@.str.1 = [5 x i8] c"%c%c\00"
define signext i8 @getYesNo() {
%1 = alloca i8
%2 = alloca i8
br label %3
3: ; preds = %16, %0
%4 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %1, i8* %2)
%6 = load i8, i8* %1
%7 = call signext i8 @lower(i8 signext %6)
store i8 %7, i8* %1
br label %8
8: ; preds = %3
%9 = load i8, i8* %1
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 121
br i1 %11, label %12, label %16
12: ; preds = %8
%13 = load i8, i8* %1
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 110
br label %16
16: ; preds = %12, %8
%17 = phi i1 [ false, %8 ], [ %15, %12 ]
br i1 %17, label %3, label %18
18: ; preds = %16
%19 = load i8, i8* %1
ret i8 %19
}

LLVM IR (-O2):
@.str = [20 x i8] c"Enter Y)es or N)o: \00"
@.str.1 = [5 x i8] c"%c%c\00"
define signext i8 @getYesNo() {
%1 = alloca i8
%2 = alloca i8
br label %3
3: ; preds = %3, %0
%4 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %1, i8* %2)
%6 = load i8, i8* %1
%7 = call signext i8 @lower(i8 signext %6)
store i8 %7, i8* %1
switch i8 %7, label %3 [
i8 121, label %8
i8 110, label %8
]
8: ; preds = %3, %3
ret i8 %7
}