#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 *);
int *malloc(int);
int main(void) {
  int i;
  for (i = 0; i < 20; i++) {
    int *p;
    p = malloc(1600);
    p = malloc(16);
    free(p);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x14,-0x8(%rbp)
jge    1173 <main+0x53>
mov    $0x640,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x10,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
store i32 0, i32* %1
store i32 0, i32* %2
br label %4
4: ; preds = %12, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 20
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = call i32* @malloc(i32 1600)
store i32* %8, i32** %3
%9 = call i32* @malloc(i32 16)
store i32* %9, i32** %3
%10 = load i32*, i32** %3
%11 = call i32 @free(i32* %10)
br label %12
12: ; preds = %7
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1
store i32 %14, i32* %2
br label %4
15: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @malloc(i32 1600)
%2 = tail call i32* @malloc(i32 16)
%3 = tail call i32 @free(i32* %2)
%4 = tail call i32* @malloc(i32 1600)
%5 = tail call i32* @malloc(i32 16)
%6 = tail call i32 @free(i32* %5)
%7 = tail call i32* @malloc(i32 1600)
%8 = tail call i32* @malloc(i32 16)
%9 = tail call i32 @free(i32* %8)
%10 = tail call i32* @malloc(i32 1600)
%11 = tail call i32* @malloc(i32 16)
%12 = tail call i32 @free(i32* %11)
%13 = tail call i32* @malloc(i32 1600)
%14 = tail call i32* @malloc(i32 16)
%15 = tail call i32 @free(i32* %14)
%16 = tail call i32* @malloc(i32 1600)
%17 = tail call i32* @malloc(i32 16)
%18 = tail call i32 @free(i32* %17)
%19 = tail call i32* @malloc(i32 1600)
%20 = tail call i32* @malloc(i32 16)
%21 = tail call i32 @free(i32* %20)
%22 = tail call i32* @malloc(i32 1600)
%23 = tail call i32* @malloc(i32 16)
%24 = tail call i32 @free(i32* %23)
%25 = tail call i32* @malloc(i32 1600)
%26 = tail call i32* @malloc(i32 16)
%27 = tail call i32 @free(i32* %26)
%28 = tail call i32* @malloc(i32 1600)
%29 = tail call i32* @malloc(i32 16)
%30 = tail call i32 @free(i32* %29)
%31 = tail call i32* @malloc(i32 1600)
%32 = tail call i32* @malloc(i32 16)
%33 = tail call i32 @free(i32* %32)
%34 = tail call i32* @malloc(i32 1600)
%35 = tail call i32* @malloc(i32 16)
%36 = tail call i32 @free(i32* %35)
%37 = tail call i32* @malloc(i32 1600)
%38 = tail call i32* @malloc(i32 16)
%39 = tail call i32 @free(i32* %38)
%40 = tail call i32* @malloc(i32 1600)
%41 = tail call i32* @malloc(i32 16)
%42 = tail call i32 @free(i32* %41)
%43 = tail call i32* @malloc(i32 1600)
%44 = tail call i32* @malloc(i32 16)
%45 = tail call i32 @free(i32* %44)
%46 = tail call i32* @malloc(i32 1600)
%47 = tail call i32* @malloc(i32 16)
%48 = tail call i32 @free(i32* %47)
%49 = tail call i32* @malloc(i32 1600)
%50 = tail call i32* @malloc(i32 16)
%51 = tail call i32 @free(i32* %50)
%52 = tail call i32* @malloc(i32 1600)
%53 = tail call i32* @malloc(i32 16)
%54 = tail call i32 @free(i32* %53)
%55 = tail call i32* @malloc(i32 1600)
%56 = tail call i32* @malloc(i32 16)
%57 = tail call i32 @free(i32* %56)
%58 = tail call i32* @malloc(i32 1600)
%59 = tail call i32* @malloc(i32 16)
%60 = tail call i32 @free(i32* %59)
ret i32 0
}