; LLVM IR from eyangch/competitive-programming :: Codeforces/1605 (e)

; 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::multiset" = 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 }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%class.anon = type { i8 }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@N = external dso_local global i64, align 8
@A = external dso_local global [200000 x i64], align 16
@B = external dso_local global [200000 x i64], align 16
@Q = external dso_local global i64, align 8
@X = external dso_local global [200000 x i64], align 16
@I = external dso_local global [200000 x i64], align 16
@sum = external dso_local global [200000 x i64], align 16
@calc = external dso_local global [200000 x i64], align 16
@res = external dso_local global [200000 x i64], align 16
@sw = external dso_local global %"class.std::multiset", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca %class.anon, align 1
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i64, 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
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %21 = alloca i64, align 8
  %22 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %23 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %24 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %25 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %26 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %27 = getelementptr i8, ptr %26, i64 -24
  %28 = load i64, ptr %27, align 8
  %29 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %28
  %30 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %29, ptr noundef null)
  %31 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  store i64 0, ptr %2, align 8, !tbaa !8
  br label %33

33:                                               ; preds = %42, %0
  %34 = load i64, ptr %2, align 8, !tbaa !8
  %35 = load i64, ptr @N, align 8, !tbaa !8
  %36 = icmp slt i64 %34, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %33
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  br label %45

38:                                               ; preds = %33
  %39 = load i64, ptr %2, align 8, !tbaa !8
  %40 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %39
  %41 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %40)
  br label %42

42:                                               ; preds = %38
  %43 = load i64, ptr %2, align 8, !tbaa !8
  %44 = add nsw i64 %43, 1
  store i64 %44, ptr %2, align 8, !tbaa !8
  br label %33, !llvm.loop !11

45:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  store i64 0, ptr %3, align 8, !tbaa !8
  br label %46

46:                                               ; preds = %55, %45
  %47 = load i64, ptr %3, align 8, !tbaa !8
  %48 = load i64, ptr @N, align 8, !tbaa !8
  %49 = icmp slt i64 %47, %48
  br i1 %49, label %51, label %50

50:                                               ; preds = %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  br label %58

51:                                               ; preds = %46
  %52 = load i64, ptr %3, align 8, !tbaa !8
  %53 = getelementptr inbounds [200000 x i64], ptr @B, i64 0, i64 %52
  %54 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %53)
  br label %55

55:                                               ; preds = %51
  %56 = load i64, ptr %3, align 8, !tbaa !8
  %57 = add nsw i64 %56, 1
  store i64 %57, ptr %3, align 8, !tbaa !8
  br label %46, !llvm.loop !13

58:                                               ; preds = %50
  %59 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @Q)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  store i64 0, ptr %4, align 8, !tbaa !8
  br label %60

60:                                               ; preds = %69, %58
  %61 = load i64, ptr %4, align 8, !tbaa !8
  %62 = load i64, ptr @Q, align 8, !tbaa !8
  %63 = icmp slt i64 %61, %62
  br i1 %63, label %65, label %64

64:                                               ; preds = %60
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  br label %72

65:                                               ; preds = %60
  %66 = load i64, ptr %4, align 8, !tbaa !8
  %67 = getelementptr inbounds [200000 x i64], ptr @X, i64 0, i64 %66
  %68 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %67)
  br label %69

69:                                               ; preds = %65
  %70 = load i64, ptr %4, align 8, !tbaa !8
  %71 = add nsw i64 %70, 1
  store i64 %71, ptr %4, align 8, !tbaa !8
  br label %60, !llvm.loop !14

72:                                               ; preds = %64
  %73 = load i64, ptr @Q, align 8, !tbaa !8
  %74 = getelementptr inbounds i64, ptr @I, i64 %73
  call void @_ZSt4iotaIPxiEvT_S1_T0_(ptr noundef @I, ptr noundef %74, i32 noundef 0)
  %75 = load i64, ptr @Q, align 8, !tbaa !8
  %76 = getelementptr inbounds i64, ptr @I, i64 %75
  call void @"_ZSt4sortIPxZ4mainE3$_0EvT_S2_T0_"(ptr noundef @I, ptr noundef %76)
  store i64 0, ptr @B, align 16, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  store i64 0, ptr %6, align 8, !tbaa !8
  br label %77

77:                                               ; preds = %90, %72
  %78 = load i64, ptr %6, align 8, !tbaa !8
  %79 = load i64, ptr @N, align 8, !tbaa !8
  %80 = icmp slt i64 %78, %79
  br i1 %80, label %82, label %81

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

82:                                               ; preds = %77
  %83 = load i64, ptr %6, align 8, !tbaa !8
  %84 = getelementptr inbounds [200000 x i64], ptr @B, i64 0, i64 %83
  %85 = load i64, ptr %84, align 8, !tbaa !8
  %86 = load i64, ptr %6, align 8, !tbaa !8
  %87 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %86
  %88 = load i64, ptr %87, align 8, !tbaa !8
  %89 = sub nsw i64 %88, %85
  store i64 %89, ptr %87, align 8, !tbaa !8
  br label %90

90:                                               ; preds = %82
  %91 = load i64, ptr %6, align 8, !tbaa !8
  %92 = add nsw i64 %91, 1
  store i64 %92, ptr %6, align 8, !tbaa !8
  br label %77, !llvm.loop !15

93:                                               ; preds = %81
  store i64 1, ptr @sum, align 16, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  store i64 1, ptr %7, align 8, !tbaa !8
  br label %94

94:                                               ; preds = %122, %93
  %95 = load i64, ptr %7, align 8, !tbaa !8
  %96 = load i64, ptr @N, align 8, !tbaa !8
  %97 = icmp sle i64 %95, %96
  br i1 %97, label %99, label %98

98:                                               ; preds = %94
  store i32 14, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  br label %125

99:                                               ; preds = %94
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %100 = load i64, ptr %7, align 8, !tbaa !8
  %101 = mul nsw i64 2, %100
  store i64 %101, ptr %9, align 8, !tbaa !8
  br label %102

102:                                              ; preds = %117, %99
  %103 = load i64, ptr %9, align 8, !tbaa !8
  %104 = load i64, ptr @N, align 8, !tbaa !8
  %105 = icmp sle i64 %103, %104
  br i1 %105, label %107, label %106

106:                                              ; preds = %102
  store i32 17, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  br label %121

107:                                              ; preds = %102
  %108 = load i64, ptr %7, align 8, !tbaa !8
  %109 = sub nsw i64 %108, 1
  %110 = getelementptr inbounds [200000 x i64], ptr @sum, i64 0, i64 %109
  %111 = load i64, ptr %110, align 8, !tbaa !8
  %112 = load i64, ptr %9, align 8, !tbaa !8
  %113 = sub nsw i64 %112, 1
  %114 = getelementptr inbounds [200000 x i64], ptr @sum, i64 0, i64 %113
  %115 = load i64, ptr %114, align 8, !tbaa !8
  %116 = sub nsw i64 %115, %111
  store i64 %116, ptr %114, align 8, !tbaa !8
  br label %117

117:                                              ; preds = %107
  %118 = load i64, ptr %7, align 8, !tbaa !8
  %119 = load i64, ptr %9, align 8, !tbaa !8
  %120 = add nsw i64 %119, %118
  store i64 %120, ptr %9, align 8, !tbaa !8
  br label %102, !llvm.loop !16

121:                                              ; preds = %106
  br label %122

122:                                              ; preds = %121
  %123 = load i64, ptr %7, align 8, !tbaa !8
  %124 = add nsw i64 %123, 1
  store i64 %124, ptr %7, align 8, !tbaa !8
  br label %94, !llvm.loop !17

125:                                              ; preds = %98
  %126 = load i64, ptr @N, align 8, !tbaa !8
  %127 = getelementptr inbounds i64, ptr @A, i64 %126
  %128 = call noundef ptr @_ZSt4copyIPxS0_ET0_T_S2_S1_(ptr noundef @A, ptr noundef %127, ptr noundef @calc)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  store i64 1, ptr %10, align 8, !tbaa !8
  br label %129

129:                                              ; preds = %157, %125
  %130 = load i64, ptr %10, align 8, !tbaa !8
  %131 = load i64, ptr @N, align 8, !tbaa !8
  %132 = icmp sle i64 %130, %131
  br i1 %132, label %134, label %133

133:                                              ; preds = %129
  store i32 20, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %160

134:                                              ; preds = %129
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %135 = load i64, ptr %10, align 8, !tbaa !8
  %136 = mul nsw i64 2, %135
  store i64 %136, ptr %11, align 8, !tbaa !8
  br label %137

137:                                              ; preds = %152, %134
  %138 = load i64, ptr %11, align 8, !tbaa !8
  %139 = load i64, ptr @N, align 8, !tbaa !8
  %140 = icmp sle i64 %138, %139
  br i1 %140, label %142, label %141

141:                                              ; preds = %137
  store i32 23, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br label %156

142:                                              ; preds = %137
  %143 = load i64, ptr %10, align 8, !tbaa !8
  %144 = sub nsw i64 %143, 1
  %145 = getelementptr inbounds [200000 x i64], ptr @calc, i64 0, i64 %144
  %146 = load i64, ptr %145, align 8, !tbaa !8
  %147 = load i64, ptr %11, align 8, !tbaa !8
  %148 = sub nsw i64 %147, 1
  %149 = getelementptr inbounds [200000 x i64], ptr @calc, i64 0, i64 %148
  %150 = load i64, ptr %149, align 8, !tbaa !8
  %151 = sub nsw i64 %150, %146
  store i64 %151, ptr %149, align 8, !tbaa !8
  br label %152

152:                                              ; preds = %142
  %153 = load i64, ptr %10, align 8, !tbaa !8
  %154 = load i64, ptr %11, align 8, !tbaa !8
  %155 = add nsw i64 %154, %153
  store i64 %155, ptr %11, align 8, !tbaa !8
  br label %137, !llvm.loop !18

156:                                              ; preds = %141
  br label %157

157:                                              ; preds = %156
  %158 = load i64, ptr %10, align 8, !tbaa !8
  %159 = add nsw i64 %158, 1
  store i64 %159, ptr %10, align 8, !tbaa !8
  br label %129, !llvm.loop !19

160:                                              ; preds = %133
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  store i64 0, ptr %12, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  store i64 0, ptr %13, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  store i64 0, ptr %14, align 8, !tbaa !8
  br label %161

161:                                              ; preds = %215, %160
  %162 = load i64, ptr %14, align 8, !tbaa !8
  %163 = load i64, ptr @N, align 8, !tbaa !8
  %164 = icmp slt i64 %162, %163
  br i1 %164, label %166, label %165

165:                                              ; preds = %161
  store i32 26, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  br label %218

166:                                              ; preds = %161
  %167 = load i64, ptr %14, align 8, !tbaa !8
  %168 = getelementptr inbounds [200000 x i64], ptr @sum, i64 0, i64 %167
  %169 = load i64, ptr %168, align 8, !tbaa !8
  %170 = icmp eq i64 %169, -1
  br i1 %170, label %171, label %178

171:                                              ; preds = %166
  %172 = load i64, ptr %14, align 8, !tbaa !8
  %173 = getelementptr inbounds [200000 x i64], ptr @calc, i64 0, i64 %172
  %174 = load i64, ptr %173, align 8, !tbaa !8
  %175 = sub nsw i64 0, %174
  %176 = load i64, ptr %14, align 8, !tbaa !8
  %177 = getelementptr inbounds [200000 x i64], ptr @calc, i64 0, i64 %176
  store i64 %175, ptr %177, align 8, !tbaa !8
  br label %178

178:                                              ; preds = %171, %166
  %179 = load i64, ptr %14, align 8, !tbaa !8
  %180 = getelementptr inbounds [200000 x i64], ptr @sum, i64 0, i64 %179
  %181 = load i64, ptr %180, align 8, !tbaa !8
  %182 = icmp ne i64 %181, 0
  br i1 %182, label %183, label %191

183:                                              ; preds = %178
  %184 = load i64, ptr %14, align 8, !tbaa !8
  %185 = getelementptr inbounds [200000 x i64], ptr @calc, i64 0, i64 %184
  %186 = load i64, ptr %185, align 8, !tbaa !8
  %187 = icmp slt i64 %186, 0
  br i1 %187, label %188, label %191

188:                                              ; preds = %183
  %189 = load i64, ptr %13, align 8, !tbaa !8
  %190 = add nsw i64 %189, 1
  store i64 %190, ptr %13, align 8, !tbaa !8
  br label %191

191:                                              ; preds = %188, %183, %178
  %192 = load i64, ptr %14, align 8, !tbaa !8
  %193 = getelementptr inbounds [200000 x i64], ptr @sum, i64 0, i64 %192
  %194 = load i64, ptr %193, align 8, !tbaa !8
  %195 = icmp ne i64 %194, 0
  br i1 %195, label %196, label %208

196:                                              ; preds = %191
  %197 = load i64, ptr %14, align 8, !tbaa !8
  %198 = getelementptr inbounds [200000 x i64], ptr @calc, i64 0, i64 %197
  %199 = load i64, ptr %198, align 8, !tbaa !8
  %200 = icmp sge i64 %199, 0
  br i1 %200, label %201, label %208

201:                                              ; preds = %196
  %202 = load i64, ptr %14, align 8, !tbaa !8
  %203 = getelementptr inbounds [200000 x i64], ptr @calc, i64 0, i64 %202
  %204 = call ptr @_ZNSt8multisetIxSt4lessIxESaIxEE6insertERKx(ptr noundef nonnull align 8 dereferenceable(48) @sw, ptr noundef nonnull align 8 dereferenceable(8) %203)
  %205 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %15, i32 0, i32 0
  store ptr %204, ptr %205, align 8
  %206 = load i64, ptr %13, align 8, !tbaa !8
  %207 = add nsw i64 %206, -1
  store i64 %207, ptr %13, align 8, !tbaa !8
  br label %208

208:                                              ; preds = %201, %196, %191
  %209 = load i64, ptr %14, align 8, !tbaa !8
  %210 = getelementptr inbounds [200000 x i64], ptr @calc, i64 0, i64 %209
  %211 = load i64, ptr %210, align 8, !tbaa !8
  %212 = call noundef i64 @_ZSt3absx(i64 noundef %211)
  %213 = load i64, ptr %12, align 8, !tbaa !8
  %214 = add nsw i64 %213, %212
  store i64 %214, ptr %12, align 8, !tbaa !8
  br label %215

215:                                              ; preds = %208
  %216 = load i64, ptr %14, align 8, !tbaa !8
  %217 = add nsw i64 %216, 1
  store i64 %217, ptr %14, align 8, !tbaa !8
  br label %161, !llvm.loop !20

218:                                              ; preds = %165
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  store i64 0, ptr %16, align 8, !tbaa !8
  br label %219

219:                                              ; preds = %283, %218
  %220 = load i64, ptr %16, align 8, !tbaa !8
  %221 = load i64, ptr @Q, align 8, !tbaa !8
  %222 = icmp slt i64 %220, %221
  br i1 %222, label %224, label %223

223:                                              ; preds = %219
  store i32 29, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  br label %286

224:                                              ; preds = %219
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %225 = load i64, ptr %16, align 8, !tbaa !8
  %226 = getelementptr inbounds [200000 x i64], ptr @I, i64 0, i64 %225
  %227 = load i64, ptr %226, align 8, !tbaa !8
  store i64 %227, ptr %17, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %228 = load i64, ptr %17, align 8, !tbaa !8
  %229 = getelementptr inbounds [200000 x i64], ptr @X, i64 0, i64 %228
  %230 = load i64, ptr %229, align 8, !tbaa !8
  store i64 %230, ptr %18, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  store i64 0, ptr %19, align 8, !tbaa !8
  %231 = load i64, ptr %16, align 8, !tbaa !8
  %232 = icmp sgt i64 %231, 0
  br i1 %232, label %233, label %240

233:                                              ; preds = %224
  %234 = load i64, ptr %16, align 8, !tbaa !8
  %235 = sub nsw i64 %234, 1
  %236 = getelementptr inbounds [200000 x i64], ptr @I, i64 0, i64 %235
  %237 = load i64, ptr %236, align 8, !tbaa !8
  %238 = getelementptr inbounds [200000 x i64], ptr @X, i64 0, i64 %237
  %239 = load i64, ptr %238, align 8, !tbaa !8
  store i64 %239, ptr %19, align 8, !tbaa !8
  br label %240

240:                                              ; preds = %233, %224
  br label %241

241:                                              ; preds = %253, %240
  %242 = call noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) @sw) #7
  %243 = icmp ne i64 %242, 0
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  br i1 %243, label %244, label %251

244:                                              ; preds = %241
  %245 = call ptr @_ZNKSt8multisetIxSt4lessIxESaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @sw) #7
  %246 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %20, i32 0, i32 0
  store ptr %245, ptr %246, align 8
  %247 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorIxEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %20) #7
  %248 = load i64, ptr %247, align 8, !tbaa !8
  %249 = load i64, ptr %18, align 8, !tbaa !8
  %250 = icmp sle i64 %248, %249
  br label %251

251:                                              ; preds = %244, %241
  %252 = phi i1 [ false, %241 ], [ %250, %244 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  br i1 %252, label %253, label %272

253:                                              ; preds = %251
  %254 = load i64, ptr %13, align 8, !tbaa !8
  %255 = add nsw i64 %254, 2
  store i64 %255, ptr %13, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  %256 = call ptr @_ZNKSt8multisetIxSt4lessIxESaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @sw) #7
  %257 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %22, i32 0, i32 0
  store ptr %256, ptr %257, align 8
  %258 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorIxEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %22) #7
  %259 = load i64, ptr %258, align 8, !tbaa !8
  %260 = load i64, ptr %19, align 8, !tbaa !8
  %261 = sub nsw i64 %259, %260
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  store i64 %261, ptr %21, align 8, !tbaa !8
  %262 = load i64, ptr %21, align 8, !tbaa !8
  %263 = mul nsw i64 2, %262
  %264 = load i64, ptr %12, align 8, !tbaa !8
  %265 = sub nsw i64 %264, %263
  store i64 %265, ptr %12, align 8, !tbaa !8
  %266 = call ptr @_ZNKSt8multisetIxSt4lessIxESaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @sw) #7
  %267 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %23, i32 0, i32 0
  store ptr %266, ptr %267, align 8
  %268 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %23, i32 0, i32 0
  %269 = load ptr, ptr %268, align 8
  %270 = call ptr @_ZNSt8multisetIxSt4lessIxESaIxEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIxE(ptr noundef nonnull align 8 dereferenceable(48) @sw, ptr %269)
  %271 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %24, i32 0, i32 0
  store ptr %270, ptr %271, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  br label %241, !llvm.loop !21

272:                                              ; preds = %251
  %273 = load i64, ptr %13, align 8, !tbaa !8
  %274 = load i64, ptr %18, align 8, !tbaa !8
  %275 = load i64, ptr %19, align 8, !tbaa !8
  %276 = sub nsw i64 %274, %275
  %277 = mul nsw i64 %273, %276
  %278 = load i64, ptr %12, align 8, !tbaa !8
  %279 = add nsw i64 %278, %277
  store i64 %279, ptr %12, align 8, !tbaa !8
  %280 = load i64, ptr %12, align 8, !tbaa !8
  %281 = load i64, ptr %17, align 8, !tbaa !8
  %282 = getelementptr inbounds [200000 x i64], ptr @res, i64 0, i64 %281
  store i64 %280, ptr %282, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  br label %283

283:                                              ; preds = %272
  %284 = load i64, ptr %16, align 8, !tbaa !8
  %285 = add nsw i64 %284, 1
  store i64 %285, ptr %16, align 8, !tbaa !8
  br label %219, !llvm.loop !22

286:                                              ; preds = %223
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #7
  store i64 0, ptr %25, align 8, !tbaa !8
  br label %287

287:                                              ; preds = %298, %286
  %288 = load i64, ptr %25, align 8, !tbaa !8
  %289 = load i64, ptr @Q, align 8, !tbaa !8
  %290 = icmp slt i64 %288, %289
  br i1 %290, label %292, label %291

291:                                              ; preds = %287
  store i32 34, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #7
  br label %301

292:                                              ; preds = %287
  %293 = load i64, ptr %25, align 8, !tbaa !8
  %294 = getelementptr inbounds [200000 x i64], ptr @res, i64 0, i64 %293
  %295 = load i64, ptr %294, align 8, !tbaa !8
  %296 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %295)
  %297 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %296, i8 noundef signext 10)
  br label %298

298:                                              ; preds = %292
  %299 = load i64, ptr %25, align 8, !tbaa !8
  %300 = add nsw i64 %299, 1
  store i64 %300, ptr %25, align 8, !tbaa !8
  br label %287, !llvm.loop !23

301:                                              ; preds = %291
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  %302 = load i32, ptr %1, align 4
  ret i32 %302
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #1 align 2

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZSt4iotaIPxiEvT_S1_T0_(ptr noundef, ptr noundef, i32 noundef) #1

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIPxZ4mainE3$_0EvT_S2_T0_"(ptr noundef, ptr noundef) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt4copyIPxS0_ET0_T_S2_S1_(ptr noundef, ptr noundef, ptr noundef) #5

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNKSt8multisetIxSt4lessIxESaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48)) #1 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)) #1 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #3 align 2

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 = { 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 #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !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}
!23 = distinct !{!23, !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::multiset" = 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 }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@N = external dso_local global i64, align 8
@A = external dso_local global [200000 x i64], align 16
@B = external dso_local global [200000 x i64], align 16
@Q = external dso_local global i64, align 8
@X = external dso_local global [200000 x i64], align 16
@I = external dso_local global [200000 x i64], align 16
@sum = external dso_local local_unnamed_addr global [200000 x i64], align 16
@calc = external dso_local global [200000 x i64], align 16
@res = external dso_local local_unnamed_addr global [200000 x i64], align 16
@sw = external dso_local global %"class.std::multiset", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %2 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %3 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %4 = getelementptr i8, ptr %3, i64 -24
  %5 = load i64, ptr %4, align 8
  %6 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %5
  %7 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %6, ptr noundef null)
  %8 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %9 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %10 = load i64, ptr @N, align 8, !tbaa !8
  %11 = icmp sgt i64 %10, 0
  br i1 %11, label %.lr.ph, label %._crit_edge

.preheader104:                                    ; preds = %.lr.ph
  %12 = icmp sgt i64 %16, 0
  br i1 %12, label %.lr.ph112, label %._crit_edge

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.066110 = phi i64 [ %15, %.lr.ph ], [ 0, %0 ]
  %13 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %.066110
  %14 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %13)
  %15 = add nuw nsw i64 %.066110, 1
  %16 = load i64, ptr @N, align 8, !tbaa !8
  %17 = icmp slt i64 %15, %16
  br i1 %17, label %.lr.ph, label %.preheader104, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph112, %0, %.preheader104
  %18 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @Q)
  %19 = load i64, ptr @Q, align 8, !tbaa !8
  %20 = icmp sgt i64 %19, 0
  br i1 %20, label %.lr.ph115, label %._crit_edge116

.lr.ph112:                                        ; preds = %.preheader104, %.lr.ph112
  %.067111 = phi i64 [ %23, %.lr.ph112 ], [ 0, %.preheader104 ]
  %21 = getelementptr inbounds [200000 x i64], ptr @B, i64 0, i64 %.067111
  %22 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %21)
  %23 = add nuw nsw i64 %.067111, 1
  %24 = load i64, ptr @N, align 8, !tbaa !8
  %25 = icmp slt i64 %23, %24
  br i1 %25, label %.lr.ph112, label %._crit_edge, !llvm.loop !13

._crit_edge116:                                   ; preds = %.lr.ph115, %._crit_edge
  %.lcssa109 = phi i64 [ %19, %._crit_edge ], [ %41, %.lr.ph115 ]
  %26 = getelementptr inbounds i64, ptr @I, i64 %.lcssa109
  tail call void @_ZSt4iotaIPxiEvT_S1_T0_(ptr noundef nonnull @I, ptr noundef nonnull %26, i32 noundef 0)
  %27 = load i64, ptr @Q, align 8, !tbaa !8
  %28 = getelementptr inbounds i64, ptr @I, i64 %27
  tail call void @"_ZSt4sortIPxZ4mainE3$_0EvT_S2_T0_"(ptr noundef nonnull @I, ptr noundef nonnull %28)
  store i64 0, ptr @B, align 16, !tbaa !8
  %29 = load i64, ptr @N, align 8, !tbaa !8
  %30 = icmp sgt i64 %29, 0
  br i1 %30, label %.lr.ph119.preheader, label %._crit_edge120.thread

.lr.ph119.preheader:                              ; preds = %._crit_edge116
  %min.iters.check = icmp ult i64 %29, 4
  br i1 %min.iters.check, label %.lr.ph119.preheader191, label %vector.ph

.lr.ph119.preheader191:                           ; preds = %middle.block, %.lr.ph119.preheader
  %.070117.ph = phi i64 [ 0, %.lr.ph119.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph119

vector.ph:                                        ; preds = %.lr.ph119.preheader
  %n.vec = and i64 %29, 9223372036854775804
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %31 = getelementptr inbounds [200000 x i64], ptr @B, i64 0, i64 %index
  %32 = getelementptr inbounds i8, ptr %31, i64 16
  %wide.load = load <2 x i64>, ptr %31, align 16, !tbaa !8
  %wide.load183 = load <2 x i64>, ptr %32, align 16, !tbaa !8
  %33 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %index
  %34 = getelementptr inbounds i8, ptr %33, i64 16
  %wide.load184 = load <2 x i64>, ptr %33, align 16, !tbaa !8
  %wide.load185 = load <2 x i64>, ptr %34, align 16, !tbaa !8
  %35 = sub nsw <2 x i64> %wide.load184, %wide.load
  %36 = sub nsw <2 x i64> %wide.load185, %wide.load183
  store <2 x i64> %35, ptr %33, align 16, !tbaa !8
  store <2 x i64> %36, ptr %34, align 16, !tbaa !8
  %index.next = add nuw i64 %index, 4
  %37 = icmp eq i64 %index.next, %n.vec
  br i1 %37, label %middle.block, label %vector.body, !llvm.loop !14

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %29, %n.vec
  br i1 %cmp.n, label %._crit_edge120, label %.lr.ph119.preheader191

._crit_edge120.thread:                            ; preds = %._crit_edge116
  store i64 1, ptr @sum, align 16, !tbaa !8
  br label %._crit_edge131

.lr.ph115:                                        ; preds = %._crit_edge, %.lr.ph115
  %.068113 = phi i64 [ %40, %.lr.ph115 ], [ 0, %._crit_edge ]
  %38 = getelementptr inbounds [200000 x i64], ptr @X, i64 0, i64 %.068113
  %39 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %38)
  %40 = add nuw nsw i64 %.068113, 1
  %41 = load i64, ptr @Q, align 8, !tbaa !8
  %42 = icmp slt i64 %40, %41
  br i1 %42, label %.lr.ph115, label %._crit_edge116, !llvm.loop !17

._crit_edge120:                                   ; preds = %.lr.ph119, %middle.block
  store i64 1, ptr @sum, align 16, !tbaa !8
  br label %.lr.ph130

.lr.ph119:                                        ; preds = %.lr.ph119.preheader191, %.lr.ph119
  %.070117 = phi i64 [ %48, %.lr.ph119 ], [ %.070117.ph, %.lr.ph119.preheader191 ]
  %43 = getelementptr inbounds [200000 x i64], ptr @B, i64 0, i64 %.070117
  %44 = load i64, ptr %43, align 8, !tbaa !8
  %45 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %.070117
  %46 = load i64, ptr %45, align 8, !tbaa !8
  %47 = sub nsw i64 %46, %44
  store i64 %47, ptr %45, align 8, !tbaa !8
  %48 = add nuw nsw i64 %.070117, 1
  %exitcond.not = icmp eq i64 %48, %29
  br i1 %exitcond.not, label %._crit_edge120, label %.lr.ph119, !llvm.loop !18

._crit_edge131:                                   ; preds = %._crit_edge126, %._crit_edge120.thread
  %49 = getelementptr inbounds i64, ptr @A, i64 %29
  %50 = tail call noundef ptr @_ZSt4copyIPxS0_ET0_T_S2_S1_(ptr noundef nonnull @A, ptr noundef nonnull %49, ptr noundef nonnull @calc)
  %51 = load i64, ptr @N, align 8, !tbaa !8
  %.not83137 = icmp slt i64 %51, 1
  br i1 %.not83137, label %.preheader102, label %.lr.ph140

.lr.ph130:                                        ; preds = %._crit_edge120, %._crit_edge126
  %.071128 = phi i64 [ %55, %._crit_edge126 ], [ 1, %._crit_edge120 ]
  %52 = shl nuw nsw i64 %.071128, 1
  %.not91122 = icmp sgt i64 %52, %29
  br i1 %.not91122, label %._crit_edge126, label %.lr.ph125

.lr.ph125:                                        ; preds = %.lr.ph130
  %53 = add nsw i64 %.071128, -1
  %54 = getelementptr inbounds [200000 x i64], ptr @sum, i64 0, i64 %53
  br label %56

._crit_edge126:                                   ; preds = %56, %.lr.ph130
  %55 = add nuw i64 %.071128, 1
  %exitcond166.not = icmp eq i64 %.071128, %29
  br i1 %exitcond166.not, label %._crit_edge131, label %.lr.ph130, !llvm.loop !19

56:                                               ; preds = %.lr.ph125, %56
  %.080123 = phi i64 [ %52, %.lr.ph125 ], [ %62, %56 ]
  %57 = load i64, ptr %54, align 8, !tbaa !8
  %58 = add nsw i64 %.080123, -1
  %59 = getelementptr inbounds [200000 x i64], ptr @sum, i64 0, i64 %58
  %60 = load i64, ptr %59, align 8, !tbaa !8
  %61 = sub nsw i64 %60, %57
  store i64 %61, ptr %59, align 8, !tbaa !8
  %62 = add nuw nsw i64 %.080123, %.071128
  %.not91 = icmp sgt i64 %62, %29
  br i1 %.not91, label %._crit_edge126, label %56, !llvm.loop !20

.lr.ph140:                                        ; preds = %._crit_edge131, %._crit_edge136
  %.079138 = phi i64 [ %66, %._crit_edge136 ], [ 1, %._crit_edge131 ]
  %63 = shl nuw nsw i64 %.079138, 1
  %.not90132 = icmp sgt i64 %63, %51
  br i1 %.not90132, label %._crit_edge136, label %.lr.ph135

.lr.ph135:                                        ; preds = %.lr.ph140
  %64 = add nsw i64 %.079138, -1
  %65 = getelementptr inbounds [200000 x i64], ptr @calc, i64 0, i64 %64
  br label %67

._crit_edge136:                                   ; preds = %67, %.lr.ph140
  %66 = add nuw i64 %.079138, 1
  %exitcond167.not = icmp eq i64 %.079138, %51
  br i1 %exitcond167.not, label %.lr.ph144, label %.lr.ph140, !llvm.loop !21

67:                                               ; preds = %.lr.ph135, %67
  %.078133 = phi i64 [ %63, %.lr.ph135 ], [ %73, %67 ]
  %68 = load i64, ptr %65, align 8, !tbaa !8
  %69 = add nsw i64 %.078133, -1
  %70 = getelementptr inbounds [200000 x i64], ptr @calc, i64 0, i64 %69
  %71 = load i64, ptr %70, align 8, !tbaa !8
  %72 = sub nsw i64 %71, %68
  store i64 %72, ptr %70, align 8, !tbaa !8
  %73 = add nuw nsw i64 %.078133, %.079138
  %.not90 = icmp sgt i64 %73, %51
  br i1 %.not90, label %._crit_edge136, label %67, !llvm.loop !22

.preheader102:                                    ; preds = %.thread95, %._crit_edge131
  %.075.lcssa = phi i64 [ 0, %._crit_edge131 ], [ %97, %.thread95 ]
  %.074.lcssa = phi i64 [ 0, %._crit_edge131 ], [ %.2, %.thread95 ]
  %74 = load i64, ptr @Q, align 8, !tbaa !8
  %75 = icmp sgt i64 %74, 0
  br i1 %75, label %.lr.ph157, label %._crit_edge160

.lr.ph144:                                        ; preds = %._crit_edge136, %.thread95
  %.073143 = phi i64 [ %98, %.thread95 ], [ 0, %._crit_edge136 ]
  %.074142 = phi i64 [ %.2, %.thread95 ], [ 0, %._crit_edge136 ]
  %.075141 = phi i64 [ %97, %.thread95 ], [ 0, %._crit_edge136 ]
  %76 = getelementptr inbounds [200000 x i64], ptr @sum, i64 0, i64 %.073143
  %77 = load i64, ptr %76, align 8, !tbaa !8
  switch i64 %77, label %.thread98 [
    i64 -1, label %81
    i64 0, label %.thread95
  ]

.thread98:                                        ; preds = %.lr.ph144
  %78 = getelementptr inbounds [200000 x i64], ptr @calc, i64 0, i64 %.073143
  %79 = load i64, ptr %78, align 8, !tbaa !8
  %80 = lshr i64 %79, 63
  br label %87

81:                                               ; preds = %.lr.ph144
  %82 = getelementptr inbounds [200000 x i64], ptr @calc, i64 0, i64 %.073143
  %83 = load i64, ptr %82, align 8, !tbaa !8
  %84 = sub nsw i64 0, %83
  store i64 %84, ptr %82, align 8, !tbaa !8
  %85 = icmp sgt i64 %83, 0
  %86 = zext i1 %85 to i64
  br label %87

87:                                               ; preds = %81, %.thread98
  %88 = phi i64 [ %79, %.thread98 ], [ %84, %81 ]
  %.pn = phi i64 [ %80, %.thread98 ], [ %86, %81 ]
  %spec.select101 = add i64 %.pn, %.074142
  %89 = icmp sgt i64 %88, -1
  br i1 %89, label %90, label %.thread95

90:                                               ; preds = %87
  %91 = getelementptr inbounds [200000 x i64], ptr @calc, i64 0, i64 %.073143
  %92 = tail call ptr @_ZNSt8multisetIxSt4lessIxESaIxEE6insertERKx(ptr noundef nonnull align 8 dereferenceable(48) @sw, ptr noundef nonnull align 8 dereferenceable(8) %91)
  %93 = add nsw i64 %spec.select101, -1
  br label %.thread95

.thread95:                                        ; preds = %.lr.ph144, %90, %87
  %.2 = phi i64 [ %93, %90 ], [ %spec.select101, %87 ], [ %.074142, %.lr.ph144 ]
  %94 = getelementptr inbounds [200000 x i64], ptr @calc, i64 0, i64 %.073143
  %95 = load i64, ptr %94, align 8, !tbaa !8
  %96 = tail call noundef i64 @_ZSt3absx(i64 noundef %95)
  %97 = add nsw i64 %96, %.075141
  %98 = add nuw nsw i64 %.073143, 1
  %99 = load i64, ptr @N, align 8, !tbaa !8
  %100 = icmp slt i64 %98, %99
  br i1 %100, label %.lr.ph144, label %.preheader102, !llvm.loop !23

.preheader:                                       ; preds = %.loopexit
  %101 = icmp sgt i64 %131, 0
  br i1 %101, label %.lr.ph159, label %._crit_edge160

.lr.ph157:                                        ; preds = %.preheader102, %.loopexit
  %.072156 = phi i64 [ %130, %.loopexit ], [ 0, %.preheader102 ]
  %.3155 = phi i64 [ %.4106, %.loopexit ], [ %.074.lcssa, %.preheader102 ]
  %.176154 = phi i64 [ %128, %.loopexit ], [ %.075.lcssa, %.preheader102 ]
  %102 = getelementptr inbounds [200000 x i64], ptr @I, i64 0, i64 %.072156
  %103 = load i64, ptr %102, align 8, !tbaa !8
  %104 = getelementptr inbounds [200000 x i64], ptr @X, i64 0, i64 %103
  %105 = load i64, ptr %104, align 8, !tbaa !8
  %.not84 = icmp eq i64 %.072156, 0
  br i1 %.not84, label %112, label %106

106:                                              ; preds = %.lr.ph157
  %107 = add nsw i64 %.072156, -1
  %108 = getelementptr inbounds [200000 x i64], ptr @I, i64 0, i64 %107
  %109 = load i64, ptr %108, align 8, !tbaa !8
  %110 = getelementptr inbounds [200000 x i64], ptr @X, i64 0, i64 %109
  %111 = load i64, ptr %110, align 8, !tbaa !8
  br label %112

112:                                              ; preds = %106, %.lr.ph157
  %.069 = phi i64 [ %111, %106 ], [ 0, %.lr.ph157 ]
  %113 = call noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) @sw) #7
  %.not85147 = icmp eq i64 %113, 0
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  br i1 %.not85147, label %.critedge, label %.lr.ph151

.lr.ph151:                                        ; preds = %112, %117
  %.4149 = phi i64 [ %118, %117 ], [ %.3155, %112 ]
  %.277148 = phi i64 [ %122, %117 ], [ %.176154, %112 ]
  %114 = call ptr @_ZNKSt8multisetIxSt4lessIxESaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @sw) #7
  store ptr %114, ptr %1, align 8
  %115 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorIxEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %1) #7
  %116 = load i64, ptr %115, align 8, !tbaa !8
  %.not86 = icmp sgt i64 %116, %105
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  br i1 %.not86, label %.loopexit, label %117

117:                                              ; preds = %.lr.ph151
  %118 = add nsw i64 %.4149, 2
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  %119 = call ptr @_ZNKSt8multisetIxSt4lessIxESaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @sw) #7
  store ptr %119, ptr %2, align 8
  %120 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorIxEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #7
  %121 = load i64, ptr %120, align 8, !tbaa !8
  %.neg = sub i64 %.069, %121
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  %.neg87 = shl i64 %.neg, 1
  %122 = add i64 %.neg87, %.277148
  %123 = call ptr @_ZNKSt8multisetIxSt4lessIxESaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @sw) #7
  %124 = call ptr @_ZNSt8multisetIxSt4lessIxESaIxEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIxE(ptr noundef nonnull align 8 dereferenceable(48) @sw, ptr %123)
  %125 = call noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) @sw) #7
  %.not85 = icmp eq i64 %125, 0
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  br i1 %.not85, label %.critedge, label %.lr.ph151, !llvm.loop !24

.critedge:                                        ; preds = %117, %112
  %.277.lcssa = phi i64 [ %.176154, %112 ], [ %122, %117 ]
  %.4.lcssa = phi i64 [ %.3155, %112 ], [ %118, %117 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph151, %.critedge
  %.277108 = phi i64 [ %.277.lcssa, %.critedge ], [ %.277148, %.lr.ph151 ]
  %.4106 = phi i64 [ %.4.lcssa, %.critedge ], [ %.4149, %.lr.ph151 ]
  %126 = sub nsw i64 %105, %.069
  %127 = mul nsw i64 %.4106, %126
  %128 = add nsw i64 %127, %.277108
  %129 = getelementptr inbounds [200000 x i64], ptr @res, i64 0, i64 %103
  store i64 %128, ptr %129, align 8, !tbaa !8
  %130 = add nuw nsw i64 %.072156, 1
  %131 = load i64, ptr @Q, align 8, !tbaa !8
  %132 = icmp slt i64 %130, %131
  br i1 %132, label %.lr.ph157, label %.preheader, !llvm.loop !25

._crit_edge160:                                   ; preds = %.lr.ph159, %.preheader102, %.preheader
  ret i32 0

.lr.ph159:                                        ; preds = %.preheader, %.lr.ph159
  %.0158 = phi i64 [ %137, %.lr.ph159 ], [ 0, %.preheader ]
  %133 = getelementptr inbounds [200000 x i64], ptr @res, i64 0, i64 %.0158
  %134 = load i64, ptr %133, align 8, !tbaa !8
  %135 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %134)
  %136 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %135, i8 noundef signext 10)
  %137 = add nuw nsw i64 %.0158, 1
  %138 = load i64, ptr @Q, align 8, !tbaa !8
  %139 = icmp slt i64 %137, %138
  br i1 %139, label %.lr.ph159, label %._crit_edge160, !llvm.loop !26
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #1 align 2

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZSt4iotaIPxiEvT_S1_T0_(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIPxZ4mainE3$_0EvT_S2_T0_"(ptr noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt4copyIPxS0_ET0_T_S2_S1_(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #5

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNKSt8multisetIxSt4lessIxESaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #1 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 #1 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #3 align 2

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 = { 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 #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12, !15, !16}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12, !16, !15}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !12}
!24 = distinct !{!24, !12}
!25 = distinct !{!25, !12}
!26 = distinct !{!26, !12}


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