; LLVM IR from sp-nitech/SPTK :: src/analysis/pitch_extraction.ll (ZN4sptk15PitchExtractionC2EiddddNS0_10AlgorithmsE)

; 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::PitchExtraction" = type { ptr, ptr }

@_ZTVN4sptk15PitchExtractionE = external dso_local unnamed_addr constant { [4 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4sptk15PitchExtractionC2EiddddNS0_10AlgorithmsE(ptr noundef nonnull align 8 dereferenceable(16) %0, i32 noundef %1, double noundef %2, double noundef %3, double noundef %4, double noundef %5, i32 noundef %6) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i32 %1, ptr %9, align 4, !tbaa !9
  store double %2, ptr %10, align 8, !tbaa !11
  store double %3, ptr %11, align 8, !tbaa !11
  store double %4, ptr %12, align 8, !tbaa !11
  store double %5, ptr %13, align 8, !tbaa !11
  store i32 %6, ptr %14, align 4, !tbaa !13
  %17 = load ptr, ptr %8, align 8
  store ptr getelementptr inbounds inrange(-16, 16) ({ [4 x ptr] }, ptr @_ZTVN4sptk15PitchExtractionE, i32 0, i32 0, i32 2), ptr %17, align 8, !tbaa !15
  %18 = load i32, ptr %14, align 4, !tbaa !13
  switch i32 %18, label %84 [
    i32 0, label %19
    i32 1, label %32
    i32 2, label %45
    i32 3, label %58
    i32 4, label %71
  ]

19:                                               ; preds = %7
  %20 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 56) #4
  %21 = load i32, ptr %9, align 4, !tbaa !9
  %22 = load double, ptr %10, align 8, !tbaa !11
  %23 = load double, ptr %11, align 8, !tbaa !11
  %24 = load double, ptr %12, align 8, !tbaa !11
  %25 = load double, ptr %13, align 8, !tbaa !11
  invoke void @_ZN4sptk21PitchExtractionByRaptC1Eidddd(ptr noundef nonnull align 8 dereferenceable(49) %20, i32 noundef %21, double noundef %22, double noundef %23, double noundef %24, double noundef %25)
          to label %26 unwind label %28

26:                                               ; preds = %19
  %27 = getelementptr inbounds %"class.sptk::PitchExtraction", ptr %17, i32 0, i32 1
  store ptr %20, ptr %27, align 8, !tbaa !17
  br label %86

28:                                               ; preds = %19
  %29 = landingpad { ptr, i32 }
          cleanup
  %30 = extractvalue { ptr, i32 } %29, 0
  store ptr %30, ptr %15, align 8
  %31 = extractvalue { ptr, i32 } %29, 1
  store i32 %31, ptr %16, align 4
  call void @_ZdlPvm(ptr noundef %20, i64 noundef 56) #5
  br label %87

32:                                               ; preds = %7
  %33 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 56) #4
  %34 = load i32, ptr %9, align 4, !tbaa !9
  %35 = load double, ptr %10, align 8, !tbaa !11
  %36 = load double, ptr %11, align 8, !tbaa !11
  %37 = load double, ptr %12, align 8, !tbaa !11
  %38 = load double, ptr %13, align 8, !tbaa !11
  invoke void @_ZN4sptk22PitchExtractionBySwipeC1Eidddd(ptr noundef nonnull align 8 dereferenceable(49) %33, i32 noundef %34, double noundef %35, double noundef %36, double noundef %37, double noundef %38)
          to label %39 unwind label %41

39:                                               ; preds = %32
  %40 = getelementptr inbounds %"class.sptk::PitchExtraction", ptr %17, i32 0, i32 1
  store ptr %33, ptr %40, align 8, !tbaa !17
  br label %86

41:                                               ; preds = %32
  %42 = landingpad { ptr, i32 }
          cleanup
  %43 = extractvalue { ptr, i32 } %42, 0
  store ptr %43, ptr %15, align 8
  %44 = extractvalue { ptr, i32 } %42, 1
  store i32 %44, ptr %16, align 4
  call void @_ZdlPvm(ptr noundef %33, i64 noundef 56) #5
  br label %87

45:                                               ; preds = %7
  %46 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 56) #4
  %47 = load i32, ptr %9, align 4, !tbaa !9
  %48 = load double, ptr %10, align 8, !tbaa !11
  %49 = load double, ptr %11, align 8, !tbaa !11
  %50 = load double, ptr %12, align 8, !tbaa !11
  %51 = load double, ptr %13, align 8, !tbaa !11
  invoke void @_ZN4sptk23PitchExtractionByReaperC1Eidddd(ptr noundef nonnull align 8 dereferenceable(49) %46, i32 noundef %47, double noundef %48, double noundef %49, double noundef %50, double noundef %51)
          to label %52 unwind label %54

52:                                               ; preds = %45
  %53 = getelementptr inbounds %"class.sptk::PitchExtraction", ptr %17, i32 0, i32 1
  store ptr %46, ptr %53, align 8, !tbaa !17
  br label %86

54:                                               ; preds = %45
  %55 = landingpad { ptr, i32 }
          cleanup
  %56 = extractvalue { ptr, i32 } %55, 0
  store ptr %56, ptr %15, align 8
  %57 = extractvalue { ptr, i32 } %55, 1
  store i32 %57, ptr %16, align 4
  call void @_ZdlPvm(ptr noundef %46, i64 noundef 56) #5
  br label %87

58:                                               ; preds = %7
  %59 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 56) #4
  %60 = load i32, ptr %9, align 4, !tbaa !9
  %61 = load double, ptr %10, align 8, !tbaa !11
  %62 = load double, ptr %11, align 8, !tbaa !11
  %63 = load double, ptr %12, align 8, !tbaa !11
  %64 = load double, ptr %13, align 8, !tbaa !11
  invoke void @_ZN4sptk20PitchExtractionByDioC1Eidddd(ptr noundef nonnull align 8 dereferenceable(49) %59, i32 noundef %60, double noundef %61, double noundef %62, double noundef %63, double noundef %64)
          to label %65 unwind label %67

65:                                               ; preds = %58
  %66 = getelementptr inbounds %"class.sptk::PitchExtraction", ptr %17, i32 0, i32 1
  store ptr %59, ptr %66, align 8, !tbaa !17
  br label %86

67:                                               ; preds = %58
  %68 = landingpad { ptr, i32 }
          cleanup
  %69 = extractvalue { ptr, i32 } %68, 0
  store ptr %69, ptr %15, align 8
  %70 = extractvalue { ptr, i32 } %68, 1
  store i32 %70, ptr %16, align 4
  call void @_ZdlPvm(ptr noundef %59, i64 noundef 56) #5
  br label %87

71:                                               ; preds = %7
  %72 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 56) #4
  %73 = load i32, ptr %9, align 4, !tbaa !9
  %74 = load double, ptr %10, align 8, !tbaa !11
  %75 = load double, ptr %11, align 8, !tbaa !11
  %76 = load double, ptr %12, align 8, !tbaa !11
  %77 = load double, ptr %13, align 8, !tbaa !11
  invoke void @_ZN4sptk24PitchExtractionByHarvestC1Eidddd(ptr noundef nonnull align 8 dereferenceable(49) %72, i32 noundef %73, double noundef %74, double noundef %75, double noundef %76, double noundef %77)
          to label %78 unwind label %80

78:                                               ; preds = %71
  %79 = getelementptr inbounds %"class.sptk::PitchExtraction", ptr %17, i32 0, i32 1
  store ptr %72, ptr %79, align 8, !tbaa !17
  br label %86

80:                                               ; preds = %71
  %81 = landingpad { ptr, i32 }
          cleanup
  %82 = extractvalue { ptr, i32 } %81, 0
  store ptr %82, ptr %15, align 8
  %83 = extractvalue { ptr, i32 } %81, 1
  store i32 %83, ptr %16, align 4
  call void @_ZdlPvm(ptr noundef %72, i64 noundef 56) #5
  br label %87

84:                                               ; preds = %7
  %85 = getelementptr inbounds %"class.sptk::PitchExtraction", ptr %17, i32 0, i32 1
  store ptr null, ptr %85, align 8, !tbaa !17
  br label %86

86:                                               ; preds = %84, %78, %65, %52, %39, %26
  ret void

87:                                               ; preds = %80, %67, %54, %41, %28
  %88 = load ptr, ptr %15, align 8
  %89 = load i32, ptr %16, align 4
  %90 = insertvalue { ptr, i32 } poison, ptr %88, 0
  %91 = insertvalue { ptr, i32 } %90, i32 %89, 1
  resume { ptr, i32 } %91
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #1

declare void @_ZN4sptk21PitchExtractionByRaptC1Eidddd(ptr noundef nonnull align 8 dereferenceable(49), i32 noundef, double noundef, double noundef, double noundef, double noundef) unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #3

declare void @_ZN4sptk22PitchExtractionBySwipeC1Eidddd(ptr noundef nonnull align 8 dereferenceable(49), i32 noundef, double noundef, double noundef, double noundef, double noundef) unnamed_addr #2

declare void @_ZN4sptk23PitchExtractionByReaperC1Eidddd(ptr noundef nonnull align 8 dereferenceable(49), i32 noundef, double noundef, double noundef, double noundef, double noundef) unnamed_addr #2

declare void @_ZN4sptk20PitchExtractionByDioC1Eidddd(ptr noundef nonnull align 8 dereferenceable(49), i32 noundef, double noundef, double noundef, double noundef, double noundef) unnamed_addr #2

declare void @_ZN4sptk24PitchExtractionByHarvestC1Eidddd(ptr noundef nonnull align 8 dereferenceable(49), i32 noundef, double noundef, double noundef, double noundef, double noundef) unnamed_addr #2

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 = { nobuiltin 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 = { "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 = { nobuiltin 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 = { builtin allocsize(0) }
attributes #5 = { builtin 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 = !{!"_ZTSN4sptk15PitchExtraction10AlgorithmsE", !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"vtable pointer", !8, i64 0}
!17 = !{!18, !6, i64 8}
!18 = !{!"_ZTSN4sptk15PitchExtractionE", !6, i64 8}


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

@_ZTVN4sptk15PitchExtractionE = external dso_local unnamed_addr constant { [4 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4sptk15PitchExtractionC2EiddddNS0_10AlgorithmsE(ptr nocapture noundef nonnull writeonly align 8 dereferenceable(16) %0, i32 noundef %1, double noundef %2, double noundef %3, double noundef %4, double noundef %5, i32 noundef %6) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  store ptr getelementptr inbounds inrange(-16, 16) (i8, ptr @_ZTVN4sptk15PitchExtractionE, i64 16), ptr %0, align 8, !tbaa !5
  switch i32 %6, label %28 [
    i32 0, label %8
    i32 1, label %12
    i32 2, label %16
    i32 3, label %20
    i32 4, label %24
  ]

8:                                                ; preds = %7
  %9 = tail call noalias noundef nonnull dereferenceable(56) ptr @_Znwm(i64 noundef 56) #4
  invoke void @_ZN4sptk21PitchExtractionByRaptC1Eidddd(ptr noundef nonnull align 8 dereferenceable(49) %9, i32 noundef %1, double noundef %2, double noundef %3, double noundef %4, double noundef %5)
          to label %28 unwind label %10

10:                                               ; preds = %8
  %11 = landingpad { ptr, i32 }
          cleanup
  br label %30

12:                                               ; preds = %7
  %13 = tail call noalias noundef nonnull dereferenceable(56) ptr @_Znwm(i64 noundef 56) #4
  invoke void @_ZN4sptk22PitchExtractionBySwipeC1Eidddd(ptr noundef nonnull align 8 dereferenceable(49) %13, i32 noundef %1, double noundef %2, double noundef %3, double noundef %4, double noundef %5)
          to label %28 unwind label %14

14:                                               ; preds = %12
  %15 = landingpad { ptr, i32 }
          cleanup
  br label %30

16:                                               ; preds = %7
  %17 = tail call noalias noundef nonnull dereferenceable(56) ptr @_Znwm(i64 noundef 56) #4
  invoke void @_ZN4sptk23PitchExtractionByReaperC1Eidddd(ptr noundef nonnull align 8 dereferenceable(49) %17, i32 noundef %1, double noundef %2, double noundef %3, double noundef %4, double noundef %5)
          to label %28 unwind label %18

18:                                               ; preds = %16
  %19 = landingpad { ptr, i32 }
          cleanup
  br label %30

20:                                               ; preds = %7
  %21 = tail call noalias noundef nonnull dereferenceable(56) ptr @_Znwm(i64 noundef 56) #4
  invoke void @_ZN4sptk20PitchExtractionByDioC1Eidddd(ptr noundef nonnull align 8 dereferenceable(49) %21, i32 noundef %1, double noundef %2, double noundef %3, double noundef %4, double noundef %5)
          to label %28 unwind label %22

22:                                               ; preds = %20
  %23 = landingpad { ptr, i32 }
          cleanup
  br label %30

24:                                               ; preds = %7
  %25 = tail call noalias noundef nonnull dereferenceable(56) ptr @_Znwm(i64 noundef 56) #4
  invoke void @_ZN4sptk24PitchExtractionByHarvestC1Eidddd(ptr noundef nonnull align 8 dereferenceable(49) %25, i32 noundef %1, double noundef %2, double noundef %3, double noundef %4, double noundef %5)
          to label %28 unwind label %26

26:                                               ; preds = %24
  %27 = landingpad { ptr, i32 }
          cleanup
  br label %30

28:                                               ; preds = %7, %24, %20, %16, %12, %8
  %.sink = phi ptr [ %9, %8 ], [ %13, %12 ], [ %17, %16 ], [ %21, %20 ], [ %25, %24 ], [ null, %7 ]
  %29 = getelementptr inbounds i8, ptr %0, i64 8
  store ptr %.sink, ptr %29, align 8, !tbaa !8
  ret void

30:                                               ; preds = %26, %22, %18, %14, %10
  %.sink31 = phi ptr [ %25, %26 ], [ %21, %22 ], [ %17, %18 ], [ %13, %14 ], [ %9, %10 ]
  %.pn = phi { ptr, i32 } [ %27, %26 ], [ %23, %22 ], [ %19, %18 ], [ %15, %14 ], [ %11, %10 ]
  tail call void @_ZdlPvm(ptr noundef nonnull %.sink31, i64 noundef 56) #5
  resume { ptr, i32 } %.pn
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #1

declare void @_ZN4sptk21PitchExtractionByRaptC1Eidddd(ptr noundef nonnull align 8 dereferenceable(49), i32 noundef, double noundef, double noundef, double noundef, double noundef) unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #3

declare void @_ZN4sptk22PitchExtractionBySwipeC1Eidddd(ptr noundef nonnull align 8 dereferenceable(49), i32 noundef, double noundef, double noundef, double noundef, double noundef) unnamed_addr #2

declare void @_ZN4sptk23PitchExtractionByReaperC1Eidddd(ptr noundef nonnull align 8 dereferenceable(49), i32 noundef, double noundef, double noundef, double noundef, double noundef) unnamed_addr #2

declare void @_ZN4sptk20PitchExtractionByDioC1Eidddd(ptr noundef nonnull align 8 dereferenceable(49), i32 noundef, double noundef, double noundef, double noundef, double noundef) unnamed_addr #2

declare void @_ZN4sptk24PitchExtractionByHarvestC1Eidddd(ptr noundef nonnull align 8 dereferenceable(49), i32 noundef, double noundef, double noundef, double noundef, double noundef) unnamed_addr #2

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 = { nobuiltin 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 = { "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 = { nobuiltin 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 = { builtin allocsize(0) }
attributes #5 = { builtin 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !10, i64 8}
!9 = !{!"_ZTSN4sptk15PitchExtractionE", !10, i64 8}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,GlobalOptPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass