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

/* Variables and functions */
scalar_t__ __VERIFIER_nondet_int();
struct sl *create_sl_with_head_and_tail();
int /*<<< orphan*/ destroy_sl(struct sl *);
int /*<<< orphan*/ sl_random_insert(struct sl *);
int main() {
  struct sl *sl = create_sl_with_head_and_tail();
  int c = 0;
  while (c < 2 && __VERIFIER_nondet_int()) {
    sl_random_insert(sl);
    c++;
  }
  destroy_sl(sl);
  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_sl_with_head_and_tail@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
xor    %eax,%eax
cmpl   $0x2,-0x14(%rbp)
mov    %al,-0x15(%rbp)
jge    1181 <main+0x41>
mov    $0x0,%al
call   1060 <__VERIFIER_nondet_int@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1191 <main+0x51>
jmp    11a8 <main+0x68>
mov    -0x10(%rbp),%rdi
call   1030 <sl_random_insert@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1161 <main+0x21>
mov    -0x10(%rbp),%rdi
call   1040 <destroy_sl@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1050 <create_sl_with_head_and_tail@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1060 <__VERIFIER_nondet_int@plt>
test   %rax,%rax
je     1173 <main+0x33>
mov    %rbx,%rdi
call   1030 <sl_random_insert@plt>
xor    %eax,%eax
call   1060 <__VERIFIER_nondet_int@plt>
test   %rax,%rax
je     1173 <main+0x33>
mov    %rbx,%rdi
call   1030 <sl_random_insert@plt>
mov    %rbx,%rdi
call   1040 <destroy_sl@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.sl = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.sl*
%3 = alloca i32
store i32 0, i32* %1
%4 = call %struct.sl* (...) @create_sl_with_head_and_tail()
store %struct.sl* %4, %struct.sl** %2
store i32 0, i32* %3
br label %5
5: ; preds = %13, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 2
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = call i64 (...) @__VERIFIER_nondet_int()
%10 = icmp ne i64 %9, 0
br label %11
11: ; preds = %8, %5
%12 = phi i1 [ false, %5 ], [ %10, %8 ]
br i1 %12, label %13, label %18
13: ; preds = %11
%14 = load %struct.sl*, %struct.sl** %2
%15 = call i32 @sl_random_insert(%struct.sl* %14)
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %5
18: ; preds = %11
%19 = load %struct.sl*, %struct.sl** %2
%20 = call i32 @destroy_sl(%struct.sl* %19)
ret i32 0
}

LLVM IR (-O2):
%struct.sl = type { i32 }
define i32 @main() {
%1 = tail call %struct.sl* (...) @create_sl_with_head_and_tail()
%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 @sl_random_insert(%struct.sl* %1)
%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 @sl_random_insert(%struct.sl* %1)
br label %10
10: ; preds = %8, %4, %0
%11 = tail call i32 @destroy_sl(%struct.sl* %1)
ret i32 0
}