; LLVM IR from sp-nitech/SPTK :: src/conversion/cepstrum_to_autocorrelation.ll (ZN4sptk25CepstrumToAutocorrelationC2Eiii)

; 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::CepstrumToAutocorrelation" = type <{ ptr, i32, i32, %"class.sptk::RealValuedFastFourierTransform", i8, [7 x i8] }>
%"class.sptk::RealValuedFastFourierTransform" = type { ptr, i32, i32, i32, %"class.sptk::FastFourierTransform", i8, %"class.std::vector" }
%"class.sptk::FastFourierTransform" = type { ptr, i32, i32, i32, i8, %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4sptk25CepstrumToAutocorrelationC2Eiii(ptr noundef nonnull align 8 dereferenceable(121) %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !9
  %11 = load ptr, ptr %5, align 8
  store ptr getelementptr inbounds inrange(-16, 16) ({ [4 x ptr] }, ptr @_ZTVN4sptk25CepstrumToAutocorrelationE, i32 0, i32 0, i32 2), ptr %11, align 8, !tbaa !11
  %12 = getelementptr inbounds %"class.sptk::CepstrumToAutocorrelation", ptr %11, i32 0, i32 1
  %13 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %13, ptr %12, align 8, !tbaa !13
  %14 = getelementptr inbounds %"class.sptk::CepstrumToAutocorrelation", ptr %11, i32 0, i32 2
  %15 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %15, ptr %14, align 4, !tbaa !22
  %16 = getelementptr inbounds %"class.sptk::CepstrumToAutocorrelation", ptr %11, i32 0, i32 3
  %17 = load i32, ptr %8, align 4, !tbaa !9
  call void @_ZN4sptk30RealValuedFastFourierTransformC1Ei(ptr noundef nonnull align 8 dereferenceable(104) %16, i32 noundef %17)
  %18 = getelementptr inbounds %"class.sptk::CepstrumToAutocorrelation", ptr %11, i32 0, i32 4
  store i8 1, ptr %18, align 8, !tbaa !23
  %19 = getelementptr inbounds %"class.sptk::CepstrumToAutocorrelation", ptr %11, i32 0, i32 1
  %20 = load i32, ptr %19, align 8, !tbaa !13
  %21 = icmp slt i32 %20, 0
  br i1 %21, label %40, label %22

22:                                               ; preds = %4
  %23 = getelementptr inbounds %"class.sptk::CepstrumToAutocorrelation", ptr %11, i32 0, i32 2
  %24 = load i32, ptr %23, align 4, !tbaa !22
  %25 = icmp slt i32 %24, 0
  br i1 %25, label %40, label %26

26:                                               ; preds = %22
  %27 = load i32, ptr %8, align 4, !tbaa !9
  %28 = getelementptr inbounds %"class.sptk::CepstrumToAutocorrelation", ptr %11, i32 0, i32 1
  %29 = load i32, ptr %28, align 8, !tbaa !13
  %30 = icmp sle i32 %27, %29
  br i1 %30, label %40, label %31

31:                                               ; preds = %26
  %32 = load i32, ptr %8, align 4, !tbaa !9
  %33 = getelementptr inbounds %"class.sptk::CepstrumToAutocorrelation", ptr %11, i32 0, i32 2
  %34 = load i32, ptr %33, align 4, !tbaa !22
  %35 = icmp sle i32 %32, %34
  br i1 %35, label %40, label %36

36:                                               ; preds = %31
  %37 = getelementptr inbounds %"class.sptk::CepstrumToAutocorrelation", ptr %11, i32 0, i32 3
  %38 = invoke noundef zeroext i1 @_ZNK4sptk30RealValuedFastFourierTransform7IsValidEv(ptr noundef nonnull align 8 dereferenceable(104) %37)
          to label %39 unwind label %42

39:                                               ; preds = %36
  br i1 %38, label %46, label %40

40:                                               ; preds = %39, %31, %26, %22, %4
  %41 = getelementptr inbounds %"class.sptk::CepstrumToAutocorrelation", ptr %11, i32 0, i32 4
  store i8 0, ptr %41, align 8, !tbaa !23
  br label %46

42:                                               ; preds = %36
  %43 = landingpad { ptr, i32 }
          cleanup
  %44 = extractvalue { ptr, i32 } %43, 0
  store ptr %44, ptr %9, align 8
  %45 = extractvalue { ptr, i32 } %43, 1
  store i32 %45, ptr %10, align 4
  call void @_ZN4sptk30RealValuedFastFourierTransformD2Ev(ptr noundef nonnull align 8 dereferenceable(104) %16) #3
  br label %47

46:                                               ; preds = %40, %39
  ret void

47:                                               ; preds = %42
  %48 = load ptr, ptr %9, align 8
  %49 = load i32, ptr %10, align 4
  %50 = insertvalue { ptr, i32 } poison, ptr %48, 0
  %51 = insertvalue { ptr, i32 } %50, i32 %49, 1
  resume { ptr, i32 } %51
}

declare void @_ZN4sptk30RealValuedFastFourierTransformC1Ei(ptr noundef nonnull align 8 dereferenceable(104), i32 noundef) unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4sptk30RealValuedFastFourierTransform7IsValidEv(ptr noundef nonnull align 8 dereferenceable(104)) #2 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4sptk30RealValuedFastFourierTransformD2Ev(ptr noundef nonnull align 8 dereferenceable(104)) unnamed_addr #2 align 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 = { "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 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 }

!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 = !{!"vtable pointer", !8, i64 0}
!13 = !{!14, !10, i64 8}
!14 = !{!"_ZTSN4sptk25CepstrumToAutocorrelationE", !10, i64 8, !10, i64 12, !15, i64 16, !17, i64 120}
!15 = !{!"_ZTSN4sptk30RealValuedFastFourierTransformE", !10, i64 8, !10, i64 12, !10, i64 16, !16, i64 24, !17, i64 72, !18, i64 80}
!16 = !{!"_ZTSN4sptk20FastFourierTransformE", !10, i64 8, !10, i64 12, !10, i64 16, !17, i64 20, !18, i64 24}
!17 = !{!"bool", !7, i64 0}
!18 = !{!"_ZTSSt6vectorIdSaIdEE", !19, i64 0}
!19 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!22 = !{!14, !10, i64 12}
!23 = !{!14, !17, i64 120}


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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4sptk25CepstrumToAutocorrelationC2Eiii(ptr noundef nonnull align 8 dereferenceable(121) %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  store ptr getelementptr inbounds inrange(-16, 16) (i8, ptr @_ZTVN4sptk25CepstrumToAutocorrelationE, i64 16), ptr %0, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %1, ptr %5, align 8, !tbaa !8
  %6 = getelementptr inbounds i8, ptr %0, i64 12
  store i32 %2, ptr %6, align 4, !tbaa !20
  %7 = getelementptr inbounds i8, ptr %0, i64 16
  tail call void @_ZN4sptk30RealValuedFastFourierTransformC1Ei(ptr noundef nonnull align 8 dereferenceable(104) %7, i32 noundef %3)
  %8 = getelementptr inbounds i8, ptr %0, i64 120
  store i8 1, ptr %8, align 8, !tbaa !21
  %9 = load i32, ptr %5, align 8, !tbaa !8
  %10 = icmp slt i32 %9, 0
  br i1 %10, label %16, label %11

11:                                               ; preds = %4
  %12 = load i32, ptr %6, align 4, !tbaa !20
  %13 = icmp sgt i32 %12, -1
  %.not = icmp slt i32 %9, %3
  %or.cond = and i1 %.not, %13
  %.not7 = icmp slt i32 %12, %3
  %or.cond8 = and i1 %.not7, %or.cond
  br i1 %or.cond8, label %14, label %16

14:                                               ; preds = %11
  %15 = tail call noundef zeroext i1 @_ZNK4sptk30RealValuedFastFourierTransform7IsValidEv(ptr noundef nonnull align 8 dereferenceable(104) %7)
  br i1 %15, label %17, label %16

16:                                               ; preds = %14, %11, %4
  store i8 0, ptr %8, align 8, !tbaa !21
  br label %17

17:                                               ; preds = %16, %14
  ret void
}

declare void @_ZN4sptk30RealValuedFastFourierTransformC1Ei(ptr noundef nonnull align 8 dereferenceable(104), i32 noundef) unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4sptk30RealValuedFastFourierTransform7IsValidEv(ptr noundef nonnull align 8 dereferenceable(104)) local_unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

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 = { "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 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" }

!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 = !{!"_ZTSN4sptk25CepstrumToAutocorrelationE", !10, i64 8, !10, i64 12, !12, i64 16, !14, i64 120}
!10 = !{!"int", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"_ZTSN4sptk30RealValuedFastFourierTransformE", !10, i64 8, !10, i64 12, !10, i64 16, !13, i64 24, !14, i64 72, !15, i64 80}
!13 = !{!"_ZTSN4sptk20FastFourierTransformE", !10, i64 8, !10, i64 12, !10, i64 16, !14, i64 20, !15, i64 24}
!14 = !{!"bool", !11, i64 0}
!15 = !{!"_ZTSSt6vectorIdSaIdEE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !19, i64 0, !19, i64 8, !19, i64 16}
!19 = !{!"any pointer", !11, i64 0}
!20 = !{!9, !10, i64 12}
!21 = !{!9, !14, i64 120}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass