#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 charInput();
int /*<<< orphan*/ lineBreak();
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ puts(char *);
int inputYesOrNo(char *customMessage) {
  char attempt;
  int attemptResult;
  do {
    printf("%s ", customMessage);
    attempt = charInput();
    attemptResult = ((attempt == 'N') || (attempt == 'n') || (attempt == 'Y') ||
                     (attempt == 'y'));
    if (attemptResult != 1) {
      puts("");
      puts("Incorrect input detected. Please enter 'Y' or 'N'.");
      lineBreak();
    }
  } while (attemptResult != 1);
  return ((attempt == 'Y') || (attempt == 'y'));
}


x86 assembly (clang, -O0):
<inputYesOrNo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xea9(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <charInput@plt>
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%ecx
mov    $0x1,%al
cmp    $0x4e,%ecx
mov    %al,-0x11(%rbp)
je     11a9 <inputYesOrNo+0x69>
movsbl -0x9(%rbp),%ecx
mov    $0x1,%al
cmp    $0x6e,%ecx
mov    %al,-0x11(%rbp)
je     11a9 <inputYesOrNo+0x69>
movsbl -0x9(%rbp),%ecx
mov    $0x1,%al
cmp    $0x59,%ecx
mov    %al,-0x11(%rbp)
je     11a9 <inputYesOrNo+0x69>
movsbl -0x9(%rbp),%eax
cmp    $0x79,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
je     11dd <inputYesOrNo+0x9d>
lea    0xe3e(%rip),%rdi
call   1030 <puts@plt>
lea    0xe33(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1050 <lineBreak@plt>
jmp    11e2 <inputYesOrNo+0xa2>
cmpl   $0x1,-0x10(%rbp)
jne    114c <inputYesOrNo+0xc>
movsbl -0x9(%rbp),%ecx
mov    $0x1,%al
cmp    $0x59,%ecx
mov    %al,-0x12(%rbp)
je     120b <inputYesOrNo+0xcb>
movsbl -0x9(%rbp),%eax
cmp    $0x79,%eax
sete   %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inputYesOrNo>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xe9e(%rip),%r14
lea    0xe9b(%rip),%r15
movabs $0x80100000801,%r12
jmp    1199 <inputYesOrNo+0x49>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1060 <lineBreak@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
xor    %eax,%eax
call   1070 <charInput@plt>
lea    -0x4e(%rax),%ecx
cmp    $0x2b,%cl
ja     1180 <inputYesOrNo+0x30>
movzbl %cl,%ecx
bt     %rcx,%r12
jae    1180 <inputYesOrNo+0x30>
and    $0xdf,%al
xor    %ecx,%ecx
cmp    $0x59,%al
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s \00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [51 x i8] c"Incorrect input detected. Please enter 'Y' or 'N'.\00"
define i32 @inputYesOrNo(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i32
store i8* %0, i8** %2
br label %5
5: ; preds = %34, %1
%6 = load i8*, i8** %2
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = call signext i8 (...) @charInput()
store i8 %8, i8* %3
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 78
br i1 %11, label %24, label %12
12: ; preds = %5
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 110
br i1 %15, label %24, label %16
16: ; preds = %12
%17 = load i8, i8* %3
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 89
br i1 %19, label %24, label %20
20: ; preds = %16
%21 = load i8, i8* %3
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 121
br label %24
24: ; preds = %20, %16, %12, %5
%25 = phi i1 [ true, %16 ], [ true, %12 ], [ true, %5 ], [ %23, %20 ]
%26 = zext i1 %25 to i32
store i32 %26, i32* %4
%27 = load i32, i32* %4
%28 = icmp ne i32 %27, 1
br i1 %28, label %29, label %33
29: ; preds = %24
%30 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%31 = call i32 @puts(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0))
%32 = call i32 (...) @lineBreak()
br label %33
33: ; preds = %29, %24
br label %34
34: ; preds = %33
%35 = load i32, i32* %4
%36 = icmp ne i32 %35, 1
br i1 %36, label %5, label %37
37: ; preds = %34
%38 = load i8, i8* %3
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 89
br i1 %40, label %45, label %41
41: ; preds = %37
%42 = load i8, i8* %3
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 121
br label %45
45: ; preds = %41, %37
%46 = phi i1 [ true, %37 ], [ %44, %41 ]
%47 = zext i1 %46 to i32
ret i32 %47
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s \00"
@.str.2 = [51 x i8] c"Incorrect input detected. Please enter 'Y' or 'N'.\00"
define i32 @inputYesOrNo(i8* %0) {
br label %2
2: ; preds = %5, %1
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call signext i8 (...) @charInput()
switch i8 %4, label %5 [
i8 110, label %9
i8 89, label %9
i8 78, label %9
i8 121, label %9
]
5: ; preds = %2
%6 = tail call i32 @putchar(i32 10)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 (...) @lineBreak()
br label %2
9: ; preds = %2, %2, %2, %2
%10 = and i8 %4, -33
%11 = icmp eq i8 %10, 89
%12 = zext i1 %11 to i32
ret i32 %12
}