; LLVM IR from eyangch/competitive-programming :: Codeforces/1144 (g)

; 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::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" }

@N = external dso_local global i64, align 8
@a = external dso_local global [200000 x i64], align 16
@dp = external dso_local global [200000 x [2 x i64]], align 16
@p = external dso_local global [200000 x [2 x i64]], align 16
@ans = external dso_local global [200000 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress 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 i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %8 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %9 = getelementptr i8, ptr %8, i64 -24
  %10 = load i64, ptr %9, align 8
  %11 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %10
  %12 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %11, ptr noundef null)
  %13 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %14 = 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) #6
  store i64 0, ptr %2, align 8, !tbaa !8
  br label %15

15:                                               ; preds = %24, %0
  %16 = load i64, ptr %2, align 8, !tbaa !8
  %17 = load i64, ptr @N, align 8, !tbaa !8
  %18 = icmp slt i64 %16, %17
  br i1 %18, label %20, label %19

19:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  br label %27

20:                                               ; preds = %15
  %21 = load i64, ptr %2, align 8, !tbaa !8
  %22 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %21
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %22)
  br label %24

24:                                               ; preds = %20
  %25 = load i64, ptr %2, align 8, !tbaa !8
  %26 = add nsw i64 %25, 1
  store i64 %26, ptr %2, align 8, !tbaa !8
  br label %15, !llvm.loop !11

27:                                               ; preds = %19
  store i64 1000000000, ptr @dp, align 16, !tbaa !8
  store i64 -1, ptr getelementptr inbounds ([2 x i64], ptr @dp, i64 0, i64 1), align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  store i64 1, ptr %3, align 8, !tbaa !8
  br label %28

28:                                               ; preds = %144, %27
  %29 = load i64, ptr %3, align 8, !tbaa !8
  %30 = load i64, ptr @N, align 8, !tbaa !8
  %31 = icmp slt i64 %29, %30
  br i1 %31, label %33, label %32

32:                                               ; preds = %28
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  br label %147

33:                                               ; preds = %28
  %34 = load i64, ptr %3, align 8, !tbaa !8
  %35 = getelementptr inbounds [200000 x [2 x i64]], ptr @dp, i64 0, i64 %34
  %36 = getelementptr inbounds [2 x i64], ptr %35, i64 0, i64 0
  store i64 -1, ptr %36, align 16, !tbaa !8
  %37 = load i64, ptr %3, align 8, !tbaa !8
  %38 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %37
  %39 = load i64, ptr %38, align 8, !tbaa !8
  %40 = load i64, ptr %3, align 8, !tbaa !8
  %41 = sub nsw i64 %40, 1
  %42 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %41
  %43 = load i64, ptr %42, align 8, !tbaa !8
  %44 = icmp sgt i64 %39, %43
  br i1 %44, label %45, label %57

45:                                               ; preds = %33
  %46 = load i64, ptr %3, align 8, !tbaa !8
  %47 = sub nsw i64 %46, 1
  %48 = getelementptr inbounds [200000 x [2 x i64]], ptr @dp, i64 0, i64 %47
  %49 = getelementptr inbounds [2 x i64], ptr %48, i64 0, i64 0
  %50 = load i64, ptr %49, align 16, !tbaa !8
  %51 = load i64, ptr %3, align 8, !tbaa !8
  %52 = getelementptr inbounds [200000 x [2 x i64]], ptr @dp, i64 0, i64 %51
  %53 = getelementptr inbounds [2 x i64], ptr %52, i64 0, i64 0
  store i64 %50, ptr %53, align 16, !tbaa !8
  %54 = load i64, ptr %3, align 8, !tbaa !8
  %55 = getelementptr inbounds [200000 x [2 x i64]], ptr @p, i64 0, i64 %54
  %56 = getelementptr inbounds [2 x i64], ptr %55, i64 0, i64 0
  store i64 0, ptr %56, align 16, !tbaa !8
  br label %57

57:                                               ; preds = %45, %33
  %58 = load i64, ptr %3, align 8, !tbaa !8
  %59 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %58
  %60 = load i64, ptr %59, align 8, !tbaa !8
  %61 = load i64, ptr %3, align 8, !tbaa !8
  %62 = sub nsw i64 %61, 1
  %63 = getelementptr inbounds [200000 x [2 x i64]], ptr @dp, i64 0, i64 %62
  %64 = getelementptr inbounds [2 x i64], ptr %63, i64 0, i64 1
  %65 = load i64, ptr %64, align 8, !tbaa !8
  %66 = icmp sgt i64 %60, %65
  br i1 %66, label %67, label %88

67:                                               ; preds = %57
  %68 = load i64, ptr %3, align 8, !tbaa !8
  %69 = sub nsw i64 %68, 1
  %70 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %69
  %71 = load i64, ptr %70, align 8, !tbaa !8
  %72 = load i64, ptr %3, align 8, !tbaa !8
  %73 = getelementptr inbounds [200000 x [2 x i64]], ptr @dp, i64 0, i64 %72
  %74 = getelementptr inbounds [2 x i64], ptr %73, i64 0, i64 0
  %75 = load i64, ptr %74, align 16, !tbaa !8
  %76 = icmp sgt i64 %71, %75
  br i1 %76, label %77, label %88

77:                                               ; preds = %67
  %78 = load i64, ptr %3, align 8, !tbaa !8
  %79 = sub nsw i64 %78, 1
  %80 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %79
  %81 = load i64, ptr %80, align 8, !tbaa !8
  %82 = load i64, ptr %3, align 8, !tbaa !8
  %83 = getelementptr inbounds [200000 x [2 x i64]], ptr @dp, i64 0, i64 %82
  %84 = getelementptr inbounds [2 x i64], ptr %83, i64 0, i64 0
  store i64 %81, ptr %84, align 16, !tbaa !8
  %85 = load i64, ptr %3, align 8, !tbaa !8
  %86 = getelementptr inbounds [200000 x [2 x i64]], ptr @p, i64 0, i64 %85
  %87 = getelementptr inbounds [2 x i64], ptr %86, i64 0, i64 0
  store i64 1, ptr %87, align 16, !tbaa !8
  br label %88

88:                                               ; preds = %77, %67, %57
  %89 = load i64, ptr %3, align 8, !tbaa !8
  %90 = getelementptr inbounds [200000 x [2 x i64]], ptr @dp, i64 0, i64 %89
  %91 = getelementptr inbounds [2 x i64], ptr %90, i64 0, i64 1
  store i64 1000000000, ptr %91, align 8, !tbaa !8
  %92 = load i64, ptr %3, align 8, !tbaa !8
  %93 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %92
  %94 = load i64, ptr %93, align 8, !tbaa !8
  %95 = load i64, ptr %3, align 8, !tbaa !8
  %96 = sub nsw i64 %95, 1
  %97 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %96
  %98 = load i64, ptr %97, align 8, !tbaa !8
  %99 = icmp slt i64 %94, %98
  br i1 %99, label %100, label %112

100:                                              ; preds = %88
  %101 = load i64, ptr %3, align 8, !tbaa !8
  %102 = sub nsw i64 %101, 1
  %103 = getelementptr inbounds [200000 x [2 x i64]], ptr @dp, i64 0, i64 %102
  %104 = getelementptr inbounds [2 x i64], ptr %103, i64 0, i64 1
  %105 = load i64, ptr %104, align 8, !tbaa !8
  %106 = load i64, ptr %3, align 8, !tbaa !8
  %107 = getelementptr inbounds [200000 x [2 x i64]], ptr @dp, i64 0, i64 %106
  %108 = getelementptr inbounds [2 x i64], ptr %107, i64 0, i64 1
  store i64 %105, ptr %108, align 8, !tbaa !8
  %109 = load i64, ptr %3, align 8, !tbaa !8
  %110 = getelementptr inbounds [200000 x [2 x i64]], ptr @p, i64 0, i64 %109
  %111 = getelementptr inbounds [2 x i64], ptr %110, i64 0, i64 1
  store i64 1, ptr %111, align 8, !tbaa !8
  br label %112

112:                                              ; preds = %100, %88
  %113 = load i64, ptr %3, align 8, !tbaa !8
  %114 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %113
  %115 = load i64, ptr %114, align 8, !tbaa !8
  %116 = load i64, ptr %3, align 8, !tbaa !8
  %117 = sub nsw i64 %116, 1
  %118 = getelementptr inbounds [200000 x [2 x i64]], ptr @dp, i64 0, i64 %117
  %119 = getelementptr inbounds [2 x i64], ptr %118, i64 0, i64 0
  %120 = load i64, ptr %119, align 16, !tbaa !8
  %121 = icmp slt i64 %115, %120
  br i1 %121, label %122, label %143

122:                                              ; preds = %112
  %123 = load i64, ptr %3, align 8, !tbaa !8
  %124 = sub nsw i64 %123, 1
  %125 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %124
  %126 = load i64, ptr %125, align 8, !tbaa !8
  %127 = load i64, ptr %3, align 8, !tbaa !8
  %128 = getelementptr inbounds [200000 x [2 x i64]], ptr @dp, i64 0, i64 %127
  %129 = getelementptr inbounds [2 x i64], ptr %128, i64 0, i64 1
  %130 = load i64, ptr %129, align 8, !tbaa !8
  %131 = icmp slt i64 %126, %130
  br i1 %131, label %132, label %143

132:                                              ; preds = %122
  %133 = load i64, ptr %3, align 8, !tbaa !8
  %134 = sub nsw i64 %133, 1
  %135 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %134
  %136 = load i64, ptr %135, align 8, !tbaa !8
  %137 = load i64, ptr %3, align 8, !tbaa !8
  %138 = getelementptr inbounds [200000 x [2 x i64]], ptr @dp, i64 0, i64 %137
  %139 = getelementptr inbounds [2 x i64], ptr %138, i64 0, i64 1
  store i64 %136, ptr %139, align 8, !tbaa !8
  %140 = load i64, ptr %3, align 8, !tbaa !8
  %141 = getelementptr inbounds [200000 x [2 x i64]], ptr @p, i64 0, i64 %140
  %142 = getelementptr inbounds [2 x i64], ptr %141, i64 0, i64 1
  store i64 0, ptr %142, align 8, !tbaa !8
  br label %143

143:                                              ; preds = %132, %122, %112
  br label %144

144:                                              ; preds = %143
  %145 = load i64, ptr %3, align 8, !tbaa !8
  %146 = add nsw i64 %145, 1
  store i64 %146, ptr %3, align 8, !tbaa !8
  br label %28, !llvm.loop !13

147:                                              ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  store i64 0, ptr %4, align 8, !tbaa !8
  %148 = load i64, ptr @N, align 8, !tbaa !8
  %149 = sub nsw i64 %148, 1
  %150 = getelementptr inbounds [200000 x [2 x i64]], ptr @dp, i64 0, i64 %149
  %151 = getelementptr inbounds [2 x i64], ptr %150, i64 0, i64 0
  %152 = load i64, ptr %151, align 16, !tbaa !8
  %153 = icmp eq i64 %152, -1
  br i1 %153, label %154, label %155

154:                                              ; preds = %147
  store i64 1, ptr %4, align 8, !tbaa !8
  br label %155

155:                                              ; preds = %154, %147
  %156 = load i64, ptr %4, align 8, !tbaa !8
  %157 = icmp eq i64 %156, 1
  br i1 %157, label %158, label %169

158:                                              ; preds = %155
  %159 = load i64, ptr @N, align 8, !tbaa !8
  %160 = sub nsw i64 %159, 1
  %161 = getelementptr inbounds [200000 x [2 x i64]], ptr @dp, i64 0, i64 %160
  %162 = getelementptr inbounds [2 x i64], ptr %161, i64 0, i64 1
  %163 = load i64, ptr %162, align 8, !tbaa !8
  %164 = sitofp i64 %163 to double
  %165 = fcmp oeq double %164, 1.000000e+09
  br i1 %165, label %166, label %169

166:                                              ; preds = %158
  %167 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %168 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %167, i8 noundef signext 10)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %5, align 4
  br label %207

169:                                              ; preds = %158, %155
  %170 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.1)
  %171 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %170, i8 noundef signext 10)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %172 = load i64, ptr @N, align 8, !tbaa !8
  %173 = sub nsw i64 %172, 1
  store i64 %173, ptr %6, align 8, !tbaa !8
  br label %174

174:                                              ; preds = %187, %169
  %175 = load i64, ptr %6, align 8, !tbaa !8
  %176 = icmp sge i64 %175, 0
  br i1 %176, label %178, label %177

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

178:                                              ; preds = %174
  %179 = load i64, ptr %4, align 8, !tbaa !8
  %180 = load i64, ptr %6, align 8, !tbaa !8
  %181 = getelementptr inbounds [200000 x i64], ptr @ans, i64 0, i64 %180
  store i64 %179, ptr %181, align 8, !tbaa !8
  %182 = load i64, ptr %6, align 8, !tbaa !8
  %183 = getelementptr inbounds [200000 x [2 x i64]], ptr @p, i64 0, i64 %182
  %184 = load i64, ptr %4, align 8, !tbaa !8
  %185 = getelementptr inbounds [2 x i64], ptr %183, i64 0, i64 %184
  %186 = load i64, ptr %185, align 8, !tbaa !8
  store i64 %186, ptr %4, align 8, !tbaa !8
  br label %187

187:                                              ; preds = %178
  %188 = load i64, ptr %6, align 8, !tbaa !8
  %189 = add nsw i64 %188, -1
  store i64 %189, ptr %6, align 8, !tbaa !8
  br label %174, !llvm.loop !14

190:                                              ; preds = %177
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  store i64 0, ptr %7, align 8, !tbaa !8
  br label %191

191:                                              ; preds = %202, %190
  %192 = load i64, ptr %7, align 8, !tbaa !8
  %193 = load i64, ptr @N, align 8, !tbaa !8
  %194 = icmp slt i64 %192, %193
  br i1 %194, label %196, label %195

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

196:                                              ; preds = %191
  %197 = load i64, ptr %7, align 8, !tbaa !8
  %198 = getelementptr inbounds [200000 x i64], ptr @ans, i64 0, i64 %197
  %199 = load i64, ptr %198, align 8, !tbaa !8
  %200 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %199)
  %201 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %200, i8 noundef signext 32)
  br label %202

202:                                              ; preds = %196
  %203 = load i64, ptr %7, align 8, !tbaa !8
  %204 = add nsw i64 %203, 1
  store i64 %204, ptr %7, align 8, !tbaa !8
  br label %191, !llvm.loop !15

205:                                              ; preds = %195
  %206 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext 10)
  store i32 0, ptr %5, align 4
  br label %207

207:                                              ; preds = %205, %166
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  %208 = load i32, ptr %5, align 4
  switch i32 %208, label %211 [
    i32 0, label %209
    i32 1, label %209
  ]

209:                                              ; preds = %207, %207
  %210 = load i32, ptr %1, align 4
  ret i32 %210

211:                                              ; preds = %207
  unreachable
}

; 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: 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: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #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 = { 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}


; 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::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" }

@N = external dso_local global i64, align 8
@a = external dso_local global [200000 x i64], align 16
@dp = external dso_local local_unnamed_addr global [200000 x [2 x i64]], align 16
@p = external dso_local local_unnamed_addr global [200000 x [2 x i64]], align 16
@ans = external dso_local local_unnamed_addr global [200000 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %2 = getelementptr i8, ptr %1, i64 -24
  %3 = load i64, ptr %2, align 8
  %4 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %3
  %5 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %4, ptr noundef null)
  %6 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %7 = 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)
  %8 = load i64, ptr @N, align 8, !tbaa !8
  %9 = icmp sgt i64 %8, 0
  br i1 %9, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %0
  store i64 1000000000, ptr @dp, align 16, !tbaa !8
  store i64 -1, ptr getelementptr inbounds (i8, ptr @dp, i64 8), align 8, !tbaa !8
  br label %._crit_edge54

._crit_edge:                                      ; preds = %.lr.ph
  store i64 1000000000, ptr @dp, align 16, !tbaa !8
  store i64 -1, ptr getelementptr inbounds (i8, ptr @dp, i64 8), align 8, !tbaa !8
  %10 = icmp sgt i64 %14, 1
  br i1 %10, label %.lr.ph53.preheader, label %._crit_edge54

.lr.ph53.preheader:                               ; preds = %._crit_edge
  %.pre = load i64, ptr @a, align 16, !tbaa !8
  br label %.lr.ph53

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.04550 = phi i64 [ %13, %.lr.ph ], [ 0, %0 ]
  %11 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %.04550
  %12 = 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) %11)
  %13 = add nuw nsw i64 %.04550, 1
  %14 = load i64, ptr @N, align 8, !tbaa !8
  %15 = icmp slt i64 %13, %14
  br i1 %15, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge54:                                    ; preds = %53, %._crit_edge.thread, %._crit_edge
  %.lcssa64 = phi i64 [ %8, %._crit_edge.thread ], [ %14, %._crit_edge ], [ %14, %53 ]
  %16 = add nsw i64 %.lcssa64, -1
  %17 = getelementptr inbounds [200000 x [2 x i64]], ptr @dp, i64 0, i64 %16
  %18 = load i64, ptr %17, align 16, !tbaa !8
  %19 = icmp eq i64 %18, -1
  %spec.store.select = zext i1 %19 to i64
  br i1 %19, label %56, label %62

.lr.ph53:                                         ; preds = %.lr.ph53.preheader, %53
  %20 = phi i64 [ %54, %53 ], [ -1, %.lr.ph53.preheader ]
  %21 = phi i64 [ %24, %53 ], [ %.pre, %.lr.ph53.preheader ]
  %.04451 = phi i64 [ %55, %53 ], [ 1, %.lr.ph53.preheader ]
  %22 = getelementptr inbounds [200000 x [2 x i64]], ptr @dp, i64 0, i64 %.04451
  store i64 -1, ptr %22, align 16, !tbaa !8
  %23 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %.04451
  %24 = load i64, ptr %23, align 8, !tbaa !8
  %25 = add nsw i64 %.04451, -1
  %26 = icmp sgt i64 %24, %21
  br i1 %26, label %27, label %31

27:                                               ; preds = %.lr.ph53
  %28 = getelementptr inbounds [200000 x [2 x i64]], ptr @dp, i64 0, i64 %25
  %29 = load i64, ptr %28, align 16, !tbaa !8
  store i64 %29, ptr %22, align 16, !tbaa !8
  %30 = getelementptr inbounds [200000 x [2 x i64]], ptr @p, i64 0, i64 %.04451
  store i64 0, ptr %30, align 16, !tbaa !8
  br label %31

31:                                               ; preds = %27, %.lr.ph53
  %32 = getelementptr inbounds [200000 x [2 x i64]], ptr @dp, i64 0, i64 %25
  %33 = getelementptr inbounds i8, ptr %32, i64 8
  %34 = icmp sgt i64 %24, %20
  br i1 %34, label %35, label %40

35:                                               ; preds = %31
  %36 = load i64, ptr %22, align 16, !tbaa !8
  %37 = icmp sgt i64 %21, %36
  br i1 %37, label %38, label %40

38:                                               ; preds = %35
  store i64 %21, ptr %22, align 16, !tbaa !8
  %39 = getelementptr inbounds [200000 x [2 x i64]], ptr @p, i64 0, i64 %.04451
  store i64 1, ptr %39, align 16, !tbaa !8
  br label %40

40:                                               ; preds = %38, %35, %31
  %41 = getelementptr inbounds i8, ptr %22, i64 8
  store i64 1000000000, ptr %41, align 8, !tbaa !8
  %42 = icmp slt i64 %24, %21
  br i1 %42, label %43, label %46

43:                                               ; preds = %40
  %44 = load i64, ptr %33, align 8, !tbaa !8
  store i64 %44, ptr %41, align 8, !tbaa !8
  %45 = getelementptr inbounds [200000 x [2 x i64]], ptr @p, i64 0, i64 %.04451, i64 1
  store i64 1, ptr %45, align 8, !tbaa !8
  br label %46

46:                                               ; preds = %43, %40
  %47 = phi i64 [ %44, %43 ], [ 1000000000, %40 ]
  %48 = load i64, ptr %32, align 16, !tbaa !8
  %49 = icmp slt i64 %24, %48
  %50 = icmp slt i64 %21, %47
  %or.cond = select i1 %49, i1 %50, i1 false
  br i1 %or.cond, label %51, label %53

51:                                               ; preds = %46
  store i64 %21, ptr %41, align 8, !tbaa !8
  %52 = getelementptr inbounds [200000 x [2 x i64]], ptr @p, i64 0, i64 %.04451, i64 1
  store i64 0, ptr %52, align 8, !tbaa !8
  br label %53

53:                                               ; preds = %46, %51
  %54 = phi i64 [ %47, %46 ], [ %21, %51 ]
  %55 = add nuw nsw i64 %.04451, 1
  %exitcond.not = icmp eq i64 %55, %14
  br i1 %exitcond.not, label %._crit_edge54, label %.lr.ph53, !llvm.loop !13

56:                                               ; preds = %._crit_edge54
  %57 = getelementptr inbounds i8, ptr %17, i64 8
  %58 = load i64, ptr %57, align 8, !tbaa !8
  %59 = icmp eq i64 %58, 1000000000
  br i1 %59, label %60, label %62

60:                                               ; preds = %56
  %61 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str)
  br label %._crit_edge61

62:                                               ; preds = %56, %._crit_edge54
  %63 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.1)
  %64 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %63, i8 noundef signext 10)
  %65 = load i64, ptr @N, align 8, !tbaa !8
  %66 = icmp sgt i64 %65, 0
  br i1 %66, label %.lr.ph58.preheader, label %._crit_edge61

.lr.ph58.preheader:                               ; preds = %62
  %xtraiter = and i64 %65, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph58.prol.loopexit, label %.lr.ph58.prol

.lr.ph58.prol:                                    ; preds = %.lr.ph58.preheader, %.lr.ph58.prol
  %.042.in56.prol = phi i64 [ %.042.prol, %.lr.ph58.prol ], [ %65, %.lr.ph58.preheader ]
  %.04355.prol = phi i64 [ %69, %.lr.ph58.prol ], [ %spec.store.select, %.lr.ph58.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %.lr.ph58.prol ], [ 0, %.lr.ph58.preheader ]
  %.042.prol = add nsw i64 %.042.in56.prol, -1
  %67 = getelementptr inbounds [200000 x i64], ptr @ans, i64 0, i64 %.042.prol
  store i64 %.04355.prol, ptr %67, align 8, !tbaa !8
  %68 = getelementptr inbounds [200000 x [2 x i64]], ptr @p, i64 0, i64 %.042.prol, i64 %.04355.prol
  %69 = load i64, ptr %68, align 8, !tbaa !8
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %.lr.ph58.prol.loopexit, label %.lr.ph58.prol, !llvm.loop !14

.lr.ph58.prol.loopexit:                           ; preds = %.lr.ph58.prol, %.lr.ph58.preheader
  %.042.in56.unr = phi i64 [ %65, %.lr.ph58.preheader ], [ %.042.prol, %.lr.ph58.prol ]
  %.04355.unr = phi i64 [ %spec.store.select, %.lr.ph58.preheader ], [ %69, %.lr.ph58.prol ]
  %70 = icmp ult i64 %65, 4
  br i1 %70, label %.preheader, label %.lr.ph58

.preheader:                                       ; preds = %.lr.ph58, %.lr.ph58.prol.loopexit
  br i1 %66, label %.lr.ph60, label %._crit_edge61

.lr.ph58:                                         ; preds = %.lr.ph58.prol.loopexit, %.lr.ph58
  %.042.in56 = phi i64 [ %.042.3, %.lr.ph58 ], [ %.042.in56.unr, %.lr.ph58.prol.loopexit ]
  %.04355 = phi i64 [ %82, %.lr.ph58 ], [ %.04355.unr, %.lr.ph58.prol.loopexit ]
  %.042 = add nsw i64 %.042.in56, -1
  %71 = getelementptr inbounds [200000 x i64], ptr @ans, i64 0, i64 %.042
  store i64 %.04355, ptr %71, align 8, !tbaa !8
  %72 = getelementptr inbounds [200000 x [2 x i64]], ptr @p, i64 0, i64 %.042, i64 %.04355
  %73 = load i64, ptr %72, align 8, !tbaa !8
  %.042.1 = add nsw i64 %.042.in56, -2
  %74 = getelementptr inbounds [200000 x i64], ptr @ans, i64 0, i64 %.042.1
  store i64 %73, ptr %74, align 8, !tbaa !8
  %75 = getelementptr inbounds [200000 x [2 x i64]], ptr @p, i64 0, i64 %.042.1, i64 %73
  %76 = load i64, ptr %75, align 8, !tbaa !8
  %.042.2 = add nsw i64 %.042.in56, -3
  %77 = getelementptr inbounds [200000 x i64], ptr @ans, i64 0, i64 %.042.2
  store i64 %76, ptr %77, align 8, !tbaa !8
  %78 = getelementptr inbounds [200000 x [2 x i64]], ptr @p, i64 0, i64 %.042.2, i64 %76
  %79 = load i64, ptr %78, align 8, !tbaa !8
  %.042.3 = add nsw i64 %.042.in56, -4
  %80 = getelementptr inbounds [200000 x i64], ptr @ans, i64 0, i64 %.042.3
  store i64 %79, ptr %80, align 8, !tbaa !8
  %81 = getelementptr inbounds [200000 x [2 x i64]], ptr @p, i64 0, i64 %.042.3, i64 %79
  %82 = load i64, ptr %81, align 8, !tbaa !8
  %83 = icmp ugt i64 %.042.2, 1
  br i1 %83, label %.lr.ph58, label %.preheader, !llvm.loop !16

.lr.ph60:                                         ; preds = %.preheader, %.lr.ph60
  %.059 = phi i64 [ %88, %.lr.ph60 ], [ 0, %.preheader ]
  %84 = getelementptr inbounds [200000 x i64], ptr @ans, i64 0, i64 %.059
  %85 = load i64, ptr %84, align 8, !tbaa !8
  %86 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %85)
  %87 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %86, i8 noundef signext 32)
  %88 = add nuw nsw i64 %.059, 1
  %89 = load i64, ptr @N, align 8, !tbaa !8
  %90 = icmp slt i64 %88, %89
  br i1 %90, label %.lr.ph60, label %._crit_edge61, !llvm.loop !17

._crit_edge61:                                    ; preds = %.lr.ph60, %.preheader, %62, %60
  %_ZSt4cout.sink = phi ptr [ %61, %60 ], [ @_ZSt4cout, %62 ], [ @_ZSt4cout, %.preheader ], [ @_ZSt4cout, %.lr.ph60 ]
  %91 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %_ZSt4cout.sink, i8 noundef signext 10)
  ret i32 0
}

; 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: 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 #4

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #4

; 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 = { 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" }

!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, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}


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