#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 *, char *);
char rstdin_c();
bool y_or_n_p(char *str) {
  char q;
  do {
    printf("%s (s/n): ", str);
    q = rstdin_c();
  } while (q != 's' && q != 'S' && q != 'n' && q != 'N');
  return (q == 's' || q == 'S') ? true : false;
}


x86 assembly (clang, -O0):
<y_or_n_p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <rstdin_c@plt>
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%ecx
xor    %eax,%eax
cmp    $0x73,%ecx
mov    %al,-0xa(%rbp)
je     1189 <y_or_n_p+0x69>
movsbl -0x9(%rbp),%ecx
xor    %eax,%eax
cmp    $0x53,%ecx
mov    %al,-0xa(%rbp)
je     1189 <y_or_n_p+0x69>
movsbl -0x9(%rbp),%ecx
xor    %eax,%eax
cmp    $0x6e,%ecx
mov    %al,-0xa(%rbp)
je     1189 <y_or_n_p+0x69>
movsbl -0x9(%rbp),%eax
cmp    $0x4e,%eax
setne  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
test   $0x1,%al
jne    112c <y_or_n_p+0xc>
movsbl -0x9(%rbp),%ecx
mov    $0x1,%al
cmp    $0x73,%ecx
mov    %al,-0xb(%rbp)
je     11b3 <y_or_n_p+0x93>
movsbl -0x9(%rbp),%eax
cmp    $0x53,%eax
sete   %al
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<y_or_n_p>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
lea    0xed1(%rip),%r14
movabs $0x2100000021,%r15
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <rstdin_c@plt>
lea    -0x4e(%rax),%ecx
cmp    $0x25,%cl
ja     1140 <y_or_n_p+0x20>
movzbl %cl,%ecx
bt     %rcx,%r15
jae    1140 <y_or_n_p+0x20>
and    $0xdf,%al
xor    %ecx,%ecx
cmp    $0x53,%al
sete   %cl
mov    %ecx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [11 x i8] c"%s (s/n): \00"
define i32 @y_or_n_p(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
store i8* %0, i8** %2
br label %4
4: ; preds = %24, %1
%5 = load i8*, i8** %2
%6 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = call signext i8 (...) @rstdin_c()
store i8 %7, i8* %3
br label %8
8: ; preds = %4
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 115
br i1 %11, label %12, label %24
12: ; preds = %8
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 83
br i1 %15, label %16, label %24
16: ; preds = %12
%17 = load i8, i8* %3
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 110
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load i8, i8* %3
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 78
br label %24
24: ; preds = %20, %16, %12, %8
%25 = phi i1 [ false, %16 ], [ false, %12 ], [ false, %8 ], [ %23, %20 ]
br i1 %25, label %4, label %26
26: ; preds = %24
%27 = load i8, i8* %3
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 115
br i1 %29, label %34, label %30
30: ; preds = %26
%31 = load i8, i8* %3
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 83
br label %34
34: ; preds = %30, %26
%35 = phi i1 [ true, %26 ], [ %33, %30 ]
%36 = zext i1 %35 to i64
%37 = select i1 %35, i32 1, i32 0
ret i32 %37
}

LLVM IR (-O2):
@.str = [11 x i8] c"%s (s/n): \00"
define i32 @y_or_n_p(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call signext i8 (...) @rstdin_c()
switch i8 %4, label %2 [
i8 115, label %5
i8 110, label %5
i8 83, label %5
i8 78, label %5
]
5: ; preds = %2, %2, %2, %2
%6 = and i8 %4, -33
%7 = icmp eq i8 %6, 83
%8 = zext i1 %7 to i32
ret i32 %8
}