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

/* Variables and functions */
int /*<<< orphan*/ assert(int);
struct llist *create_llist();
int /*<<< orphan*/ llist_add(struct llist *, int);
int /*<<< orphan*/ llist_append(struct llist *, struct llist *);
int /*<<< orphan*/ llist_dispose(struct llist *);
int llist_length(struct llist *);
int llist_lookup(struct llist *, int);
int llist_removeFirst(struct llist *);
int main() {
  struct llist *l1 = create_llist();
  struct llist *l2 = create_llist();
  llist_add(l1, 10);
  llist_add(l1, 20);
  llist_add(l1, 30);
  llist_add(l2, 40);
  llist_add(l2, 50);
  llist_add(l2, 60);
  int x = llist_removeFirst(l2);
  assert(x == 40);
  llist_append(l1, l2);
  int n = llist_length(l1);
  assert(n == 5);
  int e0 = llist_lookup(l1, 0);
  assert(e0 == 10);
  int e1 = llist_lookup(l1, 1);
  assert(e1 == 20);
  int e2 = llist_lookup(l1, 2);
  assert(e2 == 30);
  int e3 = llist_lookup(l1, 3);
  assert(e3 == 50);
  int e4 = llist_lookup(l1, 4);
  assert(e4 == 60);
  llist_dispose(l1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <create_llist@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1060 <create_llist@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0xa,%esi
call   1080 <llist_add@plt>
mov    -0x10(%rbp),%rdi
mov    $0x14,%esi
call   1080 <llist_add@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1e,%esi
call   1080 <llist_add@plt>
mov    -0x18(%rbp),%rdi
mov    $0x28,%esi
call   1080 <llist_add@plt>
mov    -0x18(%rbp),%rdi
mov    $0x32,%esi
call   1080 <llist_add@plt>
mov    -0x18(%rbp),%rdi
mov    $0x3c,%esi
call   1080 <llist_add@plt>
mov    -0x18(%rbp),%rdi
call   10a0 <llist_removeFirst@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x28,-0x1c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1070 <llist_append@plt>
mov    -0x10(%rbp),%rdi
call   1090 <llist_length@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x5,-0x20(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1030 <llist_lookup@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xa,-0x24(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1030 <llist_lookup@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x14,-0x28(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    $0x2,%esi
call   1030 <llist_lookup@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x1e,-0x2c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1030 <llist_lookup@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x32,-0x30(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1030 <llist_lookup@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x3c,-0x34(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1040 <llist_dispose@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1060 <create_llist@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1060 <create_llist@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    $0xa,%esi
call   1080 <llist_add@plt>
mov    %r14,%rdi
mov    $0x14,%esi
call   1080 <llist_add@plt>
mov    %r14,%rdi
mov    $0x1e,%esi
call   1080 <llist_add@plt>
mov    %rbx,%rdi
mov    $0x28,%esi
call   1080 <llist_add@plt>
mov    %rbx,%rdi
mov    $0x32,%esi
call   1080 <llist_add@plt>
mov    %rbx,%rdi
mov    $0x3c,%esi
call   1080 <llist_add@plt>
mov    %rbx,%rdi
call   10a0 <llist_removeFirst@plt>
xor    %edi,%edi
cmp    $0x28,%eax
sete   %dil
call   1050 <assert@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <llist_append@plt>
mov    %r14,%rdi
call   1090 <llist_length@plt>
xor    %edi,%edi
cmp    $0x5,%eax
sete   %dil
call   1050 <assert@plt>
mov    %r14,%rdi
xor    %esi,%esi
call   1030 <llist_lookup@plt>
xor    %edi,%edi
cmp    $0xa,%eax
sete   %dil
call   1050 <assert@plt>
mov    %r14,%rdi
mov    $0x1,%esi
call   1030 <llist_lookup@plt>
xor    %edi,%edi
cmp    $0x14,%eax
sete   %dil
call   1050 <assert@plt>
mov    %r14,%rdi
mov    $0x2,%esi
call   1030 <llist_lookup@plt>
xor    %edi,%edi
cmp    $0x1e,%eax
sete   %dil
call   1050 <assert@plt>
mov    %r14,%rdi
mov    $0x3,%esi
call   1030 <llist_lookup@plt>
xor    %edi,%edi
cmp    $0x32,%eax
sete   %dil
call   1050 <assert@plt>
mov    %r14,%rdi
mov    $0x4,%esi
call   1030 <llist_lookup@plt>
xor    %edi,%edi
cmp    $0x3c,%eax
sete   %dil
call   1050 <assert@plt>
mov    %r14,%rdi
call   1040 <llist_dispose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.llist = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.llist*
%3 = alloca %struct.llist*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
%11 = call %struct.llist* (...) @create_llist()
store %struct.llist* %11, %struct.llist** %2
%12 = call %struct.llist* (...) @create_llist()
store %struct.llist* %12, %struct.llist** %3
%13 = load %struct.llist*, %struct.llist** %2
%14 = call i32 @llist_add(%struct.llist* %13, i32 10)
%15 = load %struct.llist*, %struct.llist** %2
%16 = call i32 @llist_add(%struct.llist* %15, i32 20)
%17 = load %struct.llist*, %struct.llist** %2
%18 = call i32 @llist_add(%struct.llist* %17, i32 30)
%19 = load %struct.llist*, %struct.llist** %3
%20 = call i32 @llist_add(%struct.llist* %19, i32 40)
%21 = load %struct.llist*, %struct.llist** %3
%22 = call i32 @llist_add(%struct.llist* %21, i32 50)
%23 = load %struct.llist*, %struct.llist** %3
%24 = call i32 @llist_add(%struct.llist* %23, i32 60)
%25 = load %struct.llist*, %struct.llist** %3
%26 = call i32 @llist_removeFirst(%struct.llist* %25)
store i32 %26, i32* %4
%27 = load i32, i32* %4
%28 = icmp eq i32 %27, 40
%29 = zext i1 %28 to i32
%30 = call i32 @assert(i32 %29)
%31 = load %struct.llist*, %struct.llist** %2
%32 = load %struct.llist*, %struct.llist** %3
%33 = call i32 @llist_append(%struct.llist* %31, %struct.llist* %32)
%34 = load %struct.llist*, %struct.llist** %2
%35 = call i32 @llist_length(%struct.llist* %34)
store i32 %35, i32* %5
%36 = load i32, i32* %5
%37 = icmp eq i32 %36, 5
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
%40 = load %struct.llist*, %struct.llist** %2
%41 = call i32 @llist_lookup(%struct.llist* %40, i32 0)
store i32 %41, i32* %6
%42 = load i32, i32* %6
%43 = icmp eq i32 %42, 10
%44 = zext i1 %43 to i32
%45 = call i32 @assert(i32 %44)
%46 = load %struct.llist*, %struct.llist** %2
%47 = call i32 @llist_lookup(%struct.llist* %46, i32 1)
store i32 %47, i32* %7
%48 = load i32, i32* %7
%49 = icmp eq i32 %48, 20
%50 = zext i1 %49 to i32
%51 = call i32 @assert(i32 %50)
%52 = load %struct.llist*, %struct.llist** %2
%53 = call i32 @llist_lookup(%struct.llist* %52, i32 2)
store i32 %53, i32* %8
%54 = load i32, i32* %8
%55 = icmp eq i32 %54, 30
%56 = zext i1 %55 to i32
%57 = call i32 @assert(i32 %56)
%58 = load %struct.llist*, %struct.llist** %2
%59 = call i32 @llist_lookup(%struct.llist* %58, i32 3)
store i32 %59, i32* %9
%60 = load i32, i32* %9
%61 = icmp eq i32 %60, 50
%62 = zext i1 %61 to i32
%63 = call i32 @assert(i32 %62)
%64 = load %struct.llist*, %struct.llist** %2
%65 = call i32 @llist_lookup(%struct.llist* %64, i32 4)
store i32 %65, i32* %10
%66 = load i32, i32* %10
%67 = icmp eq i32 %66, 60
%68 = zext i1 %67 to i32
%69 = call i32 @assert(i32 %68)
%70 = load %struct.llist*, %struct.llist** %2
%71 = call i32 @llist_dispose(%struct.llist* %70)
ret i32 0
}

LLVM IR (-O2):
%struct.llist = type { i32 }
define i32 @main() {
%1 = tail call %struct.llist* (...) @create_llist()
%2 = tail call %struct.llist* (...) @create_llist()
%3 = tail call i32 @llist_add(%struct.llist* %1, i32 10)
%4 = tail call i32 @llist_add(%struct.llist* %1, i32 20)
%5 = tail call i32 @llist_add(%struct.llist* %1, i32 30)
%6 = tail call i32 @llist_add(%struct.llist* %2, i32 40)
%7 = tail call i32 @llist_add(%struct.llist* %2, i32 50)
%8 = tail call i32 @llist_add(%struct.llist* %2, i32 60)
%9 = tail call i32 @llist_removeFirst(%struct.llist* %2)
%10 = icmp eq i32 %9, 40
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = tail call i32 @llist_append(%struct.llist* %1, %struct.llist* %2)
%14 = tail call i32 @llist_length(%struct.llist* %1)
%15 = icmp eq i32 %14, 5
%16 = zext i1 %15 to i32
%17 = tail call i32 @assert(i32 %16)
%18 = tail call i32 @llist_lookup(%struct.llist* %1, i32 0)
%19 = icmp eq i32 %18, 10
%20 = zext i1 %19 to i32
%21 = tail call i32 @assert(i32 %20)
%22 = tail call i32 @llist_lookup(%struct.llist* %1, i32 1)
%23 = icmp eq i32 %22, 20
%24 = zext i1 %23 to i32
%25 = tail call i32 @assert(i32 %24)
%26 = tail call i32 @llist_lookup(%struct.llist* %1, i32 2)
%27 = icmp eq i32 %26, 30
%28 = zext i1 %27 to i32
%29 = tail call i32 @assert(i32 %28)
%30 = tail call i32 @llist_lookup(%struct.llist* %1, i32 3)
%31 = icmp eq i32 %30, 50
%32 = zext i1 %31 to i32
%33 = tail call i32 @assert(i32 %32)
%34 = tail call i32 @llist_lookup(%struct.llist* %1, i32 4)
%35 = icmp eq i32 %34, 60
%36 = zext i1 %35 to i32
%37 = tail call i32 @assert(i32 %36)
%38 = tail call i32 @llist_dispose(%struct.llist* %1)
ret i32 0
}