#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*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *);
int main(void) {
  int *v, *u, r;
  u = (int *)malloc(sizeof(*u));
  v = (int *)malloc(sizeof(*v));
  *u = 10;
  *v = 10;
  if (v == 0)
    exit(-1);
  *u = 15;
  *v = 15;
  if (u == 0)
    exit(-1);
  *u = 20;
  *v = 20;
  if (r) {
    u = (int *)malloc(sizeof(*u));
    v = (int *)malloc(sizeof(*v));
  }
  *u = 30;
  *v = 30;
  printf("???");
  if (r) {
    if (u == 0 || v == 0)
      exit(-1);
  }
  assert(0);
  *u = 40;
  *v = 40;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
movl   $0xa,(%rax)
mov    -0x10(%rbp),%rax
movl   $0xa,(%rax)
cmpq   $0x0,-0x10(%rbp)
jne    1194 <main+0x54>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
mov    -0x18(%rbp),%rax
movl   $0xf,(%rax)
mov    -0x10(%rbp),%rax
movl   $0xf,(%rax)
cmpq   $0x0,-0x18(%rbp)
jne    11bd <main+0x7d>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
mov    -0x18(%rbp),%rax
movl   $0x14,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x14,(%rax)
cmpl   $0x0,-0x1c(%rbp)
je     11f7 <main+0xb7>
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x1e,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x1e,(%rax)
lea    0xdee(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0x1c(%rbp)
je     1246 <main+0x106>
cmpq   $0x0,-0x18(%rbp)
je     1237 <main+0xf7>
cmpq   $0x0,-0x10(%rbp)
jne    1241 <main+0x101>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
jmp    1246 <main+0x106>
xor    %edi,%edi
call   1040 <assert@plt>
mov    -0x18(%rbp),%rax
movl   $0x28,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x28,(%rax)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
movl   $0x1e,(%r14)
movl   $0x1e,(%rax)
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <assert@plt>
movl   $0x28,(%r14)
movl   $0x28,(%rbx)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"???\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32
store i32 0, i32* %1
%5 = call i64 @malloc(i32 4)
%6 = inttoptr i64 %5 to i32*
store i32* %6, i32** %3
%7 = call i64 @malloc(i32 4)
%8 = inttoptr i64 %7 to i32*
store i32* %8, i32** %2
%9 = load i32*, i32** %3
store i32 10, i32* %9
%10 = load i32*, i32** %2
store i32 10, i32* %10
%11 = load i32*, i32** %2
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = call i32 @exit(i32 -1)
unreachable
15: ; preds = %0
%16 = load i32*, i32** %3
store i32 15, i32* %16
%17 = load i32*, i32** %2
store i32 15, i32* %17
%18 = load i32*, i32** %3
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %22
20: ; preds = %15
%21 = call i32 @exit(i32 -1)
unreachable
22: ; preds = %15
%23 = load i32*, i32** %3
store i32 20, i32* %23
%24 = load i32*, i32** %2
store i32 20, i32* %24
%25 = load i32, i32* %4
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %32
27: ; preds = %22
%28 = call i64 @malloc(i32 4)
%29 = inttoptr i64 %28 to i32*
store i32* %29, i32** %3
%30 = call i64 @malloc(i32 4)
%31 = inttoptr i64 %30 to i32*
store i32* %31, i32** %2
br label %32
32: ; preds = %27, %22
%33 = load i32*, i32** %3
store i32 30, i32* %33
%34 = load i32*, i32** %2
store i32 30, i32* %34
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%36 = load i32, i32* %4
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %47
38: ; preds = %32
%39 = load i32*, i32** %3
%40 = icmp eq i32* %39, null
br i1 %40, label %44, label %41
41: ; preds = %38
%42 = load i32*, i32** %2
%43 = icmp eq i32* %42, null
br i1 %43, label %44, label %46
44: ; preds = %41, %38
%45 = call i32 @exit(i32 -1)
unreachable
46: ; preds = %41
br label %47
47: ; preds = %46, %32
%48 = call i32 @assert(i32 0)
%49 = load i32*, i32** %3
store i32 40, i32* %49
%50 = load i32*, i32** %2
store i32 40, i32* %50
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"???\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 4)
%2 = inttoptr i64 %1 to i32*
%3 = tail call i64 @malloc(i32 4)
%4 = inttoptr i64 %3 to i32*
store i32 30, i32* %2
store i32 30, i32* %4
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @assert(i32 0)
store i32 40, i32* %2
store i32 40, i32* %4
ret i32 0
}