; LLVM IR from sbu-fsl/kernel-ml :: src/math (matrix)

; 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.matrix = type { i32, i32, i32, %union.anon }
%union.anon = type { ptr }

@.str.1 = external hidden unnamed_addr constant [69 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [4 x i8], align 1
@__PRETTY_FUNCTION__.matrix_mean = external hidden unnamed_addr constant [35 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local ptr @allocate_matrix(i32 noundef, i32 noundef, 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

; 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 ptr @matrix_mean(ptr noundef %0, i32 noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.matrix, ptr %8, i32 0, i32 1
  %10 = load i32, ptr %9, align 4, !tbaa !11
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.matrix, ptr %11, i32 0, i32 2
  %13 = load i32, ptr %12, align 8, !tbaa !13
  %14 = call ptr @allocate_matrix(i32 noundef 1, i32 noundef %10, i32 noundef %13)
  store ptr %14, ptr %7, align 8, !tbaa !5
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %15

15:                                               ; preds = %133, %2
  %16 = load i32, ptr %6, align 4, !tbaa !9
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.matrix, ptr %17, i32 0, i32 1
  %19 = load i32, ptr %18, align 4, !tbaa !11
  %20 = icmp slt i32 %16, %19
  br i1 %20, label %21, label %136

21:                                               ; preds = %15
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %22

22:                                               ; preds = %88, %21
  %23 = load i32, ptr %5, align 4, !tbaa !9
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.matrix, ptr %24, i32 0, i32 0
  %26 = load i32, ptr %25, align 8, !tbaa !14
  %27 = icmp slt i32 %23, %26
  br i1 %27, label %28, label %91

28:                                               ; preds = %22
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.matrix, ptr %29, i32 0, i32 2
  %31 = load i32, ptr %30, align 8, !tbaa !13
  switch i32 %31, label %87 [
    i32 1, label %32
    i32 2, label %59
    i32 0, label %86
  ]

32:                                               ; preds = %28
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.matrix, ptr %33, i32 0, i32 3
  %35 = load ptr, ptr %34, align 8, !tbaa !15
  %36 = load i32, ptr %5, align 4, !tbaa !9
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.matrix, ptr %37, i32 0, i32 1
  %39 = load i32, ptr %38, align 4, !tbaa !11
  %40 = mul nsw i32 %36, %39
  %41 = load i32, ptr %6, align 4, !tbaa !9
  %42 = add nsw i32 %40, %41
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds float, ptr %35, i64 %43
  %45 = load float, ptr %44, align 4, !tbaa !16
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.matrix, ptr %46, i32 0, i32 3
  %48 = load ptr, ptr %47, align 8, !tbaa !15
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.matrix, ptr %49, i32 0, i32 1
  %51 = load i32, ptr %50, align 4, !tbaa !11
  %52 = mul nsw i32 0, %51
  %53 = load i32, ptr %6, align 4, !tbaa !9
  %54 = add nsw i32 %52, %53
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds float, ptr %48, i64 %55
  %57 = load float, ptr %56, align 4, !tbaa !16
  %58 = fadd float %57, %45
  store float %58, ptr %56, align 4, !tbaa !16
  br label %87

59:                                               ; preds = %28
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.matrix, ptr %60, i32 0, i32 3
  %62 = load ptr, ptr %61, align 8, !tbaa !15
  %63 = load i32, ptr %5, align 4, !tbaa !9
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.matrix, ptr %64, i32 0, i32 1
  %66 = load i32, ptr %65, align 4, !tbaa !11
  %67 = mul nsw i32 %63, %66
  %68 = load i32, ptr %6, align 4, !tbaa !9
  %69 = add nsw i32 %67, %68
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds double, ptr %62, i64 %70
  %72 = load double, ptr %71, align 8, !tbaa !18
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.matrix, ptr %73, i32 0, i32 3
  %75 = load ptr, ptr %74, align 8, !tbaa !15
  %76 = load ptr, ptr %7, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.matrix, ptr %76, i32 0, i32 1
  %78 = load i32, ptr %77, align 4, !tbaa !11
  %79 = mul nsw i32 0, %78
  %80 = load i32, ptr %6, align 4, !tbaa !9
  %81 = add nsw i32 %79, %80
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds double, ptr %75, i64 %82
  %84 = load double, ptr %83, align 8, !tbaa !18
  %85 = fadd double %84, %72
  store double %85, ptr %83, align 8, !tbaa !18
  br label %87

86:                                               ; preds = %28
  call void @__assert_fail(ptr noundef @.str.10, ptr noundef @.str.1, i32 noundef 837, ptr noundef @__PRETTY_FUNCTION__.matrix_mean) #4
  unreachable

87:                                               ; preds = %59, %32, %28
  br label %88

88:                                               ; preds = %87
  %89 = load i32, ptr %5, align 4, !tbaa !9
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr %5, align 4, !tbaa !9
  br label %22, !llvm.loop !20

91:                                               ; preds = %22
  %92 = load ptr, ptr %3, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.matrix, ptr %92, i32 0, i32 2
  %94 = load i32, ptr %93, align 8, !tbaa !13
  switch i32 %94, label %132 [
    i32 1, label %95
    i32 2, label %113
    i32 0, label %131
  ]

95:                                               ; preds = %91
  %96 = load ptr, ptr %3, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.matrix, ptr %96, i32 0, i32 0
  %98 = load i32, ptr %97, align 8, !tbaa !14
  %99 = sitofp i32 %98 to float
  %100 = load ptr, ptr %7, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.matrix, ptr %100, i32 0, i32 3
  %102 = load ptr, ptr %101, align 8, !tbaa !15
  %103 = load ptr, ptr %7, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.matrix, ptr %103, i32 0, i32 1
  %105 = load i32, ptr %104, align 4, !tbaa !11
  %106 = mul nsw i32 0, %105
  %107 = load i32, ptr %6, align 4, !tbaa !9
  %108 = add nsw i32 %106, %107
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds float, ptr %102, i64 %109
  %111 = load float, ptr %110, align 4, !tbaa !16
  %112 = fdiv float %111, %99
  store float %112, ptr %110, align 4, !tbaa !16
  br label %132

113:                                              ; preds = %91
  %114 = load ptr, ptr %3, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.matrix, ptr %114, i32 0, i32 0
  %116 = load i32, ptr %115, align 8, !tbaa !14
  %117 = sitofp i32 %116 to double
  %118 = load ptr, ptr %7, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.matrix, ptr %118, i32 0, i32 3
  %120 = load ptr, ptr %119, align 8, !tbaa !15
  %121 = load ptr, ptr %7, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.matrix, ptr %121, i32 0, i32 1
  %123 = load i32, ptr %122, align 4, !tbaa !11
  %124 = mul nsw i32 0, %123
  %125 = load i32, ptr %6, align 4, !tbaa !9
  %126 = add nsw i32 %124, %125
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds double, ptr %120, i64 %127
  %129 = load double, ptr %128, align 8, !tbaa !18
  %130 = fdiv double %129, %117
  store double %130, ptr %128, align 8, !tbaa !18
  br label %132

131:                                              ; preds = %91
  call void @__assert_fail(ptr noundef @.str.10, ptr noundef @.str.1, i32 noundef 849, ptr noundef @__PRETTY_FUNCTION__.matrix_mean) #4
  unreachable

132:                                              ; preds = %113, %95, %91
  br label %133

133:                                              ; preds = %132
  %134 = load i32, ptr %6, align 4, !tbaa !9
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr %6, align 4, !tbaa !9
  br label %15, !llvm.loop !22

136:                                              ; preds = %15
  %137 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  ret ptr %137
}

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 = { noreturn 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 = { nounwind }
attributes #4 = { noreturn 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, !10, i64 4}
!12 = !{!"matrix", !10, i64 0, !10, i64 4, !10, i64 8, !7, i64 16}
!13 = !{!12, !10, i64 8}
!14 = !{!12, !10, i64 0}
!15 = !{!7, !7, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"float", !7, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"double", !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}


; 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"

@.str.1 = external hidden unnamed_addr constant [69 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [4 x i8], align 1
@__PRETTY_FUNCTION__.matrix_mean = external hidden unnamed_addr constant [35 x i8], align 1

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local ptr @matrix_mean(ptr nocapture noundef readonly %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 4
  %4 = load i32, ptr %3, align 4, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = load i32, ptr %5, align 8, !tbaa !10
  %7 = tail call ptr @allocate_matrix(i32 noundef 1, i32 noundef %4, i32 noundef %6)
  %8 = load i32, ptr %3, align 4, !tbaa !5
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.preheader.lr.ph, label %._crit_edge43

.preheader.lr.ph:                                 ; preds = %2
  %10 = load i32, ptr %0, align 8, !tbaa !11
  %11 = icmp sgt i32 %10, 0
  %12 = getelementptr inbounds i8, ptr %0, i64 16
  %13 = getelementptr inbounds i8, ptr %7, i64 16
  %14 = sitofp i32 %10 to double
  %15 = sitofp i32 %10 to float
  %16 = load i32, ptr %5, align 8, !tbaa !10
  br i1 %11, label %.preheader.lr.ph.split.us, label %.preheader.lr.ph.split

.preheader.lr.ph.split.us:                        ; preds = %.preheader.lr.ph
  %cond55 = icmp eq i32 %16, 0
  br i1 %cond55, label %.split49.us, label %.preheader.lr.ph.split.us.split

.preheader.lr.ph.split.us.split:                  ; preds = %.preheader.lr.ph.split.us
  %17 = zext nneg i32 %8 to i64
  %wide.trip.count75 = zext nneg i32 %10 to i64
  %18 = add nsw i64 %wide.trip.count75, -1
  %xtraiter96 = and i64 %wide.trip.count75, 1
  %19 = icmp eq i64 %18, 0
  %unroll_iter99 = and i64 %wide.trip.count75, 2147483646
  %lcmp.mod98.not = icmp eq i64 %xtraiter96, 0
  %xtraiter101 = and i64 %wide.trip.count75, 1
  %20 = icmp eq i64 %18, 0
  %unroll_iter104 = and i64 %wide.trip.count75, 2147483646
  %lcmp.mod103.not = icmp eq i64 %xtraiter101, 0
  br label %.preheader.us

.preheader.us:                                    ; preds = %31, %.preheader.lr.ph.split.us.split
  %indvars.iv77 = phi i64 [ %indvars.iv.next78, %31 ], [ 0, %.preheader.lr.ph.split.us.split ]
  switch i32 %16, label %31 [
    i32 1, label %.lr.ph.split.split.us.us.preheader
    i32 2, label %.lr.ph.split.split.us36.us.preheader
    i32 0, label %.split.us
  ]

.lr.ph.split.split.us36.us.preheader:             ; preds = %.preheader.us
  br i1 %19, label %._crit_edge.us.loopexit88.unr-lcssa, label %.lr.ph.split.split.us36.us

.lr.ph.split.split.us.us.preheader:               ; preds = %.preheader.us
  br i1 %20, label %._crit_edge.us.loopexit.unr-lcssa, label %.lr.ph.split.split.us.us

21:                                               ; preds = %._crit_edge.us
  %22 = load ptr, ptr %13, align 8, !tbaa !12
  %23 = getelementptr inbounds double, ptr %22, i64 %indvars.iv77
  %24 = load double, ptr %23, align 8, !tbaa !13
  %25 = fdiv double %24, %14
  store double %25, ptr %23, align 8, !tbaa !13
  br label %31

26:                                               ; preds = %._crit_edge.us
  %27 = load ptr, ptr %13, align 8, !tbaa !12
  %28 = getelementptr inbounds float, ptr %27, i64 %indvars.iv77
  %29 = load float, ptr %28, align 4, !tbaa !15
  %30 = fdiv float %29, %15
  store float %30, ptr %28, align 4, !tbaa !15
  br label %31

31:                                               ; preds = %.preheader.us, %26, %21, %._crit_edge.us
  %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
  %exitcond81.not = icmp eq i64 %indvars.iv.next78, %17
  br i1 %exitcond81.not, label %._crit_edge43, label %.preheader.us, !llvm.loop !17

._crit_edge.us.loopexit.unr-lcssa:                ; preds = %.lr.ph.split.split.us.us, %.lr.ph.split.split.us.us.preheader
  %indvars.iv72.unr = phi i64 [ 0, %.lr.ph.split.split.us.us.preheader ], [ %indvars.iv.next73.1, %.lr.ph.split.split.us.us ]
  br i1 %lcmp.mod103.not, label %._crit_edge.us, label %.lr.ph.split.split.us.us.epil

.lr.ph.split.split.us.us.epil:                    ; preds = %._crit_edge.us.loopexit.unr-lcssa
  %32 = load ptr, ptr %12, align 8, !tbaa !12
  %33 = mul nuw nsw i64 %indvars.iv72.unr, %17
  %34 = getelementptr inbounds float, ptr %32, i64 %33
  %35 = getelementptr inbounds float, ptr %34, i64 %indvars.iv77
  %36 = load float, ptr %35, align 4, !tbaa !15
  %37 = load ptr, ptr %13, align 8, !tbaa !12
  %38 = getelementptr inbounds float, ptr %37, i64 %indvars.iv77
  %39 = load float, ptr %38, align 4, !tbaa !15
  %40 = fadd float %36, %39
  store float %40, ptr %38, align 4, !tbaa !15
  br label %._crit_edge.us

._crit_edge.us.loopexit88.unr-lcssa:              ; preds = %.lr.ph.split.split.us36.us, %.lr.ph.split.split.us36.us.preheader
  %indvars.iv67.unr = phi i64 [ 0, %.lr.ph.split.split.us36.us.preheader ], [ %indvars.iv.next68.1, %.lr.ph.split.split.us36.us ]
  br i1 %lcmp.mod98.not, label %._crit_edge.us, label %.lr.ph.split.split.us36.us.epil

.lr.ph.split.split.us36.us.epil:                  ; preds = %._crit_edge.us.loopexit88.unr-lcssa
  %41 = load ptr, ptr %12, align 8, !tbaa !12
  %42 = mul nuw nsw i64 %indvars.iv67.unr, %17
  %43 = getelementptr inbounds double, ptr %41, i64 %42
  %44 = getelementptr inbounds double, ptr %43, i64 %indvars.iv77
  %45 = load double, ptr %44, align 8, !tbaa !13
  %46 = load ptr, ptr %13, align 8, !tbaa !12
  %47 = getelementptr inbounds double, ptr %46, i64 %indvars.iv77
  %48 = load double, ptr %47, align 8, !tbaa !13
  %49 = fadd double %45, %48
  store double %49, ptr %47, align 8, !tbaa !13
  br label %._crit_edge.us

._crit_edge.us:                                   ; preds = %.lr.ph.split.split.us36.us.epil, %._crit_edge.us.loopexit88.unr-lcssa, %.lr.ph.split.split.us.us.epil, %._crit_edge.us.loopexit.unr-lcssa
  switch i32 %16, label %31 [
    i32 1, label %26
    i32 2, label %21
    i32 0, label %.split.us
  ]

.lr.ph.split.split.us.us:                         ; preds = %.lr.ph.split.split.us.us.preheader, %.lr.ph.split.split.us.us
  %indvars.iv72 = phi i64 [ %indvars.iv.next73.1, %.lr.ph.split.split.us.us ], [ 0, %.lr.ph.split.split.us.us.preheader ]
  %niter105 = phi i64 [ %niter105.next.1, %.lr.ph.split.split.us.us ], [ 0, %.lr.ph.split.split.us.us.preheader ]
  %50 = load ptr, ptr %12, align 8, !tbaa !12
  %51 = mul nuw nsw i64 %indvars.iv72, %17
  %52 = getelementptr inbounds float, ptr %50, i64 %51
  %53 = getelementptr inbounds float, ptr %52, i64 %indvars.iv77
  %54 = load float, ptr %53, align 4, !tbaa !15
  %55 = load ptr, ptr %13, align 8, !tbaa !12
  %56 = getelementptr inbounds float, ptr %55, i64 %indvars.iv77
  %57 = load float, ptr %56, align 4, !tbaa !15
  %58 = fadd float %54, %57
  store float %58, ptr %56, align 4, !tbaa !15
  %indvars.iv.next73 = or disjoint i64 %indvars.iv72, 1
  %59 = load ptr, ptr %12, align 8, !tbaa !12
  %60 = mul nuw nsw i64 %indvars.iv.next73, %17
  %61 = getelementptr inbounds float, ptr %59, i64 %60
  %62 = getelementptr inbounds float, ptr %61, i64 %indvars.iv77
  %63 = load float, ptr %62, align 4, !tbaa !15
  %64 = load ptr, ptr %13, align 8, !tbaa !12
  %65 = getelementptr inbounds float, ptr %64, i64 %indvars.iv77
  %66 = load float, ptr %65, align 4, !tbaa !15
  %67 = fadd float %63, %66
  store float %67, ptr %65, align 4, !tbaa !15
  %indvars.iv.next73.1 = add nuw nsw i64 %indvars.iv72, 2
  %niter105.next.1 = add i64 %niter105, 2
  %niter105.ncmp.1 = icmp eq i64 %niter105.next.1, %unroll_iter104
  br i1 %niter105.ncmp.1, label %._crit_edge.us.loopexit.unr-lcssa, label %.lr.ph.split.split.us.us, !llvm.loop !19

.lr.ph.split.split.us36.us:                       ; preds = %.lr.ph.split.split.us36.us.preheader, %.lr.ph.split.split.us36.us
  %indvars.iv67 = phi i64 [ %indvars.iv.next68.1, %.lr.ph.split.split.us36.us ], [ 0, %.lr.ph.split.split.us36.us.preheader ]
  %niter100 = phi i64 [ %niter100.next.1, %.lr.ph.split.split.us36.us ], [ 0, %.lr.ph.split.split.us36.us.preheader ]
  %68 = load ptr, ptr %12, align 8, !tbaa !12
  %69 = mul nuw nsw i64 %indvars.iv67, %17
  %70 = getelementptr inbounds double, ptr %68, i64 %69
  %71 = getelementptr inbounds double, ptr %70, i64 %indvars.iv77
  %72 = load double, ptr %71, align 8, !tbaa !13
  %73 = load ptr, ptr %13, align 8, !tbaa !12
  %74 = getelementptr inbounds double, ptr %73, i64 %indvars.iv77
  %75 = load double, ptr %74, align 8, !tbaa !13
  %76 = fadd double %72, %75
  store double %76, ptr %74, align 8, !tbaa !13
  %indvars.iv.next68 = or disjoint i64 %indvars.iv67, 1
  %77 = load ptr, ptr %12, align 8, !tbaa !12
  %78 = mul nuw nsw i64 %indvars.iv.next68, %17
  %79 = getelementptr inbounds double, ptr %77, i64 %78
  %80 = getelementptr inbounds double, ptr %79, i64 %indvars.iv77
  %81 = load double, ptr %80, align 8, !tbaa !13
  %82 = load ptr, ptr %13, align 8, !tbaa !12
  %83 = getelementptr inbounds double, ptr %82, i64 %indvars.iv77
  %84 = load double, ptr %83, align 8, !tbaa !13
  %85 = fadd double %81, %84
  store double %85, ptr %83, align 8, !tbaa !13
  %indvars.iv.next68.1 = add nuw nsw i64 %indvars.iv67, 2
  %niter100.next.1 = add i64 %niter100, 2
  %niter100.ncmp.1 = icmp eq i64 %niter100.next.1, %unroll_iter99
  br i1 %niter100.ncmp.1, label %._crit_edge.us.loopexit88.unr-lcssa, label %.lr.ph.split.split.us36.us, !llvm.loop !19

.preheader.lr.ph.split:                           ; preds = %.preheader.lr.ph
  switch i32 %16, label %._crit_edge43 [
    i32 0, label %.split.us
    i32 1, label %.preheader.us50.preheader
    i32 2, label %.preheader.us53.preheader
  ]

.preheader.us53.preheader:                        ; preds = %.preheader.lr.ph.split
  %wide.trip.count = zext nneg i32 %8 to i64
  %xtraiter = and i64 %wide.trip.count, 3
  %86 = icmp ult i32 %8, 4
  br i1 %86, label %._crit_edge43.loopexit90.unr-lcssa, label %.preheader.us53.preheader.new

.preheader.us53.preheader.new:                    ; preds = %.preheader.us53.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483644
  br label %.preheader.us53

.preheader.us50.preheader:                        ; preds = %.preheader.lr.ph.split
  %wide.trip.count65 = zext nneg i32 %8 to i64
  %xtraiter91 = and i64 %wide.trip.count65, 3
  %87 = icmp ult i32 %8, 4
  br i1 %87, label %._crit_edge43.loopexit89.unr-lcssa, label %.preheader.us50.preheader.new

.preheader.us50.preheader.new:                    ; preds = %.preheader.us50.preheader
  %unroll_iter94 = and i64 %wide.trip.count65, 2147483644
  br label %.preheader.us50

.preheader.us50:                                  ; preds = %.preheader.us50, %.preheader.us50.preheader.new
  %indvars.iv62 = phi i64 [ 0, %.preheader.us50.preheader.new ], [ %indvars.iv.next63.3, %.preheader.us50 ]
  %niter95 = phi i64 [ 0, %.preheader.us50.preheader.new ], [ %niter95.next.3, %.preheader.us50 ]
  %88 = load ptr, ptr %13, align 8, !tbaa !12
  %89 = getelementptr inbounds float, ptr %88, i64 %indvars.iv62
  %90 = load float, ptr %89, align 4, !tbaa !15
  %91 = fdiv float %90, %15
  store float %91, ptr %89, align 4, !tbaa !15
  %indvars.iv.next63 = or disjoint i64 %indvars.iv62, 1
  %92 = load ptr, ptr %13, align 8, !tbaa !12
  %93 = getelementptr inbounds float, ptr %92, i64 %indvars.iv.next63
  %94 = load float, ptr %93, align 4, !tbaa !15
  %95 = fdiv float %94, %15
  store float %95, ptr %93, align 4, !tbaa !15
  %indvars.iv.next63.1 = or disjoint i64 %indvars.iv62, 2
  %96 = load ptr, ptr %13, align 8, !tbaa !12
  %97 = getelementptr inbounds float, ptr %96, i64 %indvars.iv.next63.1
  %98 = load float, ptr %97, align 4, !tbaa !15
  %99 = fdiv float %98, %15
  store float %99, ptr %97, align 4, !tbaa !15
  %indvars.iv.next63.2 = or disjoint i64 %indvars.iv62, 3
  %100 = load ptr, ptr %13, align 8, !tbaa !12
  %101 = getelementptr inbounds float, ptr %100, i64 %indvars.iv.next63.2
  %102 = load float, ptr %101, align 4, !tbaa !15
  %103 = fdiv float %102, %15
  store float %103, ptr %101, align 4, !tbaa !15
  %indvars.iv.next63.3 = add nuw nsw i64 %indvars.iv62, 4
  %niter95.next.3 = add i64 %niter95, 4
  %niter95.ncmp.3 = icmp eq i64 %niter95.next.3, %unroll_iter94
  br i1 %niter95.ncmp.3, label %._crit_edge43.loopexit89.unr-lcssa, label %.preheader.us50, !llvm.loop !17

.preheader.us53:                                  ; preds = %.preheader.us53, %.preheader.us53.preheader.new
  %indvars.iv = phi i64 [ 0, %.preheader.us53.preheader.new ], [ %indvars.iv.next.3, %.preheader.us53 ]
  %niter = phi i64 [ 0, %.preheader.us53.preheader.new ], [ %niter.next.3, %.preheader.us53 ]
  %104 = load ptr, ptr %13, align 8, !tbaa !12
  %105 = getelementptr inbounds double, ptr %104, i64 %indvars.iv
  %106 = load double, ptr %105, align 8, !tbaa !13
  %107 = fdiv double %106, %14
  store double %107, ptr %105, align 8, !tbaa !13
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %108 = load ptr, ptr %13, align 8, !tbaa !12
  %109 = getelementptr inbounds double, ptr %108, i64 %indvars.iv.next
  %110 = load double, ptr %109, align 8, !tbaa !13
  %111 = fdiv double %110, %14
  store double %111, ptr %109, align 8, !tbaa !13
  %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 2
  %112 = load ptr, ptr %13, align 8, !tbaa !12
  %113 = getelementptr inbounds double, ptr %112, i64 %indvars.iv.next.1
  %114 = load double, ptr %113, align 8, !tbaa !13
  %115 = fdiv double %114, %14
  store double %115, ptr %113, align 8, !tbaa !13
  %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 3
  %116 = load ptr, ptr %13, align 8, !tbaa !12
  %117 = getelementptr inbounds double, ptr %116, i64 %indvars.iv.next.2
  %118 = load double, ptr %117, align 8, !tbaa !13
  %119 = fdiv double %118, %14
  store double %119, ptr %117, align 8, !tbaa !13
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 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_edge43.loopexit90.unr-lcssa, label %.preheader.us53, !llvm.loop !17

.split49.us:                                      ; preds = %.preheader.lr.ph.split.us
  tail call void @__assert_fail(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.1, i32 noundef 837, ptr noundef nonnull @__PRETTY_FUNCTION__.matrix_mean) #2
  unreachable

.split.us:                                        ; preds = %._crit_edge.us, %.preheader.us, %.preheader.lr.ph.split
  tail call void @__assert_fail(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.1, i32 noundef 849, ptr noundef nonnull @__PRETTY_FUNCTION__.matrix_mean) #2
  unreachable

._crit_edge43.loopexit89.unr-lcssa:               ; preds = %.preheader.us50, %.preheader.us50.preheader
  %indvars.iv62.unr = phi i64 [ 0, %.preheader.us50.preheader ], [ %indvars.iv.next63.3, %.preheader.us50 ]
  %lcmp.mod93.not = icmp eq i64 %xtraiter91, 0
  br i1 %lcmp.mod93.not, label %._crit_edge43, label %.preheader.us50.epil

.preheader.us50.epil:                             ; preds = %._crit_edge43.loopexit89.unr-lcssa, %.preheader.us50.epil
  %indvars.iv62.epil = phi i64 [ %indvars.iv.next63.epil, %.preheader.us50.epil ], [ %indvars.iv62.unr, %._crit_edge43.loopexit89.unr-lcssa ]
  %epil.iter92 = phi i64 [ %epil.iter92.next, %.preheader.us50.epil ], [ 0, %._crit_edge43.loopexit89.unr-lcssa ]
  %120 = load ptr, ptr %13, align 8, !tbaa !12
  %121 = getelementptr inbounds float, ptr %120, i64 %indvars.iv62.epil
  %122 = load float, ptr %121, align 4, !tbaa !15
  %123 = fdiv float %122, %15
  store float %123, ptr %121, align 4, !tbaa !15
  %indvars.iv.next63.epil = add nuw nsw i64 %indvars.iv62.epil, 1
  %epil.iter92.next = add i64 %epil.iter92, 1
  %epil.iter92.cmp.not = icmp eq i64 %epil.iter92.next, %xtraiter91
  br i1 %epil.iter92.cmp.not, label %._crit_edge43, label %.preheader.us50.epil, !llvm.loop !20

._crit_edge43.loopexit90.unr-lcssa:               ; preds = %.preheader.us53, %.preheader.us53.preheader
  %indvars.iv.unr = phi i64 [ 0, %.preheader.us53.preheader ], [ %indvars.iv.next.3, %.preheader.us53 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge43, label %.preheader.us53.epil

.preheader.us53.epil:                             ; preds = %._crit_edge43.loopexit90.unr-lcssa, %.preheader.us53.epil
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.preheader.us53.epil ], [ %indvars.iv.unr, %._crit_edge43.loopexit90.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.preheader.us53.epil ], [ 0, %._crit_edge43.loopexit90.unr-lcssa ]
  %124 = load ptr, ptr %13, align 8, !tbaa !12
  %125 = getelementptr inbounds double, ptr %124, i64 %indvars.iv.epil
  %126 = load double, ptr %125, align 8, !tbaa !13
  %127 = fdiv double %126, %14
  store double %127, ptr %125, align 8, !tbaa !13
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.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_edge43, label %.preheader.us53.epil, !llvm.loop !22

._crit_edge43:                                    ; preds = %._crit_edge43.loopexit90.unr-lcssa, %.preheader.us53.epil, %._crit_edge43.loopexit89.unr-lcssa, %.preheader.us50.epil, %31, %.preheader.lr.ph.split, %2
  ret ptr %7
}

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 = { noreturn 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 #2 = { noreturn 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, !7, i64 4}
!6 = !{!"matrix", !7, i64 0, !7, i64 4, !7, i64 8, !8, i64 16}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!6, !7, i64 0}
!12 = !{!8, !8, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !8, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"float", !8, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.unroll.disable"}
!22 = distinct !{!22, !21}


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