#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 */
struct AMCMemUnit {
  int dummy;
};
typedef void AMCMemPool;

/* Variables and functions */
struct AMCMemUnit *AMCMemPool_Alloc(void *);
void *AMCMemPool_Create(int, int, int, int);
int /*<<< orphan*/ AMCMemPool_DebugStdout(void *);
int /*<<< orphan*/ AMCMemPool_Destory(void *);
int /*<<< orphan*/ AMCMemPool_Free(struct AMCMemUnit *);
int /*<<< orphan*/ AMCPrintf(char *);
int trueMain(int argc, char *argv[]) {
  long tmp;
  struct AMCMemPool *pool = AMCMemPool_Create(16, 5, 3, (!(0)));
  struct AMCMemUnit *unitArray[20];
  if (((void *)0) == pool) {
    AMCPrintf("Cannot create mempry pool");
  } else {
    AMCMemPool_DebugStdout(pool);
  }
  for (tmp = 0; tmp < 14; tmp++) {
    unitArray[tmp] = AMCMemPool_Alloc(pool);
  }
  AMCMemPool_DebugStdout(pool);
  AMCMemPool_Free(unitArray[6]);
  AMCMemPool_DebugStdout(pool);
  AMCMemPool_Free(unitArray[0]);
  AMCMemPool_DebugStdout(pool);
  AMCMemPool_Free(unitArray[8]);
  AMCMemPool_DebugStdout(pool);
  AMCMemPool_Free(unitArray[5]);
  AMCMemPool_DebugStdout(pool);
  AMCMemPool_Free(unitArray[7]);
  AMCMemPool_DebugStdout(pool);
  unitArray[6] = AMCMemPool_Alloc(pool);
  AMCMemPool_DebugStdout(pool);
  unitArray[8] = AMCMemPool_Alloc(pool);
  AMCMemPool_DebugStdout(pool);
  AMCMemPool_Free(unitArray[11]);
  AMCMemPool_DebugStdout(pool);
  AMCMemPool_Free(unitArray[12]);
  AMCMemPool_DebugStdout(pool);
  AMCMemPool_Free(unitArray[13]);
  AMCMemPool_DebugStdout(pool);
  AMCMemPool_Destory(pool);
  pool = ((void *)0);
  return 0;
}


x86 assembly (clang, -O0):
<trueMain>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x10,%edi
mov    $0x5,%esi
mov    $0x3,%edx
mov    $0x1,%ecx
call   1030 <AMCMemPool_Create@plt>
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
cmp    -0x20(%rbp),%rax
jne    11ac <trueMain+0x4c>
lea    0xe5e(%rip),%rdi
call   1050 <AMCPrintf@plt>
jmp    11b5 <trueMain+0x55>
mov    -0x20(%rbp),%rdi
call   1060 <AMCMemPool_DebugStdout@plt>
movq   $0x0,-0x18(%rbp)
cmpq   $0xe,-0x18(%rbp)
jge    11f1 <trueMain+0x91>
mov    -0x20(%rbp),%rdi
call   1070 <AMCMemPool_Alloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,-0xc0(%rbp,%rax,8)
ff
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11bd <trueMain+0x5d>
mov    -0x20(%rbp),%rdi
call   1060 <AMCMemPool_DebugStdout@plt>
mov    -0x90(%rbp),%rdi
call   1040 <AMCMemPool_Free@plt>
mov    -0x20(%rbp),%rdi
call   1060 <AMCMemPool_DebugStdout@plt>
mov    -0xc0(%rbp),%rdi
call   1040 <AMCMemPool_Free@plt>
mov    -0x20(%rbp),%rdi
call   1060 <AMCMemPool_DebugStdout@plt>
mov    -0x80(%rbp),%rdi
call   1040 <AMCMemPool_Free@plt>
mov    -0x20(%rbp),%rdi
call   1060 <AMCMemPool_DebugStdout@plt>
mov    -0x98(%rbp),%rdi
call   1040 <AMCMemPool_Free@plt>
mov    -0x20(%rbp),%rdi
call   1060 <AMCMemPool_DebugStdout@plt>
mov    -0x88(%rbp),%rdi
call   1040 <AMCMemPool_Free@plt>
mov    -0x20(%rbp),%rdi
call   1060 <AMCMemPool_DebugStdout@plt>
mov    -0x20(%rbp),%rdi
call   1070 <AMCMemPool_Alloc@plt>
mov    %rax,-0x90(%rbp)
mov    -0x20(%rbp),%rdi
call   1060 <AMCMemPool_DebugStdout@plt>
mov    -0x20(%rbp),%rdi
call   1070 <AMCMemPool_Alloc@plt>
mov    %rax,-0x80(%rbp)
mov    -0x20(%rbp),%rdi
call   1060 <AMCMemPool_DebugStdout@plt>
mov    -0x68(%rbp),%rdi
call   1040 <AMCMemPool_Free@plt>
mov    -0x20(%rbp),%rdi
call   1060 <AMCMemPool_DebugStdout@plt>
mov    -0x60(%rbp),%rdi
call   1040 <AMCMemPool_Free@plt>
mov    -0x20(%rbp),%rdi
call   1060 <AMCMemPool_DebugStdout@plt>
mov    -0x58(%rbp),%rdi
call   1040 <AMCMemPool_Free@plt>
mov    -0x20(%rbp),%rdi
call   1060 <AMCMemPool_DebugStdout@plt>
mov    -0x20(%rbp),%rdi
call   1080 <AMCMemPool_Destory@plt>
movq   $0x0,-0x20(%rbp)
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trueMain>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    $0x10,%edi
mov    $0x5,%esi
mov    $0x3,%edx
mov    $0x1,%ecx
call   1030 <AMCMemPool_Create@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1199 <trueMain+0x39>
mov    %rbx,%rdi
call   1060 <AMCMemPool_DebugStdout@plt>
jmp    11a5 <trueMain+0x45>
lea    0xe60(%rip),%rdi
call   1050 <AMCPrintf@plt>
mov    %rbx,%rdi
call   1070 <AMCMemPool_Alloc@plt>
mov    %rax,(%rsp)
mov    %rbx,%rdi
call   1070 <AMCMemPool_Alloc@plt>
mov    %rbx,%rdi
call   1070 <AMCMemPool_Alloc@plt>
mov    %rbx,%rdi
call   1070 <AMCMemPool_Alloc@plt>
mov    %rbx,%rdi
call   1070 <AMCMemPool_Alloc@plt>
mov    %rbx,%rdi
call   1070 <AMCMemPool_Alloc@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1070 <AMCMemPool_Alloc@plt>
mov    %rax,%r12
mov    %rbx,%rdi
call   1070 <AMCMemPool_Alloc@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1070 <AMCMemPool_Alloc@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1070 <AMCMemPool_Alloc@plt>
mov    %rbx,%rdi
call   1070 <AMCMemPool_Alloc@plt>
mov    %rbx,%rdi
call   1070 <AMCMemPool_Alloc@plt>
mov    %rax,%r13
mov    %rbx,%rdi
call   1070 <AMCMemPool_Alloc@plt>
mov    %rax,0x8(%rsp)
mov    %rbx,%rdi
call   1070 <AMCMemPool_Alloc@plt>
mov    %rax,0x10(%rsp)
mov    %rbx,%rdi
call   1060 <AMCMemPool_DebugStdout@plt>
mov    %r12,%rdi
call   1040 <AMCMemPool_Free@plt>
mov    %rbx,%rdi
call   1060 <AMCMemPool_DebugStdout@plt>
mov    (%rsp),%rdi
call   1040 <AMCMemPool_Free@plt>
mov    %rbx,%rdi
call   1060 <AMCMemPool_DebugStdout@plt>
mov    %r15,%rdi
call   1040 <AMCMemPool_Free@plt>
mov    %rbx,%rdi
call   1060 <AMCMemPool_DebugStdout@plt>
mov    %rbp,%rdi
call   1040 <AMCMemPool_Free@plt>
mov    %rbx,%rdi
call   1060 <AMCMemPool_DebugStdout@plt>
mov    %r14,%rdi
call   1040 <AMCMemPool_Free@plt>
mov    %rbx,%rdi
call   1060 <AMCMemPool_DebugStdout@plt>
mov    %rbx,%rdi
call   1070 <AMCMemPool_Alloc@plt>
mov    %rbx,%rdi
call   1060 <AMCMemPool_DebugStdout@plt>
mov    %rbx,%rdi
call   1070 <AMCMemPool_Alloc@plt>
mov    %rbx,%rdi
call   1060 <AMCMemPool_DebugStdout@plt>
mov    %r13,%rdi
call   1040 <AMCMemPool_Free@plt>
mov    %rbx,%rdi
call   1060 <AMCMemPool_DebugStdout@plt>
mov    0x8(%rsp),%rdi
call   1040 <AMCMemPool_Free@plt>
mov    %rbx,%rdi
call   1060 <AMCMemPool_DebugStdout@plt>
mov    0x10(%rsp),%rdi
call   1040 <AMCMemPool_Free@plt>
mov    %rbx,%rdi
call   1060 <AMCMemPool_DebugStdout@plt>
mov    %rbx,%rdi
call   1080 <AMCMemPool_Destory@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.AMCMemPool = type opaque
%struct.AMCMemUnit = type { i32 }
@.str = [26 x i8] c"Cannot create mempry pool\00"
define i32 @trueMain(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i64
%6 = alloca %struct.AMCMemPool*
%7 = alloca [20 x %struct.AMCMemUnit*]
store i32 %0, i32* %3
store i8** %1, i8*** %4
%8 = call i8* @AMCMemPool_Create(i32 16, i32 5, i32 3, i32 1)
%9 = bitcast i8* %8 to %struct.AMCMemPool*
store %struct.AMCMemPool* %9, %struct.AMCMemPool** %6
%10 = load %struct.AMCMemPool*, %struct.AMCMemPool** %6
%11 = icmp eq %struct.AMCMemPool* null, %10
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @AMCPrintf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %18
14: ; preds = %2
%15 = load %struct.AMCMemPool*, %struct.AMCMemPool** %6
%16 = bitcast %struct.AMCMemPool* %15 to i8*
%17 = call i32 @AMCMemPool_DebugStdout(i8* %16)
br label %18
18: ; preds = %14, %12
store i64 0, i64* %5
br label %19
19: ; preds = %28, %18
%20 = load i64, i64* %5
%21 = icmp slt i64 %20, 14
br i1 %21, label %22, label %31
22: ; preds = %19
%23 = load %struct.AMCMemPool*, %struct.AMCMemPool** %6
%24 = bitcast %struct.AMCMemPool* %23 to i8*
%25 = call %struct.AMCMemUnit* @AMCMemPool_Alloc(i8* %24)
%26 = load i64, i64* %5
%27 = getelementptr inbounds [20 x %struct.AMCMemUnit*], [20 x %struct.AMCMemUnit*]* %7, i64 0, i64 %26
store %struct.AMCMemUnit* %25, %struct.AMCMemUnit** %27
br label %28
28: ; preds = %22
%29 = load i64, i64* %5
%30 = add nsw i64 %29, 1
store i64 %30, i64* %5
br label %19
31: ; preds = %19
%32 = load %struct.AMCMemPool*, %struct.AMCMemPool** %6
%33 = bitcast %struct.AMCMemPool* %32 to i8*
%34 = call i32 @AMCMemPool_DebugStdout(i8* %33)
%35 = getelementptr inbounds [20 x %struct.AMCMemUnit*], [20 x %struct.AMCMemUnit*]* %7, i64 0, i64 6
%36 = load %struct.AMCMemUnit*, %struct.AMCMemUnit** %35
%37 = call i32 @AMCMemPool_Free(%struct.AMCMemUnit* %36)
%38 = load %struct.AMCMemPool*, %struct.AMCMemPool** %6
%39 = bitcast %struct.AMCMemPool* %38 to i8*
%40 = call i32 @AMCMemPool_DebugStdout(i8* %39)
%41 = getelementptr inbounds [20 x %struct.AMCMemUnit*], [20 x %struct.AMCMemUnit*]* %7, i64 0, i64 0
%42 = load %struct.AMCMemUnit*, %struct.AMCMemUnit** %41
%43 = call i32 @AMCMemPool_Free(%struct.AMCMemUnit* %42)
%44 = load %struct.AMCMemPool*, %struct.AMCMemPool** %6
%45 = bitcast %struct.AMCMemPool* %44 to i8*
%46 = call i32 @AMCMemPool_DebugStdout(i8* %45)
%47 = getelementptr inbounds [20 x %struct.AMCMemUnit*], [20 x %struct.AMCMemUnit*]* %7, i64 0, i64 8
%48 = load %struct.AMCMemUnit*, %struct.AMCMemUnit** %47
%49 = call i32 @AMCMemPool_Free(%struct.AMCMemUnit* %48)
%50 = load %struct.AMCMemPool*, %struct.AMCMemPool** %6
%51 = bitcast %struct.AMCMemPool* %50 to i8*
%52 = call i32 @AMCMemPool_DebugStdout(i8* %51)
%53 = getelementptr inbounds [20 x %struct.AMCMemUnit*], [20 x %struct.AMCMemUnit*]* %7, i64 0, i64 5
%54 = load %struct.AMCMemUnit*, %struct.AMCMemUnit** %53
%55 = call i32 @AMCMemPool_Free(%struct.AMCMemUnit* %54)
%56 = load %struct.AMCMemPool*, %struct.AMCMemPool** %6
%57 = bitcast %struct.AMCMemPool* %56 to i8*
%58 = call i32 @AMCMemPool_DebugStdout(i8* %57)
%59 = getelementptr inbounds [20 x %struct.AMCMemUnit*], [20 x %struct.AMCMemUnit*]* %7, i64 0, i64 7
%60 = load %struct.AMCMemUnit*, %struct.AMCMemUnit** %59
%61 = call i32 @AMCMemPool_Free(%struct.AMCMemUnit* %60)
%62 = load %struct.AMCMemPool*, %struct.AMCMemPool** %6
%63 = bitcast %struct.AMCMemPool* %62 to i8*
%64 = call i32 @AMCMemPool_DebugStdout(i8* %63)
%65 = load %struct.AMCMemPool*, %struct.AMCMemPool** %6
%66 = bitcast %struct.AMCMemPool* %65 to i8*
%67 = call %struct.AMCMemUnit* @AMCMemPool_Alloc(i8* %66)
%68 = getelementptr inbounds [20 x %struct.AMCMemUnit*], [20 x %struct.AMCMemUnit*]* %7, i64 0, i64 6
store %struct.AMCMemUnit* %67, %struct.AMCMemUnit** %68
%69 = load %struct.AMCMemPool*, %struct.AMCMemPool** %6
%70 = bitcast %struct.AMCMemPool* %69 to i8*
%71 = call i32 @AMCMemPool_DebugStdout(i8* %70)
%72 = load %struct.AMCMemPool*, %struct.AMCMemPool** %6
%73 = bitcast %struct.AMCMemPool* %72 to i8*
%74 = call %struct.AMCMemUnit* @AMCMemPool_Alloc(i8* %73)
%75 = getelementptr inbounds [20 x %struct.AMCMemUnit*], [20 x %struct.AMCMemUnit*]* %7, i64 0, i64 8
store %struct.AMCMemUnit* %74, %struct.AMCMemUnit** %75
%76 = load %struct.AMCMemPool*, %struct.AMCMemPool** %6
%77 = bitcast %struct.AMCMemPool* %76 to i8*
%78 = call i32 @AMCMemPool_DebugStdout(i8* %77)
%79 = getelementptr inbounds [20 x %struct.AMCMemUnit*], [20 x %struct.AMCMemUnit*]* %7, i64 0, i64 11
%80 = load %struct.AMCMemUnit*, %struct.AMCMemUnit** %79
%81 = call i32 @AMCMemPool_Free(%struct.AMCMemUnit* %80)
%82 = load %struct.AMCMemPool*, %struct.AMCMemPool** %6
%83 = bitcast %struct.AMCMemPool* %82 to i8*
%84 = call i32 @AMCMemPool_DebugStdout(i8* %83)
%85 = getelementptr inbounds [20 x %struct.AMCMemUnit*], [20 x %struct.AMCMemUnit*]* %7, i64 0, i64 12
%86 = load %struct.AMCMemUnit*, %struct.AMCMemUnit** %85
%87 = call i32 @AMCMemPool_Free(%struct.AMCMemUnit* %86)
%88 = load %struct.AMCMemPool*, %struct.AMCMemPool** %6
%89 = bitcast %struct.AMCMemPool* %88 to i8*
%90 = call i32 @AMCMemPool_DebugStdout(i8* %89)
%91 = getelementptr inbounds [20 x %struct.AMCMemUnit*], [20 x %struct.AMCMemUnit*]* %7, i64 0, i64 13
%92 = load %struct.AMCMemUnit*, %struct.AMCMemUnit** %91
%93 = call i32 @AMCMemPool_Free(%struct.AMCMemUnit* %92)
%94 = load %struct.AMCMemPool*, %struct.AMCMemPool** %6
%95 = bitcast %struct.AMCMemPool* %94 to i8*
%96 = call i32 @AMCMemPool_DebugStdout(i8* %95)
%97 = load %struct.AMCMemPool*, %struct.AMCMemPool** %6
%98 = bitcast %struct.AMCMemPool* %97 to i8*
%99 = call i32 @AMCMemPool_Destory(i8* %98)
store %struct.AMCMemPool* null, %struct.AMCMemPool** %6
ret i32 0
}

LLVM IR (-O2):
%struct.AMCMemUnit = type { i32 }
%struct.AMCMemPool = type opaque
@.str = [26 x i8] c"Cannot create mempry pool\00"
define i32 @trueMain(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i8* @AMCMemPool_Create(i32 16, i32 5, i32 3, i32 1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @AMCPrintf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %9
7: ; preds = %2
%8 = tail call i32 @AMCMemPool_DebugStdout(i8* %3)
br label %9
9: ; preds = %7, %5
%10 = tail call %struct.AMCMemUnit* @AMCMemPool_Alloc(i8* %3)
%11 = tail call %struct.AMCMemUnit* @AMCMemPool_Alloc(i8* %3)
%12 = tail call %struct.AMCMemUnit* @AMCMemPool_Alloc(i8* %3)
%13 = tail call %struct.AMCMemUnit* @AMCMemPool_Alloc(i8* %3)
%14 = tail call %struct.AMCMemUnit* @AMCMemPool_Alloc(i8* %3)
%15 = tail call %struct.AMCMemUnit* @AMCMemPool_Alloc(i8* %3)
%16 = tail call %struct.AMCMemUnit* @AMCMemPool_Alloc(i8* %3)
%17 = tail call %struct.AMCMemUnit* @AMCMemPool_Alloc(i8* %3)
%18 = tail call %struct.AMCMemUnit* @AMCMemPool_Alloc(i8* %3)
%19 = tail call %struct.AMCMemUnit* @AMCMemPool_Alloc(i8* %3)
%20 = tail call %struct.AMCMemUnit* @AMCMemPool_Alloc(i8* %3)
%21 = tail call %struct.AMCMemUnit* @AMCMemPool_Alloc(i8* %3)
%22 = tail call %struct.AMCMemUnit* @AMCMemPool_Alloc(i8* %3)
%23 = tail call %struct.AMCMemUnit* @AMCMemPool_Alloc(i8* %3)
%24 = tail call i32 @AMCMemPool_DebugStdout(i8* %3)
%25 = tail call i32 @AMCMemPool_Free(%struct.AMCMemUnit* %16)
%26 = tail call i32 @AMCMemPool_DebugStdout(i8* %3)
%27 = tail call i32 @AMCMemPool_Free(%struct.AMCMemUnit* %10)
%28 = tail call i32 @AMCMemPool_DebugStdout(i8* %3)
%29 = tail call i32 @AMCMemPool_Free(%struct.AMCMemUnit* %18)
%30 = tail call i32 @AMCMemPool_DebugStdout(i8* %3)
%31 = tail call i32 @AMCMemPool_Free(%struct.AMCMemUnit* %15)
%32 = tail call i32 @AMCMemPool_DebugStdout(i8* %3)
%33 = tail call i32 @AMCMemPool_Free(%struct.AMCMemUnit* %17)
%34 = tail call i32 @AMCMemPool_DebugStdout(i8* %3)
%35 = tail call %struct.AMCMemUnit* @AMCMemPool_Alloc(i8* %3)
%36 = tail call i32 @AMCMemPool_DebugStdout(i8* %3)
%37 = tail call %struct.AMCMemUnit* @AMCMemPool_Alloc(i8* %3)
%38 = tail call i32 @AMCMemPool_DebugStdout(i8* %3)
%39 = tail call i32 @AMCMemPool_Free(%struct.AMCMemUnit* %21)
%40 = tail call i32 @AMCMemPool_DebugStdout(i8* %3)
%41 = tail call i32 @AMCMemPool_Free(%struct.AMCMemUnit* %22)
%42 = tail call i32 @AMCMemPool_DebugStdout(i8* %3)
%43 = tail call i32 @AMCMemPool_Free(%struct.AMCMemUnit* %23)
%44 = tail call i32 @AMCMemPool_DebugStdout(i8* %3)
%45 = tail call i32 @AMCMemPool_Destory(i8* %3)
ret i32 0
}