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

; 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.std::map.67" = type { %"class.std::_Rb_tree.68" }
%"class.std::_Rb_tree.68" = type { %"struct.std::_Rb_tree<sim::Direction, std::pair<const sim::Direction, sim::Direction>, std::_Select1st<std::pair<const sim::Direction, sim::Direction>>, std::less<sim::Direction>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<sim::Direction, std::pair<const sim::Direction, sim::Direction>, std::_Select1st<std::pair<const sim::Direction, sim::Direction>>, std::less<sim::Direction>>::_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 }
%"class.sim::Meters" = type { %"class.sim::Distance" }
%"class.sim::Distance" = type { ptr, double }
%"struct.std::pair.334" = type { %"class.sim::Cartesian", %"class.sim::Degrees" }
%"class.sim::Cartesian" = type { %"class.sim::Coordinate" }
%"class.sim::Coordinate" = type { ptr, %"class.sim::Meters", %"class.sim::Meters" }
%"class.sim::Degrees" = type { %"class.sim::Angle" }
%"class.sim::Angle" = type { ptr, double }
%"struct.std::pair.248" = type { i32, i32 }
%"class.sim::Radians" = type { %"class.sim::Angle" }
%"class.sim::Polar" = type { %"class.sim::Coordinate" }
%"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.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" }

@__dso_handle = external hidden global i8
@_ZN3simL21DIRECTION_ROTATE_LEFTE = external hidden global %"class.std::map.67", align 8
@_ZN3simL22DIRECTION_ROTATE_RIGHTE = external hidden global %"class.std::map.67", align 8
@_ZZN3sim14MouseInterface14turnToEdgeImplEbE14halfWallLength = external hidden global %"class.sim::Meters", align 8
@_ZGVZN3sim14MouseInterface14turnToEdgeImplEbE14halfWallLength = external hidden global i64, align 8
@_ZZN3sim14MouseInterface14turnToEdgeImplEbE9wallWidth = external hidden global %"class.sim::Meters", align 8
@_ZGVZN3sim14MouseInterface14turnToEdgeImplEbE9wallWidth = external hidden global i64, align 8

; Function Attrs: nounwind
declare i32 @__cxa_atexit(ptr, ptr, ptr) #0

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

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) #1

declare noundef ptr @_ZN3sim1PEv() #2

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

declare noundef ptr @_ZN3sim1SEv() #2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3sim14MouseInterface14turnToEdgeImplEb(ptr noundef nonnull align 8 dereferenceable(296) %0, i1 noundef zeroext %1) #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca i8, align 1
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i8, align 1
  %8 = alloca %"struct.std::pair.334", align 8
  %9 = alloca %"struct.std::pair.248", align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %"class.sim::Radians", align 8
  %13 = alloca %"class.sim::Cartesian", align 8
  %14 = alloca %"class.sim::Polar", align 8
  %15 = alloca %"class.sim::Radians", align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %16 = zext i1 %1 to i8
  store i8 %16, ptr %4, align 1, !tbaa !9
  %17 = load ptr, ptr %3, align 8
  %18 = load atomic i8, ptr @_ZGVZN3sim14MouseInterface14turnToEdgeImplEbE14halfWallLength acquire, align 8
  %19 = icmp eq i8 %18, 0
  br i1 %19, label %20, label %31, !prof !11

20:                                               ; preds = %2
  %21 = call i32 @__cxa_guard_acquire(ptr @_ZGVZN3sim14MouseInterface14turnToEdgeImplEbE14halfWallLength) #0
  %22 = icmp ne i32 %21, 0
  br i1 %22, label %23, label %31

23:                                               ; preds = %20
  %24 = invoke noundef ptr @_ZN3sim1PEv()
          to label %25 unwind label %93

25:                                               ; preds = %23
  %26 = invoke noundef double @_ZN3sim5Param10wallLengthEv(ptr noundef nonnull align 8 dereferenceable(1056) %24)
          to label %27 unwind label %93

27:                                               ; preds = %25
  %28 = fdiv double %26, 2.000000e+00
  invoke void @_ZN3sim6MetersC1Ed(ptr noundef nonnull align 8 dereferenceable(16) @_ZZN3sim14MouseInterface14turnToEdgeImplEbE14halfWallLength, double noundef %28)
          to label %29 unwind label %93

29:                                               ; preds = %27
  %30 = call i32 @__cxa_atexit(ptr @_ZN3sim8DistanceD2Ev, ptr @_ZZN3sim14MouseInterface14turnToEdgeImplEbE14halfWallLength, ptr @__dso_handle) #0
  call void @__cxa_guard_release(ptr @_ZGVZN3sim14MouseInterface14turnToEdgeImplEbE14halfWallLength) #0
  br label %31

31:                                               ; preds = %29, %20, %2
  %32 = load atomic i8, ptr @_ZGVZN3sim14MouseInterface14turnToEdgeImplEbE9wallWidth acquire, align 8
  %33 = icmp eq i8 %32, 0
  br i1 %33, label %34, label %44, !prof !11

34:                                               ; preds = %31
  %35 = call i32 @__cxa_guard_acquire(ptr @_ZGVZN3sim14MouseInterface14turnToEdgeImplEbE9wallWidth) #0
  %36 = icmp ne i32 %35, 0
  br i1 %36, label %37, label %44

37:                                               ; preds = %34
  %38 = invoke noundef ptr @_ZN3sim1PEv()
          to label %39 unwind label %97

39:                                               ; preds = %37
  %40 = invoke noundef double @_ZN3sim5Param9wallWidthEv(ptr noundef nonnull align 8 dereferenceable(1056) %38)
          to label %41 unwind label %97

41:                                               ; preds = %39
  invoke void @_ZN3sim6MetersC1Ed(ptr noundef nonnull align 8 dereferenceable(16) @_ZZN3sim14MouseInterface14turnToEdgeImplEbE9wallWidth, double noundef %40)
          to label %42 unwind label %97

42:                                               ; preds = %41
  %43 = call i32 @__cxa_atexit(ptr @_ZN3sim8DistanceD2Ev, ptr @_ZZN3sim14MouseInterface14turnToEdgeImplEbE9wallWidth, ptr @__dso_handle) #0
  call void @__cxa_guard_release(ptr @_ZGVZN3sim14MouseInterface14turnToEdgeImplEbE9wallWidth) #0
  br label %44

44:                                               ; preds = %42, %34, %31
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #0
  %45 = load i8, ptr %4, align 1, !tbaa !9, !range !12, !noundef !13
  %46 = trunc i8 %45 to i1
  br i1 %46, label %47, label %49

47:                                               ; preds = %44
  %48 = call noundef zeroext i1 @_ZN3sim14MouseInterface12wallLeftImplEbb(ptr noundef nonnull align 8 dereferenceable(296) %17, i1 noundef zeroext false, i1 noundef zeroext false)
  br i1 %48, label %56, label %49

49:                                               ; preds = %47, %44
  %50 = load i8, ptr %4, align 1, !tbaa !9, !range !12, !noundef !13
  %51 = trunc i8 %50 to i1
  br i1 %51, label %54, label %52

52:                                               ; preds = %49
  %53 = call noundef zeroext i1 @_ZN3sim14MouseInterface13wallRightImplEbb(ptr noundef nonnull align 8 dereferenceable(296) %17, i1 noundef zeroext false, i1 noundef zeroext false)
  br label %54

54:                                               ; preds = %52, %49
  %55 = phi i1 [ false, %49 ], [ %53, %52 ]
  br label %56

56:                                               ; preds = %54, %47
  %57 = phi i1 [ true, %47 ], [ %55, %54 ]
  %58 = zext i1 %57 to i8
  store i8 %58, ptr %7, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 56, ptr %8) #0
  %59 = getelementptr inbounds %"class.sim::MouseInterface", ptr %17, i32 0, i32 1
  %60 = load ptr, ptr %59, align 8, !tbaa !14
  %61 = call i64 @_ZNK3sim5Mouse32getCurrentDiscretizedTranslationEv(ptr noundef nonnull align 8 dereferenceable(528) %60)
  store i64 %61, ptr %9, align 4
  %62 = load i8, ptr %4, align 1, !tbaa !9, !range !12, !noundef !13
  %63 = trunc i8 %62 to i1
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #0
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #0
  br i1 %63, label %64, label %70

64:                                               ; preds = %56
  %65 = getelementptr inbounds %"class.sim::MouseInterface", ptr %17, i32 0, i32 1
  %66 = load ptr, ptr %65, align 8, !tbaa !14
  %67 = call noundef i32 @_ZNK3sim5Mouse29getCurrentDiscretizedRotationEv(ptr noundef nonnull align 8 dereferenceable(528) %66)
  store i32 %67, ptr %10, align 4, !tbaa !35
  %68 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt3mapIN3sim9DirectionES1_St4lessIS1_ESaISt4pairIKS1_S1_EEE2atERS5_(ptr noundef nonnull align 8 dereferenceable(48) @_ZN3simL21DIRECTION_ROTATE_LEFTE, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %69 = load i32, ptr %68, align 4, !tbaa !35
  br label %76

70:                                               ; preds = %56
  %71 = getelementptr inbounds %"class.sim::MouseInterface", ptr %17, i32 0, i32 1
  %72 = load ptr, ptr %71, align 8, !tbaa !14
  %73 = call noundef i32 @_ZNK3sim5Mouse29getCurrentDiscretizedRotationEv(ptr noundef nonnull align 8 dereferenceable(528) %72)
  store i32 %73, ptr %11, align 4, !tbaa !35
  %74 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt3mapIN3sim9DirectionES1_St4lessIS1_ESaISt4pairIKS1_S1_EEE2atERS5_(ptr noundef nonnull align 8 dereferenceable(48) @_ZN3simL22DIRECTION_ROTATE_RIGHTE, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %75 = load i32, ptr %74, align 4, !tbaa !35
  br label %76

76:                                               ; preds = %70, %64
  %77 = phi i32 [ %69, %64 ], [ %75, %70 ]
  %78 = load i64, ptr %9, align 4
  call void @_ZN3sim14MouseInterface16getCrashLocationESt4pairIiiENS_9DirectionE(ptr dead_on_unwind writable sret(%"struct.std::pair.334") align 8 %8, ptr noundef nonnull align 8 dereferenceable(296) %17, i64 %78, i32 noundef %77)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #0
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #0
  %79 = getelementptr inbounds %"struct.std::pair.334", ptr %8, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #0
  %80 = getelementptr inbounds %"struct.std::pair.334", ptr %8, i32 0, i32 1
  invoke void @_ZN3sim7RadiansC1ERKNS_5AngleE(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(16) %80)
          to label %81 unwind label %101

81:                                               ; preds = %76
  invoke void @_ZN3sim14MouseInterface5arcToERKNS_9CartesianERKNS_7RadiansERKNS_6MetersEd(ptr noundef nonnull align 8 dereferenceable(296) %17, ptr noundef nonnull align 8 dereferenceable(40) %79, ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(16) @_ZZN3sim14MouseInterface14turnToEdgeImplEbE14halfWallLength, double noundef 1.000000e+00)
          to label %82 unwind label %105

82:                                               ; preds = %81
  call void @_ZN3sim5AngleD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %12) #0
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #0
  %83 = load i8, ptr %7, align 1, !tbaa !9, !range !12, !noundef !13
  %84 = trunc i8 %83 to i1
  br i1 %84, label %129, label %85

85:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 40, ptr %13) #0
  %86 = getelementptr inbounds %"struct.std::pair.334", ptr %8, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 40, ptr %14) #0
  %87 = getelementptr inbounds %"struct.std::pair.334", ptr %8, i32 0, i32 1
  invoke void @_ZN3sim5PolarC1ERKNS_8DistanceERKNS_5AngleE(ptr noundef nonnull align 8 dereferenceable(40) %14, ptr noundef nonnull align 8 dereferenceable(16) @_ZZN3sim14MouseInterface14turnToEdgeImplEbE9wallWidth, ptr noundef nonnull align 8 dereferenceable(16) %87)
          to label %88 unwind label %110

88:                                               ; preds = %85
  invoke void @_ZNK3sim9CartesianplERKNS_10CoordinateE(ptr dead_on_unwind writable sret(%"class.sim::Cartesian") align 8 %13, ptr noundef nonnull align 8 dereferenceable(40) %86, ptr noundef nonnull align 8 dereferenceable(40) %14)
          to label %89 unwind label %114

89:                                               ; preds = %88
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #0
  %90 = getelementptr inbounds %"struct.std::pair.334", ptr %8, i32 0, i32 1
  invoke void @_ZN3sim7RadiansC1ERKNS_5AngleE(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 8 dereferenceable(16) %90)
          to label %91 unwind label %118

91:                                               ; preds = %89
  invoke void @_ZN3sim14MouseInterface13moveForwardToERKNS_9CartesianERKNS_7RadiansE(ptr noundef nonnull align 8 dereferenceable(296) %17, ptr noundef nonnull align 8 dereferenceable(40) %13, ptr noundef nonnull align 8 dereferenceable(16) %15)
          to label %92 unwind label %122

92:                                               ; preds = %91
  call void @_ZN3sim5AngleD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %15) #0
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #0
  call void @_ZN3sim10CoordinateD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %13) #0
  call void @_ZN3sim10CoordinateD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %14) #0
  call void @llvm.lifetime.end.p0(i64 40, ptr %14) #0
  call void @llvm.lifetime.end.p0(i64 40, ptr %13) #0
  br label %143

93:                                               ; preds = %27, %25, %23
  %94 = landingpad { ptr, i32 }
          cleanup
  %95 = extractvalue { ptr, i32 } %94, 0
  store ptr %95, ptr %5, align 8
  %96 = extractvalue { ptr, i32 } %94, 1
  store i32 %96, ptr %6, align 4
  call void @__cxa_guard_abort(ptr @_ZGVZN3sim14MouseInterface14turnToEdgeImplEbE14halfWallLength) #0
  br label %145

97:                                               ; preds = %41, %39, %37
  %98 = landingpad { ptr, i32 }
          cleanup
  %99 = extractvalue { ptr, i32 } %98, 0
  store ptr %99, ptr %5, align 8
  %100 = extractvalue { ptr, i32 } %98, 1
  store i32 %100, ptr %6, align 4
  call void @__cxa_guard_abort(ptr @_ZGVZN3sim14MouseInterface14turnToEdgeImplEbE9wallWidth) #0
  br label %145

101:                                              ; preds = %76
  %102 = landingpad { ptr, i32 }
          cleanup
  %103 = extractvalue { ptr, i32 } %102, 0
  store ptr %103, ptr %5, align 8
  %104 = extractvalue { ptr, i32 } %102, 1
  store i32 %104, ptr %6, align 4
  br label %109

105:                                              ; preds = %81
  %106 = landingpad { ptr, i32 }
          cleanup
  %107 = extractvalue { ptr, i32 } %106, 0
  store ptr %107, ptr %5, align 8
  %108 = extractvalue { ptr, i32 } %106, 1
  store i32 %108, ptr %6, align 4
  call void @_ZN3sim5AngleD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %12) #0
  br label %109

109:                                              ; preds = %105, %101
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #0
  br label %144

110:                                              ; preds = %85
  %111 = landingpad { ptr, i32 }
          cleanup
  %112 = extractvalue { ptr, i32 } %111, 0
  store ptr %112, ptr %5, align 8
  %113 = extractvalue { ptr, i32 } %111, 1
  store i32 %113, ptr %6, align 4
  br label %128

114:                                              ; preds = %88
  %115 = landingpad { ptr, i32 }
          cleanup
  %116 = extractvalue { ptr, i32 } %115, 0
  store ptr %116, ptr %5, align 8
  %117 = extractvalue { ptr, i32 } %115, 1
  store i32 %117, ptr %6, align 4
  br label %127

118:                                              ; preds = %89
  %119 = landingpad { ptr, i32 }
          cleanup
  %120 = extractvalue { ptr, i32 } %119, 0
  store ptr %120, ptr %5, align 8
  %121 = extractvalue { ptr, i32 } %119, 1
  store i32 %121, ptr %6, align 4
  br label %126

122:                                              ; preds = %91
  %123 = landingpad { ptr, i32 }
          cleanup
  %124 = extractvalue { ptr, i32 } %123, 0
  store ptr %124, ptr %5, align 8
  %125 = extractvalue { ptr, i32 } %123, 1
  store i32 %125, ptr %6, align 4
  call void @_ZN3sim5AngleD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %15) #0
  br label %126

126:                                              ; preds = %122, %118
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #0
  call void @_ZN3sim10CoordinateD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %13) #0
  br label %127

127:                                              ; preds = %126, %114
  call void @_ZN3sim10CoordinateD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %14) #0
  br label %128

128:                                              ; preds = %127, %110
  call void @llvm.lifetime.end.p0(i64 40, ptr %14) #0
  call void @llvm.lifetime.end.p0(i64 40, ptr %13) #0
  br label %144

129:                                              ; preds = %82
  %130 = invoke noundef ptr @_ZN3sim1SEv()
          to label %131 unwind label %138

131:                                              ; preds = %129
  %132 = invoke noundef zeroext i1 @_ZN3sim5State7crashedEv(ptr noundef nonnull align 8 dereferenceable(168) %130)
          to label %133 unwind label %138

133:                                              ; preds = %131
  br i1 %132, label %142, label %134

134:                                              ; preds = %133
  %135 = invoke noundef ptr @_ZN3sim1SEv()
          to label %136 unwind label %138

136:                                              ; preds = %134
  invoke void @_ZN3sim5State10setCrashedEv(ptr noundef nonnull align 8 dereferenceable(168) %135)
          to label %137 unwind label %138

137:                                              ; preds = %136
  br label %142

138:                                              ; preds = %136, %134, %131, %129
  %139 = landingpad { ptr, i32 }
          cleanup
  %140 = extractvalue { ptr, i32 } %139, 0
  store ptr %140, ptr %5, align 8
  %141 = extractvalue { ptr, i32 } %139, 1
  store i32 %141, ptr %6, align 4
  br label %144

142:                                              ; preds = %137, %133
  br label %143

143:                                              ; preds = %142, %92
  call void @_ZNSt4pairIN3sim9CartesianENS0_7DegreesEED2Ev(ptr noundef nonnull align 8 dereferenceable(56) %8) #0
  call void @llvm.lifetime.end.p0(i64 56, ptr %8) #0
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #0
  ret void

144:                                              ; preds = %138, %128, %109
  call void @_ZNSt4pairIN3sim9CartesianENS0_7DegreesEED2Ev(ptr noundef nonnull align 8 dereferenceable(56) %8) #0
  call void @llvm.lifetime.end.p0(i64 56, ptr %8) #0
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #0
  br label %145

145:                                              ; preds = %144, %97, %93
  %146 = load ptr, ptr %5, align 8
  %147 = load i32, ptr %6, align 4
  %148 = insertvalue { ptr, i32 } poison, ptr %146, 0
  %149 = insertvalue { ptr, i32 } %148, i32 %147, 1
  resume { ptr, i32 } %149
}

declare i64 @_ZNK3sim5Mouse32getCurrentDiscretizedTranslationEv(ptr noundef nonnull align 8 dereferenceable(528)) #2

declare noundef i32 @_ZNK3sim5Mouse29getCurrentDiscretizedRotationEv(ptr noundef nonnull align 8 dereferenceable(528)) #2

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

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

; Function Attrs: nounwind
declare i32 @__cxa_guard_acquire(ptr) #0

declare noundef double @_ZN3sim5Param10wallLengthEv(ptr noundef nonnull align 8 dereferenceable(1056)) #2

declare noundef double @_ZN3sim5Param9wallWidthEv(ptr noundef nonnull align 8 dereferenceable(1056)) #2

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

; Function Attrs: nounwind
declare void @__cxa_guard_abort(ptr) #0

; Function Attrs: nounwind
declare void @__cxa_guard_release(ptr) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3sim14MouseInterface16getCrashLocationESt4pairIiiENS_9DirectionE(ptr dead_on_unwind noalias writable sret(%"struct.std::pair.334") align 8, ptr noundef nonnull align 8 dereferenceable(296), i64, i32 noundef) #4 align 2

declare void @_ZNK3sim9CartesianplERKNS_10CoordinateE(ptr dead_on_unwind writable sret(%"class.sim::Cartesian") align 8, ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(40)) #2

declare void @_ZN3sim5PolarC1ERKNS_8DistanceERKNS_5AngleE(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2

; Function Attrs: nounwind
declare void @_ZN3sim10CoordinateD2Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3sim14MouseInterface13moveForwardToERKNS_9CartesianERKNS_7RadiansE(ptr noundef nonnull align 8 dereferenceable(296), ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(16)) #4 align 2

declare void @_ZN3sim7RadiansC1ERKNS_5AngleE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2

declare noundef zeroext i1 @_ZN3sim5State7crashedEv(ptr noundef nonnull align 8 dereferenceable(168)) #2

declare void @_ZN3sim5State10setCrashedEv(ptr noundef nonnull align 8 dereferenceable(168)) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIN3sim9CartesianENS0_7DegreesEED2Ev(ptr noundef nonnull align 8 dereferenceable(56)) unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3sim14MouseInterface5arcToERKNS_9CartesianERKNS_7RadiansERKNS_6MetersEd(ptr noundef nonnull align 8 dereferenceable(296), ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16), double noundef) #4 align 2

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

!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 = !{!"bool", !7, i64 0}
!11 = !{!"branch_weights", i32 1, i32 1048575}
!12 = !{i8 0, i8 2}
!13 = !{}
!14 = !{!15, !6, i64 8}
!15 = !{!"_ZTSN3sim14MouseInterfaceE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !16, i64 32, !25, i64 80, !10, i64 192, !30, i64 200, !30, i64 248}
!16 = !{!"_ZTSSt3setIcSt4lessIcESaIcEE", !17, i64 0}
!17 = !{!"_ZTSSt8_Rb_treeIccSt9_IdentityIcESt4lessIcESaIcEE", !18, i64 0}
!18 = !{!"_ZTSNSt8_Rb_treeIccSt9_IdentityIcESt4lessIcESaIcEE13_Rb_tree_implIS3_Lb1EEE", !19, i64 0, !21, i64 8}
!19 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessIcEE", !20, i64 0}
!20 = !{!"_ZTSSt4lessIcE"}
!21 = !{!"_ZTSSt15_Rb_tree_header", !22, i64 0, !24, i64 32}
!22 = !{!"_ZTSSt18_Rb_tree_node_base", !23, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!23 = !{!"_ZTSSt14_Rb_tree_color", !7, i64 0}
!24 = !{!"long", !7, i64 0}
!25 = !{!"_ZTSN3sim27StaticMouseAlgorithmOptionsE", !26, i64 0, !26, i64 32, !26, i64 64, !28, i64 96, !28, i64 100, !29, i64 104}
!26 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !27, i64 0, !24, i64 8, !7, i64 16}
!27 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!28 = !{!"int", !7, i64 0}
!29 = !{!"double", !7, i64 0}
!30 = !{!"_ZTSSt3setISt4pairIiiESt4lessIS1_ESaIS1_EE", !31, i64 0}
!31 = !{!"_ZTSSt8_Rb_treeISt4pairIiiES1_St9_IdentityIS1_ESt4lessIS1_ESaIS1_EE", !32, i64 0}
!32 = !{!"_ZTSNSt8_Rb_treeISt4pairIiiES1_St9_IdentityIS1_ESt4lessIS1_ESaIS1_EE13_Rb_tree_implIS5_Lb1EEE", !33, i64 0, !21, i64 8}
!33 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessISt4pairIiiEEE", !34, i64 0}
!34 = !{!"_ZTSSt4lessISt4pairIiiEE"}
!35 = !{!36, !36, i64 0}
!36 = !{!"_ZTSN3sim9DirectionE", !7, i64 0}


; 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.std::map.67" = type { %"class.std::_Rb_tree.68" }
%"class.std::_Rb_tree.68" = type { %"struct.std::_Rb_tree<sim::Direction, std::pair<const sim::Direction, sim::Direction>, std::_Select1st<std::pair<const sim::Direction, sim::Direction>>, std::less<sim::Direction>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<sim::Direction, std::pair<const sim::Direction, sim::Direction>, std::_Select1st<std::pair<const sim::Direction, sim::Direction>>, std::less<sim::Direction>>::_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 }
%"class.sim::Meters" = type { %"class.sim::Distance" }
%"class.sim::Distance" = type { ptr, double }
%"struct.std::pair.334" = type { %"class.sim::Cartesian", %"class.sim::Degrees" }
%"class.sim::Cartesian" = type { %"class.sim::Coordinate" }
%"class.sim::Coordinate" = type { ptr, %"class.sim::Meters", %"class.sim::Meters" }
%"class.sim::Degrees" = type { %"class.sim::Angle" }
%"class.sim::Angle" = type { ptr, double }
%"class.sim::Radians" = type { %"class.sim::Angle" }
%"class.sim::Polar" = type { %"class.sim::Coordinate" }

@__dso_handle = external hidden global i8
@_ZN3simL21DIRECTION_ROTATE_LEFTE = external hidden global %"class.std::map.67", align 8
@_ZN3simL22DIRECTION_ROTATE_RIGHTE = external hidden global %"class.std::map.67", align 8
@_ZZN3sim14MouseInterface14turnToEdgeImplEbE14halfWallLength = external hidden global %"class.sim::Meters", align 8
@_ZGVZN3sim14MouseInterface14turnToEdgeImplEbE14halfWallLength = external hidden global i64, align 8
@_ZZN3sim14MouseInterface14turnToEdgeImplEbE9wallWidth = external hidden global %"class.sim::Meters", align 8
@_ZGVZN3sim14MouseInterface14turnToEdgeImplEbE9wallWidth = external hidden global i64, align 8

; Function Attrs: nofree nounwind
declare i32 @__cxa_atexit(ptr, ptr, ptr) 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

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) #1

declare noundef ptr @_ZN3sim1PEv() local_unnamed_addr #2

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

declare noundef ptr @_ZN3sim1SEv() local_unnamed_addr #2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3sim14MouseInterface14turnToEdgeImplEb(ptr noundef nonnull align 8 dereferenceable(296) %0, i1 noundef zeroext %1) local_unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"struct.std::pair.334", align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"class.sim::Radians", align 8
  %7 = alloca %"class.sim::Cartesian", align 8
  %8 = alloca %"class.sim::Polar", align 8
  %9 = alloca %"class.sim::Radians", align 8
  %10 = load atomic i8, ptr @_ZGVZN3sim14MouseInterface14turnToEdgeImplEbE14halfWallLength acquire, align 8
  %11 = icmp eq i8 %10, 0
  br i1 %11, label %12, label %22, !prof !5

12:                                               ; preds = %2
  %13 = tail call i32 @__cxa_guard_acquire(ptr nonnull @_ZGVZN3sim14MouseInterface14turnToEdgeImplEbE14halfWallLength) #6
  %.not = icmp eq i32 %13, 0
  br i1 %.not, label %22, label %14

14:                                               ; preds = %12
  %15 = invoke noundef ptr @_ZN3sim1PEv()
          to label %16 unwind label %62

16:                                               ; preds = %14
  %17 = invoke noundef double @_ZN3sim5Param10wallLengthEv(ptr noundef nonnull align 8 dereferenceable(1056) %15)
          to label %18 unwind label %62

18:                                               ; preds = %16
  %19 = fmul double %17, 5.000000e-01
  invoke void @_ZN3sim6MetersC1Ed(ptr noundef nonnull align 8 dereferenceable(16) @_ZZN3sim14MouseInterface14turnToEdgeImplEbE14halfWallLength, double noundef %19)
          to label %20 unwind label %62

20:                                               ; preds = %18
  %21 = tail call i32 @__cxa_atexit(ptr nonnull @_ZN3sim8DistanceD2Ev, ptr nonnull @_ZZN3sim14MouseInterface14turnToEdgeImplEbE14halfWallLength, ptr nonnull @__dso_handle) #6
  tail call void @__cxa_guard_release(ptr nonnull @_ZGVZN3sim14MouseInterface14turnToEdgeImplEbE14halfWallLength) #6
  br label %22

22:                                               ; preds = %20, %12, %2
  %23 = load atomic i8, ptr @_ZGVZN3sim14MouseInterface14turnToEdgeImplEbE9wallWidth acquire, align 8
  %24 = icmp eq i8 %23, 0
  br i1 %24, label %25, label %34, !prof !5

25:                                               ; preds = %22
  %26 = tail call i32 @__cxa_guard_acquire(ptr nonnull @_ZGVZN3sim14MouseInterface14turnToEdgeImplEbE9wallWidth) #6
  %.not12 = icmp eq i32 %26, 0
  br i1 %.not12, label %34, label %27

27:                                               ; preds = %25
  %28 = invoke noundef ptr @_ZN3sim1PEv()
          to label %29 unwind label %64

29:                                               ; preds = %27
  %30 = invoke noundef double @_ZN3sim5Param9wallWidthEv(ptr noundef nonnull align 8 dereferenceable(1056) %28)
          to label %31 unwind label %64

31:                                               ; preds = %29
  invoke void @_ZN3sim6MetersC1Ed(ptr noundef nonnull align 8 dereferenceable(16) @_ZZN3sim14MouseInterface14turnToEdgeImplEbE9wallWidth, double noundef %30)
          to label %32 unwind label %64

32:                                               ; preds = %31
  %33 = tail call i32 @__cxa_atexit(ptr nonnull @_ZN3sim8DistanceD2Ev, ptr nonnull @_ZZN3sim14MouseInterface14turnToEdgeImplEbE9wallWidth, ptr nonnull @__dso_handle) #6
  tail call void @__cxa_guard_release(ptr nonnull @_ZGVZN3sim14MouseInterface14turnToEdgeImplEbE9wallWidth) #6
  br label %34

34:                                               ; preds = %32, %25, %22
  %35 = getelementptr inbounds i8, ptr %0, i64 8
  br i1 %1, label %36, label %43

36:                                               ; preds = %34
  %37 = tail call noundef zeroext i1 @_ZN3sim14MouseInterface12wallLeftImplEbb(ptr noundef nonnull align 8 dereferenceable(296) %0, i1 noundef zeroext false, i1 noundef zeroext false)
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %3) #6
  %38 = load ptr, ptr %35, align 8, !tbaa !6
  %39 = tail call i64 @_ZNK3sim5Mouse32getCurrentDiscretizedTranslationEv(ptr noundef nonnull align 8 dereferenceable(528) %38)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  %40 = load ptr, ptr %35, align 8, !tbaa !6
  %41 = tail call noundef i32 @_ZNK3sim5Mouse29getCurrentDiscretizedRotationEv(ptr noundef nonnull align 8 dereferenceable(528) %40)
  store i32 %41, ptr %4, align 4, !tbaa !31
  %42 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt3mapIN3sim9DirectionES1_St4lessIS1_ESaISt4pairIKS1_S1_EEE2atERS5_(ptr noundef nonnull align 8 dereferenceable(48) @_ZN3simL21DIRECTION_ROTATE_LEFTE, ptr noundef nonnull align 4 dereferenceable(4) %4)
  br label %50

43:                                               ; preds = %34
  %44 = tail call noundef zeroext i1 @_ZN3sim14MouseInterface13wallRightImplEbb(ptr noundef nonnull align 8 dereferenceable(296) %0, i1 noundef zeroext false, i1 noundef zeroext false)
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %3) #6
  %45 = load ptr, ptr %35, align 8, !tbaa !6
  %46 = tail call i64 @_ZNK3sim5Mouse32getCurrentDiscretizedTranslationEv(ptr noundef nonnull align 8 dereferenceable(528) %45)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  %47 = load ptr, ptr %35, align 8, !tbaa !6
  %48 = tail call noundef i32 @_ZNK3sim5Mouse29getCurrentDiscretizedRotationEv(ptr noundef nonnull align 8 dereferenceable(528) %47)
  store i32 %48, ptr %5, align 4, !tbaa !31
  %49 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt3mapIN3sim9DirectionES1_St4lessIS1_ESaISt4pairIKS1_S1_EEE2atERS5_(ptr noundef nonnull align 8 dereferenceable(48) @_ZN3simL22DIRECTION_ROTATE_RIGHTE, ptr noundef nonnull align 4 dereferenceable(4) %5)
  br label %50

50:                                               ; preds = %43, %36
  %51 = phi i64 [ %39, %36 ], [ %46, %43 ]
  %52 = phi i1 [ %37, %36 ], [ %44, %43 ]
  %.in = phi ptr [ %42, %36 ], [ %49, %43 ]
  %53 = load i32, ptr %.in, align 4, !tbaa !31
  call void @_ZN3sim14MouseInterface16getCrashLocationESt4pairIiiENS_9DirectionE(ptr dead_on_unwind nonnull writable sret(%"struct.std::pair.334") align 8 %3, ptr noundef nonnull align 8 dereferenceable(296) %0, i64 %51, i32 noundef %53)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #6
  %54 = getelementptr inbounds i8, ptr %3, i64 40
  invoke void @_ZN3sim7RadiansC1ERKNS_5AngleE(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(16) %54)
          to label %55 unwind label %66

55:                                               ; preds = %50
  invoke void @_ZN3sim14MouseInterface5arcToERKNS_9CartesianERKNS_7RadiansERKNS_6MetersEd(ptr noundef nonnull align 8 dereferenceable(296) %0, ptr noundef nonnull align 8 dereferenceable(40) %3, ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(16) @_ZZN3sim14MouseInterface14turnToEdgeImplEbE14halfWallLength, double noundef 1.000000e+00)
          to label %56 unwind label %68

56:                                               ; preds = %55
  call void @_ZN3sim5AngleD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #6
  br i1 %52, label %82, label %57

57:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %8) #6
  invoke void @_ZN3sim5PolarC1ERKNS_8DistanceERKNS_5AngleE(ptr noundef nonnull align 8 dereferenceable(40) %8, ptr noundef nonnull align 8 dereferenceable(16) @_ZZN3sim14MouseInterface14turnToEdgeImplEbE9wallWidth, ptr noundef nonnull align 8 dereferenceable(16) %54)
          to label %58 unwind label %71

58:                                               ; preds = %57
  invoke void @_ZNK3sim9CartesianplERKNS_10CoordinateE(ptr dead_on_unwind nonnull writable sret(%"class.sim::Cartesian") align 8 %7, ptr noundef nonnull align 8 dereferenceable(40) %3, ptr noundef nonnull align 8 dereferenceable(40) %8)
          to label %59 unwind label %73

59:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #6
  invoke void @_ZN3sim7RadiansC1ERKNS_5AngleE(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(16) %54)
          to label %60 unwind label %75

60:                                               ; preds = %59
  invoke void @_ZN3sim14MouseInterface13moveForwardToERKNS_9CartesianERKNS_7RadiansE(ptr noundef nonnull align 8 dereferenceable(296) %0, ptr noundef nonnull align 8 dereferenceable(40) %7, ptr noundef nonnull align 8 dereferenceable(16) %9)
          to label %61 unwind label %77

61:                                               ; preds = %60
  call void @_ZN3sim5AngleD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #6
  call void @_ZN3sim10CoordinateD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %7) #6
  call void @_ZN3sim10CoordinateD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %8) #6
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %7) #6
  br label %92

62:                                               ; preds = %18, %16, %14
  %63 = landingpad { ptr, i32 }
          cleanup
  tail call void @__cxa_guard_abort(ptr nonnull @_ZGVZN3sim14MouseInterface14turnToEdgeImplEbE14halfWallLength) #6
  br label %94

64:                                               ; preds = %31, %29, %27
  %65 = landingpad { ptr, i32 }
          cleanup
  tail call void @__cxa_guard_abort(ptr nonnull @_ZGVZN3sim14MouseInterface14turnToEdgeImplEbE9wallWidth) #6
  br label %94

66:                                               ; preds = %50
  %67 = landingpad { ptr, i32 }
          cleanup
  br label %70

68:                                               ; preds = %55
  %69 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3sim5AngleD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #6
  br label %70

70:                                               ; preds = %68, %66
  %.pn = phi { ptr, i32 } [ %69, %68 ], [ %67, %66 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #6
  br label %93

71:                                               ; preds = %57
  %72 = landingpad { ptr, i32 }
          cleanup
  br label %81

73:                                               ; preds = %58
  %74 = landingpad { ptr, i32 }
          cleanup
  br label %80

75:                                               ; preds = %59
  %76 = landingpad { ptr, i32 }
          cleanup
  br label %79

77:                                               ; preds = %60
  %78 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3sim5AngleD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #6
  br label %79

79:                                               ; preds = %77, %75
  %.pn14 = phi { ptr, i32 } [ %78, %77 ], [ %76, %75 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #6
  call void @_ZN3sim10CoordinateD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %7) #6
  br label %80

80:                                               ; preds = %79, %73
  %.pn14.pn = phi { ptr, i32 } [ %.pn14, %79 ], [ %74, %73 ]
  call void @_ZN3sim10CoordinateD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %8) #6
  br label %81

81:                                               ; preds = %80, %71
  %.pn14.pn.pn = phi { ptr, i32 } [ %.pn14.pn, %80 ], [ %72, %71 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %7) #6
  br label %93

82:                                               ; preds = %56
  %83 = invoke noundef ptr @_ZN3sim1SEv()
          to label %84 unwind label %90

84:                                               ; preds = %82
  %85 = invoke noundef zeroext i1 @_ZN3sim5State7crashedEv(ptr noundef nonnull align 8 dereferenceable(168) %83)
          to label %86 unwind label %90

86:                                               ; preds = %84
  br i1 %85, label %92, label %87

87:                                               ; preds = %86
  %88 = invoke noundef ptr @_ZN3sim1SEv()
          to label %89 unwind label %90

89:                                               ; preds = %87
  invoke void @_ZN3sim5State10setCrashedEv(ptr noundef nonnull align 8 dereferenceable(168) %88)
          to label %92 unwind label %90

90:                                               ; preds = %89, %87, %84, %82
  %91 = landingpad { ptr, i32 }
          cleanup
  br label %93

92:                                               ; preds = %86, %89, %61
  call void @_ZNSt4pairIN3sim9CartesianENS0_7DegreesEED2Ev(ptr noundef nonnull align 8 dereferenceable(56) %3) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %3) #6
  ret void

93:                                               ; preds = %90, %81, %70
  %.pn18 = phi { ptr, i32 } [ %91, %90 ], [ %.pn14.pn.pn, %81 ], [ %.pn, %70 ]
  call void @_ZNSt4pairIN3sim9CartesianENS0_7DegreesEED2Ev(ptr noundef nonnull align 8 dereferenceable(56) %3) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %3) #6
  br label %94

94:                                               ; preds = %93, %64, %62
  %.pn18.pn = phi { ptr, i32 } [ %.pn18, %93 ], [ %65, %64 ], [ %63, %62 ]
  resume { ptr, i32 } %.pn18.pn
}

declare i64 @_ZNK3sim5Mouse32getCurrentDiscretizedTranslationEv(ptr noundef nonnull align 8 dereferenceable(528)) local_unnamed_addr #2

declare noundef i32 @_ZNK3sim5Mouse29getCurrentDiscretizedRotationEv(ptr noundef nonnull align 8 dereferenceable(528)) local_unnamed_addr #2

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

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

; Function Attrs: nofree nounwind
declare i32 @__cxa_guard_acquire(ptr) local_unnamed_addr #0

declare noundef double @_ZN3sim5Param10wallLengthEv(ptr noundef nonnull align 8 dereferenceable(1056)) local_unnamed_addr #2

declare noundef double @_ZN3sim5Param9wallWidthEv(ptr noundef nonnull align 8 dereferenceable(1056)) local_unnamed_addr #2

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

; Function Attrs: nofree nounwind
declare void @__cxa_guard_abort(ptr) local_unnamed_addr #0

; Function Attrs: nofree nounwind
declare void @__cxa_guard_release(ptr) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3sim14MouseInterface16getCrashLocationESt4pairIiiENS_9DirectionE(ptr dead_on_unwind noalias writable sret(%"struct.std::pair.334") align 8, ptr noundef nonnull align 8 dereferenceable(296), i64, i32 noundef) local_unnamed_addr #4 align 2

declare void @_ZNK3sim9CartesianplERKNS_10CoordinateE(ptr dead_on_unwind writable sret(%"class.sim::Cartesian") align 8, ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #2

declare void @_ZN3sim5PolarC1ERKNS_8DistanceERKNS_5AngleE(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2

; Function Attrs: nounwind
declare void @_ZN3sim10CoordinateD2Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3sim14MouseInterface13moveForwardToERKNS_9CartesianERKNS_7RadiansE(ptr noundef nonnull align 8 dereferenceable(296), ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4 align 2

declare void @_ZN3sim7RadiansC1ERKNS_5AngleE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2

declare noundef zeroext i1 @_ZN3sim5State7crashedEv(ptr noundef nonnull align 8 dereferenceable(168)) local_unnamed_addr #2

declare void @_ZN3sim5State10setCrashedEv(ptr noundef nonnull align 8 dereferenceable(168)) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIN3sim9CartesianENS0_7DegreesEED2Ev(ptr noundef nonnull align 8 dereferenceable(56)) unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3sim14MouseInterface5arcToERKNS_9CartesianERKNS_7RadiansERKNS_6MetersEd(ptr noundef nonnull align 8 dereferenceable(296), ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16), double noundef) local_unnamed_addr #4 align 2

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


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