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

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ list_first(int, struct LinkedList *);
int /*<<< orphan*/ list_pushback(int, int, struct LinkedList *);
int /*<<< orphan*/ printf(char *, int);
scalar_t__ scanf(char *, int *);
void list_init(struct LinkedList *list) {
  int var;
  int iter = 0;
  while (scanf("%d", &var) != EOF) {
    printf("iter = %d\n", iter);
    if (iter == 0) {
      list_first(var, list);
    } else {
      list_pushback(var, 1, list);
    }
    iter++;
  }
}


x86 assembly (clang, -O0):
<list_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xea6(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    0x2e7e(%rip),%rcx
cmp    (%rcx),%rax
je     11bc <list_init+0x7c>
mov    -0x10(%rbp),%esi
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0x10(%rbp)
jne    119d <list_init+0x5d>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1060 <list_first@plt>
jmp    11ae <list_init+0x6e>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rdx
mov    $0x1,%esi
call   1040 <list_pushback@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1153 <list_init+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list_init>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xeab(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x2e82(%rip),%r13
cmp    0x0(%r13),%rax
je     11ef <list_init+0xaf>
lea    0xe8c(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    0x4(%rsp),%edi
mov    %rbx,%rsi
call   1060 <list_first@plt>
lea    0xe6f(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
cmp    0x0(%r13),%rax
je     11ef <list_init+0xaf>
mov    $0x1,%ebp
lea    0xe56(%rip),%r14
lea    0xe4c(%rip),%r15
lea    0x4(%rsp),%r12
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
mov    0x4(%rsp),%edi
mov    $0x1,%esi
mov    %rbx,%rdx
call   1040 <list_pushback@plt>
add    $0x1,%ebp
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
cmp    0x0(%r13),%rax
jne    11c0 <list_init+0x80>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.LinkedList = type { i32 }
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [11 x i8] c"iter = %d\0A\00"
define void @list_init(%struct.LinkedList* %0) {
%2 = alloca %struct.LinkedList*
%3 = alloca i32
%4 = alloca i32
store %struct.LinkedList* %0, %struct.LinkedList** %2
store i32 0, i32* %4
br label %5
5: ; preds = %22, %1
%6 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%7 = load i64, i64* @EOF
%8 = icmp ne i64 %6, %7
br i1 %8, label %9, label %25
9: ; preds = %5
%10 = load i32, i32* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %9
%15 = load i32, i32* %3
%16 = load %struct.LinkedList*, %struct.LinkedList** %2
%17 = call i32 @list_first(i32 %15, %struct.LinkedList* %16)
br label %22
18: ; preds = %9
%19 = load i32, i32* %3
%20 = load %struct.LinkedList*, %struct.LinkedList** %2
%21 = call i32 @list_pushback(i32 %19, i32 1, %struct.LinkedList* %20)
br label %22
22: ; preds = %18, %14
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %4
br label %5
25: ; preds = %5
ret void
}

LLVM IR (-O2):
%struct.LinkedList = type { i32 }
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [11 x i8] c"iter = %d\0A\00"
define void @list_init(%struct.LinkedList* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = load i64, i64* @EOF
%6 = icmp eq i64 %4, %5
br i1 %6, label %23, label %7
7: ; preds = %1
%8 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 0)
%9 = load i32, i32* %2
%10 = call i32 @list_first(i32 %9, %struct.LinkedList* %0)
%11 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%12 = load i64, i64* @EOF
%13 = icmp eq i64 %11, %12
br i1 %13, label %23, label %14
14: ; preds = %7, %14
%15 = phi i32 [ %19, %14 ], [ 1, %7 ]
%16 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = load i32, i32* %2
%18 = call i32 @list_pushback(i32 %17, i32 1, %struct.LinkedList* %0)
%19 = add nuw nsw i32 %15, 1
%20 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%21 = load i64, i64* @EOF
%22 = icmp eq i64 %20, %21
br i1 %22, label %23, label %14
23: ; preds = %14, %7, %1
ret void
}