#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 */
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ strcpy(char *, char *);
int main(void) {
  typedef struct JB {
    char actor[25];
    struct JB *next;
  } jb;
  char *bonds[6] = {"Sean Connery", "David Niven",    "George Lazenby",
                    "Roger Moore",  "Timothy Dalton", "Pierce Brosnan"};
  jb *current_item;
  jb *first_item;
  jb *new_item;
  int index = 0;
  first_item = (jb *)malloc(sizeof(jb));
  current_item = first_item;
  while (1) {
    strcpy(current_item->actor, bonds[index]);
    index++;
    if (index < 6) {
      new_item = (jb *)malloc(sizeof(jb));
      current_item->next = new_item;
      current_item = new_item;
    } else {
      current_item->next = NULL;
      break;
    }
  }
  current_item = first_item;
  index = 1;
  while (current_item) {
    printf("\nStructure %d: ", index++);
    printf("%s\n", current_item->actor);
    current_item = current_item->next;
  }
  putchar('\n');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1060 <memset@plt>
lea    0xe8a(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    0xe8c(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xe8d(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xe91(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xe92(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xe96(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x5c(%rbp)
mov    $0x28,%edi
call   1070 <malloc@plt>
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
movslq -0x5c(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rsi
call   1040 <strcpy@plt>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
cmpl   $0x6,-0x5c(%rbp)
jge    121a <main+0xca>
mov    $0x28,%edi
call   1070 <malloc@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rcx
mov    -0x48(%rbp),%rax
mov    %rcx,0x20(%rax)
mov    -0x58(%rbp),%rax
mov    %rax,-0x48(%rbp)
jmp    122b <main+0xdb>
mov    -0x48(%rbp),%rax
movq   $0x0,0x20(%rax)
jmp    1230 <main+0xe0>
jmp    11ce <main+0x7e>
mov    -0x50(%rbp),%rax
mov    %rax,-0x48(%rbp)
movl   $0x1,-0x5c(%rbp)
cmpq   $0x0,-0x48(%rbp)
je     1285 <main+0x135>
mov    -0x5c(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x5c(%rbp)
movslq %eax,%rsi
lea    0xdf3(%rip),%rdi
call   1050 <printf@plt>
mov    -0x48(%rbp),%rsi
lea    0xdf3(%rip),%rdi
call   1050 <printf@plt>
mov    -0x48(%rbp),%rax
mov    0x20(%rax),%rax
mov    %rax,-0x48(%rbp)
jmp    123f <main+0xef>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    $0x28,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
lea    0xea4(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
mov    $0x28,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    %rax,0x20(%rbx)
lea    0xe91(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
mov    $0x28,%edi
call   1060 <malloc@plt>
mov    %rax,%r15
mov    %rax,0x20(%r14)
lea    0xe7d(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
mov    $0x28,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    %rax,0x20(%r15)
lea    0xe6c(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
mov    $0x28,%edi
call   1060 <malloc@plt>
mov    %rax,%r15
mov    %rax,0x20(%r14)
lea    0xe58(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
mov    $0x28,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    %rax,0x20(%r15)
lea    0xe47(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
movq   $0x0,0x20(%r14)
test   %rbx,%rbx
je     1253 <main+0x113>
mov    $0x1,%esi
lea    0xe35(%rip),%r14
lea    0xe3e(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0x1(%rsi),%r12
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
mov    0x20(%rbx),%rbx
mov    %r12,%rsi
test   %rbx,%rbx
jne    1230 <main+0xf0>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.JB = type { [25 x i8], %struct.JB* }
@.str = [13 x i8] c"Sean Connery\00"
@.str.1 = [12 x i8] c"David Niven\00"
@.str.2 = [15 x i8] c"George Lazenby\00"
@.str.3 = [12 x i8] c"Roger Moore\00"
@.str.4 = [15 x i8] c"Timothy Dalton\00"
@.str.5 = [15 x i8] c"Pierce Brosnan\00"
@.str.6 = [16 x i8] c"\0AStructure %d: \00"
@.str.7 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i8*]
%3 = alloca %struct.JB*
%4 = alloca %struct.JB*
%5 = alloca %struct.JB*
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [6 x i8*]* %2 to i8*
%8 = bitcast i8* %7 to [6 x i8*]*
%9 = getelementptr inbounds [6 x i8*], [6 x i8*]* %8, i32 0, i32 0
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i32 0, i32 0), i8** %9
%10 = getelementptr inbounds [6 x i8*], [6 x i8*]* %8, i32 0, i32 1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i32 0, i32 0), i8** %10
%11 = getelementptr inbounds [6 x i8*], [6 x i8*]* %8, i32 0, i32 2
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i32 0, i32 0), i8** %11
%12 = getelementptr inbounds [6 x i8*], [6 x i8*]* %8, i32 0, i32 3
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i32 0, i32 0), i8** %12
%13 = getelementptr inbounds [6 x i8*], [6 x i8*]* %8, i32 0, i32 4
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i32 0, i32 0), i8** %13
%14 = getelementptr inbounds [6 x i8*], [6 x i8*]* %8, i32 0, i32 5
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i32 0, i32 0), i8** %14
store i32 0, i32* %6
%15 = call i64 @malloc(i32 40)
%16 = inttoptr i64 %15 to %struct.JB*
store %struct.JB* %16, %struct.JB** %4
%17 = load %struct.JB*, %struct.JB** %4
store %struct.JB* %17, %struct.JB** %3
br label %18
18: ; preds = %0, %41
%19 = load %struct.JB*, %struct.JB** %3
%20 = getelementptr inbounds %struct.JB, %struct.JB* %19, i32 0, i32 0
%21 = getelementptr inbounds [25 x i8], [25 x i8]* %20, i64 0, i64 0
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [6 x i8*], [6 x i8*]* %2, i64 0, i64 %23
%25 = load i8*, i8** %24
%26 = call i32 @strcpy(i8* %21, i8* %25)
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %6
%29 = load i32, i32* %6
%30 = icmp slt i32 %29, 6
br i1 %30, label %31, label %38
31: ; preds = %18
%32 = call i64 @malloc(i32 40)
%33 = inttoptr i64 %32 to %struct.JB*
store %struct.JB* %33, %struct.JB** %5
%34 = load %struct.JB*, %struct.JB** %5
%35 = load %struct.JB*, %struct.JB** %3
%36 = getelementptr inbounds %struct.JB, %struct.JB* %35, i32 0, i32 1
store %struct.JB* %34, %struct.JB** %36
%37 = load %struct.JB*, %struct.JB** %5
store %struct.JB* %37, %struct.JB** %3
br label %41
38: ; preds = %18
%39 = load %struct.JB*, %struct.JB** %3
%40 = getelementptr inbounds %struct.JB, %struct.JB* %39, i32 0, i32 1
store %struct.JB* null, %struct.JB** %40
br label %42
41: ; preds = %31
br label %18
42: ; preds = %38
%43 = load %struct.JB*, %struct.JB** %4
store %struct.JB* %43, %struct.JB** %3
store i32 1, i32* %6
br label %44
44: ; preds = %47, %42
%45 = load %struct.JB*, %struct.JB** %3
%46 = icmp ne %struct.JB* %45, null
br i1 %46, label %47, label %60
47: ; preds = %44
%48 = load i32, i32* %6
%49 = add nsw i32 %48, 1
store i32 %49, i32* %6
%50 = sext i32 %48 to i64
%51 = inttoptr i64 %50 to i8*
%52 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* %51)
%53 = load %struct.JB*, %struct.JB** %3
%54 = getelementptr inbounds %struct.JB, %struct.JB* %53, i32 0, i32 0
%55 = getelementptr inbounds [25 x i8], [25 x i8]* %54, i64 0, i64 0
%56 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %55)
%57 = load %struct.JB*, %struct.JB** %3
%58 = getelementptr inbounds %struct.JB, %struct.JB* %57, i32 0, i32 1
%59 = load %struct.JB*, %struct.JB** %58
store %struct.JB* %59, %struct.JB** %3
br label %44
60: ; preds = %44
%61 = call i32 @putchar(i8 signext 10)
ret i32 0
}

LLVM IR (-O2):
%struct.JB = type { [25 x i8], %struct.JB* }
@.str = [13 x i8] c"Sean Connery\00"
@.str.1 = [12 x i8] c"David Niven\00"
@.str.2 = [15 x i8] c"George Lazenby\00"
@.str.3 = [12 x i8] c"Roger Moore\00"
@.str.4 = [15 x i8] c"Timothy Dalton\00"
@.str.5 = [15 x i8] c"Pierce Brosnan\00"
@.str.6 = [16 x i8] c"\0AStructure %d: \00"
@.str.7 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 40)
%2 = inttoptr i64 %1 to %struct.JB*
%3 = getelementptr inbounds %struct.JB, %struct.JB* %2, i64 0, i32 0, i64 0
%4 = tail call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%5 = tail call i64 @malloc(i32 40)
%6 = inttoptr i64 %5 to %struct.JB*
%7 = getelementptr inbounds %struct.JB, %struct.JB* %2, i64 0, i32 1
store %struct.JB* %6, %struct.JB** %7
%8 = getelementptr inbounds %struct.JB, %struct.JB* %6, i64 0, i32 0, i64 0
%9 = tail call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i64 @malloc(i32 40)
%11 = inttoptr i64 %10 to %struct.JB*
%12 = getelementptr inbounds %struct.JB, %struct.JB* %6, i64 0, i32 1
store %struct.JB* %11, %struct.JB** %12
%13 = getelementptr inbounds %struct.JB, %struct.JB* %11, i64 0, i32 0, i64 0
%14 = tail call i32 @strcpy(i8* %13, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%15 = tail call i64 @malloc(i32 40)
%16 = inttoptr i64 %15 to %struct.JB*
%17 = getelementptr inbounds %struct.JB, %struct.JB* %11, i64 0, i32 1
store %struct.JB* %16, %struct.JB** %17
%18 = getelementptr inbounds %struct.JB, %struct.JB* %16, i64 0, i32 0, i64 0
%19 = tail call i32 @strcpy(i8* %18, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%20 = tail call i64 @malloc(i32 40)
%21 = inttoptr i64 %20 to %struct.JB*
%22 = getelementptr inbounds %struct.JB, %struct.JB* %16, i64 0, i32 1
store %struct.JB* %21, %struct.JB** %22
%23 = getelementptr inbounds %struct.JB, %struct.JB* %21, i64 0, i32 0, i64 0
%24 = tail call i32 @strcpy(i8* %23, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%25 = tail call i64 @malloc(i32 40)
%26 = inttoptr i64 %25 to %struct.JB*
%27 = getelementptr inbounds %struct.JB, %struct.JB* %21, i64 0, i32 1
store %struct.JB* %26, %struct.JB** %27
%28 = getelementptr inbounds %struct.JB, %struct.JB* %26, i64 0, i32 0, i64 0
%29 = tail call i32 @strcpy(i8* %28, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
%30 = getelementptr inbounds %struct.JB, %struct.JB* %26, i64 0, i32 1
store %struct.JB* null, %struct.JB** %30
%31 = icmp eq i64 %1, 0
br i1 %31, label %43, label %32
32: ; preds = %0, %32
%33 = phi i64 [ %35, %32 ], [ 1, %0 ]
%34 = phi %struct.JB* [ %41, %32 ], [ %2, %0 ]
%35 = add nuw i64 %33, 1
%36 = inttoptr i64 %33 to i8*
%37 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* %36)
%38 = getelementptr inbounds %struct.JB, %struct.JB* %34, i64 0, i32 0, i64 0
%39 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %38)
%40 = getelementptr inbounds %struct.JB, %struct.JB* %34, i64 0, i32 1
%41 = load %struct.JB*, %struct.JB** %40
%42 = icmp eq %struct.JB* %41, null
br i1 %42, label %43, label %32
43: ; preds = %32, %0
%44 = tail call i32 @putchar(i8 signext 10)
ret i32 0
}