#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 *foo();
int /*<<< orphan*/ free(int *);
int *malloc(int);
int main() {
  int *null_p = NULL;
  int *random_p = (int *)123;
  int *heap_p;
  int **uninit_pp = &heap_p;
  heap_p = malloc(5 * sizeof(*heap_p));
  int *cur_p = heap_p;
  cur_p++;
  cur_p++;
  cur_p++;
  cur_p++;
  cur_p++;
  cur_p++;
  cur_p++;
  cur_p++;
  free(heap_p);
  heap_p = NULL;
  int *stack_p = foo();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movq   $0x0,-0x8(%rbp)
mov    $0x7b,%eax
mov    %rax,-0x10(%rbp)
lea    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1050 <foo@plt>
mov    %rax,-0x30(%rbp)
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   1050 <foo@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32**
%5 = alloca i32*
%6 = alloca i32*
store i32* null, i32** %1
store i32* inttoptr (i64 123 to i32*), i32** %2
store i32** %3, i32*** %4
%7 = call i32* @malloc(i32 20)
store i32* %7, i32** %3
%8 = load i32*, i32** %3
store i32* %8, i32** %5
%9 = load i32*, i32** %5
%10 = getelementptr inbounds i32, i32* %9, i32 1
store i32* %10, i32** %5
%11 = load i32*, i32** %5
%12 = getelementptr inbounds i32, i32* %11, i32 1
store i32* %12, i32** %5
%13 = load i32*, i32** %5
%14 = getelementptr inbounds i32, i32* %13, i32 1
store i32* %14, i32** %5
%15 = load i32*, i32** %5
%16 = getelementptr inbounds i32, i32* %15, i32 1
store i32* %16, i32** %5
%17 = load i32*, i32** %5
%18 = getelementptr inbounds i32, i32* %17, i32 1
store i32* %18, i32** %5
%19 = load i32*, i32** %5
%20 = getelementptr inbounds i32, i32* %19, i32 1
store i32* %20, i32** %5
%21 = load i32*, i32** %5
%22 = getelementptr inbounds i32, i32* %21, i32 1
store i32* %22, i32** %5
%23 = load i32*, i32** %5
%24 = getelementptr inbounds i32, i32* %23, i32 1
store i32* %24, i32** %5
%25 = load i32*, i32** %3
%26 = call i32 @free(i32* %25)
store i32* null, i32** %3
%27 = call i32* (...) @foo()
store i32* %27, i32** %6
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @malloc(i32 20)
%2 = tail call i32 @free(i32* %1)
%3 = tail call i32* (...) @foo()
ret i32 0
}