; LLVM IR from yangfengzzz/DigitalVox4 :: vox.render/controls (orbit_control)

; 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::Vector.0" = type { float, float }
%"class.vox::control::OrbitControl" = type { %"class.vox::Script", float, %"class.vox::Point", %"class.vox::Vector", float, float, float, float, i8, float, i8, float, i8, float, float, i8, float, i8, float, float, float, float, i8, float, ptr, %"class.vox::Point", %"class.vox::Vector", %"class.vox::control::Spherical", %"class.vox::control::Spherical", %"class.vox::control::Spherical", float, float, %"class.vox::Vector", i8, %"class.vox::Vector", i32, %"class.vox::Vector.0", %"class.vox::Vector.0", %"class.vox::Vector.0", %"class.vox::Vector.0", %"class.vox::Vector.0", %"class.vox::Vector.0", %"class.vox::Vector.0", %"class.vox::Vector.0", %"class.vox::Vector.0", i8, i8, i32, i32 }
%"class.vox::Script" = type { %"class.vox::Component.base", i8, i64, i64, i64 }
%"class.vox::Component.base" = type <{ ptr, ptr, i8, i8, i8 }>
%"class.vox::Point" = type { float, float, float }
%"class.vox::control::Spherical" = type { float, float, float }
%"class.vox::Vector" = type { float, float, float }

; 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 nounwind uwtable
declare dso_local void @_ZN3vox7control12OrbitControl10rotateLeftEf(ptr noundef nonnull align 8 dereferenceable(352), float noundef) #1 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZN3vox6VectorIfLm2EEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3vox7control12OrbitControl21handleMouseMoveRotateEdd(ptr noundef nonnull align 8 dereferenceable(352) %0, double noundef %1, double noundef %2) #2 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca %"class.vox::Vector.0", align 4
  %8 = alloca %"class.vox::Vector.0", 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
  %9 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %10 = load double, ptr %5, align 8, !tbaa !9
  %11 = fptrunc double %10 to float
  %12 = load double, ptr %6, align 8, !tbaa !9
  %13 = fptrunc double %12 to float
  call void @_ZN3vox6VectorIfLm2EEC2Eff(ptr noundef nonnull align 4 dereferenceable(8) %7, float noundef %11, float noundef %13)
  %14 = getelementptr inbounds %"class.vox::control::OrbitControl", ptr %9, i32 0, i32 37
  %15 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZN3vox6VectorIfLm2EEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(8) %14, ptr noundef nonnull align 4 dereferenceable(8) %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %16 = getelementptr inbounds %"class.vox::control::OrbitControl", ptr %9, i32 0, i32 37
  %17 = getelementptr inbounds %"class.vox::control::OrbitControl", ptr %9, i32 0, i32 36
  call void @_ZN3voxmiIfEENS_6VectorIT_Lm2EEERKS3_S5_(ptr dead_on_unwind writable sret(%"class.vox::Vector.0") align 4 %8, ptr noundef nonnull align 4 dereferenceable(8) %16, ptr noundef nonnull align 4 dereferenceable(8) %17)
  %18 = getelementptr inbounds %"class.vox::control::OrbitControl", ptr %9, i32 0, i32 38
  %19 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZN3vox6VectorIfLm2EEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(8) %18, ptr noundef nonnull align 4 dereferenceable(8) %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %20 = getelementptr inbounds %"class.vox::control::OrbitControl", ptr %9, i32 0, i32 38
  %21 = getelementptr inbounds %"class.vox::Vector.0", ptr %20, i32 0, i32 0
  %22 = load float, ptr %21, align 4, !tbaa !11
  %23 = getelementptr inbounds %"class.vox::control::OrbitControl", ptr %9, i32 0, i32 47
  %24 = load i32, ptr %23, align 8, !tbaa !24
  %25 = uitofp i32 %24 to float
  %26 = fdiv float %22, %25
  %27 = fpext float %26 to double
  %28 = fmul double 0x401921FB54442D18, %27
  %29 = getelementptr inbounds %"class.vox::control::OrbitControl", ptr %9, i32 0, i32 11
  %30 = load float, ptr %29, align 8, !tbaa !25
  %31 = fpext float %30 to double
  %32 = fmul double %28, %31
  %33 = fptrunc double %32 to float
  call void @_ZN3vox7control12OrbitControl10rotateLeftEf(ptr noundef nonnull align 8 dereferenceable(352) %9, float noundef %33)
  %34 = getelementptr inbounds %"class.vox::control::OrbitControl", ptr %9, i32 0, i32 38
  %35 = getelementptr inbounds %"class.vox::Vector.0", ptr %34, i32 0, i32 1
  %36 = load float, ptr %35, align 4, !tbaa !26
  %37 = getelementptr inbounds %"class.vox::control::OrbitControl", ptr %9, i32 0, i32 48
  %38 = load i32, ptr %37, align 4, !tbaa !27
  %39 = uitofp i32 %38 to float
  %40 = fdiv float %36, %39
  %41 = fpext float %40 to double
  %42 = fmul double 0x401921FB54442D18, %41
  %43 = getelementptr inbounds %"class.vox::control::OrbitControl", ptr %9, i32 0, i32 11
  %44 = load float, ptr %43, align 8, !tbaa !25
  %45 = fpext float %44 to double
  %46 = fmul double %42, %45
  %47 = fptrunc double %46 to float
  call void @_ZN3vox7control12OrbitControl8rotateUpEf(ptr noundef nonnull align 8 dereferenceable(352) %9, float noundef %47)
  %48 = getelementptr inbounds %"class.vox::control::OrbitControl", ptr %9, i32 0, i32 37
  %49 = getelementptr inbounds %"class.vox::control::OrbitControl", ptr %9, i32 0, i32 36
  %50 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZN3vox6VectorIfLm2EEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(8) %49, ptr noundef nonnull align 4 dereferenceable(8) %48)
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3voxmiIfEENS_6VectorIT_Lm2EEERKS3_S5_(ptr dead_on_unwind noalias writable sret(%"class.vox::Vector.0") align 4, ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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, !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, !17, i64 284}
!12 = !{!"_ZTSN3vox7control12OrbitControlE", !13, i64 0, !17, i64 48, !18, i64 52, !19, i64 64, !17, i64 76, !17, i64 80, !17, i64 84, !17, i64 88, !15, i64 92, !17, i64 96, !15, i64 100, !17, i64 104, !15, i64 108, !17, i64 112, !17, i64 116, !15, i64 120, !17, i64 124, !15, i64 128, !17, i64 132, !17, i64 136, !17, i64 140, !17, i64 144, !15, i64 148, !17, i64 152, !6, i64 160, !18, i64 168, !19, i64 180, !20, i64 192, !20, i64 204, !20, i64 216, !17, i64 228, !17, i64 232, !19, i64 236, !15, i64 248, !19, i64 252, !21, i64 264, !22, i64 268, !22, i64 276, !22, i64 284, !22, i64 292, !22, i64 300, !22, i64 308, !22, i64 316, !22, i64 324, !22, i64 332, !15, i64 340, !15, i64 341, !23, i64 344, !23, i64 348}
!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 = !{!"float", !7, i64 0}
!18 = !{!"_ZTSN3vox5PointIfLm3EEE", !17, i64 0, !17, i64 4, !17, i64 8}
!19 = !{!"_ZTSN3vox6VectorIfLm3EEE", !17, i64 0, !17, i64 4, !17, i64 8}
!20 = !{!"_ZTSN3vox7control9SphericalE", !17, i64 0, !17, i64 4, !17, i64 8}
!21 = !{!"_ZTSN3vox7control12OrbitControl5STATE4EnumE", !7, i64 0}
!22 = !{!"_ZTSN3vox6VectorIfLm2EEE", !17, i64 0, !17, i64 4}
!23 = !{!"int", !7, i64 0}
!24 = !{!12, !23, i64 344}
!25 = !{!12, !17, i64 104}
!26 = !{!12, !17, i64 288}
!27 = !{!12, !23, i64 348}


; 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.vox::Vector.0" = type { float, float }

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3vox7control12OrbitControl10rotateLeftEf(ptr noundef nonnull align 8 dereferenceable(352), float noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3vox7control12OrbitControl8rotateUpEf(ptr noundef nonnull align 8 dereferenceable(352), float noundef) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZN3vox6VectorIfLm2EEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3vox7control12OrbitControl21handleMouseMoveRotateEdd(ptr noundef nonnull align 8 dereferenceable(352) %0, double noundef %1, double noundef %2) local_unnamed_addr #2 align 2 {
  %4 = alloca %"class.vox::Vector.0", align 4
  %5 = alloca %"class.vox::Vector.0", align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  %6 = fptrunc double %1 to float
  %7 = fptrunc double %2 to float
  call void @_ZN3vox6VectorIfLm2EEC2Eff(ptr noundef nonnull align 4 dereferenceable(8) %4, float noundef %6, float noundef %7)
  %8 = getelementptr inbounds i8, ptr %0, i64 276
  %9 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZN3vox6VectorIfLm2EEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(8) %8, ptr noundef nonnull align 4 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  %10 = getelementptr inbounds i8, ptr %0, i64 268
  call void @_ZN3voxmiIfEENS_6VectorIT_Lm2EEERKS3_S5_(ptr dead_on_unwind nonnull writable sret(%"class.vox::Vector.0") align 4 %5, ptr noundef nonnull align 4 dereferenceable(8) %8, ptr noundef nonnull align 4 dereferenceable(8) %10)
  %11 = getelementptr inbounds i8, ptr %0, i64 284
  %12 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZN3vox6VectorIfLm2EEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(8) %11, ptr noundef nonnull align 4 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  %13 = load float, ptr %11, align 4, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %0, i64 344
  %15 = load i32, ptr %14, align 8, !tbaa !21
  %16 = uitofp i32 %15 to float
  %17 = fdiv float %13, %16
  %18 = fpext float %17 to double
  %19 = fmul double %18, 0x401921FB54442D18
  %20 = getelementptr inbounds i8, ptr %0, i64 104
  %21 = load float, ptr %20, align 8, !tbaa !22
  %22 = fpext float %21 to double
  %23 = fmul double %19, %22
  %24 = fptrunc double %23 to float
  call void @_ZN3vox7control12OrbitControl10rotateLeftEf(ptr noundef nonnull align 8 dereferenceable(352) %0, float noundef %24)
  %25 = getelementptr inbounds i8, ptr %0, i64 288
  %26 = load float, ptr %25, align 8, !tbaa !23
  %27 = getelementptr inbounds i8, ptr %0, i64 348
  %28 = load i32, ptr %27, align 4, !tbaa !24
  %29 = uitofp i32 %28 to float
  %30 = fdiv float %26, %29
  %31 = fpext float %30 to double
  %32 = fmul double %31, 0x401921FB54442D18
  %33 = load float, ptr %20, align 8, !tbaa !22
  %34 = fpext float %33 to double
  %35 = fmul double %32, %34
  %36 = fptrunc double %35 to float
  call void @_ZN3vox7control12OrbitControl8rotateUpEf(ptr noundef nonnull align 8 dereferenceable(352) %0, float noundef %36)
  %37 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZN3vox6VectorIfLm2EEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(8) %10, ptr noundef nonnull align 4 dereferenceable(8) %8)
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3voxmiIfEENS_6VectorIT_Lm2EEERKS3_S5_(ptr dead_on_unwind noalias writable sret(%"class.vox::Vector.0") align 4, ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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, !14, i64 284}
!6 = !{!"_ZTSN3vox7control12OrbitControlE", !7, i64 0, !14, i64 48, !15, i64 52, !16, i64 64, !14, i64 76, !14, i64 80, !14, i64 84, !14, i64 88, !12, i64 92, !14, i64 96, !12, i64 100, !14, i64 104, !12, i64 108, !14, i64 112, !14, i64 116, !12, i64 120, !14, i64 124, !12, i64 128, !14, i64 132, !14, i64 136, !14, i64 140, !14, i64 144, !12, i64 148, !14, i64 152, !9, i64 160, !15, i64 168, !16, i64 180, !17, i64 192, !17, i64 204, !17, i64 216, !14, i64 228, !14, i64 232, !16, i64 236, !12, i64 248, !16, i64 252, !18, i64 264, !19, i64 268, !19, i64 276, !19, i64 284, !19, i64 292, !19, i64 300, !19, i64 308, !19, i64 316, !19, i64 324, !19, i64 332, !12, i64 340, !12, i64 341, !20, i64 344, !20, i64 348}
!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 = !{!"float", !10, i64 0}
!15 = !{!"_ZTSN3vox5PointIfLm3EEE", !14, i64 0, !14, i64 4, !14, i64 8}
!16 = !{!"_ZTSN3vox6VectorIfLm3EEE", !14, i64 0, !14, i64 4, !14, i64 8}
!17 = !{!"_ZTSN3vox7control9SphericalE", !14, i64 0, !14, i64 4, !14, i64 8}
!18 = !{!"_ZTSN3vox7control12OrbitControl5STATE4EnumE", !10, i64 0}
!19 = !{!"_ZTSN3vox6VectorIfLm2EEE", !14, i64 0, !14, i64 4}
!20 = !{!"int", !10, i64 0}
!21 = !{!6, !20, i64 344}
!22 = !{!6, !14, i64 104}
!23 = !{!6, !14, i64 288}
!24 = !{!6, !20, i64 348}


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