#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*/ sedb_message(char *, char *);
int sedb_read_line_in(char *, int, char *, char *, char *);
scalar_t__ strcmp(char *, char *);
int sedb_yes_or_no(char *question, int default_answer) {
  static char answer[4096];
  int again;
  int result;
  int i;
  do {
    again = 0;
    i = sedb_read_line_in(answer, 1, "%s (yes/no)? [%s] ", question,
                          (default_answer ? "yes" : "no"));
    if (i == 0) {
      result = default_answer;
    } else if ((strcmp("yes", answer) == 0) || (strcmp("y", answer) == 0) ||
               (strcmp("oui", answer) == 0) || (strcmp("o", answer) == 0)) {
      result = 1;
    } else if ((strcmp("no", answer) == 0) || (strcmp("n", answer) == 0) ||
               (strcmp("non", answer) == 0)) {
      result = 0;
    } else {
      sedb_message("The answer '%s' is not clear.\n", answer);
      again = 1;
    }
  } while (again);
  return result;
}


x86 assembly (clang, -O0):
<sedb_yes_or_no>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%edx
lea    0xec3(%rip),%r8
lea    0xeb8(%rip),%rax
cmp    $0x0,%edx
cmovne %rax,%r8
lea    0x2ee7(%rip),%rdi
mov    $0x1,%esi
lea    0xe8b(%rip),%rdx
call   1050 <sedb_read_line_in@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    1192 <sedb_yes_or_no+0x62>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1299 <sedb_yes_or_no+0x169>
lea    0xe7a(%rip),%rdi
lea    0x2eb0(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1206 <sedb_yes_or_no+0xd6>
lea    0xe64(%rip),%rdi
lea    0x2e93(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1206 <sedb_yes_or_no+0xd6>
lea    0xe49(%rip),%rdi
lea    0x2e76(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1206 <sedb_yes_or_no+0xd6>
lea    0xe28(%rip),%rdi
lea    0x2e59(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1212 <sedb_yes_or_no+0xe2>
movl   $0x1,-0x14(%rbp)
jmp    1294 <sedb_yes_or_no+0x164>
lea    0xdfe(%rip),%rdi
lea    0x2e30(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1269 <sedb_yes_or_no+0x139>
lea    0xdec(%rip),%rdi
lea    0x2e13(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1269 <sedb_yes_or_no+0x139>
lea    0xdcd(%rip),%rdi
lea    0x2df6(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1275 <sedb_yes_or_no+0x145>
movl   $0x0,-0x14(%rbp)
jmp    128f <sedb_yes_or_no+0x15f>
lea    0xda8(%rip),%rdi
lea    0x2dcd(%rip),%rsi
call   1030 <sedb_message@plt>
movl   $0x1,-0x10(%rbp)
jmp    1294 <sedb_yes_or_no+0x164>
jmp    1299 <sedb_yes_or_no+0x169>
jmp    129e <sedb_yes_or_no+0x16e>
cmpl   $0x0,-0x10(%rbp)
jne    113f <sedb_yes_or_no+0xf>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sedb_yes_or_no>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r13d
mov    %rdi,%r12
test   %esi,%esi
lea    0xecd(%rip),%rax
lea    0xec2(%rip),%rbp
cmove  %rax,%rbp
lea    0x2ef4(%rip),%rdi
lea    0xe9d(%rip),%rdx
mov    $0x1,%esi
mov    %r12,%rcx
mov    %rbp,%r8
call   1050 <sedb_read_line_in@plt>
test   %eax,%eax
je     1251 <sedb_yes_or_no+0x121>
lea    0xe91(%rip),%r15
lea    0x2ec7(%rip),%rbx
xor    %r14d,%r14d
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1256 <sedb_yes_or_no+0x126>
lea    0xe73(%rip),%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1256 <sedb_yes_or_no+0x126>
lea    0xe5d(%rip),%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1256 <sedb_yes_or_no+0x126>
lea    0xe41(%rip),%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1256 <sedb_yes_or_no+0x126>
lea    0xe2c(%rip),%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     125c <sedb_yes_or_no+0x12c>
lea    0xe23(%rip),%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     125c <sedb_yes_or_no+0x12c>
lea    0xe0d(%rip),%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     125c <sedb_yes_or_no+0x12c>
lea    0xdfd(%rip),%rdi
mov    %rbx,%rsi
call   1030 <sedb_message@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
lea    0xdc2(%rip),%rdx
mov    %r12,%rcx
mov    %rbp,%r8
call   1050 <sedb_read_line_in@plt>
test   %eax,%eax
jne    118c <sedb_yes_or_no+0x5c>
mov    %r13d,%r14d
jmp    125c <sedb_yes_or_no+0x12c>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@sedb_yes_or_no.answer = internal global [4096 x i8] zeroinitializer
@.str = [19 x i8] c"%s (yes/no)? [%s] \00"
@.str.1 = [4 x i8] c"yes\00"
@.str.2 = [3 x i8] c"no\00"
@.str.3 = [2 x i8] c"y\00"
@.str.4 = [4 x i8] c"oui\00"
@.str.5 = [2 x i8] c"o\00"
@.str.6 = [2 x i8] c"n\00"
@.str.7 = [4 x i8] c"non\00"
@.str.8 = [31 x i8] c"The answer '%s' is not clear.\0A\00"
define i32 @sedb_yes_or_no(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
br label %8
8: ; preds = %47, %2
store i32 0, i32* %5
%9 = load i8*, i8** %3
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 0
%12 = zext i1 %11 to i64
%13 = select i1 %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%14 = call i32 @sedb_read_line_in(i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @sedb_yes_or_no.answer, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %13)
store i32 %14, i32* %7
%15 = load i32, i32* %7
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %8
%18 = load i32, i32* %4
store i32 %18, i32* %6
br label %46
19: ; preds = %8
%20 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @sedb_yes_or_no.answer, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %31, label %22
22: ; preds = %19
%23 = call i64 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @sedb_yes_or_no.answer, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %31, label %25
25: ; preds = %22
%26 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @sedb_yes_or_no.answer, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %31, label %28
28: ; preds = %25
%29 = call i64 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @sedb_yes_or_no.answer, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %28, %25, %22, %19
store i32 1, i32* %6
br label %45
32: ; preds = %28
%33 = call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @sedb_yes_or_no.answer, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %41, label %35
35: ; preds = %32
%36 = call i64 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @sedb_yes_or_no.answer, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %41, label %38
38: ; preds = %35
%39 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @sedb_yes_or_no.answer, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %42
41: ; preds = %38, %35, %32
store i32 0, i32* %6
br label %44
42: ; preds = %38
%43 = call i32 @sedb_message(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @sedb_yes_or_no.answer, i64 0, i64 0))
store i32 1, i32* %5
br label %44
44: ; preds = %42, %41
br label %45
45: ; preds = %44, %31
br label %46
46: ; preds = %45, %17
br label %47
47: ; preds = %46
%48 = load i32, i32* %5
%49 = icmp ne i32 %48, 0
br i1 %49, label %8, label %50
50: ; preds = %47
%51 = load i32, i32* %6
ret i32 %51
}

LLVM IR (-O2):
@sedb_yes_or_no.answer = internal global [4096 x i8] zeroinitializer
@.str = [19 x i8] c"%s (yes/no)? [%s] \00"
@.str.1 = [4 x i8] c"yes\00"
@.str.2 = [3 x i8] c"no\00"
@.str.3 = [2 x i8] c"y\00"
@.str.4 = [4 x i8] c"oui\00"
@.str.5 = [2 x i8] c"o\00"
@.str.6 = [2 x i8] c"n\00"
@.str.7 = [4 x i8] c"non\00"
@.str.8 = [31 x i8] c"The answer '%s' is not clear.\0A\00"
define i32 @sedb_yes_or_no(i8* %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = select i1 %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0)
%5 = tail call i32 @sedb_read_line_in(i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @sedb_yes_or_no.answer, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %4)
%6 = icmp eq i32 %5, 0
br i1 %6, label %32, label %7
7: ; preds = %2, %28
%8 = tail call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @sedb_yes_or_no.answer, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %32, label %10
10: ; preds = %7
%11 = tail call i64 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @sedb_yes_or_no.answer, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %32, label %13
13: ; preds = %10
%14 = tail call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @sedb_yes_or_no.answer, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %32, label %16
16: ; preds = %13
%17 = tail call i64 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @sedb_yes_or_no.answer, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %32, label %19
19: ; preds = %16
%20 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @sedb_yes_or_no.answer, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %32, label %22
22: ; preds = %19
%23 = tail call i64 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @sedb_yes_or_no.answer, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %32, label %25
25: ; preds = %22
%26 = tail call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @sedb_yes_or_no.answer, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %32, label %28
28: ; preds = %25
%29 = tail call i32 @sedb_message(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @sedb_yes_or_no.answer, i64 0, i64 0))
%30 = tail call i32 @sedb_read_line_in(i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @sedb_yes_or_no.answer, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %4)
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %7
32: ; preds = %19, %22, %25, %7, %10, %13, %16, %28, %2
%33 = phi i32 [ %1, %2 ], [ %1, %28 ], [ 1, %16 ], [ 1, %13 ], [ 1, %10 ], [ 1, %7 ], [ 0, %25 ], [ 0, %22 ], [ 0, %19 ]
ret i32 %33
}