; LLVM IR from eyangch/competitive-programming :: Codeforces/1467 (b)

; 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 i32, align 4
@N = external dso_local global i32, align 4
@a = external dso_local global [300000 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4testi(i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %12 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %13 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %14 = getelementptr i8, ptr %13, i64 -24
  %15 = load i64, ptr %14, align 8
  %16 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %15
  %17 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %16, ptr noundef null)
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @T)
  br label %19

19:                                               ; preds = %141, %0
  %20 = load i32, ptr @T, align 4, !tbaa !8
  %21 = add nsw i32 %20, -1
  store i32 %21, ptr @T, align 4, !tbaa !8
  %22 = icmp ne i32 %20, 0
  br i1 %22, label %23, label %145

23:                                               ; preds = %19
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !8
  br label %25

25:                                               ; preds = %35, %23
  %26 = load i32, ptr %2, align 4, !tbaa !8
  %27 = load i32, ptr @N, align 4, !tbaa !8
  %28 = icmp slt i32 %26, %27
  br i1 %28, label %30, label %29

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

30:                                               ; preds = %25
  %31 = load i32, ptr %2, align 4, !tbaa !8
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [300000 x i32], ptr @a, i64 0, i64 %32
  %34 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %33)
  br label %35

35:                                               ; preds = %30
  %36 = load i32, ptr %2, align 4, !tbaa !8
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %2, align 4, !tbaa !8
  br label %25, !llvm.loop !11

38:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 0, ptr %3, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 1, ptr %4, align 4, !tbaa !8
  br label %39

39:                                               ; preds = %53, %38
  %40 = load i32, ptr %4, align 4, !tbaa !8
  %41 = load i32, ptr @N, align 4, !tbaa !8
  %42 = sub nsw i32 %41, 1
  %43 = icmp slt i32 %40, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %56

45:                                               ; preds = %39
  %46 = load i32, ptr %4, align 4, !tbaa !8
  %47 = call noundef i32 @_Z4testi(i32 noundef %46)
  %48 = icmp sgt i32 %47, 0
  br i1 %48, label %49, label %52

49:                                               ; preds = %45
  %50 = load i32, ptr %3, align 4, !tbaa !8
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %3, align 4, !tbaa !8
  br label %52

52:                                               ; preds = %49, %45
  br label %53

53:                                               ; preds = %52
  %54 = load i32, ptr %4, align 4, !tbaa !8
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr %4, align 4, !tbaa !8
  br label %39, !llvm.loop !13

56:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %57 = load i32, ptr %3, align 4, !tbaa !8
  store i32 %57, ptr %5, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 1, ptr %6, align 4, !tbaa !8
  br label %58

58:                                               ; preds = %138, %56
  %59 = load i32, ptr %6, align 4, !tbaa !8
  %60 = load i32, ptr @N, align 4, !tbaa !8
  %61 = sub nsw i32 %60, 1
  %62 = icmp slt i32 %59, %61
  br i1 %62, label %64, label %63

63:                                               ; preds = %58
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %141

64:                                               ; preds = %58
  %65 = load i32, ptr %6, align 4, !tbaa !8
  %66 = call noundef i32 @_Z4testi(i32 noundef %65)
  %67 = icmp sgt i32 %66, 0
  br i1 %67, label %68, label %137

68:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %69 = load i32, ptr %6, align 4, !tbaa !8
  %70 = sub nsw i32 %69, 1
  %71 = call noundef i32 @_Z4testi(i32 noundef %70)
  %72 = load i32, ptr %6, align 4, !tbaa !8
  %73 = call noundef i32 @_Z4testi(i32 noundef %72)
  %74 = add nsw i32 %71, %73
  %75 = load i32, ptr %6, align 4, !tbaa !8
  %76 = add nsw i32 %75, 1
  %77 = call noundef i32 @_Z4testi(i32 noundef %76)
  %78 = add nsw i32 %74, %77
  store i32 %78, ptr %7, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %79 = load i32, ptr %6, align 4, !tbaa !8
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [300000 x i32], ptr @a, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !8
  store i32 %82, ptr %8, align 4, !tbaa !8
  %83 = load i32, ptr %6, align 4, !tbaa !8
  %84 = sub nsw i32 %83, 1
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [300000 x i32], ptr @a, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !8
  %88 = load i32, ptr %6, align 4, !tbaa !8
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [300000 x i32], ptr @a, i64 0, i64 %89
  store i32 %87, ptr %90, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %91 = load i32, ptr %6, align 4, !tbaa !8
  %92 = sub nsw i32 %91, 1
  %93 = call noundef i32 @_Z4testi(i32 noundef %92)
  %94 = load i32, ptr %6, align 4, !tbaa !8
  %95 = call noundef i32 @_Z4testi(i32 noundef %94)
  %96 = add nsw i32 %93, %95
  %97 = load i32, ptr %6, align 4, !tbaa !8
  %98 = add nsw i32 %97, 1
  %99 = call noundef i32 @_Z4testi(i32 noundef %98)
  %100 = add nsw i32 %96, %99
  %101 = load i32, ptr %7, align 4, !tbaa !8
  %102 = sub nsw i32 %100, %101
  store i32 %102, ptr %9, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %103 = load i32, ptr %3, align 4, !tbaa !8
  %104 = load i32, ptr %9, align 4, !tbaa !8
  %105 = add nsw i32 %103, %104
  store i32 %105, ptr %10, align 4, !tbaa !8
  %106 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %107 = load i32, ptr %106, align 4, !tbaa !8
  store i32 %107, ptr %5, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  %108 = load i32, ptr %6, align 4, !tbaa !8
  %109 = add nsw i32 %108, 1
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [300000 x i32], ptr @a, i64 0, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !8
  %113 = load i32, ptr %6, align 4, !tbaa !8
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [300000 x i32], ptr @a, i64 0, i64 %114
  store i32 %112, ptr %115, align 4, !tbaa !8
  %116 = load i32, ptr %6, align 4, !tbaa !8
  %117 = sub nsw i32 %116, 1
  %118 = call noundef i32 @_Z4testi(i32 noundef %117)
  %119 = load i32, ptr %6, align 4, !tbaa !8
  %120 = call noundef i32 @_Z4testi(i32 noundef %119)
  %121 = add nsw i32 %118, %120
  %122 = load i32, ptr %6, align 4, !tbaa !8
  %123 = add nsw i32 %122, 1
  %124 = call noundef i32 @_Z4testi(i32 noundef %123)
  %125 = add nsw i32 %121, %124
  %126 = load i32, ptr %7, align 4, !tbaa !8
  %127 = sub nsw i32 %125, %126
  store i32 %127, ptr %9, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %128 = load i32, ptr %3, align 4, !tbaa !8
  %129 = load i32, ptr %9, align 4, !tbaa !8
  %130 = add nsw i32 %128, %129
  store i32 %130, ptr %11, align 4, !tbaa !8
  %131 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %132 = load i32, ptr %131, align 4, !tbaa !8
  store i32 %132, ptr %5, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  %133 = load i32, ptr %8, align 4, !tbaa !8
  %134 = load i32, ptr %6, align 4, !tbaa !8
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [300000 x i32], ptr @a, i64 0, i64 %135
  store i32 %133, ptr %136, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %137

137:                                              ; preds = %68, %64
  br label %138

138:                                              ; preds = %137
  %139 = load i32, ptr %6, align 4, !tbaa !8
  %140 = add nsw i32 %139, 1
  store i32 %140, ptr %6, align 4, !tbaa !8
  br label %58, !llvm.loop !14

141:                                              ; preds = %63
  %142 = load i32, ptr %5, align 4, !tbaa !8
  %143 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %142)
  %144 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %143, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %19, !llvm.loop !15

145:                                              ; preds = %19
  %146 = load i32, ptr %1, align 4
  ret i32 %146
}

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #2

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

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #2

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #6

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

@T = external dso_local global i32, align 4
@N = external dso_local global i32, align 4
@a = external dso_local global [300000 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4testi(i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %5 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %6 = getelementptr i8, ptr %5, i64 -24
  %7 = load i64, ptr %6, align 8
  %8 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %7
  %9 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %8, ptr noundef null)
  %10 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @T)
  %11 = load i32, ptr @T, align 4, !tbaa !8
  %12 = add nsw i32 %11, -1
  store i32 %12, ptr @T, align 4, !tbaa !8
  %.not45 = icmp eq i32 %11, 0
  br i1 %.not45, label %._crit_edge48, label %.lr.ph47

.lr.ph47:                                         ; preds = %0, %._crit_edge44
  %13 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  %14 = load i32, ptr @N, align 4, !tbaa !8
  %15 = icmp sgt i32 %14, 0
  br i1 %15, label %.lr.ph, label %._crit_edge.thread

.preheader:                                       ; preds = %.lr.ph
  %16 = icmp sgt i32 %19, 2
  br i1 %16, label %.lr.ph40, label %._crit_edge.thread

.lr.ph:                                           ; preds = %.lr.ph47, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph47 ]
  %17 = getelementptr inbounds [300000 x i32], ptr @a, i64 0, i64 %indvars.iv
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %17)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %19 = load i32, ptr @N, align 4, !tbaa !8
  %20 = sext i32 %19 to i64
  %21 = icmp slt i64 %indvars.iv.next, %20
  br i1 %21, label %.lr.ph, label %.preheader, !llvm.loop !11

._crit_edge.thread:                               ; preds = %.preheader, %.lr.ph47
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  store i32 0, ptr %1, align 4, !tbaa !8
  br label %._crit_edge44

._crit_edge:                                      ; preds = %.lr.ph40
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  store i32 %spec.select, ptr %1, align 4, !tbaa !8
  %22 = icmp sgt i32 %27, 2
  br i1 %22, label %.lr.ph43, label %._crit_edge44

.lr.ph40:                                         ; preds = %.preheader, %.lr.ph40
  %.03439 = phi i32 [ %spec.select, %.lr.ph40 ], [ 0, %.preheader ]
  %.03538 = phi i32 [ %26, %.lr.ph40 ], [ 1, %.preheader ]
  %23 = call noundef i32 @_Z4testi(i32 noundef %.03538)
  %24 = icmp sgt i32 %23, 0
  %25 = zext i1 %24 to i32
  %spec.select = add nuw nsw i32 %.03439, %25
  %26 = add nuw nsw i32 %.03538, 1
  %27 = load i32, ptr @N, align 4, !tbaa !8
  %28 = add nsw i32 %27, -1
  %29 = icmp slt i32 %26, %28
  br i1 %29, label %.lr.ph40, label %._crit_edge, !llvm.loop !13

._crit_edge44.loopexit:                           ; preds = %71
  %.pre = load i32, ptr %1, align 4, !tbaa !8
  br label %._crit_edge44

._crit_edge44:                                    ; preds = %._crit_edge.thread, %._crit_edge44.loopexit, %._crit_edge
  %30 = phi i32 [ %.pre, %._crit_edge44.loopexit ], [ %spec.select, %._crit_edge ], [ 0, %._crit_edge.thread ]
  %31 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %30)
  %32 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %31, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  %33 = load i32, ptr @T, align 4, !tbaa !8
  %34 = add nsw i32 %33, -1
  store i32 %34, ptr @T, align 4, !tbaa !8
  %.not = icmp eq i32 %33, 0
  br i1 %.not, label %._crit_edge48, label %.lr.ph47, !llvm.loop !14

.lr.ph43:                                         ; preds = %._crit_edge, %71
  %indvars.iv50 = phi i64 [ %indvars.iv.next51.pre-phi, %71 ], [ 1, %._crit_edge ]
  %35 = trunc nuw nsw i64 %indvars.iv50 to i32
  %36 = call noundef i32 @_Z4testi(i32 noundef %35)
  %37 = icmp sgt i32 %36, 0
  br i1 %37, label %38, label %.lr.ph43._crit_edge

.lr.ph43._crit_edge:                              ; preds = %.lr.ph43
  %.pre53 = add nuw nsw i64 %indvars.iv50, 1
  br label %71

38:                                               ; preds = %.lr.ph43
  %39 = add nsw i64 %indvars.iv50, -1
  %40 = trunc nuw nsw i64 %39 to i32
  %41 = call noundef i32 @_Z4testi(i32 noundef %40)
  %42 = call noundef i32 @_Z4testi(i32 noundef %35)
  %43 = add nsw i32 %42, %41
  %44 = add nuw nsw i64 %indvars.iv50, 1
  %45 = trunc nuw nsw i64 %44 to i32
  %46 = call noundef i32 @_Z4testi(i32 noundef %45)
  %47 = add nsw i32 %43, %46
  %48 = getelementptr inbounds [300000 x i32], ptr @a, i64 0, i64 %indvars.iv50
  %49 = load i32, ptr %48, align 4, !tbaa !8
  %50 = getelementptr inbounds [300000 x i32], ptr @a, i64 0, i64 %39
  %51 = load i32, ptr %50, align 4, !tbaa !8
  store i32 %51, ptr %48, align 4, !tbaa !8
  %52 = call noundef i32 @_Z4testi(i32 noundef %40)
  %53 = call noundef i32 @_Z4testi(i32 noundef %35)
  %54 = call noundef i32 @_Z4testi(i32 noundef %45)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %55 = sub i32 %spec.select, %47
  %56 = add i32 %55, %52
  %57 = add i32 %56, %53
  %58 = add i32 %57, %54
  store i32 %58, ptr %2, align 4, !tbaa !8
  %59 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %60 = load i32, ptr %59, align 4, !tbaa !8
  store i32 %60, ptr %1, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  %61 = getelementptr inbounds [300000 x i32], ptr @a, i64 0, i64 %44
  %62 = load i32, ptr %61, align 4, !tbaa !8
  store i32 %62, ptr %48, align 4, !tbaa !8
  %63 = call noundef i32 @_Z4testi(i32 noundef %40)
  %64 = call noundef i32 @_Z4testi(i32 noundef %35)
  %65 = call noundef i32 @_Z4testi(i32 noundef %45)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %66 = add i32 %55, %63
  %67 = add i32 %66, %64
  %68 = add i32 %67, %65
  store i32 %68, ptr %3, align 4, !tbaa !8
  %69 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %70 = load i32, ptr %69, align 4, !tbaa !8
  store i32 %70, ptr %1, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  store i32 %49, ptr %48, align 4, !tbaa !8
  br label %71

71:                                               ; preds = %.lr.ph43._crit_edge, %38
  %indvars.iv.next51.pre-phi = phi i64 [ %.pre53, %.lr.ph43._crit_edge ], [ %44, %38 ]
  %72 = load i32, ptr @N, align 4, !tbaa !8
  %73 = add nsw i32 %72, -1
  %74 = sext i32 %73 to i64
  %75 = icmp slt i64 %indvars.iv.next51.pre-phi, %74
  br i1 %75, label %.lr.ph43, label %._crit_edge44.loopexit, !llvm.loop !15

._crit_edge48:                                    ; preds = %._crit_edge44, %0
  ret i32 0
}

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

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

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #2

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #6

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


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