#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*/ __ESBMC_assume(int);
int /*<<< orphan*/ assert(int);
int nondet_bool();
int main() {
  int bees, fleas;
  unsigned int foo = (unsigned int *)&bees;
  unsigned int bar = (unsigned int *)&fleas;
  bool baz = nondet_bool();
  __ESBMC_assume(baz == true);
  unsigned int qux = (baz) ? foo : bar;
  int *fin = (int *)qux;
  assert(fin == &bees);
  *fin = 0;
  assert(bees == 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rax
mov    %eax,-0x10(%rbp)
lea    -0xc(%rbp),%rax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1050 <nondet_bool@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x1,-0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <__ESBMC_assume@plt>
cmpl   $0x0,-0x18(%rbp)
je     117d <main+0x4d>
mov    -0x10(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    1183 <main+0x53>
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %rax,-0x28(%rbp)
lea    -0x8(%rbp),%rax
cmp    %rax,-0x28(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x28(%rbp),%rax
movl   $0x0,(%rax)
cmpl   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1050 <nondet_bool@plt>
mov    %eax,%ebx
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1030 <__ESBMC_assume@plt>
test   %ebx,%ebx
lea    0xc(%rsp),%rax
lea    0x8(%rsp),%rcx
cmovne %rcx,%rax
mov    %eax,%ebx
xor    %edi,%edi
cmp    %rbx,%rcx
sete   %dil
call   1040 <assert@plt>
movl   $0x0,(%rbx)
xor    %edi,%edi
cmpl   $0x0,0x8(%rsp)
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

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