; LLVM IR from tangjz/acm-icpc :: codeforces/gym/100827B.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::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 }

@e = external dso_local global [2001 x %"class.std::vector"], align 16
@n = external dso_local global i32, align 4
@p = external dso_local global [2001 x i32], align 16
@ord = external dso_local global [2001 x i32], align 16
@dep = external dso_local global [2001 x i32], align 16
@typ = external dso_local global [2001 x i32], align 16
@rem = external dso_local global [2001 x i32], align 16
@low = external dso_local global [2001 x i32], align 16
@_ZZ5solvevE1x = external hidden global [2001 x i32], align 16
@_ZZ5solvevE1y = external hidden global [2001 x i32], align 16
@_ZZ5solvevE1r = external hidden global [2001 x i32], align 16
@_ZZ5solvevE1a = external hidden global [2001 x i32], align 16
@_ZZ5solvevE1b = external hidden global [2001 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@_ZZ5solvevE3out = external hidden global [2001 x i32], align 16
@_ZZ5solvevE3que = external hidden global [2001 x i32], align 16
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %14 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca ptr, align 8
  %28 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %29 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %30 = alloca i32, align 4
  %31 = alloca i32, align 4
  %32 = alloca i32, align 4
  %33 = alloca %"class.std::vector", align 8
  %34 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #6
  store i32 1, ptr %1, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %60, %0
  %36 = load i32, ptr %1, align 4, !tbaa !5
  %37 = load i32, ptr @n, align 4, !tbaa !5
  %38 = icmp sle i32 %36, %37
  br i1 %38, label %40, label %39

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

40:                                               ; preds = %35
  %41 = load i32, ptr %1, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds i32, ptr @_ZZ5solvevE1x, i64 %42
  %44 = load i32, ptr %1, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds i32, ptr @_ZZ5solvevE1y, i64 %45
  %47 = load i32, ptr %1, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds i32, ptr @_ZZ5solvevE1r, i64 %48
  %50 = load i32, ptr %1, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds i32, ptr @_ZZ5solvevE1a, i64 %51
  %53 = load i32, ptr %1, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds i32, ptr @_ZZ5solvevE1b, i64 %54
  %56 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %43, ptr noundef %46, ptr noundef %49, ptr noundef %52, ptr noundef %55)
  %57 = load i32, ptr %1, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [2001 x i32], ptr @p, i64 0, i64 %58
  store i32 0, ptr %59, align 4, !tbaa !5
  br label %60

60:                                               ; preds = %40
  %61 = load i32, ptr %1, align 4, !tbaa !5
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %1, align 4, !tbaa !5
  br label %35, !llvm.loop !9

63:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %64

64:                                               ; preds = %156, %63
  %65 = load i32, ptr %2, align 4, !tbaa !5
  %66 = load i32, ptr @n, align 4, !tbaa !5
  %67 = icmp sle i32 %65, %66
  br i1 %67, label %69, label %68

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

69:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %70

70:                                               ; preds = %146, %69
  %71 = load i32, ptr %4, align 4, !tbaa !5
  %72 = load i32, ptr @n, align 4, !tbaa !5
  %73 = icmp sle i32 %71, %72
  br i1 %73, label %75, label %74

74:                                               ; preds = %70
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %149

75:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %76 = load i32, ptr %2, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE1x, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = load i32, ptr %4, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE1x, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = sub nsw i32 %79, %83
  store i32 %84, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %85 = load i32, ptr %2, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE1y, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = load i32, ptr %4, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE1y, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = sub nsw i32 %88, %92
  store i32 %93, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %94 = load i32, ptr %2, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE1r, i64 0, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = load i32, ptr %4, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE1r, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = sub nsw i32 %97, %101
  store i32 %102, ptr %7, align 4, !tbaa !5
  %103 = load i32, ptr %7, align 4, !tbaa !5
  %104 = icmp sge i32 %103, 0
  br i1 %104, label %117, label %105

105:                                              ; preds = %75
  %106 = load i32, ptr %5, align 4, !tbaa !5
  %107 = load i32, ptr %5, align 4, !tbaa !5
  %108 = mul nsw i32 %106, %107
  %109 = load i32, ptr %6, align 4, !tbaa !5
  %110 = load i32, ptr %6, align 4, !tbaa !5
  %111 = mul nsw i32 %109, %110
  %112 = add nsw i32 %108, %111
  %113 = load i32, ptr %7, align 4, !tbaa !5
  %114 = load i32, ptr %7, align 4, !tbaa !5
  %115 = mul nsw i32 %113, %114
  %116 = icmp sge i32 %112, %115
  br i1 %116, label %117, label %118

117:                                              ; preds = %105, %75
  store i32 10, ptr %3, align 4
  br label %143

118:                                              ; preds = %105
  %119 = load i32, ptr %2, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [2001 x i32], ptr @p, i64 0, i64 %120
  %122 = load i32, ptr %121, align 4, !tbaa !5
  %123 = icmp ne i32 %122, 0
  br i1 %123, label %124, label %137

124:                                              ; preds = %118
  %125 = load i32, ptr %4, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE1r, i64 0, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !5
  %129 = load i32, ptr %2, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [2001 x i32], ptr @p, i64 0, i64 %130
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE1r, i64 0, i64 %133
  %135 = load i32, ptr %134, align 4, !tbaa !5
  %136 = icmp slt i32 %128, %135
  br i1 %136, label %137, label %142

137:                                              ; preds = %124, %118
  %138 = load i32, ptr %4, align 4, !tbaa !5
  %139 = load i32, ptr %2, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [2001 x i32], ptr @p, i64 0, i64 %140
  store i32 %138, ptr %141, align 4, !tbaa !5
  br label %142

142:                                              ; preds = %137, %124
  store i32 0, ptr %3, align 4
  br label %143

143:                                              ; preds = %142, %117
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  %144 = load i32, ptr %3, align 4
  switch i32 %144, label %508 [
    i32 0, label %145
    i32 10, label %146
  ]

145:                                              ; preds = %143
  br label %146

146:                                              ; preds = %145, %143
  %147 = load i32, ptr %4, align 4, !tbaa !5
  %148 = add nsw i32 %147, 1
  store i32 %148, ptr %4, align 4, !tbaa !5
  br label %70, !llvm.loop !11

149:                                              ; preds = %74
  %150 = load i32, ptr %2, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [2001 x i32], ptr @p, i64 0, i64 %151
  %153 = load i32, ptr %152, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [2001 x %"class.std::vector"], ptr @e, i64 0, i64 %154
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %155, ptr noundef nonnull align 4 dereferenceable(4) %2)
  br label %156

156:                                              ; preds = %149
  %157 = load i32, ptr %2, align 4, !tbaa !5
  %158 = add nsw i32 %157, 1
  store i32 %158, ptr %2, align 4, !tbaa !5
  br label %64, !llvm.loop !12

159:                                              ; preds = %68
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  store i32 0, ptr @ord, align 16, !tbaa !5
  store i32 -1, ptr @dep, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %160

160:                                              ; preds = %304, %159
  %161 = load i32, ptr %9, align 4, !tbaa !5
  %162 = load i32, ptr %10, align 4, !tbaa !5
  %163 = icmp sle i32 %161, %162
  br i1 %163, label %165, label %164

164:                                              ; preds = %160
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %307

165:                                              ; preds = %160
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %166 = load i32, ptr %9, align 4, !tbaa !5
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [2001 x i32], ptr @ord, i64 0, i64 %167
  %169 = load i32, ptr %168, align 4, !tbaa !5
  store i32 %169, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %170 = load i32, ptr %11, align 4, !tbaa !5
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [2001 x %"class.std::vector"], ptr @e, i64 0, i64 %171
  store ptr %172, ptr %12, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %173 = load ptr, ptr %12, align 8, !tbaa !13
  %174 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %173) #6
  %175 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  store ptr %174, ptr %175, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %176 = load ptr, ptr %12, align 8, !tbaa !13
  %177 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %176) #6
  %178 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %14, i32 0, i32 0
  store ptr %177, ptr %178, align 8
  br label %179

179:                                              ; preds = %198, %165
  %180 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %14) #6
  br i1 %180, label %182, label %181

181:                                              ; preds = %179
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %200

182:                                              ; preds = %179
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %183 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #6
  %184 = load i32, ptr %183, align 4, !tbaa !5
  store i32 %184, ptr %15, align 4, !tbaa !5
  %185 = load i32, ptr %11, align 4, !tbaa !5
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [2001 x i32], ptr @dep, i64 0, i64 %186
  %188 = load i32, ptr %187, align 4, !tbaa !5
  %189 = add nsw i32 %188, 1
  %190 = load i32, ptr %15, align 4, !tbaa !5
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [2001 x i32], ptr @dep, i64 0, i64 %191
  store i32 %189, ptr %192, align 4, !tbaa !5
  %193 = load i32, ptr %15, align 4, !tbaa !5
  %194 = load i32, ptr %10, align 4, !tbaa !5
  %195 = add nsw i32 %194, 1
  store i32 %195, ptr %10, align 4, !tbaa !5
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds [2001 x i32], ptr @ord, i64 0, i64 %196
  store i32 %193, ptr %197, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %198

198:                                              ; preds = %182
  %199 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #6
  br label %179

200:                                              ; preds = %181
  %201 = load i32, ptr %11, align 4, !tbaa !5
  %202 = icmp ne i32 %201, 0
  br i1 %202, label %204, label %203

203:                                              ; preds = %200
  store i32 13, ptr %3, align 4
  br label %301

204:                                              ; preds = %200
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 0, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  store i32 0, ptr %17, align 4, !tbaa !5
  %205 = load i32, ptr %11, align 4, !tbaa !5
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds [2001 x i32], ptr @rem, i64 0, i64 %206
  store i32 0, ptr %207, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  store i32 1, ptr %18, align 4, !tbaa !5
  br label %208

208:                                              ; preds = %244, %204
  %209 = load i32, ptr %18, align 4, !tbaa !5
  %210 = load i32, ptr %11, align 4, !tbaa !5
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [2001 x i32], ptr @dep, i64 0, i64 %211
  %213 = load i32, ptr %212, align 4, !tbaa !5
  %214 = icmp sle i32 %209, %213
  br i1 %214, label %216, label %215

215:                                              ; preds = %208
  store i32 16, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %247

216:                                              ; preds = %208
  %217 = load i32, ptr %18, align 4, !tbaa !5
  %218 = and i32 %217, 1
  %219 = icmp ne i32 %218, 0
  br i1 %219, label %220, label %225

220:                                              ; preds = %216
  %221 = load i32, ptr %11, align 4, !tbaa !5
  %222 = sext i32 %221 to i64
  %223 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE1a, i64 0, i64 %222
  %224 = load i32, ptr %223, align 4, !tbaa !5
  br label %230

225:                                              ; preds = %216
  %226 = load i32, ptr %11, align 4, !tbaa !5
  %227 = sext i32 %226 to i64
  %228 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE1b, i64 0, i64 %227
  %229 = load i32, ptr %228, align 4, !tbaa !5
  br label %230

230:                                              ; preds = %225, %220
  %231 = phi i32 [ %224, %220 ], [ %229, %225 ]
  %232 = load i32, ptr %17, align 4, !tbaa !5
  %233 = add nsw i32 %232, %231
  store i32 %233, ptr %17, align 4, !tbaa !5
  %234 = load i32, ptr %17, align 4, !tbaa !5
  %235 = load i32, ptr %16, align 4, !tbaa !5
  %236 = icmp sgt i32 %234, %235
  br i1 %236, label %237, label %243

237:                                              ; preds = %230
  %238 = load i32, ptr %17, align 4, !tbaa !5
  store i32 %238, ptr %16, align 4, !tbaa !5
  %239 = load i32, ptr %18, align 4, !tbaa !5
  %240 = load i32, ptr %11, align 4, !tbaa !5
  %241 = sext i32 %240 to i64
  %242 = getelementptr inbounds [2001 x i32], ptr @rem, i64 0, i64 %241
  store i32 %239, ptr %242, align 4, !tbaa !5
  br label %243

243:                                              ; preds = %237, %230
  br label %244

244:                                              ; preds = %243
  %245 = load i32, ptr %18, align 4, !tbaa !5
  %246 = add nsw i32 %245, 1
  store i32 %246, ptr %18, align 4, !tbaa !5
  br label %208, !llvm.loop !15

247:                                              ; preds = %215
  %248 = load i32, ptr %11, align 4, !tbaa !5
  %249 = sext i32 %248 to i64
  %250 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE1a, i64 0, i64 %249
  %251 = load i32, ptr %250, align 4, !tbaa !5
  %252 = load i32, ptr %11, align 4, !tbaa !5
  %253 = sext i32 %252 to i64
  %254 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE1b, i64 0, i64 %253
  %255 = load i32, ptr %254, align 4, !tbaa !5
  %256 = add nsw i32 %251, %255
  %257 = icmp ne i32 %256, 0
  %258 = xor i1 %257, true
  %259 = zext i1 %258 to i32
  %260 = shl i32 %259, 1
  %261 = load i32, ptr %11, align 4, !tbaa !5
  %262 = sext i32 %261 to i64
  %263 = getelementptr inbounds [2001 x i32], ptr @rem, i64 0, i64 %262
  %264 = load i32, ptr %263, align 4, !tbaa !5
  %265 = and i32 %264, 1
  %266 = icmp ne i32 %265, 0
  br i1 %266, label %267, label %272

267:                                              ; preds = %247
  %268 = load i32, ptr %11, align 4, !tbaa !5
  %269 = sext i32 %268 to i64
  %270 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE1b, i64 0, i64 %269
  %271 = load i32, ptr %270, align 4, !tbaa !5
  br label %277

272:                                              ; preds = %247
  %273 = load i32, ptr %11, align 4, !tbaa !5
  %274 = sext i32 %273 to i64
  %275 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE1a, i64 0, i64 %274
  %276 = load i32, ptr %275, align 4, !tbaa !5
  br label %277

277:                                              ; preds = %272, %267
  %278 = phi i32 [ %271, %267 ], [ %276, %272 ]
  %279 = icmp ne i32 %278, 0
  %280 = xor i1 %279, true
  %281 = zext i1 %280 to i32
  %282 = or i32 %260, %281
  %283 = load i32, ptr %11, align 4, !tbaa !5
  %284 = sext i32 %283 to i64
  %285 = getelementptr inbounds [2001 x i32], ptr @typ, i64 0, i64 %284
  store i32 %282, ptr %285, align 4, !tbaa !5
  %286 = load i32, ptr %11, align 4, !tbaa !5
  %287 = sext i32 %286 to i64
  %288 = getelementptr inbounds [2001 x i32], ptr @dep, i64 0, i64 %287
  %289 = load i32, ptr %288, align 4, !tbaa !5
  %290 = load i32, ptr %11, align 4, !tbaa !5
  %291 = sext i32 %290 to i64
  %292 = getelementptr inbounds [2001 x i32], ptr @rem, i64 0, i64 %291
  %293 = load i32, ptr %292, align 4, !tbaa !5
  %294 = sub nsw i32 %289, %293
  %295 = load i32, ptr %11, align 4, !tbaa !5
  %296 = sext i32 %295 to i64
  %297 = getelementptr inbounds [2001 x i32], ptr @rem, i64 0, i64 %296
  store i32 %294, ptr %297, align 4, !tbaa !5
  %298 = load i32, ptr %16, align 4, !tbaa !5
  %299 = load i32, ptr %8, align 4, !tbaa !5
  %300 = add nsw i32 %299, %298
  store i32 %300, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  store i32 0, ptr %3, align 4
  br label %301

301:                                              ; preds = %277, %203
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  %302 = load i32, ptr %3, align 4
  switch i32 %302, label %508 [
    i32 0, label %303
    i32 13, label %304
  ]

303:                                              ; preds = %301
  br label %304

304:                                              ; preds = %303, %301
  %305 = load i32, ptr %9, align 4, !tbaa !5
  %306 = add nsw i32 %305, 1
  store i32 %306, ptr %9, align 4, !tbaa !5
  br label %160, !llvm.loop !16

307:                                              ; preds = %164
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  store i32 1, ptr %19, align 4, !tbaa !5
  br label %308

308:                                              ; preds = %467, %307
  %309 = load i32, ptr %19, align 4, !tbaa !5
  %310 = load i32, ptr @n, align 4, !tbaa !5
  %311 = icmp sle i32 %309, %310
  br i1 %311, label %313, label %312

312:                                              ; preds = %308
  store i32 19, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %470

313:                                              ; preds = %308
  %314 = load i32, ptr @n, align 4, !tbaa !5
  %315 = sext i32 %314 to i64
  %316 = mul i64 %315, 4
  call void @llvm.memset.p0.i64(ptr align 4 getelementptr inbounds (i32, ptr @low, i64 1), i8 63, i64 %316, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  %317 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %317, ptr %20, align 4, !tbaa !5
  br label %318

318:                                              ; preds = %348, %313
  %319 = load i32, ptr %20, align 4, !tbaa !5
  %320 = icmp sge i32 %319, 1
  br i1 %320, label %322, label %321

321:                                              ; preds = %318
  store i32 22, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  br label %351

322:                                              ; preds = %318
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  %323 = load i32, ptr %20, align 4, !tbaa !5
  %324 = sext i32 %323 to i64
  %325 = getelementptr inbounds [2001 x i32], ptr @ord, i64 0, i64 %324
  %326 = load i32, ptr %325, align 4, !tbaa !5
  store i32 %326, ptr %21, align 4, !tbaa !5
  %327 = load i32, ptr %21, align 4, !tbaa !5
  %328 = sext i32 %327 to i64
  %329 = getelementptr inbounds [2001 x i32], ptr @p, i64 0, i64 %328
  %330 = load i32, ptr %329, align 4, !tbaa !5
  %331 = sext i32 %330 to i64
  %332 = getelementptr inbounds [2001 x i32], ptr @low, i64 0, i64 %331
  %333 = load i32, ptr %21, align 4, !tbaa !5
  %334 = sext i32 %333 to i64
  %335 = getelementptr inbounds [2001 x i32], ptr @low, i64 0, i64 %334
  %336 = load i32, ptr %21, align 4, !tbaa !5
  %337 = sext i32 %336 to i64
  %338 = getelementptr inbounds [2001 x i32], ptr @rem, i64 0, i64 %337
  %339 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %335, ptr noundef nonnull align 4 dereferenceable(4) %338)
  %340 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %332, ptr noundef nonnull align 4 dereferenceable(4) %339)
  %341 = load i32, ptr %340, align 4, !tbaa !5
  %342 = load i32, ptr %21, align 4, !tbaa !5
  %343 = sext i32 %342 to i64
  %344 = getelementptr inbounds [2001 x i32], ptr @p, i64 0, i64 %343
  %345 = load i32, ptr %344, align 4, !tbaa !5
  %346 = sext i32 %345 to i64
  %347 = getelementptr inbounds [2001 x i32], ptr @low, i64 0, i64 %346
  store i32 %341, ptr %347, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %348

348:                                              ; preds = %322
  %349 = load i32, ptr %20, align 4, !tbaa !5
  %350 = add nsw i32 %349, -1
  store i32 %350, ptr %20, align 4, !tbaa !5
  br label %318, !llvm.loop !17

351:                                              ; preds = %321
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  store i32 1, ptr %22, align 4, !tbaa !5
  br label %352

352:                                              ; preds = %402, %351
  %353 = load i32, ptr %22, align 4, !tbaa !5
  %354 = load i32, ptr @n, align 4, !tbaa !5
  %355 = icmp sle i32 %353, %354
  br i1 %355, label %357, label %356

356:                                              ; preds = %352
  store i32 25, ptr %3, align 4
  br label %405

357:                                              ; preds = %352
  %358 = load i32, ptr %22, align 4, !tbaa !5
  %359 = sext i32 %358 to i64
  %360 = getelementptr inbounds [2001 x i32], ptr @rem, i64 0, i64 %359
  %361 = load i32, ptr %360, align 4, !tbaa !5
  %362 = load i32, ptr @n, align 4, !tbaa !5
  %363 = icmp sge i32 %361, %362
  br i1 %363, label %370, label %364

364:                                              ; preds = %357
  %365 = load i32, ptr %22, align 4, !tbaa !5
  %366 = sext i32 %365 to i64
  %367 = getelementptr inbounds [2001 x i32], ptr @low, i64 0, i64 %366
  %368 = load i32, ptr %367, align 4, !tbaa !5
  %369 = icmp ne i32 %368, 0
  br i1 %369, label %371, label %370

370:                                              ; preds = %364, %357
  br label %402

371:                                              ; preds = %364
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #6
  %372 = load i32, ptr %22, align 4, !tbaa !5
  %373 = sext i32 %372 to i64
  %374 = getelementptr inbounds [2001 x i32], ptr @rem, i64 0, i64 %373
  %375 = load i32, ptr %374, align 4, !tbaa !5
  store i32 %375, ptr %23, align 4, !tbaa !5
  %376 = load i32, ptr %22, align 4, !tbaa !5
  %377 = sext i32 %376 to i64
  %378 = getelementptr inbounds [2001 x i32], ptr @typ, i64 0, i64 %377
  %379 = load i32, ptr %378, align 4, !tbaa !5
  %380 = and i32 %379, 2
  %381 = icmp ne i32 %380, 0
  br i1 %381, label %382, label %385

382:                                              ; preds = %371
  %383 = load i32, ptr %23, align 4, !tbaa !5
  %384 = and i32 %383, 1
  store i32 %384, ptr %23, align 4, !tbaa !5
  br label %385

385:                                              ; preds = %382, %371
  %386 = load i32, ptr %23, align 4, !tbaa !5
  %387 = load i32, ptr %22, align 4, !tbaa !5
  %388 = sext i32 %387 to i64
  %389 = getelementptr inbounds [2001 x i32], ptr @typ, i64 0, i64 %388
  %390 = load i32, ptr %389, align 4, !tbaa !5
  %391 = and i32 %390, 1
  %392 = icmp sle i32 %386, %391
  br i1 %392, label %393, label %398

393:                                              ; preds = %385
  %394 = load i32, ptr %22, align 4, !tbaa !5
  %395 = load i32, ptr %19, align 4, !tbaa !5
  %396 = sext i32 %395 to i64
  %397 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE3out, i64 0, i64 %396
  store i32 %394, ptr %397, align 4, !tbaa !5
  store i32 25, ptr %3, align 4
  br label %399

398:                                              ; preds = %385
  store i32 0, ptr %3, align 4
  br label %399

399:                                              ; preds = %398, %393
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  %400 = load i32, ptr %3, align 4
  switch i32 %400, label %405 [
    i32 0, label %401
  ]

401:                                              ; preds = %399
  br label %402

402:                                              ; preds = %401, %370
  %403 = load i32, ptr %22, align 4, !tbaa !5
  %404 = add nsw i32 %403, 1
  store i32 %404, ptr %22, align 4, !tbaa !5
  br label %352, !llvm.loop !18

405:                                              ; preds = %399, %356
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  br label %406

406:                                              ; preds = %405
  %407 = load i32, ptr @n, align 4, !tbaa !5
  %408 = load i32, ptr %19, align 4, !tbaa !5
  %409 = sext i32 %408 to i64
  %410 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE3out, i64 0, i64 %409
  %411 = load i32, ptr %410, align 4, !tbaa !5
  %412 = sext i32 %411 to i64
  %413 = getelementptr inbounds [2001 x i32], ptr @rem, i64 0, i64 %412
  store i32 %407, ptr %413, align 4, !tbaa !5
  %414 = load i32, ptr %19, align 4, !tbaa !5
  %415 = sext i32 %414 to i64
  %416 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE3out, i64 0, i64 %415
  %417 = load i32, ptr %416, align 4, !tbaa !5
  store i32 %417, ptr getelementptr inbounds ([2001 x i32], ptr @_ZZ5solvevE3que, i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #6
  store i32 1, ptr %24, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #6
  store i32 1, ptr %25, align 4, !tbaa !5
  br label %418

418:                                              ; preds = %463, %406
  %419 = load i32, ptr %24, align 4, !tbaa !5
  %420 = load i32, ptr %25, align 4, !tbaa !5
  %421 = icmp sle i32 %419, %420
  br i1 %421, label %423, label %422

422:                                              ; preds = %418
  store i32 28, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  br label %466

423:                                              ; preds = %418
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #6
  %424 = load i32, ptr %24, align 4, !tbaa !5
  %425 = sext i32 %424 to i64
  %426 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE3que, i64 0, i64 %425
  %427 = load i32, ptr %426, align 4, !tbaa !5
  store i32 %427, ptr %26, align 4, !tbaa !5
  %428 = load i32, ptr %26, align 4, !tbaa !5
  %429 = sext i32 %428 to i64
  %430 = getelementptr inbounds [2001 x i32], ptr @rem, i64 0, i64 %429
  %431 = load i32, ptr %430, align 4, !tbaa !5
  %432 = load i32, ptr @n, align 4, !tbaa !5
  %433 = icmp slt i32 %431, %432
  %434 = zext i1 %433 to i32
  %435 = load i32, ptr %26, align 4, !tbaa !5
  %436 = sext i32 %435 to i64
  %437 = getelementptr inbounds [2001 x i32], ptr @rem, i64 0, i64 %436
  %438 = load i32, ptr %437, align 4, !tbaa !5
  %439 = sub nsw i32 %438, %434
  store i32 %439, ptr %437, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #6
  %440 = load i32, ptr %26, align 4, !tbaa !5
  %441 = sext i32 %440 to i64
  %442 = getelementptr inbounds [2001 x %"class.std::vector"], ptr @e, i64 0, i64 %441
  store ptr %442, ptr %27, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #6
  %443 = load ptr, ptr %27, align 8, !tbaa !13
  %444 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %443) #6
  %445 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %28, i32 0, i32 0
  store ptr %444, ptr %445, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #6
  %446 = load ptr, ptr %27, align 8, !tbaa !13
  %447 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %446) #6
  %448 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %29, i32 0, i32 0
  store ptr %447, ptr %448, align 8
  br label %449

449:                                              ; preds = %460, %423
  %450 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %28, ptr noundef nonnull align 8 dereferenceable(8) %29) #6
  br i1 %450, label %452, label %451

451:                                              ; preds = %449
  store i32 31, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #6
  br label %462

452:                                              ; preds = %449
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #6
  %453 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %28) #6
  %454 = load i32, ptr %453, align 4, !tbaa !5
  store i32 %454, ptr %30, align 4, !tbaa !5
  %455 = load i32, ptr %30, align 4, !tbaa !5
  %456 = load i32, ptr %25, align 4, !tbaa !5
  %457 = add nsw i32 %456, 1
  store i32 %457, ptr %25, align 4, !tbaa !5
  %458 = sext i32 %457 to i64
  %459 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE3que, i64 0, i64 %458
  store i32 %455, ptr %459, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #6
  br label %460

460:                                              ; preds = %452
  %461 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %28) #6
  br label %449

462:                                              ; preds = %451
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #6
  br label %463

463:                                              ; preds = %462
  %464 = load i32, ptr %24, align 4, !tbaa !5
  %465 = add nsw i32 %464, 1
  store i32 %465, ptr %24, align 4, !tbaa !5
  br label %418, !llvm.loop !19

466:                                              ; preds = %422
  br label %467

467:                                              ; preds = %466
  %468 = load i32, ptr %19, align 4, !tbaa !5
  %469 = add nsw i32 %468, 1
  store i32 %469, ptr %19, align 4, !tbaa !5
  br label %308, !llvm.loop !20

470:                                              ; preds = %312
  %471 = load i32, ptr %8, align 4, !tbaa !5
  %472 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %471)
  call void @llvm.lifetime.start.p0(i64 4, ptr %31) #6
  store i32 1, ptr %31, align 4, !tbaa !5
  br label %473

473:                                              ; preds = %491, %470
  %474 = load i32, ptr %31, align 4, !tbaa !5
  %475 = load i32, ptr @n, align 4, !tbaa !5
  %476 = icmp sle i32 %474, %475
  br i1 %476, label %478, label %477

477:                                              ; preds = %473
  store i32 33, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #6
  br label %494

478:                                              ; preds = %473
  %479 = load i32, ptr %31, align 4, !tbaa !5
  %480 = sext i32 %479 to i64
  %481 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE3out, i64 0, i64 %480
  %482 = load i32, ptr %481, align 4, !tbaa !5
  %483 = load i32, ptr %31, align 4, !tbaa !5
  %484 = load i32, ptr @n, align 4, !tbaa !5
  %485 = icmp eq i32 %483, %484
  %486 = zext i1 %485 to i64
  %487 = getelementptr inbounds [3 x i8], ptr @.str.5, i64 0, i64 %486
  %488 = load i8, ptr %487, align 1, !tbaa !21
  %489 = sext i8 %488 to i32
  %490 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %482, i32 noundef %489)
  br label %491

491:                                              ; preds = %478
  %492 = load i32, ptr %31, align 4, !tbaa !5
  %493 = add nsw i32 %492, 1
  store i32 %493, ptr %31, align 4, !tbaa !5
  br label %473, !llvm.loop !22

494:                                              ; preds = %477
  call void @llvm.lifetime.start.p0(i64 4, ptr %32) #6
  store i32 0, ptr %32, align 4, !tbaa !5
  br label %495

495:                                              ; preds = %504, %494
  %496 = load i32, ptr %32, align 4, !tbaa !5
  %497 = load i32, ptr @n, align 4, !tbaa !5
  %498 = icmp sle i32 %496, %497
  br i1 %498, label %500, label %499

499:                                              ; preds = %495
  store i32 36, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #6
  br label %507

500:                                              ; preds = %495
  call void @llvm.lifetime.start.p0(i64 24, ptr %33) #6
  call void @llvm.memset.p0.i64(ptr align 8 %33, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %33) #6
  %501 = load i32, ptr %32, align 4, !tbaa !5
  %502 = sext i32 %501 to i64
  %503 = getelementptr inbounds [2001 x %"class.std::vector"], ptr @e, i64 0, i64 %502
  call void @_ZNSt6vectorIiSaIiEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24) %33, ptr noundef nonnull align 8 dereferenceable(24) %503) #6
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %33) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %33) #6
  br label %504

504:                                              ; preds = %500
  %505 = load i32, ptr %32, align 4, !tbaa !5
  %506 = add nsw i32 %505, 1
  store i32 %506, ptr %32, align 4, !tbaa !5
  br label %495, !llvm.loop !23

507:                                              ; preds = %499
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  ret void

508:                                              ; preds = %301, %143
  unreachable
}

declare i32 @__isoc99_scanf(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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3

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

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

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

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

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

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

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

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

declare i32 @printf(ptr noundef, ...) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #0 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 = { "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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = !{!7, !7, i64 0}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}


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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@e = external dso_local global [2001 x %"class.std::vector"], align 16
@n = external dso_local global i32, align 4
@p = external dso_local local_unnamed_addr global [2001 x i32], align 16
@ord = external dso_local local_unnamed_addr global [2001 x i32], align 16
@dep = external dso_local local_unnamed_addr global [2001 x i32], align 16
@typ = external dso_local local_unnamed_addr global [2001 x i32], align 16
@rem = external dso_local global [2001 x i32], align 16
@low = external dso_local global [2001 x i32], align 16
@_ZZ5solvevE1x = external hidden global [2001 x i32], align 16
@_ZZ5solvevE1y = external hidden global [2001 x i32], align 16
@_ZZ5solvevE1r = external hidden global [2001 x i32], align 16
@_ZZ5solvevE1a = external hidden global [2001 x i32], align 16
@_ZZ5solvevE1b = external hidden global [2001 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@_ZZ5solvevE3out = external hidden local_unnamed_addr global [2001 x i32], align 16
@_ZZ5solvevE3que = external hidden local_unnamed_addr global [2001 x i32], align 16
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #1 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %3 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %6 = alloca %"class.std::vector", align 8
  %7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %8 = load i32, ptr @n, align 4, !tbaa !5
  %.not151 = icmp slt i32 %8, 1
  br i1 %.not151, label %._crit_edge.thread, label %.lr.ph

._crit_edge.thread:                               ; preds = %0
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  br label %._crit_edge159

._crit_edge:                                      ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  store i32 1, ptr %1, align 4, !tbaa !5
  %.not125157 = icmp slt i32 %16, 1
  br i1 %.not125157, label %._crit_edge159, label %.preheader147

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %9 = getelementptr inbounds i32, ptr @_ZZ5solvevE1x, i64 %indvars.iv
  %10 = getelementptr inbounds i32, ptr @_ZZ5solvevE1y, i64 %indvars.iv
  %11 = getelementptr inbounds i32, ptr @_ZZ5solvevE1r, i64 %indvars.iv
  %12 = getelementptr inbounds i32, ptr @_ZZ5solvevE1a, i64 %indvars.iv
  %13 = getelementptr inbounds i32, ptr @_ZZ5solvevE1b, i64 %indvars.iv
  %14 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %9, ptr noundef nonnull %10, ptr noundef nonnull %11, ptr noundef nonnull %12, ptr noundef nonnull %13)
  %15 = getelementptr inbounds [2001 x i32], ptr @p, i64 0, i64 %indvars.iv
  store i32 0, ptr %15, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %16 = load i32, ptr @n, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %.not.not = icmp slt i64 %indvars.iv, %17
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.preheader147:                                    ; preds = %._crit_edge, %._crit_edge156
  %18 = phi i32 [ %31, %._crit_edge156 ], [ %16, %._crit_edge ]
  %storemerge158 = phi i32 [ %30, %._crit_edge156 ], [ 1, %._crit_edge ]
  %.not142153 = icmp slt i32 %18, 1
  %.pre238 = sext i32 %storemerge158 to i64
  br i1 %.not142153, label %._crit_edge156, label %.lr.ph155

.lr.ph155:                                        ; preds = %.preheader147
  %19 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE1r, i64 0, i64 %.pre238
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE1y, i64 0, i64 %.pre238
  %22 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE1x, i64 0, i64 %.pre238
  %23 = getelementptr inbounds [2001 x i32], ptr @p, i64 0, i64 %.pre238
  %24 = add nuw i32 %18, 1
  %wide.trip.count = zext i32 %24 to i64
  br label %32

._crit_edge159:                                   ; preds = %._crit_edge156, %._crit_edge.thread, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  store i32 0, ptr @ord, align 16, !tbaa !5
  store i32 -1, ptr @dep, align 16, !tbaa !5
  br label %61

._crit_edge156:                                   ; preds = %59, %.preheader147
  %25 = getelementptr inbounds [2001 x i32], ptr @p, i64 0, i64 %.pre238
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [2001 x %"class.std::vector"], ptr @e, i64 0, i64 %27
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %28, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %29 = load i32, ptr %1, align 4, !tbaa !5
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr %1, align 4, !tbaa !5
  %31 = load i32, ptr @n, align 4, !tbaa !5
  %.not125.not = icmp slt i32 %29, %31
  br i1 %.not125.not, label %.preheader147, label %._crit_edge159, !llvm.loop !11

32:                                               ; preds = %.lr.ph155, %59
  %indvars.iv205 = phi i64 [ 1, %.lr.ph155 ], [ %indvars.iv.next206, %59 ]
  %33 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE1r, i64 0, i64 %indvars.iv205
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = sub nsw i32 %20, %34
  %36 = icmp sgt i32 %35, -1
  br i1 %36, label %59, label %37

37:                                               ; preds = %32
  %38 = load i32, ptr %21, align 4, !tbaa !5
  %39 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE1y, i64 0, i64 %indvars.iv205
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = sub nsw i32 %38, %40
  %42 = load i32, ptr %22, align 4, !tbaa !5
  %43 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE1x, i64 0, i64 %indvars.iv205
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = sub nsw i32 %42, %44
  %46 = mul nsw i32 %45, %45
  %47 = mul nsw i32 %41, %41
  %48 = add nuw nsw i32 %46, %47
  %49 = mul nsw i32 %35, %35
  %.not143 = icmp ult i32 %48, %49
  br i1 %.not143, label %50, label %59

50:                                               ; preds = %37
  %51 = load i32, ptr %23, align 4, !tbaa !5
  %.not144 = icmp eq i32 %51, 0
  br i1 %.not144, label %57, label %52

52:                                               ; preds = %50
  %53 = sext i32 %51 to i64
  %54 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE1r, i64 0, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = icmp slt i32 %34, %55
  br i1 %56, label %57, label %59

57:                                               ; preds = %52, %50
  %58 = trunc nuw nsw i64 %indvars.iv205 to i32
  store i32 %58, ptr %23, align 4, !tbaa !5
  br label %59

59:                                               ; preds = %52, %57, %32, %37
  %indvars.iv.next206 = add nuw nsw i64 %indvars.iv205, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next206, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge156, label %32, !llvm.loop !12

.preheader146:                                    ; preds = %123
  %60 = load i32, ptr @n, align 4, !tbaa !5
  %.not127190 = icmp slt i32 %60, 1
  br i1 %.not127190, label %._crit_edge193, label %.lr.ph192

61:                                               ; preds = %._crit_edge159, %123
  %indvars.iv212 = phi i64 [ 0, %._crit_edge159 ], [ %indvars.iv.next213, %123 ]
  %.0107175 = phi i32 [ 0, %._crit_edge159 ], [ %.1108, %123 ]
  %.0116173 = phi i32 [ 0, %._crit_edge159 ], [ %.1117.lcssa, %123 ]
  %62 = getelementptr inbounds [2001 x i32], ptr @ord, i64 0, i64 %indvars.iv212
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [2001 x %"class.std::vector"], ptr @e, i64 0, i64 %64
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %66 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %65) #6
  store ptr %66, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %67 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %65) #6
  store ptr %67, ptr %3, align 8
  %68 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  br i1 %68, label %.lr.ph162, label %._crit_edge163

.lr.ph162:                                        ; preds = %61
  %69 = getelementptr inbounds [2001 x i32], ptr @dep, i64 0, i64 %64
  %70 = sext i32 %.0116173 to i64
  br label %72

._crit_edge163.loopexit:                          ; preds = %72
  %71 = trunc nsw i64 %indvars.iv.next209 to i32
  br label %._crit_edge163

._crit_edge163:                                   ; preds = %._crit_edge163.loopexit, %61
  %.1117.lcssa = phi i32 [ %.0116173, %61 ], [ %71, %._crit_edge163.loopexit ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  %.not136 = icmp eq i32 %63, 0
  br i1 %.not136, label %123, label %82

72:                                               ; preds = %.lr.ph162, %72
  %indvars.iv208 = phi i64 [ %70, %.lr.ph162 ], [ %indvars.iv.next209, %72 ]
  %73 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = load i32, ptr %69, align 4, !tbaa !5
  %76 = add nsw i32 %75, 1
  %77 = sext i32 %74 to i64
  %78 = getelementptr inbounds [2001 x i32], ptr @dep, i64 0, i64 %77
  store i32 %76, ptr %78, align 4, !tbaa !5
  %indvars.iv.next209 = add nsw i64 %indvars.iv208, 1
  %79 = getelementptr inbounds [2001 x i32], ptr @ord, i64 0, i64 %indvars.iv.next209
  store i32 %74, ptr %79, align 4, !tbaa !5
  %80 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  %81 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  br i1 %81, label %72, label %._crit_edge163.loopexit

82:                                               ; preds = %._crit_edge163
  %83 = getelementptr inbounds [2001 x i32], ptr @rem, i64 0, i64 %64
  %84 = getelementptr inbounds [2001 x i32], ptr @dep, i64 0, i64 %64
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %.not137164 = icmp slt i32 %85, 1
  br i1 %.not137164, label %._crit_edge170, label %.lr.ph169.preheader

.lr.ph169.preheader:                              ; preds = %82
  %xtraiter = and i32 %85, 1
  %86 = icmp eq i32 %85, 1
  br i1 %86, label %._crit_edge170.loopexit.unr-lcssa, label %.lr.ph169.preheader.new

.lr.ph169.preheader.new:                          ; preds = %.lr.ph169.preheader
  %unroll_iter = and i32 %85, 2147483646
  %.in = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE1a, i64 0, i64 %64
  %87 = load i32, ptr %.in, align 4, !tbaa !5
  %.in.1 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE1b, i64 0, i64 %64
  %88 = load i32, ptr %.in.1, align 4, !tbaa !5
  br label %.lr.ph169

._crit_edge170.loopexit.unr-lcssa:                ; preds = %121, %.lr.ph169.preheader
  %.lcssa248.ph = phi i32 [ poison, %.lr.ph169.preheader ], [ %114, %121 ]
  %.1114.lcssa.ph = phi i32 [ poison, %.lr.ph169.preheader ], [ %.1114.1, %121 ]
  %.unr = phi i32 [ 0, %.lr.ph169.preheader ], [ %114, %121 ]
  %.0111167.unr = phi i32 [ 1, %.lr.ph169.preheader ], [ %122, %121 ]
  %.0112166.unr = phi i32 [ 0, %.lr.ph169.preheader ], [ %111, %121 ]
  %.0113165.unr = phi i32 [ 0, %.lr.ph169.preheader ], [ %.1114.1, %121 ]
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge170, label %.lr.ph169.epil

.lr.ph169.epil:                                   ; preds = %._crit_edge170.loopexit.unr-lcssa
  %89 = and i32 %.0111167.unr, 1
  %.not141.epil = icmp eq i32 %89, 0
  %_ZZ5solvevE1b._ZZ5solvevE1a.epil = select i1 %.not141.epil, ptr @_ZZ5solvevE1b, ptr @_ZZ5solvevE1a
  %.in.epil = getelementptr inbounds [2001 x i32], ptr %_ZZ5solvevE1b._ZZ5solvevE1a.epil, i64 0, i64 %64
  %90 = load i32, ptr %.in.epil, align 4, !tbaa !5
  %91 = add nsw i32 %90, %.0112166.unr
  %92 = icmp sgt i32 %91, %.0113165.unr
  br i1 %92, label %93, label %._crit_edge170

93:                                               ; preds = %.lr.ph169.epil
  store i32 %.0111167.unr, ptr %83, align 4, !tbaa !5
  br label %._crit_edge170

._crit_edge170:                                   ; preds = %._crit_edge170.loopexit.unr-lcssa, %93, %.lr.ph169.epil, %82
  %94 = phi i32 [ 0, %82 ], [ %.lcssa248.ph, %._crit_edge170.loopexit.unr-lcssa ], [ %.0111167.unr, %93 ], [ %.unr, %.lr.ph169.epil ]
  %.0113.lcssa = phi i32 [ 0, %82 ], [ %.1114.lcssa.ph, %._crit_edge170.loopexit.unr-lcssa ], [ %91, %93 ], [ %.0113165.unr, %.lr.ph169.epil ]
  %95 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE1a, i64 0, i64 %64
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE1b, i64 0, i64 %64
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = sub i32 0, %98
  %.not138 = icmp eq i32 %96, %99
  %100 = select i1 %.not138, i32 2, i32 0
  %101 = and i32 %94, 1
  %.not139 = icmp eq i32 %101, 0
  %. = select i1 %.not139, i32 %96, i32 %98
  %.not140 = icmp eq i32 %., 0
  %102 = zext i1 %.not140 to i32
  %103 = or disjoint i32 %100, %102
  %104 = getelementptr inbounds [2001 x i32], ptr @typ, i64 0, i64 %64
  store i32 %103, ptr %104, align 4, !tbaa !5
  %105 = sub nsw i32 %85, %94
  store i32 %105, ptr %83, align 4, !tbaa !5
  %106 = add nuw nsw i32 %.0113.lcssa, %.0107175
  br label %123

.lr.ph169:                                        ; preds = %121, %.lr.ph169.preheader.new
  %107 = phi i32 [ 0, %.lr.ph169.preheader.new ], [ %114, %121 ]
  %.0111167 = phi i32 [ 1, %.lr.ph169.preheader.new ], [ %122, %121 ]
  %.0112166 = phi i32 [ 0, %.lr.ph169.preheader.new ], [ %111, %121 ]
  %.0113165 = phi i32 [ 0, %.lr.ph169.preheader.new ], [ %.1114.1, %121 ]
  %niter = phi i32 [ 0, %.lr.ph169.preheader.new ], [ %niter.next.1, %121 ]
  %108 = add nsw i32 %87, %.0112166
  %109 = icmp sgt i32 %108, %.0113165
  %110 = select i1 %109, i32 %.0111167, i32 %107
  %.1114 = select i1 %109, i32 %108, i32 %.0113165
  %111 = add nsw i32 %88, %108
  %112 = icmp sgt i32 %111, %.1114
  %113 = add nuw i32 %.0111167, 1
  %114 = select i1 %112, i32 %113, i32 %110
  %.1114.1 = select i1 %112, i32 %111, i32 %.1114
  %115 = xor i1 %109, true
  %116 = xor i1 %112, true
  %117 = xor i1 %115, true
  %118 = xor i1 %116, true
  %119 = or i1 %117, %118
  br i1 %119, label %120, label %121

120:                                              ; preds = %.lr.ph169
  store i32 %114, ptr %83, align 4, !tbaa !5
  br label %121

121:                                              ; preds = %.lr.ph169, %120
  %122 = add nuw i32 %.0111167, 2
  %niter.next.1 = add i32 %niter, 2
  %niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge170.loopexit.unr-lcssa, label %.lr.ph169, !llvm.loop !13

123:                                              ; preds = %._crit_edge163, %._crit_edge170
  %.1108 = phi i32 [ %106, %._crit_edge170 ], [ %.0107175, %._crit_edge163 ]
  %indvars.iv.next213 = add nuw nsw i64 %indvars.iv212, 1
  %124 = sext i32 %.1117.lcssa to i64
  %.not126.not = icmp slt i64 %indvars.iv212, %124
  br i1 %.not126.not, label %61, label %.preheader146, !llvm.loop !14

._crit_edge193:                                   ; preds = %168, %.preheader146
  %125 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.1108)
  %126 = load i32, ptr @n, align 4, !tbaa !5
  %.not128194 = icmp slt i32 %126, 1
  br i1 %.not128194, label %.preheader, label %.lr.ph197

.lr.ph192:                                        ; preds = %.preheader146, %168
  %indvars.iv229 = phi i64 [ %indvars.iv.next230, %168 ], [ 1, %.preheader146 ]
  %127 = phi i32 [ %169, %168 ], [ %60, %.preheader146 ]
  %128 = sext i32 %127 to i64
  %129 = shl nsw i64 %128, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @low, i64 4), i8 63, i64 %129, i1 false)
  %130 = icmp sgt i32 %127, 0
  br i1 %130, label %.lr.ph178.preheader, label %.loopexit

.lr.ph178.preheader:                              ; preds = %.lr.ph192
  %131 = zext nneg i32 %127 to i64
  br label %.lr.ph178

.preheader145:                                    ; preds = %.lr.ph178
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  %.not130179 = icmp slt i32 %.pre, 1
  br i1 %.not130179, label %.loopexit, label %.lr.ph181.preheader

.lr.ph181.preheader:                              ; preds = %.preheader145
  %132 = add nuw i32 %.pre, 1
  %wide.trip.count221 = zext i32 %132 to i64
  br label %.lr.ph181

.lr.ph178:                                        ; preds = %.lr.ph178.preheader, %.lr.ph178
  %indvars.iv215 = phi i64 [ %131, %.lr.ph178.preheader ], [ %indvars.iv.next216, %.lr.ph178 ]
  %133 = getelementptr inbounds [2001 x i32], ptr @ord, i64 0, i64 %indvars.iv215
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [2001 x i32], ptr @p, i64 0, i64 %135
  %137 = load i32, ptr %136, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [2001 x i32], ptr @low, i64 0, i64 %138
  %140 = getelementptr inbounds [2001 x i32], ptr @low, i64 0, i64 %135
  %141 = getelementptr inbounds [2001 x i32], ptr @rem, i64 0, i64 %135
  %142 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %140, ptr noundef nonnull align 4 dereferenceable(4) %141)
  %143 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %139, ptr noundef nonnull align 4 dereferenceable(4) %142)
  %144 = load i32, ptr %143, align 4, !tbaa !5
  %145 = load i32, ptr %136, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [2001 x i32], ptr @low, i64 0, i64 %146
  store i32 %144, ptr %147, align 4, !tbaa !5
  %indvars.iv.next216 = add nsw i64 %indvars.iv215, -1
  %148 = icmp ugt i64 %indvars.iv215, 1
  br i1 %148, label %.lr.ph178, label %.preheader145, !llvm.loop !15

.lr.ph181:                                        ; preds = %.lr.ph181.preheader, %.critedge
  %indvars.iv218 = phi i64 [ 1, %.lr.ph181.preheader ], [ %indvars.iv.next219, %.critedge ]
  %149 = getelementptr inbounds [2001 x i32], ptr @rem, i64 0, i64 %indvars.iv218
  %150 = load i32, ptr %149, align 4, !tbaa !5
  %.not131 = icmp slt i32 %150, %.pre
  br i1 %.not131, label %151, label %.critedge

151:                                              ; preds = %.lr.ph181
  %152 = getelementptr inbounds [2001 x i32], ptr @low, i64 0, i64 %indvars.iv218
  %153 = load i32, ptr %152, align 4, !tbaa !5
  %.not132 = icmp eq i32 %153, 0
  br i1 %.not132, label %.critedge, label %154

154:                                              ; preds = %151
  %155 = getelementptr inbounds [2001 x i32], ptr @typ, i64 0, i64 %indvars.iv218
  %156 = load i32, ptr %155, align 4, !tbaa !5
  %157 = and i32 %156, 2
  %.not133 = icmp eq i32 %157, 0
  %158 = and i32 %150, 1
  %spec.select = select i1 %.not133, i32 %150, i32 %158
  %159 = and i32 %156, 1
  %.not134 = icmp sgt i32 %spec.select, %159
  br i1 %.not134, label %.critedge, label %160

160:                                              ; preds = %154
  %161 = trunc nuw nsw i64 %indvars.iv218 to i32
  %162 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE3out, i64 0, i64 %indvars.iv229
  store i32 %161, ptr %162, align 4, !tbaa !5
  br label %.loopexit

.critedge:                                        ; preds = %154, %.lr.ph181, %151
  %indvars.iv.next219 = add nuw nsw i64 %indvars.iv218, 1
  %exitcond222.not = icmp eq i64 %indvars.iv.next219, %wide.trip.count221
  br i1 %exitcond222.not, label %.loopexit, label %.lr.ph181, !llvm.loop !16

.loopexit:                                        ; preds = %.critedge, %.lr.ph192, %.preheader145, %160
  %163 = phi i32 [ %.pre, %.preheader145 ], [ %.pre, %160 ], [ %127, %.lr.ph192 ], [ %.pre, %.critedge ]
  %164 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE3out, i64 0, i64 %indvars.iv229
  %165 = load i32, ptr %164, align 4, !tbaa !5
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [2001 x i32], ptr @rem, i64 0, i64 %166
  store i32 %163, ptr %167, align 4, !tbaa !5
  store i32 %165, ptr getelementptr inbounds (i8, ptr @_ZZ5solvevE3que, i64 4), align 4, !tbaa !5
  br label %171

168:                                              ; preds = %._crit_edge186
  %indvars.iv.next230 = add nuw nsw i64 %indvars.iv229, 1
  %169 = load i32, ptr @n, align 4, !tbaa !5
  %170 = sext i32 %169 to i64
  %.not127.not = icmp slt i64 %indvars.iv229, %170
  br i1 %.not127.not, label %.lr.ph192, label %._crit_edge193, !llvm.loop !17

171:                                              ; preds = %.loopexit, %._crit_edge186
  %indvars.iv226 = phi i64 [ 1, %.loopexit ], [ %indvars.iv.next227, %._crit_edge186 ]
  %.0103189 = phi i32 [ 1, %.loopexit ], [ %.1.lcssa, %._crit_edge186 ]
  %172 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE3que, i64 0, i64 %indvars.iv226
  %173 = load i32, ptr %172, align 4, !tbaa !5
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [2001 x i32], ptr @rem, i64 0, i64 %174
  %176 = load i32, ptr %175, align 4, !tbaa !5
  %177 = load i32, ptr @n, align 4, !tbaa !5
  %178 = icmp slt i32 %176, %177
  %.neg = sext i1 %178 to i32
  %179 = add i32 %176, %.neg
  store i32 %179, ptr %175, align 4, !tbaa !5
  %180 = getelementptr inbounds [2001 x %"class.std::vector"], ptr @e, i64 0, i64 %174
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %181 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %180) #6
  store ptr %181, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %182 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %180) #6
  store ptr %182, ptr %5, align 8
  %183 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  br i1 %183, label %.lr.ph185.preheader, label %._crit_edge186

.lr.ph185.preheader:                              ; preds = %171
  %184 = sext i32 %.0103189 to i64
  br label %.lr.ph185

._crit_edge186.loopexit:                          ; preds = %.lr.ph185
  %185 = trunc nsw i64 %indvars.iv.next224 to i32
  br label %._crit_edge186

._crit_edge186:                                   ; preds = %._crit_edge186.loopexit, %171
  %.1.lcssa = phi i32 [ %.0103189, %171 ], [ %185, %._crit_edge186.loopexit ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  %indvars.iv.next227 = add nuw nsw i64 %indvars.iv226, 1
  %186 = sext i32 %.1.lcssa to i64
  %.not135.not = icmp slt i64 %indvars.iv226, %186
  br i1 %.not135.not, label %171, label %168, !llvm.loop !18

.lr.ph185:                                        ; preds = %.lr.ph185.preheader, %.lr.ph185
  %indvars.iv223 = phi i64 [ %184, %.lr.ph185.preheader ], [ %indvars.iv.next224, %.lr.ph185 ]
  %187 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  %188 = load i32, ptr %187, align 4, !tbaa !5
  %indvars.iv.next224 = add nsw i64 %indvars.iv223, 1
  %189 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE3que, i64 0, i64 %indvars.iv.next224
  store i32 %188, ptr %189, align 4, !tbaa !5
  %190 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  %191 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  br i1 %191, label %.lr.ph185, label %._crit_edge186.loopexit

.preheader:                                       ; preds = %.lr.ph197, %._crit_edge193
  %192 = phi i32 [ %126, %._crit_edge193 ], [ %203, %.lr.ph197 ]
  %.not129198 = icmp slt i32 %192, 0
  br i1 %.not129198, label %._crit_edge201, label %.lr.ph200

.lr.ph197:                                        ; preds = %._crit_edge193, %.lr.ph197
  %indvars.iv232 = phi i64 [ %indvars.iv.next233, %.lr.ph197 ], [ 1, %._crit_edge193 ]
  %193 = phi i32 [ %203, %.lr.ph197 ], [ %126, %._crit_edge193 ]
  %194 = getelementptr inbounds [2001 x i32], ptr @_ZZ5solvevE3out, i64 0, i64 %indvars.iv232
  %195 = load i32, ptr %194, align 4, !tbaa !5
  %196 = zext i32 %193 to i64
  %197 = icmp eq i64 %indvars.iv232, %196
  %198 = zext i1 %197 to i64
  %199 = getelementptr inbounds [3 x i8], ptr @.str.5, i64 0, i64 %198
  %200 = load i8, ptr %199, align 1, !tbaa !19
  %201 = sext i8 %200 to i32
  %202 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %195, i32 noundef %201)
  %indvars.iv.next233 = add nuw nsw i64 %indvars.iv232, 1
  %203 = load i32, ptr @n, align 4, !tbaa !5
  %204 = sext i32 %203 to i64
  %.not128.not = icmp slt i64 %indvars.iv232, %204
  br i1 %.not128.not, label %.lr.ph197, label %.preheader, !llvm.loop !20

._crit_edge201:                                   ; preds = %.lr.ph200, %.preheader
  ret void

.lr.ph200:                                        ; preds = %.preheader, %.lr.ph200
  %indvars.iv235 = phi i64 [ %indvars.iv.next236, %.lr.ph200 ], [ 0, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %6, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #6
  %205 = getelementptr inbounds [2001 x %"class.std::vector"], ptr @e, i64 0, i64 %indvars.iv235
  call void @_ZNSt6vectorIiSaIiEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 8 dereferenceable(24) %205) #6
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #6
  %indvars.iv.next236 = add nuw nsw i64 %indvars.iv235, 1
  %206 = load i32, ptr @n, align 4, !tbaa !5
  %207 = sext i32 %206 to i64
  %.not129.not = icmp slt i64 %indvars.iv235, %207
  br i1 %.not129.not, label %.lr.ph200, label %._crit_edge201, !llvm.loop !21
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3

; 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 #1 align 2

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

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

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

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

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

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

; 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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 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 = { nofree nounwind "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 = { 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = !{!7, !7, i64 0}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}


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