#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 main(void) {
  int RateStatement(char *, int *);
  int AskQuestion(char *, int *);
  int score = 0;
  if (AskQuestion("Do you like sports?", &score)) {
    if (RateStatement("I love Football", &score))
      AskQuestion("Do you think the QB position is hard?", &score);
    RateStatement("I love Rugby", &score);
  }
  if (AskQuestion("Do you like video games?", &score)) {
    if (RateStatement("I love Sports Games", &score)) {
      AskQuestion("Do you like madden?", &score);
      AskQuestion("Do you like NBA 2K?", &score);
    }
    RateStatement("I love RPG", &score);
    RateStatement("I love Shooters", &score);
  }
  int counter = 0;
  while (counter < 10) {
    if (AskQuestion("Do you love dogs?", &score))
      break;
    counter++;
  }
  printf("Your score was: %d\n", score);
  if (score > 50)
    printf("We would be great friends!");
  else if (score > 0)
    printf("We could be friends!");
  else
    printf("We would never be friends. Ever.");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <AskQuestion@plt>
cmp    $0x0,%eax
je     1198 <main+0x68>
lea    0xeae(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <RateStatement@plt>
cmp    $0x0,%eax
je     1188 <main+0x58>
lea    0xea5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <AskQuestion@plt>
lea    0xebb(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <RateStatement@plt>
lea    0xeb8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <AskQuestion@plt>
cmp    $0x0,%eax
je     120a <main+0xda>
lea    0xeb8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <RateStatement@plt>
cmp    $0x0,%eax
je     11ea <main+0xba>
lea    0xeb3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <AskQuestion@plt>
lea    0xeb7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <AskQuestion@plt>
lea    0xebb(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <RateStatement@plt>
lea    0xeb6(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <RateStatement@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1247 <main+0x117>
lea    0xea5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <AskQuestion@plt>
cmp    $0x0,%eax
je     1239 <main+0x109>
jmp    1247 <main+0x117>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1211 <main+0xe1>
mov    -0x8(%rbp),%esi
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x32,-0x8(%rbp)
jle    1275 <main+0x145>
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12a5 <main+0x175>
cmpl   $0x0,-0x8(%rbp)
jle    1292 <main+0x162>
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12a0 <main+0x170>
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12a5 <main+0x175>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
lea    0xebc(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1030 <AskQuestion@plt>
test   %eax,%eax
je     1189 <main+0x59>
lea    0xebb(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <RateStatement@plt>
test   %eax,%eax
je     1178 <main+0x48>
lea    0xeb6(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1030 <AskQuestion@plt>
lea    0xecb(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <RateStatement@plt>
lea    0xec7(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1030 <AskQuestion@plt>
test   %eax,%eax
je     11f9 <main+0xc9>
lea    0xecb(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <RateStatement@plt>
test   %eax,%eax
je     11d6 <main+0xa6>
lea    0xeca(%rip),%rdi
lea    0xc(%rsp),%rbx
mov    %rbx,%rsi
call   1030 <AskQuestion@plt>
lea    0xeca(%rip),%rdi
mov    %rbx,%rsi
call   1030 <AskQuestion@plt>
lea    0xecf(%rip),%rdi
lea    0xc(%rsp),%rbx
mov    %rbx,%rsi
call   1050 <RateStatement@plt>
lea    0xec6(%rip),%rdi
mov    %rbx,%rsi
call   1050 <RateStatement@plt>
lea    0xec7(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1030 <AskQuestion@plt>
test   %eax,%eax
jne    12d3 <main+0x1a3>
lea    0xeae(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1030 <AskQuestion@plt>
test   %eax,%eax
jne    12d3 <main+0x1a3>
lea    0xe95(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1030 <AskQuestion@plt>
test   %eax,%eax
jne    12d3 <main+0x1a3>
lea    0xe7c(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1030 <AskQuestion@plt>
test   %eax,%eax
jne    12d3 <main+0x1a3>
lea    0xe67(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1030 <AskQuestion@plt>
test   %eax,%eax
jne    12d3 <main+0x1a3>
lea    0xe52(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1030 <AskQuestion@plt>
test   %eax,%eax
jne    12d3 <main+0x1a3>
lea    0xe3d(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1030 <AskQuestion@plt>
test   %eax,%eax
jne    12d3 <main+0x1a3>
lea    0xe28(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1030 <AskQuestion@plt>
test   %eax,%eax
jne    12d3 <main+0x1a3>
lea    0xe13(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1030 <AskQuestion@plt>
test   %eax,%eax
jne    12d3 <main+0x1a3>
lea    0xdfe(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1030 <AskQuestion@plt>
mov    0xc(%rsp),%esi
lea    0xdfb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
lea    0xe16(%rip),%rcx
lea    0xe24(%rip),%rdx
cmovg  %rcx,%rdx
cmp    $0x33,%eax
lea    0xde6(%rip),%rdi
cmovl  %rdx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Do you like sports?\00"
@.str.1 = [16 x i8] c"I love Football\00"
@.str.2 = [38 x i8] c"Do you think the QB position is hard?\00"
@.str.3 = [13 x i8] c"I love Rugby\00"
@.str.4 = [25 x i8] c"Do you like video games?\00"
@.str.5 = [20 x i8] c"I love Sports Games\00"
@.str.6 = [20 x i8] c"Do you like madden?\00"
@.str.7 = [20 x i8] c"Do you like NBA 2K?\00"
@.str.8 = [11 x i8] c"I love RPG\00"
@.str.9 = [16 x i8] c"I love Shooters\00"
@.str.10 = [18 x i8] c"Do you love dogs?\00"
@.str.11 = [20 x i8] c"Your score was: %d\0A\00"
@.str.12 = [27 x i8] c"We would be great friends!\00"
@.str.13 = [21 x i8] c"We could be friends!\00"
@.str.14 = [33 x i8] c"We would never be friends. Ever.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%4 = call i32 @AskQuestion(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %13
6: ; preds = %0
%7 = call i32 @RateStatement(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 @AskQuestion(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32* %2)
br label %11
11: ; preds = %9, %6
%12 = call i32 @RateStatement(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32* %2)
br label %13
13: ; preds = %11, %0
%14 = call i32 @AskQuestion(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %25
16: ; preds = %13
%17 = call i32 @RateStatement(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32* %2)
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = call i32 @AskQuestion(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i32* %2)
%21 = call i32 @AskQuestion(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i32* %2)
br label %22
22: ; preds = %19, %16
%23 = call i32 @RateStatement(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i32* %2)
%24 = call i32 @RateStatement(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i32* %2)
br label %25
25: ; preds = %22, %13
store i32 0, i32* %3
br label %26
26: ; preds = %33, %25
%27 = load i32, i32* %3
%28 = icmp slt i32 %27, 10
br i1 %28, label %29, label %36
29: ; preds = %26
%30 = call i32 @AskQuestion(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i32* %2)
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %29
br label %36
33: ; preds = %29
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 1
store i32 %35, i32* %3
br label %26
36: ; preds = %32, %26
%37 = load i32, i32* %2
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0), i32 %37)
%39 = load i32, i32* %2
%40 = icmp sgt i32 %39, 50
br i1 %40, label %41, label %43
41: ; preds = %36
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.12, i64 0, i64 0))
br label %51
43: ; preds = %36
%44 = load i32, i32* %2
%45 = icmp sgt i32 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %43
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.13, i64 0, i64 0))
br label %50
48: ; preds = %43
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.14, i64 0, i64 0))
br label %50
50: ; preds = %48, %46
br label %51
51: ; preds = %50, %41
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Do you like sports?\00"
@.str.1 = [16 x i8] c"I love Football\00"
@.str.2 = [38 x i8] c"Do you think the QB position is hard?\00"
@.str.3 = [13 x i8] c"I love Rugby\00"
@.str.4 = [25 x i8] c"Do you like video games?\00"
@.str.5 = [20 x i8] c"I love Sports Games\00"
@.str.6 = [20 x i8] c"Do you like madden?\00"
@.str.7 = [20 x i8] c"Do you like NBA 2K?\00"
@.str.8 = [11 x i8] c"I love RPG\00"
@.str.9 = [16 x i8] c"I love Shooters\00"
@.str.10 = [18 x i8] c"Do you love dogs?\00"
@.str.11 = [20 x i8] c"Your score was: %d\0A\00"
@.str.12 = [27 x i8] c"We would be great friends!\00"
@.str.13 = [21 x i8] c"We could be friends!\00"
@.str.14 = [33 x i8] c"We would never be friends. Ever.\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = call i32 @AskQuestion(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %0
%6 = call i32 @RateStatement(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = icmp eq i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = call i32 @AskQuestion(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32* %1)
br label %10
10: ; preds = %8, %5
%11 = call i32 @RateStatement(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32* %1)
br label %12
12: ; preds = %10, %0
%13 = call i32 @AskQuestion(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%14 = icmp eq i32 %13, 0
br i1 %14, label %24, label %15
15: ; preds = %12
%16 = call i32 @RateStatement(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%17 = icmp eq i32 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = call i32 @AskQuestion(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%20 = call i32 @AskQuestion(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i32* %1)
br label %21
21: ; preds = %18, %15
%22 = call i32 @RateStatement(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i32* %1)
%23 = call i32 @RateStatement(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i32* %1)
br label %24
24: ; preds = %21, %12
%25 = call i32 @AskQuestion(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i32* %1)
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %53
27: ; preds = %24
%28 = call i32 @AskQuestion(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i32* %1)
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %53
30: ; preds = %27
%31 = call i32 @AskQuestion(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i32* %1)
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %53
33: ; preds = %30
%34 = call i32 @AskQuestion(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i32* %1)
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %53
36: ; preds = %33
%37 = call i32 @AskQuestion(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i32* %1)
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %53
39: ; preds = %36
%40 = call i32 @AskQuestion(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i32* %1)
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %53
42: ; preds = %39
%43 = call i32 @AskQuestion(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i32* %1)
%44 = icmp eq i32 %43, 0
br i1 %44, label %45, label %53
45: ; preds = %42
%46 = call i32 @AskQuestion(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i32* %1)
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %53
48: ; preds = %45
%49 = call i32 @AskQuestion(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i32* %1)
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %53
51: ; preds = %48
%52 = call i32 @AskQuestion(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.10, i64 0, i64 0), i32* %1)
br label %53
53: ; preds = %51, %48, %45, %42, %39, %36, %33, %30, %27, %24
%54 = load i32, i32* %1
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0), i32 %54)
%56 = load i32, i32* %1
%57 = icmp sgt i32 %56, 50
%58 = icmp sgt i32 %56, 0
%59 = select i1 %58, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.14, i64 0, i64 0)
%60 = select i1 %57, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.12, i64 0, i64 0), i8* %59
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %60)
ret i32 0
}