; LLVM IR from viplix3/BoTSORT-cpp :: botsort/src/lapjv.ll (Z15find_path_densejPPdiPiS_S1_)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @_Z15find_path_densejPPdiPiS_S1_(i32 noundef %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #3 {
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca double, align 8
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  store i32 %0, ptr %8, align 4, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !9
  store i32 %2, ptr %10, align 4, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !9
  store ptr %4, ptr %12, align 8, !tbaa !9
  store ptr %5, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  store i32 0, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  store i32 0, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  store i32 -1, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  store i32 0, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  %27 = load i32, ptr %8, align 4, !tbaa !5
  %28 = zext i32 %27 to i64
  %29 = mul i64 4, %28
  %30 = call noalias ptr @malloc(i64 noundef %29) #5
  store ptr %30, ptr %18, align 8, !tbaa !9
  %31 = icmp eq ptr %30, null
  br i1 %31, label %32, label %33

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

33:                                               ; preds = %6
  %34 = load i32, ptr %8, align 4, !tbaa !5
  %35 = zext i32 %34 to i64
  %36 = mul i64 8, %35
  %37 = call noalias ptr @malloc(i64 noundef %36) #5
  store ptr %37, ptr %19, align 8, !tbaa !9
  %38 = icmp eq ptr %37, null
  br i1 %38, label %39, label %40

39:                                               ; preds = %33
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %20, align 4
  br label %182

40:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #4
  store i32 0, ptr %21, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %76, %40
  %42 = load i32, ptr %21, align 4, !tbaa !5
  %43 = load i32, ptr %8, align 4, !tbaa !5
  %44 = icmp ult i32 %42, %43
  br i1 %44, label %46, label %45

45:                                               ; preds = %41
  store i32 2, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  br label %79

46:                                               ; preds = %41
  %47 = load i32, ptr %21, align 4, !tbaa !5
  %48 = load ptr, ptr %18, align 8, !tbaa !9
  %49 = load i32, ptr %21, align 4, !tbaa !5
  %50 = zext i32 %49 to i64
  %51 = getelementptr inbounds i32, ptr %48, i64 %50
  store i32 %47, ptr %51, align 4, !tbaa !5
  %52 = load i32, ptr %10, align 4, !tbaa !5
  %53 = load ptr, ptr %13, align 8, !tbaa !9
  %54 = load i32, ptr %21, align 4, !tbaa !5
  %55 = zext i32 %54 to i64
  %56 = getelementptr inbounds i32, ptr %53, i64 %55
  store i32 %52, ptr %56, align 4, !tbaa !5
  %57 = load ptr, ptr %9, align 8, !tbaa !9
  %58 = load i32, ptr %10, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds ptr, ptr %57, i64 %59
  %61 = load ptr, ptr %60, align 8, !tbaa !9
  %62 = load i32, ptr %21, align 4, !tbaa !5
  %63 = zext i32 %62 to i64
  %64 = getelementptr inbounds double, ptr %61, i64 %63
  %65 = load double, ptr %64, align 8, !tbaa !11
  %66 = load ptr, ptr %12, align 8, !tbaa !9
  %67 = load i32, ptr %21, align 4, !tbaa !5
  %68 = zext i32 %67 to i64
  %69 = getelementptr inbounds double, ptr %66, i64 %68
  %70 = load double, ptr %69, align 8, !tbaa !11
  %71 = fsub double %65, %70
  %72 = load ptr, ptr %19, align 8, !tbaa !9
  %73 = load i32, ptr %21, align 4, !tbaa !5
  %74 = zext i32 %73 to i64
  %75 = getelementptr inbounds double, ptr %72, i64 %74
  store double %71, ptr %75, align 8, !tbaa !11
  br label %76

76:                                               ; preds = %46
  %77 = load i32, ptr %21, align 4, !tbaa !5
  %78 = add i32 %77, 1
  store i32 %78, ptr %21, align 4, !tbaa !5
  br label %41, !llvm.loop !13

79:                                               ; preds = %45
  br label %80

80:                                               ; preds = %132, %79
  %81 = load i32, ptr %16, align 4, !tbaa !5
  %82 = icmp eq i32 %81, -1
  br i1 %82, label %83, label %133

83:                                               ; preds = %80
  %84 = load i32, ptr %14, align 4, !tbaa !5
  %85 = load i32, ptr %15, align 4, !tbaa !5
  %86 = icmp eq i32 %84, %85
  br i1 %86, label %87, label %120

87:                                               ; preds = %83
  %88 = load i32, ptr %14, align 4, !tbaa !5
  store i32 %88, ptr %17, align 4, !tbaa !5
  %89 = load i32, ptr %8, align 4, !tbaa !5
  %90 = load i32, ptr %14, align 4, !tbaa !5
  %91 = load ptr, ptr %19, align 8, !tbaa !9
  %92 = load ptr, ptr %18, align 8, !tbaa !9
  %93 = load ptr, ptr %11, align 8, !tbaa !9
  %94 = call noundef i32 @_Z11_find_densejjPdPiS0_(i32 noundef %89, i32 noundef %90, ptr noundef %91, ptr noundef %92, ptr noundef %93)
  store i32 %94, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #4
  %95 = load i32, ptr %14, align 4, !tbaa !5
  store i32 %95, ptr %22, align 4, !tbaa !5
  br label %96

96:                                               ; preds = %116, %87
  %97 = load i32, ptr %22, align 4, !tbaa !5
  %98 = load i32, ptr %15, align 4, !tbaa !5
  %99 = icmp ult i32 %97, %98
  br i1 %99, label %101, label %100

100:                                              ; preds = %96
  store i32 7, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  br label %119

101:                                              ; preds = %96
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #4
  %102 = load ptr, ptr %18, align 8, !tbaa !9
  %103 = load i32, ptr %22, align 4, !tbaa !5
  %104 = zext i32 %103 to i64
  %105 = getelementptr inbounds i32, ptr %102, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !5
  store i32 %106, ptr %23, align 4, !tbaa !5
  %107 = load ptr, ptr %11, align 8, !tbaa !9
  %108 = load i32, ptr %23, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds i32, ptr %107, i64 %109
  %111 = load i32, ptr %110, align 4, !tbaa !5
  %112 = icmp slt i32 %111, 0
  br i1 %112, label %113, label %115

113:                                              ; preds = %101
  %114 = load i32, ptr %23, align 4, !tbaa !5
  store i32 %114, ptr %16, align 4, !tbaa !5
  br label %115

115:                                              ; preds = %113, %101
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #4
  br label %116

116:                                              ; preds = %115
  %117 = load i32, ptr %22, align 4, !tbaa !5
  %118 = add i32 %117, 1
  store i32 %118, ptr %22, align 4, !tbaa !5
  br label %96, !llvm.loop !15

119:                                              ; preds = %100
  br label %120

120:                                              ; preds = %119, %83
  %121 = load i32, ptr %16, align 4, !tbaa !5
  %122 = icmp eq i32 %121, -1
  br i1 %122, label %123, label %132

123:                                              ; preds = %120
  %124 = load i32, ptr %8, align 4, !tbaa !5
  %125 = load ptr, ptr %9, align 8, !tbaa !9
  %126 = load ptr, ptr %19, align 8, !tbaa !9
  %127 = load ptr, ptr %18, align 8, !tbaa !9
  %128 = load ptr, ptr %13, align 8, !tbaa !9
  %129 = load ptr, ptr %11, align 8, !tbaa !9
  %130 = load ptr, ptr %12, align 8, !tbaa !9
  %131 = call noundef i32 @_Z11_scan_densejPPdPjS1_S_PiS2_S2_S_(i32 noundef %124, ptr noundef %125, ptr noundef %14, ptr noundef %15, ptr noundef %126, ptr noundef %127, ptr noundef %128, ptr noundef %129, ptr noundef %130)
  store i32 %131, ptr %16, align 4, !tbaa !5
  br label %132

132:                                              ; preds = %123, %120
  br label %80, !llvm.loop !16

133:                                              ; preds = %80
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #4
  %134 = load ptr, ptr %19, align 8, !tbaa !9
  %135 = load ptr, ptr %18, align 8, !tbaa !9
  %136 = load i32, ptr %14, align 4, !tbaa !5
  %137 = zext i32 %136 to i64
  %138 = getelementptr inbounds i32, ptr %135, i64 %137
  %139 = load i32, ptr %138, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds double, ptr %134, i64 %140
  %142 = load double, ptr %141, align 8, !tbaa !11
  store double %142, ptr %24, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #4
  store i32 0, ptr %25, align 4, !tbaa !5
  br label %143

143:                                              ; preds = %167, %133
  %144 = load i32, ptr %25, align 4, !tbaa !5
  %145 = load i32, ptr %17, align 4, !tbaa !5
  %146 = icmp ult i32 %144, %145
  br i1 %146, label %148, label %147

147:                                              ; preds = %143
  store i32 10, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #4
  br label %170

148:                                              ; preds = %143
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #4
  %149 = load ptr, ptr %18, align 8, !tbaa !9
  %150 = load i32, ptr %25, align 4, !tbaa !5
  %151 = zext i32 %150 to i64
  %152 = getelementptr inbounds i32, ptr %149, i64 %151
  %153 = load i32, ptr %152, align 4, !tbaa !5
  store i32 %153, ptr %26, align 4, !tbaa !5
  %154 = load ptr, ptr %19, align 8, !tbaa !9
  %155 = load i32, ptr %26, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds double, ptr %154, i64 %156
  %158 = load double, ptr %157, align 8, !tbaa !11
  %159 = load double, ptr %24, align 8, !tbaa !11
  %160 = fsub double %158, %159
  %161 = load ptr, ptr %12, align 8, !tbaa !9
  %162 = load i32, ptr %26, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds double, ptr %161, i64 %163
  %165 = load double, ptr %164, align 8, !tbaa !11
  %166 = fadd double %165, %160
  store double %166, ptr %164, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #4
  br label %167

167:                                              ; preds = %148
  %168 = load i32, ptr %25, align 4, !tbaa !5
  %169 = add i32 %168, 1
  store i32 %169, ptr %25, align 4, !tbaa !5
  br label %143, !llvm.loop !17

170:                                              ; preds = %147
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #4
  %171 = load ptr, ptr %18, align 8, !tbaa !9
  %172 = icmp ne ptr %171, null
  br i1 %172, label %173, label %175

173:                                              ; preds = %170
  %174 = load ptr, ptr %18, align 8, !tbaa !9
  call void @free(ptr noundef %174) #4
  store ptr null, ptr %18, align 8, !tbaa !9
  br label %175

175:                                              ; preds = %173, %170
  %176 = load ptr, ptr %19, align 8, !tbaa !9
  %177 = icmp ne ptr %176, null
  br i1 %177, label %178, label %180

178:                                              ; preds = %175
  %179 = load ptr, ptr %19, align 8, !tbaa !9
  call void @free(ptr noundef %179) #4
  store ptr null, ptr %19, align 8, !tbaa !9
  br label %180

180:                                              ; preds = %178, %175
  %181 = load i32, ptr %16, align 4, !tbaa !5
  store i32 %181, ptr %7, align 4
  store i32 1, ptr %20, align 4
  br label %182

182:                                              ; preds = %180, %39, %32
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  %183 = load i32, ptr %7, align 4
  ret i32 %183
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind allocsize(0) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}


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

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

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

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

; 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 nounwind uwtable
declare dso_local noundef i32 @_Z11_find_densejjPdPiS0_(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @_Z15find_path_densejPPdiPiS_S1_(i32 noundef %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) local_unnamed_addr #3 {
  %7 = ptrtoint ptr %4 to i64
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #4
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #4
  store i32 0, ptr %9, align 4, !tbaa !5
  %10 = zext i32 %0 to i64
  %11 = shl nuw nsw i64 %10, 2
  %12 = tail call noalias ptr @malloc(i64 noundef %11) #5
  %13 = icmp eq ptr %12, null
  br i1 %13, label %143, label %14

14:                                               ; preds = %6
  %15 = shl nuw nsw i64 %10, 3
  %16 = tail call noalias ptr @malloc(i64 noundef %15) #5
  %17 = ptrtoint ptr %16 to i64
  %18 = icmp eq ptr %16, null
  br i1 %18, label %143, label %.preheader69

.preheader69:                                     ; preds = %14
  %.not = icmp eq i32 %0, 0
  br i1 %.not, label %.preheader.preheader, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader69
  %19 = sext i32 %2 to i64
  %20 = getelementptr inbounds ptr, ptr %1, i64 %19
  %21 = load ptr, ptr %20, align 8, !tbaa !9
  %min.iters.check = icmp ult i32 %0, 6
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.memcheck

vector.memcheck:                                  ; preds = %.lr.ph
  %22 = ptrtoint ptr %21 to i64
  %23 = sub i64 %17, %22
  %diff.check = icmp ult i64 %23, 32
  %24 = sub i64 %17, %7
  %diff.check97 = icmp ult i64 %24, 32
  %conflict.rdx = or i1 %diff.check, %diff.check97
  br i1 %conflict.rdx, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %vector.memcheck
  %n.vec = and i64 %10, 4294967292
  %broadcast.splatinsert = insertelement <2 x i32> poison, i32 %2, i64 0
  %broadcast.splat = shufflevector <2 x i32> %broadcast.splatinsert, <2 x i32> 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 ]
  %vec.ind = phi <2 x i32> [ <i32 0, i32 1>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %step.add = add <2 x i32> %vec.ind, <i32 2, i32 2>
  %25 = getelementptr inbounds i32, ptr %12, i64 %index
  %26 = getelementptr inbounds i8, ptr %25, i64 8
  store <2 x i32> %vec.ind, ptr %25, align 4, !tbaa !5
  store <2 x i32> %step.add, ptr %26, align 4, !tbaa !5
  %27 = getelementptr inbounds i32, ptr %5, i64 %index
  %28 = getelementptr inbounds i8, ptr %27, i64 8
  store <2 x i32> %broadcast.splat, ptr %27, align 4, !tbaa !5
  store <2 x i32> %broadcast.splat, ptr %28, align 4, !tbaa !5
  %29 = getelementptr inbounds double, ptr %21, i64 %index
  %30 = getelementptr inbounds i8, ptr %29, i64 16
  %wide.load = load <2 x double>, ptr %29, align 8, !tbaa !11
  %wide.load99 = load <2 x double>, ptr %30, align 8, !tbaa !11
  %31 = getelementptr inbounds double, ptr %4, i64 %index
  %32 = getelementptr inbounds i8, ptr %31, i64 16
  %wide.load100 = load <2 x double>, ptr %31, align 8, !tbaa !11
  %wide.load101 = load <2 x double>, ptr %32, align 8, !tbaa !11
  %33 = fsub <2 x double> %wide.load, %wide.load100
  %34 = fsub <2 x double> %wide.load99, %wide.load101
  %35 = getelementptr inbounds double, ptr %16, i64 %index
  %36 = getelementptr inbounds i8, ptr %35, i64 16
  store <2 x double> %33, ptr %35, align 8, !tbaa !11
  store <2 x double> %34, ptr %36, align 8, !tbaa !11
  %index.next = add nuw i64 %index, 4
  %vec.ind.next = add <2 x i32> %vec.ind, <i32 4, i32 4>
  %37 = icmp eq i64 %index.next, %n.vec
  br i1 %37, label %middle.block, label %vector.body, !llvm.loop !13

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %10
  br i1 %cmp.n, label %.preheader.preheader, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %middle.block, %vector.memcheck, %.lr.ph
  %indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %.lr.ph ], [ %n.vec, %middle.block ]
  %xtraiter = and i64 %10, 1
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol

scalar.ph.prol:                                   ; preds = %scalar.ph.preheader
  %38 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv.ph
  %39 = trunc nuw i64 %indvars.iv.ph to i32
  store i32 %39, ptr %38, align 4, !tbaa !5
  %40 = getelementptr inbounds i32, ptr %5, i64 %indvars.iv.ph
  store i32 %2, ptr %40, align 4, !tbaa !5
  %41 = getelementptr inbounds double, ptr %21, i64 %indvars.iv.ph
  %42 = load double, ptr %41, align 8, !tbaa !11
  %43 = getelementptr inbounds double, ptr %4, i64 %indvars.iv.ph
  %44 = load double, ptr %43, align 8, !tbaa !11
  %45 = fsub double %42, %44
  %46 = getelementptr inbounds double, ptr %16, i64 %indvars.iv.ph
  store double %45, ptr %46, align 8, !tbaa !11
  %indvars.iv.next.prol = or disjoint i64 %indvars.iv.ph, 1
  br label %scalar.ph.prol.loopexit

scalar.ph.prol.loopexit:                          ; preds = %scalar.ph.prol, %scalar.ph.preheader
  %indvars.iv.unr = phi i64 [ %indvars.iv.ph, %scalar.ph.preheader ], [ %indvars.iv.next.prol, %scalar.ph.prol ]
  %47 = add nsw i64 %10, -1
  %48 = icmp eq i64 %indvars.iv.ph, %47
  br i1 %48, label %.preheader.preheader, label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.prol.loopexit, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next.1, %scalar.ph ], [ %indvars.iv.unr, %scalar.ph.prol.loopexit ]
  %49 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv
  %50 = trunc nuw i64 %indvars.iv to i32
  store i32 %50, ptr %49, align 4, !tbaa !5
  %51 = getelementptr inbounds i32, ptr %5, i64 %indvars.iv
  store i32 %2, ptr %51, align 4, !tbaa !5
  %52 = getelementptr inbounds double, ptr %21, i64 %indvars.iv
  %53 = load double, ptr %52, align 8, !tbaa !11
  %54 = getelementptr inbounds double, ptr %4, i64 %indvars.iv
  %55 = load double, ptr %54, align 8, !tbaa !11
  %56 = fsub double %53, %55
  %57 = getelementptr inbounds double, ptr %16, i64 %indvars.iv
  store double %56, ptr %57, align 8, !tbaa !11
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %58 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv.next
  %59 = trunc nuw i64 %indvars.iv.next to i32
  store i32 %59, ptr %58, align 4, !tbaa !5
  %60 = getelementptr inbounds i32, ptr %5, i64 %indvars.iv.next
  store i32 %2, ptr %60, align 4, !tbaa !5
  %61 = getelementptr inbounds double, ptr %21, i64 %indvars.iv.next
  %62 = load double, ptr %61, align 8, !tbaa !11
  %63 = getelementptr inbounds double, ptr %4, i64 %indvars.iv.next
  %64 = load double, ptr %63, align 8, !tbaa !11
  %65 = fsub double %62, %64
  %66 = getelementptr inbounds double, ptr %16, i64 %indvars.iv.next
  store double %65, ptr %66, align 8, !tbaa !11
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, %10
  br i1 %exitcond.not.1, label %.preheader.preheader, label %scalar.ph, !llvm.loop !17

.preheader.preheader:                             ; preds = %scalar.ph.prol.loopexit, %scalar.ph, %middle.block, %.preheader69
  %invariant.gep = getelementptr inbounds i8, ptr %12, i64 4
  %invariant.gep110 = getelementptr inbounds i8, ptr %12, i64 8
  %invariant.gep112 = getelementptr inbounds i8, ptr %12, i64 12
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge.thread
  %.05774 = phi i32 [ %.15868, %._crit_edge.thread ], [ 0, %.preheader.preheader ]
  %67 = load i32, ptr %8, align 4, !tbaa !5
  %68 = load i32, ptr %9, align 4, !tbaa !5
  %69 = icmp eq i32 %67, %68
  br i1 %69, label %70, label %._crit_edge.thread

70:                                               ; preds = %.preheader
  %71 = call noundef i32 @_Z11_find_densejjPdPiS0_(i32 noundef %0, i32 noundef %67, ptr noundef nonnull %16, ptr noundef nonnull %12, ptr noundef %3)
  store i32 %71, ptr %9, align 4, !tbaa !5
  %72 = load i32, ptr %8, align 4, !tbaa !5
  %73 = icmp ult i32 %72, %71
  br i1 %73, label %.lr.ph73.preheader, label %._crit_edge.thread

.lr.ph73.preheader:                               ; preds = %70
  %74 = zext i32 %72 to i64
  %wide.trip.count84 = zext i32 %71 to i64
  %75 = sub nsw i64 %wide.trip.count84, %74
  %xtraiter102 = and i64 %75, 3
  %76 = sub nsw i64 %74, %wide.trip.count84
  %77 = icmp ugt i64 %76, -4
  br i1 %77, label %._crit_edge.unr-lcssa, label %.lr.ph73.preheader.new

.lr.ph73.preheader.new:                           ; preds = %.lr.ph73.preheader
  %unroll_iter = and i64 %75, -4
  br label %.lr.ph73

.lr.ph73:                                         ; preds = %.lr.ph73, %.lr.ph73.preheader.new
  %indvars.iv81 = phi i64 [ %74, %.lr.ph73.preheader.new ], [ %indvars.iv.next82.3, %.lr.ph73 ]
  %.172 = phi i32 [ -1, %.lr.ph73.preheader.new ], [ %spec.select.3, %.lr.ph73 ]
  %niter = phi i64 [ 0, %.lr.ph73.preheader.new ], [ %niter.next.3, %.lr.ph73 ]
  %78 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv81
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds i32, ptr %3, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = icmp slt i32 %82, 0
  %spec.select = select i1 %83, i32 %79, i32 %.172
  %gep = getelementptr inbounds i32, ptr %invariant.gep, i64 %indvars.iv81
  %84 = load i32, ptr %gep, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds i32, ptr %3, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = icmp slt i32 %87, 0
  %spec.select.1 = select i1 %88, i32 %84, i32 %spec.select
  %gep111 = getelementptr inbounds i32, ptr %invariant.gep110, i64 %indvars.iv81
  %89 = load i32, ptr %gep111, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds i32, ptr %3, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = icmp slt i32 %92, 0
  %spec.select.2 = select i1 %93, i32 %89, i32 %spec.select.1
  %gep113 = getelementptr inbounds i32, ptr %invariant.gep112, i64 %indvars.iv81
  %94 = load i32, ptr %gep113, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds i32, ptr %3, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = icmp slt i32 %97, 0
  %spec.select.3 = select i1 %98, i32 %94, i32 %spec.select.2
  %indvars.iv.next82.3 = add nuw nsw i64 %indvars.iv81, 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 %._crit_edge.unr-lcssa, label %.lr.ph73, !llvm.loop !18

._crit_edge.unr-lcssa:                            ; preds = %.lr.ph73, %.lr.ph73.preheader
  %spec.select.lcssa.ph = phi i32 [ poison, %.lr.ph73.preheader ], [ %spec.select.3, %.lr.ph73 ]
  %indvars.iv81.unr = phi i64 [ %74, %.lr.ph73.preheader ], [ %indvars.iv.next82.3, %.lr.ph73 ]
  %.172.unr = phi i32 [ -1, %.lr.ph73.preheader ], [ %spec.select.3, %.lr.ph73 ]
  %lcmp.mod103.not = icmp eq i64 %xtraiter102, 0
  br i1 %lcmp.mod103.not, label %._crit_edge, label %.lr.ph73.epil

.lr.ph73.epil:                                    ; preds = %._crit_edge.unr-lcssa, %.lr.ph73.epil
  %indvars.iv81.epil = phi i64 [ %indvars.iv.next82.epil, %.lr.ph73.epil ], [ %indvars.iv81.unr, %._crit_edge.unr-lcssa ]
  %.172.epil = phi i32 [ %spec.select.epil, %.lr.ph73.epil ], [ %.172.unr, %._crit_edge.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph73.epil ], [ 0, %._crit_edge.unr-lcssa ]
  %99 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv81.epil
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds i32, ptr %3, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = icmp slt i32 %103, 0
  %spec.select.epil = select i1 %104, i32 %100, i32 %.172.epil
  %indvars.iv.next82.epil = add nuw nsw i64 %indvars.iv81.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter102
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.lr.ph73.epil, !llvm.loop !19

._crit_edge:                                      ; preds = %.lr.ph73.epil, %._crit_edge.unr-lcssa
  %spec.select.lcssa = phi i32 [ %spec.select.lcssa.ph, %._crit_edge.unr-lcssa ], [ %spec.select.epil, %.lr.ph73.epil ]
  %105 = icmp eq i32 %spec.select.lcssa, -1
  br i1 %105, label %._crit_edge.thread, label %.thread92

._crit_edge.thread:                               ; preds = %70, %._crit_edge, %.preheader
  %.15868 = phi i32 [ %67, %._crit_edge ], [ %.05774, %.preheader ], [ %67, %70 ]
  %106 = call noundef i32 @_Z11_scan_densejPPdPjS1_S_PiS2_S2_S_(i32 noundef %0, ptr noundef %1, ptr noundef nonnull %8, ptr noundef nonnull %9, ptr noundef nonnull %16, ptr noundef nonnull %12, ptr noundef %5, ptr noundef %3, ptr noundef %4)
  %107 = icmp eq i32 %106, -1
  br i1 %107, label %.preheader, label %.thread92, !llvm.loop !21

.thread92:                                        ; preds = %._crit_edge, %._crit_edge.thread
  %.496 = phi i32 [ %106, %._crit_edge.thread ], [ %spec.select.lcssa, %._crit_edge ]
  %.1586795 = phi i32 [ %.15868, %._crit_edge.thread ], [ %67, %._crit_edge ]
  %108 = load i32, ptr %8, align 4, !tbaa !5
  %109 = zext i32 %108 to i64
  %110 = getelementptr inbounds i32, ptr %12, i64 %109
  %111 = load i32, ptr %110, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds double, ptr %16, i64 %112
  %114 = load double, ptr %113, align 8, !tbaa !11
  %.not79 = icmp eq i32 %.1586795, 0
  br i1 %.not79, label %._crit_edge78, label %.lr.ph77.preheader

.lr.ph77.preheader:                               ; preds = %.thread92
  %wide.trip.count89 = zext i32 %.1586795 to i64
  %xtraiter105 = and i64 %wide.trip.count89, 1
  %115 = icmp eq i32 %.1586795, 1
  br i1 %115, label %._crit_edge78.loopexit.unr-lcssa, label %.lr.ph77.preheader.new

.lr.ph77.preheader.new:                           ; preds = %.lr.ph77.preheader
  %unroll_iter108 = and i64 %wide.trip.count89, 4294967294
  br label %.lr.ph77

.lr.ph77:                                         ; preds = %.lr.ph77, %.lr.ph77.preheader.new
  %indvars.iv86 = phi i64 [ 0, %.lr.ph77.preheader.new ], [ %indvars.iv.next87.1, %.lr.ph77 ]
  %niter109 = phi i64 [ 0, %.lr.ph77.preheader.new ], [ %niter109.next.1, %.lr.ph77 ]
  %116 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv86
  %117 = load i32, ptr %116, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds double, ptr %16, i64 %118
  %120 = load double, ptr %119, align 8, !tbaa !11
  %121 = fsub double %120, %114
  %122 = getelementptr inbounds double, ptr %4, i64 %118
  %123 = load double, ptr %122, align 8, !tbaa !11
  %124 = fadd double %123, %121
  store double %124, ptr %122, align 8, !tbaa !11
  %indvars.iv.next87 = or disjoint i64 %indvars.iv86, 1
  %125 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv.next87
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds double, ptr %16, i64 %127
  %129 = load double, ptr %128, align 8, !tbaa !11
  %130 = fsub double %129, %114
  %131 = getelementptr inbounds double, ptr %4, i64 %127
  %132 = load double, ptr %131, align 8, !tbaa !11
  %133 = fadd double %132, %130
  store double %133, ptr %131, align 8, !tbaa !11
  %indvars.iv.next87.1 = add nuw nsw i64 %indvars.iv86, 2
  %niter109.next.1 = add i64 %niter109, 2
  %niter109.ncmp.1 = icmp eq i64 %niter109.next.1, %unroll_iter108
  br i1 %niter109.ncmp.1, label %._crit_edge78.loopexit.unr-lcssa, label %.lr.ph77, !llvm.loop !22

._crit_edge78.loopexit.unr-lcssa:                 ; preds = %.lr.ph77, %.lr.ph77.preheader
  %indvars.iv86.unr = phi i64 [ 0, %.lr.ph77.preheader ], [ %indvars.iv.next87.1, %.lr.ph77 ]
  %lcmp.mod107.not = icmp eq i64 %xtraiter105, 0
  br i1 %lcmp.mod107.not, label %._crit_edge78, label %.lr.ph77.epil

.lr.ph77.epil:                                    ; preds = %._crit_edge78.loopexit.unr-lcssa
  %134 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv86.unr
  %135 = load i32, ptr %134, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds double, ptr %16, i64 %136
  %138 = load double, ptr %137, align 8, !tbaa !11
  %139 = fsub double %138, %114
  %140 = getelementptr inbounds double, ptr %4, i64 %136
  %141 = load double, ptr %140, align 8, !tbaa !11
  %142 = fadd double %141, %139
  store double %142, ptr %140, align 8, !tbaa !11
  br label %._crit_edge78

._crit_edge78:                                    ; preds = %.lr.ph77.epil, %._crit_edge78.loopexit.unr-lcssa, %.thread92
  call void @free(ptr noundef nonnull %12) #4
  call void @free(ptr noundef nonnull %16) #4
  br label %143

143:                                              ; preds = %14, %6, %._crit_edge78
  %.0 = phi i32 [ %.496, %._crit_edge78 ], [ -1, %6 ], [ -1, %14 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  ret i32 %.0
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { nounwind allocsize(0) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14, !15, !16}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !14, !15}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.unroll.disable"}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !14}


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