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

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.segt = type { [400005 x i64], [400005 x i64] }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@N = external dso_local global i64, align 8
@Q = external dso_local global i64, align 8
@a = external dso_local global [100000 x i64], align 16
@b = external dso_local global [100000 x i64], align 16
@p = external dso_local global [100001 x i64], align 16
@second = external dso_local global %struct.segt, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %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) @N)
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 8 dereferenceable(8) @Q)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  store i64 0, ptr %2, align 8, !tbaa !8
  br label %19

19:                                               ; preds = %28, %0
  %20 = load i64, ptr %2, align 8, !tbaa !8
  %21 = load i64, ptr @N, align 8, !tbaa !8
  %22 = icmp slt i64 %20, %21
  br i1 %22, label %24, label %23

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

24:                                               ; preds = %19
  %25 = load i64, ptr %2, align 8, !tbaa !8
  %26 = getelementptr inbounds [100000 x i64], ptr @a, i64 0, i64 %25
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %26)
  br label %28

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

31:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  store i64 0, ptr %3, align 8, !tbaa !8
  br label %32

32:                                               ; preds = %41, %31
  %33 = load i64, ptr %3, align 8, !tbaa !8
  %34 = load i64, ptr @N, align 8, !tbaa !8
  %35 = icmp slt i64 %33, %34
  br i1 %35, label %37, label %36

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

37:                                               ; preds = %32
  %38 = load i64, ptr %3, align 8, !tbaa !8
  %39 = getelementptr inbounds [100000 x i64], ptr @b, i64 0, i64 %38
  %40 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %39)
  br label %41

41:                                               ; preds = %37
  %42 = load i64, ptr %3, align 8, !tbaa !8
  %43 = add nsw i64 %42, 1
  store i64 %43, ptr %3, align 8, !tbaa !8
  br label %32, !llvm.loop !13

44:                                               ; preds = %36
  store i64 0, ptr @p, align 16, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  store i64 1, ptr %4, align 8, !tbaa !8
  br label %45

45:                                               ; preds = %67, %44
  %46 = load i64, ptr %4, align 8, !tbaa !8
  %47 = load i64, ptr @N, align 8, !tbaa !8
  %48 = icmp sle i64 %46, %47
  br i1 %48, label %50, label %49

49:                                               ; preds = %45
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  br label %70

50:                                               ; preds = %45
  %51 = load i64, ptr %4, align 8, !tbaa !8
  %52 = sub nsw i64 %51, 1
  %53 = getelementptr inbounds [100001 x i64], ptr @p, i64 0, i64 %52
  %54 = load i64, ptr %53, align 8, !tbaa !8
  %55 = load i64, ptr %4, align 8, !tbaa !8
  %56 = sub nsw i64 %55, 1
  %57 = getelementptr inbounds [100000 x i64], ptr @b, i64 0, i64 %56
  %58 = load i64, ptr %57, align 8, !tbaa !8
  %59 = load i64, ptr %4, align 8, !tbaa !8
  %60 = sub nsw i64 %59, 1
  %61 = getelementptr inbounds [100000 x i64], ptr @a, i64 0, i64 %60
  %62 = load i64, ptr %61, align 8, !tbaa !8
  %63 = sub nsw i64 %58, %62
  %64 = add nsw i64 %54, %63
  %65 = load i64, ptr %4, align 8, !tbaa !8
  %66 = getelementptr inbounds [100001 x i64], ptr @p, i64 0, i64 %65
  store i64 %64, ptr %66, align 8, !tbaa !8
  br label %67

67:                                               ; preds = %50
  %68 = load i64, ptr %4, align 8, !tbaa !8
  %69 = add nsw i64 %68, 1
  store i64 %69, ptr %4, align 8, !tbaa !8
  br label %45, !llvm.loop !14

70:                                               ; preds = %49
  %71 = load i64, ptr @N, align 8, !tbaa !8
  call void @_ZN4segt5buildExxxRA100001_x(ptr noundef nonnull align 8 dereferenceable(6400080) @second, i64 noundef 1, i64 noundef 0, i64 noundef %71, ptr noundef nonnull align 8 dereferenceable(800008) @p)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  store i64 0, ptr %5, align 8, !tbaa !8
  br label %72

72:                                               ; preds = %123, %70
  %73 = load i64, ptr %5, align 8, !tbaa !8
  %74 = load i64, ptr @Q, align 8, !tbaa !8
  %75 = icmp slt i64 %73, %74
  br i1 %75, label %77, label %76

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

77:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %78 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %79 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %78, ptr noundef nonnull align 8 dereferenceable(8) %8)
  %80 = load i64, ptr %8, align 8, !tbaa !8
  %81 = getelementptr inbounds [100001 x i64], ptr @p, i64 0, i64 %80
  %82 = load i64, ptr %81, align 8, !tbaa !8
  %83 = load i64, ptr %7, align 8, !tbaa !8
  %84 = sub nsw i64 %83, 1
  %85 = getelementptr inbounds [100001 x i64], ptr @p, i64 0, i64 %84
  %86 = load i64, ptr %85, align 8, !tbaa !8
  %87 = icmp ne i64 %82, %86
  br i1 %87, label %88, label %91

88:                                               ; preds = %77
  %89 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef -1)
  %90 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %89, i8 noundef signext 10)
  store i32 13, ptr %6, align 4
  br label %120

91:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %92 = load i64, ptr @N, align 8, !tbaa !8
  %93 = load i64, ptr %7, align 8, !tbaa !8
  %94 = load i64, ptr %8, align 8, !tbaa !8
  %95 = call noundef i64 @_ZN4segt3qryExxxxxb(ptr noundef nonnull align 8 dereferenceable(6400080) @second, i64 noundef 1, i64 noundef 0, i64 noundef %92, i64 noundef %93, i64 noundef %94, i1 noundef zeroext false)
  store i64 %95, ptr %9, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %96 = load i64, ptr @N, align 8, !tbaa !8
  %97 = load i64, ptr %7, align 8, !tbaa !8
  %98 = load i64, ptr %8, align 8, !tbaa !8
  %99 = call noundef i64 @_ZN4segt3qryExxxxxb(ptr noundef nonnull align 8 dereferenceable(6400080) @second, i64 noundef 1, i64 noundef 0, i64 noundef %96, i64 noundef %97, i64 noundef %98, i1 noundef zeroext true)
  store i64 %99, ptr %10, align 8, !tbaa !8
  %100 = load i64, ptr %9, align 8, !tbaa !8
  %101 = load i64, ptr %7, align 8, !tbaa !8
  %102 = sub nsw i64 %101, 1
  %103 = getelementptr inbounds [100001 x i64], ptr @p, i64 0, i64 %102
  %104 = load i64, ptr %103, align 8, !tbaa !8
  %105 = sub nsw i64 %100, %104
  %106 = icmp slt i64 %105, 0
  br i1 %106, label %107, label %110

107:                                              ; preds = %91
  %108 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef -1)
  %109 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %108, i8 noundef signext 10)
  store i32 13, ptr %6, align 4
  br label %119

110:                                              ; preds = %91
  %111 = load i64, ptr %10, align 8, !tbaa !8
  %112 = load i64, ptr %7, align 8, !tbaa !8
  %113 = sub nsw i64 %112, 1
  %114 = getelementptr inbounds [100001 x i64], ptr @p, i64 0, i64 %113
  %115 = load i64, ptr %114, align 8, !tbaa !8
  %116 = sub nsw i64 %111, %115
  %117 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %116)
  %118 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %117, i8 noundef signext 10)
  store i32 0, ptr %6, align 4
  br label %119

119:                                              ; preds = %110, %107
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %120

120:                                              ; preds = %119, %88
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  %121 = load i32, ptr %6, align 4
  switch i32 %121, label %128 [
    i32 0, label %122
    i32 13, label %123
  ]

122:                                              ; preds = %120
  br label %123

123:                                              ; preds = %122, %120
  %124 = load i64, ptr %5, align 8, !tbaa !8
  %125 = add nsw i64 %124, 1
  store i64 %125, ptr %5, align 8, !tbaa !8
  br label %72, !llvm.loop !15

126:                                              ; preds = %76
  %127 = load i32, ptr %1, align 4
  ret i32 %127

128:                                              ; preds = %120
  unreachable
}

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4segt5buildExxxRA100001_x(ptr noundef nonnull align 8 dereferenceable(6400080), i64 noundef, i64 noundef, i64 noundef, ptr noundef nonnull align 8 dereferenceable(800008)) #3 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZN4segt3qryExxxxxb(ptr noundef nonnull align 8 dereferenceable(6400080), i64 noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef, i1 noundef zeroext) #3 align 2

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

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

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

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.segt = type { [400005 x i64], [400005 x i64] }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@N = external dso_local global i64, align 8
@Q = external dso_local global i64, align 8
@a = external dso_local global [100000 x i64], align 16
@b = external dso_local global [100000 x i64], align 16
@p = external dso_local global [100001 x i64], align 16
@second = external dso_local global %struct.segt, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca 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) @N)
  %10 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(8) @Q)
  %11 = load i64, ptr @N, align 8, !tbaa !8
  %12 = icmp sgt i64 %11, 0
  br i1 %12, label %.lr.ph, label %._crit_edge.thread

.preheader:                                       ; preds = %.lr.ph
  %13 = icmp sgt i64 %17, 0
  br i1 %13, label %.lr.ph24, label %._crit_edge.thread

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

._crit_edge.thread:                               ; preds = %.preheader, %0
  %.lcssa.ph = phi i64 [ %17, %.preheader ], [ %11, %0 ]
  store i64 0, ptr @p, align 16, !tbaa !8
  br label %._crit_edge29

._crit_edge:                                      ; preds = %.lr.ph24
  store i64 0, ptr @p, align 16, !tbaa !8
  %.not25 = icmp slt i64 %23, 1
  br i1 %.not25, label %._crit_edge29, label %.lr.ph28.preheader

.lr.ph28.preheader:                               ; preds = %._crit_edge
  %xtraiter = and i64 %23, 1
  %19 = icmp eq i64 %23, 1
  br i1 %19, label %._crit_edge29.loopexit.unr-lcssa, label %.lr.ph28.preheader.new

.lr.ph28.preheader.new:                           ; preds = %.lr.ph28.preheader
  %unroll_iter = and i64 %23, 9223372036854775806
  br label %.lr.ph28

.lr.ph24:                                         ; preds = %.preheader, %.lr.ph24
  %.01723 = phi i64 [ %22, %.lr.ph24 ], [ 0, %.preheader ]
  %20 = getelementptr inbounds [100000 x i64], ptr @b, i64 0, i64 %.01723
  %21 = 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) %20)
  %22 = add nuw nsw i64 %.01723, 1
  %23 = load i64, ptr @N, align 8, !tbaa !8
  %24 = icmp slt i64 %22, %23
  br i1 %24, label %.lr.ph24, label %._crit_edge, !llvm.loop !13

._crit_edge29.loopexit.unr-lcssa:                 ; preds = %.lr.ph28, %.lr.ph28.preheader
  %.unr = phi i64 [ 0, %.lr.ph28.preheader ], [ %50, %.lr.ph28 ]
  %.01926.unr = phi i64 [ 1, %.lr.ph28.preheader ], [ %52, %.lr.ph28 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge29, label %.lr.ph28.epil

.lr.ph28.epil:                                    ; preds = %._crit_edge29.loopexit.unr-lcssa
  %25 = add nsw i64 %.01926.unr, -1
  %26 = getelementptr inbounds [100000 x i64], ptr @b, i64 0, i64 %25
  %27 = load i64, ptr %26, align 8, !tbaa !8
  %28 = getelementptr inbounds [100000 x i64], ptr @a, i64 0, i64 %25
  %29 = load i64, ptr %28, align 8, !tbaa !8
  %30 = add i64 %27, %.unr
  %31 = sub i64 %30, %29
  %32 = getelementptr inbounds [100001 x i64], ptr @p, i64 0, i64 %.01926.unr
  store i64 %31, ptr %32, align 8, !tbaa !8
  br label %._crit_edge29

._crit_edge29:                                    ; preds = %.lr.ph28.epil, %._crit_edge29.loopexit.unr-lcssa, %._crit_edge.thread, %._crit_edge
  %.lcssa37 = phi i64 [ %.lcssa.ph, %._crit_edge.thread ], [ %23, %._crit_edge ], [ %23, %._crit_edge29.loopexit.unr-lcssa ], [ %23, %.lr.ph28.epil ]
  tail call void @_ZN4segt5buildExxxRA100001_x(ptr noundef nonnull align 8 dereferenceable(6400080) @second, i64 noundef 1, i64 noundef 0, i64 noundef %.lcssa37, ptr noundef nonnull align 8 dereferenceable(800008) @p)
  %33 = load i64, ptr @Q, align 8, !tbaa !8
  %34 = icmp sgt i64 %33, 0
  br i1 %34, label %.lr.ph32, label %._crit_edge33

.lr.ph28:                                         ; preds = %.lr.ph28, %.lr.ph28.preheader.new
  %35 = phi i64 [ 0, %.lr.ph28.preheader.new ], [ %50, %.lr.ph28 ]
  %.01926 = phi i64 [ 1, %.lr.ph28.preheader.new ], [ %52, %.lr.ph28 ]
  %niter = phi i64 [ 0, %.lr.ph28.preheader.new ], [ %niter.next.1, %.lr.ph28 ]
  %36 = add nsw i64 %.01926, -1
  %37 = getelementptr inbounds [100000 x i64], ptr @b, i64 0, i64 %36
  %38 = load i64, ptr %37, align 8, !tbaa !8
  %39 = getelementptr inbounds [100000 x i64], ptr @a, i64 0, i64 %36
  %40 = load i64, ptr %39, align 8, !tbaa !8
  %41 = add i64 %38, %35
  %42 = sub i64 %41, %40
  %43 = getelementptr inbounds [100001 x i64], ptr @p, i64 0, i64 %.01926
  store i64 %42, ptr %43, align 8, !tbaa !8
  %44 = add nuw i64 %.01926, 1
  %45 = getelementptr inbounds [100000 x i64], ptr @b, i64 0, i64 %.01926
  %46 = load i64, ptr %45, align 8, !tbaa !8
  %47 = getelementptr inbounds [100000 x i64], ptr @a, i64 0, i64 %.01926
  %48 = load i64, ptr %47, align 8, !tbaa !8
  %49 = add i64 %46, %42
  %50 = sub i64 %49, %48
  %51 = getelementptr inbounds [100001 x i64], ptr @p, i64 0, i64 %44
  store i64 %50, ptr %51, align 8, !tbaa !8
  %52 = add nuw i64 %.01926, 2
  %niter.next.1 = add nuw i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge29.loopexit.unr-lcssa, label %.lr.ph28, !llvm.loop !14

._crit_edge33:                                    ; preds = %81, %._crit_edge29
  ret i32 0

.lr.ph32:                                         ; preds = %._crit_edge29, %81
  %.01830 = phi i64 [ %83, %81 ], [ 0, %._crit_edge29 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %53 = 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)
  %54 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %53, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %55 = load i64, ptr %2, align 8, !tbaa !8
  %56 = getelementptr inbounds [100001 x i64], ptr @p, i64 0, i64 %55
  %57 = load i64, ptr %56, align 8, !tbaa !8
  %58 = load i64, ptr %1, align 8, !tbaa !8
  %59 = add nsw i64 %58, -1
  %60 = getelementptr inbounds [100001 x i64], ptr @p, i64 0, i64 %59
  %61 = load i64, ptr %60, align 8, !tbaa !8
  %.not21 = icmp eq i64 %57, %61
  br i1 %.not21, label %64, label %62

62:                                               ; preds = %.lr.ph32
  %63 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef -1)
  br label %81

64:                                               ; preds = %.lr.ph32
  %65 = load i64, ptr @N, align 8, !tbaa !8
  %66 = call noundef i64 @_ZN4segt3qryExxxxxb(ptr noundef nonnull align 8 dereferenceable(6400080) @second, i64 noundef 1, i64 noundef 0, i64 noundef %65, i64 noundef %58, i64 noundef %55, i1 noundef zeroext false)
  %67 = load i64, ptr @N, align 8, !tbaa !8
  %68 = load i64, ptr %1, align 8, !tbaa !8
  %69 = load i64, ptr %2, align 8, !tbaa !8
  %70 = call noundef i64 @_ZN4segt3qryExxxxxb(ptr noundef nonnull align 8 dereferenceable(6400080) @second, i64 noundef 1, i64 noundef 0, i64 noundef %67, i64 noundef %68, i64 noundef %69, i1 noundef zeroext true)
  %71 = load i64, ptr %1, align 8, !tbaa !8
  %72 = add nsw i64 %71, -1
  %73 = getelementptr inbounds [100001 x i64], ptr @p, i64 0, i64 %72
  %74 = load i64, ptr %73, align 8, !tbaa !8
  %75 = icmp slt i64 %66, %74
  br i1 %75, label %76, label %78

76:                                               ; preds = %64
  %77 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef -1)
  br label %81

78:                                               ; preds = %64
  %79 = sub nsw i64 %70, %74
  %80 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %79)
  br label %81

81:                                               ; preds = %76, %78, %62
  %.sink = phi ptr [ %77, %76 ], [ %80, %78 ], [ %63, %62 ]
  %82 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %.sink, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  %83 = add nuw nsw i64 %.01830, 1
  %84 = load i64, ptr @Q, align 8, !tbaa !8
  %85 = icmp slt i64 %83, %84
  br i1 %85, label %.lr.ph32, label %._crit_edge33, !llvm.loop !15
}

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4segt5buildExxxRA100001_x(ptr noundef nonnull align 8 dereferenceable(6400080), i64 noundef, i64 noundef, i64 noundef, ptr noundef nonnull align 8 dereferenceable(800008)) local_unnamed_addr #3 align 2

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

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 dso_local noundef i64 @_ZN4segt3qryExxxxxb(ptr noundef nonnull align 8 dereferenceable(6400080), i64 noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef, i1 noundef zeroext) local_unnamed_addr #3 align 2

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass