#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(char *);
char *malloc(int);
int /*<<< orphan*/ printf(char *);
int main(void) {
  int i;
  char *c;
  printf("Testing...\n");
  for (i = 0; i < 10; ++i) {
    c = malloc(23);
    free(c);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1181 <main+0x51>
mov    $0x17,%edi
call   1050 <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    1152 <main+0x22>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [12 x i8] c"Testing...\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %5
5: ; preds = %12, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %15
8: ; preds = %5
%9 = call i8* @malloc(i32 23)
store i8* %9, i8** %3
%10 = load i8*, i8** %3
%11 = call i32 @free(i8* %10)
br label %12
12: ; preds = %8
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1
store i32 %14, i32* %2
br label %5
15: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@str = [11 x i8] c"Testing...\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%2 = tail call dereferenceable_or_null(23) i8* @malloc(i32 23)
%3 = tail call i32 @free(i8* %2)
%4 = tail call dereferenceable_or_null(23) i8* @malloc(i32 23)
%5 = tail call i32 @free(i8* %4)
%6 = tail call dereferenceable_or_null(23) i8* @malloc(i32 23)
%7 = tail call i32 @free(i8* %6)
%8 = tail call dereferenceable_or_null(23) i8* @malloc(i32 23)
%9 = tail call i32 @free(i8* %8)
%10 = tail call dereferenceable_or_null(23) i8* @malloc(i32 23)
%11 = tail call i32 @free(i8* %10)
%12 = tail call dereferenceable_or_null(23) i8* @malloc(i32 23)
%13 = tail call i32 @free(i8* %12)
%14 = tail call dereferenceable_or_null(23) i8* @malloc(i32 23)
%15 = tail call i32 @free(i8* %14)
%16 = tail call dereferenceable_or_null(23) i8* @malloc(i32 23)
%17 = tail call i32 @free(i8* %16)
%18 = tail call dereferenceable_or_null(23) i8* @malloc(i32 23)
%19 = tail call i32 @free(i8* %18)
%20 = tail call dereferenceable_or_null(23) i8* @malloc(i32 23)
%21 = tail call i32 @free(i8* %20)
ret i32 0
}