; LLVM IR from upupming/algorithm :: kick-start/2021/RoundD/B.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"

%"class.std::basic_istream" = type { ptr, i64, %"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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%class.anon = type { i8 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@c = external dso_local global i64, align 8
@l = external dso_local global [100010 x i64], align 16
@r = external dso_local global [100010 x i64], align 16
@a = external dso_local global [400040 x i64], align 16
@diff = external dso_local global [400040 x i64], align 16
@cnt = external dso_local global [400040 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z5queryx(i64 noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z5solvev() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"class.std::vector", align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %11 = alloca %class.anon, align 1
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %18, ptr noundef nonnull align 8 dereferenceable(8) @c)
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #6
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %20

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

24:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #6
  br label %74

25:                                               ; preds = %20
  %26 = load i32, ptr %1, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [100010 x i64], ptr @l, i64 0, i64 %27
  %29 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %28)
  %30 = load i32, ptr %1, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [100010 x i64], ptr @r, i64 0, i64 %31
  %33 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %29, ptr noundef nonnull align 8 dereferenceable(8) %32)
  %34 = load i32, ptr %1, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [100010 x i64], ptr @l, i64 0, i64 %35
  %37 = load i64, ptr %36, align 8, !tbaa !9
  %38 = load i32, ptr %1, align 4, !tbaa !5
  %39 = mul nsw i32 4, %38
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [400040 x i64], ptr @a, i64 0, i64 %40
  store i64 %37, ptr %41, align 8, !tbaa !9
  %42 = load i32, ptr %1, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [100010 x i64], ptr @r, i64 0, i64 %43
  %45 = load i64, ptr %44, align 8, !tbaa !9
  %46 = load i32, ptr %1, align 4, !tbaa !5
  %47 = mul nsw i32 4, %46
  %48 = add nsw i32 %47, 1
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [400040 x i64], ptr @a, i64 0, i64 %49
  store i64 %45, ptr %50, align 8, !tbaa !9
  %51 = load i32, ptr %1, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [100010 x i64], ptr @l, i64 0, i64 %52
  %54 = load i64, ptr %53, align 8, !tbaa !9
  %55 = add nsw i64 %54, 1
  %56 = load i32, ptr %1, align 4, !tbaa !5
  %57 = mul nsw i32 4, %56
  %58 = add nsw i32 %57, 2
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [400040 x i64], ptr @a, i64 0, i64 %59
  store i64 %55, ptr %60, align 8, !tbaa !9
  %61 = load i32, ptr %1, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [100010 x i64], ptr @r, i64 0, i64 %62
  %64 = load i64, ptr %63, align 8, !tbaa !9
  %65 = sub nsw i64 %64, 1
  %66 = load i32, ptr %1, align 4, !tbaa !5
  %67 = mul nsw i32 4, %66
  %68 = add nsw i32 %67, 3
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [400040 x i64], ptr @a, i64 0, i64 %69
  store i64 %65, ptr %70, align 8, !tbaa !9
  br label %71

71:                                               ; preds = %25
  %72 = load i32, ptr %1, align 4, !tbaa !5
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %1, align 4, !tbaa !5
  br label %20, !llvm.loop !11

74:                                               ; preds = %24
  %75 = load i32, ptr @n, align 4, !tbaa !5
  %76 = mul nsw i32 4, %75
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds i64, ptr @a, i64 %77
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef @a, ptr noundef %78)
  %79 = load i32, ptr @n, align 4, !tbaa !5
  %80 = mul nsw i32 4, %79
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds i64, ptr @a, i64 %81
  %83 = call noundef ptr @_ZSt6uniqueIPxET_S1_S1_(ptr noundef @a, ptr noundef %82)
  %84 = ptrtoint ptr %83 to i64
  %85 = sub i64 %84, ptrtoint (ptr @a to i64)
  %86 = sdiv exact i64 %85, 8
  %87 = trunc i64 %86 to i32
  store i32 %87, ptr @m, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %88

88:                                               ; preds = %97, %74
  %89 = load i32, ptr %2, align 4, !tbaa !5
  %90 = load i32, ptr @m, align 4, !tbaa !5
  %91 = icmp slt i32 %89, %90
  br i1 %91, label %93, label %92

92:                                               ; preds = %88
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %100

93:                                               ; preds = %88
  %94 = load i32, ptr %2, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [400040 x i64], ptr @diff, i64 0, i64 %95
  store i64 0, ptr %96, align 8, !tbaa !9
  br label %97

97:                                               ; preds = %93
  %98 = load i32, ptr %2, align 4, !tbaa !5
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr %2, align 4, !tbaa !5
  br label %88, !llvm.loop !13

100:                                              ; preds = %92
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %101

101:                                              ; preds = %126, %100
  %102 = load i32, ptr %3, align 4, !tbaa !5
  %103 = load i32, ptr @n, align 4, !tbaa !5
  %104 = icmp slt i32 %102, %103
  br i1 %104, label %106, label %105

105:                                              ; preds = %101
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %129

106:                                              ; preds = %101
  %107 = load i32, ptr %3, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [100010 x i64], ptr @l, i64 0, i64 %108
  %110 = load i64, ptr %109, align 8, !tbaa !9
  %111 = add nsw i64 %110, 1
  %112 = call noundef i32 @_Z5queryx(i64 noundef %111)
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [400040 x i64], ptr @diff, i64 0, i64 %113
  %115 = load i64, ptr %114, align 8, !tbaa !9
  %116 = add nsw i64 %115, 1
  store i64 %116, ptr %114, align 8, !tbaa !9
  %117 = load i32, ptr %3, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [100010 x i64], ptr @r, i64 0, i64 %118
  %120 = load i64, ptr %119, align 8, !tbaa !9
  %121 = call noundef i32 @_Z5queryx(i64 noundef %120)
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [400040 x i64], ptr @diff, i64 0, i64 %122
  %124 = load i64, ptr %123, align 8, !tbaa !9
  %125 = sub nsw i64 %124, 1
  store i64 %125, ptr %123, align 8, !tbaa !9
  br label %126

126:                                              ; preds = %106
  %127 = load i32, ptr %3, align 4, !tbaa !5
  %128 = add nsw i32 %127, 1
  store i32 %128, ptr %3, align 4, !tbaa !5
  br label %101, !llvm.loop !14

129:                                              ; preds = %105
  %130 = load i64, ptr @diff, align 16, !tbaa !9
  store i64 %130, ptr @cnt, align 16, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %131

131:                                              ; preds = %150, %129
  %132 = load i32, ptr %4, align 4, !tbaa !5
  %133 = load i32, ptr @m, align 4, !tbaa !5
  %134 = icmp slt i32 %132, %133
  br i1 %134, label %136, label %135

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

136:                                              ; preds = %131
  %137 = load i32, ptr %4, align 4, !tbaa !5
  %138 = sub nsw i32 %137, 1
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [400040 x i64], ptr @cnt, i64 0, i64 %139
  %141 = load i64, ptr %140, align 8, !tbaa !9
  %142 = load i32, ptr %4, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [400040 x i64], ptr @diff, i64 0, i64 %143
  %145 = load i64, ptr %144, align 8, !tbaa !9
  %146 = add nsw i64 %141, %145
  %147 = load i32, ptr %4, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [400040 x i64], ptr @cnt, i64 0, i64 %148
  store i64 %146, ptr %149, align 8, !tbaa !9
  br label %150

150:                                              ; preds = %136
  %151 = load i32, ptr %4, align 4, !tbaa !5
  %152 = add nsw i32 %151, 1
  store i32 %152, ptr %4, align 4, !tbaa !5
  br label %131, !llvm.loop !15

153:                                              ; preds = %135
  call void @llvm.lifetime.start.p0(i64 24, ptr %5) #6
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %154

154:                                              ; preds = %161, %153
  %155 = load i32, ptr %6, align 4, !tbaa !5
  %156 = load i32, ptr @m, align 4, !tbaa !5
  %157 = icmp slt i32 %155, %156
  br i1 %157, label %159, label %158

158:                                              ; preds = %154
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %168

159:                                              ; preds = %154
  invoke void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %160 unwind label %164

160:                                              ; preds = %159
  br label %161

161:                                              ; preds = %160
  %162 = load i32, ptr %6, align 4, !tbaa !5
  %163 = add nsw i32 %162, 1
  store i32 %163, ptr %6, align 4, !tbaa !5
  br label %154, !llvm.loop !16

164:                                              ; preds = %159
  %165 = landingpad { ptr, i32 }
          cleanup
  %166 = extractvalue { ptr, i32 } %165, 0
  store ptr %166, ptr %7, align 8
  %167 = extractvalue { ptr, i32 } %165, 1
  store i32 %167, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %243

168:                                              ; preds = %158
  %169 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  %170 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  store ptr %169, ptr %170, align 8
  %171 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  %172 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %10, i32 0, i32 0
  store ptr %171, ptr %172, align 8
  %173 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  %174 = load ptr, ptr %173, align 8
  %175 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %10, i32 0, i32 0
  %176 = load ptr, ptr %175, align 8
  invoke void @"_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEZ5solvevE3$_0EvT_S8_T0_"(ptr %174, ptr %176)
          to label %177 unwind label %190

177:                                              ; preds = %168
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %178 = load i32, ptr @n, align 4, !tbaa !5
  %179 = sext i32 %178 to i64
  store i64 %179, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %180

180:                                              ; preds = %234, %177
  %181 = load i32, ptr %13, align 4, !tbaa !5
  %182 = load i32, ptr @m, align 4, !tbaa !5
  %183 = icmp slt i32 %181, %182
  br i1 %183, label %184, label %187

184:                                              ; preds = %180
  %185 = load i64, ptr @c, align 8, !tbaa !9
  %186 = icmp ne i64 %185, 0
  br label %187

187:                                              ; preds = %184, %180
  %188 = phi i1 [ false, %180 ], [ %186, %184 ]
  br i1 %188, label %194, label %189

189:                                              ; preds = %187
  store i32 17, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %241

190:                                              ; preds = %168
  %191 = landingpad { ptr, i32 }
          cleanup
  %192 = extractvalue { ptr, i32 } %191, 0
  store ptr %192, ptr %7, align 8
  %193 = extractvalue { ptr, i32 } %191, 1
  store i32 %193, ptr %8, align 4
  br label %243

194:                                              ; preds = %187
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %195 = load i32, ptr %13, align 4, !tbaa !5
  %196 = sext i32 %195 to i64
  %197 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %196) #6
  %198 = load i32, ptr %197, align 4, !tbaa !5
  store i32 %198, ptr %15, align 4, !tbaa !5
  %199 = load i32, ptr %15, align 4, !tbaa !5
  %200 = add nsw i32 %199, 1
  %201 = load i32, ptr @m, align 4, !tbaa !5
  %202 = icmp sge i32 %200, %201
  br i1 %202, label %203, label %204

203:                                              ; preds = %194
  store i32 19, ptr %14, align 4
  br label %231

204:                                              ; preds = %194
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %205 = load i32, ptr %15, align 4, !tbaa !5
  %206 = add nsw i32 %205, 1
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds [400040 x i64], ptr @a, i64 0, i64 %207
  %209 = load i64, ptr %208, align 8, !tbaa !9
  %210 = load i32, ptr %15, align 4, !tbaa !5
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [400040 x i64], ptr @a, i64 0, i64 %211
  %213 = load i64, ptr %212, align 8, !tbaa !9
  %214 = sub nsw i64 %209, %213
  store i64 %214, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %215 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(8) @c)
          to label %216 unwind label %237

216:                                              ; preds = %204
  %217 = load i64, ptr %215, align 8, !tbaa !9
  %218 = load i32, ptr %15, align 4, !tbaa !5
  %219 = sext i32 %218 to i64
  %220 = getelementptr inbounds [400040 x i64], ptr @cnt, i64 0, i64 %219
  %221 = load i64, ptr %220, align 8, !tbaa !9
  %222 = mul nsw i64 %217, %221
  store i64 %222, ptr %17, align 8, !tbaa !9
  %223 = load i64, ptr %17, align 8, !tbaa !9
  %224 = load i64, ptr %12, align 8, !tbaa !9
  %225 = add nsw i64 %224, %223
  store i64 %225, ptr %12, align 8, !tbaa !9
  %226 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(8) @c)
          to label %227 unwind label %237

227:                                              ; preds = %216
  %228 = load i64, ptr %226, align 8, !tbaa !9
  %229 = load i64, ptr @c, align 8, !tbaa !9
  %230 = sub nsw i64 %229, %228
  store i64 %230, ptr @c, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  store i32 0, ptr %14, align 4
  br label %231

231:                                              ; preds = %227, %203
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  %232 = load i32, ptr %14, align 4
  switch i32 %232, label %249 [
    i32 0, label %233
    i32 19, label %234
  ]

233:                                              ; preds = %231
  br label %234

234:                                              ; preds = %233, %231
  %235 = load i32, ptr %13, align 4, !tbaa !5
  %236 = add nsw i32 %235, 1
  store i32 %236, ptr %13, align 4, !tbaa !5
  br label %180, !llvm.loop !17

237:                                              ; preds = %216, %204
  %238 = landingpad { ptr, i32 }
          cleanup
  %239 = extractvalue { ptr, i32 } %238, 0
  store ptr %239, ptr %7, align 8
  %240 = extractvalue { ptr, i32 } %238, 1
  store i32 %240, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %243

241:                                              ; preds = %189
  %242 = load i64, ptr %12, align 8, !tbaa !9
  store i32 1, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #6
  ret i64 %242

243:                                              ; preds = %237, %190, %164
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #6
  br label %244

244:                                              ; preds = %243
  %245 = load ptr, ptr %7, align 8
  %246 = load i32, ptr %8, align 4
  %247 = insertvalue { ptr, i32 } poison, ptr %245, 0
  %248 = insertvalue { ptr, i32 } %247, i32 %246, 1
  resume { ptr, i32 } %248

249:                                              ; preds = %231
  unreachable
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #1

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

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

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

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

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

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEZ5solvevE3$_0EvT_S8_T0_"(ptr, ptr) #3

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

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

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

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

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::basic_istream" = type { ptr, i64, %"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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@n = external dso_local global i32, align 4
@m = external dso_local local_unnamed_addr global i32, align 4
@c = external dso_local global i64, align 8
@l = external dso_local global [100010 x i64], align 16
@r = external dso_local global [100010 x i64], align 16
@a = external dso_local global [400040 x i64], align 16
@diff = external dso_local local_unnamed_addr global [400040 x i64], align 16
@cnt = external dso_local local_unnamed_addr global [400040 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z5queryx(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z5solvev() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::vector", align 8
  %2 = alloca i32, align 4
  %3 = alloca i64, align 8
  %4 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %5 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 8 dereferenceable(8) @c)
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  %.lcssa = phi i32 [ %6, %0 ], [ %38, %.lr.ph ]
  %8 = shl nsw i32 %.lcssa, 2
  %9 = sext i32 %8 to i64
  %10 = getelementptr inbounds i64, ptr @a, i64 %9
  tail call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull @a, ptr noundef nonnull %10)
  %11 = load i32, ptr @n, align 4, !tbaa !5
  %12 = shl nsw i32 %11, 2
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds i64, ptr @a, i64 %13
  %15 = tail call noundef ptr @_ZSt6uniqueIPxET_S1_S1_(ptr noundef nonnull @a, ptr noundef nonnull %14)
  %16 = ptrtoint ptr %15 to i64
  %17 = sub i64 %16, ptrtoint (ptr @a to i64)
  %18 = lshr exact i64 %17, 3
  %19 = trunc i64 %18 to i32
  store i32 %19, ptr @m, align 4, !tbaa !5
  %20 = icmp sgt i32 %19, 0
  br i1 %20, label %.lr.ph49.preheader, label %.preheader

.lr.ph49.preheader:                               ; preds = %._crit_edge
  %21 = and i64 %17, 17179869176
  tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @diff, i8 0, i64 %21, i1 false), !tbaa !9
  br label %.preheader

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %22 = getelementptr inbounds [100010 x i64], ptr @l, i64 0, i64 %indvars.iv
  %23 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %22)
  %24 = getelementptr inbounds [100010 x i64], ptr @r, i64 0, i64 %indvars.iv
  %25 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef nonnull align 8 dereferenceable(8) %24)
  %26 = load i64, ptr %22, align 8, !tbaa !9
  %27 = shl nsw i64 %indvars.iv, 2
  %28 = getelementptr inbounds [400040 x i64], ptr @a, i64 0, i64 %27
  store i64 %26, ptr %28, align 16, !tbaa !9
  %29 = load i64, ptr %24, align 8, !tbaa !9
  %30 = or disjoint i64 %27, 1
  %31 = getelementptr inbounds [400040 x i64], ptr @a, i64 0, i64 %30
  store i64 %29, ptr %31, align 8, !tbaa !9
  %32 = add nsw i64 %26, 1
  %33 = or disjoint i64 %27, 2
  %34 = getelementptr inbounds [400040 x i64], ptr @a, i64 0, i64 %33
  store i64 %32, ptr %34, align 16, !tbaa !9
  %35 = add nsw i64 %29, -1
  %36 = or disjoint i64 %27, 3
  %37 = getelementptr inbounds [400040 x i64], ptr @a, i64 0, i64 %36
  store i64 %35, ptr %37, align 8, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %38 = load i32, ptr @n, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = icmp slt i64 %indvars.iv.next, %39
  br i1 %40, label %.lr.ph, label %._crit_edge, !llvm.loop !11

.preheader:                                       ; preds = %.lr.ph49.preheader, %._crit_edge
  %41 = load i32, ptr @n, align 4, !tbaa !5
  %42 = icmp sgt i32 %41, 0
  br i1 %42, label %.lr.ph51, label %._crit_edge52

._crit_edge52.loopexit:                           ; preds = %.lr.ph51
  %.pre = load i32, ptr @m, align 4, !tbaa !5
  br label %._crit_edge52

._crit_edge52:                                    ; preds = %._crit_edge52.loopexit, %.preheader
  %43 = phi i32 [ %.pre, %._crit_edge52.loopexit ], [ %19, %.preheader ]
  %44 = load i64, ptr @diff, align 16, !tbaa !9
  store i64 %44, ptr @cnt, align 16, !tbaa !9
  %45 = icmp sgt i32 %43, 1
  br i1 %45, label %.lr.ph55.preheader, label %._crit_edge56

.lr.ph55.preheader:                               ; preds = %._crit_edge52
  %wide.trip.count = zext nneg i32 %43 to i64
  %46 = add nsw i64 %wide.trip.count, -1
  %47 = add nsw i64 %wide.trip.count, -2
  %xtraiter = and i64 %46, 3
  %48 = icmp ult i64 %47, 3
  br i1 %48, label %._crit_edge56.loopexit.unr-lcssa, label %.lr.ph55.preheader.new

.lr.ph55.preheader.new:                           ; preds = %.lr.ph55.preheader
  %unroll_iter = and i64 %46, -4
  br label %.lr.ph55

.lr.ph51:                                         ; preds = %.preheader, %.lr.ph51
  %indvars.iv71 = phi i64 [ %indvars.iv.next72, %.lr.ph51 ], [ 0, %.preheader ]
  %49 = getelementptr inbounds [100010 x i64], ptr @l, i64 0, i64 %indvars.iv71
  %50 = load i64, ptr %49, align 8, !tbaa !9
  %51 = add nsw i64 %50, 1
  %52 = tail call noundef i32 @_Z5queryx(i64 noundef %51)
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [400040 x i64], ptr @diff, i64 0, i64 %53
  %55 = load i64, ptr %54, align 8, !tbaa !9
  %56 = add nsw i64 %55, 1
  store i64 %56, ptr %54, align 8, !tbaa !9
  %57 = getelementptr inbounds [100010 x i64], ptr @r, i64 0, i64 %indvars.iv71
  %58 = load i64, ptr %57, align 8, !tbaa !9
  %59 = tail call noundef i32 @_Z5queryx(i64 noundef %58)
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [400040 x i64], ptr @diff, i64 0, i64 %60
  %62 = load i64, ptr %61, align 8, !tbaa !9
  %63 = add nsw i64 %62, -1
  store i64 %63, ptr %61, align 8, !tbaa !9
  %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
  %64 = load i32, ptr @n, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = icmp slt i64 %indvars.iv.next72, %65
  br i1 %66, label %.lr.ph51, label %._crit_edge52.loopexit, !llvm.loop !13

._crit_edge56.loopexit.unr-lcssa:                 ; preds = %.lr.ph55, %.lr.ph55.preheader
  %.unr = phi i64 [ %44, %.lr.ph55.preheader ], [ %89, %.lr.ph55 ]
  %indvars.iv74.unr = phi i64 [ 1, %.lr.ph55.preheader ], [ %indvars.iv.next75.3, %.lr.ph55 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge56, label %.lr.ph55.epil

.lr.ph55.epil:                                    ; preds = %._crit_edge56.loopexit.unr-lcssa, %.lr.ph55.epil
  %67 = phi i64 [ %70, %.lr.ph55.epil ], [ %.unr, %._crit_edge56.loopexit.unr-lcssa ]
  %indvars.iv74.epil = phi i64 [ %indvars.iv.next75.epil, %.lr.ph55.epil ], [ %indvars.iv74.unr, %._crit_edge56.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph55.epil ], [ 0, %._crit_edge56.loopexit.unr-lcssa ]
  %68 = getelementptr inbounds [400040 x i64], ptr @diff, i64 0, i64 %indvars.iv74.epil
  %69 = load i64, ptr %68, align 8, !tbaa !9
  %70 = add nsw i64 %69, %67
  %71 = getelementptr inbounds [400040 x i64], ptr @cnt, i64 0, i64 %indvars.iv74.epil
  store i64 %70, ptr %71, align 8, !tbaa !9
  %indvars.iv.next75.epil = add nuw nsw i64 %indvars.iv74.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_edge56, label %.lr.ph55.epil, !llvm.loop !14

._crit_edge56:                                    ; preds = %._crit_edge56.loopexit.unr-lcssa, %.lr.ph55.epil, %._crit_edge52
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %1) #7
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  store i32 0, ptr %2, align 4, !tbaa !5
  %72 = load i32, ptr @m, align 4, !tbaa !5
  %73 = icmp sgt i32 %72, 0
  br i1 %73, label %.lr.ph58, label %._crit_edge59

.lr.ph55:                                         ; preds = %.lr.ph55, %.lr.ph55.preheader.new
  %74 = phi i64 [ %44, %.lr.ph55.preheader.new ], [ %89, %.lr.ph55 ]
  %indvars.iv74 = phi i64 [ 1, %.lr.ph55.preheader.new ], [ %indvars.iv.next75.3, %.lr.ph55 ]
  %niter = phi i64 [ 0, %.lr.ph55.preheader.new ], [ %niter.next.3, %.lr.ph55 ]
  %75 = getelementptr inbounds [400040 x i64], ptr @diff, i64 0, i64 %indvars.iv74
  %76 = load i64, ptr %75, align 8, !tbaa !9
  %77 = add nsw i64 %76, %74
  %78 = getelementptr inbounds [400040 x i64], ptr @cnt, i64 0, i64 %indvars.iv74
  store i64 %77, ptr %78, align 8, !tbaa !9
  %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
  %79 = getelementptr inbounds [400040 x i64], ptr @diff, i64 0, i64 %indvars.iv.next75
  %80 = load i64, ptr %79, align 8, !tbaa !9
  %81 = add nsw i64 %80, %77
  %82 = getelementptr inbounds [400040 x i64], ptr @cnt, i64 0, i64 %indvars.iv.next75
  store i64 %81, ptr %82, align 8, !tbaa !9
  %indvars.iv.next75.1 = add nuw nsw i64 %indvars.iv74, 2
  %83 = getelementptr inbounds [400040 x i64], ptr @diff, i64 0, i64 %indvars.iv.next75.1
  %84 = load i64, ptr %83, align 8, !tbaa !9
  %85 = add nsw i64 %84, %81
  %86 = getelementptr inbounds [400040 x i64], ptr @cnt, i64 0, i64 %indvars.iv.next75.1
  store i64 %85, ptr %86, align 8, !tbaa !9
  %indvars.iv.next75.2 = add nuw nsw i64 %indvars.iv74, 3
  %87 = getelementptr inbounds [400040 x i64], ptr @diff, i64 0, i64 %indvars.iv.next75.2
  %88 = load i64, ptr %87, align 8, !tbaa !9
  %89 = add nsw i64 %88, %85
  %90 = getelementptr inbounds [400040 x i64], ptr @cnt, i64 0, i64 %indvars.iv.next75.2
  store i64 %89, ptr %90, align 8, !tbaa !9
  %indvars.iv.next75.3 = add nuw nsw i64 %indvars.iv74, 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_edge56.loopexit.unr-lcssa, label %.lr.ph55, !llvm.loop !16

._crit_edge59:                                    ; preds = %93, %._crit_edge56
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  %91 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #7
  %92 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #7
  invoke void @"_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEZ5solvevE3$_0EvT_S8_T0_"(ptr %91, ptr %92)
          to label %100 unwind label %108

.lr.ph58:                                         ; preds = %._crit_edge56, %93
  invoke void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
          to label %93 unwind label %98

93:                                               ; preds = %.lr.ph58
  %94 = load i32, ptr %2, align 4, !tbaa !5
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %2, align 4, !tbaa !5
  %96 = load i32, ptr @m, align 4, !tbaa !5
  %97 = icmp slt i32 %95, %96
  br i1 %97, label %.lr.ph58, label %._crit_edge59, !llvm.loop !17

98:                                               ; preds = %.lr.ph58
  %99 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  br label %139

100:                                              ; preds = %._crit_edge59
  %101 = load i32, ptr @n, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = load i32, ptr @m, align 4, !tbaa !5
  %104 = icmp sgt i32 %103, 0
  %105 = load i64, ptr @c, align 8
  %106 = icmp ne i64 %105, 0
  %107 = select i1 %104, i1 %106, i1 false
  br i1 %107, label %.lr.ph63, label %._crit_edge64

._crit_edge64:                                    ; preds = %132, %100
  %.038.lcssa = phi i64 [ %102, %100 ], [ %.1, %132 ]
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %1) #7
  ret i64 %.038.lcssa

108:                                              ; preds = %._crit_edge59
  %109 = landingpad { ptr, i32 }
          cleanup
  br label %139

.lr.ph63:                                         ; preds = %100, %132
  %indvars.iv77 = phi i64 [ %indvars.iv.next78, %132 ], [ 0, %100 ]
  %.03860 = phi i64 [ %.1, %132 ], [ %102, %100 ]
  %110 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %indvars.iv77) #7
  %111 = load i32, ptr %110, align 4, !tbaa !5
  %112 = add nsw i32 %111, 1
  %113 = load i32, ptr @m, align 4, !tbaa !5
  %.not = icmp slt i32 %112, %113
  br i1 %.not, label %114, label %.lr.ph63._crit_edge

.lr.ph63._crit_edge:                              ; preds = %.lr.ph63
  %.pre81 = load i64, ptr @c, align 8
  br label %132

114:                                              ; preds = %.lr.ph63
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %115 = sext i32 %112 to i64
  %116 = getelementptr inbounds [400040 x i64], ptr @a, i64 0, i64 %115
  %117 = load i64, ptr %116, align 8, !tbaa !9
  %118 = sext i32 %111 to i64
  %119 = getelementptr inbounds [400040 x i64], ptr @a, i64 0, i64 %118
  %120 = load i64, ptr %119, align 8, !tbaa !9
  %121 = sub nsw i64 %117, %120
  store i64 %121, ptr %3, align 8, !tbaa !9
  %122 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) @c)
  %123 = load i64, ptr %122, align 8, !tbaa !9
  %124 = getelementptr inbounds [400040 x i64], ptr @cnt, i64 0, i64 %118
  %125 = load i64, ptr %124, align 8, !tbaa !9
  %126 = mul nsw i64 %125, %123
  %127 = add nsw i64 %126, %.03860
  %128 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) @c)
  %129 = load i64, ptr %128, align 8, !tbaa !9
  %130 = load i64, ptr @c, align 8, !tbaa !9
  %131 = sub nsw i64 %130, %129
  store i64 %131, ptr @c, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  %.pre80 = load i32, ptr @m, align 4, !tbaa !5
  br label %132

132:                                              ; preds = %.lr.ph63._crit_edge, %114
  %133 = phi i64 [ %131, %114 ], [ %.pre81, %.lr.ph63._crit_edge ]
  %134 = phi i32 [ %.pre80, %114 ], [ %113, %.lr.ph63._crit_edge ]
  %.1 = phi i64 [ %127, %114 ], [ %.03860, %.lr.ph63._crit_edge ]
  %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
  %135 = sext i32 %134 to i64
  %136 = icmp slt i64 %indvars.iv.next78, %135
  %137 = icmp ne i64 %133, 0
  %138 = select i1 %136, i1 %137, i1 false
  br i1 %138, label %.lr.ph63, label %._crit_edge64, !llvm.loop !18

139:                                              ; preds = %108, %98
  %.pn = phi { ptr, i32 } [ %99, %98 ], [ %109, %108 ]
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %1) #7
  resume { ptr, i32 } %.pn
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

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

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

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

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

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

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEZ5solvevE3$_0EvT_S8_T0_"(ptr, ptr) local_unnamed_addr #3

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

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

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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 nounwind willreturn memory(argmem: write) }
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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


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