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

37:                                               ; preds = %5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %11, ptr align 4 %6, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %12, ptr align 4 %11, i64 12, i1 false)
  %38 = getelementptr inbounds { i64, i32 }, ptr %12, i32 0, i32 0
  %39 = load i64, ptr %38, align 4
  %40 = getelementptr inbounds { i64, i32 }, ptr %12, i32 0, i32 1
  %41 = load i32, ptr %40, align 4
  %42 = call noundef zeroext i1 @_ZNK3sim14MouseInterface15hasOpposingWallESt4pairIS1_IiiENS_9DirectionEE(ptr noundef nonnull align 8 dereferenceable(296) %22, i64 %39, i32 %41)
  br i1 %42, label %43, label %55

43:                                               ; preds = %37
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %14, ptr align 4 %6, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %14, 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
  %48 = call { i64, i32 } @_ZNK3sim14MouseInterface15getOpposingWallESt4pairIS1_IiiENS_9DirectionEE(ptr noundef nonnull align 8 dereferenceable(296) %22, i64 %45, i32 %47)
  store { i64, i32 } %48, ptr %16, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 8 %16, i64 12, i1 false)
  %49 = load i8, ptr %9, align 1, !tbaa !9, !range !38, !noundef !39
  %50 = trunc i8 %49 to i1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %17, ptr align 4 %13, i64 12, i1 false)
  %51 = getelementptr inbounds { i64, i32 }, ptr %17, i32 0, i32 0
  %52 = load i64, ptr %51, align 4
  %53 = getelementptr inbounds { i64, i32 }, ptr %17, i32 0, i32 1
  %54 = load i32, ptr %53, align 4
  call void @_ZN3sim14MouseInterface15declareWallImplESt4pairIS1_IiiENS_9DirectionEEbb(ptr noundef nonnull align 8 dereferenceable(296) %22, i64 %52, i32 %54, i1 noundef zeroext %50, i1 noundef zeroext false)
  br label %55

55:                                               ; preds = %43, %37, %5
  ret void
}

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

; 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

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 @_ZN3sim14MouseInterface15declareWallImplESt4pairIS1_IiiENS_9DirectionEEbb(ptr noundef nonnull align 8 dereferenceable(296) %0, i64 %1, i32 %2, i1 noundef zeroext %3, i1 noundef zeroext %4) local_unnamed_addr #0 align 2 {
  %.sroa.017.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
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  tail call void @_ZN3sim11MazeGraphic11declareWallEiiNS_9DirectionEb(ptr noundef nonnull align 8 dereferenceable(24) %7, i32 noundef %.sroa.017.0.extract.trunc, i32 noundef %.sroa.4.0.extract.trunc, i32 noundef %2, i1 noundef zeroext %3)
  br i1 %4, label %8, label %13

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

10:                                               ; preds = %8
  %11 = 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 } %11, 0
  %.fca.1.extract = extractvalue { i64, i32 } %11, 1
  %.sroa.017.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
  %12 = load ptr, ptr %6, align 8, !tbaa !5
  tail call void @_ZN3sim11MazeGraphic11declareWallEiiNS_9DirectionEb(ptr noundef nonnull align 8 dereferenceable(24) %12, i32 noundef %.sroa.017.0.extract.trunc.i, i32 noundef %.sroa.4.0.extract.trunc.i, i32 noundef %.fca.1.extract, i1 noundef zeroext %3)
  br label %13

13:                                               ; preds = %10, %8, %5
  ret void
}

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

; 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

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