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

; 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
@__const._Z22CheckArgumentsOverflowv.params = external hidden unnamed_addr constant [2 x i64], align 16
@.str.23 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [10 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 @_Z8TreallocPvm(ptr noundef, i64 noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z22CheckArgumentsOverflowv() #2 {
  %1 = alloca ptr, align 8
  %2 = alloca [2 x i64], align 16
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr %2) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %2, ptr align 16 @__const._Z22CheckArgumentsOverflowv.params, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %8

8:                                                ; preds = %91, %0
  %9 = load i32, ptr %3, align 4, !tbaa !5
  %10 = zext i32 %9 to i64
  %11 = call noundef i64 @_ZN7Harness12array_lengthImLm2EEEmRAT0__KT_(ptr noundef nonnull align 8 dereferenceable(16) %2)
  %12 = icmp ult i64 %10, %11
  br i1 %12, label %14, label %13

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

14:                                               ; preds = %8
  %15 = load i32, ptr %3, align 4, !tbaa !5
  %16 = zext i32 %15 to i64
  %17 = getelementptr inbounds [2 x i64], ptr %2, i64 0, i64 %16
  %18 = load i64, ptr %17, align 8, !tbaa !9
  %19 = call noundef ptr @_Z7Tmallocm(i64 noundef %18)
  store ptr %19, ptr %1, align 8, !tbaa !11
  %20 = load ptr, ptr %1, align 8, !tbaa !11
  %21 = icmp ne ptr %20, null
  br i1 %21, label %23, label %22

22:                                               ; preds = %14
  br label %24

23:                                               ; preds = %14
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 310, ptr noundef @.str.23, ptr noundef null)
  br label %24

24:                                               ; preds = %23, %22
  %25 = load i8, ptr @__tbb_test_errno, align 1, !tbaa !13, !range !15, !noundef !16
  %26 = trunc i8 %25 to i1
  br i1 %26, label %27, label %31

27:                                               ; preds = %24
  %28 = call ptr @__errno_location() #6
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = icmp eq i32 %29, 12
  br i1 %30, label %31, label %32

31:                                               ; preds = %27, %24
  br label %33

32:                                               ; preds = %27
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 311, ptr noundef @.str.24, ptr noundef null)
  br label %33

33:                                               ; preds = %32, %31
  %34 = load i32, ptr %3, align 4, !tbaa !5
  %35 = zext i32 %34 to i64
  %36 = getelementptr inbounds [2 x i64], ptr %2, i64 0, i64 %35
  %37 = load i64, ptr %36, align 8, !tbaa !9
  %38 = call noundef ptr @_Z8TreallocPvm(ptr noundef null, i64 noundef %37)
  store ptr %38, ptr %1, align 8, !tbaa !11
  %39 = load ptr, ptr %1, align 8, !tbaa !11
  %40 = icmp ne ptr %39, null
  br i1 %40, label %42, label %41

41:                                               ; preds = %33
  br label %43

42:                                               ; preds = %33
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 313, ptr noundef @.str.23, ptr noundef null)
  br label %43

43:                                               ; preds = %42, %41
  %44 = load i8, ptr @__tbb_test_errno, align 1, !tbaa !13, !range !15, !noundef !16
  %45 = trunc i8 %44 to i1
  br i1 %45, label %46, label %50

46:                                               ; preds = %43
  %47 = call ptr @__errno_location() #6
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = icmp eq i32 %48, 12
  br i1 %49, label %50, label %51

50:                                               ; preds = %46, %43
  br label %52

51:                                               ; preds = %46
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 314, ptr noundef @.str.24, ptr noundef null)
  br label %52

52:                                               ; preds = %51, %50
  %53 = load i32, ptr %3, align 4, !tbaa !5
  %54 = zext i32 %53 to i64
  %55 = getelementptr inbounds [2 x i64], ptr %2, i64 0, i64 %54
  %56 = load i64, ptr %55, align 8, !tbaa !9
  %57 = call noundef ptr @_Z7Tcallocmm(i64 noundef 1, i64 noundef %56)
  store ptr %57, ptr %1, align 8, !tbaa !11
  %58 = load ptr, ptr %1, align 8, !tbaa !11
  %59 = icmp ne ptr %58, null
  br i1 %59, label %61, label %60

60:                                               ; preds = %52
  br label %62

61:                                               ; preds = %52
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 316, ptr noundef @.str.23, ptr noundef null)
  br label %62

62:                                               ; preds = %61, %60
  %63 = load i8, ptr @__tbb_test_errno, align 1, !tbaa !13, !range !15, !noundef !16
  %64 = trunc i8 %63 to i1
  br i1 %64, label %65, label %69

65:                                               ; preds = %62
  %66 = call ptr @__errno_location() #6
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = icmp eq i32 %67, 12
  br i1 %68, label %69, label %70

69:                                               ; preds = %65, %62
  br label %71

70:                                               ; preds = %65
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 317, ptr noundef @.str.24, ptr noundef null)
  br label %71

71:                                               ; preds = %70, %69
  %72 = load i32, ptr %3, align 4, !tbaa !5
  %73 = zext i32 %72 to i64
  %74 = getelementptr inbounds [2 x i64], ptr %2, i64 0, i64 %73
  %75 = load i64, ptr %74, align 8, !tbaa !9
  %76 = call noundef ptr @_Z7Tcallocmm(i64 noundef %75, i64 noundef 1)
  store ptr %76, ptr %1, align 8, !tbaa !11
  %77 = load ptr, ptr %1, align 8, !tbaa !11
  %78 = icmp ne ptr %77, null
  br i1 %78, label %80, label %79

79:                                               ; preds = %71
  br label %81

80:                                               ; preds = %71
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 319, ptr noundef @.str.23, ptr noundef null)
  br label %81

81:                                               ; preds = %80, %79
  %82 = load i8, ptr @__tbb_test_errno, align 1, !tbaa !13, !range !15, !noundef !16
  %83 = trunc i8 %82 to i1
  br i1 %83, label %84, label %88

84:                                               ; preds = %81
  %85 = call ptr @__errno_location() #6
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = icmp eq i32 %86, 12
  br i1 %87, label %88, label %89

88:                                               ; preds = %84, %81
  br label %90

89:                                               ; preds = %84
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 320, ptr noundef @.str.24, ptr noundef null)
  br label %90

90:                                               ; preds = %89, %88
  br label %91

91:                                               ; preds = %90
  %92 = load i32, ptr %3, align 4, !tbaa !5
  %93 = add i32 %92, 1
  store i32 %93, ptr %3, align 4, !tbaa !5
  br label %8, !llvm.loop !17

94:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  store i64 -9223372036854775808, ptr %4, align 8, !tbaa !9
  %95 = load ptr, ptr @Rposix_memalign, align 8, !tbaa !11
  %96 = icmp ne ptr %95, null
  br i1 %96, label %97, label %138

97:                                               ; preds = %94
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %98 = load ptr, ptr @Rposix_memalign, align 8, !tbaa !11
  %99 = call noundef i32 %98(ptr noundef %1, i64 noundef -9223372036854775808, i64 noundef 9223372036854775807)
  store i32 %99, ptr %5, align 4, !tbaa !5
  %100 = load i32, ptr %5, align 4, !tbaa !5
  %101 = icmp eq i32 %100, 12
  br i1 %101, label %102, label %103

102:                                              ; preds = %97
  br label %104

103:                                              ; preds = %97
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 325, ptr noundef @.str.25, ptr noundef null)
  br label %104

104:                                              ; preds = %103, %102
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %105

105:                                              ; preds = %134, %104
  %106 = load i32, ptr %6, align 4, !tbaa !5
  %107 = zext i32 %106 to i64
  %108 = call noundef i64 @_ZN7Harness12array_lengthImLm2EEEmRAT0__KT_(ptr noundef nonnull align 8 dereferenceable(16) %2)
  %109 = icmp ult i64 %107, %108
  br i1 %109, label %111, label %110

110:                                              ; preds = %105
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %137

111:                                              ; preds = %105
  %112 = load ptr, ptr @Rposix_memalign, align 8, !tbaa !11
  %113 = load i32, ptr %6, align 4, !tbaa !5
  %114 = zext i32 %113 to i64
  %115 = getelementptr inbounds [2 x i64], ptr %2, i64 0, i64 %114
  %116 = load i64, ptr %115, align 8, !tbaa !9
  %117 = call noundef i32 %112(ptr noundef %1, i64 noundef -9223372036854775808, i64 noundef %116)
  store i32 %117, ptr %5, align 4, !tbaa !5
  %118 = load i32, ptr %5, align 4, !tbaa !5
  %119 = icmp eq i32 %118, 12
  br i1 %119, label %120, label %121

120:                                              ; preds = %111
  br label %122

121:                                              ; preds = %111
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 328, ptr noundef @.str.25, ptr noundef null)
  br label %122

122:                                              ; preds = %121, %120
  %123 = load ptr, ptr @Rposix_memalign, align 8, !tbaa !11
  %124 = load i32, ptr %6, align 4, !tbaa !5
  %125 = zext i32 %124 to i64
  %126 = getelementptr inbounds [2 x i64], ptr %2, i64 0, i64 %125
  %127 = load i64, ptr %126, align 8, !tbaa !9
  %128 = call noundef i32 %123(ptr noundef %1, i64 noundef 8, i64 noundef %127)
  store i32 %128, ptr %5, align 4, !tbaa !5
  %129 = load i32, ptr %5, align 4, !tbaa !5
  %130 = icmp eq i32 %129, 12
  br i1 %130, label %131, label %132

131:                                              ; preds = %122
  br label %133

132:                                              ; preds = %122
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 330, ptr noundef @.str.25, ptr noundef null)
  br label %133

133:                                              ; preds = %132, %131
  br label %134

134:                                              ; preds = %133
  %135 = load i32, ptr %6, align 4, !tbaa !5
  %136 = add i32 %135, 1
  store i32 %136, ptr %6, align 4, !tbaa !5
  br label %105, !llvm.loop !19

137:                                              ; preds = %110
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %138

138:                                              ; preds = %137, %94
  %139 = load ptr, ptr @Raligned_malloc, align 8, !tbaa !11
  %140 = icmp ne ptr %139, null
  br i1 %140, label %141, label %200

141:                                              ; preds = %138
  %142 = load ptr, ptr @Raligned_malloc, align 8, !tbaa !11
  %143 = call noundef ptr %142(i64 noundef 9223372036854775807, i64 noundef -9223372036854775808)
  store ptr %143, ptr %1, align 8, !tbaa !11
  %144 = load ptr, ptr %1, align 8, !tbaa !11
  %145 = icmp ne ptr %144, null
  br i1 %145, label %147, label %146

146:                                              ; preds = %141
  br label %148

147:                                              ; preds = %141
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 335, ptr noundef @.str.23, ptr noundef null)
  br label %148

148:                                              ; preds = %147, %146
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %149

149:                                              ; preds = %196, %148
  %150 = load i32, ptr %7, align 4, !tbaa !5
  %151 = zext i32 %150 to i64
  %152 = call noundef i64 @_ZN7Harness12array_lengthImLm2EEEmRAT0__KT_(ptr noundef nonnull align 8 dereferenceable(16) %2)
  %153 = icmp ult i64 %151, %152
  br i1 %153, label %155, label %154

154:                                              ; preds = %149
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %199

155:                                              ; preds = %149
  %156 = load ptr, ptr @Raligned_malloc, align 8, !tbaa !11
  %157 = load i32, ptr %7, align 4, !tbaa !5
  %158 = zext i32 %157 to i64
  %159 = getelementptr inbounds [2 x i64], ptr %2, i64 0, i64 %158
  %160 = load i64, ptr %159, align 8, !tbaa !9
  %161 = call noundef ptr %156(i64 noundef %160, i64 noundef -9223372036854775808)
  store ptr %161, ptr %1, align 8, !tbaa !11
  %162 = load ptr, ptr %1, align 8, !tbaa !11
  %163 = icmp ne ptr %162, null
  br i1 %163, label %165, label %164

164:                                              ; preds = %155
  br label %166

165:                                              ; preds = %155
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 338, ptr noundef @.str.23, ptr noundef null)
  br label %166

166:                                              ; preds = %165, %164
  %167 = load i8, ptr @__tbb_test_errno, align 1, !tbaa !13, !range !15, !noundef !16
  %168 = trunc i8 %167 to i1
  br i1 %168, label %169, label %173

169:                                              ; preds = %166
  %170 = call ptr @__errno_location() #6
  %171 = load i32, ptr %170, align 4, !tbaa !5
  %172 = icmp eq i32 %171, 12
  br i1 %172, label %173, label %174

173:                                              ; preds = %169, %166
  br label %175

174:                                              ; preds = %169
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 339, ptr noundef @.str.24, ptr noundef null)
  br label %175

175:                                              ; preds = %174, %173
  %176 = load ptr, ptr @Raligned_malloc, align 8, !tbaa !11
  %177 = load i32, ptr %7, align 4, !tbaa !5
  %178 = zext i32 %177 to i64
  %179 = getelementptr inbounds [2 x i64], ptr %2, i64 0, i64 %178
  %180 = load i64, ptr %179, align 8, !tbaa !9
  %181 = call noundef ptr %176(i64 noundef %180, i64 noundef 8)
  store ptr %181, ptr %1, align 8, !tbaa !11
  %182 = load ptr, ptr %1, align 8, !tbaa !11
  %183 = icmp ne ptr %182, null
  br i1 %183, label %185, label %184

184:                                              ; preds = %175
  br label %186

185:                                              ; preds = %175
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 341, ptr noundef @.str.23, ptr noundef null)
  br label %186

186:                                              ; preds = %185, %184
  %187 = load i8, ptr @__tbb_test_errno, align 1, !tbaa !13, !range !15, !noundef !16
  %188 = trunc i8 %187 to i1
  br i1 %188, label %189, label %193

189:                                              ; preds = %186
  %190 = call ptr @__errno_location() #6
  %191 = load i32, ptr %190, align 4, !tbaa !5
  %192 = icmp eq i32 %191, 12
  br i1 %192, label %193, label %194

193:                                              ; preds = %189, %186
  br label %195

194:                                              ; preds = %189
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 342, ptr noundef @.str.24, ptr noundef null)
  br label %195

195:                                              ; preds = %194, %193
  br label %196

196:                                              ; preds = %195
  %197 = load i32, ptr %7, align 4, !tbaa !5
  %198 = add i32 %197, 1
  store i32 %198, ptr %7, align 4, !tbaa !5
  br label %149, !llvm.loop !20

199:                                              ; preds = %154
  br label %200

200:                                              ; preds = %199, %138
  %201 = call noundef ptr @_Z7Tcallocmm(i64 noundef 9223372036854775791, i64 noundef 9223372036854775791)
  store ptr %201, ptr %1, align 8, !tbaa !11
  %202 = load ptr, ptr %1, align 8, !tbaa !11
  %203 = icmp ne ptr %202, null
  br i1 %203, label %205, label %204

204:                                              ; preds = %200
  br label %206

205:                                              ; preds = %200
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 347, ptr noundef @.str.23, ptr noundef null)
  br label %206

206:                                              ; preds = %205, %204
  %207 = load i8, ptr @__tbb_test_errno, align 1, !tbaa !13, !range !15, !noundef !16
  %208 = trunc i8 %207 to i1
  br i1 %208, label %209, label %213

209:                                              ; preds = %206
  %210 = call ptr @__errno_location() #6
  %211 = load i32, ptr %210, align 4, !tbaa !5
  %212 = icmp eq i32 %211, 12
  br i1 %212, label %213, label %214

213:                                              ; preds = %209, %206
  br label %215

214:                                              ; preds = %209
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 348, ptr noundef @.str.24, ptr noundef null)
  br label %215

215:                                              ; preds = %214, %213
  %216 = call noundef ptr @_Z7Tcallocmm(i64 noundef 9223372036854775807, i64 noundef 9223372036854775807)
  store ptr %216, ptr %1, align 8, !tbaa !11
  %217 = load ptr, ptr %1, align 8, !tbaa !11
  %218 = icmp ne ptr %217, null
  br i1 %218, label %220, label %219

219:                                              ; preds = %215
  br label %221

220:                                              ; preds = %215
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 350, ptr noundef @.str.23, ptr noundef null)
  br label %221

221:                                              ; preds = %220, %219
  %222 = load i8, ptr @__tbb_test_errno, align 1, !tbaa !13, !range !15, !noundef !16
  %223 = trunc i8 %222 to i1
  br i1 %223, label %224, label %228

224:                                              ; preds = %221
  %225 = call ptr @__errno_location() #6
  %226 = load i32, ptr %225, align 4, !tbaa !5
  %227 = icmp eq i32 %226, 12
  br i1 %227, label %228, label %229

228:                                              ; preds = %224, %221
  br label %230

229:                                              ; preds = %224
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef @.str, i32 noundef 351, ptr noundef @.str.24, ptr noundef null)
  br label %230

230:                                              ; preds = %229, %228
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #5
  ret void
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN7Harness12array_lengthImLm2EEEmRAT0__KT_(ptr noundef nonnull align 8 dereferenceable(16)) #4

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

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

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { inlinehint 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 #5 = { nounwind }
attributes #6 = { 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 = !{!"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 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = distinct !{!20, !18}


; 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
@__const._Z22CheckArgumentsOverflowv.params = external hidden unnamed_addr constant [2 x i64], align 16
@.str.23 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [10 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 @_Z8TreallocPvm(ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z22CheckArgumentsOverflowv() local_unnamed_addr #2 {
  %1 = alloca ptr, align 8
  %2 = alloca [2 x i64], align 16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %2, ptr noundef nonnull align 16 dereferenceable(16) @__const._Z22CheckArgumentsOverflowv.params, i64 16, i1 false)
  %3 = call noundef i64 @_ZN7Harness12array_lengthImLm2EEEmRAT0__KT_(ptr noundef nonnull align 8 dereferenceable(16) %2)
  %.not42 = icmp eq i64 %3, 0
  br i1 %.not42, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %54, %0
  %4 = load ptr, ptr @Rposix_memalign, align 8, !tbaa !5
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %.loopexit34, label %59

.lr.ph:                                           ; preds = %0, %54
  %5 = phi i64 [ %56, %54 ], [ 0, %0 ]
  %.01835 = phi i32 [ %55, %54 ], [ 0, %0 ]
  %6 = getelementptr inbounds [2 x i64], ptr %2, i64 0, i64 %5
  %7 = load i64, ptr %6, align 8, !tbaa !9
  %8 = call noundef ptr @_Z7Tmallocm(i64 noundef %7)
  store ptr %8, ptr %1, align 8, !tbaa !5
  %.not30 = icmp eq ptr %8, null
  br i1 %.not30, label %10, label %9

9:                                                ; preds = %.lr.ph
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 310, ptr noundef nonnull @.str.23, ptr noundef null)
  br label %10

10:                                               ; preds = %.lr.ph, %9
  %11 = load i8, ptr @__tbb_test_errno, align 1, !tbaa !11, !range !13, !noundef !14
  %12 = trunc nuw i8 %11 to i1
  br i1 %12, label %13, label %18

13:                                               ; preds = %10
  %14 = tail call ptr @__errno_location() #6
  %15 = load i32, ptr %14, align 4, !tbaa !15
  %16 = icmp eq i32 %15, 12
  br i1 %16, label %18, label %17

17:                                               ; preds = %13
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 311, ptr noundef nonnull @.str.24, ptr noundef null)
  br label %18

18:                                               ; preds = %10, %13, %17
  %19 = load i64, ptr %6, align 8, !tbaa !9
  %20 = call noundef ptr @_Z8TreallocPvm(ptr noundef null, i64 noundef %19)
  %.not31 = icmp eq ptr %20, null
  br i1 %.not31, label %22, label %21

21:                                               ; preds = %18
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 313, ptr noundef nonnull @.str.23, ptr noundef null)
  br label %22

22:                                               ; preds = %18, %21
  %23 = load i8, ptr @__tbb_test_errno, align 1, !tbaa !11, !range !13, !noundef !14
  %24 = trunc nuw i8 %23 to i1
  br i1 %24, label %25, label %30

25:                                               ; preds = %22
  %26 = tail call ptr @__errno_location() #6
  %27 = load i32, ptr %26, align 4, !tbaa !15
  %28 = icmp eq i32 %27, 12
  br i1 %28, label %30, label %29

29:                                               ; preds = %25
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 314, ptr noundef nonnull @.str.24, ptr noundef null)
  br label %30

30:                                               ; preds = %22, %25, %29
  %31 = load i64, ptr %6, align 8, !tbaa !9
  %32 = call noundef ptr @_Z7Tcallocmm(i64 noundef 1, i64 noundef %31)
  %.not32 = icmp eq ptr %32, null
  br i1 %.not32, label %34, label %33

33:                                               ; preds = %30
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 316, ptr noundef nonnull @.str.23, ptr noundef null)
  br label %34

34:                                               ; preds = %30, %33
  %35 = load i8, ptr @__tbb_test_errno, align 1, !tbaa !11, !range !13, !noundef !14
  %36 = trunc nuw i8 %35 to i1
  br i1 %36, label %37, label %42

37:                                               ; preds = %34
  %38 = tail call ptr @__errno_location() #6
  %39 = load i32, ptr %38, align 4, !tbaa !15
  %40 = icmp eq i32 %39, 12
  br i1 %40, label %42, label %41

41:                                               ; preds = %37
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 317, ptr noundef nonnull @.str.24, ptr noundef null)
  br label %42

42:                                               ; preds = %34, %37, %41
  %43 = load i64, ptr %6, align 8, !tbaa !9
  %44 = call noundef ptr @_Z7Tcallocmm(i64 noundef %43, i64 noundef 1)
  store ptr %44, ptr %1, align 8, !tbaa !5
  %.not33 = icmp eq ptr %44, null
  br i1 %.not33, label %46, label %45

45:                                               ; preds = %42
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 319, ptr noundef nonnull @.str.23, ptr noundef null)
  br label %46

46:                                               ; preds = %42, %45
  %47 = load i8, ptr @__tbb_test_errno, align 1, !tbaa !11, !range !13, !noundef !14
  %48 = trunc nuw i8 %47 to i1
  br i1 %48, label %49, label %54

49:                                               ; preds = %46
  %50 = tail call ptr @__errno_location() #6
  %51 = load i32, ptr %50, align 4, !tbaa !15
  %52 = icmp eq i32 %51, 12
  br i1 %52, label %54, label %53

53:                                               ; preds = %49
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 320, ptr noundef nonnull @.str.24, ptr noundef null)
  br label %54

54:                                               ; preds = %53, %49, %46
  %55 = add i32 %.01835, 1
  %56 = zext i32 %55 to i64
  %57 = call noundef i64 @_ZN7Harness12array_lengthImLm2EEEmRAT0__KT_(ptr noundef nonnull align 8 dereferenceable(16) %2)
  %58 = icmp ugt i64 %57, %56
  br i1 %58, label %.lr.ph, label %._crit_edge, !llvm.loop !17

59:                                               ; preds = %._crit_edge
  %60 = call noundef i32 %4(ptr noundef nonnull %1, i64 noundef -9223372036854775808, i64 noundef 9223372036854775807)
  %61 = icmp eq i32 %60, 12
  br i1 %61, label %63, label %62

62:                                               ; preds = %59
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 325, ptr noundef nonnull @.str.25, ptr noundef null)
  br label %63

63:                                               ; preds = %59, %62
  %64 = call noundef i64 @_ZN7Harness12array_lengthImLm2EEEmRAT0__KT_(ptr noundef nonnull align 8 dereferenceable(16) %2)
  %.not43 = icmp eq i64 %64, 0
  br i1 %.not43, label %.loopexit34, label %.lr.ph38

.lr.ph38:                                         ; preds = %63, %78
  %65 = phi i64 [ %80, %78 ], [ 0, %63 ]
  %.01736 = phi i32 [ %79, %78 ], [ 0, %63 ]
  %66 = load ptr, ptr @Rposix_memalign, align 8, !tbaa !5
  %67 = getelementptr inbounds [2 x i64], ptr %2, i64 0, i64 %65
  %68 = load i64, ptr %67, align 8, !tbaa !9
  %69 = call noundef i32 %66(ptr noundef nonnull %1, i64 noundef -9223372036854775808, i64 noundef %68)
  %70 = icmp eq i32 %69, 12
  br i1 %70, label %72, label %71

71:                                               ; preds = %.lr.ph38
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 328, ptr noundef nonnull @.str.25, ptr noundef null)
  br label %72

72:                                               ; preds = %.lr.ph38, %71
  %73 = load ptr, ptr @Rposix_memalign, align 8, !tbaa !5
  %74 = load i64, ptr %67, align 8, !tbaa !9
  %75 = call noundef i32 %73(ptr noundef nonnull %1, i64 noundef 8, i64 noundef %74)
  %76 = icmp eq i32 %75, 12
  br i1 %76, label %78, label %77

77:                                               ; preds = %72
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 330, ptr noundef nonnull @.str.25, ptr noundef null)
  br label %78

78:                                               ; preds = %77, %72
  %79 = add i32 %.01736, 1
  %80 = zext i32 %79 to i64
  %81 = call noundef i64 @_ZN7Harness12array_lengthImLm2EEEmRAT0__KT_(ptr noundef nonnull align 8 dereferenceable(16) %2)
  %82 = icmp ugt i64 %81, %80
  br i1 %82, label %.lr.ph38, label %.loopexit34, !llvm.loop !19

.loopexit34:                                      ; preds = %78, %63, %._crit_edge
  %83 = load ptr, ptr @Raligned_malloc, align 8, !tbaa !5
  %.not24 = icmp eq ptr %83, null
  br i1 %.not24, label %.loopexit, label %84

84:                                               ; preds = %.loopexit34
  %85 = call noundef ptr %83(i64 noundef 9223372036854775807, i64 noundef -9223372036854775808)
  store ptr %85, ptr %1, align 8, !tbaa !5
  %.not25 = icmp eq ptr %85, null
  br i1 %.not25, label %87, label %86

86:                                               ; preds = %84
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 335, ptr noundef nonnull @.str.23, ptr noundef null)
  br label %87

87:                                               ; preds = %84, %86
  %88 = call noundef i64 @_ZN7Harness12array_lengthImLm2EEEmRAT0__KT_(ptr noundef nonnull align 8 dereferenceable(16) %2)
  %.not44 = icmp eq i64 %88, 0
  br i1 %.not44, label %.loopexit, label %.lr.ph41

.lr.ph41:                                         ; preds = %87, %116
  %89 = phi i64 [ %118, %116 ], [ 0, %87 ]
  %.039 = phi i32 [ %117, %116 ], [ 0, %87 ]
  %90 = load ptr, ptr @Raligned_malloc, align 8, !tbaa !5
  %91 = getelementptr inbounds [2 x i64], ptr %2, i64 0, i64 %89
  %92 = load i64, ptr %91, align 8, !tbaa !9
  %93 = call noundef ptr %90(i64 noundef %92, i64 noundef -9223372036854775808)
  store ptr %93, ptr %1, align 8, !tbaa !5
  %.not28 = icmp eq ptr %93, null
  br i1 %.not28, label %95, label %94

94:                                               ; preds = %.lr.ph41
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 338, ptr noundef nonnull @.str.23, ptr noundef null)
  br label %95

95:                                               ; preds = %.lr.ph41, %94
  %96 = load i8, ptr @__tbb_test_errno, align 1, !tbaa !11, !range !13, !noundef !14
  %97 = trunc nuw i8 %96 to i1
  br i1 %97, label %98, label %103

98:                                               ; preds = %95
  %99 = tail call ptr @__errno_location() #6
  %100 = load i32, ptr %99, align 4, !tbaa !15
  %101 = icmp eq i32 %100, 12
  br i1 %101, label %103, label %102

102:                                              ; preds = %98
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 339, ptr noundef nonnull @.str.24, ptr noundef null)
  br label %103

103:                                              ; preds = %95, %98, %102
  %104 = load ptr, ptr @Raligned_malloc, align 8, !tbaa !5
  %105 = load i64, ptr %91, align 8, !tbaa !9
  %106 = call noundef ptr %104(i64 noundef %105, i64 noundef 8)
  store ptr %106, ptr %1, align 8, !tbaa !5
  %.not29 = icmp eq ptr %106, null
  br i1 %.not29, label %108, label %107

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

108:                                              ; preds = %103, %107
  %109 = load i8, ptr @__tbb_test_errno, align 1, !tbaa !11, !range !13, !noundef !14
  %110 = trunc nuw i8 %109 to i1
  br i1 %110, label %111, label %116

111:                                              ; preds = %108
  %112 = tail call ptr @__errno_location() #6
  %113 = load i32, ptr %112, align 4, !tbaa !15
  %114 = icmp eq i32 %113, 12
  br i1 %114, label %116, label %115

115:                                              ; preds = %111
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 342, ptr noundef nonnull @.str.24, ptr noundef null)
  br label %116

116:                                              ; preds = %115, %111, %108
  %117 = add i32 %.039, 1
  %118 = zext i32 %117 to i64
  %119 = call noundef i64 @_ZN7Harness12array_lengthImLm2EEEmRAT0__KT_(ptr noundef nonnull align 8 dereferenceable(16) %2)
  %120 = icmp ugt i64 %119, %118
  br i1 %120, label %.lr.ph41, label %.loopexit, !llvm.loop !20

.loopexit:                                        ; preds = %116, %87, %.loopexit34
  %121 = call noundef ptr @_Z7Tcallocmm(i64 noundef 9223372036854775791, i64 noundef 9223372036854775791)
  store ptr %121, ptr %1, align 8, !tbaa !5
  %.not26 = icmp eq ptr %121, null
  br i1 %.not26, label %123, label %122

122:                                              ; preds = %.loopexit
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 347, ptr noundef nonnull @.str.23, ptr noundef null)
  br label %123

123:                                              ; preds = %.loopexit, %122
  %124 = load i8, ptr @__tbb_test_errno, align 1, !tbaa !11, !range !13, !noundef !14
  %125 = trunc nuw i8 %124 to i1
  br i1 %125, label %126, label %131

126:                                              ; preds = %123
  %127 = tail call ptr @__errno_location() #6
  %128 = load i32, ptr %127, align 4, !tbaa !15
  %129 = icmp eq i32 %128, 12
  br i1 %129, label %131, label %130

130:                                              ; preds = %126
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 348, ptr noundef nonnull @.str.24, ptr noundef null)
  br label %131

131:                                              ; preds = %123, %126, %130
  %132 = call noundef ptr @_Z7Tcallocmm(i64 noundef 9223372036854775807, i64 noundef 9223372036854775807)
  store ptr %132, ptr %1, align 8, !tbaa !5
  %.not27 = icmp eq ptr %132, null
  br i1 %.not27, label %134, label %133

133:                                              ; preds = %131
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 350, ptr noundef nonnull @.str.23, ptr noundef null)
  br label %134

134:                                              ; preds = %131, %133
  %135 = load i8, ptr @__tbb_test_errno, align 1, !tbaa !11, !range !13, !noundef !14
  %136 = trunc nuw i8 %135 to i1
  br i1 %136, label %137, label %142

137:                                              ; preds = %134
  %138 = tail call ptr @__errno_location() #6
  %139 = load i32, ptr %138, align 4, !tbaa !15
  %140 = icmp eq i32 %139, 12
  br i1 %140, label %142, label %141

141:                                              ; preds = %137
  call void @_Z11ReportErrorPKciS0_S0_(ptr noundef nonnull @.str, i32 noundef 351, ptr noundef nonnull @.str.24, ptr noundef null)
  br label %142

142:                                              ; preds = %134, %137, %141
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  ret void
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN7Harness12array_lengthImLm2EEEmRAT0__KT_(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4

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

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

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { inlinehint 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 #5 = { nounwind }
attributes #6 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !16, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = distinct !{!20, !18}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass