#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_2(int);
int main() {
  int *ptr1 = malloc_2(sizeof(int));
  int *ptr2 = malloc_2(sizeof(int));
  assert(ptr1 == ptr2);
  assert((unsigned long)ptr1 == (unsigned long)ptr2);
  int i1 = (int)ptr1;
  int i2 = (int)ptr2;
  assert(i1 == i2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1030 <malloc_2@plt>
mov    %rax,-0x10(%rbp)
mov    $0x4,%edi
call   1030 <malloc_2@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0x4,%edi
call   1030 <malloc_2@plt>
mov    %rax,%r14
mov    $0x4,%edi
call   1030 <malloc_2@plt>
mov    %rax,%rbx
xor    %ebp,%ebp
cmp    %rax,%r14
sete   %bpl
mov    %ebp,%edi
call   1040 <assert@plt>
mov    %ebp,%edi
call   1040 <assert@plt>
xor    %edi,%edi
cmp    %ebx,%r14d
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
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 i32* @malloc_2(i32 4)
store i32* %6, i32** %2
%7 = call i32* @malloc_2(i32 4)
store i32* %7, i32** %3
%8 = load i32*, i32** %2
%9 = load i32*, i32** %3
%10 = icmp eq i32* %8, %9
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load i32*, i32** %2
%14 = ptrtoint i32* %13 to i64
%15 = load i32*, i32** %3
%16 = ptrtoint i32* %15 to i64
%17 = icmp eq i64 %14, %16
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = load i32*, i32** %2
%21 = ptrtoint i32* %20 to i32
store i32 %21, i32* %4
%22 = load i32*, i32** %3
%23 = ptrtoint i32* %22 to i32
store i32 %23, i32* %5
%24 = load i32, i32* %4
%25 = load i32, i32* %5
%26 = icmp eq i32 %24, %25
%27 = zext i1 %26 to i32
%28 = call i32 @assert(i32 %27)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @malloc_2(i32 4)
%2 = tail call i32* @malloc_2(i32 4)
%3 = icmp eq i32* %1, %2
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = tail call i32 @assert(i32 %4)
%7 = ptrtoint i32* %1 to i64
%8 = trunc i64 %7 to i32
%9 = ptrtoint i32* %2 to i64
%10 = trunc i64 %9 to i32
%11 = icmp eq i32 %8, %10
%12 = zext i1 %11 to i32
%13 = tail call i32 @assert(i32 %12)
ret i32 0
}