; LLVM IR from tryingfly/nabo :: nabo_core/utility/algorithms.ll (ZN3Alg14filterTwoClass7setCutFEdd)

; 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.Alg::filterTwoClass" = type { double, double, double, double, double, double, double, double, double }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN3Alg4clipIdiiEEbRT_RKT0_RKT1_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN3Alg4clipIdidEEbRT_RKT0_RKT1_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 8 dereferenceable(8)) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN3Alg14filterTwoClass7setCutFEdd(ptr noundef nonnull align 8 dereferenceable(72) %0, double noundef %1, double noundef %2) #0 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca i32, align 4
  %8 = alloca double, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store double %1, ptr %5, align 8, !tbaa !9
  store double %2, ptr %6, align 8, !tbaa !9
  %11 = load ptr, ptr %4, align 8
  %12 = load double, ptr %5, align 8, !tbaa !9
  %13 = fmul double %12, 0x401921FB54442EEA
  %14 = getelementptr inbounds %"class.Alg::filterTwoClass", ptr %11, i32 0, i32 6
  store double %13, ptr %14, align 8, !tbaa !11
  %15 = getelementptr inbounds %"class.Alg::filterTwoClass", ptr %11, i32 0, i32 6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #2
  store i32 0, ptr %7, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  %16 = getelementptr inbounds %"class.Alg::filterTwoClass", ptr %11, i32 0, i32 0
  %17 = load double, ptr %16, align 8, !tbaa !15
  %18 = fdiv double 1.000000e+00, %17
  %19 = fdiv double %18, 2.000000e+00
  store double %19, ptr %8, align 8, !tbaa !9
  %20 = call noundef zeroext i1 @_ZN3Alg4clipIdidEEbRT_RKT0_RKT1_(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 8 dereferenceable(8) %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #2
  %21 = getelementptr inbounds %"class.Alg::filterTwoClass", ptr %11, i32 0, i32 6
  %22 = load double, ptr %21, align 8, !tbaa !11
  %23 = fmul double 1.414000e+00, %22
  %24 = getelementptr inbounds %"class.Alg::filterTwoClass", ptr %11, i32 0, i32 7
  store double %23, ptr %24, align 8, !tbaa !16
  %25 = getelementptr inbounds %"class.Alg::filterTwoClass", ptr %11, i32 0, i32 6
  %26 = load double, ptr %25, align 8, !tbaa !11
  %27 = getelementptr inbounds %"class.Alg::filterTwoClass", ptr %11, i32 0, i32 6
  %28 = load double, ptr %27, align 8, !tbaa !11
  %29 = fmul double %26, %28
  %30 = getelementptr inbounds %"class.Alg::filterTwoClass", ptr %11, i32 0, i32 8
  store double %29, ptr %30, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #2
  store i32 0, ptr %9, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #2
  store i32 1, ptr %10, align 4, !tbaa !13
  %31 = call noundef zeroext i1 @_ZN3Alg4clipIdiiEEbRT_RKT0_RKT1_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %10)
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #2
  %32 = load double, ptr %6, align 8, !tbaa !9
  %33 = getelementptr inbounds %"class.Alg::filterTwoClass", ptr %11, i32 0, i32 0
  %34 = load double, ptr %33, align 8, !tbaa !15
  %35 = fmul double %32, %34
  %36 = getelementptr inbounds %"class.Alg::filterTwoClass", ptr %11, i32 0, i32 5
  store double %35, ptr %36, align 8, !tbaa !18
  ret void
}

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = !{!"double", !7, i64 0}
!11 = !{!12, !10, i64 48}
!12 = !{!"_ZTSN3Alg14filterTwoClassE", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!12, !10, i64 0}
!16 = !{!12, !10, i64 56}
!17 = !{!12, !10, i64 64}
!18 = !{!12, !10, i64 40}


; 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 nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN3Alg4clipIdiiEEbRT_RKT0_RKT1_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN3Alg4clipIdidEEbRT_RKT0_RKT1_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN3Alg14filterTwoClass7setCutFEdd(ptr noundef nonnull align 8 dereferenceable(72) %0, double noundef %1, double noundef %2) local_unnamed_addr #0 align 2 {
  %4 = alloca double, align 8
  %5 = alloca i32, align 4
  %6 = alloca double, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store double %2, ptr %4, align 8, !tbaa !5
  %9 = fmul double %1, 0x401921FB54442EEA
  %10 = getelementptr inbounds i8, ptr %0, i64 48
  store double %9, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #2
  store i32 0, ptr %5, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #2
  %11 = load double, ptr %0, align 8, !tbaa !13
  %12 = fdiv double 1.000000e+00, %11
  %13 = fmul double %12, 5.000000e-01
  store double %13, ptr %6, align 8, !tbaa !5
  %14 = call noundef zeroext i1 @_ZN3Alg4clipIdidEEbRT_RKT0_RKT1_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 8 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #2
  %15 = load <2 x double>, ptr %10, align 8
  %16 = getelementptr inbounds i8, ptr %0, i64 56
  %17 = shufflevector <2 x double> %15, <2 x double> poison, <2 x i32> zeroinitializer
  %18 = shufflevector <2 x double> %15, <2 x double> <double 1.414000e+00, double poison>, <2 x i32> <i32 2, i32 0>
  %19 = fmul <2 x double> %17, %18
  store <2 x double> %19, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #2
  store i32 0, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #2
  store i32 1, ptr %8, align 4, !tbaa !11
  %20 = call noundef zeroext i1 @_ZN3Alg4clipIdiiEEbRT_RKT0_RKT1_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #2
  %21 = load double, ptr %4, align 8, !tbaa !5
  %22 = load double, ptr %0, align 8, !tbaa !13
  %23 = fmul double %21, %22
  %24 = getelementptr inbounds i8, ptr %0, i64 40
  store double %23, ptr %24, align 8, !tbaa !14
  ret void
}

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 48}
!10 = !{!"_ZTSN3Alg14filterTwoClassE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!10, !6, i64 0}
!14 = !{!10, !6, i64 40}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SLPVectorizerPass,SROAPass,VectorCombinePass