; LLVM IR from CLASS-SZ/class_sz :: class-sz/tools (r8lib)

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

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

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

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

; Function Attrs: nounwind
declare double @sqrt(double noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local double @r8_epsilon() #3

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @r8mat_mv_new(i32 noundef, i32 noundef, ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local void @r8mat_power_method(i32 noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #3 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca double, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca double, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca double, align 8
  %18 = alloca double, align 8
  store i32 %0, ptr %5, align 4, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  store double 1.000000e-04, ptr %13, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  store i32 100, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  store i32 10, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  %19 = call double @r8_epsilon()
  %20 = call double @sqrt(double noundef %19) #4
  store double %20, ptr %10, align 8, !tbaa !11
  %21 = load i32, ptr %5, align 4, !tbaa !5
  %22 = load ptr, ptr %8, align 8, !tbaa !9
  %23 = call double @r8vec_norm(i32 noundef %21, ptr noundef %22)
  %24 = load ptr, ptr %7, align 8, !tbaa !9
  store double %23, ptr %24, align 8, !tbaa !11
  %25 = load ptr, ptr %7, align 8, !tbaa !9
  %26 = load double, ptr %25, align 8, !tbaa !11
  %27 = fcmp oeq double %26, 0.000000e+00
  br i1 %27, label %28, label %46

28:                                               ; preds = %4
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %38, %28
  %30 = load i32, ptr %11, align 4, !tbaa !5
  %31 = load i32, ptr %5, align 4, !tbaa !5
  %32 = icmp slt i32 %30, %31
  br i1 %32, label %33, label %41

33:                                               ; preds = %29
  %34 = load ptr, ptr %8, align 8, !tbaa !9
  %35 = load i32, ptr %11, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds double, ptr %34, i64 %36
  store double 1.000000e+00, ptr %37, align 8, !tbaa !11
  br label %38

38:                                               ; preds = %33
  %39 = load i32, ptr %11, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %11, align 4, !tbaa !5
  br label %29, !llvm.loop !13

41:                                               ; preds = %29
  %42 = load i32, ptr %5, align 4, !tbaa !5
  %43 = sitofp i32 %42 to double
  %44 = call double @sqrt(double noundef %43) #4
  %45 = load ptr, ptr %7, align 8, !tbaa !9
  store double %44, ptr %45, align 8, !tbaa !11
  br label %46

46:                                               ; preds = %41, %4
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %64, %46
  %48 = load i32, ptr %11, align 4, !tbaa !5
  %49 = load i32, ptr %5, align 4, !tbaa !5
  %50 = icmp slt i32 %48, %49
  br i1 %50, label %51, label %67

51:                                               ; preds = %47
  %52 = load ptr, ptr %8, align 8, !tbaa !9
  %53 = load i32, ptr %11, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds double, ptr %52, i64 %54
  %56 = load double, ptr %55, align 8, !tbaa !11
  %57 = load ptr, ptr %7, align 8, !tbaa !9
  %58 = load double, ptr %57, align 8, !tbaa !11
  %59 = fdiv double %56, %58
  %60 = load ptr, ptr %8, align 8, !tbaa !9
  %61 = load i32, ptr %11, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds double, ptr %60, i64 %62
  store double %59, ptr %63, align 8, !tbaa !11
  br label %64

64:                                               ; preds = %51
  %65 = load i32, ptr %11, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %11, align 4, !tbaa !5
  br label %47, !llvm.loop !15

67:                                               ; preds = %47
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %68

68:                                               ; preds = %184, %67
  %69 = load i32, ptr %12, align 4, !tbaa !5
  %70 = load i32, ptr %14, align 4, !tbaa !5
  %71 = icmp sle i32 %69, %70
  br i1 %71, label %72, label %187

72:                                               ; preds = %68
  %73 = load i32, ptr %5, align 4, !tbaa !5
  %74 = load i32, ptr %5, align 4, !tbaa !5
  %75 = load ptr, ptr %6, align 8, !tbaa !9
  %76 = load ptr, ptr %8, align 8, !tbaa !9
  %77 = call ptr @r8mat_mv_new(i32 noundef %73, i32 noundef %74, ptr noundef %75, ptr noundef %76)
  store ptr %77, ptr %9, align 8, !tbaa !9
  %78 = load ptr, ptr %7, align 8, !tbaa !9
  %79 = load double, ptr %78, align 8, !tbaa !11
  store double %79, ptr %18, align 8, !tbaa !11
  %80 = load i32, ptr %5, align 4, !tbaa !5
  %81 = load ptr, ptr %9, align 8, !tbaa !9
  %82 = call double @r8vec_norm(i32 noundef %80, ptr noundef %81)
  %83 = load ptr, ptr %7, align 8, !tbaa !9
  store double %82, ptr %83, align 8, !tbaa !11
  %84 = load i32, ptr %15, align 4, !tbaa !5
  %85 = load i32, ptr %12, align 4, !tbaa !5
  %86 = icmp slt i32 %84, %85
  br i1 %86, label %87, label %102

87:                                               ; preds = %72
  %88 = load ptr, ptr %7, align 8, !tbaa !9
  %89 = load double, ptr %88, align 8, !tbaa !11
  %90 = load double, ptr %18, align 8, !tbaa !11
  %91 = fsub double %89, %90
  %92 = call double @llvm.fabs.f64(double %91)
  %93 = load double, ptr %13, align 8, !tbaa !11
  %94 = load ptr, ptr %7, align 8, !tbaa !9
  %95 = load double, ptr %94, align 8, !tbaa !11
  %96 = call double @llvm.fabs.f64(double %95)
  %97 = fadd double 1.000000e+00, %96
  %98 = fmul double %93, %97
  %99 = fcmp ole double %92, %98
  br i1 %99, label %100, label %101

100:                                              ; preds = %87
  br label %187

101:                                              ; preds = %87
  br label %102

102:                                              ; preds = %101, %72
  %103 = load i32, ptr %5, align 4, !tbaa !5
  %104 = load ptr, ptr %9, align 8, !tbaa !9
  %105 = load ptr, ptr %8, align 8, !tbaa !9
  call void @r8vec_copy(i32 noundef %103, ptr noundef %104, ptr noundef %105)
  %106 = load ptr, ptr %9, align 8, !tbaa !9
  call void @free(ptr noundef %106) #4
  %107 = load ptr, ptr %7, align 8, !tbaa !9
  %108 = load double, ptr %107, align 8, !tbaa !11
  %109 = fcmp une double %108, 0.000000e+00
  br i1 %109, label %110, label %132

110:                                              ; preds = %102
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %111

111:                                              ; preds = %128, %110
  %112 = load i32, ptr %11, align 4, !tbaa !5
  %113 = load i32, ptr %5, align 4, !tbaa !5
  %114 = icmp slt i32 %112, %113
  br i1 %114, label %115, label %131

115:                                              ; preds = %111
  %116 = load ptr, ptr %8, align 8, !tbaa !9
  %117 = load i32, ptr %11, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds double, ptr %116, i64 %118
  %120 = load double, ptr %119, align 8, !tbaa !11
  %121 = load ptr, ptr %7, align 8, !tbaa !9
  %122 = load double, ptr %121, align 8, !tbaa !11
  %123 = fdiv double %120, %122
  %124 = load ptr, ptr %8, align 8, !tbaa !9
  %125 = load i32, ptr %11, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds double, ptr %124, i64 %126
  store double %123, ptr %127, align 8, !tbaa !11
  br label %128

128:                                              ; preds = %115
  %129 = load i32, ptr %11, align 4, !tbaa !5
  %130 = add nsw i32 %129, 1
  store i32 %130, ptr %11, align 4, !tbaa !5
  br label %111, !llvm.loop !16

131:                                              ; preds = %111
  br label %132

132:                                              ; preds = %131, %102
  %133 = load i32, ptr %12, align 4, !tbaa !5
  %134 = load i32, ptr %14, align 4, !tbaa !5
  %135 = sdiv i32 %134, 2
  %136 = icmp slt i32 %133, %135
  br i1 %136, label %137, label %183

137:                                              ; preds = %132
  %138 = load i32, ptr %12, align 4, !tbaa !5
  %139 = sub nsw i32 %138, 1
  %140 = load i32, ptr %5, align 4, !tbaa !5
  %141 = srem i32 %139, %140
  store i32 %141, ptr %16, align 4, !tbaa !5
  %142 = load ptr, ptr %8, align 8, !tbaa !9
  %143 = load i32, ptr %16, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds double, ptr %142, i64 %144
  %146 = load double, ptr %145, align 8, !tbaa !11
  %147 = load double, ptr %10, align 8, !tbaa !11
  %148 = load ptr, ptr %8, align 8, !tbaa !9
  %149 = load i32, ptr %16, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds double, ptr %148, i64 %150
  %152 = load double, ptr %151, align 8, !tbaa !11
  %153 = call double @llvm.fabs.f64(double %152)
  %154 = fadd double 1.000000e+00, %153
  %155 = call double @llvm.fmuladd.f64(double %147, double %154, double %146)
  %156 = load ptr, ptr %8, align 8, !tbaa !9
  %157 = load i32, ptr %16, align 4, !tbaa !5
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds double, ptr %156, i64 %158
  store double %155, ptr %159, align 8, !tbaa !11
  %160 = load i32, ptr %5, align 4, !tbaa !5
  %161 = load ptr, ptr %8, align 8, !tbaa !9
  %162 = call double @r8vec_norm(i32 noundef %160, ptr noundef %161)
  store double %162, ptr %17, align 8, !tbaa !11
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %163

163:                                              ; preds = %179, %137
  %164 = load i32, ptr %11, align 4, !tbaa !5
  %165 = load i32, ptr %5, align 4, !tbaa !5
  %166 = icmp slt i32 %164, %165
  br i1 %166, label %167, label %182

167:                                              ; preds = %163
  %168 = load ptr, ptr %8, align 8, !tbaa !9
  %169 = load i32, ptr %11, align 4, !tbaa !5
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds double, ptr %168, i64 %170
  %172 = load double, ptr %171, align 8, !tbaa !11
  %173 = load double, ptr %17, align 8, !tbaa !11
  %174 = fdiv double %172, %173
  %175 = load ptr, ptr %8, align 8, !tbaa !9
  %176 = load i32, ptr %11, align 4, !tbaa !5
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds double, ptr %175, i64 %177
  store double %174, ptr %178, align 8, !tbaa !11
  br label %179

179:                                              ; preds = %167
  %180 = load i32, ptr %11, align 4, !tbaa !5
  %181 = add nsw i32 %180, 1
  store i32 %181, ptr %11, align 4, !tbaa !5
  br label %163, !llvm.loop !17

182:                                              ; preds = %163
  br label %183

183:                                              ; preds = %182, %132
  br label %184

184:                                              ; preds = %183
  %185 = load i32, ptr %12, align 4, !tbaa !5
  %186 = add nsw i32 %185, 1
  store i32 %186, ptr %12, align 4, !tbaa !5
  br label %68, !llvm.loop !18

187:                                              ; preds = %100, %68
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local double @r8vec_norm(i32 noundef, ptr noundef) #3

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

!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}


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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local double @r8_epsilon() local_unnamed_addr #2

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @r8vec_copy(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local ptr @r8mat_mv_new(i32 noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @r8mat_power_method(i32 noundef %0, ptr noundef %1, ptr nocapture noundef %2, ptr noundef %3) local_unnamed_addr #2 {
  %5 = tail call double @r8_epsilon()
  %6 = tail call double @sqrt(double noundef %5) #4
  %7 = tail call double @r8vec_norm(i32 noundef %0, ptr noundef %3)
  store double %7, ptr %2, align 8, !tbaa !5
  %8 = fcmp oeq double %7, 0.000000e+00
  br i1 %8, label %.preheader74, label %16

.preheader74:                                     ; preds = %4
  %9 = icmp sgt i32 %0, 0
  br i1 %9, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.preheader74
  %wide.trip.count = zext nneg i32 %0 to i64
  %min.iters.check = icmp ult i32 %0, 4
  br i1 %min.iters.check, label %.lr.ph.preheader152, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %wide.trip.count, 2147483644
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %10 = getelementptr inbounds double, ptr %3, i64 %index
  %11 = getelementptr inbounds i8, ptr %10, i64 16
  store <2 x double> <double 1.000000e+00, double 1.000000e+00>, ptr %10, align 8, !tbaa !5
  store <2 x double> <double 1.000000e+00, double 1.000000e+00>, ptr %11, align 8, !tbaa !5
  %index.next = add nuw i64 %index, 4
  %12 = icmp eq i64 %index.next, %n.vec
  br i1 %12, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader152

.lr.ph.preheader152:                              ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader152, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader152 ]
  %13 = getelementptr inbounds double, ptr %3, i64 %indvars.iv
  store double 1.000000e+00, ptr %13, align 8, !tbaa !5
  %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 %._crit_edge, label %.lr.ph, !llvm.loop !13

._crit_edge:                                      ; preds = %.lr.ph, %middle.block, %.preheader74
  %14 = sitofp i32 %0 to double
  %15 = tail call double @sqrt(double noundef %14) #4
  store double %15, ptr %2, align 8, !tbaa !5
  br label %16

16:                                               ; preds = %._crit_edge, %4
  %17 = icmp sgt i32 %0, 0
  br i1 %17, label %.lr.ph78.preheader, label %.preheader73

.lr.ph78.preheader:                               ; preds = %16
  %wide.trip.count90 = zext nneg i32 %0 to i64
  %min.iters.check106 = icmp eq i32 %0, 1
  br i1 %min.iters.check106, label %.lr.ph78.preheader151, label %vector.memcheck

.lr.ph78.preheader151:                            ; preds = %middle.block104, %vector.memcheck, %.lr.ph78.preheader
  %indvars.iv87.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %.lr.ph78.preheader ], [ %n.vec109, %middle.block104 ]
  %18 = sub nsw i64 %wide.trip.count90, %indvars.iv87.ph
  %xtraiter = and i64 %18, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph78.prol.loopexit, label %.lr.ph78.prol

.lr.ph78.prol:                                    ; preds = %.lr.ph78.preheader151, %.lr.ph78.prol
  %indvars.iv87.prol = phi i64 [ %indvars.iv.next88.prol, %.lr.ph78.prol ], [ %indvars.iv87.ph, %.lr.ph78.preheader151 ]
  %prol.iter = phi i64 [ %prol.iter.next, %.lr.ph78.prol ], [ 0, %.lr.ph78.preheader151 ]
  %19 = getelementptr inbounds double, ptr %3, i64 %indvars.iv87.prol
  %20 = load double, ptr %19, align 8, !tbaa !5
  %21 = load double, ptr %2, align 8, !tbaa !5
  %22 = fdiv double %20, %21
  store double %22, ptr %19, align 8, !tbaa !5
  %indvars.iv.next88.prol = add nuw nsw i64 %indvars.iv87.prol, 1
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %.lr.ph78.prol.loopexit, label %.lr.ph78.prol, !llvm.loop !14

.lr.ph78.prol.loopexit:                           ; preds = %.lr.ph78.prol, %.lr.ph78.preheader151
  %indvars.iv87.unr = phi i64 [ %indvars.iv87.ph, %.lr.ph78.preheader151 ], [ %indvars.iv.next88.prol, %.lr.ph78.prol ]
  %23 = sub nsw i64 %indvars.iv87.ph, %wide.trip.count90
  %24 = icmp ugt i64 %23, -4
  br i1 %24, label %.preheader73, label %.lr.ph78.preheader151.new

.lr.ph78.preheader151.new:                        ; preds = %.lr.ph78.prol.loopexit
  %invariant.gep = getelementptr i8, ptr %3, i64 8
  %invariant.gep156 = getelementptr i8, ptr %3, i64 16
  %invariant.gep158 = getelementptr i8, ptr %3, i64 24
  br label %.lr.ph78

vector.memcheck:                                  ; preds = %.lr.ph78.preheader
  %25 = shl nuw nsw i64 %wide.trip.count90, 3
  %scevgep = getelementptr i8, ptr %3, i64 %25
  %scevgep103 = getelementptr i8, ptr %2, i64 8
  %bound0 = icmp ugt ptr %scevgep103, %3
  %bound1 = icmp ugt ptr %scevgep, %2
  %found.conflict = and i1 %bound0, %bound1
  br i1 %found.conflict, label %.lr.ph78.preheader151, label %vector.ph107

vector.ph107:                                     ; preds = %vector.memcheck
  %n.vec109 = and i64 %wide.trip.count90, 2147483646
  %26 = load double, ptr %2, align 8, !tbaa !5, !alias.scope !16
  %broadcast.splatinsert = insertelement <2 x double> poison, double %26, i64 0
  %broadcast.splat = shufflevector <2 x double> %broadcast.splatinsert, <2 x double> poison, <2 x i32> zeroinitializer
  br label %vector.body111

vector.body111:                                   ; preds = %vector.body111, %vector.ph107
  %index112 = phi i64 [ 0, %vector.ph107 ], [ %index.next113, %vector.body111 ]
  %27 = getelementptr inbounds double, ptr %3, i64 %index112
  %wide.load = load <2 x double>, ptr %27, align 8, !tbaa !5, !alias.scope !19, !noalias !16
  %28 = fdiv <2 x double> %wide.load, %broadcast.splat
  store <2 x double> %28, ptr %27, align 8, !tbaa !5, !alias.scope !19, !noalias !16
  %index.next113 = add nuw i64 %index112, 2
  %29 = icmp eq i64 %index.next113, %n.vec109
  br i1 %29, label %middle.block104, label %vector.body111, !llvm.loop !21

middle.block104:                                  ; preds = %vector.body111
  %cmp.n114 = icmp eq i64 %n.vec109, %wide.trip.count90
  br i1 %cmp.n114, label %.preheader73, label %.lr.ph78.preheader151

.preheader73:                                     ; preds = %.lr.ph78.prol.loopexit, %.lr.ph78, %middle.block104, %16
  %30 = icmp slt i32 %0, 1
  %wide.trip.count95 = zext i32 %0 to i64
  %wide.trip.count100 = zext nneg i32 %0 to i64
  %31 = shl nuw nsw i64 %wide.trip.count95, 3
  %scevgep130 = getelementptr i8, ptr %3, i64 %31
  %scevgep131 = getelementptr i8, ptr %2, i64 8
  %min.iters.check137 = icmp ult i32 %0, 2
  %bound0132 = icmp ugt ptr %scevgep131, %3
  %bound1133 = icmp ugt ptr %scevgep130, %2
  %found.conflict134 = and i1 %bound0132, %bound1133
  %n.vec140 = and i64 %wide.trip.count95, 2147483646
  %cmp.n148 = icmp eq i64 %n.vec140, %wide.trip.count95
  %invariant.gep160 = getelementptr i8, ptr %3, i64 8
  %invariant.gep162 = getelementptr i8, ptr %3, i64 16
  %invariant.gep164 = getelementptr i8, ptr %3, i64 24
  %min.iters.check117 = icmp eq i32 %0, 1
  %n.vec120 = and i64 %wide.trip.count95, 2147483646
  %cmp.n128 = icmp eq i64 %n.vec120, %wide.trip.count95
  br label %45

.lr.ph78:                                         ; preds = %.lr.ph78, %.lr.ph78.preheader151.new
  %indvars.iv87 = phi i64 [ %indvars.iv87.unr, %.lr.ph78.preheader151.new ], [ %indvars.iv.next88.3, %.lr.ph78 ]
  %32 = getelementptr inbounds double, ptr %3, i64 %indvars.iv87
  %33 = load double, ptr %32, align 8, !tbaa !5
  %34 = load double, ptr %2, align 8, !tbaa !5
  %35 = fdiv double %33, %34
  store double %35, ptr %32, align 8, !tbaa !5
  %gep = getelementptr double, ptr %invariant.gep, i64 %indvars.iv87
  %36 = load double, ptr %gep, align 8, !tbaa !5
  %37 = load double, ptr %2, align 8, !tbaa !5
  %38 = fdiv double %36, %37
  store double %38, ptr %gep, align 8, !tbaa !5
  %gep157 = getelementptr double, ptr %invariant.gep156, i64 %indvars.iv87
  %39 = load double, ptr %gep157, align 8, !tbaa !5
  %40 = load double, ptr %2, align 8, !tbaa !5
  %41 = fdiv double %39, %40
  store double %41, ptr %gep157, align 8, !tbaa !5
  %gep159 = getelementptr double, ptr %invariant.gep158, i64 %indvars.iv87
  %42 = load double, ptr %gep159, align 8, !tbaa !5
  %43 = load double, ptr %2, align 8, !tbaa !5
  %44 = fdiv double %42, %43
  store double %44, ptr %gep159, align 8, !tbaa !5
  %indvars.iv.next88.3 = add nuw nsw i64 %indvars.iv87, 4
  %exitcond91.not.3 = icmp eq i64 %indvars.iv.next88.3, %wide.trip.count90
  br i1 %exitcond91.not.3, label %.preheader73, label %.lr.ph78, !llvm.loop !22

45:                                               ; preds = %.preheader73, %.loopexit
  %.06984 = phi i32 [ 1, %.preheader73 ], [ %101, %.loopexit ]
  %46 = tail call ptr @r8mat_mv_new(i32 noundef %0, i32 noundef %0, ptr noundef %1, ptr noundef %3)
  %47 = load double, ptr %2, align 8, !tbaa !5
  %48 = tail call double @r8vec_norm(i32 noundef %0, ptr noundef %46)
  store double %48, ptr %2, align 8, !tbaa !5
  %49 = icmp ugt i32 %.06984, 10
  br i1 %49, label %50, label %57

50:                                               ; preds = %45
  %51 = fsub double %48, %47
  %52 = tail call double @llvm.fabs.f64(double %51)
  %53 = tail call double @llvm.fabs.f64(double %48)
  %54 = fadd double %53, 1.000000e+00
  %55 = fmul double %54, 1.000000e-04
  %56 = fcmp ugt double %52, %55
  br i1 %56, label %57, label %102

57:                                               ; preds = %50, %45
  tail call void @r8vec_copy(i32 noundef %0, ptr noundef %46, ptr noundef %3)
  tail call void @free(ptr noundef %46) #4
  %58 = load double, ptr %2, align 8, !tbaa !5
  %59 = fcmp oeq double %58, 0.000000e+00
  %brmerge = or i1 %59, %30
  br i1 %brmerge, label %.loopexit72, label %.lr.ph80.preheader

.lr.ph80.preheader:                               ; preds = %57
  %brmerge166 = select i1 %min.iters.check137, i1 true, i1 %found.conflict134
  br i1 %brmerge166, label %.lr.ph80.preheader150, label %vector.ph138

vector.ph138:                                     ; preds = %.lr.ph80.preheader
  %60 = load double, ptr %2, align 8, !tbaa !5, !alias.scope !23
  %broadcast.splatinsert145 = insertelement <2 x double> poison, double %60, i64 0
  %broadcast.splat146 = shufflevector <2 x double> %broadcast.splatinsert145, <2 x double> poison, <2 x i32> zeroinitializer
  br label %vector.body142

vector.body142:                                   ; preds = %vector.body142, %vector.ph138
  %index143 = phi i64 [ 0, %vector.ph138 ], [ %index.next147, %vector.body142 ]
  %61 = getelementptr inbounds double, ptr %3, i64 %index143
  %wide.load144 = load <2 x double>, ptr %61, align 8, !tbaa !5, !alias.scope !26, !noalias !23
  %62 = fdiv <2 x double> %wide.load144, %broadcast.splat146
  store <2 x double> %62, ptr %61, align 8, !tbaa !5, !alias.scope !26, !noalias !23
  %index.next147 = add nuw i64 %index143, 2
  %63 = icmp eq i64 %index.next147, %n.vec140
  br i1 %63, label %middle.block135, label %vector.body142, !llvm.loop !28

middle.block135:                                  ; preds = %vector.body142
  br i1 %cmp.n148, label %.loopexit72, label %.lr.ph80.preheader150

.lr.ph80.preheader150:                            ; preds = %.lr.ph80.preheader, %middle.block135
  %indvars.iv92.ph = phi i64 [ 0, %.lr.ph80.preheader ], [ %n.vec140, %middle.block135 ]
  %64 = sub nsw i64 %wide.trip.count95, %indvars.iv92.ph
  %xtraiter153 = and i64 %64, 3
  %lcmp.mod154.not = icmp eq i64 %xtraiter153, 0
  br i1 %lcmp.mod154.not, label %.lr.ph80.prol.loopexit, label %.lr.ph80.prol

.lr.ph80.prol:                                    ; preds = %.lr.ph80.preheader150, %.lr.ph80.prol
  %indvars.iv92.prol = phi i64 [ %indvars.iv.next93.prol, %.lr.ph80.prol ], [ %indvars.iv92.ph, %.lr.ph80.preheader150 ]
  %prol.iter155 = phi i64 [ %prol.iter155.next, %.lr.ph80.prol ], [ 0, %.lr.ph80.preheader150 ]
  %65 = getelementptr inbounds double, ptr %3, i64 %indvars.iv92.prol
  %66 = load double, ptr %65, align 8, !tbaa !5
  %67 = load double, ptr %2, align 8, !tbaa !5
  %68 = fdiv double %66, %67
  store double %68, ptr %65, align 8, !tbaa !5
  %indvars.iv.next93.prol = add nuw nsw i64 %indvars.iv92.prol, 1
  %prol.iter155.next = add i64 %prol.iter155, 1
  %prol.iter155.cmp.not = icmp eq i64 %prol.iter155.next, %xtraiter153
  br i1 %prol.iter155.cmp.not, label %.lr.ph80.prol.loopexit, label %.lr.ph80.prol, !llvm.loop !29

.lr.ph80.prol.loopexit:                           ; preds = %.lr.ph80.prol, %.lr.ph80.preheader150
  %indvars.iv92.unr = phi i64 [ %indvars.iv92.ph, %.lr.ph80.preheader150 ], [ %indvars.iv.next93.prol, %.lr.ph80.prol ]
  %69 = sub nsw i64 %indvars.iv92.ph, %wide.trip.count95
  %70 = icmp ugt i64 %69, -4
  br i1 %70, label %.loopexit72, label %.lr.ph80

.lr.ph80:                                         ; preds = %.lr.ph80.prol.loopexit, %.lr.ph80
  %indvars.iv92 = phi i64 [ %indvars.iv.next93.3, %.lr.ph80 ], [ %indvars.iv92.unr, %.lr.ph80.prol.loopexit ]
  %71 = getelementptr inbounds double, ptr %3, i64 %indvars.iv92
  %72 = load double, ptr %71, align 8, !tbaa !5
  %73 = load double, ptr %2, align 8, !tbaa !5
  %74 = fdiv double %72, %73
  store double %74, ptr %71, align 8, !tbaa !5
  %gep161 = getelementptr double, ptr %invariant.gep160, i64 %indvars.iv92
  %75 = load double, ptr %gep161, align 8, !tbaa !5
  %76 = load double, ptr %2, align 8, !tbaa !5
  %77 = fdiv double %75, %76
  store double %77, ptr %gep161, align 8, !tbaa !5
  %gep163 = getelementptr double, ptr %invariant.gep162, i64 %indvars.iv92
  %78 = load double, ptr %gep163, align 8, !tbaa !5
  %79 = load double, ptr %2, align 8, !tbaa !5
  %80 = fdiv double %78, %79
  store double %80, ptr %gep163, align 8, !tbaa !5
  %gep165 = getelementptr double, ptr %invariant.gep164, i64 %indvars.iv92
  %81 = load double, ptr %gep165, align 8, !tbaa !5
  %82 = load double, ptr %2, align 8, !tbaa !5
  %83 = fdiv double %81, %82
  store double %83, ptr %gep165, align 8, !tbaa !5
  %indvars.iv.next93.3 = add nuw nsw i64 %indvars.iv92, 4
  %exitcond96.not.3 = icmp eq i64 %indvars.iv.next93.3, %wide.trip.count95
  br i1 %exitcond96.not.3, label %.loopexit72, label %.lr.ph80, !llvm.loop !30

.loopexit72:                                      ; preds = %.lr.ph80.prol.loopexit, %.lr.ph80, %middle.block135, %57
  %84 = icmp ult i32 %.06984, 50
  br i1 %84, label %85, label %.loopexit

85:                                               ; preds = %.loopexit72
  %86 = add nsw i32 %.06984, -1
  %87 = srem i32 %86, %0
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds double, ptr %3, i64 %88
  %90 = load double, ptr %89, align 8, !tbaa !5
  %91 = tail call double @llvm.fabs.f64(double %90)
  %92 = fadd double %91, 1.000000e+00
  %93 = tail call double @llvm.fmuladd.f64(double %6, double %92, double %90)
  store double %93, ptr %89, align 8, !tbaa !5
  %94 = tail call double @r8vec_norm(i32 noundef %0, ptr noundef %3)
  br i1 %17, label %.lr.ph83.preheader, label %.loopexit

.lr.ph83.preheader:                               ; preds = %85
  br i1 %min.iters.check117, label %.lr.ph83.preheader149, label %vector.ph118

vector.ph118:                                     ; preds = %.lr.ph83.preheader
  %broadcast.splatinsert125 = insertelement <2 x double> poison, double %94, i64 0
  %broadcast.splat126 = shufflevector <2 x double> %broadcast.splatinsert125, <2 x double> poison, <2 x i32> zeroinitializer
  br label %vector.body122

vector.body122:                                   ; preds = %vector.body122, %vector.ph118
  %index123 = phi i64 [ 0, %vector.ph118 ], [ %index.next127, %vector.body122 ]
  %95 = getelementptr inbounds double, ptr %3, i64 %index123
  %wide.load124 = load <2 x double>, ptr %95, align 8, !tbaa !5
  %96 = fdiv <2 x double> %wide.load124, %broadcast.splat126
  store <2 x double> %96, ptr %95, align 8, !tbaa !5
  %index.next127 = add nuw i64 %index123, 2
  %97 = icmp eq i64 %index.next127, %n.vec120
  br i1 %97, label %middle.block115, label %vector.body122, !llvm.loop !31

middle.block115:                                  ; preds = %vector.body122
  br i1 %cmp.n128, label %.loopexit, label %.lr.ph83.preheader149

.lr.ph83.preheader149:                            ; preds = %middle.block115, %.lr.ph83.preheader
  %indvars.iv97.ph = phi i64 [ 0, %.lr.ph83.preheader ], [ %n.vec120, %middle.block115 ]
  br label %.lr.ph83

.lr.ph83:                                         ; preds = %.lr.ph83.preheader149, %.lr.ph83
  %indvars.iv97 = phi i64 [ %indvars.iv.next98, %.lr.ph83 ], [ %indvars.iv97.ph, %.lr.ph83.preheader149 ]
  %98 = getelementptr inbounds double, ptr %3, i64 %indvars.iv97
  %99 = load double, ptr %98, align 8, !tbaa !5
  %100 = fdiv double %99, %94
  store double %100, ptr %98, align 8, !tbaa !5
  %indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1
  %exitcond101.not = icmp eq i64 %indvars.iv.next98, %wide.trip.count100
  br i1 %exitcond101.not, label %.loopexit, label %.lr.ph83, !llvm.loop !32

.loopexit:                                        ; preds = %.lr.ph83, %middle.block115, %85, %.loopexit72
  %101 = add nuw nsw i32 %.06984, 1
  %exitcond102.not = icmp eq i32 %101, 101
  br i1 %exitcond102.not, label %102, label %45, !llvm.loop !33

102:                                              ; preds = %50, %.loopexit
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local double @r8vec_norm(i32 noundef, ptr noundef) local_unnamed_addr #2

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

!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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = !{!17}
!17 = distinct !{!17, !18}
!18 = distinct !{!18, !"LVerDomain"}
!19 = !{!20}
!20 = distinct !{!20, !18}
!21 = distinct !{!21, !10, !11, !12}
!22 = distinct !{!22, !10, !11}
!23 = !{!24}
!24 = distinct !{!24, !25}
!25 = distinct !{!25, !"LVerDomain"}
!26 = !{!27}
!27 = distinct !{!27, !25}
!28 = distinct !{!28, !10, !11, !12}
!29 = distinct !{!29, !15}
!30 = distinct !{!30, !10, !11}
!31 = distinct !{!31, !10, !11, !12}
!32 = distinct !{!32, !10, !12, !11}
!33 = distinct !{!33, !10}


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