; LLVM IR from VastoLorde95/Competitive-Programming :: CodeChef/SHORT/COOK74/Problem B/B.ll (Z5solvev)

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

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

@n = external dso_local global i32, align 4
@a = external dso_local global [100100 x i32], align 16
@d = external dso_local global [100100 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"class.std::map", align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #5
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %25, %0
  %16 = load i32, ptr %1, align 4, !tbaa !5
  %17 = load i32, ptr @n, align 4, !tbaa !5
  %18 = icmp slt i32 %16, %17
  br i1 %18, label %20, label %19

19:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #5
  br label %28

20:                                               ; preds = %15
  %21 = load i32, ptr %1, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %22
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %23)
  br label %25

25:                                               ; preds = %20
  %26 = load i32, ptr %1, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr %1, align 4, !tbaa !5
  br label %15, !llvm.loop !9

28:                                               ; preds = %19
  %29 = load i32, ptr @n, align 4, !tbaa !5
  %30 = icmp sle i32 %29, 3
  br i1 %30, label %31, label %49

31:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1000000000, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %43, %31
  %33 = load i32, ptr %3, align 4, !tbaa !5
  %34 = load i32, ptr @n, align 4, !tbaa !5
  %35 = icmp slt i32 %33, %34
  br i1 %35, label %37, label %36

36:                                               ; preds = %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %46

37:                                               ; preds = %32
  %38 = load i32, ptr %3, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %39
  %41 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %40)
  %42 = load i32, ptr %41, align 4, !tbaa !5
  store i32 %42, ptr %2, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %37
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %3, align 4, !tbaa !5
  br label %32, !llvm.loop !11

46:                                               ; preds = %36
  %47 = load i32, ptr %2, align 4, !tbaa !5
  %48 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %47)
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %301

49:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 48, ptr %4) #5
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %76, %49
  %51 = load i32, ptr %5, align 4, !tbaa !5
  %52 = load i32, ptr @n, align 4, !tbaa !5
  %53 = icmp slt i32 %51, %52
  br i1 %53, label %55, label %54

54:                                               ; preds = %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %83

55:                                               ; preds = %50
  %56 = load i32, ptr %5, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = load i32, ptr %5, align 4, !tbaa !5
  %61 = sub nsw i32 %60, 1
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = sub nsw i32 %59, %64
  %66 = load i32, ptr %5, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [100100 x i32], ptr @d, i64 0, i64 %67
  store i32 %65, ptr %68, align 4, !tbaa !5
  %69 = load i32, ptr %5, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [100100 x i32], ptr @d, i64 0, i64 %70
  %72 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %71)
          to label %73 unwind label %79

73:                                               ; preds = %55
  %74 = load i32, ptr %72, align 4, !tbaa !5
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %72, align 4, !tbaa !5
  br label %76

76:                                               ; preds = %73
  %77 = load i32, ptr %5, align 4, !tbaa !5
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %5, align 4, !tbaa !5
  br label %50, !llvm.loop !12

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

83:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 2000000000, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %84 = load i32, ptr getelementptr inbounds ([100100 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
  %85 = load i32, ptr @a, align 16, !tbaa !5
  %86 = sub nsw i32 %84, %85
  store i32 %86, ptr %9, align 4, !tbaa !5
  %87 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %88 unwind label %95

88:                                               ; preds = %83
  %89 = load i32, ptr %87, align 4, !tbaa !5
  %90 = add nsw i32 %89, -1
  store i32 %90, ptr %87, align 4, !tbaa !5
  %91 = icmp eq i32 %90, 0
  br i1 %91, label %92, label %99

92:                                               ; preds = %88
  %93 = invoke noundef i64 @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5eraseERS3_(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %94 unwind label %95

94:                                               ; preds = %92
  br label %99

95:                                               ; preds = %297, %139, %131, %125, %106, %104, %92, %83
  %96 = landingpad { ptr, i32 }
          cleanup
  %97 = extractvalue { ptr, i32 } %96, 0
  store ptr %97, ptr %6, align 8
  %98 = extractvalue { ptr, i32 } %96, 1
  store i32 %98, ptr %7, align 4
  br label %302

99:                                               ; preds = %94, %88
  %100 = call noundef i64 @_ZNKSt3mapIiiSt4lessIiESaISt4pairIKiiEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %4) #5
  %101 = icmp eq i64 %100, 1
  br i1 %101, label %102, label %104

102:                                              ; preds = %99
  %103 = load i32, ptr @a, align 16, !tbaa !5
  store i32 %103, ptr %8, align 4, !tbaa !5
  br label %104

104:                                              ; preds = %102, %99
  %105 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %106 unwind label %95

106:                                              ; preds = %104
  %107 = load i32, ptr %105, align 4, !tbaa !5
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %105, align 4, !tbaa !5
  %109 = load i32, ptr @n, align 4, !tbaa !5
  %110 = sub nsw i32 %109, 1
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = load i32, ptr @n, align 4, !tbaa !5
  %115 = sub nsw i32 %114, 2
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = sub nsw i32 %113, %118
  store i32 %119, ptr %9, align 4, !tbaa !5
  %120 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %121 unwind label %95

121:                                              ; preds = %106
  %122 = load i32, ptr %120, align 4, !tbaa !5
  %123 = add nsw i32 %122, -1
  store i32 %123, ptr %120, align 4, !tbaa !5
  %124 = icmp eq i32 %123, 0
  br i1 %124, label %125, label %128

125:                                              ; preds = %121
  %126 = invoke noundef i64 @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5eraseERS3_(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %127 unwind label %95

127:                                              ; preds = %125
  br label %128

128:                                              ; preds = %127, %121
  %129 = call noundef i64 @_ZNKSt3mapIiiSt4lessIiESaISt4pairIKiiEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %4) #5
  %130 = icmp eq i64 %129, 1
  br i1 %130, label %131, label %139

131:                                              ; preds = %128
  %132 = load i32, ptr @n, align 4, !tbaa !5
  %133 = sub nsw i32 %132, 1
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %134
  %136 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %135)
          to label %137 unwind label %95

137:                                              ; preds = %131
  %138 = load i32, ptr %136, align 4, !tbaa !5
  store i32 %138, ptr %8, align 4, !tbaa !5
  br label %139

139:                                              ; preds = %137, %128
  %140 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %141 unwind label %95

141:                                              ; preds = %139
  %142 = load i32, ptr %140, align 4, !tbaa !5
  %143 = add nsw i32 %142, 1
  store i32 %143, ptr %140, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %144

144:                                              ; preds = %289, %141
  %145 = load i32, ptr %10, align 4, !tbaa !5
  %146 = load i32, ptr @n, align 4, !tbaa !5
  %147 = sub nsw i32 %146, 1
  %148 = icmp slt i32 %145, %147
  br i1 %148, label %150, label %149

149:                                              ; preds = %144
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %293

150:                                              ; preds = %144
  %151 = load i32, ptr %10, align 4, !tbaa !5
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %152
  %154 = load i32, ptr %153, align 4, !tbaa !5
  %155 = load i32, ptr %10, align 4, !tbaa !5
  %156 = sub nsw i32 %155, 1
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %157
  %159 = load i32, ptr %158, align 4, !tbaa !5
  %160 = sub nsw i32 %154, %159
  store i32 %160, ptr %9, align 4, !tbaa !5
  %161 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %162 unwind label %169

162:                                              ; preds = %150
  %163 = load i32, ptr %161, align 4, !tbaa !5
  %164 = add nsw i32 %163, -1
  store i32 %164, ptr %161, align 4, !tbaa !5
  %165 = icmp eq i32 %164, 0
  br i1 %165, label %166, label %173

166:                                              ; preds = %162
  %167 = invoke noundef i64 @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5eraseERS3_(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %168 unwind label %169

168:                                              ; preds = %166
  br label %173

169:                                              ; preds = %233, %221, %210, %189, %173, %166, %150
  %170 = landingpad { ptr, i32 }
          cleanup
  %171 = extractvalue { ptr, i32 } %170, 0
  store ptr %171, ptr %6, align 8
  %172 = extractvalue { ptr, i32 } %170, 1
  store i32 %172, ptr %7, align 4
  br label %292

173:                                              ; preds = %168, %162
  %174 = load i32, ptr %10, align 4, !tbaa !5
  %175 = add nsw i32 %174, 1
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %176
  %178 = load i32, ptr %177, align 4, !tbaa !5
  %179 = load i32, ptr %10, align 4, !tbaa !5
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %180
  %182 = load i32, ptr %181, align 4, !tbaa !5
  %183 = sub nsw i32 %178, %182
  store i32 %183, ptr %9, align 4, !tbaa !5
  %184 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %185 unwind label %169

185:                                              ; preds = %173
  %186 = load i32, ptr %184, align 4, !tbaa !5
  %187 = add nsw i32 %186, -1
  store i32 %187, ptr %184, align 4, !tbaa !5
  %188 = icmp eq i32 %187, 0
  br i1 %188, label %189, label %192

189:                                              ; preds = %185
  %190 = invoke noundef i64 @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5eraseERS3_(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %191 unwind label %169

191:                                              ; preds = %189
  br label %192

192:                                              ; preds = %191, %185
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %193 = load i32, ptr %10, align 4, !tbaa !5
  %194 = add nsw i32 %193, 1
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %195
  %197 = load i32, ptr %196, align 4, !tbaa !5
  %198 = load i32, ptr %10, align 4, !tbaa !5
  %199 = sub nsw i32 %198, 1
  %200 = sext i32 %199 to i64
  %201 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %200
  %202 = load i32, ptr %201, align 4, !tbaa !5
  %203 = sub nsw i32 %197, %202
  store i32 %203, ptr %11, align 4, !tbaa !5
  %204 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %11)
          to label %205 unwind label %217

205:                                              ; preds = %192
  %206 = load i32, ptr %204, align 4, !tbaa !5
  %207 = add nsw i32 %206, 1
  store i32 %207, ptr %204, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  %208 = call noundef i64 @_ZNKSt3mapIiiSt4lessIiESaISt4pairIKiiEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %4) #5
  %209 = icmp eq i64 %208, 1
  br i1 %209, label %210, label %221

210:                                              ; preds = %205
  %211 = load i32, ptr %10, align 4, !tbaa !5
  %212 = sext i32 %211 to i64
  %213 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %212
  %214 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %213)
          to label %215 unwind label %169

215:                                              ; preds = %210
  %216 = load i32, ptr %214, align 4, !tbaa !5
  store i32 %216, ptr %8, align 4, !tbaa !5
  br label %221

217:                                              ; preds = %192
  %218 = landingpad { ptr, i32 }
          cleanup
  %219 = extractvalue { ptr, i32 } %218, 0
  store ptr %219, ptr %6, align 8
  %220 = extractvalue { ptr, i32 } %218, 1
  store i32 %220, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %292

221:                                              ; preds = %215, %205
  %222 = load i32, ptr %10, align 4, !tbaa !5
  %223 = sext i32 %222 to i64
  %224 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %223
  %225 = load i32, ptr %224, align 4, !tbaa !5
  %226 = load i32, ptr %10, align 4, !tbaa !5
  %227 = sub nsw i32 %226, 1
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %228
  %230 = load i32, ptr %229, align 4, !tbaa !5
  %231 = sub nsw i32 %225, %230
  store i32 %231, ptr %9, align 4, !tbaa !5
  %232 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %233 unwind label %169

233:                                              ; preds = %221
  %234 = load i32, ptr %232, align 4, !tbaa !5
  %235 = add nsw i32 %234, 1
  store i32 %235, ptr %232, align 4, !tbaa !5
  %236 = load i32, ptr %10, align 4, !tbaa !5
  %237 = add nsw i32 %236, 1
  %238 = sext i32 %237 to i64
  %239 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %238
  %240 = load i32, ptr %239, align 4, !tbaa !5
  %241 = load i32, ptr %10, align 4, !tbaa !5
  %242 = sext i32 %241 to i64
  %243 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %242
  %244 = load i32, ptr %243, align 4, !tbaa !5
  %245 = sub nsw i32 %240, %244
  store i32 %245, ptr %9, align 4, !tbaa !5
  %246 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %247 unwind label %169

247:                                              ; preds = %233
  %248 = load i32, ptr %246, align 4, !tbaa !5
  %249 = add nsw i32 %248, 1
  store i32 %249, ptr %246, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %250 = load i32, ptr %10, align 4, !tbaa !5
  %251 = add nsw i32 %250, 1
  %252 = sext i32 %251 to i64
  %253 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %252
  %254 = load i32, ptr %253, align 4, !tbaa !5
  %255 = load i32, ptr %10, align 4, !tbaa !5
  %256 = sub nsw i32 %255, 1
  %257 = sext i32 %256 to i64
  %258 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %257
  %259 = load i32, ptr %258, align 4, !tbaa !5
  %260 = sub nsw i32 %254, %259
  store i32 %260, ptr %12, align 4, !tbaa !5
  %261 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %12)
          to label %262 unwind label %280

262:                                              ; preds = %247
  %263 = load i32, ptr %261, align 4, !tbaa !5
  %264 = add nsw i32 %263, -1
  store i32 %264, ptr %261, align 4, !tbaa !5
  %265 = icmp eq i32 %264, 0
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br i1 %265, label %266, label %288

266:                                              ; preds = %262
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %267 = load i32, ptr %10, align 4, !tbaa !5
  %268 = add nsw i32 %267, 1
  %269 = sext i32 %268 to i64
  %270 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %269
  %271 = load i32, ptr %270, align 4, !tbaa !5
  %272 = load i32, ptr %10, align 4, !tbaa !5
  %273 = sub nsw i32 %272, 1
  %274 = sext i32 %273 to i64
  %275 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %274
  %276 = load i32, ptr %275, align 4, !tbaa !5
  %277 = sub nsw i32 %271, %276
  store i32 %277, ptr %13, align 4, !tbaa !5
  %278 = invoke noundef i64 @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5eraseERS3_(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %13)
          to label %279 unwind label %284

279:                                              ; preds = %266
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %288

280:                                              ; preds = %247
  %281 = landingpad { ptr, i32 }
          cleanup
  %282 = extractvalue { ptr, i32 } %281, 0
  store ptr %282, ptr %6, align 8
  %283 = extractvalue { ptr, i32 } %281, 1
  store i32 %283, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %292

284:                                              ; preds = %266
  %285 = landingpad { ptr, i32 }
          cleanup
  %286 = extractvalue { ptr, i32 } %285, 0
  store ptr %286, ptr %6, align 8
  %287 = extractvalue { ptr, i32 } %285, 1
  store i32 %287, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %292

288:                                              ; preds = %279, %262
  br label %289

289:                                              ; preds = %288
  %290 = load i32, ptr %10, align 4, !tbaa !5
  %291 = add nsw i32 %290, 1
  store i32 %291, ptr %10, align 4, !tbaa !5
  br label %144, !llvm.loop !13

292:                                              ; preds = %284, %280, %217, %169
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %302

293:                                              ; preds = %149
  %294 = load i32, ptr %8, align 4, !tbaa !5
  %295 = icmp eq i32 %294, 2000000000
  br i1 %295, label %296, label %297

296:                                              ; preds = %293
  store i32 -1, ptr %8, align 4, !tbaa !5
  br label %297

297:                                              ; preds = %296, %293
  %298 = load i32, ptr %8, align 4, !tbaa !5
  %299 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %298)
          to label %300 unwind label %95

300:                                              ; preds = %297
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr %4) #5
  br label %301

301:                                              ; preds = %300, %46
  ret void

302:                                              ; preds = %292, %95
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %303

303:                                              ; preds = %302, %79
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr %4) #5
  br label %304

304:                                              ; preds = %303
  %305 = load ptr, ptr %6, align 8
  %306 = load i32, ptr %7, align 4
  %307 = insertvalue { ptr, i32 } poison, ptr %305, 0
  %308 = insertvalue { ptr, i32 } %307, i32 %306, 1
  resume { ptr, i32 } %308
}

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

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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


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

@n = external dso_local global i32, align 4
@a = external dso_local global [100100 x i32], align 16
@d = external dso_local global [100100 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::map", align 8
  %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 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %9 = load i32, ptr @n, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph, label %.thread

.thread:                                          ; preds = %0
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  store i32 1000000000, ptr %1, align 4, !tbaa !5
  br label %._crit_edge54

._crit_edge:                                      ; preds = %.lr.ph
  %11 = icmp slt i32 %14, 4
  br i1 %11, label %17, label %27

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %12 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %indvars.iv
  %13 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %12)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = icmp slt i64 %indvars.iv.next, %15
  br i1 %16, label %.lr.ph, label %._crit_edge, !llvm.loop !9

17:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  store i32 1000000000, ptr %1, align 4, !tbaa !5
  %18 = icmp sgt i32 %14, 0
  br i1 %18, label %.lr.ph53, label %._crit_edge54

._crit_edge54:                                    ; preds = %.lr.ph53, %.thread, %17
  %19 = phi i32 [ 1000000000, %17 ], [ 1000000000, %.thread ], [ %23, %.lr.ph53 ]
  %20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %19)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  br label %188

.lr.ph53:                                         ; preds = %17, %.lr.ph53
  %indvars.iv63 = phi i64 [ %indvars.iv.next64, %.lr.ph53 ], [ 0, %17 ]
  %21 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %indvars.iv63
  %22 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %21)
  %23 = load i32, ptr %22, align 4, !tbaa !5
  store i32 %23, ptr %1, align 4, !tbaa !5
  %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
  %24 = load i32, ptr @n, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = icmp slt i64 %indvars.iv.next64, %25
  br i1 %26, label %.lr.ph53, label %._crit_edge54, !llvm.loop !11

27:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %2) #5
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #5
  %28 = load i32, ptr @n, align 4, !tbaa !5
  %29 = icmp sgt i32 %28, 1
  br i1 %29, label %.lr.ph45, label %._crit_edge46

._crit_edge46:                                    ; preds = %42, %27
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  store i32 2000000000, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  %30 = load i32, ptr getelementptr inbounds (i8, ptr @a, i64 4), align 4, !tbaa !5
  %31 = load i32, ptr @a, align 16, !tbaa !5
  %32 = sub nsw i32 %30, %31
  store i32 %32, ptr %4, align 4, !tbaa !5
  %33 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %50 unwind label %56

.lr.ph45:                                         ; preds = %27, %42
  %indvars.iv57 = phi i64 [ %indvars.iv.next58, %42 ], [ 1, %27 ]
  %34 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %indvars.iv57
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = add nsw i64 %indvars.iv57, -1
  %37 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %36
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = sub nsw i32 %35, %38
  %40 = getelementptr inbounds [100100 x i32], ptr @d, i64 0, i64 %indvars.iv57
  store i32 %39, ptr %40, align 4, !tbaa !5
  %41 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %40)
          to label %42 unwind label %48

42:                                               ; preds = %.lr.ph45
  %43 = load i32, ptr %41, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %41, align 4, !tbaa !5
  %indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
  %45 = load i32, ptr @n, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = icmp slt i64 %indvars.iv.next58, %46
  br i1 %47, label %.lr.ph45, label %._crit_edge46, !llvm.loop !12

48:                                               ; preds = %.lr.ph45
  %49 = landingpad { ptr, i32 }
          cleanup
  br label %190

50:                                               ; preds = %._crit_edge46
  %51 = load i32, ptr %33, align 4, !tbaa !5
  %52 = add nsw i32 %51, -1
  store i32 %52, ptr %33, align 4, !tbaa !5
  %53 = icmp eq i32 %52, 0
  br i1 %53, label %54, label %58

54:                                               ; preds = %50
  %55 = invoke noundef i64 @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5eraseERS3_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %58 unwind label %56

56:                                               ; preds = %95, %83, %65, %63, %54, %._crit_edge46
  %57 = landingpad { ptr, i32 }
          cleanup
  br label %189

58:                                               ; preds = %54, %50
  %59 = call noundef i64 @_ZNKSt3mapIiiSt4lessIiESaISt4pairIKiiEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %2) #5
  %60 = icmp eq i64 %59, 1
  br i1 %60, label %61, label %63

61:                                               ; preds = %58
  %62 = load i32, ptr @a, align 16, !tbaa !5
  store i32 %62, ptr %3, align 4, !tbaa !5
  br label %63

63:                                               ; preds = %61, %58
  %64 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %65 unwind label %56

65:                                               ; preds = %63
  %66 = load i32, ptr %64, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %64, align 4, !tbaa !5
  %68 = load i32, ptr @n, align 4, !tbaa !5
  %69 = add nsw i32 %68, -1
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = add nsw i32 %68, -2
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = sub nsw i32 %72, %76
  store i32 %77, ptr %4, align 4, !tbaa !5
  %78 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %79 unwind label %56

79:                                               ; preds = %65
  %80 = load i32, ptr %78, align 4, !tbaa !5
  %81 = add nsw i32 %80, -1
  store i32 %81, ptr %78, align 4, !tbaa !5
  %82 = icmp eq i32 %81, 0
  br i1 %82, label %83, label %85

83:                                               ; preds = %79
  %84 = invoke noundef i64 @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5eraseERS3_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %85 unwind label %56

85:                                               ; preds = %83, %79
  %86 = call noundef i64 @_ZNKSt3mapIiiSt4lessIiESaISt4pairIKiiEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %2) #5
  %87 = icmp eq i64 %86, 1
  br i1 %87, label %88, label %95

88:                                               ; preds = %85
  %89 = load i32, ptr @n, align 4, !tbaa !5
  %90 = add nsw i32 %89, -1
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %91
  %93 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %92)
  %94 = load i32, ptr %93, align 4, !tbaa !5
  store i32 %94, ptr %3, align 4, !tbaa !5
  br label %95

95:                                               ; preds = %88, %85
  %96 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %97 unwind label %56

97:                                               ; preds = %95
  %98 = load i32, ptr %96, align 4, !tbaa !5
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr %96, align 4, !tbaa !5
  %100 = load i32, ptr @n, align 4, !tbaa !5
  %101 = icmp sgt i32 %100, 2
  br i1 %101, label %.lr.ph49, label %._crit_edge50

._crit_edge50:                                    ; preds = %179, %97
  %102 = load i32, ptr %3, align 4, !tbaa !5
  %103 = icmp eq i32 %102, 2000000000
  br i1 %103, label %184, label %185

.lr.ph49:                                         ; preds = %97, %179
  %indvars.iv60 = phi i64 [ %indvars.iv.next61, %179 ], [ 1, %97 ]
  %104 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %indvars.iv60
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = add nsw i64 %indvars.iv60, -1
  %107 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = sub nsw i32 %105, %108
  store i32 %109, ptr %4, align 4, !tbaa !5
  %110 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %111 unwind label %117

111:                                              ; preds = %.lr.ph49
  %112 = load i32, ptr %110, align 4, !tbaa !5
  %113 = add nsw i32 %112, -1
  store i32 %113, ptr %110, align 4, !tbaa !5
  %114 = icmp eq i32 %113, 0
  br i1 %114, label %115, label %119

115:                                              ; preds = %111
  %116 = invoke noundef i64 @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5eraseERS3_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %119 unwind label %117

117:                                              ; preds = %151, %146, %129, %119, %115, %.lr.ph49
  %118 = landingpad { ptr, i32 }
          cleanup
  br label %189

119:                                              ; preds = %115, %111
  %indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
  %120 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %indvars.iv.next61
  %121 = load i32, ptr %120, align 4, !tbaa !5
  %122 = load i32, ptr %104, align 4, !tbaa !5
  %123 = sub nsw i32 %121, %122
  store i32 %123, ptr %4, align 4, !tbaa !5
  %124 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %125 unwind label %117

125:                                              ; preds = %119
  %126 = load i32, ptr %124, align 4, !tbaa !5
  %127 = add nsw i32 %126, -1
  store i32 %127, ptr %124, align 4, !tbaa !5
  %128 = icmp eq i32 %127, 0
  br i1 %128, label %129, label %131

129:                                              ; preds = %125
  %130 = invoke noundef i64 @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5eraseERS3_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %131 unwind label %117

131:                                              ; preds = %129, %125
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  %132 = load i32, ptr %120, align 4, !tbaa !5
  %133 = load i32, ptr %107, align 4, !tbaa !5
  %134 = sub nsw i32 %132, %133
  store i32 %134, ptr %5, align 4, !tbaa !5
  %135 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %5)
          to label %136 unwind label %144

136:                                              ; preds = %131
  %137 = load i32, ptr %135, align 4, !tbaa !5
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %135, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  %139 = call noundef i64 @_ZNKSt3mapIiiSt4lessIiESaISt4pairIKiiEEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %2) #5
  %140 = icmp eq i64 %139, 1
  br i1 %140, label %141, label %146

141:                                              ; preds = %136
  %142 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %104)
  %143 = load i32, ptr %142, align 4, !tbaa !5
  store i32 %143, ptr %3, align 4, !tbaa !5
  br label %146

144:                                              ; preds = %131
  %145 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  br label %189

146:                                              ; preds = %141, %136
  %147 = load i32, ptr %104, align 4, !tbaa !5
  %148 = load i32, ptr %107, align 4, !tbaa !5
  %149 = sub nsw i32 %147, %148
  store i32 %149, ptr %4, align 4, !tbaa !5
  %150 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %151 unwind label %117

151:                                              ; preds = %146
  %152 = load i32, ptr %150, align 4, !tbaa !5
  %153 = add nsw i32 %152, 1
  store i32 %153, ptr %150, align 4, !tbaa !5
  %154 = load i32, ptr %120, align 4, !tbaa !5
  %155 = load i32, ptr %104, align 4, !tbaa !5
  %156 = sub nsw i32 %154, %155
  store i32 %156, ptr %4, align 4, !tbaa !5
  %157 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %158 unwind label %117

158:                                              ; preds = %151
  %159 = load i32, ptr %157, align 4, !tbaa !5
  %160 = add nsw i32 %159, 1
  store i32 %160, ptr %157, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  %161 = load i32, ptr %120, align 4, !tbaa !5
  %162 = load i32, ptr %107, align 4, !tbaa !5
  %163 = sub nsw i32 %161, %162
  store i32 %163, ptr %6, align 4, !tbaa !5
  %164 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %165 unwind label %175

165:                                              ; preds = %158
  %166 = load i32, ptr %164, align 4, !tbaa !5
  %167 = add nsw i32 %166, -1
  store i32 %167, ptr %164, align 4, !tbaa !5
  %168 = icmp eq i32 %167, 0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  br i1 %168, label %169, label %179

169:                                              ; preds = %165
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  %170 = load i32, ptr %120, align 4, !tbaa !5
  %171 = load i32, ptr %107, align 4, !tbaa !5
  %172 = sub nsw i32 %170, %171
  store i32 %172, ptr %7, align 4, !tbaa !5
  %173 = invoke noundef i64 @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5eraseERS3_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 4 dereferenceable(4) %7)
          to label %174 unwind label %177

174:                                              ; preds = %169
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  br label %179

175:                                              ; preds = %158
  %176 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  br label %189

177:                                              ; preds = %169
  %178 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  br label %189

179:                                              ; preds = %165, %174
  %180 = load i32, ptr @n, align 4, !tbaa !5
  %181 = add nsw i32 %180, -1
  %182 = sext i32 %181 to i64
  %183 = icmp slt i64 %indvars.iv.next61, %182
  br i1 %183, label %.lr.ph49, label %._crit_edge50, !llvm.loop !13

184:                                              ; preds = %._crit_edge50
  store i32 -1, ptr %3, align 4, !tbaa !5
  br label %185

185:                                              ; preds = %184, %._crit_edge50
  %186 = phi i32 [ -1, %184 ], [ %102, %._crit_edge50 ]
  %187 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %186)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %2) #5
  br label %188

188:                                              ; preds = %185, %._crit_edge54
  ret void

189:                                              ; preds = %117, %144, %175, %177, %56
  %.pn.pn = phi { ptr, i32 } [ %57, %56 ], [ %178, %177 ], [ %176, %175 ], [ %118, %117 ], [ %145, %144 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  br label %190

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

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

; 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 #3

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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


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