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

%"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
@h = external dso_local global [300000 x i64], align 16
@b = external dso_local global [300000 x i64], align 16
@s = external dso_local global ptr, align 8
@s2 = external dso_local global ptr, align 8
@_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 norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %9 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %10 = getelementptr i8, ptr %9, i64 -24
  %11 = load i64, ptr %10, align 8
  %12 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %11
  %13 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %12, ptr noundef null)
  %14 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %15 = 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) #9
  store i64 0, ptr %2, align 8, !tbaa !8
  br label %16

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

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

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

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

28:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #9
  store i64 0, ptr %3, align 8, !tbaa !8
  br label %29

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

33:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #9
  br label %41

34:                                               ; preds = %29
  %35 = load i64, ptr %3, align 8, !tbaa !8
  %36 = getelementptr inbounds [300000 x i64], ptr @b, i64 0, i64 %35
  %37 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %36)
  br label %38

38:                                               ; preds = %34
  %39 = load i64, ptr %3, align 8, !tbaa !8
  %40 = add nsw i64 %39, 1
  store i64 %40, ptr %3, align 8, !tbaa !8
  br label %29, !llvm.loop !13

41:                                               ; preds = %33
  %42 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 48) #10
  %43 = load i64, ptr @N, align 8, !tbaa !8
  %44 = add nsw i64 %43, 1
  invoke void @_ZN4segtC2Exx(ptr noundef nonnull align 8 dereferenceable(48) %42, i64 noundef 1, i64 noundef %44)
          to label %45 unwind label %58

45:                                               ; preds = %41
  store ptr %42, ptr @s, align 8, !tbaa !14
  %46 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 48) #10
  %47 = load i64, ptr @N, align 8, !tbaa !8
  %48 = add nsw i64 %47, 1
  invoke void @_ZN4segtC2Exx(ptr noundef nonnull align 8 dereferenceable(48) %46, i64 noundef 1, i64 noundef %48)
          to label %49 unwind label %62

49:                                               ; preds = %45
  store ptr %46, ptr @s2, align 8, !tbaa !14
  %50 = load ptr, ptr @s, align 8, !tbaa !14
  %51 = load i64, ptr @N, align 8, !tbaa !8
  %52 = add nsw i64 %51, 1
  call void @_ZN4segt3updExx(ptr noundef nonnull align 8 dereferenceable(48) %50, i64 noundef %52, i64 noundef 0)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #9
  store i64 0, ptr %6, align 8, !tbaa !8
  br label %53

53:                                               ; preds = %106, %49
  %54 = load i64, ptr %6, align 8, !tbaa !8
  %55 = load i64, ptr @N, align 8, !tbaa !8
  %56 = icmp slt i64 %54, %55
  br i1 %56, label %66, label %57

57:                                               ; preds = %53
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #9
  br label %109

58:                                               ; preds = %41
  %59 = landingpad { ptr, i32 }
          cleanup
  %60 = extractvalue { ptr, i32 } %59, 0
  store ptr %60, ptr %4, align 8
  %61 = extractvalue { ptr, i32 } %59, 1
  store i32 %61, ptr %5, align 4
  call void @_ZdlPvm(ptr noundef %42, i64 noundef 48) #11
  br label %117

62:                                               ; preds = %45
  %63 = landingpad { ptr, i32 }
          cleanup
  %64 = extractvalue { ptr, i32 } %63, 0
  store ptr %64, ptr %4, align 8
  %65 = extractvalue { ptr, i32 } %63, 1
  store i32 %65, ptr %5, align 4
  call void @_ZdlPvm(ptr noundef %46, i64 noundef 48) #11
  br label %117

66:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #9
  %67 = load ptr, ptr @s, align 8, !tbaa !14
  %68 = load i64, ptr %6, align 8, !tbaa !8
  %69 = getelementptr inbounds [300000 x i64], ptr @h, i64 0, i64 %68
  %70 = load i64, ptr %69, align 8, !tbaa !8
  %71 = load i64, ptr @N, align 8, !tbaa !8
  %72 = add nsw i64 %71, 1
  %73 = call noundef i64 @_ZN4segt3qryExx(ptr noundef nonnull align 8 dereferenceable(48) %67, i64 noundef %70, i64 noundef %72)
  store i64 %73, ptr %7, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #9
  %74 = load ptr, ptr @s2, align 8, !tbaa !14
  %75 = load i64, ptr @N, align 8, !tbaa !8
  %76 = add nsw i64 %75, 1
  %77 = call noundef i64 @_ZN4segt3qryExx(ptr noundef nonnull align 8 dereferenceable(48) %74, i64 noundef 1, i64 noundef %76)
  store i64 %77, ptr %8, align 8, !tbaa !8
  %78 = load ptr, ptr @s, align 8, !tbaa !14
  %79 = load i64, ptr %6, align 8, !tbaa !8
  %80 = getelementptr inbounds [300000 x i64], ptr @h, i64 0, i64 %79
  %81 = load i64, ptr %80, align 8, !tbaa !8
  %82 = load i64, ptr @N, align 8, !tbaa !8
  %83 = add nsw i64 %82, 1
  call void @_ZN4segt5fzeroExx(ptr noundef nonnull align 8 dereferenceable(48) %78, i64 noundef %81, i64 noundef %83)
  %84 = load ptr, ptr @s2, align 8, !tbaa !14
  %85 = load i64, ptr %6, align 8, !tbaa !8
  %86 = getelementptr inbounds [300000 x i64], ptr @h, i64 0, i64 %85
  %87 = load i64, ptr %86, align 8, !tbaa !8
  %88 = load i64, ptr @N, align 8, !tbaa !8
  %89 = add nsw i64 %88, 1
  call void @_ZN4segt5fzeroExx(ptr noundef nonnull align 8 dereferenceable(48) %84, i64 noundef %87, i64 noundef %89)
  %90 = load ptr, ptr @s, align 8, !tbaa !14
  %91 = load i64, ptr %6, align 8, !tbaa !8
  %92 = getelementptr inbounds [300000 x i64], ptr @h, i64 0, i64 %91
  %93 = load i64, ptr %92, align 8, !tbaa !8
  %94 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8)
  %95 = load i64, ptr %94, align 8, !tbaa !8
  call void @_ZN4segt3updExx(ptr noundef nonnull align 8 dereferenceable(48) %90, i64 noundef %93, i64 noundef %95)
  %96 = load ptr, ptr @s2, align 8, !tbaa !14
  %97 = load i64, ptr %6, align 8, !tbaa !8
  %98 = getelementptr inbounds [300000 x i64], ptr @h, i64 0, i64 %97
  %99 = load i64, ptr %98, align 8, !tbaa !8
  %100 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8)
  %101 = load i64, ptr %100, align 8, !tbaa !8
  %102 = load i64, ptr %6, align 8, !tbaa !8
  %103 = getelementptr inbounds [300000 x i64], ptr @b, i64 0, i64 %102
  %104 = load i64, ptr %103, align 8, !tbaa !8
  %105 = add nsw i64 %101, %104
  call void @_ZN4segt3updExx(ptr noundef nonnull align 8 dereferenceable(48) %96, i64 noundef %99, i64 noundef %105)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #9
  br label %106

106:                                              ; preds = %66
  %107 = load i64, ptr %6, align 8, !tbaa !8
  %108 = add nsw i64 %107, 1
  store i64 %108, ptr %6, align 8, !tbaa !8
  br label %53, !llvm.loop !16

109:                                              ; preds = %57
  %110 = load ptr, ptr @s2, align 8, !tbaa !14
  %111 = load i64, ptr @N, align 8, !tbaa !8
  %112 = add nsw i64 %111, 1
  %113 = call noundef i64 @_ZN4segt3qryExx(ptr noundef nonnull align 8 dereferenceable(48) %110, i64 noundef 1, i64 noundef %112)
  %114 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %113)
  %115 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %114, ptr noundef @.str)
  %116 = load i32, ptr %1, align 4
  ret i32 %116

117:                                              ; preds = %62, %58
  %118 = load ptr, ptr %4, align 8
  %119 = load i32, ptr %5, align 4
  %120 = insertvalue { ptr, i32 } poison, ptr %118, 0
  %121 = insertvalue { ptr, i32 } %120, i32 %119, 1
  resume { ptr, i32 } %121
}

; 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: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #5

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4segtC2Exx(ptr noundef nonnull align 8 dereferenceable(48), i64 noundef, i64 noundef) unnamed_addr #3 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #6

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

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

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

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

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

; 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 = { nobuiltin allocsize(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 = { nobuiltin nounwind "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 = { 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 #8 = { 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 #9 = { nounwind }
attributes #10 = { builtin allocsize(0) }
attributes #11 = { builtin 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 = !{!15, !15, i64 0}
!15 = !{!"any pointer", !10, i64 0}
!16 = distinct !{!16, !12}


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

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

@N = external dso_local global i64, align 8
@h = external dso_local global [300000 x i64], align 16
@b = external dso_local global [300000 x i64], align 16
@s = external dso_local local_unnamed_addr global ptr, align 8
@s2 = external dso_local local_unnamed_addr global ptr, align 8
@_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 norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %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 = load i64, ptr @N, align 8, !tbaa !8
  %11 = icmp sgt i64 %10, 0
  br i1 %11, label %.lr.ph, label %._crit_edge

.preheader:                                       ; preds = %.lr.ph
  %12 = icmp sgt i64 %16, 0
  br i1 %12, label %.lr.ph25, label %._crit_edge

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

._crit_edge:                                      ; preds = %.lr.ph25, %0, %.preheader
  %.lcssa22 = phi i64 [ %16, %.preheader ], [ %10, %0 ], [ %23, %.lr.ph25 ]
  %18 = tail call noalias noundef nonnull dereferenceable(48) ptr @_Znwm(i64 noundef 48) #9
  %19 = add nsw i64 %.lcssa22, 1
  invoke void @_ZN4segtC2Exx(ptr noundef nonnull align 8 dereferenceable(48) %18, i64 noundef 1, i64 noundef %19)
          to label %25 unwind label %40

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

25:                                               ; preds = %._crit_edge
  store ptr %18, ptr @s, align 8, !tbaa !14
  %26 = tail call noalias noundef nonnull dereferenceable(48) ptr @_Znwm(i64 noundef 48) #9
  %27 = load i64, ptr @N, align 8, !tbaa !8
  %28 = add nsw i64 %27, 1
  invoke void @_ZN4segtC2Exx(ptr noundef nonnull align 8 dereferenceable(48) %26, i64 noundef 1, i64 noundef %28)
          to label %29 unwind label %42

29:                                               ; preds = %25
  store ptr %26, ptr @s2, align 8, !tbaa !14
  %30 = load ptr, ptr @s, align 8, !tbaa !14
  %31 = load i64, ptr @N, align 8, !tbaa !8
  %32 = add nsw i64 %31, 1
  tail call void @_ZN4segt3updExx(ptr noundef nonnull align 8 dereferenceable(48) %30, i64 noundef %32, i64 noundef 0)
  %33 = load i64, ptr @N, align 8, !tbaa !8
  %34 = icmp sgt i64 %33, 0
  br i1 %34, label %.lr.ph28, label %._crit_edge29

._crit_edge29:                                    ; preds = %.lr.ph28, %29
  %.lcssa = phi i64 [ %33, %29 ], [ %74, %.lr.ph28 ]
  %35 = load ptr, ptr @s2, align 8, !tbaa !14
  %36 = add nsw i64 %.lcssa, 1
  %37 = call noundef i64 @_ZN4segt3qryExx(ptr noundef nonnull align 8 dereferenceable(48) %35, i64 noundef 1, i64 noundef %36)
  %38 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %37)
  %39 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %38, ptr noundef nonnull @.str)
  ret i32 0

40:                                               ; preds = %._crit_edge
  %41 = landingpad { ptr, i32 }
          cleanup
  br label %76

42:                                               ; preds = %25
  %43 = landingpad { ptr, i32 }
          cleanup
  br label %76

.lr.ph28:                                         ; preds = %29, %.lr.ph28
  %44 = phi i64 [ %74, %.lr.ph28 ], [ %33, %29 ]
  %.026 = phi i64 [ %73, %.lr.ph28 ], [ 0, %29 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #10
  %45 = load ptr, ptr @s, align 8, !tbaa !14
  %46 = getelementptr inbounds [300000 x i64], ptr @h, i64 0, i64 %.026
  %47 = load i64, ptr %46, align 8, !tbaa !8
  %48 = add nsw i64 %44, 1
  %49 = call noundef i64 @_ZN4segt3qryExx(ptr noundef nonnull align 8 dereferenceable(48) %45, i64 noundef %47, i64 noundef %48)
  store i64 %49, ptr %1, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #10
  %50 = load ptr, ptr @s2, align 8, !tbaa !14
  %51 = load i64, ptr @N, align 8, !tbaa !8
  %52 = add nsw i64 %51, 1
  %53 = call noundef i64 @_ZN4segt3qryExx(ptr noundef nonnull align 8 dereferenceable(48) %50, i64 noundef 1, i64 noundef %52)
  store i64 %53, ptr %2, align 8, !tbaa !8
  %54 = load ptr, ptr @s, align 8, !tbaa !14
  %55 = load i64, ptr %46, align 8, !tbaa !8
  %56 = load i64, ptr @N, align 8, !tbaa !8
  %57 = add nsw i64 %56, 1
  call void @_ZN4segt5fzeroExx(ptr noundef nonnull align 8 dereferenceable(48) %54, i64 noundef %55, i64 noundef %57)
  %58 = load ptr, ptr @s2, align 8, !tbaa !14
  %59 = load i64, ptr %46, align 8, !tbaa !8
  %60 = load i64, ptr @N, align 8, !tbaa !8
  %61 = add nsw i64 %60, 1
  call void @_ZN4segt5fzeroExx(ptr noundef nonnull align 8 dereferenceable(48) %58, i64 noundef %59, i64 noundef %61)
  %62 = load ptr, ptr @s, align 8, !tbaa !14
  %63 = load i64, ptr %46, align 8, !tbaa !8
  %64 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %65 = load i64, ptr %64, align 8, !tbaa !8
  call void @_ZN4segt3updExx(ptr noundef nonnull align 8 dereferenceable(48) %62, i64 noundef %63, i64 noundef %65)
  %66 = load ptr, ptr @s2, align 8, !tbaa !14
  %67 = load i64, ptr %46, align 8, !tbaa !8
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %69 = load i64, ptr %68, align 8, !tbaa !8
  %70 = getelementptr inbounds [300000 x i64], ptr @b, i64 0, i64 %.026
  %71 = load i64, ptr %70, align 8, !tbaa !8
  %72 = add nsw i64 %71, %69
  call void @_ZN4segt3updExx(ptr noundef nonnull align 8 dereferenceable(48) %66, i64 noundef %67, i64 noundef %72)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #10
  %73 = add nuw nsw i64 %.026, 1
  %74 = load i64, ptr @N, align 8, !tbaa !8
  %75 = icmp slt i64 %73, %74
  br i1 %75, label %.lr.ph28, label %._crit_edge29, !llvm.loop !16

76:                                               ; preds = %42, %40
  %.sink = phi ptr [ %26, %42 ], [ %18, %40 ]
  %.pn = phi { ptr, i32 } [ %43, %42 ], [ %41, %40 ]
  tail call void @_ZdlPvm(ptr noundef nonnull %.sink, i64 noundef 48) #11
  resume { ptr, i32 } %.pn
}

; 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: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4segtC2Exx(ptr noundef nonnull align 8 dereferenceable(48), i64 noundef, i64 noundef) unnamed_addr #3 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #6

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

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

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

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

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

; 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 = { nobuiltin allocsize(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 = { nobuiltin nounwind "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 = { 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 #8 = { 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 #9 = { builtin allocsize(0) }
attributes #10 = { nounwind }
attributes #11 = { builtin 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 = !{!15, !15, i64 0}
!15 = !{!"any pointer", !10, i64 0}
!16 = distinct !{!16, !12}


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