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

; 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::AutocorrelationAnalysis" = type <{ ptr, i8, [7 x i8], ptr, ptr, i8, [7 x i8] }>

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4sptk23AutocorrelationAnalysisC2Eiib(ptr noundef nonnull align 8 dereferenceable(33) %0, i32 noundef %1, i32 noundef %2, i1 noundef zeroext %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 i8, align 1
  %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
  %11 = zext i1 %3 to i8
  store i8 %11, ptr %8, align 1, !tbaa !11
  %12 = load ptr, ptr %5, align 8
  store ptr getelementptr inbounds inrange(-16, 16) ({ [4 x ptr] }, ptr @_ZTVN4sptk23AutocorrelationAnalysisE, i32 0, i32 0, i32 2), ptr %12, align 8, !tbaa !13
  %13 = getelementptr inbounds %"class.sptk::AutocorrelationAnalysis", ptr %12, i32 0, i32 1
  %14 = load i8, ptr %8, align 1, !tbaa !11, !range !15, !noundef !16
  %15 = trunc i8 %14 to i1
  %16 = zext i1 %15 to i8
  store i8 %16, ptr %13, align 8, !tbaa !17
  %17 = getelementptr inbounds %"class.sptk::AutocorrelationAnalysis", ptr %12, i32 0, i32 3
  store ptr null, ptr %17, align 8, !tbaa !19
  %18 = getelementptr inbounds %"class.sptk::AutocorrelationAnalysis", ptr %12, i32 0, i32 4
  store ptr null, ptr %18, align 8, !tbaa !20
  %19 = getelementptr inbounds %"class.sptk::AutocorrelationAnalysis", ptr %12, i32 0, i32 5
  store i8 1, ptr %19, align 8, !tbaa !21
  %20 = getelementptr inbounds %"class.sptk::AutocorrelationAnalysis", ptr %12, i32 0, i32 1
  %21 = load i8, ptr %20, align 8, !tbaa !17, !range !15, !noundef !16
  %22 = trunc i8 %21 to i1
  br i1 %22, label %23, label %38

23:                                               ; preds = %4
  %24 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 24) #5
  %25 = load i32, ptr %6, align 4, !tbaa !9
  %26 = load i32, ptr %7, align 4, !tbaa !9
  invoke void @_ZN4sptk25WaveformToAutocorrelationC1Eii(ptr noundef nonnull align 8 dereferenceable(17) %24, i32 noundef %25, i32 noundef %26)
          to label %27 unwind label %34

27:                                               ; preds = %23
  %28 = getelementptr inbounds %"class.sptk::AutocorrelationAnalysis", ptr %12, i32 0, i32 3
  store ptr %24, ptr %28, align 8, !tbaa !19
  %29 = getelementptr inbounds %"class.sptk::AutocorrelationAnalysis", ptr %12, i32 0, i32 3
  %30 = load ptr, ptr %29, align 8, !tbaa !19
  %31 = call noundef zeroext i1 @_ZNK4sptk25WaveformToAutocorrelation7IsValidEv(ptr noundef nonnull align 8 dereferenceable(17) %30)
  %32 = getelementptr inbounds %"class.sptk::AutocorrelationAnalysis", ptr %12, i32 0, i32 5
  %33 = zext i1 %31 to i8
  store i8 %33, ptr %32, align 8, !tbaa !21
  br label %53

34:                                               ; preds = %23
  %35 = landingpad { ptr, i32 }
          cleanup
  %36 = extractvalue { ptr, i32 } %35, 0
  store ptr %36, ptr %9, align 8
  %37 = extractvalue { ptr, i32 } %35, 1
  store i32 %37, ptr %10, align 4
  call void @_ZdlPvm(ptr noundef %24, i64 noundef 24) #6
  br label %54

38:                                               ; preds = %4
  %39 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 136) #5
  %40 = load i32, ptr %6, align 4, !tbaa !9
  %41 = load i32, ptr %7, align 4, !tbaa !9
  invoke void @_ZN4sptk25SpectrumToAutocorrelationC1Eii(ptr noundef nonnull align 8 dereferenceable(129) %39, i32 noundef %40, i32 noundef %41)
          to label %42 unwind label %49

42:                                               ; preds = %38
  %43 = getelementptr inbounds %"class.sptk::AutocorrelationAnalysis", ptr %12, i32 0, i32 4
  store ptr %39, ptr %43, align 8, !tbaa !20
  %44 = getelementptr inbounds %"class.sptk::AutocorrelationAnalysis", ptr %12, i32 0, i32 4
  %45 = load ptr, ptr %44, align 8, !tbaa !20
  %46 = call noundef zeroext i1 @_ZNK4sptk25SpectrumToAutocorrelation7IsValidEv(ptr noundef nonnull align 8 dereferenceable(129) %45)
  %47 = getelementptr inbounds %"class.sptk::AutocorrelationAnalysis", ptr %12, i32 0, i32 5
  %48 = zext i1 %46 to i8
  store i8 %48, ptr %47, align 8, !tbaa !21
  br label %53

49:                                               ; preds = %38
  %50 = landingpad { ptr, i32 }
          cleanup
  %51 = extractvalue { ptr, i32 } %50, 0
  store ptr %51, ptr %9, align 8
  %52 = extractvalue { ptr, i32 } %50, 1
  store i32 %52, ptr %10, align 4
  call void @_ZdlPvm(ptr noundef %39, i64 noundef 136) #6
  br label %54

53:                                               ; preds = %42, %27
  ret void

54:                                               ; preds = %49, %34
  %55 = load ptr, ptr %9, align 8
  %56 = load i32, ptr %10, align 4
  %57 = insertvalue { ptr, i32 } poison, ptr %55, 0
  %58 = insertvalue { ptr, i32 } %57, i32 %56, 1
  resume { ptr, i32 } %58
}

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

declare void @_ZN4sptk25WaveformToAutocorrelationC1Eii(ptr noundef nonnull align 8 dereferenceable(17), i32 noundef, i32 noundef) unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

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

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

declare void @_ZN4sptk25SpectrumToAutocorrelationC1Eii(ptr noundef nonnull align 8 dereferenceable(129), i32 noundef, i32 noundef) unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4sptk25SpectrumToAutocorrelation7IsValidEv(ptr noundef nonnull align 8 dereferenceable(129)) #4 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 = { 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 = { 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 = { builtin allocsize(0) }
attributes #6 = { 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 = !{!"bool", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"vtable pointer", !8, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{!18, !12, i64 8}
!18 = !{!"_ZTSN4sptk23AutocorrelationAnalysisE", !12, i64 8, !6, i64 16, !6, i64 24, !12, i64 32}
!19 = !{!18, !6, i64 16}
!20 = !{!18, !6, i64 24}
!21 = !{!18, !12, i64 32}


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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4sptk23AutocorrelationAnalysisC2Eiib(ptr nocapture noundef nonnull writeonly align 8 dereferenceable(33) %0, i32 noundef %1, i32 noundef %2, i1 noundef zeroext %3) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %5 = zext i1 %3 to i8
  store ptr getelementptr inbounds inrange(-16, 16) (i8, ptr @_ZTVN4sptk23AutocorrelationAnalysisE, i64 16), ptr %0, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  store i8 %5, ptr %6, align 8, !tbaa !8
  %7 = getelementptr inbounds i8, ptr %0, i64 16
  %8 = getelementptr inbounds i8, ptr %0, i64 24
  %9 = getelementptr inbounds i8, ptr %0, i64 32
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %7, i8 0, i64 16, i1 false)
  store i8 1, ptr %9, align 8, !tbaa !13
  br i1 %3, label %10, label %16

10:                                               ; preds = %4
  %11 = tail call noalias noundef nonnull dereferenceable(24) ptr @_Znwm(i64 noundef 24) #6
  invoke void @_ZN4sptk25WaveformToAutocorrelationC1Eii(ptr noundef nonnull align 8 dereferenceable(17) %11, i32 noundef %1, i32 noundef %2)
          to label %12 unwind label %14

12:                                               ; preds = %10
  store ptr %11, ptr %7, align 8, !tbaa !14
  %13 = tail call noundef zeroext i1 @_ZNK4sptk25WaveformToAutocorrelation7IsValidEv(ptr noundef nonnull align 8 dereferenceable(17) %11)
  br label %22

14:                                               ; preds = %10
  %15 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %11, i64 noundef 24) #7
  br label %23

16:                                               ; preds = %4
  %17 = tail call noalias noundef nonnull dereferenceable(136) ptr @_Znwm(i64 noundef 136) #6
  invoke void @_ZN4sptk25SpectrumToAutocorrelationC1Eii(ptr noundef nonnull align 8 dereferenceable(129) %17, i32 noundef %1, i32 noundef %2)
          to label %18 unwind label %20

18:                                               ; preds = %16
  store ptr %17, ptr %8, align 8, !tbaa !15
  %19 = tail call noundef zeroext i1 @_ZNK4sptk25SpectrumToAutocorrelation7IsValidEv(ptr noundef nonnull align 8 dereferenceable(129) %17)
  br label %22

20:                                               ; preds = %16
  %21 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %17, i64 noundef 136) #7
  br label %23

22:                                               ; preds = %18, %12
  %storemerge.in = phi i1 [ %19, %18 ], [ %13, %12 ]
  %storemerge = zext i1 %storemerge.in to i8
  store i8 %storemerge, ptr %9, align 8, !tbaa !13
  ret void

23:                                               ; preds = %20, %14
  %.pn = phi { ptr, i32 } [ %15, %14 ], [ %21, %20 ]
  resume { ptr, i32 } %.pn
}

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

declare void @_ZN4sptk25WaveformToAutocorrelationC1Eii(ptr noundef nonnull align 8 dereferenceable(17), i32 noundef, i32 noundef) unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

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

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

declare void @_ZN4sptk25SpectrumToAutocorrelationC1Eii(ptr noundef nonnull align 8 dereferenceable(129), i32 noundef, i32 noundef) unnamed_addr #2

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

; 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 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 = { 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 = { builtin allocsize(0) }
attributes #7 = { 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 = !{!"_ZTSN4sptk23AutocorrelationAnalysisE", !10, i64 8, !12, i64 16, !12, i64 24, !10, i64 32}
!10 = !{!"bool", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"any pointer", !11, i64 0}
!13 = !{!9, !10, i64 32}
!14 = !{!9, !12, i64 16}
!15 = !{!9, !12, i64 24}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass