; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/171 Division 2/Problem D (D)

; 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 [23 x i32], align 16
@dp = external dso_local global [8388608 x [2 x i32]], align 16
@pos = external dso_local global %"class.std::map", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 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 i8, align 1
  %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 i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %22 = 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 %23

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

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

28:                                               ; preds = %23
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [23 x i32], ptr @a, i64 0, i64 %30
  %32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %31)
  br label %33

33:                                               ; preds = %28
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %2, align 4, !tbaa !5
  br label %23, !llvm.loop !9

36:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  %37 = load i32, ptr @a, align 16, !tbaa !5
  store i32 %37, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %50, %36
  %39 = load i32, ptr %4, align 4, !tbaa !5
  %40 = load i32, ptr @n, align 4, !tbaa !5
  %41 = icmp slt i32 %39, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %38
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %53

43:                                               ; preds = %38
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %45 = load i32, ptr %4, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [23 x i32], ptr @a, i64 0, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = call noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef %44, i32 noundef %48)
  store i32 %49, ptr %3, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %43
  %51 = load i32, ptr %4, align 4, !tbaa !5
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %4, align 4, !tbaa !5
  br label %38, !llvm.loop !11

53:                                               ; preds = %42
  %54 = load i32, ptr %3, align 4, !tbaa !5
  %55 = load i32, ptr @a, align 16, !tbaa !5
  %56 = icmp ne i32 %54, %55
  br i1 %56, label %57, label %59

57:                                               ; preds = %53
  %58 = call i32 @puts(ptr noundef @.str.2)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %5, align 4
  br label %308

59:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %60

60:                                               ; preds = %71, %59
  %61 = load i32, ptr %6, align 4, !tbaa !5
  %62 = load i32, ptr @n, align 4, !tbaa !5
  %63 = icmp slt i32 %61, %62
  br i1 %63, label %65, label %64

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

65:                                               ; preds = %60
  %66 = load i32, ptr %6, align 4, !tbaa !5
  %67 = load i32, ptr %6, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [23 x i32], ptr @a, i64 0, i64 %68
  %70 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @pos, ptr noundef nonnull align 4 dereferenceable(4) %69)
  store i32 %66, ptr %70, align 4, !tbaa !5
  br label %71

71:                                               ; preds = %65
  %72 = load i32, ptr %6, align 4, !tbaa !5
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %6, align 4, !tbaa !5
  br label %60, !llvm.loop !12

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

75:                                               ; preds = %136, %74
  %76 = load i32, ptr %7, align 4, !tbaa !5
  %77 = load i32, ptr @n, align 4, !tbaa !5
  %78 = icmp slt i32 %76, %77
  br i1 %78, label %80, label %79

79:                                               ; preds = %75
  store i32 11, ptr %5, align 4
  br label %139

80:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #7
  store i8 0, ptr %8, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %81

81:                                               ; preds = %124, %80
  %82 = load i32, ptr %9, align 4, !tbaa !5
  %83 = load i32, ptr %7, align 4, !tbaa !5
  %84 = icmp slt i32 %82, %83
  br i1 %84, label %86, label %85

85:                                               ; preds = %81
  store i32 14, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %127

86:                                               ; preds = %81
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %87

87:                                               ; preds = %120, %86
  %88 = load i32, ptr %10, align 4, !tbaa !5
  %89 = load i32, ptr %7, align 4, !tbaa !5
  %90 = icmp slt i32 %88, %89
  br i1 %90, label %92, label %91

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

92:                                               ; preds = %87
  %93 = load i32, ptr %9, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [23 x i32], ptr @a, 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 [23 x i32], ptr @a, i64 0, i64 %98
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = add nsw i32 %96, %100
  %102 = load i32, ptr %7, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [23 x i32], ptr @a, i64 0, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = icmp eq i32 %101, %105
  br i1 %106, label %107, label %108

107:                                              ; preds = %92
  store i8 1, ptr %8, align 1, !tbaa !13
  br label %108

108:                                              ; preds = %107, %92
  %109 = load i32, ptr %10, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [23 x i32], ptr @a, i64 0, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !5
  %113 = load i32, ptr %7, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [23 x i32], ptr @a, i64 0, i64 %114
  %116 = load i32, ptr %115, align 4, !tbaa !5
  %117 = icmp eq i32 %112, %116
  br i1 %117, label %118, label %119

118:                                              ; preds = %108
  store i8 1, ptr %8, align 1, !tbaa !13
  br label %119

119:                                              ; preds = %118, %108
  br label %120

120:                                              ; preds = %119
  %121 = load i32, ptr %10, align 4, !tbaa !5
  %122 = add nsw i32 %121, 1
  store i32 %122, ptr %10, align 4, !tbaa !5
  br label %87, !llvm.loop !15

123:                                              ; preds = %91
  br label %124

124:                                              ; preds = %123
  %125 = load i32, ptr %9, align 4, !tbaa !5
  %126 = add nsw i32 %125, 1
  store i32 %126, ptr %9, align 4, !tbaa !5
  br label %81, !llvm.loop !16

127:                                              ; preds = %85
  %128 = load i8, ptr %8, align 1, !tbaa !13, !range !17, !noundef !18
  %129 = trunc i8 %128 to i1
  br i1 %129, label %132, label %130

130:                                              ; preds = %127
  %131 = call i32 @puts(ptr noundef @.str.2)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %5, align 4
  br label %133

132:                                              ; preds = %127
  store i32 0, ptr %5, align 4
  br label %133

133:                                              ; preds = %132, %130
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #7
  %134 = load i32, ptr %5, align 4
  switch i32 %134, label %139 [
    i32 0, label %135
  ]

135:                                              ; preds = %133
  br label %136

136:                                              ; preds = %135
  %137 = load i32, ptr %7, align 4, !tbaa !5
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %7, align 4, !tbaa !5
  br label %75, !llvm.loop !19

139:                                              ; preds = %133, %79
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  %140 = load i32, ptr %5, align 4
  switch i32 %140, label %308 [
    i32 11, label %141
  ]

141:                                              ; preds = %139
  store i32 1, ptr getelementptr inbounds ([8388608 x [2 x i32]], ptr @dp, i64 0, i64 1), align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %142

142:                                              ; preds = %269, %141
  %143 = load i32, ptr %11, align 4, !tbaa !5
  %144 = load i32, ptr @n, align 4, !tbaa !5
  %145 = icmp slt i32 %143, %144
  br i1 %145, label %147, label %146

146:                                              ; preds = %142
  store i32 20, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %272

147:                                              ; preds = %142
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %148

148:                                              ; preds = %265, %147
  %149 = load i32, ptr %12, align 4, !tbaa !5
  %150 = load i32, ptr %11, align 4, !tbaa !5
  %151 = shl i32 1, %150
  %152 = icmp slt i32 %149, %151
  br i1 %152, label %154, label %153

153:                                              ; preds = %148
  store i32 23, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %268

154:                                              ; preds = %148
  %155 = load i32, ptr %12, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [8388608 x [2 x i32]], ptr @dp, i64 0, i64 %156
  %158 = load i32, ptr %11, align 4, !tbaa !5
  %159 = and i32 %158, 1
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [2 x i32], ptr %157, i64 0, i64 %160
  store i32 0, ptr %161, align 4, !tbaa !5
  %162 = load i32, ptr %12, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [8388608 x [2 x i32]], ptr @dp, i64 0, i64 %163
  %165 = load i32, ptr %11, align 4, !tbaa !5
  %166 = xor i32 %165, 1
  %167 = and i32 %166, 1
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [2 x i32], ptr %164, i64 0, i64 %168
  %170 = load i32, ptr %169, align 4, !tbaa !5
  %171 = icmp eq i32 %170, 0
  br i1 %171, label %172, label %173

172:                                              ; preds = %154
  br label %265

173:                                              ; preds = %154
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %174

174:                                              ; preds = %260, %173
  %175 = load i32, ptr %13, align 4, !tbaa !5
  %176 = load i32, ptr %11, align 4, !tbaa !5
  %177 = icmp slt i32 %175, %176
  br i1 %177, label %179, label %178

178:                                              ; preds = %174
  store i32 26, ptr %5, align 4
  br label %263

179:                                              ; preds = %174
  %180 = load i32, ptr %12, align 4, !tbaa !5
  %181 = load i32, ptr %13, align 4, !tbaa !5
  %182 = shl i32 1, %181
  %183 = and i32 %180, %182
  %184 = icmp sgt i32 %183, 0
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  br i1 %184, label %185, label %197

185:                                              ; preds = %179
  %186 = load i32, ptr %11, align 4, !tbaa !5
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [23 x i32], ptr @a, i64 0, i64 %187
  %189 = load i32, ptr %188, align 4, !tbaa !5
  %190 = load i32, ptr %13, align 4, !tbaa !5
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [23 x i32], ptr @a, i64 0, i64 %191
  %193 = load i32, ptr %192, align 4, !tbaa !5
  %194 = sub nsw i32 %189, %193
  store i32 %194, ptr %14, align 4, !tbaa !5
  %195 = call noundef i64 @_ZNKSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48) @pos, ptr noundef nonnull align 4 dereferenceable(4) %14)
  %196 = icmp ne i64 %195, 0
  br label %197

197:                                              ; preds = %185, %179
  %198 = phi i1 [ false, %179 ], [ %196, %185 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br i1 %198, label %199, label %259

199:                                              ; preds = %197
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  %200 = load i32, ptr %11, align 4, !tbaa !5
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds [23 x i32], ptr @a, i64 0, i64 %201
  %203 = load i32, ptr %202, align 4, !tbaa !5
  %204 = load i32, ptr %13, align 4, !tbaa !5
  %205 = sext i32 %204 to i64
  %206 = getelementptr inbounds [23 x i32], ptr @a, i64 0, i64 %205
  %207 = load i32, ptr %206, align 4, !tbaa !5
  %208 = sub nsw i32 %203, %207
  store i32 %208, ptr %16, align 4, !tbaa !5
  %209 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) @pos, ptr noundef nonnull align 4 dereferenceable(4) %16)
  %210 = load i32, ptr %209, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  store i32 %210, ptr %15, align 4, !tbaa !5
  %211 = load i32, ptr %12, align 4, !tbaa !5
  %212 = load i32, ptr %15, align 4, !tbaa !5
  %213 = shl i32 1, %212
  %214 = and i32 %211, %213
  %215 = icmp sgt i32 %214, 0
  br i1 %215, label %216, label %255

216:                                              ; preds = %199
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %217 = load i32, ptr %12, align 4, !tbaa !5
  %218 = load i32, ptr %11, align 4, !tbaa !5
  %219 = shl i32 1, %218
  %220 = or i32 %217, %219
  store i32 %220, ptr %17, align 4, !tbaa !5
  %221 = load i32, ptr %17, align 4, !tbaa !5
  %222 = sext i32 %221 to i64
  %223 = getelementptr inbounds [8388608 x [2 x i32]], ptr @dp, i64 0, i64 %222
  %224 = load i32, ptr %11, align 4, !tbaa !5
  %225 = and i32 %224, 1
  %226 = sext i32 %225 to i64
  %227 = getelementptr inbounds [2 x i32], ptr %223, i64 0, i64 %226
  store i32 1, ptr %227, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  store i32 0, ptr %18, align 4, !tbaa !5
  br label %228

228:                                              ; preds = %251, %216
  %229 = load i32, ptr %18, align 4, !tbaa !5
  %230 = load i32, ptr %11, align 4, !tbaa !5
  %231 = icmp slt i32 %229, %230
  br i1 %231, label %233, label %232

232:                                              ; preds = %228
  store i32 29, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  br label %254

233:                                              ; preds = %228
  %234 = load i32, ptr %17, align 4, !tbaa !5
  %235 = load i32, ptr %18, align 4, !tbaa !5
  %236 = shl i32 1, %235
  %237 = and i32 %234, %236
  %238 = icmp sgt i32 %237, 0
  br i1 %238, label %239, label %250

239:                                              ; preds = %233
  %240 = load i32, ptr %17, align 4, !tbaa !5
  %241 = load i32, ptr %18, align 4, !tbaa !5
  %242 = shl i32 1, %241
  %243 = xor i32 %240, %242
  %244 = sext i32 %243 to i64
  %245 = getelementptr inbounds [8388608 x [2 x i32]], ptr @dp, i64 0, i64 %244
  %246 = load i32, ptr %11, align 4, !tbaa !5
  %247 = and i32 %246, 1
  %248 = sext i32 %247 to i64
  %249 = getelementptr inbounds [2 x i32], ptr %245, i64 0, i64 %248
  store i32 1, ptr %249, align 4, !tbaa !5
  br label %250

250:                                              ; preds = %239, %233
  br label %251

251:                                              ; preds = %250
  %252 = load i32, ptr %18, align 4, !tbaa !5
  %253 = add nsw i32 %252, 1
  store i32 %253, ptr %18, align 4, !tbaa !5
  br label %228, !llvm.loop !20

254:                                              ; preds = %232
  store i32 26, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %256

255:                                              ; preds = %199
  store i32 0, ptr %5, align 4
  br label %256

256:                                              ; preds = %255, %254
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  %257 = load i32, ptr %5, align 4
  switch i32 %257, label %263 [
    i32 0, label %258
  ]

258:                                              ; preds = %256
  br label %259

259:                                              ; preds = %258, %197
  br label %260

260:                                              ; preds = %259
  %261 = load i32, ptr %13, align 4, !tbaa !5
  %262 = add nsw i32 %261, 1
  store i32 %262, ptr %13, align 4, !tbaa !5
  br label %174, !llvm.loop !21

263:                                              ; preds = %256, %178
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %264

264:                                              ; preds = %263
  br label %265

265:                                              ; preds = %264, %172
  %266 = load i32, ptr %12, align 4, !tbaa !5
  %267 = add nsw i32 %266, 1
  store i32 %267, ptr %12, align 4, !tbaa !5
  br label %148, !llvm.loop !22

268:                                              ; preds = %153
  br label %269

269:                                              ; preds = %268
  %270 = load i32, ptr %11, align 4, !tbaa !5
  %271 = add nsw i32 %270, 1
  store i32 %271, ptr %11, align 4, !tbaa !5
  br label %142, !llvm.loop !23

272:                                              ; preds = %146
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  store i32 1000, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  store i32 0, ptr %20, align 4, !tbaa !5
  br label %273

273:                                              ; preds = %296, %272
  %274 = load i32, ptr %20, align 4, !tbaa !5
  %275 = load i32, ptr @n, align 4, !tbaa !5
  %276 = shl i32 1, %275
  %277 = icmp slt i32 %274, %276
  br i1 %277, label %279, label %278

278:                                              ; preds = %273
  store i32 32, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  br label %299

279:                                              ; preds = %273
  %280 = load i32, ptr %20, align 4, !tbaa !5
  %281 = sext i32 %280 to i64
  %282 = getelementptr inbounds [8388608 x [2 x i32]], ptr @dp, i64 0, i64 %281
  %283 = load i32, ptr @n, align 4, !tbaa !5
  %284 = sub nsw i32 %283, 1
  %285 = srem i32 %284, 2
  %286 = sext i32 %285 to i64
  %287 = getelementptr inbounds [2 x i32], ptr %282, i64 0, i64 %286
  %288 = load i32, ptr %287, align 4, !tbaa !5
  %289 = icmp eq i32 %288, 1
  br i1 %289, label %290, label %295

290:                                              ; preds = %279
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  %291 = load i32, ptr %20, align 4, !tbaa !5
  %292 = call i32 @llvm.ctpop.i32(i32 %291)
  store i32 %292, ptr %21, align 4, !tbaa !5
  %293 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %19, ptr noundef nonnull align 4 dereferenceable(4) %21)
  %294 = load i32, ptr %293, align 4, !tbaa !5
  store i32 %294, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %295

295:                                              ; preds = %290, %279
  br label %296

296:                                              ; preds = %295
  %297 = load i32, ptr %20, align 4, !tbaa !5
  %298 = add nsw i32 %297, 1
  store i32 %298, ptr %20, align 4, !tbaa !5
  br label %273, !llvm.loop !24

299:                                              ; preds = %278
  %300 = load i32, ptr %19, align 4, !tbaa !5
  %301 = icmp eq i32 %300, 1000
  br i1 %301, label %302, label %304

302:                                              ; preds = %299
  %303 = call i32 @puts(ptr noundef @.str.2)
  br label %307

304:                                              ; preds = %299
  %305 = load i32, ptr %19, align 4, !tbaa !5
  %306 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %305)
  br label %307

307:                                              ; preds = %304, %302
  store i32 0, ptr %1, align 4
  store i32 1, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %308

308:                                              ; preds = %307, %139, %57
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  %309 = load i32, ptr %1, align 4
  ret i32 %309
}

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: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef, i32 noundef) #3

declare i32 @puts(ptr noundef) #1

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.ctpop.i32(i32) #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 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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !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 [23 x i32], align 16
@dp = external dso_local local_unnamed_addr global [8388608 x [2 x i32]], align 16
@pos = external dso_local global %"class.std::map", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 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 i32, align 4
  %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 %.critedge96.thread

._crit_edge:                                      ; preds = %.lr.ph
  %8 = icmp sgt i32 %12, 1
  br i1 %8, label %.lr.ph109.preheader, label %.preheader104

.lr.ph109.preheader:                              ; preds = %._crit_edge
  %9 = load i32, ptr @a, align 16, !tbaa !5
  br label %.lr.ph109

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

._crit_edge110:                                   ; preds = %.lr.ph109
  %.pre = load i32, ptr @a, align 16, !tbaa !5
  %.not = icmp eq i32 %20, %.pre
  br i1 %.not, label %.preheader104, label %24

.preheader104:                                    ; preds = %._crit_edge, %._crit_edge110
  %15 = phi i32 [ %21, %._crit_edge110 ], [ %12, %._crit_edge ]
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.lr.ph112, label %.critedge96.thread

.critedge96.thread:                               ; preds = %0, %.preheader104
  %17 = phi i32 [ %15, %.preheader104 ], [ %6, %0 ]
  store i32 1, ptr getelementptr inbounds (i8, ptr @dp, i64 8), align 8, !tbaa !5
  br label %._crit_edge126.thread

.lr.ph109:                                        ; preds = %.lr.ph109.preheader, %.lr.ph109
  %indvars.iv136 = phi i64 [ %indvars.iv.next137, %.lr.ph109 ], [ 1, %.lr.ph109.preheader ]
  %.086106 = phi i32 [ %20, %.lr.ph109 ], [ %9, %.lr.ph109.preheader ]
  %18 = getelementptr inbounds [23 x i32], ptr @a, i64 0, i64 %indvars.iv136
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %20 = tail call noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef %.086106, i32 noundef %19)
  %indvars.iv.next137 = add nuw nsw i64 %indvars.iv136, 1
  %21 = load i32, ptr @n, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = icmp slt i64 %indvars.iv.next137, %22
  br i1 %23, label %.lr.ph109, label %._crit_edge110, !llvm.loop !11

24:                                               ; preds = %._crit_edge110
  %25 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %147

.preheader103:                                    ; preds = %.lr.ph112
  %.not89118 = icmp sgt i32 %29, 2
  br i1 %.not89118, label %.preheader102.preheader, label %.critedge96

.preheader102.preheader:                          ; preds = %.preheader103
  %wide.trip.count151 = zext nneg i32 %29 to i64
  br label %.preheader102

.lr.ph112:                                        ; preds = %.preheader104, %.lr.ph112
  %indvars.iv139 = phi i64 [ %indvars.iv.next140, %.lr.ph112 ], [ 0, %.preheader104 ]
  %26 = getelementptr inbounds [23 x i32], ptr @a, i64 0, i64 %indvars.iv139
  %27 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @pos, ptr noundef nonnull align 4 dereferenceable(4) %26)
  %28 = trunc nuw nsw i64 %indvars.iv139 to i32
  store i32 %28, ptr %27, align 4, !tbaa !5
  %indvars.iv.next140 = add nuw nsw i64 %indvars.iv139, 1
  %29 = load i32, ptr @n, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = icmp slt i64 %indvars.iv.next140, %30
  br i1 %31, label %.lr.ph112, label %.preheader103, !llvm.loop !12

32:                                               ; preds = %.critedge94
  %indvars.iv.next149 = add nuw nsw i64 %indvars.iv148, 1
  %exitcond152.not = icmp eq i64 %indvars.iv.next149, %wide.trip.count151
  %indvar.next = add i64 %indvar, 1
  br i1 %exitcond152.not, label %.critedge96, label %.preheader102, !llvm.loop !13

.preheader102:                                    ; preds = %.preheader102.preheader, %32
  %indvar = phi i64 [ 0, %.preheader102.preheader ], [ %indvar.next, %32 ]
  %indvars.iv148 = phi i64 [ 2, %.preheader102.preheader ], [ %indvars.iv.next149, %32 ]
  %33 = getelementptr inbounds [23 x i32], ptr @a, i64 0, i64 %indvars.iv148
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %xtraiter = and i64 %indvars.iv148, 1
  %35 = icmp eq i64 %indvar, -1
  %unroll_iter = and i64 %indvars.iv148, 9223372036854775806
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader101

.preheader101:                                    ; preds = %.preheader102, %44
  %indvars.iv144 = phi i64 [ 0, %.preheader102 ], [ %indvars.iv.next145, %44 ]
  %.076116 = phi i1 [ false, %.preheader102 ], [ %.379.lcssa, %44 ]
  %36 = getelementptr inbounds [23 x i32], ptr @a, i64 0, i64 %indvars.iv144
  %37 = load i32, ptr %36, align 4, !tbaa !5
  br i1 %35, label %.unr-lcssa, label %.preheader101.new

.critedge94:                                      ; preds = %44
  br i1 %.379.lcssa, label %32, label %58

.unr-lcssa:                                       ; preds = %.preheader101.new, %.preheader101
  %.379.lcssa.ph = phi i1 [ poison, %.preheader101 ], [ %.379.1, %.preheader101.new ]
  %indvars.iv142.unr = phi i64 [ 0, %.preheader101 ], [ %indvars.iv.next143.1, %.preheader101.new ]
  %.177114.unr = phi i1 [ %.076116, %.preheader101 ], [ %.379.1, %.preheader101.new ]
  br i1 %lcmp.mod.not, label %44, label %.epilog-lcssa

.epilog-lcssa:                                    ; preds = %.unr-lcssa
  %38 = getelementptr inbounds [23 x i32], ptr @a, i64 0, i64 %indvars.iv142.unr
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = add nsw i32 %39, %37
  %41 = icmp eq i32 %40, %34
  %42 = icmp eq i32 %39, %34
  %43 = select i1 %42, i1 true, i1 %41
  %.379.epil = select i1 %43, i1 true, i1 %.177114.unr
  br label %44

44:                                               ; preds = %.unr-lcssa, %.epilog-lcssa
  %.379.lcssa = phi i1 [ %.379.lcssa.ph, %.unr-lcssa ], [ %.379.epil, %.epilog-lcssa ]
  %indvars.iv.next145 = add nuw nsw i64 %indvars.iv144, 1
  %exitcond147.not = icmp eq i64 %indvars.iv.next145, %indvars.iv148
  br i1 %exitcond147.not, label %.critedge94, label %.preheader101, !llvm.loop !14

.preheader101.new:                                ; preds = %.preheader101, %.preheader101.new
  %indvars.iv142 = phi i64 [ %indvars.iv.next143.1, %.preheader101.new ], [ 0, %.preheader101 ]
  %.177114 = phi i1 [ %.379.1, %.preheader101.new ], [ %.076116, %.preheader101 ]
  %niter = phi i64 [ %niter.next.1, %.preheader101.new ], [ 0, %.preheader101 ]
  %45 = getelementptr inbounds [23 x i32], ptr @a, i64 0, i64 %indvars.iv142
  %46 = load i32, ptr %45, align 8, !tbaa !5
  %47 = add nsw i32 %46, %37
  %48 = icmp eq i32 %47, %34
  %49 = icmp eq i32 %46, %34
  %indvars.iv.next143 = or disjoint i64 %indvars.iv142, 1
  %50 = getelementptr inbounds [23 x i32], ptr @a, i64 0, i64 %indvars.iv.next143
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = add nsw i32 %51, %37
  %53 = icmp eq i32 %52, %34
  %54 = icmp eq i32 %51, %34
  %55 = select i1 %54, i1 true, i1 %53
  %56 = select i1 %55, i1 true, i1 %49
  %57 = select i1 %56, i1 true, i1 %48
  %.379.1 = select i1 %57, i1 true, i1 %.177114
  %indvars.iv.next143.1 = add nuw nsw i64 %indvars.iv142, 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 %.unr-lcssa, label %.preheader101.new, !llvm.loop !15

58:                                               ; preds = %.critedge94
  %59 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %147

.critedge96:                                      ; preds = %32, %.preheader103
  store i32 1, ptr getelementptr inbounds (i8, ptr @dp, i64 8), align 8, !tbaa !5
  %60 = icmp sgt i32 %29, 1
  br i1 %60, label %.preheader100, label %._crit_edge126.thread

.preheader100:                                    ; preds = %.critedge96, %._crit_edge124
  %indvar199 = phi i64 [ %indvar.next200, %._crit_edge124 ], [ 0, %.critedge96 ]
  %61 = phi i32 [ %70, %._crit_edge124 ], [ %29, %.critedge96 ]
  %indvars.iv163 = phi i64 [ %indvars.iv.next164, %._crit_edge124 ], [ 1, %.critedge96 ]
  %62 = trunc nuw nsw i64 %indvars.iv163 to i32
  %63 = shl nuw i32 1, %62
  %64 = icmp sgt i32 %63, 1
  br i1 %64, label %.lr.ph123, label %._crit_edge124

.lr.ph123:                                        ; preds = %.preheader100
  %65 = and i64 %indvars.iv163, 1
  %66 = and i64 %indvars.iv163, 1
  %67 = xor i64 %65, 1
  %68 = getelementptr inbounds [23 x i32], ptr @a, i64 0, i64 %indvars.iv163
  %wide.trip.count161 = zext nneg i32 %63 to i64
  %xtraiter201 = and i64 %indvars.iv163, 1
  %69 = icmp eq i64 %indvar199, 0
  %unroll_iter203 = and i64 %indvars.iv163, 9223372036854775806
  %lcmp.mod202.not = icmp eq i64 %xtraiter201, 0
  br label %73

._crit_edge126.thread:                            ; preds = %.critedge96, %.critedge96.thread
  %.ph175 = phi i32 [ %17, %.critedge96.thread ], [ %29, %.critedge96 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  store i32 1000, ptr %3, align 4, !tbaa !5
  br label %.lr.ph129.preheader

._crit_edge126:                                   ; preds = %._crit_edge124
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  store i32 1000, ptr %3, align 4, !tbaa !5
  %.not131 = icmp eq i32 %70, 31
  br i1 %.not131, label %._crit_edge130.thread, label %.lr.ph129.preheader

.lr.ph129.preheader:                              ; preds = %._crit_edge126.thread, %._crit_edge126
  %.ph = phi i32 [ %70, %._crit_edge126 ], [ %.ph175, %._crit_edge126.thread ]
  br label %.lr.ph129

._crit_edge124.loopexit:                          ; preds = %.loopexit
  %.pre169 = load i32, ptr @n, align 4, !tbaa !5
  br label %._crit_edge124

._crit_edge124:                                   ; preds = %._crit_edge124.loopexit, %.preheader100
  %70 = phi i32 [ %.pre169, %._crit_edge124.loopexit ], [ %61, %.preheader100 ]
  %indvars.iv.next164 = add nuw nsw i64 %indvars.iv163, 1
  %71 = sext i32 %70 to i64
  %72 = icmp slt i64 %indvars.iv.next164, %71
  %indvar.next200 = add i64 %indvar199, 1
  br i1 %72, label %.preheader100, label %._crit_edge126, !llvm.loop !16

73:                                               ; preds = %.lr.ph123, %.loopexit
  %indvars.iv158 = phi i64 [ 1, %.lr.ph123 ], [ %indvars.iv.next159, %.loopexit ]
  %74 = getelementptr inbounds [8388608 x [2 x i32]], ptr @dp, i64 0, i64 %indvars.iv158, i64 %66
  store i32 0, ptr %74, align 4, !tbaa !5
  %75 = getelementptr inbounds [8388608 x [2 x i32]], ptr @dp, i64 0, i64 %indvars.iv158, i64 %67
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = icmp eq i32 %76, 0
  br i1 %77, label %.loopexit, label %.preheader.preheader

.preheader.preheader:                             ; preds = %73
  %78 = trunc nuw nsw i64 %indvars.iv158 to i32
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %.critedge98
  %indvars.iv153 = phi i64 [ 0, %.preheader.preheader ], [ %indvars.iv.next154, %.critedge98 ]
  %79 = trunc nuw nsw i64 %indvars.iv153 to i32
  %80 = shl nuw i32 1, %79
  %81 = and i32 %80, %78
  %.not90 = icmp eq i32 %81, 0
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  br i1 %.not90, label %.critedge, label %82

82:                                               ; preds = %.preheader
  %83 = load i32, ptr %68, align 4, !tbaa !5
  %84 = getelementptr inbounds [23 x i32], ptr @a, i64 0, i64 %indvars.iv153
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = sub nsw i32 %83, %85
  store i32 %86, ptr %1, align 4, !tbaa !5
  %87 = call noundef i64 @_ZNKSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48) @pos, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.not91 = icmp eq i64 %87, 0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  br i1 %.not91, label %.critedge98, label %88

88:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %89 = load i32, ptr %68, align 4, !tbaa !5
  %90 = load i32, ptr %84, align 4, !tbaa !5
  %91 = sub nsw i32 %89, %90
  store i32 %91, ptr %2, align 4, !tbaa !5
  %92 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) @pos, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %93 = load i32, ptr %92, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  %94 = shl nuw i32 1, %93
  %95 = and i32 %94, %78
  %.not92 = icmp eq i32 %95, 0
  br i1 %.not92, label %.critedge98, label %96

96:                                               ; preds = %88
  %97 = or i32 %63, %78
  %98 = zext nneg i32 %97 to i64
  %99 = getelementptr inbounds [8388608 x [2 x i32]], ptr @dp, i64 0, i64 %98, i64 %66
  store i32 1, ptr %99, align 4, !tbaa !5
  br i1 %69, label %.loopexit.loopexit.unr-lcssa, label %.new

.new:                                             ; preds = %96, %114
  %.068121 = phi i32 [ %115, %114 ], [ 0, %96 ]
  %niter204 = phi i64 [ %niter204.next.1, %114 ], [ 0, %96 ]
  %100 = shl nuw i32 1, %.068121
  %101 = and i32 %100, %97
  %.not205 = icmp eq i32 %101, 0
  br i1 %.not205, label %106, label %102

102:                                              ; preds = %.new
  %103 = xor i32 %100, %97
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [8388608 x [2 x i32]], ptr @dp, i64 0, i64 %104, i64 %66
  store i32 1, ptr %105, align 4, !tbaa !5
  br label %106

106:                                              ; preds = %.new, %102
  %107 = shl nuw i32 2, %.068121
  %108 = and i32 %107, %97
  %109 = icmp sgt i32 %108, 0
  br i1 %109, label %110, label %114

110:                                              ; preds = %106
  %111 = xor i32 %107, %97
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [8388608 x [2 x i32]], ptr @dp, i64 0, i64 %112, i64 %66
  store i32 1, ptr %113, align 4, !tbaa !5
  br label %114

114:                                              ; preds = %110, %106
  %115 = add nuw nsw i32 %.068121, 2
  %niter204.next.1 = add i64 %niter204, 2
  %niter204.ncmp.1 = icmp eq i64 %niter204.next.1, %unroll_iter203
  br i1 %niter204.ncmp.1, label %.loopexit.loopexit.unr-lcssa, label %.new, !llvm.loop !17

.critedge:                                        ; preds = %.preheader
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  br label %.critedge98

.critedge98:                                      ; preds = %88, %82, %.critedge
  %indvars.iv.next154 = add nuw nsw i64 %indvars.iv153, 1
  %exitcond156.not = icmp eq i64 %indvars.iv.next154, %indvars.iv163
  br i1 %exitcond156.not, label %.loopexit, label %.preheader, !llvm.loop !18

.loopexit.loopexit.unr-lcssa:                     ; preds = %114, %96
  %.068121.unr = phi i32 [ 0, %96 ], [ %115, %114 ]
  br i1 %lcmp.mod202.not, label %.loopexit, label %.epil.preheader198

.epil.preheader198:                               ; preds = %.loopexit.loopexit.unr-lcssa
  %116 = shl nuw i32 1, %.068121.unr
  %117 = and i32 %116, %97
  %118 = icmp sgt i32 %117, 0
  br i1 %118, label %119, label %.loopexit

119:                                              ; preds = %.epil.preheader198
  %120 = xor i32 %116, %97
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [8388608 x [2 x i32]], ptr @dp, i64 0, i64 %121, i64 %66
  store i32 1, ptr %122, align 4, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %.critedge98, %.loopexit.loopexit.unr-lcssa, %119, %.epil.preheader198, %73
  %indvars.iv.next159 = add nuw nsw i64 %indvars.iv158, 1
  %exitcond162.not = icmp eq i64 %indvars.iv.next159, %wide.trip.count161
  br i1 %exitcond162.not, label %._crit_edge124.loopexit, label %73, !llvm.loop !19

._crit_edge130:                                   ; preds = %137
  %123 = icmp eq i32 %138, 1000
  br i1 %123, label %._crit_edge130.thread, label %144

.lr.ph129:                                        ; preds = %.lr.ph129.preheader, %137
  %124 = phi i32 [ %138, %137 ], [ 1000, %.lr.ph129.preheader ]
  %125 = phi i32 [ %139, %137 ], [ %.ph, %.lr.ph129.preheader ]
  %indvars.iv166 = phi i64 [ %indvars.iv.next167, %137 ], [ 0, %.lr.ph129.preheader ]
  %126 = add nsw i32 %125, -1
  %127 = srem i32 %126, 2
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [8388608 x [2 x i32]], ptr @dp, i64 0, i64 %indvars.iv166, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = icmp eq i32 %130, 1
  br i1 %131, label %132, label %137

132:                                              ; preds = %.lr.ph129
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  %133 = trunc nuw nsw i64 %indvars.iv166 to i32
  %134 = call range(i32 0, 32) i32 @llvm.ctpop.i32(i32 %133)
  store i32 %134, ptr %4, align 4, !tbaa !5
  %135 = 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) %4)
  %136 = load i32, ptr %135, align 4, !tbaa !5
  store i32 %136, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  %.pre170 = load i32, ptr @n, align 4, !tbaa !5
  br label %137

137:                                              ; preds = %.lr.ph129, %132
  %138 = phi i32 [ %124, %.lr.ph129 ], [ %136, %132 ]
  %139 = phi i32 [ %125, %.lr.ph129 ], [ %.pre170, %132 ]
  %indvars.iv.next167 = add nuw nsw i64 %indvars.iv166, 1
  %140 = shl nuw i32 1, %139
  %141 = sext i32 %140 to i64
  %142 = icmp slt i64 %indvars.iv.next167, %141
  br i1 %142, label %.lr.ph129, label %._crit_edge130, !llvm.loop !20

._crit_edge130.thread:                            ; preds = %._crit_edge126, %._crit_edge130
  %143 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %146

144:                                              ; preds = %._crit_edge130
  %145 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %138)
  br label %146

146:                                              ; preds = %144, %._crit_edge130.thread
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  br label %147

147:                                              ; preds = %58, %146, %24
  ret i32 0
}

; 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: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef, i32 noundef) local_unnamed_addr #3

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

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.ctpop.i32(i32) #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 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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}


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