; LLVM IR from yangfengzzz/DigitalVox4 :: vox.render/controls/free_control.ll (ZN3vox7control11FreeControl11onMouseMoveEdd)

; 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.vox::control::FreeControl" = type <{ %"class.vox::Script", %"class.vox::Vector", %"class.vox::Vector", float, float, i8, [3 x i8], float, i8, [3 x i8], float, float, i8, i8, i8, i8, %"class.vox::Vector", %"class.vox::control::Spherical", %"struct.std::array", i8, [3 x i8], i32, i32, [4 x i8] }>
%"class.vox::Script" = type { %"class.vox::Component.base", i8, i64, i64, i64 }
%"class.vox::Component.base" = type <{ ptr, ptr, i8, i8, i8 }>
%"class.vox::Vector" = type { float, float, float }
%"class.vox::control::Spherical" = type { float, float, float }
%"struct.std::array" = type { [2 x double] }

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3vox7control11FreeControl11onMouseMoveEdd(ptr noundef nonnull align 8 dereferenceable(156) %0, double noundef %1, double noundef %2) #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  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
  %13 = load ptr, ptr %4, align 8
  %14 = getelementptr inbounds %"class.vox::control::FreeControl", ptr %13, i32 0, i32 8
  %15 = load i8, ptr %14, align 8, !tbaa !11, !range !22, !noundef !23
  %16 = trunc i8 %15 to i1
  %17 = zext i1 %16 to i32
  %18 = icmp eq i32 %17, 0
  br i1 %18, label %19, label %20

19:                                               ; preds = %3
  br label %61

20:                                               ; preds = %3
  %21 = call noundef zeroext i1 @_ZN3vox9Component7enabledEv(ptr noundef nonnull align 8 dereferenceable(19) %13)
  %22 = zext i1 %21 to i32
  %23 = icmp eq i32 %22, 0
  br i1 %23, label %24, label %25

24:                                               ; preds = %20
  br label %61

25:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %26 = load double, ptr %5, align 8, !tbaa !9
  %27 = getelementptr inbounds %"class.vox::control::FreeControl", ptr %13, i32 0, i32 18
  %28 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm2EEixEm(ptr noundef nonnull align 8 dereferenceable(16) %27, i64 noundef 0) #4
  %29 = load double, ptr %28, align 8, !tbaa !9
  %30 = fsub double %26, %29
  store double %30, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %31 = load double, ptr %6, align 8, !tbaa !9
  %32 = getelementptr inbounds %"class.vox::control::FreeControl", ptr %13, i32 0, i32 18
  %33 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm2EEixEm(ptr noundef nonnull align 8 dereferenceable(16) %32, i64 noundef 1) #4
  %34 = load double, ptr %33, align 8, !tbaa !9
  %35 = fsub double %31, %34
  store double %35, ptr %8, align 8, !tbaa !9
  %36 = load double, ptr %5, align 8, !tbaa !9
  %37 = getelementptr inbounds %"class.vox::control::FreeControl", ptr %13, i32 0, i32 18
  %38 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm2EEixEm(ptr noundef nonnull align 8 dereferenceable(16) %37, i64 noundef 0) #4
  store double %36, ptr %38, align 8, !tbaa !9
  %39 = load double, ptr %6, align 8, !tbaa !9
  %40 = getelementptr inbounds %"class.vox::control::FreeControl", ptr %13, i32 0, i32 18
  %41 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm2EEixEm(ptr noundef nonnull align 8 dereferenceable(16) %40, i64 noundef 1) #4
  store double %39, ptr %41, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %42 = getelementptr inbounds %"class.vox::control::FreeControl", ptr %13, i32 0, i32 21
  %43 = load i32, ptr %42, align 4, !tbaa !24
  %44 = uitofp i32 %43 to double
  %45 = fdiv double 1.800000e+02, %44
  store double %45, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %46 = getelementptr inbounds %"class.vox::control::FreeControl", ptr %13, i32 0, i32 22
  %47 = load i32, ptr %46, align 8, !tbaa !25
  %48 = uitofp i32 %47 to double
  %49 = fdiv double 1.800000e+02, %48
  store double %49, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %50 = load double, ptr %7, align 8, !tbaa !9
  %51 = load double, ptr %9, align 8, !tbaa !9
  %52 = fmul double %50, %51
  store double %52, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %53 = load double, ptr %8, align 8, !tbaa !9
  %54 = load double, ptr %10, align 8, !tbaa !9
  %55 = fmul double %53, %54
  store double %55, ptr %12, align 8, !tbaa !9
  %56 = load double, ptr %11, align 8, !tbaa !9
  %57 = fneg double %56
  %58 = fptrunc double %57 to float
  %59 = load double, ptr %12, align 8, !tbaa !9
  %60 = fptrunc double %59 to float
  call void @_ZN3vox7control11FreeControl6rotateEff(ptr noundef nonnull align 8 dereferenceable(156) %13, float noundef %58, float noundef %60)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %61

61:                                               ; preds = %25, %24, %19
  ret void
}

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

declare noundef zeroext i1 @_ZN3vox9Component7enabledEv(ptr noundef nonnull align 8 dereferenceable(19)) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3vox7control11FreeControl6rotateEff(ptr noundef nonnull align 8 dereferenceable(156), float noundef, float noundef) #1 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { "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 }

!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, !15, i64 88}
!12 = !{!"_ZTSN3vox7control11FreeControlE", !13, i64 0, !17, i64 48, !17, i64 60, !18, i64 72, !18, i64 76, !15, i64 80, !18, i64 84, !15, i64 88, !18, i64 92, !18, i64 96, !15, i64 100, !15, i64 101, !15, i64 102, !15, i64 103, !17, i64 104, !19, i64 116, !20, i64 128, !15, i64 144, !21, i64 148, !21, i64 152}
!13 = !{!"_ZTSN3vox6ScriptE", !14, i64 0, !15, i64 19, !16, i64 24, !16, i64 32, !16, i64 40}
!14 = !{!"_ZTSN3vox9ComponentE", !6, i64 8, !15, i64 16, !15, i64 17, !15, i64 18}
!15 = !{!"bool", !7, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{!"_ZTSN3vox6VectorIfLm3EEE", !18, i64 0, !18, i64 4, !18, i64 8}
!18 = !{!"float", !7, i64 0}
!19 = !{!"_ZTSN3vox7control9SphericalE", !18, i64 0, !18, i64 4, !18, i64 8}
!20 = !{!"_ZTSSt5arrayIdLm2EE", !7, i64 0}
!21 = !{!"int", !7, i64 0}
!22 = !{i8 0, i8 2}
!23 = !{}
!24 = !{!12, !21, i64 148}
!25 = !{!12, !21, i64 152}


; 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 void @_ZN3vox7control11FreeControl11onMouseMoveEdd(ptr noundef nonnull align 8 dereferenceable(156) %0, double noundef %1, double noundef %2) local_unnamed_addr #0 align 2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 88
  %5 = load i8, ptr %4, align 8, !tbaa !5, !range !19, !noundef !20
  %6 = icmp eq i8 %5, 0
  br i1 %6, label %32, label %7

7:                                                ; preds = %3
  %8 = tail call noundef zeroext i1 @_ZN3vox9Component7enabledEv(ptr noundef nonnull align 8 dereferenceable(19) %0)
  br i1 %8, label %9, label %32

9:                                                ; preds = %7
  %10 = getelementptr inbounds i8, ptr %0, i64 128
  %11 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm2EEixEm(ptr noundef nonnull align 8 dereferenceable(16) %10, i64 noundef 0) #3
  %12 = load double, ptr %11, align 8, !tbaa !21
  %13 = fsub double %1, %12
  %14 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm2EEixEm(ptr noundef nonnull align 8 dereferenceable(16) %10, i64 noundef 1) #3
  %15 = load double, ptr %14, align 8, !tbaa !21
  %16 = fsub double %2, %15
  %17 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm2EEixEm(ptr noundef nonnull align 8 dereferenceable(16) %10, i64 noundef 0) #3
  store double %1, ptr %17, align 8, !tbaa !21
  %18 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5arrayIdLm2EEixEm(ptr noundef nonnull align 8 dereferenceable(16) %10, i64 noundef 1) #3
  store double %2, ptr %18, align 8, !tbaa !21
  %19 = getelementptr inbounds i8, ptr %0, i64 148
  %20 = load i32, ptr %19, align 4, !tbaa !23
  %21 = uitofp i32 %20 to double
  %22 = fdiv double 1.800000e+02, %21
  %23 = getelementptr inbounds i8, ptr %0, i64 152
  %24 = load i32, ptr %23, align 8, !tbaa !24
  %25 = uitofp i32 %24 to double
  %26 = fdiv double 1.800000e+02, %25
  %27 = fmul double %16, %26
  %28 = fneg double %13
  %29 = fmul double %22, %28
  %30 = fptrunc double %29 to float
  %31 = fptrunc double %27 to float
  tail call void @_ZN3vox7control11FreeControl6rotateEff(ptr noundef nonnull align 8 dereferenceable(156) %0, float noundef %30, float noundef %31)
  br label %32

32:                                               ; preds = %7, %3, %9
  ret void
}

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

declare noundef zeroext i1 @_ZN3vox9Component7enabledEv(ptr noundef nonnull align 8 dereferenceable(19)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3vox7control11FreeControl6rotateEff(ptr noundef nonnull align 8 dereferenceable(156), float noundef, float noundef) local_unnamed_addr #0 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 = { "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 88}
!6 = !{!"_ZTSN3vox7control11FreeControlE", !7, i64 0, !14, i64 48, !14, i64 60, !15, i64 72, !15, i64 76, !12, i64 80, !15, i64 84, !12, i64 88, !15, i64 92, !15, i64 96, !12, i64 100, !12, i64 101, !12, i64 102, !12, i64 103, !14, i64 104, !16, i64 116, !17, i64 128, !12, i64 144, !18, i64 148, !18, i64 152}
!7 = !{!"_ZTSN3vox6ScriptE", !8, i64 0, !12, i64 19, !13, i64 24, !13, i64 32, !13, i64 40}
!8 = !{!"_ZTSN3vox9ComponentE", !9, i64 8, !12, i64 16, !12, i64 17, !12, i64 18}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"bool", !10, i64 0}
!13 = !{!"long", !10, i64 0}
!14 = !{!"_ZTSN3vox6VectorIfLm3EEE", !15, i64 0, !15, i64 4, !15, i64 8}
!15 = !{!"float", !10, i64 0}
!16 = !{!"_ZTSN3vox7control9SphericalE", !15, i64 0, !15, i64 4, !15, i64 8}
!17 = !{!"_ZTSSt5arrayIdLm2EE", !10, i64 0}
!18 = !{!"int", !10, i64 0}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = !{!22, !22, i64 0}
!22 = !{!"double", !10, i64 0}
!23 = !{!6, !18, i64 148}
!24 = !{!6, !18, i64 152}


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