#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 *readtty(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ *value(char *);
int yorn(char *msg) {
  char *cp;
  if (value("interactive") == NULL)
    return 1;
  do
    cp = readtty(msg, NULL);
  while (*cp != 'y' && *cp != 'Y' && *cp != 'n' && *cp != 'N');
  return *cp == 'y' || *cp == 'Y';
}


x86 assembly (clang, -O0):
<yorn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <value@plt>
cmp    $0x0,%rax
jne    114e <yorn+0x2e>
movl   $0x1,-0x4(%rbp)
jmp    11ee <yorn+0xce>
jmp    1153 <yorn+0x33>
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <readtty@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x79,%ecx
mov    %al,-0x19(%rbp)
je     11b3 <yorn+0x93>
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x59,%ecx
mov    %al,-0x19(%rbp)
je     11b3 <yorn+0x93>
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x6e,%ecx
mov    %al,-0x19(%rbp)
je     11b3 <yorn+0x93>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x4e,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1153 <yorn+0x33>
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x79,%ecx
mov    %al,-0x1a(%rbp)
je     11e3 <yorn+0xc3>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x59,%eax
sete   %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yorn>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xed2(%rip),%rdi
call   1030 <value@plt>
test   %rax,%rax
je     117a <yorn+0x5a>
movabs $0x80100000801,%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <readtty@plt>
movzbl (%rax),%ecx
lea    -0x4e(%rcx),%eax
cmp    $0x2b,%al
ja     1150 <yorn+0x30>
movzbl %al,%eax
bt     %rax,%r14
jae    1150 <yorn+0x30>
and    $0xdf,%cl
xor    %eax,%eax
cmp    $0x59,%cl
sete   %al
jmp    117f <yorn+0x5f>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [12 x i8] c"interactive\00"
define i32 @yorn(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = call i32* @value(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 1, i32* %2
br label %47
8: ; preds = %1
br label %9
9: ; preds = %32, %8
%10 = load i8*, i8** %3
%11 = call i8* @readtty(i8* %10, i32* null)
store i8* %11, i8** %4
br label %12
12: ; preds = %9
%13 = load i8*, i8** %4
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 121
br i1 %16, label %17, label %32
17: ; preds = %12
%18 = load i8*, i8** %4
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 89
br i1 %21, label %22, label %32
22: ; preds = %17
%23 = load i8*, i8** %4
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp ne i32 %25, 110
br i1 %26, label %27, label %32
27: ; preds = %22
%28 = load i8*, i8** %4
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp ne i32 %30, 78
br label %32
32: ; preds = %27, %22, %17, %12
%33 = phi i1 [ false, %22 ], [ false, %17 ], [ false, %12 ], [ %31, %27 ]
br i1 %33, label %9, label %34
34: ; preds = %32
%35 = load i8*, i8** %4
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 121
br i1 %38, label %44, label %39
39: ; preds = %34
%40 = load i8*, i8** %4
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = icmp eq i32 %42, 89
br label %44
44: ; preds = %39, %34
%45 = phi i1 [ true, %34 ], [ %43, %39 ]
%46 = zext i1 %45 to i32
store i32 %46, i32* %2
br label %47
47: ; preds = %44, %7
%48 = load i32, i32* %2
ret i32 %48
}

LLVM IR (-O2):
@.str = [12 x i8] c"interactive\00"
define i32 @yorn(i8* %0) {
%2 = tail call i32* @value(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = tail call i8* @readtty(i8* %0, i32* null)
%6 = load i8, i8* %5
switch i8 %6, label %4 [
i8 121, label %7
i8 89, label %7
i8 110, label %7
i8 78, label %7
]
7: ; preds = %4, %4, %4, %4
%8 = and i8 %6, -33
%9 = icmp eq i8 %8, 89
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %1, %7
%12 = phi i32 [ %10, %7 ], [ 1, %1 ]
ret i32 %12
}