; LLVM IR from yourtion/LearningMasteringAlgorithms-C :: source (interpol)

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

26:                                               ; preds = %6
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %20, align 4
  br label %169

27:                                               ; preds = %6
  %28 = load i32, ptr %10, align 4, !tbaa !9
  %29 = sext i32 %28 to i64
  %30 = mul i64 8, %29
  %31 = call noalias ptr @malloc(i64 noundef %30) #6
  store ptr %31, ptr %16, align 8, !tbaa !5
  %32 = icmp eq ptr %31, null
  br i1 %32, label %33, label %35

33:                                               ; preds = %27
  %34 = load ptr, ptr %15, align 8, !tbaa !5
  call void @free(ptr noundef %34) #5
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %20, align 4
  br label %169

35:                                               ; preds = %27
  %36 = load ptr, ptr %15, align 8, !tbaa !5
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = load i32, ptr %10, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  %40 = mul i64 8, %39
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %36, ptr align 8 %37, i64 %40, i1 false)
  %41 = load ptr, ptr %15, align 8, !tbaa !5
  %42 = getelementptr inbounds double, ptr %41, i64 0
  %43 = load double, ptr %42, align 8, !tbaa !11
  %44 = load ptr, ptr %16, align 8, !tbaa !5
  %45 = getelementptr inbounds double, ptr %44, i64 0
  store double %43, ptr %45, align 8, !tbaa !11
  store i32 1, ptr %19, align 4, !tbaa !9
  br label %46

46:                                               ; preds = %100, %35
  %47 = load i32, ptr %19, align 4, !tbaa !9
  %48 = load i32, ptr %10, align 4, !tbaa !9
  %49 = icmp slt i32 %47, %48
  br i1 %49, label %50, label %103

50:                                               ; preds = %46
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %51

51:                                               ; preds = %89, %50
  %52 = load i32, ptr %17, align 4, !tbaa !9
  %53 = load i32, ptr %10, align 4, !tbaa !9
  %54 = load i32, ptr %19, align 4, !tbaa !9
  %55 = sub nsw i32 %53, %54
  %56 = icmp slt i32 %52, %55
  br i1 %56, label %57, label %92

57:                                               ; preds = %51
  %58 = load i32, ptr %17, align 4, !tbaa !9
  %59 = load i32, ptr %19, align 4, !tbaa !9
  %60 = add nsw i32 %58, %59
  store i32 %60, ptr %18, align 4, !tbaa !9
  %61 = load ptr, ptr %15, align 8, !tbaa !5
  %62 = load i32, ptr %17, align 4, !tbaa !9
  %63 = add nsw i32 %62, 1
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds double, ptr %61, i64 %64
  %66 = load double, ptr %65, align 8, !tbaa !11
  %67 = load ptr, ptr %15, align 8, !tbaa !5
  %68 = load i32, ptr %17, align 4, !tbaa !9
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds double, ptr %67, i64 %69
  %71 = load double, ptr %70, align 8, !tbaa !11
  %72 = fsub double %66, %71
  %73 = load ptr, ptr %8, align 8, !tbaa !5
  %74 = load i32, ptr %18, align 4, !tbaa !9
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds double, ptr %73, i64 %75
  %77 = load double, ptr %76, align 8, !tbaa !11
  %78 = load ptr, ptr %8, align 8, !tbaa !5
  %79 = load i32, ptr %17, align 4, !tbaa !9
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds double, ptr %78, i64 %80
  %82 = load double, ptr %81, align 8, !tbaa !11
  %83 = fsub double %77, %82
  %84 = fdiv double %72, %83
  %85 = load ptr, ptr %15, align 8, !tbaa !5
  %86 = load i32, ptr %17, align 4, !tbaa !9
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds double, ptr %85, i64 %87
  store double %84, ptr %88, align 8, !tbaa !11
  br label %89

89:                                               ; preds = %57
  %90 = load i32, ptr %17, align 4, !tbaa !9
  %91 = add nsw i32 %90, 1
  store i32 %91, ptr %17, align 4, !tbaa !9
  br label %51, !llvm.loop !13

92:                                               ; preds = %51
  %93 = load ptr, ptr %15, align 8, !tbaa !5
  %94 = getelementptr inbounds double, ptr %93, i64 0
  %95 = load double, ptr %94, align 8, !tbaa !11
  %96 = load ptr, ptr %16, align 8, !tbaa !5
  %97 = load i32, ptr %19, align 4, !tbaa !9
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds double, ptr %96, i64 %98
  store double %95, ptr %99, align 8, !tbaa !11
  br label %100

100:                                              ; preds = %92
  %101 = load i32, ptr %19, align 4, !tbaa !9
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %19, align 4, !tbaa !9
  br label %46, !llvm.loop !15

103:                                              ; preds = %46
  %104 = load ptr, ptr %15, align 8, !tbaa !5
  call void @free(ptr noundef %104) #5
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %105

105:                                              ; preds = %164, %103
  %106 = load i32, ptr %19, align 4, !tbaa !9
  %107 = load i32, ptr %13, align 4, !tbaa !9
  %108 = icmp slt i32 %106, %107
  br i1 %108, label %109, label %167

109:                                              ; preds = %105
  %110 = load ptr, ptr %16, align 8, !tbaa !5
  %111 = getelementptr inbounds double, ptr %110, i64 0
  %112 = load double, ptr %111, align 8, !tbaa !11
  %113 = load ptr, ptr %12, align 8, !tbaa !5
  %114 = load i32, ptr %19, align 4, !tbaa !9
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds double, ptr %113, i64 %115
  store double %112, ptr %116, align 8, !tbaa !11
  store i32 1, ptr %18, align 4, !tbaa !9
  br label %117

117:                                              ; preds = %160, %109
  %118 = load i32, ptr %18, align 4, !tbaa !9
  %119 = load i32, ptr %10, align 4, !tbaa !9
  %120 = icmp slt i32 %118, %119
  br i1 %120, label %121, label %163

121:                                              ; preds = %117
  %122 = load ptr, ptr %16, align 8, !tbaa !5
  %123 = load i32, ptr %18, align 4, !tbaa !9
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds double, ptr %122, i64 %124
  %126 = load double, ptr %125, align 8, !tbaa !11
  store double %126, ptr %14, align 8, !tbaa !11
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %127

127:                                              ; preds = %145, %121
  %128 = load i32, ptr %17, align 4, !tbaa !9
  %129 = load i32, ptr %18, align 4, !tbaa !9
  %130 = icmp slt i32 %128, %129
  br i1 %130, label %131, label %148

131:                                              ; preds = %127
  %132 = load double, ptr %14, align 8, !tbaa !11
  %133 = load ptr, ptr %11, align 8, !tbaa !5
  %134 = load i32, ptr %19, align 4, !tbaa !9
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds double, ptr %133, i64 %135
  %137 = load double, ptr %136, align 8, !tbaa !11
  %138 = load ptr, ptr %8, align 8, !tbaa !5
  %139 = load i32, ptr %17, align 4, !tbaa !9
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds double, ptr %138, i64 %140
  %142 = load double, ptr %141, align 8, !tbaa !11
  %143 = fsub double %137, %142
  %144 = fmul double %132, %143
  store double %144, ptr %14, align 8, !tbaa !11
  br label %145

145:                                              ; preds = %131
  %146 = load i32, ptr %17, align 4, !tbaa !9
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %17, align 4, !tbaa !9
  br label %127, !llvm.loop !16

148:                                              ; preds = %127
  %149 = load ptr, ptr %12, align 8, !tbaa !5
  %150 = load i32, ptr %19, align 4, !tbaa !9
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds double, ptr %149, i64 %151
  %153 = load double, ptr %152, align 8, !tbaa !11
  %154 = load double, ptr %14, align 8, !tbaa !11
  %155 = fadd double %153, %154
  %156 = load ptr, ptr %12, align 8, !tbaa !5
  %157 = load i32, ptr %19, align 4, !tbaa !9
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds double, ptr %156, i64 %158
  store double %155, ptr %159, align 8, !tbaa !11
  br label %160

160:                                              ; preds = %148
  %161 = load i32, ptr %18, align 4, !tbaa !9
  %162 = add nsw i32 %161, 1
  store i32 %162, ptr %18, align 4, !tbaa !9
  br label %117, !llvm.loop !17

163:                                              ; preds = %117
  br label %164

164:                                              ; preds = %163
  %165 = load i32, ptr %19, align 4, !tbaa !9
  %166 = add nsw i32 %165, 1
  store i32 %166, ptr %19, align 4, !tbaa !9
  br label %105, !llvm.loop !18

167:                                              ; preds = %105
  %168 = load ptr, ptr %16, align 8, !tbaa !5
  call void @free(ptr noundef %168) #5
  store i32 0, ptr %7, align 4
  store i32 1, ptr %20, align 4
  br label %169

169:                                              ; preds = %167, %33, %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  %170 = load i32, ptr %7, align 4
  ret i32 %170
}

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

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

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !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: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @interpol(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, i32 noundef %2, ptr nocapture noundef readonly %3, ptr nocapture noundef writeonly %4, i32 noundef %5) local_unnamed_addr #0 {
  %7 = sext i32 %2 to i64
  %8 = shl nsw i64 %7, 3
  %9 = tail call noalias ptr @malloc(i64 noundef %8) #4
  %10 = icmp eq ptr %9, null
  br i1 %10, label %81, label %11

11:                                               ; preds = %6
  %12 = tail call noalias ptr @malloc(i64 noundef %8) #4
  %13 = icmp eq ptr %12, null
  br i1 %13, label %14, label %15

14:                                               ; preds = %11
  tail call void @free(ptr noundef nonnull %9) #5
  br label %81

15:                                               ; preds = %11
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 8 %9, ptr align 8 %1, i64 %8, i1 false)
  %16 = load double, ptr %9, align 8, !tbaa !5
  %17 = icmp sgt i32 %2, 1
  br i1 %17, label %.preheader.preheader, label %._crit_edge67.thread

.preheader.preheader:                             ; preds = %15
  %wide.trip.count85 = zext nneg i32 %2 to i64
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge
  %indvar = phi i32 [ 0, %.preheader.preheader ], [ %indvar.next, %._crit_edge ]
  %18 = phi double [ %16, %.preheader.preheader ], [ %43, %._crit_edge ]
  %indvars.iv82 = phi i64 [ 1, %.preheader.preheader ], [ %indvars.iv.next83, %._crit_edge ]
  %indvars.iv80.in = phi i32 [ %2, %.preheader.preheader ], [ %indvars.iv80, %._crit_edge ]
  %19 = xor i32 %indvar, -1
  %20 = add i32 %19, %2
  %21 = zext i32 %20 to i64
  %indvars.iv80 = add i32 %indvars.iv80.in, -1
  %22 = icmp slt i64 %indvars.iv82, %7
  br i1 %22, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.preheader
  %wide.trip.count = zext i32 %indvars.iv80 to i64
  %invariant.gep = getelementptr inbounds double, ptr %0, i64 %indvars.iv82
  %min.iters.check = icmp ult i32 %20, 2
  br i1 %min.iters.check, label %.lr.ph.preheader124, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %21, 4294967294
  %vector.recur.init = insertelement <2 x double> poison, double %18, i64 1
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vector.recur = phi <2 x double> [ %vector.recur.init, %vector.ph ], [ %wide.load, %vector.body ]
  %23 = or disjoint i64 %index, 1
  %24 = getelementptr inbounds double, ptr %9, i64 %23
  %wide.load = load <2 x double>, ptr %24, align 8, !tbaa !5
  %25 = shufflevector <2 x double> %vector.recur, <2 x double> %wide.load, <2 x i32> <i32 1, i32 2>
  %26 = getelementptr inbounds double, ptr %9, i64 %index
  %27 = fsub <2 x double> %wide.load, %25
  %28 = getelementptr inbounds double, ptr %invariant.gep, i64 %index
  %wide.load109 = load <2 x double>, ptr %28, align 8, !tbaa !5
  %29 = getelementptr inbounds double, ptr %0, i64 %index
  %wide.load110 = load <2 x double>, ptr %29, align 8, !tbaa !5
  %30 = fsub <2 x double> %wide.load109, %wide.load110
  %31 = fdiv <2 x double> %27, %30
  store <2 x double> %31, ptr %26, align 8, !tbaa !5
  %index.next = add nuw i64 %index, 2
  %32 = icmp eq i64 %index.next, %n.vec
  br i1 %32, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %vector.recur.extract = extractelement <2 x double> %wide.load, i64 1
  %cmp.n = icmp eq i64 %n.vec, %21
  br i1 %cmp.n, label %._crit_edge.loopexit, label %.lr.ph.preheader124

.lr.ph.preheader124:                              ; preds = %middle.block, %.lr.ph.preheader
  %.ph = phi double [ %18, %.lr.ph.preheader ], [ %vector.recur.extract, %middle.block ]
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader124, %.lr.ph
  %33 = phi double [ %35, %.lr.ph ], [ %.ph, %.lr.ph.preheader124 ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader124 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %34 = getelementptr inbounds double, ptr %9, i64 %indvars.iv.next
  %35 = load double, ptr %34, align 8, !tbaa !5
  %36 = getelementptr inbounds double, ptr %9, i64 %indvars.iv
  %37 = fsub double %35, %33
  %gep = getelementptr inbounds double, ptr %invariant.gep, i64 %indvars.iv
  %38 = load double, ptr %gep, align 8, !tbaa !5
  %39 = getelementptr inbounds double, ptr %0, i64 %indvars.iv
  %40 = load double, ptr %39, align 8, !tbaa !5
  %41 = fsub double %38, %40
  %42 = fdiv double %37, %41
  store double %42, ptr %36, align 8, !tbaa !5
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge.loopexit, label %.lr.ph, !llvm.loop !13

._crit_edge.loopexit:                             ; preds = %.lr.ph, %middle.block
  %.pre = load double, ptr %9, align 8, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %43 = phi double [ %.pre, %._crit_edge.loopexit ], [ %18, %.preheader ]
  %44 = getelementptr inbounds double, ptr %12, i64 %indvars.iv82
  store double %43, ptr %44, align 8, !tbaa !5
  %indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
  %exitcond86.not = icmp eq i64 %indvars.iv.next83, %wide.trip.count85
  %indvar.next = add i32 %indvar, 1
  br i1 %exitcond86.not, label %._crit_edge67, label %.preheader, !llvm.loop !14

._crit_edge67:                                    ; preds = %._crit_edge
  tail call void @free(ptr noundef nonnull %9) #5
  %45 = icmp sgt i32 %5, 0
  br i1 %45, label %.lr.ph76, label %._crit_edge77

._crit_edge67.thread:                             ; preds = %15
  tail call void @free(ptr noundef nonnull %9) #5
  %46 = icmp sgt i32 %5, 0
  br i1 %46, label %.lr.ph76.split.preheader, label %._crit_edge77

.lr.ph76:                                         ; preds = %._crit_edge67
  br i1 %17, label %.lr.ph72.us.preheader, label %.lr.ph76.split.preheader

.lr.ph76.split.preheader:                         ; preds = %._crit_edge67.thread, %.lr.ph76
  %wide.trip.count90 = zext nneg i32 %5 to i64
  %min.iters.check113 = icmp ult i32 %5, 4
  br i1 %min.iters.check113, label %.lr.ph76.split.preheader122, label %vector.ph114

.lr.ph76.split.preheader122:                      ; preds = %middle.block111, %.lr.ph76.split.preheader
  %indvars.iv87.ph = phi i64 [ 0, %.lr.ph76.split.preheader ], [ %n.vec116, %middle.block111 ]
  br label %.lr.ph76.split

vector.ph114:                                     ; preds = %.lr.ph76.split.preheader
  %n.vec116 = and i64 %wide.trip.count90, 2147483644
  %broadcast.splatinsert = insertelement <2 x double> poison, double %16, i64 0
  %broadcast.splat = shufflevector <2 x double> %broadcast.splatinsert, <2 x double> poison, <2 x i32> zeroinitializer
  br label %vector.body118

vector.body118:                                   ; preds = %vector.body118, %vector.ph114
  %index119 = phi i64 [ 0, %vector.ph114 ], [ %index.next120, %vector.body118 ]
  %47 = getelementptr inbounds double, ptr %4, i64 %index119
  %48 = getelementptr inbounds i8, ptr %47, i64 16
  store <2 x double> %broadcast.splat, ptr %47, align 8, !tbaa !5
  store <2 x double> %broadcast.splat, ptr %48, align 8, !tbaa !5
  %index.next120 = add nuw i64 %index119, 4
  %49 = icmp eq i64 %index.next120, %n.vec116
  br i1 %49, label %middle.block111, label %vector.body118, !llvm.loop !15

middle.block111:                                  ; preds = %vector.body118
  %cmp.n121 = icmp eq i64 %n.vec116, %wide.trip.count90
  br i1 %cmp.n121, label %._crit_edge77, label %.lr.ph76.split.preheader122

.lr.ph72.us.preheader:                            ; preds = %.lr.ph76
  %wide.trip.count105 = zext nneg i32 %5 to i64
  %wide.trip.count100 = zext nneg i32 %2 to i64
  br label %.lr.ph72.us

.lr.ph72.us:                                      ; preds = %.lr.ph72.us.preheader, %._crit_edge73.us
  %indvars.iv102 = phi i64 [ 0, %.lr.ph72.us.preheader ], [ %indvars.iv.next103, %._crit_edge73.us ]
  %50 = getelementptr inbounds double, ptr %4, i64 %indvars.iv102
  store double %16, ptr %50, align 8, !tbaa !5
  %51 = getelementptr inbounds double, ptr %3, i64 %indvars.iv102
  br label %52

52:                                               ; preds = %.lr.ph72.us, %.epilog-lcssa
  %indvar125 = phi i64 [ 0, %.lr.ph72.us ], [ %indvar.next126, %.epilog-lcssa ]
  %53 = phi double [ %16, %.lr.ph72.us ], [ %62, %.epilog-lcssa ]
  %indvars.iv97 = phi i64 [ 1, %.lr.ph72.us ], [ %indvars.iv.next98, %.epilog-lcssa ]
  %54 = getelementptr inbounds double, ptr %12, i64 %indvars.iv97
  %55 = load double, ptr %54, align 8, !tbaa !5
  %56 = load double, ptr %51, align 8, !tbaa !5
  %xtraiter = and i64 %indvars.iv97, 3
  %57 = icmp ult i64 %indvar125, 3
  br i1 %57, label %.unr-lcssa, label %.new

.new:                                             ; preds = %52
  %unroll_iter = and i64 %indvars.iv97, 9223372036854775804
  br label %63

.unr-lcssa:                                       ; preds = %63, %52
  %.lcssa.ph = phi double [ poison, %52 ], [ %79, %63 ]
  %indvars.iv92.unr = phi i64 [ 0, %52 ], [ %indvars.iv.next93.3, %63 ]
  %.06068.us.unr = phi double [ %55, %52 ], [ %79, %63 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.epilog-lcssa, label %.epil.preheader

.epil.preheader:                                  ; preds = %.unr-lcssa, %.epil.preheader
  %indvars.iv92.epil = phi i64 [ %indvars.iv.next93.epil, %.epil.preheader ], [ %indvars.iv92.unr, %.unr-lcssa ]
  %.06068.us.epil = phi double [ %61, %.epil.preheader ], [ %.06068.us.unr, %.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %.unr-lcssa ]
  %58 = getelementptr inbounds double, ptr %0, i64 %indvars.iv92.epil
  %59 = load double, ptr %58, align 8, !tbaa !5
  %60 = fsub double %56, %59
  %61 = fmul double %.06068.us.epil, %60
  %indvars.iv.next93.epil = add nuw nsw i64 %indvars.iv92.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.epilog-lcssa, label %.epil.preheader, !llvm.loop !16

.epilog-lcssa:                                    ; preds = %.epil.preheader, %.unr-lcssa
  %.lcssa = phi double [ %.lcssa.ph, %.unr-lcssa ], [ %61, %.epil.preheader ]
  %62 = fadd double %.lcssa, %53
  store double %62, ptr %50, 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
  %indvar.next126 = add i64 %indvar125, 1
  br i1 %exitcond101.not, label %._crit_edge73.us, label %52, !llvm.loop !18

63:                                               ; preds = %63, %.new
  %indvars.iv92 = phi i64 [ 0, %.new ], [ %indvars.iv.next93.3, %63 ]
  %.06068.us = phi double [ %55, %.new ], [ %79, %63 ]
  %niter = phi i64 [ 0, %.new ], [ %niter.next.3, %63 ]
  %64 = getelementptr inbounds double, ptr %0, i64 %indvars.iv92
  %65 = load double, ptr %64, align 8, !tbaa !5
  %66 = fsub double %56, %65
  %67 = fmul double %.06068.us, %66
  %indvars.iv.next93 = or disjoint i64 %indvars.iv92, 1
  %68 = getelementptr inbounds double, ptr %0, i64 %indvars.iv.next93
  %69 = load double, ptr %68, align 8, !tbaa !5
  %70 = fsub double %56, %69
  %71 = fmul double %67, %70
  %indvars.iv.next93.1 = or disjoint i64 %indvars.iv92, 2
  %72 = getelementptr inbounds double, ptr %0, i64 %indvars.iv.next93.1
  %73 = load double, ptr %72, align 8, !tbaa !5
  %74 = fsub double %56, %73
  %75 = fmul double %71, %74
  %indvars.iv.next93.2 = or disjoint i64 %indvars.iv92, 3
  %76 = getelementptr inbounds double, ptr %0, i64 %indvars.iv.next93.2
  %77 = load double, ptr %76, align 8, !tbaa !5
  %78 = fsub double %56, %77
  %79 = fmul double %75, %78
  %indvars.iv.next93.3 = add nuw nsw i64 %indvars.iv92, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.unr-lcssa, label %63, !llvm.loop !19

._crit_edge73.us:                                 ; preds = %.epilog-lcssa
  %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_edge77, label %.lr.ph72.us, !llvm.loop !20

.lr.ph76.split:                                   ; preds = %.lr.ph76.split.preheader122, %.lr.ph76.split
  %indvars.iv87 = phi i64 [ %indvars.iv.next88, %.lr.ph76.split ], [ %indvars.iv87.ph, %.lr.ph76.split.preheader122 ]
  %80 = getelementptr inbounds double, ptr %4, i64 %indvars.iv87
  store double %16, ptr %80, align 8, !tbaa !5
  %indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
  %exitcond91.not = icmp eq i64 %indvars.iv.next88, %wide.trip.count90
  br i1 %exitcond91.not, label %._crit_edge77, label %.lr.ph76.split, !llvm.loop !21

._crit_edge77:                                    ; preds = %.lr.ph76.split, %._crit_edge73.us, %middle.block111, %._crit_edge67.thread, %._crit_edge67
  tail call void @free(ptr noundef %12) #5
  br label %81

81:                                               ; preds = %6, %._crit_edge77, %14
  %.059 = phi i32 [ -1, %14 ], [ 0, %._crit_edge77 ], [ -1, %6 ]
  ret i32 %.059
}

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

; 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 nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

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,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nounwind allocsize(0) }
attributes #5 = { 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, !10}
!15 = distinct !{!15, !10, !11, !12}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10, !12, !11}


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