; LLVM IR from tangjz/acm-icpc :: Summer_Training/2016-07-17 (D - Trouble - lizy)

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

@T = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@a = external dso_local global [5 x [209 x i64]], align 16
@u = external dso_local global [4000006 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3insx(i64 noundef) #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z4findx(i64 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @T)
  br label %11

11:                                               ; preds = %129, %0
  %12 = load i32, ptr @T, align 4, !tbaa !5
  %13 = add nsw i32 %12, -1
  store i32 %13, ptr @T, align 4, !tbaa !5
  %14 = icmp ne i32 %12, 0
  br i1 %14, label %15, label %130

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

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

20:                                               ; preds = %17
  store i32 4, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %43

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

22:                                               ; preds = %36, %21
  %23 = load i32, ptr %4, align 4, !tbaa !5
  %24 = load i32, ptr @n, align 4, !tbaa !5
  %25 = icmp slt i32 %23, %24
  br i1 %25, label %27, label %26

26:                                               ; preds = %22
  store i32 7, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %39

27:                                               ; preds = %22
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [5 x [209 x i64]], ptr @a, i64 0, i64 %29
  %31 = getelementptr inbounds [209 x i64], ptr %30, i64 0, i64 0
  %32 = load i32, ptr %4, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds i64, ptr %31, i64 %33
  %35 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %34)
  br label %36

36:                                               ; preds = %27
  %37 = load i32, ptr %4, align 4, !tbaa !5
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %4, align 4, !tbaa !5
  br label %22, !llvm.loop !9

39:                                               ; preds = %26
  br label %40

40:                                               ; preds = %39
  %41 = load i32, ptr %2, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %2, align 4, !tbaa !5
  br label %17, !llvm.loop !11

43:                                               ; preds = %20
  call void @llvm.memset.p0.i64(ptr align 16 @u, i8 0, i64 4000006, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %69, %43
  %45 = load i32, ptr %5, align 4, !tbaa !5
  %46 = load i32, ptr @n, align 4, !tbaa !5
  %47 = icmp slt i32 %45, %46
  br i1 %47, label %49, label %48

48:                                               ; preds = %44
  store i32 10, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %72

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

50:                                               ; preds = %65, %49
  %51 = load i32, ptr %6, align 4, !tbaa !5
  %52 = load i32, ptr @n, align 4, !tbaa !5
  %53 = icmp slt i32 %51, %52
  br i1 %53, label %55, label %54

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

55:                                               ; preds = %50
  %56 = load i32, ptr %5, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [209 x i64], ptr @a, i64 0, i64 %57
  %59 = load i64, ptr %58, align 8, !tbaa !12
  %60 = load i32, ptr %6, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [209 x i64], ptr getelementptr inbounds ([5 x [209 x i64]], ptr @a, i64 0, i64 1), i64 0, i64 %61
  %63 = load i64, ptr %62, align 8, !tbaa !12
  %64 = add nsw i64 %59, %63
  call void @_Z3insx(i64 noundef %64)
  br label %65

65:                                               ; preds = %55
  %66 = load i32, ptr %6, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %6, align 4, !tbaa !5
  br label %50, !llvm.loop !14

68:                                               ; preds = %54
  br label %69

69:                                               ; preds = %68
  %70 = load i32, ptr %5, align 4, !tbaa !5
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr %5, align 4, !tbaa !5
  br label %44, !llvm.loop !15

72:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %73

73:                                               ; preds = %122, %72
  %74 = load i32, ptr %7, align 4, !tbaa !5
  %75 = load i32, ptr @n, align 4, !tbaa !5
  %76 = icmp slt i32 %74, %75
  br i1 %76, label %78, label %77

77:                                               ; preds = %73
  store i32 16, ptr %3, align 4
  br label %125

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

79:                                               ; preds = %116, %78
  %80 = load i32, ptr %8, align 4, !tbaa !5
  %81 = load i32, ptr @n, align 4, !tbaa !5
  %82 = icmp slt i32 %80, %81
  br i1 %82, label %84, label %83

83:                                               ; preds = %79
  store i32 19, ptr %3, align 4
  br label %119

84:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %85

85:                                               ; preds = %110, %84
  %86 = load i32, ptr %9, align 4, !tbaa !5
  %87 = load i32, ptr @n, align 4, !tbaa !5
  %88 = icmp slt i32 %86, %87
  br i1 %88, label %90, label %89

89:                                               ; preds = %85
  store i32 22, ptr %3, align 4
  br label %113

90:                                               ; preds = %85
  %91 = load i32, ptr %7, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [209 x i64], ptr getelementptr inbounds ([5 x [209 x i64]], ptr @a, i64 0, i64 3), i64 0, i64 %92
  %94 = load i64, ptr %93, align 8, !tbaa !12
  %95 = load i32, ptr %8, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [209 x i64], ptr getelementptr inbounds ([5 x [209 x i64]], ptr @a, i64 0, i64 4), i64 0, i64 %96
  %98 = load i64, ptr %97, align 8, !tbaa !12
  %99 = add nsw i64 %94, %98
  %100 = load i32, ptr %9, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [209 x i64], ptr getelementptr inbounds ([5 x [209 x i64]], ptr @a, i64 0, i64 2), i64 0, i64 %101
  %103 = load i64, ptr %102, align 8, !tbaa !12
  %104 = add nsw i64 %99, %103
  %105 = sub nsw i64 0, %104
  %106 = call noundef zeroext i1 @_Z4findx(i64 noundef %105)
  br i1 %106, label %107, label %109

107:                                              ; preds = %90
  %108 = call i32 @puts(ptr noundef @.str.2)
  store i32 25, ptr %3, align 4
  br label %113

109:                                              ; preds = %90
  br label %110

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

113:                                              ; preds = %107, %89
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  %114 = load i32, ptr %3, align 4
  switch i32 %114, label %119 [
    i32 22, label %115
  ]

115:                                              ; preds = %113
  br label %116

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

119:                                              ; preds = %113, %83
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  %120 = load i32, ptr %3, align 4
  switch i32 %120, label %125 [
    i32 19, label %121
  ]

121:                                              ; preds = %119
  br label %122

122:                                              ; preds = %121
  %123 = load i32, ptr %7, align 4, !tbaa !5
  %124 = add nsw i32 %123, 1
  store i32 %124, ptr %7, align 4, !tbaa !5
  br label %73, !llvm.loop !18

125:                                              ; preds = %119, %77
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  %126 = load i32, ptr %3, align 4
  switch i32 %126, label %131 [
    i32 16, label %127
    i32 25, label %129
  ]

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

129:                                              ; preds = %127, %125
  br label %11, !llvm.loop !19

130:                                              ; preds = %11
  ret i32 0

131:                                              ; preds = %125
  unreachable
}

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

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

declare i32 @puts(ptr noundef) #3

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

@T = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@a = external dso_local global [5 x [209 x i64]], align 16
@u = external dso_local local_unnamed_addr global [4000006 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3insx(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z4findx(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @T)
  %2 = load i32, ptr @T, align 4, !tbaa !5
  %3 = add nsw i32 %2, -1
  store i32 %3, ptr @T, align 4, !tbaa !5
  %.not61 = icmp eq i32 %2, 0
  br i1 %.not61, label %._crit_edge64, label %.lr.ph63

.lr.ph63:                                         ; preds = %0, %._crit_edge60
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph, label %._crit_edge60.sink.split

.split48.us:                                      ; preds = %.lr.ph.4
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4000006) @u, i8 0, i64 4000006, i1 false)
  %7 = icmp sgt i32 %29, 0
  br i1 %7, label %.preheader42, label %._crit_edge60

._crit_edge:                                      ; preds = %.lr.ph
  %8 = icmp sgt i32 %34, 0
  br i1 %8, label %.lr.ph.1, label %._crit_edge60.sink.split

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

._crit_edge.1:                                    ; preds = %.lr.ph.1
  %14 = icmp sgt i32 %11, 0
  br i1 %14, label %.lr.ph.2, label %._crit_edge60.sink.split

.lr.ph.2:                                         ; preds = %._crit_edge.1, %.lr.ph.2
  %indvars.iv.2 = phi i64 [ %indvars.iv.next.2, %.lr.ph.2 ], [ 0, %._crit_edge.1 ]
  %15 = getelementptr inbounds i64, ptr getelementptr inbounds (i8, ptr @a, i64 3344), i64 %indvars.iv.2
  %16 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %15)
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv.2, 1
  %17 = load i32, ptr @n, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = icmp slt i64 %indvars.iv.next.2, %18
  br i1 %19, label %.lr.ph.2, label %._crit_edge.2, !llvm.loop !9

._crit_edge.2:                                    ; preds = %.lr.ph.2
  %20 = icmp sgt i32 %17, 0
  br i1 %20, label %.lr.ph.3, label %._crit_edge60.sink.split

.lr.ph.3:                                         ; preds = %._crit_edge.2, %.lr.ph.3
  %indvars.iv.3 = phi i64 [ %indvars.iv.next.3, %.lr.ph.3 ], [ 0, %._crit_edge.2 ]
  %21 = getelementptr inbounds i64, ptr getelementptr inbounds (i8, ptr @a, i64 5016), i64 %indvars.iv.3
  %22 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %21)
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv.3, 1
  %23 = load i32, ptr @n, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = icmp slt i64 %indvars.iv.next.3, %24
  br i1 %25, label %.lr.ph.3, label %._crit_edge.3, !llvm.loop !9

._crit_edge.3:                                    ; preds = %.lr.ph.3
  %26 = icmp sgt i32 %23, 0
  br i1 %26, label %.lr.ph.4, label %._crit_edge60.sink.split

.lr.ph.4:                                         ; preds = %._crit_edge.3, %.lr.ph.4
  %indvars.iv.4 = phi i64 [ %indvars.iv.next.4, %.lr.ph.4 ], [ 0, %._crit_edge.3 ]
  %27 = getelementptr inbounds i64, ptr getelementptr inbounds (i8, ptr @a, i64 6688), i64 %indvars.iv.4
  %28 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %27)
  %indvars.iv.next.4 = add nuw nsw i64 %indvars.iv.4, 1
  %29 = load i32, ptr @n, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = icmp slt i64 %indvars.iv.next.4, %30
  br i1 %31, label %.lr.ph.4, label %.split48.us, !llvm.loop !9

.lr.ph:                                           ; preds = %.lr.ph63, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph63 ]
  %32 = getelementptr inbounds i64, ptr @a, i64 %indvars.iv
  %33 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %32)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %34 = load i32, ptr @n, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = icmp slt i64 %indvars.iv.next, %35
  br i1 %36, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.preheader44:                                     ; preds = %._crit_edge51
  %37 = icmp sgt i32 %41, 0
  br i1 %37, label %.preheader41, label %._crit_edge60

.preheader42:                                     ; preds = %.split48.us, %._crit_edge51
  %38 = phi i32 [ %41, %._crit_edge51 ], [ %29, %.split48.us ]
  %indvars.iv76 = phi i64 [ %indvars.iv.next77, %._crit_edge51 ], [ 0, %.split48.us ]
  %39 = icmp sgt i32 %38, 0
  br i1 %39, label %.lr.ph50, label %.preheader42.._crit_edge51_crit_edge

.preheader42.._crit_edge51_crit_edge:             ; preds = %.preheader42
  %.pre = sext i32 %38 to i64
  br label %._crit_edge51

.lr.ph50:                                         ; preds = %.preheader42
  %40 = getelementptr inbounds [209 x i64], ptr @a, i64 0, i64 %indvars.iv76
  br label %43

._crit_edge51:                                    ; preds = %43, %.preheader42.._crit_edge51_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.preheader42.._crit_edge51_crit_edge ], [ %49, %43 ]
  %41 = phi i32 [ %38, %.preheader42.._crit_edge51_crit_edge ], [ %48, %43 ]
  %indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
  %42 = icmp slt i64 %indvars.iv.next77, %.pre-phi
  br i1 %42, label %.preheader42, label %.preheader44, !llvm.loop !11

43:                                               ; preds = %.lr.ph50, %43
  %indvars.iv73 = phi i64 [ 0, %.lr.ph50 ], [ %indvars.iv.next74, %43 ]
  %44 = load i64, ptr %40, align 8, !tbaa !13
  %45 = getelementptr inbounds [209 x i64], ptr getelementptr inbounds (i8, ptr @a, i64 1672), i64 0, i64 %indvars.iv73
  %46 = load i64, ptr %45, align 8, !tbaa !13
  %47 = add nsw i64 %46, %44
  tail call void @_Z3insx(i64 noundef %47)
  %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
  %48 = load i32, ptr @n, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = icmp slt i64 %indvars.iv.next74, %49
  br i1 %50, label %43, label %._crit_edge51, !llvm.loop !15

.preheader41:                                     ; preds = %.preheader44, %._crit_edge58
  %51 = phi i32 [ %72, %._crit_edge58 ], [ %41, %.preheader44 ]
  %indvars.iv85 = phi i64 [ %indvars.iv.next86, %._crit_edge58 ], [ 0, %.preheader44 ]
  %52 = icmp sgt i32 %51, 0
  br i1 %52, label %.preheader.preheader, label %._crit_edge58

.preheader.preheader:                             ; preds = %.preheader41
  %53 = getelementptr inbounds [209 x i64], ptr getelementptr inbounds (i8, ptr @a, i64 5016), i64 0, i64 %indvars.iv85
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge56
  %54 = phi i32 [ %51, %.preheader.preheader ], [ %69, %._crit_edge56 ]
  %55 = phi i32 [ %51, %.preheader.preheader ], [ %70, %._crit_edge56 ]
  %indvars.iv82 = phi i64 [ 0, %.preheader.preheader ], [ %indvars.iv.next83, %._crit_edge56 ]
  %.not3253 = icmp sgt i32 %55, 0
  br i1 %.not3253, label %.lr.ph55, label %.preheader.._crit_edge56_crit_edge

.preheader.._crit_edge56_crit_edge:               ; preds = %.preheader
  %.pre88 = sext i32 %55 to i64
  br label %._crit_edge56

.lr.ph55:                                         ; preds = %.preheader
  %56 = getelementptr inbounds [209 x i64], ptr getelementptr inbounds (i8, ptr @a, i64 6688), i64 0, i64 %indvars.iv82
  br label %60

57:                                               ; preds = %60
  %indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
  %58 = load i32, ptr @n, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %.not32 = icmp slt i64 %indvars.iv.next80, %59
  br i1 %.not32, label %60, label %._crit_edge56, !llvm.loop !16

60:                                               ; preds = %.lr.ph55, %57
  %indvars.iv79 = phi i64 [ 0, %.lr.ph55 ], [ %indvars.iv.next80, %57 ]
  %61 = load i64, ptr %53, align 8, !tbaa !13
  %62 = load i64, ptr %56, align 8, !tbaa !13
  %63 = add nsw i64 %61, %62
  %64 = getelementptr inbounds [209 x i64], ptr getelementptr inbounds (i8, ptr @a, i64 3344), i64 0, i64 %indvars.iv79
  %65 = load i64, ptr %64, align 8, !tbaa !13
  %66 = add nsw i64 %63, %65
  %67 = sub nsw i64 0, %66
  %68 = tail call noundef zeroext i1 @_Z4findx(i64 noundef %67)
  br i1 %68, label %._crit_edge60, label %57

._crit_edge56:                                    ; preds = %57, %.preheader.._crit_edge56_crit_edge
  %.pre-phi89 = phi i64 [ %.pre88, %.preheader.._crit_edge56_crit_edge ], [ %59, %57 ]
  %69 = phi i32 [ %54, %.preheader.._crit_edge56_crit_edge ], [ %58, %57 ]
  %70 = phi i32 [ %55, %.preheader.._crit_edge56_crit_edge ], [ %58, %57 ]
  %indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
  %71 = icmp slt i64 %indvars.iv.next83, %.pre-phi89
  br i1 %71, label %.preheader, label %._crit_edge58, !llvm.loop !17

._crit_edge58:                                    ; preds = %._crit_edge56, %.preheader41
  %72 = phi i32 [ %51, %.preheader41 ], [ %69, %._crit_edge56 ]
  %indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
  %73 = sext i32 %72 to i64
  %74 = icmp slt i64 %indvars.iv.next86, %73
  br i1 %74, label %.preheader41, label %._crit_edge60, !llvm.loop !18

._crit_edge60.sink.split:                         ; preds = %._crit_edge.3, %._crit_edge.2, %._crit_edge.1, %._crit_edge, %.lr.ph63
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4000006) @u, i8 0, i64 4000006, i1 false)
  br label %._crit_edge60

._crit_edge60:                                    ; preds = %._crit_edge58, %60, %.preheader44, %.split48.us, %._crit_edge60.sink.split
  %.str.2.sink = phi ptr [ @.str.3, %._crit_edge60.sink.split ], [ @.str.3, %.split48.us ], [ @.str.3, %.preheader44 ], [ @.str.2, %60 ], [ @.str.3, %._crit_edge58 ]
  %75 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
  %76 = load i32, ptr @T, align 4, !tbaa !5
  %77 = add nsw i32 %76, -1
  store i32 %77, ptr @T, align 4, !tbaa !5
  %.not = icmp eq i32 %76, 0
  br i1 %.not, label %._crit_edge64, label %.lr.ph63, !llvm.loop !19

._crit_edge64:                                    ; preds = %._crit_edge60, %0
  ret i32 0
}

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @puts(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 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 #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 nounwind willreturn memory(argmem: write) }

!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.unswitch.partial.disable"}
!13 = !{!14, !14, i64 0}
!14 = !{!"long long", !7, i64 0}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !12}
!18 = distinct !{!18, !10, !12}
!19 = distinct !{!19, !10}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass