#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) {
  printf("\nlinkedlists started\n\n");
  struct entry {
    int value;
    struct entry *next;
  };
  struct entry n1, n2, n3;
  int i;
  n1.value = 100;
  n2.value = 200;
  n3.value = 300;
  n1.next = &n2;
  n2.next = &n3;
  i = n1.next->value;
  printf("%i ", i);
  printf("%i\n", n2.next->value);
  printf("\nlinkedlists ended\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x64,-0x18(%rbp)
movl   $0xc8,-0x28(%rbp)
movl   $0x12c,-0x38(%rbp)
lea    -0x28(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    -0x38(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%esi
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee0(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
mov    $0xc8,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebd(%rip),%rdi
mov    $0x12c,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec4(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.entry = type { i32, %struct.entry* }
@.str = [23 x i8] c"\0Alinkedlists started\0A\0A\00"
@.str.1 = [4 x i8] c"%i \00"
@.str.2 = [4 x i8] c"%i\0A\00"
@.str.3 = [21 x i8] c"\0Alinkedlists ended\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.entry
%3 = alloca %struct.entry
%4 = alloca %struct.entry
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds %struct.entry, %struct.entry* %2, i32 0, i32 0
store i32 100, i32* %7
%8 = getelementptr inbounds %struct.entry, %struct.entry* %3, i32 0, i32 0
store i32 200, i32* %8
%9 = getelementptr inbounds %struct.entry, %struct.entry* %4, i32 0, i32 0
store i32 300, i32* %9
%10 = getelementptr inbounds %struct.entry, %struct.entry* %2, i32 0, i32 1
store %struct.entry* %3, %struct.entry** %10
%11 = getelementptr inbounds %struct.entry, %struct.entry* %3, i32 0, i32 1
store %struct.entry* %4, %struct.entry** %11
%12 = getelementptr inbounds %struct.entry, %struct.entry* %2, i32 0, i32 1
%13 = load %struct.entry*, %struct.entry** %12
%14 = getelementptr inbounds %struct.entry, %struct.entry* %13, i32 0, i32 0
%15 = load i32, i32* %14
store i32 %15, i32* %5
%16 = load i32, i32* %5
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = getelementptr inbounds %struct.entry, %struct.entry* %3, i32 0, i32 1
%19 = load %struct.entry*, %struct.entry** %18
%20 = getelementptr inbounds %struct.entry, %struct.entry* %19, i32 0, i32 0
%21 = load i32, i32* %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.entry = type { i32, %struct.entry* }
@.str.1 = [4 x i8] c"%i \00"
@.str.2 = [4 x i8] c"%i\0A\00"
@str = [22 x i8] c"\0Alinkedlists started\0A\00"
@str.4 = [20 x i8] c"\0Alinkedlists ended\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 200)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 300)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.4, i64 0, i64 0))
ret i32 0
}