; LLVM IR from Py-Contributors/AlgorithmsAndDataStructure :: C++/Algorithms/BranchAndBound/8Puzzle_problem.ll (Z5solvePA3_iiiS0_)

; 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::priority_queue" = type <{ %"class.std::vector", [8 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = 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 }
%struct.Node = type { ptr, [3 x [3 x i32]], i32, i32, i32, i32 }

@row = external dso_local global [4 x i32], align 16
@col = external dso_local global [4 x i32], align 16

; 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 uwtable
declare dso_local noundef ptr @_Z7newNodePA3_iiiiiiP4Node(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z13calculateCostPA3_iS0_(ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z6isSafeii(i32 noundef, i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z9printPathP4Node(ptr noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvePA3_iiiS0_(ptr noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3) #1 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca %"class.std::priority_queue", align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #4
  call void @_ZNSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %9)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = load i32, ptr %6, align 4, !tbaa !9
  %19 = load i32, ptr %7, align 4, !tbaa !9
  %20 = load i32, ptr %6, align 4, !tbaa !9
  %21 = load i32, ptr %7, align 4, !tbaa !9
  %22 = invoke noundef ptr @_Z7newNodePA3_iiiiiiP4Node(ptr noundef %17, i32 noundef %18, i32 noundef %19, i32 noundef %20, i32 noundef %21, i32 noundef 0, ptr noundef null)
          to label %23 unwind label %46

23:                                               ; preds = %4
  store ptr %22, ptr %10, align 8, !tbaa !5
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = load ptr, ptr %8, align 8, !tbaa !5
  %26 = call noundef i32 @_Z13calculateCostPA3_iS0_(ptr noundef %24, ptr noundef %25)
  %27 = load ptr, ptr %10, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.Node, ptr %27, i32 0, i32 4
  store i32 %26, ptr %28, align 4, !tbaa !11
  invoke void @_ZNSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(25) %9, ptr noundef nonnull align 8 dereferenceable(8) %10)
          to label %29 unwind label %46

29:                                               ; preds = %23
  br label %30

30:                                               ; preds = %130, %29
  %31 = invoke noundef zeroext i1 @_ZNKSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %9)
          to label %32 unwind label %46

32:                                               ; preds = %30
  %33 = xor i1 %31, true
  br i1 %33, label %34, label %132

34:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %35 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %9)
          to label %36 unwind label %50

36:                                               ; preds = %34
  %37 = load ptr, ptr %35, align 8, !tbaa !5
  store ptr %37, ptr %13, align 8, !tbaa !5
  invoke void @_ZNSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %9)
          to label %38 unwind label %50

38:                                               ; preds = %36
  %39 = load ptr, ptr %13, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.Node, ptr %39, i32 0, i32 4
  %41 = load i32, ptr %40, align 4, !tbaa !11
  %42 = icmp eq i32 %41, 0
  br i1 %42, label %43, label %54

43:                                               ; preds = %38
  %44 = load ptr, ptr %13, align 8, !tbaa !5
  invoke void @_Z9printPathP4Node(ptr noundef %44)
          to label %45 unwind label %50

45:                                               ; preds = %43
  store i32 1, ptr %14, align 4
  br label %128

46:                                               ; preds = %30, %23, %4
  %47 = landingpad { ptr, i32 }
          cleanup
  %48 = extractvalue { ptr, i32 } %47, 0
  store ptr %48, ptr %11, align 8
  %49 = extractvalue { ptr, i32 } %47, 1
  store i32 %49, ptr %12, align 4
  br label %136

50:                                               ; preds = %43, %36, %34
  %51 = landingpad { ptr, i32 }
          cleanup
  %52 = extractvalue { ptr, i32 } %51, 0
  store ptr %52, ptr %11, align 8
  %53 = extractvalue { ptr, i32 } %51, 1
  store i32 %53, ptr %12, align 4
  br label %131

54:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %55

55:                                               ; preds = %124, %54
  %56 = load i32, ptr %15, align 4, !tbaa !9
  %57 = icmp slt i32 %56, 4
  br i1 %57, label %59, label %58

58:                                               ; preds = %55
  store i32 4, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %127

59:                                               ; preds = %55
  %60 = load ptr, ptr %13, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.Node, ptr %60, i32 0, i32 2
  %62 = load i32, ptr %61, align 4, !tbaa !13
  %63 = load i32, ptr %15, align 4, !tbaa !9
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [4 x i32], ptr @row, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !9
  %67 = add nsw i32 %62, %66
  %68 = load ptr, ptr %13, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.Node, ptr %68, i32 0, i32 3
  %70 = load i32, ptr %69, align 8, !tbaa !14
  %71 = load i32, ptr %15, align 4, !tbaa !9
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [4 x i32], ptr @col, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !9
  %75 = add nsw i32 %70, %74
  %76 = call noundef i32 @_Z6isSafeii(i32 noundef %67, i32 noundef %75)
  %77 = icmp ne i32 %76, 0
  br i1 %77, label %78, label %123

78:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %79 = load ptr, ptr %13, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.Node, ptr %79, i32 0, i32 1
  %81 = getelementptr inbounds [3 x [3 x i32]], ptr %80, i64 0, i64 0
  %82 = load ptr, ptr %13, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.Node, ptr %82, i32 0, i32 2
  %84 = load i32, ptr %83, align 4, !tbaa !13
  %85 = load ptr, ptr %13, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.Node, ptr %85, i32 0, i32 3
  %87 = load i32, ptr %86, align 8, !tbaa !14
  %88 = load ptr, ptr %13, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.Node, ptr %88, i32 0, i32 2
  %90 = load i32, ptr %89, align 4, !tbaa !13
  %91 = load i32, ptr %15, align 4, !tbaa !9
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [4 x i32], ptr @row, i64 0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !9
  %95 = add nsw i32 %90, %94
  %96 = load ptr, ptr %13, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.Node, ptr %96, i32 0, i32 3
  %98 = load i32, ptr %97, align 8, !tbaa !14
  %99 = load i32, ptr %15, align 4, !tbaa !9
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [4 x i32], ptr @col, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !9
  %103 = add nsw i32 %98, %102
  %104 = load ptr, ptr %13, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.Node, ptr %104, i32 0, i32 5
  %106 = load i32, ptr %105, align 8, !tbaa !15
  %107 = add nsw i32 %106, 1
  %108 = load ptr, ptr %13, align 8, !tbaa !5
  %109 = invoke noundef ptr @_Z7newNodePA3_iiiiiiP4Node(ptr noundef %81, i32 noundef %84, i32 noundef %87, i32 noundef %95, i32 noundef %103, i32 noundef %107, ptr noundef %108)
          to label %110 unwind label %119

110:                                              ; preds = %78
  store ptr %109, ptr %16, align 8, !tbaa !5
  %111 = load ptr, ptr %16, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.Node, ptr %111, i32 0, i32 1
  %113 = getelementptr inbounds [3 x [3 x i32]], ptr %112, i64 0, i64 0
  %114 = load ptr, ptr %8, align 8, !tbaa !5
  %115 = call noundef i32 @_Z13calculateCostPA3_iS0_(ptr noundef %113, ptr noundef %114)
  %116 = load ptr, ptr %16, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.Node, ptr %116, i32 0, i32 4
  store i32 %115, ptr %117, align 4, !tbaa !11
  invoke void @_ZNSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(25) %9, ptr noundef nonnull align 8 dereferenceable(8) %16)
          to label %118 unwind label %119

118:                                              ; preds = %110
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  br label %123

119:                                              ; preds = %110, %78
  %120 = landingpad { ptr, i32 }
          cleanup
  %121 = extractvalue { ptr, i32 } %120, 0
  store ptr %121, ptr %11, align 8
  %122 = extractvalue { ptr, i32 } %120, 1
  store i32 %122, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %131

123:                                              ; preds = %118, %59
  br label %124

124:                                              ; preds = %123
  %125 = load i32, ptr %15, align 4, !tbaa !9
  %126 = add nsw i32 %125, 1
  store i32 %126, ptr %15, align 4, !tbaa !9
  br label %55, !llvm.loop !16

127:                                              ; preds = %58
  store i32 0, ptr %14, align 4
  br label %128

128:                                              ; preds = %127, %45
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  %129 = load i32, ptr %14, align 4
  switch i32 %129, label %133 [
    i32 0, label %130
  ]

130:                                              ; preds = %128
  br label %30, !llvm.loop !18

131:                                              ; preds = %119, %50
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  br label %136

132:                                              ; preds = %32
  store i32 0, ptr %14, align 4
  br label %133

133:                                              ; preds = %132, %128
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @_ZNSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %9) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #4
  %134 = load i32, ptr %14, align 4
  switch i32 %134, label %142 [
    i32 0, label %135
    i32 1, label %135
  ]

135:                                              ; preds = %133, %133
  ret void

136:                                              ; preds = %131, %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @_ZNSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %9) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #4
  br label %137

137:                                              ; preds = %136
  %138 = load ptr, ptr %11, align 8
  %139 = load i32, ptr %12, align 4
  %140 = insertvalue { ptr, i32 } poison, ptr %138, 0
  %141 = insertvalue { ptr, i32 } %140, i32 %139, 1
  resume { ptr, i32 } %141

142:                                              ; preds = %133
  unreachable
}

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(25), ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compE3topEv(ptr noundef nonnull align 8 dereferenceable(25)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compE3popEv(ptr noundef nonnull align 8 dereferenceable(25)) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compED2Ev(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #3 align 2

attributes #0 = { 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 = { 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 #3 = { 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 #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 52}
!12 = !{!"_ZTS4Node", !6, i64 0, !7, i64 8, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56}
!13 = !{!12, !10, i64 44}
!14 = !{!12, !10, i64 48}
!15 = !{!12, !10, i64 56}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}


; 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::priority_queue" = type <{ %"class.std::vector", [8 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = 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 }

@row = external dso_local local_unnamed_addr global [4 x i32], align 16
@col = external dso_local local_unnamed_addr global [4 x i32], align 16

; 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 noundef ptr @_Z7newNodePA3_iiiiiiP4Node(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z13calculateCostPA3_iS0_(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z6isSafeii(i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z9printPathP4Node(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvePA3_iiiS0_(ptr noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3) local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %5 = alloca %"class.std::priority_queue", align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #4
  call void @_ZNSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %5)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  %8 = invoke noundef ptr @_Z7newNodePA3_iiiiiiP4Node(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %1, i32 noundef %2, i32 noundef 0, ptr noundef null)
          to label %9 unwind label %30

9:                                                ; preds = %4
  store ptr %8, ptr %6, align 8, !tbaa !5
  %10 = call noundef i32 @_Z13calculateCostPA3_iS0_(ptr noundef %0, ptr noundef %3)
  %11 = getelementptr inbounds i8, ptr %8, i64 52
  store i32 %10, ptr %11, align 4, !tbaa !9
  invoke void @_ZNSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(25) %5, ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %.preheader34 unwind label %30

.preheader34:                                     ; preds = %9
  %12 = call noundef zeroext i1 @_ZNKSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %5)
  br i1 %12, label %.thread, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader34, %122
  %13 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %5)
  %14 = load ptr, ptr %13, align 8, !tbaa !5
  invoke void @_ZNSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %5)
          to label %15 unwind label %.loopexit

15:                                               ; preds = %.lr.ph
  %16 = getelementptr inbounds i8, ptr %14, i64 52
  %17 = load i32, ptr %16, align 4, !tbaa !9
  %.not33 = icmp eq i32 %17, 0
  br i1 %.not33, label %29, label %.preheader

.preheader:                                       ; preds = %15
  %18 = getelementptr inbounds i8, ptr %14, i64 44
  %19 = getelementptr inbounds i8, ptr %14, i64 48
  %20 = getelementptr inbounds i8, ptr %14, i64 8
  %21 = getelementptr inbounds i8, ptr %14, i64 56
  %22 = load i32, ptr %18, align 4, !tbaa !12
  %23 = load i32, ptr @row, align 16, !tbaa !13
  %24 = add nsw i32 %23, %22
  %25 = load i32, ptr %19, align 8, !tbaa !14
  %26 = load i32, ptr @col, align 16, !tbaa !13
  %27 = add nsw i32 %26, %25
  %28 = call noundef i32 @_Z6isSafeii(i32 noundef %24, i32 noundef %27)
  %.not = icmp eq i32 %28, 0
  br i1 %.not, label %50, label %32

29:                                               ; preds = %15
  invoke void @_Z9printPathP4Node(ptr noundef nonnull %14)
          to label %.thread unwind label %.loopexit.split-lp

30:                                               ; preds = %9, %4
  %31 = landingpad { ptr, i32 }
          cleanup
  br label %124

.loopexit:                                        ; preds = %.lr.ph
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %124

.loopexit.split-lp:                               ; preds = %29
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %124

32:                                               ; preds = %.preheader
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  %33 = load i32, ptr %18, align 4, !tbaa !12
  %34 = load i32, ptr %19, align 8, !tbaa !14
  %35 = load i32, ptr @row, align 16, !tbaa !13
  %36 = add nsw i32 %35, %33
  %37 = load i32, ptr @col, align 16, !tbaa !13
  %38 = add nsw i32 %37, %34
  %39 = load i32, ptr %21, align 8, !tbaa !15
  %40 = add nsw i32 %39, 1
  %41 = invoke noundef ptr @_Z7newNodePA3_iiiiiiP4Node(ptr noundef nonnull %20, i32 noundef %33, i32 noundef %34, i32 noundef %36, i32 noundef %38, i32 noundef %40, ptr noundef nonnull %14)
          to label %42 unwind label %48

42:                                               ; preds = %32
  store ptr %41, ptr %7, align 8, !tbaa !5
  %43 = getelementptr inbounds i8, ptr %41, i64 8
  %44 = call noundef i32 @_Z13calculateCostPA3_iS0_(ptr noundef nonnull %43, ptr noundef %3)
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = getelementptr inbounds i8, ptr %45, i64 52
  store i32 %44, ptr %46, align 4, !tbaa !9
  invoke void @_ZNSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(25) %5, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %47 unwind label %48

47:                                               ; preds = %42
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  br label %50

48:                                               ; preds = %116, %106, %92, %82, %68, %58, %42, %32
  %49 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  br label %124

50:                                               ; preds = %.preheader, %47
  %51 = load i32, ptr %18, align 4, !tbaa !12
  %52 = load i32, ptr getelementptr inbounds (i8, ptr @row, i64 4), align 4, !tbaa !13
  %53 = add nsw i32 %52, %51
  %54 = load i32, ptr %19, align 8, !tbaa !14
  %55 = load i32, ptr getelementptr inbounds (i8, ptr @col, i64 4), align 4, !tbaa !13
  %56 = add nsw i32 %55, %54
  %57 = call noundef i32 @_Z6isSafeii(i32 noundef %53, i32 noundef %56)
  %.not.1 = icmp eq i32 %57, 0
  br i1 %.not.1, label %74, label %58

58:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  %59 = load i32, ptr %18, align 4, !tbaa !12
  %60 = load i32, ptr %19, align 8, !tbaa !14
  %61 = load i32, ptr getelementptr inbounds (i8, ptr @row, i64 4), align 4, !tbaa !13
  %62 = add nsw i32 %61, %59
  %63 = load i32, ptr getelementptr inbounds (i8, ptr @col, i64 4), align 4, !tbaa !13
  %64 = add nsw i32 %63, %60
  %65 = load i32, ptr %21, align 8, !tbaa !15
  %66 = add nsw i32 %65, 1
  %67 = invoke noundef ptr @_Z7newNodePA3_iiiiiiP4Node(ptr noundef nonnull %20, i32 noundef %59, i32 noundef %60, i32 noundef %62, i32 noundef %64, i32 noundef %66, ptr noundef nonnull %14)
          to label %68 unwind label %48

68:                                               ; preds = %58
  store ptr %67, ptr %7, align 8, !tbaa !5
  %69 = getelementptr inbounds i8, ptr %67, i64 8
  %70 = call noundef i32 @_Z13calculateCostPA3_iS0_(ptr noundef nonnull %69, ptr noundef %3)
  %71 = load ptr, ptr %7, align 8, !tbaa !5
  %72 = getelementptr inbounds i8, ptr %71, i64 52
  store i32 %70, ptr %72, align 4, !tbaa !9
  invoke void @_ZNSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(25) %5, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %73 unwind label %48

73:                                               ; preds = %68
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  br label %74

74:                                               ; preds = %73, %50
  %75 = load i32, ptr %18, align 4, !tbaa !12
  %76 = load i32, ptr getelementptr inbounds (i8, ptr @row, i64 8), align 8, !tbaa !13
  %77 = add nsw i32 %76, %75
  %78 = load i32, ptr %19, align 8, !tbaa !14
  %79 = load i32, ptr getelementptr inbounds (i8, ptr @col, i64 8), align 8, !tbaa !13
  %80 = add nsw i32 %79, %78
  %81 = call noundef i32 @_Z6isSafeii(i32 noundef %77, i32 noundef %80)
  %.not.2 = icmp eq i32 %81, 0
  br i1 %.not.2, label %98, label %82

82:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  %83 = load i32, ptr %18, align 4, !tbaa !12
  %84 = load i32, ptr %19, align 8, !tbaa !14
  %85 = load i32, ptr getelementptr inbounds (i8, ptr @row, i64 8), align 8, !tbaa !13
  %86 = add nsw i32 %85, %83
  %87 = load i32, ptr getelementptr inbounds (i8, ptr @col, i64 8), align 8, !tbaa !13
  %88 = add nsw i32 %87, %84
  %89 = load i32, ptr %21, align 8, !tbaa !15
  %90 = add nsw i32 %89, 1
  %91 = invoke noundef ptr @_Z7newNodePA3_iiiiiiP4Node(ptr noundef nonnull %20, i32 noundef %83, i32 noundef %84, i32 noundef %86, i32 noundef %88, i32 noundef %90, ptr noundef nonnull %14)
          to label %92 unwind label %48

92:                                               ; preds = %82
  store ptr %91, ptr %7, align 8, !tbaa !5
  %93 = getelementptr inbounds i8, ptr %91, i64 8
  %94 = call noundef i32 @_Z13calculateCostPA3_iS0_(ptr noundef nonnull %93, ptr noundef %3)
  %95 = load ptr, ptr %7, align 8, !tbaa !5
  %96 = getelementptr inbounds i8, ptr %95, i64 52
  store i32 %94, ptr %96, align 4, !tbaa !9
  invoke void @_ZNSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(25) %5, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %97 unwind label %48

97:                                               ; preds = %92
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  br label %98

98:                                               ; preds = %97, %74
  %99 = load i32, ptr %18, align 4, !tbaa !12
  %100 = load i32, ptr getelementptr inbounds (i8, ptr @row, i64 12), align 4, !tbaa !13
  %101 = add nsw i32 %100, %99
  %102 = load i32, ptr %19, align 8, !tbaa !14
  %103 = load i32, ptr getelementptr inbounds (i8, ptr @col, i64 12), align 4, !tbaa !13
  %104 = add nsw i32 %103, %102
  %105 = call noundef i32 @_Z6isSafeii(i32 noundef %101, i32 noundef %104)
  %.not.3 = icmp eq i32 %105, 0
  br i1 %.not.3, label %122, label %106

106:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  %107 = load i32, ptr %18, align 4, !tbaa !12
  %108 = load i32, ptr %19, align 8, !tbaa !14
  %109 = load i32, ptr getelementptr inbounds (i8, ptr @row, i64 12), align 4, !tbaa !13
  %110 = add nsw i32 %109, %107
  %111 = load i32, ptr getelementptr inbounds (i8, ptr @col, i64 12), align 4, !tbaa !13
  %112 = add nsw i32 %111, %108
  %113 = load i32, ptr %21, align 8, !tbaa !15
  %114 = add nsw i32 %113, 1
  %115 = invoke noundef ptr @_Z7newNodePA3_iiiiiiP4Node(ptr noundef nonnull %20, i32 noundef %107, i32 noundef %108, i32 noundef %110, i32 noundef %112, i32 noundef %114, ptr noundef nonnull %14)
          to label %116 unwind label %48

116:                                              ; preds = %106
  store ptr %115, ptr %7, align 8, !tbaa !5
  %117 = getelementptr inbounds i8, ptr %115, i64 8
  %118 = call noundef i32 @_Z13calculateCostPA3_iS0_(ptr noundef nonnull %117, ptr noundef %3)
  %119 = load ptr, ptr %7, align 8, !tbaa !5
  %120 = getelementptr inbounds i8, ptr %119, i64 52
  store i32 %118, ptr %120, align 4, !tbaa !9
  invoke void @_ZNSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(25) %5, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %121 unwind label %48

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

122:                                              ; preds = %121, %98
  %123 = call noundef zeroext i1 @_ZNKSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %5)
  br i1 %123, label %.thread, label %.lr.ph

.thread:                                          ; preds = %122, %.preheader34, %29
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  call void @_ZNSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %5) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #4
  ret void

124:                                              ; preds = %.loopexit, %.loopexit.split-lp, %48, %30
  %.pn.pn = phi { ptr, i32 } [ %31, %30 ], [ %49, %48 ], [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  call void @_ZNSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %5) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #4
  resume { ptr, i32 } %.pn.pn
}

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(25), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compE3topEv(ptr noundef nonnull align 8 dereferenceable(25)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compE3popEv(ptr noundef nonnull align 8 dereferenceable(25)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt14priority_queueIP4NodeSt6vectorIS1_SaIS1_EE4compED2Ev(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #3 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 = { 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 #3 = { 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 #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, !11, i64 52}
!10 = !{!"_ZTS4Node", !6, i64 0, !7, i64 8, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 44}
!13 = !{!11, !11, i64 0}
!14 = !{!10, !11, i64 48}
!15 = !{!10, !11, i64 56}


; Effective O3 passes: ConstraintEliminationPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass