; LLVM IR from stan-dev/math :: lib/sundials_6.1.1/benchmarks/nvector (test_nvector_performance)

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

@print_time = external dso_local global i32, align 4
@nextra = external dso_local global i32, align 4
@.str.38 = external hidden unnamed_addr constant [70 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [27 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 allocsize(0)
declare noalias ptr @malloc(i64 noundef) #1

declare ptr @N_VClone(ptr noundef) #2

declare void @N_VRand(ptr noundef, i64 noundef, double noundef, double noundef) #2

declare void @ClearCache(...) #2

declare void @sync_device(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @time_stats(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #3

declare i32 @printf(ptr noundef, ...) #2

; Function Attrs: nounwind
declare void @free(ptr noundef) #4

declare void @N_VDestroy(ptr noundef) #2

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

declare void @N_VRandZeroOne(ptr noundef, i64 noundef) #2

declare double @N_VWrmsNormMask(ptr noundef, ptr noundef, ptr noundef) #2

declare ptr @N_VCloneVectorArray(i32 noundef, ptr noundef) #2

declare void @N_VDestroyVectorArray(ptr noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @Test_N_VWrmsNormMaskVectorArray(ptr noundef %0, i64 noundef %1, i32 noundef %2, i32 noundef %3) #3 {
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  %18 = alloca double, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca ptr, align 8
  %25 = alloca ptr, align 8
  %26 = alloca ptr, align 8
  %27 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !11
  store i32 %3, ptr %8, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #5
  %28 = load i32, ptr %8, align 4, !tbaa !11
  %29 = load i32, ptr @nextra, align 4, !tbaa !11
  %30 = add nsw i32 %28, %29
  %31 = sext i32 %30 to i64
  %32 = mul i64 %31, 8
  %33 = call noalias ptr @malloc(i64 noundef %32) #6
  store ptr %33, ptr %19, align 8, !tbaa !5
  %34 = load i32, ptr %8, align 4, !tbaa !11
  %35 = load i32, ptr @nextra, align 4, !tbaa !11
  %36 = add nsw i32 %34, %35
  %37 = sext i32 %36 to i64
  %38 = mul i64 %37, 8
  %39 = call noalias ptr @malloc(i64 noundef %38) #6
  store ptr %39, ptr %20, align 8, !tbaa !5
  %40 = load i32, ptr %7, align 4, !tbaa !11
  %41 = sext i32 %40 to i64
  %42 = mul i64 %41, 8
  %43 = call noalias ptr @malloc(i64 noundef %42) #6
  store ptr %43, ptr %24, align 8, !tbaa !5
  %44 = load i32, ptr %7, align 4, !tbaa !11
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = call ptr @N_VCloneVectorArray(i32 noundef %44, ptr noundef %45)
  store ptr %46, ptr %25, align 8, !tbaa !5
  %47 = load i32, ptr %7, align 4, !tbaa !11
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = call ptr @N_VCloneVectorArray(i32 noundef %47, ptr noundef %48)
  store ptr %49, ptr %26, align 8, !tbaa !5
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = call ptr @N_VClone(ptr noundef %50)
  store ptr %51, ptr %27, align 8, !tbaa !5
  %52 = load ptr, ptr %27, align 8, !tbaa !5
  %53 = load i64, ptr %6, align 8, !tbaa !9
  call void @N_VRandZeroOne(ptr noundef %52, i64 noundef %53)
  store i32 0, ptr %22, align 4, !tbaa !11
  br label %54

54:                                               ; preds = %71, %4
  %55 = load i32, ptr %22, align 4, !tbaa !11
  %56 = load i32, ptr %7, align 4, !tbaa !11
  %57 = icmp slt i32 %55, %56
  br i1 %57, label %58, label %74

58:                                               ; preds = %54
  %59 = load ptr, ptr %25, align 8, !tbaa !5
  %60 = load i32, ptr %22, align 4, !tbaa !11
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds ptr, ptr %59, i64 %61
  %63 = load ptr, ptr %62, align 8, !tbaa !5
  %64 = load i64, ptr %6, align 8, !tbaa !9
  call void @N_VRand(ptr noundef %63, i64 noundef %64, double noundef -1.000000e+00, double noundef 1.000000e+00)
  %65 = load ptr, ptr %26, align 8, !tbaa !5
  %66 = load i32, ptr %22, align 4, !tbaa !11
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds ptr, ptr %65, i64 %67
  %69 = load ptr, ptr %68, align 8, !tbaa !5
  %70 = load i64, ptr %6, align 8, !tbaa !9
  call void @N_VRand(ptr noundef %69, i64 noundef %70, double noundef 1.000000e+00, double noundef 2.000000e+00)
  br label %71

71:                                               ; preds = %58
  %72 = load i32, ptr %22, align 4, !tbaa !11
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %22, align 4, !tbaa !11
  br label %54, !llvm.loop !13

74:                                               ; preds = %54
  store i32 0, ptr %21, align 4, !tbaa !11
  br label %75

75:                                               ; preds = %117, %74
  %76 = load i32, ptr %21, align 4, !tbaa !11
  %77 = load i32, ptr %8, align 4, !tbaa !11
  %78 = load i32, ptr @nextra, align 4, !tbaa !11
  %79 = add nsw i32 %77, %78
  %80 = icmp slt i32 %76, %79
  br i1 %80, label %81, label %120

81:                                               ; preds = %75
  call void (...) @ClearCache()
  %82 = call double @get_time()
  store double %82, ptr %9, align 8, !tbaa !15
  store i32 0, ptr %22, align 4, !tbaa !11
  br label %83

83:                                               ; preds = %104, %81
  %84 = load i32, ptr %22, align 4, !tbaa !11
  %85 = load i32, ptr %7, align 4, !tbaa !11
  %86 = icmp slt i32 %84, %85
  br i1 %86, label %87, label %107

87:                                               ; preds = %83
  %88 = load ptr, ptr %25, align 8, !tbaa !5
  %89 = load i32, ptr %22, align 4, !tbaa !11
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds ptr, ptr %88, i64 %90
  %92 = load ptr, ptr %91, align 8, !tbaa !5
  %93 = load ptr, ptr %26, align 8, !tbaa !5
  %94 = load i32, ptr %22, align 4, !tbaa !11
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds ptr, ptr %93, i64 %95
  %97 = load ptr, ptr %96, align 8, !tbaa !5
  %98 = load ptr, ptr %27, align 8, !tbaa !5
  %99 = call double @N_VWrmsNormMask(ptr noundef %92, ptr noundef %97, ptr noundef %98)
  %100 = load ptr, ptr %24, align 8, !tbaa !5
  %101 = load i32, ptr %22, align 4, !tbaa !11
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds double, ptr %100, i64 %102
  store double %99, ptr %103, align 8, !tbaa !15
  br label %104

104:                                              ; preds = %87
  %105 = load i32, ptr %22, align 4, !tbaa !11
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr %22, align 4, !tbaa !11
  br label %83, !llvm.loop !17

107:                                              ; preds = %83
  %108 = load ptr, ptr %5, align 8, !tbaa !5
  call void @sync_device(ptr noundef %108)
  %109 = call double @get_time()
  store double %109, ptr %10, align 8, !tbaa !15
  %110 = load double, ptr %10, align 8, !tbaa !15
  %111 = load double, ptr %9, align 8, !tbaa !15
  %112 = fsub double %110, %111
  %113 = load ptr, ptr %20, align 8, !tbaa !5
  %114 = load i32, ptr %21, align 4, !tbaa !11
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds double, ptr %113, i64 %115
  store double %112, ptr %116, align 8, !tbaa !15
  br label %117

117:                                              ; preds = %107
  %118 = load i32, ptr %21, align 4, !tbaa !11
  %119 = add nsw i32 %118, 1
  store i32 %119, ptr %21, align 4, !tbaa !11
  br label %75, !llvm.loop !18

120:                                              ; preds = %75
  %121 = load ptr, ptr %27, align 8, !tbaa !5
  %122 = load i64, ptr %6, align 8, !tbaa !9
  call void @N_VRandZeroOne(ptr noundef %121, i64 noundef %122)
  store i32 0, ptr %22, align 4, !tbaa !11
  br label %123

123:                                              ; preds = %140, %120
  %124 = load i32, ptr %22, align 4, !tbaa !11
  %125 = load i32, ptr %7, align 4, !tbaa !11
  %126 = icmp slt i32 %124, %125
  br i1 %126, label %127, label %143

127:                                              ; preds = %123
  %128 = load ptr, ptr %25, align 8, !tbaa !5
  %129 = load i32, ptr %22, align 4, !tbaa !11
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds ptr, ptr %128, i64 %130
  %132 = load ptr, ptr %131, align 8, !tbaa !5
  %133 = load i64, ptr %6, align 8, !tbaa !9
  call void @N_VRand(ptr noundef %132, i64 noundef %133, double noundef -1.000000e+00, double noundef 1.000000e+00)
  %134 = load ptr, ptr %26, align 8, !tbaa !5
  %135 = load i32, ptr %22, align 4, !tbaa !11
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds ptr, ptr %134, i64 %136
  %138 = load ptr, ptr %137, align 8, !tbaa !5
  %139 = load i64, ptr %6, align 8, !tbaa !9
  call void @N_VRand(ptr noundef %138, i64 noundef %139, double noundef 1.000000e+00, double noundef 2.000000e+00)
  br label %140

140:                                              ; preds = %127
  %141 = load i32, ptr %22, align 4, !tbaa !11
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %22, align 4, !tbaa !11
  br label %123, !llvm.loop !19

143:                                              ; preds = %123
  store i32 0, ptr %21, align 4, !tbaa !11
  br label %144

144:                                              ; preds = %167, %143
  %145 = load i32, ptr %21, align 4, !tbaa !11
  %146 = load i32, ptr %8, align 4, !tbaa !11
  %147 = load i32, ptr @nextra, align 4, !tbaa !11
  %148 = add nsw i32 %146, %147
  %149 = icmp slt i32 %145, %148
  br i1 %149, label %150, label %170

150:                                              ; preds = %144
  call void (...) @ClearCache()
  %151 = call double @get_time()
  store double %151, ptr %9, align 8, !tbaa !15
  %152 = load i32, ptr %7, align 4, !tbaa !11
  %153 = load ptr, ptr %25, align 8, !tbaa !5
  %154 = load ptr, ptr %26, align 8, !tbaa !5
  %155 = load ptr, ptr %27, align 8, !tbaa !5
  %156 = load ptr, ptr %24, align 8, !tbaa !5
  %157 = call i32 @N_VWrmsNormMaskVectorArray(i32 noundef %152, ptr noundef %153, ptr noundef %154, ptr noundef %155, ptr noundef %156)
  store i32 %157, ptr %23, align 4, !tbaa !11
  %158 = load ptr, ptr %5, align 8, !tbaa !5
  call void @sync_device(ptr noundef %158)
  %159 = call double @get_time()
  store double %159, ptr %10, align 8, !tbaa !15
  %160 = load double, ptr %10, align 8, !tbaa !15
  %161 = load double, ptr %9, align 8, !tbaa !15
  %162 = fsub double %160, %161
  %163 = load ptr, ptr %19, align 8, !tbaa !5
  %164 = load i32, ptr %21, align 4, !tbaa !11
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds double, ptr %163, i64 %165
  store double %162, ptr %166, align 8, !tbaa !15
  br label %167

167:                                              ; preds = %150
  %168 = load i32, ptr %21, align 4, !tbaa !11
  %169 = add nsw i32 %168, 1
  store i32 %169, ptr %21, align 4, !tbaa !11
  br label %144, !llvm.loop !20

170:                                              ; preds = %144
  %171 = load ptr, ptr %5, align 8, !tbaa !5
  %172 = load ptr, ptr %19, align 8, !tbaa !5
  %173 = load i32, ptr @nextra, align 4, !tbaa !11
  %174 = load i32, ptr %8, align 4, !tbaa !11
  call void @time_stats(ptr noundef %171, ptr noundef %172, i32 noundef %173, i32 noundef %174, ptr noundef %11, ptr noundef %12, ptr noundef %13, ptr noundef %14)
  %175 = load ptr, ptr %5, align 8, !tbaa !5
  %176 = load ptr, ptr %20, align 8, !tbaa !5
  %177 = load i32, ptr @nextra, align 4, !tbaa !11
  %178 = load i32, ptr %8, align 4, !tbaa !11
  call void @time_stats(ptr noundef %175, ptr noundef %176, i32 noundef %177, i32 noundef %178, ptr noundef %15, ptr noundef %16, ptr noundef %17, ptr noundef %18)
  %179 = load i32, ptr @print_time, align 4, !tbaa !11
  %180 = icmp ne i32 %179, 0
  br i1 %180, label %181, label %191

181:                                              ; preds = %170
  %182 = load double, ptr %11, align 8, !tbaa !15
  %183 = load double, ptr %12, align 8, !tbaa !15
  %184 = load double, ptr %13, align 8, !tbaa !15
  %185 = load double, ptr %14, align 8, !tbaa !15
  %186 = load double, ptr %15, align 8, !tbaa !15
  %187 = load double, ptr %16, align 8, !tbaa !15
  %188 = load double, ptr %17, align 8, !tbaa !15
  %189 = load double, ptr %18, align 8, !tbaa !15
  %190 = call i32 (ptr, ...) @printf(ptr noundef @.str.38, ptr noundef @.str.50, double noundef %182, double noundef %183, double noundef %184, double noundef %185, double noundef %186, double noundef %187, double noundef %188, double noundef %189)
  br label %191

191:                                              ; preds = %181, %170
  %192 = load ptr, ptr %19, align 8, !tbaa !5
  call void @free(ptr noundef %192) #5
  %193 = load ptr, ptr %20, align 8, !tbaa !5
  call void @free(ptr noundef %193) #5
  %194 = load ptr, ptr %24, align 8, !tbaa !5
  call void @free(ptr noundef %194) #5
  %195 = load ptr, ptr %25, align 8, !tbaa !5
  %196 = load i32, ptr %7, align 4, !tbaa !11
  call void @N_VDestroyVectorArray(ptr noundef %195, i32 noundef %196)
  %197 = load ptr, ptr %26, align 8, !tbaa !5
  %198 = load i32, ptr %7, align 4, !tbaa !11
  call void @N_VDestroyVectorArray(ptr noundef %197, i32 noundef %198)
  %199 = load ptr, ptr %27, align 8, !tbaa !5
  call void @N_VDestroy(ptr noundef %199)
  %200 = load i32, ptr %23, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  ret i32 %200
}

declare i32 @N_VWrmsNormMaskVectorArray(i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden double @get_time() #3

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

!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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !16, i64 0}
!16 = !{!"double", !7, i64 0}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}
!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"

@print_time = external dso_local local_unnamed_addr global i32, align 4
@nextra = external dso_local local_unnamed_addr global i32, align 4
@.str.38 = external hidden unnamed_addr constant [70 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [27 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 nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #1

declare ptr @N_VClone(ptr noundef) local_unnamed_addr #2

declare void @N_VRand(ptr noundef, i64 noundef, double noundef, double noundef) local_unnamed_addr #2

declare void @ClearCache(...) local_unnamed_addr #2

declare void @sync_device(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden void @time_stats(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5

declare void @N_VDestroy(ptr noundef) local_unnamed_addr #2

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

declare void @N_VRandZeroOne(ptr noundef, i64 noundef) local_unnamed_addr #2

declare double @N_VWrmsNormMask(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare ptr @N_VCloneVectorArray(i32 noundef, ptr noundef) local_unnamed_addr #2

declare void @N_VDestroyVectorArray(ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local i32 @Test_N_VWrmsNormMaskVectorArray(ptr noundef %0, i64 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #3 {
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #6
  %13 = load i32, ptr @nextra, align 4, !tbaa !5
  %14 = add nsw i32 %13, %3
  %15 = sext i32 %14 to i64
  %16 = shl nsw i64 %15, 3
  %17 = tail call noalias ptr @malloc(i64 noundef %16) #7
  %18 = tail call noalias ptr @malloc(i64 noundef %16) #7
  %19 = sext i32 %2 to i64
  %20 = shl nsw i64 %19, 3
  %21 = tail call noalias ptr @malloc(i64 noundef %20) #7
  %22 = tail call ptr @N_VCloneVectorArray(i32 noundef %2, ptr noundef %0) #6
  %23 = tail call ptr @N_VCloneVectorArray(i32 noundef %2, ptr noundef %0) #6
  %24 = tail call ptr @N_VClone(ptr noundef %0) #6
  tail call void @N_VRandZeroOne(ptr noundef %24, i64 noundef %1) #6
  %25 = icmp sgt i32 %2, 0
  br i1 %25, label %.lr.ph.preheader, label %.preheader79.thread

.lr.ph.preheader:                                 ; preds = %4
  %wide.trip.count = zext nneg i32 %2 to i64
  br label %.lr.ph

.preheader79:                                     ; preds = %.lr.ph
  %26 = load i32, ptr @nextra, align 4, !tbaa !5
  %27 = add nsw i32 %26, %3
  %28 = icmp sgt i32 %27, 0
  br i1 %28, label %.lr.ph84, label %._crit_edge85

.preheader79.thread:                              ; preds = %4
  %29 = load i32, ptr @nextra, align 4, !tbaa !5
  %30 = add nsw i32 %29, %3
  %31 = icmp sgt i32 %30, 0
  br i1 %31, label %.lr.ph84.split.preheader, label %._crit_edge85.thread

._crit_edge85.thread:                             ; preds = %.preheader79.thread
  tail call void @N_VRandZeroOne(ptr noundef %24, i64 noundef %1) #6
  br label %.preheader

.lr.ph84:                                         ; preds = %.preheader79
  br i1 %25, label %.lr.ph82.us.preheader, label %.lr.ph84.split.preheader

.lr.ph84.split.preheader:                         ; preds = %.preheader79.thread, %.lr.ph84
  br label %.lr.ph84.split

.lr.ph82.us.preheader:                            ; preds = %.lr.ph84
  %wide.trip.count101 = zext nneg i32 %2 to i64
  br label %.lr.ph82.us

.lr.ph82.us:                                      ; preds = %.lr.ph82.us.preheader, %._crit_edge.us
  %indvars.iv103 = phi i64 [ 0, %.lr.ph82.us.preheader ], [ %indvars.iv.next104, %._crit_edge.us ]
  tail call void (...) @ClearCache() #6
  %32 = tail call double @get_time()
  br label %33

33:                                               ; preds = %.lr.ph82.us, %33
  %indvars.iv98 = phi i64 [ 0, %.lr.ph82.us ], [ %indvars.iv.next99, %33 ]
  %34 = getelementptr inbounds ptr, ptr %22, i64 %indvars.iv98
  %35 = load ptr, ptr %34, align 8, !tbaa !9
  %36 = getelementptr inbounds ptr, ptr %23, i64 %indvars.iv98
  %37 = load ptr, ptr %36, align 8, !tbaa !9
  %38 = tail call double @N_VWrmsNormMask(ptr noundef %35, ptr noundef %37, ptr noundef %24) #6
  %39 = getelementptr inbounds double, ptr %21, i64 %indvars.iv98
  store double %38, ptr %39, align 8, !tbaa !11
  %indvars.iv.next99 = add nuw nsw i64 %indvars.iv98, 1
  %exitcond102.not = icmp eq i64 %indvars.iv.next99, %wide.trip.count101
  br i1 %exitcond102.not, label %._crit_edge.us, label %33, !llvm.loop !13

._crit_edge.us:                                   ; preds = %33
  tail call void @sync_device(ptr noundef %0) #6
  %40 = tail call double @get_time()
  %41 = fsub double %40, %32
  %42 = getelementptr inbounds double, ptr %18, i64 %indvars.iv103
  store double %41, ptr %42, align 8, !tbaa !11
  %indvars.iv.next104 = add nuw nsw i64 %indvars.iv103, 1
  %43 = load i32, ptr @nextra, align 4, !tbaa !5
  %44 = add nsw i32 %43, %3
  %45 = sext i32 %44 to i64
  %46 = icmp slt i64 %indvars.iv.next104, %45
  br i1 %46, label %.lr.ph82.us, label %._crit_edge85, !llvm.loop !15

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %47 = getelementptr inbounds ptr, ptr %22, i64 %indvars.iv
  %48 = load ptr, ptr %47, align 8, !tbaa !9
  tail call void @N_VRand(ptr noundef %48, i64 noundef %1, double noundef -1.000000e+00, double noundef 1.000000e+00) #6
  %49 = getelementptr inbounds ptr, ptr %23, i64 %indvars.iv
  %50 = load ptr, ptr %49, align 8, !tbaa !9
  tail call void @N_VRand(ptr noundef %50, i64 noundef %1, double noundef 1.000000e+00, double noundef 2.000000e+00) #6
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.preheader79, label %.lr.ph, !llvm.loop !16

.lr.ph84.split:                                   ; preds = %.lr.ph84.split.preheader, %.lr.ph84.split
  %indvars.iv95 = phi i64 [ %indvars.iv.next96, %.lr.ph84.split ], [ 0, %.lr.ph84.split.preheader ]
  tail call void (...) @ClearCache() #6
  %51 = tail call double @get_time()
  tail call void @sync_device(ptr noundef %0) #6
  %52 = tail call double @get_time()
  %53 = fsub double %52, %51
  %54 = getelementptr inbounds double, ptr %18, i64 %indvars.iv95
  store double %53, ptr %54, align 8, !tbaa !11
  %indvars.iv.next96 = add nuw nsw i64 %indvars.iv95, 1
  %55 = load i32, ptr @nextra, align 4, !tbaa !5
  %56 = add nsw i32 %55, %3
  %57 = sext i32 %56 to i64
  %58 = icmp slt i64 %indvars.iv.next96, %57
  br i1 %58, label %.lr.ph84.split, label %._crit_edge85, !llvm.loop !15

._crit_edge85:                                    ; preds = %.lr.ph84.split, %._crit_edge.us, %.preheader79
  tail call void @N_VRandZeroOne(ptr noundef %24, i64 noundef %1) #6
  br i1 %25, label %.lr.ph87.preheader, label %.preheader

.lr.ph87.preheader:                               ; preds = %._crit_edge85
  %wide.trip.count109 = zext nneg i32 %2 to i64
  br label %.lr.ph87

.preheader:                                       ; preds = %.lr.ph87, %._crit_edge85.thread, %._crit_edge85
  %59 = load i32, ptr @nextra, align 4, !tbaa !5
  %60 = add nsw i32 %59, %3
  %61 = icmp sgt i32 %60, 0
  br i1 %61, label %.lr.ph89, label %._crit_edge

.lr.ph87:                                         ; preds = %.lr.ph87.preheader, %.lr.ph87
  %indvars.iv106 = phi i64 [ 0, %.lr.ph87.preheader ], [ %indvars.iv.next107, %.lr.ph87 ]
  %62 = getelementptr inbounds ptr, ptr %22, i64 %indvars.iv106
  %63 = load ptr, ptr %62, align 8, !tbaa !9
  tail call void @N_VRand(ptr noundef %63, i64 noundef %1, double noundef -1.000000e+00, double noundef 1.000000e+00) #6
  %64 = getelementptr inbounds ptr, ptr %23, i64 %indvars.iv106
  %65 = load ptr, ptr %64, align 8, !tbaa !9
  tail call void @N_VRand(ptr noundef %65, i64 noundef %1, double noundef 1.000000e+00, double noundef 2.000000e+00) #6
  %indvars.iv.next107 = add nuw nsw i64 %indvars.iv106, 1
  %exitcond110.not = icmp eq i64 %indvars.iv.next107, %wide.trip.count109
  br i1 %exitcond110.not, label %.preheader, label %.lr.ph87, !llvm.loop !17

.lr.ph89:                                         ; preds = %.preheader, %.lr.ph89
  %indvars.iv111 = phi i64 [ %indvars.iv.next112, %.lr.ph89 ], [ 0, %.preheader ]
  tail call void (...) @ClearCache() #6
  %66 = tail call double @get_time()
  %67 = tail call i32 @N_VWrmsNormMaskVectorArray(i32 noundef %2, ptr noundef %22, ptr noundef %23, ptr noundef %24, ptr noundef %21) #6
  tail call void @sync_device(ptr noundef %0) #6
  %68 = tail call double @get_time()
  %69 = fsub double %68, %66
  %70 = getelementptr inbounds double, ptr %17, i64 %indvars.iv111
  store double %69, ptr %70, align 8, !tbaa !11
  %indvars.iv.next112 = add nuw nsw i64 %indvars.iv111, 1
  %71 = load i32, ptr @nextra, align 4, !tbaa !5
  %72 = add nsw i32 %71, %3
  %73 = sext i32 %72 to i64
  %74 = icmp slt i64 %indvars.iv.next112, %73
  br i1 %74, label %.lr.ph89, label %._crit_edge, !llvm.loop !18

._crit_edge:                                      ; preds = %.lr.ph89, %.preheader
  %.077.lcssa = phi i32 [ undef, %.preheader ], [ %67, %.lr.ph89 ]
  %.lcssa = phi i32 [ %59, %.preheader ], [ %71, %.lr.ph89 ]
  call void @time_stats(ptr noundef %0, ptr noundef %17, i32 noundef %.lcssa, i32 noundef %3, ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %8)
  %75 = load i32, ptr @nextra, align 4, !tbaa !5
  call void @time_stats(ptr noundef %0, ptr noundef %18, i32 noundef %75, i32 noundef %3, ptr noundef nonnull %9, ptr noundef nonnull %10, ptr noundef nonnull %11, ptr noundef nonnull %12)
  %76 = load i32, ptr @print_time, align 4, !tbaa !5
  %.not = icmp eq i32 %76, 0
  br i1 %.not, label %87, label %77

77:                                               ; preds = %._crit_edge
  %78 = load double, ptr %5, align 8, !tbaa !11
  %79 = load double, ptr %6, align 8, !tbaa !11
  %80 = load double, ptr %7, align 8, !tbaa !11
  %81 = load double, ptr %8, align 8, !tbaa !11
  %82 = load double, ptr %9, align 8, !tbaa !11
  %83 = load double, ptr %10, align 8, !tbaa !11
  %84 = load double, ptr %11, align 8, !tbaa !11
  %85 = load double, ptr %12, align 8, !tbaa !11
  %86 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.38, ptr noundef nonnull @.str.50, double noundef %78, double noundef %79, double noundef %80, double noundef %81, double noundef %82, double noundef %83, double noundef %84, double noundef %85)
  br label %87

87:                                               ; preds = %77, %._crit_edge
  call void @free(ptr noundef %17) #6
  call void @free(ptr noundef %18) #6
  call void @free(ptr noundef %21) #6
  call void @N_VDestroyVectorArray(ptr noundef %22, i32 noundef %2) #6
  call void @N_VDestroyVectorArray(ptr noundef %23, i32 noundef %2) #6
  call void @N_VDestroy(ptr noundef %24) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  ret i32 %.077.lcssa
}

declare i32 @N_VWrmsNormMaskVectorArray(i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden double @get_time() local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { "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 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 #4 = { nofree nounwind "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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }

!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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}


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