; LLVM IR from sp-nitech/SPTK :: third_party/REAPER/epoch_tracker (epoch_tracker)

; 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: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIfSaIfEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIfSaIfEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2

; Function Attrs: nounwind
declare double @sqrt(double noundef) #3

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4sptk6reaper12EpochTracker16GetSymmetryStatsERKSt6vectorIfSaIfEEPfS7_S7_(ptr noundef nonnull align 8 dereferenceable(500) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #1 align 2 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca double, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  %20 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  %22 = call noundef i64 @_ZNKSt6vectorIfSaIfEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %21) #4
  %23 = trunc i64 %22 to i32
  store i32 %23, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  store double 0.000000e+00, ptr %12, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  store double 0.000000e+00, ptr %13, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  store double 0.000000e+00, ptr %14, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  store i32 0, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  store i32 0, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %24

24:                                               ; preds = %38, %5
  %25 = load i32, ptr %17, align 4, !tbaa !9
  %26 = load i32, ptr %11, align 4, !tbaa !9
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %29, label %28

28:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  br label %41

29:                                               ; preds = %24
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = load i32, ptr %17, align 4, !tbaa !9
  %32 = sext i32 %31 to i64
  %33 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIfSaIfEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %30, i64 noundef %32) #4
  %34 = load float, ptr %33, align 4, !tbaa !13
  %35 = fpext float %34 to double
  %36 = load double, ptr %14, align 8, !tbaa !11
  %37 = fadd double %36, %35
  store double %37, ptr %14, align 8, !tbaa !11
  br label %38

38:                                               ; preds = %29
  %39 = load i32, ptr %17, align 4, !tbaa !9
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %17, align 4, !tbaa !9
  br label %24, !llvm.loop !15

41:                                               ; preds = %28
  %42 = load double, ptr %14, align 8, !tbaa !11
  %43 = load i32, ptr %11, align 4, !tbaa !9
  %44 = sitofp i32 %43 to double
  %45 = fdiv double %42, %44
  %46 = fptrunc double %45 to float
  %47 = load ptr, ptr %10, align 8, !tbaa !5
  store float %46, ptr %47, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %48

48:                                               ; preds = %84, %41
  %49 = load i32, ptr %18, align 4, !tbaa !9
  %50 = load i32, ptr %11, align 4, !tbaa !9
  %51 = icmp slt i32 %49, %50
  br i1 %51, label %53, label %52

52:                                               ; preds = %48
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  br label %87

53:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  %54 = load ptr, ptr %7, align 8, !tbaa !5
  %55 = load i32, ptr %18, align 4, !tbaa !9
  %56 = sext i32 %55 to i64
  %57 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIfSaIfEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %54, i64 noundef %56) #4
  %58 = load float, ptr %57, align 4, !tbaa !13
  %59 = load ptr, ptr %10, align 8, !tbaa !5
  %60 = load float, ptr %59, align 4, !tbaa !13
  %61 = fsub float %58, %60
  %62 = fpext float %61 to double
  store double %62, ptr %19, align 8, !tbaa !11
  %63 = load double, ptr %19, align 8, !tbaa !11
  %64 = fcmp ogt double %63, 0.000000e+00
  br i1 %64, label %65, label %72

65:                                               ; preds = %53
  %66 = load double, ptr %19, align 8, !tbaa !11
  %67 = load double, ptr %19, align 8, !tbaa !11
  %68 = load double, ptr %12, align 8, !tbaa !11
  %69 = call double @llvm.fmuladd.f64(double %66, double %67, double %68)
  store double %69, ptr %12, align 8, !tbaa !11
  %70 = load i32, ptr %15, align 4, !tbaa !9
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr %15, align 4, !tbaa !9
  br label %83

72:                                               ; preds = %53
  %73 = load double, ptr %19, align 8, !tbaa !11
  %74 = fcmp olt double %73, 0.000000e+00
  br i1 %74, label %75, label %82

75:                                               ; preds = %72
  %76 = load double, ptr %19, align 8, !tbaa !11
  %77 = load double, ptr %19, align 8, !tbaa !11
  %78 = load double, ptr %13, align 8, !tbaa !11
  %79 = call double @llvm.fmuladd.f64(double %76, double %77, double %78)
  store double %79, ptr %13, align 8, !tbaa !11
  %80 = load i32, ptr %16, align 4, !tbaa !9
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr %16, align 4, !tbaa !9
  br label %82

82:                                               ; preds = %75, %72
  br label %83

83:                                               ; preds = %82, %65
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  br label %84

84:                                               ; preds = %83
  %85 = load i32, ptr %18, align 4, !tbaa !9
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %18, align 4, !tbaa !9
  br label %48, !llvm.loop !17

87:                                               ; preds = %52
  %88 = load double, ptr %12, align 8, !tbaa !11
  %89 = load i32, ptr %15, align 4, !tbaa !9
  %90 = sitofp i32 %89 to double
  %91 = fdiv double %88, %90
  %92 = call double @sqrt(double noundef %91) #4
  %93 = fptrunc double %92 to float
  %94 = load ptr, ptr %8, align 8, !tbaa !5
  store float %93, ptr %94, align 4, !tbaa !13
  %95 = load double, ptr %13, align 8, !tbaa !11
  %96 = load i32, ptr %16, align 4, !tbaa !9
  %97 = sitofp i32 %96 to double
  %98 = fdiv double %95, %97
  %99 = call double @sqrt(double noundef %98) #4
  %100 = fptrunc double %99 to float
  %101 = load ptr, ptr %9, align 8, !tbaa !5
  store float %100, ptr %101, align 4, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 #4 = { 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !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"

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIfSaIfEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIfSaIfEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4sptk6reaper12EpochTracker16GetSymmetryStatsERKSt6vectorIfSaIfEEPfS7_S7_(ptr nocapture noundef nonnull readnone align 8 dereferenceable(500) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr nocapture noundef writeonly %2, ptr nocapture noundef writeonly %3, ptr nocapture noundef %4) local_unnamed_addr #0 align 2 {
  %6 = tail call noundef i64 @_ZNKSt6vectorIfSaIfEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #3
  %7 = trunc i64 %6 to i32
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.lr.ph.preheader, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %5
  %9 = sitofp i32 %7 to double
  %10 = fdiv double 0.000000e+00, %9
  %11 = fptrunc double %10 to float
  store float %11, ptr %4, align 4, !tbaa !5
  br label %._crit_edge53

.lr.ph.preheader:                                 ; preds = %5
  %wide.trip.count = and i64 %6, 2147483647
  br label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph
  %12 = sitofp i32 %7 to double
  %13 = fdiv double %18, %12
  %14 = fptrunc double %13 to float
  store float %14, ptr %4, align 4, !tbaa !5
  br i1 %8, label %.lr.ph52.preheader, label %._crit_edge53

.lr.ph52.preheader:                               ; preds = %._crit_edge
  %wide.trip.count62 = and i64 %6, 2147483647
  br label %.lr.ph52

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %.03844 = phi double [ 0.000000e+00, %.lr.ph.preheader ], [ %18, %.lr.ph ]
  %15 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIfSaIfEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %indvars.iv) #3
  %16 = load float, ptr %15, align 4, !tbaa !5
  %17 = fpext float %16 to double
  %18 = fadd double %.03844, %17
  %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 %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge53.loopexit:                           ; preds = %43
  %19 = sitofp i32 %.137 to double
  %20 = fdiv double %.1, %19
  %21 = sitofp i32 %.135 to double
  %22 = fdiv double %.140, %21
  br label %._crit_edge53

._crit_edge53:                                    ; preds = %._crit_edge.thread, %._crit_edge53.loopexit, %._crit_edge
  %23 = phi double [ 0x7FF8000000000000, %._crit_edge ], [ %20, %._crit_edge53.loopexit ], [ 0x7FF8000000000000, %._crit_edge.thread ]
  %24 = phi double [ 0x7FF8000000000000, %._crit_edge ], [ %22, %._crit_edge53.loopexit ], [ 0x7FF8000000000000, %._crit_edge.thread ]
  %25 = tail call double @sqrt(double noundef %23) #3
  %26 = fptrunc double %25 to float
  store float %26, ptr %2, align 4, !tbaa !5
  %27 = tail call double @sqrt(double noundef %24) #3
  %28 = fptrunc double %27 to float
  store float %28, ptr %3, align 4, !tbaa !5
  ret void

.lr.ph52:                                         ; preds = %.lr.ph52.preheader, %43
  %indvars.iv59 = phi i64 [ 0, %.lr.ph52.preheader ], [ %indvars.iv.next60, %43 ]
  %.050 = phi double [ 0.000000e+00, %.lr.ph52.preheader ], [ %.1, %43 ]
  %.03448 = phi i32 [ 0, %.lr.ph52.preheader ], [ %.135, %43 ]
  %.03647 = phi i32 [ 0, %.lr.ph52.preheader ], [ %.137, %43 ]
  %.03946 = phi double [ 0.000000e+00, %.lr.ph52.preheader ], [ %.140, %43 ]
  %29 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIfSaIfEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %indvars.iv59) #3
  %30 = load float, ptr %29, align 4, !tbaa !5
  %31 = load float, ptr %4, align 4, !tbaa !5
  %32 = fsub float %30, %31
  %33 = fpext float %32 to double
  %34 = fcmp ogt float %32, 0.000000e+00
  br i1 %34, label %35, label %38

35:                                               ; preds = %.lr.ph52
  %36 = tail call double @llvm.fmuladd.f64(double %33, double %33, double %.050)
  %37 = add nsw i32 %.03647, 1
  br label %43

38:                                               ; preds = %.lr.ph52
  %39 = fcmp olt float %32, 0.000000e+00
  br i1 %39, label %40, label %43

40:                                               ; preds = %38
  %41 = tail call double @llvm.fmuladd.f64(double %33, double %33, double %.03946)
  %42 = add nsw i32 %.03448, 1
  br label %43

43:                                               ; preds = %38, %40, %35
  %.140 = phi double [ %.03946, %35 ], [ %41, %40 ], [ %.03946, %38 ]
  %.137 = phi i32 [ %37, %35 ], [ %.03647, %40 ], [ %.03647, %38 ]
  %.135 = phi i32 [ %.03448, %35 ], [ %42, %40 ], [ %.03448, %38 ]
  %.1 = phi double [ %36, %35 ], [ %.050, %40 ], [ %.050, %38 ]
  %indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
  %exitcond63.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count62
  br i1 %exitcond63.not, label %._crit_edge53.loopexit, label %.lr.ph52, !llvm.loop !11
}

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { mustprogress nofree nounwind willreturn memory(write) "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 }

!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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


; Effective O3 passes: CorrelatedValuePropagationPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass