; LLVM IR from VastoLorde95/Competitive-Programming :: CodeChef/LTIME/LTIME26/Problem C (C)

; 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::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_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 }
%"struct.std::pair" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@t = external dso_local global i32, align 4
@x = external dso_local global i32, align 4
@y = external dso_local global i32, align 4
@a = external dso_local global i32, align 4
@b = external dso_local global i32, align 4
@di = external dso_local global [2001000 x i32], align 16
@n = external dso_local global i64, align 8
@k = external dso_local global i64, align 8
@cnt = external dso_local global i64, align 8
@l1 = external dso_local global i64, align 8
@l2 = external dso_local global i64, align 8
@r1 = external dso_local global i64, align 8
@r2 = external dso_local global i64, align 8
@tot1 = external dso_local global i64, align 8
@tot2 = external dso_local global i64, align 8
@d1 = external dso_local global %"class.std::set", align 8
@d2 = external dso_local global %"class.std::set", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 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 i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca %"struct.std::pair", align 8
  %6 = alloca i64, align 8
  %7 = alloca %"struct.std::pair", align 8
  %8 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %9 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  store i32 0, ptr %1, align 4
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %17

17:                                               ; preds = %308, %0
  %18 = load i32, ptr @t, align 4, !tbaa !5
  %19 = add nsw i32 %18, -1
  store i32 %19, ptr @t, align 4, !tbaa !5
  %20 = icmp ne i32 %18, 0
  br i1 %20, label %21, label %315

21:                                               ; preds = %17
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef @n, ptr noundef @k)
  call void @_ZNSt3setIxSt4lessIxESaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @d1) #7
  call void @_ZNSt3setIxSt4lessIxESaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @d2) #7
  store i64 0, ptr @cnt, align 8, !tbaa !9
  call void @llvm.memset.p0.i64(ptr align 16 @di, i8 0, i64 8004000, i1 false)
  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 = %71, %21
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = load i64, ptr @k, align 8, !tbaa !9
  %27 = icmp slt i64 %25, %26
  br i1 %27, label %29, label %28

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

29:                                               ; preds = %23
  %30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef @x, ptr noundef @y)
  %31 = load i32, ptr @x, align 4, !tbaa !5
  %32 = load i32, ptr @y, align 4, !tbaa !5
  %33 = sub nsw i32 %31, %32
  store i32 %33, ptr @a, align 4, !tbaa !5
  %34 = load i32, ptr @x, align 4, !tbaa !5
  %35 = load i32, ptr @y, align 4, !tbaa !5
  %36 = add nsw i32 %34, %35
  store i32 %36, ptr @b, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  %37 = load i32, ptr @b, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  store i64 %38, ptr %3, align 8, !tbaa !9
  %39 = call noundef i64 @_ZNKSt3setIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) @d2, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %40 = icmp ne i64 %39, 0
  %41 = xor i1 %40, true
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  br i1 %41, label %42, label %63

42:                                               ; preds = %29
  %43 = load i64, ptr @n, align 8, !tbaa !9
  %44 = load i64, ptr @n, align 8, !tbaa !9
  %45 = add nsw i64 %44, 1
  %46 = load i32, ptr @b, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = sub nsw i64 %45, %47
  %49 = call noundef i64 @_ZSt3absx(i64 noundef %48)
  %50 = sub nsw i64 %43, %49
  %51 = load i64, ptr @cnt, align 8, !tbaa !9
  %52 = add nsw i64 %51, %50
  store i64 %52, ptr @cnt, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  %53 = load i32, ptr @b, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  store i64 %54, ptr %4, align 8, !tbaa !9
  %55 = call { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertEOx(ptr noundef nonnull align 8 dereferenceable(48) @d2, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %56 = getelementptr inbounds { ptr, i8 }, ptr %5, i32 0, i32 0
  %57 = extractvalue { ptr, i8 } %55, 0
  store ptr %57, ptr %56, align 8
  %58 = getelementptr inbounds { ptr, i8 }, ptr %5, i32 0, i32 1
  %59 = extractvalue { ptr, i8 } %55, 1
  store i8 %59, ptr %58, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  %60 = load i32, ptr @b, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [2001000 x i32], ptr @di, i64 0, i64 %61
  store i32 1, ptr %62, align 4, !tbaa !5
  br label %63

63:                                               ; preds = %42, %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %64 = load i32, ptr @a, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  store i64 %65, ptr %6, align 8, !tbaa !9
  %66 = call { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertEOx(ptr noundef nonnull align 8 dereferenceable(48) @d1, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %67 = getelementptr inbounds { ptr, i8 }, ptr %7, i32 0, i32 0
  %68 = extractvalue { ptr, i8 } %66, 0
  store ptr %68, ptr %67, align 8
  %69 = getelementptr inbounds { ptr, i8 }, ptr %7, i32 0, i32 1
  %70 = extractvalue { ptr, i8 } %66, 1
  store i8 %70, ptr %69, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %71

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

74:                                               ; preds = %28
  %75 = load i64, ptr @n, align 8, !tbaa !9
  %76 = add nsw i64 %75, 2
  store i64 %76, ptr @r2, align 8, !tbaa !9
  %77 = load i64, ptr @n, align 8, !tbaa !9
  store i64 %77, ptr @l2, align 8, !tbaa !9
  %78 = load i64, ptr @n, align 8, !tbaa !9
  %79 = add nsw i64 %78, 1
  store i64 %79, ptr @l1, align 8, !tbaa !9
  store i64 %79, ptr @r1, align 8, !tbaa !9
  %80 = load i64, ptr @r1, align 8, !tbaa !9
  %81 = add nsw i64 %80, 2
  store i64 %81, ptr @r1, align 8, !tbaa !9
  %82 = load i64, ptr @l1, align 8, !tbaa !9
  %83 = sub nsw i64 %82, 2
  store i64 %83, ptr @l1, align 8, !tbaa !9
  store i64 0, ptr @tot2, align 8, !tbaa !9
  store i64 0, ptr @tot1, align 8, !tbaa !9
  %84 = load i64, ptr @n, align 8, !tbaa !9
  %85 = add nsw i64 %84, 1
  %86 = getelementptr inbounds [2001000 x i32], ptr @di, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = icmp ne i32 %87, 0
  br i1 %88, label %89, label %90

89:                                               ; preds = %74
  store i64 1, ptr @tot1, align 8, !tbaa !9
  br label %90

90:                                               ; preds = %89, %74
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %91 = call ptr @_ZNKSt3setIxSt4lessIxESaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @d1) #7
  %92 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %8, i32 0, i32 0
  store ptr %91, ptr %92, align 8
  br label %93

93:                                               ; preds = %305, %90
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %94 = call ptr @_ZNKSt3setIxSt4lessIxESaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @d1) #7
  %95 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %9, i32 0, i32 0
  store ptr %94, ptr %95, align 8
  %96 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIxES2_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  br i1 %96, label %98, label %97

97:                                               ; preds = %93
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %308

98:                                               ; preds = %93
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %99 = load i64, ptr @n, align 8, !tbaa !9
  %100 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorIxEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  %101 = load i64, ptr %100, align 8, !tbaa !9
  %102 = call noundef i64 @_ZSt3absx(i64 noundef %101)
  %103 = sub nsw i64 %99, %102
  store i64 %103, ptr %10, align 8, !tbaa !9
  %104 = load i64, ptr %10, align 8, !tbaa !9
  %105 = load i64, ptr @cnt, align 8, !tbaa !9
  %106 = add nsw i64 %105, %104
  store i64 %106, ptr @cnt, align 8, !tbaa !9
  %107 = load i64, ptr %10, align 8, !tbaa !9
  %108 = srem i64 %107, 2
  %109 = icmp eq i64 %108, 0
  br i1 %109, label %110, label %200

110:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %111 = load i64, ptr @n, align 8, !tbaa !9
  %112 = add nsw i64 %111, 1
  %113 = load i64, ptr %10, align 8, !tbaa !9
  %114 = sub nsw i64 %113, 1
  %115 = sub nsw i64 %112, %114
  store i64 %115, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %116 = load i64, ptr @n, align 8, !tbaa !9
  %117 = add nsw i64 %116, 1
  %118 = load i64, ptr %10, align 8, !tbaa !9
  %119 = sub nsw i64 %118, 1
  %120 = add nsw i64 %117, %119
  store i64 %120, ptr %12, align 8, !tbaa !9
  %121 = load i64, ptr @l2, align 8, !tbaa !9
  %122 = load i64, ptr %11, align 8, !tbaa !9
  %123 = icmp sge i64 %121, %122
  br i1 %123, label %124, label %141

124:                                              ; preds = %110
  br label %125

125:                                              ; preds = %137, %124
  %126 = load i64, ptr @l2, align 8, !tbaa !9
  %127 = load i64, ptr %11, align 8, !tbaa !9
  %128 = icmp sge i64 %126, %127
  br i1 %128, label %129, label %140

129:                                              ; preds = %125
  %130 = load i64, ptr @l2, align 8, !tbaa !9
  %131 = getelementptr inbounds [2001000 x i32], ptr @di, i64 0, i64 %130
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = icmp ne i32 %132, 0
  br i1 %133, label %134, label %137

134:                                              ; preds = %129
  %135 = load i64, ptr @tot2, align 8, !tbaa !9
  %136 = add nsw i64 %135, 1
  store i64 %136, ptr @tot2, align 8, !tbaa !9
  br label %137

137:                                              ; preds = %134, %129
  %138 = load i64, ptr @l2, align 8, !tbaa !9
  %139 = sub nsw i64 %138, 2
  store i64 %139, ptr @l2, align 8, !tbaa !9
  br label %125, !llvm.loop !13

140:                                              ; preds = %125
  br label %158

141:                                              ; preds = %110
  br label %142

142:                                              ; preds = %154, %141
  %143 = load i64, ptr @l2, align 8, !tbaa !9
  %144 = load i64, ptr %11, align 8, !tbaa !9
  %145 = icmp slt i64 %143, %144
  br i1 %145, label %146, label %157

146:                                              ; preds = %142
  %147 = load i64, ptr @l2, align 8, !tbaa !9
  %148 = getelementptr inbounds [2001000 x i32], ptr @di, i64 0, i64 %147
  %149 = load i32, ptr %148, align 4, !tbaa !5
  %150 = icmp ne i32 %149, 0
  br i1 %150, label %151, label %154

151:                                              ; preds = %146
  %152 = load i64, ptr @tot2, align 8, !tbaa !9
  %153 = add nsw i64 %152, -1
  store i64 %153, ptr @tot2, align 8, !tbaa !9
  br label %154

154:                                              ; preds = %151, %146
  %155 = load i64, ptr @l2, align 8, !tbaa !9
  %156 = add nsw i64 %155, 2
  store i64 %156, ptr @l2, align 8, !tbaa !9
  br label %142, !llvm.loop !14

157:                                              ; preds = %142
  br label %158

158:                                              ; preds = %157, %140
  %159 = load i64, ptr @r2, align 8, !tbaa !9
  %160 = load i64, ptr %12, align 8, !tbaa !9
  %161 = icmp sle i64 %159, %160
  br i1 %161, label %162, label %179

162:                                              ; preds = %158
  br label %163

163:                                              ; preds = %175, %162
  %164 = load i64, ptr @r2, align 8, !tbaa !9
  %165 = load i64, ptr %12, align 8, !tbaa !9
  %166 = icmp sle i64 %164, %165
  br i1 %166, label %167, label %178

167:                                              ; preds = %163
  %168 = load i64, ptr @r2, align 8, !tbaa !9
  %169 = getelementptr inbounds [2001000 x i32], ptr @di, i64 0, i64 %168
  %170 = load i32, ptr %169, align 4, !tbaa !5
  %171 = icmp ne i32 %170, 0
  br i1 %171, label %172, label %175

172:                                              ; preds = %167
  %173 = load i64, ptr @tot2, align 8, !tbaa !9
  %174 = add nsw i64 %173, 1
  store i64 %174, ptr @tot2, align 8, !tbaa !9
  br label %175

175:                                              ; preds = %172, %167
  %176 = load i64, ptr @r2, align 8, !tbaa !9
  %177 = add nsw i64 %176, 2
  store i64 %177, ptr @r2, align 8, !tbaa !9
  br label %163, !llvm.loop !15

178:                                              ; preds = %163
  br label %196

179:                                              ; preds = %158
  br label %180

180:                                              ; preds = %192, %179
  %181 = load i64, ptr @r2, align 8, !tbaa !9
  %182 = load i64, ptr %12, align 8, !tbaa !9
  %183 = icmp sgt i64 %181, %182
  br i1 %183, label %184, label %195

184:                                              ; preds = %180
  %185 = load i64, ptr @r2, align 8, !tbaa !9
  %186 = getelementptr inbounds [2001000 x i32], ptr @di, i64 0, i64 %185
  %187 = load i32, ptr %186, align 4, !tbaa !5
  %188 = icmp ne i32 %187, 0
  br i1 %188, label %189, label %192

189:                                              ; preds = %184
  %190 = load i64, ptr @tot2, align 8, !tbaa !9
  %191 = add nsw i64 %190, -1
  store i64 %191, ptr @tot2, align 8, !tbaa !9
  br label %192

192:                                              ; preds = %189, %184
  %193 = load i64, ptr @r2, align 8, !tbaa !9
  %194 = sub nsw i64 %193, 2
  store i64 %194, ptr @r2, align 8, !tbaa !9
  br label %180, !llvm.loop !16

195:                                              ; preds = %180
  br label %196

196:                                              ; preds = %195, %178
  %197 = load i64, ptr @tot2, align 8, !tbaa !9
  %198 = load i64, ptr @cnt, align 8, !tbaa !9
  %199 = sub nsw i64 %198, %197
  store i64 %199, ptr @cnt, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br label %304

200:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %201 = load i64, ptr @n, align 8, !tbaa !9
  %202 = add nsw i64 %201, 1
  %203 = load i64, ptr %10, align 8, !tbaa !9
  %204 = sub nsw i64 %203, 1
  %205 = sub nsw i64 %202, %204
  store i64 %205, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %206 = load i64, ptr @n, align 8, !tbaa !9
  %207 = add nsw i64 %206, 1
  %208 = load i64, ptr %10, align 8, !tbaa !9
  %209 = sub nsw i64 %208, 1
  %210 = add nsw i64 %207, %209
  store i64 %210, ptr %14, align 8, !tbaa !9
  %211 = load i64, ptr %10, align 8, !tbaa !9
  %212 = icmp eq i64 %211, 1
  br i1 %212, label %213, label %223

213:                                              ; preds = %200
  %214 = load i64, ptr @n, align 8, !tbaa !9
  %215 = add nsw i64 %214, 1
  %216 = getelementptr inbounds [2001000 x i32], ptr @di, i64 0, i64 %215
  %217 = load i32, ptr %216, align 4, !tbaa !5
  %218 = icmp ne i32 %217, 0
  br i1 %218, label %219, label %222

219:                                              ; preds = %213
  %220 = load i64, ptr @cnt, align 8, !tbaa !9
  %221 = add nsw i64 %220, -1
  store i64 %221, ptr @cnt, align 8, !tbaa !9
  br label %222

222:                                              ; preds = %219, %213
  br label %303

223:                                              ; preds = %200
  %224 = load i64, ptr @l1, align 8, !tbaa !9
  %225 = load i64, ptr %13, align 8, !tbaa !9
  %226 = icmp sge i64 %224, %225
  br i1 %226, label %227, label %244

227:                                              ; preds = %223
  br label %228

228:                                              ; preds = %240, %227
  %229 = load i64, ptr @l1, align 8, !tbaa !9
  %230 = load i64, ptr %13, align 8, !tbaa !9
  %231 = icmp sge i64 %229, %230
  br i1 %231, label %232, label %243

232:                                              ; preds = %228
  %233 = load i64, ptr @l1, align 8, !tbaa !9
  %234 = getelementptr inbounds [2001000 x i32], ptr @di, i64 0, i64 %233
  %235 = load i32, ptr %234, align 4, !tbaa !5
  %236 = icmp ne i32 %235, 0
  br i1 %236, label %237, label %240

237:                                              ; preds = %232
  %238 = load i64, ptr @tot1, align 8, !tbaa !9
  %239 = add nsw i64 %238, 1
  store i64 %239, ptr @tot1, align 8, !tbaa !9
  br label %240

240:                                              ; preds = %237, %232
  %241 = load i64, ptr @l1, align 8, !tbaa !9
  %242 = sub nsw i64 %241, 2
  store i64 %242, ptr @l1, align 8, !tbaa !9
  br label %228, !llvm.loop !17

243:                                              ; preds = %228
  br label %261

244:                                              ; preds = %223
  br label %245

245:                                              ; preds = %257, %244
  %246 = load i64, ptr @l1, align 8, !tbaa !9
  %247 = load i64, ptr %13, align 8, !tbaa !9
  %248 = icmp slt i64 %246, %247
  br i1 %248, label %249, label %260

249:                                              ; preds = %245
  %250 = load i64, ptr @l1, align 8, !tbaa !9
  %251 = getelementptr inbounds [2001000 x i32], ptr @di, i64 0, i64 %250
  %252 = load i32, ptr %251, align 4, !tbaa !5
  %253 = icmp ne i32 %252, 0
  br i1 %253, label %254, label %257

254:                                              ; preds = %249
  %255 = load i64, ptr @tot1, align 8, !tbaa !9
  %256 = add nsw i64 %255, -1
  store i64 %256, ptr @tot1, align 8, !tbaa !9
  br label %257

257:                                              ; preds = %254, %249
  %258 = load i64, ptr @l1, align 8, !tbaa !9
  %259 = add nsw i64 %258, 2
  store i64 %259, ptr @l1, align 8, !tbaa !9
  br label %245, !llvm.loop !18

260:                                              ; preds = %245
  br label %261

261:                                              ; preds = %260, %243
  %262 = load i64, ptr @r1, align 8, !tbaa !9
  %263 = load i64, ptr %14, align 8, !tbaa !9
  %264 = icmp sle i64 %262, %263
  br i1 %264, label %265, label %282

265:                                              ; preds = %261
  br label %266

266:                                              ; preds = %278, %265
  %267 = load i64, ptr @r1, align 8, !tbaa !9
  %268 = load i64, ptr %14, align 8, !tbaa !9
  %269 = icmp sle i64 %267, %268
  br i1 %269, label %270, label %281

270:                                              ; preds = %266
  %271 = load i64, ptr @r1, align 8, !tbaa !9
  %272 = getelementptr inbounds [2001000 x i32], ptr @di, i64 0, i64 %271
  %273 = load i32, ptr %272, align 4, !tbaa !5
  %274 = icmp ne i32 %273, 0
  br i1 %274, label %275, label %278

275:                                              ; preds = %270
  %276 = load i64, ptr @tot1, align 8, !tbaa !9
  %277 = add nsw i64 %276, 1
  store i64 %277, ptr @tot1, align 8, !tbaa !9
  br label %278

278:                                              ; preds = %275, %270
  %279 = load i64, ptr @r1, align 8, !tbaa !9
  %280 = add nsw i64 %279, 2
  store i64 %280, ptr @r1, align 8, !tbaa !9
  br label %266, !llvm.loop !19

281:                                              ; preds = %266
  br label %299

282:                                              ; preds = %261
  br label %283

283:                                              ; preds = %295, %282
  %284 = load i64, ptr @r1, align 8, !tbaa !9
  %285 = load i64, ptr %14, align 8, !tbaa !9
  %286 = icmp sgt i64 %284, %285
  br i1 %286, label %287, label %298

287:                                              ; preds = %283
  %288 = load i64, ptr @r1, align 8, !tbaa !9
  %289 = getelementptr inbounds [2001000 x i32], ptr @di, i64 0, i64 %288
  %290 = load i32, ptr %289, align 4, !tbaa !5
  %291 = icmp ne i32 %290, 0
  br i1 %291, label %292, label %295

292:                                              ; preds = %287
  %293 = load i64, ptr @tot1, align 8, !tbaa !9
  %294 = add nsw i64 %293, -1
  store i64 %294, ptr @tot1, align 8, !tbaa !9
  br label %295

295:                                              ; preds = %292, %287
  %296 = load i64, ptr @r1, align 8, !tbaa !9
  %297 = sub nsw i64 %296, 2
  store i64 %297, ptr @r1, align 8, !tbaa !9
  br label %283, !llvm.loop !20

298:                                              ; preds = %283
  br label %299

299:                                              ; preds = %298, %281
  %300 = load i64, ptr @tot1, align 8, !tbaa !9
  %301 = load i64, ptr @cnt, align 8, !tbaa !9
  %302 = sub nsw i64 %301, %300
  store i64 %302, ptr @cnt, align 8, !tbaa !9
  br label %303

303:                                              ; preds = %299, %222
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %304

304:                                              ; preds = %303, %196
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %305

305:                                              ; preds = %304
  %306 = call ptr @_ZNSt23_Rb_tree_const_iteratorIxEppEi(ptr noundef nonnull align 8 dereferenceable(8) %8, i32 noundef 0) #7
  %307 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %15, i32 0, i32 0
  store ptr %306, ptr %307, align 8
  br label %93, !llvm.loop !21

308:                                              ; preds = %97
  %309 = load i64, ptr @n, align 8, !tbaa !9
  %310 = load i64, ptr @n, align 8, !tbaa !9
  %311 = mul nsw i64 %309, %310
  %312 = load i64, ptr @cnt, align 8, !tbaa !9
  %313 = sub nsw i64 %311, %312
  %314 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i64 noundef %313)
  br label %17, !llvm.loop !22

315:                                              ; preds = %17
  ret i32 0
}

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZSt3absx(i64 noundef) #6

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertEOx(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) #5 align 2

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

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

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

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}


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

%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_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 }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@t = external dso_local global i32, align 4
@x = external dso_local global i32, align 4
@y = external dso_local global i32, align 4
@a = external dso_local local_unnamed_addr global i32, align 4
@b = external dso_local local_unnamed_addr global i32, align 4
@di = external dso_local local_unnamed_addr global [2001000 x i32], align 16
@n = external dso_local global i64, align 8
@k = external dso_local global i64, align 8
@cnt = external dso_local local_unnamed_addr global i64, align 8
@l1 = external dso_local local_unnamed_addr global i64, align 8
@l2 = external dso_local local_unnamed_addr global i64, align 8
@r1 = external dso_local local_unnamed_addr global i64, align 8
@r2 = external dso_local local_unnamed_addr global i64, align 8
@tot1 = external dso_local local_unnamed_addr global i64, align 8
@tot2 = external dso_local local_unnamed_addr global i64, align 8
@d1 = external dso_local global %"class.std::set", align 8
@d2 = external dso_local global %"class.std::set", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %5 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %7 = load i32, ptr @t, align 4, !tbaa !5
  %8 = add nsw i32 %7, -1
  store i32 %8, ptr @t, align 4, !tbaa !5
  %.not101 = icmp eq i32 %7, 0
  br i1 %.not101, label %._crit_edge104, label %.lr.ph103

.lr.ph103:                                        ; preds = %0, %._crit_edge100
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull @n, ptr noundef nonnull @k)
  call void @_ZNSt3setIxSt4lessIxESaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @d1) #7
  call void @_ZNSt3setIxSt4lessIxESaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @d2) #7
  store i64 0, ptr @cnt, align 8, !tbaa !9
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(8004000) @di, i8 0, i64 8004000, i1 false)
  %10 = load i64, ptr @k, align 8, !tbaa !9
  %11 = icmp sgt i64 %10, 0
  br i1 %11, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %45, %.lr.ph103
  %12 = load i64, ptr @n, align 8, !tbaa !9
  %13 = add nsw i64 %12, 2
  store i64 %13, ptr @r2, align 8, !tbaa !9
  store i64 %12, ptr @l2, align 8, !tbaa !9
  %14 = add nsw i64 %12, 1
  %15 = add nsw i64 %12, 3
  store i64 %15, ptr @r1, align 8, !tbaa !9
  %16 = add nsw i64 %12, -1
  store i64 %16, ptr @l1, align 8, !tbaa !9
  store i64 0, ptr @tot2, align 8, !tbaa !9
  %17 = getelementptr inbounds [2001000 x i32], ptr @di, i64 0, i64 %14
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %.not32 = icmp ne i32 %18, 0
  %spec.store.select = zext i1 %.not32 to i64
  store i64 %spec.store.select, ptr @tot1, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %19 = call ptr @_ZNKSt3setIxSt4lessIxESaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @d1) #7
  store ptr %19, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %20 = call ptr @_ZNKSt3setIxSt4lessIxESaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @d1) #7
  store ptr %20, ptr %5, align 8
  %21 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIxES2_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  br i1 %21, label %.lr.ph99, label %._crit_edge100

.lr.ph:                                           ; preds = %.lr.ph103, %45
  %indvars.iv = phi i64 [ %indvars.iv.next, %45 ], [ 0, %.lr.ph103 ]
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull @x, ptr noundef nonnull @y)
  %23 = load i32, ptr @x, align 4, !tbaa !5
  %24 = load i32, ptr @y, align 4, !tbaa !5
  %25 = sub nsw i32 %23, %24
  store i32 %25, ptr @a, align 4, !tbaa !5
  %26 = add nsw i32 %24, %23
  store i32 %26, ptr @b, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  %27 = sext i32 %26 to i64
  store i64 %27, ptr %1, align 8, !tbaa !9
  %28 = call noundef i64 @_ZNKSt3setIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) @d2, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %.not50 = icmp eq i64 %28, 0
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  br i1 %.not50, label %29, label %45

29:                                               ; preds = %.lr.ph
  %30 = load i64, ptr @n, align 8, !tbaa !9
  %31 = add nsw i64 %30, 1
  %32 = load i32, ptr @b, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = sub i64 %31, %33
  %35 = call noundef i64 @_ZSt3absx(i64 noundef %34)
  %36 = sub i64 %30, %35
  %37 = load i64, ptr @cnt, align 8, !tbaa !9
  %38 = add nsw i64 %36, %37
  store i64 %38, ptr @cnt, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  %39 = load i32, ptr @b, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  store i64 %40, ptr %2, align 8, !tbaa !9
  %41 = call { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertEOx(ptr noundef nonnull align 8 dereferenceable(48) @d2, ptr noundef nonnull align 8 dereferenceable(8) %2)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  %42 = load i32, ptr @b, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [2001000 x i32], ptr @di, i64 0, i64 %43
  store i32 1, ptr %44, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %29, %.lr.ph
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %46 = load i32, ptr @a, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  store i64 %47, ptr %3, align 8, !tbaa !9
  %48 = call { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertEOx(ptr noundef nonnull align 8 dereferenceable(48) @d1, ptr noundef nonnull align 8 dereferenceable(8) %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %49 = load i64, ptr @k, align 8, !tbaa !9
  %50 = icmp sgt i64 %49, %indvars.iv.next
  br i1 %50, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge100:                                   ; preds = %165, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  %51 = load i64, ptr @n, align 8, !tbaa !9
  %52 = mul nsw i64 %51, %51
  %53 = load i64, ptr @cnt, align 8, !tbaa !9
  %54 = sub nsw i64 %52, %53
  %55 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i64 noundef %54)
  %56 = load i32, ptr @t, align 4, !tbaa !5
  %57 = add nsw i32 %56, -1
  store i32 %57, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %56, 0
  br i1 %.not, label %._crit_edge104, label %.lr.ph103, !llvm.loop !13

.lr.ph99:                                         ; preds = %._crit_edge, %165
  %58 = load i64, ptr @n, align 8, !tbaa !9
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorIxEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  %60 = load i64, ptr %59, align 8, !tbaa !9
  %61 = call noundef i64 @_ZSt3absx(i64 noundef %60)
  %62 = sub nsw i64 %58, %61
  %63 = load i64, ptr @cnt, align 8, !tbaa !9
  %64 = add nsw i64 %63, %62
  store i64 %64, ptr @cnt, align 8, !tbaa !9
  %65 = and i64 %62, 1
  %66 = icmp eq i64 %65, 0
  %67 = load i64, ptr @n, align 8, !tbaa !9
  %68 = sub i64 %67, %62
  %69 = add i64 %68, 2
  %70 = add i64 %67, %62
  br i1 %66, label %71, label %114

71:                                               ; preds = %.lr.ph99
  %72 = load i64, ptr @l2, align 8, !tbaa !9
  %.not42 = icmp slt i64 %72, %69
  %tot2.promoted87 = load i64, ptr @tot2, align 8, !tbaa !9
  br i1 %.not42, label %.lr.ph88, label %.lr.ph84

.lr.ph84:                                         ; preds = %71, %79
  %73 = phi i64 [ %81, %79 ], [ %72, %71 ]
  %74 = phi i64 [ %80, %79 ], [ %tot2.promoted87, %71 ]
  %75 = getelementptr inbounds [2001000 x i32], ptr @di, i64 0, i64 %73
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %.not49 = icmp eq i32 %76, 0
  br i1 %.not49, label %79, label %77

77:                                               ; preds = %.lr.ph84
  %78 = add nsw i64 %74, 1
  store i64 %78, ptr @tot2, align 8, !tbaa !9
  br label %79

79:                                               ; preds = %77, %.lr.ph84
  %80 = phi i64 [ %78, %77 ], [ %74, %.lr.ph84 ]
  %81 = add nsw i64 %73, -2
  %.not44 = icmp slt i64 %81, %69
  br i1 %.not44, label %.loopexit57, label %.lr.ph84, !llvm.loop !14

.lr.ph88:                                         ; preds = %71, %88
  %82 = phi i64 [ %90, %88 ], [ %72, %71 ]
  %83 = phi i64 [ %89, %88 ], [ %tot2.promoted87, %71 ]
  %84 = getelementptr inbounds [2001000 x i32], ptr @di, i64 0, i64 %82
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %.not43 = icmp eq i32 %85, 0
  br i1 %.not43, label %88, label %86

86:                                               ; preds = %.lr.ph88
  %87 = add nsw i64 %83, -1
  store i64 %87, ptr @tot2, align 8, !tbaa !9
  br label %88

88:                                               ; preds = %86, %.lr.ph88
  %89 = phi i64 [ %87, %86 ], [ %83, %.lr.ph88 ]
  %90 = add nsw i64 %82, 2
  %91 = icmp slt i64 %90, %69
  br i1 %91, label %.lr.ph88, label %.loopexit57, !llvm.loop !15

.loopexit57:                                      ; preds = %79, %88
  %storemerge116 = phi i64 [ %90, %88 ], [ %81, %79 ]
  %tot2.promoted95 = phi i64 [ %89, %88 ], [ %80, %79 ]
  store i64 %storemerge116, ptr @l2, align 8, !tbaa !9
  %92 = load i64, ptr @r2, align 8, !tbaa !9
  %.not45 = icmp sgt i64 %92, %70
  br i1 %.not45, label %.lr.ph96, label %.lr.ph92

.lr.ph92:                                         ; preds = %.loopexit57, %99
  %93 = phi i64 [ %101, %99 ], [ %92, %.loopexit57 ]
  %94 = phi i64 [ %100, %99 ], [ %tot2.promoted95, %.loopexit57 ]
  %95 = getelementptr inbounds [2001000 x i32], ptr @di, i64 0, i64 %93
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %.not48 = icmp eq i32 %96, 0
  br i1 %.not48, label %99, label %97

97:                                               ; preds = %.lr.ph92
  %98 = add nsw i64 %94, 1
  store i64 %98, ptr @tot2, align 8, !tbaa !9
  br label %99

99:                                               ; preds = %97, %.lr.ph92
  %100 = phi i64 [ %98, %97 ], [ %94, %.lr.ph92 ]
  %101 = add nsw i64 %93, 2
  %.not47 = icmp sgt i64 %101, %70
  br i1 %.not47, label %.loopexit, label %.lr.ph92, !llvm.loop !16

.lr.ph96:                                         ; preds = %.loopexit57, %108
  %102 = phi i64 [ %110, %108 ], [ %92, %.loopexit57 ]
  %103 = phi i64 [ %109, %108 ], [ %tot2.promoted95, %.loopexit57 ]
  %104 = getelementptr inbounds [2001000 x i32], ptr @di, i64 0, i64 %102
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %.not46 = icmp eq i32 %105, 0
  br i1 %.not46, label %108, label %106

106:                                              ; preds = %.lr.ph96
  %107 = add nsw i64 %103, -1
  store i64 %107, ptr @tot2, align 8, !tbaa !9
  br label %108

108:                                              ; preds = %106, %.lr.ph96
  %109 = phi i64 [ %107, %106 ], [ %103, %.lr.ph96 ]
  %110 = add nsw i64 %102, -2
  %111 = icmp sgt i64 %110, %70
  br i1 %111, label %.lr.ph96, label %.loopexit, !llvm.loop !17

.loopexit:                                        ; preds = %99, %108
  %storemerge117 = phi i64 [ %110, %108 ], [ %101, %99 ]
  %112 = phi i64 [ %109, %108 ], [ %100, %99 ]
  store i64 %storemerge117, ptr @r2, align 8, !tbaa !9
  %113 = sub nsw i64 %64, %112
  br label %.sink.split

114:                                              ; preds = %.lr.ph99
  %115 = icmp eq i64 %62, 1
  br i1 %115, label %116, label %122

116:                                              ; preds = %114
  %117 = add nsw i64 %67, 1
  %118 = getelementptr inbounds [2001000 x i32], ptr @di, i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %.not41 = icmp eq i32 %119, 0
  br i1 %.not41, label %165, label %120

120:                                              ; preds = %116
  %121 = add nsw i64 %64, -1
  br label %.sink.split

122:                                              ; preds = %114
  %123 = load i64, ptr @l1, align 8, !tbaa !9
  %.not33 = icmp slt i64 %123, %69
  %tot1.promoted72 = load i64, ptr @tot1, align 8, !tbaa !9
  br i1 %.not33, label %.lr.ph73, label %.lr.ph70

.lr.ph70:                                         ; preds = %122, %130
  %124 = phi i64 [ %132, %130 ], [ %123, %122 ]
  %125 = phi i64 [ %131, %130 ], [ %tot1.promoted72, %122 ]
  %126 = getelementptr inbounds [2001000 x i32], ptr @di, i64 0, i64 %124
  %127 = load i32, ptr %126, align 4, !tbaa !5
  %.not40 = icmp eq i32 %127, 0
  br i1 %.not40, label %130, label %128

128:                                              ; preds = %.lr.ph70
  %129 = add nsw i64 %125, 1
  store i64 %129, ptr @tot1, align 8, !tbaa !9
  br label %130

130:                                              ; preds = %128, %.lr.ph70
  %131 = phi i64 [ %129, %128 ], [ %125, %.lr.ph70 ]
  %132 = add nsw i64 %124, -2
  %.not35 = icmp slt i64 %132, %69
  br i1 %.not35, label %.loopexit65, label %.lr.ph70, !llvm.loop !18

.lr.ph73:                                         ; preds = %122, %139
  %133 = phi i64 [ %141, %139 ], [ %123, %122 ]
  %134 = phi i64 [ %140, %139 ], [ %tot1.promoted72, %122 ]
  %135 = getelementptr inbounds [2001000 x i32], ptr @di, i64 0, i64 %133
  %136 = load i32, ptr %135, align 4, !tbaa !5
  %.not34 = icmp eq i32 %136, 0
  br i1 %.not34, label %139, label %137

137:                                              ; preds = %.lr.ph73
  %138 = add nsw i64 %134, -1
  store i64 %138, ptr @tot1, align 8, !tbaa !9
  br label %139

139:                                              ; preds = %137, %.lr.ph73
  %140 = phi i64 [ %138, %137 ], [ %134, %.lr.ph73 ]
  %141 = add nsw i64 %133, 2
  %142 = icmp slt i64 %141, %69
  br i1 %142, label %.lr.ph73, label %.loopexit65, !llvm.loop !19

.loopexit65:                                      ; preds = %130, %139
  %storemerge = phi i64 [ %141, %139 ], [ %132, %130 ]
  %tot1.promoted80 = phi i64 [ %140, %139 ], [ %131, %130 ]
  store i64 %storemerge, ptr @l1, align 8, !tbaa !9
  %143 = load i64, ptr @r1, align 8, !tbaa !9
  %.not36 = icmp sgt i64 %143, %70
  br i1 %.not36, label %.lr.ph81, label %.lr.ph77

.lr.ph77:                                         ; preds = %.loopexit65, %150
  %144 = phi i64 [ %152, %150 ], [ %143, %.loopexit65 ]
  %145 = phi i64 [ %151, %150 ], [ %tot1.promoted80, %.loopexit65 ]
  %146 = getelementptr inbounds [2001000 x i32], ptr @di, i64 0, i64 %144
  %147 = load i32, ptr %146, align 4, !tbaa !5
  %.not39 = icmp eq i32 %147, 0
  br i1 %.not39, label %150, label %148

148:                                              ; preds = %.lr.ph77
  %149 = add nsw i64 %145, 1
  store i64 %149, ptr @tot1, align 8, !tbaa !9
  br label %150

150:                                              ; preds = %148, %.lr.ph77
  %151 = phi i64 [ %149, %148 ], [ %145, %.lr.ph77 ]
  %152 = add nsw i64 %144, 2
  %.not38 = icmp sgt i64 %152, %70
  br i1 %.not38, label %.loopexit61, label %.lr.ph77, !llvm.loop !20

.lr.ph81:                                         ; preds = %.loopexit65, %159
  %153 = phi i64 [ %161, %159 ], [ %143, %.loopexit65 ]
  %154 = phi i64 [ %160, %159 ], [ %tot1.promoted80, %.loopexit65 ]
  %155 = getelementptr inbounds [2001000 x i32], ptr @di, i64 0, i64 %153
  %156 = load i32, ptr %155, align 4, !tbaa !5
  %.not37 = icmp eq i32 %156, 0
  br i1 %.not37, label %159, label %157

157:                                              ; preds = %.lr.ph81
  %158 = add nsw i64 %154, -1
  store i64 %158, ptr @tot1, align 8, !tbaa !9
  br label %159

159:                                              ; preds = %157, %.lr.ph81
  %160 = phi i64 [ %158, %157 ], [ %154, %.lr.ph81 ]
  %161 = add nsw i64 %153, -2
  %162 = icmp sgt i64 %161, %70
  br i1 %162, label %.lr.ph81, label %.loopexit61, !llvm.loop !21

.loopexit61:                                      ; preds = %150, %159
  %storemerge115 = phi i64 [ %161, %159 ], [ %152, %150 ]
  %163 = phi i64 [ %160, %159 ], [ %151, %150 ]
  store i64 %storemerge115, ptr @r1, align 8, !tbaa !9
  %164 = sub nsw i64 %64, %163
  br label %.sink.split

.sink.split:                                      ; preds = %.loopexit, %120, %.loopexit61
  %.sink = phi i64 [ %164, %.loopexit61 ], [ %121, %120 ], [ %113, %.loopexit ]
  store i64 %.sink, ptr @cnt, align 8, !tbaa !9
  br label %165

165:                                              ; preds = %.sink.split, %116
  %166 = call ptr @_ZNSt23_Rb_tree_const_iteratorIxEppEi(ptr noundef nonnull align 8 dereferenceable(8) %4, i32 noundef 0) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %167 = call ptr @_ZNKSt3setIxSt4lessIxESaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @d1) #7
  store ptr %167, ptr %5, align 8
  %168 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIxES2_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  br i1 %168, label %.lr.ph99, label %._crit_edge100, !llvm.loop !22

._crit_edge104:                                   ; preds = %._crit_edge100, %0
  ret i32 0
}

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZSt3absx(i64 noundef) local_unnamed_addr #6

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertEOx(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5 align 2

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

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

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

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}


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