#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*/ answ;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int read(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int think_positively(char *prompt, int def_answ, char *help) {
  char answ[512];
  int len;
response:
  fprintf(stderr, prompt);
  if (def_answ)
    fprintf(stderr, " [Y/n/?] ");
  else
    fprintf(stderr, " [N/y/?] ");
  if ((len = read(0, answ, sizeof(answ))) < 1) {
    fprintf(stderr, "\n\nERROR! Cannot read stdin\n");
    perror("stdin");
    printf("invalid_configuration__run_make_config_again\n");
    exit(-1);
  }
  if (len < 2)
    return def_answ;
  if (answ[0] == '?') {
    fprintf(stderr, "\n");
    fprintf(stderr, help);
    fprintf(stderr, "\n");
    goto response;
  }
  answ[len - 1] = 0;
  if (!strcmp(answ, "y") || !strcmp(answ, "Y"))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<think_positively>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
call   1060 <fprintf@plt>
cmpl   $0x0,-0x14(%rbp)
je     11ac <think_positively+0x4c>
mov    0x2e47(%rip),%rax
mov    (%rax),%edi
lea    0xe5e(%rip),%rsi
call   1060 <fprintf@plt>
jmp    11c1 <think_positively+0x61>
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
lea    0xe4e(%rip),%rsi
call   1060 <fprintf@plt>
lea    -0x220(%rbp),%rsi
xor    %edi,%edi
mov    $0x200,%edx
call   1040 <read@plt>
mov    %eax,-0x224(%rbp)
cmp    $0x1,%eax
jge    121a <think_positively+0xba>
mov    0x2df6(%rip),%rax
mov    (%rax),%edi
lea    0xe21(%rip),%rsi
call   1060 <fprintf@plt>
lea    0xe31(%rip),%rdi
call   1070 <perror@plt>
lea    0xe2b(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>
cmpl   $0x2,-0x224(%rbp)
jge    1232 <think_positively+0xd2>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12e1 <think_positively+0x181>
movsbl -0x220(%rbp),%eax
cmp    $0x3f,%eax
jne    1283 <think_positively+0x123>
mov    0x2d97(%rip),%rax
mov    (%rax),%edi
lea    0xe10(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2d82(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rsi
call   1060 <fprintf@plt>
mov    0x2d70(%rip),%rax
mov    (%rax),%edi
lea    0xde9(%rip),%rsi
call   1060 <fprintf@plt>
jmp    1176 <think_positively+0x16>
mov    -0x224(%rbp),%eax
sub    $0x1,%eax
cltq
movb   $0x0,-0x220(%rbp,%rax,1)
lea    -0x220(%rbp),%rdi
lea    0xdc0(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
je     12ce <think_positively+0x16e>
lea    -0x220(%rbp),%rdi
lea    0xda6(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    12da <think_positively+0x17a>
movl   $0x1,-0x4(%rbp)
jmp    12e1 <think_positively+0x181>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x230,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<think_positively>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x218,%rsp
mov    %rdx,%r15
mov    %esi,%ebx
mov    %rdi,%r12
mov    0x2e70(%rip),%r14
mov    (%r14),%edi
mov    %r12,%rsi
call   1050 <fprintf@plt>
mov    %ebx,0xc(%rsp)
test   %ebx,%ebx
mov    (%r14),%edi
lea    0xe7f(%rip),%rax
lea    0xe6e(%rip),%rbx
cmove  %rax,%rbx
mov    %rbx,%rsi
call   1050 <fprintf@plt>
lea    0x10(%rsp),%rsi
xor    %edi,%edi
mov    $0x200,%edx
call   1040 <read@plt>
test   %eax,%eax
jle    121e <think_positively+0xce>
lea    0xe74(%rip),%rbp
lea    0x10(%rsp),%r13
nop
cmp    $0x1,%eax
je     124f <think_positively+0xff>
cmpb   $0x3f,0x10(%rsp)
jne    1255 <think_positively+0x105>
mov    (%r14),%edi
mov    %rbp,%rsi
call   1050 <fprintf@plt>
mov    (%r14),%edi
mov    %r15,%rsi
call   1050 <fprintf@plt>
mov    (%r14),%edi
mov    %rbp,%rsi
call   1050 <fprintf@plt>
mov    (%r14),%edi
mov    %r12,%rsi
call   1050 <fprintf@plt>
mov    (%r14),%edi
mov    %rbx,%rsi
call   1050 <fprintf@plt>
xor    %edi,%edi
mov    %r13,%rsi
mov    $0x200,%edx
call   1040 <read@plt>
test   %eax,%eax
jg     11c0 <think_positively+0x70>
mov    (%r14),%edi
lea    0xdec(%rip),%rsi
call   1050 <fprintf@plt>
lea    0xdfc(%rip),%rdi
call   1060 <perror@plt>
lea    0xdf6(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
mov    0xc(%rsp),%eax
jmp    126e <think_positively+0x11e>
add    $0xffffffff,%eax
movb   $0x0,0x10(%rsp,%rax,1)
movzwl 0x10(%rsp),%ecx
and    $0xffffffdf,%ecx
xor    %eax,%eax
cmp    $0x59,%cx
sete   %al
add    $0x218,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [10 x i8] c" [Y/n/?] \00"
@.str.1 = [10 x i8] c" [N/y/?] \00"
@.str.2 = [28 x i8] c"\0A\0AERROR! Cannot read stdin\0A\00"
@.str.3 = [6 x i8] c"stdin\00"
@.str.4 = [46 x i8] c"invalid_configuration__run_make_config_again\0A\00"
@.str.5 = [2 x i8] c"\0A\00"
@.str.6 = [2 x i8] c"y\00"
@.str.7 = [2 x i8] c"Y\00"
define i32 @think_positively(i8* %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca [512 x i8]
%9 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
br label %10
10: ; preds = %42, %3
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %5
%13 = call i32 @fprintf(i32 %11, i8* %12)
%14 = load i32, i32* %6
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %10
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %22
19: ; preds = %10
%20 = load i32, i32* @stderr
%21 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %22
22: ; preds = %19, %16
%23 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%24 = call i32 @read(i32 0, i8* %23, i32 512)
store i32 %24, i32* %9
%25 = icmp slt i32 %24, 1
br i1 %25, label %26, label %32
26: ; preds = %22
%27 = load i32, i32* @stderr
%28 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%29 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%30 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0))
%31 = call i32 @exit(i32 -1)
unreachable
32: ; preds = %22
%33 = load i32, i32* %9
%34 = icmp slt i32 %33, 2
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = load i32, i32* %6
store i32 %36, i32* %4
br label %64
37: ; preds = %32
%38 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 63
br i1 %41, label %42, label %50
42: ; preds = %37
%43 = load i32, i32* @stderr
%44 = call i32 @fprintf(i32 %43, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%45 = load i32, i32* @stderr
%46 = load i8*, i8** %7
%47 = call i32 @fprintf(i32 %45, i8* %46)
%48 = load i32, i32* @stderr
%49 = call i32 @fprintf(i32 %48, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %10
50: ; preds = %37
%51 = load i32, i32* %9
%52 = sub nsw i32 %51, 1
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 %53
store i8 0, i8* %54
%55 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%56 = call i32 @strcmp(i8* %55, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%57 = icmp ne i32 %56, 0
br i1 %57, label %58, label %62
58: ; preds = %50
%59 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%60 = call i32 @strcmp(i8* %59, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%61 = icmp ne i32 %60, 0
br i1 %61, label %63, label %62
62: ; preds = %58, %50
store i32 1, i32* %4
br label %64
63: ; preds = %58
store i32 0, i32* %4
br label %64
64: ; preds = %63, %62, %35
%65 = load i32, i32* %4
ret i32 %65
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [10 x i8] c" [Y/n/?] \00"
@.str.1 = [10 x i8] c" [N/y/?] \00"
@.str.2 = [28 x i8] c"\0A\0AERROR! Cannot read stdin\0A\00"
@.str.3 = [6 x i8] c"stdin\00"
@.str.5 = [2 x i8] c"\0A\00"
@str = [45 x i8] c"invalid_configuration__run_make_config_again\00"
define i32 @think_positively(i8* %0, i32 %1, i8* %2) {
%4 = alloca [512 x i8]
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%6 = icmp eq i32 %1, 0
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* %0)
%9 = load i32, i32* @stderr
%10 = select i1 %6, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0)
%11 = tail call i32 @fprintf(i32 %9, i8* %10)
%12 = call i32 @read(i32 0, i8* %5, i32 512)
%13 = icmp slt i32 %12, 1
br i1 %13, label %14, label %20
14: ; preds = %26, %3
%15 = load i32, i32* @stderr
%16 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%17 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
%19 = tail call i32 @exit(i32 -1)
unreachable
20: ; preds = %3, %26
%21 = phi i32 [ %37, %26 ], [ %12, %3 ]
%22 = icmp eq i32 %21, 1
br i1 %22, label %48, label %23
23: ; preds = %20
%24 = load i8, i8* %5
%25 = icmp eq i8 %24, 63
br i1 %25, label %26, label %39
26: ; preds = %23
%27 = load i32, i32* @stderr
%28 = tail call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%29 = load i32, i32* @stderr
%30 = tail call i32 @fprintf(i32 %29, i8* %2)
%31 = load i32, i32* @stderr
%32 = tail call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%33 = load i32, i32* @stderr
%34 = tail call i32 @fprintf(i32 %33, i8* %0)
%35 = load i32, i32* @stderr
%36 = tail call i32 @fprintf(i32 %35, i8* %10)
%37 = call i32 @read(i32 0, i8* %5, i32 512)
%38 = icmp slt i32 %37, 1
br i1 %38, label %14, label %20
39: ; preds = %23
%40 = add nsw i32 %21, -1
%41 = zext i32 %40 to i64
%42 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 %41
store i8 0, i8* %42
%43 = bitcast [512 x i8]* %4 to i16*
%44 = load i16, i16* %43
%45 = and i16 %44, -33
%46 = icmp eq i16 %45, 89
%47 = zext i1 %46 to i32
br label %48
48: ; preds = %20, %39
%49 = phi i32 [ %47, %39 ], [ %1, %20 ]
ret i32 %49
}