#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 fgetc(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
char *gettext(char *);
int /*<<< orphan*/ purge();
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
unsigned char ask_continue(void) {
  int continuing = 'y';
  do {
    fprintf(stdout, gettext("Do you want to continue ? [Y/n] "));
    continuing = fgetc(stdin);
    purge();
  } while ((continuing != 'y') && (continuing != 'Y') && (continuing != 'n') &&
           (continuing != 'N') && (continuing != '\n'));
  return (((continuing == 'y') || (continuing == 'Y' || continuing == '\n'))
              ? 1
              : 0);
}


x86 assembly (clang, -O0):
<ask_continue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x79,-0x4(%rbp)
mov    0x2e82(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
lea    0xe9e(%rip),%rdi
call   1030 <gettext@plt>
mov    -0x8(%rbp),%edi
mov    %rax,%rsi
call   1060 <fprintf@plt>
mov    0x2e6f(%rip),%rax
mov    (%rax),%edi
call   1040 <fgetc@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1050 <purge@plt>
xor    %eax,%eax
cmpl   $0x79,-0x4(%rbp)
mov    %al,-0x9(%rbp)
je     11d0 <ask_continue+0x90>
xor    %eax,%eax
cmpl   $0x59,-0x4(%rbp)
mov    %al,-0x9(%rbp)
je     11d0 <ask_continue+0x90>
xor    %eax,%eax
cmpl   $0x6e,-0x4(%rbp)
mov    %al,-0x9(%rbp)
je     11d0 <ask_continue+0x90>
xor    %eax,%eax
cmpl   $0x4e,-0x4(%rbp)
mov    %al,-0x9(%rbp)
je     11d0 <ask_continue+0x90>
cmpl   $0xa,-0x4(%rbp)
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    114f <ask_continue+0xf>
mov    $0x1,%al
cmpl   $0x79,-0x4(%rbp)
mov    %al,-0xa(%rbp)
je     1209 <ask_continue+0xc9>
mov    $0x1,%al
cmpl   $0x59,-0x4(%rbp)
mov    %al,-0xb(%rbp)
je     1203 <ask_continue+0xc3>
cmpl   $0xa,-0x4(%rbp)
sete   %al
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ask_continue>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    0x2e8a(%rip),%r14
lea    0xeab(%rip),%r15
mov    0x2e8c(%rip),%rbx
nopl   0x0(%rax)
mov    (%r14),%ebp
mov    %r15,%rdi
call   1030 <gettext@plt>
mov    %ebp,%edi
mov    %rax,%rsi
call   1060 <fprintf@plt>
mov    (%rbx),%edi
call   1040 <fgetc@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1050 <purge@plt>
cmp    $0x58,%ebp
jle    11a0 <ask_continue+0x60>
cmp    $0x59,%ebp
je     11aa <ask_continue+0x6a>
cmp    $0x79,%ebp
je     11ba <ask_continue+0x7a>
cmp    $0x6e,%ebp
jne    1160 <ask_continue+0x20>
jmp    11aa <ask_continue+0x6a>
nopl   0x0(%rax,%rax,1)
cmp    $0xa,%ebp
je     11aa <ask_continue+0x6a>
cmp    $0x4e,%ebp
jne    1160 <ask_continue+0x20>
cmp    $0x59,%ebp
sete   %cl
cmp    $0xa,%ebp
sete   %al
or     %cl,%al
jmp    11bc <ask_continue+0x7c>
mov    $0x1,%al
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [33 x i8] c"Do you want to continue ? [Y/n] \00"
@stdin = global i32 0
define zeroext i8 @ask_continue() {
%1 = alloca i32
store i32 121, i32* %1
br label %2
2: ; preds = %24, %0
%3 = load i32, i32* @stdout
%4 = call i8* @gettext(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @fprintf(i32 %3, i8* %4)
%6 = load i32, i32* @stdin
%7 = call i32 @fgetc(i32 %6)
store i32 %7, i32* %1
%8 = call i32 (...) @purge()
br label %9
9: ; preds = %2
%10 = load i32, i32* %1
%11 = icmp ne i32 %10, 121
br i1 %11, label %12, label %24
12: ; preds = %9
%13 = load i32, i32* %1
%14 = icmp ne i32 %13, 89
br i1 %14, label %15, label %24
15: ; preds = %12
%16 = load i32, i32* %1
%17 = icmp ne i32 %16, 110
br i1 %17, label %18, label %24
18: ; preds = %15
%19 = load i32, i32* %1
%20 = icmp ne i32 %19, 78
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = load i32, i32* %1
%23 = icmp ne i32 %22, 10
br label %24
24: ; preds = %21, %18, %15, %12, %9
%25 = phi i1 [ false, %18 ], [ false, %15 ], [ false, %12 ], [ false, %9 ], [ %23, %21 ]
br i1 %25, label %2, label %26
26: ; preds = %24
%27 = load i32, i32* %1
%28 = icmp eq i32 %27, 121
br i1 %28, label %37, label %29
29: ; preds = %26
%30 = load i32, i32* %1
%31 = icmp eq i32 %30, 89
br i1 %31, label %35, label %32
32: ; preds = %29
%33 = load i32, i32* %1
%34 = icmp eq i32 %33, 10
br label %35
35: ; preds = %32, %29
%36 = phi i1 [ true, %29 ], [ %34, %32 ]
br label %37
37: ; preds = %35, %26
%38 = phi i1 [ true, %26 ], [ %36, %35 ]
%39 = zext i1 %38 to i64
%40 = select i1 %38, i32 1, i32 0
%41 = trunc i32 %40 to i8
ret i8 %41
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [33 x i8] c"Do you want to continue ? [Y/n] \00"
@stdin = global i32 0
define zeroext i8 @ask_continue() {
br label %1
1: ; preds = %1, %0
%2 = load i32, i32* @stdout
%3 = tail call i8* @gettext(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @fprintf(i32 %2, i8* %3)
%5 = load i32, i32* @stdin
%6 = tail call i32 @fgetc(i32 %5)
%7 = tail call i32 (...) @purge()
switch i32 %6, label %1 [
i32 121, label %13
i32 10, label %8
i32 78, label %8
i32 89, label %8
i32 110, label %8
]
8: ; preds = %1, %1, %1, %1
%9 = icmp eq i32 %6, 89
%10 = icmp eq i32 %6, 10
%11 = or i1 %9, %10
%12 = zext i1 %11 to i8
br label %13
13: ; preds = %1, %8
%14 = phi i8 [ %12, %8 ], [ 1, %1 ]
ret i8 %14
}