#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 */

/* Variables and functions */
int /*<<< orphan*/ csolve_assert(int);
scalar_t__ malloc(int);
int nondet();
int main() {
  int *x = (int *)malloc(sizeof(int));
  *x = nondet();
  int *y = (int *)malloc(sizeof(int));
  *y = nondet();
  int **p = (int **)malloc(sizeof(int *));
  *p = x;
  int **q = (int **)malloc(sizeof(int *));
  *q = y;
  if (nondet()) {
    p = q;
  }
  csolve_assert(**p == **q);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <nondet@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <nondet@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    $0x0,%al
call   1030 <nondet@plt>
cmp    $0x0,%eax
je     11c3 <main+0x93>
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%eax
mov    -0x28(%rbp),%rcx
mov    (%rcx),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <csolve_assert@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1030 <nondet@plt>
mov    %eax,(%r14)
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,%r15
xor    %eax,%eax
call   1030 <nondet@plt>
mov    %eax,(%r15)
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %r14,(%rax)
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,%r14
mov    %r15,(%rax)
xor    %eax,%eax
call   1030 <nondet@plt>
test   %eax,%eax
cmovne %r14,%rbx
mov    (%rbx),%rax
mov    (%rax),%eax
mov    (%r14),%rcx
xor    %edi,%edi
cmp    (%rcx),%eax
sete   %dil
call   1050 <csolve_assert@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32**
%5 = alloca i32**
store i32 0, i32* %1
%6 = call i64 @malloc(i32 4)
%7 = inttoptr i64 %6 to i32*
store i32* %7, i32** %2
%8 = call i32 (...) @nondet()
%9 = load i32*, i32** %2
store i32 %8, i32* %9
%10 = call i64 @malloc(i32 4)
%11 = inttoptr i64 %10 to i32*
store i32* %11, i32** %3
%12 = call i32 (...) @nondet()
%13 = load i32*, i32** %3
store i32 %12, i32* %13
%14 = call i64 @malloc(i32 8)
%15 = inttoptr i64 %14 to i32**
store i32** %15, i32*** %4
%16 = load i32*, i32** %2
%17 = load i32**, i32*** %4
store i32* %16, i32** %17
%18 = call i64 @malloc(i32 8)
%19 = inttoptr i64 %18 to i32**
store i32** %19, i32*** %5
%20 = load i32*, i32** %3
%21 = load i32**, i32*** %5
store i32* %20, i32** %21
%22 = call i32 (...) @nondet()
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %0
%25 = load i32**, i32*** %5
store i32** %25, i32*** %4
br label %26
26: ; preds = %24, %0
%27 = load i32**, i32*** %4
%28 = load i32*, i32** %27
%29 = load i32, i32* %28
%30 = load i32**, i32*** %5
%31 = load i32*, i32** %30
%32 = load i32, i32* %31
%33 = icmp eq i32 %29, %32
%34 = zext i1 %33 to i32
%35 = call i32 @csolve_assert(i32 %34)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @malloc(i32 4)
%2 = inttoptr i64 %1 to i32*
%3 = tail call i32 (...) @nondet()
store i32 %3, i32* %2
%4 = tail call i64 @malloc(i32 4)
%5 = inttoptr i64 %4 to i32*
%6 = tail call i32 (...) @nondet()
store i32 %6, i32* %5
%7 = tail call i64 @malloc(i32 8)
%8 = inttoptr i64 %7 to i32**
store i32* %2, i32** %8
%9 = tail call i64 @malloc(i32 8)
%10 = inttoptr i64 %9 to i32**
store i32* %5, i32** %10
%11 = tail call i32 (...) @nondet()
%12 = icmp eq i32 %11, 0
%13 = select i1 %12, i32** %8, i32** %10
%14 = load i32*, i32** %13
%15 = load i32, i32* %14
%16 = load i32*, i32** %10
%17 = load i32, i32* %16
%18 = icmp eq i32 %15, %17
%19 = zext i1 %18 to i32
%20 = tail call i32 @csolve_assert(i32 %19)
ret i32 0
}