; LLVM IR from lzyrapx/Competitive-Programming :: 百度之星/百度之星2017-资格赛/02（fib堆优化+SW）.ll (Z6Searchii)

; 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" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::priority_queue" = type <{ %"class.std::vector.0", [8 x i8] }>
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = 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 { i32, i32 }

@vis = external dso_local global [3010 x i32], align 16
@wet = external dso_local global [3010 x i32], align 16
@combine = external dso_local global [3010 x i32], align 16
@g = external dso_local global [3010 x [3010 x i32]], align 16
@G = external dso_local global [3010 x %"class.std::vector"], align 16
@s = external dso_local global i32, align 4
@t = external dso_local global i32, align 4
@minCut = external dso_local global i32, align 4

; Function Attrs: mustprogress uwtable
define dso_local void @_Z6Searchii(i32 noundef %0, i32 noundef %1) #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"class.std::priority_queue", align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %struct.node, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %struct.node, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca %struct.node, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %5) #5
  call void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EEC2IS3_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %5)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %45, %2
  %19 = load i32, ptr %7, align 4, !tbaa !5
  %20 = load i32, ptr %3, align 4, !tbaa !5
  %21 = icmp sle i32 %19, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %48

23:                                               ; preds = %18
  %24 = load i32, ptr %7, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [3010 x i32], ptr @combine, i64 0, i64 %25
  %27 = load i32, ptr %26, align 4, !tbaa !5
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %44, label %29

29:                                               ; preds = %23
  %30 = load i32, ptr %7, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [3010 x i32], ptr @wet, i64 0, i64 %31
  store i32 0, ptr %32, align 4, !tbaa !5
  %33 = load i32, ptr %7, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [3010 x i32], ptr @vis, i64 0, i64 %34
  store i32 0, ptr %35, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %36 = getelementptr inbounds %struct.node, ptr %8, i32 0, i32 0
  %37 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %37, ptr %36, align 4, !tbaa !9
  %38 = getelementptr inbounds %struct.node, ptr %8, i32 0, i32 1
  store i32 0, ptr %38, align 4, !tbaa !11
  invoke void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(25) %5, ptr noundef nonnull align 4 dereferenceable(8) %8)
          to label %39 unwind label %40

39:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %44

40:                                               ; preds = %29
  %41 = landingpad { ptr, i32 }
          cleanup
  %42 = extractvalue { ptr, i32 } %41, 0
  store ptr %42, ptr %9, align 8
  %43 = extractvalue { ptr, i32 } %41, 1
  store i32 %43, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %164

44:                                               ; preds = %39, %23
  br label %45

45:                                               ; preds = %44
  %46 = load i32, ptr %7, align 4, !tbaa !5
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %7, align 4, !tbaa !5
  br label %18, !llvm.loop !12

48:                                               ; preds = %22
  store i32 -1, ptr @t, align 4, !tbaa !5
  store i32 -1, ptr @s, align 4, !tbaa !5
  %49 = load i32, ptr %4, align 4, !tbaa !5
  %50 = load i32, ptr %3, align 4, !tbaa !5
  %51 = sub nsw i32 %50, %49
  store i32 %51, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %154, %48
  %53 = load i32, ptr %11, align 4, !tbaa !5
  %54 = load i32, ptr %3, align 4, !tbaa !5
  %55 = icmp sle i32 %53, %54
  br i1 %55, label %57, label %56

56:                                               ; preds = %52
  store i32 5, ptr %12, align 4
  br label %158

57:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %58 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %5)
          to label %59 unwind label %72

59:                                               ; preds = %57
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 4 %58, i64 8, i1 false), !tbaa.struct !14
  invoke void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %5)
          to label %60 unwind label %72

60:                                               ; preds = %59
  br label %61

61:                                               ; preds = %71, %60
  %62 = getelementptr inbounds %struct.node, ptr %13, i32 0, i32 0
  %63 = load i32, ptr %62, align 4, !tbaa !9
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [3010 x i32], ptr @vis, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = icmp ne i32 %66, 0
  br i1 %67, label %68, label %76

68:                                               ; preds = %61
  %69 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %5)
          to label %70 unwind label %72

70:                                               ; preds = %68
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 4 %69, i64 8, i1 false), !tbaa.struct !14
  invoke void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %5)
          to label %71 unwind label %72

71:                                               ; preds = %70
  br label %61, !llvm.loop !15

72:                                               ; preds = %70, %68, %59, %57
  %73 = landingpad { ptr, i32 }
          cleanup
  %74 = extractvalue { ptr, i32 } %73, 0
  store ptr %74, ptr %9, align 8
  %75 = extractvalue { ptr, i32 } %73, 1
  store i32 %75, ptr %10, align 4
  br label %157

76:                                               ; preds = %61
  %77 = load i32, ptr @t, align 4, !tbaa !5
  %78 = getelementptr inbounds %struct.node, ptr %13, i32 0, i32 0
  %79 = load i32, ptr %78, align 4, !tbaa !9
  %80 = icmp eq i32 %77, %79
  br i1 %80, label %81, label %82

81:                                               ; preds = %76
  store i32 1, ptr %12, align 4
  br label %151

82:                                               ; preds = %76
  %83 = load i32, ptr @t, align 4, !tbaa !5
  store i32 %83, ptr @s, align 4, !tbaa !5
  %84 = getelementptr inbounds %struct.node, ptr %13, i32 0, i32 0
  %85 = load i32, ptr %84, align 4, !tbaa !9
  store i32 %85, ptr @t, align 4, !tbaa !5
  %86 = getelementptr inbounds %struct.node, ptr %13, i32 0, i32 0
  %87 = load i32, ptr %86, align 4, !tbaa !9
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [3010 x i32], ptr @vis, i64 0, i64 %88
  store i32 1, ptr %89, align 4, !tbaa !5
  %90 = getelementptr inbounds %struct.node, ptr %13, i32 0, i32 1
  %91 = load i32, ptr %90, align 4, !tbaa !11
  store i32 %91, ptr @minCut, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %92

92:                                               ; preds = %147, %82
  %93 = load i32, ptr %14, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = load i32, ptr @t, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [3010 x %"class.std::vector"], ptr @G, i64 0, i64 %96
  %98 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %97) #5
  %99 = icmp ult i64 %94, %98
  br i1 %99, label %101, label %100

100:                                              ; preds = %92
  store i32 10, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %150

101:                                              ; preds = %92
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %102 = load i32, ptr @t, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [3010 x %"class.std::vector"], ptr @G, i64 0, i64 %103
  %105 = load i32, ptr %14, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %104, i64 noundef %106) #5
  %108 = load i32, ptr %107, align 4, !tbaa !5
  store i32 %108, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %109 = load i32, ptr @t, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [3010 x [3010 x i32]], ptr @g, i64 0, i64 %110
  %112 = load i32, ptr %15, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [3010 x i32], ptr %111, i64 0, i64 %113
  %115 = load i32, ptr %114, align 4, !tbaa !5
  store i32 %115, ptr %16, align 4, !tbaa !5
  %116 = load i32, ptr %15, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [3010 x i32], ptr @combine, i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = icmp ne i32 %119, 0
  br i1 %120, label %146, label %121

121:                                              ; preds = %101
  %122 = load i32, ptr %15, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [3010 x i32], ptr @vis, i64 0, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !5
  %126 = icmp ne i32 %125, 0
  br i1 %126, label %146, label %127

127:                                              ; preds = %121
  %128 = load i32, ptr %16, align 4, !tbaa !5
  %129 = load i32, ptr %15, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [3010 x i32], ptr @wet, i64 0, i64 %130
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = add nsw i32 %132, %128
  store i32 %133, ptr %131, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %134 = getelementptr inbounds %struct.node, ptr %17, i32 0, i32 0
  %135 = load i32, ptr %15, align 4, !tbaa !5
  store i32 %135, ptr %134, align 4, !tbaa !9
  %136 = getelementptr inbounds %struct.node, ptr %17, i32 0, i32 1
  %137 = load i32, ptr %15, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [3010 x i32], ptr @wet, i64 0, i64 %138
  %140 = load i32, ptr %139, align 4, !tbaa !5
  store i32 %140, ptr %136, align 4, !tbaa !11
  invoke void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(25) %5, ptr noundef nonnull align 4 dereferenceable(8) %17)
          to label %141 unwind label %142

141:                                              ; preds = %127
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  br label %146

142:                                              ; preds = %127
  %143 = landingpad { ptr, i32 }
          cleanup
  %144 = extractvalue { ptr, i32 } %143, 0
  store ptr %144, ptr %9, align 8
  %145 = extractvalue { ptr, i32 } %143, 1
  store i32 %145, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %157

146:                                              ; preds = %141, %121, %101
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %147

147:                                              ; preds = %146
  %148 = load i32, ptr %14, align 4, !tbaa !5
  %149 = add nsw i32 %148, 1
  store i32 %149, ptr %14, align 4, !tbaa !5
  br label %92, !llvm.loop !16

150:                                              ; preds = %100
  store i32 0, ptr %12, align 4
  br label %151

151:                                              ; preds = %150, %81
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  %152 = load i32, ptr %12, align 4
  switch i32 %152, label %158 [
    i32 0, label %153
  ]

153:                                              ; preds = %151
  br label %154

154:                                              ; preds = %153
  %155 = load i32, ptr %11, align 4, !tbaa !5
  %156 = add nsw i32 %155, 1
  store i32 %156, ptr %11, align 4, !tbaa !5
  br label %52, !llvm.loop !17

157:                                              ; preds = %142, %72
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %164

158:                                              ; preds = %151, %56
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  %159 = load i32, ptr %12, align 4
  switch i32 %159, label %161 [
    i32 5, label %160
  ]

160:                                              ; preds = %158
  store i32 0, ptr %12, align 4
  br label %161

161:                                              ; preds = %160, %158
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %5) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %5) #5
  %162 = load i32, ptr %12, align 4
  switch i32 %162, label %170 [
    i32 0, label %163
    i32 1, label %163
  ]

163:                                              ; preds = %161, %161
  ret void

164:                                              ; preds = %157, %40
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %5) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %5) #5
  br label %165

165:                                              ; preds = %164
  %166 = load ptr, ptr %9, align 8
  %167 = load i32, ptr %10, align 4
  %168 = insertvalue { ptr, i32 } poison, ptr %166, 0
  %169 = insertvalue { ptr, i32 } %168, i32 %167, 1
  resume { ptr, i32 } %169

170:                                              ; preds = %161
  unreachable
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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

; 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) #3

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #4 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"_ZTS4node", !6, i64 0, !6, i64 4}
!11 = !{!10, !6, i64 4}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{i64 0, i64 4, !5, i64 4, i64 4, !5}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13}


; 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" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::priority_queue" = type <{ %"class.std::vector.0", [8 x i8] }>
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = 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 { i32, i32 }

@vis = external dso_local local_unnamed_addr global [3010 x i32], align 16
@wet = external dso_local local_unnamed_addr global [3010 x i32], align 16
@combine = external dso_local local_unnamed_addr global [3010 x i32], align 16
@g = external dso_local local_unnamed_addr global [3010 x [3010 x i32]], align 16
@G = external dso_local global [3010 x %"class.std::vector"], align 16
@s = external dso_local local_unnamed_addr global i32, align 4
@t = external dso_local local_unnamed_addr global i32, align 4
@minCut = external dso_local local_unnamed_addr global i32, align 4

; Function Attrs: mustprogress uwtable
define dso_local void @_Z6Searchii(i32 noundef %0, i32 noundef %1) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::priority_queue", align 8
  %4 = alloca %struct.node, align 4
  %5 = alloca %struct.node, align 4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #4
  call void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EEC2IS3_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %3)
  %.not54 = icmp slt i32 %0, 1
  br i1 %.not54, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2
  %6 = getelementptr inbounds i8, ptr %4, i64 4
  %7 = add nuw i32 %0, 1
  %wide.trip.count = zext i32 %7 to i64
  br label %11

._crit_edge:                                      ; preds = %21, %2
  store i32 -1, ptr @t, align 4, !tbaa !5
  store i32 -1, ptr @s, align 4, !tbaa !5
  %.not4266.not = icmp sgt i32 %0, %1
  br i1 %.not4266.not, label %.lr.ph69, label %.critedge

.lr.ph69:                                         ; preds = %._crit_edge
  %8 = getelementptr inbounds i8, ptr %5, i64 4
  %9 = add i32 %0, 1
  %10 = sub i32 %9, %1
  br label %22

11:                                               ; preds = %.lr.ph, %21
  %indvars.iv = phi i64 [ 1, %.lr.ph ], [ %indvars.iv.next, %21 ]
  %12 = getelementptr inbounds [3010 x i32], ptr @combine, i64 0, i64 %indvars.iv
  %13 = load i32, ptr %12, align 4, !tbaa !5
  %.not48 = icmp eq i32 %13, 0
  br i1 %.not48, label %14, label %21

14:                                               ; preds = %11
  %15 = getelementptr inbounds [3010 x i32], ptr @wet, i64 0, i64 %indvars.iv
  store i32 0, ptr %15, align 4, !tbaa !5
  %16 = getelementptr inbounds [3010 x i32], ptr @vis, i64 0, i64 %indvars.iv
  store i32 0, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %17 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %17, ptr %4, align 4, !tbaa !9
  store i32 0, ptr %6, align 4, !tbaa !11
  invoke void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(25) %3, ptr noundef nonnull align 4 dereferenceable(8) %4)
          to label %18 unwind label %19

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

19:                                               ; preds = %14
  %20 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  br label %65

21:                                               ; preds = %11, %18
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %11, !llvm.loop !12

22:                                               ; preds = %.lr.ph69, %._crit_edge65
  %.03467 = phi i32 [ 1, %.lr.ph69 ], [ %64, %._crit_edge65 ]
  %23 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %3)
  %.sroa.0.0.copyload = load i32, ptr %23, align 4, !tbaa !5
  %.sroa.9.0..sroa_idx = getelementptr inbounds i8, ptr %23, i64 4
  %.sroa.9.0.copyload = load i32, ptr %.sroa.9.0..sroa_idx, align 4, !tbaa !5
  invoke void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %3)
          to label %.preheader unwind label %.loopexit.split-lp

.preheader:                                       ; preds = %22
  %24 = sext i32 %.sroa.0.0.copyload to i64
  %25 = getelementptr inbounds [3010 x i32], ptr @vis, i64 0, i64 %24
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %.not4357 = icmp eq i32 %26, 0
  br i1 %.not4357, label %._crit_edge59, label %.lr.ph58

27:                                               ; preds = %.lr.ph58
  %28 = sext i32 %.sroa.0.0.copyload14 to i64
  %29 = getelementptr inbounds [3010 x i32], ptr @vis, i64 0, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %.not43 = icmp eq i32 %30, 0
  br i1 %.not43, label %._crit_edge59, label %.lr.ph58, !llvm.loop !14

.lr.ph58:                                         ; preds = %.preheader, %27
  %31 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %3)
  %.sroa.0.0.copyload14 = load i32, ptr %31, align 4, !tbaa !5
  %.sroa.9.0..sroa_idx15 = getelementptr inbounds i8, ptr %31, i64 4
  %.sroa.9.0.copyload16 = load i32, ptr %.sroa.9.0..sroa_idx15, align 4, !tbaa !5
  invoke void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %3)
          to label %27 unwind label %.loopexit, !llvm.loop !14

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

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

._crit_edge59:                                    ; preds = %27, %.preheader
  %.lcssa56 = phi i64 [ %24, %.preheader ], [ %28, %27 ]
  %.sroa.9.0.lcssa = phi i32 [ %.sroa.9.0.copyload, %.preheader ], [ %.sroa.9.0.copyload16, %27 ]
  %.sroa.0.0.lcssa = phi i32 [ %.sroa.0.0.copyload, %.preheader ], [ %.sroa.0.0.copyload14, %27 ]
  %32 = load i32, ptr @t, align 4, !tbaa !5
  %.not46 = icmp eq i32 %32, %.sroa.0.0.lcssa
  br i1 %.not46, label %.critedge, label %33

33:                                               ; preds = %._crit_edge59
  %34 = getelementptr inbounds [3010 x i32], ptr @vis, i64 0, i64 %.lcssa56
  store i32 %32, ptr @s, align 4, !tbaa !5
  store i32 %.sroa.0.0.lcssa, ptr @t, align 4, !tbaa !5
  store i32 1, ptr %34, align 4, !tbaa !5
  store i32 %.sroa.9.0.lcssa, ptr @minCut, align 4, !tbaa !5
  %35 = sext i32 %.sroa.0.0.lcssa to i64
  %36 = getelementptr inbounds [3010 x %"class.std::vector"], ptr @G, i64 0, i64 %35
  %37 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %36) #4
  %.not = icmp eq i64 %37, 0
  br i1 %.not, label %._crit_edge65, label %.lr.ph64

.lr.ph64:                                         ; preds = %33, %60
  %indvars.iv74 = phi i64 [ %indvars.iv.next75, %60 ], [ 0, %33 ]
  %38 = load i32, ptr @t, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [3010 x %"class.std::vector"], ptr @G, i64 0, i64 %39
  %41 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %40, i64 noundef %indvars.iv74) #4
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = load i32, ptr @t, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = sext i32 %42 to i64
  %46 = getelementptr inbounds [3010 x [3010 x i32]], ptr @g, i64 0, i64 %44, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = getelementptr inbounds [3010 x i32], ptr @combine, i64 0, i64 %45
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %.not44 = icmp eq i32 %49, 0
  br i1 %.not44, label %50, label %60

50:                                               ; preds = %.lr.ph64
  %51 = getelementptr inbounds [3010 x i32], ptr @vis, i64 0, i64 %45
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %.not45 = icmp eq i32 %52, 0
  br i1 %.not45, label %53, label %60

53:                                               ; preds = %50
  %54 = getelementptr inbounds [3010 x i32], ptr @wet, i64 0, i64 %45
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = add nsw i32 %55, %47
  store i32 %56, ptr %54, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  store i32 %42, ptr %5, align 4, !tbaa !9
  store i32 %56, ptr %8, align 4, !tbaa !11
  invoke void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(25) %3, ptr noundef nonnull align 4 dereferenceable(8) %5)
          to label %57 unwind label %58

57:                                               ; preds = %53
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  %.pre = load i32, ptr @t, align 4, !tbaa !5
  %.pre78 = sext i32 %.pre to i64
  br label %60

58:                                               ; preds = %53
  %59 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  br label %65

60:                                               ; preds = %57, %50, %.lr.ph64
  %.pre-phi = phi i64 [ %.pre78, %57 ], [ %44, %50 ], [ %44, %.lr.ph64 ]
  %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
  %61 = getelementptr inbounds [3010 x %"class.std::vector"], ptr @G, i64 0, i64 %.pre-phi
  %62 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %61) #4
  %63 = icmp ugt i64 %62, %indvars.iv.next75
  br i1 %63, label %.lr.ph64, label %._crit_edge65, !llvm.loop !15

._crit_edge65:                                    ; preds = %60, %33
  %64 = add nuw i32 %.03467, 1
  %exitcond77.not = icmp eq i32 %64, %10
  br i1 %exitcond77.not, label %.critedge, label %22, !llvm.loop !16

.critedge:                                        ; preds = %._crit_edge65, %._crit_edge59, %._crit_edge
  call void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %3) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #4
  ret void

65:                                               ; preds = %.loopexit, %.loopexit.split-lp, %58, %19
  %.pn49 = phi { ptr, i32 } [ %20, %19 ], [ %59, %58 ], [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %3) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #4
  resume { ptr, i32 } %.pn49
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #3 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"_ZTS4node", !6, i64 0, !6, i64 4}
!11 = !{!10, !6, i64 4}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass