#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 */
typedef int /*<<< orphan*/ reply;

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int yes(char *prompt) {
  char reply[80], *p;
  for (;;) {
    printf("\33[%d;%dH", (17) + 1, (0) + 1);
    printf(prompt);
    printf("\33[K");
    fflush(stdout);
    if (!fgets(reply, sizeof(reply), stdin))
      continue;
    for (p = reply; *p == ' ' || *p == '\t'; ++p)
      ;
    switch (*p) {
    case 0:
    case 'y':
    case 'Y':
      return (1);
    case 'n':
    case 'N':
    case 'q':
    case 'Q':
      return (0);
    }
  }
}


x86 assembly (clang, -O0):
<yes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xebd(%rip),%rdi
mov    $0x12,%esi
mov    $0x1,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e64(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
lea    -0x60(%rbp),%rdi
mov    0x2e62(%rip),%rax
mov    (%rax),%edx
mov    $0x50,%esi
call   1040 <fgets@plt>
cmp    $0x0,%eax
jne    11a0 <yes+0x70>
jmp    113c <yes+0xc>
lea    -0x60(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x69(%rbp)
je     11cd <yes+0x9d>
mov    -0x68(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x69(%rbp)
mov    -0x69(%rbp),%al
test   $0x1,%al
jne    11dd <yes+0xad>
jmp    11f3 <yes+0xc3>
jmp    11e2 <yes+0xb2>
mov    -0x68(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x68(%rbp)
jmp    11a8 <yes+0x78>
mov    -0x68(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x70(%rbp)
test   %eax,%eax
je     1270 <yes+0x140>
jmp    120a <yes+0xda>
mov    -0x70(%rbp),%eax
sub    $0x4e,%eax
je     127c <yes+0x14c>
jmp    121b <yes+0xeb>
mov    -0x70(%rbp),%eax
sub    $0x51,%eax
je     127c <yes+0x14c>
jmp    122c <yes+0xfc>
mov    -0x70(%rbp),%eax
sub    $0x59,%eax
je     1270 <yes+0x140>
jmp    123d <yes+0x10d>
mov    -0x70(%rbp),%eax
sub    $0x6e,%eax
je     127c <yes+0x14c>
jmp    124e <yes+0x11e>
mov    -0x70(%rbp),%eax
sub    $0x71,%eax
je     127c <yes+0x14c>
jmp    125f <yes+0x12f>
mov    -0x70(%rbp),%eax
sub    $0x79,%eax
jne    1288 <yes+0x158>
jmp    1270 <yes+0x140>
movl   $0x1,-0x4(%rbp)
jmp    128d <yes+0x15d>
movl   $0x0,-0x4(%rbp)
jmp    128d <yes+0x15d>
jmp    113c <yes+0xc>
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yes>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rdi,%rbx
lea    0xeb8(%rip),%r14
lea    0xeba(%rip),%r15
mov    0x2e82(%rip),%r13
mov    0x2e8b(%rip),%rbp
mov    %rsp,%r12
jmp    1178 <yes+0x48>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
test   %eax,%eax
je     120c <yes+0xdc>
mov    %r14,%rdi
mov    $0x12,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x0(%r13),%edi
call   1050 <fflush@plt>
mov    0x0(%rbp),%edx
mov    %r12,%rdi
mov    $0x50,%esi
call   1040 <fgets@plt>
test   %eax,%eax
je     1178 <yes+0x48>
mov    %r12,%rcx
jmp    11d4 <yes+0xa4>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rcx
movsbl (%rcx),%eax
cmp    $0x20,%eax
je     11d0 <yes+0xa0>
cmp    $0x9,%al
je     11d0 <yes+0xa0>
lea    -0x4e(%rax),%ecx
cmp    $0x2b,%ecx
ja     1170 <yes+0x40>
movabs $0x900000009,%rdx
bt     %rcx,%rdx
jb     1213 <yes+0xe3>
movabs $0x80000000800,%rdx
bt     %rcx,%rdx
jae    1170 <yes+0x40>
mov    $0x1,%eax
jmp    1215 <yes+0xe5>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"\1B[%d;%dH\00"
@.str.1 = [4 x i8] c"\1B[K\00"
@stdout = global i32 0
@stdin = global i32 0
define i32 @yes(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [80 x i8]
%5 = alloca i8*
store i8* %0, i8** %3
br label %6
6: ; preds = %42, %17, %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 18, i32 1)
%8 = load i8*, i8** %3
%9 = call i32 (i8*, ...) @printf(i8* %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32, i32* @stdout
%12 = call i32 @fflush(i32 %11)
%13 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%14 = load i32, i32* @stdin
%15 = call i32 @fgets(i8* %13, i32 80, i32 %14)
%16 = icmp ne i32 %15, 0
br i1 %16, label %18, label %17
17: ; preds = %6
br label %6
18: ; preds = %6
%19 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
store i8* %19, i8** %5
br label %20
20: ; preds = %33, %18
%21 = load i8*, i8** %5
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 32
br i1 %24, label %30, label %25
25: ; preds = %20
%26 = load i8*, i8** %5
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 9
br label %30
30: ; preds = %25, %20
%31 = phi i1 [ true, %20 ], [ %29, %25 ]
br i1 %31, label %32, label %36
32: ; preds = %30
br label %33
33: ; preds = %32
%34 = load i8*, i8** %5
%35 = getelementptr inbounds i8, i8* %34, i32 1
store i8* %35, i8** %5
br label %20
36: ; preds = %30
%37 = load i8*, i8** %5
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
switch i32 %39, label %42 [
i32 0, label %40
i32 121, label %40
i32 89, label %40
i32 110, label %41
i32 78, label %41
i32 113, label %41
i32 81, label %41
]
40: ; preds = %36, %36, %36
store i32 1, i32* %2
br label %43
41: ; preds = %36, %36, %36, %36
store i32 0, i32* %2
br label %43
42: ; preds = %36
br label %6
43: ; preds = %41, %40
%44 = load i32, i32* %2
ret i32 %44
}

LLVM IR (-O2):
@.str = [9 x i8] c"\1B[%d;%dH\00"
@.str.1 = [4 x i8] c"\1B[K\00"
@stdout = global i32 0
@stdin = global i32 0
define i32 @yes(i8* nocapture %0) {
%2 = alloca [80 x i8]
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
br label %4
4: ; preds = %13, %1
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 18, i32 1)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %0)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32, i32* @stdout
%9 = call i32 @fflush(i32 %8)
%10 = load i32, i32* @stdin
%11 = call i32 @fgets(i8* %3, i32 80, i32 %10)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %4, %19
br label %4
14: ; preds = %4, %17
%15 = phi i8* [ %18, %17 ], [ %3, %4 ]
%16 = load i8, i8* %15
switch i8 %16, label %19 [
i8 32, label %17
i8 9, label %17
]
17: ; preds = %14, %14
%18 = getelementptr inbounds i8, i8* %15, i64 1
br label %14
19: ; preds = %14
%20 = sext i8 %16 to i32
switch i32 %20, label %13 [
i32 0, label %21
i32 121, label %21
i32 89, label %21
i32 110, label %22
i32 78, label %22
i32 113, label %22
i32 81, label %22
]
21: ; preds = %19, %19, %19
br label %22
22: ; preds = %19, %19, %19, %19, %21
%23 = phi i32 [ 1, %21 ], [ 0, %19 ], [ 0, %19 ], [ 0, %19 ], [ 0, %19 ]
ret i32 %23
}