; 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 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [11 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 i32 @rand() #4

declare void @N_VConst(double noundef, ptr noundef) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #5

; 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

; Function Attrs: nounwind uwtable
define dso_local i32 @Test_N_VScale(ptr noundef %0, i64 noundef %1, i32 noundef %2) #3 {
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca ptr, 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 i32, align 4
  %16 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %17 = load i32, ptr %6, align 4, !tbaa !11
  %18 = load i32, ptr @nextra, align 4, !tbaa !11
  %19 = add nsw i32 %17, %18
  %20 = sext i32 %19 to i64
  %21 = mul i64 %20, 8
  %22 = call noalias ptr @malloc(i64 noundef %21) #7
  store ptr %22, ptr %9, align 8, !tbaa !5
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = call ptr @N_VClone(ptr noundef %23)
  store ptr %24, ptr %16, align 8, !tbaa !5
  store i32 0, ptr %15, align 4, !tbaa !11
  br label %25

25:                                               ; preds = %51, %3
  %26 = load i32, ptr %15, align 4, !tbaa !11
  %27 = load i32, ptr %6, align 4, !tbaa !11
  %28 = load i32, ptr @nextra, align 4, !tbaa !11
  %29 = add nsw i32 %27, %28
  %30 = icmp slt i32 %26, %29
  br i1 %30, label %31, label %54

31:                                               ; preds = %25
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = load i64, ptr %5, align 8, !tbaa !9
  call void @N_VRand(ptr noundef %32, i64 noundef %33, double noundef -1.000000e+00, double noundef 1.000000e+00)
  %34 = call i32 @rand() #6
  %35 = sitofp i32 %34 to double
  %36 = fdiv double %35, 0x41DFFFFFFFC00000
  %37 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %36, double -1.000000e+00)
  store double %37, ptr %14, align 8, !tbaa !13
  call void (...) @ClearCache()
  %38 = call double @get_time()
  store double %38, ptr %7, align 8, !tbaa !13
  %39 = load double, ptr %14, align 8, !tbaa !13
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  call void @N_VScale(double noundef %39, ptr noundef %40, ptr noundef %41)
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  call void @sync_device(ptr noundef %42)
  %43 = call double @get_time()
  store double %43, ptr %8, align 8, !tbaa !13
  %44 = load double, ptr %8, align 8, !tbaa !13
  %45 = load double, ptr %7, align 8, !tbaa !13
  %46 = fsub double %44, %45
  %47 = load ptr, ptr %9, align 8, !tbaa !5
  %48 = load i32, ptr %15, align 4, !tbaa !11
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds double, ptr %47, i64 %49
  store double %46, ptr %50, align 8, !tbaa !13
  br label %51

51:                                               ; preds = %31
  %52 = load i32, ptr %15, align 4, !tbaa !11
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %15, align 4, !tbaa !11
  br label %25, !llvm.loop !15

54:                                               ; preds = %25
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  %57 = load i32, ptr @nextra, align 4, !tbaa !11
  %58 = load i32, ptr %6, align 4, !tbaa !11
  call void @time_stats(ptr noundef %55, ptr noundef %56, i32 noundef %57, i32 noundef %58, ptr noundef %10, ptr noundef %11, ptr noundef %12, ptr noundef %13)
  %59 = load i32, ptr @print_time, align 4, !tbaa !11
  %60 = icmp ne i32 %59, 0
  br i1 %60, label %61, label %67

61:                                               ; preds = %54
  %62 = load double, ptr %10, align 8, !tbaa !13
  %63 = load double, ptr %11, align 8, !tbaa !13
  %64 = load double, ptr %12, align 8, !tbaa !13
  %65 = load double, ptr %13, align 8, !tbaa !13
  %66 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.20, double noundef %62, double noundef %63, double noundef %64, double noundef %65)
  br label %67

67:                                               ; preds = %61, %54
  store i32 0, ptr %15, align 4, !tbaa !11
  br label %68

68:                                               ; preds = %90, %67
  %69 = load i32, ptr %15, align 4, !tbaa !11
  %70 = load i32, ptr %6, align 4, !tbaa !11
  %71 = load i32, ptr @nextra, align 4, !tbaa !11
  %72 = add nsw i32 %70, %71
  %73 = icmp slt i32 %69, %72
  br i1 %73, label %74, label %93

74:                                               ; preds = %68
  %75 = load ptr, ptr %4, align 8, !tbaa !5
  %76 = load i64, ptr %5, align 8, !tbaa !9
  call void @N_VRand(ptr noundef %75, i64 noundef %76, double noundef -1.000000e+00, double noundef 1.000000e+00)
  %77 = load ptr, ptr %16, align 8, !tbaa !5
  call void @N_VConst(double noundef 0.000000e+00, ptr noundef %77)
  call void (...) @ClearCache()
  %78 = call double @get_time()
  store double %78, ptr %7, align 8, !tbaa !13
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  %80 = load ptr, ptr %16, align 8, !tbaa !5
  call void @N_VScale(double noundef 1.000000e+00, ptr noundef %79, ptr noundef %80)
  %81 = load ptr, ptr %4, align 8, !tbaa !5
  call void @sync_device(ptr noundef %81)
  %82 = call double @get_time()
  store double %82, ptr %8, align 8, !tbaa !13
  %83 = load double, ptr %8, align 8, !tbaa !13
  %84 = load double, ptr %7, align 8, !tbaa !13
  %85 = fsub double %83, %84
  %86 = load ptr, ptr %9, align 8, !tbaa !5
  %87 = load i32, ptr %15, align 4, !tbaa !11
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds double, ptr %86, i64 %88
  store double %85, ptr %89, align 8, !tbaa !13
  br label %90

90:                                               ; preds = %74
  %91 = load i32, ptr %15, align 4, !tbaa !11
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr %15, align 4, !tbaa !11
  br label %68, !llvm.loop !17

93:                                               ; preds = %68
  %94 = load ptr, ptr %4, align 8, !tbaa !5
  %95 = load ptr, ptr %9, align 8, !tbaa !5
  %96 = load i32, ptr @nextra, align 4, !tbaa !11
  %97 = load i32, ptr %6, align 4, !tbaa !11
  call void @time_stats(ptr noundef %94, ptr noundef %95, i32 noundef %96, i32 noundef %97, ptr noundef %10, ptr noundef %11, ptr noundef %12, ptr noundef %13)
  %98 = load i32, ptr @print_time, align 4, !tbaa !11
  %99 = icmp ne i32 %98, 0
  br i1 %99, label %100, label %106

100:                                              ; preds = %93
  %101 = load double, ptr %10, align 8, !tbaa !13
  %102 = load double, ptr %11, align 8, !tbaa !13
  %103 = load double, ptr %12, align 8, !tbaa !13
  %104 = load double, ptr %13, align 8, !tbaa !13
  %105 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.21, double noundef %101, double noundef %102, double noundef %103, double noundef %104)
  br label %106

106:                                              ; preds = %100, %93
  store i32 0, ptr %15, align 4, !tbaa !11
  br label %107

107:                                              ; preds = %129, %106
  %108 = load i32, ptr %15, align 4, !tbaa !11
  %109 = load i32, ptr %6, align 4, !tbaa !11
  %110 = load i32, ptr @nextra, align 4, !tbaa !11
  %111 = add nsw i32 %109, %110
  %112 = icmp slt i32 %108, %111
  br i1 %112, label %113, label %132

113:                                              ; preds = %107
  %114 = load ptr, ptr %4, align 8, !tbaa !5
  %115 = load i64, ptr %5, align 8, !tbaa !9
  call void @N_VRand(ptr noundef %114, i64 noundef %115, double noundef -1.000000e+00, double noundef 1.000000e+00)
  %116 = load ptr, ptr %16, align 8, !tbaa !5
  call void @N_VConst(double noundef 0.000000e+00, ptr noundef %116)
  call void (...) @ClearCache()
  %117 = call double @get_time()
  store double %117, ptr %7, align 8, !tbaa !13
  %118 = load ptr, ptr %4, align 8, !tbaa !5
  %119 = load ptr, ptr %16, align 8, !tbaa !5
  call void @N_VScale(double noundef -1.000000e+00, ptr noundef %118, ptr noundef %119)
  %120 = load ptr, ptr %4, align 8, !tbaa !5
  call void @sync_device(ptr noundef %120)
  %121 = call double @get_time()
  store double %121, ptr %8, align 8, !tbaa !13
  %122 = load double, ptr %8, align 8, !tbaa !13
  %123 = load double, ptr %7, align 8, !tbaa !13
  %124 = fsub double %122, %123
  %125 = load ptr, ptr %9, align 8, !tbaa !5
  %126 = load i32, ptr %15, align 4, !tbaa !11
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds double, ptr %125, i64 %127
  store double %124, ptr %128, align 8, !tbaa !13
  br label %129

129:                                              ; preds = %113
  %130 = load i32, ptr %15, align 4, !tbaa !11
  %131 = add nsw i32 %130, 1
  store i32 %131, ptr %15, align 4, !tbaa !11
  br label %107, !llvm.loop !18

132:                                              ; preds = %107
  %133 = load ptr, ptr %4, align 8, !tbaa !5
  %134 = load ptr, ptr %9, align 8, !tbaa !5
  %135 = load i32, ptr @nextra, align 4, !tbaa !11
  %136 = load i32, ptr %6, align 4, !tbaa !11
  call void @time_stats(ptr noundef %133, ptr noundef %134, i32 noundef %135, i32 noundef %136, ptr noundef %10, ptr noundef %11, ptr noundef %12, ptr noundef %13)
  %137 = load i32, ptr @print_time, align 4, !tbaa !11
  %138 = icmp ne i32 %137, 0
  br i1 %138, label %139, label %145

139:                                              ; preds = %132
  %140 = load double, ptr %10, align 8, !tbaa !13
  %141 = load double, ptr %11, align 8, !tbaa !13
  %142 = load double, ptr %12, align 8, !tbaa !13
  %143 = load double, ptr %13, align 8, !tbaa !13
  %144 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.22, double noundef %140, double noundef %141, double noundef %142, double noundef %143)
  br label %145

145:                                              ; preds = %139, %132
  store i32 0, ptr %15, align 4, !tbaa !11
  br label %146

146:                                              ; preds = %173, %145
  %147 = load i32, ptr %15, align 4, !tbaa !11
  %148 = load i32, ptr %6, align 4, !tbaa !11
  %149 = load i32, ptr @nextra, align 4, !tbaa !11
  %150 = add nsw i32 %148, %149
  %151 = icmp slt i32 %147, %150
  br i1 %151, label %152, label %176

152:                                              ; preds = %146
  %153 = load ptr, ptr %4, align 8, !tbaa !5
  %154 = load i64, ptr %5, align 8, !tbaa !9
  call void @N_VRand(ptr noundef %153, i64 noundef %154, double noundef -1.000000e+00, double noundef 1.000000e+00)
  %155 = load ptr, ptr %16, align 8, !tbaa !5
  call void @N_VConst(double noundef 0.000000e+00, ptr noundef %155)
  %156 = call i32 @rand() #6
  %157 = sitofp i32 %156 to double
  %158 = fdiv double %157, 0x41DFFFFFFFC00000
  %159 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %158, double -1.000000e+00)
  store double %159, ptr %14, align 8, !tbaa !13
  call void (...) @ClearCache()
  %160 = call double @get_time()
  store double %160, ptr %7, align 8, !tbaa !13
  %161 = load double, ptr %14, align 8, !tbaa !13
  %162 = load ptr, ptr %4, align 8, !tbaa !5
  %163 = load ptr, ptr %16, align 8, !tbaa !5
  call void @N_VScale(double noundef %161, ptr noundef %162, ptr noundef %163)
  %164 = load ptr, ptr %4, align 8, !tbaa !5
  call void @sync_device(ptr noundef %164)
  %165 = call double @get_time()
  store double %165, ptr %8, align 8, !tbaa !13
  %166 = load double, ptr %8, align 8, !tbaa !13
  %167 = load double, ptr %7, align 8, !tbaa !13
  %168 = fsub double %166, %167
  %169 = load ptr, ptr %9, align 8, !tbaa !5
  %170 = load i32, ptr %15, align 4, !tbaa !11
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds double, ptr %169, i64 %171
  store double %168, ptr %172, align 8, !tbaa !13
  br label %173

173:                                              ; preds = %152
  %174 = load i32, ptr %15, align 4, !tbaa !11
  %175 = add nsw i32 %174, 1
  store i32 %175, ptr %15, align 4, !tbaa !11
  br label %146, !llvm.loop !19

176:                                              ; preds = %146
  %177 = load ptr, ptr %4, align 8, !tbaa !5
  %178 = load ptr, ptr %9, align 8, !tbaa !5
  %179 = load i32, ptr @nextra, align 4, !tbaa !11
  %180 = load i32, ptr %6, align 4, !tbaa !11
  call void @time_stats(ptr noundef %177, ptr noundef %178, i32 noundef %179, i32 noundef %180, ptr noundef %10, ptr noundef %11, ptr noundef %12, ptr noundef %13)
  %181 = load i32, ptr @print_time, align 4, !tbaa !11
  %182 = icmp ne i32 %181, 0
  br i1 %182, label %183, label %189

183:                                              ; preds = %176
  %184 = load double, ptr %10, align 8, !tbaa !13
  %185 = load double, ptr %11, align 8, !tbaa !13
  %186 = load double, ptr %12, align 8, !tbaa !13
  %187 = load double, ptr %13, align 8, !tbaa !13
  %188 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.23, double noundef %184, double noundef %185, double noundef %186, double noundef %187)
  br label %189

189:                                              ; preds = %183, %176
  %190 = load ptr, ptr %9, align 8, !tbaa !5
  call void @free(ptr noundef %190) #6
  %191 = load ptr, ptr %16, align 8, !tbaa !5
  call void @N_VDestroy(ptr noundef %191)
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  ret i32 0
}

declare void @N_VScale(double 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"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 = !{!14, !14, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !16}


; 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 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [11 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: nounwind
declare i32 @rand() local_unnamed_addr #5

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #6

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

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

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

.lr.ph:                                           ; preds = %3, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %3 ]
  tail call void @N_VRand(ptr noundef %0, i64 noundef %1, double noundef -1.000000e+00, double noundef 1.000000e+00) #8
  %17 = tail call i32 @rand() #8
  %18 = sitofp i32 %17 to double
  %19 = fdiv double %18, 0x41DFFFFFFFC00000
  %20 = tail call double @llvm.fmuladd.f64(double %19, double 2.000000e+00, double -1.000000e+00)
  tail call void (...) @ClearCache() #8
  %21 = tail call double @get_time()
  tail call void @N_VScale(double noundef %20, ptr noundef %0, ptr noundef %0) #8
  tail call void @sync_device(ptr noundef %0) #8
  %22 = tail call double @get_time()
  %23 = fsub double %22, %21
  %24 = getelementptr inbounds double, ptr %12, i64 %indvars.iv
  store double %23, ptr %24, align 8, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %25 = load i32, ptr @nextra, align 4, !tbaa !5
  %26 = add nsw i32 %25, %2
  %27 = sext i32 %26 to i64
  %28 = icmp slt i64 %indvars.iv.next, %27
  br i1 %28, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph, %3
  %.lcssa73 = phi i32 [ %14, %3 ], [ %25, %.lr.ph ]
  call void @time_stats(ptr noundef %0, ptr noundef %12, i32 noundef %.lcssa73, i32 noundef %2, ptr noundef nonnull %4, ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef nonnull %7)
  %29 = load i32, ptr @print_time, align 4, !tbaa !5
  %.not = icmp eq i32 %29, 0
  br i1 %.not, label %36, label %30

30:                                               ; preds = %._crit_edge
  %31 = load double, ptr %4, align 8, !tbaa !9
  %32 = load double, ptr %5, align 8, !tbaa !9
  %33 = load double, ptr %6, align 8, !tbaa !9
  %34 = load double, ptr %7, align 8, !tbaa !9
  %35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull @.str.20, double noundef %31, double noundef %32, double noundef %33, double noundef %34)
  br label %36

36:                                               ; preds = %30, %._crit_edge
  %37 = load i32, ptr @nextra, align 4, !tbaa !5
  %38 = add nsw i32 %37, %2
  %39 = icmp sgt i32 %38, 0
  br i1 %39, label %.lr.ph77, label %._crit_edge78

.lr.ph77:                                         ; preds = %36, %.lr.ph77
  %indvars.iv95 = phi i64 [ %indvars.iv.next96, %.lr.ph77 ], [ 0, %36 ]
  call void @N_VRand(ptr noundef %0, i64 noundef %1, double noundef -1.000000e+00, double noundef 1.000000e+00) #8
  call void @N_VConst(double noundef 0.000000e+00, ptr noundef %13) #8
  call void (...) @ClearCache() #8
  %40 = call double @get_time()
  call void @N_VScale(double noundef 1.000000e+00, ptr noundef %0, ptr noundef %13) #8
  call void @sync_device(ptr noundef %0) #8
  %41 = call double @get_time()
  %42 = fsub double %41, %40
  %43 = getelementptr inbounds double, ptr %12, i64 %indvars.iv95
  store double %42, ptr %43, align 8, !tbaa !9
  %indvars.iv.next96 = add nuw nsw i64 %indvars.iv95, 1
  %44 = load i32, ptr @nextra, align 4, !tbaa !5
  %45 = add nsw i32 %44, %2
  %46 = sext i32 %45 to i64
  %47 = icmp slt i64 %indvars.iv.next96, %46
  br i1 %47, label %.lr.ph77, label %._crit_edge78, !llvm.loop !13

._crit_edge78:                                    ; preds = %.lr.ph77, %36
  %.lcssa72 = phi i32 [ %37, %36 ], [ %44, %.lr.ph77 ]
  call void @time_stats(ptr noundef %0, ptr noundef %12, i32 noundef %.lcssa72, i32 noundef %2, ptr noundef nonnull %4, ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef nonnull %7)
  %48 = load i32, ptr @print_time, align 4, !tbaa !5
  %.not68 = icmp eq i32 %48, 0
  br i1 %.not68, label %55, label %49

49:                                               ; preds = %._crit_edge78
  %50 = load double, ptr %4, align 8, !tbaa !9
  %51 = load double, ptr %5, align 8, !tbaa !9
  %52 = load double, ptr %6, align 8, !tbaa !9
  %53 = load double, ptr %7, align 8, !tbaa !9
  %54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull @.str.21, double noundef %50, double noundef %51, double noundef %52, double noundef %53)
  br label %55

55:                                               ; preds = %49, %._crit_edge78
  %56 = load i32, ptr @nextra, align 4, !tbaa !5
  %57 = add nsw i32 %56, %2
  %58 = icmp sgt i32 %57, 0
  br i1 %58, label %.lr.ph82, label %._crit_edge83

.lr.ph82:                                         ; preds = %55, %.lr.ph82
  %indvars.iv98 = phi i64 [ %indvars.iv.next99, %.lr.ph82 ], [ 0, %55 ]
  call void @N_VRand(ptr noundef %0, i64 noundef %1, double noundef -1.000000e+00, double noundef 1.000000e+00) #8
  call void @N_VConst(double noundef 0.000000e+00, ptr noundef %13) #8
  call void (...) @ClearCache() #8
  %59 = call double @get_time()
  call void @N_VScale(double noundef -1.000000e+00, ptr noundef %0, ptr noundef %13) #8
  call void @sync_device(ptr noundef %0) #8
  %60 = call double @get_time()
  %61 = fsub double %60, %59
  %62 = getelementptr inbounds double, ptr %12, i64 %indvars.iv98
  store double %61, ptr %62, align 8, !tbaa !9
  %indvars.iv.next99 = add nuw nsw i64 %indvars.iv98, 1
  %63 = load i32, ptr @nextra, align 4, !tbaa !5
  %64 = add nsw i32 %63, %2
  %65 = sext i32 %64 to i64
  %66 = icmp slt i64 %indvars.iv.next99, %65
  br i1 %66, label %.lr.ph82, label %._crit_edge83, !llvm.loop !14

._crit_edge83:                                    ; preds = %.lr.ph82, %55
  %.lcssa71 = phi i32 [ %56, %55 ], [ %63, %.lr.ph82 ]
  call void @time_stats(ptr noundef %0, ptr noundef %12, i32 noundef %.lcssa71, i32 noundef %2, ptr noundef nonnull %4, ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef nonnull %7)
  %67 = load i32, ptr @print_time, align 4, !tbaa !5
  %.not69 = icmp eq i32 %67, 0
  br i1 %.not69, label %74, label %68

68:                                               ; preds = %._crit_edge83
  %69 = load double, ptr %4, align 8, !tbaa !9
  %70 = load double, ptr %5, align 8, !tbaa !9
  %71 = load double, ptr %6, align 8, !tbaa !9
  %72 = load double, ptr %7, align 8, !tbaa !9
  %73 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull @.str.22, double noundef %69, double noundef %70, double noundef %71, double noundef %72)
  br label %74

74:                                               ; preds = %68, %._crit_edge83
  %75 = load i32, ptr @nextra, align 4, !tbaa !5
  %76 = add nsw i32 %75, %2
  %77 = icmp sgt i32 %76, 0
  br i1 %77, label %.lr.ph87, label %._crit_edge88

.lr.ph87:                                         ; preds = %74, %.lr.ph87
  %indvars.iv101 = phi i64 [ %indvars.iv.next102, %.lr.ph87 ], [ 0, %74 ]
  call void @N_VRand(ptr noundef %0, i64 noundef %1, double noundef -1.000000e+00, double noundef 1.000000e+00) #8
  call void @N_VConst(double noundef 0.000000e+00, ptr noundef %13) #8
  %78 = call i32 @rand() #8
  %79 = sitofp i32 %78 to double
  %80 = fdiv double %79, 0x41DFFFFFFFC00000
  %81 = call double @llvm.fmuladd.f64(double %80, double 2.000000e+00, double -1.000000e+00)
  call void (...) @ClearCache() #8
  %82 = call double @get_time()
  call void @N_VScale(double noundef %81, ptr noundef %0, ptr noundef %13) #8
  call void @sync_device(ptr noundef %0) #8
  %83 = call double @get_time()
  %84 = fsub double %83, %82
  %85 = getelementptr inbounds double, ptr %12, i64 %indvars.iv101
  store double %84, ptr %85, align 8, !tbaa !9
  %indvars.iv.next102 = add nuw nsw i64 %indvars.iv101, 1
  %86 = load i32, ptr @nextra, align 4, !tbaa !5
  %87 = add nsw i32 %86, %2
  %88 = sext i32 %87 to i64
  %89 = icmp slt i64 %indvars.iv.next102, %88
  br i1 %89, label %.lr.ph87, label %._crit_edge88, !llvm.loop !15

._crit_edge88:                                    ; preds = %.lr.ph87, %74
  %.lcssa = phi i32 [ %75, %74 ], [ %86, %.lr.ph87 ]
  call void @time_stats(ptr noundef %0, ptr noundef %12, i32 noundef %.lcssa, i32 noundef %2, ptr noundef nonnull %4, ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef nonnull %7)
  %90 = load i32, ptr @print_time, align 4, !tbaa !5
  %.not70 = icmp eq i32 %90, 0
  br i1 %.not70, label %97, label %91

91:                                               ; preds = %._crit_edge88
  %92 = load double, ptr %4, align 8, !tbaa !9
  %93 = load double, ptr %5, align 8, !tbaa !9
  %94 = load double, ptr %6, align 8, !tbaa !9
  %95 = load double, ptr %7, align 8, !tbaa !9
  %96 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull @.str.23, double noundef %92, double noundef %93, double noundef %94, double noundef %95)
  br label %97

97:                                               ; preds = %91, %._crit_edge88
  call void @free(ptr noundef %12) #8
  call void @N_VDestroy(ptr noundef %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  ret i32 0
}

declare void @N_VScale(double 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 = { 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 #6 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { 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 #8 = { nounwind }
attributes #9 = { 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 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}


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