#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 */
scalar_t__ malloc(int);
void *allocationThread(void *none) {
  int i, j;
  for (i = 0; i < 10; i++) {
    char *p1 = (char *)malloc(10);
    *p1 = 100;
  }
}


x86 assembly (clang, -O0):
<allocationThread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    1150 <allocationThread+0x40>
mov    $0xa,%edi
call   1030 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movb   $0x64,(%rax)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1123 <allocationThread+0x13>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<allocationThread>:
push   %rax
mov    $0xa,%edi
call   1030 <malloc@plt>
movb   $0x64,(%rax)
mov    $0xa,%edi
call   1030 <malloc@plt>
movb   $0x64,(%rax)
mov    $0xa,%edi
call   1030 <malloc@plt>
movb   $0x64,(%rax)
mov    $0xa,%edi
call   1030 <malloc@plt>
movb   $0x64,(%rax)
mov    $0xa,%edi
call   1030 <malloc@plt>
movb   $0x64,(%rax)
mov    $0xa,%edi
call   1030 <malloc@plt>
movb   $0x64,(%rax)
mov    $0xa,%edi
call   1030 <malloc@plt>
movb   $0x64,(%rax)
mov    $0xa,%edi
call   1030 <malloc@plt>
movb   $0x64,(%rax)
mov    $0xa,%edi
call   1030 <malloc@plt>
movb   $0x64,(%rax)
mov    $0xa,%edi
call   1030 <malloc@plt>
movb   $0x64,(%rax)
pop    %rcx
ret

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

LLVM IR (-O2):
define noalias i8* @allocationThread(i8* nocapture readnone %0) {
%2 = tail call i64 @malloc(i32 10)
%3 = inttoptr i64 %2 to i8*
store i8 100, i8* %3
%4 = tail call i64 @malloc(i32 10)
%5 = inttoptr i64 %4 to i8*
store i8 100, i8* %5
%6 = tail call i64 @malloc(i32 10)
%7 = inttoptr i64 %6 to i8*
store i8 100, i8* %7
%8 = tail call i64 @malloc(i32 10)
%9 = inttoptr i64 %8 to i8*
store i8 100, i8* %9
%10 = tail call i64 @malloc(i32 10)
%11 = inttoptr i64 %10 to i8*
store i8 100, i8* %11
%12 = tail call i64 @malloc(i32 10)
%13 = inttoptr i64 %12 to i8*
store i8 100, i8* %13
%14 = tail call i64 @malloc(i32 10)
%15 = inttoptr i64 %14 to i8*
store i8 100, i8* %15
%16 = tail call i64 @malloc(i32 10)
%17 = inttoptr i64 %16 to i8*
store i8 100, i8* %17
%18 = tail call i64 @malloc(i32 10)
%19 = inttoptr i64 %18 to i8*
store i8 100, i8* %19
%20 = tail call i64 @malloc(i32 10)
%21 = inttoptr i64 %20 to i8*
store i8 100, i8* %21
ret i8* undef
}