; LLVM IR from suxiaojack/sapDecoder :: src/hrtf.ll (ZN4HRTFC2Eii)

; 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.HRTF = type { ptr, i32, i32, ptr, i32, i8, float, float, i32, %"class.std::vector", %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<std::vector<float>, std::vector<float>>, std::allocator<std::pair<std::vector<float>, std::vector<float>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<std::vector<float>, std::vector<float>>, std::allocator<std::pair<std::vector<float>, std::vector<float>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<std::vector<float>, std::vector<float>>, std::allocator<std::pair<std::vector<float>, std::vector<float>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<std::vector<float>, std::vector<float>>, std::allocator<std::pair<std::vector<float>, std::vector<float>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4HRTFC2Eii(ptr noundef nonnull align 8 dereferenceable(96) %0, i32 noundef %1, i32 noundef %2) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !9
  %9 = load ptr, ptr %4, align 8
  store ptr getelementptr inbounds inrange(-16, 16) ({ [4 x ptr] }, ptr @_ZTV4HRTF, i32 0, i32 0, i32 2), ptr %9, align 8, !tbaa !11
  %10 = getelementptr inbounds %class.HRTF, ptr %9, i32 0, i32 9
  call void @_ZNSt6vectorISt4pairIS_IfSaIfEES2_ESaIS3_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #4
  %11 = getelementptr inbounds %class.HRTF, ptr %9, i32 0, i32 10
  call void @_ZNSt6vectorISt4pairIS_IfSaIfEES2_ESaIS3_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #4
  %12 = load i32, ptr %5, align 4, !tbaa !9
  %13 = getelementptr inbounds %class.HRTF, ptr %9, i32 0, i32 1
  store i32 %12, ptr %13, align 8, !tbaa !13
  %14 = load i32, ptr %6, align 4, !tbaa !9
  %15 = getelementptr inbounds %class.HRTF, ptr %9, i32 0, i32 2
  store i32 %14, ptr %15, align 4, !tbaa !21
  %16 = getelementptr inbounds %class.HRTF, ptr %9, i32 0, i32 4
  store i32 -1, ptr %16, align 8, !tbaa !22
  %17 = getelementptr inbounds %class.HRTF, ptr %9, i32 0, i32 6
  store float -1.000000e+00, ptr %17, align 8, !tbaa !23
  %18 = getelementptr inbounds %class.HRTF, ptr %9, i32 0, i32 7
  store float -1.000000e+00, ptr %18, align 4, !tbaa !24
  %19 = getelementptr inbounds %class.HRTF, ptr %9, i32 0, i32 5
  store i8 0, ptr %19, align 4, !tbaa !25
  %20 = getelementptr inbounds %class.HRTF, ptr %9, i32 0, i32 8
  store i32 -1, ptr %20, align 8, !tbaa !26
  %21 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 104) #5
          to label %22 unwind label %30

22:                                               ; preds = %3
  invoke void @_ZN19FLANNNeighborSearchC2Ev(ptr noundef nonnull align 8 dereferenceable(104) %21)
          to label %23 unwind label %34

23:                                               ; preds = %22
  %24 = getelementptr inbounds %class.HRTF, ptr %9, i32 0, i32 3
  store ptr %21, ptr %24, align 8, !tbaa !27
  invoke void @_ZN4HRTF18InitNeighborSearchEv(ptr noundef nonnull align 8 dereferenceable(96) %9)
          to label %25 unwind label %30

25:                                               ; preds = %23
  invoke void @_ZN4HRTF20SampleTransformHRTFsEv(ptr noundef nonnull align 8 dereferenceable(96) %9)
          to label %26 unwind label %30

26:                                               ; preds = %25
  invoke void @_ZN4HRTF18FreqTransformHRTFsEv(ptr noundef nonnull align 8 dereferenceable(96) %9)
          to label %27 unwind label %30

27:                                               ; preds = %26
  %28 = invoke noundef zeroext i1 @_ZN4HRTF12SetDirectionEff(ptr noundef nonnull align 8 dereferenceable(96) %9, float noundef 0.000000e+00, float noundef 0.000000e+00)
          to label %29 unwind label %30

29:                                               ; preds = %27
  ret void

30:                                               ; preds = %27, %26, %25, %23, %3
  %31 = landingpad { ptr, i32 }
          cleanup
  %32 = extractvalue { ptr, i32 } %31, 0
  store ptr %32, ptr %7, align 8
  %33 = extractvalue { ptr, i32 } %31, 1
  store i32 %33, ptr %8, align 4
  br label %38

34:                                               ; preds = %22
  %35 = landingpad { ptr, i32 }
          cleanup
  %36 = extractvalue { ptr, i32 } %35, 0
  store ptr %36, ptr %7, align 8
  %37 = extractvalue { ptr, i32 } %35, 1
  store i32 %37, ptr %8, align 4
  call void @_ZdlPvm(ptr noundef %21, i64 noundef 104) #6
  br label %38

38:                                               ; preds = %34, %30
  call void @_ZNSt6vectorISt4pairIS_IfSaIfEES2_ESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #4
  call void @_ZNSt6vectorISt4pairIS_IfSaIfEES2_ESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #4
  br label %39

39:                                               ; preds = %38
  %40 = load ptr, ptr %7, align 8
  %41 = load i32, ptr %8, align 4
  %42 = insertvalue { ptr, i32 } poison, ptr %40, 0
  %43 = insertvalue { ptr, i32 } %42, i32 %41, 1
  resume { ptr, i32 } %43
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN19FLANNNeighborSearchC2Ev(ptr noundef nonnull align 8 dereferenceable(104)) unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4HRTF18InitNeighborSearchEv(ptr noundef nonnull align 8 dereferenceable(96)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4HRTF20SampleTransformHRTFsEv(ptr noundef nonnull align 8 dereferenceable(96)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4HRTF18FreqTransformHRTFsEv(ptr noundef nonnull align 8 dereferenceable(96)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN4HRTF12SetDirectionEff(ptr noundef nonnull align 8 dereferenceable(96), float noundef, float noundef) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorISt4pairIS_IfSaIfEES2_ESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 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 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 = { 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 #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 = { nounwind }
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 = !{!"vtable pointer", !8, i64 0}
!13 = !{!14, !10, i64 8}
!14 = !{!"_ZTS4HRTF", !10, i64 8, !10, i64 12, !6, i64 16, !10, i64 24, !15, i64 28, !16, i64 32, !16, i64 36, !10, i64 40, !17, i64 48, !17, i64 72}
!15 = !{!"bool", !7, i64 0}
!16 = !{!"float", !7, i64 0}
!17 = !{!"_ZTSSt6vectorISt4pairIS_IfSaIfEES2_ESaIS3_EE", !18, i64 0}
!18 = !{!"_ZTSSt12_Vector_baseISt4pairISt6vectorIfSaIfEES3_ESaIS4_EE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseISt4pairISt6vectorIfSaIfEES3_ESaIS4_EE12_Vector_implE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseISt4pairISt6vectorIfSaIfEES3_ESaIS4_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!21 = !{!14, !10, i64 12}
!22 = !{!14, !10, i64 24}
!23 = !{!14, !16, i64 32}
!24 = !{!14, !16, i64 36}
!25 = !{!14, !15, i64 28}
!26 = !{!14, !10, i64 40}
!27 = !{!14, !6, i64 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"

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4HRTFC2Eii(ptr noundef nonnull align 8 dereferenceable(96) %0, i32 noundef %1, i32 noundef %2) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  store ptr getelementptr inbounds inrange(-16, 16) (i8, ptr @_ZTV4HRTF, i64 16), ptr %0, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 48
  tail call void @_ZNSt6vectorISt4pairIS_IfSaIfEES2_ESaIS3_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #4
  %5 = getelementptr inbounds i8, ptr %0, i64 72
  tail call void @_ZNSt6vectorISt4pairIS_IfSaIfEES2_ESaIS3_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #4
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %1, ptr %6, align 8, !tbaa !8
  %7 = getelementptr inbounds i8, ptr %0, i64 12
  store i32 %2, ptr %7, align 4, !tbaa !19
  %8 = getelementptr inbounds i8, ptr %0, i64 24
  store i32 -1, ptr %8, align 8, !tbaa !20
  %9 = getelementptr inbounds i8, ptr %0, i64 32
  store <2 x float> <float -1.000000e+00, float -1.000000e+00>, ptr %9, align 8, !tbaa !21
  %10 = getelementptr inbounds i8, ptr %0, i64 28
  store i8 0, ptr %10, align 4, !tbaa !22
  %11 = getelementptr inbounds i8, ptr %0, i64 40
  store i32 -1, ptr %11, align 8, !tbaa !23
  %12 = invoke noalias noundef nonnull dereferenceable(104) ptr @_Znwm(i64 noundef 104) #5
          to label %13 unwind label %21

13:                                               ; preds = %3
  invoke void @_ZN19FLANNNeighborSearchC2Ev(ptr noundef nonnull align 8 dereferenceable(104) %12)
          to label %14 unwind label %23

14:                                               ; preds = %13
  %15 = getelementptr inbounds i8, ptr %0, i64 16
  store ptr %12, ptr %15, align 8, !tbaa !24
  invoke void @_ZN4HRTF18InitNeighborSearchEv(ptr noundef nonnull align 8 dereferenceable(96) %0)
          to label %16 unwind label %21

16:                                               ; preds = %14
  invoke void @_ZN4HRTF20SampleTransformHRTFsEv(ptr noundef nonnull align 8 dereferenceable(96) %0)
          to label %17 unwind label %21

17:                                               ; preds = %16
  invoke void @_ZN4HRTF18FreqTransformHRTFsEv(ptr noundef nonnull align 8 dereferenceable(96) %0)
          to label %18 unwind label %21

18:                                               ; preds = %17
  %19 = invoke noundef zeroext i1 @_ZN4HRTF12SetDirectionEff(ptr noundef nonnull align 8 dereferenceable(96) %0, float noundef 0.000000e+00, float noundef 0.000000e+00)
          to label %20 unwind label %21

20:                                               ; preds = %18
  ret void

21:                                               ; preds = %18, %17, %16, %14, %3
  %22 = landingpad { ptr, i32 }
          cleanup
  br label %25

23:                                               ; preds = %13
  %24 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %12, i64 noundef 104) #6
  br label %25

25:                                               ; preds = %23, %21
  %.pn = phi { ptr, i32 } [ %22, %21 ], [ %24, %23 ]
  tail call void @_ZNSt6vectorISt4pairIS_IfSaIfEES2_ESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #4
  tail call void @_ZNSt6vectorISt4pairIS_IfSaIfEES2_ESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #4
  resume { ptr, i32 } %.pn
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN19FLANNNeighborSearchC2Ev(ptr noundef nonnull align 8 dereferenceable(104)) unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4HRTF18InitNeighborSearchEv(ptr noundef nonnull align 8 dereferenceable(96)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4HRTF20SampleTransformHRTFsEv(ptr noundef nonnull align 8 dereferenceable(96)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4HRTF18FreqTransformHRTFsEv(ptr noundef nonnull align 8 dereferenceable(96)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN4HRTF12SetDirectionEff(ptr noundef nonnull align 8 dereferenceable(96), float noundef, float noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorISt4pairIS_IfSaIfEES2_ESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 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 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 = { 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 #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 = { nounwind }
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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !10, i64 8}
!9 = !{!"_ZTS4HRTF", !10, i64 8, !10, i64 12, !12, i64 16, !10, i64 24, !13, i64 28, !14, i64 32, !14, i64 36, !10, i64 40, !15, i64 48, !15, i64 72}
!10 = !{!"int", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"any pointer", !11, i64 0}
!13 = !{!"bool", !11, i64 0}
!14 = !{!"float", !11, i64 0}
!15 = !{!"_ZTSSt6vectorISt4pairIS_IfSaIfEES2_ESaIS3_EE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseISt4pairISt6vectorIfSaIfEES3_ESaIS4_EE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseISt4pairISt6vectorIfSaIfEES3_ESaIS4_EE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseISt4pairISt6vectorIfSaIfEES3_ESaIS4_EE17_Vector_impl_dataE", !12, i64 0, !12, i64 8, !12, i64 16}
!19 = !{!9, !10, i64 12}
!20 = !{!9, !10, i64 24}
!21 = !{!14, !14, i64 0}
!22 = !{!9, !13, i64 28}
!23 = !{!9, !10, i64 40}
!24 = !{!9, !12, i64 16}


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