; LLVM IR from tangjz/acm-icpc :: usaco/Training/Chapter 1 Getting started (ariprog)

; 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
@m = external dso_local global i32, align 4
@maxval = external dso_local global i32, align 4
@len = external dso_local global i32, align 4
@num = external dso_local global [125001 x i32], align 16
@used = external dso_local global [125001 x i8], align 16
@flag = external dso_local global i8, align 1
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1

; 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
  store i32 0, ptr %1, align 4
  %6 = load ptr, ptr @stdin, align 8, !tbaa !5
  %7 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.1, ptr noundef %6)
  %8 = load ptr, ptr @stdout, align 8, !tbaa !5
  %9 = call ptr @freopen(ptr noundef @.str.2, ptr noundef @.str.3, ptr noundef %8)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef @n, ptr noundef @m)
  %11 = load i32, ptr @m, align 4, !tbaa !9
  %12 = load i32, ptr @m, align 4, !tbaa !9
  %13 = mul nsw i32 %11, %12
  %14 = shl i32 %13, 1
  store i32 %14, ptr @maxval, align 4, !tbaa !9
  store i32 0, ptr %2, align 4, !tbaa !9
  br label %15

15:                                               ; preds = %52, %0
  %16 = load i32, ptr %2, align 4, !tbaa !9
  %17 = load i32, ptr @m, align 4, !tbaa !9
  %18 = icmp sle i32 %16, %17
  br i1 %18, label %19, label %55

19:                                               ; preds = %15
  %20 = load i32, ptr %2, align 4, !tbaa !9
  store i32 %20, ptr %3, align 4, !tbaa !9
  br label %21

21:                                               ; preds = %48, %19
  %22 = load i32, ptr %3, align 4, !tbaa !9
  %23 = load i32, ptr @m, align 4, !tbaa !9
  %24 = icmp sle i32 %22, %23
  br i1 %24, label %25, label %51

25:                                               ; preds = %21
  %26 = load i32, ptr %2, align 4, !tbaa !9
  %27 = load i32, ptr %2, align 4, !tbaa !9
  %28 = mul nsw i32 %26, %27
  %29 = load i32, ptr %3, align 4, !tbaa !9
  %30 = load i32, ptr %3, align 4, !tbaa !9
  %31 = mul nsw i32 %29, %30
  %32 = add nsw i32 %28, %31
  store i32 %32, ptr %5, align 4, !tbaa !9
  %33 = load i32, ptr %5, align 4, !tbaa !9
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [125001 x i8], ptr @used, i64 0, i64 %34
  %36 = load i8, ptr %35, align 1, !tbaa !11, !range !13, !noundef !14
  %37 = trunc i8 %36 to i1
  br i1 %37, label %38, label %39

38:                                               ; preds = %25
  br label %48

39:                                               ; preds = %25
  %40 = load i32, ptr %5, align 4, !tbaa !9
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [125001 x i8], ptr @used, i64 0, i64 %41
  store i8 1, ptr %42, align 1, !tbaa !11
  %43 = load i32, ptr %5, align 4, !tbaa !9
  %44 = load i32, ptr @len, align 4, !tbaa !9
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr @len, align 4, !tbaa !9
  %46 = sext i32 %44 to i64
  %47 = getelementptr inbounds [125001 x i32], ptr @num, i64 0, i64 %46
  store i32 %43, ptr %47, align 4, !tbaa !9
  br label %48

48:                                               ; preds = %39, %38
  %49 = load i32, ptr %3, align 4, !tbaa !9
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %3, align 4, !tbaa !9
  br label %21, !llvm.loop !15

51:                                               ; preds = %21
  br label %52

52:                                               ; preds = %51
  %53 = load i32, ptr %2, align 4, !tbaa !9
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %2, align 4, !tbaa !9
  br label %15, !llvm.loop !17

55:                                               ; preds = %15
  %56 = load i32, ptr @len, align 4, !tbaa !9
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds i32, ptr @num, i64 %57
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef @num, ptr noundef %58)
  store i32 1, ptr %4, align 4, !tbaa !9
  br label %59

59:                                               ; preds = %122, %55
  %60 = load i32, ptr %4, align 4, !tbaa !9
  %61 = load i32, ptr @len, align 4, !tbaa !9
  %62 = sub nsw i32 %61, 1
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [125001 x i32], ptr @num, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !9
  %66 = load i32, ptr @n, align 4, !tbaa !9
  %67 = sub nsw i32 %66, 1
  %68 = sdiv i32 %65, %67
  %69 = icmp sle i32 %60, %68
  br i1 %69, label %70, label %125

70:                                               ; preds = %59
  store i32 0, ptr %2, align 4, !tbaa !9
  br label %71

71:                                               ; preds = %118, %70
  %72 = load i32, ptr %2, align 4, !tbaa !9
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [125001 x i32], ptr @num, i64 0, i64 %73
  %75 = load i32, ptr %74, align 4, !tbaa !9
  %76 = load i32, ptr @n, align 4, !tbaa !9
  %77 = sub nsw i32 %76, 1
  %78 = load i32, ptr %4, align 4, !tbaa !9
  %79 = mul nsw i32 %77, %78
  %80 = add nsw i32 %75, %79
  %81 = load i32, ptr @maxval, align 4, !tbaa !9
  %82 = icmp sle i32 %80, %81
  br i1 %82, label %83, label %121

83:                                               ; preds = %71
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %84

84:                                               ; preds = %103, %83
  %85 = load i32, ptr %3, align 4, !tbaa !9
  %86 = load i32, ptr @n, align 4, !tbaa !9
  %87 = icmp slt i32 %85, %86
  br i1 %87, label %88, label %106

88:                                               ; preds = %84
  %89 = load i32, ptr %2, align 4, !tbaa !9
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [125001 x i32], ptr @num, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !9
  %93 = load i32, ptr %3, align 4, !tbaa !9
  %94 = load i32, ptr %4, align 4, !tbaa !9
  %95 = mul nsw i32 %93, %94
  %96 = add nsw i32 %92, %95
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [125001 x i8], ptr @used, i64 0, i64 %97
  %99 = load i8, ptr %98, align 1, !tbaa !11, !range !13, !noundef !14
  %100 = trunc i8 %99 to i1
  br i1 %100, label %102, label %101

101:                                              ; preds = %88
  br label %106

102:                                              ; preds = %88
  br label %103

103:                                              ; preds = %102
  %104 = load i32, ptr %3, align 4, !tbaa !9
  %105 = add nsw i32 %104, 1
  store i32 %105, ptr %3, align 4, !tbaa !9
  br label %84, !llvm.loop !18

106:                                              ; preds = %101, %84
  %107 = load i32, ptr %3, align 4, !tbaa !9
  %108 = load i32, ptr @n, align 4, !tbaa !9
  %109 = icmp slt i32 %107, %108
  br i1 %109, label %110, label %111

110:                                              ; preds = %106
  br label %118

111:                                              ; preds = %106
  %112 = load i32, ptr %2, align 4, !tbaa !9
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [125001 x i32], ptr @num, i64 0, i64 %113
  %115 = load i32, ptr %114, align 4, !tbaa !9
  %116 = load i32, ptr %4, align 4, !tbaa !9
  %117 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %115, i32 noundef %116)
  store i8 1, ptr @flag, align 1, !tbaa !11
  br label %118

118:                                              ; preds = %111, %110
  %119 = load i32, ptr %2, align 4, !tbaa !9
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %2, align 4, !tbaa !9
  br label %71, !llvm.loop !19

121:                                              ; preds = %71
  br label %122

122:                                              ; preds = %121
  %123 = load i32, ptr %4, align 4, !tbaa !9
  %124 = add nsw i32 %123, 1
  store i32 %124, ptr %4, align 4, !tbaa !9
  br label %59, !llvm.loop !20

125:                                              ; preds = %59
  %126 = load i8, ptr @flag, align 1, !tbaa !11, !range !13, !noundef !14
  %127 = trunc i8 %126 to i1
  br i1 %127, label %130, label %128

128:                                              ; preds = %125
  %129 = call i32 @puts(ptr noundef @.str.6)
  br label %130

130:                                              ; preds = %128, %125
  %131 = load ptr, ptr @stdin, align 8, !tbaa !5
  %132 = call i32 @fclose(ptr noundef %131)
  %133 = load ptr, ptr @stdout, align 8, !tbaa !5
  %134 = call i32 @fclose(ptr noundef %133)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  ret i32 0
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #1

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

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

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

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

declare i32 @puts(ptr noundef) #1

declare i32 @fclose(ptr noundef) #1

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

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 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 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !16}
!20 = distinct !{!20, !16}


; 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
@m = external dso_local global i32, align 4
@maxval = external dso_local local_unnamed_addr global i32, align 4
@len = external dso_local local_unnamed_addr global i32, align 4
@num = external dso_local global [125001 x i32], align 16
@used = external dso_local local_unnamed_addr global [125001 x i8], align 16
@flag = external dso_local local_unnamed_addr global i8, align 1
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = load ptr, ptr @stdin, align 8, !tbaa !5
  %2 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef %1)
  %3 = load ptr, ptr @stdout, align 8, !tbaa !5
  %4 = tail call ptr @freopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef %3)
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %6 = load i32, ptr @m, align 4, !tbaa !9
  %7 = shl i32 %6, 1
  %8 = mul i32 %7, %6
  store i32 %8, ptr @maxval, align 4, !tbaa !9
  %len.promoted34 = load i32, ptr @len, align 4, !tbaa !9
  %.not38 = icmp slt i32 %6, 0
  br i1 %.not38, label %._crit_edge, label %.preheader32.preheader

.preheader32.preheader:                           ; preds = %0
  %9 = add nuw i32 %6, 1
  %wide.trip.count53 = zext i32 %9 to i64
  br label %.preheader32

.preheader32:                                     ; preds = %.preheader32.preheader, %25
  %indvars.iv = phi i64 [ 0, %.preheader32.preheader ], [ %indvars.iv.next, %25 ]
  %len.promoted3739 = phi i32 [ %len.promoted34, %.preheader32.preheader ], [ %len.promoted35, %25 ]
  %10 = mul nuw nsw i64 %indvars.iv, %indvars.iv
  br label %11

11:                                               ; preds = %.preheader32, %23
  %indvars.iv49 = phi i64 [ %indvars.iv, %.preheader32 ], [ %indvars.iv.next50, %23 ]
  %len.promoted36 = phi i32 [ %len.promoted3739, %.preheader32 ], [ %len.promoted35, %23 ]
  %12 = phi i32 [ %len.promoted3739, %.preheader32 ], [ %24, %23 ]
  %13 = mul nuw nsw i64 %indvars.iv49, %indvars.iv49
  %14 = add nuw nsw i64 %13, %10
  %15 = getelementptr inbounds [125001 x i8], ptr @used, i64 0, i64 %14
  %16 = load i8, ptr %15, align 1, !tbaa !11, !range !13, !noundef !14
  %17 = trunc nuw i8 %16 to i1
  br i1 %17, label %23, label %18

18:                                               ; preds = %11
  store i8 1, ptr %15, align 1, !tbaa !11
  %19 = add nsw i32 %12, 1
  store i32 %19, ptr @len, align 4, !tbaa !9
  %20 = sext i32 %12 to i64
  %21 = getelementptr inbounds [125001 x i32], ptr @num, i64 0, i64 %20
  %22 = trunc nuw i64 %14 to i32
  store i32 %22, ptr %21, align 4, !tbaa !9
  br label %23

23:                                               ; preds = %11, %18
  %len.promoted35 = phi i32 [ %len.promoted36, %11 ], [ %19, %18 ]
  %24 = phi i32 [ %12, %11 ], [ %19, %18 ]
  %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next50, %wide.trip.count53
  br i1 %exitcond.not, label %25, label %11, !llvm.loop !15

25:                                               ; preds = %23
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond54.not = icmp eq i64 %indvars.iv.next, %wide.trip.count53
  br i1 %exitcond54.not, label %._crit_edge, label %.preheader32, !llvm.loop !17

._crit_edge:                                      ; preds = %25, %0
  %26 = phi i32 [ %len.promoted34, %0 ], [ %len.promoted35, %25 ]
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds i32, ptr @num, i64 %27
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @num, ptr noundef nonnull %28)
  %29 = load i32, ptr @len, align 4, !tbaa !9
  %30 = add nsw i32 %29, -1
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [125001 x i32], ptr @num, i64 0, i64 %31
  %33 = load i32, ptr %32, align 4, !tbaa !9
  %34 = load i32, ptr @n, align 4, !tbaa !9
  %35 = add nsw i32 %34, -1
  %36 = sdiv i32 %33, %35
  %.not2846 = icmp slt i32 %36, 1
  br i1 %.not2846, label %._crit_edge48, label %.preheader31.preheader

.preheader31.preheader:                           ; preds = %._crit_edge
  %.pre = load i32, ptr @maxval, align 4, !tbaa !9
  br label %.preheader31

.preheader31:                                     ; preds = %.preheader31.preheader, %._crit_edge45
  %37 = phi i32 [ %34, %.preheader31.preheader ], [ %67, %._crit_edge45 ]
  %38 = phi i32 [ %29, %.preheader31.preheader ], [ %68, %._crit_edge45 ]
  %39 = phi i32 [ %.pre, %.preheader31.preheader ], [ %69, %._crit_edge45 ]
  %40 = phi i32 [ %.pre, %.preheader31.preheader ], [ %70, %._crit_edge45 ]
  %indvars.iv63 = phi i64 [ 1, %.preheader31.preheader ], [ %indvars.iv.next64, %._crit_edge45 ]
  %41 = load i32, ptr @num, align 16, !tbaa !9
  %42 = add nsw i32 %37, -1
  %43 = trunc nuw nsw i64 %indvars.iv63 to i32
  %44 = mul nsw i32 %42, %43
  %45 = add nsw i32 %44, %41
  %.not2943 = icmp sgt i32 %45, %40
  br i1 %.not2943, label %._crit_edge45, label %.preheader

.preheader:                                       ; preds = %.preheader31, %.thread
  %46 = phi i32 [ %59, %.thread ], [ %37, %.preheader31 ]
  %47 = phi i32 [ %60, %.thread ], [ %39, %.preheader31 ]
  %48 = phi i32 [ %61, %.thread ], [ %37, %.preheader31 ]
  %indvars.iv60 = phi i64 [ %indvars.iv.next61, %.thread ], [ 0, %.preheader31 ]
  %49 = phi i32 [ %63, %.thread ], [ %41, %.preheader31 ]
  %50 = icmp sgt i32 %48, 0
  br i1 %50, label %.lr.ph.preheader, label %._crit_edge42

.lr.ph.preheader:                                 ; preds = %.preheader
  %51 = sext i32 %49 to i64
  %wide.trip.count58 = zext nneg i32 %48 to i64
  br label %.lr.ph

52:                                               ; preds = %.lr.ph
  %indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
  %exitcond59.not = icmp eq i64 %indvars.iv.next56, %wide.trip.count58
  br i1 %exitcond59.not, label %._crit_edge42, label %.lr.ph, !llvm.loop !18

.lr.ph:                                           ; preds = %.lr.ph.preheader, %52
  %indvars.iv55 = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next56, %52 ]
  %53 = mul nuw nsw i64 %indvars.iv55, %indvars.iv63
  %54 = add nsw i64 %53, %51
  %55 = getelementptr inbounds [125001 x i8], ptr @used, i64 0, i64 %54
  %56 = load i8, ptr %55, align 1, !tbaa !11, !range !13, !noundef !14
  %57 = trunc nuw i8 %56 to i1
  br i1 %57, label %52, label %.thread

._crit_edge42:                                    ; preds = %52, %.preheader
  %58 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %49, i32 noundef %43)
  store i8 1, ptr @flag, align 1, !tbaa !11
  %.pre66 = load i32, ptr @n, align 4, !tbaa !9
  %.pre67 = load i32, ptr @maxval, align 4, !tbaa !9
  br label %.thread

.thread:                                          ; preds = %.lr.ph, %._crit_edge42
  %59 = phi i32 [ %.pre66, %._crit_edge42 ], [ %46, %.lr.ph ]
  %60 = phi i32 [ %.pre67, %._crit_edge42 ], [ %47, %.lr.ph ]
  %61 = phi i32 [ %.pre66, %._crit_edge42 ], [ %48, %.lr.ph ]
  %indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
  %62 = getelementptr inbounds [125001 x i32], ptr @num, i64 0, i64 %indvars.iv.next61
  %63 = load i32, ptr %62, align 4, !tbaa !9
  %64 = add nsw i32 %61, -1
  %65 = mul nsw i32 %64, %43
  %66 = add nsw i32 %65, %63
  %.not29 = icmp sgt i32 %66, %60
  br i1 %.not29, label %._crit_edge45.loopexit, label %.preheader, !llvm.loop !19

._crit_edge45.loopexit:                           ; preds = %.thread
  %.pre68 = load i32, ptr @len, align 4, !tbaa !9
  %.pre69 = add nsw i32 %59, -1
  br label %._crit_edge45

._crit_edge45:                                    ; preds = %._crit_edge45.loopexit, %.preheader31
  %.pre-phi = phi i32 [ %.pre69, %._crit_edge45.loopexit ], [ %42, %.preheader31 ]
  %67 = phi i32 [ %59, %._crit_edge45.loopexit ], [ %37, %.preheader31 ]
  %68 = phi i32 [ %.pre68, %._crit_edge45.loopexit ], [ %38, %.preheader31 ]
  %69 = phi i32 [ %60, %._crit_edge45.loopexit ], [ %39, %.preheader31 ]
  %70 = phi i32 [ %60, %._crit_edge45.loopexit ], [ %40, %.preheader31 ]
  %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
  %71 = add nsw i32 %68, -1
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [125001 x i32], ptr @num, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !9
  %75 = sdiv i32 %74, %.pre-phi
  %76 = sext i32 %75 to i64
  %.not28.not = icmp slt i64 %indvars.iv63, %76
  br i1 %.not28.not, label %.preheader31, label %._crit_edge48, !llvm.loop !20

._crit_edge48:                                    ; preds = %._crit_edge45, %._crit_edge
  %77 = load i8, ptr @flag, align 1, !tbaa !11, !range !13, !noundef !14
  %78 = trunc nuw i8 %77 to i1
  br i1 %78, label %81, label %79

79:                                               ; preds = %._crit_edge48
  %80 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.6)
  br label %81

81:                                               ; preds = %79, %._crit_edge48
  %82 = load ptr, ptr @stdin, align 8, !tbaa !5
  %83 = tail call i32 @fclose(ptr noundef %82)
  %84 = load ptr, ptr @stdout, align 8, !tbaa !5
  %85 = tail call i32 @fclose(ptr noundef %84)
  ret i32 0
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

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

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #2

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 = { 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 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !16}
!20 = distinct !{!20, !16}


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