; LLVM IR from bonamarton/phys_num :: multi_dim_fitt (multiDimFitt)

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

%struct.tensor = type { ptr, i32, i32, ptr }

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

; Function Attrs: nounwind uwtable
declare dso_local void @init_tensor(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @makeIdxSequence(ptr dead_on_unwind noalias writable sret(%struct.tensor) align 8 %0, i32 noundef %1, i32 noundef %2) #1 {
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store i32 %1, ptr %4, align 4, !tbaa !5
  store i32 %2, ptr %5, align 4, !tbaa !5
  call void @init_tensor(ptr noundef %0)
  %14 = load i32, ptr %4, align 4, !tbaa !5
  %15 = getelementptr inbounds %struct.tensor, ptr %0, i32 0, i32 2
  store i32 %14, ptr %15, align 4, !tbaa !9
  %16 = load i32, ptr %5, align 4, !tbaa !5
  %17 = load i32, ptr %4, align 4, !tbaa !5
  %18 = add nsw i32 %16, %17
  %19 = call i32 @factor(i32 noundef %18)
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = call i32 @factor(i32 noundef %20)
  %22 = load i32, ptr %5, align 4, !tbaa !5
  %23 = call i32 @factor(i32 noundef %22)
  %24 = mul nsw i32 %21, %23
  %25 = sdiv i32 %19, %24
  %26 = getelementptr inbounds %struct.tensor, ptr %0, i32 0, i32 1
  store i32 %25, ptr %26, align 8, !tbaa !12
  %27 = getelementptr inbounds %struct.tensor, ptr %0, i32 0, i32 1
  %28 = load i32, ptr %27, align 8, !tbaa !12
  %29 = getelementptr inbounds %struct.tensor, ptr %0, i32 0, i32 2
  %30 = load i32, ptr %29, align 4, !tbaa !9
  %31 = mul nsw i32 %28, %30
  %32 = sext i32 %31 to i64
  %33 = mul i64 %32, 8
  %34 = call noalias ptr @malloc(i64 noundef %33) #6
  %35 = getelementptr inbounds %struct.tensor, ptr %0, i32 0, i32 0
  store ptr %34, ptr %35, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %36 = getelementptr inbounds %struct.tensor, ptr %0, i32 0, i32 2
  %37 = load i32, ptr %36, align 4, !tbaa !9
  %38 = sext i32 %37 to i64
  %39 = call noalias ptr @calloc(i64 noundef %38, i64 noundef 4) #8
  store ptr %39, ptr %6, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %40 = load i32, ptr %5, align 4, !tbaa !5
  %41 = add nsw i32 %40, 1
  %42 = sitofp i32 %41 to double
  %43 = load i32, ptr %4, align 4, !tbaa !5
  %44 = sitofp i32 %43 to double
  %45 = call double @pow(double noundef %42, double noundef %44) #7
  %46 = call double @llvm.round.f64(double %45)
  %47 = fptosi double %46 to i32
  store i32 %47, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 0, ptr %13, align 4, !tbaa !5
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %48

48:                                               ; preds = %58, %3
  %49 = load i32, ptr %8, align 4, !tbaa !5
  %50 = load i32, ptr %4, align 4, !tbaa !5
  %51 = icmp slt i32 %49, %50
  br i1 %51, label %52, label %61

52:                                               ; preds = %48
  %53 = getelementptr inbounds %struct.tensor, ptr %0, i32 0, i32 0
  %54 = load ptr, ptr %53, align 8, !tbaa !13
  %55 = load i32, ptr %8, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds double, ptr %54, i64 %56
  store double 0.000000e+00, ptr %57, align 8, !tbaa !15
  br label %58

58:                                               ; preds = %52
  %59 = load i32, ptr %8, align 4, !tbaa !5
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %8, align 4, !tbaa !5
  br label %48, !llvm.loop !17

61:                                               ; preds = %48
  %62 = load i32, ptr %11, align 4, !tbaa !5
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %11, align 4, !tbaa !5
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %64

64:                                               ; preds = %150, %61
  %65 = load i32, ptr %7, align 4, !tbaa !5
  %66 = load i32, ptr %9, align 4, !tbaa !5
  %67 = sub nsw i32 %66, 1
  %68 = icmp slt i32 %65, %67
  br i1 %68, label %69, label %153

69:                                               ; preds = %64
  store i32 0, ptr %10, align 4, !tbaa !5
  store i32 0, ptr %12, align 4, !tbaa !5
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %70

70:                                               ; preds = %101, %69
  %71 = load i32, ptr %13, align 4, !tbaa !5
  %72 = icmp eq i32 %71, 0
  br i1 %72, label %73, label %77

73:                                               ; preds = %70
  %74 = load i32, ptr %10, align 4, !tbaa !5
  %75 = load i32, ptr %4, align 4, !tbaa !5
  %76 = icmp slt i32 %74, %75
  br label %77

77:                                               ; preds = %73, %70
  %78 = phi i1 [ false, %70 ], [ %76, %73 ]
  br i1 %78, label %79, label %102

79:                                               ; preds = %77
  %80 = load ptr, ptr %6, align 8, !tbaa !14
  %81 = load i32, ptr %10, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds i32, ptr %80, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = load i32, ptr %5, align 4, !tbaa !5
  %86 = icmp slt i32 %84, %85
  br i1 %86, label %87, label %94

87:                                               ; preds = %79
  %88 = load ptr, ptr %6, align 8, !tbaa !14
  %89 = load i32, ptr %10, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds i32, ptr %88, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %91, align 4, !tbaa !5
  store i32 1, ptr %13, align 4, !tbaa !5
  br label %101

94:                                               ; preds = %79
  %95 = load ptr, ptr %6, align 8, !tbaa !14
  %96 = load i32, ptr %10, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds i32, ptr %95, i64 %97
  store i32 0, ptr %98, align 4, !tbaa !5
  %99 = load i32, ptr %10, align 4, !tbaa !5
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr %10, align 4, !tbaa !5
  br label %101

101:                                              ; preds = %94, %87
  br label %70, !llvm.loop !19

102:                                              ; preds = %77
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %103

103:                                              ; preds = %115, %102
  %104 = load i32, ptr %8, align 4, !tbaa !5
  %105 = load i32, ptr %4, align 4, !tbaa !5
  %106 = icmp slt i32 %104, %105
  br i1 %106, label %107, label %118

107:                                              ; preds = %103
  %108 = load ptr, ptr %6, align 8, !tbaa !14
  %109 = load i32, ptr %8, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds i32, ptr %108, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !5
  %113 = load i32, ptr %12, align 4, !tbaa !5
  %114 = add nsw i32 %113, %112
  store i32 %114, ptr %12, align 4, !tbaa !5
  br label %115

115:                                              ; preds = %107
  %116 = load i32, ptr %8, align 4, !tbaa !5
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %8, align 4, !tbaa !5
  br label %103, !llvm.loop !20

118:                                              ; preds = %103
  %119 = load i32, ptr %12, align 4, !tbaa !5
  %120 = load i32, ptr %5, align 4, !tbaa !5
  %121 = icmp sle i32 %119, %120
  br i1 %121, label %122, label %149

122:                                              ; preds = %118
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %123

123:                                              ; preds = %143, %122
  %124 = load i32, ptr %8, align 4, !tbaa !5
  %125 = load i32, ptr %4, align 4, !tbaa !5
  %126 = icmp slt i32 %124, %125
  br i1 %126, label %127, label %146

127:                                              ; preds = %123
  %128 = load ptr, ptr %6, align 8, !tbaa !14
  %129 = load i32, ptr %8, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds i32, ptr %128, i64 %130
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = sitofp i32 %132 to double
  %134 = getelementptr inbounds %struct.tensor, ptr %0, i32 0, i32 0
  %135 = load ptr, ptr %134, align 8, !tbaa !13
  %136 = load i32, ptr %11, align 4, !tbaa !5
  %137 = load i32, ptr %4, align 4, !tbaa !5
  %138 = mul nsw i32 %136, %137
  %139 = load i32, ptr %8, align 4, !tbaa !5
  %140 = add nsw i32 %138, %139
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds double, ptr %135, i64 %141
  store double %133, ptr %142, align 8, !tbaa !15
  br label %143

143:                                              ; preds = %127
  %144 = load i32, ptr %8, align 4, !tbaa !5
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %8, align 4, !tbaa !5
  br label %123, !llvm.loop !21

146:                                              ; preds = %123
  %147 = load i32, ptr %11, align 4, !tbaa !5
  %148 = add nsw i32 %147, 1
  store i32 %148, ptr %11, align 4, !tbaa !5
  br label %149

149:                                              ; preds = %146, %118
  br label %150

150:                                              ; preds = %149
  %151 = load i32, ptr %7, align 4, !tbaa !5
  %152 = add nsw i32 %151, 1
  store i32 %152, ptr %7, align 4, !tbaa !5
  br label %64, !llvm.loop !22

153:                                              ; preds = %64
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  ret void
}

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

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #2

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local i32 @factor(i32 noundef) #1

; Function Attrs: nounwind
declare double @pow(double noundef, double noundef) #4

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

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

!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, !6, i64 12}
!10 = !{!"tensor", !11, i64 0, !6, i64 8, !6, i64 12, !11, i64 16}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!10, !6, i64 8}
!13 = !{!10, !11, i64 0}
!14 = !{!11, !11, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"double", !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = distinct !{!20, !18}
!21 = distinct !{!21, !18}
!22 = distinct !{!22, !18}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.tensor = type { ptr, i32, i32, ptr }

; Function Attrs: nounwind uwtable
declare dso_local void @init_tensor(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @makeIdxSequence(ptr dead_on_unwind noalias writable sret(%struct.tensor) align 8 %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  tail call void @init_tensor(ptr noundef %0)
  %4 = getelementptr inbounds i8, ptr %0, i64 12
  store i32 %1, ptr %4, align 4, !tbaa !5
  %5 = add nsw i32 %2, %1
  %6 = tail call i32 @factor(i32 noundef %5)
  %7 = tail call i32 @factor(i32 noundef %1)
  %8 = tail call i32 @factor(i32 noundef %2)
  %9 = mul nsw i32 %8, %7
  %10 = sdiv i32 %6, %9
  %11 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %10, ptr %11, align 8, !tbaa !11
  %12 = load i32, ptr %4, align 4, !tbaa !5
  %13 = mul nsw i32 %12, %10
  %14 = sext i32 %13 to i64
  %15 = shl nsw i64 %14, 3
  %16 = tail call noalias ptr @malloc(i64 noundef %15) #7
  store ptr %16, ptr %0, align 8, !tbaa !12
  %17 = sext i32 %12 to i64
  %18 = tail call noalias ptr @calloc(i64 noundef %17, i64 noundef 4) #8
  %19 = add nsw i32 %2, 1
  %20 = sitofp i32 %19 to double
  %21 = sitofp i32 %1 to double
  %22 = tail call double @pow(double noundef %20, double noundef %21) #9
  %23 = tail call double @llvm.round.f64(double %22)
  %24 = fptosi double %23 to i32
  %25 = icmp sgt i32 %1, 0
  br i1 %25, label %.preheader54, label %._crit_edge66

.preheader54:                                     ; preds = %3
  %26 = load ptr, ptr %0, align 8, !tbaa !12
  %27 = zext nneg i32 %1 to i64
  %28 = shl nuw nsw i64 %27, 3
  tail call void @llvm.memset.p0.i64(ptr align 8 %26, i8 0, i64 %28, i1 false), !tbaa !13
  %29 = icmp sgt i32 %24, 1
  br i1 %29, label %.preheader53.us.preheader, label %._crit_edge66

.preheader53.us.preheader:                        ; preds = %.preheader54
  %30 = load ptr, ptr %0, align 8
  %wide.trip.count = zext nneg i32 %1 to i64
  %wide.trip.count105 = zext nneg i32 %1 to i64
  %31 = add nsw i32 %24, -2
  %min.iters.check121 = icmp ult i32 %1, 8
  %n.vec124 = and i64 %wide.trip.count, 2147483640
  %cmp.n132 = icmp eq i64 %n.vec124, %wide.trip.count
  %min.iters.check = icmp ult i32 %1, 4
  %n.vec = and i64 %wide.trip.count, 2147483644
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br label %.preheader53.us

.preheader53.us:                                  ; preds = %.preheader53.us.preheader, %36
  %.04365.us = phi i32 [ %.144.us, %36 ], [ 1, %.preheader53.us.preheader ]
  %.04764.us = phi i32 [ %37, %36 ], [ 0, %.preheader53.us.preheader ]
  br label %41

._crit_edge.us:                                   ; preds = %.lr.ph60.us, %middle.block119
  %.lcssa117 = phi i32 [ %54, %middle.block119 ], [ %40, %.lr.ph60.us ]
  %.not.us = icmp sgt i32 %.lcssa117, %2
  br i1 %.not.us, label %36, label %.lr.ph62.us

._crit_edge63.us:                                 ; preds = %scalar.ph, %middle.block
  %32 = add nsw i32 %.04365.us, 1
  br label %36

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv102 = phi i64 [ %indvars.iv.next103, %scalar.ph ], [ %indvars.iv102.ph, %scalar.ph.preheader ]
  %33 = getelementptr inbounds i32, ptr %18, i64 %indvars.iv102
  %34 = load i32, ptr %33, align 4, !tbaa !15
  %35 = sitofp i32 %34 to double
  %gep = getelementptr double, ptr %invariant.gep, i64 %indvars.iv102
  store double %35, ptr %gep, align 8, !tbaa !13
  %indvars.iv.next103 = add nuw nsw i64 %indvars.iv102, 1
  %exitcond106.not = icmp eq i64 %indvars.iv.next103, %wide.trip.count105
  br i1 %exitcond106.not, label %._crit_edge63.us, label %scalar.ph, !llvm.loop !16

36:                                               ; preds = %._crit_edge63.us, %._crit_edge.us
  %.144.us = phi i32 [ %32, %._crit_edge63.us ], [ %.04365.us, %._crit_edge.us ]
  %37 = add nuw nsw i32 %.04764.us, 1
  %exitcond107.not = icmp eq i32 %.04764.us, %31
  br i1 %exitcond107.not, label %._crit_edge66, label %.preheader53.us, !llvm.loop !20

.lr.ph60.us:                                      ; preds = %.lr.ph60.us.preheader133, %.lr.ph60.us
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph60.us ], [ %indvars.iv.ph, %.lr.ph60.us.preheader133 ]
  %.04259.us = phi i32 [ %40, %.lr.ph60.us ], [ %.04259.us.ph, %.lr.ph60.us.preheader133 ]
  %38 = getelementptr inbounds i32, ptr %18, i64 %indvars.iv
  %39 = load i32, ptr %38, align 4, !tbaa !15
  %40 = add nsw i32 %39, %.04259.us
  %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.us, label %.lr.ph60.us, !llvm.loop !21

41:                                               ; preds = %.preheader53.us, %46
  %.04556.us = phi i32 [ 0, %.preheader53.us ], [ %47, %46 ]
  %42 = zext nneg i32 %.04556.us to i64
  %43 = getelementptr inbounds i32, ptr %18, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !15
  %.not = icmp slt i32 %44, %2
  br i1 %.not, label %.thread, label %46

.thread:                                          ; preds = %41
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %43, align 4
  br label %.lr.ph60.us.preheader

46:                                               ; preds = %41
  %47 = add nuw nsw i32 %.04556.us, 1
  store i32 0, ptr %43, align 4
  %48 = icmp slt i32 %47, %1
  br i1 %48, label %41, label %.lr.ph60.us.preheader, !llvm.loop !22

.lr.ph60.us.preheader:                            ; preds = %46, %.thread
  br i1 %min.iters.check121, label %.lr.ph60.us.preheader133, label %vector.body126

.lr.ph60.us.preheader133:                         ; preds = %middle.block119, %.lr.ph60.us.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph60.us.preheader ], [ %n.vec124, %middle.block119 ]
  %.04259.us.ph = phi i32 [ 0, %.lr.ph60.us.preheader ], [ %54, %middle.block119 ]
  br label %.lr.ph60.us

vector.body126:                                   ; preds = %.lr.ph60.us.preheader, %vector.body126
  %index127 = phi i64 [ %index.next131, %vector.body126 ], [ 0, %.lr.ph60.us.preheader ]
  %vec.phi = phi <4 x i32> [ %51, %vector.body126 ], [ zeroinitializer, %.lr.ph60.us.preheader ]
  %vec.phi128 = phi <4 x i32> [ %52, %vector.body126 ], [ zeroinitializer, %.lr.ph60.us.preheader ]
  %49 = getelementptr inbounds i32, ptr %18, i64 %index127
  %50 = getelementptr inbounds i8, ptr %49, i64 16
  %wide.load129 = load <4 x i32>, ptr %49, align 4, !tbaa !15
  %wide.load130 = load <4 x i32>, ptr %50, align 4, !tbaa !15
  %51 = add <4 x i32> %wide.load129, %vec.phi
  %52 = add <4 x i32> %wide.load130, %vec.phi128
  %index.next131 = add nuw i64 %index127, 8
  %53 = icmp eq i64 %index.next131, %n.vec124
  br i1 %53, label %middle.block119, label %vector.body126, !llvm.loop !23

middle.block119:                                  ; preds = %vector.body126
  %bin.rdx = add <4 x i32> %52, %51
  %54 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  br i1 %cmp.n132, label %._crit_edge.us, label %.lr.ph60.us.preheader133

.lr.ph62.us:                                      ; preds = %._crit_edge.us
  %55 = mul nsw i32 %.04365.us, %1
  %56 = sext i32 %55 to i64
  %invariant.gep = getelementptr double, ptr %30, i64 %56
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.body

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph62.us
  %indvars.iv102.ph = phi i64 [ 0, %.lr.ph62.us ], [ %n.vec, %middle.block ]
  br label %scalar.ph

vector.body:                                      ; preds = %.lr.ph62.us, %vector.body
  %index = phi i64 [ %index.next, %vector.body ], [ 0, %.lr.ph62.us ]
  %57 = getelementptr inbounds i32, ptr %18, i64 %index
  %58 = getelementptr inbounds i8, ptr %57, i64 8
  %wide.load = load <2 x i32>, ptr %57, align 4, !tbaa !15
  %wide.load118 = load <2 x i32>, ptr %58, align 4, !tbaa !15
  %59 = sitofp <2 x i32> %wide.load to <2 x double>
  %60 = sitofp <2 x i32> %wide.load118 to <2 x double>
  %61 = getelementptr double, ptr %invariant.gep, i64 %index
  %62 = getelementptr i8, ptr %61, i64 16
  store <2 x double> %59, ptr %61, align 8, !tbaa !13
  store <2 x double> %60, ptr %62, align 8, !tbaa !13
  %index.next = add nuw i64 %index, 4
  %63 = icmp eq i64 %index.next, %n.vec
  br i1 %63, label %middle.block, label %vector.body, !llvm.loop !24

middle.block:                                     ; preds = %vector.body
  br i1 %cmp.n, label %._crit_edge63.us, label %scalar.ph.preheader

._crit_edge66:                                    ; preds = %36, %3, %.preheader54
  ret void
}

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @factor(i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @pow(double noundef, double noundef) local_unnamed_addr #3

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #6

attributes #0 = { 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 #1 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) 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 = { 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 #3 = { 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 #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind allocsize(0) }
attributes #8 = { nounwind allocsize(0,1) }
attributes #9 = { 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, !10, i64 12}
!6 = !{!"tensor", !7, i64 0, !10, i64 8, !10, i64 12, !7, i64 16}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !10, i64 8}
!12 = !{!6, !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !8, i64 0}
!15 = !{!10, !10, i64 0}
!16 = distinct !{!16, !17, !18, !19}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!"llvm.loop.unroll.runtime.disable"}
!19 = !{!"llvm.loop.isvectorized", i32 1}
!20 = distinct !{!20, !17}
!21 = distinct !{!21, !17, !18, !19}
!22 = distinct !{!22, !17}
!23 = distinct !{!23, !17, !19, !18}
!24 = distinct !{!24, !17, !19, !18}


; Effective O3 passes: ADCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopIdiomRecognizePass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,MergedLoadStoreMotionPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass