; LLVM IR from tangjz/acm-icpc :: 51nod (1533)

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

@n = external dso_local global i32, align 4
@a = external dso_local global [200001 x i32], align 16
@ord = external dso_local global [200001 x i32], align 16
@ans = external dso_local global [200001 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3sumi(i32 noundef) #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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3cmpRKiS0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %10

10:                                               ; preds = %24, %0
  %11 = load i32, ptr %2, align 4, !tbaa !5
  %12 = load i32, ptr @n, align 4, !tbaa !5
  %13 = icmp sle i32 %11, %12
  br i1 %13, label %15, label %14

14:                                               ; preds = %10
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %27

15:                                               ; preds = %10
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds i32, ptr @a, i64 %17
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %18)
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %22
  store i32 %20, ptr %23, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %15
  %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 %10, !llvm.loop !9

27:                                               ; preds = %14
  %28 = load i32, ptr @n, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds i32, ptr @ord, i64 %29
  %31 = getelementptr inbounds i32, ptr %30, i64 1
  call void @_ZSt4sortIPiPFbRKiS2_EEvT_S5_T0_(ptr noundef getelementptr inbounds (i32, ptr @ord, i64 1), ptr noundef %31, ptr noundef @_Z3cmpRKiS0_)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 1, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  br label %32

32:                                               ; preds = %146, %27
  %33 = load i32, ptr %3, align 4, !tbaa !5
  %34 = load i32, ptr @n, align 4, !tbaa !5
  %35 = icmp sle i32 %33, %34
  br i1 %35, label %37, label %36

36:                                               ; preds = %32
  store i32 5, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %148

37:                                               ; preds = %32
  %38 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %38, ptr %4, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %110, %37
  %40 = load i32, ptr %4, align 4, !tbaa !5
  %41 = load i32, ptr @n, align 4, !tbaa !5
  %42 = icmp sle i32 %40, %41
  br i1 %42, label %43, label %59

43:                                               ; preds = %39
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [200001 x i32], ptr @a, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = load i32, ptr %4, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [200001 x i32], ptr @a, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = icmp eq i32 %50, %57
  br label %59

59:                                               ; preds = %43, %39
  %60 = phi i1 [ false, %39 ], [ %58, %43 ]
  br i1 %60, label %61, label %113

61:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %62

62:                                               ; preds = %106, %61
  %63 = load i32, ptr %6, align 4, !tbaa !5
  %64 = load i32, ptr @n, align 4, !tbaa !5
  %65 = icmp slt i32 %63, %64
  br i1 %65, label %66, label %77

66:                                               ; preds = %62
  %67 = load i32, ptr %6, align 4, !tbaa !5
  %68 = load i32, ptr %4, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = sub nsw i32 %71, 1
  %73 = mul nsw i32 %67, %72
  %74 = add nsw i32 %73, 2
  %75 = load i32, ptr @n, align 4, !tbaa !5
  %76 = icmp sle i32 %74, %75
  br label %77

77:                                               ; preds = %66, %62
  %78 = phi i1 [ false, %62 ], [ %76, %66 ]
  br i1 %78, label %80, label %79

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

80:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %81 = load i32, ptr %6, align 4, !tbaa !5
  %82 = load i32, ptr %4, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %83
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = mul nsw i32 %81, %85
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr %7, align 4, !tbaa !5
  %88 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = call noundef i32 @_Z3sumi(i32 noundef %89)
  %91 = load i32, ptr %6, align 4, !tbaa !5
  %92 = load i32, ptr %4, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = sub nsw i32 %95, 1
  %97 = mul nsw i32 %91, %96
  %98 = add nsw i32 %97, 1
  %99 = call noundef i32 @_Z3sumi(i32 noundef %98)
  %100 = sub nsw i32 %90, %99
  %101 = load i32, ptr %6, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [200001 x i32], ptr @ans, i64 0, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = add nsw i32 %104, %100
  store i32 %105, ptr %103, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %106

106:                                              ; preds = %80
  %107 = load i32, ptr %6, align 4, !tbaa !5
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %6, align 4, !tbaa !5
  br label %62, !llvm.loop !11

109:                                              ; preds = %79
  br label %110

110:                                              ; preds = %109
  %111 = load i32, ptr %4, align 4, !tbaa !5
  %112 = add nsw i32 %111, 1
  store i32 %112, ptr %4, align 4, !tbaa !5
  br label %39, !llvm.loop !12

113:                                              ; preds = %59
  %114 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %114, ptr %4, align 4, !tbaa !5
  br label %115

115:                                              ; preds = %142, %113
  %116 = load i32, ptr %4, align 4, !tbaa !5
  %117 = load i32, ptr @n, align 4, !tbaa !5
  %118 = icmp sle i32 %116, %117
  br i1 %118, label %119, label %135

119:                                              ; preds = %115
  %120 = load i32, ptr %3, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [200001 x i32], ptr @a, i64 0, i64 %124
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = load i32, ptr %4, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [200001 x i32], ptr @a, i64 0, i64 %131
  %133 = load i32, ptr %132, align 4, !tbaa !5
  %134 = icmp eq i32 %126, %133
  br label %135

135:                                              ; preds = %119, %115
  %136 = phi i1 [ false, %115 ], [ %134, %119 ]
  br i1 %136, label %137, label %145

137:                                              ; preds = %135
  %138 = load i32, ptr %4, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %139
  %141 = load i32, ptr %140, align 4, !tbaa !5
  call void @_Z3addii(i32 noundef %141, i32 noundef 1)
  br label %142

142:                                              ; preds = %137
  %143 = load i32, ptr %4, align 4, !tbaa !5
  %144 = add nsw i32 %143, 1
  store i32 %144, ptr %4, align 4, !tbaa !5
  br label %115, !llvm.loop !13

145:                                              ; preds = %135
  br label %146

146:                                              ; preds = %145
  %147 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %147, ptr %3, align 4, !tbaa !5
  br label %32, !llvm.loop !14

148:                                              ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %149

149:                                              ; preds = %168, %148
  %150 = load i32, ptr %8, align 4, !tbaa !5
  %151 = load i32, ptr @n, align 4, !tbaa !5
  %152 = icmp slt i32 %150, %151
  br i1 %152, label %154, label %153

153:                                              ; preds = %149
  store i32 17, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %171

154:                                              ; preds = %149
  %155 = load i32, ptr %8, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [200001 x i32], ptr @ans, i64 0, i64 %156
  %158 = load i32, ptr %157, align 4, !tbaa !5
  %159 = load i32, ptr %8, align 4, !tbaa !5
  %160 = load i32, ptr @n, align 4, !tbaa !5
  %161 = sub nsw i32 %160, 1
  %162 = icmp eq i32 %159, %161
  %163 = zext i1 %162 to i64
  %164 = getelementptr inbounds [3 x i8], ptr @.str.2, i64 0, i64 %163
  %165 = load i8, ptr %164, align 1, !tbaa !15
  %166 = sext i8 %165 to i32
  %167 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %158, i32 noundef %166)
  br label %168

168:                                              ; preds = %154
  %169 = load i32, ptr %8, align 4, !tbaa !5
  %170 = add nsw i32 %169, 1
  store i32 %170, ptr %8, align 4, !tbaa !5
  br label %149, !llvm.loop !16

171:                                              ; preds = %153
  ret i32 0
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiPFbRKiS2_EEvT_S5_T0_(ptr noundef, ptr noundef, ptr noundef) #4

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "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 = { 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 #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 = !{!"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}
!14 = distinct !{!14, !10}
!15 = !{!7, !7, i64 0}
!16 = distinct !{!16, !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"

@n = external dso_local global i32, align 4
@a = external dso_local global [200001 x i32], align 16
@ord = external dso_local global [200001 x i32], align 16
@ans = external dso_local local_unnamed_addr global [200001 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3sumi(i32 noundef) 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3cmpRKiS0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  %2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %3 = load i32, ptr @n, align 4, !tbaa !5
  %.not48 = icmp slt i32 %3, 1
  br i1 %.not48, label %.._crit_edge_crit_edge, label %.lr.ph

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre = sext i32 %3 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.._crit_edge_crit_edge ], [ %12, %.lr.ph ]
  %4 = getelementptr inbounds i32, ptr @ord, i64 %.pre-phi
  %5 = getelementptr inbounds i8, ptr %4, i64 4
  tail call void @_ZSt4sortIPiPFbRKiS2_EEvT_S5_T0_(ptr noundef nonnull getelementptr inbounds (i8, ptr @ord, i64 4), ptr noundef nonnull %5, ptr noundef nonnull @_Z3cmpRKiS0_)
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %.not4263 = icmp slt i32 %6, 1
  br i1 %.not4263, label %._crit_edge67, label %.preheader47

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %7 = getelementptr inbounds i32, ptr @a, i64 %indvars.iv
  %8 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %7)
  %9 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %indvars.iv
  %10 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %10, ptr %9, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %11 = load i32, ptr @n, align 4, !tbaa !5
  %12 = sext i32 %11 to i64
  %.not.not = icmp slt i64 %indvars.iv, %12
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.preheader47:                                     ; preds = %._crit_edge, %.critedge4
  %13 = phi i32 [ %82, %.critedge4 ], [ %6, %._crit_edge ]
  %.03764 = phi i32 [ %.1.lcssa, %.critedge4 ], [ 1, %._crit_edge ]
  %14 = sext i32 %.03764 to i64
  %15 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %14
  %.not4353 = icmp sgt i32 %.03764, %13
  br i1 %.not4353, label %.critedge, label %.lr.ph55

.preheader:                                       ; preds = %.critedge4
  %16 = icmp sgt i32 %82, 1
  br i1 %16, label %.lr.ph66, label %._crit_edge67

.lr.ph55:                                         ; preds = %.preheader47, %.critedge2
  %17 = phi i32 [ %36, %.critedge2 ], [ %13, %.preheader47 ]
  %18 = phi i32 [ %37, %.critedge2 ], [ %13, %.preheader47 ]
  %indvars.iv73 = phi i64 [ %indvars.iv.next74, %.critedge2 ], [ %14, %.preheader47 ]
  %19 = load i32, ptr %15, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [200001 x i32], ptr @a, i64 0, i64 %20
  %22 = load i32, ptr %21, align 4, !tbaa !5
  %23 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %indvars.iv73
  %24 = load i32, ptr %23, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [200001 x i32], ptr @a, i64 0, i64 %25
  %27 = load i32, ptr %26, align 4, !tbaa !5
  %28 = icmp eq i32 %22, %27
  br i1 %28, label %.preheader46, label %.critedge

.preheader46:                                     ; preds = %.lr.ph55
  %29 = icmp sgt i32 %18, 1
  br i1 %29, label %.lr.ph51.preheader, label %.critedge2

.lr.ph51.preheader:                               ; preds = %.preheader46
  %30 = load i32, ptr %23, align 4, !tbaa !5
  %.not4591.not = icmp slt i32 %30, %18
  br i1 %.not4591.not, label %.lr.ph93, label %.critedge2

.lr.ph51:                                         ; preds = %.lr.ph93
  %31 = load i32, ptr %23, align 4, !tbaa !5
  %32 = add nsw i32 %31, -1
  %33 = trunc nuw nsw i64 %indvars.iv.next71 to i32
  %34 = mul nsw i32 %32, %33
  %35 = add nsw i32 %34, 2
  %.not45 = icmp sgt i32 %35, %55
  br i1 %.not45, label %.critedge2, label %.lr.ph93, !llvm.loop !11

.critedge2:                                       ; preds = %.lr.ph93, %.lr.ph51, %.lr.ph51.preheader, %.preheader46
  %36 = phi i32 [ %17, %.preheader46 ], [ %17, %.lr.ph51.preheader ], [ %55, %.lr.ph51 ], [ %55, %.lr.ph93 ]
  %37 = phi i32 [ %18, %.preheader46 ], [ %18, %.lr.ph51.preheader ], [ %55, %.lr.ph51 ], [ %55, %.lr.ph93 ]
  %indvars.iv.next74 = add nsw i64 %indvars.iv73, 1
  %38 = sext i32 %37 to i64
  %.not43.not = icmp slt i64 %indvars.iv73, %38
  br i1 %.not43.not, label %.lr.ph55, label %.critedge, !llvm.loop !12

.lr.ph93:                                         ; preds = %.lr.ph51.preheader, %.lr.ph51
  %39 = phi i32 [ %33, %.lr.ph51 ], [ 1, %.lr.ph51.preheader ]
  %40 = phi i32 [ %31, %.lr.ph51 ], [ %30, %.lr.ph51.preheader ]
  %indvars.iv7092 = phi i64 [ %indvars.iv.next71, %.lr.ph51 ], [ 1, %.lr.ph51.preheader ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %41 = mul nsw i32 %40, %39
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %1, align 4, !tbaa !5
  %43 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = call noundef i32 @_Z3sumi(i32 noundef %44)
  %46 = load i32, ptr %23, align 4, !tbaa !5
  %47 = add nsw i32 %46, -1
  %48 = mul nsw i32 %47, %39
  %49 = add nsw i32 %48, 1
  %50 = call noundef i32 @_Z3sumi(i32 noundef %49)
  %51 = sub i32 %45, %50
  %52 = getelementptr inbounds [200001 x i32], ptr @ans, i64 0, i64 %indvars.iv7092
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = add nsw i32 %51, %53
  store i32 %54, ptr %52, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %indvars.iv.next71 = add nuw nsw i64 %indvars.iv7092, 1
  %55 = load i32, ptr @n, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = icmp slt i64 %indvars.iv.next71, %56
  br i1 %57, label %.lr.ph51, label %.critedge2, !llvm.loop !11

.critedge:                                        ; preds = %.lr.ph55, %.critedge2, %.preheader47
  %58 = phi i32 [ %13, %.preheader47 ], [ %17, %.lr.ph55 ], [ %36, %.critedge2 ]
  %59 = phi i32 [ %13, %.preheader47 ], [ %18, %.lr.ph55 ], [ %37, %.critedge2 ]
  %.not4457 = icmp sgt i32 %.03764, %59
  br i1 %.not4457, label %.critedge4, label %.lr.ph59.preheader

.lr.ph59.preheader:                               ; preds = %.critedge
  %60 = load i32, ptr %15, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [200001 x i32], ptr @a, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = sext i32 %60 to i64
  %65 = getelementptr inbounds [200001 x i32], ptr @a, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = icmp eq i32 %63, %66
  br i1 %67, label %.lr.ph98, label %.critedge4.loopexit

.lr.ph59:                                         ; preds = %.lr.ph98
  %68 = load i32, ptr %15, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [200001 x i32], ptr @a, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %indvars.iv.next77
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [200001 x i32], ptr @a, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = icmp eq i32 %71, %76
  br i1 %77, label %.lr.ph98, label %.critedge4.loopexit, !llvm.loop !13

.lr.ph98:                                         ; preds = %.lr.ph59.preheader, %.lr.ph59
  %78 = phi i32 [ %73, %.lr.ph59 ], [ %60, %.lr.ph59.preheader ]
  %indvars.iv7697 = phi i64 [ %indvars.iv.next77, %.lr.ph59 ], [ %14, %.lr.ph59.preheader ]
  call void @_Z3addii(i32 noundef %78, i32 noundef 1)
  %indvars.iv.next77 = add nsw i64 %indvars.iv7697, 1
  %79 = load i32, ptr @n, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %.not44.not = icmp slt i64 %indvars.iv7697, %80
  br i1 %.not44.not, label %.lr.ph59, label %.critedge4.loopexit, !llvm.loop !13

.critedge4.loopexit:                              ; preds = %.lr.ph98, %.lr.ph59, %.lr.ph59.preheader
  %81 = phi i32 [ %58, %.lr.ph59.preheader ], [ %79, %.lr.ph59 ], [ %79, %.lr.ph98 ]
  %.1.lcssa.ph.in = phi i64 [ %14, %.lr.ph59.preheader ], [ %indvars.iv.next77, %.lr.ph59 ], [ %indvars.iv.next77, %.lr.ph98 ]
  %.1.lcssa.ph = trunc i64 %.1.lcssa.ph.in to i32
  br label %.critedge4

.critedge4:                                       ; preds = %.critedge4.loopexit, %.critedge
  %82 = phi i32 [ %58, %.critedge ], [ %81, %.critedge4.loopexit ]
  %.1.lcssa = phi i32 [ %.03764, %.critedge ], [ %.1.lcssa.ph, %.critedge4.loopexit ]
  %.not42 = icmp sgt i32 %.1.lcssa, %82
  br i1 %.not42, label %.preheader, label %.preheader47, !llvm.loop !14

._crit_edge67:                                    ; preds = %.lr.ph66, %._crit_edge, %.preheader
  ret i32 0

.lr.ph66:                                         ; preds = %.preheader, %.lr.ph66
  %indvars.iv79 = phi i64 [ %indvars.iv.next80, %.lr.ph66 ], [ 1, %.preheader ]
  %83 = phi i32 [ %94, %.lr.ph66 ], [ %82, %.preheader ]
  %84 = getelementptr inbounds [200001 x i32], ptr @ans, i64 0, i64 %indvars.iv79
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = add nsw i32 %83, -1
  %87 = zext i32 %86 to i64
  %88 = icmp eq i64 %indvars.iv79, %87
  %89 = zext i1 %88 to i64
  %90 = getelementptr inbounds [3 x i8], ptr @.str.2, i64 0, i64 %89
  %91 = load i8, ptr %90, align 1, !tbaa !15
  %92 = sext i8 %91 to i32
  %93 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %85, i32 noundef %92)
  %indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
  %94 = load i32, ptr @n, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = icmp slt i64 %indvars.iv.next80, %95
  br i1 %96, label %.lr.ph66, label %._crit_edge67, !llvm.loop !16
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiPFbRKiS2_EEvT_S5_T0_(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

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

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #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 = { 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 #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 = !{!"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}
!14 = distinct !{!14, !10}
!15 = !{!7, !7, i64 0}
!16 = distinct !{!16, !10}


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