; LLVM IR from upupming/algorithm :: kick-start/2020/RoundE/C-Toys.ll (Z5solvev)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.P = type { i64, i64, i64 }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"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<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }

@n = external dso_local global i32, align 4
@p = external dso_local global [100010 x %struct.P], align 16
@sum_e = external dso_local global i64, align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [14 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3cmp1PS_(ptr noundef byval(%struct.P) align 8, ptr noundef byval(%struct.P) align 8) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #1 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca %"class.std::priority_queue", align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca %"struct.std::pair", align 4
  %13 = alloca %"struct.std::pair", align 4
  %14 = alloca i64, align 8
  %15 = load i32, ptr @n, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds %struct.P, ptr @p, i64 %16
  call void @_ZSt4sortIP1PEvT_S2_(ptr noundef @p, ptr noundef %17)
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #7
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %51, %0
  %19 = load i32, ptr %1, align 4, !tbaa !5
  %20 = load i32, ptr @n, align 4, !tbaa !5
  %21 = icmp slt i32 %19, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %18
  store i32 2, ptr %2, align 4
  br label %54

23:                                               ; preds = %18
  %24 = load i64, ptr @sum_e, align 8, !tbaa !9
  %25 = load i32, ptr %1, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [100010 x %struct.P], ptr @p, i64 0, i64 %26
  %28 = getelementptr inbounds %struct.P, ptr %27, i32 0, i32 0
  %29 = load i64, ptr %28, align 8, !tbaa !11
  %30 = load i32, ptr %1, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [100010 x %struct.P], ptr @p, i64 0, i64 %31
  %33 = getelementptr inbounds %struct.P, ptr %32, i32 0, i32 1
  %34 = load i64, ptr %33, align 8, !tbaa !13
  %35 = add nsw i64 %29, %34
  %36 = icmp slt i64 %24, %35
  br i1 %36, label %37, label %45

37:                                               ; preds = %23
  %38 = load i32, ptr %1, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [100010 x %struct.P], ptr @p, i64 0, i64 %39
  %41 = getelementptr inbounds %struct.P, ptr %40, i32 0, i32 0
  %42 = load i64, ptr %41, align 8, !tbaa !11
  %43 = load i64, ptr @sum_e, align 8, !tbaa !9
  %44 = sub nsw i64 %43, %42
  store i64 %44, ptr @sum_e, align 8, !tbaa !9
  br label %50

45:                                               ; preds = %23
  %46 = load i32, ptr %1, align 4, !tbaa !5
  %47 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %46)
  %48 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %47, ptr noundef @.str)
  %49 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %48, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 1, ptr %2, align 4
  br label %54

50:                                               ; preds = %37
  br label %51

51:                                               ; preds = %50
  %52 = load i32, ptr %1, align 4, !tbaa !5
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %1, align 4, !tbaa !5
  br label %18, !llvm.loop !14

54:                                               ; preds = %45, %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #7
  %55 = load i32, ptr %2, align 4
  switch i32 %55, label %220 [
    i32 2, label %56
    i32 1, label %209
  ]

56:                                               ; preds = %54
  %57 = load i32, ptr @n, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds %struct.P, ptr @p, i64 %58
  call void @_ZSt4sortIP1PPFbS0_S0_EEvT_S4_T0_(ptr noundef @p, ptr noundef %59, ptr noundef @_Z3cmp1PS_)
  store i64 0, ptr @sum_e, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %60

60:                                               ; preds = %73, %56
  %61 = load i32, ptr %3, align 4, !tbaa !5
  %62 = load i32, ptr @n, align 4, !tbaa !5
  %63 = icmp slt i32 %61, %62
  br i1 %63, label %65, label %64

64:                                               ; preds = %60
  store i32 5, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %76

65:                                               ; preds = %60
  %66 = load i32, ptr %3, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [100010 x %struct.P], ptr @p, i64 0, i64 %67
  %69 = getelementptr inbounds %struct.P, ptr %68, i32 0, i32 0
  %70 = load i64, ptr %69, align 8, !tbaa !11
  %71 = load i64, ptr @sum_e, align 8, !tbaa !9
  %72 = add nsw i64 %71, %70
  store i64 %72, ptr @sum_e, align 8, !tbaa !9
  br label %73

73:                                               ; preds = %65
  %74 = load i32, ptr %3, align 4, !tbaa !5
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %3, align 4, !tbaa !5
  br label %60, !llvm.loop !16

76:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  %77 = load i64, ptr @sum_e, align 8, !tbaa !9
  store i64 %77, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  store i64 0, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %78 = load i64, ptr @sum_e, align 8, !tbaa !9
  store i64 %78, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  store i64 0, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 32, ptr %8) #7
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %8)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %79

79:                                               ; preds = %194, %76
  %80 = load i32, ptr %9, align 4, !tbaa !5
  %81 = load i32, ptr @n, align 4, !tbaa !5
  %82 = icmp slt i32 %80, %81
  br i1 %82, label %84, label %83

83:                                               ; preds = %79
  store i32 8, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %198

84:                                               ; preds = %79
  %85 = load i64, ptr @sum_e, align 8, !tbaa !9
  %86 = load i32, ptr %9, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [100010 x %struct.P], ptr @p, i64 0, i64 %87
  %89 = getelementptr inbounds %struct.P, ptr %88, i32 0, i32 0
  %90 = load i64, ptr %89, align 8, !tbaa !11
  %91 = load i32, ptr %9, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [100010 x %struct.P], ptr @p, i64 0, i64 %92
  %94 = getelementptr inbounds %struct.P, ptr %93, i32 0, i32 1
  %95 = load i64, ptr %94, align 8, !tbaa !13
  %96 = add nsw i64 %90, %95
  %97 = icmp slt i64 %85, %96
  br i1 %97, label %98, label %161

98:                                               ; preds = %84
  %99 = load i64, ptr %7, align 8, !tbaa !9
  %100 = add nsw i64 %99, 1
  store i64 %100, ptr %7, align 8, !tbaa !9
  %101 = load i32, ptr %9, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [100010 x %struct.P], ptr @p, i64 0, i64 %102
  %104 = getelementptr inbounds %struct.P, ptr %103, i32 0, i32 0
  %105 = load i64, ptr %104, align 8, !tbaa !11
  %106 = load i64, ptr @sum_e, align 8, !tbaa !9
  %107 = sub nsw i64 %106, %105
  store i64 %107, ptr @sum_e, align 8, !tbaa !9
  %108 = load i32, ptr %9, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [100010 x %struct.P], ptr @p, i64 0, i64 %109
  %111 = getelementptr inbounds %struct.P, ptr %110, i32 0, i32 0
  %112 = load i64, ptr %111, align 8, !tbaa !11
  %113 = load i64, ptr %6, align 8, !tbaa !9
  %114 = sub nsw i64 %113, %112
  store i64 %114, ptr %6, align 8, !tbaa !9
  br label %115

115:                                              ; preds = %134, %98
  %116 = invoke noundef i64 @_ZNKSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(25) %8)
          to label %117 unwind label %152

117:                                              ; preds = %115
  %118 = icmp ne i64 %116, 0
  br i1 %118, label %119, label %127

119:                                              ; preds = %117
  %120 = load i64, ptr @sum_e, align 8, !tbaa !9
  %121 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %8)
          to label %122 unwind label %152

122:                                              ; preds = %119
  %123 = getelementptr inbounds %"struct.std::pair", ptr %121, i32 0, i32 0
  %124 = load i32, ptr %123, align 4, !tbaa !17
  %125 = sext i32 %124 to i64
  %126 = icmp slt i64 %120, %125
  br label %127

127:                                              ; preds = %122, %117
  %128 = phi i1 [ false, %117 ], [ %126, %122 ]
  br i1 %128, label %129, label %160

129:                                              ; preds = %127
  %130 = load i64, ptr %7, align 8, !tbaa !9
  %131 = add nsw i64 %130, 1
  store i64 %131, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %132 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %8)
          to label %133 unwind label %156

133:                                              ; preds = %129
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %12, ptr align 4 %132, i64 8, i1 false)
  invoke void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %8)
          to label %134 unwind label %156

134:                                              ; preds = %133
  %135 = getelementptr inbounds %"struct.std::pair", ptr %12, i32 0, i32 1
  %136 = load i32, ptr %135, align 4, !tbaa !19
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [100010 x %struct.P], ptr @p, i64 0, i64 %137
  %139 = getelementptr inbounds %struct.P, ptr %138, i32 0, i32 0
  %140 = load i64, ptr %139, align 8, !tbaa !11
  %141 = load i64, ptr @sum_e, align 8, !tbaa !9
  %142 = sub nsw i64 %141, %140
  store i64 %142, ptr @sum_e, align 8, !tbaa !9
  %143 = getelementptr inbounds %"struct.std::pair", ptr %12, i32 0, i32 1
  %144 = load i32, ptr %143, align 4, !tbaa !19
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [100010 x %struct.P], ptr @p, i64 0, i64 %145
  %147 = getelementptr inbounds %struct.P, ptr %146, i32 0, i32 0
  %148 = load i64, ptr %147, align 8, !tbaa !11
  %149 = mul nsw i64 2, %148
  %150 = load i64, ptr %6, align 8, !tbaa !9
  %151 = sub nsw i64 %150, %149
  store i64 %151, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  br label %115, !llvm.loop !20

152:                                              ; preds = %119, %115
  %153 = landingpad { ptr, i32 }
          cleanup
  %154 = extractvalue { ptr, i32 } %153, 0
  store ptr %154, ptr %10, align 8
  %155 = extractvalue { ptr, i32 } %153, 1
  store i32 %155, ptr %11, align 4
  br label %197

156:                                              ; preds = %133, %129
  %157 = landingpad { ptr, i32 }
          cleanup
  %158 = extractvalue { ptr, i32 } %157, 0
  store ptr %158, ptr %10, align 8
  %159 = extractvalue { ptr, i32 } %157, 1
  store i32 %159, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  br label %197

160:                                              ; preds = %127
  br label %193

161:                                              ; preds = %84
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %162 = load i32, ptr %9, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [100010 x %struct.P], ptr @p, i64 0, i64 %163
  %165 = getelementptr inbounds %struct.P, ptr %164, i32 0, i32 0
  %166 = load i64, ptr %165, align 8, !tbaa !11
  %167 = load i32, ptr %9, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [100010 x %struct.P], ptr @p, i64 0, i64 %168
  %170 = getelementptr inbounds %struct.P, ptr %169, i32 0, i32 1
  %171 = load i64, ptr %170, align 8, !tbaa !13
  %172 = add nsw i64 %166, %171
  store i64 %172, ptr %14, align 8, !tbaa !9
  invoke void @_ZNSt4pairIiiEC2IxRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %173 unwind label %188

173:                                              ; preds = %161
  invoke void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) %8, ptr noundef nonnull align 4 dereferenceable(8) %13)
          to label %174 unwind label %188

174:                                              ; preds = %173
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  %175 = load i32, ptr %9, align 4, !tbaa !5
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [100010 x %struct.P], ptr @p, i64 0, i64 %176
  %178 = getelementptr inbounds %struct.P, ptr %177, i32 0, i32 0
  %179 = load i64, ptr %178, align 8, !tbaa !11
  %180 = load i64, ptr %6, align 8, !tbaa !9
  %181 = add nsw i64 %180, %179
  store i64 %181, ptr %6, align 8, !tbaa !9
  %182 = load i64, ptr %6, align 8, !tbaa !9
  %183 = load i64, ptr %4, align 8, !tbaa !9
  %184 = icmp sgt i64 %182, %183
  br i1 %184, label %185, label %192

185:                                              ; preds = %174
  %186 = load i64, ptr %6, align 8, !tbaa !9
  store i64 %186, ptr %4, align 8, !tbaa !9
  %187 = load i64, ptr %7, align 8, !tbaa !9
  store i64 %187, ptr %5, align 8, !tbaa !9
  br label %192

188:                                              ; preds = %173, %161
  %189 = landingpad { ptr, i32 }
          cleanup
  %190 = extractvalue { ptr, i32 } %189, 0
  store ptr %190, ptr %10, align 8
  %191 = extractvalue { ptr, i32 } %189, 1
  store i32 %191, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %197

192:                                              ; preds = %185, %174
  br label %193

193:                                              ; preds = %192, %160
  br label %194

194:                                              ; preds = %193
  %195 = load i32, ptr %9, align 4, !tbaa !5
  %196 = add nsw i32 %195, 1
  store i32 %196, ptr %9, align 4, !tbaa !5
  br label %79, !llvm.loop !21

197:                                              ; preds = %188, %156, %152
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %214

198:                                              ; preds = %83
  %199 = load i64, ptr %5, align 8, !tbaa !9
  %200 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %199)
          to label %201 unwind label %210

201:                                              ; preds = %198
  %202 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %200, ptr noundef @.str.1)
          to label %203 unwind label %210

203:                                              ; preds = %201
  %204 = load i64, ptr %4, align 8, !tbaa !9
  %205 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %202, i64 noundef %204)
          to label %206 unwind label %210

206:                                              ; preds = %203
  %207 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %205, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %208 unwind label %210

208:                                              ; preds = %206
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %8) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  br label %209

209:                                              ; preds = %208, %54
  ret void

210:                                              ; preds = %206, %203, %201, %198
  %211 = landingpad { ptr, i32 }
          cleanup
  %212 = extractvalue { ptr, i32 } %211, 0
  store ptr %212, ptr %10, align 8
  %213 = extractvalue { ptr, i32 } %211, 1
  store i32 %213, ptr %11, align 4
  br label %214

214:                                              ; preds = %210, %197
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %8) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  br label %215

215:                                              ; preds = %214
  %216 = load ptr, ptr %10, align 8
  %217 = load i32, ptr %11, align 4
  %218 = insertvalue { ptr, i32 } poison, ptr %216, 0
  %219 = insertvalue { ptr, i32 } %218, i32 %217, 1
  resume { ptr, i32 } %219

220:                                              ; preds = %54
  unreachable
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIP1PEvT_S2_(ptr noundef, ptr noundef) #2

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #2

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #4

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIP1PPFbS0_S0_EEvT_S4_T0_(ptr noundef, ptr noundef, ptr noundef) #2

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25)) #0 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) #5

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

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #1 align 2

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

attributes #0 = { 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 #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 = { inlinehint 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { 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, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_ZTS1P", !10, i64 0, !10, i64 8, !10, i64 16}
!13 = !{!12, !10, i64 8}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = !{!18, !6, i64 0}
!18 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!19 = !{!18, !6, i64 4}
!20 = distinct !{!20, !15}
!21 = distinct !{!21, !15}


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

%struct.P = type { i64, i64, i64 }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"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<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }

@n = external dso_local local_unnamed_addr global i32, align 4
@p = external dso_local global [100010 x %struct.P], align 16
@sum_e = external dso_local local_unnamed_addr global i64, align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [14 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3cmp1PS_(ptr noundef byval(%struct.P) align 8, ptr noundef byval(%struct.P) align 8) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::priority_queue", align 8
  %2 = alloca i32, align 4
  %3 = alloca %"struct.std::pair", align 4
  %4 = alloca i64, align 8
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %6 = sext i32 %5 to i64
  %7 = getelementptr inbounds %struct.P, ptr @p, i64 %6
  tail call void @_ZSt4sortIP1PEvT_S2_(ptr noundef nonnull @p, ptr noundef nonnull %7)
  %8 = load i32, ptr @n, align 4, !tbaa !5
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %0
  %sum_e.promoted = load i64, ptr @sum_e, align 8, !tbaa !9
  %wide.trip.count = zext nneg i32 %8 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %17
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %17 ]
  %10 = phi i64 [ %sum_e.promoted, %.lr.ph.preheader ], [ %18, %17 ]
  %11 = getelementptr inbounds [100010 x %struct.P], ptr @p, i64 0, i64 %indvars.iv
  %12 = load i64, ptr %11, align 8, !tbaa !11
  %13 = getelementptr inbounds i8, ptr %11, i64 8
  %14 = load i64, ptr %13, align 8, !tbaa !13
  %15 = add nsw i64 %14, %12
  %16 = icmp slt i64 %10, %15
  br i1 %16, label %17, label %19

17:                                               ; preds = %.lr.ph
  %18 = sub nsw i64 %10, %12
  store i64 %18, ptr @sum_e, align 8, !tbaa !9
  %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 %.lr.ph, !llvm.loop !14

19:                                               ; preds = %.lr.ph
  %20 = trunc nuw nsw i64 %indvars.iv to i32
  %21 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %20)
  %22 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %21, ptr noundef nonnull @.str)
  %23 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %22, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %103

._crit_edge:                                      ; preds = %17, %0
  %24 = sext i32 %8 to i64
  %25 = getelementptr inbounds %struct.P, ptr @p, i64 %24
  tail call void @_ZSt4sortIP1PPFbS0_S0_EEvT_S4_T0_(ptr noundef nonnull @p, ptr noundef nonnull %25, ptr noundef nonnull @_Z3cmp1PS_)
  store i64 0, ptr @sum_e, align 8, !tbaa !9
  %26 = load i32, ptr @n, align 4, !tbaa !5
  %27 = icmp sgt i32 %26, 0
  br i1 %27, label %.lr.ph59.preheader, label %33

.lr.ph59.preheader:                               ; preds = %._crit_edge
  %wide.trip.count86 = zext nneg i32 %26 to i64
  %xtraiter = and i64 %wide.trip.count86, 3
  %28 = icmp ult i32 %26, 4
  br i1 %28, label %._crit_edge60.unr-lcssa, label %.lr.ph59.preheader.new

.lr.ph59.preheader.new:                           ; preds = %.lr.ph59.preheader
  %unroll_iter = and i64 %wide.trip.count86, 2147483644
  br label %.lr.ph59

._crit_edge60.unr-lcssa:                          ; preds = %.lr.ph59, %.lr.ph59.preheader
  %.lcssa.ph = phi i64 [ poison, %.lr.ph59.preheader ], [ %49, %.lr.ph59 ]
  %indvars.iv83.unr = phi i64 [ 0, %.lr.ph59.preheader ], [ %indvars.iv.next84.3, %.lr.ph59 ]
  %.unr = phi i64 [ 0, %.lr.ph59.preheader ], [ %49, %.lr.ph59 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge60, label %.lr.ph59.epil

.lr.ph59.epil:                                    ; preds = %._crit_edge60.unr-lcssa, %.lr.ph59.epil
  %indvars.iv83.epil = phi i64 [ %indvars.iv.next84.epil, %.lr.ph59.epil ], [ %indvars.iv83.unr, %._crit_edge60.unr-lcssa ]
  %29 = phi i64 [ %32, %.lr.ph59.epil ], [ %.unr, %._crit_edge60.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph59.epil ], [ 0, %._crit_edge60.unr-lcssa ]
  %30 = getelementptr inbounds [100010 x %struct.P], ptr @p, i64 0, i64 %indvars.iv83.epil
  %31 = load i64, ptr %30, align 8, !tbaa !11
  %32 = add nsw i64 %29, %31
  %indvars.iv.next84.epil = add nuw nsw i64 %indvars.iv83.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge60, label %.lr.ph59.epil, !llvm.loop !16

._crit_edge60:                                    ; preds = %.lr.ph59.epil, %._crit_edge60.unr-lcssa
  %.lcssa = phi i64 [ %.lcssa.ph, %._crit_edge60.unr-lcssa ], [ %32, %.lr.ph59.epil ]
  store i64 %.lcssa, ptr @sum_e, align 8, !tbaa !9
  br label %33

33:                                               ; preds = %._crit_edge60, %._crit_edge
  %34 = phi i64 [ %.lcssa, %._crit_edge60 ], [ 0, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %1) #7
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %1)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  store i32 0, ptr %2, align 4, !tbaa !5
  %35 = load i32, ptr @n, align 4, !tbaa !5
  %36 = icmp sgt i32 %35, 0
  br i1 %36, label %.lr.ph77, label %._crit_edge78

.lr.ph59:                                         ; preds = %.lr.ph59, %.lr.ph59.preheader.new
  %indvars.iv83 = phi i64 [ 0, %.lr.ph59.preheader.new ], [ %indvars.iv.next84.3, %.lr.ph59 ]
  %37 = phi i64 [ 0, %.lr.ph59.preheader.new ], [ %49, %.lr.ph59 ]
  %niter = phi i64 [ 0, %.lr.ph59.preheader.new ], [ %niter.next.3, %.lr.ph59 ]
  %38 = getelementptr inbounds [100010 x %struct.P], ptr @p, i64 0, i64 %indvars.iv83
  %39 = load i64, ptr %38, align 16, !tbaa !11
  %40 = add nsw i64 %37, %39
  %indvars.iv.next84 = or disjoint i64 %indvars.iv83, 1
  %41 = getelementptr inbounds [100010 x %struct.P], ptr @p, i64 0, i64 %indvars.iv.next84
  %42 = load i64, ptr %41, align 8, !tbaa !11
  %43 = add nsw i64 %40, %42
  %indvars.iv.next84.1 = or disjoint i64 %indvars.iv83, 2
  %44 = getelementptr inbounds [100010 x %struct.P], ptr @p, i64 0, i64 %indvars.iv.next84.1
  %45 = load i64, ptr %44, align 16, !tbaa !11
  %46 = add nsw i64 %43, %45
  %indvars.iv.next84.2 = or disjoint i64 %indvars.iv83, 3
  %47 = getelementptr inbounds [100010 x %struct.P], ptr @p, i64 0, i64 %indvars.iv.next84.2
  %48 = load i64, ptr %47, align 8, !tbaa !11
  %49 = add nsw i64 %46, %48
  %indvars.iv.next84.3 = add nuw nsw i64 %indvars.iv83, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge60.unr-lcssa, label %.lr.ph59, !llvm.loop !18

._crit_edge78:                                    ; preds = %.critedge, %33
  %.034.lcssa = phi i64 [ %34, %33 ], [ %.135, %.critedge ]
  %.032.lcssa = phi i64 [ 0, %33 ], [ %.133, %.critedge ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  %50 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.032.lcssa)
          to label %96 unwind label %104

.lr.ph77:                                         ; preds = %33, %.critedge
  %.02775 = phi i64 [ %.2, %.critedge ], [ 0, %33 ]
  %.02974 = phi i64 [ %.231, %.critedge ], [ %34, %33 ]
  %.03273 = phi i64 [ %.133, %.critedge ], [ 0, %33 ]
  %.03472 = phi i64 [ %.135, %.critedge ], [ %34, %33 ]
  %storemerge71 = phi i32 [ %92, %.critedge ], [ 0, %33 ]
  %51 = load i64, ptr @sum_e, align 8, !tbaa !9
  %52 = sext i32 %storemerge71 to i64
  %53 = getelementptr inbounds [100010 x %struct.P], ptr @p, i64 0, i64 %52
  %54 = load i64, ptr %53, align 8, !tbaa !11
  %55 = getelementptr inbounds i8, ptr %53, i64 8
  %56 = load i64, ptr %55, align 8, !tbaa !13
  %57 = add nsw i64 %56, %54
  %58 = icmp slt i64 %51, %57
  br i1 %58, label %59, label %81

59:                                               ; preds = %.lr.ph77
  %60 = sub nsw i64 %51, %54
  store i64 %60, ptr @sum_e, align 8, !tbaa !9
  %61 = sub nsw i64 %.02974, %54
  %.12861 = add nsw i64 %.02775, 1
  %62 = call noundef i64 @_ZNKSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(25) %1)
  %.not62 = icmp eq i64 %62, 0
  br i1 %.not62, label %.critedge, label %.lr.ph66

.lr.ph66:                                         ; preds = %59, %70
  %.12864 = phi i64 [ %.128, %70 ], [ %.12861, %59 ]
  %.13063 = phi i64 [ %77, %70 ], [ %61, %59 ]
  %63 = load i64, ptr @sum_e, align 8, !tbaa !9
  %64 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %1)
  %65 = load i32, ptr %64, align 4, !tbaa !19
  %66 = sext i32 %65 to i64
  %67 = icmp slt i64 %63, %66
  br i1 %67, label %68, label %.critedge

68:                                               ; preds = %.lr.ph66
  %69 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %1)
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %69, i64 4
  %.sroa.4.0.copyload = load i32, ptr %.sroa.4.0..sroa_idx, align 4
  invoke void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %1)
          to label %70 unwind label %79

70:                                               ; preds = %68
  %71 = sext i32 %.sroa.4.0.copyload to i64
  %72 = getelementptr inbounds [100010 x %struct.P], ptr @p, i64 0, i64 %71
  %73 = load i64, ptr %72, align 8, !tbaa !11
  %74 = load i64, ptr @sum_e, align 8, !tbaa !9
  %75 = sub nsw i64 %74, %73
  store i64 %75, ptr @sum_e, align 8, !tbaa !9
  %76 = shl nsw i64 %73, 1
  %77 = sub nsw i64 %.13063, %76
  %.128 = add nsw i64 %.12864, 1
  %78 = call noundef i64 @_ZNKSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(25) %1)
  %.not = icmp eq i64 %78, 0
  br i1 %.not, label %.critedge, label %.lr.ph66, !llvm.loop !21

79:                                               ; preds = %68
  %80 = landingpad { ptr, i32 }
          cleanup
  br label %95

81:                                               ; preds = %.lr.ph77
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  store i64 %57, ptr %4, align 8, !tbaa !9
  call void @_ZNSt4pairIiiEC2IxRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(4) %2)
  invoke void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(25) %1, ptr noundef nonnull align 4 dereferenceable(8) %3)
          to label %82 unwind label %89

82:                                               ; preds = %81
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  %83 = load i32, ptr %2, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [100010 x %struct.P], ptr @p, i64 0, i64 %84
  %86 = load i64, ptr %85, align 8, !tbaa !11
  %87 = add nsw i64 %86, %.02974
  %88 = icmp sgt i64 %87, %.03472
  %spec.select = call i64 @llvm.smax.i64(i64 %87, i64 %.03472)
  %spec.select44 = select i1 %88, i64 %.02775, i64 %.03273
  br label %.critedge

89:                                               ; preds = %81
  %90 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  br label %95

.critedge:                                        ; preds = %.lr.ph66, %70, %59, %82
  %.135 = phi i64 [ %spec.select, %82 ], [ %.03472, %59 ], [ %.03472, %70 ], [ %.03472, %.lr.ph66 ]
  %.133 = phi i64 [ %spec.select44, %82 ], [ %.03273, %59 ], [ %.03273, %70 ], [ %.03273, %.lr.ph66 ]
  %.231 = phi i64 [ %87, %82 ], [ %61, %59 ], [ %.13063, %.lr.ph66 ], [ %77, %70 ]
  %.2 = phi i64 [ %.02775, %82 ], [ %.12861, %59 ], [ %.12864, %.lr.ph66 ], [ %.128, %70 ]
  %91 = load i32, ptr %2, align 4, !tbaa !5
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr %2, align 4, !tbaa !5
  %93 = load i32, ptr @n, align 4, !tbaa !5
  %94 = icmp slt i32 %92, %93
  br i1 %94, label %.lr.ph77, label %._crit_edge78, !llvm.loop !22

95:                                               ; preds = %89, %79
  %.pn = phi { ptr, i32 } [ %80, %79 ], [ %90, %89 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  br label %106

96:                                               ; preds = %._crit_edge78
  %97 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %50, ptr noundef nonnull @.str.1)
          to label %98 unwind label %104

98:                                               ; preds = %96
  %99 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %97, i64 noundef %.034.lcssa)
          to label %100 unwind label %104

100:                                              ; preds = %98
  %101 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %99, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %102 unwind label %104

102:                                              ; preds = %100
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %1) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #7
  br label %103

103:                                              ; preds = %19, %102
  ret void

104:                                              ; preds = %100, %98, %96, %._crit_edge78
  %105 = landingpad { ptr, i32 }
          cleanup
  br label %106

106:                                              ; preds = %104, %95
  %.pn.pn = phi { ptr, i32 } [ %.pn, %95 ], [ %105, %104 ]
  call void @_ZNSt14priority_queueISt4pairIiiESt6vectorIS1_SaIS1_EESt4lessIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %1) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #7
  resume { ptr, i32 } %.pn.pn
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIP1PEvT_S2_(ptr noundef, ptr noundef) local_unnamed_addr #2

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #4

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIP1PPFbS0_S0_EEvT_S4_T0_(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #1 align 2

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #6

attributes #0 = { 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 #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 = { inlinehint 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { "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 = { 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { 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, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_ZTS1P", !10, i64 0, !10, i64 8, !10, i64 16}
!13 = !{!12, !10, i64 8}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
!18 = distinct !{!18, !15}
!19 = !{!20, !6, i64 0}
!20 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!21 = distinct !{!21, !15}
!22 = distinct !{!22, !15}


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