; LLVM IR from Wilson-ZheLin/Introduction-to-Digital-Image-Processing :: 10. Otus, Moving Average, and Region Growing/src/main.ll (Z14Otsu_AlgorithmPhii)

; 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: mustprogress uwtable
define dso_local noundef ptr @_Z14Otsu_AlgorithmPhii(ptr noundef %0, i32 noundef %1, i32 noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca [256 x float], align 16
  %10 = alloca [256 x float], align 16
  %11 = alloca [256 x float], align 16
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca float, align 4
  %17 = alloca i32, align 4
  %18 = alloca float, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca float, align 4
  %23 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %24 = load i32, ptr %5, align 4, !tbaa !9
  %25 = load i32, ptr %6, align 4, !tbaa !9
  %26 = mul nsw i32 %24, %25
  store i32 %26, ptr %8, align 4, !tbaa !9
  %27 = load i32, ptr %8, align 4, !tbaa !9
  %28 = sext i32 %27 to i64
  %29 = call noalias ptr @malloc(i64 noundef %28) #6
  store ptr %29, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1024, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 1024, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 1024, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %30

30:                                               ; preds = %38, %3
  %31 = load i32, ptr %12, align 4, !tbaa !9
  %32 = icmp slt i32 %31, 256
  br i1 %32, label %34, label %33

33:                                               ; preds = %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %41

34:                                               ; preds = %30
  %35 = load i32, ptr %12, align 4, !tbaa !9
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [256 x float], ptr %9, i64 0, i64 %36
  store float 0.000000e+00, ptr %37, align 4, !tbaa !11
  br label %38

38:                                               ; preds = %34
  %39 = load i32, ptr %12, align 4, !tbaa !9
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %12, align 4, !tbaa !9
  br label %30, !llvm.loop !13

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

42:                                               ; preds = %59, %41
  %43 = load i32, ptr %13, align 4, !tbaa !9
  %44 = load i32, ptr %8, align 4, !tbaa !9
  %45 = icmp slt i32 %43, %44
  br i1 %45, label %47, label %46

46:                                               ; preds = %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %62

47:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = load i32, ptr %13, align 4, !tbaa !9
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds i8, ptr %48, i64 %50
  %52 = load i8, ptr %51, align 1, !tbaa !15
  %53 = zext i8 %52 to i32
  store i32 %53, ptr %14, align 4, !tbaa !9
  %54 = load i32, ptr %14, align 4, !tbaa !9
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [256 x float], ptr %9, i64 0, i64 %55
  %57 = load float, ptr %56, align 4, !tbaa !11
  %58 = fadd float %57, 1.000000e+00
  store float %58, ptr %56, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %59

59:                                               ; preds = %47
  %60 = load i32, ptr %13, align 4, !tbaa !9
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %13, align 4, !tbaa !9
  br label %42, !llvm.loop !16

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

63:                                               ; preds = %78, %62
  %64 = load i32, ptr %15, align 4, !tbaa !9
  %65 = icmp slt i32 %64, 256
  br i1 %65, label %67, label %66

66:                                               ; preds = %63
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %81

67:                                               ; preds = %63
  %68 = load i32, ptr %15, align 4, !tbaa !9
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [256 x float], ptr %9, i64 0, i64 %69
  %71 = load float, ptr %70, align 4, !tbaa !11
  %72 = load i32, ptr %8, align 4, !tbaa !9
  %73 = sitofp i32 %72 to float
  %74 = fdiv float %71, %73
  %75 = load i32, ptr %15, align 4, !tbaa !9
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [256 x float], ptr %10, i64 0, i64 %76
  store float %74, ptr %77, align 4, !tbaa !11
  br label %78

78:                                               ; preds = %67
  %79 = load i32, ptr %15, align 4, !tbaa !9
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %15, align 4, !tbaa !9
  br label %63, !llvm.loop !17

81:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %82 = getelementptr inbounds [256 x float], ptr %10, i64 0, i64 0
  %83 = call noundef float @_Z3sumiPf(i32 noundef 256, ptr noundef %82)
  store float %83, ptr %16, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %84

84:                                               ; preds = %96, %81
  %85 = load i32, ptr %17, align 4, !tbaa !9
  %86 = icmp slt i32 %85, 256
  br i1 %86, label %88, label %87

87:                                               ; preds = %84
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %99

88:                                               ; preds = %84
  %89 = load i32, ptr %17, align 4, !tbaa !9
  %90 = load float, ptr %16, align 4, !tbaa !11
  %91 = getelementptr inbounds [256 x float], ptr %10, i64 0, i64 0
  %92 = call noundef float @_Z15calculate_sigmaifPf(i32 noundef %89, float noundef %90, ptr noundef %91)
  %93 = load i32, ptr %17, align 4, !tbaa !9
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [256 x float], ptr %11, i64 0, i64 %94
  store float %92, ptr %95, align 4, !tbaa !11
  br label %96

96:                                               ; preds = %88
  %97 = load i32, ptr %17, align 4, !tbaa !9
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %17, align 4, !tbaa !9
  br label %84, !llvm.loop !18

99:                                               ; preds = %87
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  %100 = getelementptr inbounds [256 x float], ptr %11, i64 0, i64 0
  %101 = load float, ptr %100, align 16, !tbaa !11
  store float %101, ptr %18, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  store i32 1, ptr %19, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  store i32 0, ptr %20, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  store i32 1, ptr %21, align 4, !tbaa !9
  br label %102

102:                                              ; preds = %137, %99
  %103 = load i32, ptr %21, align 4, !tbaa !9
  %104 = icmp slt i32 %103, 256
  br i1 %104, label %106, label %105

105:                                              ; preds = %102
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  br label %140

106:                                              ; preds = %102
  %107 = load i32, ptr %21, align 4, !tbaa !9
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [256 x float], ptr %11, i64 0, i64 %108
  %110 = load float, ptr %109, align 4, !tbaa !11
  %111 = load float, ptr %18, align 4, !tbaa !11
  %112 = fsub float %110, %111
  %113 = call noundef float @_ZSt3absf(float noundef %112)
  %114 = fpext float %113 to double
  %115 = fcmp olt double %114, 1.000000e-10
  br i1 %115, label %116, label %122

116:                                              ; preds = %106
  %117 = load i32, ptr %21, align 4, !tbaa !9
  %118 = load i32, ptr %20, align 4, !tbaa !9
  %119 = add nsw i32 %118, %117
  store i32 %119, ptr %20, align 4, !tbaa !9
  %120 = load i32, ptr %19, align 4, !tbaa !9
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %19, align 4, !tbaa !9
  br label %136

122:                                              ; preds = %106
  %123 = load i32, ptr %21, align 4, !tbaa !9
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [256 x float], ptr %11, i64 0, i64 %124
  %126 = load float, ptr %125, align 4, !tbaa !11
  %127 = load float, ptr %18, align 4, !tbaa !11
  %128 = fcmp ogt float %126, %127
  br i1 %128, label %129, label %135

129:                                              ; preds = %122
  %130 = load i32, ptr %21, align 4, !tbaa !9
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [256 x float], ptr %11, i64 0, i64 %131
  %133 = load float, ptr %132, align 4, !tbaa !11
  store float %133, ptr %18, align 4, !tbaa !11
  store i32 1, ptr %19, align 4, !tbaa !9
  %134 = load i32, ptr %21, align 4, !tbaa !9
  store i32 %134, ptr %20, align 4, !tbaa !9
  br label %135

135:                                              ; preds = %129, %122
  br label %136

136:                                              ; preds = %135, %116
  br label %137

137:                                              ; preds = %136
  %138 = load i32, ptr %21, align 4, !tbaa !9
  %139 = add nsw i32 %138, 1
  store i32 %139, ptr %21, align 4, !tbaa !9
  br label %102, !llvm.loop !19

140:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #5
  %141 = load i32, ptr %20, align 4, !tbaa !9
  %142 = sitofp i32 %141 to float
  %143 = load i32, ptr %19, align 4, !tbaa !9
  %144 = sitofp i32 %143 to float
  %145 = fdiv float %142, %144
  store float %145, ptr %22, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #5
  store i32 0, ptr %23, align 4, !tbaa !9
  br label %146

146:                                              ; preds = %172, %140
  %147 = load i32, ptr %23, align 4, !tbaa !9
  %148 = load i32, ptr %8, align 4, !tbaa !9
  %149 = icmp slt i32 %147, %148
  br i1 %149, label %151, label %150

150:                                              ; preds = %146
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #5
  br label %175

151:                                              ; preds = %146
  %152 = load ptr, ptr %4, align 8, !tbaa !5
  %153 = load i32, ptr %23, align 4, !tbaa !9
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds i8, ptr %152, i64 %154
  %156 = load i8, ptr %155, align 1, !tbaa !15
  %157 = zext i8 %156 to i32
  %158 = sitofp i32 %157 to float
  %159 = load float, ptr %22, align 4, !tbaa !11
  %160 = fcmp ole float %158, %159
  br i1 %160, label %161, label %166

161:                                              ; preds = %151
  %162 = load ptr, ptr %7, align 8, !tbaa !5
  %163 = load i32, ptr %23, align 4, !tbaa !9
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds i8, ptr %162, i64 %164
  store i8 0, ptr %165, align 1, !tbaa !15
  br label %171

166:                                              ; preds = %151
  %167 = load ptr, ptr %7, align 8, !tbaa !5
  %168 = load i32, ptr %23, align 4, !tbaa !9
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds i8, ptr %167, i64 %169
  store i8 -1, ptr %170, align 1, !tbaa !15
  br label %171

171:                                              ; preds = %166, %161
  br label %172

172:                                              ; preds = %171
  %173 = load i32, ptr %23, align 4, !tbaa !9
  %174 = add nsw i32 %173, 1
  store i32 %174, ptr %23, align 4, !tbaa !9
  br label %146, !llvm.loop !20

175:                                              ; preds = %150
  %176 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 1024, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 1024, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 1024, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  ret ptr %176
}

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_Z15calculate_sigmaifPf(i32 noundef, float noundef, ptr noundef) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3absf(float noundef) #4

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 = { mustprogress 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 #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 = { inlinehint 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 #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++ 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 = !{!7, !7, i64 0}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !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 uwtable
define dso_local noalias noundef ptr @_Z14Otsu_AlgorithmPhii(ptr nocapture noundef readonly %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #2 {
.preheader57:
  %3 = alloca [256 x float], align 16
  %4 = alloca [256 x float], align 16
  %5 = alloca [256 x float], align 16
  %6 = mul nsw i32 %2, %1
  %7 = sext i32 %6 to i64
  %8 = tail call noalias ptr @malloc(i64 noundef %7) #6
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %5) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1024) %3, i8 0, i64 1024, i1 false), !tbaa !5
  %9 = icmp sgt i32 %6, 0
  br i1 %9, label %.lr.ph.preheader, label %vector.ph

.lr.ph.preheader:                                 ; preds = %.preheader57
  %wide.trip.count = zext nneg i32 %6 to i64
  %xtraiter = and i64 %wide.trip.count, 3
  %10 = icmp ult i32 %6, 4
  br i1 %10, label %vector.ph.loopexit.unr-lcssa, label %.lr.ph.preheader.new

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

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

.lr.ph.epil:                                      ; preds = %vector.ph.loopexit.unr-lcssa, %.lr.ph.epil
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.lr.ph.epil ], [ %indvars.iv.unr, %vector.ph.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph.epil ], [ 0, %vector.ph.loopexit.unr-lcssa ]
  %11 = getelementptr inbounds i8, ptr %0, i64 %indvars.iv.epil
  %12 = load i8, ptr %11, align 1, !tbaa !9
  %13 = zext i8 %12 to i64
  %14 = getelementptr inbounds [256 x float], ptr %3, i64 0, i64 %13
  %15 = load float, ptr %14, align 4, !tbaa !5
  %16 = fadd float %15, 1.000000e+00
  store float %16, ptr %14, align 4, !tbaa !5
  %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 %vector.ph, label %.lr.ph.epil, !llvm.loop !10

vector.ph:                                        ; preds = %vector.ph.loopexit.unr-lcssa, %.lr.ph.epil, %.preheader57
  %17 = sitofp i32 %6 to float
  %broadcast.splatinsert = insertelement <4 x float> poison, float %17, i64 0
  %broadcast.splat = shufflevector <4 x float> %broadcast.splatinsert, <4 x float> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next.3, %vector.body ]
  %18 = getelementptr inbounds [256 x float], ptr %3, i64 0, i64 %index
  %wide.load = load <4 x float>, ptr %18, align 16, !tbaa !5
  %19 = fdiv <4 x float> %wide.load, %broadcast.splat
  %20 = getelementptr inbounds [256 x float], ptr %4, i64 0, i64 %index
  store <4 x float> %19, ptr %20, align 16, !tbaa !5
  %index.next = or disjoint i64 %index, 4
  %21 = getelementptr inbounds [256 x float], ptr %3, i64 0, i64 %index.next
  %wide.load.1 = load <4 x float>, ptr %21, align 16, !tbaa !5
  %22 = fdiv <4 x float> %wide.load.1, %broadcast.splat
  %23 = getelementptr inbounds [256 x float], ptr %4, i64 0, i64 %index.next
  store <4 x float> %22, ptr %23, align 16, !tbaa !5
  %index.next.1 = or disjoint i64 %index, 8
  %24 = getelementptr inbounds [256 x float], ptr %3, i64 0, i64 %index.next.1
  %wide.load.2 = load <4 x float>, ptr %24, align 16, !tbaa !5
  %25 = fdiv <4 x float> %wide.load.2, %broadcast.splat
  %26 = getelementptr inbounds [256 x float], ptr %4, i64 0, i64 %index.next.1
  store <4 x float> %25, ptr %26, align 16, !tbaa !5
  %index.next.2 = or disjoint i64 %index, 12
  %27 = getelementptr inbounds [256 x float], ptr %3, i64 0, i64 %index.next.2
  %wide.load.3 = load <4 x float>, ptr %27, align 16, !tbaa !5
  %28 = fdiv <4 x float> %wide.load.3, %broadcast.splat
  %29 = getelementptr inbounds [256 x float], ptr %4, i64 0, i64 %index.next.2
  store <4 x float> %28, ptr %29, align 16, !tbaa !5
  %index.next.3 = add nuw nsw i64 %index, 16
  %30 = icmp eq i64 %index.next.3, 256
  br i1 %30, label %middle.block, label %vector.body, !llvm.loop !12

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader.new ], [ %indvars.iv.next.3, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.3, %.lr.ph ]
  %31 = getelementptr inbounds i8, ptr %0, i64 %indvars.iv
  %32 = load i8, ptr %31, align 1, !tbaa !9
  %33 = zext i8 %32 to i64
  %34 = getelementptr inbounds [256 x float], ptr %3, i64 0, i64 %33
  %35 = load float, ptr %34, align 4, !tbaa !5
  %36 = fadd float %35, 1.000000e+00
  store float %36, ptr %34, align 4, !tbaa !5
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %37 = getelementptr inbounds i8, ptr %0, i64 %indvars.iv.next
  %38 = load i8, ptr %37, align 1, !tbaa !9
  %39 = zext i8 %38 to i64
  %40 = getelementptr inbounds [256 x float], ptr %3, i64 0, i64 %39
  %41 = load float, ptr %40, align 4, !tbaa !5
  %42 = fadd float %41, 1.000000e+00
  store float %42, ptr %40, align 4, !tbaa !5
  %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 2
  %43 = getelementptr inbounds i8, ptr %0, i64 %indvars.iv.next.1
  %44 = load i8, ptr %43, align 1, !tbaa !9
  %45 = zext i8 %44 to i64
  %46 = getelementptr inbounds [256 x float], ptr %3, i64 0, i64 %45
  %47 = load float, ptr %46, align 4, !tbaa !5
  %48 = fadd float %47, 1.000000e+00
  store float %48, ptr %46, align 4, !tbaa !5
  %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 3
  %49 = getelementptr inbounds i8, ptr %0, i64 %indvars.iv.next.2
  %50 = load i8, ptr %49, align 1, !tbaa !9
  %51 = zext i8 %50 to i64
  %52 = getelementptr inbounds [256 x float], ptr %3, i64 0, i64 %51
  %53 = load float, ptr %52, align 4, !tbaa !5
  %54 = fadd float %53, 1.000000e+00
  store float %54, ptr %52, align 4, !tbaa !5
  %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 %vector.ph.loopexit.unr-lcssa, label %.lr.ph, !llvm.loop !16

middle.block:                                     ; preds = %vector.body
  %55 = call noundef float @_Z3sumiPf(i32 noundef 256, ptr noundef nonnull %4)
  br label %58

56:                                               ; preds = %58
  %57 = load float, ptr %5, align 16, !tbaa !5
  br label %78

58:                                               ; preds = %middle.block, %58
  %indvars.iv74 = phi i64 [ 0, %middle.block ], [ %indvars.iv.next75, %58 ]
  %59 = trunc nuw nsw i64 %indvars.iv74 to i32
  %60 = call noundef float @_Z15calculate_sigmaifPf(i32 noundef %59, float noundef %55, ptr noundef nonnull %4)
  %61 = getelementptr inbounds [256 x float], ptr %5, i64 0, i64 %indvars.iv74
  store float %60, ptr %61, align 4, !tbaa !5
  %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
  %exitcond77.not = icmp eq i64 %indvars.iv.next75, 256
  br i1 %exitcond77.not, label %56, label %58, !llvm.loop !17

62:                                               ; preds = %93
  %63 = sitofp i32 %.1 to float
  %64 = sitofp i32 %.149 to float
  %65 = fdiv float %63, %64
  br i1 %9, label %iter.check, label %._crit_edge

iter.check:                                       ; preds = %62
  %wide.trip.count85 = zext nneg i32 %6 to i64
  %min.iters.check = icmp ult i32 %6, 8
  br i1 %min.iters.check, label %.lr.ph67.preheader, label %vector.main.loop.iter.check

vector.main.loop.iter.check:                      ; preds = %iter.check
  %min.iters.check90 = icmp ult i32 %6, 16
  br i1 %min.iters.check90, label %vec.epilog.ph, label %vector.ph91

vector.ph91:                                      ; preds = %vector.main.loop.iter.check
  %n.vec = and i64 %wide.trip.count85, 2147483632
  %broadcast.splatinsert95 = insertelement <16 x float> poison, float %65, i64 0
  %broadcast.splat96 = shufflevector <16 x float> %broadcast.splatinsert95, <16 x float> poison, <16 x i32> zeroinitializer
  br label %vector.body92

vector.body92:                                    ; preds = %vector.body92, %vector.ph91
  %index93 = phi i64 [ 0, %vector.ph91 ], [ %index.next97, %vector.body92 ]
  %66 = getelementptr inbounds i8, ptr %0, i64 %index93
  %wide.load94 = load <16 x i8>, ptr %66, align 1, !tbaa !9
  %67 = uitofp <16 x i8> %wide.load94 to <16 x float>
  %68 = fcmp ult <16 x float> %broadcast.splat96, %67
  %69 = sext <16 x i1> %68 to <16 x i8>
  %70 = getelementptr inbounds i8, ptr %8, i64 %index93
  store <16 x i8> %69, ptr %70, align 1
  %index.next97 = add nuw i64 %index93, 16
  %71 = icmp eq i64 %index.next97, %n.vec
  br i1 %71, label %middle.block87, label %vector.body92, !llvm.loop !18

middle.block87:                                   ; preds = %vector.body92
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count85
  br i1 %cmp.n, label %._crit_edge, label %vec.epilog.iter.check

vec.epilog.iter.check:                            ; preds = %middle.block87
  %n.vec.remaining = and i64 %wide.trip.count85, 8
  %min.epilog.iters.check.not.not = icmp eq i64 %n.vec.remaining, 0
  br i1 %min.epilog.iters.check.not.not, label %.lr.ph67.preheader, label %vec.epilog.ph

.lr.ph67.preheader:                               ; preds = %vec.epilog.middle.block, %iter.check, %vec.epilog.iter.check
  %indvars.iv82.ph = phi i64 [ 0, %iter.check ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec99, %vec.epilog.middle.block ]
  br label %.lr.ph67

vec.epilog.ph:                                    ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
  %vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
  %n.vec99 = and i64 %wide.trip.count85, 2147483640
  %broadcast.splatinsert103 = insertelement <8 x float> poison, float %65, i64 0
  %broadcast.splat104 = shufflevector <8 x float> %broadcast.splatinsert103, <8 x float> poison, <8 x i32> zeroinitializer
  br label %vec.epilog.vector.body

vec.epilog.vector.body:                           ; preds = %vec.epilog.vector.body, %vec.epilog.ph
  %index101 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next105, %vec.epilog.vector.body ]
  %72 = getelementptr inbounds i8, ptr %0, i64 %index101
  %wide.load102 = load <8 x i8>, ptr %72, align 1, !tbaa !9
  %73 = uitofp <8 x i8> %wide.load102 to <8 x float>
  %74 = fcmp ult <8 x float> %broadcast.splat104, %73
  %75 = sext <8 x i1> %74 to <8 x i8>
  %76 = getelementptr inbounds i8, ptr %8, i64 %index101
  store <8 x i8> %75, ptr %76, align 1
  %index.next105 = add nuw i64 %index101, 8
  %77 = icmp eq i64 %index.next105, %n.vec99
  br i1 %77, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !19

vec.epilog.middle.block:                          ; preds = %vec.epilog.vector.body
  %cmp.n106 = icmp eq i64 %n.vec99, %wide.trip.count85
  br i1 %cmp.n106, label %._crit_edge, label %.lr.ph67.preheader

78:                                               ; preds = %56, %93
  %indvars.iv78 = phi i64 [ 1, %56 ], [ %indvars.iv.next79, %93 ]
  %.04764 = phi i32 [ 0, %56 ], [ %.1, %93 ]
  %.04863 = phi i32 [ 1, %56 ], [ %.149, %93 ]
  %.05062 = phi float [ %57, %56 ], [ %.151, %93 ]
  %79 = getelementptr inbounds [256 x float], ptr %5, i64 0, i64 %indvars.iv78
  %80 = load float, ptr %79, align 4, !tbaa !5
  %81 = fsub float %80, %.05062
  %82 = call noundef float @_ZSt3absf(float noundef %81)
  %83 = fpext float %82 to double
  %84 = fcmp olt double %83, 1.000000e-10
  br i1 %84, label %85, label %89

85:                                               ; preds = %78
  %86 = trunc nuw nsw i64 %indvars.iv78 to i32
  %87 = add nsw i32 %.04764, %86
  %88 = add nsw i32 %.04863, 1
  br label %93

89:                                               ; preds = %78
  %90 = fcmp ogt float %80, %.05062
  br i1 %90, label %91, label %93

91:                                               ; preds = %89
  %92 = trunc nuw nsw i64 %indvars.iv78 to i32
  br label %93

93:                                               ; preds = %85, %91, %89
  %.151 = phi float [ %.05062, %85 ], [ %80, %91 ], [ %.05062, %89 ]
  %.149 = phi i32 [ %88, %85 ], [ 1, %91 ], [ %.04863, %89 ]
  %.1 = phi i32 [ %87, %85 ], [ %92, %91 ], [ %.04764, %89 ]
  %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
  %exitcond81.not = icmp eq i64 %indvars.iv.next79, 256
  br i1 %exitcond81.not, label %62, label %78, !llvm.loop !20

._crit_edge:                                      ; preds = %.lr.ph67, %middle.block87, %vec.epilog.middle.block, %62
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %3) #7
  ret ptr %8

.lr.ph67:                                         ; preds = %.lr.ph67.preheader, %.lr.ph67
  %indvars.iv82 = phi i64 [ %indvars.iv.next83, %.lr.ph67 ], [ %indvars.iv82.ph, %.lr.ph67.preheader ]
  %94 = getelementptr inbounds i8, ptr %0, i64 %indvars.iv82
  %95 = load i8, ptr %94, align 1, !tbaa !9
  %96 = uitofp i8 %95 to float
  %97 = fcmp ult float %65, %96
  %.sink = sext i1 %97 to i8
  %98 = getelementptr inbounds i8, ptr %8, i64 %indvars.iv82
  store i8 %.sink, ptr %98, align 1
  %indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
  %exitcond86.not = icmp eq i64 %indvars.iv.next83, %wide.trip.count85
  br i1 %exitcond86.not, label %._crit_edge, label %.lr.ph67, !llvm.loop !21
}

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_Z15calculate_sigmaifPf(i32 noundef, float noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3absf(float noundef) local_unnamed_addr #4

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

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 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 #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 = { inlinehint 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind allocsize(0) }
attributes #7 = { 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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.unroll.disable"}
!12 = distinct !{!12, !13, !14, !15}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13}
!18 = distinct !{!18, !13, !14, !15}
!19 = distinct !{!19, !13, !14, !15}
!20 = distinct !{!20, !13}
!21 = distinct !{!21, !13, !15, !14}


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