; LLVM IR from tangjz/acm-icpc :: codeforces/complete (700E)

; 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.std::pair" = type { i32, i32 }

@n = external dso_local global i32, align 4
@rk = external dso_local global [200001 x i32], align 16
@buf = external dso_local global [200001 x i8], align 16
@seg2 = external dso_local global [400003 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11SuffixArrayv() #0

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z7seg_updiiiiSt4pairIiiE(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i64) #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_Z7seg_queiii(i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8seg2_updiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z8seg2_queiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #4 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"struct.std::pair", align 4
  %5 = alloca %"struct.std::pair", align 4
  %6 = alloca %"struct.std::pair", align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::pair", align 4
  %10 = alloca %"struct.std::pair", align 4
  store i32 0, ptr %1, align 4
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @buf)
  call void @_Z11SuffixArrayv()
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #9
  store i32 0, ptr %2, align 4, !tbaa !5
  %12 = load i32, ptr @n, align 4, !tbaa !5
  %13 = shl i32 %12, 1
  %14 = sext i32 %13 to i64
  %15 = mul i64 %14, 4
  call void @llvm.memset.p0.i64(ptr align 16 @seg2, i8 63, i64 %15, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #9
  %16 = load i32, ptr @n, align 4, !tbaa !5
  %17 = sub nsw i32 %16, 1
  store i32 %17, ptr %3, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %86, %0
  %19 = load i32, ptr %3, align 4, !tbaa !5
  %20 = icmp sge i32 %19, 0
  br i1 %20, label %22, label %21

21:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #9
  br label %89

22:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #9
  %23 = load i32, ptr @n, align 4, !tbaa !5
  %24 = sub nsw i32 %23, 1
  %25 = load i32, ptr %3, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [200001 x i32], ptr @rk, i64 0, i64 %26
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = call i64 @_Z7seg_queiii(i32 noundef 0, i32 noundef %24, i32 noundef %28)
  store i64 %29, ptr %4, align 4
  %30 = getelementptr inbounds %"struct.std::pair", ptr %4, i32 0, i32 1
  %31 = load i32, ptr %30, align 4, !tbaa !9
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %33, label %57

33:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #9
  %34 = load i32, ptr %3, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [200001 x i32], ptr @rk, i64 0, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = getelementptr inbounds %"struct.std::pair", ptr %4, i32 0, i32 1
  %39 = load i32, ptr %38, align 4, !tbaa !9
  %40 = sub nsw i32 0, %39
  %41 = call i64 @_Z8getRangeii(i32 noundef %37, i32 noundef %40)
  store i64 %41, ptr %5, align 4
  %42 = getelementptr inbounds %"struct.std::pair", ptr %4, i32 0, i32 0
  %43 = load i32, ptr %42, align 4, !tbaa !11
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %42, align 4, !tbaa !11
  %45 = load i32, ptr @n, align 4, !tbaa !5
  %46 = sub nsw i32 %45, 1
  %47 = getelementptr inbounds %"struct.std::pair", ptr %5, i32 0, i32 0
  %48 = load i32, ptr %47, align 4, !tbaa !11
  %49 = getelementptr inbounds %"struct.std::pair", ptr %5, i32 0, i32 1
  %50 = load i32, ptr %49, align 4, !tbaa !9
  %51 = call noundef i32 @_Z8seg2_queiiii(i32 noundef 0, i32 noundef %46, i32 noundef %48, i32 noundef %50)
  %52 = load i32, ptr %3, align 4, !tbaa !5
  %53 = sub nsw i32 %51, %52
  %54 = getelementptr inbounds %"struct.std::pair", ptr %4, i32 0, i32 1
  %55 = load i32, ptr %54, align 4, !tbaa !9
  %56 = sub nsw i32 %55, %53
  store i32 %56, ptr %54, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #9
  br label %60

57:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #9
  store i32 1, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #9
  store i32 -1, ptr %8, align 4, !tbaa !5
  %58 = call i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  store i64 %58, ptr %6, align 4
  %59 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(8) %6) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #9
  br label %60

60:                                               ; preds = %57, %33
  %61 = getelementptr inbounds %"struct.std::pair", ptr %4, i32 0, i32 0
  %62 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %61)
  %63 = load i32, ptr %62, align 4, !tbaa !5
  store i32 %63, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #9
  %64 = load i32, ptr %3, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [200001 x i32], ptr @rk, i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = getelementptr inbounds %"struct.std::pair", ptr %4, i32 0, i32 1
  %69 = load i32, ptr %68, align 4, !tbaa !9
  %70 = sub nsw i32 0, %69
  %71 = call i64 @_Z8getRangeii(i32 noundef %67, i32 noundef %70)
  store i64 %71, ptr %9, align 4
  %72 = load i32, ptr @n, align 4, !tbaa !5
  %73 = sub nsw i32 %72, 1
  %74 = getelementptr inbounds %"struct.std::pair", ptr %9, i32 0, i32 0
  %75 = load i32, ptr %74, align 4, !tbaa !11
  %76 = getelementptr inbounds %"struct.std::pair", ptr %9, i32 0, i32 1
  %77 = load i32, ptr %76, align 4, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %10, ptr align 4 %4, i64 8, i1 false)
  %78 = load i64, ptr %10, align 4
  call void @_Z7seg_updiiiiSt4pairIiiE(i32 noundef 0, i32 noundef %73, i32 noundef %75, i32 noundef %77, i64 %78)
  %79 = load i32, ptr @n, align 4, !tbaa !5
  %80 = sub nsw i32 %79, 1
  %81 = load i32, ptr %3, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [200001 x i32], ptr @rk, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = load i32, ptr %3, align 4, !tbaa !5
  call void @_Z8seg2_updiiii(i32 noundef 0, i32 noundef %80, i32 noundef %84, i32 noundef %85)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #9
  br label %86

86:                                               ; preds = %60
  %87 = load i32, ptr %3, align 4, !tbaa !5
  %88 = add nsw i32 %87, -1
  store i32 %88, ptr %3, align 4, !tbaa !5
  br label %18, !llvm.loop !12

89:                                               ; preds = %21
  %90 = load i32, ptr %2, align 4, !tbaa !5
  %91 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %90)
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #9
  ret i32 0
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i64 @_Z8getRangeii(i32 noundef, i32 noundef) #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #7 align 2

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

declare i32 @printf(ptr noundef, ...) #5

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 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 #9 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 4}
!10 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!11 = !{!10, !6, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


; 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.std::pair" = type { i32, i32 }

@n = external dso_local global i32, align 4
@rk = external dso_local local_unnamed_addr global [200001 x i32], align 16
@buf = external dso_local global [200001 x i8], align 16
@seg2 = external dso_local local_unnamed_addr global [400003 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11SuffixArrayv() local_unnamed_addr #0

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z7seg_updiiiiSt4pairIiiE(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i64) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_Z7seg_queiii(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8seg2_updiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i32, align 4
  %2 = alloca %"struct.std::pair", align 8
  %3 = alloca %"struct.std::pair", align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @buf)
  tail call void @_Z11SuffixArrayv()
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  store i32 0, ptr %1, align 4, !tbaa !5
  %7 = load i32, ptr @n, align 4, !tbaa !5
  %8 = shl i32 %7, 1
  %9 = sext i32 %8 to i64
  %10 = shl nsw i64 %9, 2
  tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @seg2, i8 63, i64 %10, i1 false)
  %11 = icmp sgt i32 %7, 0
  br i1 %11, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %0
  %12 = getelementptr inbounds i8, ptr %2, i64 4
  %13 = zext nneg i32 %7 to i64
  br label %16

._crit_edge.loopexit:                             ; preds = %39
  %.pre = load i32, ptr %1, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %0
  %14 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ 0, %0 ]
  %15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %14)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  ret i32 0

16:                                               ; preds = %.lr.ph, %39
  %indvars.iv = phi i64 [ %13, %.lr.ph ], [ %indvars.iv.next, %39 ]
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #8
  %17 = load i32, ptr @n, align 4, !tbaa !5
  %18 = add nsw i32 %17, -1
  %19 = getelementptr inbounds [200001 x i32], ptr @rk, i64 0, i64 %indvars.iv.next
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = call i64 @_Z7seg_queiii(i32 noundef 0, i32 noundef %18, i32 noundef %20)
  store i64 %21, ptr %2, align 8
  %.not = icmp ult i64 %21, 4294967296
  br i1 %.not, label %36, label %22

22:                                               ; preds = %16
  %23 = lshr i64 %21, 32
  %24 = trunc nuw i64 %23 to i32
  %25 = load i32, ptr %19, align 4, !tbaa !5
  %26 = sub nsw i32 0, %24
  %27 = call i64 @_Z8getRangeii(i32 noundef %25, i32 noundef %26)
  %.sroa.02.0.extract.trunc = trunc i64 %27 to i32
  %.sroa.43.0.extract.shift = lshr i64 %27, 32
  %.sroa.43.0.extract.trunc = trunc nuw i64 %.sroa.43.0.extract.shift to i32
  %28 = load i32, ptr %2, align 8, !tbaa !9
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %2, align 8, !tbaa !9
  %30 = load i32, ptr @n, align 4, !tbaa !5
  %31 = add nsw i32 %30, -1
  %32 = call noundef i32 @_Z8seg2_queiiii(i32 noundef 0, i32 noundef %31, i32 noundef %.sroa.02.0.extract.trunc, i32 noundef %.sroa.43.0.extract.trunc)
  %33 = trunc nuw nsw i64 %indvars.iv.next to i32
  %.neg = sub i32 %33, %32
  %34 = load i32, ptr %12, align 4, !tbaa !11
  %35 = add i32 %.neg, %34
  store i32 %35, ptr %12, align 4, !tbaa !11
  br label %39

36:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #8
  store i32 1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #8
  store i32 -1, ptr %5, align 4, !tbaa !5
  %37 = call i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  store i64 %37, ptr %3, align 8
  %38 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %2, ptr noundef nonnull align 4 dereferenceable(8) %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  %.pre16 = trunc nuw nsw i64 %indvars.iv.next to i32
  br label %39

39:                                               ; preds = %36, %22
  %.pre-phi = phi i32 [ %.pre16, %36 ], [ %33, %22 ]
  %40 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %41 = load i32, ptr %40, align 4, !tbaa !5
  store i32 %41, ptr %1, align 4, !tbaa !5
  %42 = load i32, ptr %19, align 4, !tbaa !5
  %43 = load i32, ptr %12, align 4, !tbaa !11
  %44 = sub nsw i32 0, %43
  %45 = call i64 @_Z8getRangeii(i32 noundef %42, i32 noundef %44)
  %.sroa.01.0.extract.trunc = trunc i64 %45 to i32
  %.sroa.4.0.extract.shift = lshr i64 %45, 32
  %.sroa.4.0.extract.trunc = trunc nuw i64 %.sroa.4.0.extract.shift to i32
  %46 = load i32, ptr @n, align 4, !tbaa !5
  %47 = add nsw i32 %46, -1
  %.sroa.0.0.copyload = load i64, ptr %2, align 8
  call void @_Z7seg_updiiiiSt4pairIiiE(i32 noundef 0, i32 noundef %47, i32 noundef %.sroa.01.0.extract.trunc, i32 noundef %.sroa.4.0.extract.trunc, i64 %.sroa.0.0.copyload)
  %48 = load i32, ptr @n, align 4, !tbaa !5
  %49 = add nsw i32 %48, -1
  %50 = load i32, ptr %19, align 4, !tbaa !5
  call void @_Z8seg2_updiiii(i32 noundef 0, i32 noundef %49, i32 noundef %50, i32 noundef %.pre-phi)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #8
  %51 = icmp ugt i64 %indvars.iv, 1
  br i1 %51, label %16, label %._crit_edge.loopexit, !llvm.loop !12
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local i64 @_Z8getRangeii(i32 noundef, i32 noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #6 align 2

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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 #4 = { nofree 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 #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 = { 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 = { 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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!11 = !{!10, !6, i64 4}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,LoopSimplifyPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass