#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stdin;
short askBoolQuestion(char *question) {
  int response = -1;
  do {
    printf("%s\n> ", question);
    scanf(" %i", &response);
    fflush(stdin);
    if (response < 0 || response > 1) {
      printf("\t\tERROR: Input must be either a 0 (false) or 1 (true)!\n");
    }
  } while (response < 0 || response > 1);
  return response;
}


x86 assembly (clang, -O0):
<askBoolQuestion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeaa(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
cmpl   $0x0,-0xc(%rbp)
jl     1187 <askBoolQuestion+0x57>
cmpl   $0x1,-0xc(%rbp)
jle    1195 <askBoolQuestion+0x65>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    119a <askBoolQuestion+0x6a>
mov    $0x1,%al
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0xd(%rbp)
jl     11b3 <askBoolQuestion+0x83>
cmpl   $0x1,-0xc(%rbp)
setg   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1143 <askBoolQuestion+0x13>
mov    -0xc(%rbp),%eax
cwtl
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<askBoolQuestion>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
movl   $0xffffffff,0x4(%rsp)
ff
lea    0xea3(%rip),%r14
lea    0xea2(%rip),%r15
lea    0x4(%rsp),%r12
mov    0x2e78(%rip),%rbp
lea    0xe93(%rip),%r13
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1060 <scanf@plt>
mov    0x0(%rbp),%edi
call   1050 <fflush@plt>
mov    0x4(%rsp),%eax
cmp    $0x2,%eax
jb     11ba <askBoolQuestion+0x7a>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%eax
cmp    $0x1,%eax
ja     1180 <askBoolQuestion+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s\0A> \00"
@.str.1 = [4 x i8] c" %i\00"
@stdin = global i32 0
@.str.2 = [56 x i8] c"\09\09ERROR: Input must be either a 0 (false) or 1 (true)!\0A\00"
define signext i16 @askBoolQuestion(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 -1, i32* %3
br label %4
4: ; preds = %24, %1
%5 = load i8*, i8** %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%8 = load i32, i32* @stdin
%9 = call i32 @fflush(i32 %8)
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %4
%13 = load i32, i32* %3
%14 = icmp sgt i32 %13, 1
br i1 %14, label %15, label %17
15: ; preds = %12, %4
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0))
br label %17
17: ; preds = %15, %12
br label %18
18: ; preds = %17
%19 = load i32, i32* %3
%20 = icmp slt i32 %19, 0
br i1 %20, label %24, label %21
21: ; preds = %18
%22 = load i32, i32* %3
%23 = icmp sgt i32 %22, 1
br label %24
24: ; preds = %21, %18
%25 = phi i1 [ true, %18 ], [ %23, %21 ]
br i1 %25, label %4, label %26
26: ; preds = %24
%27 = load i32, i32* %3
%28 = trunc i32 %27 to i16
ret i16 %28
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s\0A> \00"
@.str.1 = [4 x i8] c" %i\00"
@stdin = global i32 0
@str = [55 x i8] c"\09\09ERROR: Input must be either a 0 (false) or 1 (true)!\00"
define signext i16 @askBoolQuestion(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 -1, i32* %2
br label %4
4: ; preds = %11, %1
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0)
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = load i32, i32* @stdin
%8 = call i32 @fflush(i32 %7)
%9 = load i32, i32* %2
%10 = icmp ugt i32 %9, 1
br i1 %10, label %11, label %15
11: ; preds = %4
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str, i64 0, i64 0))
%13 = load i32, i32* %2
%14 = icmp ugt i32 %13, 1
br i1 %14, label %4, label %15
15: ; preds = %4, %11
%16 = phi i32 [ %13, %11 ], [ %9, %4 ]
%17 = trunc i32 %16 to i16
ret i16 %17
}