#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*/ n_hello_worlds(int);
int /*<<< orphan*/ puts(char *);
int main(int argc, char **argv) {
  puts("Bonus Marks 1");
  puts("Prompt: Use a for loop to print out 'Hello World!' five times.\n");
  for (int i = 0; i < 5; i += 1) {
    puts("Hello World!");
  }
  puts("\nBonus Marks 2");
  puts("Prompt: Use a while loop to print out 'Hello World!' five times.\n");
  int ii = 0;
  while (ii < 5) {
    puts("Hello World!");
    ii += 1;
  }
  puts("\nBonus Marks 3");
  char *prompt_3 = "Prompt: Declare a function that outputs 'Hello World!' n "
                   "times. Call this from main.\n";
  puts(prompt_3);
  n_hello_worlds(1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
call   1040 <puts@plt>
lea    0xec5(%rip),%rdi
call   1040 <puts@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x5,-0x14(%rbp)
jge    1179 <main+0x59>
lea    0xee8(%rip),%rdi
call   1040 <puts@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1155 <main+0x35>
lea    0xedb(%rip),%rdi
call   1040 <puts@plt>
lea    0xede(%rip),%rdi
call   1040 <puts@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x5,-0x18(%rbp)
jge    11bc <main+0x9c>
lea    0xea5(%rip),%rdi
call   1040 <puts@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1198 <main+0x78>
lea    0xee9(%rip),%rdi
call   1040 <puts@plt>
lea    0xeec(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1030 <n_hello_worlds@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rdi
call   1040 <puts@plt>
lea    0xeda(%rip),%rdi
call   1040 <puts@plt>
lea    0xf0e(%rip),%rbx
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xeec(%rip),%rdi
call   1040 <puts@plt>
lea    0xeef(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xefd(%rip),%rdi
call   1040 <puts@plt>
lea    0xf00(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1030 <n_hello_worlds@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Bonus Marks 1\00"
@.str.1 = [64 x i8] c"Prompt: Use a for loop to print out 'Hello World!' five times.\0A\00"
@.str.2 = [13 x i8] c"Hello World!\00"
@.str.3 = [15 x i8] c"\0ABonus Marks 2\00"
@.str.4 = [66 x i8] c"Prompt: Use a while loop to print out 'Hello World!' five times.\0A\00"
@.str.5 = [15 x i8] c"\0ABonus Marks 3\00"
@.str.6 = [86 x i8] c"Prompt: Declare a function that outputs 'Hello World!' n times. Call this from main.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @puts(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %6
br label %11
11: ; preds = %16, %2
%12 = load i32, i32* %6
%13 = icmp slt i32 %12, 5
br i1 %13, label %14, label %19
14: ; preds = %11
%15 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %14
%17 = load i32, i32* %6
%18 = add nsw i32 %17, 1
store i32 %18, i32* %6
br label %11
19: ; preds = %11
%20 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%21 = call i32 @puts(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %7
br label %22
22: ; preds = %25, %19
%23 = load i32, i32* %7
%24 = icmp slt i32 %23, 5
br i1 %24, label %25, label %29
25: ; preds = %22
%26 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
store i32 %28, i32* %7
br label %22
29: ; preds = %22
%30 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
store i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.6, i64 0, i64 0), i8** %8
%31 = load i8*, i8** %8
%32 = call i32 @puts(i8* %31)
%33 = call i32 @n_hello_worlds(i32 1)
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
@.str = [14 x i8] c"Bonus Marks 1\00"
@.str.1 = [64 x i8] c"Prompt: Use a for loop to print out 'Hello World!' five times.\0A\00"
@.str.2 = [13 x i8] c"Hello World!\00"
@.str.3 = [15 x i8] c"\0ABonus Marks 2\00"
@.str.4 = [66 x i8] c"Prompt: Use a while loop to print out 'Hello World!' five times.\0A\00"
@.str.5 = [15 x i8] c"\0ABonus Marks 3\00"
@.str.6 = [86 x i8] c"Prompt: Declare a function that outputs 'Hello World!' n times. Call this from main.\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.4, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([86 x i8], [86 x i8]* @.str.6, i64 0, i64 0))
%19 = tail call i32 @n_hello_worlds(i32 1)
ret i32 0
}