; LLVM IR from Whittler23/A-star-algorithm-SFML :: src/grid.ll (ZN4Grid13getNeighboursEP4Node)

; 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::vector.9" = type { %"struct.std::_Vector_base.10" }
%"struct.std::_Vector_base.10" = type { %"struct.std::_Vector_base<Node *, std::allocator<Node *>>::_Vector_impl" }
%"struct.std::_Vector_base<Node *, std::allocator<Node *>>::_Vector_impl" = type { %"struct.std::_Vector_base<Node *, std::allocator<Node *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Node *, std::allocator<Node *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.sf::Vector2" = type { i32, i32 }
%class.Grid = type <{ %"class.sf::Drawable", %"class.std::vector", ptr, ptr, i32, i32, i32, i8, [3 x i8] }>
%"class.sf::Drawable" = type { ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::unique_ptr<Node>, std::allocator<std::unique_ptr<Node>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::unique_ptr<Node>, std::allocator<std::unique_ptr<Node>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::unique_ptr<Node>, std::allocator<std::unique_ptr<Node>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::unique_ptr<Node>, std::allocator<std::unique_ptr<Node>>>::_Vector_impl_data" = type { ptr, ptr, ptr }

declare i32 @__gxx_personality_v0(...)

; 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: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN4Grid16isPositionProperEii(ptr noundef nonnull align 8 dereferenceable(61), i32 noundef, i32 noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN4Grid14getNodeInWorldEii(ptr noundef nonnull align 8 dereferenceable(61), i32 noundef, i32 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Grid13getNeighboursEP4Node(ptr dead_on_unwind noalias writable sret(%"class.std::vector.9") align 8 %0, ptr noundef nonnull align 8 dereferenceable(61) %1, ptr noundef %2) #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i1, align 1
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %"class.sf::Vector2", align 4
  %15 = alloca i32, align 4
  %16 = alloca %"class.sf::Vector2", align 4
  %17 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %18 = load ptr, ptr %5, align 8
  store i1 false, ptr %7, align 1
  call void @_ZNSt6vectorIP4NodeSaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  invoke void @_ZNSt6vectorIP4NodeSaIS1_EE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 9)
          to label %19 unwind label %24

19:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 -1, ptr %10, align 4, !tbaa !9
  br label %20

20:                                               ; preds = %102, %19
  %21 = load i32, ptr %10, align 4, !tbaa !9
  %22 = icmp sle i32 %21, 1
  br i1 %22, label %28, label %23

23:                                               ; preds = %20
  store i32 2, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %105

24:                                               ; preds = %3
  %25 = landingpad { ptr, i32 }
          cleanup
  %26 = extractvalue { ptr, i32 } %25, 0
  store ptr %26, ptr %8, align 8
  %27 = extractvalue { ptr, i32 } %25, 1
  store i32 %27, ptr %9, align 4
  br label %109

28:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 -1, ptr %12, align 4, !tbaa !9
  br label %29

29:                                               ; preds = %91, %28
  %30 = load i32, ptr %12, align 4, !tbaa !9
  %31 = icmp sle i32 %30, 1
  br i1 %31, label %33, label %32

32:                                               ; preds = %29
  store i32 5, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %101

33:                                               ; preds = %29
  %34 = load i32, ptr %10, align 4, !tbaa !9
  %35 = load i32, ptr %12, align 4, !tbaa !9
  %36 = invoke noundef zeroext i1 @_ZN4Grid12shouldIgnoreEii(ptr noundef nonnull align 8 dereferenceable(61) %18, i32 noundef %34, i32 noundef %35)
          to label %37 unwind label %39

37:                                               ; preds = %33
  br i1 %36, label %38, label %43

38:                                               ; preds = %37
  br label %91

39:                                               ; preds = %33
  %40 = landingpad { ptr, i32 }
          cleanup
  %41 = extractvalue { ptr, i32 } %40, 0
  store ptr %41, ptr %8, align 8
  %42 = extractvalue { ptr, i32 } %40, 1
  store i32 %42, ptr %9, align 4
  br label %100

43:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = invoke i64 @_ZNK4Node11getPositionEv(ptr noundef nonnull align 8 dereferenceable(556) %44)
          to label %46 unwind label %69

46:                                               ; preds = %43
  store i64 %45, ptr %14, align 4
  %47 = getelementptr inbounds %"class.sf::Vector2", ptr %14, i32 0, i32 0
  %48 = load i32, ptr %47, align 4, !tbaa !11
  %49 = getelementptr inbounds %class.Grid, ptr %18, i32 0, i32 6
  %50 = load i32, ptr %49, align 8, !tbaa !13
  %51 = load i32, ptr %10, align 4, !tbaa !9
  %52 = mul nsw i32 %50, %51
  %53 = add nsw i32 %48, %52
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  store i32 %53, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = invoke i64 @_ZNK4Node11getPositionEv(ptr noundef nonnull align 8 dereferenceable(556) %54)
          to label %56 unwind label %73

56:                                               ; preds = %46
  store i64 %55, ptr %16, align 4
  %57 = getelementptr inbounds %"class.sf::Vector2", ptr %16, i32 0, i32 1
  %58 = load i32, ptr %57, align 4, !tbaa !21
  %59 = getelementptr inbounds %class.Grid, ptr %18, i32 0, i32 6
  %60 = load i32, ptr %59, align 8, !tbaa !13
  %61 = load i32, ptr %12, align 4, !tbaa !9
  %62 = mul nsw i32 %60, %61
  %63 = add nsw i32 %58, %62
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  store i32 %63, ptr %15, align 4, !tbaa !9
  %64 = load i32, ptr %13, align 4, !tbaa !9
  %65 = load i32, ptr %15, align 4, !tbaa !9
  %66 = invoke noundef zeroext i1 @_ZN4Grid16isPositionProperEii(ptr noundef nonnull align 8 dereferenceable(61) %18, i32 noundef %64, i32 noundef %65)
          to label %67 unwind label %77

67:                                               ; preds = %56
  br i1 %66, label %81, label %68

68:                                               ; preds = %67
  store i32 7, ptr %11, align 4
  br label %88

69:                                               ; preds = %43
  %70 = landingpad { ptr, i32 }
          cleanup
  %71 = extractvalue { ptr, i32 } %70, 0
  store ptr %71, ptr %8, align 8
  %72 = extractvalue { ptr, i32 } %70, 1
  store i32 %72, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  br label %99

73:                                               ; preds = %46
  %74 = landingpad { ptr, i32 }
          cleanup
  %75 = extractvalue { ptr, i32 } %74, 0
  store ptr %75, ptr %8, align 8
  %76 = extractvalue { ptr, i32 } %74, 1
  store i32 %76, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  br label %98

77:                                               ; preds = %56
  %78 = landingpad { ptr, i32 }
          cleanup
  %79 = extractvalue { ptr, i32 } %78, 0
  store ptr %79, ptr %8, align 8
  %80 = extractvalue { ptr, i32 } %78, 1
  store i32 %80, ptr %9, align 4
  br label %98

81:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %82 = load i32, ptr %13, align 4, !tbaa !9
  %83 = load i32, ptr %15, align 4, !tbaa !9
  %84 = invoke noundef ptr @_ZN4Grid14getNodeInWorldEii(ptr noundef nonnull align 8 dereferenceable(61) %18, i32 noundef %82, i32 noundef %83)
          to label %85 unwind label %94

85:                                               ; preds = %81
  store ptr %84, ptr %17, align 8, !tbaa !5
  %86 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP4NodeSaIS1_EE12emplace_backIJRS1_EEES5_DpOT_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(8) %17)
          to label %87 unwind label %94

87:                                               ; preds = %85
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  store i32 0, ptr %11, align 4
  br label %88

88:                                               ; preds = %87, %68
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  %89 = load i32, ptr %11, align 4
  switch i32 %89, label %115 [
    i32 0, label %90
    i32 7, label %91
  ]

90:                                               ; preds = %88
  br label %91

91:                                               ; preds = %90, %88, %38
  %92 = load i32, ptr %12, align 4, !tbaa !9
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %12, align 4, !tbaa !9
  br label %29, !llvm.loop !22

94:                                               ; preds = %85, %81
  %95 = landingpad { ptr, i32 }
          cleanup
  %96 = extractvalue { ptr, i32 } %95, 0
  store ptr %96, ptr %8, align 8
  %97 = extractvalue { ptr, i32 } %95, 1
  store i32 %97, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  br label %98

98:                                               ; preds = %94, %77, %73
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %99

99:                                               ; preds = %98, %69
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %100

100:                                              ; preds = %99, %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %109

101:                                              ; preds = %32
  br label %102

102:                                              ; preds = %101
  %103 = load i32, ptr %10, align 4, !tbaa !9
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %10, align 4, !tbaa !9
  br label %20, !llvm.loop !24

105:                                              ; preds = %23
  store i1 true, ptr %7, align 1
  store i32 1, ptr %11, align 4
  %106 = load i1, ptr %7, align 1
  br i1 %106, label %108, label %107

107:                                              ; preds = %105
  call void @_ZNSt6vectorIP4NodeSaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  br label %108

108:                                              ; preds = %107, %105
  ret void

109:                                              ; preds = %100, %24
  call void @_ZNSt6vectorIP4NodeSaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  br label %110

110:                                              ; preds = %109
  %111 = load ptr, ptr %8, align 8
  %112 = load i32, ptr %9, align 4
  %113 = insertvalue { ptr, i32 } poison, ptr %111, 0
  %114 = insertvalue { ptr, i32 } %113, i32 %112, 1
  resume { ptr, i32 } %114

115:                                              ; preds = %88
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIP4NodeSaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIP4NodeSaIS1_EE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 align 2

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

declare i64 @_ZNK4Node11getPositionEv(ptr noundef nonnull align 8 dereferenceable(556)) #3

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIP4NodeSaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_ZTSN2sf7Vector2IiEE", !10, i64 0, !10, i64 4}
!13 = !{!14, !10, i64 56}
!14 = !{!"_ZTS4Grid", !15, i64 0, !16, i64 8, !6, i64 32, !6, i64 40, !10, i64 48, !10, i64 52, !10, i64 56, !20, i64 60}
!15 = !{!"_ZTSN2sf8DrawableE"}
!16 = !{!"_ZTSSt6vectorISt10unique_ptrI4NodeSt14default_deleteIS1_EESaIS4_EE", !17, i64 0}
!17 = !{!"_ZTSSt12_Vector_baseISt10unique_ptrI4NodeSt14default_deleteIS1_EESaIS4_EE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseISt10unique_ptrI4NodeSt14default_deleteIS1_EESaIS4_EE12_Vector_implE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseISt10unique_ptrI4NodeSt14default_deleteIS1_EESaIS4_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!20 = !{!"bool", !7, i64 0}
!21 = !{!12, !10, i64 4}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = distinct !{!24, !23}


; 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::vector.9" = type { %"struct.std::_Vector_base.10" }
%"struct.std::_Vector_base.10" = type { %"struct.std::_Vector_base<Node *, std::allocator<Node *>>::_Vector_impl" }
%"struct.std::_Vector_base<Node *, std::allocator<Node *>>::_Vector_impl" = type { %"struct.std::_Vector_base<Node *, std::allocator<Node *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Node *, std::allocator<Node *>>::_Vector_impl_data" = type { ptr, ptr, ptr }

declare i32 @__gxx_personality_v0(...)

; 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 nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN4Grid16isPositionProperEii(ptr noundef nonnull align 8 dereferenceable(61), i32 noundef, i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN4Grid14getNodeInWorldEii(ptr noundef nonnull align 8 dereferenceable(61), i32 noundef, i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Grid13getNeighboursEP4Node(ptr dead_on_unwind noalias nonnull writable sret(%"class.std::vector.9") align 8 %0, ptr noundef nonnull align 8 dereferenceable(61) %1, ptr noundef %2) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  tail call void @_ZNSt6vectorIP4NodeSaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  invoke void @_ZNSt6vectorIP4NodeSaIS1_EE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 9)
          to label %.preheader28 unwind label %7

.preheader28:                                     ; preds = %3
  %5 = getelementptr inbounds i8, ptr %1, i64 56
  %6 = invoke noundef zeroext i1 @_ZN4Grid12shouldIgnoreEii(ptr noundef nonnull align 8 dereferenceable(61) %1, i32 noundef -1, i32 noundef -1)
          to label %9 unwind label %10

7:                                                ; preds = %3
  %8 = landingpad { ptr, i32 }
          cleanup
  br label %155

9:                                                ; preds = %.preheader28
  br i1 %6, label %30, label %12

10:                                               ; preds = %135, %120, %.preheader.2, %89, %76, %.preheader.1, %45, %30, %.preheader28
  %11 = landingpad { ptr, i32 }
          cleanup
  br label %155

12:                                               ; preds = %9
  %13 = invoke i64 @_ZNK4Node11getPositionEv(ptr noundef nonnull align 8 dereferenceable(556) %2)
          to label %14 unwind label %22

14:                                               ; preds = %12
  %.sroa.02.0.extract.trunc = trunc i64 %13 to i32
  %15 = load i32, ptr %5, align 8, !tbaa !5
  %16 = sub nsw i32 %.sroa.02.0.extract.trunc, %15
  %17 = invoke i64 @_ZNK4Node11getPositionEv(ptr noundef nonnull align 8 dereferenceable(556) %2)
          to label %18 unwind label %24

18:                                               ; preds = %14
  %.sroa.4.0.extract.shift = lshr i64 %17, 32
  %.sroa.4.0.extract.trunc = trunc nuw i64 %.sroa.4.0.extract.shift to i32
  %19 = load i32, ptr %5, align 8, !tbaa !5
  %20 = sub nsw i32 %.sroa.4.0.extract.trunc, %19
  %21 = tail call noundef zeroext i1 @_ZN4Grid16isPositionProperEii(ptr noundef nonnull align 8 dereferenceable(61) %1, i32 noundef %16, i32 noundef %20)
  br i1 %21, label %26, label %30

22:                                               ; preds = %138, %123, %106, %92, %79, %64, %48, %33, %12
  %23 = landingpad { ptr, i32 }
          cleanup
  br label %155

24:                                               ; preds = %140, %125, %108, %94, %81, %66, %50, %35, %14
  %25 = landingpad { ptr, i32 }
          cleanup
  br label %155

26:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %27 = tail call noundef ptr @_ZN4Grid14getNodeInWorldEii(ptr noundef nonnull align 8 dereferenceable(61) %1, i32 noundef %16, i32 noundef %20)
  store ptr %27, ptr %4, align 8, !tbaa !17
  %28 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP4NodeSaIS1_EE12emplace_backIJRS1_EEES5_DpOT_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %29 unwind label %153

29:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  br label %30

30:                                               ; preds = %29, %18, %9
  %31 = invoke noundef zeroext i1 @_ZN4Grid12shouldIgnoreEii(ptr noundef nonnull align 8 dereferenceable(61) %1, i32 noundef -1, i32 noundef 0)
          to label %32 unwind label %10

32:                                               ; preds = %30
  br i1 %31, label %45, label %33

33:                                               ; preds = %32
  %34 = invoke i64 @_ZNK4Node11getPositionEv(ptr noundef nonnull align 8 dereferenceable(556) %2)
          to label %35 unwind label %22

35:                                               ; preds = %33
  %.sroa.02.0.extract.trunc.1 = trunc i64 %34 to i32
  %36 = load i32, ptr %5, align 8, !tbaa !5
  %37 = sub nsw i32 %.sroa.02.0.extract.trunc.1, %36
  %38 = invoke i64 @_ZNK4Node11getPositionEv(ptr noundef nonnull align 8 dereferenceable(556) %2)
          to label %39 unwind label %24

39:                                               ; preds = %35
  %.sroa.4.0.extract.shift.1 = lshr i64 %38, 32
  %.sroa.4.0.extract.trunc.1 = trunc nuw i64 %.sroa.4.0.extract.shift.1 to i32
  %40 = call noundef zeroext i1 @_ZN4Grid16isPositionProperEii(ptr noundef nonnull align 8 dereferenceable(61) %1, i32 noundef %37, i32 noundef %.sroa.4.0.extract.trunc.1)
  br i1 %40, label %41, label %45

41:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %42 = call noundef ptr @_ZN4Grid14getNodeInWorldEii(ptr noundef nonnull align 8 dereferenceable(61) %1, i32 noundef %37, i32 noundef %.sroa.4.0.extract.trunc.1)
  store ptr %42, ptr %4, align 8, !tbaa !17
  %43 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP4NodeSaIS1_EE12emplace_backIJRS1_EEES5_DpOT_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %44 unwind label %153

44:                                               ; preds = %41
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  br label %45

45:                                               ; preds = %44, %39, %32
  %46 = invoke noundef zeroext i1 @_ZN4Grid12shouldIgnoreEii(ptr noundef nonnull align 8 dereferenceable(61) %1, i32 noundef -1, i32 noundef 1)
          to label %47 unwind label %10

47:                                               ; preds = %45
  br i1 %46, label %.preheader.1, label %48

48:                                               ; preds = %47
  %49 = invoke i64 @_ZNK4Node11getPositionEv(ptr noundef nonnull align 8 dereferenceable(556) %2)
          to label %50 unwind label %22

50:                                               ; preds = %48
  %.sroa.02.0.extract.trunc.2 = trunc i64 %49 to i32
  %51 = load i32, ptr %5, align 8, !tbaa !5
  %52 = sub nsw i32 %.sroa.02.0.extract.trunc.2, %51
  %53 = invoke i64 @_ZNK4Node11getPositionEv(ptr noundef nonnull align 8 dereferenceable(556) %2)
          to label %54 unwind label %24

54:                                               ; preds = %50
  %.sroa.4.0.extract.shift.2 = lshr i64 %53, 32
  %.sroa.4.0.extract.trunc.2 = trunc nuw i64 %.sroa.4.0.extract.shift.2 to i32
  %55 = load i32, ptr %5, align 8, !tbaa !5
  %56 = add nsw i32 %55, %.sroa.4.0.extract.trunc.2
  %57 = call noundef zeroext i1 @_ZN4Grid16isPositionProperEii(ptr noundef nonnull align 8 dereferenceable(61) %1, i32 noundef %52, i32 noundef %56)
  br i1 %57, label %58, label %.preheader.1

58:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %59 = call noundef ptr @_ZN4Grid14getNodeInWorldEii(ptr noundef nonnull align 8 dereferenceable(61) %1, i32 noundef %52, i32 noundef %56)
  store ptr %59, ptr %4, align 8, !tbaa !17
  %60 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP4NodeSaIS1_EE12emplace_backIJRS1_EEES5_DpOT_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %61 unwind label %153

61:                                               ; preds = %58
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  br label %.preheader.1

.preheader.1:                                     ; preds = %61, %54, %47
  %62 = invoke noundef zeroext i1 @_ZN4Grid12shouldIgnoreEii(ptr noundef nonnull align 8 dereferenceable(61) %1, i32 noundef 0, i32 noundef -1)
          to label %63 unwind label %10

63:                                               ; preds = %.preheader.1
  br i1 %62, label %76, label %64

64:                                               ; preds = %63
  %65 = invoke i64 @_ZNK4Node11getPositionEv(ptr noundef nonnull align 8 dereferenceable(556) %2)
          to label %66 unwind label %22

66:                                               ; preds = %64
  %.sroa.02.0.extract.trunc.131 = trunc i64 %65 to i32
  %67 = invoke i64 @_ZNK4Node11getPositionEv(ptr noundef nonnull align 8 dereferenceable(556) %2)
          to label %68 unwind label %24

68:                                               ; preds = %66
  %.sroa.4.0.extract.shift.132 = lshr i64 %67, 32
  %.sroa.4.0.extract.trunc.133 = trunc nuw i64 %.sroa.4.0.extract.shift.132 to i32
  %69 = load i32, ptr %5, align 8, !tbaa !5
  %70 = sub nsw i32 %.sroa.4.0.extract.trunc.133, %69
  %71 = call noundef zeroext i1 @_ZN4Grid16isPositionProperEii(ptr noundef nonnull align 8 dereferenceable(61) %1, i32 noundef %.sroa.02.0.extract.trunc.131, i32 noundef %70)
  br i1 %71, label %72, label %76

72:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %73 = call noundef ptr @_ZN4Grid14getNodeInWorldEii(ptr noundef nonnull align 8 dereferenceable(61) %1, i32 noundef %.sroa.02.0.extract.trunc.131, i32 noundef %70)
  store ptr %73, ptr %4, align 8, !tbaa !17
  %74 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP4NodeSaIS1_EE12emplace_backIJRS1_EEES5_DpOT_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %75 unwind label %153

75:                                               ; preds = %72
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  br label %76

76:                                               ; preds = %75, %68, %63
  %77 = invoke noundef zeroext i1 @_ZN4Grid12shouldIgnoreEii(ptr noundef nonnull align 8 dereferenceable(61) %1, i32 noundef 0, i32 noundef 0)
          to label %78 unwind label %10

78:                                               ; preds = %76
  br i1 %77, label %89, label %79

79:                                               ; preds = %78
  %80 = invoke i64 @_ZNK4Node11getPositionEv(ptr noundef nonnull align 8 dereferenceable(556) %2)
          to label %81 unwind label %22

81:                                               ; preds = %79
  %.sroa.02.0.extract.trunc.1.1 = trunc i64 %80 to i32
  %82 = invoke i64 @_ZNK4Node11getPositionEv(ptr noundef nonnull align 8 dereferenceable(556) %2)
          to label %83 unwind label %24

83:                                               ; preds = %81
  %.sroa.4.0.extract.shift.1.1 = lshr i64 %82, 32
  %.sroa.4.0.extract.trunc.1.1 = trunc nuw i64 %.sroa.4.0.extract.shift.1.1 to i32
  %84 = call noundef zeroext i1 @_ZN4Grid16isPositionProperEii(ptr noundef nonnull align 8 dereferenceable(61) %1, i32 noundef %.sroa.02.0.extract.trunc.1.1, i32 noundef %.sroa.4.0.extract.trunc.1.1)
  br i1 %84, label %85, label %89

85:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %86 = call noundef ptr @_ZN4Grid14getNodeInWorldEii(ptr noundef nonnull align 8 dereferenceable(61) %1, i32 noundef %.sroa.02.0.extract.trunc.1.1, i32 noundef %.sroa.4.0.extract.trunc.1.1)
  store ptr %86, ptr %4, align 8, !tbaa !17
  %87 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP4NodeSaIS1_EE12emplace_backIJRS1_EEES5_DpOT_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %88 unwind label %153

88:                                               ; preds = %85
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  br label %89

89:                                               ; preds = %88, %83, %78
  %90 = invoke noundef zeroext i1 @_ZN4Grid12shouldIgnoreEii(ptr noundef nonnull align 8 dereferenceable(61) %1, i32 noundef 0, i32 noundef 1)
          to label %91 unwind label %10

91:                                               ; preds = %89
  br i1 %90, label %.preheader.2, label %92

92:                                               ; preds = %91
  %93 = invoke i64 @_ZNK4Node11getPositionEv(ptr noundef nonnull align 8 dereferenceable(556) %2)
          to label %94 unwind label %22

94:                                               ; preds = %92
  %.sroa.02.0.extract.trunc.2.1 = trunc i64 %93 to i32
  %95 = invoke i64 @_ZNK4Node11getPositionEv(ptr noundef nonnull align 8 dereferenceable(556) %2)
          to label %96 unwind label %24

96:                                               ; preds = %94
  %.sroa.4.0.extract.shift.2.1 = lshr i64 %95, 32
  %.sroa.4.0.extract.trunc.2.1 = trunc nuw i64 %.sroa.4.0.extract.shift.2.1 to i32
  %97 = load i32, ptr %5, align 8, !tbaa !5
  %98 = add nsw i32 %97, %.sroa.4.0.extract.trunc.2.1
  %99 = call noundef zeroext i1 @_ZN4Grid16isPositionProperEii(ptr noundef nonnull align 8 dereferenceable(61) %1, i32 noundef %.sroa.02.0.extract.trunc.2.1, i32 noundef %98)
  br i1 %99, label %100, label %.preheader.2

100:                                              ; preds = %96
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %101 = call noundef ptr @_ZN4Grid14getNodeInWorldEii(ptr noundef nonnull align 8 dereferenceable(61) %1, i32 noundef %.sroa.02.0.extract.trunc.2.1, i32 noundef %98)
  store ptr %101, ptr %4, align 8, !tbaa !17
  %102 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP4NodeSaIS1_EE12emplace_backIJRS1_EEES5_DpOT_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %103 unwind label %153

103:                                              ; preds = %100
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  br label %.preheader.2

.preheader.2:                                     ; preds = %103, %96, %91
  %104 = invoke noundef zeroext i1 @_ZN4Grid12shouldIgnoreEii(ptr noundef nonnull align 8 dereferenceable(61) %1, i32 noundef 1, i32 noundef -1)
          to label %105 unwind label %10

105:                                              ; preds = %.preheader.2
  br i1 %104, label %120, label %106

106:                                              ; preds = %105
  %107 = invoke i64 @_ZNK4Node11getPositionEv(ptr noundef nonnull align 8 dereferenceable(556) %2)
          to label %108 unwind label %22

108:                                              ; preds = %106
  %.sroa.02.0.extract.trunc.234 = trunc i64 %107 to i32
  %109 = load i32, ptr %5, align 8, !tbaa !5
  %110 = add nsw i32 %109, %.sroa.02.0.extract.trunc.234
  %111 = invoke i64 @_ZNK4Node11getPositionEv(ptr noundef nonnull align 8 dereferenceable(556) %2)
          to label %112 unwind label %24

112:                                              ; preds = %108
  %.sroa.4.0.extract.shift.235 = lshr i64 %111, 32
  %.sroa.4.0.extract.trunc.236 = trunc nuw i64 %.sroa.4.0.extract.shift.235 to i32
  %113 = load i32, ptr %5, align 8, !tbaa !5
  %114 = sub nsw i32 %.sroa.4.0.extract.trunc.236, %113
  %115 = call noundef zeroext i1 @_ZN4Grid16isPositionProperEii(ptr noundef nonnull align 8 dereferenceable(61) %1, i32 noundef %110, i32 noundef %114)
  br i1 %115, label %116, label %120

116:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %117 = call noundef ptr @_ZN4Grid14getNodeInWorldEii(ptr noundef nonnull align 8 dereferenceable(61) %1, i32 noundef %110, i32 noundef %114)
  store ptr %117, ptr %4, align 8, !tbaa !17
  %118 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP4NodeSaIS1_EE12emplace_backIJRS1_EEES5_DpOT_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %119 unwind label %153

119:                                              ; preds = %116
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  br label %120

120:                                              ; preds = %119, %112, %105
  %121 = invoke noundef zeroext i1 @_ZN4Grid12shouldIgnoreEii(ptr noundef nonnull align 8 dereferenceable(61) %1, i32 noundef 1, i32 noundef 0)
          to label %122 unwind label %10

122:                                              ; preds = %120
  br i1 %121, label %135, label %123

123:                                              ; preds = %122
  %124 = invoke i64 @_ZNK4Node11getPositionEv(ptr noundef nonnull align 8 dereferenceable(556) %2)
          to label %125 unwind label %22

125:                                              ; preds = %123
  %.sroa.02.0.extract.trunc.1.2 = trunc i64 %124 to i32
  %126 = load i32, ptr %5, align 8, !tbaa !5
  %127 = add nsw i32 %126, %.sroa.02.0.extract.trunc.1.2
  %128 = invoke i64 @_ZNK4Node11getPositionEv(ptr noundef nonnull align 8 dereferenceable(556) %2)
          to label %129 unwind label %24

129:                                              ; preds = %125
  %.sroa.4.0.extract.shift.1.2 = lshr i64 %128, 32
  %.sroa.4.0.extract.trunc.1.2 = trunc nuw i64 %.sroa.4.0.extract.shift.1.2 to i32
  %130 = call noundef zeroext i1 @_ZN4Grid16isPositionProperEii(ptr noundef nonnull align 8 dereferenceable(61) %1, i32 noundef %127, i32 noundef %.sroa.4.0.extract.trunc.1.2)
  br i1 %130, label %131, label %135

131:                                              ; preds = %129
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %132 = call noundef ptr @_ZN4Grid14getNodeInWorldEii(ptr noundef nonnull align 8 dereferenceable(61) %1, i32 noundef %127, i32 noundef %.sroa.4.0.extract.trunc.1.2)
  store ptr %132, ptr %4, align 8, !tbaa !17
  %133 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP4NodeSaIS1_EE12emplace_backIJRS1_EEES5_DpOT_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %134 unwind label %153

134:                                              ; preds = %131
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  br label %135

135:                                              ; preds = %134, %129, %122
  %136 = invoke noundef zeroext i1 @_ZN4Grid12shouldIgnoreEii(ptr noundef nonnull align 8 dereferenceable(61) %1, i32 noundef 1, i32 noundef 1)
          to label %137 unwind label %10

137:                                              ; preds = %135
  br i1 %136, label %152, label %138

138:                                              ; preds = %137
  %139 = invoke i64 @_ZNK4Node11getPositionEv(ptr noundef nonnull align 8 dereferenceable(556) %2)
          to label %140 unwind label %22

140:                                              ; preds = %138
  %.sroa.02.0.extract.trunc.2.2 = trunc i64 %139 to i32
  %141 = load i32, ptr %5, align 8, !tbaa !5
  %142 = add nsw i32 %141, %.sroa.02.0.extract.trunc.2.2
  %143 = invoke i64 @_ZNK4Node11getPositionEv(ptr noundef nonnull align 8 dereferenceable(556) %2)
          to label %144 unwind label %24

144:                                              ; preds = %140
  %.sroa.4.0.extract.shift.2.2 = lshr i64 %143, 32
  %.sroa.4.0.extract.trunc.2.2 = trunc nuw i64 %.sroa.4.0.extract.shift.2.2 to i32
  %145 = load i32, ptr %5, align 8, !tbaa !5
  %146 = add nsw i32 %145, %.sroa.4.0.extract.trunc.2.2
  %147 = call noundef zeroext i1 @_ZN4Grid16isPositionProperEii(ptr noundef nonnull align 8 dereferenceable(61) %1, i32 noundef %142, i32 noundef %146)
  br i1 %147, label %148, label %152

148:                                              ; preds = %144
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %149 = call noundef ptr @_ZN4Grid14getNodeInWorldEii(ptr noundef nonnull align 8 dereferenceable(61) %1, i32 noundef %142, i32 noundef %146)
  store ptr %149, ptr %4, align 8, !tbaa !17
  %150 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP4NodeSaIS1_EE12emplace_backIJRS1_EEES5_DpOT_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %151 unwind label %153

151:                                              ; preds = %148
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  br label %152

152:                                              ; preds = %151, %144, %137
  ret void

153:                                              ; preds = %148, %131, %116, %100, %85, %72, %58, %41, %26
  %154 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  br label %155

155:                                              ; preds = %10, %24, %153, %22, %7
  %.pn.pn.pn.pn = phi { ptr, i32 } [ %8, %7 ], [ %11, %10 ], [ %23, %22 ], [ %154, %153 ], [ %25, %24 ]
  call void @_ZNSt6vectorIP4NodeSaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  resume { ptr, i32 } %.pn.pn.pn.pn
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIP4NodeSaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIP4NodeSaIS1_EE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #2 align 2

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

declare i64 @_ZNK4Node11getPositionEv(ptr noundef nonnull align 8 dereferenceable(556)) local_unnamed_addr #3

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIP4NodeSaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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, !15, i64 56}
!6 = !{!"_ZTS4Grid", !7, i64 0, !8, i64 8, !12, i64 32, !12, i64 40, !15, i64 48, !15, i64 52, !15, i64 56, !16, i64 60}
!7 = !{!"_ZTSN2sf8DrawableE"}
!8 = !{!"_ZTSSt6vectorISt10unique_ptrI4NodeSt14default_deleteIS1_EESaIS4_EE", !9, i64 0}
!9 = !{!"_ZTSSt12_Vector_baseISt10unique_ptrI4NodeSt14default_deleteIS1_EESaIS4_EE", !10, i64 0}
!10 = !{!"_ZTSNSt12_Vector_baseISt10unique_ptrI4NodeSt14default_deleteIS1_EESaIS4_EE12_Vector_implE", !11, i64 0}
!11 = !{!"_ZTSNSt12_Vector_baseISt10unique_ptrI4NodeSt14default_deleteIS1_EESaIS4_EE17_Vector_impl_dataE", !12, i64 0, !12, i64 8, !12, i64 16}
!12 = !{!"any pointer", !13, i64 0}
!13 = !{!"omnipotent char", !14, i64 0}
!14 = !{!"Simple C++ TBAA"}
!15 = !{!"int", !13, i64 0}
!16 = !{!"bool", !13, i64 0}
!17 = !{!12, !12, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass