; LLVM IR from tangjz/acm-icpc :: lydsy (1233)

; 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 i32, align 4
@sum = external dso_local global [100001 x i32], align 16
@f = external dso_local global [100001 x i32], align 16
@g = external dso_local global [100001 x i32], align 16
@q = external dso_local global [100001 x i32], align 16
@head = external dso_local global i32, align 4
@tail = external dso_local global i32, align 4
@_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
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  %3 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %4 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %5

5:                                                ; preds = %24, %0
  %6 = load i32, ptr %2, align 4, !tbaa !5
  %7 = load i32, ptr @n, align 4, !tbaa !5
  %8 = icmp sle i32 %6, %7
  br i1 %8, label %9, label %27

9:                                                ; preds = %5
  %10 = load i32, ptr %2, align 4, !tbaa !5
  %11 = sext i32 %10 to i64
  %12 = getelementptr inbounds [100001 x i32], ptr @sum, i64 0, i64 %11
  %13 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = sub nsw i32 %14, 1
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [100001 x i32], ptr @sum, i64 0, i64 %16
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [100001 x i32], ptr @sum, i64 0, i64 %20
  %22 = load i32, ptr %21, align 4, !tbaa !5
  %23 = add nsw i32 %22, %18
  store i32 %23, ptr %21, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %9
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr %2, align 4, !tbaa !5
  br label %5, !llvm.loop !9

27:                                               ; preds = %5
  %28 = load i32, ptr @n, align 4, !tbaa !5
  %29 = add nsw i32 %28, 1
  %30 = load i32, ptr @head, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [100001 x i32], ptr @q, i64 0, i64 %31
  store i32 %29, ptr %32, align 4, !tbaa !5
  %33 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %33, ptr %2, align 4, !tbaa !5
  br label %34

34:                                               ; preds = %144, %27
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = icmp sge i32 %35, 1
  br i1 %36, label %37, label %147

37:                                               ; preds = %34
  br label %38

38:                                               ; preds = %69, %37
  %39 = load i32, ptr @head, align 4, !tbaa !5
  %40 = load i32, ptr @tail, align 4, !tbaa !5
  %41 = icmp slt i32 %39, %40
  br i1 %41, label %42, label %67

42:                                               ; preds = %38
  %43 = load i32, ptr @head, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [100001 x i32], ptr @q, i64 0, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = sub nsw i32 %47, 1
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [100001 x i32], ptr @sum, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = load i32, ptr @head, align 4, !tbaa !5
  %53 = add nsw i32 %52, 1
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [100001 x i32], ptr @q, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [100001 x i32], ptr @f, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = sub nsw i32 %51, %59
  %61 = load i32, ptr %2, align 4, !tbaa !5
  %62 = sub nsw i32 %61, 1
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [100001 x i32], ptr @sum, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = icmp sge i32 %60, %65
  br label %67

67:                                               ; preds = %42, %38
  %68 = phi i1 [ false, %38 ], [ %66, %42 ]
  br i1 %68, label %69, label %72

69:                                               ; preds = %67
  %70 = load i32, ptr @head, align 4, !tbaa !5
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr @head, align 4, !tbaa !5
  br label %38, !llvm.loop !11

72:                                               ; preds = %67
  %73 = load i32, ptr @head, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [100001 x i32], ptr @q, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = sub nsw i32 %76, 1
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [100001 x i32], ptr @sum, i64 0, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = load i32, ptr %2, align 4, !tbaa !5
  %82 = sub nsw i32 %81, 1
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [100001 x i32], ptr @sum, i64 0, i64 %83
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = sub nsw i32 %80, %85
  %87 = load i32, ptr %2, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [100001 x i32], ptr @f, i64 0, i64 %88
  store i32 %86, ptr %89, align 4, !tbaa !5
  %90 = load i32, ptr @head, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [100001 x i32], ptr @q, i64 0, i64 %91
  %93 = load i32, ptr %92, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [100001 x i32], ptr @g, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = add nsw i32 %96, 1
  %98 = load i32, ptr %2, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [100001 x i32], ptr @g, i64 0, i64 %99
  store i32 %97, ptr %100, align 4, !tbaa !5
  br label %101

101:                                              ; preds = %135, %72
  %102 = load i32, ptr @head, align 4, !tbaa !5
  %103 = load i32, ptr @tail, align 4, !tbaa !5
  %104 = icmp sle i32 %102, %103
  br i1 %104, label %105, label %133

105:                                              ; preds = %101
  %106 = load i32, ptr %2, align 4, !tbaa !5
  %107 = sub nsw i32 %106, 1
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [100001 x i32], ptr @sum, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = load i32, ptr %2, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [100001 x i32], ptr @f, i64 0, i64 %112
  %114 = load i32, ptr %113, align 4, !tbaa !5
  %115 = sub nsw i32 %110, %114
  %116 = load i32, ptr @tail, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [100001 x i32], ptr @q, i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = sub nsw i32 %119, 1
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [100001 x i32], ptr @sum, i64 0, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !5
  %124 = load i32, ptr @tail, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [100001 x i32], ptr @q, i64 0, i64 %125
  %127 = load i32, ptr %126, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [100001 x i32], ptr @f, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = sub nsw i32 %123, %130
  %132 = icmp sge i32 %115, %131
  br label %133

133:                                              ; preds = %105, %101
  %134 = phi i1 [ false, %101 ], [ %132, %105 ]
  br i1 %134, label %135, label %138

135:                                              ; preds = %133
  %136 = load i32, ptr @tail, align 4, !tbaa !5
  %137 = add nsw i32 %136, -1
  store i32 %137, ptr @tail, align 4, !tbaa !5
  br label %101, !llvm.loop !12

138:                                              ; preds = %133
  %139 = load i32, ptr %2, align 4, !tbaa !5
  %140 = load i32, ptr @tail, align 4, !tbaa !5
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr @tail, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [100001 x i32], ptr @q, i64 0, i64 %142
  store i32 %139, ptr %143, align 4, !tbaa !5
  br label %144

144:                                              ; preds = %138
  %145 = load i32, ptr %2, align 4, !tbaa !5
  %146 = add nsw i32 %145, -1
  store i32 %146, ptr %2, align 4, !tbaa !5
  br label %34, !llvm.loop !13

147:                                              ; preds = %34
  %148 = load i32, ptr getelementptr inbounds ([100001 x i32], ptr @g, i64 0, i64 1), align 4, !tbaa !5
  %149 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %148)
  %150 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %149, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  ret i32 0
}

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #4

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}


; 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 i32, align 4
@sum = external dso_local global [100001 x i32], align 16
@f = external dso_local local_unnamed_addr global [100001 x i32], align 16
@g = external dso_local local_unnamed_addr global [100001 x i32], align 16
@q = external dso_local local_unnamed_addr global [100001 x i32], align 16
@head = external dso_local local_unnamed_addr global i32, align 4
@tail = external dso_local local_unnamed_addr global i32, align 4
@_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 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %2 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %3 = load i32, ptr @n, align 4, !tbaa !5
  %.not24 = icmp slt i32 %3, 1
  br i1 %.not24, label %._crit_edge.thread, label %.lr.ph

._crit_edge.thread:                               ; preds = %0
  %4 = add nsw i32 %3, 1
  %5 = load i32, ptr @head, align 4, !tbaa !5
  %6 = sext i32 %5 to i64
  %7 = getelementptr inbounds [100001 x i32], ptr @q, i64 0, i64 %6
  store i32 %4, ptr %7, align 4, !tbaa !5
  br label %77

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %8 = getelementptr inbounds [100001 x i32], ptr @sum, i64 0, i64 %indvars.iv
  %9 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %10 = add nsw i64 %indvars.iv, -1
  %11 = getelementptr inbounds [100001 x i32], ptr @sum, i64 0, i64 %10
  %12 = load i32, ptr %11, align 4, !tbaa !5
  %13 = load i32, ptr %8, align 4, !tbaa !5
  %14 = add nsw i32 %13, %12
  store i32 %14, ptr %8, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %15 = load i32, ptr @n, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %.not.not = icmp slt i64 %indvars.iv, %16
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph
  %17 = add nsw i32 %15, 1
  %18 = load i32, ptr @head, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [100001 x i32], ptr @q, i64 0, i64 %19
  store i32 %17, ptr %20, align 4, !tbaa !5
  %21 = icmp sgt i32 %15, 0
  br i1 %21, label %.preheader.preheader, label %77

.preheader.preheader:                             ; preds = %._crit_edge
  %tail.promoted39 = load i32, ptr @tail, align 4, !tbaa !5
  %22 = zext nneg i32 %15 to i64
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %.critedge2
  %indvars.iv57 = phi i64 [ %22, %.preheader.preheader ], [ %24, %.critedge2 ]
  %head.promoted3845 = phi i32 [ %18, %.preheader.preheader ], [ %head.promoted36, %.critedge2 ]
  %tail.promoted4044 = phi i32 [ %tail.promoted39, %.preheader.preheader ], [ %72, %.critedge2 ]
  %23 = icmp slt i32 %head.promoted3845, %tail.promoted4044
  %24 = add nsw i64 %indvars.iv57, -1
  %25 = getelementptr inbounds [100001 x i32], ptr @sum, i64 0, i64 %24
  %26 = load i32, ptr %25, align 4, !tbaa !5
  br i1 %23, label %.lr.ph26, label %.critedge

.lr.ph26:                                         ; preds = %.preheader
  %27 = sext i32 %head.promoted3845 to i64
  %28 = sext i32 %tail.promoted4044 to i64
  br label %29

29:                                               ; preds = %.lr.ph26, %40
  %indvars.iv51 = phi i64 [ %27, %.lr.ph26 ], [ %indvars.iv.next52, %40 ]
  %indvars.iv.next52 = add nsw i64 %indvars.iv51, 1
  %30 = getelementptr inbounds [100001 x i32], ptr @q, i64 0, i64 %indvars.iv.next52
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = add nsw i32 %31, -1
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [100001 x i32], ptr @sum, i64 0, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = sext i32 %31 to i64
  %37 = getelementptr inbounds [100001 x i32], ptr @f, i64 0, i64 %36
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = sub nsw i32 %35, %38
  %.not19 = icmp slt i32 %39, %26
  br i1 %.not19, label %.critedge.loopexit.split.loop.exit63, label %40

40:                                               ; preds = %29
  %41 = trunc nsw i64 %indvars.iv.next52 to i32
  store i32 %41, ptr @head, align 4, !tbaa !5
  %exitcond.not = icmp eq i64 %indvars.iv.next52, %28
  br i1 %exitcond.not, label %.critedge, label %29, !llvm.loop !11

.critedge.loopexit.split.loop.exit63:             ; preds = %29
  %42 = trunc nsw i64 %indvars.iv51 to i32
  br label %.critedge

.critedge:                                        ; preds = %40, %.critedge.loopexit.split.loop.exit63, %.preheader
  %head.promoted36 = phi i32 [ %head.promoted3845, %.preheader ], [ %42, %.critedge.loopexit.split.loop.exit63 ], [ %tail.promoted4044, %40 ]
  %43 = sext i32 %head.promoted36 to i64
  %44 = getelementptr inbounds [100001 x i32], ptr @q, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = add nsw i32 %45, -1
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [100001 x i32], ptr @sum, i64 0, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = sub nsw i32 %49, %26
  %51 = getelementptr inbounds [100001 x i32], ptr @f, i64 0, i64 %indvars.iv57
  store i32 %50, ptr %51, align 4, !tbaa !5
  %52 = sext i32 %45 to i64
  %53 = getelementptr inbounds [100001 x i32], ptr @g, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = add nsw i32 %54, 1
  %56 = getelementptr inbounds [100001 x i32], ptr @g, i64 0, i64 %indvars.iv57
  store i32 %55, ptr %56, align 4, !tbaa !5
  %57 = sub nsw i32 %26, %50
  %.not2030 = icmp sgt i32 %head.promoted36, %tail.promoted4044
  br i1 %.not2030, label %.critedge2, label %.lr.ph31.preheader

.lr.ph31.preheader:                               ; preds = %.critedge
  %58 = sext i32 %tail.promoted4044 to i64
  %59 = add i32 %head.promoted36, -1
  br label %.lr.ph31

.lr.ph31:                                         ; preds = %.lr.ph31.preheader, %70
  %indvars.iv54 = phi i64 [ %58, %.lr.ph31.preheader ], [ %indvars.iv.next55, %70 ]
  %60 = getelementptr inbounds [100001 x i32], ptr @q, i64 0, i64 %indvars.iv54
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = add nsw i32 %61, -1
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [100001 x i32], ptr @sum, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = sext i32 %61 to i64
  %67 = getelementptr inbounds [100001 x i32], ptr @f, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = sub nsw i32 %65, %68
  %.not21 = icmp slt i32 %57, %69
  br i1 %.not21, label %.critedge2.loopexit.split.loop.exit65, label %70

70:                                               ; preds = %.lr.ph31
  %indvars.iv.next55 = add nsw i64 %indvars.iv54, -1
  %.not20.not = icmp sgt i64 %indvars.iv54, %43
  br i1 %.not20.not, label %.lr.ph31, label %.critedge2, !llvm.loop !12

.critedge2.loopexit.split.loop.exit65:            ; preds = %.lr.ph31
  %71 = trunc nsw i64 %indvars.iv54 to i32
  br label %.critedge2

.critedge2:                                       ; preds = %70, %.critedge2.loopexit.split.loop.exit65, %.critedge
  %.lcssa22 = phi i32 [ %tail.promoted4044, %.critedge ], [ %71, %.critedge2.loopexit.split.loop.exit65 ], [ %59, %70 ]
  %72 = add nsw i32 %.lcssa22, 1
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [100001 x i32], ptr @q, i64 0, i64 %73
  %75 = trunc nuw nsw i64 %indvars.iv57 to i32
  store i32 %75, ptr %74, align 4, !tbaa !5
  %76 = icmp sgt i64 %indvars.iv57, 1
  br i1 %76, label %.preheader, label %._crit_edge47, !llvm.loop !13

._crit_edge47:                                    ; preds = %.critedge2
  store i32 %72, ptr @tail, align 4, !tbaa !5
  br label %77

77:                                               ; preds = %._crit_edge.thread, %._crit_edge47, %._crit_edge
  %78 = load i32, ptr getelementptr inbounds (i8, ptr @g, i64 4), align 4, !tbaa !5
  %79 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %78)
  %80 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %79, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0
}

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #3

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 = { "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 = { 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 #3 = { 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" }

!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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}


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