; LLVM IR from bondhugula/pluto :: test (kmeans)

; 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 void @k_classify_local(ptr noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, i32 noundef %6, i32 noundef %7) #0 {
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca float, align 4
  %22 = alloca float, align 4
  %23 = alloca float, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store i32 %1, ptr %10, align 4, !tbaa !9
  store i32 %2, ptr %11, align 4, !tbaa !9
  store ptr %3, ptr %12, align 8, !tbaa !5
  store ptr %4, ptr %13, align 8, !tbaa !5
  store ptr %5, ptr %14, align 8, !tbaa !5
  store i32 %6, ptr %15, align 4, !tbaa !9
  store i32 %7, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #3
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %24

24:                                               ; preds = %98, %8
  %25 = load i32, ptr %17, align 4, !tbaa !9
  %26 = load i32, ptr %10, align 4, !tbaa !9
  %27 = icmp ult i32 %25, %26
  br i1 %27, label %28, label %101

28:                                               ; preds = %24
  store i32 -1, ptr %20, align 4, !tbaa !9
  store float 0x47EFFFFFE0000000, ptr %21, align 4, !tbaa !11
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %29

29:                                               ; preds = %72, %28
  %30 = load i32, ptr %18, align 4, !tbaa !9
  %31 = load i32, ptr %15, align 4, !tbaa !9
  %32 = icmp ult i32 %30, %31
  br i1 %32, label %33, label %75

33:                                               ; preds = %29
  store float 0.000000e+00, ptr %22, align 4, !tbaa !11
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %34

34:                                               ; preds = %50, %33
  %35 = load i32, ptr %19, align 4, !tbaa !9
  %36 = load i32, ptr %16, align 4, !tbaa !9
  %37 = icmp ult i32 %35, %36
  br i1 %37, label %38, label %53

38:                                               ; preds = %34
  %39 = load ptr, ptr %12, align 8, !tbaa !5
  %40 = getelementptr inbounds float, ptr %39, i64 0
  %41 = load float, ptr %40, align 4, !tbaa !11
  %42 = load ptr, ptr %9, align 8, !tbaa !5
  %43 = getelementptr inbounds float, ptr %42, i64 0
  %44 = load float, ptr %43, align 4, !tbaa !11
  %45 = fsub float %41, %44
  store float %45, ptr %23, align 4, !tbaa !11
  %46 = load float, ptr %23, align 4, !tbaa !11
  %47 = load float, ptr %23, align 4, !tbaa !11
  %48 = load float, ptr %22, align 4, !tbaa !11
  %49 = call float @llvm.fmuladd.f32(float %46, float %47, float %48)
  store float %49, ptr %22, align 4, !tbaa !11
  br label %50

50:                                               ; preds = %38
  %51 = load i32, ptr %19, align 4, !tbaa !9
  %52 = add i32 %51, 1
  store i32 %52, ptr %19, align 4, !tbaa !9
  br label %34, !llvm.loop !13

53:                                               ; preds = %34
  %54 = load float, ptr %22, align 4, !tbaa !11
  %55 = load float, ptr %21, align 4, !tbaa !11
  %56 = fcmp olt float %54, %55
  br i1 %56, label %57, label %59

57:                                               ; preds = %53
  %58 = load float, ptr %22, align 4, !tbaa !11
  br label %61

59:                                               ; preds = %53
  %60 = load float, ptr %21, align 4, !tbaa !11
  br label %61

61:                                               ; preds = %59, %57
  %62 = phi float [ %58, %57 ], [ %60, %59 ]
  store float %62, ptr %21, align 4, !tbaa !11
  %63 = load float, ptr %22, align 4, !tbaa !11
  %64 = load float, ptr %21, align 4, !tbaa !11
  %65 = fcmp olt float %63, %64
  br i1 %65, label %66, label %68

66:                                               ; preds = %61
  %67 = load i32, ptr %18, align 4, !tbaa !9
  br label %70

68:                                               ; preds = %61
  %69 = load i32, ptr %20, align 4, !tbaa !9
  br label %70

70:                                               ; preds = %68, %66
  %71 = phi i32 [ %67, %66 ], [ %69, %68 ]
  store i32 %71, ptr %20, align 4, !tbaa !9
  br label %72

72:                                               ; preds = %70
  %73 = load i32, ptr %18, align 4, !tbaa !9
  %74 = add i32 %73, 1
  store i32 %74, ptr %18, align 4, !tbaa !9
  br label %29, !llvm.loop !15

75:                                               ; preds = %29
  %76 = load ptr, ptr %14, align 8, !tbaa !5
  %77 = load i32, ptr %20, align 4, !tbaa !9
  %78 = zext i32 %77 to i64
  %79 = getelementptr inbounds i32, ptr %76, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !9
  %81 = add i32 %80, 1
  store i32 %81, ptr %79, align 4, !tbaa !9
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %82

82:                                               ; preds = %94, %75
  %83 = load i32, ptr %19, align 4, !tbaa !9
  %84 = load i32, ptr %16, align 4, !tbaa !9
  %85 = icmp ult i32 %83, %84
  br i1 %85, label %86, label %97

86:                                               ; preds = %82
  %87 = load ptr, ptr %9, align 8, !tbaa !5
  %88 = getelementptr inbounds float, ptr %87, i64 0
  %89 = load float, ptr %88, align 4, !tbaa !11
  %90 = load ptr, ptr %13, align 8, !tbaa !5
  %91 = getelementptr inbounds float, ptr %90, i64 0
  %92 = load float, ptr %91, align 4, !tbaa !11
  %93 = fadd float %92, %89
  store float %93, ptr %91, align 4, !tbaa !11
  br label %94

94:                                               ; preds = %86
  %95 = load i32, ptr %19, align 4, !tbaa !9
  %96 = add i32 %95, 1
  store i32 %96, ptr %19, align 4, !tbaa !9
  br label %82, !llvm.loop !16

97:                                               ; preds = %82
  br label %98

98:                                               ; preds = %97
  %99 = load i32, ptr %17, align 4, !tbaa !9
  %100 = add i32 %99, 1
  store i32 %100, ptr %17, align 4, !tbaa !9
  br label %24, !llvm.loop !17

101:                                              ; preds = %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  ret void
}

; 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 speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #2

; 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 = !{!"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 = !{!"float", !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: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @k_classify_local(ptr nocapture noundef readonly %0, i32 noundef %1, i32 noundef %2, ptr nocapture noundef readonly %3, ptr nocapture noundef %4, ptr nocapture noundef %5, i32 noundef %6, i32 noundef %7) local_unnamed_addr #0 {
  %.not = icmp eq i32 %1, 0
  br i1 %.not, label %38, label %.preheader33.lr.ph

.preheader33.lr.ph:                               ; preds = %8
  %.not63 = icmp eq i32 %6, 0
  %9 = getelementptr inbounds i8, ptr %5, i64 17179869180
  %.promoted = load i32, ptr %9, align 4, !tbaa !5
  %.not65 = icmp eq i32 %7, 0
  br i1 %.not63, label %.preheader33.lr.ph.split, label %.preheader33.lr.ph.split.us

.preheader33.lr.ph.split.us:                      ; preds = %.preheader33.lr.ph
  br i1 %.not65, label %._crit_edge41, label %.preheader33.us.us.us.preheader

.preheader33.us.us.us.preheader:                  ; preds = %.preheader33.lr.ph.split.us
  %.pre.pre = load float, ptr %4, align 4, !tbaa !9
  %xtraiter = and i32 %7, 3
  %10 = icmp ult i32 %7, 4
  %unroll_iter = and i32 %7, -4
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br label %.preheader33.us.us.us

.preheader33.us.us.us:                            ; preds = %.preheader33.us.us.us.preheader, %._crit_edge.us47.us.us
  %.pre = phi float [ %.lcssa84, %._crit_edge.us47.us.us ], [ %.pre.pre, %.preheader33.us.us.us.preheader ]
  %.040.us.us.us = phi i32 [ %23, %._crit_edge.us47.us.us ], [ 0, %.preheader33.us.us.us.preheader ]
  br i1 %10, label %._crit_edge.us47.us.us.unr-lcssa, label %.preheader33.us.us.us.new

.preheader33.us.us.us.new:                        ; preds = %.preheader33.us.us.us, %.preheader33.us.us.us.new
  %11 = phi float [ %19, %.preheader33.us.us.us.new ], [ %.pre, %.preheader33.us.us.us ]
  %niter = phi i32 [ %niter.next.3, %.preheader33.us.us.us.new ], [ 0, %.preheader33.us.us.us ]
  %12 = load float, ptr %0, align 4, !tbaa !9
  %13 = fadd float %12, %11
  store float %13, ptr %4, align 4, !tbaa !9
  %14 = load float, ptr %0, align 4, !tbaa !9
  %15 = fadd float %14, %13
  store float %15, ptr %4, align 4, !tbaa !9
  %16 = load float, ptr %0, align 4, !tbaa !9
  %17 = fadd float %16, %15
  store float %17, ptr %4, align 4, !tbaa !9
  %18 = load float, ptr %0, align 4, !tbaa !9
  %19 = fadd float %18, %17
  store float %19, ptr %4, align 4, !tbaa !9
  %niter.next.3 = add i32 %niter, 4
  %niter.ncmp.3 = icmp eq i32 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.us47.us.us.unr-lcssa, label %.preheader33.us.us.us.new, !llvm.loop !11

._crit_edge.us47.us.us.unr-lcssa:                 ; preds = %.preheader33.us.us.us.new, %.preheader33.us.us.us
  %.lcssa84.ph = phi float [ poison, %.preheader33.us.us.us ], [ %19, %.preheader33.us.us.us.new ]
  %.unr = phi float [ %.pre, %.preheader33.us.us.us ], [ %19, %.preheader33.us.us.us.new ]
  br i1 %lcmp.mod.not, label %._crit_edge.us47.us.us, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge.us47.us.us.unr-lcssa, %.epil.preheader
  %20 = phi float [ %22, %.epil.preheader ], [ %.unr, %._crit_edge.us47.us.us.unr-lcssa ]
  %epil.iter = phi i32 [ %epil.iter.next, %.epil.preheader ], [ 0, %._crit_edge.us47.us.us.unr-lcssa ]
  %21 = load float, ptr %0, align 4, !tbaa !9
  %22 = fadd float %21, %20
  store float %22, ptr %4, align 4, !tbaa !9
  %epil.iter.next = add i32 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge.us47.us.us, label %.epil.preheader, !llvm.loop !13

._crit_edge.us47.us.us:                           ; preds = %.epil.preheader, %._crit_edge.us47.us.us.unr-lcssa
  %.lcssa84 = phi float [ %.lcssa84.ph, %._crit_edge.us47.us.us.unr-lcssa ], [ %22, %.epil.preheader ]
  %23 = add nuw i32 %.040.us.us.us, 1
  %exitcond73.not = icmp eq i32 %23, %1
  br i1 %exitcond73.not, label %._crit_edge41, label %.preheader33.us.us.us, !llvm.loop !15

.preheader33.lr.ph.split:                         ; preds = %.preheader33.lr.ph
  br i1 %.not65, label %._crit_edge41, label %.preheader33.us48.preheader

.preheader33.us48.preheader:                      ; preds = %.preheader33.lr.ph.split
  %.pre76.pre = load float, ptr %4, align 4, !tbaa !9
  %xtraiter87 = and i32 %7, 3
  %24 = icmp ult i32 %7, 4
  %unroll_iter92 = and i32 %7, -4
  %lcmp.mod90.not = icmp eq i32 %xtraiter87, 0
  br label %.preheader33.us48

.preheader33.us48:                                ; preds = %.preheader33.us48.preheader, %._crit_edge.us
  %.pre76 = phi float [ %.lcssa, %._crit_edge.us ], [ %.pre76.pre, %.preheader33.us48.preheader ]
  %.040.us49 = phi i32 [ %37, %._crit_edge.us ], [ 0, %.preheader33.us48.preheader ]
  br i1 %24, label %._crit_edge.us.unr-lcssa, label %.preheader33.us48.new

.preheader33.us48.new:                            ; preds = %.preheader33.us48, %.preheader33.us48.new
  %25 = phi float [ %33, %.preheader33.us48.new ], [ %.pre76, %.preheader33.us48 ]
  %niter93 = phi i32 [ %niter93.next.3, %.preheader33.us48.new ], [ 0, %.preheader33.us48 ]
  %26 = load float, ptr %0, align 4, !tbaa !9
  %27 = fadd float %26, %25
  store float %27, ptr %4, align 4, !tbaa !9
  %28 = load float, ptr %0, align 4, !tbaa !9
  %29 = fadd float %28, %27
  store float %29, ptr %4, align 4, !tbaa !9
  %30 = load float, ptr %0, align 4, !tbaa !9
  %31 = fadd float %30, %29
  store float %31, ptr %4, align 4, !tbaa !9
  %32 = load float, ptr %0, align 4, !tbaa !9
  %33 = fadd float %32, %31
  store float %33, ptr %4, align 4, !tbaa !9
  %niter93.next.3 = add i32 %niter93, 4
  %niter93.ncmp.3 = icmp eq i32 %niter93.next.3, %unroll_iter92
  br i1 %niter93.ncmp.3, label %._crit_edge.us.unr-lcssa, label %.preheader33.us48.new, !llvm.loop !11

._crit_edge.us.unr-lcssa:                         ; preds = %.preheader33.us48.new, %.preheader33.us48
  %.lcssa.ph = phi float [ poison, %.preheader33.us48 ], [ %33, %.preheader33.us48.new ]
  %.unr89 = phi float [ %.pre76, %.preheader33.us48 ], [ %33, %.preheader33.us48.new ]
  br i1 %lcmp.mod90.not, label %._crit_edge.us, label %.epil.preheader86

.epil.preheader86:                                ; preds = %._crit_edge.us.unr-lcssa, %.epil.preheader86
  %34 = phi float [ %36, %.epil.preheader86 ], [ %.unr89, %._crit_edge.us.unr-lcssa ]
  %epil.iter88 = phi i32 [ %epil.iter88.next, %.epil.preheader86 ], [ 0, %._crit_edge.us.unr-lcssa ]
  %35 = load float, ptr %0, align 4, !tbaa !9
  %36 = fadd float %35, %34
  store float %36, ptr %4, align 4, !tbaa !9
  %epil.iter88.next = add i32 %epil.iter88, 1
  %epil.iter88.cmp.not = icmp eq i32 %epil.iter88.next, %xtraiter87
  br i1 %epil.iter88.cmp.not, label %._crit_edge.us, label %.epil.preheader86, !llvm.loop !16

._crit_edge.us:                                   ; preds = %.epil.preheader86, %._crit_edge.us.unr-lcssa
  %.lcssa = phi float [ %.lcssa.ph, %._crit_edge.us.unr-lcssa ], [ %36, %.epil.preheader86 ]
  %37 = add nuw i32 %.040.us49, 1
  %exitcond75.not = icmp eq i32 %37, %1
  br i1 %exitcond75.not, label %._crit_edge41, label %.preheader33.us48, !llvm.loop !15

._crit_edge41:                                    ; preds = %._crit_edge.us47.us.us, %._crit_edge.us, %.preheader33.lr.ph.split, %.preheader33.lr.ph.split.us
  %.us-phi = add i32 %.promoted, %1
  store i32 %.us-phi, ptr %9, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %._crit_edge41, %8
  ret void
}

attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) 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" }

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

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


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