#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*/ free(int *);
int *malloc(int);
int /*<<< orphan*/ write(int, char *, int);
int main(void) {
  int *x;
  int y;
  int z;
  write(1, "A\n", 2);
  x = malloc(sizeof(int));
  write(1, "B\n", 2);
  *x = 0xdeadbeef;
  write(1, "C\n", 2);
  y = *x;
  write(1, "D\n", 2);
  free(x);
  write(1, "E\n", 2);
  z = *x;
  write(1, "F\n", 2);
  if (y == z)
    write(1, "G\n", 2);
  else
    write(1, "H\n", 2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
lea    0xeb5(%rip),%rsi
mov    $0x2,%edx
call   1040 <write@plt>
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x1,%edi
lea    0xe94(%rip),%rsi
mov    $0x2,%edx
call   1040 <write@plt>
mov    -0x10(%rbp),%rax
movl   $0xdeadbeef,(%rax)
mov    $0x1,%edi
lea    0xe77(%rip),%rsi
mov    $0x2,%edx
call   1040 <write@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    $0x1,%edi
lea    0xe5b(%rip),%rsi
mov    $0x2,%edx
call   1040 <write@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    $0x1,%edi
lea    0xe3f(%rip),%rsi
mov    $0x2,%edx
call   1040 <write@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    $0x1,%edi
lea    0xe23(%rip),%rsi
mov    $0x2,%edx
call   1040 <write@plt>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    121d <main+0xed>
mov    $0x1,%edi
lea    0xe04(%rip),%rsi
mov    $0x2,%edx
call   1040 <write@plt>
jmp    1233 <main+0x103>
mov    $0x1,%edi
lea    0xdec(%rip),%rsi
mov    $0x2,%edx
call   1040 <write@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rsi
mov    $0x1,%edi
mov    $0x2,%edx
call   1040 <write@plt>
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xea8(%rip),%rsi
mov    $0x1,%edi
mov    $0x2,%edx
call   1040 <write@plt>
movl   $0xdeadbeef,(%rbx)
lea    0xe8f(%rip),%rsi
mov    $0x1,%edi
mov    $0x2,%edx
call   1040 <write@plt>
lea    0xe7c(%rip),%rsi
mov    $0x1,%edi
mov    $0x2,%edx
call   1040 <write@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xe61(%rip),%rsi
mov    $0x1,%edi
mov    $0x2,%edx
call   1040 <write@plt>
mov    (%rbx),%ebx
lea    0xe4c(%rip),%rsi
mov    $0x1,%edi
mov    $0x2,%edx
call   1040 <write@plt>
cmp    $0xdeadbeef,%ebx
lea    0xe33(%rip),%rax
lea    0xe2f(%rip),%rsi
cmove  %rax,%rsi
mov    $0x1,%edi
mov    $0x2,%edx
call   1040 <write@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"A\0A\00"
@.str.1 = [3 x i8] c"B\0A\00"
@.str.2 = [3 x i8] c"C\0A\00"
@.str.3 = [3 x i8] c"D\0A\00"
@.str.4 = [3 x i8] c"E\0A\00"
@.str.5 = [3 x i8] c"F\0A\00"
@.str.6 = [3 x i8] c"G\0A\00"
@.str.7 = [3 x i8] c"H\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%6 = call i32* @malloc(i32 4)
store i32* %6, i32** %2
%7 = call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%8 = load i32*, i32** %2
store i32 -559038737, i32* %8
%9 = call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 2)
%10 = load i32*, i32** %2
%11 = load i32, i32* %10
store i32 %11, i32* %3
%12 = call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 2)
%13 = load i32*, i32** %2
%14 = call i32 @free(i32* %13)
%15 = call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 2)
%16 = load i32*, i32** %2
%17 = load i32, i32* %16
store i32 %17, i32* %4
%18 = call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 2)
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = icmp eq i32 %19, %20
br i1 %21, label %22, label %24
22: ; preds = %0
%23 = call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 2)
br label %26
24: ; preds = %0
%25 = call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 2)
br label %26
26: ; preds = %24, %22
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"A\0A\00"
@.str.1 = [3 x i8] c"B\0A\00"
@.str.2 = [3 x i8] c"C\0A\00"
@.str.3 = [3 x i8] c"D\0A\00"
@.str.4 = [3 x i8] c"E\0A\00"
@.str.5 = [3 x i8] c"F\0A\00"
@.str.6 = [3 x i8] c"G\0A\00"
@.str.7 = [3 x i8] c"H\0A\00"
define i32 @main() {
%1 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%2 = tail call i32* @malloc(i32 4)
%3 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
store i32 -559038737, i32* %2
%4 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 2)
%5 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 2)
%6 = tail call i32 @free(i32* %2)
%7 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 2)
%8 = load i32, i32* %2
%9 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 2)
%10 = icmp eq i32 %8, -559038737
%11 = select i1 %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0)
%12 = tail call i32 @write(i32 1, i8* %11, i32 2)
ret i32 0
}