; LLVM IR from mackorone/mms :: old/v2/src/sim (MouseInterface)

; 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.sim::Radians" = type { %"class.sim::Angle" }
%"class.sim::Angle" = type { ptr, double }
%"class.sim::Milliseconds" = type { %"class.sim::Duration" }
%"class.sim::Duration" = type { ptr, double }
%"class.sim::MouseInterface" = type { ptr, ptr, ptr, ptr, %"class.std::set.221", %"struct.sim::StaticMouseAlgorithmOptions", i8, %"class.std::set.226", %"class.std::set.226" }
%"class.std::set.221" = type { %"class.std::_Rb_tree.222" }
%"class.std::_Rb_tree.222" = type { %"struct.std::_Rb_tree<char, char, std::_Identity<char>, std::less<char>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<char, char, std::_Identity<char>, std::less<char>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.sim::StaticMouseAlgorithmOptions" = type { %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", i32, i32, double }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::set.226" = type { %"class.std::_Rb_tree.227" }
%"class.std::_Rb_tree.227" = type { %"struct.std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int>>, std::less<std::pair<int, int>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }

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

declare i32 @__gxx_personality_v0(...)

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

declare void @_ZN3sim12MillisecondsC1Ed(ptr noundef nonnull align 8 dereferenceable(16), double noundef) unnamed_addr #1

; Function Attrs: nounwind
declare void @_ZN3sim8DurationD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2

declare void @_ZN3sim12SimUtilities5sleepERKNS_8DurationE(ptr noundef nonnull align 8 dereferenceable(16)) #1

declare noundef ptr @_ZN3sim1PEv() #1

declare noundef double @_ZN3sim5Param16minSleepDurationEv(ptr noundef nonnull align 8 dereferenceable(1056)) #1

declare void @_ZN3sim5Mouse8teleportERKNS_10CoordinateERKNS_5AngleE(ptr noundef nonnull align 8 dereferenceable(528), ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(16)) #1

; Function Attrs: nounwind
declare void @_ZN3sim5AngleD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2

declare void @_ZNK3sim5Mouse18getCurrentRotationEv(ptr dead_on_unwind writable sret(%"class.sim::Radians") align 8, ptr noundef nonnull align 8 dereferenceable(528)) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3sim14MouseInterface5arcToERKNS_9CartesianERKNS_7RadiansERKNS_6MetersEd(ptr noundef nonnull align 8 dereferenceable(296) %0, ptr noundef nonnull align 8 dereferenceable(40) %1, ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(16) %3, double noundef %4) #3 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca double, align 8
  %11 = alloca %"class.sim::Radians", align 8
  %12 = alloca %"class.sim::Radians", align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca %"class.sim::Radians", align 8
  %16 = alloca %"class.sim::Radians", align 8
  %17 = alloca %"class.sim::Milliseconds", align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store double %4, ptr %10, align 8, !tbaa !9
  %18 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #4
  %19 = getelementptr inbounds %"class.sim::MouseInterface", ptr %18, i32 0, i32 1
  %20 = load ptr, ptr %19, align 8, !tbaa !11
  call void @_ZNK3sim5Mouse18getCurrentRotationEv(ptr dead_on_unwind writable sret(%"class.sim::Radians") align 8 %12, ptr noundef nonnull align 8 dereferenceable(528) %20)
  %21 = load ptr, ptr %8, align 8, !tbaa !5
  invoke void @_ZNK3sim14MouseInterface16getRotationDeltaERKNS_7RadiansES3_(ptr dead_on_unwind writable sret(%"class.sim::Radians") align 8 %11, ptr noundef nonnull align 8 dereferenceable(296) %18, ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(16) %21)
          to label %22 unwind label %36

22:                                               ; preds = %5
  call void @_ZN3sim5AngleD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %12) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #4
  %23 = invoke noundef double @_ZNK3sim5Angle20getDegreesNotBoundedEv(ptr noundef nonnull align 8 dereferenceable(16) %11)
          to label %24 unwind label %40

24:                                               ; preds = %22
  %25 = fcmp olt double 0.000000e+00, %23
  br i1 %25, label %26, label %44

26:                                               ; preds = %24
  %27 = getelementptr inbounds %"class.sim::MouseInterface", ptr %18, i32 0, i32 1
  %28 = load ptr, ptr %27, align 8, !tbaa !11
  %29 = getelementptr inbounds %"class.sim::MouseInterface", ptr %18, i32 0, i32 5
  %30 = getelementptr inbounds %"struct.sim::StaticMouseAlgorithmOptions", ptr %29, i32 0, i32 5
  %31 = load double, ptr %30, align 8, !tbaa !32
  %32 = load double, ptr %10, align 8, !tbaa !9
  %33 = fmul double %31, %32
  %34 = load ptr, ptr %9, align 8, !tbaa !5
  invoke void @_ZN3sim5Mouse26setWheelSpeedsForCurveLeftEdRKNS_6MetersE(ptr noundef nonnull align 8 dereferenceable(528) %28, double noundef %33, ptr noundef nonnull align 8 dereferenceable(16) %34)
          to label %35 unwind label %40

35:                                               ; preds = %26
  br label %54

36:                                               ; preds = %5
  %37 = landingpad { ptr, i32 }
          cleanup
  %38 = extractvalue { ptr, i32 } %37, 0
  store ptr %38, ptr %13, align 8
  %39 = extractvalue { ptr, i32 } %37, 1
  store i32 %39, ptr %14, align 4
  call void @_ZN3sim5AngleD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %12) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #4
  br label %107

40:                                               ; preds = %100, %97, %55, %44, %26, %22
  %41 = landingpad { ptr, i32 }
          cleanup
  %42 = extractvalue { ptr, i32 } %41, 0
  store ptr %42, ptr %13, align 8
  %43 = extractvalue { ptr, i32 } %41, 1
  store i32 %43, ptr %14, align 4
  br label %106

44:                                               ; preds = %24
  %45 = getelementptr inbounds %"class.sim::MouseInterface", ptr %18, i32 0, i32 1
  %46 = load ptr, ptr %45, align 8, !tbaa !11
  %47 = getelementptr inbounds %"class.sim::MouseInterface", ptr %18, i32 0, i32 5
  %48 = getelementptr inbounds %"struct.sim::StaticMouseAlgorithmOptions", ptr %47, i32 0, i32 5
  %49 = load double, ptr %48, align 8, !tbaa !32
  %50 = load double, ptr %10, align 8, !tbaa !9
  %51 = fmul double %49, %50
  %52 = load ptr, ptr %9, align 8, !tbaa !5
  invoke void @_ZN3sim5Mouse27setWheelSpeedsForCurveRightEdRKNS_6MetersE(ptr noundef nonnull align 8 dereferenceable(528) %46, double noundef %51, ptr noundef nonnull align 8 dereferenceable(16) %52)
          to label %53 unwind label %40

53:                                               ; preds = %44
  br label %54

54:                                               ; preds = %53, %35
  br label %55

55:                                               ; preds = %73, %54
  %56 = invoke noundef double @_ZNK3sim5Angle20getRadiansNotBoundedEv(ptr noundef nonnull align 8 dereferenceable(16) %11)
          to label %57 unwind label %40

57:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr %16) #4
  %58 = getelementptr inbounds %"class.sim::MouseInterface", ptr %18, i32 0, i32 1
  %59 = load ptr, ptr %58, align 8, !tbaa !11
  invoke void @_ZNK3sim5Mouse18getCurrentRotationEv(ptr dead_on_unwind writable sret(%"class.sim::Radians") align 8 %16, ptr noundef nonnull align 8 dereferenceable(528) %59)
          to label %60 unwind label %74

60:                                               ; preds = %57
  %61 = load ptr, ptr %8, align 8, !tbaa !5
  invoke void @_ZNK3sim14MouseInterface16getRotationDeltaERKNS_7RadiansES3_(ptr dead_on_unwind writable sret(%"class.sim::Radians") align 8 %15, ptr noundef nonnull align 8 dereferenceable(296) %18, ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef nonnull align 8 dereferenceable(16) %61)
          to label %62 unwind label %78

62:                                               ; preds = %60
  %63 = invoke noundef double @_ZNK3sim5Angle20getRadiansNotBoundedEv(ptr noundef nonnull align 8 dereferenceable(16) %15)
          to label %64 unwind label %82

64:                                               ; preds = %62
  %65 = fmul double %56, %63
  %66 = fcmp olt double 0.000000e+00, %65
  call void @_ZN3sim5AngleD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %15) #4
  call void @_ZN3sim5AngleD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %16) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #4
  br i1 %66, label %67, label %97

67:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 16, ptr %17) #4
  %68 = invoke noundef ptr @_ZN3sim1PEv()
          to label %69 unwind label %88

69:                                               ; preds = %67
  %70 = invoke noundef double @_ZN3sim5Param16minSleepDurationEv(ptr noundef nonnull align 8 dereferenceable(1056) %68)
          to label %71 unwind label %88

71:                                               ; preds = %69
  invoke void @_ZN3sim12MillisecondsC1Ed(ptr noundef nonnull align 8 dereferenceable(16) %17, double noundef %70)
          to label %72 unwind label %88

72:                                               ; preds = %71
  invoke void @_ZN3sim12SimUtilities5sleepERKNS_8DurationE(ptr noundef nonnull align 8 dereferenceable(16) %17)
          to label %73 unwind label %92

73:                                               ; preds = %72
  call void @_ZN3sim8DurationD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %17) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #4
  br label %55, !llvm.loop !33

74:                                               ; preds = %57
  %75 = landingpad { ptr, i32 }
          cleanup
  %76 = extractvalue { ptr, i32 } %75, 0
  store ptr %76, ptr %13, align 8
  %77 = extractvalue { ptr, i32 } %75, 1
  store i32 %77, ptr %14, align 4
  br label %87

78:                                               ; preds = %60
  %79 = landingpad { ptr, i32 }
          cleanup
  %80 = extractvalue { ptr, i32 } %79, 0
  store ptr %80, ptr %13, align 8
  %81 = extractvalue { ptr, i32 } %79, 1
  store i32 %81, ptr %14, align 4
  br label %86

82:                                               ; preds = %62
  %83 = landingpad { ptr, i32 }
          cleanup
  %84 = extractvalue { ptr, i32 } %83, 0
  store ptr %84, ptr %13, align 8
  %85 = extractvalue { ptr, i32 } %83, 1
  store i32 %85, ptr %14, align 4
  call void @_ZN3sim5AngleD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %15) #4
  br label %86

86:                                               ; preds = %82, %78
  call void @_ZN3sim5AngleD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %16) #4
  br label %87

87:                                               ; preds = %86, %74
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #4
  br label %106

88:                                               ; preds = %71, %69, %67
  %89 = landingpad { ptr, i32 }
          cleanup
  %90 = extractvalue { ptr, i32 } %89, 0
  store ptr %90, ptr %13, align 8
  %91 = extractvalue { ptr, i32 } %89, 1
  store i32 %91, ptr %14, align 4
  br label %96

92:                                               ; preds = %72
  %93 = landingpad { ptr, i32 }
          cleanup
  %94 = extractvalue { ptr, i32 } %93, 0
  store ptr %94, ptr %13, align 8
  %95 = extractvalue { ptr, i32 } %93, 1
  store i32 %95, ptr %14, align 4
  call void @_ZN3sim8DurationD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %17) #4
  br label %96

96:                                               ; preds = %92, %88
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #4
  br label %106

97:                                               ; preds = %64
  %98 = getelementptr inbounds %"class.sim::MouseInterface", ptr %18, i32 0, i32 1
  %99 = load ptr, ptr %98, align 8, !tbaa !11
  invoke void @_ZN3sim5Mouse13stopAllWheelsEv(ptr noundef nonnull align 8 dereferenceable(528) %99)
          to label %100 unwind label %40

100:                                              ; preds = %97
  %101 = getelementptr inbounds %"class.sim::MouseInterface", ptr %18, i32 0, i32 1
  %102 = load ptr, ptr %101, align 8, !tbaa !11
  %103 = load ptr, ptr %7, align 8, !tbaa !5
  %104 = load ptr, ptr %8, align 8, !tbaa !5
  invoke void @_ZN3sim5Mouse8teleportERKNS_10CoordinateERKNS_5AngleE(ptr noundef nonnull align 8 dereferenceable(528) %102, ptr noundef nonnull align 8 dereferenceable(40) %103, ptr noundef nonnull align 8 dereferenceable(16) %104)
          to label %105 unwind label %40

105:                                              ; preds = %100
  call void @_ZN3sim5AngleD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %11) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #4
  ret void

106:                                              ; preds = %96, %87, %40
  call void @_ZN3sim5AngleD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %11) #4
  br label %107

107:                                              ; preds = %106, %36
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #4
  br label %108

108:                                              ; preds = %107
  %109 = load ptr, ptr %13, align 8
  %110 = load i32, ptr %14, align 4
  %111 = insertvalue { ptr, i32 } poison, ptr %109, 0
  %112 = insertvalue { ptr, i32 } %111, i32 %110, 1
  resume { ptr, i32 } %112
}

declare void @_ZN3sim5Mouse13stopAllWheelsEv(ptr noundef nonnull align 8 dereferenceable(528)) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3sim14MouseInterface16getRotationDeltaERKNS_7RadiansES3_(ptr dead_on_unwind noalias writable sret(%"class.sim::Radians") align 8, ptr noundef nonnull align 8 dereferenceable(296), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #3 align 2

declare noundef double @_ZNK3sim5Angle20getDegreesNotBoundedEv(ptr noundef nonnull align 8 dereferenceable(16)) #1

declare void @_ZN3sim5Mouse26setWheelSpeedsForCurveLeftEdRKNS_6MetersE(ptr noundef nonnull align 8 dereferenceable(528), double noundef, ptr noundef nonnull align 8 dereferenceable(16)) #1

declare void @_ZN3sim5Mouse27setWheelSpeedsForCurveRightEdRKNS_6MetersE(ptr noundef nonnull align 8 dereferenceable(528), double noundef, ptr noundef nonnull align 8 dereferenceable(16)) #1

declare noundef double @_ZNK3sim5Angle20getRadiansNotBoundedEv(ptr noundef nonnull align 8 dereferenceable(16)) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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 #3 = { 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 #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, !6, i64 8}
!12 = !{!"_ZTSN3sim14MouseInterfaceE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !13, i64 32, !22, i64 80, !26, i64 192, !27, i64 200, !27, i64 248}
!13 = !{!"_ZTSSt3setIcSt4lessIcESaIcEE", !14, i64 0}
!14 = !{!"_ZTSSt8_Rb_treeIccSt9_IdentityIcESt4lessIcESaIcEE", !15, i64 0}
!15 = !{!"_ZTSNSt8_Rb_treeIccSt9_IdentityIcESt4lessIcESaIcEE13_Rb_tree_implIS3_Lb1EEE", !16, i64 0, !18, i64 8}
!16 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessIcEE", !17, i64 0}
!17 = !{!"_ZTSSt4lessIcE"}
!18 = !{!"_ZTSSt15_Rb_tree_header", !19, i64 0, !21, i64 32}
!19 = !{!"_ZTSSt18_Rb_tree_node_base", !20, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!20 = !{!"_ZTSSt14_Rb_tree_color", !7, i64 0}
!21 = !{!"long", !7, i64 0}
!22 = !{!"_ZTSN3sim27StaticMouseAlgorithmOptionsE", !23, i64 0, !23, i64 32, !23, i64 64, !25, i64 96, !25, i64 100, !10, i64 104}
!23 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !24, i64 0, !21, i64 8, !7, i64 16}
!24 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!25 = !{!"int", !7, i64 0}
!26 = !{!"bool", !7, i64 0}
!27 = !{!"_ZTSSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE", !28, i64 0}
!28 = !{!"_ZTSSt8_Rb_treeISt4pairIiiES1_St9_IdentityIS1_ESt4lessIS1_ESaIS1_EE", !29, i64 0}
!29 = !{!"_ZTSNSt8_Rb_treeISt4pairIiiES1_St9_IdentityIS1_ESt4lessIS1_ESaIS1_EE13_Rb_tree_implIS5_Lb1EEE", !30, i64 0, !18, i64 8}
!30 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessISt4pairIiiEEE", !31, i64 0}
!31 = !{!"_ZTSSt4lessISt4pairIiiEE"}
!32 = !{!12, !10, i64 184}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}


; 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.sim::Radians" = type { %"class.sim::Angle" }
%"class.sim::Angle" = type { ptr, double }
%"class.sim::Milliseconds" = type { %"class.sim::Duration" }
%"class.sim::Duration" = type { ptr, double }

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

declare i32 @__gxx_personality_v0(...)

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

declare void @_ZN3sim12MillisecondsC1Ed(ptr noundef nonnull align 8 dereferenceable(16), double noundef) unnamed_addr #1

; Function Attrs: nounwind
declare void @_ZN3sim8DurationD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2

declare void @_ZN3sim12SimUtilities5sleepERKNS_8DurationE(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1

declare noundef ptr @_ZN3sim1PEv() local_unnamed_addr #1

declare noundef double @_ZN3sim5Param16minSleepDurationEv(ptr noundef nonnull align 8 dereferenceable(1056)) local_unnamed_addr #1

declare void @_ZN3sim5Mouse8teleportERKNS_10CoordinateERKNS_5AngleE(ptr noundef nonnull align 8 dereferenceable(528), ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1

; Function Attrs: nounwind
declare void @_ZN3sim5AngleD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2

declare void @_ZNK3sim5Mouse18getCurrentRotationEv(ptr dead_on_unwind writable sret(%"class.sim::Radians") align 8, ptr noundef nonnull align 8 dereferenceable(528)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3sim14MouseInterface5arcToERKNS_9CartesianERKNS_7RadiansERKNS_6MetersEd(ptr noundef nonnull align 8 dereferenceable(296) %0, ptr noundef nonnull align 8 dereferenceable(40) %1, ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(16) %3, double noundef %4) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca %"class.sim::Radians", align 8
  %7 = alloca %"class.sim::Radians", align 8
  %8 = alloca %"class.sim::Radians", align 8
  %9 = alloca %"class.sim::Radians", align 8
  %10 = alloca %"class.sim::Milliseconds", align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #4
  %11 = getelementptr inbounds i8, ptr %0, i64 8
  %12 = load ptr, ptr %11, align 8, !tbaa !5
  call void @_ZNK3sim5Mouse18getCurrentRotationEv(ptr dead_on_unwind nonnull writable sret(%"class.sim::Radians") align 8 %7, ptr noundef nonnull align 8 dereferenceable(528) %12)
  invoke void @_ZNK3sim14MouseInterface16getRotationDeltaERKNS_7RadiansES3_(ptr dead_on_unwind nonnull writable sret(%"class.sim::Radians") align 8 %6, ptr noundef nonnull align 8 dereferenceable(296) %0, ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(16) %2)
          to label %13 unwind label %22

13:                                               ; preds = %5
  call void @_ZN3sim5AngleD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #4
  %14 = invoke noundef double @_ZNK3sim5Angle20getDegreesNotBoundedEv(ptr noundef nonnull align 8 dereferenceable(16) %6)
          to label %15 unwind label %.loopexit.split-lp

15:                                               ; preds = %13
  %16 = fcmp ogt double %14, 0.000000e+00
  %17 = load ptr, ptr %11, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %0, i64 184
  %19 = load double, ptr %18, align 8, !tbaa !30
  %20 = fmul double %19, %4
  br i1 %16, label %21, label %24

21:                                               ; preds = %15
  invoke void @_ZN3sim5Mouse26setWheelSpeedsForCurveLeftEdRKNS_6MetersE(ptr noundef nonnull align 8 dereferenceable(528) %17, double noundef %20, ptr noundef nonnull align 8 dereferenceable(16) %3)
          to label %.preheader unwind label %.loopexit.split-lp

22:                                               ; preds = %5
  %23 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3sim5AngleD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #4
  br label %61

.loopexit:                                        ; preds = %25
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %60

.loopexit.split-lp:                               ; preds = %13, %21, %24, %55, %57
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %60

24:                                               ; preds = %15
  invoke void @_ZN3sim5Mouse27setWheelSpeedsForCurveRightEdRKNS_6MetersE(ptr noundef nonnull align 8 dereferenceable(528) %17, double noundef %20, ptr noundef nonnull align 8 dereferenceable(16) %3)
          to label %.preheader unwind label %.loopexit.split-lp

.preheader:                                       ; preds = %24, %21
  br label %25

25:                                               ; preds = %.preheader, %41
  %26 = invoke noundef double @_ZNK3sim5Angle20getRadiansNotBoundedEv(ptr noundef nonnull align 8 dereferenceable(16) %6)
          to label %27 unwind label %.loopexit

27:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #4
  %28 = load ptr, ptr %11, align 8, !tbaa !5
  invoke void @_ZNK3sim5Mouse18getCurrentRotationEv(ptr dead_on_unwind nonnull writable sret(%"class.sim::Radians") align 8 %9, ptr noundef nonnull align 8 dereferenceable(528) %28)
          to label %29 unwind label %42

29:                                               ; preds = %27
  invoke void @_ZNK3sim14MouseInterface16getRotationDeltaERKNS_7RadiansES3_(ptr dead_on_unwind nonnull writable sret(%"class.sim::Radians") align 8 %8, ptr noundef nonnull align 8 dereferenceable(296) %0, ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(16) %2)
          to label %30 unwind label %44

30:                                               ; preds = %29
  %31 = invoke noundef double @_ZNK3sim5Angle20getRadiansNotBoundedEv(ptr noundef nonnull align 8 dereferenceable(16) %8)
          to label %32 unwind label %46

32:                                               ; preds = %30
  %33 = fmul double %26, %31
  %34 = fcmp ogt double %33, 0.000000e+00
  call void @_ZN3sim5AngleD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #4
  call void @_ZN3sim5AngleD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #4
  br i1 %34, label %35, label %55

35:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #4
  %36 = invoke noundef ptr @_ZN3sim1PEv()
          to label %37 unwind label %50

37:                                               ; preds = %35
  %38 = invoke noundef double @_ZN3sim5Param16minSleepDurationEv(ptr noundef nonnull align 8 dereferenceable(1056) %36)
          to label %39 unwind label %50

39:                                               ; preds = %37
  invoke void @_ZN3sim12MillisecondsC1Ed(ptr noundef nonnull align 8 dereferenceable(16) %10, double noundef %38)
          to label %40 unwind label %50

40:                                               ; preds = %39
  invoke void @_ZN3sim12SimUtilities5sleepERKNS_8DurationE(ptr noundef nonnull align 8 dereferenceable(16) %10)
          to label %41 unwind label %52

41:                                               ; preds = %40
  call void @_ZN3sim8DurationD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %10) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #4
  br label %25, !llvm.loop !31

42:                                               ; preds = %27
  %43 = landingpad { ptr, i32 }
          cleanup
  br label %49

44:                                               ; preds = %29
  %45 = landingpad { ptr, i32 }
          cleanup
  br label %48

46:                                               ; preds = %30
  %47 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3sim5AngleD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #4
  br label %48

48:                                               ; preds = %46, %44
  %.pn = phi { ptr, i32 } [ %47, %46 ], [ %45, %44 ]
  call void @_ZN3sim5AngleD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #4
  br label %49

49:                                               ; preds = %48, %42
  %.pn.pn = phi { ptr, i32 } [ %.pn, %48 ], [ %43, %42 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #4
  br label %60

50:                                               ; preds = %39, %37, %35
  %51 = landingpad { ptr, i32 }
          cleanup
  br label %54

52:                                               ; preds = %40
  %53 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3sim8DurationD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %10) #4
  br label %54

54:                                               ; preds = %52, %50
  %.pn17 = phi { ptr, i32 } [ %53, %52 ], [ %51, %50 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #4
  br label %60

55:                                               ; preds = %32
  %56 = load ptr, ptr %11, align 8, !tbaa !5
  invoke void @_ZN3sim5Mouse13stopAllWheelsEv(ptr noundef nonnull align 8 dereferenceable(528) %56)
          to label %57 unwind label %.loopexit.split-lp

57:                                               ; preds = %55
  %58 = load ptr, ptr %11, align 8, !tbaa !5
  invoke void @_ZN3sim5Mouse8teleportERKNS_10CoordinateERKNS_5AngleE(ptr noundef nonnull align 8 dereferenceable(528) %58, ptr noundef nonnull align 8 dereferenceable(40) %1, ptr noundef nonnull align 8 dereferenceable(16) %2)
          to label %59 unwind label %.loopexit.split-lp

59:                                               ; preds = %57
  call void @_ZN3sim5AngleD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #4
  ret void

60:                                               ; preds = %.loopexit, %.loopexit.split-lp, %54, %49
  %.pn17.pn = phi { ptr, i32 } [ %.pn17, %54 ], [ %.pn.pn, %49 ], [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @_ZN3sim5AngleD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #4
  br label %61

61:                                               ; preds = %60, %22
  %.pn17.pn.pn = phi { ptr, i32 } [ %.pn17.pn, %60 ], [ %23, %22 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #4
  resume { ptr, i32 } %.pn17.pn.pn
}

declare void @_ZN3sim5Mouse13stopAllWheelsEv(ptr noundef nonnull align 8 dereferenceable(528)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3sim14MouseInterface16getRotationDeltaERKNS_7RadiansES3_(ptr dead_on_unwind noalias writable sret(%"class.sim::Radians") align 8, ptr noundef nonnull align 8 dereferenceable(296), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #3 align 2

declare noundef double @_ZNK3sim5Angle20getDegreesNotBoundedEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1

declare void @_ZN3sim5Mouse26setWheelSpeedsForCurveLeftEdRKNS_6MetersE(ptr noundef nonnull align 8 dereferenceable(528), double noundef, ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1

declare void @_ZN3sim5Mouse27setWheelSpeedsForCurveRightEdRKNS_6MetersE(ptr noundef nonnull align 8 dereferenceable(528), double noundef, ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1

declare noundef double @_ZNK3sim5Angle20getRadiansNotBoundedEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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 #3 = { 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 #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, !7, i64 8}
!6 = !{!"_ZTSN3sim14MouseInterfaceE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !19, i64 80, !24, i64 192, !25, i64 200, !25, i64 248}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSSt3setIcSt4lessIcESaIcEE", !11, i64 0}
!11 = !{!"_ZTSSt8_Rb_treeIccSt9_IdentityIcESt4lessIcESaIcEE", !12, i64 0}
!12 = !{!"_ZTSNSt8_Rb_treeIccSt9_IdentityIcESt4lessIcESaIcEE13_Rb_tree_implIS3_Lb1EEE", !13, i64 0, !15, i64 8}
!13 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessIcEE", !14, i64 0}
!14 = !{!"_ZTSSt4lessIcE"}
!15 = !{!"_ZTSSt15_Rb_tree_header", !16, i64 0, !18, i64 32}
!16 = !{!"_ZTSSt18_Rb_tree_node_base", !17, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!17 = !{!"_ZTSSt14_Rb_tree_color", !8, i64 0}
!18 = !{!"long", !8, i64 0}
!19 = !{!"_ZTSN3sim27StaticMouseAlgorithmOptionsE", !20, i64 0, !20, i64 32, !20, i64 64, !22, i64 96, !22, i64 100, !23, i64 104}
!20 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !21, i64 0, !18, i64 8, !8, i64 16}
!21 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !7, i64 0}
!22 = !{!"int", !8, i64 0}
!23 = !{!"double", !8, i64 0}
!24 = !{!"bool", !8, i64 0}
!25 = !{!"_ZTSSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE", !26, i64 0}
!26 = !{!"_ZTSSt8_Rb_treeISt4pairIiiES1_St9_IdentityIS1_ESt4lessIS1_ESaIS1_EE", !27, i64 0}
!27 = !{!"_ZTSNSt8_Rb_treeISt4pairIiiES1_St9_IdentityIS1_ESt4lessIS1_ESaIS1_EE13_Rb_tree_implIS5_Lb1EEE", !28, i64 0, !15, i64 8}
!28 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessISt4pairIiiEEE", !29, i64 0}
!29 = !{!"_ZTSSt4lessISt4pairIiiEE"}
!30 = !{!6, !23, i64 184}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass