; 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
define dso_local void @makeLinearSystem(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #1 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %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 ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.tensor, ptr %19, i32 0, i32 2
  %21 = load i32, ptr %20, align 4, !tbaa !9
  store i32 %21, ptr %9, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.tensor, ptr %22, i32 0, i32 1
  %24 = load i32, ptr %23, align 8, !tbaa !13
  store i32 %24, ptr %10, align 4, !tbaa !12
  %25 = load i32, ptr %10, align 4, !tbaa !12
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.tensor, ptr %26, i32 0, i32 2
  store i32 %25, ptr %27, align 4, !tbaa !9
  %28 = load i32, ptr %10, align 4, !tbaa !12
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.tensor, ptr %29, i32 0, i32 1
  store i32 %28, ptr %30, align 8, !tbaa !13
  %31 = load i32, ptr %10, align 4, !tbaa !12
  %32 = load i32, ptr %10, align 4, !tbaa !12
  %33 = mul nsw i32 %31, %32
  %34 = sext i32 %33 to i64
  %35 = call noalias ptr @calloc(i64 noundef %34, i64 noundef 8) #7
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.tensor, ptr %36, i32 0, i32 0
  store ptr %35, ptr %37, align 8, !tbaa !14
  %38 = load ptr, ptr %8, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.tensor, ptr %38, i32 0, i32 2
  store i32 1, ptr %39, align 4, !tbaa !9
  %40 = load i32, ptr %10, align 4, !tbaa !12
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.tensor, ptr %41, i32 0, i32 1
  store i32 %40, ptr %42, align 8, !tbaa !13
  %43 = load i32, ptr %10, align 4, !tbaa !12
  %44 = sext i32 %43 to i64
  %45 = call noalias ptr @calloc(i64 noundef %44, i64 noundef 8) #7
  %46 = load ptr, ptr %8, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.tensor, ptr %46, i32 0, i32 0
  store ptr %45, ptr %47, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %48 = load i32, ptr %10, align 4, !tbaa !12
  %49 = sext i32 %48 to i64
  %50 = mul i64 %49, 8
  %51 = call noalias ptr @malloc(i64 noundef %50) #8
  store ptr %51, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store i32 0, ptr %15, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 0, ptr %16, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  store double 0.000000e+00, ptr %17, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  store double 0.000000e+00, ptr %18, align 8, !tbaa !15
  store i32 0, ptr %14, align 4, !tbaa !12
  br label %52

52:                                               ; preds = %205, %4
  %53 = load i32, ptr %14, align 4, !tbaa !12
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.tensor, ptr %54, i32 0, i32 1
  %56 = load i32, ptr %55, align 8, !tbaa !13
  %57 = icmp slt i32 %53, %56
  br i1 %57, label %58, label %208

58:                                               ; preds = %52
  %59 = load i32, ptr %14, align 4, !tbaa !12
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.tensor, ptr %60, i32 0, i32 2
  %62 = load i32, ptr %61, align 4, !tbaa !9
  %63 = mul nsw i32 %59, %62
  store i32 %63, ptr %16, align 4, !tbaa !12
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.tensor, ptr %64, i32 0, i32 0
  %66 = load ptr, ptr %65, align 8, !tbaa !14
  %67 = load i32, ptr %16, align 4, !tbaa !12
  %68 = load i32, ptr %9, align 4, !tbaa !12
  %69 = add nsw i32 %67, %68
  %70 = add nsw i32 %69, 1
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds double, ptr %66, i64 %71
  %73 = load double, ptr %72, align 8, !tbaa !15
  store double %73, ptr %17, align 8, !tbaa !15
  store i32 0, ptr %13, align 4, !tbaa !12
  br label %74

74:                                               ; preds = %126, %58
  %75 = load i32, ptr %13, align 4, !tbaa !12
  %76 = load i32, ptr %10, align 4, !tbaa !12
  %77 = icmp slt i32 %75, %76
  br i1 %77, label %78, label %129

78:                                               ; preds = %74
  %79 = load ptr, ptr %11, align 8, !tbaa !5
  %80 = load i32, ptr %13, align 4, !tbaa !12
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds double, ptr %79, i64 %81
  store double 1.000000e+00, ptr %82, align 8, !tbaa !15
  store i32 0, ptr %12, align 4, !tbaa !12
  br label %83

83:                                               ; preds = %115, %78
  %84 = load i32, ptr %12, align 4, !tbaa !12
  %85 = load i32, ptr %9, align 4, !tbaa !12
  %86 = icmp slt i32 %84, %85
  br i1 %86, label %87, label %118

87:                                               ; preds = %83
  %88 = load ptr, ptr %5, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.tensor, ptr %88, i32 0, i32 0
  %90 = load ptr, ptr %89, align 8, !tbaa !14
  %91 = load i32, ptr %16, align 4, !tbaa !12
  %92 = load i32, ptr %12, align 4, !tbaa !12
  %93 = add nsw i32 %91, %92
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds double, ptr %90, i64 %94
  %96 = load double, ptr %95, align 8, !tbaa !15
  %97 = load ptr, ptr %6, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.tensor, ptr %97, i32 0, i32 0
  %99 = load ptr, ptr %98, align 8, !tbaa !14
  %100 = load i32, ptr %13, align 4, !tbaa !12
  %101 = load i32, ptr %9, align 4, !tbaa !12
  %102 = mul nsw i32 %100, %101
  %103 = load i32, ptr %12, align 4, !tbaa !12
  %104 = add nsw i32 %102, %103
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds double, ptr %99, i64 %105
  %107 = load double, ptr %106, align 8, !tbaa !15
  %108 = call double @pow(double noundef %96, double noundef %107) #6
  %109 = load ptr, ptr %11, align 8, !tbaa !5
  %110 = load i32, ptr %13, align 4, !tbaa !12
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds double, ptr %109, i64 %111
  %113 = load double, ptr %112, align 8, !tbaa !15
  %114 = fmul double %113, %108
  store double %114, ptr %112, align 8, !tbaa !15
  br label %115

115:                                              ; preds = %87
  %116 = load i32, ptr %12, align 4, !tbaa !12
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %12, align 4, !tbaa !12
  br label %83, !llvm.loop !17

118:                                              ; preds = %83
  %119 = load double, ptr %17, align 8, !tbaa !15
  %120 = load ptr, ptr %11, align 8, !tbaa !5
  %121 = load i32, ptr %13, align 4, !tbaa !12
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds double, ptr %120, i64 %122
  %124 = load double, ptr %123, align 8, !tbaa !15
  %125 = fdiv double %124, %119
  store double %125, ptr %123, align 8, !tbaa !15
  br label %126

126:                                              ; preds = %118
  %127 = load i32, ptr %13, align 4, !tbaa !12
  %128 = add nsw i32 %127, 1
  store i32 %128, ptr %13, align 4, !tbaa !12
  br label %74, !llvm.loop !19

129:                                              ; preds = %74
  store i32 0, ptr %13, align 4, !tbaa !12
  br label %130

130:                                              ; preds = %167, %129
  %131 = load i32, ptr %13, align 4, !tbaa !12
  %132 = load i32, ptr %10, align 4, !tbaa !12
  %133 = icmp slt i32 %131, %132
  br i1 %133, label %134, label %170

134:                                              ; preds = %130
  %135 = load i32, ptr %13, align 4, !tbaa !12
  %136 = load i32, ptr %10, align 4, !tbaa !12
  %137 = mul nsw i32 %135, %136
  store i32 %137, ptr %15, align 4, !tbaa !12
  store i32 0, ptr %12, align 4, !tbaa !12
  br label %138

138:                                              ; preds = %163, %134
  %139 = load i32, ptr %12, align 4, !tbaa !12
  %140 = load i32, ptr %10, align 4, !tbaa !12
  %141 = icmp slt i32 %139, %140
  br i1 %141, label %142, label %166

142:                                              ; preds = %138
  %143 = load ptr, ptr %11, align 8, !tbaa !5
  %144 = load i32, ptr %13, align 4, !tbaa !12
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds double, ptr %143, i64 %145
  %147 = load double, ptr %146, align 8, !tbaa !15
  %148 = load ptr, ptr %11, align 8, !tbaa !5
  %149 = load i32, ptr %12, align 4, !tbaa !12
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds double, ptr %148, i64 %150
  %152 = load double, ptr %151, align 8, !tbaa !15
  %153 = load ptr, ptr %7, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.tensor, ptr %153, i32 0, i32 0
  %155 = load ptr, ptr %154, align 8, !tbaa !14
  %156 = load i32, ptr %15, align 4, !tbaa !12
  %157 = load i32, ptr %12, align 4, !tbaa !12
  %158 = add nsw i32 %156, %157
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds double, ptr %155, i64 %159
  %161 = load double, ptr %160, align 8, !tbaa !15
  %162 = call double @llvm.fmuladd.f64(double %147, double %152, double %161)
  store double %162, ptr %160, align 8, !tbaa !15
  br label %163

163:                                              ; preds = %142
  %164 = load i32, ptr %12, align 4, !tbaa !12
  %165 = add nsw i32 %164, 1
  store i32 %165, ptr %12, align 4, !tbaa !12
  br label %138, !llvm.loop !20

166:                                              ; preds = %138
  br label %167

167:                                              ; preds = %166
  %168 = load i32, ptr %13, align 4, !tbaa !12
  %169 = add nsw i32 %168, 1
  store i32 %169, ptr %13, align 4, !tbaa !12
  br label %130, !llvm.loop !21

170:                                              ; preds = %130
  %171 = load ptr, ptr %5, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.tensor, ptr %171, i32 0, i32 0
  %173 = load ptr, ptr %172, align 8, !tbaa !14
  %174 = load i32, ptr %16, align 4, !tbaa !12
  %175 = load i32, ptr %9, align 4, !tbaa !12
  %176 = add nsw i32 %174, %175
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds double, ptr %173, i64 %177
  %179 = load double, ptr %178, align 8, !tbaa !15
  %180 = load double, ptr %17, align 8, !tbaa !15
  %181 = fdiv double %179, %180
  store double %181, ptr %18, align 8, !tbaa !15
  store i32 0, ptr %12, align 4, !tbaa !12
  br label %182

182:                                              ; preds = %201, %170
  %183 = load i32, ptr %12, align 4, !tbaa !12
  %184 = load i32, ptr %10, align 4, !tbaa !12
  %185 = icmp slt i32 %183, %184
  br i1 %185, label %186, label %204

186:                                              ; preds = %182
  %187 = load ptr, ptr %11, align 8, !tbaa !5
  %188 = load i32, ptr %12, align 4, !tbaa !12
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds double, ptr %187, i64 %189
  %191 = load double, ptr %190, align 8, !tbaa !15
  %192 = load double, ptr %18, align 8, !tbaa !15
  %193 = load ptr, ptr %8, align 8, !tbaa !5
  %194 = getelementptr inbounds %struct.tensor, ptr %193, i32 0, i32 0
  %195 = load ptr, ptr %194, align 8, !tbaa !14
  %196 = load i32, ptr %12, align 4, !tbaa !12
  %197 = sext i32 %196 to i64
  %198 = getelementptr inbounds double, ptr %195, i64 %197
  %199 = load double, ptr %198, align 8, !tbaa !15
  %200 = call double @llvm.fmuladd.f64(double %191, double %192, double %199)
  store double %200, ptr %198, align 8, !tbaa !15
  br label %201

201:                                              ; preds = %186
  %202 = load i32, ptr %12, align 4, !tbaa !12
  %203 = add nsw i32 %202, 1
  store i32 %203, ptr %12, align 4, !tbaa !12
  br label %182, !llvm.loop !22

204:                                              ; preds = %182
  br label %205

205:                                              ; preds = %204
  %206 = load i32, ptr %14, align 4, !tbaa !12
  %207 = add nsw i32 %206, 1
  store i32 %207, ptr %14, align 4, !tbaa !12
  br label %52, !llvm.loop !23

208:                                              ; preds = %52
  %209 = load ptr, ptr %11, align 8, !tbaa !5
  call void @free(ptr noundef %209) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  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
declare void @free(ptr noundef) #3

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

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

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

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 "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 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0,1) }
attributes #8 = { 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, !11, i64 12}
!10 = !{!"tensor", !6, i64 0, !11, i64 8, !11, i64 12, !6, i64 16}
!11 = !{!"int", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!10, !11, i64 8}
!14 = !{!10, !6, 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}
!23 = distinct !{!23, !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"

; Function Attrs: nounwind uwtable
define dso_local void @makeLinearSystem(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr nocapture noundef %2, ptr nocapture noundef %3) local_unnamed_addr #0 {
  %5 = getelementptr inbounds i8, ptr %1, i64 12
  %6 = load i32, ptr %5, align 4, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %1, i64 8
  %8 = load i32, ptr %7, align 8, !tbaa !11
  %9 = getelementptr inbounds i8, ptr %2, i64 12
  store i32 %8, ptr %9, align 4, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %2, i64 8
  store i32 %8, ptr %10, align 8, !tbaa !11
  %11 = mul nsw i32 %8, %8
  %12 = zext nneg i32 %11 to i64
  %13 = tail call noalias ptr @calloc(i64 noundef %12, i64 noundef 8) #7
  store ptr %13, ptr %2, align 8, !tbaa !12
  %14 = getelementptr inbounds i8, ptr %3, i64 12
  store i32 1, ptr %14, align 4, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %3, i64 8
  store i32 %8, ptr %15, align 8, !tbaa !11
  %16 = sext i32 %8 to i64
  %17 = tail call noalias ptr @calloc(i64 noundef %16, i64 noundef 8) #7
  store ptr %17, ptr %3, align 8, !tbaa !12
  %18 = shl nsw i64 %16, 3
  %19 = tail call noalias ptr @malloc(i64 noundef %18) #8
  %20 = getelementptr inbounds i8, ptr %0, i64 8
  %21 = load i32, ptr %20, align 8, !tbaa !11
  %22 = icmp sgt i32 %21, 0
  br i1 %22, label %.lr.ph88, label %._crit_edge89

.lr.ph88:                                         ; preds = %4
  %23 = getelementptr inbounds i8, ptr %0, i64 12
  %24 = icmp sgt i32 %8, 0
  %25 = icmp sgt i32 %6, 0
  br i1 %24, label %.lr.ph78.us.preheader, label %._crit_edge89

.lr.ph78.us.preheader:                            ; preds = %.lr.ph88
  %26 = sext i32 %6 to i64
  %27 = zext nneg i32 %8 to i64
  %.pre = load ptr, ptr %0, align 8, !tbaa !12
  %wide.trip.count117 = zext i32 %6 to i64
  %min.iters.check163 = icmp ult i32 %8, 4
  %n.vec166 = and i64 %27, 2147483644
  %cmp.n173 = icmp eq i64 %n.vec166, %27
  %xtraiter = and i64 %wide.trip.count117, 1
  %28 = icmp eq i32 %6, 1
  %unroll_iter = and i64 %wide.trip.count117, 2147483646
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  %min.iters.check146 = icmp ult i32 %8, 4
  %n.vec149 = and i64 %27, 2147483644
  %cmp.n160 = icmp eq i64 %n.vec149, %27
  %min.iters.check = icmp ult i32 %8, 4
  %n.vec = and i64 %27, 2147483644
  %cmp.n = icmp eq i64 %n.vec, %27
  br label %.lr.ph78.us

.lr.ph78.us:                                      ; preds = %.lr.ph78.us.preheader, %._crit_edge.us94
  %29 = phi ptr [ %100, %._crit_edge.us94 ], [ %.pre, %.lr.ph78.us.preheader ]
  %.086.us = phi i32 [ %42, %._crit_edge.us94 ], [ 0, %.lr.ph78.us.preheader ]
  %30 = load i32, ptr %23, align 4, !tbaa !5
  %31 = mul nsw i32 %30, %.086.us
  %32 = add nsw i32 %31, %6
  %33 = sext i32 %32 to i64
  %34 = getelementptr double, ptr %29, i64 %33
  %35 = getelementptr i8, ptr %34, i64 8
  %36 = load double, ptr %35, align 8, !tbaa !13
  br i1 %25, label %.lr.ph.us.us.preheader, label %.lr.ph78.split.us92.preheader

.lr.ph78.split.us92.preheader:                    ; preds = %.lr.ph78.us
  %37 = fdiv double 1.000000e+00, %36
  br i1 %min.iters.check163, label %.lr.ph78.split.us92.preheader174, label %vector.ph164

.lr.ph78.split.us92.preheader174:                 ; preds = %middle.block161, %.lr.ph78.split.us92.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph78.split.us92.preheader ], [ %n.vec166, %middle.block161 ]
  br label %.lr.ph78.split.us92

vector.ph164:                                     ; preds = %.lr.ph78.split.us92.preheader
  %broadcast.splatinsert170 = insertelement <2 x double> poison, double %37, i64 0
  %broadcast.splat171 = shufflevector <2 x double> %broadcast.splatinsert170, <2 x double> poison, <2 x i32> zeroinitializer
  br label %vector.body168

vector.body168:                                   ; preds = %vector.body168, %vector.ph164
  %index169 = phi i64 [ 0, %vector.ph164 ], [ %index.next172, %vector.body168 ]
  %38 = getelementptr inbounds double, ptr %19, i64 %index169
  %39 = getelementptr inbounds i8, ptr %38, i64 16
  store <2 x double> %broadcast.splat171, ptr %38, align 8, !tbaa !13
  store <2 x double> %broadcast.splat171, ptr %39, align 8, !tbaa !13
  %index.next172 = add nuw i64 %index169, 4
  %40 = icmp eq i64 %index.next172, %n.vec166
  br i1 %40, label %middle.block161, label %vector.body168, !llvm.loop !15

middle.block161:                                  ; preds = %vector.body168
  br i1 %cmp.n173, label %.lr.ph81.us, label %.lr.ph78.split.us92.preheader174

.lr.ph.us.us.preheader:                           ; preds = %.lr.ph78.us
  %41 = sext i32 %31 to i64
  br label %.lr.ph.us.us

._crit_edge.us94:                                 ; preds = %scalar.ph, %middle.block
  %42 = add nuw nsw i32 %.086.us, 1
  %43 = load i32, ptr %20, align 8, !tbaa !11
  %44 = icmp slt i32 %42, %43
  br i1 %44, label %.lr.ph78.us, label %._crit_edge89, !llvm.loop !19

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv134 = phi i64 [ %indvars.iv.next135, %scalar.ph ], [ %indvars.iv134.ph, %scalar.ph.preheader ]
  %45 = getelementptr inbounds double, ptr %19, i64 %indvars.iv134
  %46 = load double, ptr %45, align 8, !tbaa !13
  %47 = getelementptr inbounds double, ptr %104, i64 %indvars.iv134
  %48 = load double, ptr %47, align 8, !tbaa !13
  %49 = tail call double @llvm.fmuladd.f64(double %46, double %103, double %48)
  store double %49, ptr %47, align 8, !tbaa !13
  %indvars.iv.next135 = add nuw nsw i64 %indvars.iv134, 1
  %exitcond138.not = icmp eq i64 %indvars.iv.next135, %27
  br i1 %exitcond138.not, label %._crit_edge.us94, label %scalar.ph, !llvm.loop !20

.lr.ph78.split.us92:                              ; preds = %.lr.ph78.split.us92.preheader174, %.lr.ph78.split.us92
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph78.split.us92 ], [ %indvars.iv.ph, %.lr.ph78.split.us92.preheader174 ]
  %50 = getelementptr inbounds double, ptr %19, i64 %indvars.iv
  store double %37, ptr %50, align 8, !tbaa !13
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %27
  br i1 %exitcond.not, label %.lr.ph81.us, label %.lr.ph78.split.us92, !llvm.loop !21

.lr.ph.us.us:                                     ; preds = %.lr.ph.us.us.preheader, %._crit_edge.us.us
  %indvars.iv119 = phi i64 [ 0, %.lr.ph.us.us.preheader ], [ %indvars.iv.next120, %._crit_edge.us.us ]
  %51 = getelementptr inbounds double, ptr %19, i64 %indvars.iv119
  %52 = mul nuw nsw i64 %indvars.iv119, %26
  br i1 %28, label %._crit_edge.us.us.unr-lcssa, label %.lr.ph.us.us.new

.lr.ph.us.us.new:                                 ; preds = %.lr.ph.us.us, %.lr.ph.us.us.new
  %indvars.iv114 = phi i64 [ %indvars.iv.next115.1, %.lr.ph.us.us.new ], [ 0, %.lr.ph.us.us ]
  %53 = phi double [ %73, %.lr.ph.us.us.new ], [ 1.000000e+00, %.lr.ph.us.us ]
  %niter = phi i64 [ %niter.next.1, %.lr.ph.us.us.new ], [ 0, %.lr.ph.us.us ]
  %54 = load ptr, ptr %0, align 8, !tbaa !12
  %55 = getelementptr double, ptr %54, i64 %indvars.iv114
  %56 = getelementptr double, ptr %55, i64 %41
  %57 = load double, ptr %56, align 8, !tbaa !13
  %58 = load ptr, ptr %1, align 8, !tbaa !12
  %59 = getelementptr inbounds double, ptr %58, i64 %indvars.iv114
  %60 = getelementptr inbounds double, ptr %59, i64 %52
  %61 = load double, ptr %60, align 8, !tbaa !13
  %62 = tail call double @pow(double noundef %57, double noundef %61) #9
  %63 = fmul double %62, %53
  %indvars.iv.next115 = or disjoint i64 %indvars.iv114, 1
  %64 = load ptr, ptr %0, align 8, !tbaa !12
  %65 = getelementptr double, ptr %64, i64 %indvars.iv.next115
  %66 = getelementptr double, ptr %65, i64 %41
  %67 = load double, ptr %66, align 8, !tbaa !13
  %68 = load ptr, ptr %1, align 8, !tbaa !12
  %69 = getelementptr inbounds double, ptr %68, i64 %indvars.iv.next115
  %70 = getelementptr inbounds double, ptr %69, i64 %52
  %71 = load double, ptr %70, align 8, !tbaa !13
  %72 = tail call double @pow(double noundef %67, double noundef %71) #9
  %73 = fmul double %72, %63
  %indvars.iv.next115.1 = add nuw nsw i64 %indvars.iv114, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.us.us.unr-lcssa, label %.lr.ph.us.us.new, !llvm.loop !22

._crit_edge.us.us.unr-lcssa:                      ; preds = %.lr.ph.us.us.new, %.lr.ph.us.us
  %.lcssa.ph = phi double [ poison, %.lr.ph.us.us ], [ %73, %.lr.ph.us.us.new ]
  %indvars.iv114.unr = phi i64 [ 0, %.lr.ph.us.us ], [ %indvars.iv.next115.1, %.lr.ph.us.us.new ]
  %.unr = phi double [ 1.000000e+00, %.lr.ph.us.us ], [ %73, %.lr.ph.us.us.new ]
  br i1 %lcmp.mod.not, label %._crit_edge.us.us, label %._crit_edge.us.us.epilog-lcssa

._crit_edge.us.us.epilog-lcssa:                   ; preds = %._crit_edge.us.us.unr-lcssa
  %74 = load ptr, ptr %0, align 8, !tbaa !12
  %75 = getelementptr double, ptr %74, i64 %indvars.iv114.unr
  %76 = getelementptr double, ptr %75, i64 %41
  %77 = load double, ptr %76, align 8, !tbaa !13
  %78 = load ptr, ptr %1, align 8, !tbaa !12
  %79 = getelementptr inbounds double, ptr %78, i64 %indvars.iv114.unr
  %80 = getelementptr inbounds double, ptr %79, i64 %52
  %81 = load double, ptr %80, align 8, !tbaa !13
  %82 = tail call double @pow(double noundef %77, double noundef %81) #9
  %83 = fmul double %82, %.unr
  br label %._crit_edge.us.us

._crit_edge.us.us:                                ; preds = %._crit_edge.us.us.unr-lcssa, %._crit_edge.us.us.epilog-lcssa
  %.lcssa = phi double [ %.lcssa.ph, %._crit_edge.us.us.unr-lcssa ], [ %83, %._crit_edge.us.us.epilog-lcssa ]
  %84 = fdiv double %.lcssa, %36
  store double %84, ptr %51, align 8, !tbaa !13
  %indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1
  %exitcond123.not = icmp eq i64 %indvars.iv.next120, %27
  br i1 %exitcond123.not, label %.lr.ph81.us, label %.lr.ph.us.us, !llvm.loop !23

.lr.ph81.us:                                      ; preds = %.lr.ph78.split.us92, %._crit_edge.us.us, %middle.block161
  %85 = load ptr, ptr %2, align 8, !tbaa !12
  br label %.lr.ph.us83.us

.lr.ph.us83.us:                                   ; preds = %._crit_edge.us84.us, %.lr.ph81.us
  %indvars.iv129 = phi i64 [ %indvars.iv.next130, %._crit_edge.us84.us ], [ 0, %.lr.ph81.us ]
  %86 = mul nuw nsw i64 %indvars.iv129, %27
  %87 = getelementptr inbounds double, ptr %19, i64 %indvars.iv129
  %88 = load double, ptr %87, align 8, !tbaa !13
  %invariant.gep = getelementptr inbounds double, ptr %85, i64 %86
  br i1 %min.iters.check146, label %scalar.ph145.preheader, label %vector.ph147

vector.ph147:                                     ; preds = %.lr.ph.us83.us
  %broadcast.splatinsert157 = insertelement <2 x double> poison, double %88, i64 0
  %broadcast.splat158 = shufflevector <2 x double> %broadcast.splatinsert157, <2 x double> poison, <2 x i32> zeroinitializer
  br label %vector.body151

vector.body151:                                   ; preds = %vector.body151, %vector.ph147
  %index152 = phi i64 [ 0, %vector.ph147 ], [ %index.next159, %vector.body151 ]
  %89 = getelementptr inbounds double, ptr %19, i64 %index152
  %90 = getelementptr inbounds i8, ptr %89, i64 16
  %wide.load153 = load <2 x double>, ptr %89, align 8, !tbaa !13
  %wide.load154 = load <2 x double>, ptr %90, align 8, !tbaa !13
  %91 = getelementptr inbounds double, ptr %invariant.gep, i64 %index152
  %92 = getelementptr inbounds i8, ptr %91, i64 16
  %wide.load155 = load <2 x double>, ptr %91, align 8, !tbaa !13
  %wide.load156 = load <2 x double>, ptr %92, align 8, !tbaa !13
  %93 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %broadcast.splat158, <2 x double> %wide.load153, <2 x double> %wide.load155)
  %94 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %broadcast.splat158, <2 x double> %wide.load154, <2 x double> %wide.load156)
  store <2 x double> %93, ptr %91, align 8, !tbaa !13
  store <2 x double> %94, ptr %92, align 8, !tbaa !13
  %index.next159 = add nuw i64 %index152, 4
  %95 = icmp eq i64 %index.next159, %n.vec149
  br i1 %95, label %middle.block144, label %vector.body151, !llvm.loop !24

middle.block144:                                  ; preds = %vector.body151
  br i1 %cmp.n160, label %._crit_edge.us84.us, label %scalar.ph145.preheader

scalar.ph145.preheader:                           ; preds = %middle.block144, %.lr.ph.us83.us
  %indvars.iv124.ph = phi i64 [ 0, %.lr.ph.us83.us ], [ %n.vec149, %middle.block144 ]
  br label %scalar.ph145

scalar.ph145:                                     ; preds = %scalar.ph145.preheader, %scalar.ph145
  %indvars.iv124 = phi i64 [ %indvars.iv.next125, %scalar.ph145 ], [ %indvars.iv124.ph, %scalar.ph145.preheader ]
  %96 = getelementptr inbounds double, ptr %19, i64 %indvars.iv124
  %97 = load double, ptr %96, align 8, !tbaa !13
  %gep = getelementptr inbounds double, ptr %invariant.gep, i64 %indvars.iv124
  %98 = load double, ptr %gep, align 8, !tbaa !13
  %99 = tail call double @llvm.fmuladd.f64(double %88, double %97, double %98)
  store double %99, ptr %gep, align 8, !tbaa !13
  %indvars.iv.next125 = add nuw nsw i64 %indvars.iv124, 1
  %exitcond128.not = icmp eq i64 %indvars.iv.next125, %27
  br i1 %exitcond128.not, label %._crit_edge.us84.us, label %scalar.ph145, !llvm.loop !25

._crit_edge.us84.us:                              ; preds = %scalar.ph145, %middle.block144
  %indvars.iv.next130 = add nuw nsw i64 %indvars.iv129, 1
  %exitcond133.not = icmp eq i64 %indvars.iv.next130, %27
  br i1 %exitcond133.not, label %.lr.ph.us93, label %.lr.ph.us83.us, !llvm.loop !26

.lr.ph.us93:                                      ; preds = %._crit_edge.us84.us
  %100 = load ptr, ptr %0, align 8, !tbaa !12
  %101 = getelementptr inbounds double, ptr %100, i64 %33
  %102 = load double, ptr %101, align 8, !tbaa !13
  %103 = fdiv double %102, %36
  %104 = load ptr, ptr %3, align 8, !tbaa !12
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

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

vector.ph:                                        ; preds = %.lr.ph.us93
  %broadcast.splatinsert = insertelement <2 x double> poison, double %103, i64 0
  %broadcast.splat = shufflevector <2 x double> %broadcast.splatinsert, <2 x double> poison, <2 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %105 = getelementptr inbounds double, ptr %19, i64 %index
  %106 = getelementptr inbounds i8, ptr %105, i64 16
  %wide.load = load <2 x double>, ptr %105, align 8, !tbaa !13
  %wide.load141 = load <2 x double>, ptr %106, align 8, !tbaa !13
  %107 = getelementptr inbounds double, ptr %104, i64 %index
  %108 = getelementptr inbounds i8, ptr %107, i64 16
  %wide.load142 = load <2 x double>, ptr %107, align 8, !tbaa !13
  %wide.load143 = load <2 x double>, ptr %108, align 8, !tbaa !13
  %109 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %wide.load, <2 x double> %broadcast.splat, <2 x double> %wide.load142)
  %110 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %wide.load141, <2 x double> %broadcast.splat, <2 x double> %wide.load143)
  store <2 x double> %109, ptr %107, align 8, !tbaa !13
  store <2 x double> %110, ptr %108, align 8, !tbaa !13
  %index.next = add nuw i64 %index, 4
  %111 = icmp eq i64 %index.next, %n.vec
  br i1 %111, label %middle.block, label %vector.body, !llvm.loop !27

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

._crit_edge89:                                    ; preds = %._crit_edge.us94, %.lr.ph88, %4
  tail call void @free(ptr noundef %19) #9
  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 nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #2

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #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 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 #3 = { 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 #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind allocsize(0,1) }
attributes #8 = { nounwind allocsize(0) }
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 = distinct !{!15, !16, !17, !18}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!"llvm.loop.isvectorized", i32 1}
!18 = !{!"llvm.loop.unroll.runtime.disable"}
!19 = distinct !{!19, !16}
!20 = distinct !{!20, !16, !18, !17}
!21 = distinct !{!21, !16, !18, !17}
!22 = distinct !{!22, !16}
!23 = distinct !{!23, !16}
!24 = distinct !{!24, !16, !17, !18}
!25 = distinct !{!25, !16, !18, !17}
!26 = distinct !{!26, !16}
!27 = distinct !{!27, !16, !17, !18}


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