; LLVM IR from eyangch/competitive-programming :: Codeforces/1420 (c2)

; 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
@Q = external dso_local global i64, align 8
@a = external dso_local global [300002 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 [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z4hillx(i64 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %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
  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) @T)
  br label %15

15:                                               ; preds = %154, %0
  %16 = load i64, ptr @T, align 8, !tbaa !8
  %17 = add nsw i64 %16, -1
  store i64 %17, ptr @T, align 8, !tbaa !8
  %18 = icmp ne i64 %16, 0
  br i1 %18, label %19, label %155

19:                                               ; preds = %15
  %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) @N)
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 8 dereferenceable(8) @Q)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  store i64 1, ptr %2, align 8, !tbaa !8
  br label %22

22:                                               ; preds = %31, %19
  %23 = load i64, ptr %2, align 8, !tbaa !8
  %24 = load i64, ptr @N, align 8, !tbaa !8
  %25 = icmp sle i64 %23, %24
  br i1 %25, label %27, label %26

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

27:                                               ; preds = %22
  %28 = load i64, ptr %2, align 8, !tbaa !8
  %29 = getelementptr inbounds [300002 x i64], ptr @a, i64 0, i64 %28
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %29)
  br label %31

31:                                               ; preds = %27
  %32 = load i64, ptr %2, align 8, !tbaa !8
  %33 = add nsw i64 %32, 1
  store i64 %33, ptr %2, align 8, !tbaa !8
  br label %22, !llvm.loop !11

34:                                               ; preds = %26
  %35 = load i64, ptr @N, align 8, !tbaa !8
  %36 = add nsw i64 %35, 1
  %37 = getelementptr inbounds [300002 x i64], ptr @a, i64 0, i64 %36
  store i64 0, ptr %37, align 8, !tbaa !8
  store i64 0, ptr @a, align 16, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  store i64 0, ptr %3, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  store i64 1, ptr %4, align 8, !tbaa !8
  br label %38

38:                                               ; preds = %48, %34
  %39 = load i64, ptr %4, align 8, !tbaa !8
  %40 = load i64, ptr @N, align 8, !tbaa !8
  %41 = icmp sle i64 %39, %40
  br i1 %41, label %43, label %42

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

43:                                               ; preds = %38
  %44 = load i64, ptr %4, align 8, !tbaa !8
  %45 = call noundef i64 @_Z4hillx(i64 noundef %44)
  %46 = load i64, ptr %3, align 8, !tbaa !8
  %47 = add nsw i64 %46, %45
  store i64 %47, ptr %3, align 8, !tbaa !8
  br label %48

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

51:                                               ; preds = %42
  %52 = load i64, ptr %3, align 8, !tbaa !8
  %53 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %52)
  %54 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %53, ptr noundef @.str)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  store i64 0, ptr %5, align 8, !tbaa !8
  br label %55

55:                                               ; preds = %151, %51
  %56 = load i64, ptr %5, align 8, !tbaa !8
  %57 = load i64, ptr @Q, align 8, !tbaa !8
  %58 = icmp slt i64 %56, %57
  br i1 %58, label %60, label %59

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

60:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %61 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %62 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %61, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %63 = load i64, ptr %6, align 8, !tbaa !8
  %64 = load i64, ptr %7, align 8, !tbaa !8
  %65 = icmp ne i64 %63, %64
  br i1 %65, label %66, label %147

66:                                               ; preds = %60
  %67 = load i64, ptr %6, align 8, !tbaa !8
  %68 = call noundef i64 @_Z4hillx(i64 noundef %67)
  %69 = load i64, ptr %6, align 8, !tbaa !8
  %70 = sub nsw i64 %69, 1
  %71 = call noundef i64 @_Z4hillx(i64 noundef %70)
  %72 = add nsw i64 %68, %71
  %73 = load i64, ptr %6, align 8, !tbaa !8
  %74 = add nsw i64 %73, 1
  %75 = call noundef i64 @_Z4hillx(i64 noundef %74)
  %76 = add nsw i64 %72, %75
  %77 = load i64, ptr %3, align 8, !tbaa !8
  %78 = sub nsw i64 %77, %76
  store i64 %78, ptr %3, align 8, !tbaa !8
  %79 = load i64, ptr %7, align 8, !tbaa !8
  %80 = load i64, ptr %6, align 8, !tbaa !8
  %81 = add nsw i64 %80, 2
  %82 = icmp sgt i64 %79, %81
  br i1 %82, label %83, label %89

83:                                               ; preds = %66
  %84 = load i64, ptr %7, align 8, !tbaa !8
  %85 = sub nsw i64 %84, 1
  %86 = call noundef i64 @_Z4hillx(i64 noundef %85)
  %87 = load i64, ptr %3, align 8, !tbaa !8
  %88 = sub nsw i64 %87, %86
  store i64 %88, ptr %3, align 8, !tbaa !8
  br label %89

89:                                               ; preds = %83, %66
  %90 = load i64, ptr %7, align 8, !tbaa !8
  %91 = load i64, ptr %6, align 8, !tbaa !8
  %92 = add nsw i64 %91, 1
  %93 = icmp sgt i64 %90, %92
  br i1 %93, label %94, label %99

94:                                               ; preds = %89
  %95 = load i64, ptr %7, align 8, !tbaa !8
  %96 = call noundef i64 @_Z4hillx(i64 noundef %95)
  %97 = load i64, ptr %3, align 8, !tbaa !8
  %98 = sub nsw i64 %97, %96
  store i64 %98, ptr %3, align 8, !tbaa !8
  br label %99

99:                                               ; preds = %94, %89
  %100 = load i64, ptr %7, align 8, !tbaa !8
  %101 = add nsw i64 %100, 1
  %102 = call noundef i64 @_Z4hillx(i64 noundef %101)
  %103 = load i64, ptr %3, align 8, !tbaa !8
  %104 = sub nsw i64 %103, %102
  store i64 %104, ptr %3, align 8, !tbaa !8
  %105 = load i64, ptr %6, align 8, !tbaa !8
  %106 = getelementptr inbounds [300002 x i64], ptr @a, i64 0, i64 %105
  %107 = load i64, ptr %7, align 8, !tbaa !8
  %108 = getelementptr inbounds [300002 x i64], ptr @a, i64 0, i64 %107
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %106, ptr noundef nonnull align 8 dereferenceable(8) %108) #7
  %109 = load i64, ptr %6, align 8, !tbaa !8
  %110 = call noundef i64 @_Z4hillx(i64 noundef %109)
  %111 = load i64, ptr %6, align 8, !tbaa !8
  %112 = sub nsw i64 %111, 1
  %113 = call noundef i64 @_Z4hillx(i64 noundef %112)
  %114 = add nsw i64 %110, %113
  %115 = load i64, ptr %6, align 8, !tbaa !8
  %116 = add nsw i64 %115, 1
  %117 = call noundef i64 @_Z4hillx(i64 noundef %116)
  %118 = add nsw i64 %114, %117
  %119 = load i64, ptr %3, align 8, !tbaa !8
  %120 = add nsw i64 %119, %118
  store i64 %120, ptr %3, align 8, !tbaa !8
  %121 = load i64, ptr %7, align 8, !tbaa !8
  %122 = load i64, ptr %6, align 8, !tbaa !8
  %123 = add nsw i64 %122, 2
  %124 = icmp sgt i64 %121, %123
  br i1 %124, label %125, label %131

125:                                              ; preds = %99
  %126 = load i64, ptr %7, align 8, !tbaa !8
  %127 = sub nsw i64 %126, 1
  %128 = call noundef i64 @_Z4hillx(i64 noundef %127)
  %129 = load i64, ptr %3, align 8, !tbaa !8
  %130 = add nsw i64 %129, %128
  store i64 %130, ptr %3, align 8, !tbaa !8
  br label %131

131:                                              ; preds = %125, %99
  %132 = load i64, ptr %7, align 8, !tbaa !8
  %133 = load i64, ptr %6, align 8, !tbaa !8
  %134 = add nsw i64 %133, 1
  %135 = icmp sgt i64 %132, %134
  br i1 %135, label %136, label %141

136:                                              ; preds = %131
  %137 = load i64, ptr %7, align 8, !tbaa !8
  %138 = call noundef i64 @_Z4hillx(i64 noundef %137)
  %139 = load i64, ptr %3, align 8, !tbaa !8
  %140 = add nsw i64 %139, %138
  store i64 %140, ptr %3, align 8, !tbaa !8
  br label %141

141:                                              ; preds = %136, %131
  %142 = load i64, ptr %7, align 8, !tbaa !8
  %143 = add nsw i64 %142, 1
  %144 = call noundef i64 @_Z4hillx(i64 noundef %143)
  %145 = load i64, ptr %3, align 8, !tbaa !8
  %146 = add nsw i64 %145, %144
  store i64 %146, ptr %3, align 8, !tbaa !8
  br label %147

147:                                              ; preds = %141, %60
  %148 = load i64, ptr %3, align 8, !tbaa !8
  %149 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %148)
  %150 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %149, ptr noundef @.str)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %151

151:                                              ; preds = %147
  %152 = load i64, ptr %5, align 8, !tbaa !8
  %153 = add nsw i64 %152, 1
  store i64 %153, ptr %5, align 8, !tbaa !8
  br label %55, !llvm.loop !14

154:                                              ; preds = %59
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  br label %15, !llvm.loop !15

155:                                              ; preds = %15
  %156 = load i32, ptr %1, align 4
  ret i32 %156
}

; 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 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_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

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

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

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


; 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
@Q = external dso_local global i64, align 8
@a = external dso_local global [300002 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 [2 x i8], align 1

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %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
  %.not49 = icmp eq i64 %10, 0
  br i1 %.not49, label %._crit_edge52, label %.lr.ph51

.loopexit:                                        ; preds = %105, %._crit_edge43
  %12 = load i64, ptr @T, align 8, !tbaa !8
  %13 = add nsw i64 %12, -1
  store i64 %13, ptr @T, align 8, !tbaa !8
  %.not = icmp eq i64 %12, 0
  br i1 %.not, label %._crit_edge52, label %.lr.ph51, !llvm.loop !11

.lr.ph51:                                         ; preds = %0, %.loopexit
  %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)
  %15 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 8 dereferenceable(8) @Q)
  %16 = load i64, ptr @N, align 8, !tbaa !8
  %.not2936 = icmp slt i64 %16, 1
  br i1 %.not2936, label %._crit_edge.thread, label %.lr.ph

._crit_edge.thread:                               ; preds = %.lr.ph51
  %17 = add nsw i64 %16, 1
  %18 = getelementptr inbounds [300002 x i64], ptr @a, i64 0, i64 %17
  store i64 0, ptr %18, align 8, !tbaa !8
  store i64 0, ptr @a, align 16, !tbaa !8
  br label %._crit_edge43

._crit_edge:                                      ; preds = %.lr.ph
  %19 = add nsw i64 %24, 1
  %20 = getelementptr inbounds [300002 x i64], ptr @a, i64 0, i64 %19
  store i64 0, ptr %20, align 8, !tbaa !8
  store i64 0, ptr @a, align 16, !tbaa !8
  %.not3038 = icmp slt i64 %24, 1
  br i1 %.not3038, label %._crit_edge43, label %.lr.ph42

.lr.ph:                                           ; preds = %.lr.ph51, %.lr.ph
  %.02237 = phi i64 [ %23, %.lr.ph ], [ 1, %.lr.ph51 ]
  %21 = getelementptr inbounds [300002 x i64], ptr @a, i64 0, i64 %.02237
  %22 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %21)
  %23 = add nuw nsw i64 %.02237, 1
  %24 = load i64, ptr @N, align 8, !tbaa !8
  %.not29.not = icmp slt i64 %.02237, %24
  br i1 %.not29.not, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge43:                                    ; preds = %.lr.ph42, %._crit_edge.thread, %._crit_edge
  %.021.lcssa = phi i64 [ 0, %._crit_edge ], [ 0, %._crit_edge.thread ], [ %30, %.lr.ph42 ]
  %25 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.021.lcssa)
  %26 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %25, ptr noundef nonnull @.str)
  %27 = load i64, ptr @Q, align 8, !tbaa !8
  %28 = icmp sgt i64 %27, 0
  br i1 %28, label %.lr.ph48, label %.loopexit

.lr.ph42:                                         ; preds = %._crit_edge, %.lr.ph42
  %.02040 = phi i64 [ %31, %.lr.ph42 ], [ 1, %._crit_edge ]
  %.02139 = phi i64 [ %30, %.lr.ph42 ], [ 0, %._crit_edge ]
  %29 = call noundef i64 @_Z4hillx(i64 noundef %.02040)
  %30 = add nsw i64 %29, %.02139
  %31 = add nuw nsw i64 %.02040, 1
  %32 = load i64, ptr @N, align 8, !tbaa !8
  %.not30.not = icmp slt i64 %.02040, %32
  br i1 %.not30.not, label %.lr.ph42, label %._crit_edge43, !llvm.loop !14

.lr.ph48:                                         ; preds = %._crit_edge43, %105
  %.046 = phi i64 [ %108, %105 ], [ 0, %._crit_edge43 ]
  %.145 = phi i64 [ %.6, %105 ], [ %.021.lcssa, %._crit_edge43 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  %33 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %34 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %33, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %35 = load i64, ptr %1, align 8, !tbaa !8
  %36 = load i64, ptr %2, align 8, !tbaa !8
  %.not31 = icmp eq i64 %35, %36
  br i1 %.not31, label %105, label %37

37:                                               ; preds = %.lr.ph48
  %38 = call noundef i64 @_Z4hillx(i64 noundef %35)
  %39 = load i64, ptr %1, align 8, !tbaa !8
  %40 = add nsw i64 %39, -1
  %41 = call noundef i64 @_Z4hillx(i64 noundef %40)
  %42 = load i64, ptr %1, align 8, !tbaa !8
  %43 = add nsw i64 %42, 1
  %44 = call noundef i64 @_Z4hillx(i64 noundef %43)
  %45 = add i64 %38, %41
  %46 = add i64 %45, %44
  %47 = sub i64 %.145, %46
  %48 = load i64, ptr %2, align 8, !tbaa !8
  %49 = load i64, ptr %1, align 8, !tbaa !8
  %50 = add nsw i64 %49, 2
  %51 = icmp sgt i64 %48, %50
  br i1 %51, label %52, label %56

52:                                               ; preds = %37
  %53 = add nsw i64 %48, -1
  %54 = call noundef i64 @_Z4hillx(i64 noundef %53)
  %55 = sub nsw i64 %47, %54
  %.pre = load i64, ptr %2, align 8, !tbaa !8
  %.pre55 = load i64, ptr %1, align 8, !tbaa !8
  br label %56

56:                                               ; preds = %52, %37
  %57 = phi i64 [ %.pre55, %52 ], [ %49, %37 ]
  %58 = phi i64 [ %.pre, %52 ], [ %48, %37 ]
  %.2 = phi i64 [ %55, %52 ], [ %47, %37 ]
  %59 = add nsw i64 %57, 1
  %60 = icmp sgt i64 %58, %59
  br i1 %60, label %61, label %64

61:                                               ; preds = %56
  %62 = call noundef i64 @_Z4hillx(i64 noundef %58)
  %63 = sub nsw i64 %.2, %62
  %.pre56 = load i64, ptr %2, align 8, !tbaa !8
  br label %64

64:                                               ; preds = %61, %56
  %65 = phi i64 [ %.pre56, %61 ], [ %58, %56 ]
  %.3 = phi i64 [ %63, %61 ], [ %.2, %56 ]
  %66 = add nsw i64 %65, 1
  %67 = call noundef i64 @_Z4hillx(i64 noundef %66)
  %68 = sub nsw i64 %.3, %67
  %69 = load i64, ptr %1, align 8, !tbaa !8
  %70 = getelementptr inbounds [300002 x i64], ptr @a, i64 0, i64 %69
  %71 = load i64, ptr %2, align 8, !tbaa !8
  %72 = getelementptr inbounds [300002 x i64], ptr @a, i64 0, i64 %71
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %70, ptr noundef nonnull align 8 dereferenceable(8) %72) #7
  %73 = load i64, ptr %1, align 8, !tbaa !8
  %74 = call noundef i64 @_Z4hillx(i64 noundef %73)
  %75 = load i64, ptr %1, align 8, !tbaa !8
  %76 = add nsw i64 %75, -1
  %77 = call noundef i64 @_Z4hillx(i64 noundef %76)
  %78 = load i64, ptr %1, align 8, !tbaa !8
  %79 = add nsw i64 %78, 1
  %80 = call noundef i64 @_Z4hillx(i64 noundef %79)
  %81 = add i64 %74, %68
  %82 = add i64 %81, %77
  %83 = add i64 %82, %80
  %84 = load i64, ptr %2, align 8, !tbaa !8
  %85 = load i64, ptr %1, align 8, !tbaa !8
  %86 = add nsw i64 %85, 2
  %87 = icmp sgt i64 %84, %86
  br i1 %87, label %88, label %92

88:                                               ; preds = %64
  %89 = add nsw i64 %84, -1
  %90 = call noundef i64 @_Z4hillx(i64 noundef %89)
  %91 = add nsw i64 %90, %83
  %.pre57 = load i64, ptr %2, align 8, !tbaa !8
  %.pre58 = load i64, ptr %1, align 8, !tbaa !8
  br label %92

92:                                               ; preds = %88, %64
  %93 = phi i64 [ %.pre58, %88 ], [ %85, %64 ]
  %94 = phi i64 [ %.pre57, %88 ], [ %84, %64 ]
  %.4 = phi i64 [ %91, %88 ], [ %83, %64 ]
  %95 = add nsw i64 %93, 1
  %96 = icmp sgt i64 %94, %95
  br i1 %96, label %97, label %100

97:                                               ; preds = %92
  %98 = call noundef i64 @_Z4hillx(i64 noundef %94)
  %99 = add nsw i64 %98, %.4
  %.pre59 = load i64, ptr %2, align 8, !tbaa !8
  br label %100

100:                                              ; preds = %97, %92
  %101 = phi i64 [ %.pre59, %97 ], [ %94, %92 ]
  %.5 = phi i64 [ %99, %97 ], [ %.4, %92 ]
  %102 = add nsw i64 %101, 1
  %103 = call noundef i64 @_Z4hillx(i64 noundef %102)
  %104 = add nsw i64 %103, %.5
  br label %105

105:                                              ; preds = %100, %.lr.ph48
  %.6 = phi i64 [ %104, %100 ], [ %.145, %.lr.ph48 ]
  %106 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.6)
  %107 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %106, ptr noundef nonnull @.str)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  %108 = add nuw nsw i64 %.046, 1
  %109 = load i64, ptr @Q, align 8, !tbaa !8
  %110 = icmp slt i64 %108, %109
  br i1 %110, label %.lr.ph48, label %.loopexit, !llvm.loop !15

._crit_edge52:                                    ; 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 #0 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 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 #5

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

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

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

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


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