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

/* Variables and functions */
scalar_t__ __VERIFIER_nondet_int();
int /*<<< orphan*/ l0_destroy(struct L0 *, int);
int /*<<< orphan*/ l0_insert(struct L0 **);
int main() {
  static struct L0 *list;
  int c = 0;
  do {
    c++;
    l0_insert(&list);
  } while (c < 3 && __VERIFIER_nondet_int());
  l0_destroy(list, 4);
  l0_destroy(list, 3);
  l0_destroy(list, 2);
  l0_destroy(list, 1);
  l0_destroy(list, 0);
  return !!list;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
lea    0x2eea(%rip),%rdi
call   1050 <l0_insert@plt>
xor    %eax,%eax
cmpl   $0x3,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jge    117b <main+0x4b>
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1146 <main+0x16>
mov    0x2eb3(%rip),%rdi
mov    $0x4,%esi
call   1040 <l0_destroy@plt>
mov    0x2ea2(%rip),%rdi
mov    $0x3,%esi
call   1040 <l0_destroy@plt>
mov    0x2e91(%rip),%rdi
mov    $0x2,%esi
call   1040 <l0_destroy@plt>
mov    0x2e80(%rip),%rdi
mov    $0x1,%esi
call   1040 <l0_destroy@plt>
mov    0x2e6f(%rip),%rdi
xor    %esi,%esi
call   1040 <l0_destroy@plt>
cmpq   $0x0,0x2e60(%rip)
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x2f08(%rip),%rdi
call   1050 <l0_insert@plt>
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
test   %rax,%rax
je     116d <main+0x3d>
lea    0x2ef0(%rip),%rdi
call   1050 <l0_insert@plt>
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
test   %rax,%rax
je     116d <main+0x3d>
lea    0x2ed8(%rip),%rdi
call   1050 <l0_insert@plt>
mov    0x2ecc(%rip),%rdi
mov    $0x4,%esi
call   1040 <l0_destroy@plt>
mov    0x2ebb(%rip),%rdi
mov    $0x3,%esi
call   1040 <l0_destroy@plt>
mov    0x2eaa(%rip),%rdi
mov    $0x2,%esi
call   1040 <l0_destroy@plt>
mov    0x2e99(%rip),%rdi
mov    $0x1,%esi
call   1040 <l0_destroy@plt>
mov    0x2e88(%rip),%rdi
xor    %esi,%esi
call   1040 <l0_destroy@plt>
xor    %eax,%eax
cmpq   $0x0,0x2e77(%rip)
setne  %al
pop    %rcx
ret

LLVM IR (-O0):
%struct.L0 = type { i32 }
@main.list = internal global %struct.L0* null
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %13, %0
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 1
store i32 %5, i32* %2
%6 = call i32 @l0_insert(%struct.L0** @main.list)
br label %7
7: ; preds = %3
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 3
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = call i64 (...) @__VERIFIER_nondet_int()
%12 = icmp ne i64 %11, 0
br label %13
13: ; preds = %10, %7
%14 = phi i1 [ false, %7 ], [ %12, %10 ]
br i1 %14, label %3, label %15
15: ; preds = %13
%16 = load %struct.L0*, %struct.L0** @main.list
%17 = call i32 @l0_destroy(%struct.L0* %16, i32 4)
%18 = load %struct.L0*, %struct.L0** @main.list
%19 = call i32 @l0_destroy(%struct.L0* %18, i32 3)
%20 = load %struct.L0*, %struct.L0** @main.list
%21 = call i32 @l0_destroy(%struct.L0* %20, i32 2)
%22 = load %struct.L0*, %struct.L0** @main.list
%23 = call i32 @l0_destroy(%struct.L0* %22, i32 1)
%24 = load %struct.L0*, %struct.L0** @main.list
%25 = call i32 @l0_destroy(%struct.L0* %24, i32 0)
%26 = load %struct.L0*, %struct.L0** @main.list
%27 = icmp ne %struct.L0* %26, null
%28 = xor i1 %27, true
%29 = xor i1 %28, true
%30 = zext i1 %29 to i32
ret i32 %30
}

LLVM IR (-O2):
%struct.L0 = type { i32 }
@main.list = internal global %struct.L0* null
define i32 @main() {
%1 = tail call i32 @l0_insert(%struct.L0** @main.list)
%2 = tail call i64 (...) @__VERIFIER_nondet_int()
%3 = icmp eq i64 %2, 0
br i1 %3, label %10, label %4
4: ; preds = %0
%5 = tail call i32 @l0_insert(%struct.L0** @main.list)
%6 = tail call i64 (...) @__VERIFIER_nondet_int()
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = tail call i32 @l0_insert(%struct.L0** @main.list)
br label %10
10: ; preds = %8, %4, %0
%11 = load %struct.L0*, %struct.L0** @main.list
%12 = tail call i32 @l0_destroy(%struct.L0* %11, i32 4)
%13 = load %struct.L0*, %struct.L0** @main.list
%14 = tail call i32 @l0_destroy(%struct.L0* %13, i32 3)
%15 = load %struct.L0*, %struct.L0** @main.list
%16 = tail call i32 @l0_destroy(%struct.L0* %15, i32 2)
%17 = load %struct.L0*, %struct.L0** @main.list
%18 = tail call i32 @l0_destroy(%struct.L0* %17, i32 1)
%19 = load %struct.L0*, %struct.L0** @main.list
%20 = tail call i32 @l0_destroy(%struct.L0* %19, i32 0)
%21 = load %struct.L0*, %struct.L0** @main.list
%22 = icmp ne %struct.L0* %21, null
%23 = zext i1 %22 to i32
ret i32 %23
}