#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 */
struct link {
  int dummy;
};

/* Variables and functions */
struct link *linked_list_add(struct link *, char *);
int linked_list_count(struct link *);
char *linked_list_get(struct link *, int);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  struct link *listOfStrings;
  listOfStrings = linked_list_add(
      listOfStrings, "Friends, Romans, countrymen, lend me your ears;");
  listOfStrings = linked_list_add(listOfStrings,
                                  "I come to bury Caesar, not to praise him.");
  listOfStrings =
      linked_list_add(listOfStrings, "The evil that men do lives after them;");
  listOfStrings = linked_list_add(listOfStrings,
                                  "The good is oft interred with their bones;");
  for (int currentPosition = 0;
       currentPosition < linked_list_count(listOfStrings); currentPosition++) {
    printf("The string is: %s\n",
           linked_list_get(listOfStrings, currentPosition));
  }
  return 0;
}


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)
mov    -0x18(%rbp),%rdi
lea    0xe9f(%rip),%rsi
call   1040 <linked_list_add@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xebb(%rip),%rsi
call   1040 <linked_list_add@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xed1(%rip),%rsi
call   1040 <linked_list_add@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xee4(%rip),%rsi
call   1040 <linked_list_add@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <linked_list_count@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
jge    11f2 <main+0xb2>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1030 <linked_list_get@plt>
mov    %rax,%rsi
lea    0xecd(%rip),%rdi
call   1050 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11ad <main+0x6d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
lea    0xeb5(%rip),%rsi
call   1040 <linked_list_add@plt>
lea    0xed9(%rip),%rsi
mov    %rax,%rdi
call   1040 <linked_list_add@plt>
lea    0xef4(%rip),%rsi
mov    %rax,%rdi
call   1040 <linked_list_add@plt>
lea    0xf0c(%rip),%rsi
mov    %rax,%rdi
call   1040 <linked_list_add@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <linked_list_count@plt>
test   %eax,%eax
jle    11c4 <main+0x84>
xor    %ebp,%ebp
lea    0xf17(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <linked_list_get@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
add    $0x1,%ebp
mov    %rbx,%rdi
call   1060 <linked_list_count@plt>
cmp    %eax,%ebp
jl     11a0 <main+0x60>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.link = type { i32 }
@.str = [48 x i8] c"Friends, Romans, countrymen, lend me your ears;\00"
@.str.1 = [42 x i8] c"I come to bury Caesar, not to praise him.\00"
@.str.2 = [39 x i8] c"The evil that men do lives after them;\00"
@.str.3 = [43 x i8] c"The good is oft interred with their bones;\00"
@.str.4 = [19 x i8] c"The string is: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.link*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load %struct.link*, %struct.link** %6
%9 = call %struct.link* @linked_list_add(%struct.link* %8, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
store %struct.link* %9, %struct.link** %6
%10 = load %struct.link*, %struct.link** %6
%11 = call %struct.link* @linked_list_add(%struct.link* %10, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
store %struct.link* %11, %struct.link** %6
%12 = load %struct.link*, %struct.link** %6
%13 = call %struct.link* @linked_list_add(%struct.link* %12, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
store %struct.link* %13, %struct.link** %6
%14 = load %struct.link*, %struct.link** %6
%15 = call %struct.link* @linked_list_add(%struct.link* %14, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
store %struct.link* %15, %struct.link** %6
store i32 0, i32* %7
br label %16
16: ; preds = %26, %2
%17 = load i32, i32* %7
%18 = load %struct.link*, %struct.link** %6
%19 = call i32 @linked_list_count(%struct.link* %18)
%20 = icmp slt i32 %17, %19
br i1 %20, label %21, label %29
21: ; preds = %16
%22 = load %struct.link*, %struct.link** %6
%23 = load i32, i32* %7
%24 = call i8* @linked_list_get(%struct.link* %22, i32 %23)
%25 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* %24)
br label %26
26: ; preds = %21
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
store i32 %28, i32* %7
br label %16
29: ; preds = %16
ret i32 0
}

LLVM IR (-O2):
%struct.link = type { i32 }
@.str = [48 x i8] c"Friends, Romans, countrymen, lend me your ears;\00"
@.str.1 = [42 x i8] c"I come to bury Caesar, not to praise him.\00"
@.str.2 = [39 x i8] c"The evil that men do lives after them;\00"
@.str.3 = [43 x i8] c"The good is oft interred with their bones;\00"
@.str.4 = [19 x i8] c"The string is: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call %struct.link* @linked_list_add(%struct.link* undef, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%4 = tail call %struct.link* @linked_list_add(%struct.link* %3, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call %struct.link* @linked_list_add(%struct.link* %4, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call %struct.link* @linked_list_add(%struct.link* %5, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
%7 = tail call i32 @linked_list_count(%struct.link* %6)
%8 = icmp sgt i32 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %10, %2
ret i32 0
10: ; preds = %2, %10
%11 = phi i32 [ %14, %10 ], [ 0, %2 ]
%12 = tail call i8* @linked_list_get(%struct.link* %6, i32 %11)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* %12)
%14 = add nuw nsw i32 %11, 1
%15 = tail call i32 @linked_list_count(%struct.link* %6)
%16 = icmp slt i32 %14, %15
br i1 %16, label %10, label %9
}