#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 */
#define EOF 128
int /*<<< orphan*/ clearerr(int /*<<< orphan*/);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int getchar();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int tolower(int);
void wanttocontinue() {
  int c, t;
  do {
    fprintf(stderr, "*** Do you want to continue? (y/n) ");
    c = getchar();
    switch (c) {
    case EOF:
      clearerr(stdin);
    case '\n':
      continue;
      break;
    default:
      c = tolower(c);
      break;
    }
    while (((t = getchar()) != '\n') && (t != EOF)) {
      c = 0;
    }
    clearerr(stdin);
  } while (c != 'y' && c != 'n');
  if (c == 'n') {
    fprintf(stderr, "\n**** ABORTING TURNIN ****\n");
    exit(0);
  }
  return;
}


x86 assembly (clang, -O0):
<wanttocontinue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
lea    0xe98(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <getchar@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0xa,%eax
je     11ac <wanttocontinue+0x5c>
jmp    118b <wanttocontinue+0x3b>
mov    -0xc(%rbp),%eax
sub    $0x80,%eax
jne    11b1 <wanttocontinue+0x61>
jmp    119e <wanttocontinue+0x4e>
mov    0x2e43(%rip),%rax
mov    (%rax),%edi
call   1050 <clearerr@plt>
jmp    1212 <wanttocontinue+0xc2>
mov    -0x4(%rbp),%edi
call   1060 <tolower@plt>
mov    %eax,-0x4(%rbp)
jmp    11c1 <wanttocontinue+0x71>
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0x8(%rbp)
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0xd(%rbp)
je     11e8 <wanttocontinue+0x98>
cmpl   $0x80,-0x8(%rbp)
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    11f8 <wanttocontinue+0xa8>
jmp    1204 <wanttocontinue+0xb4>
movl   $0x0,-0x4(%rbp)
jmp    11c1 <wanttocontinue+0x71>
mov    0x2ddd(%rip),%rax
mov    (%rax),%edi
call   1050 <clearerr@plt>
xor    %eax,%eax
cmpl   $0x79,-0x4(%rbp)
mov    %al,-0xe(%rbp)
je     122b <wanttocontinue+0xdb>
cmpl   $0x6e,-0x4(%rbp)
setne  %al
mov    %al,-0xe(%rbp)
mov    -0xe(%rbp),%al
test   $0x1,%al
jne    1158 <wanttocontinue+0x8>
cmpl   $0x6e,-0x4(%rbp)
jne    125c <wanttocontinue+0x10c>
mov    0x2d91(%rip),%rax
mov    (%rax),%edi
lea    0xdd4(%rip),%rsi
call   1040 <fprintf@plt>
xor    %edi,%edi
call   1070 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wanttocontinue>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    0x2e79(%rip),%r15
lea    0xe9a(%rip),%r14
mov    0x2e7b(%rip),%r12
nopl   (%rax)
mov    (%r15),%edi
mov    %r14,%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <getchar@plt>
mov    %eax,%ebx
cmp    $0xa,%eax
je     11c0 <wanttocontinue+0x70>
cmp    $0x80,%ebx
je     11b7 <wanttocontinue+0x67>
mov    %ebx,%edi
call   1060 <tolower@plt>
mov    %eax,%ebp
nopw   0x0(%rax,%rax,1)
mov    %ebp,%ebx
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0x80,%eax
je     11b7 <wanttocontinue+0x67>
cmp    $0xa,%eax
jne    11a0 <wanttocontinue+0x50>
mov    (%r12),%edi
call   1050 <clearerr@plt>
cmp    $0x79,%ebx
je     11e0 <wanttocontinue+0x90>
cmp    $0x6e,%ebx
jne    1170 <wanttocontinue+0x20>
mov    (%r15),%edi
lea    0xe50(%rip),%rsi
call   1040 <fprintf@plt>
xor    %edi,%edi
call   1070 <exit@plt>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [36 x i8] c"*** Do you want to continue? (y/n) \00"
@stdin = global i32 0
@.str.1 = [28 x i8] c"\0A**** ABORTING TURNIN ****\0A\00"
define void @wanttocontinue() {
%1 = alloca i32
%2 = alloca i32
br label %3
3: ; preds = %34, %0
%4 = load i32, i32* @stderr
%5 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (...) @getchar()
store i32 %6, i32* %1
%7 = load i32, i32* %1
switch i32 %7, label %12 [
i32 128, label %8
i32 10, label %11
]
8: ; preds = %3
%9 = load i32, i32* @stdin
%10 = call i32 @clearerr(i32 %9)
br label %11
11: ; preds = %3, %8
br label %28
12: ; preds = %3
%13 = load i32, i32* %1
%14 = call i32 @tolower(i32 %13)
store i32 %14, i32* %1
br label %15
15: ; preds = %12
br label %16
16: ; preds = %24, %15
%17 = call i32 (...) @getchar()
store i32 %17, i32* %2
%18 = icmp ne i32 %17, 10
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i32, i32* %2
%21 = icmp ne i32 %20, 128
br label %22
22: ; preds = %19, %16
%23 = phi i1 [ false, %16 ], [ %21, %19 ]
br i1 %23, label %24, label %25
24: ; preds = %22
store i32 0, i32* %1
br label %16
25: ; preds = %22
%26 = load i32, i32* @stdin
%27 = call i32 @clearerr(i32 %26)
br label %28
28: ; preds = %25, %11
%29 = load i32, i32* %1
%30 = icmp ne i32 %29, 121
br i1 %30, label %31, label %34
31: ; preds = %28
%32 = load i32, i32* %1
%33 = icmp ne i32 %32, 110
br label %34
34: ; preds = %31, %28
%35 = phi i1 [ false, %28 ], [ %33, %31 ]
br i1 %35, label %3, label %36
36: ; preds = %34
%37 = load i32, i32* %1
%38 = icmp eq i32 %37, 110
br i1 %38, label %39, label %43
39: ; preds = %36
%40 = load i32, i32* @stderr
%41 = call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%42 = call i32 @exit(i32 0)
unreachable
43: ; preds = %36
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [36 x i8] c"*** Do you want to continue? (y/n) \00"
@stdin = global i32 0
@.str.1 = [28 x i8] c"\0A**** ABORTING TURNIN ****\0A\00"
define void @wanttocontinue() {
br label %1
1: ; preds = %14, %0
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (...) @getchar()
switch i32 %4, label %5 [
i32 128, label %10
i32 10, label %14
]
5: ; preds = %1
%6 = tail call i32 @tolower(i32 %4)
br label %7
7: ; preds = %7, %5
%8 = phi i32 [ %6, %5 ], [ 0, %7 ]
%9 = tail call i32 (...) @getchar()
switch i32 %9, label %7 [
i32 128, label %10
i32 10, label %10
]
10: ; preds = %7, %7, %1
%11 = phi i32 [ %4, %1 ], [ %8, %7 ], [ %8, %7 ]
%12 = load i32, i32* @stdin
%13 = tail call i32 @clearerr(i32 %12)
br label %14
14: ; preds = %10, %1
%15 = phi i32 [ %4, %1 ], [ %11, %10 ]
switch i32 %15, label %1 [
i32 110, label %16
i32 121, label %20
]
16: ; preds = %14
%17 = load i32, i32* @stderr
%18 = tail call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%19 = tail call i32 @exit(i32 0)
unreachable
20: ; preds = %14
ret void
}