; LLVM IR from stan-dev/math :: lib/tbb_2020.3/src/test/test_malloc_pools.ll (Z23TestPoolKeepTillDestroyv)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"struct.rml::MemPoolPolicy" = type { ptr, ptr, i64, i32, i32 }

@.str.20 = external hidden unnamed_addr constant [93 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [2 x i8], align 1
@_ZL9putMemAll = external hidden global i64, align 8
@_ZL9getMemAll = external hidden global i64, align 8
@.str.44 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.45 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.49 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.51 = external hidden unnamed_addr constant [22 x i8], align 1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11ReportErrorPKciS0_S0_(ptr noundef, i32 noundef, ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3rml13MemPoolPolicyC2EPFPvlRmEPFilS1_mEmbb(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef, i64 noundef, i1 noundef zeroext, i1 noundef zeroext) unnamed_addr #2 align 2

declare noundef i32 @_ZN3rml14pool_create_v1ElPKNS_13MemPoolPolicyEPPNS_10MemoryPoolE(i64 noundef, ptr noundef, ptr noundef) #3

declare noundef ptr @_ZN3rml11pool_mallocEPNS_10MemoryPoolEm(ptr noundef, i64 noundef) #3

declare noundef zeroext i1 @_ZN3rml10pool_resetEPNS_10MemoryPoolE(ptr noundef) #3

declare noundef zeroext i1 @_ZN3rml12pool_destroyEPNS_10MemoryPoolE(ptr noundef) #3

declare noundef zeroext i1 @_ZN3rml9pool_freeEPNS_10MemoryPoolEPv(ptr noundef, ptr noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_Z23TestPoolKeepTillDestroyv() #1 {
  %1 = alloca i32, align 4
  %2 = alloca [102401 x ptr], align 16
  %3 = alloca %"struct.rml::MemPoolPolicy", align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca i8, align 1
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  store i32 51200, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 819208, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr %3) #4
  call void @_ZN3rml13MemPoolPolicyC2EPFPvlRmEPFilS1_mEmbb(ptr noundef nonnull align 8 dereferenceable(32) %3, ptr noundef @_ZL12getMemMalloclRm, ptr noundef @_ZL10putMemFreelPvm, i64 noundef 0, i1 noundef zeroext false, i1 noundef zeroext false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %14

14:                                               ; preds = %146, %0
  %15 = load i32, ptr %5, align 4, !tbaa !5
  %16 = icmp slt i32 %15, 2
  br i1 %16, label %18, label %17

17:                                               ; preds = %14
  store i32 2, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %149

18:                                               ; preds = %14
  store i64 0, ptr @_ZL9putMemAll, align 8, !tbaa !9
  store i64 0, ptr @_ZL9getMemAll, align 8, !tbaa !9
  %19 = load i32, ptr %5, align 4, !tbaa !5
  %20 = icmp ne i32 %19, 0
  br i1 %20, label %21, label %26

21:                                               ; preds = %18
  %22 = getelementptr inbounds %"struct.rml::MemPoolPolicy", ptr %3, i32 0, i32 4
  %23 = load i32, ptr %22, align 4
  %24 = and i32 %23, -3
  %25 = or i32 %24, 2
  store i32 %25, ptr %22, align 4
  br label %26

26:                                               ; preds = %21, %18
  %27 = call noundef i32 @_ZN3rml14pool_create_v1ElPKNS_13MemPoolPolicyEPPNS_10MemoryPoolE(i64 noundef 0, ptr noundef %3, ptr noundef %4)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %28

28:                                               ; preds = %44, %26
  %29 = load i32, ptr %7, align 4, !tbaa !5
  %30 = icmp slt i32 %29, 102400
  br i1 %30, label %32, label %31

31:                                               ; preds = %28
  store i32 5, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %47

32:                                               ; preds = %28
  %33 = load ptr, ptr %4, align 8, !tbaa !11
  %34 = call noundef ptr @_ZN3rml11pool_mallocEPNS_10MemoryPoolEm(ptr noundef %33, i64 noundef 7168)
  %35 = load i32, ptr %7, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [102401 x ptr], ptr %2, i64 0, i64 %36
  store ptr %34, ptr %37, align 8, !tbaa !11
  %38 = load ptr, ptr %4, align 8, !tbaa !11
  %39 = call noundef ptr @_ZN3rml11pool_mallocEPNS_10MemoryPoolEm(ptr noundef %38, i64 noundef 10240)
  %40 = load i32, ptr %7, align 4, !tbaa !5
  %41 = add nsw i32 %40, 1
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [102401 x ptr], ptr %2, i64 0, i64 %42
  store ptr %39, ptr %43, align 8, !tbaa !11
  br label %44

44:                                               ; preds = %32
  %45 = load i32, ptr %7, align 4, !tbaa !5
  %46 = add nsw i32 %45, 2
  store i32 %46, ptr %7, align 4, !tbaa !5
  br label %28, !llvm.loop !13

47:                                               ; preds = %31
  %48 = load ptr, ptr %4, align 8, !tbaa !11
  %49 = call noundef ptr @_ZN3rml11pool_mallocEPNS_10MemoryPoolEm(ptr noundef %48, i64 noundef 8388608)
  %50 = getelementptr inbounds [102401 x ptr], ptr %2, i64 0, i64 102400
  store ptr %49, ptr %50, align 16, !tbaa !11
  %51 = load i64, ptr @_ZL9putMemAll, align 8, !tbaa !9
  %52 = icmp ne i64 %51, 0
  br i1 %52, label %54, label %53

53:                                               ; preds = %47
  br label %55

54:                                               ; preds = %47
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str.20, i32 noundef 540, ptr noundef @.str.44, ptr noundef null)
  br label %55

55:                                               ; preds = %54, %53
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %67, %55
  %57 = load i32, ptr %8, align 4, !tbaa !5
  %58 = icmp slt i32 %57, 102400
  br i1 %58, label %60, label %59

59:                                               ; preds = %56
  store i32 8, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %70

60:                                               ; preds = %56
  %61 = load ptr, ptr %4, align 8, !tbaa !11
  %62 = load i32, ptr %8, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [102401 x ptr], ptr %2, i64 0, i64 %63
  %65 = load ptr, ptr %64, align 8, !tbaa !11
  %66 = call noundef zeroext i1 @_ZN3rml9pool_freeEPNS_10MemoryPoolEPv(ptr noundef %61, ptr noundef %65)
  br label %67

67:                                               ; preds = %60
  %68 = load i32, ptr %8, align 4, !tbaa !5
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %8, align 4, !tbaa !5
  br label %56, !llvm.loop !15

70:                                               ; preds = %59
  %71 = load ptr, ptr %4, align 8, !tbaa !11
  %72 = getelementptr inbounds [102401 x ptr], ptr %2, i64 0, i64 102400
  %73 = load ptr, ptr %72, align 16, !tbaa !11
  %74 = call noundef zeroext i1 @_ZN3rml9pool_freeEPNS_10MemoryPoolEPv(ptr noundef %71, ptr noundef %73)
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %75 = load i64, ptr @_ZL9putMemAll, align 8, !tbaa !9
  store i64 %75, ptr %9, align 8, !tbaa !9
  %76 = load i32, ptr %5, align 4, !tbaa !5
  %77 = icmp ne i32 %76, 0
  br i1 %77, label %78, label %84

78:                                               ; preds = %70
  %79 = load i64, ptr @_ZL9putMemAll, align 8, !tbaa !9
  %80 = icmp ne i64 %79, 0
  br i1 %80, label %82, label %81

81:                                               ; preds = %78
  br label %83

82:                                               ; preds = %78
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str.20, i32 noundef 546, ptr noundef @.str.44, ptr noundef null)
  br label %83

83:                                               ; preds = %82, %81
  br label %90

84:                                               ; preds = %70
  %85 = load i64, ptr @_ZL9putMemAll, align 8, !tbaa !9
  %86 = icmp ne i64 %85, 0
  br i1 %86, label %87, label %88

87:                                               ; preds = %84
  br label %89

88:                                               ; preds = %84
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str.20, i32 noundef 548, ptr noundef @.str.45, ptr noundef null)
  br label %89

89:                                               ; preds = %88, %87
  store i64 0, ptr @_ZL9putMemAll, align 8, !tbaa !9
  br label %90

90:                                               ; preds = %89, %83
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %91 = load i64, ptr @_ZL9getMemAll, align 8, !tbaa !9
  store i64 %91, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %92 = load ptr, ptr %4, align 8, !tbaa !11
  %93 = call noundef ptr @_ZN3rml11pool_mallocEPNS_10MemoryPoolEm(ptr noundef %92, i64 noundef 8388608)
  store ptr %93, ptr %11, align 8, !tbaa !11
  %94 = load ptr, ptr %11, align 8, !tbaa !11
  %95 = icmp ne ptr %94, null
  br i1 %95, label %96, label %97

96:                                               ; preds = %90
  br label %98

97:                                               ; preds = %90
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str.20, i32 noundef 553, ptr noundef @.str.42, ptr noundef null)
  br label %98

98:                                               ; preds = %97, %96
  %99 = load i32, ptr %5, align 4, !tbaa !5
  %100 = icmp ne i32 %99, 0
  br i1 %100, label %101, label %108

101:                                              ; preds = %98
  %102 = load i64, ptr %10, align 8, !tbaa !9
  %103 = load i64, ptr @_ZL9getMemAll, align 8, !tbaa !9
  %104 = icmp eq i64 %102, %103
  br i1 %104, label %105, label %106

105:                                              ; preds = %101
  br label %107

106:                                              ; preds = %101
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str.20, i32 noundef 555, ptr noundef @.str.46, ptr noundef @.str.47)
  br label %107

107:                                              ; preds = %106, %105
  br label %108

108:                                              ; preds = %107, %98
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %109 = load i64, ptr @_ZL9putMemAll, align 8, !tbaa !9
  store i64 %109, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #4
  %110 = load ptr, ptr %4, align 8, !tbaa !11
  %111 = call noundef zeroext i1 @_ZN3rml10pool_resetEPNS_10MemoryPoolE(ptr noundef %110)
  %112 = zext i1 %111 to i8
  store i8 %112, ptr %13, align 1, !tbaa !16
  %113 = load i8, ptr %13, align 1, !tbaa !16, !range !18, !noundef !19
  %114 = trunc i8 %113 to i1
  br i1 %114, label %115, label %116

115:                                              ; preds = %108
  br label %117

116:                                              ; preds = %108
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str.20, i32 noundef 558, ptr noundef @.str.23, ptr noundef null)
  br label %117

117:                                              ; preds = %116, %115
  %118 = load i64, ptr %12, align 8, !tbaa !9
  %119 = load i64, ptr @_ZL9putMemAll, align 8, !tbaa !9
  %120 = icmp eq i64 %118, %119
  br i1 %120, label %121, label %122

121:                                              ; preds = %117
  br label %123

122:                                              ; preds = %117
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str.20, i32 noundef 559, ptr noundef @.str.48, ptr noundef @.str.49)
  br label %123

123:                                              ; preds = %122, %121
  %124 = load ptr, ptr %4, align 8, !tbaa !11
  %125 = call noundef zeroext i1 @_ZN3rml12pool_destroyEPNS_10MemoryPoolE(ptr noundef %124)
  %126 = zext i1 %125 to i8
  store i8 %126, ptr %13, align 1, !tbaa !16
  %127 = load i8, ptr %13, align 1, !tbaa !16, !range !18, !noundef !19
  %128 = trunc i8 %127 to i1
  br i1 %128, label %129, label %130

129:                                              ; preds = %123
  br label %131

130:                                              ; preds = %123
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str.20, i32 noundef 561, ptr noundef @.str.23, ptr noundef null)
  br label %131

131:                                              ; preds = %130, %129
  %132 = load i64, ptr @_ZL9putMemAll, align 8, !tbaa !9
  %133 = icmp ne i64 %132, 0
  br i1 %133, label %134, label %135

134:                                              ; preds = %131
  br label %136

135:                                              ; preds = %131
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str.20, i32 noundef 562, ptr noundef @.str.45, ptr noundef null)
  br label %136

136:                                              ; preds = %135, %134
  %137 = load i64, ptr @_ZL9putMemAll, align 8, !tbaa !9
  %138 = load i64, ptr %9, align 8, !tbaa !9
  %139 = add i64 %138, %137
  store i64 %139, ptr %9, align 8, !tbaa !9
  %140 = load i64, ptr @_ZL9getMemAll, align 8, !tbaa !9
  %141 = load i64, ptr %9, align 8, !tbaa !9
  %142 = icmp eq i64 %140, %141
  br i1 %142, label %143, label %144

143:                                              ; preds = %136
  br label %145

144:                                              ; preds = %136
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str.20, i32 noundef 564, ptr noundef @.str.50, ptr noundef @.str.51)
  br label %145

145:                                              ; preds = %144, %143
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %146

146:                                              ; preds = %145
  %147 = load i32, ptr %5, align 4, !tbaa !5
  %148 = add nsw i32 %147, 1
  store i32 %148, ptr %5, align 4, !tbaa !5
  br label %14, !llvm.loop !20

149:                                              ; preds = %17
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 819208, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #4
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef ptr @_ZL12getMemMalloclRm(i64 noundef, ptr noundef nonnull align 8 dereferenceable(8)) #2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL10putMemFreelPvm(i64 noundef, ptr noundef, i64 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{!17, !17, i64 0}
!17 = !{!"bool", !7, i64 0}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = distinct !{!20, !14}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"struct.rml::MemPoolPolicy" = type { ptr, ptr, i64, i32, i32 }

@.str.20 = external hidden unnamed_addr constant [93 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [2 x i8], align 1
@_ZL9putMemAll = external hidden local_unnamed_addr global i64, align 8
@_ZL9getMemAll = external hidden local_unnamed_addr global i64, align 8
@.str.44 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.45 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.49 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.51 = external hidden unnamed_addr constant [22 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11ReportErrorPKciS0_S0_(ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3rml13MemPoolPolicyC2EPFPvlRmEPFilS1_mEmbb(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef, i64 noundef, i1 noundef zeroext, i1 noundef zeroext) unnamed_addr #2 align 2

declare noundef i32 @_ZN3rml14pool_create_v1ElPKNS_13MemPoolPolicyEPPNS_10MemoryPoolE(i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare noundef ptr @_ZN3rml11pool_mallocEPNS_10MemoryPoolEm(ptr noundef, i64 noundef) local_unnamed_addr #3

declare noundef zeroext i1 @_ZN3rml10pool_resetEPNS_10MemoryPoolE(ptr noundef) local_unnamed_addr #3

declare noundef zeroext i1 @_ZN3rml12pool_destroyEPNS_10MemoryPoolE(ptr noundef) local_unnamed_addr #3

declare noundef zeroext i1 @_ZN3rml9pool_freeEPNS_10MemoryPoolEPv(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local void @_Z23TestPoolKeepTillDestroyv() local_unnamed_addr #1 {
  %1 = alloca [102401 x ptr], align 16
  %2 = alloca %"struct.rml::MemPoolPolicy", align 8
  %3 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 819208, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %2) #4
  call void @_ZN3rml13MemPoolPolicyC2EPFPvlRmEPFilS1_mEmbb(ptr noundef nonnull align 8 dereferenceable(32) %2, ptr noundef nonnull @_ZL12getMemMalloclRm, ptr noundef nonnull @_ZL10putMemFreelPvm, i64 noundef 0, i1 noundef zeroext false, i1 noundef zeroext false)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  %4 = getelementptr inbounds i8, ptr %2, i64 28
  %5 = getelementptr inbounds i8, ptr %1, i64 819200
  store i64 0, ptr @_ZL9putMemAll, align 8, !tbaa !5
  store i64 0, ptr @_ZL9getMemAll, align 8, !tbaa !5
  %6 = call noundef i32 @_ZN3rml14pool_create_v1ElPKNS_13MemPoolPolicyEPPNS_10MemoryPoolE(i64 noundef 0, ptr noundef nonnull %2, ptr noundef nonnull %3)
  br label %11

7:                                                ; preds = %11
  %8 = load ptr, ptr %3, align 8, !tbaa !9
  %9 = call noundef ptr @_ZN3rml11pool_mallocEPNS_10MemoryPoolEm(ptr noundef %8, i64 noundef 8388608)
  store ptr %9, ptr %5, align 16, !tbaa !9
  %10 = load i64, ptr @_ZL9putMemAll, align 8, !tbaa !5
  %.not20 = icmp eq i64 %10, 0
  br i1 %.not20, label %.preheader, label %20

11:                                               ; preds = %0, %11
  %indvars.iv = phi i64 [ 0, %0 ], [ %indvars.iv.next, %11 ]
  %12 = load ptr, ptr %3, align 8, !tbaa !9
  %13 = call noundef ptr @_ZN3rml11pool_mallocEPNS_10MemoryPoolEm(ptr noundef %12, i64 noundef 7168)
  %14 = getelementptr inbounds [102401 x ptr], ptr %1, i64 0, i64 %indvars.iv
  store ptr %13, ptr %14, align 16, !tbaa !9
  %15 = load ptr, ptr %3, align 8, !tbaa !9
  %16 = call noundef ptr @_ZN3rml11pool_mallocEPNS_10MemoryPoolEm(ptr noundef %15, i64 noundef 10240)
  %17 = or disjoint i64 %indvars.iv, 1
  %18 = getelementptr inbounds [102401 x ptr], ptr %1, i64 0, i64 %17
  store ptr %16, ptr %18, align 8, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 2
  %19 = icmp ult i64 %indvars.iv, 102398
  br i1 %19, label %11, label %7, !llvm.loop !11

20:                                               ; preds = %7
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str.20, i32 noundef 540, ptr noundef nonnull @.str.44, ptr noundef null)
  br label %.preheader

.preheader:                                       ; preds = %7, %20
  br label %25

21:                                               ; preds = %25
  %22 = load ptr, ptr %3, align 8, !tbaa !9
  %23 = call noundef zeroext i1 @_ZN3rml9pool_freeEPNS_10MemoryPoolEPv(ptr noundef %22, ptr noundef %9)
  %24 = load i64, ptr @_ZL9putMemAll, align 8, !tbaa !5
  %.not21 = icmp eq i64 %24, 0
  br i1 %.not21, label %30, label %31

25:                                               ; preds = %.preheader, %25
  %indvars.iv30 = phi i64 [ %indvars.iv.next31, %25 ], [ 0, %.preheader ]
  %26 = load ptr, ptr %3, align 8, !tbaa !9
  %27 = getelementptr inbounds [102401 x ptr], ptr %1, i64 0, i64 %indvars.iv30
  %28 = load ptr, ptr %27, align 8, !tbaa !9
  %29 = call noundef zeroext i1 @_ZN3rml9pool_freeEPNS_10MemoryPoolEPv(ptr noundef %26, ptr noundef %28)
  %indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next31, 102400
  br i1 %exitcond.not, label %21, label %25, !llvm.loop !13

30:                                               ; preds = %21
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str.20, i32 noundef 548, ptr noundef nonnull @.str.45, ptr noundef null)
  br label %31

31:                                               ; preds = %21, %30
  store i64 0, ptr @_ZL9putMemAll, align 8, !tbaa !5
  %32 = load ptr, ptr %3, align 8, !tbaa !9
  %33 = call noundef ptr @_ZN3rml11pool_mallocEPNS_10MemoryPoolEm(ptr noundef %32, i64 noundef 8388608)
  %.not23 = icmp eq ptr %33, null
  br i1 %.not23, label %34, label %35

34:                                               ; preds = %31
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str.20, i32 noundef 553, ptr noundef nonnull @.str.42, ptr noundef null)
  br label %35

35:                                               ; preds = %34, %31
  %36 = load i64, ptr @_ZL9putMemAll, align 8, !tbaa !5
  %37 = load ptr, ptr %3, align 8, !tbaa !9
  %38 = call noundef zeroext i1 @_ZN3rml10pool_resetEPNS_10MemoryPoolE(ptr noundef %37)
  br i1 %38, label %40, label %39

39:                                               ; preds = %35
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str.20, i32 noundef 558, ptr noundef nonnull @.str.23, ptr noundef null)
  br label %40

40:                                               ; preds = %35, %39
  %41 = load i64, ptr @_ZL9putMemAll, align 8, !tbaa !5
  %42 = icmp eq i64 %36, %41
  br i1 %42, label %44, label %43

43:                                               ; preds = %40
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str.20, i32 noundef 559, ptr noundef nonnull @.str.48, ptr noundef nonnull @.str.49)
  br label %44

44:                                               ; preds = %40, %43
  %45 = load ptr, ptr %3, align 8, !tbaa !9
  %46 = call noundef zeroext i1 @_ZN3rml12pool_destroyEPNS_10MemoryPoolE(ptr noundef %45)
  br i1 %46, label %48, label %47

47:                                               ; preds = %44
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str.20, i32 noundef 561, ptr noundef nonnull @.str.23, ptr noundef null)
  br label %48

48:                                               ; preds = %44, %47
  %49 = load i64, ptr @_ZL9putMemAll, align 8, !tbaa !5
  %.not24 = icmp eq i64 %49, 0
  br i1 %.not24, label %50, label %51

50:                                               ; preds = %48
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str.20, i32 noundef 562, ptr noundef nonnull @.str.45, ptr noundef null)
  %.pre = load i64, ptr @_ZL9putMemAll, align 8, !tbaa !5
  br label %51

51:                                               ; preds = %48, %50
  %52 = phi i64 [ %49, %48 ], [ %.pre, %50 ]
  %53 = add i64 %52, %24
  %54 = load i64, ptr @_ZL9getMemAll, align 8, !tbaa !5
  %55 = icmp eq i64 %54, %53
  br i1 %55, label %57, label %56

56:                                               ; preds = %51
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str.20, i32 noundef 564, ptr noundef nonnull @.str.50, ptr noundef nonnull @.str.51)
  br label %57

57:                                               ; preds = %51, %56
  store i64 0, ptr @_ZL9putMemAll, align 8, !tbaa !5
  store i64 0, ptr @_ZL9getMemAll, align 8, !tbaa !5
  %58 = load i32, ptr %4, align 4
  %59 = or i32 %58, 2
  store i32 %59, ptr %4, align 4
  %60 = call noundef i32 @_ZN3rml14pool_create_v1ElPKNS_13MemPoolPolicyEPPNS_10MemoryPoolE(i64 noundef 0, ptr noundef nonnull %2, ptr noundef nonnull %3)
  br label %61

61:                                               ; preds = %61, %57
  %indvars.iv.1 = phi i64 [ 0, %57 ], [ %indvars.iv.next.1, %61 ]
  %62 = load ptr, ptr %3, align 8, !tbaa !9
  %63 = call noundef ptr @_ZN3rml11pool_mallocEPNS_10MemoryPoolEm(ptr noundef %62, i64 noundef 7168)
  %64 = getelementptr inbounds [102401 x ptr], ptr %1, i64 0, i64 %indvars.iv.1
  store ptr %63, ptr %64, align 16, !tbaa !9
  %65 = load ptr, ptr %3, align 8, !tbaa !9
  %66 = call noundef ptr @_ZN3rml11pool_mallocEPNS_10MemoryPoolEm(ptr noundef %65, i64 noundef 10240)
  %67 = or disjoint i64 %indvars.iv.1, 1
  %68 = getelementptr inbounds [102401 x ptr], ptr %1, i64 0, i64 %67
  store ptr %66, ptr %68, align 8, !tbaa !9
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv.1, 2
  %69 = icmp ult i64 %indvars.iv.1, 102398
  br i1 %69, label %61, label %70, !llvm.loop !11

70:                                               ; preds = %61
  %71 = load ptr, ptr %3, align 8, !tbaa !9
  %72 = call noundef ptr @_ZN3rml11pool_mallocEPNS_10MemoryPoolEm(ptr noundef %71, i64 noundef 8388608)
  store ptr %72, ptr %5, align 16, !tbaa !9
  %73 = load i64, ptr @_ZL9putMemAll, align 8, !tbaa !5
  %.not20.1 = icmp eq i64 %73, 0
  br i1 %.not20.1, label %.preheader.1, label %74

74:                                               ; preds = %70
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str.20, i32 noundef 540, ptr noundef nonnull @.str.44, ptr noundef null)
  br label %.preheader.1

.preheader.1:                                     ; preds = %74, %70
  br label %75

75:                                               ; preds = %75, %.preheader.1
  %indvars.iv30.1 = phi i64 [ %indvars.iv.next31.1, %75 ], [ 0, %.preheader.1 ]
  %76 = load ptr, ptr %3, align 8, !tbaa !9
  %77 = getelementptr inbounds [102401 x ptr], ptr %1, i64 0, i64 %indvars.iv30.1
  %78 = load ptr, ptr %77, align 8, !tbaa !9
  %79 = call noundef zeroext i1 @_ZN3rml9pool_freeEPNS_10MemoryPoolEPv(ptr noundef %76, ptr noundef %78)
  %indvars.iv.next31.1 = add nuw nsw i64 %indvars.iv30.1, 1
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next31.1, 102400
  br i1 %exitcond.not.1, label %80, label %75, !llvm.loop !13

80:                                               ; preds = %75
  %81 = load ptr, ptr %3, align 8, !tbaa !9
  %82 = call noundef zeroext i1 @_ZN3rml9pool_freeEPNS_10MemoryPoolEPv(ptr noundef %81, ptr noundef %72)
  %83 = load i64, ptr @_ZL9putMemAll, align 8, !tbaa !5
  %.not21.1 = icmp eq i64 %83, 0
  br i1 %.not21.1, label %85, label %84

84:                                               ; preds = %80
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str.20, i32 noundef 546, ptr noundef nonnull @.str.44, ptr noundef null)
  br label %85

85:                                               ; preds = %84, %80
  %86 = load i64, ptr @_ZL9getMemAll, align 8, !tbaa !5
  %87 = load ptr, ptr %3, align 8, !tbaa !9
  %88 = call noundef ptr @_ZN3rml11pool_mallocEPNS_10MemoryPoolEm(ptr noundef %87, i64 noundef 8388608)
  %.not23.1 = icmp eq ptr %88, null
  br i1 %.not23.1, label %89, label %90

89:                                               ; preds = %85
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str.20, i32 noundef 553, ptr noundef nonnull @.str.42, ptr noundef null)
  br label %90

90:                                               ; preds = %89, %85
  %91 = load i64, ptr @_ZL9getMemAll, align 8
  %92 = icmp eq i64 %86, %91
  br i1 %92, label %94, label %93

93:                                               ; preds = %90
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str.20, i32 noundef 555, ptr noundef nonnull @.str.46, ptr noundef nonnull @.str.47)
  br label %94

94:                                               ; preds = %93, %90
  %95 = load i64, ptr @_ZL9putMemAll, align 8, !tbaa !5
  %96 = load ptr, ptr %3, align 8, !tbaa !9
  %97 = call noundef zeroext i1 @_ZN3rml10pool_resetEPNS_10MemoryPoolE(ptr noundef %96)
  br i1 %97, label %99, label %98

98:                                               ; preds = %94
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str.20, i32 noundef 558, ptr noundef nonnull @.str.23, ptr noundef null)
  br label %99

99:                                               ; preds = %98, %94
  %100 = load i64, ptr @_ZL9putMemAll, align 8, !tbaa !5
  %101 = icmp eq i64 %95, %100
  br i1 %101, label %103, label %102

102:                                              ; preds = %99
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str.20, i32 noundef 559, ptr noundef nonnull @.str.48, ptr noundef nonnull @.str.49)
  br label %103

103:                                              ; preds = %102, %99
  %104 = load ptr, ptr %3, align 8, !tbaa !9
  %105 = call noundef zeroext i1 @_ZN3rml12pool_destroyEPNS_10MemoryPoolE(ptr noundef %104)
  br i1 %105, label %107, label %106

106:                                              ; preds = %103
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str.20, i32 noundef 561, ptr noundef nonnull @.str.23, ptr noundef null)
  br label %107

107:                                              ; preds = %106, %103
  %108 = load i64, ptr @_ZL9putMemAll, align 8, !tbaa !5
  %.not24.1 = icmp eq i64 %108, 0
  br i1 %.not24.1, label %109, label %110

109:                                              ; preds = %107
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str.20, i32 noundef 562, ptr noundef nonnull @.str.45, ptr noundef null)
  %.pre.1 = load i64, ptr @_ZL9putMemAll, align 8, !tbaa !5
  br label %110

110:                                              ; preds = %109, %107
  %111 = phi i64 [ %108, %107 ], [ %.pre.1, %109 ]
  %112 = add i64 %111, %83
  %113 = load i64, ptr @_ZL9getMemAll, align 8, !tbaa !5
  %114 = icmp eq i64 %113, %112
  br i1 %114, label %116, label %115

115:                                              ; preds = %110
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str.20, i32 noundef 564, ptr noundef nonnull @.str.50, ptr noundef nonnull @.str.51)
  br label %116

116:                                              ; preds = %115, %110
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 819208, ptr nonnull %1) #4
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef ptr @_ZL12getMemMalloclRm(i64 noundef, ptr noundef nonnull align 8 dereferenceable(8)) #2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL10putMemFreelPvm(i64 noundef, ptr noundef, i64 noundef) #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


; Effective O3 passes: ADCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass