#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 */
char *calloc(int, int);
int /*<<< orphan*/ cfree(char *);
int /*<<< orphan*/ write(int, char *, int);
int main(void) {
  char *x;
  char *y;
  write(1, "A\n", 2);
  x = calloc(8, 8);
  write(1, "B\n", 2);
  y = calloc(16, 8);
  write(1, "C\n", 2);
  cfree(y);
  write(1, "D\n", 2);
  cfree(x);
  write(1, "E\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   1030 <write@plt>
mov    $0x8,%esi
mov    %esi,%edi
call   1040 <calloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x1,%edi
lea    0xe92(%rip),%rsi
mov    $0x2,%edx
call   1030 <write@plt>
mov    $0x10,%edi
mov    $0x8,%esi
call   1040 <calloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x1,%edi
lea    0xe6c(%rip),%rsi
mov    $0x2,%edx
call   1030 <write@plt>
mov    -0x18(%rbp),%rdi
call   1050 <cfree@plt>
mov    $0x1,%edi
lea    0xe50(%rip),%rsi
mov    $0x2,%edx
call   1030 <write@plt>
mov    -0x10(%rbp),%rdi
call   1050 <cfree@plt>
mov    $0x1,%edi
lea    0xe34(%rip),%rsi
mov    $0x2,%edx
call   1030 <write@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%rsi
mov    $0x1,%edi
mov    $0x2,%edx
call   1030 <write@plt>
mov    $0x8,%edi
mov    $0x8,%esi
call   1040 <calloc@plt>
mov    %rax,%r14
lea    0xea0(%rip),%rsi
mov    $0x1,%edi
mov    $0x2,%edx
call   1030 <write@plt>
mov    $0x10,%edi
mov    $0x8,%esi
call   1040 <calloc@plt>
mov    %rax,%rbx
lea    0xe7b(%rip),%rsi
mov    $0x1,%edi
mov    $0x2,%edx
call   1030 <write@plt>
mov    %rbx,%rdi
call   1050 <cfree@plt>
lea    0xe60(%rip),%rsi
mov    $0x1,%edi
mov    $0x2,%edx
call   1030 <write@plt>
mov    %r14,%rdi
call   1050 <cfree@plt>
lea    0xe45(%rip),%rsi
mov    $0x1,%edi
mov    $0x2,%edx
call   1030 <write@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
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"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i32 0, i32* %1
%4 = call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%5 = call i8* @calloc(i32 8, i32 8)
store i8* %5, i8** %2
%6 = call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%7 = call i8* @calloc(i32 16, i32 8)
store i8* %7, i8** %3
%8 = call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 2)
%9 = load i8*, i8** %3
%10 = call i32 @cfree(i8* %9)
%11 = call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 2)
%12 = load i8*, i8** %2
%13 = call i32 @cfree(i8* %12)
%14 = call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 2)
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"
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 dereferenceable_or_null(64) i8* @calloc(i32 8, i32 8)
%3 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%4 = tail call dereferenceable_or_null(128) i8* @calloc(i32 16, i32 8)
%5 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 2)
%6 = tail call i32 @cfree(i8* %4)
%7 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 2)
%8 = tail call i32 @cfree(i8* %2)
%9 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 2)
ret i32 0
}