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

; 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 }
%"struct.std::pair.250" = type { %"struct.std::pair.248", i32 }
%"struct.std::pair.248" = type { i32, i32 }
%"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" }

@_ZN3simL21DIRECTION_ROTATE_LEFTE = external hidden global %"class.std::map.67", align 8

; 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: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i32 } @_ZSt9make_pairISt4pairIiiERKN3sim9DirectionEES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS6_INS7_IT0_E4typeEE6__typeEEOS8_OSD_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN3sim14MouseInterface12wallLeftImplEbb(ptr noundef nonnull align 8 dereferenceable(296) %0, i1 noundef zeroext %1, i1 noundef zeroext %2) #2 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca i8, align 1
  %6 = alloca i8, align 1
  %7 = alloca %"struct.std::pair.250", align 4
  %8 = alloca %"struct.std::pair.248", align 4
  %9 = alloca i32, align 4
  %10 = alloca { i64, i32 }, align 8
  %11 = alloca { i64, i32 }, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  %12 = zext i1 %1 to i8
  store i8 %12, ptr %5, align 1, !tbaa !9
  %13 = zext i1 %2 to i8
  store i8 %13, ptr %6, align 1, !tbaa !9
  %14 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %15 = getelementptr inbounds %"class.sim::MouseInterface", ptr %14, i32 0, i32 1
  %16 = load ptr, ptr %15, align 8, !tbaa !11
  %17 = call i64 @_ZNK3sim5Mouse32getCurrentDiscretizedTranslationEv(ptr noundef nonnull align 8 dereferenceable(528) %16)
  store i64 %17, ptr %8, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %18 = getelementptr inbounds %"class.sim::MouseInterface", ptr %14, i32 0, i32 1
  %19 = load ptr, ptr %18, align 8, !tbaa !11
  %20 = call noundef i32 @_ZNK3sim5Mouse29getCurrentDiscretizedRotationEv(ptr noundef nonnull align 8 dereferenceable(528) %19)
  store i32 %20, ptr %9, align 4, !tbaa !32
  %21 = 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) %9)
  %22 = call { i64, i32 } @_ZSt9make_pairISt4pairIiiERKN3sim9DirectionEES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS6_INS7_IT0_E4typeEE6__typeEEOS8_OSD_(ptr noundef nonnull align 4 dereferenceable(8) %8, ptr noundef nonnull align 4 dereferenceable(4) %21)
  store { i64, i32 } %22, ptr %10, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %7, ptr align 8 %10, i64 12, i1 false)
  %23 = load i8, ptr %5, align 1, !tbaa !9, !range !34, !noundef !35
  %24 = trunc i8 %23 to i1
  %25 = load i8, ptr %6, align 1, !tbaa !9, !range !34, !noundef !35
  %26 = trunc i8 %25 to i1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %11, ptr align 4 %7, i64 12, i1 false)
  %27 = getelementptr inbounds { i64, i32 }, ptr %11, i32 0, i32 0
  %28 = load i64, ptr %27, align 4
  %29 = getelementptr inbounds { i64, i32 }, ptr %11, i32 0, i32 1
  %30 = load i32, ptr %29, align 4
  %31 = call noundef zeroext i1 @_ZN3sim14MouseInterface6isWallESt4pairIS1_IiiENS_9DirectionEEbb(ptr noundef nonnull align 8 dereferenceable(296) %14, i64 %28, i32 %30, i1 noundef zeroext %24, i1 noundef zeroext %26)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  ret i1 %31
}

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

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

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

; 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)) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { "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 = !{!"bool", !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, !10, 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, !26, 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 = !{!"double", !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 = !{!33, !33, i64 0}
!33 = !{!"_ZTSN3sim9DirectionE", !7, i64 0}
!34 = !{i8 0, i8 2}
!35 = !{}


; 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 }
%"struct.std::pair.248" = type { i32, i32 }

@_ZN3simL21DIRECTION_ROTATE_LEFTE = external hidden global %"class.std::map.67", align 8

; 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 uwtable
declare dso_local { i64, i32 } @_ZSt9make_pairISt4pairIiiERKN3sim9DirectionEES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS6_INS7_IT0_E4typeEE6__typeEEOS8_OSD_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN3sim14MouseInterface12wallLeftImplEbb(ptr noundef nonnull align 8 dereferenceable(296) %0, i1 noundef zeroext %1, i1 noundef zeroext %2) local_unnamed_addr #1 align 2 {
  %4 = alloca %"struct.std::pair.248", align 8
  %5 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = tail call i64 @_ZNK3sim5Mouse32getCurrentDiscretizedTranslationEv(ptr noundef nonnull align 8 dereferenceable(528) %7)
  store i64 %8, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #3
  %9 = load ptr, ptr %6, align 8, !tbaa !5
  %10 = tail call noundef i32 @_ZNK3sim5Mouse29getCurrentDiscretizedRotationEv(ptr noundef nonnull align 8 dereferenceable(528) %9)
  store i32 %10, ptr %5, align 4, !tbaa !30
  %11 = 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) %5)
  %12 = call { i64, i32 } @_ZSt9make_pairISt4pairIiiERKN3sim9DirectionEES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS6_INS7_IT0_E4typeEE6__typeEEOS8_OSD_(ptr noundef nonnull align 4 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %.fca.0.extract = extractvalue { i64, i32 } %12, 0
  %.fca.1.extract = extractvalue { i64, i32 } %12, 1
  %13 = call noundef zeroext i1 @_ZN3sim14MouseInterface6isWallESt4pairIS1_IiiENS_9DirectionEEbb(ptr noundef nonnull align 8 dereferenceable(296) %0, i64 %.fca.0.extract, i32 %.fca.1.extract, i1 noundef zeroext %1, i1 noundef zeroext %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  ret i1 %13
}

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: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3sim14MouseInterface6isWallESt4pairIS1_IiiENS_9DirectionEEbb(ptr noundef nonnull align 8 dereferenceable(296), i64, i32, i1 noundef zeroext, i1 noundef zeroext) local_unnamed_addr #1 align 2

; 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 #1 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "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, !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 = !{!31, !31, i64 0}
!31 = !{!"_ZTSN3sim9DirectionE", !8, i64 0}


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