; LLVM IR from tangjz/acm-icpc :: codeforces/complete (567A)

; 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 [100010 x i32], align 16
@id = external dso_local global [100010 x i32], align 16
@ans = external dso_local global [100010 x [2 x i32]], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 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() #1 {
  %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 0, 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 slt 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 [100010 x i32], ptr @id, 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 @id, i64 %29
  call void @_ZSt4sortIPiPFbRKiS2_EEvT_S5_T0_(ptr noundef @id, ptr noundef %30, ptr noundef @_Z3cmpRKiS0_)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %31

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

35:                                               ; preds = %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %158

36:                                               ; preds = %31
  %37 = load i32, ptr %3, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [100010 x i32], ptr @id, i64 0, i64 %38
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [100010 x [2 x i32]], ptr @ans, i64 0, i64 %41
  %43 = getelementptr inbounds [2 x i32], ptr %42, i64 0, i64 0
  store i32 2147483647, ptr %43, align 8, !tbaa !5
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %45 = icmp sgt i32 %44, 0
  br i1 %45, label %46, label %79

46:                                               ; preds = %36
  %47 = load i32, ptr %3, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [100010 x i32], ptr @id, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [100010 x [2 x i32]], ptr @ans, i64 0, i64 %51
  %53 = getelementptr inbounds [2 x i32], ptr %52, i64 0, i64 0
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  %54 = load i32, ptr %3, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [100010 x i32], ptr @id, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = load i32, ptr %3, align 4, !tbaa !5
  %62 = sub nsw i32 %61, 1
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [100010 x i32], ptr @id, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = sub nsw i32 %60, %68
  store i32 %69, ptr %4, align 4, !tbaa !5
  %70 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %53, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = load i32, ptr %3, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [100010 x i32], ptr @id, i64 0, i64 %73
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [100010 x [2 x i32]], ptr @ans, i64 0, i64 %76
  %78 = getelementptr inbounds [2 x i32], ptr %77, i64 0, i64 0
  store i32 %71, ptr %78, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %79

79:                                               ; preds = %46, %36
  %80 = load i32, ptr %3, align 4, !tbaa !5
  %81 = load i32, ptr @n, align 4, !tbaa !5
  %82 = sub nsw i32 %81, 1
  %83 = icmp slt i32 %80, %82
  br i1 %83, label %84, label %117

84:                                               ; preds = %79
  %85 = load i32, ptr %3, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [100010 x i32], ptr @id, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [100010 x [2 x i32]], ptr @ans, i64 0, i64 %89
  %91 = getelementptr inbounds [2 x i32], ptr %90, i64 0, i64 0
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %92 = load i32, ptr %3, align 4, !tbaa !5
  %93 = add nsw i32 %92, 1
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [100010 x i32], ptr @id, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = load i32, ptr %3, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [100010 x i32], ptr @id, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = sub nsw i32 %99, %106
  store i32 %107, ptr %5, align 4, !tbaa !5
  %108 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %91, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = load i32, ptr %3, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [100010 x i32], ptr @id, i64 0, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [100010 x [2 x i32]], ptr @ans, i64 0, i64 %114
  %116 = getelementptr inbounds [2 x i32], ptr %115, i64 0, i64 0
  store i32 %109, ptr %116, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %117

117:                                              ; preds = %84, %79
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %118 = load i32, ptr %3, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [100010 x i32], ptr @id, i64 0, i64 %119
  %121 = load i32, ptr %120, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %122
  %124 = load i32, ptr %123, align 4, !tbaa !5
  %125 = load i32, ptr @id, align 16, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !5
  %129 = sub nsw i32 %124, %128
  store i32 %129, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %130 = load i32, ptr @n, align 4, !tbaa !5
  %131 = sub nsw i32 %130, 1
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [100010 x i32], ptr @id, i64 0, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %135
  %137 = load i32, ptr %136, align 4, !tbaa !5
  %138 = load i32, ptr %3, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [100010 x i32], ptr @id, i64 0, i64 %139
  %141 = load i32, ptr %140, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %142
  %144 = load i32, ptr %143, align 4, !tbaa !5
  %145 = sub nsw i32 %137, %144
  store i32 %145, ptr %7, align 4, !tbaa !5
  %146 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %147 = load i32, ptr %146, align 4, !tbaa !5
  %148 = load i32, ptr %3, align 4, !tbaa !5
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [100010 x i32], ptr @id, i64 0, i64 %149
  %151 = load i32, ptr %150, align 4, !tbaa !5
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [100010 x [2 x i32]], ptr @ans, i64 0, i64 %152
  %154 = getelementptr inbounds [2 x i32], ptr %153, i64 0, i64 1
  store i32 %147, ptr %154, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %155

155:                                              ; preds = %117
  %156 = load i32, ptr %3, align 4, !tbaa !5
  %157 = add nsw i32 %156, 1
  store i32 %157, ptr %3, align 4, !tbaa !5
  br label %31, !llvm.loop !11

158:                                              ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %159

159:                                              ; preds = %176, %158
  %160 = load i32, ptr %8, align 4, !tbaa !5
  %161 = load i32, ptr @n, align 4, !tbaa !5
  %162 = icmp slt i32 %160, %161
  br i1 %162, label %164, label %163

163:                                              ; preds = %159
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %179

164:                                              ; preds = %159
  %165 = load i32, ptr %8, align 4, !tbaa !5
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [100010 x [2 x i32]], ptr @ans, i64 0, i64 %166
  %168 = getelementptr inbounds [2 x i32], ptr %167, i64 0, i64 0
  %169 = load i32, ptr %168, align 8, !tbaa !5
  %170 = load i32, ptr %8, align 4, !tbaa !5
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [100010 x [2 x i32]], ptr @ans, i64 0, i64 %171
  %173 = getelementptr inbounds [2 x i32], ptr %172, i64 0, i64 1
  %174 = load i32, ptr %173, align 4, !tbaa !5
  %175 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %169, i32 noundef %174)
  br label %176

176:                                              ; preds = %164
  %177 = load i32, ptr %8, align 4, !tbaa !5
  %178 = add nsw i32 %177, 1
  store i32 %178, ptr %8, align 4, !tbaa !5
  br label %159, !llvm.loop !12

179:                                              ; preds = %163
  ret i32 0
}

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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

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

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

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 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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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}


; 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 [100010 x i32], align 16
@id = external dso_local global [100010 x i32], align 16
@ans = external dso_local global [100010 x [2 x i32]], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 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 #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.lr.ph, label %.._crit_edge_crit_edge

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre55 = sext i32 %6 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi56 = phi i64 [ %.pre55, %.._crit_edge_crit_edge ], [ %51, %.lr.ph ]
  %8 = getelementptr inbounds i32, ptr @id, i64 %.pre-phi56
  tail call void @_ZSt4sortIPiPFbRKiS2_EEvT_S5_T0_(ptr noundef nonnull @id, ptr noundef nonnull %8, ptr noundef nonnull @_Z3cmpRKiS0_)
  %9 = load i32, ptr @n, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %11, label %._crit_edge34

11:                                               ; preds = %._crit_edge
  %12 = load i32, ptr @id, align 16, !tbaa !5
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds [100010 x [2 x i32]], ptr @ans, i64 0, i64 %13
  store i32 2147483647, ptr %14, align 8, !tbaa !5
  %.not = icmp eq i32 %9, 1
  br i1 %.not, label %30, label %15

15:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %16 = load i32, ptr getelementptr inbounds (i8, ptr @id, i64 4), align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %17
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %20 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %13
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = sub nsw i32 %19, %21
  store i32 %22, ptr %2, align 4, !tbaa !5
  %23 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %24 = load i32, ptr %23, align 4, !tbaa !5
  %25 = load i32, ptr @id, align 16, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [100010 x [2 x i32]], ptr @ans, i64 0, i64 %26
  store i32 %24, ptr %27, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  %28 = add nsw i32 %.pre, -1
  %29 = sext i32 %28 to i64
  br label %30

30:                                               ; preds = %15, %11
  %.pre-phi49.in.in = phi i64 [ %29, %15 ], [ 0, %11 ]
  %.pre-phi = phi i64 [ %26, %15 ], [ %13, %11 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %31 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %.pre-phi
  %32 = load i32, ptr %31, align 4, !tbaa !5
  store i32 0, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  %33 = getelementptr inbounds [100010 x i32], ptr @id, i64 0, i64 %.pre-phi49.in.in
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = sub nsw i32 %37, %32
  store i32 %38, ptr %4, align 4, !tbaa !5
  %39 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = load i32, ptr @id, align 16, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [100010 x [2 x i32]], ptr @ans, i64 0, i64 %42, i64 1
  store i32 %40, ptr %43, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  %44 = load i32, ptr @n, align 4, !tbaa !5
  %45 = icmp sgt i32 %44, 1
  br i1 %45, label %.lr.ph31.peel.next, label %.preheader

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %46 = getelementptr inbounds i32, ptr @a, i64 %indvars.iv
  %47 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %46)
  %48 = getelementptr inbounds [100010 x i32], ptr @id, i64 0, i64 %indvars.iv
  %49 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %49, ptr %48, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %50 = load i32, ptr @n, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = icmp slt i64 %indvars.iv.next, %51
  br i1 %52, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.preheader:                                       ; preds = %91, %30
  %53 = phi i32 [ %44, %30 ], [ %110, %91 ]
  %54 = icmp sgt i32 %53, 0
  br i1 %54, label %.lr.ph33, label %._crit_edge34

.lr.ph31.peel.next:                               ; preds = %30, %91
  %55 = phi i32 [ %107, %91 ], [ %41, %30 ]
  %indvars.iv37 = phi i64 [ %indvars.iv.next38.pre-phi, %91 ], [ 1, %30 ]
  %56 = getelementptr inbounds [100010 x i32], ptr @id, i64 0, i64 %indvars.iv37
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [100010 x [2 x i32]], ptr @ans, i64 0, i64 %58
  store i32 2147483647, ptr %59, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %60 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %58
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = sext i32 %55 to i64
  %63 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = sub nsw i32 %61, %64
  store i32 %65, ptr %1, align 4, !tbaa !5
  %66 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %59, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = load i32, ptr %56, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [100010 x [2 x i32]], ptr @ans, i64 0, i64 %69
  store i32 %67, ptr %70, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %.pre44 = load i32, ptr @n, align 4, !tbaa !5
  %71 = add nsw i32 %.pre44, -1
  %72 = sext i32 %71 to i64
  %73 = icmp slt i64 %indvars.iv37, %72
  %74 = sext i32 %68 to i64
  br i1 %73, label %75, label %._crit_edge54

._crit_edge54:                                    ; preds = %.lr.ph31.peel.next
  %.pre59 = add nuw nsw i64 %indvars.iv37, 1
  br label %91

75:                                               ; preds = %.lr.ph31.peel.next
  %76 = getelementptr inbounds [100010 x [2 x i32]], ptr @ans, i64 0, i64 %74
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %77 = add nuw nsw i64 %indvars.iv37, 1
  %78 = getelementptr inbounds [100010 x i32], ptr @id, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %74
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = sub nsw i32 %82, %84
  store i32 %85, ptr %2, align 4, !tbaa !5
  %86 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %76, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = load i32, ptr %56, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [100010 x [2 x i32]], ptr @ans, i64 0, i64 %89
  store i32 %87, ptr %90, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  %.pre45 = load i32, ptr @n, align 4, !tbaa !5
  %.pre50 = add nsw i32 %.pre45, -1
  %.pre52 = sext i32 %.pre50 to i64
  br label %91

91:                                               ; preds = %._crit_edge54, %75
  %indvars.iv.next38.pre-phi = phi i64 [ %.pre59, %._crit_edge54 ], [ %77, %75 ]
  %.pre-phi58 = phi i64 [ %74, %._crit_edge54 ], [ %89, %75 ]
  %.pre-phi53 = phi i64 [ %72, %._crit_edge54 ], [ %.pre52, %75 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %92 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %.pre-phi58
  %93 = load i32, ptr %92, align 4, !tbaa !5
  %94 = load i32, ptr @id, align 16, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = sub nsw i32 %93, %97
  store i32 %98, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  %99 = getelementptr inbounds [100010 x i32], ptr @id, i64 0, i64 %.pre-phi53
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = sub nsw i32 %103, %93
  store i32 %104, ptr %4, align 4, !tbaa !5
  %105 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = load i32, ptr %56, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [100010 x [2 x i32]], ptr @ans, i64 0, i64 %108, i64 1
  store i32 %106, ptr %109, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  %110 = load i32, ptr @n, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = icmp slt i64 %indvars.iv.next38.pre-phi, %111
  br i1 %112, label %.lr.ph31.peel.next, label %.preheader, !llvm.loop !11

._crit_edge34:                                    ; preds = %.lr.ph33, %._crit_edge, %.preheader
  ret i32 0

.lr.ph33:                                         ; preds = %.preheader, %.lr.ph33
  %indvars.iv41 = phi i64 [ %indvars.iv.next42, %.lr.ph33 ], [ 0, %.preheader ]
  %113 = getelementptr inbounds [100010 x [2 x i32]], ptr @ans, i64 0, i64 %indvars.iv41
  %114 = load i32, ptr %113, align 8, !tbaa !5
  %115 = getelementptr inbounds i8, ptr %113, i64 4
  %116 = load i32, ptr %115, align 4, !tbaa !5
  %117 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %114, i32 noundef %116)
  %indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
  %118 = load i32, ptr @n, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = icmp slt i64 %indvars.iv.next42, %119
  br i1 %120, label %.lr.ph33, label %._crit_edge34, !llvm.loop !13
}

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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: 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 #5

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

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 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 #2 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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}
!12 = !{!"llvm.loop.peeled.count", i32 1}
!13 = distinct !{!13, !10}


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