; LLVM IR from sp-nitech/SPTK :: src/input (input_source_preprocessing_for_filter_gain)

; 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.__gnu_cxx::__normal_iterator" = type { ptr }
%class.anon = type { double }
%"class.sptk::InputSourcePreprocessingForFilterGain" = type <{ %"class.sptk::InputSourceInterface", i32, [4 x i8], ptr, i8, [7 x i8] }>
%"class.sptk::InputSourceInterface" = type { ptr }

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4sptk37InputSourcePreprocessingForFilterGain3GetEPSt6vectorIdSaIdEE(ptr noundef nonnull align 8 dereferenceable(25) %0, ptr noundef %1) unnamed_addr #0 align 2 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca double, align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = alloca %class.anon, align 8
  %11 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %12 = load ptr, ptr %4, align 8
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = icmp eq ptr null, %13
  br i1 %14, label %19, label %15

15:                                               ; preds = %2
  %16 = getelementptr inbounds %"class.sptk::InputSourcePreprocessingForFilterGain", ptr %12, i32 0, i32 4
  %17 = load i8, ptr %16, align 8, !tbaa !9, !range !14, !noundef !15
  %18 = trunc i8 %17 to i1
  br i1 %18, label %20, label %19

19:                                               ; preds = %15, %2
  store i1 false, ptr %3, align 1
  br label %90

20:                                               ; preds = %15
  %21 = getelementptr inbounds %"class.sptk::InputSourcePreprocessingForFilterGain", ptr %12, i32 0, i32 3
  %22 = load ptr, ptr %21, align 8, !tbaa !16
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = load ptr, ptr %22, align 8, !tbaa !17
  %25 = getelementptr inbounds ptr, ptr %24, i64 4
  %26 = load ptr, ptr %25, align 8
  %27 = call noundef zeroext i1 %26(ptr noundef nonnull align 8 dereferenceable(8) %22, ptr noundef %23)
  br i1 %27, label %29, label %28

28:                                               ; preds = %20
  store i1 false, ptr %3, align 1
  br label %90

29:                                               ; preds = %20
  %30 = getelementptr inbounds %"class.sptk::InputSourcePreprocessingForFilterGain", ptr %12, i32 0, i32 1
  %31 = load i32, ptr %30, align 8, !tbaa !19
  switch i32 %31, label %88 [
    i32 0, label %32
    i32 1, label %33
    i32 2, label %40
    i32 3, label %53
    i32 4, label %56
  ]

32:                                               ; preds = %29
  br label %89

33:                                               ; preds = %29
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %34, i64 noundef 0) #4
  %36 = load double, ptr %35, align 8, !tbaa !20
  %37 = call double @exp(double noundef %36) #4
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %38, i64 noundef 0) #4
  store double %37, ptr %39, align 8, !tbaa !20
  br label %89

40:                                               ; preds = %29
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %41, i64 noundef 0) #4
  %43 = load double, ptr %42, align 8, !tbaa !20
  %44 = fcmp oeq double 0.000000e+00, %43
  br i1 %44, label %45, label %46

45:                                               ; preds = %40
  store i1 false, ptr %3, align 1
  br label %90

46:                                               ; preds = %40
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %47, i64 noundef 0) #4
  %49 = load double, ptr %48, align 8, !tbaa !20
  %50 = fdiv double 1.000000e+00, %49
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %51, i64 noundef 0) #4
  store double %50, ptr %52, align 8, !tbaa !20
  br label %89

53:                                               ; preds = %29
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %54, i64 noundef 0) #4
  store double 1.000000e+00, ptr %55, align 8, !tbaa !20
  br label %89

56:                                               ; preds = %29
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %57, i64 noundef 0) #4
  %59 = load double, ptr %58, align 8, !tbaa !20
  %60 = fcmp oeq double 0.000000e+00, %59
  br i1 %60, label %61, label %62

61:                                               ; preds = %56
  store i1 false, ptr %3, align 1
  br label %90

62:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %63, i64 noundef 0) #4
  %65 = load double, ptr %64, align 8, !tbaa !20
  %66 = fdiv double 1.000000e+00, %65
  store double %66, ptr %6, align 8, !tbaa !20
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = call ptr @_ZNSt6vectorIdSaIdEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %67) #4
  %69 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %7, i32 0, i32 0
  store ptr %68, ptr %69, align 8
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  %71 = call ptr @_ZNSt6vectorIdSaIdEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %70) #4
  %72 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %8, i32 0, i32 0
  store ptr %71, ptr %72, align 8
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = call ptr @_ZNSt6vectorIdSaIdEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %73) #4
  %75 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  store ptr %74, ptr %75, align 8
  %76 = getelementptr inbounds %class.anon, ptr %10, i32 0, i32 0
  %77 = load double, ptr %6, align 8, !tbaa !20
  store double %77, ptr %76, align 8, !tbaa !22
  %78 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %7, i32 0, i32 0
  %79 = load ptr, ptr %78, align 8
  %80 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %8, i32 0, i32 0
  %81 = load ptr, ptr %80, align 8
  %82 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  %83 = load ptr, ptr %82, align 8
  %84 = getelementptr inbounds %class.anon, ptr %10, i32 0, i32 0
  %85 = load double, ptr %84, align 8
  %86 = call ptr @"_ZSt9transformIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEES6_ZN4sptk37InputSourcePreprocessingForFilterGain3GetEPS5_E3$_0ET0_T_SC_SB_T1_"(ptr %79, ptr %81, ptr %83, double %85)
  %87 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %11, i32 0, i32 0
  store ptr %86, ptr %87, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  br label %89

88:                                               ; preds = %29
  store i1 false, ptr %3, align 1
  br label %90

89:                                               ; preds = %62, %53, %46, %33, %32
  store i1 true, ptr %3, align 1
  br label %90

90:                                               ; preds = %89, %88, %61, %45, %28, %19
  %91 = load i1, ptr %3, align 1
  ret i1 %91
}

; Function Attrs: nounwind
declare double @exp(double noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(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.start.p0(i64 immarg, ptr nocapture) #3

; Function Attrs: mustprogress uwtable
declare hidden ptr @"_ZSt9transformIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEES6_ZN4sptk37InputSourcePreprocessingForFilterGain3GetEPS5_E3$_0ET0_T_SC_SB_T1_"(ptr, ptr, ptr, double) #0

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { 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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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, !13, i64 24}
!10 = !{!"_ZTSN4sptk37InputSourcePreprocessingForFilterGainE", !11, i64 0, !12, i64 8, !6, i64 16, !13, i64 24}
!11 = !{!"_ZTSN4sptk20InputSourceInterfaceE"}
!12 = !{!"_ZTSN4sptk37InputSourcePreprocessingForFilterGain14FilterGainTypeE", !7, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = !{!10, !6, i64 16}
!17 = !{!18, !18, i64 0}
!18 = !{!"vtable pointer", !8, i64 0}
!19 = !{!10, !12, i64 8}
!20 = !{!21, !21, i64 0}
!21 = !{!"double", !7, i64 0}
!22 = !{!23, !21, i64 0}
!23 = !{!"_ZTSZN4sptk37InputSourcePreprocessingForFilterGain3GetEPSt6vectorIdSaIdEEE3$_0", !21, i64 0}


; 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 noundef zeroext i1 @_ZN4sptk37InputSourcePreprocessingForFilterGain3GetEPSt6vectorIdSaIdEE(ptr nocapture noundef nonnull readonly align 8 dereferenceable(25) %0, ptr noundef %1) unnamed_addr #0 align 2 {
  %3 = icmp eq ptr %1, null
  br i1 %3, label %47, label %4

4:                                                ; preds = %2
  %5 = getelementptr inbounds i8, ptr %0, i64 24
  %6 = load i8, ptr %5, align 8, !tbaa !5, !range !13, !noundef !14
  %7 = trunc nuw i8 %6 to i1
  br i1 %7, label %8, label %47

8:                                                ; preds = %4
  %9 = getelementptr inbounds i8, ptr %0, i64 16
  %10 = load ptr, ptr %9, align 8, !tbaa !15
  %11 = load ptr, ptr %10, align 8, !tbaa !16
  %12 = getelementptr inbounds i8, ptr %11, i64 32
  %13 = load ptr, ptr %12, align 8
  %14 = tail call noundef zeroext i1 %13(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull %1)
  br i1 %14, label %15, label %47

15:                                               ; preds = %8
  %16 = getelementptr inbounds i8, ptr %0, i64 8
  %17 = load i32, ptr %16, align 8, !tbaa !18
  switch i32 %17, label %47 [
    i32 0, label %46
    i32 1, label %18
    i32 2, label %23
    i32 3, label %32
    i32 4, label %34
  ]

18:                                               ; preds = %15
  %19 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef 0) #3
  %20 = load double, ptr %19, align 8, !tbaa !19
  %21 = tail call double @exp(double noundef %20) #3
  %22 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef 0) #3
  store double %21, ptr %22, align 8, !tbaa !19
  br label %46

23:                                               ; preds = %15
  %24 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef 0) #3
  %25 = load double, ptr %24, align 8, !tbaa !19
  %26 = fcmp oeq double %25, 0.000000e+00
  br i1 %26, label %47, label %27

27:                                               ; preds = %23
  %28 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef 0) #3
  %29 = load double, ptr %28, align 8, !tbaa !19
  %30 = fdiv double 1.000000e+00, %29
  %31 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef 0) #3
  store double %30, ptr %31, align 8, !tbaa !19
  br label %46

32:                                               ; preds = %15
  %33 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef 0) #3
  store double 1.000000e+00, ptr %33, align 8, !tbaa !19
  br label %46

34:                                               ; preds = %15
  %35 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef 0) #3
  %36 = load double, ptr %35, align 8, !tbaa !19
  %37 = fcmp oeq double %36, 0.000000e+00
  br i1 %37, label %47, label %38

38:                                               ; preds = %34
  %39 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef 0) #3
  %40 = load double, ptr %39, align 8, !tbaa !19
  %41 = fdiv double 1.000000e+00, %40
  %42 = tail call ptr @_ZNSt6vectorIdSaIdEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #3
  %43 = tail call ptr @_ZNSt6vectorIdSaIdEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #3
  %44 = tail call ptr @_ZNSt6vectorIdSaIdEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #3
  %45 = tail call ptr @"_ZSt9transformIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEES6_ZN4sptk37InputSourcePreprocessingForFilterGain3GetEPS5_E3$_0ET0_T_SC_SB_T1_"(ptr %42, ptr %43, ptr %44, double %41)
  br label %46

46:                                               ; preds = %15, %38, %32, %27, %18
  br label %47

47:                                               ; preds = %15, %34, %23, %8, %2, %4, %46
  %.0 = phi i1 [ true, %46 ], [ false, %4 ], [ false, %2 ], [ false, %8 ], [ false, %23 ], [ false, %34 ], [ false, %15 ]
  ret i1 %.0
}

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

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

; Function Attrs: mustprogress uwtable
declare hidden ptr @"_ZSt9transformIN9__gnu_cxx17__normal_iteratorIPdSt6vectorIdSaIdEEEES6_ZN4sptk37InputSourcePreprocessingForFilterGain3GetEPS5_E3$_0ET0_T_SC_SB_T1_"(ptr, ptr, ptr, double) local_unnamed_addr #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIdSaIdEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) local_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 = { 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 #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, !12, i64 24}
!6 = !{!"_ZTSN4sptk37InputSourcePreprocessingForFilterGainE", !7, i64 0, !8, i64 8, !11, i64 16, !12, i64 24}
!7 = !{!"_ZTSN4sptk20InputSourceInterfaceE"}
!8 = !{!"_ZTSN4sptk37InputSourcePreprocessingForFilterGain14FilterGainTypeE", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!"bool", !9, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!6, !11, i64 16}
!16 = !{!17, !17, i64 0}
!17 = !{!"vtable pointer", !10, i64 0}
!18 = !{!6, !8, i64 8}
!19 = !{!20, !20, i64 0}
!20 = !{!"double", !9, i64 0}


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