#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(void *);
void *malloc(int);
int /*<<< orphan*/ printf(char *, void *);
main() {
  void *a, *b, *c, *d, *e;
  a = malloc(2 * 1);
  printf("  a     = %p\n", a);
  b = malloc(6 * 1);
  printf("  b     = %p\n", b);
  c = malloc(1 * 1);
  printf("  c     = %p\n", c);
  free(a);
  d = malloc(3 * 1);
  printf("  d     = %p\n", d);
  free(b);
  e = malloc(3 * 1);
  printf("  e     = %p\n", e);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    $0x2,%edi
call   1050 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeaf(%rip),%rdi
call   1040 <printf@plt>
mov    $0x6,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe9f(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe8f(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    $0x3,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe76(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    $0x3,%edi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xe5d(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x2,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xeb8(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    $0x6,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
lea    0xeaa(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <malloc@plt>
lea    0xe9f(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    $0x3,%edi
call   1050 <malloc@plt>
lea    0xe8c(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    $0x3,%edi
call   1050 <malloc@plt>
lea    0xe79(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [14 x i8] c" a = %p\0A\00"
@.str.1 = [14 x i8] c" b = %p\0A\00"
@.str.2 = [14 x i8] c" c = %p\0A\00"
@.str.3 = [14 x i8] c" d = %p\0A\00"
@.str.4 = [14 x i8] c" e = %p\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = call i8* @malloc(i32 2)
store i8* %6, i8** %1
%7 = load i8*, i8** %1
%8 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = call i8* @malloc(i32 6)
store i8* %9, i8** %2
%10 = load i8*, i8** %2
%11 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = call i8* @malloc(i32 1)
store i8* %12, i8** %3
%13 = load i8*, i8** %3
%14 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %13)
%15 = load i8*, i8** %1
%16 = call i32 @free(i8* %15)
%17 = call i8* @malloc(i32 3)
store i8* %17, i8** %4
%18 = load i8*, i8** %4
%19 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %18)
%20 = load i8*, i8** %2
%21 = call i32 @free(i8* %20)
%22 = call i8* @malloc(i32 3)
store i8* %22, i8** %5
%23 = load i8*, i8** %5
%24 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* %23)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c" a = %p\0A\00"
@.str.1 = [14 x i8] c" b = %p\0A\00"
@.str.2 = [14 x i8] c" c = %p\0A\00"
@.str.3 = [14 x i8] c" d = %p\0A\00"
@.str.4 = [14 x i8] c" e = %p\0A\00"
define i32 @main() {
%1 = tail call dereferenceable_or_null(2) i8* @malloc(i32 2)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %1)
%3 = tail call dereferenceable_or_null(6) i8* @malloc(i32 6)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%5 = tail call dereferenceable_or_null(1) i8* @malloc(i32 1)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%7 = tail call i32 @free(i8* %1)
%8 = tail call dereferenceable_or_null(3) i8* @malloc(i32 3)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %8)
%10 = tail call i32 @free(i8* %3)
%11 = tail call dereferenceable_or_null(3) i8* @malloc(i32 3)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* %11)
ret i32 0
}