#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*/ add(struct list *, int);
int /*<<< orphan*/ assert(int);
struct list *create_list();
int /*<<< orphan*/ dispose(struct list *);
int list_length(struct list *);
int main() {
  struct list *l = create_list();
  add(l, 1);
  add(l, 2);
  add(l, 2);
  add(l, 4);
  int tmp = list_length(l);
  assert(tmp == 4);
  dispose(l);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <create_list@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1040 <add@plt>
mov    -0x10(%rbp),%rdi
mov    $0x2,%esi
call   1040 <add@plt>
mov    -0x10(%rbp),%rdi
mov    $0x2,%esi
call   1040 <add@plt>
mov    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1040 <add@plt>
mov    -0x10(%rbp),%rdi
call   1070 <list_length@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1030 <dispose@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1050 <create_list@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x1,%esi
call   1040 <add@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <add@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <add@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1040 <add@plt>
mov    %rbx,%rdi
call   1070 <list_length@plt>
xor    %edi,%edi
cmp    $0x4,%eax
sete   %dil
call   1060 <assert@plt>
mov    %rbx,%rdi
call   1030 <dispose@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.list = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.list*
%3 = alloca i32
store i32 0, i32* %1
%4 = call %struct.list* (...) @create_list()
store %struct.list* %4, %struct.list** %2
%5 = load %struct.list*, %struct.list** %2
%6 = call i32 @add(%struct.list* %5, i32 1)
%7 = load %struct.list*, %struct.list** %2
%8 = call i32 @add(%struct.list* %7, i32 2)
%9 = load %struct.list*, %struct.list** %2
%10 = call i32 @add(%struct.list* %9, i32 2)
%11 = load %struct.list*, %struct.list** %2
%12 = call i32 @add(%struct.list* %11, i32 4)
%13 = load %struct.list*, %struct.list** %2
%14 = call i32 @list_length(%struct.list* %13)
store i32 %14, i32* %3
%15 = load i32, i32* %3
%16 = icmp eq i32 %15, 4
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = load %struct.list*, %struct.list** %2
%20 = call i32 @dispose(%struct.list* %19)
ret i32 0
}

LLVM IR (-O2):
%struct.list = type { i32 }
define i32 @main() {
%1 = tail call %struct.list* (...) @create_list()
%2 = tail call i32 @add(%struct.list* %1, i32 1)
%3 = tail call i32 @add(%struct.list* %1, i32 2)
%4 = tail call i32 @add(%struct.list* %1, i32 2)
%5 = tail call i32 @add(%struct.list* %1, i32 4)
%6 = tail call i32 @list_length(%struct.list* %1)
%7 = icmp eq i32 %6, 4
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = tail call i32 @dispose(%struct.list* %1)
ret i32 0
}