; LLVM IR from Izaron/ACM-ICPC :: Timus Online Judge/Volume 5/1452. Pascal vs. C++ (main)

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

@n = external dso_local global i32, align 4
@ms = external dso_local global [2005 x i32], align 16
@ind = external dso_local global %"class.std::map", align 8
@ind2 = external dso_local global %"class.std::map", align 8
@kek = external dso_local global [2005 x [2005 x i16]], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %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 i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i16, align 2
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %21

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

25:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %40

26:                                               ; preds = %21
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %28
  %30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %29)
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = trunc i32 %31 to i16
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %34
  %36 = call noundef nonnull align 2 dereferenceable(2) ptr @_ZNSt3mapIisSt4lessIiESaISt4pairIKisEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @ind, ptr noundef nonnull align 4 dereferenceable(4) %35)
  store i16 %32, ptr %36, align 2, !tbaa !9
  br label %37

37:                                               ; preds = %26
  %38 = load i32, ptr %2, align 4, !tbaa !5
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr %2, align 4, !tbaa !5
  br label %21, !llvm.loop !11

40:                                               ; preds = %25
  %41 = load i32, ptr @n, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds i32, ptr @ms, i64 %42
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef @ms, ptr noundef %43)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %56, %40
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = load i32, ptr @n, align 4, !tbaa !5
  %47 = icmp slt i32 %45, %46
  br i1 %47, label %49, label %48

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

49:                                               ; preds = %44
  %50 = load i32, ptr %3, align 4, !tbaa !5
  %51 = trunc i32 %50 to i16
  %52 = load i32, ptr %3, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %53
  %55 = call noundef nonnull align 2 dereferenceable(2) ptr @_ZNSt3mapIisSt4lessIiESaISt4pairIKisEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @ind2, ptr noundef nonnull align 4 dereferenceable(4) %54)
  store i16 %51, ptr %55, align 2, !tbaa !9
  br label %56

56:                                               ; preds = %49
  %57 = load i32, ptr %3, align 4, !tbaa !5
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %3, align 4, !tbaa !5
  br label %44, !llvm.loop !13

59:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  %60 = load i32, ptr @ms, align 16, !tbaa !5
  store i32 %60, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  store i32 1, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 16 @kek, i8 0, i64 8040050, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %61 = load i32, ptr @n, align 4, !tbaa !5
  %62 = sub nsw i32 %61, 1
  store i32 %62, ptr %10, align 4, !tbaa !5
  br label %63

63:                                               ; preds = %198, %59
  %64 = load i32, ptr %10, align 4, !tbaa !5
  %65 = icmp sge i32 %64, 0
  br i1 %65, label %67, label %66

66:                                               ; preds = %63
  store i32 8, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %201

67:                                               ; preds = %63
  %68 = load i32, ptr %10, align 4, !tbaa !5
  %69 = add nsw i32 %68, 1
  %70 = load i32, ptr @n, align 4, !tbaa !5
  %71 = icmp slt i32 %69, %70
  br i1 %71, label %72, label %84

72:                                               ; preds = %67
  %73 = load i32, ptr %10, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = load i32, ptr %10, align 4, !tbaa !5
  %78 = add nsw i32 %77, 1
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = icmp eq i32 %76, %81
  br i1 %82, label %83, label %84

83:                                               ; preds = %72
  br label %198

84:                                               ; preds = %72, %67
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %85 = load i32, ptr %10, align 4, !tbaa !5
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %12, align 4, !tbaa !5
  br label %87

87:                                               ; preds = %194, %84
  %88 = load i32, ptr %12, align 4, !tbaa !5
  %89 = load i32, ptr @n, align 4, !tbaa !5
  %90 = icmp slt i32 %88, %89
  br i1 %90, label %92, label %91

91:                                               ; preds = %87
  store i32 11, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %197

92:                                               ; preds = %87
  %93 = load i32, ptr %12, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = load i32, ptr %10, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %98
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = icmp eq i32 %96, %100
  br i1 %101, label %102, label %103

102:                                              ; preds = %92
  br label %194

103:                                              ; preds = %92
  %104 = load i32, ptr %10, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [2005 x [2005 x i16]], ptr @kek, i64 0, i64 %105
  %107 = load i32, ptr %12, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [2005 x i16], ptr %106, i64 0, i64 %108
  store i16 2, ptr %109, align 2, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %110 = load i32, ptr %12, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = mul nsw i32 %113, 2
  %115 = load i32, ptr %10, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = sub nsw i32 %114, %118
  store i32 %119, ptr %13, align 4, !tbaa !5
  %120 = call noundef i64 @_ZNKSt3mapIisSt4lessIiESaISt4pairIKisEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48) @ind2, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %121 = icmp ne i64 %120, 0
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br i1 %121, label %122, label %193

122:                                              ; preds = %103
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %123 = load i32, ptr %12, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %124
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = mul nsw i32 %126, 2
  %128 = load i32, ptr %10, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %129
  %131 = load i32, ptr %130, align 4, !tbaa !5
  %132 = sub nsw i32 %127, %131
  store i32 %132, ptr %15, align 4, !tbaa !5
  %133 = call noundef nonnull align 2 dereferenceable(2) ptr @_ZNSt3mapIisSt4lessIiESaISt4pairIKisEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) @ind2, ptr noundef nonnull align 4 dereferenceable(4) %15)
  %134 = load i16, ptr %133, align 2, !tbaa !9
  %135 = sext i16 %134 to i32
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  store i32 %135, ptr %14, align 4, !tbaa !5
  %136 = load i32, ptr %10, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [2005 x [2005 x i16]], ptr @kek, i64 0, i64 %137
  %139 = load i32, ptr %12, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [2005 x i16], ptr %138, i64 0, i64 %140
  call void @llvm.lifetime.start.p0(i64 2, ptr %16) #7
  %142 = load i32, ptr %12, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [2005 x [2005 x i16]], ptr @kek, i64 0, i64 %143
  %145 = load i32, ptr %14, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [2005 x i16], ptr %144, i64 0, i64 %146
  %148 = load i16, ptr %147, align 2, !tbaa !9
  %149 = sext i16 %148 to i32
  %150 = add nsw i32 %149, 1
  %151 = trunc i32 %150 to i16
  store i16 %151, ptr %16, align 2, !tbaa !9
  %152 = call noundef nonnull align 2 dereferenceable(2) ptr @_ZSt3maxIsERKT_S2_S2_(ptr noundef nonnull align 2 dereferenceable(2) %141, ptr noundef nonnull align 2 dereferenceable(2) %16)
  %153 = load i16, ptr %152, align 2, !tbaa !9
  %154 = load i32, ptr %10, align 4, !tbaa !5
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [2005 x [2005 x i16]], ptr @kek, i64 0, i64 %155
  %157 = load i32, ptr %12, align 4, !tbaa !5
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [2005 x i16], ptr %156, i64 0, i64 %158
  store i16 %153, ptr %159, align 2, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 2, ptr %16) #7
  %160 = load i32, ptr %10, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [2005 x [2005 x i16]], ptr @kek, i64 0, i64 %161
  %163 = load i32, ptr %12, align 4, !tbaa !5
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [2005 x i16], ptr %162, i64 0, i64 %164
  %166 = load i16, ptr %165, align 2, !tbaa !9
  %167 = sext i16 %166 to i32
  %168 = load i32, ptr %5, align 4, !tbaa !5
  %169 = icmp sgt i32 %167, %168
  br i1 %169, label %170, label %192

170:                                              ; preds = %122
  %171 = load i32, ptr %10, align 4, !tbaa !5
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [2005 x [2005 x i16]], ptr @kek, i64 0, i64 %172
  %174 = load i32, ptr %12, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [2005 x i16], ptr %173, i64 0, i64 %175
  %177 = load i16, ptr %176, align 2, !tbaa !9
  %178 = sext i16 %177 to i32
  store i32 %178, ptr %5, align 4, !tbaa !5
  %179 = load i32, ptr %10, align 4, !tbaa !5
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %180
  %182 = load i32, ptr %181, align 4, !tbaa !5
  store i32 %182, ptr %4, align 4, !tbaa !5
  %183 = load i32, ptr %12, align 4, !tbaa !5
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %184
  %186 = load i32, ptr %185, align 4, !tbaa !5
  %187 = load i32, ptr %10, align 4, !tbaa !5
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %188
  %190 = load i32, ptr %189, align 4, !tbaa !5
  %191 = sub nsw i32 %186, %190
  store i32 %191, ptr %6, align 4, !tbaa !5
  br label %192

192:                                              ; preds = %170, %122
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %193

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

194:                                              ; preds = %193, %102
  %195 = load i32, ptr %12, align 4, !tbaa !5
  %196 = add nsw i32 %195, 1
  store i32 %196, ptr %12, align 4, !tbaa !5
  br label %87, !llvm.loop !14

197:                                              ; preds = %91
  br label %198

198:                                              ; preds = %197, %83
  %199 = load i32, ptr %10, align 4, !tbaa !5
  %200 = add nsw i32 %199, -1
  store i32 %200, ptr %10, align 4, !tbaa !5
  br label %63, !llvm.loop !15

201:                                              ; preds = %66
  %202 = load i32, ptr %5, align 4, !tbaa !5
  %203 = icmp sgt i32 2, %202
  br i1 %203, label %204, label %242

204:                                              ; preds = %201
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  store i32 0, ptr %17, align 4, !tbaa !5
  br label %205

205:                                              ; preds = %238, %204
  %206 = load i32, ptr %17, align 4, !tbaa !5
  %207 = add nsw i32 %206, 1
  %208 = load i32, ptr @n, align 4, !tbaa !5
  %209 = icmp slt i32 %207, %208
  br i1 %209, label %211, label %210

210:                                              ; preds = %205
  store i32 14, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %241

211:                                              ; preds = %205
  %212 = load i32, ptr %17, align 4, !tbaa !5
  %213 = sext i32 %212 to i64
  %214 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %213
  %215 = load i32, ptr %214, align 4, !tbaa !5
  %216 = load i32, ptr %17, align 4, !tbaa !5
  %217 = add nsw i32 %216, 1
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %218
  %220 = load i32, ptr %219, align 4, !tbaa !5
  %221 = icmp ne i32 %215, %220
  br i1 %221, label %222, label %237

222:                                              ; preds = %211
  %223 = load i32, ptr %17, align 4, !tbaa !5
  %224 = sext i32 %223 to i64
  %225 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %224
  %226 = load i32, ptr %225, align 4, !tbaa !5
  store i32 %226, ptr %4, align 4, !tbaa !5
  store i32 2, ptr %5, align 4, !tbaa !5
  %227 = load i32, ptr %17, align 4, !tbaa !5
  %228 = add nsw i32 %227, 1
  %229 = sext i32 %228 to i64
  %230 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %229
  %231 = load i32, ptr %230, align 4, !tbaa !5
  %232 = load i32, ptr %17, align 4, !tbaa !5
  %233 = sext i32 %232 to i64
  %234 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %233
  %235 = load i32, ptr %234, align 4, !tbaa !5
  %236 = sub nsw i32 %231, %235
  store i32 %236, ptr %6, align 4, !tbaa !5
  br label %237

237:                                              ; preds = %222, %211
  br label %238

238:                                              ; preds = %237
  %239 = load i32, ptr %17, align 4, !tbaa !5
  %240 = add nsw i32 %239, 1
  store i32 %240, ptr %17, align 4, !tbaa !5
  br label %205, !llvm.loop !16

241:                                              ; preds = %210
  br label %242

242:                                              ; preds = %241, %201
  %243 = load i32, ptr %5, align 4, !tbaa !5
  %244 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %243)
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  store i32 0, ptr %18, align 4, !tbaa !5
  br label %245

245:                                              ; preds = %261, %242
  %246 = load i32, ptr %18, align 4, !tbaa !5
  %247 = load i32, ptr %5, align 4, !tbaa !5
  %248 = icmp slt i32 %246, %247
  br i1 %248, label %250, label %249

249:                                              ; preds = %245
  store i32 17, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  br label %264

250:                                              ; preds = %245
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  %251 = load i32, ptr %4, align 4, !tbaa !5
  %252 = load i32, ptr %18, align 4, !tbaa !5
  %253 = load i32, ptr %6, align 4, !tbaa !5
  %254 = mul nsw i32 %252, %253
  %255 = add nsw i32 %251, %254
  store i32 %255, ptr %19, align 4, !tbaa !5
  %256 = call noundef nonnull align 2 dereferenceable(2) ptr @_ZNSt3mapIisSt4lessIiESaISt4pairIKisEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) @ind, ptr noundef nonnull align 4 dereferenceable(4) %19)
  %257 = load i16, ptr %256, align 2, !tbaa !9
  %258 = sext i16 %257 to i32
  %259 = add nsw i32 %258, 1
  %260 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %259)
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %261

261:                                              ; preds = %250
  %262 = load i32, ptr %18, align 4, !tbaa !5
  %263 = add nsw i32 %262, 1
  store i32 %263, ptr %18, align 4, !tbaa !5
  br label %245, !llvm.loop !17

264:                                              ; preds = %249
  %265 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  %266 = load i32, ptr %1, align 4
  ret i32 %266
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #1

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

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

; 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: mustprogress uwtable
declare dso_local noundef i64 @_ZNKSt3mapIisSt4lessIiESaISt4pairIKisEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) #3 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 2 dereferenceable(2) ptr @_ZSt3maxIsERKT_S2_S2_(ptr noundef nonnull align 2 dereferenceable(2), ptr noundef nonnull align 2 dereferenceable(2)) #6

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

attributes #0 = { mustprogress norecurse 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 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint mustprogress 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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"short", !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::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, std::pair<const int, short>, std::_Select1st<std::pair<const int, short>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, short>, std::_Select1st<std::pair<const int, short>>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }

@n = external dso_local global i32, align 4
@ms = external dso_local global [2005 x i32], align 16
@ind = external dso_local global %"class.std::map", align 8
@ind2 = external dso_local global %"class.std::map", align 8
@kek = external dso_local global [2005 x [2005 x i16]], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i16, align 2
  %4 = alloca i32, align 4
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %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

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre = sext i32 %6 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.._crit_edge_crit_edge ], [ %17, %.lr.ph ]
  %8 = getelementptr inbounds i32, ptr @ms, i64 %.pre-phi
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @ms, ptr noundef nonnull %8)
  %9 = load i32, ptr @n, align 4
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph89, label %._crit_edge90.thread

._crit_edge90.thread:                             ; preds = %._crit_edge
  %11 = load i32, ptr @ms, align 16, !tbaa !5
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(8040050) @kek, i8 0, i64 8040050, i1 false)
  br label %.loopexit.thread

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %12 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %indvars.iv
  %13 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %12)
  %14 = trunc i64 %indvars.iv to i16
  %15 = tail call noundef nonnull align 2 dereferenceable(2) ptr @_ZNSt3mapIisSt4lessIiESaISt4pairIKisEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @ind, ptr noundef nonnull align 4 dereferenceable(4) %12)
  store i16 %14, ptr %15, align 2, !tbaa !9
  %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
  %18 = icmp slt i64 %indvars.iv.next, %17
  br i1 %18, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge90:                                    ; preds = %.lr.ph89
  %19 = load i32, ptr @ms, align 16, !tbaa !5
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(8040050) @kek, i8 0, i64 8040050, i1 false)
  %20 = icmp sgt i32 %25, 0
  br i1 %20, label %.lr.ph108.preheader, label %.loopexit.thread

.lr.ph108.preheader:                              ; preds = %._crit_edge90
  %21 = zext nneg i32 %25 to i64
  br label %.lr.ph108

.lr.ph89:                                         ; preds = %._crit_edge, %.lr.ph89
  %indvars.iv129 = phi i64 [ %indvars.iv.next130, %.lr.ph89 ], [ 0, %._crit_edge ]
  %22 = trunc i64 %indvars.iv129 to i16
  %23 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %indvars.iv129
  %24 = tail call noundef nonnull align 2 dereferenceable(2) ptr @_ZNSt3mapIisSt4lessIiESaISt4pairIKisEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @ind2, ptr noundef nonnull align 4 dereferenceable(4) %23)
  store i16 %22, ptr %24, align 2, !tbaa !9
  %indvars.iv.next130 = add nuw nsw i64 %indvars.iv129, 1
  %25 = load i32, ptr @n, align 4
  %26 = sext i32 %25 to i64
  %27 = icmp slt i64 %indvars.iv.next130, %26
  br i1 %27, label %.lr.ph89, label %._crit_edge90, !llvm.loop !13

._crit_edge109:                                   ; preds = %.loopexit84
  %28 = icmp slt i32 %.465, 2
  br i1 %28, label %.preheader, label %.loopexit.thread

.preheader:                                       ; preds = %._crit_edge109
  %29 = icmp sgt i32 %77, 1
  br i1 %29, label %.lr.ph117.preheader, label %.loopexit.thread

.lr.ph117.preheader:                              ; preds = %.preheader
  %30 = add nsw i32 %77, -1
  %wide.trip.count = zext nneg i32 %30 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %31 = icmp eq i32 %30, 1
  br i1 %31, label %.loopexit.unr-lcssa, label %.lr.ph117.preheader.new

.lr.ph117.preheader.new:                          ; preds = %.lr.ph117.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483646
  br label %.lr.ph117

.lr.ph108:                                        ; preds = %.lr.ph108.preheader, %.loopexit84
  %32 = phi i32 [ %25, %.lr.ph108.preheader ], [ %77, %.loopexit84 ]
  %.old = phi i32 [ %25, %.lr.ph108.preheader ], [ %.old147, %.loopexit84 ]
  %indvars.iv132 = phi i64 [ %21, %.lr.ph108.preheader ], [ %indvars.iv.next133, %.loopexit84 ]
  %.060104 = phi i32 [ %19, %.lr.ph108.preheader ], [ %.4, %.loopexit84 ]
  %.061103 = phi i32 [ 1, %.lr.ph108.preheader ], [ %.465, %.loopexit84 ]
  %.069102 = phi i32 [ 0, %.lr.ph108.preheader ], [ %.473, %.loopexit84 ]
  %indvars.iv.next133 = add nsw i64 %indvars.iv132, -1
  %33 = sext i32 %.old to i64
  %34 = icmp slt i64 %indvars.iv132, %33
  br i1 %34, label %35, label %.loopexit84

35:                                               ; preds = %.lr.ph108
  %36 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %indvars.iv.next133
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %indvars.iv132
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = icmp ne i32 %37, %39
  %41 = sext i32 %32 to i64
  %42 = icmp slt i64 %indvars.iv132, %41
  %or.cond = select i1 %40, i1 %42, i1 false
  br i1 %or.cond, label %.lr.ph97, label %.loopexit84

.lr.ph97:                                         ; preds = %35
  %43 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %indvars.iv.next133
  br label %44

44:                                               ; preds = %.lr.ph97, %73
  %indvars.iv134 = phi i64 [ %indvars.iv132, %.lr.ph97 ], [ %indvars.iv.next135, %73 ]
  %.194 = phi i32 [ %.060104, %.lr.ph97 ], [ %.3, %73 ]
  %.16293 = phi i32 [ %.061103, %.lr.ph97 ], [ %.364, %73 ]
  %.17092 = phi i32 [ %.069102, %.lr.ph97 ], [ %.372, %73 ]
  %45 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %indvars.iv134
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = load i32, ptr %43, align 4, !tbaa !5
  %48 = icmp eq i32 %46, %47
  br i1 %48, label %73, label %49

49:                                               ; preds = %44
  %50 = getelementptr inbounds [2005 x [2005 x i16]], ptr @kek, i64 0, i64 %indvars.iv.next133, i64 %indvars.iv134
  store i16 2, ptr %50, align 2, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %51 = shl nsw i32 %46, 1
  %52 = sub nsw i32 %51, %47
  store i32 %52, ptr %1, align 4, !tbaa !5
  %53 = call noundef i64 @_ZNKSt3mapIisSt4lessIiESaISt4pairIKisEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48) @ind2, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.not83 = icmp eq i64 %53, 0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  br i1 %.not83, label %73, label %54

54:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %55 = load i32, ptr %45, align 4, !tbaa !5
  %56 = shl nsw i32 %55, 1
  %57 = load i32, ptr %43, align 4, !tbaa !5
  %58 = sub nsw i32 %56, %57
  store i32 %58, ptr %2, align 4, !tbaa !5
  %59 = call noundef nonnull align 2 dereferenceable(2) ptr @_ZNSt3mapIisSt4lessIiESaISt4pairIKisEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) @ind2, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %60 = load i16, ptr %59, align 2, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %3) #7
  %61 = sext i16 %60 to i64
  %62 = getelementptr inbounds [2005 x [2005 x i16]], ptr @kek, i64 0, i64 %indvars.iv134, i64 %61
  %63 = load i16, ptr %62, align 2, !tbaa !9
  %64 = add i16 %63, 1
  store i16 %64, ptr %3, align 2, !tbaa !9
  %65 = call noundef nonnull align 2 dereferenceable(2) ptr @_ZSt3maxIsERKT_S2_S2_(ptr noundef nonnull align 2 dereferenceable(2) %50, ptr noundef nonnull align 2 dereferenceable(2) %3)
  %66 = load i16, ptr %65, align 2, !tbaa !9
  store i16 %66, ptr %50, align 2, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %3) #7
  %67 = sext i16 %66 to i32
  %68 = icmp slt i32 %.16293, %67
  br i1 %68, label %69, label %73

69:                                               ; preds = %54
  %70 = load i32, ptr %43, align 4, !tbaa !5
  %71 = load i32, ptr %45, align 4, !tbaa !5
  %72 = sub nsw i32 %71, %70
  br label %73

73:                                               ; preds = %54, %69, %49, %44
  %.372 = phi i32 [ %.17092, %44 ], [ %.17092, %49 ], [ %72, %69 ], [ %.17092, %54 ]
  %.364 = phi i32 [ %.16293, %44 ], [ %.16293, %49 ], [ %67, %69 ], [ %.16293, %54 ]
  %.3 = phi i32 [ %.194, %44 ], [ %.194, %49 ], [ %70, %69 ], [ %.194, %54 ]
  %indvars.iv.next135 = add nuw nsw i64 %indvars.iv134, 1
  %74 = load i32, ptr @n, align 4
  %75 = trunc nuw i64 %indvars.iv.next135 to i32
  %76 = icmp sgt i32 %74, %75
  br i1 %76, label %44, label %.loopexit84, !llvm.loop !14

.loopexit84:                                      ; preds = %73, %.lr.ph108, %35
  %77 = phi i32 [ %32, %35 ], [ %32, %.lr.ph108 ], [ %74, %73 ]
  %.old147 = phi i32 [ %32, %35 ], [ %.old, %.lr.ph108 ], [ %74, %73 ]
  %.473 = phi i32 [ %.069102, %35 ], [ %.069102, %.lr.ph108 ], [ %.372, %73 ]
  %.465 = phi i32 [ %.061103, %35 ], [ %.061103, %.lr.ph108 ], [ %.364, %73 ]
  %.4 = phi i32 [ %.060104, %35 ], [ %.060104, %.lr.ph108 ], [ %.3, %73 ]
  %78 = icmp sgt i64 %indvars.iv132, 1
  br i1 %78, label %.lr.ph108, label %._crit_edge109, !llvm.loop !15

.lr.ph117:                                        ; preds = %.lr.ph117, %.lr.ph117.preheader.new
  %indvars.iv140 = phi i64 [ 0, %.lr.ph117.preheader.new ], [ %indvars.iv.next141.1, %.lr.ph117 ]
  %indvars.iv138 = phi i64 [ 1, %.lr.ph117.preheader.new ], [ %indvars.iv.next139.1, %.lr.ph117 ]
  %.5115 = phi i32 [ %.4, %.lr.ph117.preheader.new ], [ %.6.1, %.lr.ph117 ]
  %.566114 = phi i32 [ 1, %.lr.ph117.preheader.new ], [ %.667.1, %.lr.ph117 ]
  %.574113 = phi i32 [ %.473, %.lr.ph117.preheader.new ], [ %.675.1, %.lr.ph117 ]
  %niter = phi i64 [ 0, %.lr.ph117.preheader.new ], [ %niter.next.1, %.lr.ph117 ]
  %79 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %indvars.iv140
  %80 = load i32, ptr %79, align 8, !tbaa !5
  %81 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %indvars.iv138
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %.not = icmp eq i32 %80, %82
  %83 = sub nsw i32 %82, %80
  %.675 = select i1 %.not, i32 %.574113, i32 %83
  %.6 = select i1 %.not, i32 %.5115, i32 %80
  %indvars.iv.next139 = add nuw nsw i64 %indvars.iv138, 1
  %84 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %indvars.iv.next139
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %.not.1 = icmp eq i32 %82, %85
  %86 = sub nsw i32 %85, %82
  %.675.1 = select i1 %.not.1, i32 %.675, i32 %86
  %87 = select i1 %.not.1, i1 %.not, i1 false
  %.667.1 = select i1 %87, i32 %.566114, i32 2
  %.6.1 = select i1 %.not.1, i32 %.6, i32 %82
  %indvars.iv.next139.1 = add nuw nsw i64 %indvars.iv138, 2
  %indvars.iv.next141.1 = add nuw nsw i64 %indvars.iv140, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.loopexit.unr-lcssa, label %.lr.ph117, !llvm.loop !16

.loopexit.thread:                                 ; preds = %._crit_edge109, %.preheader, %._crit_edge90.thread, %._crit_edge90
  %.776.ph = phi i32 [ %.473, %.preheader ], [ %.473, %._crit_edge109 ], [ 0, %._crit_edge90.thread ], [ 0, %._crit_edge90 ]
  %.768.ph = phi i32 [ 1, %.preheader ], [ %.465, %._crit_edge109 ], [ 1, %._crit_edge90.thread ], [ 1, %._crit_edge90 ]
  %.7.ph = phi i32 [ %.4, %.preheader ], [ %.4, %._crit_edge109 ], [ %11, %._crit_edge90.thread ], [ %19, %._crit_edge90 ]
  %88 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.768.ph)
  br label %.lr.ph123.preheader

.loopexit.unr-lcssa:                              ; preds = %.lr.ph117, %.lr.ph117.preheader
  %.675.lcssa.ph = phi i32 [ poison, %.lr.ph117.preheader ], [ %.675.1, %.lr.ph117 ]
  %.667.lcssa.ph = phi i32 [ poison, %.lr.ph117.preheader ], [ %.667.1, %.lr.ph117 ]
  %.6.lcssa.ph = phi i32 [ poison, %.lr.ph117.preheader ], [ %.6.1, %.lr.ph117 ]
  %indvars.iv140.unr = phi i64 [ 0, %.lr.ph117.preheader ], [ %indvars.iv.next141.1, %.lr.ph117 ]
  %indvars.iv138.unr = phi i64 [ 1, %.lr.ph117.preheader ], [ %indvars.iv.next139.1, %.lr.ph117 ]
  %.5115.unr = phi i32 [ %.4, %.lr.ph117.preheader ], [ %.6.1, %.lr.ph117 ]
  %.566114.unr = phi i32 [ 1, %.lr.ph117.preheader ], [ %.667.1, %.lr.ph117 ]
  %.574113.unr = phi i32 [ %.473, %.lr.ph117.preheader ], [ %.675.1, %.lr.ph117 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.loopexit, label %.lr.ph117.epil

.lr.ph117.epil:                                   ; preds = %.loopexit.unr-lcssa
  %89 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %indvars.iv140.unr
  %90 = load i32, ptr %89, align 4, !tbaa !5
  %91 = getelementptr inbounds [2005 x i32], ptr @ms, i64 0, i64 %indvars.iv138.unr
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %.not.epil = icmp eq i32 %90, %92
  %93 = sub nsw i32 %92, %90
  %.675.epil = select i1 %.not.epil, i32 %.574113.unr, i32 %93
  %.667.epil = select i1 %.not.epil, i32 %.566114.unr, i32 2
  %.6.epil = select i1 %.not.epil, i32 %.5115.unr, i32 %90
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.unr-lcssa, %.lr.ph117.epil
  %.675.lcssa = phi i32 [ %.675.lcssa.ph, %.loopexit.unr-lcssa ], [ %.675.epil, %.lr.ph117.epil ]
  %.667.lcssa = phi i32 [ %.667.lcssa.ph, %.loopexit.unr-lcssa ], [ %.667.epil, %.lr.ph117.epil ]
  %.6.lcssa = phi i32 [ %.6.lcssa.ph, %.loopexit.unr-lcssa ], [ %.6.epil, %.lr.ph117.epil ]
  %94 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.667.lcssa)
  %95 = icmp sgt i32 %.667.lcssa, 0
  br i1 %95, label %.lr.ph123.preheader, label %._crit_edge124

.lr.ph123.preheader:                              ; preds = %.loopexit.thread, %.loopexit
  %.7161 = phi i32 [ %.7.ph, %.loopexit.thread ], [ %.6.lcssa, %.loopexit ]
  %.768160 = phi i32 [ %.768.ph, %.loopexit.thread ], [ %.667.lcssa, %.loopexit ]
  %.776159 = phi i32 [ %.776.ph, %.loopexit.thread ], [ %.675.lcssa, %.loopexit ]
  br label %.lr.ph123

._crit_edge124:                                   ; preds = %.lr.ph123, %.loopexit
  %96 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  ret i32 0

.lr.ph123:                                        ; preds = %.lr.ph123.preheader, %.lr.ph123
  %.0121 = phi i32 [ %104, %.lr.ph123 ], [ 0, %.lr.ph123.preheader ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  %97 = mul nsw i32 %.0121, %.776159
  %98 = add nsw i32 %97, %.7161
  store i32 %98, ptr %4, align 4, !tbaa !5
  %99 = call noundef nonnull align 2 dereferenceable(2) ptr @_ZNSt3mapIisSt4lessIiESaISt4pairIKisEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) @ind, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %100 = load i16, ptr %99, align 2, !tbaa !9
  %101 = sext i16 %100 to i32
  %102 = add nsw i32 %101, 1
  %103 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %102)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  %104 = add nuw nsw i32 %.0121, 1
  %exitcond145.not = icmp eq i32 %104, %.768160
  br i1 %exitcond145.not, label %._crit_edge124, label %.lr.ph123, !llvm.loop !17
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; 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 uwtable
declare dso_local noundef nonnull align 2 dereferenceable(2) ptr @_ZNSt3mapIisSt4lessIiESaISt4pairIKisEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3 align 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 @_ZSt4sortIPiEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #4

; 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: mustprogress uwtable
declare dso_local noundef i64 @_ZNKSt3mapIisSt4lessIiESaISt4pairIKisEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3 align 2

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

attributes #0 = { mustprogress norecurse 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 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint mustprogress 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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"short", !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}


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