#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*/ list_append(struct list *, int);
struct list *list_create(int /*<<< orphan*/);
int /*<<< orphan*/ list_destroy(struct list *);
int /*<<< orphan*/ list_remove(struct list *, int);
int /*<<< orphan*/ printlist(struct list *);
int main(void) {
  struct list *l = list_create(0);
  list_append(l, 1);
  list_append(l, 2);
  list_append(l, 3);
  list_append(l, 4);
  printlist(l);
  list_remove(l, 3);
  list_remove(l, 2);
  list_remove(l, 1);
  printlist(l);
  list_remove(l, 4);
  printlist(l);
  list_destroy(l);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1030 <list_create@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1050 <list_append@plt>
mov    -0x10(%rbp),%rdi
mov    $0x2,%esi
call   1050 <list_append@plt>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1050 <list_append@plt>
mov    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1050 <list_append@plt>
mov    -0x10(%rbp),%rdi
call   1070 <printlist@plt>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1060 <list_remove@plt>
mov    -0x10(%rbp),%rdi
mov    $0x2,%esi
call   1060 <list_remove@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1060 <list_remove@plt>
mov    -0x10(%rbp),%rdi
call   1070 <printlist@plt>
mov    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1060 <list_remove@plt>
mov    -0x10(%rbp),%rdi
call   1070 <printlist@plt>
mov    -0x10(%rbp),%rdi
call   1040 <list_destroy@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1030 <list_create@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x1,%esi
call   1050 <list_append@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1050 <list_append@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1050 <list_append@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1050 <list_append@plt>
mov    %rbx,%rdi
call   1070 <printlist@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1060 <list_remove@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1060 <list_remove@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1060 <list_remove@plt>
mov    %rbx,%rdi
call   1070 <printlist@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1060 <list_remove@plt>
mov    %rbx,%rdi
call   1070 <printlist@plt>
mov    %rbx,%rdi
call   1040 <list_destroy@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.list = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.list*
store i32 0, i32* %1
%3 = call %struct.list* @list_create(i32 0)
store %struct.list* %3, %struct.list** %2
%4 = load %struct.list*, %struct.list** %2
%5 = call i32 @list_append(%struct.list* %4, i32 1)
%6 = load %struct.list*, %struct.list** %2
%7 = call i32 @list_append(%struct.list* %6, i32 2)
%8 = load %struct.list*, %struct.list** %2
%9 = call i32 @list_append(%struct.list* %8, i32 3)
%10 = load %struct.list*, %struct.list** %2
%11 = call i32 @list_append(%struct.list* %10, i32 4)
%12 = load %struct.list*, %struct.list** %2
%13 = call i32 @printlist(%struct.list* %12)
%14 = load %struct.list*, %struct.list** %2
%15 = call i32 @list_remove(%struct.list* %14, i32 3)
%16 = load %struct.list*, %struct.list** %2
%17 = call i32 @list_remove(%struct.list* %16, i32 2)
%18 = load %struct.list*, %struct.list** %2
%19 = call i32 @list_remove(%struct.list* %18, i32 1)
%20 = load %struct.list*, %struct.list** %2
%21 = call i32 @printlist(%struct.list* %20)
%22 = load %struct.list*, %struct.list** %2
%23 = call i32 @list_remove(%struct.list* %22, i32 4)
%24 = load %struct.list*, %struct.list** %2
%25 = call i32 @printlist(%struct.list* %24)
%26 = load %struct.list*, %struct.list** %2
%27 = call i32 @list_destroy(%struct.list* %26)
ret i32 0
}

LLVM IR (-O2):
%struct.list = type { i32 }
define i32 @main() {
%1 = tail call %struct.list* @list_create(i32 0)
%2 = tail call i32 @list_append(%struct.list* %1, i32 1)
%3 = tail call i32 @list_append(%struct.list* %1, i32 2)
%4 = tail call i32 @list_append(%struct.list* %1, i32 3)
%5 = tail call i32 @list_append(%struct.list* %1, i32 4)
%6 = tail call i32 @printlist(%struct.list* %1)
%7 = tail call i32 @list_remove(%struct.list* %1, i32 3)
%8 = tail call i32 @list_remove(%struct.list* %1, i32 2)
%9 = tail call i32 @list_remove(%struct.list* %1, i32 1)
%10 = tail call i32 @printlist(%struct.list* %1)
%11 = tail call i32 @list_remove(%struct.list* %1, i32 4)
%12 = tail call i32 @printlist(%struct.list* %1)
%13 = tail call i32 @list_destroy(%struct.list* %1)
ret i32 0
}