#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*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
scalar_t__ isupper(char);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
char tolower(char);
int yes_noerror(void) {
  static char buf[16];
  fflush(stdout);
  do {
    if (fgets(buf, 15, stdin) == NULL)
      exit(1);
    if (isupper(*buf))
      *buf = tolower(*buf);
  } while (*buf != 'n' && *buf != 'y');
  return (*buf == 'y') ? 1 : 0;
}


x86 assembly (clang, -O0):
<yes_noerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edx
lea    0x2eea(%rip),%rdi
mov    $0xf,%esi
call   1030 <fgets@plt>
cmp    $0x0,%rax
jne    1194 <yes_noerror+0x44>
mov    $0x1,%edi
call   1070 <exit@plt>
movsbl 0x2ec5(%rip),%edi
call   1060 <isupper@plt>
cmp    $0x0,%rax
je     11bc <yes_noerror+0x6c>
movsbl 0x2eaf(%rip),%edi
call   1040 <tolower@plt>
mov    %al,0x2ea4(%rip)
jmp    11c1 <yes_noerror+0x71>
movsbl 0x2e98(%rip),%ecx
xor    %eax,%eax
cmp    $0x6e,%ecx
mov    %al,-0x1(%rbp)
je     11e6 <yes_noerror+0x96>
movsbl 0x2e83(%rip),%eax
cmp    $0x79,%eax
setne  %al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
test   $0x1,%al
jne    1166 <yes_noerror+0x16>
movsbl 0x2e68(%rip),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x79,%edx
cmove  %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yes_noerror>:
push   %r14
push   %rbx
push   %rax
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    0x2e7f(%rip),%r14
lea    0x2ef0(%rip),%rbx
mov    (%r14),%edx
mov    %rbx,%rdi
mov    $0xf,%esi
call   1030 <fgets@plt>
test   %rax,%rax
je     11c7 <yes_noerror+0x77>
movsbl 0x2ed4(%rip),%edi
call   1060 <isupper@plt>
mov    %rax,%rcx
movzbl 0x2ec5(%rip),%eax
test   %rcx,%rcx
je     11ae <yes_noerror+0x5e>
movsbl %al,%edi
call   1040 <tolower@plt>
mov    %al,0x2eb2(%rip)
cmp    $0x79,%al
je     11b6 <yes_noerror+0x66>
cmp    $0x6e,%al
jne    1170 <yes_noerror+0x20>
xor    %ecx,%ecx
cmp    $0x79,%al
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@yes_noerror.buf = internal global [16 x i8] zeroinitializer
@stdout = global i32 0
@stdin = global i32 0
define i32 @yes_noerror() {
%1 = load i32, i32* @stdout
%2 = call i32 @fflush(i32 %1)
br label %3
3: ; preds = %25, %0
%4 = load i32, i32* @stdin
%5 = call i32* @fgets(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @yes_noerror.buf, i64 0, i64 0), i32 15, i32 %4)
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = call i32 @exit(i32 1)
unreachable
9: ; preds = %3
%10 = load i8, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @yes_noerror.buf, i64 0, i64 0)
%11 = call i64 @isupper(i8 signext %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = load i8, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @yes_noerror.buf, i64 0, i64 0)
%15 = call signext i8 @tolower(i8 signext %14)
store i8 %15, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @yes_noerror.buf, i64 0, i64 0)
br label %16
16: ; preds = %13, %9
br label %17
17: ; preds = %16
%18 = load i8, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @yes_noerror.buf, i64 0, i64 0)
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 110
br i1 %20, label %21, label %25
21: ; preds = %17
%22 = load i8, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @yes_noerror.buf, i64 0, i64 0)
%23 = sext i8 %22 to i32
%24 = icmp ne i32 %23, 121
br label %25
25: ; preds = %21, %17
%26 = phi i1 [ false, %17 ], [ %24, %21 ]
br i1 %26, label %3, label %27
27: ; preds = %25
%28 = load i8, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @yes_noerror.buf, i64 0, i64 0)
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 121
%31 = zext i1 %30 to i64
%32 = select i1 %30, i32 1, i32 0
ret i32 %32
}

LLVM IR (-O2):
@yes_noerror.buf = internal global [16 x i8] zeroinitializer
@stdout = global i32 0
@stdin = global i32 0
define i32 @yes_noerror() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fflush(i32 %1)
br label %3
3: ; preds = %16, %0
%4 = load i32, i32* @stdin
%5 = tail call i32* @fgets(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @yes_noerror.buf, i64 0, i64 0), i32 15, i32 %4)
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %3
%10 = load i8, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @yes_noerror.buf, i64 0, i64 0)
%11 = tail call i64 @isupper(i8 signext %10)
%12 = icmp eq i64 %11, 0
%13 = load i8, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @yes_noerror.buf, i64 0, i64 0)
br i1 %12, label %16, label %14
14: ; preds = %9
%15 = tail call signext i8 @tolower(i8 signext %13)
store i8 %15, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @yes_noerror.buf, i64 0, i64 0)
br label %16
16: ; preds = %9, %14
%17 = phi i8 [ %15, %14 ], [ %13, %9 ]
switch i8 %17, label %3 [
i8 121, label %18
i8 110, label %18
]
18: ; preds = %16, %16
%19 = icmp eq i8 %17, 121
%20 = zext i1 %19 to i32
ret i32 %20
}