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

; 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"

@__tbb_test_errno = external dso_local global i8, align 1
@.str = external hidden unnamed_addr constant [98 x i8], align 1
@Rposix_memalign = external dso_local global ptr, align 8
@Raligned_malloc = external dso_local global ptr, align 8
@Raligned_realloc = external dso_local global ptr, align 8
@Taligned_free = external dso_local global ptr, align 8
@.str.81 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.82 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.83 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.84 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.85 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.86 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.87 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.88 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.89 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.90 = external hidden unnamed_addr constant [16 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: nounwind willreturn memory(none)
declare ptr @__errno_location() #1

; 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) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z16Taligned_reallocPvmm(ptr noundef, i64 noundef, i64 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z15Tposix_memalignPPvmm(ptr noundef, i64 noundef, i64 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z15Taligned_mallocmm(i64 noundef, i64 noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8CMemTest21TestAlignedParametersEv(ptr noundef nonnull align 8 dereferenceable(16) %0) #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %11 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %12 = load ptr, ptr @Rposix_memalign, align 8, !tbaa !5
  %13 = icmp ne ptr %12, null
  br i1 %13, label %14, label %56

14:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 3, ptr %5, align 4, !tbaa !9
  br label %15

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

18:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  br label %38

19:                                               ; preds = %15
  %20 = load i32, ptr %5, align 4, !tbaa !9
  %21 = load i32, ptr %5, align 4, !tbaa !9
  %22 = sub nsw i32 %21, 1
  %23 = and i32 %20, %22
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %25, label %34

25:                                               ; preds = %19
  %26 = load i32, ptr %5, align 4, !tbaa !9
  %27 = sext i32 %26 to i64
  %28 = call noundef i32 @_Z15Tposix_memalignPPvmm(ptr noundef null, i64 noundef %27, i64 noundef 100)
  store i32 %28, ptr %4, align 4, !tbaa !9
  %29 = load i32, ptr %4, align 4, !tbaa !9
  %30 = icmp eq i32 22, %29
  br i1 %30, label %31, label %32

31:                                               ; preds = %25
  br label %33

32:                                               ; preds = %25
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 1042, ptr noundef @.str.81, ptr noundef null)
  br label %33

33:                                               ; preds = %32, %31
  br label %34

34:                                               ; preds = %33, %19
  br label %35

35:                                               ; preds = %34
  %36 = load i32, ptr %5, align 4, !tbaa !9
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %5, align 4, !tbaa !9
  br label %15, !llvm.loop !11

38:                                               ; preds = %18
  store ptr %4, ptr %3, align 8, !tbaa !5
  %39 = call noundef i32 @_Z15Tposix_memalignPPvmm(ptr noundef %3, i64 noundef 40, i64 noundef 100)
  store i32 %39, ptr %4, align 4, !tbaa !9
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  %41 = icmp eq ptr %40, %4
  br i1 %41, label %42, label %43

42:                                               ; preds = %38
  br label %44

43:                                               ; preds = %38
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 1048, ptr noundef @.str.82, ptr noundef @.str.83)
  br label %44

44:                                               ; preds = %43, %42
  %45 = load i32, ptr %4, align 4, !tbaa !9
  %46 = icmp eq i32 22, %45
  br i1 %46, label %47, label %48

47:                                               ; preds = %44
  br label %49

48:                                               ; preds = %44
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 1049, ptr noundef @.str.81, ptr noundef null)
  br label %49

49:                                               ; preds = %48, %47
  %50 = call noundef i32 @_Z15Tposix_memalignPPvmm(ptr noundef null, i64 noundef 2, i64 noundef 100)
  store i32 %50, ptr %4, align 4, !tbaa !9
  %51 = load i32, ptr %4, align 4, !tbaa !9
  %52 = icmp eq i32 22, %51
  br i1 %52, label %53, label %54

53:                                               ; preds = %49
  br label %55

54:                                               ; preds = %49
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 1054, ptr noundef @.str.81, ptr noundef null)
  br label %55

55:                                               ; preds = %54, %53
  br label %56

56:                                               ; preds = %55, %1
  %57 = load ptr, ptr @Raligned_malloc, align 8, !tbaa !5
  %58 = icmp ne ptr %57, null
  br i1 %58, label %59, label %108

59:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 3, ptr %6, align 4, !tbaa !9
  br label %60

60:                                               ; preds = %89, %59
  %61 = load i32, ptr %6, align 4, !tbaa !9
  %62 = icmp slt i32 %61, 16
  br i1 %62, label %64, label %63

63:                                               ; preds = %60
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  br label %92

64:                                               ; preds = %60
  %65 = load i32, ptr %6, align 4, !tbaa !9
  %66 = load i32, ptr %6, align 4, !tbaa !9
  %67 = sub nsw i32 %66, 1
  %68 = and i32 %65, %67
  %69 = icmp ne i32 %68, 0
  br i1 %69, label %70, label %88

70:                                               ; preds = %64
  %71 = load i32, ptr %6, align 4, !tbaa !9
  %72 = sext i32 %71 to i64
  %73 = call noundef ptr @_Z15Taligned_mallocmm(i64 noundef 100, i64 noundef %72)
  store ptr %73, ptr %3, align 8, !tbaa !5
  %74 = load ptr, ptr %3, align 8, !tbaa !5
  %75 = icmp eq ptr null, %74
  br i1 %75, label %76, label %77

76:                                               ; preds = %70
  br label %78

77:                                               ; preds = %70
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 1061, ptr noundef @.str.84, ptr noundef null)
  br label %78

78:                                               ; preds = %77, %76
  %79 = load i8, ptr @__tbb_test_errno, align 1, !tbaa !13, !range !15, !noundef !16
  %80 = trunc i8 %79 to i1
  br i1 %80, label %81, label %85

81:                                               ; preds = %78
  %82 = call ptr @__errno_location() #4
  %83 = load i32, ptr %82, align 4, !tbaa !9
  %84 = icmp eq i32 22, %83
  br i1 %84, label %85, label %86

85:                                               ; preds = %81, %78
  br label %87

86:                                               ; preds = %81
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 1062, ptr noundef @.str.85, ptr noundef null)
  br label %87

87:                                               ; preds = %86, %85
  br label %88

88:                                               ; preds = %87, %64
  br label %89

89:                                               ; preds = %88
  %90 = load i32, ptr %6, align 4, !tbaa !9
  %91 = add nsw i32 %90, 1
  store i32 %91, ptr %6, align 4, !tbaa !9
  br label %60, !llvm.loop !17

92:                                               ; preds = %63
  %93 = call noundef ptr @_Z15Taligned_mallocmm(i64 noundef 0, i64 noundef 16)
  store ptr %93, ptr %3, align 8, !tbaa !5
  %94 = load ptr, ptr %3, align 8, !tbaa !5
  %95 = icmp eq ptr null, %94
  br i1 %95, label %96, label %97

96:                                               ; preds = %92
  br label %98

97:                                               ; preds = %92
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 1067, ptr noundef @.str.84, ptr noundef @.str.86)
  br label %98

98:                                               ; preds = %97, %96
  %99 = load i8, ptr @__tbb_test_errno, align 1, !tbaa !13, !range !15, !noundef !16
  %100 = trunc i8 %99 to i1
  br i1 %100, label %101, label %105

101:                                              ; preds = %98
  %102 = call ptr @__errno_location() #4
  %103 = load i32, ptr %102, align 4, !tbaa !9
  %104 = icmp eq i32 22, %103
  br i1 %104, label %105, label %106

105:                                              ; preds = %101, %98
  br label %107

106:                                              ; preds = %101
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 1068, ptr noundef @.str.85, ptr noundef null)
  br label %107

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

108:                                              ; preds = %107, %56
  %109 = load ptr, ptr @Taligned_free, align 8, !tbaa !5
  %110 = icmp ne ptr %109, null
  br i1 %110, label %111, label %123

111:                                              ; preds = %108
  %112 = call ptr @__errno_location() #4
  store i32 0, ptr %112, align 4, !tbaa !9
  %113 = load ptr, ptr @Taligned_free, align 8, !tbaa !5
  call void %113(ptr noundef null)
  %114 = load i8, ptr @__tbb_test_errno, align 1, !tbaa !13, !range !15, !noundef !16
  %115 = trunc i8 %114 to i1
  br i1 %115, label %116, label %120

116:                                              ; preds = %111
  %117 = call ptr @__errno_location() #4
  %118 = load i32, ptr %117, align 4, !tbaa !9
  %119 = icmp eq i32 0, %118
  br i1 %119, label %120, label %121

120:                                              ; preds = %116, %111
  br label %122

121:                                              ; preds = %116
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 1077, ptr noundef @.str.87, ptr noundef null)
  br label %122

122:                                              ; preds = %121, %120
  br label %123

123:                                              ; preds = %122, %108
  %124 = load ptr, ptr @Raligned_realloc, align 8, !tbaa !5
  %125 = icmp ne ptr %124, null
  br i1 %125, label %126, label %210

126:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 1, ptr %7, align 4, !tbaa !9
  br label %127

127:                                              ; preds = %168, %126
  %128 = load i32, ptr %7, align 4, !tbaa !9
  %129 = icmp slt i32 %128, 20
  br i1 %129, label %131, label %130

130:                                              ; preds = %127
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  br label %171

131:                                              ; preds = %127
  %132 = load i32, ptr %7, align 4, !tbaa !9
  %133 = call ptr @__errno_location() #4
  store i32 %132, ptr %133, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %134 = load i32, ptr %7, align 4, !tbaa !9
  %135 = mul nsw i32 %134, 10
  %136 = sext i32 %135 to i64
  %137 = call noundef ptr @_Z15Taligned_mallocmm(i64 noundef %136, i64 noundef 128)
  store ptr %137, ptr %8, align 8, !tbaa !5
  %138 = load ptr, ptr %8, align 8, !tbaa !5
  %139 = icmp ne ptr null, %138
  br i1 %139, label %140, label %141

140:                                              ; preds = %131
  br label %142

141:                                              ; preds = %131
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 1084, ptr noundef @.str.88, ptr noundef null)
  br label %142

142:                                              ; preds = %141, %140
  %143 = load i8, ptr @__tbb_test_errno, align 1, !tbaa !13, !range !15, !noundef !16
  %144 = trunc i8 %143 to i1
  br i1 %144, label %145, label %149

145:                                              ; preds = %142
  %146 = call ptr @__errno_location() #4
  %147 = load i32, ptr %146, align 4, !tbaa !9
  %148 = icmp ne i32 0, %147
  br i1 %148, label %149, label %150

149:                                              ; preds = %145, %142
  br label %151

150:                                              ; preds = %145
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 1085, ptr noundef @.str.89, ptr noundef null)
  br label %151

151:                                              ; preds = %150, %149
  %152 = load ptr, ptr %8, align 8, !tbaa !5
  %153 = call noundef ptr @_Z16Taligned_reallocPvmm(ptr noundef %152, i64 noundef 0, i64 noundef 64)
  store ptr %153, ptr %3, align 8, !tbaa !5
  %154 = load ptr, ptr %3, align 8, !tbaa !5
  %155 = icmp eq ptr null, %154
  br i1 %155, label %156, label %157

156:                                              ; preds = %151
  br label %158

157:                                              ; preds = %151
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 1088, ptr noundef @.str.84, ptr noundef null)
  br label %158

158:                                              ; preds = %157, %156
  %159 = load i8, ptr @__tbb_test_errno, align 1, !tbaa !13, !range !15, !noundef !16
  %160 = trunc i8 %159 to i1
  br i1 %160, label %161, label %165

161:                                              ; preds = %158
  %162 = call ptr @__errno_location() #4
  %163 = load i32, ptr %162, align 4, !tbaa !9
  %164 = icmp ne i32 0, %163
  br i1 %164, label %165, label %166

165:                                              ; preds = %161, %158
  br label %167

166:                                              ; preds = %161
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 1089, ptr noundef @.str.89, ptr noundef null)
  br label %167

167:                                              ; preds = %166, %165
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %168

168:                                              ; preds = %167
  %169 = load i32, ptr %7, align 4, !tbaa !9
  %170 = add nsw i32 %169, 1
  store i32 %170, ptr %7, align 4, !tbaa !9
  br label %127, !llvm.loop !18

171:                                              ; preds = %130
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 3, ptr %9, align 4, !tbaa !9
  br label %172

172:                                              ; preds = %206, %171
  %173 = load i32, ptr %9, align 4, !tbaa !9
  %174 = icmp slt i32 %173, 16
  br i1 %174, label %176, label %175

175:                                              ; preds = %172
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  br label %209

176:                                              ; preds = %172
  %177 = load i32, ptr %9, align 4, !tbaa !9
  %178 = load i32, ptr %9, align 4, !tbaa !9
  %179 = sub nsw i32 %178, 1
  %180 = and i32 %177, %179
  %181 = icmp ne i32 %180, 0
  br i1 %181, label %182, label %205

182:                                              ; preds = %176
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  store ptr %9, ptr %10, align 8, !tbaa !5
  %183 = load i32, ptr %9, align 4, !tbaa !9
  %184 = sext i32 %183 to i64
  %185 = call noundef ptr @_Z16Taligned_reallocPvmm(ptr noundef %10, i64 noundef 100, i64 noundef %184)
  store ptr %185, ptr %3, align 8, !tbaa !5
  %186 = load ptr, ptr %3, align 8, !tbaa !5
  %187 = icmp eq ptr null, %186
  br i1 %187, label %188, label %189

188:                                              ; preds = %182
  br label %190

189:                                              ; preds = %182
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 1096, ptr noundef @.str.84, ptr noundef null)
  br label %190

190:                                              ; preds = %189, %188
  %191 = load ptr, ptr %10, align 8, !tbaa !5
  %192 = icmp eq ptr %9, %191
  br i1 %192, label %193, label %194

193:                                              ; preds = %190
  br label %195

194:                                              ; preds = %190
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 1097, ptr noundef @.str.90, ptr noundef null)
  br label %195

195:                                              ; preds = %194, %193
  %196 = load i8, ptr @__tbb_test_errno, align 1, !tbaa !13, !range !15, !noundef !16
  %197 = trunc i8 %196 to i1
  br i1 %197, label %198, label %202

198:                                              ; preds = %195
  %199 = call ptr @__errno_location() #4
  %200 = load i32, ptr %199, align 4, !tbaa !9
  %201 = icmp eq i32 22, %200
  br i1 %201, label %202, label %203

202:                                              ; preds = %198, %195
  br label %204

203:                                              ; preds = %198
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 1098, ptr noundef @.str.85, ptr noundef null)
  br label %204

204:                                              ; preds = %203, %202
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  br label %205

205:                                              ; preds = %204, %176
  br label %206

206:                                              ; preds = %205
  %207 = load i32, ptr %9, align 4, !tbaa !9
  %208 = add nsw i32 %207, 1
  store i32 %208, ptr %9, align 4, !tbaa !9
  br label %172, !llvm.loop !19

209:                                              ; preds = %175
  br label %210

210:                                              ; preds = %209, %123
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind willreturn memory(none) "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 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 = { nounwind }
attributes #4 = { nounwind willreturn memory(none) }

!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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}


; 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"

@__tbb_test_errno = external dso_local local_unnamed_addr global i8, align 1
@.str = external hidden unnamed_addr constant [98 x i8], align 1
@Rposix_memalign = external dso_local local_unnamed_addr global ptr, align 8
@Raligned_malloc = external dso_local local_unnamed_addr global ptr, align 8
@Raligned_realloc = external dso_local local_unnamed_addr global ptr, align 8
@Taligned_free = external dso_local local_unnamed_addr global ptr, align 8
@.str.81 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.82 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.83 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.84 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.85 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.86 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.87 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.88 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.89 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.90 = external hidden unnamed_addr constant [16 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 nofree nosync nounwind willreturn memory(none)
declare ptr @__errno_location() local_unnamed_addr #1

; 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 #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z16Taligned_reallocPvmm(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z15Tposix_memalignPPvmm(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z15Taligned_mallocmm(i64 noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8CMemTest21TestAlignedParametersEv(ptr nocapture noundef nonnull readnone align 8 dereferenceable(16) %0) local_unnamed_addr #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %6 = load ptr, ptr @Rposix_memalign, align 8, !tbaa !5
  %.not = icmp eq ptr %6, null
  br i1 %.not, label %27, label %.preheader29

7:                                                ; preds = %17
  store ptr %3, ptr %2, align 8, !tbaa !5
  %8 = call noundef i32 @_Z15Tposix_memalignPPvmm(ptr noundef nonnull %2, i64 noundef 40, i64 noundef 100)
  store i32 %8, ptr %3, align 4, !tbaa !9
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = icmp eq ptr %9, %3
  br i1 %10, label %19, label %18

.preheader29:                                     ; preds = %1, %17
  %indvars.iv = phi i64 [ %indvars.iv.next, %17 ], [ 3, %1 ]
  %11 = trunc nuw nsw i64 %indvars.iv to i32
  %12 = tail call range(i32 0, 5) i32 @llvm.ctpop.i32(i32 %11)
  %.not27 = icmp ult i32 %12, 2
  br i1 %.not27, label %17, label %13

13:                                               ; preds = %.preheader29
  %14 = tail call noundef i32 @_Z15Tposix_memalignPPvmm(ptr noundef null, i64 noundef %indvars.iv, i64 noundef 100)
  store i32 %14, ptr %3, align 4, !tbaa !9
  %15 = icmp eq i32 %14, 22
  br i1 %15, label %17, label %16

16:                                               ; preds = %13
  tail call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 1042, ptr noundef nonnull @.str.81, ptr noundef null)
  br label %17

17:                                               ; preds = %.preheader29, %13, %16
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 16
  br i1 %exitcond.not, label %7, label %.preheader29, !llvm.loop !11

18:                                               ; preds = %7
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 1048, ptr noundef nonnull @.str.82, ptr noundef nonnull @.str.83)
  %.pr = load i32, ptr %3, align 4, !tbaa !9
  br label %19

19:                                               ; preds = %7, %18
  %20 = phi i32 [ %8, %7 ], [ %.pr, %18 ]
  %21 = icmp eq i32 %20, 22
  br i1 %21, label %23, label %22

22:                                               ; preds = %19
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 1049, ptr noundef nonnull @.str.81, ptr noundef null)
  br label %23

23:                                               ; preds = %19, %22
  %24 = call noundef i32 @_Z15Tposix_memalignPPvmm(ptr noundef null, i64 noundef 2, i64 noundef 100)
  store i32 %24, ptr %3, align 4, !tbaa !9
  %25 = icmp eq i32 %24, 22
  br i1 %25, label %27, label %26

26:                                               ; preds = %23
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 1054, ptr noundef nonnull @.str.81, ptr noundef null)
  br label %27

27:                                               ; preds = %26, %23, %1
  %28 = load ptr, ptr @Raligned_malloc, align 8, !tbaa !5
  %.not19 = icmp eq ptr %28, null
  br i1 %.not19, label %56, label %.preheader28

29:                                               ; preds = %46
  %30 = call noundef ptr @_Z15Taligned_mallocmm(i64 noundef 0, i64 noundef 16)
  store ptr %30, ptr %2, align 8, !tbaa !5
  %31 = icmp eq ptr %30, null
  br i1 %31, label %48, label %47

.preheader28:                                     ; preds = %27, %46
  %indvars.iv35 = phi i64 [ %indvars.iv.next36, %46 ], [ 3, %27 ]
  %32 = trunc nuw nsw i64 %indvars.iv35 to i32
  %33 = call range(i32 0, 5) i32 @llvm.ctpop.i32(i32 %32)
  %.not26 = icmp ult i32 %33, 2
  br i1 %.not26, label %46, label %34

34:                                               ; preds = %.preheader28
  %35 = call noundef ptr @_Z15Taligned_mallocmm(i64 noundef 100, i64 noundef %indvars.iv35)
  store ptr %35, ptr %2, align 8, !tbaa !5
  %36 = icmp eq ptr %35, null
  br i1 %36, label %38, label %37

37:                                               ; preds = %34
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 1061, ptr noundef nonnull @.str.84, ptr noundef null)
  br label %38

38:                                               ; preds = %34, %37
  %39 = load i8, ptr @__tbb_test_errno, align 1, !tbaa !13, !range !15, !noundef !16
  %40 = trunc nuw i8 %39 to i1
  br i1 %40, label %41, label %46

41:                                               ; preds = %38
  %42 = tail call ptr @__errno_location() #5
  %43 = load i32, ptr %42, align 4, !tbaa !9
  %44 = icmp eq i32 %43, 22
  br i1 %44, label %46, label %45

45:                                               ; preds = %41
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 1062, ptr noundef nonnull @.str.85, ptr noundef null)
  br label %46

46:                                               ; preds = %.preheader28, %38, %41, %45
  %indvars.iv.next36 = add nuw nsw i64 %indvars.iv35, 1
  %exitcond38.not = icmp eq i64 %indvars.iv.next36, 16
  br i1 %exitcond38.not, label %29, label %.preheader28, !llvm.loop !17

47:                                               ; preds = %29
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 1067, ptr noundef nonnull @.str.84, ptr noundef nonnull @.str.86)
  br label %48

48:                                               ; preds = %29, %47
  %49 = load i8, ptr @__tbb_test_errno, align 1, !tbaa !13, !range !15, !noundef !16
  %50 = trunc nuw i8 %49 to i1
  br i1 %50, label %51, label %56

51:                                               ; preds = %48
  %52 = tail call ptr @__errno_location() #5
  %53 = load i32, ptr %52, align 4, !tbaa !9
  %54 = icmp eq i32 %53, 22
  br i1 %54, label %56, label %55

55:                                               ; preds = %51
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 1068, ptr noundef nonnull @.str.85, ptr noundef null)
  br label %56

56:                                               ; preds = %55, %51, %48, %27
  %57 = load ptr, ptr @Taligned_free, align 8, !tbaa !5
  %.not20 = icmp eq ptr %57, null
  br i1 %.not20, label %66, label %58

58:                                               ; preds = %56
  %59 = tail call ptr @__errno_location() #5
  store i32 0, ptr %59, align 4, !tbaa !9
  call void %57(ptr noundef null)
  %60 = load i8, ptr @__tbb_test_errno, align 1, !tbaa !13, !range !15, !noundef !16
  %61 = trunc nuw i8 %60 to i1
  br i1 %61, label %62, label %66

62:                                               ; preds = %58
  %63 = load i32, ptr %59, align 4, !tbaa !9
  %64 = icmp eq i32 %63, 0
  br i1 %64, label %66, label %65

65:                                               ; preds = %62
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 1077, ptr noundef nonnull @.str.87, ptr noundef null)
  br label %66

66:                                               ; preds = %65, %62, %58, %56
  %67 = load ptr, ptr @Raligned_realloc, align 8, !tbaa !5
  %.not21 = icmp eq ptr %67, null
  br i1 %.not21, label %116, label %.preheader

.preheader:                                       ; preds = %66
  %68 = tail call ptr @__errno_location() #5
  br label %70

69:                                               ; preds = %91
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  store i32 3, ptr %4, align 4, !tbaa !9
  br label %93

70:                                               ; preds = %.preheader, %91
  %indvars.iv39 = phi i64 [ 1, %.preheader ], [ %indvars.iv.next40, %91 ]
  %71 = trunc nuw nsw i64 %indvars.iv39 to i32
  store i32 %71, ptr %68, align 4, !tbaa !9
  %72 = mul nuw nsw i64 %indvars.iv39, 10
  %73 = call noundef ptr @_Z15Taligned_mallocmm(i64 noundef %72, i64 noundef 128)
  %.not23 = icmp eq ptr %73, null
  br i1 %.not23, label %74, label %75

74:                                               ; preds = %70
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 1084, ptr noundef nonnull @.str.88, ptr noundef null)
  br label %75

75:                                               ; preds = %70, %74
  %76 = load i8, ptr @__tbb_test_errno, align 1, !tbaa !13, !range !15, !noundef !16
  %77 = trunc nuw i8 %76 to i1
  br i1 %77, label %78, label %81

78:                                               ; preds = %75
  %79 = load i32, ptr %68, align 4, !tbaa !9
  %.not24 = icmp eq i32 %79, 0
  br i1 %.not24, label %80, label %81

80:                                               ; preds = %78
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 1085, ptr noundef nonnull @.str.89, ptr noundef null)
  br label %81

81:                                               ; preds = %75, %78, %80
  %82 = call noundef ptr @_Z16Taligned_reallocPvmm(ptr noundef %73, i64 noundef 0, i64 noundef 64)
  store ptr %82, ptr %2, align 8, !tbaa !5
  %83 = icmp eq ptr %82, null
  br i1 %83, label %85, label %84

84:                                               ; preds = %81
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 1088, ptr noundef nonnull @.str.84, ptr noundef null)
  br label %85

85:                                               ; preds = %81, %84
  %86 = load i8, ptr @__tbb_test_errno, align 1, !tbaa !13, !range !15, !noundef !16
  %87 = trunc nuw i8 %86 to i1
  br i1 %87, label %88, label %91

88:                                               ; preds = %85
  %89 = load i32, ptr %68, align 4, !tbaa !9
  %.not25 = icmp eq i32 %89, 0
  br i1 %.not25, label %90, label %91

90:                                               ; preds = %88
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 1089, ptr noundef nonnull @.str.89, ptr noundef null)
  br label %91

91:                                               ; preds = %85, %88, %90
  %indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
  %exitcond42.not = icmp eq i64 %indvars.iv.next40, 20
  br i1 %exitcond42.not, label %69, label %70, !llvm.loop !18

92:                                               ; preds = %112
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  br label %116

93:                                               ; preds = %69, %112
  %storemerge33 = phi i32 [ 3, %69 ], [ %114, %112 ]
  %94 = call range(i32 0, 33) i32 @llvm.ctpop.i32(i32 %storemerge33)
  %.not22 = icmp ult i32 %94, 2
  br i1 %.not22, label %112, label %95

95:                                               ; preds = %93
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  store ptr %4, ptr %5, align 8, !tbaa !5
  %96 = sext i32 %storemerge33 to i64
  %97 = call noundef ptr @_Z16Taligned_reallocPvmm(ptr noundef nonnull %5, i64 noundef 100, i64 noundef %96)
  store ptr %97, ptr %2, align 8, !tbaa !5
  %98 = icmp eq ptr %97, null
  br i1 %98, label %100, label %99

99:                                               ; preds = %95
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 1096, ptr noundef nonnull @.str.84, ptr noundef null)
  br label %100

100:                                              ; preds = %95, %99
  %101 = load ptr, ptr %5, align 8, !tbaa !5
  %102 = icmp eq ptr %4, %101
  br i1 %102, label %104, label %103

103:                                              ; preds = %100
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 1097, ptr noundef nonnull @.str.90, ptr noundef null)
  br label %104

104:                                              ; preds = %100, %103
  %105 = load i8, ptr @__tbb_test_errno, align 1, !tbaa !13, !range !15, !noundef !16
  %106 = trunc nuw i8 %105 to i1
  br i1 %106, label %107, label %111

107:                                              ; preds = %104
  %108 = load i32, ptr %68, align 4, !tbaa !9
  %109 = icmp eq i32 %108, 22
  br i1 %109, label %111, label %110

110:                                              ; preds = %107
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 1098, ptr noundef nonnull @.str.85, ptr noundef null)
  br label %111

111:                                              ; preds = %104, %107, %110
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  %.pre = load i32, ptr %4, align 4, !tbaa !9
  br label %112

112:                                              ; preds = %93, %111
  %113 = phi i32 [ %storemerge33, %93 ], [ %.pre, %111 ]
  %114 = add nsw i32 %113, 1
  store i32 %114, ptr %4, align 4, !tbaa !9
  %115 = icmp slt i32 %113, 15
  br i1 %115, label %93, label %92, !llvm.loop !19

116:                                              ; preds = %92, %66
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.ctpop.i32(i32) #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nofree nosync nounwind willreturn memory(none) "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 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(none) }

!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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass