int main(int argc, char **argv) {
  printf("Allocatind a (size = 4 bytes)..\n");
  int *a = malloc(4);
  printf("a: 0x%x\n", a);
  printf("Allocatind b (size = 4 bytes)..\n");
  int *b = malloc(4);
  printf("b: 0x%x\n", b);
  printf("Allocatind c (size = 4 bytes)..\n");
  int *c = malloc(4);
  printf("c: 0x%x\n", c);
  printf("Freeing c..\n");
  free(c);
  printf("Freeing b..\n");
  free(b);
  printf("Allocatind d (size = 12 bytes)..\n");
  int *d = malloc(12);
  printf("d: 0x%x\n", d);
  printf("Freeing d..\n");
  free(d);
  printf("Freeing a..\n");
  free(a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xc,%edi
call   1050 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rsi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0xed8(%rip),%rdi
call   1040 <puts@plt>
mov    $0x4,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
lea    0xe9b(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xece(%rip),%rdi
call   1040 <puts@plt>
mov    $0x4,%edi
call   1060 <malloc@plt>
mov    %rax,%r15
lea    0xe7a(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xec4(%rip),%rdi
call   1040 <puts@plt>
mov    $0x4,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
lea    0xe59(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeba(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xeb2(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1030 <free@plt>
lea    0xeaa(%rip),%rdi
call   1040 <puts@plt>
mov    $0xc,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
lea    0xe10(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xea1(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xe99(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Allocatind a (size = 4 bytes)..\0A\00"
@.str.1 = [9 x i8] c"a: 0x%x\0A\00"
@.str.2 = [33 x i8] c"Allocatind b (size = 4 bytes)..\0A\00"
@.str.3 = [9 x i8] c"b: 0x%x\0A\00"
@.str.4 = [33 x i8] c"Allocatind c (size = 4 bytes)..\0A\00"
@.str.5 = [9 x i8] c"c: 0x%x\0A\00"
@.str.6 = [13 x i8] c"Freeing c..\0A\00"
@.str.7 = [13 x i8] c"Freeing b..\0A\00"
@.str.8 = [34 x i8] c"Allocatind d (size = 12 bytes)..\0A\00"
@.str.9 = [9 x i8] c"d: 0x%x\0A\00"
@.str.10 = [13 x i8] c"Freeing d..\0A\00"
@.str.11 = [13 x i8] c"Freeing a..\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%11 = call i8* @malloc(i64 4)
%12 = bitcast i8* %11 to i32*
store i32* %12, i32** %6
%13 = load i32*, i32** %6
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%16 = call i8* @malloc(i64 4)
%17 = bitcast i8* %16 to i32*
store i32* %17, i32** %7
%18 = load i32*, i32** %7
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32* %18)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0))
%21 = call i8* @malloc(i64 4)
%22 = bitcast i8* %21 to i32*
store i32* %22, i32** %8
%23 = load i32*, i32** %8
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32* %23)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
%26 = load i32*, i32** %8
%27 = bitcast i32* %26 to i8*
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%29 = load i32*, i32** %7
%30 = bitcast i32* %29 to i8*
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0))
%32 = call i8* @malloc(i64 12)
%33 = bitcast i8* %32 to i32*
store i32* %33, i32** %9
%34 = load i32*, i32** %9
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i32* %34)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0))
%37 = load i32*, i32** %9
%38 = bitcast i32* %37 to i8*
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0))
%40 = load i32*, i32** %6
%41 = bitcast i32* %40 to i8*
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"a: 0x%x\0A\00"
@.str.3 = [9 x i8] c"b: 0x%x\0A\00"
@.str.5 = [9 x i8] c"c: 0x%x\0A\00"
@.str.9 = [9 x i8] c"d: 0x%x\0A\00"
@str = [32 x i8] c"Allocatind a (size = 4 bytes)..\00"
@str.12 = [32 x i8] c"Allocatind b (size = 4 bytes)..\00"
@str.13 = [32 x i8] c"Allocatind c (size = 4 bytes)..\00"
@str.14 = [12 x i8] c"Freeing c..\00"
@str.15 = [12 x i8] c"Freeing b..\00"
@str.16 = [33 x i8] c"Allocatind d (size = 12 bytes)..\00"
@str.17 = [12 x i8] c"Freeing d..\00"
@str.18 = [12 x i8] c"Freeing a..\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%4 = tail call dereferenceable_or_null(4) i8* @malloc(i64 4)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.12, i64 0, i64 0))
%7 = tail call dereferenceable_or_null(4) i8* @malloc(i64 4)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %7)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.13, i64 0, i64 0))
%10 = tail call dereferenceable_or_null(4) i8* @malloc(i64 4)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* %10)
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.14, i64 0, i64 0))
tail call void @free(i8* %10)
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.15, i64 0, i64 0))
tail call void @free(i8* %7)
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.16, i64 0, i64 0))
%15 = tail call dereferenceable_or_null(12) i8* @malloc(i64 12)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i8* %15)
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.17, i64 0, i64 0))
tail call void @free(i8* %15)
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.18, i64 0, i64 0))
tail call void @free(i8* %4)
ret i32 0
}