; LLVM IR from AlgoGenesis/C :: Machine_Learning_Algorithms/K-Nearest Neighbors(KNN) (Program)

; 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.Point = type { ptr, i32 }

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @knn_classify(ptr noundef %0, i32 noundef %1, ptr %2, i32 %3, i32 noundef %4, i32 noundef %5) #0 {
  %7 = alloca %struct.Point, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %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 double, align 8
  %19 = alloca i32, align 4
  %20 = alloca [2 x i32], align 4
  %21 = alloca i32, align 4
  %22 = getelementptr inbounds { ptr, i32 }, ptr %7, i32 0, i32 0
  store ptr %2, ptr %22, align 8
  %23 = getelementptr inbounds { ptr, i32 }, ptr %7, i32 0, i32 1
  store i32 %3, ptr %23, align 8
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i32 %1, ptr %9, align 4, !tbaa !9
  store i32 %4, ptr %10, align 4, !tbaa !9
  store i32 %5, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %24 = load i32, ptr %9, align 4, !tbaa !9
  %25 = sext i32 %24 to i64
  %26 = mul i64 %25, 8
  %27 = call noalias ptr @malloc(i64 noundef %26) #6
  store ptr %27, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %28 = load i32, ptr %9, align 4, !tbaa !9
  %29 = sext i32 %28 to i64
  %30 = mul i64 %29, 4
  %31 = call noalias ptr @malloc(i64 noundef %30) #6
  store ptr %31, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %32

32:                                               ; preds = %66, %6
  %33 = load i32, ptr %14, align 4, !tbaa !9
  %34 = load i32, ptr %9, align 4, !tbaa !9
  %35 = icmp slt i32 %33, %34
  br i1 %35, label %37, label %36

36:                                               ; preds = %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %69

37:                                               ; preds = %32
  %38 = load ptr, ptr %8, align 8, !tbaa !5
  %39 = load i32, ptr %14, align 4, !tbaa !9
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds %struct.Point, ptr %38, i64 %40
  %42 = load i32, ptr %10, align 4, !tbaa !9
  %43 = getelementptr inbounds { ptr, i32 }, ptr %41, i32 0, i32 0
  %44 = load ptr, ptr %43, align 8
  %45 = getelementptr inbounds { ptr, i32 }, ptr %41, i32 0, i32 1
  %46 = load i32, ptr %45, align 8
  %47 = getelementptr inbounds { ptr, i32 }, ptr %7, i32 0, i32 0
  %48 = load ptr, ptr %47, align 8
  %49 = getelementptr inbounds { ptr, i32 }, ptr %7, i32 0, i32 1
  %50 = load i32, ptr %49, align 8
  %51 = call double @euclidean_distance(ptr %44, i32 %46, ptr %48, i32 %50, i32 noundef %42)
  %52 = load ptr, ptr %12, align 8, !tbaa !5
  %53 = load i32, ptr %14, align 4, !tbaa !9
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds double, ptr %52, i64 %54
  store double %51, ptr %55, align 8, !tbaa !11
  %56 = load ptr, ptr %8, align 8, !tbaa !5
  %57 = load i32, ptr %14, align 4, !tbaa !9
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds %struct.Point, ptr %56, i64 %58
  %60 = getelementptr inbounds %struct.Point, ptr %59, i32 0, i32 1
  %61 = load i32, ptr %60, align 8, !tbaa !13
  %62 = load ptr, ptr %13, align 8, !tbaa !5
  %63 = load i32, ptr %14, align 4, !tbaa !9
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds i32, ptr %62, i64 %64
  store i32 %61, ptr %65, align 4, !tbaa !9
  br label %66

66:                                               ; preds = %37
  %67 = load i32, ptr %14, align 4, !tbaa !9
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %14, align 4, !tbaa !9
  br label %32, !llvm.loop !15

69:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %70

70:                                               ; preds = %140, %69
  %71 = load i32, ptr %15, align 4, !tbaa !9
  %72 = load i32, ptr %9, align 4, !tbaa !9
  %73 = sub nsw i32 %72, 1
  %74 = icmp slt i32 %71, %73
  br i1 %74, label %76, label %75

75:                                               ; preds = %70
  store i32 5, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %143

76:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %77 = load i32, ptr %15, align 4, !tbaa !9
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %17, align 4, !tbaa !9
  br label %79

79:                                               ; preds = %136, %76
  %80 = load i32, ptr %17, align 4, !tbaa !9
  %81 = load i32, ptr %9, align 4, !tbaa !9
  %82 = icmp slt i32 %80, %81
  br i1 %82, label %84, label %83

83:                                               ; preds = %79
  store i32 8, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %139

84:                                               ; preds = %79
  %85 = load ptr, ptr %12, align 8, !tbaa !5
  %86 = load i32, ptr %15, align 4, !tbaa !9
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds double, ptr %85, i64 %87
  %89 = load double, ptr %88, align 8, !tbaa !11
  %90 = load ptr, ptr %12, align 8, !tbaa !5
  %91 = load i32, ptr %17, align 4, !tbaa !9
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds double, ptr %90, i64 %92
  %94 = load double, ptr %93, align 8, !tbaa !11
  %95 = fcmp ogt double %89, %94
  br i1 %95, label %96, label %135

96:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %97 = load ptr, ptr %12, align 8, !tbaa !5
  %98 = load i32, ptr %15, align 4, !tbaa !9
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds double, ptr %97, i64 %99
  %101 = load double, ptr %100, align 8, !tbaa !11
  store double %101, ptr %18, align 8, !tbaa !11
  %102 = load ptr, ptr %12, align 8, !tbaa !5
  %103 = load i32, ptr %17, align 4, !tbaa !9
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds double, ptr %102, i64 %104
  %106 = load double, ptr %105, align 8, !tbaa !11
  %107 = load ptr, ptr %12, align 8, !tbaa !5
  %108 = load i32, ptr %15, align 4, !tbaa !9
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds double, ptr %107, i64 %109
  store double %106, ptr %110, align 8, !tbaa !11
  %111 = load double, ptr %18, align 8, !tbaa !11
  %112 = load ptr, ptr %12, align 8, !tbaa !5
  %113 = load i32, ptr %17, align 4, !tbaa !9
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds double, ptr %112, i64 %114
  store double %111, ptr %115, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  %116 = load ptr, ptr %13, align 8, !tbaa !5
  %117 = load i32, ptr %15, align 4, !tbaa !9
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds i32, ptr %116, i64 %118
  %120 = load i32, ptr %119, align 4, !tbaa !9
  store i32 %120, ptr %19, align 4, !tbaa !9
  %121 = load ptr, ptr %13, align 8, !tbaa !5
  %122 = load i32, ptr %17, align 4, !tbaa !9
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds i32, ptr %121, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !9
  %126 = load ptr, ptr %13, align 8, !tbaa !5
  %127 = load i32, ptr %15, align 4, !tbaa !9
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds i32, ptr %126, i64 %128
  store i32 %125, ptr %129, align 4, !tbaa !9
  %130 = load i32, ptr %19, align 4, !tbaa !9
  %131 = load ptr, ptr %13, align 8, !tbaa !5
  %132 = load i32, ptr %17, align 4, !tbaa !9
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds i32, ptr %131, i64 %133
  store i32 %130, ptr %134, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  br label %135

135:                                              ; preds = %96, %84
  br label %136

136:                                              ; preds = %135
  %137 = load i32, ptr %17, align 4, !tbaa !9
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %17, align 4, !tbaa !9
  br label %79, !llvm.loop !17

139:                                              ; preds = %83
  br label %140

140:                                              ; preds = %139
  %141 = load i32, ptr %15, align 4, !tbaa !9
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %15, align 4, !tbaa !9
  br label %70, !llvm.loop !18

143:                                              ; preds = %75
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  call void @llvm.memset.p0.i64(ptr align 4 %20, i8 0, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  store i32 0, ptr %21, align 4, !tbaa !9
  br label %144

144:                                              ; preds = %159, %143
  %145 = load i32, ptr %21, align 4, !tbaa !9
  %146 = load i32, ptr %11, align 4, !tbaa !9
  %147 = icmp slt i32 %145, %146
  br i1 %147, label %149, label %148

148:                                              ; preds = %144
  store i32 11, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  br label %162

149:                                              ; preds = %144
  %150 = load ptr, ptr %13, align 8, !tbaa !5
  %151 = load i32, ptr %21, align 4, !tbaa !9
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds i32, ptr %150, i64 %152
  %154 = load i32, ptr %153, align 4, !tbaa !9
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [2 x i32], ptr %20, i64 0, i64 %155
  %157 = load i32, ptr %156, align 4, !tbaa !9
  %158 = add nsw i32 %157, 1
  store i32 %158, ptr %156, align 4, !tbaa !9
  br label %159

159:                                              ; preds = %149
  %160 = load i32, ptr %21, align 4, !tbaa !9
  %161 = add nsw i32 %160, 1
  store i32 %161, ptr %21, align 4, !tbaa !9
  br label %144, !llvm.loop !19

162:                                              ; preds = %148
  %163 = load ptr, ptr %12, align 8, !tbaa !5
  call void @free(ptr noundef %163) #5
  %164 = load ptr, ptr %13, align 8, !tbaa !5
  call void @free(ptr noundef %164) #5
  %165 = getelementptr inbounds [2 x i32], ptr %20, i64 0, i64 0
  %166 = load i32, ptr %165, align 4, !tbaa !9
  %167 = getelementptr inbounds [2 x i32], ptr %20, i64 0, i64 1
  %168 = load i32, ptr %167, align 4, !tbaa !9
  %169 = icmp sgt i32 %166, %168
  %170 = zext i1 %169 to i64
  %171 = select i1 %169, i32 0, i32 1
  store i32 1, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  ret i32 %171
}

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

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

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

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = !{!14, !10, i64 8}
!14 = !{!"", !6, i64 0, !10, i64 8}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !16}


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

%struct.Point = type { ptr, i32 }

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

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @knn_classify(ptr nocapture noundef readonly %0, i32 noundef %1, ptr %2, i32 %3, i32 noundef %4, i32 noundef %5) local_unnamed_addr #0 {
  %7 = alloca [2 x i32], align 8
  %8 = sext i32 %1 to i64
  %9 = shl nsw i64 %8, 3
  %10 = tail call noalias ptr @malloc(i64 noundef %9) #4
  %11 = shl nsw i64 %8, 2
  %12 = tail call noalias ptr @malloc(i64 noundef %11) #4
  %13 = icmp sgt i32 %1, 0
  br i1 %13, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %6
  %wide.trip.count = zext nneg i32 %1 to i64
  br label %.lr.ph

.preheader:                                       ; preds = %.lr.ph
  %.not = icmp eq i32 %1, 1
  br i1 %.not, label %._crit_edge, label %.lr.ph59.preheader

.lr.ph59.preheader:                               ; preds = %.preheader
  %14 = add nsw i32 %1, -1
  %wide.trip.count75 = zext nneg i32 %14 to i64
  %wide.trip.count70 = zext nneg i32 %1 to i64
  br label %.lr.ph57

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %15 = getelementptr inbounds %struct.Point, ptr %0, i64 %indvars.iv
  %16 = load ptr, ptr %15, align 8
  %17 = getelementptr inbounds i8, ptr %15, i64 8
  %18 = load i32, ptr %17, align 8
  %19 = tail call double @euclidean_distance(ptr %16, i32 %18, ptr %2, i32 %3, i32 noundef %4)
  %20 = getelementptr inbounds double, ptr %10, i64 %indvars.iv
  store double %19, ptr %20, align 8, !tbaa !5
  %21 = load i32, ptr %17, align 8, !tbaa !9
  %22 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv
  store i32 %21, ptr %22, align 4, !tbaa !13
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.preheader, label %.lr.ph, !llvm.loop !14

.loopexit:                                        ; preds = %36
  %indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
  %exitcond76.not = icmp eq i64 %indvars.iv.next73, %wide.trip.count75
  br i1 %exitcond76.not, label %._crit_edge, label %.lr.ph57, !llvm.loop !16

._crit_edge:                                      ; preds = %.loopexit, %6, %.preheader
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  store i64 0, ptr %7, align 8
  %23 = icmp sgt i32 %5, 0
  br i1 %23, label %.lr.ph62.preheader, label %._crit_edge63

.lr.ph62.preheader:                               ; preds = %._crit_edge
  %wide.trip.count80 = zext nneg i32 %5 to i64
  %xtraiter = and i64 %wide.trip.count80, 3
  %24 = icmp ult i32 %5, 4
  br i1 %24, label %._crit_edge63.loopexit.unr-lcssa, label %.lr.ph62.preheader.new

.lr.ph62.preheader.new:                           ; preds = %.lr.ph62.preheader
  %unroll_iter = and i64 %wide.trip.count80, 2147483644
  br label %.lr.ph62

.lr.ph57:                                         ; preds = %.loopexit, %.lr.ph59.preheader
  %indvars.iv72 = phi i64 [ 0, %.lr.ph59.preheader ], [ %indvars.iv.next73, %.loopexit ]
  %indvars.iv65 = phi i64 [ 1, %.lr.ph59.preheader ], [ %indvars.iv.next66, %.loopexit ]
  %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
  %25 = getelementptr inbounds double, ptr %10, i64 %indvars.iv72
  %26 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv72
  br label %27

27:                                               ; preds = %.lr.ph57, %36
  %indvars.iv67 = phi i64 [ %indvars.iv65, %.lr.ph57 ], [ %indvars.iv.next68, %36 ]
  %28 = load double, ptr %25, align 8, !tbaa !5
  %29 = getelementptr inbounds double, ptr %10, i64 %indvars.iv67
  %30 = load double, ptr %29, align 8, !tbaa !5
  %31 = fcmp ogt double %28, %30
  br i1 %31, label %32, label %36

32:                                               ; preds = %27
  store double %30, ptr %25, align 8, !tbaa !5
  store double %28, ptr %29, align 8, !tbaa !5
  %33 = load i32, ptr %26, align 4, !tbaa !13
  %34 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv67
  %35 = load i32, ptr %34, align 4, !tbaa !13
  store i32 %35, ptr %26, align 4, !tbaa !13
  store i32 %33, ptr %34, align 4, !tbaa !13
  br label %36

36:                                               ; preds = %27, %32
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %exitcond71.not = icmp eq i64 %indvars.iv.next68, %wide.trip.count70
  br i1 %exitcond71.not, label %.loopexit, label %27, !llvm.loop !17

._crit_edge63.loopexit.unr-lcssa:                 ; preds = %.lr.ph62, %.lr.ph62.preheader
  %indvars.iv77.unr = phi i64 [ 0, %.lr.ph62.preheader ], [ %indvars.iv.next78.3, %.lr.ph62 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge63.loopexit, label %.lr.ph62.epil

.lr.ph62.epil:                                    ; preds = %._crit_edge63.loopexit.unr-lcssa, %.lr.ph62.epil
  %indvars.iv77.epil = phi i64 [ %indvars.iv.next78.epil, %.lr.ph62.epil ], [ %indvars.iv77.unr, %._crit_edge63.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph62.epil ], [ 0, %._crit_edge63.loopexit.unr-lcssa ]
  %37 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv77.epil
  %38 = load i32, ptr %37, align 4, !tbaa !13
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [2 x i32], ptr %7, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !13
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %40, align 4, !tbaa !13
  %indvars.iv.next78.epil = add nuw nsw i64 %indvars.iv77.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 %._crit_edge63.loopexit, label %.lr.ph62.epil, !llvm.loop !18

._crit_edge63.loopexit:                           ; preds = %.lr.ph62.epil, %._crit_edge63.loopexit.unr-lcssa
  %.pre = load i32, ptr %7, align 8, !tbaa !13
  %.phi.trans.insert = getelementptr inbounds i8, ptr %7, i64 4
  %.pre82 = load i32, ptr %.phi.trans.insert, align 4, !tbaa !13
  br label %._crit_edge63

._crit_edge63:                                    ; preds = %._crit_edge63.loopexit, %._crit_edge
  %43 = phi i32 [ %.pre82, %._crit_edge63.loopexit ], [ 0, %._crit_edge ]
  %44 = phi i32 [ %.pre, %._crit_edge63.loopexit ], [ 0, %._crit_edge ]
  tail call void @free(ptr noundef %10) #5
  tail call void @free(ptr noundef %12) #5
  %45 = icmp sle i32 %44, %43
  %46 = zext i1 %45 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  ret i32 %46

.lr.ph62:                                         ; preds = %.lr.ph62, %.lr.ph62.preheader.new
  %indvars.iv77 = phi i64 [ 0, %.lr.ph62.preheader.new ], [ %indvars.iv.next78.3, %.lr.ph62 ]
  %niter = phi i64 [ 0, %.lr.ph62.preheader.new ], [ %niter.next.3, %.lr.ph62 ]
  %47 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv77
  %48 = load i32, ptr %47, align 4, !tbaa !13
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [2 x i32], ptr %7, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !13
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %50, align 4, !tbaa !13
  %indvars.iv.next78 = or disjoint i64 %indvars.iv77, 1
  %53 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv.next78
  %54 = load i32, ptr %53, align 4, !tbaa !13
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [2 x i32], ptr %7, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !13
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %56, align 4, !tbaa !13
  %indvars.iv.next78.1 = or disjoint i64 %indvars.iv77, 2
  %59 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv.next78.1
  %60 = load i32, ptr %59, align 4, !tbaa !13
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [2 x i32], ptr %7, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !13
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %62, align 4, !tbaa !13
  %indvars.iv.next78.2 = or disjoint i64 %indvars.iv77, 3
  %65 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv.next78.2
  %66 = load i32, ptr %65, align 4, !tbaa !13
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [2 x i32], ptr %7, i64 0, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !13
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %68, align 4, !tbaa !13
  %indvars.iv.next78.3 = add nuw nsw i64 %indvars.iv77, 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_edge63.loopexit.unr-lcssa, label %.lr.ph62, !llvm.loop !20
}

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

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind 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 = !{!10, !12, i64 8}
!10 = !{!"", !11, i64 0, !12, i64 8}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!12, !12, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.unroll.disable"}
!20 = distinct !{!20, !15}


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