; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2008-09/toys.ll (Z4testi)

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

%"struct.std::pair" = type { i32, i32 }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::_Rb_tree_iterator" = type { ptr }
%"struct.std::pair.0" = type { i32, i32 }

@D = external dso_local global i32, align 4
@Tc = external dso_local global i32, align 4
@T = external dso_local global [100001 x i32], align 16
@a = external dso_local global %"struct.std::pair", align 4
@b = external dso_local global %"struct.std::pair", align 4

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z4testi(i32 noundef %0) #0 personality ptr @__gxx_personality_v0 {
  %2 = alloca i64, align 8
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = alloca %"class.std::map", align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %13 = alloca i32, align 4
  %14 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %15 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %16 = alloca i32, align 4
  %17 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %18 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %19 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %20 = alloca i32, align 4
  %21 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %22 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %23 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %24 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %25 = alloca i32, align 4
  %26 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %27 = alloca %"struct.std::_Rb_tree_iterator", align 8
  store i32 %0, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  %28 = load i32, ptr %3, align 4, !tbaa !5
  %29 = load i32, ptr @Tc, align 4, !tbaa !5
  %30 = load i32, ptr @b, align 4, !tbaa !9
  %31 = sub nsw i32 %29, %30
  %32 = mul nsw i32 %28, %31
  %33 = sext i32 %32 to i64
  store i64 %33, ptr %4, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 48, ptr %5) #6
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #6
  %34 = load i32, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 -1000000007, ptr %6, align 4, !tbaa !5
  %35 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %36 unwind label %42

36:                                               ; preds = %1
  store i32 %34, ptr %35, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %37

37:                                               ; preds = %194, %36
  %38 = load i32, ptr %9, align 4, !tbaa !5
  %39 = load i32, ptr @D, align 4, !tbaa !5
  %40 = icmp slt i32 %38, %39
  br i1 %40, label %46, label %41

41:                                               ; preds = %37
  store i32 2, ptr %10, align 4
  br label %197

42:                                               ; preds = %1
  %43 = landingpad { ptr, i32 }
          cleanup
  %44 = extractvalue { ptr, i32 } %43, 0
  store ptr %44, ptr %7, align 8
  %45 = extractvalue { ptr, i32 } %43, 1
  store i32 %45, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %203

46:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %47 = load i32, ptr %9, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [100001 x i32], ptr @T, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  store i32 %50, ptr %11, align 4, !tbaa !5
  br label %51

51:                                               ; preds = %188, %46
  %52 = load i32, ptr %11, align 4, !tbaa !5
  %53 = icmp ne i32 %52, 0
  br i1 %53, label %54, label %190

54:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %55 = load i32, ptr %9, align 4, !tbaa !5
  %56 = load i32, ptr getelementptr inbounds (%"struct.std::pair", ptr @b, i32 0, i32 1), align 4, !tbaa !13
  %57 = sub nsw i32 %55, %56
  store i32 %57, ptr %13, align 4, !tbaa !5
  %58 = invoke ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE11upper_boundERS3_(ptr noundef nonnull align 8 dereferenceable(48) %5, ptr noundef nonnull align 4 dereferenceable(4) %13)
          to label %59 unwind label %75

59:                                               ; preds = %54
  %60 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %12, i32 0, i32 0
  store ptr %58, ptr %60, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %61 = call ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %5) #6
  %62 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %14, i32 0, i32 0
  store ptr %61, ptr %62, align 8
  %63 = call noundef zeroext i1 @_ZSteqRKSt17_Rb_tree_iteratorISt4pairIKiiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(8) %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br i1 %63, label %64, label %136

64:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %65 = load i32, ptr %9, align 4, !tbaa !5
  %66 = load i32, ptr getelementptr inbounds (%"struct.std::pair", ptr @a, i32 0, i32 1), align 4, !tbaa !13
  %67 = sub nsw i32 %65, %66
  store i32 %67, ptr %16, align 4, !tbaa !5
  %68 = invoke ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE11upper_boundERS3_(ptr noundef nonnull align 8 dereferenceable(48) %5, ptr noundef nonnull align 4 dereferenceable(4) %16)
          to label %69 unwind label %79

69:                                               ; preds = %64
  %70 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %15, i32 0, i32 0
  store ptr %68, ptr %70, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %71 = call ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %5) #6
  %72 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %17, i32 0, i32 0
  store ptr %71, ptr %72, align 8
  %73 = call noundef zeroext i1 @_ZSteqRKSt17_Rb_tree_iteratorISt4pairIKiiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull align 8 dereferenceable(8) %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  br i1 %73, label %74, label %83

74:                                               ; preds = %69
  store i64 2000000014, ptr %2, align 8
  store i32 1, ptr %10, align 4
  br label %132

75:                                               ; preds = %54
  %76 = landingpad { ptr, i32 }
          cleanup
  %77 = extractvalue { ptr, i32 } %76, 0
  store ptr %77, ptr %7, align 8
  %78 = extractvalue { ptr, i32 } %76, 1
  store i32 %78, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %189

79:                                               ; preds = %64
  %80 = landingpad { ptr, i32 }
          cleanup
  %81 = extractvalue { ptr, i32 } %80, 0
  store ptr %81, ptr %7, align 8
  %82 = extractvalue { ptr, i32 } %80, 1
  store i32 %82, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %135

83:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %19, ptr align 8 %15, i64 8, i1 false), !tbaa.struct !14
  %84 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %19, i32 0, i32 0
  %85 = load ptr, ptr %84, align 8
  %86 = invoke ptr @_ZSt4prevISt17_Rb_tree_iteratorISt4pairIKiiEEET_S5_NSt15iterator_traitsIS5_E15difference_typeE(ptr %85, i64 noundef 1)
          to label %87 unwind label %123

87:                                               ; preds = %83
  %88 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %18, i32 0, i32 0
  store ptr %86, ptr %88, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %15, ptr align 8 %18, i64 8, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  %89 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %15) #6
  %90 = getelementptr inbounds %"struct.std::pair.0", ptr %89, i32 0, i32 1
  %91 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %90)
          to label %92 unwind label %127

92:                                               ; preds = %87
  %93 = load i32, ptr %91, align 4, !tbaa !5
  store i32 %93, ptr %20, align 4, !tbaa !5
  %94 = load i32, ptr %20, align 4, !tbaa !5
  %95 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %15) #6
  %96 = getelementptr inbounds %"struct.std::pair.0", ptr %95, i32 0, i32 1
  %97 = load i32, ptr %96, align 4, !tbaa !17
  %98 = sub nsw i32 %97, %94
  store i32 %98, ptr %96, align 4, !tbaa !17
  %99 = load i32, ptr %20, align 4, !tbaa !5
  %100 = load i32, ptr %11, align 4, !tbaa !5
  %101 = sub nsw i32 %100, %99
  store i32 %101, ptr %11, align 4, !tbaa !5
  %102 = load i32, ptr %20, align 4, !tbaa !5
  %103 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %5, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %104 unwind label %127

104:                                              ; preds = %92
  %105 = load i32, ptr %103, align 4, !tbaa !5
  %106 = add nsw i32 %105, %102
  store i32 %106, ptr %103, align 4, !tbaa !5
  %107 = load i32, ptr @a, align 4, !tbaa !9
  %108 = load i32, ptr %20, align 4, !tbaa !5
  %109 = mul nsw i32 %107, %108
  %110 = sext i32 %109 to i64
  %111 = load i64, ptr %4, align 8, !tbaa !11
  %112 = add nsw i64 %111, %110
  store i64 %112, ptr %4, align 8, !tbaa !11
  %113 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %15) #6
  %114 = getelementptr inbounds %"struct.std::pair.0", ptr %113, i32 0, i32 1
  %115 = load i32, ptr %114, align 4, !tbaa !17
  %116 = icmp eq i32 %115, 0
  br i1 %116, label %117, label %131

117:                                              ; preds = %104
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %21, ptr align 8 %15, i64 8, i1 false), !tbaa.struct !14
  %118 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %21, i32 0, i32 0
  %119 = load ptr, ptr %118, align 8
  %120 = invoke ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5eraseB5cxx11ESt17_Rb_tree_iteratorIS4_E(ptr noundef nonnull align 8 dereferenceable(48) %5, ptr %119)
          to label %121 unwind label %127

121:                                              ; preds = %117
  %122 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %22, i32 0, i32 0
  store ptr %120, ptr %122, align 8
  br label %131

123:                                              ; preds = %83
  %124 = landingpad { ptr, i32 }
          cleanup
  %125 = extractvalue { ptr, i32 } %124, 0
  store ptr %125, ptr %7, align 8
  %126 = extractvalue { ptr, i32 } %124, 1
  store i32 %126, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  br label %135

127:                                              ; preds = %117, %92, %87
  %128 = landingpad { ptr, i32 }
          cleanup
  %129 = extractvalue { ptr, i32 } %128, 0
  store ptr %129, ptr %7, align 8
  %130 = extractvalue { ptr, i32 } %128, 1
  store i32 %130, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  br label %135

131:                                              ; preds = %121, %104
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  store i32 0, ptr %10, align 4
  br label %132

132:                                              ; preds = %131, %74
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  %133 = load i32, ptr %10, align 4
  switch i32 %133, label %186 [
    i32 0, label %134
  ]

134:                                              ; preds = %132
  br label %185

135:                                              ; preds = %127, %123, %79
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %189

136:                                              ; preds = %59
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %24, ptr align 8 %12, i64 8, i1 false), !tbaa.struct !14
  %137 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %24, i32 0, i32 0
  %138 = load ptr, ptr %137, align 8
  %139 = invoke ptr @_ZSt4prevISt17_Rb_tree_iteratorISt4pairIKiiEEET_S5_NSt15iterator_traitsIS5_E15difference_typeE(ptr %138, i64 noundef 1)
          to label %140 unwind label %176

140:                                              ; preds = %136
  %141 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %23, i32 0, i32 0
  store ptr %139, ptr %141, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %12, ptr align 8 %23, i64 8, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #6
  %142 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #6
  %143 = getelementptr inbounds %"struct.std::pair.0", ptr %142, i32 0, i32 1
  %144 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %143)
          to label %145 unwind label %180

145:                                              ; preds = %140
  %146 = load i32, ptr %144, align 4, !tbaa !5
  store i32 %146, ptr %25, align 4, !tbaa !5
  %147 = load i32, ptr %25, align 4, !tbaa !5
  %148 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #6
  %149 = getelementptr inbounds %"struct.std::pair.0", ptr %148, i32 0, i32 1
  %150 = load i32, ptr %149, align 4, !tbaa !17
  %151 = sub nsw i32 %150, %147
  store i32 %151, ptr %149, align 4, !tbaa !17
  %152 = load i32, ptr %25, align 4, !tbaa !5
  %153 = load i32, ptr %11, align 4, !tbaa !5
  %154 = sub nsw i32 %153, %152
  store i32 %154, ptr %11, align 4, !tbaa !5
  %155 = load i32, ptr %25, align 4, !tbaa !5
  %156 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %5, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %157 unwind label %180

157:                                              ; preds = %145
  %158 = load i32, ptr %156, align 4, !tbaa !5
  %159 = add nsw i32 %158, %155
  store i32 %159, ptr %156, align 4, !tbaa !5
  %160 = load i32, ptr @b, align 4, !tbaa !9
  %161 = load i32, ptr %25, align 4, !tbaa !5
  %162 = mul nsw i32 %160, %161
  %163 = sext i32 %162 to i64
  %164 = load i64, ptr %4, align 8, !tbaa !11
  %165 = add nsw i64 %164, %163
  store i64 %165, ptr %4, align 8, !tbaa !11
  %166 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #6
  %167 = getelementptr inbounds %"struct.std::pair.0", ptr %166, i32 0, i32 1
  %168 = load i32, ptr %167, align 4, !tbaa !17
  %169 = icmp eq i32 %168, 0
  br i1 %169, label %170, label %184

170:                                              ; preds = %157
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %26, ptr align 8 %12, i64 8, i1 false), !tbaa.struct !14
  %171 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %26, i32 0, i32 0
  %172 = load ptr, ptr %171, align 8
  %173 = invoke ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5eraseB5cxx11ESt17_Rb_tree_iteratorIS4_E(ptr noundef nonnull align 8 dereferenceable(48) %5, ptr %172)
          to label %174 unwind label %180

174:                                              ; preds = %170
  %175 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %27, i32 0, i32 0
  store ptr %173, ptr %175, align 8
  br label %184

176:                                              ; preds = %136
  %177 = landingpad { ptr, i32 }
          cleanup
  %178 = extractvalue { ptr, i32 } %177, 0
  store ptr %178, ptr %7, align 8
  %179 = extractvalue { ptr, i32 } %177, 1
  store i32 %179, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  br label %189

180:                                              ; preds = %170, %145, %140
  %181 = landingpad { ptr, i32 }
          cleanup
  %182 = extractvalue { ptr, i32 } %181, 0
  store ptr %182, ptr %7, align 8
  %183 = extractvalue { ptr, i32 } %181, 1
  store i32 %183, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #6
  br label %189

184:                                              ; preds = %174, %157
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #6
  br label %185

185:                                              ; preds = %184, %134
  store i32 0, ptr %10, align 4
  br label %186

186:                                              ; preds = %185, %132
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  %187 = load i32, ptr %10, align 4
  switch i32 %187, label %191 [
    i32 0, label %188
  ]

188:                                              ; preds = %186
  br label %51, !llvm.loop !19

189:                                              ; preds = %180, %176, %135, %75
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %203

190:                                              ; preds = %51
  store i32 0, ptr %10, align 4
  br label %191

191:                                              ; preds = %190, %186
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  %192 = load i32, ptr %10, align 4
  switch i32 %192, label %197 [
    i32 0, label %193
  ]

193:                                              ; preds = %191
  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 %37, !llvm.loop !21

197:                                              ; preds = %191, %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  %198 = load i32, ptr %10, align 4
  switch i32 %198, label %201 [
    i32 2, label %199
  ]

199:                                              ; preds = %197
  %200 = load i64, ptr %4, align 8, !tbaa !11
  store i64 %200, ptr %2, align 8
  store i32 1, ptr %10, align 4
  br label %201

201:                                              ; preds = %199, %197
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  %202 = load i64, ptr %2, align 8
  ret i64 %202

203:                                              ; preds = %189, %42
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  br label %204

204:                                              ; preds = %203
  %205 = load ptr, ptr %7, align 8
  %206 = load i32, ptr %8, align 4
  %207 = insertvalue { ptr, i32 } poison, ptr %205, 0
  %208 = insertvalue { ptr, i32 } %207, i32 %206, 1
  resume { ptr, i32 } %208
}

; 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 @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) #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 uwtable
declare dso_local ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE11upper_boundERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) #0 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local ptr @_ZSt4prevISt17_Rb_tree_iteratorISt4pairIKiiEEET_S5_NSt15iterator_traitsIS5_E15difference_typeE(ptr, i64 noundef) #3

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #5

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #2 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 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = !{!10, !6, i64 4}
!14 = !{i64 0, i64 8, !15}
!15 = !{!16, !16, i64 0}
!16 = !{!"any pointer", !7, i64 0}
!17 = !{!18, !6, i64 4}
!18 = !{!"_ZTSSt4pairIKiiE", !6, i64 0, !6, i64 4}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !20}


; 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.std::pair" = type { i32, i32 }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::_Rb_tree_iterator" = type { ptr }

@D = external dso_local local_unnamed_addr global i32, align 4
@Tc = external dso_local local_unnamed_addr global i32, align 4
@T = external dso_local local_unnamed_addr global [100001 x i32], align 16
@a = external dso_local local_unnamed_addr global %"struct.std::pair", align 4
@b = external dso_local local_unnamed_addr global %"struct.std::pair", align 4

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z4testi(i32 noundef %0) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.std::map", align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %7 = alloca i32, align 4
  %8 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %9 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %10 = alloca i32, align 4
  %11 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %12 = load i32, ptr @Tc, align 4, !tbaa !5
  %13 = load i32, ptr @b, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %2) #5
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  store i32 -1000000007, ptr %3, align 4, !tbaa !5
  %14 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
          to label %15 unwind label %20

15:                                               ; preds = %1
  %16 = sub nsw i32 %12, %13
  %17 = mul nsw i32 %16, %0
  %18 = sext i32 %17 to i64
  store i32 %0, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  %19 = load i32, ptr @D, align 4, !tbaa !5
  %.not4978 = icmp sgt i32 %19, 0
  br i1 %.not4978, label %.lr.ph82, label %.loopexit

20:                                               ; preds = %1
  %21 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  br label %109

.lr.ph82:                                         ; preds = %15, %._crit_edge
  %22 = phi i32 [ %106, %._crit_edge ], [ %19, %15 ]
  %.02980 = phi i64 [ %.130.lcssa, %._crit_edge ], [ %18, %15 ]
  %storemerge79 = phi i32 [ %108, %._crit_edge ], [ 0, %15 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  %23 = sext i32 %storemerge79 to i64
  %24 = getelementptr inbounds [100001 x i32], ptr @T, i64 0, i64 %23
  %25 = load i32, ptr %24, align 4, !tbaa !5
  store i32 %25, ptr %5, align 4, !tbaa !5
  %.not76 = icmp eq i32 %25, 0
  br i1 %.not76, label %._crit_edge, label %.lr.ph

thread-pre-split:                                 ; preds = %.thread55, %.thread
  %.pn61.in = phi i32 [ %93, %.thread ], [ %63, %.thread55 ]
  %.pn61 = sext i32 %.pn61.in to i64
  %.43353 = add nsw i64 %.13077, %.pn61
  %.pr = load i32, ptr %5, align 4, !tbaa !5
  %.not = icmp eq i32 %.pr, 0
  br i1 %.not, label %._crit_edge.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph82, %thread-pre-split
  %.13077 = phi i64 [ %.43353, %thread-pre-split ], [ %.02980, %.lr.ph82 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  %26 = load i32, ptr %4, align 4, !tbaa !5
  %27 = load i32, ptr getelementptr inbounds (i8, ptr @b, i64 4), align 4, !tbaa !11
  %28 = sub nsw i32 %26, %27
  store i32 %28, ptr %7, align 4, !tbaa !5
  %29 = invoke ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE11upper_boundERS3_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %7)
          to label %30 unwind label %41

30:                                               ; preds = %.lr.ph
  store ptr %29, ptr %6, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #5
  %31 = call ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %2) #5
  store ptr %31, ptr %8, align 8
  %32 = call noundef zeroext i1 @_ZSteqRKSt17_Rb_tree_iteratorISt4pairIKiiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  br i1 %32, label %33, label %75

33:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #5
  %34 = load i32, ptr %4, align 4, !tbaa !5
  %35 = load i32, ptr getelementptr inbounds (i8, ptr @a, i64 4), align 4, !tbaa !11
  %36 = sub nsw i32 %34, %35
  store i32 %36, ptr %10, align 4, !tbaa !5
  %37 = invoke ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE11upper_boundERS3_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %10)
          to label %38 unwind label %43

38:                                               ; preds = %33
  store ptr %37, ptr %9, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #5
  %39 = call ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %2) #5
  store ptr %39, ptr %11, align 8
  %40 = call noundef zeroext i1 @_ZSteqRKSt17_Rb_tree_iteratorISt4pairIKiiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #5
  br i1 %40, label %105, label %45

41:                                               ; preds = %.lr.ph
  %42 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  br label %104

43:                                               ; preds = %33
  %44 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #5
  br label %74

45:                                               ; preds = %38
  %.sroa.016.0.copyload = load ptr, ptr %9, align 8, !tbaa !12
  %46 = invoke ptr @_ZSt4prevISt17_Rb_tree_iteratorISt4pairIKiiEEET_S5_NSt15iterator_traitsIS5_E15difference_typeE(ptr %.sroa.016.0.copyload, i64 noundef 1)
          to label %47 unwind label %70

47:                                               ; preds = %45
  store ptr %46, ptr %9, align 8, !tbaa !12
  %48 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #5
  %49 = getelementptr inbounds i8, ptr %48, i64 4
  %50 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %49)
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #5
  %53 = getelementptr inbounds i8, ptr %52, i64 4
  %54 = load i32, ptr %53, align 4, !tbaa !14
  %55 = sub nsw i32 %54, %51
  store i32 %55, ptr %53, align 4, !tbaa !14
  %56 = load i32, ptr %5, align 4, !tbaa !5
  %57 = sub nsw i32 %56, %51
  store i32 %57, ptr %5, align 4, !tbaa !5
  %58 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %59 unwind label %72

59:                                               ; preds = %47
  %60 = load i32, ptr %58, align 4, !tbaa !5
  %61 = add nsw i32 %60, %51
  store i32 %61, ptr %58, align 4, !tbaa !5
  %62 = load i32, ptr @a, align 4, !tbaa !9
  %63 = mul nsw i32 %62, %51
  %64 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #5
  %65 = getelementptr inbounds i8, ptr %64, i64 4
  %66 = load i32, ptr %65, align 4, !tbaa !14
  %67 = icmp eq i32 %66, 0
  br i1 %67, label %68, label %.thread55

68:                                               ; preds = %59
  %.sroa.011.0.copyload = load ptr, ptr %9, align 8, !tbaa !12
  %69 = invoke ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5eraseB5cxx11ESt17_Rb_tree_iteratorIS4_E(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr %.sroa.011.0.copyload)
          to label %.thread55 unwind label %72

70:                                               ; preds = %45
  %71 = landingpad { ptr, i32 }
          cleanup
  br label %74

72:                                               ; preds = %68, %47
  %73 = landingpad { ptr, i32 }
          cleanup
  br label %74

74:                                               ; preds = %72, %70, %43
  %.pn = phi { ptr, i32 } [ %73, %72 ], [ %71, %70 ], [ %44, %43 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #5
  br label %104

75:                                               ; preds = %30
  %.sroa.08.0.copyload = load ptr, ptr %6, align 8, !tbaa !12
  %76 = invoke ptr @_ZSt4prevISt17_Rb_tree_iteratorISt4pairIKiiEEET_S5_NSt15iterator_traitsIS5_E15difference_typeE(ptr %.sroa.08.0.copyload, i64 noundef 1)
          to label %77 unwind label %100

77:                                               ; preds = %75
  store ptr %76, ptr %6, align 8, !tbaa !12
  %78 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #5
  %79 = getelementptr inbounds i8, ptr %78, i64 4
  %80 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %79)
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #5
  %83 = getelementptr inbounds i8, ptr %82, i64 4
  %84 = load i32, ptr %83, align 4, !tbaa !14
  %85 = sub nsw i32 %84, %81
  store i32 %85, ptr %83, align 4, !tbaa !14
  %86 = load i32, ptr %5, align 4, !tbaa !5
  %87 = sub nsw i32 %86, %81
  store i32 %87, ptr %5, align 4, !tbaa !5
  %88 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %89 unwind label %102

89:                                               ; preds = %77
  %90 = load i32, ptr %88, align 4, !tbaa !5
  %91 = add nsw i32 %90, %81
  store i32 %91, ptr %88, align 4, !tbaa !5
  %92 = load i32, ptr @b, align 4, !tbaa !9
  %93 = mul nsw i32 %92, %81
  %94 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #5
  %95 = getelementptr inbounds i8, ptr %94, i64 4
  %96 = load i32, ptr %95, align 4, !tbaa !14
  %97 = icmp eq i32 %96, 0
  br i1 %97, label %98, label %.thread

98:                                               ; preds = %89
  %.sroa.04.0.copyload = load ptr, ptr %6, align 8, !tbaa !12
  %99 = invoke ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5eraseB5cxx11ESt17_Rb_tree_iteratorIS4_E(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr %.sroa.04.0.copyload)
          to label %.thread unwind label %102

100:                                              ; preds = %75
  %101 = landingpad { ptr, i32 }
          cleanup
  br label %104

102:                                              ; preds = %98, %77
  %103 = landingpad { ptr, i32 }
          cleanup
  br label %104

.thread:                                          ; preds = %89, %98
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  br label %thread-pre-split

.thread55:                                        ; preds = %68, %59
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  br label %thread-pre-split

104:                                              ; preds = %102, %100, %74, %41
  %.pn.pn = phi { ptr, i32 } [ %.pn, %74 ], [ %103, %102 ], [ %101, %100 ], [ %42, %41 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  br label %109

105:                                              ; preds = %38
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  br label %.loopexit

._crit_edge.loopexit:                             ; preds = %thread-pre-split
  %.pre = load i32, ptr %4, align 4, !tbaa !5
  %.pre84 = load i32, ptr @D, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.lr.ph82
  %106 = phi i32 [ %22, %.lr.ph82 ], [ %.pre84, %._crit_edge.loopexit ]
  %107 = phi i32 [ %storemerge79, %.lr.ph82 ], [ %.pre, %._crit_edge.loopexit ]
  %.130.lcssa = phi i64 [ %.02980, %.lr.ph82 ], [ %.43353, %._crit_edge.loopexit ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %4, align 4, !tbaa !5
  %.not49 = icmp slt i32 %108, %106
  br i1 %.not49, label %.lr.ph82, label %.loopexit, !llvm.loop !16

.loopexit:                                        ; preds = %._crit_edge, %15, %105
  %spec.select = phi i64 [ 2000000014, %105 ], [ %18, %15 ], [ %.130.lcssa, %._crit_edge ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %2) #5
  ret i64 %spec.select

109:                                              ; preds = %104, %20
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %104 ], [ %21, %20 ]
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %2) #5
  resume { ptr, i32 } %.pn.pn.pn
}

; 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 @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) 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 uwtable
declare dso_local ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE11upper_boundERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local ptr @_ZSt4prevISt17_Rb_tree_iteratorISt4pairIKiiEEET_S5_NSt15iterator_traitsIS5_E15difference_typeE(ptr, i64 noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #2 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 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 = { 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 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!11 = !{!10, !6, i64 4}
!12 = !{!13, !13, i64 0}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!15, !6, i64 4}
!15 = !{!"_ZTSSt4pairIKiiE", !6, i64 0, !6, i64 4}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


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