#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 list {
  int dummy;
};

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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1070 <linked_list_alloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe74(%rip),%rsi
call   1040 <linked_list_add@plt>
mov    -0x18(%rbp),%rdi
lea    0xe94(%rip),%rsi
call   1040 <linked_list_add@plt>
mov    -0x18(%rbp),%rdi
lea    0xeae(%rip),%rsi
call   1040 <linked_list_add@plt>
mov    -0x18(%rbp),%rdi
lea    0xec5(%rip),%rsi
call   1040 <linked_list_add@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <linked_list_count@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
cmp    %ecx,%eax
jge    120b <main+0xab>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1030 <linked_list_get@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1060 <do_something_awesome@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11c8 <main+0x68>
mov    -0x18(%rbp),%rdi
call   1080 <linked_list_free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
xor    %eax,%eax
call   1070 <linked_list_alloc@plt>
mov    %rax,%r14
lea    0xe89(%rip),%rsi
mov    %rax,%rdi
call   1040 <linked_list_add@plt>
lea    0xeaa(%rip),%rsi
mov    %r14,%rdi
call   1040 <linked_list_add@plt>
lea    0xec5(%rip),%rsi
mov    %r14,%rdi
call   1040 <linked_list_add@plt>
lea    0xedd(%rip),%rsi
mov    %r14,%rdi
call   1040 <linked_list_add@plt>
mov    %r14,%rdi
call   1050 <linked_list_count@plt>
test   %eax,%eax
jle    11e1 <main+0x81>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <linked_list_get@plt>
mov    %rax,%rdi
call   1060 <do_something_awesome@plt>
add    $0x1,%ebx
mov    %r14,%rdi
call   1050 <linked_list_count@plt>
cmp    %eax,%ebx
jl     11c0 <main+0x60>
mov    %r14,%rdi
call   1080 <linked_list_free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.list = 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"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.list*
%7 = alloca i32
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call %struct.list* (...) @linked_list_alloc()
store %struct.list* %9, %struct.list** %6
%10 = load %struct.list*, %struct.list** %6
%11 = call i32 @linked_list_add(%struct.list* %10, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%12 = load %struct.list*, %struct.list** %6
%13 = call i32 @linked_list_add(%struct.list* %12, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%14 = load %struct.list*, %struct.list** %6
%15 = call i32 @linked_list_add(%struct.list* %14, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%16 = load %struct.list*, %struct.list** %6
%17 = call i32 @linked_list_add(%struct.list* %16, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %7
br label %18
18: ; preds = %29, %2
%19 = load i32, i32* %7
%20 = load %struct.list*, %struct.list** %6
%21 = call i32 @linked_list_count(%struct.list* %20)
%22 = icmp slt i32 %19, %21
br i1 %22, label %23, label %32
23: ; preds = %18
%24 = load %struct.list*, %struct.list** %6
%25 = load i32, i32* %7
%26 = call i8* @linked_list_get(%struct.list* %24, i32 %25)
store i8* %26, i8** %8
%27 = load i8*, i8** %8
%28 = call i32 @do_something_awesome(i8* %27)
br label %29
29: ; preds = %23
%30 = load i32, i32* %7
%31 = add nsw i32 %30, 1
store i32 %31, i32* %7
br label %18
32: ; preds = %18
%33 = load %struct.list*, %struct.list** %6
%34 = call i32 @linked_list_free(%struct.list* %33)
ret i32 0
}

LLVM IR (-O2):
%struct.list = 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"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call %struct.list* (...) @linked_list_alloc()
%4 = tail call i32 @linked_list_add(%struct.list* %3, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @linked_list_add(%struct.list* %3, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @linked_list_add(%struct.list* %3, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @linked_list_add(%struct.list* %3, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
%8 = tail call i32 @linked_list_count(%struct.list* %3)
%9 = icmp sgt i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %12, %2
%11 = tail call i32 @linked_list_free(%struct.list* %3)
ret i32 0
12: ; preds = %2, %12
%13 = phi i32 [ %16, %12 ], [ 0, %2 ]
%14 = tail call i8* @linked_list_get(%struct.list* %3, i32 %13)
%15 = tail call i32 @do_something_awesome(i8* %14)
%16 = add nuw nsw i32 %13, 1
%17 = tail call i32 @linked_list_count(%struct.list* %3)
%18 = icmp slt i32 %16, %17
br i1 %18, label %12, label %10
}