; LLVM IR from Tunghohin/Competitive_Coding :: Luogu (p1020)

; 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_ostream" = type { ptr, %"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 }

@a = external dso_local global [100010 x i32], align 16
@q = external dso_local global [100010 x i32], align 16
@n = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca 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
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  br label %13

13:                                               ; preds = %20, %0
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %15 = add nsw i32 %14, 1
  store i32 %15, ptr @n, align 4, !tbaa !5
  %16 = sext i32 %14 to i64
  %17 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %16
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %17)
  %19 = icmp ne i32 %18, -1
  br i1 %19, label %20, label %21

20:                                               ; preds = %13
  br label %13, !llvm.loop !9

21:                                               ; preds = %13
  %22 = load i32, ptr @n, align 4, !tbaa !5
  %23 = sub nsw i32 %22, 1
  store i32 %23, ptr @n, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %69, %21
  %25 = load i32, ptr %3, align 4, !tbaa !5
  %26 = load i32, ptr @n, align 4, !tbaa !5
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %29, label %28

28:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %72

29:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %30 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %30, ptr %5, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %55, %29
  %32 = load i32, ptr %4, align 4, !tbaa !5
  %33 = load i32, ptr %5, align 4, !tbaa !5
  %34 = icmp slt i32 %32, %33
  br i1 %34, label %35, label %56

35:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  %36 = load i32, ptr %4, align 4, !tbaa !5
  %37 = load i32, ptr %5, align 4, !tbaa !5
  %38 = add nsw i32 %36, %37
  %39 = add nsw i32 %38, 1
  %40 = ashr i32 %39, 1
  store i32 %40, ptr %6, align 4, !tbaa !5
  %41 = load i32, ptr %6, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [100010 x i32], ptr @q, i64 0, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = icmp sge i32 %44, %48
  br i1 %49, label %50, label %52

50:                                               ; preds = %35
  %51 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %51, ptr %4, align 4, !tbaa !5
  br label %55

52:                                               ; preds = %35
  %53 = load i32, ptr %6, align 4, !tbaa !5
  %54 = sub nsw i32 %53, 1
  store i32 %54, ptr %5, align 4, !tbaa !5
  br label %55

55:                                               ; preds = %52, %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %31, !llvm.loop !11

56:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %57 = load i32, ptr %5, align 4, !tbaa !5
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %7, align 4, !tbaa !5
  %59 = 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) %7)
  %60 = load i32, ptr %59, align 4, !tbaa !5
  store i32 %60, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  %61 = load i32, ptr %3, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = load i32, ptr %5, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [100010 x i32], ptr @q, i64 0, i64 %67
  store i32 %64, ptr %68, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %69

69:                                               ; preds = %56
  %70 = load i32, ptr %3, align 4, !tbaa !5
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr %3, align 4, !tbaa !5
  br label %24, !llvm.loop !12

72:                                               ; preds = %28
  %73 = load i32, ptr %2, align 4, !tbaa !5
  %74 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %73)
  %75 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %74, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.memset.p0.i64(ptr align 16 @q, i8 0, i64 400040, i1 false)
  store i32 0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %76

76:                                               ; preds = %121, %72
  %77 = load i32, ptr %8, align 4, !tbaa !5
  %78 = load i32, ptr @n, align 4, !tbaa !5
  %79 = icmp slt i32 %77, %78
  br i1 %79, label %81, label %80

80:                                               ; preds = %76
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %124

81:                                               ; preds = %76
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %82 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %82, ptr %10, align 4, !tbaa !5
  br label %83

83:                                               ; preds = %107, %81
  %84 = load i32, ptr %9, align 4, !tbaa !5
  %85 = load i32, ptr %10, align 4, !tbaa !5
  %86 = icmp slt i32 %84, %85
  br i1 %86, label %87, label %108

87:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %88 = load i32, ptr %9, align 4, !tbaa !5
  %89 = load i32, ptr %10, align 4, !tbaa !5
  %90 = add nsw i32 %88, %89
  %91 = add nsw i32 %90, 1
  %92 = ashr i32 %91, 1
  store i32 %92, ptr %11, align 4, !tbaa !5
  %93 = load i32, ptr %11, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [100010 x i32], ptr @q, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = load i32, ptr %8, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %98
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = icmp slt i32 %96, %100
  br i1 %101, label %102, label %104

102:                                              ; preds = %87
  %103 = load i32, ptr %11, align 4, !tbaa !5
  store i32 %103, ptr %9, align 4, !tbaa !5
  br label %107

104:                                              ; preds = %87
  %105 = load i32, ptr %11, align 4, !tbaa !5
  %106 = sub nsw i32 %105, 1
  store i32 %106, ptr %10, align 4, !tbaa !5
  br label %107

107:                                              ; preds = %104, %102
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %83, !llvm.loop !13

108:                                              ; preds = %83
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %109 = load i32, ptr %10, align 4, !tbaa !5
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr %12, align 4, !tbaa !5
  %111 = 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) %12)
  %112 = load i32, ptr %111, align 4, !tbaa !5
  store i32 %112, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  %113 = load i32, ptr %8, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %114
  %116 = load i32, ptr %115, align 4, !tbaa !5
  %117 = load i32, ptr %10, align 4, !tbaa !5
  %118 = add nsw i32 %117, 1
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [100010 x i32], ptr @q, i64 0, i64 %119
  store i32 %116, ptr %120, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %121

121:                                              ; preds = %108
  %122 = load i32, ptr %8, align 4, !tbaa !5
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %8, align 4, !tbaa !5
  br label %76, !llvm.loop !14

124:                                              ; preds = %80
  %125 = load i32, ptr %2, align 4, !tbaa !5
  %126 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %125)
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  %127 = load i32, ptr %1, align 4
  ret i32 %127
}

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

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

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

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

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

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

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


; 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_ostream" = type { ptr, %"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 }

@a = external dso_local global [100010 x i32], align 16
@q = external dso_local local_unnamed_addr global [100010 x i32], align 16
@n = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  br label %4

4:                                                ; preds = %4, %0
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %6 = add nsw i32 %5, 1
  store i32 %6, ptr @n, align 4, !tbaa !5
  %7 = sext i32 %5 to i64
  %8 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %7
  %9 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %8)
  %.not = icmp eq i32 %9, -1
  br i1 %.not, label %10, label %4, !llvm.loop !9

10:                                               ; preds = %4
  %11 = load i32, ptr @n, align 4, !tbaa !5
  %12 = add nsw i32 %11, -1
  store i32 %12, ptr @n, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  store i32 0, ptr %1, align 4, !tbaa !5
  %13 = icmp sgt i32 %11, 1
  br i1 %13, label %.lr.ph40, label %._crit_edge41

._crit_edge41:                                    ; preds = %._crit_edge, %10
  %14 = phi i32 [ 0, %10 ], [ %34, %._crit_edge ]
  %15 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %14)
  %16 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400040) @q, i8 0, i64 400040, i1 false)
  store i32 0, ptr %1, align 4, !tbaa !5
  %17 = load i32, ptr @n, align 4, !tbaa !5
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %.lr.ph50, label %._crit_edge51

.lr.ph40:                                         ; preds = %10, %._crit_edge
  %19 = phi i32 [ %34, %._crit_edge ], [ 0, %10 ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %._crit_edge ], [ 0, %10 ]
  %20 = icmp sgt i32 %19, 0
  br i1 %20, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph40
  %21 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %indvars.iv
  %22 = load i32, ptr %21, align 4, !tbaa !5
  br label %23

23:                                               ; preds = %.lr.ph, %23
  %.03137 = phi i32 [ 0, %.lr.ph ], [ %.132, %23 ]
  %.03336 = phi i32 [ %19, %.lr.ph ], [ %.134, %23 ]
  %24 = add nuw nsw i32 %.03336, 1
  %25 = add nuw nsw i32 %24, %.03137
  %26 = lshr i32 %25, 1
  %27 = zext nneg i32 %26 to i64
  %28 = getelementptr inbounds [100010 x i32], ptr @q, i64 0, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %.not35 = icmp slt i32 %29, %22
  %30 = add nsw i32 %26, -1
  %.134 = select i1 %.not35, i32 %30, i32 %.03336
  %.132 = select i1 %.not35, i32 %.03137, i32 %26
  %31 = icmp slt i32 %.132, %.134
  br i1 %31, label %23, label %._crit_edge, !llvm.loop !11

._crit_edge:                                      ; preds = %23, %.lr.ph40
  %.033.lcssa = phi i32 [ %19, %.lr.ph40 ], [ %.134, %23 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  %32 = add nsw i32 %.033.lcssa, 1
  store i32 %32, ptr %2, align 4, !tbaa !5
  %33 = 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)
  %34 = load i32, ptr %33, align 4, !tbaa !5
  store i32 %34, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  %35 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %indvars.iv
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = sext i32 %32 to i64
  %38 = getelementptr inbounds [100010 x i32], ptr @q, i64 0, i64 %37
  store i32 %36, ptr %38, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %39 = load i32, ptr @n, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = icmp slt i64 %indvars.iv.next, %40
  br i1 %41, label %.lr.ph40, label %._crit_edge41, !llvm.loop !12

._crit_edge51:                                    ; preds = %._crit_edge46, %._crit_edge41
  %42 = phi i32 [ 0, %._crit_edge41 ], [ %60, %._crit_edge46 ]
  %43 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %42)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  ret i32 0

.lr.ph50:                                         ; preds = %._crit_edge41, %._crit_edge46
  %44 = phi i32 [ %60, %._crit_edge46 ], [ 0, %._crit_edge41 ]
  %indvars.iv53 = phi i64 [ %indvars.iv.next54, %._crit_edge46 ], [ 0, %._crit_edge41 ]
  %45 = icmp sgt i32 %44, 0
  br i1 %45, label %.lr.ph45, label %._crit_edge46

.lr.ph45:                                         ; preds = %.lr.ph50
  %46 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %indvars.iv53
  %47 = load i32, ptr %46, align 4, !tbaa !5
  br label %48

48:                                               ; preds = %.lr.ph45, %48
  %.02743 = phi i32 [ %44, %.lr.ph45 ], [ %.1, %48 ]
  %.02842 = phi i32 [ 0, %.lr.ph45 ], [ %.129, %48 ]
  %49 = add nuw nsw i32 %.02743, 1
  %50 = add nuw nsw i32 %49, %.02842
  %51 = lshr i32 %50, 1
  %52 = zext nneg i32 %51 to i64
  %53 = getelementptr inbounds [100010 x i32], ptr @q, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = icmp slt i32 %54, %47
  %56 = add nsw i32 %51, -1
  %.129 = select i1 %55, i32 %51, i32 %.02842
  %.1 = select i1 %55, i32 %.02743, i32 %56
  %57 = icmp slt i32 %.129, %.1
  br i1 %57, label %48, label %._crit_edge46, !llvm.loop !13

._crit_edge46:                                    ; preds = %48, %.lr.ph50
  %.027.lcssa = phi i32 [ %44, %.lr.ph50 ], [ %.1, %48 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  %58 = add nsw i32 %.027.lcssa, 1
  store i32 %58, ptr %3, align 4, !tbaa !5
  %59 = 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) %3)
  %60 = load i32, ptr %59, align 4, !tbaa !5
  store i32 %60, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  %61 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %indvars.iv53
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = sext i32 %58 to i64
  %64 = getelementptr inbounds [100010 x i32], ptr @q, i64 0, i64 %63
  store i32 %62, ptr %64, align 4, !tbaa !5
  %indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1
  %65 = load i32, ptr @n, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = icmp slt i64 %indvars.iv.next54, %66
  br i1 %67, label %.lr.ph50, label %._crit_edge51, !llvm.loop !14
}

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

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

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

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

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

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

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 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress 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 = { 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 nocallback nofree nounwind willreturn memory(argmem: write) }
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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}


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