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

/* Variables and functions */
int /*<<< orphan*/ assert(int);
struct llist *create_llist();
int /*<<< orphan*/ iter_dispose(struct iter *);
int iter_next(struct iter *);
int /*<<< orphan*/ llist_add(struct llist *, int);
struct iter *llist_create_iter(struct llist *);
int /*<<< orphan*/ llist_dispose(struct llist *);
int main2() {
  struct llist *l = create_llist();
  llist_add(l, 5);
  llist_add(l, 10);
  llist_add(l, 15);
  struct iter *i1 = llist_create_iter(l);
  struct iter *i2 = llist_create_iter(l);
  int i1e1 = iter_next(i1);
  assert(i1e1 == 5);
  int i2e1 = iter_next(i2);
  assert(i2e1 == 5);
  int i1e2 = iter_next(i1);
  assert(i1e2 == 10);
  int i2e2 = iter_next(i2);
  assert(i2e2 == 10);
  iter_dispose(i1);
  iter_dispose(i2);
  llist_dispose(l);
  return 0;
}


x86 assembly (clang, -O0):
<main2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    $0x0,%al
call   1060 <create_llist@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x5,%esi
call   1070 <llist_add@plt>
mov    -0x8(%rbp),%rdi
mov    $0xa,%esi
call   1070 <llist_add@plt>
mov    -0x8(%rbp),%rdi
mov    $0xf,%esi
call   1070 <llist_add@plt>
mov    -0x8(%rbp),%rdi
call   1080 <llist_create_iter@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1080 <llist_create_iter@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1090 <iter_next@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x5,-0x1c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x18(%rbp),%rdi
call   1090 <iter_next@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x5,-0x20(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1090 <iter_next@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xa,-0x24(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x18(%rbp),%rdi
call   1090 <iter_next@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0xa,-0x28(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1050 <iter_dispose@plt>
mov    -0x18(%rbp),%rdi
call   1050 <iter_dispose@plt>
mov    -0x8(%rbp),%rdi
call   1030 <llist_dispose@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main2>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1060 <create_llist@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x5,%esi
call   1070 <llist_add@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1070 <llist_add@plt>
mov    %rbx,%rdi
mov    $0xf,%esi
call   1070 <llist_add@plt>
mov    %rbx,%rdi
call   1080 <llist_create_iter@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1080 <llist_create_iter@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1090 <iter_next@plt>
xor    %edi,%edi
cmp    $0x5,%eax
sete   %dil
call   1040 <assert@plt>
mov    %r15,%rdi
call   1090 <iter_next@plt>
xor    %edi,%edi
cmp    $0x5,%eax
sete   %dil
call   1040 <assert@plt>
mov    %r14,%rdi
call   1090 <iter_next@plt>
xor    %edi,%edi
cmp    $0xa,%eax
sete   %dil
call   1040 <assert@plt>
mov    %r15,%rdi
call   1090 <iter_next@plt>
xor    %edi,%edi
cmp    $0xa,%eax
sete   %dil
call   1040 <assert@plt>
mov    %r14,%rdi
call   1050 <iter_dispose@plt>
mov    %r15,%rdi
call   1050 <iter_dispose@plt>
mov    %rbx,%rdi
call   1030 <llist_dispose@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.llist = type { i32 }
%struct.iter = type { i32 }
define i32 @main2() {
%1 = alloca %struct.llist*
%2 = alloca %struct.iter*
%3 = alloca %struct.iter*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = call %struct.llist* (...) @create_llist()
store %struct.llist* %8, %struct.llist** %1
%9 = load %struct.llist*, %struct.llist** %1
%10 = call i32 @llist_add(%struct.llist* %9, i32 5)
%11 = load %struct.llist*, %struct.llist** %1
%12 = call i32 @llist_add(%struct.llist* %11, i32 10)
%13 = load %struct.llist*, %struct.llist** %1
%14 = call i32 @llist_add(%struct.llist* %13, i32 15)
%15 = load %struct.llist*, %struct.llist** %1
%16 = call %struct.iter* @llist_create_iter(%struct.llist* %15)
store %struct.iter* %16, %struct.iter** %2
%17 = load %struct.llist*, %struct.llist** %1
%18 = call %struct.iter* @llist_create_iter(%struct.llist* %17)
store %struct.iter* %18, %struct.iter** %3
%19 = load %struct.iter*, %struct.iter** %2
%20 = call i32 @iter_next(%struct.iter* %19)
store i32 %20, i32* %4
%21 = load i32, i32* %4
%22 = icmp eq i32 %21, 5
%23 = zext i1 %22 to i32
%24 = call i32 @assert(i32 %23)
%25 = load %struct.iter*, %struct.iter** %3
%26 = call i32 @iter_next(%struct.iter* %25)
store i32 %26, i32* %5
%27 = load i32, i32* %5
%28 = icmp eq i32 %27, 5
%29 = zext i1 %28 to i32
%30 = call i32 @assert(i32 %29)
%31 = load %struct.iter*, %struct.iter** %2
%32 = call i32 @iter_next(%struct.iter* %31)
store i32 %32, i32* %6
%33 = load i32, i32* %6
%34 = icmp eq i32 %33, 10
%35 = zext i1 %34 to i32
%36 = call i32 @assert(i32 %35)
%37 = load %struct.iter*, %struct.iter** %3
%38 = call i32 @iter_next(%struct.iter* %37)
store i32 %38, i32* %7
%39 = load i32, i32* %7
%40 = icmp eq i32 %39, 10
%41 = zext i1 %40 to i32
%42 = call i32 @assert(i32 %41)
%43 = load %struct.iter*, %struct.iter** %2
%44 = call i32 @iter_dispose(%struct.iter* %43)
%45 = load %struct.iter*, %struct.iter** %3
%46 = call i32 @iter_dispose(%struct.iter* %45)
%47 = load %struct.llist*, %struct.llist** %1
%48 = call i32 @llist_dispose(%struct.llist* %47)
ret i32 0
}

LLVM IR (-O2):
%struct.llist = type { i32 }
%struct.iter = type { i32 }
define i32 @main2() {
%1 = tail call %struct.llist* (...) @create_llist()
%2 = tail call i32 @llist_add(%struct.llist* %1, i32 5)
%3 = tail call i32 @llist_add(%struct.llist* %1, i32 10)
%4 = tail call i32 @llist_add(%struct.llist* %1, i32 15)
%5 = tail call %struct.iter* @llist_create_iter(%struct.llist* %1)
%6 = tail call %struct.iter* @llist_create_iter(%struct.llist* %1)
%7 = tail call i32 @iter_next(%struct.iter* %5)
%8 = icmp eq i32 %7, 5
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = tail call i32 @iter_next(%struct.iter* %6)
%12 = icmp eq i32 %11, 5
%13 = zext i1 %12 to i32
%14 = tail call i32 @assert(i32 %13)
%15 = tail call i32 @iter_next(%struct.iter* %5)
%16 = icmp eq i32 %15, 10
%17 = zext i1 %16 to i32
%18 = tail call i32 @assert(i32 %17)
%19 = tail call i32 @iter_next(%struct.iter* %6)
%20 = icmp eq i32 %19, 10
%21 = zext i1 %20 to i32
%22 = tail call i32 @assert(i32 %21)
%23 = tail call i32 @iter_dispose(%struct.iter* %5)
%24 = tail call i32 @iter_dispose(%struct.iter* %6)
%25 = tail call i32 @llist_dispose(%struct.llist* %1)
ret i32 0
}