#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 */
scalar_t__ __VERIFIER_nondet_int();
int /*<<< orphan*/ free(void *);
void *malloc(unsigned int);
int main() {
  union {
    void *p0;
    struct {
      char c[2];
      int p1;
      int p2;
    } str;
  } data;
  data.p0 = malloc(37U);
  void *ptr = data.p0;
  if (__VERIFIER_nondet_int()) {
    data.str.p2 = 20;
  } else {
    data.str.p2 = 30;
  }
  if (25 > data.str.p2) {
    data.str.c[1] = sizeof data.str.p1;
  }
  free(data.p0);
  free(ptr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x25,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
cmp    $0x0,%rax
je     1172 <main+0x42>
movl   $0x14,-0x10(%rbp)
jmp    1179 <main+0x49>
movl   $0x1e,-0x10(%rbp)
mov    $0x19,%eax
cmp    -0x10(%rbp),%eax
jle    118b <main+0x5b>
movb   $0x4,-0x17(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x25,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
mov    %rbx,%rdi
and    $0xffffffffffff00ff,%rdi
or     $0x400,%rdi
test   %rax,%rax
cmove  %rbx,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%union.anon = type { i8*, [8 x i8] }
%struct.anon = type { [2 x i8], i32, i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %union.anon
%3 = alloca i8*
store i32 0, i32* %1
%4 = call i8* @malloc(i32 37)
%5 = bitcast %union.anon* %2 to i8**
store i8* %4, i8** %5
%6 = bitcast %union.anon* %2 to i8**
%7 = load i8*, i8** %6
store i8* %7, i8** %3
%8 = call i64 (...) @__VERIFIER_nondet_int()
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %0
%11 = bitcast %union.anon* %2 to %struct.anon*
%12 = getelementptr inbounds %struct.anon, %struct.anon* %11, i32 0, i32 2
store i32 20, i32* %12
br label %16
13: ; preds = %0
%14 = bitcast %union.anon* %2 to %struct.anon*
%15 = getelementptr inbounds %struct.anon, %struct.anon* %14, i32 0, i32 2
store i32 30, i32* %15
br label %16
16: ; preds = %13, %10
%17 = bitcast %union.anon* %2 to %struct.anon*
%18 = getelementptr inbounds %struct.anon, %struct.anon* %17, i32 0, i32 2
%19 = load i32, i32* %18
%20 = icmp sgt i32 25, %19
br i1 %20, label %21, label %25
21: ; preds = %16
%22 = bitcast %union.anon* %2 to %struct.anon*
%23 = getelementptr inbounds %struct.anon, %struct.anon* %22, i32 0, i32 0
%24 = getelementptr inbounds [2 x i8], [2 x i8]* %23, i64 0, i64 1
store i8 4, i8* %24
br label %25
25: ; preds = %21, %16
%26 = bitcast %union.anon* %2 to i8**
%27 = load i8*, i8** %26
%28 = call i32 @free(i8* %27)
%29 = load i8*, i8** %3
%30 = call i32 @free(i8* %29)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call dereferenceable_or_null(37) i8* @malloc(i32 37)
%2 = tail call i64 (...) @__VERIFIER_nondet_int()
%3 = icmp eq i64 %2, 0
%4 = ptrtoint i8* %1 to i64
%5 = and i64 %4, -65281
%6 = or i64 %5, 1024
%7 = inttoptr i64 %6 to i8*
%8 = select i1 %3, i8* %1, i8* %7
%9 = tail call i32 @free(i8* %8)
%10 = tail call i32 @free(i8* %1)
ret i32 0
}