; LLVM IR from eyangch/competitive-programming :: USACOcontests/platinum/2021.03 (united_cows_of_farmer_john)

; 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.segment_tree = type { [800005 x i64], [800005 x i64], [800005 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
@A = external dso_local global [200000 x i64], align 16
@pv = external dso_local global [200000 x i64], align 16
@P = external dso_local global [200000 x i64], align 16
@S = external dso_local global %struct.segment_tree, 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 i32, align 4
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %7 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %8 = getelementptr i8, ptr %7, i64 -24
  %9 = load i64, ptr %8, align 8
  %10 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %9
  %11 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %10, ptr noundef null)
  %12 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %13 = 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)
  %14 = load i64, ptr @N, align 8, !tbaa !8
  %15 = getelementptr inbounds i64, ptr @pv, i64 %14
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 -1, ptr %2, align 4, !tbaa !11
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef @pv, ptr noundef %15, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  store i64 0, ptr %3, align 8, !tbaa !8
  br label %16

16:                                               ; preds = %41, %0
  %17 = load i64, ptr %3, 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 %3) #6
  br label %44

21:                                               ; preds = %16
  %22 = load i64, ptr %3, align 8, !tbaa !8
  %23 = getelementptr inbounds [200000 x i64], ptr @A, 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)
  %25 = load i64, ptr %3, align 8, !tbaa !8
  %26 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %25
  %27 = load i64, ptr %26, align 8, !tbaa !8
  %28 = add nsw i64 %27, -1
  store i64 %28, ptr %26, align 8, !tbaa !8
  %29 = load i64, ptr %3, align 8, !tbaa !8
  %30 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %29
  %31 = load i64, ptr %30, align 8, !tbaa !8
  %32 = getelementptr inbounds [200000 x i64], ptr @pv, i64 0, i64 %31
  %33 = load i64, ptr %32, align 8, !tbaa !8
  %34 = load i64, ptr %3, align 8, !tbaa !8
  %35 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %34
  store i64 %33, ptr %35, align 8, !tbaa !8
  %36 = load i64, ptr %3, align 8, !tbaa !8
  %37 = load i64, ptr %3, align 8, !tbaa !8
  %38 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %37
  %39 = load i64, ptr %38, align 8, !tbaa !8
  %40 = getelementptr inbounds [200000 x i64], ptr @pv, i64 0, i64 %39
  store i64 %36, ptr %40, align 8, !tbaa !8
  br label %41

41:                                               ; preds = %21
  %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 %16, !llvm.loop !13

44:                                               ; preds = %20
  %45 = load i64, ptr @N, align 8, !tbaa !8
  call void @_ZN12segment_tree4initEx(ptr noundef nonnull align 8 dereferenceable(19200120) @S, i64 noundef %45)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  store i64 0, ptr %4, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  store i64 0, ptr %5, align 8, !tbaa !8
  br label %46

46:                                               ; preds = %84, %44
  %47 = load i64, ptr %5, align 8, !tbaa !8
  %48 = load i64, ptr @N, align 8, !tbaa !8
  %49 = icmp slt i64 %47, %48
  br i1 %49, label %51, label %50

50:                                               ; preds = %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  br label %87

51:                                               ; preds = %46
  %52 = load i64, ptr %5, align 8, !tbaa !8
  %53 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %52
  %54 = load i64, ptr %53, align 8, !tbaa !8
  %55 = icmp sge i64 %54, 0
  br i1 %55, label %56, label %69

56:                                               ; preds = %51
  %57 = load i64, ptr %5, align 8, !tbaa !8
  %58 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %57
  %59 = load i64, ptr %58, align 8, !tbaa !8
  call void @_ZN12segment_tree10deactivateExxxx(ptr noundef nonnull align 8 dereferenceable(19200120) @S, i64 noundef %59, i64 noundef 0, i64 noundef 199999, i64 noundef 1)
  %60 = load i64, ptr %5, align 8, !tbaa !8
  %61 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %60
  %62 = load i64, ptr %61, align 8, !tbaa !8
  %63 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %62
  %64 = load i64, ptr %63, align 8, !tbaa !8
  %65 = add nsw i64 %64, 1
  %66 = load i64, ptr %5, align 8, !tbaa !8
  %67 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %66
  %68 = load i64, ptr %67, align 8, !tbaa !8
  call void @_ZN12segment_tree3updExxxxxx(ptr noundef nonnull align 8 dereferenceable(19200120) @S, i64 noundef %65, i64 noundef %68, i64 noundef -1, i64 noundef 0, i64 noundef 199999, i64 noundef 1)
  br label %69

69:                                               ; preds = %56, %51
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %70 = load i64, ptr %5, align 8, !tbaa !8
  %71 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %70
  %72 = load i64, ptr %71, align 8, !tbaa !8
  %73 = load i64, ptr %5, align 8, !tbaa !8
  %74 = call noundef i64 @_ZN12segment_tree3qryExxxxx(ptr noundef nonnull align 8 dereferenceable(19200120) @S, i64 noundef %72, i64 noundef %73, i64 noundef 0, i64 noundef 199999, i64 noundef 1)
  store i64 %74, ptr %6, align 8, !tbaa !8
  %75 = load i64, ptr %6, align 8, !tbaa !8
  %76 = load i64, ptr %4, align 8, !tbaa !8
  %77 = add nsw i64 %76, %75
  store i64 %77, ptr %4, align 8, !tbaa !8
  %78 = load i64, ptr %5, align 8, !tbaa !8
  %79 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %78
  %80 = load i64, ptr %79, align 8, !tbaa !8
  %81 = add nsw i64 %80, 1
  %82 = load i64, ptr %5, align 8, !tbaa !8
  %83 = sub nsw i64 %82, 1
  call void @_ZN12segment_tree3updExxxxxx(ptr noundef nonnull align 8 dereferenceable(19200120) @S, i64 noundef %81, i64 noundef %83, i64 noundef 1, i64 noundef 0, i64 noundef 199999, i64 noundef 1)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %84

84:                                               ; preds = %69
  %85 = load i64, ptr %5, align 8, !tbaa !8
  %86 = add nsw i64 %85, 1
  store i64 %86, ptr %5, align 8, !tbaa !8
  br label %46, !llvm.loop !15

87:                                               ; preds = %50
  %88 = load i64, ptr %4, align 8, !tbaa !8
  %89 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %88)
  %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)
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  %91 = load i32, ptr %1, align 4
  ret i32 %91
}

; 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: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) #4

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZN12segment_tree3qryExxxxx(ptr noundef nonnull align 8 dereferenceable(19200120), i64 noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef) #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) #4

; 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 = { 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 #5 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; 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.segment_tree = type { [800005 x i64], [800005 x i64], [800005 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
@A = external dso_local global [200000 x i64], align 16
@pv = external dso_local global [200000 x i64], align 16
@P = external dso_local local_unnamed_addr global [200000 x i64], align 16
@S = external dso_local global %struct.segment_tree, 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 i32, align 4
  %2 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %3 = getelementptr i8, ptr %2, i64 -24
  %4 = load i64, ptr %3, align 8
  %5 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %4
  %6 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %5, ptr noundef null)
  %7 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %8 = 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)
  %9 = load i64, ptr @N, align 8, !tbaa !8
  %10 = getelementptr inbounds i64, ptr @pv, i64 %9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  store i32 -1, ptr %1, align 4, !tbaa !11
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull @pv, ptr noundef nonnull %10, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %11 = load i64, ptr @N, align 8, !tbaa !8
  %12 = icmp sgt i64 %11, 0
  br i1 %12, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  %.lcssa = phi i64 [ %11, %0 ], [ %23, %.lr.ph ]
  call void @_ZN12segment_tree4initEx(ptr noundef nonnull align 8 dereferenceable(19200120) @S, i64 noundef %.lcssa)
  %13 = load i64, ptr @N, align 8, !tbaa !8
  %14 = icmp sgt i64 %13, 0
  br i1 %14, label %.lr.ph30, label %._crit_edge31

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.026 = phi i64 [ %22, %.lr.ph ], [ 0, %0 ]
  %15 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %.026
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %15)
  %17 = load i64, ptr %15, align 8, !tbaa !8
  %18 = add nsw i64 %17, -1
  store i64 %18, ptr %15, align 8, !tbaa !8
  %19 = getelementptr inbounds [200000 x i64], ptr @pv, i64 0, i64 %18
  %20 = load i64, ptr %19, align 8, !tbaa !8
  %21 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %.026
  store i64 %20, ptr %21, align 8, !tbaa !8
  store i64 %.026, ptr %19, align 8, !tbaa !8
  %22 = add nuw nsw i64 %.026, 1
  %23 = load i64, ptr @N, align 8, !tbaa !8
  %24 = icmp slt i64 %22, %23
  br i1 %24, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge31:                                    ; preds = %35, %._crit_edge
  %.023.lcssa = phi i64 [ 0, %._crit_edge ], [ %38, %35 ]
  %25 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.023.lcssa)
  %26 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %25, i8 noundef signext 10)
  ret i32 0

.lr.ph30:                                         ; preds = %._crit_edge, %35
  %.02228 = phi i64 [ %42, %35 ], [ 0, %._crit_edge ]
  %.02327 = phi i64 [ %38, %35 ], [ 0, %._crit_edge ]
  %27 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %.02228
  %28 = load i64, ptr %27, align 8, !tbaa !8
  %29 = icmp sgt i64 %28, -1
  br i1 %29, label %30, label %35

30:                                               ; preds = %.lr.ph30
  call void @_ZN12segment_tree10deactivateExxxx(ptr noundef nonnull align 8 dereferenceable(19200120) @S, i64 noundef %28, i64 noundef 0, i64 noundef 199999, i64 noundef 1)
  %31 = load i64, ptr %27, align 8, !tbaa !8
  %32 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %31
  %33 = load i64, ptr %32, align 8, !tbaa !8
  %34 = add nsw i64 %33, 1
  call void @_ZN12segment_tree3updExxxxxx(ptr noundef nonnull align 8 dereferenceable(19200120) @S, i64 noundef %34, i64 noundef %31, i64 noundef -1, i64 noundef 0, i64 noundef 199999, i64 noundef 1)
  %.pre = load i64, ptr %27, align 8, !tbaa !8
  br label %35

35:                                               ; preds = %30, %.lr.ph30
  %36 = phi i64 [ %.pre, %30 ], [ %28, %.lr.ph30 ]
  %37 = call noundef i64 @_ZN12segment_tree3qryExxxxx(ptr noundef nonnull align 8 dereferenceable(19200120) @S, i64 noundef %36, i64 noundef %.02228, i64 noundef 0, i64 noundef 199999, i64 noundef 1)
  %38 = add nsw i64 %37, %.02327
  %39 = load i64, ptr %27, align 8, !tbaa !8
  %40 = add nsw i64 %39, 1
  %41 = add nsw i64 %.02228, -1
  call void @_ZN12segment_tree3updExxxxxx(ptr noundef nonnull align 8 dereferenceable(19200120) @S, i64 noundef %40, i64 noundef %41, i64 noundef 1, i64 noundef 0, i64 noundef 199999, i64 noundef 1)
  %42 = add nuw nsw i64 %.02228, 1
  %43 = load i64, ptr @N, align 8, !tbaa !8
  %44 = icmp slt i64 %42, %43
  br i1 %44, label %.lr.ph30, label %._crit_edge31, !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: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZN12segment_tree3qryExxxxx(ptr noundef nonnull align 8 dereferenceable(19200120), i64 noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef) 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 #4

; 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 = { 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 #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


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