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

/* Variables and functions */
int /*<<< orphan*/ add_to_list(struct linked_list_t *, int);
void fill_list(struct linked_list_t *list) {
  int i;
  for (i = 0; i < 10; i++) {
    add_to_list(list, 100 + i);
  }
}


x86 assembly (clang, -O0):
<fill_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    114a <fill_list+0x3a>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x64,%esi
call   1030 <add_to_list@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <fill_list+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill_list>:
push   %rbx
mov    %rdi,%rbx
mov    $0x64,%esi
call   1030 <add_to_list@plt>
mov    %rbx,%rdi
mov    $0x65,%esi
call   1030 <add_to_list@plt>
mov    %rbx,%rdi
mov    $0x66,%esi
call   1030 <add_to_list@plt>
mov    %rbx,%rdi
mov    $0x67,%esi
call   1030 <add_to_list@plt>
mov    %rbx,%rdi
mov    $0x68,%esi
call   1030 <add_to_list@plt>
mov    %rbx,%rdi
mov    $0x69,%esi
call   1030 <add_to_list@plt>
mov    %rbx,%rdi
mov    $0x6a,%esi
call   1030 <add_to_list@plt>
mov    %rbx,%rdi
mov    $0x6b,%esi
call   1030 <add_to_list@plt>
mov    %rbx,%rdi
mov    $0x6c,%esi
call   1030 <add_to_list@plt>
mov    %rbx,%rdi
mov    $0x6d,%esi
pop    %rbx
jmp    1030 <add_to_list@plt>

LLVM IR (-O0):
%struct.linked_list_t = type { i32 }
define void @fill_list(%struct.linked_list_t* %0) {
%2 = alloca %struct.linked_list_t*
%3 = alloca i32
store %struct.linked_list_t* %0, %struct.linked_list_t** %2
store i32 0, i32* %3
br label %4
4: ; preds = %12, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = load %struct.linked_list_t*, %struct.linked_list_t** %2
%9 = load i32, i32* %3
%10 = add nsw i32 100, %9
%11 = call i32 @add_to_list(%struct.linked_list_t* %8, i32 %10)
br label %12
12: ; preds = %7
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %4
15: ; preds = %4
ret void
}

LLVM IR (-O2):
%struct.linked_list_t = type { i32 }
define void @fill_list(%struct.linked_list_t* %0) {
%2 = tail call i32 @add_to_list(%struct.linked_list_t* %0, i32 100)
%3 = tail call i32 @add_to_list(%struct.linked_list_t* %0, i32 101)
%4 = tail call i32 @add_to_list(%struct.linked_list_t* %0, i32 102)
%5 = tail call i32 @add_to_list(%struct.linked_list_t* %0, i32 103)
%6 = tail call i32 @add_to_list(%struct.linked_list_t* %0, i32 104)
%7 = tail call i32 @add_to_list(%struct.linked_list_t* %0, i32 105)
%8 = tail call i32 @add_to_list(%struct.linked_list_t* %0, i32 106)
%9 = tail call i32 @add_to_list(%struct.linked_list_t* %0, i32 107)
%10 = tail call i32 @add_to_list(%struct.linked_list_t* %0, i32 108)
%11 = tail call i32 @add_to_list(%struct.linked_list_t* %0, i32 109)
ret void
}