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

/* Variables and functions */
scalar_t__ ___sl_get_nondet_int();
int /*<<< orphan*/ chain_node(struct node **);
struct node *create_sll(const struct node **pp1, const struct node **pp2) {
  struct node *list = NULL;
  do
    chain_node(&list);
  while (___sl_get_nondet_int());
  *pp2 = list;
  while (___sl_get_nondet_int())
    chain_node(&list);
  *pp1 = list;
  do
    chain_node(&list);
  while (___sl_get_nondet_int());
  return list;
}


x86 assembly (clang, -O0):
<create_sll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
call   1040 <chain_node@plt>
mov    $0x0,%al
call   1030 <___sl_get_nondet_int@plt>
cmp    $0x0,%rax
jne    1138 <create_sll+0x18>
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    $0x0,%al
call   1030 <___sl_get_nondet_int@plt>
cmp    $0x0,%rax
je     117c <create_sll+0x5c>
lea    -0x18(%rbp),%rdi
call   1040 <chain_node@plt>
jmp    115d <create_sll+0x3d>
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
lea    -0x18(%rbp),%rdi
call   1040 <chain_node@plt>
mov    $0x0,%al
call   1030 <___sl_get_nondet_int@plt>
cmp    $0x0,%rax
jne    1187 <create_sll+0x67>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_sll>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r15
mov    %rdi,%r14
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rbx
nopl   (%rax)
mov    %rbx,%rdi
call   1040 <chain_node@plt>
xor    %eax,%eax
call   1030 <___sl_get_nondet_int@plt>
test   %rax,%rax
jne    1140 <create_sll+0x20>
mov    0x8(%rsp),%rax
mov    %rax,(%r15)
xor    %eax,%eax
call   1030 <___sl_get_nondet_int@plt>
test   %rax,%rax
je     1184 <create_sll+0x64>
lea    0x8(%rsp),%rbx
nopl   (%rax)
mov    %rbx,%rdi
call   1040 <chain_node@plt>
xor    %eax,%eax
call   1030 <___sl_get_nondet_int@plt>
test   %rax,%rax
jne    1170 <create_sll+0x50>
mov    0x8(%rsp),%rax
mov    %rax,(%r14)
lea    0x8(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <chain_node@plt>
xor    %eax,%eax
call   1030 <___sl_get_nondet_int@plt>
test   %rax,%rax
jne    11a0 <create_sll+0x80>
mov    0x8(%rsp),%rax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.node = type { i32 }
define %struct.node* @create_sll(%struct.node** %0, %struct.node** %1) {
%3 = alloca %struct.node**
%4 = alloca %struct.node**
%5 = alloca %struct.node*
store %struct.node** %0, %struct.node*** %3
store %struct.node** %1, %struct.node*** %4
store %struct.node* null, %struct.node** %5
br label %6
6: ; preds = %8, %2
%7 = call i32 @chain_node(%struct.node** %5)
br label %8
8: ; preds = %6
%9 = call i64 (...) @___sl_get_nondet_int()
%10 = icmp ne i64 %9, 0
br i1 %10, label %6, label %11
11: ; preds = %8
%12 = load %struct.node*, %struct.node** %5
%13 = load %struct.node**, %struct.node*** %4
store %struct.node* %12, %struct.node** %13
br label %14
14: ; preds = %17, %11
%15 = call i64 (...) @___sl_get_nondet_int()
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 @chain_node(%struct.node** %5)
br label %14
19: ; preds = %14
%20 = load %struct.node*, %struct.node** %5
%21 = load %struct.node**, %struct.node*** %3
store %struct.node* %20, %struct.node** %21
br label %22
22: ; preds = %24, %19
%23 = call i32 @chain_node(%struct.node** %5)
br label %24
24: ; preds = %22
%25 = call i64 (...) @___sl_get_nondet_int()
%26 = icmp ne i64 %25, 0
br i1 %26, label %22, label %27
27: ; preds = %24
%28 = load %struct.node*, %struct.node** %5
ret %struct.node* %28
}

LLVM IR (-O2):
%struct.node = type { i32 }
define %struct.node* @create_sll(%struct.node** nocapture writeonly %0, %struct.node** nocapture writeonly %1) {
%3 = alloca %struct.node*
%4 = bitcast %struct.node** %3 to i8*
store %struct.node* null, %struct.node** %3
br label %5
5: ; preds = %5, %2
%6 = call i32 @chain_node(%struct.node** %3)
%7 = call i64 (...) @___sl_get_nondet_int()
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %5
9: ; preds = %5
%10 = load %struct.node*, %struct.node** %3
store %struct.node* %10, %struct.node** %1
%11 = call i64 (...) @___sl_get_nondet_int()
%12 = icmp eq i64 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %9, %13
%14 = call i32 @chain_node(%struct.node** %3)
%15 = call i64 (...) @___sl_get_nondet_int()
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %13
17: ; preds = %13, %9
%18 = load %struct.node*, %struct.node** %3
store %struct.node* %18, %struct.node** %0
br label %19
19: ; preds = %19, %17
%20 = call i32 @chain_node(%struct.node** %3)
%21 = call i64 (...) @___sl_get_nondet_int()
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %19
23: ; preds = %19
%24 = load %struct.node*, %struct.node** %3
ret %struct.node* %24
}