; LLVM IR from dtecta/motion-toolkit :: curve/CircleCurve.ll (ZNK2cv11CircleCurve4evalEf)

; 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.mt::Vector3" = type { %"class.mt::Dual", %"class.mt::Dual", %"class.mt::Dual" }
%"class.mt::Dual" = type { float, float }
%"class.cv::CircleCurve" = type { %"class.cv::Curve", %"class.mt::Vector3.0", float }
%"class.cv::Curve" = type { ptr }
%"class.mt::Vector3.0" = type { float, float, float }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK2cv11CircleCurve4evalEf(ptr dead_on_unwind noalias writable sret(%"class.mt::Vector3") align 4 %0, ptr noundef nonnull align 8 dereferenceable(24) %1, float noundef %2) unnamed_addr #0 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca float, align 4
  %6 = alloca %"class.mt::Dual", align 4
  %7 = alloca %"class.mt::Vector3", align 4
  %8 = alloca %"class.mt::Dual", align 4
  %9 = alloca %"class.mt::Dual", align 4
  %10 = alloca %"class.mt::Dual", align 4
  %11 = alloca %"class.mt::Dual", align 4
  %12 = alloca %"class.mt::Dual", align 4
  store ptr %1, ptr %4, align 8, !tbaa !5
  store float %2, ptr %5, align 4, !tbaa !9
  %13 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %14 = load float, ptr %5, align 4, !tbaa !9
  %15 = call noundef float @_ZN2mt12ScalarTraitsIfE2piEv()
  %16 = fmul float %14, %15
  %17 = fmul float %16, 2.000000e+00
  call void @_ZN2mt4DualIfEC2Eff(ptr noundef nonnull align 4 dereferenceable(8) %6, float noundef %17, float noundef 1.000000e+00)
  %18 = getelementptr inbounds %"class.cv::CircleCurve", ptr %13, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #6
  %19 = getelementptr inbounds %"class.cv::CircleCurve", ptr %13, i32 0, i32 2
  %20 = load float, ptr %19, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %21 = call <2 x float> @_ZN2mt3cosIfEENS_4DualIT_EERKS3_(ptr noundef nonnull align 4 dereferenceable(8) %6)
  store <2 x float> %21, ptr %9, align 4
  %22 = call <2 x float> @_ZN2mtmlIfEENS_4DualIT_EES2_RKS3_(float noundef %20, ptr noundef nonnull align 4 dereferenceable(8) %9)
  store <2 x float> %22, ptr %8, align 4
  %23 = getelementptr inbounds %"class.cv::CircleCurve", ptr %13, i32 0, i32 2
  %24 = load float, ptr %23, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %25 = call <2 x float> @_ZN2mt3sinIfEENS_4DualIT_EERKS3_(ptr noundef nonnull align 4 dereferenceable(8) %6)
  store <2 x float> %25, ptr %11, align 4
  %26 = call <2 x float> @_ZN2mtmlIfEENS_4DualIT_EES2_RKS3_(float noundef %24, ptr noundef nonnull align 4 dereferenceable(8) %11)
  store <2 x float> %26, ptr %10, align 4
  call void @_ZN2mt4DualIfEC2Eff(ptr noundef nonnull align 4 dereferenceable(8) %12, float noundef 0.000000e+00, float noundef 0.000000e+00)
  %27 = load <2 x float>, ptr %8, align 4
  %28 = load <2 x float>, ptr %10, align 4
  %29 = load <2 x float>, ptr %12, align 4
  call void @_ZN2mt7Vector3INS_4DualIfEEEC2ES2_S2_S2_(ptr noundef nonnull align 4 dereferenceable(24) %7, <2 x float> %27, <2 x float> %28, <2 x float> %29)
  call void @_ZN2mtplIfNS_4DualIfEEEENS_7Vector3INS_7PromoteIT_T0_E2RTEEERKNS3_IS5_EERKNS3_IS6_EE(ptr dead_on_unwind writable sret(%"class.mt::Vector3") align 4 %0, ptr noundef nonnull align 4 dereferenceable(12) %18, ptr noundef nonnull align 4 dereferenceable(24) %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  ret void
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZN2mt12ScalarTraitsIfE2piEv() #2 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZN2mt4DualIfEC2Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #3 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local void @_ZN2mtplIfNS_4DualIfEEEENS_7Vector3INS_7PromoteIT_T0_E2RTEEERKNS3_IS5_EERKNS3_IS6_EE(ptr dead_on_unwind noalias writable sret(%"class.mt::Vector3") align 4, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(24)) #4

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local <2 x float> @_ZN2mtmlIfEENS_4DualIT_EES2_RKS3_(float noundef, ptr noundef nonnull align 4 dereferenceable(8)) #4

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local <2 x float> @_ZN2mt3cosIfEENS_4DualIT_EERKS3_(ptr noundef nonnull align 4 dereferenceable(8)) #4

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local <2 x float> @_ZN2mt3sinIfEENS_4DualIT_EERKS3_(ptr noundef nonnull align 4 dereferenceable(8)) #4

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZN2mt7Vector3INS_4DualIfEEEC2ES2_S2_S2_(ptr noundef nonnull align 4 dereferenceable(24), <2 x float>, <2 x float>, <2 x float>) unnamed_addr #5 align 2

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="64" "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 = { 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 = { alwaysinline 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 #4 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="64" "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 = { alwaysinline mustprogress nounwind uwtable "min-legal-vector-width"="64" "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 #6 = { 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 = !{!"float", !7, i64 0}
!11 = !{!12, !10, i64 20}
!12 = !{!"_ZTSN2cv11CircleCurveE", !13, i64 0, !14, i64 8, !10, i64 20}
!13 = !{!"_ZTSN2cv5CurveE"}
!14 = !{!"_ZTSN2mt7Vector3IfEE", !10, i64 0, !10, i64 4, !10, i64 8}


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

%"class.mt::Vector3" = type { %"class.mt::Dual", %"class.mt::Dual", %"class.mt::Dual" }
%"class.mt::Dual" = type { float, float }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK2cv11CircleCurve4evalEf(ptr dead_on_unwind noalias writable sret(%"class.mt::Vector3") align 4 %0, ptr noundef nonnull align 8 dereferenceable(24) %1, float noundef %2) unnamed_addr #0 align 2 {
  %4 = alloca %"class.mt::Dual", align 4
  %5 = alloca %"class.mt::Vector3", align 4
  %6 = alloca %"class.mt::Dual", align 8
  %7 = alloca %"class.mt::Dual", align 8
  %8 = alloca %"class.mt::Dual", align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %9 = tail call noundef float @_ZN2mt12ScalarTraitsIfE2piEv()
  %10 = fmul float %9, %2
  %11 = fmul float %10, 2.000000e+00
  call void @_ZN2mt4DualIfEC2Eff(ptr noundef nonnull align 4 dereferenceable(8) %4, float noundef %11, float noundef 1.000000e+00)
  %12 = getelementptr inbounds i8, ptr %1, i64 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #6
  %13 = getelementptr inbounds i8, ptr %1, i64 20
  %14 = load float, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %15 = call <2 x float> @_ZN2mt3cosIfEENS_4DualIT_EERKS3_(ptr noundef nonnull align 4 dereferenceable(8) %4)
  store <2 x float> %15, ptr %6, align 8
  %16 = call <2 x float> @_ZN2mtmlIfEENS_4DualIT_EES2_RKS3_(float noundef %14, ptr noundef nonnull align 4 dereferenceable(8) %6)
  %17 = load float, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %18 = call <2 x float> @_ZN2mt3sinIfEENS_4DualIT_EERKS3_(ptr noundef nonnull align 4 dereferenceable(8) %4)
  store <2 x float> %18, ptr %7, align 8
  %19 = call <2 x float> @_ZN2mtmlIfEENS_4DualIT_EES2_RKS3_(float noundef %17, ptr noundef nonnull align 4 dereferenceable(8) %7)
  call void @_ZN2mt4DualIfEC2Eff(ptr noundef nonnull align 4 dereferenceable(8) %8, float noundef 0.000000e+00, float noundef 0.000000e+00)
  %20 = load <2 x float>, ptr %8, align 8
  call void @_ZN2mt7Vector3INS_4DualIfEEEC2ES2_S2_S2_(ptr noundef nonnull align 4 dereferenceable(24) %5, <2 x float> %16, <2 x float> %19, <2 x float> %20)
  call void @_ZN2mtplIfNS_4DualIfEEEENS_7Vector3INS_7PromoteIT_T0_E2RTEEERKNS3_IS5_EERKNS3_IS6_EE(ptr dead_on_unwind writable sret(%"class.mt::Vector3") align 4 %0, ptr noundef nonnull align 4 dereferenceable(12) %12, ptr noundef nonnull align 4 dereferenceable(24) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  ret void
}

; 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 nounwind uwtable
declare dso_local noundef float @_ZN2mt12ScalarTraitsIfE2piEv() local_unnamed_addr #2 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZN2mt4DualIfEC2Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #3 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local void @_ZN2mtplIfNS_4DualIfEEEENS_7Vector3INS_7PromoteIT_T0_E2RTEEERKNS3_IS5_EERKNS3_IS6_EE(ptr dead_on_unwind noalias writable sret(%"class.mt::Vector3") align 4, ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(24)) local_unnamed_addr #4

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local <2 x float> @_ZN2mtmlIfEENS_4DualIT_EES2_RKS3_(float noundef, ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #4

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local <2 x float> @_ZN2mt3cosIfEENS_4DualIT_EERKS3_(ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #4

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local <2 x float> @_ZN2mt3sinIfEENS_4DualIT_EERKS3_(ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #4

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZN2mt7Vector3INS_4DualIfEEEC2ES2_S2_S2_(ptr noundef nonnull align 4 dereferenceable(24), <2 x float>, <2 x float>, <2 x float>) unnamed_addr #5 align 2

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="64" "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 = { 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 = { alwaysinline 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 #4 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="64" "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 = { alwaysinline mustprogress nounwind uwtable "min-legal-vector-width"="64" "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 #6 = { 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, !9, i64 20}
!6 = !{!"_ZTSN2cv11CircleCurveE", !7, i64 0, !8, i64 8, !9, i64 20}
!7 = !{!"_ZTSN2cv5CurveE"}
!8 = !{!"_ZTSN2mt7Vector3IfEE", !9, i64 0, !9, i64 4, !9, i64 8}
!9 = !{!"float", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}


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