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

/* Variables and functions */
int /*<<< orphan*/ freeList(struct node *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ printlist(struct node *);
int /*<<< orphan*/ searchlist(struct node *, char *);
struct node *updateList(struct node *, char *);
int main() {
  struct node *start = NULL;
  start = updateList(start, "Word One");
  start = updateList(start, "Word Two");
  start = updateList(start, "Word Three");
  start = updateList(start, "Word Four");
  printf("--- Initial list ---\n");
  printlist(start);
  searchlist(start, "Word Two");
  searchlist(start, "Dumplings");
  start = updateList(start, "Word Two");
  printf("\n\n--- Updated list ---\n");
  printlist(start);
  freeList(start);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe8e(%rip),%rsi
call   1040 <updateList@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe83(%rip),%rsi
call   1040 <updateList@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe78(%rip),%rsi
call   1040 <updateList@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe6f(%rip),%rsi
call   1040 <updateList@plt>
mov    %rax,-0x10(%rbp)
lea    0xe69(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1070 <printlist@plt>
mov    -0x10(%rbp),%rdi
lea    0xe32(%rip),%rsi
call   1060 <searchlist@plt>
mov    -0x10(%rbp),%rdi
lea    0xe56(%rip),%rsi
call   1060 <searchlist@plt>
mov    -0x10(%rbp),%rdi
lea    0xe12(%rip),%rsi
call   1040 <updateList@plt>
mov    %rax,-0x10(%rbp)
lea    0xe40(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1070 <printlist@plt>
mov    -0x10(%rbp),%rdi
call   1030 <freeList@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xea5(%rip),%rsi
xor    %edi,%edi
call   1050 <updateList@plt>
lea    0xea0(%rip),%r14
mov    %rax,%rdi
mov    %r14,%rsi
call   1050 <updateList@plt>
lea    0xe97(%rip),%rsi
mov    %rax,%rdi
call   1050 <updateList@plt>
lea    0xe93(%rip),%rsi
mov    %rax,%rdi
call   1050 <updateList@plt>
mov    %rax,%rbx
lea    0xe95(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1070 <printlist@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <searchlist@plt>
lea    0xe6c(%rip),%rsi
mov    %rbx,%rdi
call   1060 <searchlist@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <updateList@plt>
mov    %rax,%rbx
lea    0xe6e(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1070 <printlist@plt>
mov    %rbx,%rdi
call   1040 <freeList@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [9 x i8] c"Word One\00"
@.str.1 = [9 x i8] c"Word Two\00"
@.str.2 = [11 x i8] c"Word Three\00"
@.str.3 = [10 x i8] c"Word Four\00"
@.str.4 = [22 x i8] c"--- Initial list ---\0A\00"
@.str.5 = [10 x i8] c"Dumplings\00"
@.str.6 = [24 x i8] c"\0A\0A--- Updated list ---\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.node*
store i32 0, i32* %1
store %struct.node* null, %struct.node** %2
%3 = load %struct.node*, %struct.node** %2
%4 = call %struct.node* @updateList(%struct.node* %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store %struct.node* %4, %struct.node** %2
%5 = load %struct.node*, %struct.node** %2
%6 = call %struct.node* @updateList(%struct.node* %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
store %struct.node* %6, %struct.node** %2
%7 = load %struct.node*, %struct.node** %2
%8 = call %struct.node* @updateList(%struct.node* %7, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
store %struct.node* %8, %struct.node** %2
%9 = load %struct.node*, %struct.node** %2
%10 = call %struct.node* @updateList(%struct.node* %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
store %struct.node* %10, %struct.node** %2
%11 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%12 = load %struct.node*, %struct.node** %2
%13 = call i32 @printlist(%struct.node* %12)
%14 = load %struct.node*, %struct.node** %2
%15 = call i32 @searchlist(%struct.node* %14, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%16 = load %struct.node*, %struct.node** %2
%17 = call i32 @searchlist(%struct.node* %16, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%18 = load %struct.node*, %struct.node** %2
%19 = call %struct.node* @updateList(%struct.node* %18, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
store %struct.node* %19, %struct.node** %2
%20 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%21 = load %struct.node*, %struct.node** %2
%22 = call i32 @printlist(%struct.node* %21)
%23 = load %struct.node*, %struct.node** %2
%24 = call i32 @freeList(%struct.node* %23)
ret i32 0
}

LLVM IR (-O2):
%struct.node = type { i32 }
@.str = [9 x i8] c"Word One\00"
@.str.1 = [9 x i8] c"Word Two\00"
@.str.2 = [11 x i8] c"Word Three\00"
@.str.3 = [10 x i8] c"Word Four\00"
@.str.5 = [10 x i8] c"Dumplings\00"
@str = [21 x i8] c"--- Initial list ---\00"
@str.7 = [23 x i8] c"\0A\0A--- Updated list ---\00"
define i32 @main() {
%1 = tail call %struct.node* @updateList(%struct.node* null, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = tail call %struct.node* @updateList(%struct.node* %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call %struct.node* @updateList(%struct.node* %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call %struct.node* @updateList(%struct.node* %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @printlist(%struct.node* %4)
%7 = tail call i32 @searchlist(%struct.node* %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @searchlist(%struct.node* %4, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%9 = tail call %struct.node* @updateList(%struct.node* %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.7, i64 0, i64 0))
%11 = tail call i32 @printlist(%struct.node* %9)
%12 = tail call i32 @freeList(%struct.node* %9)
ret i32 0
}