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

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

%"class.sptk::reaper::LpcAnalyzer" = type { %"class.std::vector", %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl" }
%"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl" = type { %"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl_data" }
%"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl_data" = type { ptr, ptr, ptr }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4sptk6reaper11LpcAnalyzer10HannWindowEPKfPfif(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, float noundef %4) #0 align 2 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca float, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca double, align 8
  %14 = 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 i32 %3, ptr %9, align 4, !tbaa !9
  store float %4, ptr %10, align 4, !tbaa !11
  %15 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %16 = getelementptr inbounds %"class.sptk::reaper::LpcAnalyzer", ptr %15, i32 0, i32 1
  %17 = call noundef i64 @_ZNKSt6vectorIfSaIfEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %16) #5
  %18 = load i32, ptr %9, align 4, !tbaa !9
  %19 = sext i32 %18 to i64
  %20 = icmp ne i64 %17, %19
  br i1 %20, label %21, label %53

21:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  store double 5.000000e-01, ptr %14, align 8, !tbaa !13
  %22 = getelementptr inbounds %"class.sptk::reaper::LpcAnalyzer", ptr %15, i32 0, i32 1
  %23 = load i32, ptr %9, align 4, !tbaa !9
  %24 = sext i32 %23 to i64
  call void @_ZNSt6vectorIfSaIfEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %22, i64 noundef %24)
  store i32 0, ptr %11, align 4, !tbaa !9
  %25 = load i32, ptr %9, align 4, !tbaa !9
  %26 = sitofp i32 %25 to double
  %27 = fdiv double 0x401921FB54442D18, %26
  store double %27, ptr %13, align 8, !tbaa !13
  br label %28

28:                                               ; preds = %49, %21
  %29 = load i32, ptr %11, align 4, !tbaa !9
  %30 = load i32, ptr %9, align 4, !tbaa !9
  %31 = icmp slt i32 %29, %30
  br i1 %31, label %32, label %52

32:                                               ; preds = %28
  %33 = load double, ptr %14, align 8, !tbaa !13
  %34 = load double, ptr %14, align 8, !tbaa !13
  %35 = load double, ptr %14, align 8, !tbaa !13
  %36 = load i32, ptr %11, align 4, !tbaa !9
  %37 = sitofp i32 %36 to double
  %38 = fadd double %35, %37
  %39 = load double, ptr %13, align 8, !tbaa !13
  %40 = fmul double %38, %39
  %41 = call double @cos(double noundef %40) #5
  %42 = fneg double %34
  %43 = call double @llvm.fmuladd.f64(double %42, double %41, double %33)
  %44 = fptrunc double %43 to float
  %45 = getelementptr inbounds %"class.sptk::reaper::LpcAnalyzer", ptr %15, i32 0, i32 1
  %46 = load i32, ptr %11, align 4, !tbaa !9
  %47 = sext i32 %46 to i64
  %48 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIfSaIfEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %45, i64 noundef %47) #5
  store float %44, ptr %48, align 4, !tbaa !11
  br label %49

49:                                               ; preds = %32
  %50 = load i32, ptr %11, align 4, !tbaa !9
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %11, align 4, !tbaa !9
  br label %28, !llvm.loop !15

52:                                               ; preds = %28
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %53

53:                                               ; preds = %52, %5
  %54 = load float, ptr %10, align 4, !tbaa !11
  %55 = fpext float %54 to double
  %56 = fcmp une double %55, 0.000000e+00
  br i1 %56, label %57, label %86

57:                                               ; preds = %53
  store i32 0, ptr %11, align 4, !tbaa !9
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  %59 = getelementptr inbounds float, ptr %58, i64 1
  store ptr %59, ptr %12, align 8, !tbaa !5
  br label %60

60:                                               ; preds = %82, %57
  %61 = load i32, ptr %11, align 4, !tbaa !9
  %62 = load i32, ptr %9, align 4, !tbaa !9
  %63 = icmp slt i32 %61, %62
  br i1 %63, label %64, label %85

64:                                               ; preds = %60
  %65 = getelementptr inbounds %"class.sptk::reaper::LpcAnalyzer", ptr %15, i32 0, i32 1
  %66 = load i32, ptr %11, align 4, !tbaa !9
  %67 = sext i32 %66 to i64
  %68 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIfSaIfEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %65, i64 noundef %67) #5
  %69 = load float, ptr %68, align 4, !tbaa !11
  %70 = load ptr, ptr %12, align 8, !tbaa !5
  %71 = getelementptr inbounds float, ptr %70, i32 1
  store ptr %71, ptr %12, align 8, !tbaa !5
  %72 = load float, ptr %70, align 4, !tbaa !11
  %73 = load float, ptr %10, align 4, !tbaa !11
  %74 = load ptr, ptr %7, align 8, !tbaa !5
  %75 = getelementptr inbounds float, ptr %74, i32 1
  store ptr %75, ptr %7, align 8, !tbaa !5
  %76 = load float, ptr %74, align 4, !tbaa !11
  %77 = fneg float %73
  %78 = call float @llvm.fmuladd.f32(float %77, float %76, float %72)
  %79 = fmul float %69, %78
  %80 = load ptr, ptr %8, align 8, !tbaa !5
  %81 = getelementptr inbounds float, ptr %80, i32 1
  store ptr %81, ptr %8, align 8, !tbaa !5
  store float %79, ptr %80, align 4, !tbaa !11
  br label %82

82:                                               ; preds = %64
  %83 = load i32, ptr %11, align 4, !tbaa !9
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %11, align 4, !tbaa !9
  br label %60, !llvm.loop !17

85:                                               ; preds = %60
  br label %107

86:                                               ; preds = %53
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %87

87:                                               ; preds = %103, %86
  %88 = load i32, ptr %11, align 4, !tbaa !9
  %89 = load i32, ptr %9, align 4, !tbaa !9
  %90 = icmp slt i32 %88, %89
  br i1 %90, label %91, label %106

91:                                               ; preds = %87
  %92 = getelementptr inbounds %"class.sptk::reaper::LpcAnalyzer", ptr %15, i32 0, i32 1
  %93 = load i32, ptr %11, align 4, !tbaa !9
  %94 = sext i32 %93 to i64
  %95 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIfSaIfEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %92, i64 noundef %94) #5
  %96 = load float, ptr %95, align 4, !tbaa !11
  %97 = load ptr, ptr %7, align 8, !tbaa !5
  %98 = getelementptr inbounds float, ptr %97, i32 1
  store ptr %98, ptr %7, align 8, !tbaa !5
  %99 = load float, ptr %97, align 4, !tbaa !11
  %100 = fmul float %96, %99
  %101 = load ptr, ptr %8, align 8, !tbaa !5
  %102 = getelementptr inbounds float, ptr %101, i32 1
  store ptr %102, ptr %8, align 8, !tbaa !5
  store float %100, ptr %101, align 4, !tbaa !11
  br label %103

103:                                              ; preds = %91
  %104 = load i32, ptr %11, align 4, !tbaa !9
  %105 = add nsw i32 %104, 1
  store i32 %105, ptr %11, align 4, !tbaa !9
  br label %87, !llvm.loop !18

106:                                              ; preds = %87
  br label %107

107:                                              ; preds = %106, %85
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  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: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIfSaIfEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIfSaIfEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #0 align 2

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #4

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = !{!14, !14, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !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 uwtable
define dso_local void @_ZN4sptk6reaper11LpcAnalyzer10HannWindowEPKfPfif(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr nocapture noundef readonly %1, ptr nocapture noundef writeonly %2, i32 noundef %3, float noundef %4) local_unnamed_addr #0 align 2 {
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  %7 = tail call noundef i64 @_ZNKSt6vectorIfSaIfEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #4
  %8 = sext i32 %3 to i64
  %.not = icmp eq i64 %7, %8
  br i1 %.not, label %.loopexit36, label %9

9:                                                ; preds = %5
  tail call void @_ZNSt6vectorIfSaIfEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %8)
  %10 = sitofp i32 %3 to double
  %11 = fdiv double 0x401921FB54442D18, %10
  %12 = icmp sgt i32 %3, 0
  br i1 %12, label %.lr.ph.preheader, label %.loopexit36

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

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %13 = trunc nuw nsw i64 %indvars.iv to i32
  %14 = uitofp nneg i32 %13 to double
  %15 = fadd double %14, 5.000000e-01
  %16 = fmul double %11, %15
  %17 = tail call double @cos(double noundef %16) #4
  %18 = tail call double @llvm.fmuladd.f64(double %17, double -5.000000e-01, double 5.000000e-01)
  %19 = fptrunc double %18 to float
  %20 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIfSaIfEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %indvars.iv) #4
  store float %19, ptr %20, align 4, !tbaa !5
  %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 %.loopexit36, label %.lr.ph, !llvm.loop !9

.loopexit36:                                      ; preds = %.lr.ph, %9, %5
  %21 = fcmp une float %4, 0.000000e+00
  %22 = icmp sgt i32 %3, 0
  br i1 %21, label %.preheader, label %.preheader34

.preheader34:                                     ; preds = %.loopexit36
  br i1 %22, label %.lr.ph41.preheader, label %.loopexit

.lr.ph41.preheader:                               ; preds = %.preheader34
  %wide.trip.count52 = zext nneg i32 %3 to i64
  br label %.lr.ph41

.preheader:                                       ; preds = %.loopexit36
  br i1 %22, label %.lr.ph46, label %.loopexit

.lr.ph46:                                         ; preds = %.preheader
  %23 = fneg float %4
  %wide.trip.count57 = zext nneg i32 %3 to i64
  br label %24

24:                                               ; preds = %.lr.ph46, %24
  %indvars.iv54 = phi i64 [ 0, %.lr.ph46 ], [ %indvars.iv.next55, %24 ]
  %.045 = phi ptr [ %1, %.lr.ph46 ], [ %25, %24 ]
  %.02844 = phi ptr [ %2, %.lr.ph46 ], [ %32, %24 ]
  %25 = getelementptr i8, ptr %.045, i64 4
  %26 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIfSaIfEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %indvars.iv54) #4
  %27 = load float, ptr %26, align 4, !tbaa !5
  %28 = load float, ptr %25, align 4, !tbaa !5
  %29 = load float, ptr %.045, align 4, !tbaa !5
  %30 = tail call float @llvm.fmuladd.f32(float %23, float %29, float %28)
  %31 = fmul float %27, %30
  %32 = getelementptr inbounds i8, ptr %.02844, i64 4
  store float %31, ptr %.02844, align 4, !tbaa !5
  %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
  %exitcond58.not = icmp eq i64 %indvars.iv.next55, %wide.trip.count57
  br i1 %exitcond58.not, label %.loopexit, label %24, !llvm.loop !11

.lr.ph41:                                         ; preds = %.lr.ph41.preheader, %.lr.ph41
  %indvars.iv49 = phi i64 [ 0, %.lr.ph41.preheader ], [ %indvars.iv.next50, %.lr.ph41 ]
  %.140 = phi ptr [ %1, %.lr.ph41.preheader ], [ %35, %.lr.ph41 ]
  %.12939 = phi ptr [ %2, %.lr.ph41.preheader ], [ %38, %.lr.ph41 ]
  %33 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIfSaIfEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %indvars.iv49) #4
  %34 = load float, ptr %33, align 4, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %.140, i64 4
  %36 = load float, ptr %.140, align 4, !tbaa !5
  %37 = fmul float %34, %36
  %38 = getelementptr inbounds i8, ptr %.12939, i64 4
  store float %37, ptr %.12939, align 4, !tbaa !5
  %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
  %exitcond53.not = icmp eq i64 %indvars.iv.next50, %wide.trip.count52
  br i1 %exitcond53.not, label %.loopexit, label %.lr.ph41, !llvm.loop !12

.loopexit:                                        ; preds = %.lr.ph41, %24, %.preheader34, %.preheader
  ret void
}

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

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

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

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #3

attributes #0 = { 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 #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 = { 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"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}
!12 = distinct !{!12, !10}


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