; 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.49 = external hidden unnamed_addr constant [23 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 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

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

declare double @N_VWrmsNorm(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_VWrmsNormVectorArray(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
  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
  %27 = load i32, ptr %8, align 4, !tbaa !11
  %28 = load i32, ptr @nextra, align 4, !tbaa !11
  %29 = add nsw i32 %27, %28
  %30 = sext i32 %29 to i64
  %31 = mul i64 %30, 8
  %32 = call noalias ptr @malloc(i64 noundef %31) #6
  store ptr %32, ptr %19, align 8, !tbaa !5
  %33 = load i32, ptr %8, align 4, !tbaa !11
  %34 = load i32, ptr @nextra, align 4, !tbaa !11
  %35 = add nsw i32 %33, %34
  %36 = sext i32 %35 to i64
  %37 = mul i64 %36, 8
  %38 = call noalias ptr @malloc(i64 noundef %37) #6
  store ptr %38, ptr %20, align 8, !tbaa !5
  %39 = load i32, ptr %7, align 4, !tbaa !11
  %40 = sext i32 %39 to i64
  %41 = mul i64 %40, 8
  %42 = call noalias ptr @malloc(i64 noundef %41) #6
  store ptr %42, ptr %24, align 8, !tbaa !5
  %43 = load i32, ptr %7, align 4, !tbaa !11
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = call ptr @N_VCloneVectorArray(i32 noundef %43, ptr noundef %44)
  store ptr %45, ptr %25, align 8, !tbaa !5
  %46 = load i32, ptr %7, align 4, !tbaa !11
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = call ptr @N_VCloneVectorArray(i32 noundef %46, ptr noundef %47)
  store ptr %48, ptr %26, align 8, !tbaa !5
  store i32 0, ptr %22, align 4, !tbaa !11
  br label %49

49:                                               ; preds = %66, %4
  %50 = load i32, ptr %22, align 4, !tbaa !11
  %51 = load i32, ptr %7, align 4, !tbaa !11
  %52 = icmp slt i32 %50, %51
  br i1 %52, label %53, label %69

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

66:                                               ; preds = %53
  %67 = load i32, ptr %22, align 4, !tbaa !11
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %22, align 4, !tbaa !11
  br label %49, !llvm.loop !13

69:                                               ; preds = %49
  store i32 0, ptr %21, align 4, !tbaa !11
  br label %70

70:                                               ; preds = %111, %69
  %71 = load i32, ptr %21, align 4, !tbaa !11
  %72 = load i32, ptr %8, align 4, !tbaa !11
  %73 = load i32, ptr @nextra, align 4, !tbaa !11
  %74 = add nsw i32 %72, %73
  %75 = icmp slt i32 %71, %74
  br i1 %75, label %76, label %114

76:                                               ; preds = %70
  call void (...) @ClearCache()
  %77 = call double @get_time()
  store double %77, ptr %9, align 8, !tbaa !15
  store i32 0, ptr %22, align 4, !tbaa !11
  br label %78

78:                                               ; preds = %98, %76
  %79 = load i32, ptr %22, align 4, !tbaa !11
  %80 = load i32, ptr %7, align 4, !tbaa !11
  %81 = icmp slt i32 %79, %80
  br i1 %81, label %82, label %101

82:                                               ; preds = %78
  %83 = load ptr, ptr %25, align 8, !tbaa !5
  %84 = load i32, ptr %22, align 4, !tbaa !11
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds ptr, ptr %83, i64 %85
  %87 = load ptr, ptr %86, align 8, !tbaa !5
  %88 = load ptr, ptr %26, 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 = call double @N_VWrmsNorm(ptr noundef %87, ptr noundef %92)
  %94 = load ptr, ptr %24, align 8, !tbaa !5
  %95 = load i32, ptr %22, align 4, !tbaa !11
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds double, ptr %94, i64 %96
  store double %93, ptr %97, align 8, !tbaa !15
  br label %98

98:                                               ; preds = %82
  %99 = load i32, ptr %22, align 4, !tbaa !11
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr %22, align 4, !tbaa !11
  br label %78, !llvm.loop !17

101:                                              ; preds = %78
  %102 = load ptr, ptr %5, align 8, !tbaa !5
  call void @sync_device(ptr noundef %102)
  %103 = call double @get_time()
  store double %103, ptr %10, align 8, !tbaa !15
  %104 = load double, ptr %10, align 8, !tbaa !15
  %105 = load double, ptr %9, align 8, !tbaa !15
  %106 = fsub double %104, %105
  %107 = load ptr, ptr %20, align 8, !tbaa !5
  %108 = load i32, ptr %21, align 4, !tbaa !11
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds double, ptr %107, i64 %109
  store double %106, ptr %110, align 8, !tbaa !15
  br label %111

111:                                              ; preds = %101
  %112 = load i32, ptr %21, align 4, !tbaa !11
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %21, align 4, !tbaa !11
  br label %70, !llvm.loop !18

114:                                              ; preds = %70
  store i32 0, ptr %22, align 4, !tbaa !11
  br label %115

115:                                              ; preds = %132, %114
  %116 = load i32, ptr %22, align 4, !tbaa !11
  %117 = load i32, ptr %7, align 4, !tbaa !11
  %118 = icmp slt i32 %116, %117
  br i1 %118, label %119, label %135

119:                                              ; preds = %115
  %120 = load ptr, ptr %25, align 8, !tbaa !5
  %121 = load i32, ptr %22, align 4, !tbaa !11
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds ptr, ptr %120, i64 %122
  %124 = load ptr, ptr %123, align 8, !tbaa !5
  %125 = load i64, ptr %6, align 8, !tbaa !9
  call void @N_VRand(ptr noundef %124, i64 noundef %125, double noundef -1.000000e+00, double noundef 1.000000e+00)
  %126 = load ptr, ptr %26, align 8, !tbaa !5
  %127 = load i32, ptr %22, align 4, !tbaa !11
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds ptr, ptr %126, i64 %128
  %130 = load ptr, ptr %129, align 8, !tbaa !5
  %131 = load i64, ptr %6, align 8, !tbaa !9
  call void @N_VRand(ptr noundef %130, i64 noundef %131, double noundef 1.000000e+00, double noundef 2.000000e+00)
  br label %132

132:                                              ; preds = %119
  %133 = load i32, ptr %22, align 4, !tbaa !11
  %134 = add nsw i32 %133, 1
  store i32 %134, ptr %22, align 4, !tbaa !11
  br label %115, !llvm.loop !19

135:                                              ; preds = %115
  store i32 0, ptr %21, align 4, !tbaa !11
  br label %136

136:                                              ; preds = %158, %135
  %137 = load i32, ptr %21, align 4, !tbaa !11
  %138 = load i32, ptr %8, align 4, !tbaa !11
  %139 = load i32, ptr @nextra, align 4, !tbaa !11
  %140 = add nsw i32 %138, %139
  %141 = icmp slt i32 %137, %140
  br i1 %141, label %142, label %161

142:                                              ; preds = %136
  call void (...) @ClearCache()
  %143 = call double @get_time()
  store double %143, ptr %9, align 8, !tbaa !15
  %144 = load i32, ptr %7, align 4, !tbaa !11
  %145 = load ptr, ptr %25, align 8, !tbaa !5
  %146 = load ptr, ptr %26, align 8, !tbaa !5
  %147 = load ptr, ptr %24, align 8, !tbaa !5
  %148 = call i32 @N_VWrmsNormVectorArray(i32 noundef %144, ptr noundef %145, ptr noundef %146, ptr noundef %147)
  store i32 %148, ptr %23, align 4, !tbaa !11
  %149 = load ptr, ptr %5, align 8, !tbaa !5
  call void @sync_device(ptr noundef %149)
  %150 = call double @get_time()
  store double %150, ptr %10, align 8, !tbaa !15
  %151 = load double, ptr %10, align 8, !tbaa !15
  %152 = load double, ptr %9, align 8, !tbaa !15
  %153 = fsub double %151, %152
  %154 = load ptr, ptr %19, align 8, !tbaa !5
  %155 = load i32, ptr %21, align 4, !tbaa !11
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds double, ptr %154, i64 %156
  store double %153, ptr %157, align 8, !tbaa !15
  br label %158

158:                                              ; preds = %142
  %159 = load i32, ptr %21, align 4, !tbaa !11
  %160 = add nsw i32 %159, 1
  store i32 %160, ptr %21, align 4, !tbaa !11
  br label %136, !llvm.loop !20

161:                                              ; preds = %136
  %162 = load ptr, ptr %5, align 8, !tbaa !5
  %163 = load ptr, ptr %19, align 8, !tbaa !5
  %164 = load i32, ptr @nextra, align 4, !tbaa !11
  %165 = load i32, ptr %8, align 4, !tbaa !11
  call void @time_stats(ptr noundef %162, ptr noundef %163, i32 noundef %164, i32 noundef %165, ptr noundef %11, ptr noundef %12, ptr noundef %13, ptr noundef %14)
  %166 = load ptr, ptr %5, align 8, !tbaa !5
  %167 = load ptr, ptr %20, align 8, !tbaa !5
  %168 = load i32, ptr @nextra, align 4, !tbaa !11
  %169 = load i32, ptr %8, align 4, !tbaa !11
  call void @time_stats(ptr noundef %166, ptr noundef %167, i32 noundef %168, i32 noundef %169, ptr noundef %15, ptr noundef %16, ptr noundef %17, ptr noundef %18)
  %170 = load i32, ptr @print_time, align 4, !tbaa !11
  %171 = icmp ne i32 %170, 0
  br i1 %171, label %172, label %182

172:                                              ; preds = %161
  %173 = load double, ptr %11, align 8, !tbaa !15
  %174 = load double, ptr %12, align 8, !tbaa !15
  %175 = load double, ptr %13, align 8, !tbaa !15
  %176 = load double, ptr %14, align 8, !tbaa !15
  %177 = load double, ptr %15, align 8, !tbaa !15
  %178 = load double, ptr %16, align 8, !tbaa !15
  %179 = load double, ptr %17, align 8, !tbaa !15
  %180 = load double, ptr %18, align 8, !tbaa !15
  %181 = call i32 (ptr, ...) @printf(ptr noundef @.str.38, ptr noundef @.str.49, double noundef %173, double noundef %174, double noundef %175, double noundef %176, double noundef %177, double noundef %178, double noundef %179, double noundef %180)
  br label %182

182:                                              ; preds = %172, %161
  %183 = load ptr, ptr %19, align 8, !tbaa !5
  call void @free(ptr noundef %183) #5
  %184 = load ptr, ptr %20, align 8, !tbaa !5
  call void @free(ptr noundef %184) #5
  %185 = load ptr, ptr %24, align 8, !tbaa !5
  call void @free(ptr noundef %185) #5
  %186 = load ptr, ptr %25, align 8, !tbaa !5
  %187 = load i32, ptr %7, align 4, !tbaa !11
  call void @N_VDestroyVectorArray(ptr noundef %186, i32 noundef %187)
  %188 = load ptr, ptr %26, align 8, !tbaa !5
  %189 = load i32, ptr %7, align 4, !tbaa !11
  call void @N_VDestroyVectorArray(ptr noundef %188, i32 noundef %189)
  %190 = load i32, ptr %23, align 4, !tbaa !11
  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 %190
}

declare i32 @N_VWrmsNormVectorArray(i32 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.49 = external hidden unnamed_addr constant [23 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 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

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

declare double @N_VWrmsNorm(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_VWrmsNormVectorArray(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 = icmp sgt i32 %2, 0
  br i1 %24, label %.lr.ph.preheader, label %.preheader72.thread

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

.preheader72:                                     ; preds = %.lr.ph
  %25 = load i32, ptr @nextra, align 4, !tbaa !5
  %26 = add nsw i32 %25, %3
  %27 = icmp sgt i32 %26, 0
  br i1 %27, label %.lr.ph77, label %.preheader71

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

.lr.ph77:                                         ; preds = %.preheader72
  br i1 %24, label %.lr.ph75.us.preheader, label %.lr.ph77.split.preheader

.lr.ph77.split.preheader:                         ; preds = %.preheader72.thread, %.lr.ph77
  br label %.lr.ph77.split

.lr.ph75.us.preheader:                            ; preds = %.lr.ph77
  %wide.trip.count93 = zext nneg i32 %2 to i64
  br label %.lr.ph75.us

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

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

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

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %46 = getelementptr inbounds ptr, ptr %22, i64 %indvars.iv
  %47 = load ptr, ptr %46, align 8, !tbaa !9
  tail call void @N_VRand(ptr noundef %47, i64 noundef %1, double noundef -1.000000e+00, double noundef 1.000000e+00) #6
  %48 = getelementptr inbounds ptr, ptr %23, i64 %indvars.iv
  %49 = load ptr, ptr %48, align 8, !tbaa !9
  tail call void @N_VRand(ptr noundef %49, 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 %.preheader72, label %.lr.ph, !llvm.loop !16

.preheader71:                                     ; preds = %.lr.ph77.split, %._crit_edge.us, %.preheader72
  %50 = phi i32 [ %25, %.preheader72 ], [ %42, %._crit_edge.us ], [ %55, %.lr.ph77.split ]
  br i1 %24, label %.lr.ph79.preheader, label %.preheader

.lr.ph79.preheader:                               ; preds = %.preheader71
  %wide.trip.count101 = zext nneg i32 %2 to i64
  br label %.lr.ph79

.lr.ph77.split:                                   ; preds = %.lr.ph77.split.preheader, %.lr.ph77.split
  %indvars.iv87 = phi i64 [ %indvars.iv.next88, %.lr.ph77.split ], [ 0, %.lr.ph77.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.iv87
  store double %53, ptr %54, align 8, !tbaa !11
  %indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 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.next88, %57
  br i1 %58, label %.lr.ph77.split, label %.preheader71, !llvm.loop !15

.preheader.loopexit:                              ; preds = %.lr.ph79
  %.pre = load i32, ptr @nextra, align 4, !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %.preheader72.thread, %.preheader.loopexit, %.preheader71
  %59 = phi i32 [ %.pre, %.preheader.loopexit ], [ %50, %.preheader71 ], [ %28, %.preheader72.thread ]
  %60 = add nsw i32 %59, %3
  %61 = icmp sgt i32 %60, 0
  br i1 %61, label %.lr.ph81, label %._crit_edge

.lr.ph79:                                         ; preds = %.lr.ph79.preheader, %.lr.ph79
  %indvars.iv98 = phi i64 [ 0, %.lr.ph79.preheader ], [ %indvars.iv.next99, %.lr.ph79 ]
  %62 = getelementptr inbounds ptr, ptr %22, i64 %indvars.iv98
  %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.iv98
  %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.next99 = add nuw nsw i64 %indvars.iv98, 1
  %exitcond102.not = icmp eq i64 %indvars.iv.next99, %wide.trip.count101
  br i1 %exitcond102.not, label %.preheader.loopexit, label %.lr.ph79, !llvm.loop !17

.lr.ph81:                                         ; preds = %.preheader, %.lr.ph81
  %indvars.iv103 = phi i64 [ %indvars.iv.next104, %.lr.ph81 ], [ 0, %.preheader ]
  tail call void (...) @ClearCache() #6
  %66 = tail call double @get_time()
  %67 = tail call i32 @N_VWrmsNormVectorArray(i32 noundef %2, ptr noundef %22, ptr noundef %23, 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.iv103
  store double %69, ptr %70, align 8, !tbaa !11
  %indvars.iv.next104 = add nuw nsw i64 %indvars.iv103, 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.next104, %73
  br i1 %74, label %.lr.ph81, label %._crit_edge, !llvm.loop !18

._crit_edge:                                      ; preds = %.lr.ph81, %.preheader
  %.067.lcssa = phi i32 [ undef, %.preheader ], [ %67, %.lr.ph81 ]
  %.lcssa = phi i32 [ %59, %.preheader ], [ %71, %.lr.ph81 ]
  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.49, 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 @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 %.067.lcssa
}

declare i32 @N_VWrmsNormVectorArray(i32 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