; 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"

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3sim14MouseInterface17undeclareWallImplESt4pairIS1_IiiENS_9DirectionEEb(ptr noundef nonnull align 8 dereferenceable(296) %0, i64 %1, i32 %2, i1 noundef zeroext %3) #1 align 2 {
  %5 = alloca %"struct.std::pair.250", align 4
  %6 = alloca { i64, i32 }, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i8, align 1
  %9 = alloca %"struct.std::pair.250", align 4
  %10 = alloca { i64, i32 }, align 4
  %11 = alloca %"struct.std::pair.250", align 4
  %12 = alloca %"struct.std::pair.250", align 4
  %13 = alloca { i64, i32 }, align 4
  %14 = alloca { i64, i32 }, align 8
  %15 = alloca { i64, i32 }, align 4
  %16 = getelementptr inbounds { i64, i32 }, ptr %6, i32 0, i32 0
  store i64 %1, ptr %16, align 4
  %17 = getelementptr inbounds { i64, i32 }, ptr %6, i32 0, i32 1
  store i32 %2, ptr %17, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %5, ptr align 4 %6, i64 12, i1 false)
  store ptr %0, ptr %7, align 8, !tbaa !5
  %18 = zext i1 %3 to i8
  store i8 %18, ptr %8, align 1, !tbaa !9
  %19 = load ptr, ptr %7, align 8
  %20 = getelementptr inbounds %"class.sim::MouseInterface", ptr %19, i32 0, i32 2
  %21 = load ptr, ptr %20, align 8, !tbaa !11
  %22 = getelementptr inbounds %"struct.std::pair.250", ptr %5, i32 0, i32 0
  %23 = getelementptr inbounds %"struct.std::pair.248", ptr %22, i32 0, i32 0
  %24 = load i32, ptr %23, align 4, !tbaa !32
  %25 = getelementptr inbounds %"struct.std::pair.250", ptr %5, i32 0, i32 0
  %26 = getelementptr inbounds %"struct.std::pair.248", ptr %25, i32 0, i32 1
  %27 = load i32, ptr %26, align 4, !tbaa !36
  %28 = getelementptr inbounds %"struct.std::pair.250", ptr %5, i32 0, i32 1
  %29 = load i32, ptr %28, align 4, !tbaa !37
  call void @_ZN3sim11MazeGraphic13undeclareWallEiiNS_9DirectionE(ptr noundef nonnull align 8 dereferenceable(24) %21, i32 noundef %24, i32 noundef %27, i32 noundef %29)
  %30 = load i8, ptr %8, align 1, !tbaa !9, !range !38, !noundef !39
  %31 = trunc i8 %30 to i1
  br i1 %31, label %32, label %48

32:                                               ; preds = %4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %9, ptr align 4 %5, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %10, ptr align 4 %9, i64 12, i1 false)
  %33 = getelementptr inbounds { i64, i32 }, ptr %10, i32 0, i32 0
  %34 = load i64, ptr %33, align 4
  %35 = getelementptr inbounds { i64, i32 }, ptr %10, i32 0, i32 1
  %36 = load i32, ptr %35, align 4
  %37 = call noundef zeroext i1 @_ZNK3sim14MouseInterface15hasOpposingWallESt4pairIS1_IiiENS_9DirectionEE(ptr noundef nonnull align 8 dereferenceable(296) %19, i64 %34, i32 %36)
  br i1 %37, label %38, label %48

38:                                               ; preds = %32
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %12, ptr align 4 %5, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 4 %12, i64 12, i1 false)
  %39 = getelementptr inbounds { i64, i32 }, ptr %13, i32 0, i32 0
  %40 = load i64, ptr %39, align 4
  %41 = getelementptr inbounds { i64, i32 }, ptr %13, i32 0, i32 1
  %42 = load i32, ptr %41, align 4
  %43 = call { i64, i32 } @_ZNK3sim14MouseInterface15getOpposingWallESt4pairIS1_IiiENS_9DirectionEE(ptr noundef nonnull align 8 dereferenceable(296) %19, i64 %40, i32 %42)
  store { i64, i32 } %43, ptr %14, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %11, ptr align 8 %14, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %11, i64 12, i1 false)
  %44 = getelementptr inbounds { i64, i32 }, ptr %15, i32 0, i32 0
  %45 = load i64, ptr %44, align 4
  %46 = getelementptr inbounds { i64, i32 }, ptr %15, i32 0, i32 1
  %47 = load i32, ptr %46, align 4
  call void @_ZN3sim14MouseInterface17undeclareWallImplESt4pairIS1_IiiENS_9DirectionEEb(ptr noundef nonnull align 8 dereferenceable(296) %19, i64 %45, i32 %47, i1 noundef zeroext false)
  br label %48

48:                                               ; preds = %38, %32, %4
  ret void
}

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

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

declare void @_ZN3sim11MazeGraphic13undeclareWallEiiNS_9DirectionE(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef, i32 noundef) #2

attributes #0 = { nocallback nofree 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" }

!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 16}
!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, !25, i64 0}
!33 = !{!"_ZTSSt4pairIS_IiiEN3sim9DirectionEE", !34, i64 0, !35, i64 8}
!34 = !{!"_ZTSSt4pairIiiE", !25, i64 0, !25, i64 4}
!35 = !{!"_ZTSN3sim9DirectionE", !7, i64 0}
!36 = !{!33, !25, i64 4}
!37 = !{!33, !35, i64 8}
!38 = !{i8 0, i8 2}
!39 = !{}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3sim14MouseInterface17undeclareWallImplESt4pairIS1_IiiENS_9DirectionEEb(ptr noundef nonnull align 8 dereferenceable(296) %0, i64 %1, i32 %2, i1 noundef zeroext %3) local_unnamed_addr #0 align 2 {
  %.sroa.015.0.extract.trunc = trunc i64 %1 to i32
  %.sroa.4.0.extract.shift = lshr i64 %1, 32
  %.sroa.4.0.extract.trunc = trunc nuw i64 %.sroa.4.0.extract.shift to i32
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  tail call void @_ZN3sim11MazeGraphic13undeclareWallEiiNS_9DirectionE(ptr noundef nonnull align 8 dereferenceable(24) %6, i32 noundef %.sroa.015.0.extract.trunc, i32 noundef %.sroa.4.0.extract.trunc, i32 noundef %2)
  br i1 %3, label %7, label %12

7:                                                ; preds = %4
  %8 = tail call noundef zeroext i1 @_ZNK3sim14MouseInterface15hasOpposingWallESt4pairIS1_IiiENS_9DirectionEE(ptr noundef nonnull align 8 dereferenceable(296) %0, i64 %1, i32 %2)
  br i1 %8, label %9, label %12

9:                                                ; preds = %7
  %10 = tail call { i64, i32 } @_ZNK3sim14MouseInterface15getOpposingWallESt4pairIS1_IiiENS_9DirectionEE(ptr noundef nonnull align 8 dereferenceable(296) %0, i64 %1, i32 %2)
  %.fca.0.extract = extractvalue { i64, i32 } %10, 0
  %.fca.1.extract = extractvalue { i64, i32 } %10, 1
  %.sroa.015.0.extract.trunc.i = trunc i64 %.fca.0.extract to i32
  %.sroa.4.0.extract.shift.i = lshr i64 %.fca.0.extract, 32
  %.sroa.4.0.extract.trunc.i = trunc nuw i64 %.sroa.4.0.extract.shift.i to i32
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  tail call void @_ZN3sim11MazeGraphic13undeclareWallEiiNS_9DirectionE(ptr noundef nonnull align 8 dereferenceable(24) %11, i32 noundef %.sroa.015.0.extract.trunc.i, i32 noundef %.sroa.4.0.extract.trunc.i, i32 noundef %.fca.1.extract)
  br label %12

12:                                               ; preds = %9, %7, %4
  ret void
}

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

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

declare void @_ZN3sim11MazeGraphic13undeclareWallEiiNS_9DirectionE(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "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, !7, i64 16}
!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"}


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