#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
scalar_t__ strcmpI(char *, char *);
yesno(const char *text) {
  char ans[10];
  while (1) {
    printf("Mente du: %s(ja/nej)? => ", text);
    scanf(" %s", ans);
    if (strcmpI(ans, "j") || strcmpI(ans, "y") || strcmpI(ans, "ja") ||
        strcmpI(ans, "yes"))
      return 1;
    else if (strcmpI(ans, "n") || strcmpI(ans, "nej") || strcmpI(ans, "no"))
      return 0;
    printf("Indtast venligst et gyldigt svar\n");
  }
}


x86 assembly (clang, -O0):
<yesno>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x1a(%rbp),%rsi
lea    0xec1(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x1a(%rbp),%rdi
lea    0xec2(%rip),%rsi
call   1040 <strcmpI@plt>
cmp    $0x0,%rax
jne    11c6 <yesno+0x96>
lea    -0x1a(%rbp),%rdi
lea    0xe9b(%rip),%rsi
call   1040 <strcmpI@plt>
cmp    $0x0,%rax
jne    11c6 <yesno+0x96>
lea    -0x1a(%rbp),%rdi
lea    0xe83(%rip),%rsi
call   1040 <strcmpI@plt>
cmp    $0x0,%rax
jne    11c6 <yesno+0x96>
lea    -0x1a(%rbp),%rdi
lea    0xe6c(%rip),%rsi
call   1040 <strcmpI@plt>
cmp    $0x0,%rax
je     11d2 <yesno+0xa2>
movl   $0x1,-0x4(%rbp)
jmp    1244 <yesno+0x114>
lea    -0x1a(%rbp),%rdi
lea    0xe4a(%rip),%rsi
call   1040 <strcmpI@plt>
cmp    $0x0,%rax
jne    1220 <yesno+0xf0>
lea    -0x1a(%rbp),%rdi
lea    0xe32(%rip),%rsi
call   1040 <strcmpI@plt>
cmp    $0x0,%rax
jne    1220 <yesno+0xf0>
lea    -0x1a(%rbp),%rdi
lea    0xe1c(%rip),%rsi
call   1040 <strcmpI@plt>
cmp    $0x0,%rax
je     122c <yesno+0xfc>
movl   $0x0,-0x4(%rbp)
jmp    1244 <yesno+0x114>
jmp    1231 <yesno+0x101>
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113c <yesno+0xc>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yesno>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r15
lea    0xea8(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb1(%rip),%rdi
lea    0xe(%rsp),%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
lea    0xeae(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmpI@plt>
test   %rax,%rax
je     11a0 <yesno+0x60>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe77(%rip),%r14
lea    0xe(%rsp),%rbx
lea    0xe6d(%rip),%r12
lea    0xe69(%rip),%r13
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcmpI@plt>
test   %rax,%rax
jne    118a <yesno+0x4a>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <strcmpI@plt>
test   %rax,%rax
jne    118a <yesno+0x4a>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1050 <strcmpI@plt>
test   %rax,%rax
jne    118a <yesno+0x4a>
mov    %rbx,%rdi
lea    0xe2d(%rip),%rsi
call   1050 <strcmpI@plt>
test   %rax,%rax
jne    118f <yesno+0x4f>
mov    %rbx,%rdi
lea    0xe1b(%rip),%rsi
call   1050 <strcmpI@plt>
test   %rax,%rax
jne    118f <yesno+0x4f>
mov    %rbx,%rdi
lea    0xe07(%rip),%rsi
call   1050 <strcmpI@plt>
test   %rax,%rax
jne    118f <yesno+0x4f>
lea    0xdf5(%rip),%rdi
call   1030 <puts@plt>
lea    0xdb9(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdc2(%rip),%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
lea    0xdc1(%rip),%rsi
call   1050 <strcmpI@plt>
test   %rax,%rax
je     11c0 <yesno+0x80>
jmp    118a <yesno+0x4a>

LLVM IR (-O0):
@.str = [26 x i8] c"Mente du: %s(ja/nej)? => \00"
@.str.1 = [4 x i8] c" %s\00"
@.str.2 = [2 x i8] c"j\00"
@.str.3 = [2 x i8] c"y\00"
@.str.4 = [3 x i8] c"ja\00"
@.str.5 = [4 x i8] c"yes\00"
@.str.6 = [2 x i8] c"n\00"
@.str.7 = [4 x i8] c"nej\00"
@.str.8 = [3 x i8] c"no\00"
@.str.9 = [34 x i8] c"Indtast venligst et gyldigt svar\0A\00"
define i32 @yesno(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [10 x i8]
store i8* %0, i8** %3
br label %5
5: ; preds = %1, %40
%6 = load i8*, i8** %3
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%9 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%11 = call i64 @strcmpI(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp ne i64 %11, 0
br i1 %12, label %25, label %13
13: ; preds = %5
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%15 = call i64 @strcmpI(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%16 = icmp ne i64 %15, 0
br i1 %16, label %25, label %17
17: ; preds = %13
%18 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%19 = call i64 @strcmpI(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%20 = icmp ne i64 %19, 0
br i1 %20, label %25, label %21
21: ; preds = %17
%22 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%23 = call i64 @strcmpI(i8* %22, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %21, %17, %13, %5
store i32 1, i32* %2
br label %42
26: ; preds = %21
%27 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%28 = call i64 @strcmpI(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%29 = icmp ne i64 %28, 0
br i1 %29, label %38, label %30
30: ; preds = %26
%31 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%32 = call i64 @strcmpI(i8* %31, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%33 = icmp ne i64 %32, 0
br i1 %33, label %38, label %34
34: ; preds = %30
%35 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%36 = call i64 @strcmpI(i8* %35, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %39
38: ; preds = %34, %30, %26
store i32 0, i32* %2
br label %42
39: ; preds = %34
br label %40
40: ; preds = %39
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0))
br label %5
42: ; preds = %38, %25
%43 = load i32, i32* %2
ret i32 %43
}

LLVM IR (-O2):
@.str = [26 x i8] c"Mente du: %s(ja/nej)? => \00"
@.str.1 = [4 x i8] c" %s\00"
@.str.2 = [2 x i8] c"j\00"
@.str.3 = [2 x i8] c"y\00"
@.str.4 = [3 x i8] c"ja\00"
@.str.5 = [4 x i8] c"yes\00"
@.str.6 = [2 x i8] c"n\00"
@.str.7 = [4 x i8] c"nej\00"
@.str.8 = [3 x i8] c"no\00"
@str = [33 x i8] c"Indtast venligst et gyldigt svar\00"
define i32 @yesno(i8* %0) {
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%6 = call i64 @strcmpI(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %32
8: ; preds = %1, %26
%9 = call i64 @strcmpI(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %32
11: ; preds = %8
%12 = call i64 @strcmpI(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %32
14: ; preds = %11
%15 = call i64 @strcmpI(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %32
17: ; preds = %14
%18 = call i64 @strcmpI(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %32
20: ; preds = %17
%21 = call i64 @strcmpI(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %32
23: ; preds = %20
%24 = call i64 @strcmpI(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %32
26: ; preds = %23
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %0)
%29 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%30 = call i64 @strcmpI(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %8, label %32
32: ; preds = %14, %11, %8, %26, %23, %20, %17, %1
%33 = phi i32 [ 1, %1 ], [ 0, %17 ], [ 0, %20 ], [ 0, %23 ], [ 1, %26 ], [ 1, %8 ], [ 1, %11 ], [ 1, %14 ]
ret i32 %33
}