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

/* Variables and functions */
int /*<<< orphan*/ Print(struct LIST *);
int /*<<< orphan*/ Push(struct LIST **, int);
int main() {
  int i = 10;
  struct LIST *list = NULL;
  while (i--) {
    Push(&list, i + 1);
  }
  Print(list);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1166 <main+0x46>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
lea    -0x10(%rbp),%rdi
call   1030 <Push@plt>
jmp    113e <main+0x1e>
mov    -0x10(%rbp),%rdi
call   1040 <Print@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <Push@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
call   1030 <Push@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1030 <Push@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1030 <Push@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1030 <Push@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <Push@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <Push@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <Push@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <Push@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <Push@plt>
mov    0x8(%rsp),%rdi
call   1040 <Print@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.LIST = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.LIST*
store i32 0, i32* %1
store i32 10, i32* %2
store %struct.LIST* null, %struct.LIST** %3
br label %4
4: ; preds = %8, %0
%5 = load i32, i32* %2
%6 = add nsw i32 %5, -1
store i32 %6, i32* %2
%7 = icmp ne i32 %5, 0
br i1 %7, label %8, label %12
8: ; preds = %4
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 1
%11 = call i32 @Push(%struct.LIST** %3, i32 %10)
br label %4
12: ; preds = %4
%13 = load %struct.LIST*, %struct.LIST** %3
%14 = call i32 @Print(%struct.LIST* %13)
ret i32 0
}

LLVM IR (-O2):
%struct.LIST = type { i32 }
define i32 @main() {
%1 = alloca %struct.LIST*
%2 = bitcast %struct.LIST** %1 to i8*
store %struct.LIST* null, %struct.LIST** %1
%3 = call i32 @Push(%struct.LIST** %1, i32 10)
%4 = call i32 @Push(%struct.LIST** %1, i32 9)
%5 = call i32 @Push(%struct.LIST** %1, i32 8)
%6 = call i32 @Push(%struct.LIST** %1, i32 7)
%7 = call i32 @Push(%struct.LIST** %1, i32 6)
%8 = call i32 @Push(%struct.LIST** %1, i32 5)
%9 = call i32 @Push(%struct.LIST** %1, i32 4)
%10 = call i32 @Push(%struct.LIST** %1, i32 3)
%11 = call i32 @Push(%struct.LIST** %1, i32 2)
%12 = call i32 @Push(%struct.LIST** %1, i32 1)
%13 = load %struct.LIST*, %struct.LIST** %1
%14 = call i32 @Print(%struct.LIST* %13)
ret i32 0
}