; LLVM IR from eyangch/competitive-programming :: Codeforces/1706 (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::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" }

@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@H = external dso_local global [100000 x i64], align 16
@dp = external dso_local global [2 x [100000 x i64]], align 16
@_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 i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %11 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %12 = getelementptr i8, ptr %11, i64 -24
  %13 = load i64, ptr %12, align 8
  %14 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %13
  %15 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %14, ptr noundef null)
  %16 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %17 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @T)
  br label %18

18:                                               ; preds = %186, %0
  %19 = load i64, ptr @T, align 8, !tbaa !8
  %20 = add nsw i64 %19, -1
  store i64 %20, ptr @T, align 8, !tbaa !8
  %21 = icmp ne i64 %19, 0
  br i1 %21, label %22, label %190

22:                                               ; preds = %18
  %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) @N)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  store i64 0, ptr %2, align 8, !tbaa !8
  br label %24

24:                                               ; preds = %33, %22
  %25 = load i64, ptr %2, align 8, !tbaa !8
  %26 = load i64, ptr @N, align 8, !tbaa !8
  %27 = icmp slt i64 %25, %26
  br i1 %27, label %29, label %28

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

29:                                               ; preds = %24
  %30 = load i64, ptr %2, align 8, !tbaa !8
  %31 = getelementptr inbounds [100000 x i64], ptr @H, i64 0, i64 %30
  %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) %31)
  br label %33

33:                                               ; preds = %29
  %34 = load i64, ptr %2, align 8, !tbaa !8
  %35 = add nsw i64 %34, 1
  store i64 %35, ptr %2, align 8, !tbaa !8
  br label %24, !llvm.loop !11

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

37:                                               ; preds = %47, %36
  %38 = load i64, ptr %4, align 8, !tbaa !8
  %39 = load i64, ptr @N, align 8, !tbaa !8
  %40 = icmp slt i64 %38, %39
  br i1 %40, label %42, label %41

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

42:                                               ; preds = %37
  %43 = load i64, ptr %4, align 8, !tbaa !8
  %44 = getelementptr inbounds [100000 x i64], ptr @dp, i64 0, i64 %43
  store i64 0, ptr %44, align 8, !tbaa !8
  %45 = load i64, ptr %4, align 8, !tbaa !8
  %46 = getelementptr inbounds [100000 x i64], ptr getelementptr inbounds ([2 x [100000 x i64]], ptr @dp, i64 0, i64 1), i64 0, i64 %45
  store i64 0, ptr %46, align 8, !tbaa !8
  br label %47

47:                                               ; preds = %42
  %48 = load i64, ptr %4, align 8, !tbaa !8
  %49 = add nsw i64 %48, 1
  store i64 %49, ptr %4, align 8, !tbaa !8
  br label %37, !llvm.loop !13

50:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  store i64 1, ptr %5, align 8, !tbaa !8
  br label %51

51:                                               ; preds = %96, %50
  %52 = load i64, ptr %5, align 8, !tbaa !8
  %53 = load i64, ptr @N, align 8, !tbaa !8
  %54 = sub nsw i64 %53, 1
  %55 = icmp slt i64 %52, %54
  br i1 %55, label %57, label %56

56:                                               ; preds = %51
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  br label %99

57:                                               ; preds = %51
  %58 = load i64, ptr %5, align 8, !tbaa !8
  %59 = icmp sgt i64 %58, 1
  br i1 %59, label %60, label %67

60:                                               ; preds = %57
  %61 = load i64, ptr %5, align 8, !tbaa !8
  %62 = sub nsw i64 %61, 2
  %63 = getelementptr inbounds [100000 x i64], ptr @dp, i64 0, i64 %62
  %64 = load i64, ptr %63, align 8, !tbaa !8
  %65 = load i64, ptr %5, align 8, !tbaa !8
  %66 = getelementptr inbounds [100000 x i64], ptr @dp, i64 0, i64 %65
  store i64 %64, ptr %66, align 8, !tbaa !8
  br label %70

67:                                               ; preds = %57
  %68 = load i64, ptr %5, align 8, !tbaa !8
  %69 = getelementptr inbounds [100000 x i64], ptr getelementptr inbounds ([2 x [100000 x i64]], ptr @dp, i64 0, i64 1), i64 0, i64 %68
  store i64 0, ptr %69, align 8, !tbaa !8
  br label %70

70:                                               ; preds = %67, %60
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %71 = load i64, ptr %5, align 8, !tbaa !8
  %72 = sub nsw i64 %71, 1
  %73 = getelementptr inbounds [100000 x i64], ptr @H, i64 0, i64 %72
  %74 = load i64, ptr %5, align 8, !tbaa !8
  %75 = add nsw i64 %74, 1
  %76 = getelementptr inbounds [100000 x i64], ptr @H, i64 0, i64 %75
  %77 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %73, ptr noundef nonnull align 8 dereferenceable(8) %76)
  %78 = load i64, ptr %77, align 8, !tbaa !8
  %79 = add nsw i64 %78, 1
  store i64 %79, ptr %6, align 8, !tbaa !8
  %80 = load i64, ptr %6, align 8, !tbaa !8
  %81 = load i64, ptr %5, align 8, !tbaa !8
  %82 = getelementptr inbounds [100000 x i64], ptr @H, i64 0, i64 %81
  %83 = load i64, ptr %82, align 8, !tbaa !8
  %84 = icmp sgt i64 %80, %83
  br i1 %84, label %85, label %95

85:                                               ; preds = %70
  %86 = load i64, ptr %6, align 8, !tbaa !8
  %87 = load i64, ptr %5, align 8, !tbaa !8
  %88 = getelementptr inbounds [100000 x i64], ptr @H, i64 0, i64 %87
  %89 = load i64, ptr %88, align 8, !tbaa !8
  %90 = sub nsw i64 %86, %89
  %91 = load i64, ptr %5, align 8, !tbaa !8
  %92 = getelementptr inbounds [100000 x i64], ptr @dp, i64 0, i64 %91
  %93 = load i64, ptr %92, align 8, !tbaa !8
  %94 = add nsw i64 %93, %90
  store i64 %94, ptr %92, align 8, !tbaa !8
  br label %95

95:                                               ; preds = %85, %70
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %96

96:                                               ; preds = %95
  %97 = load i64, ptr %5, align 8, !tbaa !8
  %98 = add nsw i64 %97, 2
  store i64 %98, ptr %5, align 8, !tbaa !8
  br label %51, !llvm.loop !14

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

102:                                              ; preds = %147, %99
  %103 = load i64, ptr %7, align 8, !tbaa !8
  %104 = icmp sgt i64 %103, 0
  br i1 %104, label %106, label %105

105:                                              ; preds = %102
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  br label %150

106:                                              ; preds = %102
  %107 = load i64, ptr %7, align 8, !tbaa !8
  %108 = load i64, ptr @N, align 8, !tbaa !8
  %109 = sub nsw i64 %108, 2
  %110 = icmp slt i64 %107, %109
  br i1 %110, label %111, label %118

111:                                              ; preds = %106
  %112 = load i64, ptr %7, align 8, !tbaa !8
  %113 = add nsw i64 %112, 2
  %114 = getelementptr inbounds [100000 x i64], ptr getelementptr inbounds ([2 x [100000 x i64]], ptr @dp, i64 0, i64 1), i64 0, i64 %113
  %115 = load i64, ptr %114, align 8, !tbaa !8
  %116 = load i64, ptr %7, align 8, !tbaa !8
  %117 = getelementptr inbounds [100000 x i64], ptr getelementptr inbounds ([2 x [100000 x i64]], ptr @dp, i64 0, i64 1), i64 0, i64 %116
  store i64 %115, ptr %117, align 8, !tbaa !8
  br label %121

118:                                              ; preds = %106
  %119 = load i64, ptr %7, align 8, !tbaa !8
  %120 = getelementptr inbounds [100000 x i64], ptr getelementptr inbounds ([2 x [100000 x i64]], ptr @dp, i64 0, i64 1), i64 0, i64 %119
  store i64 0, ptr %120, align 8, !tbaa !8
  br label %121

121:                                              ; preds = %118, %111
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %122 = load i64, ptr %7, align 8, !tbaa !8
  %123 = sub nsw i64 %122, 1
  %124 = getelementptr inbounds [100000 x i64], ptr @H, i64 0, i64 %123
  %125 = load i64, ptr %7, align 8, !tbaa !8
  %126 = add nsw i64 %125, 1
  %127 = getelementptr inbounds [100000 x i64], ptr @H, i64 0, i64 %126
  %128 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %124, ptr noundef nonnull align 8 dereferenceable(8) %127)
  %129 = load i64, ptr %128, align 8, !tbaa !8
  %130 = add nsw i64 %129, 1
  store i64 %130, ptr %8, align 8, !tbaa !8
  %131 = load i64, ptr %8, align 8, !tbaa !8
  %132 = load i64, ptr %7, align 8, !tbaa !8
  %133 = getelementptr inbounds [100000 x i64], ptr @H, i64 0, i64 %132
  %134 = load i64, ptr %133, align 8, !tbaa !8
  %135 = icmp sgt i64 %131, %134
  br i1 %135, label %136, label %146

136:                                              ; preds = %121
  %137 = load i64, ptr %8, align 8, !tbaa !8
  %138 = load i64, ptr %7, align 8, !tbaa !8
  %139 = getelementptr inbounds [100000 x i64], ptr @H, i64 0, i64 %138
  %140 = load i64, ptr %139, align 8, !tbaa !8
  %141 = sub nsw i64 %137, %140
  %142 = load i64, ptr %7, align 8, !tbaa !8
  %143 = getelementptr inbounds [100000 x i64], ptr getelementptr inbounds ([2 x [100000 x i64]], ptr @dp, i64 0, i64 1), i64 0, i64 %142
  %144 = load i64, ptr %143, align 8, !tbaa !8
  %145 = add nsw i64 %144, %141
  store i64 %145, ptr %143, align 8, !tbaa !8
  br label %146

146:                                              ; preds = %136, %121
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %147

147:                                              ; preds = %146
  %148 = load i64, ptr %7, align 8, !tbaa !8
  %149 = sub nsw i64 %148, 2
  store i64 %149, ptr %7, align 8, !tbaa !8
  br label %102, !llvm.loop !15

150:                                              ; preds = %105
  %151 = load i64, ptr @N, align 8, !tbaa !8
  %152 = and i64 %151, 1
  %153 = icmp ne i64 %152, 0
  br i1 %153, label %154, label %159

154:                                              ; preds = %150
  %155 = load i64, ptr @N, align 8, !tbaa !8
  %156 = sub nsw i64 %155, 2
  %157 = getelementptr inbounds [100000 x i64], ptr @dp, i64 0, i64 %156
  %158 = load i64, ptr %157, align 8, !tbaa !8
  store i64 %158, ptr %3, align 8, !tbaa !8
  br label %186

159:                                              ; preds = %150
  %160 = load i64, ptr @N, align 8, !tbaa !8
  %161 = sub nsw i64 %160, 3
  %162 = getelementptr inbounds [100000 x i64], ptr @dp, i64 0, i64 %161
  %163 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %162, ptr noundef nonnull align 8 dereferenceable(8) getelementptr inbounds ([100000 x i64], ptr getelementptr inbounds ([2 x [100000 x i64]], ptr @dp, i64 0, i64 1), i64 0, i64 2))
  %164 = load i64, ptr %163, align 8, !tbaa !8
  store i64 %164, ptr %3, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  store i64 1, ptr %9, align 8, !tbaa !8
  br label %165

165:                                              ; preds = %182, %159
  %166 = load i64, ptr %9, align 8, !tbaa !8
  %167 = load i64, ptr @N, align 8, !tbaa !8
  %168 = sub nsw i64 %167, 3
  %169 = icmp slt i64 %166, %168
  br i1 %169, label %171, label %170

170:                                              ; preds = %165
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  br label %185

171:                                              ; preds = %165
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %172 = load i64, ptr %9, align 8, !tbaa !8
  %173 = getelementptr inbounds [100000 x i64], ptr @dp, i64 0, i64 %172
  %174 = load i64, ptr %173, align 8, !tbaa !8
  %175 = load i64, ptr %9, align 8, !tbaa !8
  %176 = add nsw i64 %175, 3
  %177 = getelementptr inbounds [100000 x i64], ptr getelementptr inbounds ([2 x [100000 x i64]], ptr @dp, i64 0, i64 1), i64 0, i64 %176
  %178 = load i64, ptr %177, align 8, !tbaa !8
  %179 = add nsw i64 %174, %178
  store i64 %179, ptr %10, align 8, !tbaa !8
  %180 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %10)
  %181 = load i64, ptr %180, align 8, !tbaa !8
  store i64 %181, ptr %3, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %182

182:                                              ; preds = %171
  %183 = load i64, ptr %9, align 8, !tbaa !8
  %184 = add nsw i64 %183, 2
  store i64 %184, ptr %9, align 8, !tbaa !8
  br label %165, !llvm.loop !16

185:                                              ; preds = %170
  br label %186

186:                                              ; preds = %185, %154
  %187 = load i64, ptr %3, align 8, !tbaa !8
  %188 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %187)
  %189 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %188, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  br label %18, !llvm.loop !17

190:                                              ; preds = %18
  %191 = load i32, ptr %1, align 4
  ret i32 %191
}

; 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 nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #5

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

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


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

@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@H = external dso_local global [100000 x i64], align 16
@dp = external dso_local global [2 x [100000 x i64]], align 16
@_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 i64, align 8
  %2 = alloca i64, 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) @T)
  %10 = load i64, ptr @T, align 8, !tbaa !8
  %11 = add nsw i64 %10, -1
  store i64 %11, ptr @T, align 8, !tbaa !8
  %.not67 = icmp eq i64 %10, 0
  br i1 %.not67, label %._crit_edge70, label %.lr.ph69

.lr.ph69:                                         ; preds = %0, %.loopexit
  %12 = 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)
  %13 = load i64, ptr @N, align 8, !tbaa !8
  %14 = icmp sgt i64 %13, 0
  br i1 %14, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %.lr.ph69
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  store i64 1000000000000000, ptr %1, align 8, !tbaa !8
  br label %._crit_edge63

._crit_edge:                                      ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  store i64 1000000000000000, ptr %1, align 8, !tbaa !8
  %15 = icmp sgt i64 %22, 0
  br i1 %15, label %.lr.ph55.preheader, label %._crit_edge63

.lr.ph55.preheader:                               ; preds = %._crit_edge
  %min.iters.check = icmp eq i64 %22, 1
  br i1 %min.iters.check, label %.lr.ph55.preheader80, label %vector.ph

.lr.ph55.preheader80:                             ; preds = %middle.block, %.lr.ph55.preheader
  %.04053.ph = phi i64 [ 0, %.lr.ph55.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph55

vector.ph:                                        ; preds = %.lr.ph55.preheader
  %n.vec = and i64 %22, 9223372036854775806
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %16 = getelementptr inbounds [100000 x i64], ptr @dp, i64 0, i64 %index
  store <2 x i64> zeroinitializer, ptr %16, align 16, !tbaa !8
  %17 = getelementptr inbounds [100000 x i64], ptr getelementptr inbounds (i8, ptr @dp, i64 800000), i64 0, i64 %index
  store <2 x i64> zeroinitializer, ptr %17, align 16, !tbaa !8
  %index.next = add nuw i64 %index, 2
  %18 = icmp eq i64 %index.next, %n.vec
  br i1 %18, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %22, %n.vec
  br i1 %cmp.n, label %.preheader50, label %.lr.ph55.preheader80

.lr.ph:                                           ; preds = %.lr.ph69, %.lr.ph
  %.03852 = phi i64 [ %21, %.lr.ph ], [ 0, %.lr.ph69 ]
  %19 = getelementptr inbounds [100000 x i64], ptr @H, i64 0, i64 %.03852
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %19)
  %21 = add nuw nsw i64 %.03852, 1
  %22 = load i64, ptr @N, align 8, !tbaa !8
  %23 = icmp slt i64 %21, %22
  br i1 %23, label %.lr.ph, label %._crit_edge, !llvm.loop !15

.preheader50:                                     ; preds = %.lr.ph55, %middle.block
  %24 = icmp sgt i64 %22, 2
  br i1 %24, label %25, label %._crit_edge63

25:                                               ; preds = %.preheader50
  store i64 0, ptr getelementptr inbounds (i8, ptr @dp, i64 800008), align 8, !tbaa !8
  %26 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @H, ptr noundef nonnull align 8 dereferenceable(8) getelementptr inbounds (i8, ptr @H, i64 16))
  %27 = load i64, ptr %26, align 8, !tbaa !8
  %28 = load i64, ptr getelementptr inbounds (i8, ptr @H, i64 8), align 8, !tbaa !8
  %.not48.peel = icmp slt i64 %27, %28
  br i1 %.not48.peel, label %34, label %29

29:                                               ; preds = %25
  %30 = add nsw i64 %27, 1
  %31 = sub i64 %30, %28
  %32 = load i64, ptr getelementptr inbounds (i8, ptr @dp, i64 8), align 8, !tbaa !8
  %33 = add nsw i64 %31, %32
  store i64 %33, ptr getelementptr inbounds (i8, ptr @dp, i64 8), align 8, !tbaa !8
  br label %34

34:                                               ; preds = %29, %25
  %35 = load i64, ptr @N, align 8, !tbaa !8
  %36 = icmp sgt i64 %35, 4
  br i1 %36, label %.lr.ph57.peel.next, label %.preheader

.lr.ph55:                                         ; preds = %.lr.ph55.preheader80, %.lr.ph55
  %.04053 = phi i64 [ %39, %.lr.ph55 ], [ %.04053.ph, %.lr.ph55.preheader80 ]
  %37 = getelementptr inbounds [100000 x i64], ptr @dp, i64 0, i64 %.04053
  store i64 0, ptr %37, align 8, !tbaa !8
  %38 = getelementptr inbounds [100000 x i64], ptr getelementptr inbounds (i8, ptr @dp, i64 800000), i64 0, i64 %.04053
  store i64 0, ptr %38, align 8, !tbaa !8
  %39 = add nuw nsw i64 %.04053, 1
  %exitcond.not = icmp eq i64 %39, %22
  br i1 %exitcond.not, label %.preheader50, label %.lr.ph55, !llvm.loop !16

.preheader:                                       ; preds = %59, %34
  %.lcssa51 = phi i64 [ %35, %34 ], [ %61, %59 ]
  %40 = icmp sgt i64 %.lcssa51, 2
  br i1 %40, label %.lr.ph62, label %._crit_edge63

.lr.ph57.peel.next:                               ; preds = %34, %59
  %.04156 = phi i64 [ %60, %59 ], [ 3, %34 ]
  %41 = add nsw i64 %.04156, -2
  %42 = getelementptr inbounds [100000 x i64], ptr @dp, i64 0, i64 %41
  %43 = load i64, ptr %42, align 8, !tbaa !8
  %44 = getelementptr inbounds [100000 x i64], ptr @dp, i64 0, i64 %.04156
  store i64 %43, ptr %44, align 8, !tbaa !8
  %45 = add nsw i64 %.04156, -1
  %46 = getelementptr inbounds [100000 x i64], ptr @H, i64 0, i64 %45
  %47 = add nuw nsw i64 %.04156, 1
  %48 = getelementptr inbounds [100000 x i64], ptr @H, i64 0, i64 %47
  %49 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %46, ptr noundef nonnull align 8 dereferenceable(8) %48)
  %50 = load i64, ptr %49, align 8, !tbaa !8
  %51 = getelementptr inbounds [100000 x i64], ptr @H, i64 0, i64 %.04156
  %52 = load i64, ptr %51, align 8, !tbaa !8
  %.not48 = icmp slt i64 %50, %52
  br i1 %.not48, label %59, label %53

53:                                               ; preds = %.lr.ph57.peel.next
  %54 = add nsw i64 %50, 1
  %55 = sub i64 %54, %52
  %56 = getelementptr inbounds [100000 x i64], ptr @dp, i64 0, i64 %.04156
  %57 = load i64, ptr %56, align 8, !tbaa !8
  %58 = add nsw i64 %55, %57
  store i64 %58, ptr %56, align 8, !tbaa !8
  br label %59

59:                                               ; preds = %53, %.lr.ph57.peel.next
  %60 = add nuw nsw i64 %.04156, 2
  %61 = load i64, ptr @N, align 8, !tbaa !8
  %62 = add nsw i64 %61, -1
  %63 = icmp slt i64 %60, %62
  br i1 %63, label %.lr.ph57.peel.next, label %.preheader, !llvm.loop !17

._crit_edge63.loopexit:                           ; preds = %86
  %.pre = load i64, ptr @N, align 8, !tbaa !8
  br label %._crit_edge63

._crit_edge63:                                    ; preds = %._crit_edge, %._crit_edge.thread, %.preheader50, %._crit_edge63.loopexit, %.preheader
  %64 = phi i64 [ %.pre, %._crit_edge63.loopexit ], [ %.lcssa51, %.preheader ], [ %22, %.preheader50 ], [ %22, %._crit_edge ], [ %13, %._crit_edge.thread ]
  %65 = and i64 %64, 1
  %.not46 = icmp eq i64 %65, 0
  br i1 %.not46, label %92, label %88

.lr.ph62:                                         ; preds = %.preheader, %86
  %.039.in60 = phi i64 [ %.03961, %86 ], [ %.lcssa51, %.preheader ]
  %.03961 = add nsw i64 %.039.in60, -2
  %66 = load i64, ptr @N, align 8, !tbaa !8
  %67 = icmp slt i64 %.039.in60, %66
  br i1 %67, label %68, label %71

68:                                               ; preds = %.lr.ph62
  %69 = getelementptr inbounds [100000 x i64], ptr getelementptr inbounds (i8, ptr @dp, i64 800000), i64 0, i64 %.039.in60
  %70 = load i64, ptr %69, align 8, !tbaa !8
  br label %71

71:                                               ; preds = %.lr.ph62, %68
  %.sink = phi i64 [ %70, %68 ], [ 0, %.lr.ph62 ]
  %72 = getelementptr inbounds [100000 x i64], ptr getelementptr inbounds (i8, ptr @dp, i64 800000), i64 0, i64 %.03961
  store i64 %.sink, ptr %72, align 8
  %73 = add nsw i64 %.039.in60, -3
  %74 = getelementptr inbounds [100000 x i64], ptr @H, i64 0, i64 %73
  %75 = add nsw i64 %.039.in60, -1
  %76 = getelementptr inbounds [100000 x i64], ptr @H, i64 0, i64 %75
  %77 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %74, ptr noundef nonnull align 8 dereferenceable(8) %76)
  %78 = load i64, ptr %77, align 8, !tbaa !8
  %79 = getelementptr inbounds [100000 x i64], ptr @H, i64 0, i64 %.03961
  %80 = load i64, ptr %79, align 8, !tbaa !8
  %.not47 = icmp slt i64 %78, %80
  br i1 %.not47, label %86, label %81

81:                                               ; preds = %71
  %82 = add nsw i64 %78, 1
  %83 = sub i64 %82, %80
  %84 = load i64, ptr %72, align 8, !tbaa !8
  %85 = add nsw i64 %83, %84
  store i64 %85, ptr %72, align 8, !tbaa !8
  br label %86

86:                                               ; preds = %81, %71
  %87 = icmp ugt i64 %.039.in60, 4
  br i1 %87, label %.lr.ph62, label %._crit_edge63.loopexit, !llvm.loop !19

88:                                               ; preds = %._crit_edge63
  %89 = add nsw i64 %64, -2
  %90 = getelementptr inbounds [100000 x i64], ptr @dp, i64 0, i64 %89
  %91 = load i64, ptr %90, align 8, !tbaa !8
  store i64 %91, ptr %1, align 8, !tbaa !8
  br label %.loopexit

92:                                               ; preds = %._crit_edge63
  %93 = add nsw i64 %64, -3
  %94 = getelementptr inbounds [100000 x i64], ptr @dp, i64 0, i64 %93
  %95 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %94, ptr noundef nonnull align 8 dereferenceable(8) getelementptr inbounds (i8, ptr @dp, i64 800016))
  %96 = load i64, ptr %95, align 8, !tbaa !8
  store i64 %96, ptr %1, align 8, !tbaa !8
  %97 = load i64, ptr @N, align 8, !tbaa !8
  %98 = icmp sgt i64 %97, 4
  br i1 %98, label %.lr.ph66, label %.loopexit

.lr.ph66:                                         ; preds = %92, %.lr.ph66
  %.064 = phi i64 [ %107, %.lr.ph66 ], [ 1, %92 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  %99 = getelementptr inbounds [100000 x i64], ptr @dp, i64 0, i64 %.064
  %100 = load i64, ptr %99, align 8, !tbaa !8
  %101 = add nuw nsw i64 %.064, 3
  %102 = getelementptr inbounds [100000 x i64], ptr getelementptr inbounds (i8, ptr @dp, i64 800000), i64 0, i64 %101
  %103 = load i64, ptr %102, align 8, !tbaa !8
  %104 = add nsw i64 %103, %100
  store i64 %104, ptr %2, align 8, !tbaa !8
  %105 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %106 = load i64, ptr %105, align 8, !tbaa !8
  store i64 %106, ptr %1, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  %107 = add nuw nsw i64 %.064, 2
  %108 = load i64, ptr @N, align 8, !tbaa !8
  %109 = add nsw i64 %108, -3
  %110 = icmp slt i64 %107, %109
  br i1 %110, label %.lr.ph66, label %.loopexit, !llvm.loop !20

.loopexit:                                        ; preds = %.lr.ph66, %92, %88
  %111 = phi i64 [ %96, %92 ], [ %91, %88 ], [ %106, %.lr.ph66 ]
  %112 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %111)
  %113 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %112, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  %114 = load i64, ptr @T, align 8, !tbaa !8
  %115 = add nsw i64 %114, -1
  store i64 %115, ptr @T, align 8, !tbaa !8
  %.not = icmp eq i64 %114, 0
  br i1 %.not, label %._crit_edge70, label %.lr.ph69, !llvm.loop !21

._crit_edge70:                                    ; preds = %.loopexit, %0
  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: 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

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

; 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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #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, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12, !14, !13}
!17 = distinct !{!17, !12, !18}
!18 = !{!"llvm.loop.peeled.count", i32 1}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}


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