#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);
int *malloc(int);
int rand();
void main() {
  int x, y;
  int *p, *q, *r;
  int *a1, *a2;
  p = &x;
  q = &y;
  q = p;
  p = a1 = malloc(sizeof(int));
  r = q;
  r = a2 = malloc(sizeof(int));
  switch (rand()) {
  case 0:
    assert(p != a1);
  case 1:
    assert(p != &x);
  case 2:
    assert(q != a1);
  case 3:
    assert(q != &x);
  case 4:
    assert(q != &y);
  case 5:
    assert(r != a1);
  case 6:
    assert(r != a2);
  case 7:
    assert(r != &x);
  default:
    assert(r != &y);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x4,%edi
mov    %edi,-0x3c(%rbp)
call   1040 <malloc@plt>
mov    -0x3c(%rbp),%edi
mov    %rax,-0x28(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
call   1040 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
call   1050 <rand@plt>
mov    %eax,%ecx
mov    %rcx,-0x38(%rbp)
sub    $0x7,%eax
ja     124f <main+0x11f>
mov    -0x38(%rbp),%rax
lea    0xe62(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rax
cmp    -0x28(%rbp),%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    -0x4(%rbp),%rax
cmp    %rax,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x18(%rbp),%rax
cmp    -0x28(%rbp),%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    -0x4(%rbp),%rax
cmp    %rax,-0x18(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    -0x8(%rbp),%rax
cmp    %rax,-0x18(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x20(%rbp),%rax
cmp    -0x30(%rbp),%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    -0x4(%rbp),%rax
cmp    %rax,-0x20(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    -0x8(%rbp),%rax
cmp    %rax,-0x20(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,%r14
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1050 <rand@plt>
cmp    $0x7,%eax
ja     11b7 <main+0x87>
mov    %eax,%eax
lea    0xe9d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %edi,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %edi,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %edi,%edi
cmp    %r14,%rbx
setne  %dil
call   1030 <assert@plt>
xor    %edi,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <assert@plt>

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
store i32* %1, i32** %3
store i32* %2, i32** %4
%8 = load i32*, i32** %3
store i32* %8, i32** %4
%9 = call i32* @malloc(i32 4)
store i32* %9, i32** %6
store i32* %9, i32** %3
%10 = load i32*, i32** %4
store i32* %10, i32** %5
%11 = call i32* @malloc(i32 4)
store i32* %11, i32** %7
store i32* %11, i32** %5
%12 = call i32 (...) @rand()
switch i32 %12, label %57 [
i32 0, label %13
i32 1, label %19
i32 2, label %24
i32 3, label %30
i32 4, label %35
i32 5, label %40
i32 6, label %46
i32 7, label %52
]
13: ; preds = %0
%14 = load i32*, i32** %3
%15 = load i32*, i32** %6
%16 = icmp ne i32* %14, %15
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
br label %19
19: ; preds = %0, %13
%20 = load i32*, i32** %3
%21 = icmp ne i32* %20, %1
%22 = zext i1 %21 to i32
%23 = call i32 @assert(i32 %22)
br label %24
24: ; preds = %0, %19
%25 = load i32*, i32** %4
%26 = load i32*, i32** %6
%27 = icmp ne i32* %25, %26
%28 = zext i1 %27 to i32
%29 = call i32 @assert(i32 %28)
br label %30
30: ; preds = %0, %24
%31 = load i32*, i32** %4
%32 = icmp ne i32* %31, %1
%33 = zext i1 %32 to i32
%34 = call i32 @assert(i32 %33)
br label %35
35: ; preds = %0, %30
%36 = load i32*, i32** %4
%37 = icmp ne i32* %36, %2
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
br label %40
40: ; preds = %0, %35
%41 = load i32*, i32** %5
%42 = load i32*, i32** %6
%43 = icmp ne i32* %41, %42
%44 = zext i1 %43 to i32
%45 = call i32 @assert(i32 %44)
br label %46
46: ; preds = %0, %40
%47 = load i32*, i32** %5
%48 = load i32*, i32** %7
%49 = icmp ne i32* %47, %48
%50 = zext i1 %49 to i32
%51 = call i32 @assert(i32 %50)
br label %52
52: ; preds = %0, %46
%53 = load i32*, i32** %5
%54 = icmp ne i32* %53, %1
%55 = zext i1 %54 to i32
%56 = call i32 @assert(i32 %55)
br label %57
57: ; preds = %0, %52
%58 = load i32*, i32** %5
%59 = icmp ne i32* %58, %2
%60 = zext i1 %59 to i32
%61 = call i32 @assert(i32 %60)
br label %62
62: ; preds = %57
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32* @malloc(i32 4)
%2 = tail call i32* @malloc(i32 4)
%3 = tail call i32 (...) @rand()
switch i32 %3, label %22 [
i32 0, label %4
i32 1, label %6
i32 2, label %8
i32 3, label %10
i32 4, label %12
i32 5, label %14
i32 6, label %18
i32 7, label %20
]
4: ; preds = %0
%5 = tail call i32 @assert(i32 0)
br label %6
6: ; preds = %0, %4
%7 = tail call i32 @assert(i32 1)
br label %8
8: ; preds = %0, %6
%9 = tail call i32 @assert(i32 1)
br label %10
10: ; preds = %0, %8
%11 = tail call i32 @assert(i32 0)
br label %12
12: ; preds = %0, %10
%13 = tail call i32 @assert(i32 1)
br label %14
14: ; preds = %0, %12
%15 = icmp ne i32* %2, %1
%16 = zext i1 %15 to i32
%17 = tail call i32 @assert(i32 %16)
br label %18
18: ; preds = %0, %14
%19 = tail call i32 @assert(i32 0)
br label %20
20: ; preds = %0, %18
%21 = tail call i32 @assert(i32 1)
br label %22
22: ; preds = %0, %20
%23 = tail call i32 @assert(i32 1)
ret void
}