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

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

%struct.Edge = type { i32, i32 }

@n = external dso_local global i32, align 4
@s = external dso_local global i32, align 4
@tot = external dso_local global i32, align 4
@lnk = external dso_local global [50001 x i32], align 16
@dis = external dso_local global [50001 x i32], align 16
@cnt = external dso_local global [50001 x i32], align 16
@ord = external dso_local global ptr, align 8
@e = external dso_local global [100002 x %struct.Edge], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z3dfsii(i32 noundef, 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 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 %struct.Edge, align 4
  %5 = alloca %struct.Edge, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @s)
  %11 = load i32, ptr @n, align 4, !tbaa !5
  %12 = icmp eq i32 %11, 1
  br i1 %12, label %13, label %15

13:                                               ; preds = %0
  %14 = call i32 @puts(ptr noundef @.str.1)
  store i32 0, ptr %1, align 4
  br label %150

15:                                               ; preds = %0
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %16

16:                                               ; preds = %53, %15
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = load i32, ptr @n, align 4, !tbaa !5
  %19 = icmp slt i32 %17, %18
  br i1 %19, label %21, label %20

20:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %56

21:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %3)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %23 = getelementptr inbounds %struct.Edge, ptr %4, i32 0, i32 0
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [50001 x i32], ptr @lnk, i64 0, i64 %25
  %27 = load i32, ptr %26, align 4, !tbaa !5
  store i32 %27, ptr %23, align 4, !tbaa !9
  %28 = getelementptr inbounds %struct.Edge, ptr %4, i32 0, i32 1
  %29 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %29, ptr %28, align 4, !tbaa !11
  %30 = load i32, ptr @tot, align 4, !tbaa !5
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr @tot, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [100002 x %struct.Edge], ptr @e, i64 0, i64 %32
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %33, ptr align 4 %4, i64 8, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  %34 = load i32, ptr @tot, align 4, !tbaa !5
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [50001 x i32], ptr @lnk, i64 0, i64 %36
  store i32 %34, ptr %37, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %38 = getelementptr inbounds %struct.Edge, ptr %5, i32 0, i32 0
  %39 = load i32, ptr %3, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [50001 x i32], ptr @lnk, i64 0, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !5
  store i32 %42, ptr %38, align 4, !tbaa !9
  %43 = getelementptr inbounds %struct.Edge, ptr %5, i32 0, i32 1
  %44 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %44, ptr %43, align 4, !tbaa !11
  %45 = load i32, ptr @tot, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr @tot, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [100002 x %struct.Edge], ptr @e, i64 0, i64 %47
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %48, ptr align 4 %5, i64 8, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  %49 = load i32, ptr @tot, align 4, !tbaa !5
  %50 = load i32, ptr %3, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [50001 x i32], ptr @lnk, i64 0, i64 %51
  store i32 %49, ptr %52, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %53

53:                                               ; preds = %21
  %54 = load i32, ptr %2, align 4, !tbaa !5
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr %2, align 4, !tbaa !5
  br label %16, !llvm.loop !13

56:                                               ; preds = %20
  %57 = load i32, ptr @s, align 4, !tbaa !5
  %58 = call noundef i32 @_Z3dfsii(i32 noundef %57, i32 noundef -1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %59

59:                                               ; preds = %73, %56
  %60 = load i32, ptr %6, align 4, !tbaa !5
  %61 = load i32, ptr @n, align 4, !tbaa !5
  %62 = icmp slt i32 %60, %61
  br i1 %62, label %64, label %63

63:                                               ; preds = %59
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %76

64:                                               ; preds = %59
  %65 = load i32, ptr %6, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [50001 x i32], ptr @dis, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [50001 x i32], ptr @cnt, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %70, align 4, !tbaa !5
  br label %73

73:                                               ; preds = %64
  %74 = load i32, ptr %6, align 4, !tbaa !5
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %6, align 4, !tbaa !5
  br label %59, !llvm.loop !15

76:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %77

77:                                               ; preds = %93, %76
  %78 = load i32, ptr %7, align 4, !tbaa !5
  %79 = load i32, ptr @n, align 4, !tbaa !5
  %80 = icmp sle i32 %78, %79
  br i1 %80, label %82, label %81

81:                                               ; preds = %77
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %96

82:                                               ; preds = %77
  %83 = load i32, ptr %7, align 4, !tbaa !5
  %84 = sub nsw i32 %83, 1
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [50001 x i32], ptr @cnt, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = load i32, ptr %7, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [50001 x i32], ptr @cnt, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = add nsw i32 %91, %87
  store i32 %92, ptr %90, align 4, !tbaa !5
  br label %93

93:                                               ; preds = %82
  %94 = load i32, ptr %7, align 4, !tbaa !5
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %7, align 4, !tbaa !5
  br label %77, !llvm.loop !16

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

97:                                               ; preds = %115, %96
  %98 = load i32, ptr %8, align 4, !tbaa !5
  %99 = load i32, ptr @n, align 4, !tbaa !5
  %100 = icmp slt i32 %98, %99
  br i1 %100, label %102, label %101

101:                                              ; preds = %97
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %118

102:                                              ; preds = %97
  %103 = load i32, ptr %8, align 4, !tbaa !5
  %104 = load ptr, ptr @ord, align 8, !tbaa !17
  %105 = load i32, ptr %8, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [50001 x i32], ptr @dis, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [50001 x i32], ptr @cnt, i64 0, i64 %109
  %111 = load i32, ptr %110, align 4, !tbaa !5
  %112 = add nsw i32 %111, -1
  store i32 %112, ptr %110, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds i32, ptr %104, i64 %113
  store i32 %103, ptr %114, align 4, !tbaa !5
  br label %115

115:                                              ; preds = %102
  %116 = load i32, ptr %8, align 4, !tbaa !5
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %8, align 4, !tbaa !5
  br label %97, !llvm.loop !19

118:                                              ; preds = %101
  %119 = load i32, ptr @s, align 4, !tbaa !5
  %120 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %119)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %121 = load i32, ptr @n, align 4, !tbaa !5
  %122 = sub nsw i32 %121, 1
  store i32 %122, ptr %9, align 4, !tbaa !5
  br label %123

123:                                              ; preds = %146, %118
  %124 = load i32, ptr %9, align 4, !tbaa !5
  %125 = icmp sge i32 %124, 0
  br i1 %125, label %126, label %136

126:                                              ; preds = %123
  %127 = load ptr, ptr @ord, align 8, !tbaa !17
  %128 = load i32, ptr %9, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds i32, ptr %127, i64 %129
  %131 = load i32, ptr %130, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [50001 x i32], ptr @dis, i64 0, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = icmp ne i32 %134, 0
  br label %136

136:                                              ; preds = %126, %123
  %137 = phi i1 [ false, %123 ], [ %135, %126 ]
  br i1 %137, label %139, label %138

138:                                              ; preds = %136
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %149

139:                                              ; preds = %136
  %140 = load ptr, ptr @ord, align 8, !tbaa !17
  %141 = load i32, ptr %9, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds i32, ptr %140, i64 %142
  %144 = load i32, ptr %143, align 4, !tbaa !5
  %145 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %144)
  br label %146

146:                                              ; preds = %139
  %147 = load i32, ptr %9, align 4, !tbaa !5
  %148 = add nsw i32 %147, -1
  store i32 %148, ptr %9, align 4, !tbaa !5
  br label %123, !llvm.loop !20

149:                                              ; preds = %138
  store i32 0, ptr %1, align 4
  br label %150

150:                                              ; preds = %149, %13
  %151 = load i32, ptr %1, align 4
  ret i32 %151
}

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

declare i32 @puts(ptr noundef) #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

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

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"_ZTS4Edge", !6, i64 0, !6, i64 4}
!11 = !{!10, !6, i64 4}
!12 = !{i64 0, i64 4, !5, i64 4, i64 4, !5}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = !{!18, !18, i64 0}
!18 = !{!"any pointer", !7, i64 0}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}


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

%struct.Edge = type { i32, i32 }

@n = external dso_local global i32, align 4
@s = external dso_local global i32, align 4
@tot = external dso_local local_unnamed_addr global i32, align 4
@lnk = external dso_local local_unnamed_addr global [50001 x i32], align 16
@dis = external dso_local local_unnamed_addr global [50001 x i32], align 16
@cnt = external dso_local local_unnamed_addr global [50001 x i32], align 16
@ord = external dso_local local_unnamed_addr global ptr, align 8
@e = external dso_local local_unnamed_addr global [100002 x %struct.Edge], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z3dfsii(i32 noundef, 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 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, ptr noundef nonnull @s)
  %3 = load i32, ptr @n, align 4, !tbaa !5
  %4 = icmp eq i32 %3, 1
  br i1 %4, label %6, label %.preheader30

.preheader30:                                     ; preds = %0
  %5 = icmp sgt i32 %3, 1
  br i1 %5, label %.lr.ph, label %._crit_edge

6:                                                ; preds = %0
  %7 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %.critedge

._crit_edge:                                      ; preds = %.lr.ph, %.preheader30
  %8 = load i32, ptr @s, align 4, !tbaa !5
  %9 = call noundef i32 @_Z3dfsii(i32 noundef %8, i32 noundef -1)
  %10 = load i32, ptr @n, align 4, !tbaa !5
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %.lr.ph34.preheader, label %._crit_edge40

.lr.ph34.preheader:                               ; preds = %._crit_edge
  %wide.trip.count = zext nneg i32 %10 to i64
  %xtraiter = and i64 %wide.trip.count, 3
  %12 = icmp ult i32 %10, 4
  br i1 %12, label %.lr.ph37.preheader.unr-lcssa, label %.lr.ph34.preheader.new

.lr.ph34.preheader.new:                           ; preds = %.lr.ph34.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483644
  br label %.lr.ph34

.lr.ph:                                           ; preds = %.preheader30, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.preheader30 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %1)
  %14 = getelementptr inbounds [50001 x i32], ptr @lnk, i64 0, i64 %indvars.iv
  %15 = load i32, ptr %14, align 4, !tbaa !5
  %16 = load i32, ptr %1, align 4, !tbaa !5
  %17 = load i32, ptr @tot, align 4, !tbaa !5
  %18 = add nsw i32 %17, 1
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [100002 x %struct.Edge], ptr @e, i64 0, i64 %19
  store i32 %15, ptr %20, align 8, !tbaa !5
  %.sroa.416.0..sroa_idx = getelementptr inbounds i8, ptr %20, i64 4
  store i32 %16, ptr %.sroa.416.0..sroa_idx, align 4, !tbaa !5
  store i32 %18, ptr %14, align 4, !tbaa !5
  %21 = sext i32 %16 to i64
  %22 = getelementptr inbounds [50001 x i32], ptr @lnk, i64 0, i64 %21
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = add nsw i32 %17, 2
  store i32 %24, ptr @tot, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [100002 x %struct.Edge], ptr @e, i64 0, i64 %25
  store i32 %23, ptr %26, align 8, !tbaa !5
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %26, i64 4
  %27 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %27, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !5
  store i32 %24, ptr %22, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %28 = load i32, ptr @n, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = icmp slt i64 %indvars.iv.next, %29
  br i1 %30, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.lr.ph37.preheader.unr-lcssa:                     ; preds = %.lr.ph34, %.lr.ph34.preheader
  %indvars.iv47.unr = phi i64 [ 0, %.lr.ph34.preheader ], [ %indvars.iv.next48.3, %.lr.ph34 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph37.preheader, label %.lr.ph34.epil

.lr.ph34.epil:                                    ; preds = %.lr.ph37.preheader.unr-lcssa, %.lr.ph34.epil
  %indvars.iv47.epil = phi i64 [ %indvars.iv.next48.epil, %.lr.ph34.epil ], [ %indvars.iv47.unr, %.lr.ph37.preheader.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph34.epil ], [ 0, %.lr.ph37.preheader.unr-lcssa ]
  %31 = getelementptr inbounds [50001 x i32], ptr @dis, i64 0, i64 %indvars.iv47.epil
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [50001 x i32], ptr @cnt, i64 0, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %34, align 4, !tbaa !5
  %indvars.iv.next48.epil = add nuw nsw i64 %indvars.iv47.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.lr.ph37.preheader, label %.lr.ph34.epil, !llvm.loop !11

.lr.ph37.preheader:                               ; preds = %.lr.ph34.epil, %.lr.ph37.preheader.unr-lcssa
  %.pre = load i32, ptr @cnt, align 16, !tbaa !5
  %37 = zext nneg i32 %10 to i64
  %xtraiter62 = and i64 %37, 3
  %38 = icmp ult i32 %10, 4
  br i1 %38, label %.preheader.unr-lcssa, label %.lr.ph37.preheader.new

.lr.ph37.preheader.new:                           ; preds = %.lr.ph37.preheader
  %unroll_iter65 = and i64 %37, 2147483644
  br label %.lr.ph37

.lr.ph34:                                         ; preds = %.lr.ph34, %.lr.ph34.preheader.new
  %indvars.iv47 = phi i64 [ 0, %.lr.ph34.preheader.new ], [ %indvars.iv.next48.3, %.lr.ph34 ]
  %niter = phi i64 [ 0, %.lr.ph34.preheader.new ], [ %niter.next.3, %.lr.ph34 ]
  %39 = getelementptr inbounds [50001 x i32], ptr @dis, i64 0, i64 %indvars.iv47
  %40 = load i32, ptr %39, align 16, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [50001 x i32], ptr @cnt, i64 0, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %42, align 4, !tbaa !5
  %indvars.iv.next48 = or disjoint i64 %indvars.iv47, 1
  %45 = getelementptr inbounds [50001 x i32], ptr @dis, i64 0, i64 %indvars.iv.next48
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [50001 x i32], ptr @cnt, i64 0, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %48, align 4, !tbaa !5
  %indvars.iv.next48.1 = or disjoint i64 %indvars.iv47, 2
  %51 = getelementptr inbounds [50001 x i32], ptr @dis, i64 0, i64 %indvars.iv.next48.1
  %52 = load i32, ptr %51, align 8, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [50001 x i32], ptr @cnt, i64 0, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %54, align 4, !tbaa !5
  %indvars.iv.next48.2 = or disjoint i64 %indvars.iv47, 3
  %57 = getelementptr inbounds [50001 x i32], ptr @dis, i64 0, i64 %indvars.iv.next48.2
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [50001 x i32], ptr @cnt, i64 0, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %60, align 4, !tbaa !5
  %indvars.iv.next48.3 = add nuw nsw i64 %indvars.iv47, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.lr.ph37.preheader.unr-lcssa, label %.lr.ph34, !llvm.loop !13

.preheader.unr-lcssa:                             ; preds = %.lr.ph37, %.lr.ph37.preheader
  %.unr = phi i32 [ %.pre, %.lr.ph37.preheader ], [ %80, %.lr.ph37 ]
  %indvars.iv50.unr = phi i64 [ 1, %.lr.ph37.preheader ], [ %indvars.iv.next51.3, %.lr.ph37 ]
  %lcmp.mod64.not = icmp eq i64 %xtraiter62, 0
  br i1 %lcmp.mod64.not, label %.preheader, label %.lr.ph37.epil

.lr.ph37.epil:                                    ; preds = %.preheader.unr-lcssa, %.lr.ph37.epil
  %63 = phi i32 [ %66, %.lr.ph37.epil ], [ %.unr, %.preheader.unr-lcssa ]
  %indvars.iv50.epil = phi i64 [ %indvars.iv.next51.epil, %.lr.ph37.epil ], [ %indvars.iv50.unr, %.preheader.unr-lcssa ]
  %epil.iter63 = phi i64 [ %epil.iter63.next, %.lr.ph37.epil ], [ 0, %.preheader.unr-lcssa ]
  %64 = getelementptr inbounds [50001 x i32], ptr @cnt, i64 0, i64 %indvars.iv50.epil
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = add nsw i32 %65, %63
  store i32 %66, ptr %64, align 4, !tbaa !5
  %indvars.iv.next51.epil = add nuw nsw i64 %indvars.iv50.epil, 1
  %epil.iter63.next = add i64 %epil.iter63, 1
  %epil.iter63.cmp.not = icmp eq i64 %epil.iter63.next, %xtraiter62
  br i1 %epil.iter63.cmp.not, label %.preheader, label %.lr.ph37.epil, !llvm.loop !14

.preheader:                                       ; preds = %.lr.ph37.epil, %.preheader.unr-lcssa
  br i1 %11, label %.lr.ph39, label %._crit_edge40

.lr.ph39:                                         ; preds = %.preheader
  %67 = load ptr, ptr @ord, align 8, !tbaa !15
  br label %86

.lr.ph37:                                         ; preds = %.lr.ph37, %.lr.ph37.preheader.new
  %68 = phi i32 [ %.pre, %.lr.ph37.preheader.new ], [ %80, %.lr.ph37 ]
  %indvars.iv50 = phi i64 [ 1, %.lr.ph37.preheader.new ], [ %indvars.iv.next51.3, %.lr.ph37 ]
  %niter66 = phi i64 [ 0, %.lr.ph37.preheader.new ], [ %niter66.next.3, %.lr.ph37 ]
  %69 = getelementptr inbounds [50001 x i32], ptr @cnt, i64 0, i64 %indvars.iv50
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = add nsw i32 %70, %68
  store i32 %71, ptr %69, align 4, !tbaa !5
  %indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
  %72 = getelementptr inbounds [50001 x i32], ptr @cnt, i64 0, i64 %indvars.iv.next51
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = add nsw i32 %73, %71
  store i32 %74, ptr %72, align 4, !tbaa !5
  %indvars.iv.next51.1 = add nuw nsw i64 %indvars.iv50, 2
  %75 = getelementptr inbounds [50001 x i32], ptr @cnt, i64 0, i64 %indvars.iv.next51.1
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = add nsw i32 %76, %74
  store i32 %77, ptr %75, align 4, !tbaa !5
  %indvars.iv.next51.2 = add nuw nsw i64 %indvars.iv50, 3
  %78 = getelementptr inbounds [50001 x i32], ptr @cnt, i64 0, i64 %indvars.iv.next51.2
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = add nsw i32 %79, %77
  store i32 %80, ptr %78, align 4, !tbaa !5
  %indvars.iv.next51.3 = add nuw nsw i64 %indvars.iv50, 4
  %niter66.next.3 = add i64 %niter66, 4
  %niter66.ncmp.3 = icmp eq i64 %niter66.next.3, %unroll_iter65
  br i1 %niter66.ncmp.3, label %.preheader.unr-lcssa, label %.lr.ph37, !llvm.loop !17

._crit_edge40:                                    ; preds = %86, %._crit_edge, %.preheader
  %81 = load i32, ptr @s, align 4, !tbaa !5
  %82 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %81)
  %83 = load i32, ptr @n, align 4, !tbaa !5
  %84 = icmp sgt i32 %83, 0
  br i1 %84, label %.lr.ph44.preheader, label %.critedge

.lr.ph44.preheader:                               ; preds = %._crit_edge40
  %85 = zext nneg i32 %83 to i64
  br label %.lr.ph44

86:                                               ; preds = %.lr.ph39, %86
  %indvars.iv55 = phi i64 [ 0, %.lr.ph39 ], [ %indvars.iv.next56, %86 ]
  %87 = getelementptr inbounds [50001 x i32], ptr @dis, i64 0, i64 %indvars.iv55
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [50001 x i32], ptr @cnt, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = add nsw i32 %91, -1
  store i32 %92, ptr %90, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds i32, ptr %67, i64 %93
  %95 = trunc nuw nsw i64 %indvars.iv55 to i32
  store i32 %95, ptr %94, align 4, !tbaa !5
  %indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
  %96 = load i32, ptr @n, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = icmp slt i64 %indvars.iv.next56, %97
  br i1 %98, label %86, label %._crit_edge40, !llvm.loop !18

.lr.ph44:                                         ; preds = %.lr.ph44.preheader, %105
  %indvars.iv58 = phi i64 [ %85, %.lr.ph44.preheader ], [ %indvars.iv.next59, %105 ]
  %indvars.iv.next59 = add nsw i64 %indvars.iv58, -1
  %99 = load ptr, ptr @ord, align 8, !tbaa !15
  %100 = getelementptr inbounds i32, ptr %99, i64 %indvars.iv.next59
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [50001 x i32], ptr @dis, i64 0, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %.not28 = icmp eq i32 %104, 0
  br i1 %.not28, label %.critedge, label %105

105:                                              ; preds = %.lr.ph44
  %106 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %101)
  %107 = icmp ugt i64 %indvars.iv58, 1
  br i1 %107, label %.lr.ph44, label %.critedge, !llvm.loop !19

.critedge:                                        ; preds = %105, %.lr.ph44, %._crit_edge40, %6
  ret i32 0
}

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

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

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

attributes #0 = { 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 #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 = { 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, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !12}
!15 = !{!16, !16, i64 0}
!16 = !{!"any pointer", !7, i64 0}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}


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