#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 /*<<< orphan*/);
int /*<<< orphan*/ malloc(int /*<<< orphan*/);
int main(void) {
  free(malloc(0));
  free(malloc(0));
  free(malloc(0));
  free(malloc(0));
  free(malloc(0));
  free(malloc(0));
  free(malloc(0));
  free(malloc(0));
  free(malloc(0));
  free(malloc(0));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1040 <malloc@plt>
mov    %eax,%edi
call   1030 <free@plt>
xor    %edi,%edi
call   1040 <malloc@plt>
mov    %eax,%edi
call   1030 <free@plt>
xor    %edi,%edi
call   1040 <malloc@plt>
mov    %eax,%edi
call   1030 <free@plt>
xor    %edi,%edi
call   1040 <malloc@plt>
mov    %eax,%edi
call   1030 <free@plt>
xor    %edi,%edi
call   1040 <malloc@plt>
mov    %eax,%edi
call   1030 <free@plt>
xor    %edi,%edi
call   1040 <malloc@plt>
mov    %eax,%edi
call   1030 <free@plt>
xor    %edi,%edi
call   1040 <malloc@plt>
mov    %eax,%edi
call   1030 <free@plt>
xor    %edi,%edi
call   1040 <malloc@plt>
mov    %eax,%edi
call   1030 <free@plt>
xor    %edi,%edi
call   1040 <malloc@plt>
mov    %eax,%edi
call   1030 <free@plt>
xor    %edi,%edi
call   1040 <malloc@plt>
mov    %eax,%edi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @malloc(i32 0)
%3 = call i32 @free(i32 %2)
%4 = call i32 @malloc(i32 0)
%5 = call i32 @free(i32 %4)
%6 = call i32 @malloc(i32 0)
%7 = call i32 @free(i32 %6)
%8 = call i32 @malloc(i32 0)
%9 = call i32 @free(i32 %8)
%10 = call i32 @malloc(i32 0)
%11 = call i32 @free(i32 %10)
%12 = call i32 @malloc(i32 0)
%13 = call i32 @free(i32 %12)
%14 = call i32 @malloc(i32 0)
%15 = call i32 @free(i32 %14)
%16 = call i32 @malloc(i32 0)
%17 = call i32 @free(i32 %16)
%18 = call i32 @malloc(i32 0)
%19 = call i32 @free(i32 %18)
%20 = call i32 @malloc(i32 0)
%21 = call i32 @free(i32 %20)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @malloc(i32 0)
%2 = tail call i32 @free(i32 %1)
%3 = tail call i32 @malloc(i32 0)
%4 = tail call i32 @free(i32 %3)
%5 = tail call i32 @malloc(i32 0)
%6 = tail call i32 @free(i32 %5)
%7 = tail call i32 @malloc(i32 0)
%8 = tail call i32 @free(i32 %7)
%9 = tail call i32 @malloc(i32 0)
%10 = tail call i32 @free(i32 %9)
%11 = tail call i32 @malloc(i32 0)
%12 = tail call i32 @free(i32 %11)
%13 = tail call i32 @malloc(i32 0)
%14 = tail call i32 @free(i32 %13)
%15 = tail call i32 @malloc(i32 0)
%16 = tail call i32 @free(i32 %15)
%17 = tail call i32 @malloc(i32 0)
%18 = tail call i32 @free(i32 %17)
%19 = tail call i32 @malloc(i32 0)
%20 = tail call i32 @free(i32 %19)
ret i32 0
}