; LLVM IR from tangjz/acm-icpc :: usaco/Training/Chapter 2 Bigger challenges (preface)

; 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
@cnt = external dso_local global [7 x i32], align 16
@.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 [3 x i8], align 1
@_ZL3num = external hidden constant [3 x [10 x [7 x i32]]], align 16
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1
@_ZL2ch = external hidden constant [7 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
  store i32 0, ptr %1, align 4
  %5 = load ptr, ptr @stdin, align 8, !tbaa !5
  %6 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.1, ptr noundef %5)
  %7 = load ptr, ptr @stdout, align 8, !tbaa !5
  %8 = call ptr @freopen(ptr noundef @.str.2, ptr noundef @.str.3, ptr noundef %7)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef @n)
  store i32 1, ptr %2, align 4, !tbaa !9
  br label %10

10:                                               ; preds = %105, %0
  %11 = load i32, ptr %2, align 4, !tbaa !9
  %12 = load i32, ptr @n, align 4, !tbaa !9
  %13 = icmp sle i32 %11, %12
  br i1 %13, label %14, label %108

14:                                               ; preds = %10
  %15 = load i32, ptr %2, align 4, !tbaa !9
  store i32 %15, ptr %3, align 4, !tbaa !9
  %16 = load i32, ptr %3, align 4, !tbaa !9
  %17 = icmp sge i32 %16, 1000
  br i1 %17, label %18, label %25

18:                                               ; preds = %14
  %19 = load i32, ptr %3, align 4, !tbaa !9
  %20 = sdiv i32 %19, 1000
  %21 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @cnt, i64 0, i64 6), align 8, !tbaa !9
  %22 = add nsw i32 %21, %20
  store i32 %22, ptr getelementptr inbounds ([7 x i32], ptr @cnt, i64 0, i64 6), align 8, !tbaa !9
  %23 = load i32, ptr %3, align 4, !tbaa !9
  %24 = srem i32 %23, 1000
  store i32 %24, ptr %3, align 4, !tbaa !9
  br label %25

25:                                               ; preds = %18, %14
  %26 = load i32, ptr %3, align 4, !tbaa !9
  %27 = icmp sge i32 %26, 100
  br i1 %27, label %28, label %54

28:                                               ; preds = %25
  %29 = load i32, ptr %3, align 4, !tbaa !9
  %30 = sdiv i32 %29, 100
  store i32 %30, ptr %4, align 4, !tbaa !9
  %31 = load i32, ptr %4, align 4, !tbaa !9
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [10 x [7 x i32]], ptr getelementptr inbounds ([3 x [10 x [7 x i32]]], ptr @_ZL3num, i64 0, i64 2), i64 0, i64 %32
  %34 = getelementptr inbounds [7 x i32], ptr %33, i64 0, i64 4
  %35 = load i32, ptr %34, align 4, !tbaa !9
  %36 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @cnt, i64 0, i64 4), align 16, !tbaa !9
  %37 = add nsw i32 %36, %35
  store i32 %37, ptr getelementptr inbounds ([7 x i32], ptr @cnt, i64 0, i64 4), align 16, !tbaa !9
  %38 = load i32, ptr %4, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [10 x [7 x i32]], ptr getelementptr inbounds ([3 x [10 x [7 x i32]]], ptr @_ZL3num, i64 0, i64 2), i64 0, i64 %39
  %41 = getelementptr inbounds [7 x i32], ptr %40, i64 0, i64 5
  %42 = load i32, ptr %41, align 4, !tbaa !9
  %43 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @cnt, i64 0, i64 5), align 4, !tbaa !9
  %44 = add nsw i32 %43, %42
  store i32 %44, ptr getelementptr inbounds ([7 x i32], ptr @cnt, i64 0, i64 5), align 4, !tbaa !9
  %45 = load i32, ptr %4, align 4, !tbaa !9
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [10 x [7 x i32]], ptr getelementptr inbounds ([3 x [10 x [7 x i32]]], ptr @_ZL3num, i64 0, i64 2), i64 0, i64 %46
  %48 = getelementptr inbounds [7 x i32], ptr %47, i64 0, i64 6
  %49 = load i32, ptr %48, align 4, !tbaa !9
  %50 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @cnt, i64 0, i64 6), align 8, !tbaa !9
  %51 = add nsw i32 %50, %49
  store i32 %51, ptr getelementptr inbounds ([7 x i32], ptr @cnt, i64 0, i64 6), align 8, !tbaa !9
  %52 = load i32, ptr %3, align 4, !tbaa !9
  %53 = srem i32 %52, 100
  store i32 %53, ptr %3, align 4, !tbaa !9
  br label %54

54:                                               ; preds = %28, %25
  %55 = load i32, ptr %3, align 4, !tbaa !9
  %56 = icmp sge i32 %55, 10
  br i1 %56, label %57, label %83

57:                                               ; preds = %54
  %58 = load i32, ptr %3, align 4, !tbaa !9
  %59 = sdiv i32 %58, 10
  store i32 %59, ptr %4, align 4, !tbaa !9
  %60 = load i32, ptr %4, align 4, !tbaa !9
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [10 x [7 x i32]], ptr getelementptr inbounds ([3 x [10 x [7 x i32]]], ptr @_ZL3num, i64 0, i64 1), i64 0, i64 %61
  %63 = getelementptr inbounds [7 x i32], ptr %62, i64 0, i64 2
  %64 = load i32, ptr %63, align 4, !tbaa !9
  %65 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @cnt, i64 0, i64 2), align 8, !tbaa !9
  %66 = add nsw i32 %65, %64
  store i32 %66, ptr getelementptr inbounds ([7 x i32], ptr @cnt, i64 0, i64 2), align 8, !tbaa !9
  %67 = load i32, ptr %4, align 4, !tbaa !9
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [10 x [7 x i32]], ptr getelementptr inbounds ([3 x [10 x [7 x i32]]], ptr @_ZL3num, i64 0, i64 1), i64 0, i64 %68
  %70 = getelementptr inbounds [7 x i32], ptr %69, i64 0, i64 3
  %71 = load i32, ptr %70, align 4, !tbaa !9
  %72 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @cnt, i64 0, i64 3), align 4, !tbaa !9
  %73 = add nsw i32 %72, %71
  store i32 %73, ptr getelementptr inbounds ([7 x i32], ptr @cnt, i64 0, i64 3), align 4, !tbaa !9
  %74 = load i32, ptr %4, align 4, !tbaa !9
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [10 x [7 x i32]], ptr getelementptr inbounds ([3 x [10 x [7 x i32]]], ptr @_ZL3num, i64 0, i64 1), i64 0, i64 %75
  %77 = getelementptr inbounds [7 x i32], ptr %76, i64 0, i64 4
  %78 = load i32, ptr %77, align 4, !tbaa !9
  %79 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @cnt, i64 0, i64 4), align 16, !tbaa !9
  %80 = add nsw i32 %79, %78
  store i32 %80, ptr getelementptr inbounds ([7 x i32], ptr @cnt, i64 0, i64 4), align 16, !tbaa !9
  %81 = load i32, ptr %3, align 4, !tbaa !9
  %82 = srem i32 %81, 10
  store i32 %82, ptr %3, align 4, !tbaa !9
  br label %83

83:                                               ; preds = %57, %54
  %84 = load i32, ptr %3, align 4, !tbaa !9
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [10 x [7 x i32]], ptr @_ZL3num, i64 0, i64 %85
  %87 = getelementptr inbounds [7 x i32], ptr %86, i64 0, i64 0
  %88 = load i32, ptr %87, align 4, !tbaa !9
  %89 = load i32, ptr @cnt, align 16, !tbaa !9
  %90 = add nsw i32 %89, %88
  store i32 %90, ptr @cnt, align 16, !tbaa !9
  %91 = load i32, ptr %3, align 4, !tbaa !9
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [10 x [7 x i32]], ptr @_ZL3num, i64 0, i64 %92
  %94 = getelementptr inbounds [7 x i32], ptr %93, i64 0, i64 1
  %95 = load i32, ptr %94, align 4, !tbaa !9
  %96 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @cnt, i64 0, i64 1), align 4, !tbaa !9
  %97 = add nsw i32 %96, %95
  store i32 %97, ptr getelementptr inbounds ([7 x i32], ptr @cnt, i64 0, i64 1), align 4, !tbaa !9
  %98 = load i32, ptr %3, align 4, !tbaa !9
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [10 x [7 x i32]], ptr @_ZL3num, i64 0, i64 %99
  %101 = getelementptr inbounds [7 x i32], ptr %100, i64 0, i64 2
  %102 = load i32, ptr %101, align 4, !tbaa !9
  %103 = load i32, ptr getelementptr inbounds ([7 x i32], ptr @cnt, i64 0, i64 2), align 8, !tbaa !9
  %104 = add nsw i32 %103, %102
  store i32 %104, ptr getelementptr inbounds ([7 x i32], ptr @cnt, i64 0, i64 2), align 8, !tbaa !9
  br label %105

105:                                              ; preds = %83
  %106 = load i32, ptr %2, align 4, !tbaa !9
  %107 = add nsw i32 %106, 1
  store i32 %107, ptr %2, align 4, !tbaa !9
  br label %10, !llvm.loop !11

108:                                              ; preds = %10
  store i32 0, ptr %2, align 4, !tbaa !9
  br label %109

109:                                              ; preds = %130, %108
  %110 = load i32, ptr %2, align 4, !tbaa !9
  %111 = icmp slt i32 %110, 7
  br i1 %111, label %112, label %133

112:                                              ; preds = %109
  %113 = load i32, ptr %2, align 4, !tbaa !9
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [7 x i32], ptr @cnt, i64 0, i64 %114
  %116 = load i32, ptr %115, align 4, !tbaa !9
  %117 = icmp ne i32 %116, 0
  br i1 %117, label %118, label %129

118:                                              ; preds = %112
  %119 = load i32, ptr %2, align 4, !tbaa !9
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [7 x i8], ptr @_ZL2ch, i64 0, i64 %120
  %122 = load i8, ptr %121, align 1, !tbaa !13
  %123 = sext i8 %122 to i32
  %124 = load i32, ptr %2, align 4, !tbaa !9
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [7 x i32], ptr @cnt, i64 0, i64 %125
  %127 = load i32, ptr %126, align 4, !tbaa !9
  %128 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %123, i32 noundef %127)
  br label %129

129:                                              ; preds = %118, %112
  br label %130

130:                                              ; preds = %129
  %131 = load i32, ptr %2, align 4, !tbaa !9
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %2, align 4, !tbaa !9
  br label %109, !llvm.loop !14

133:                                              ; preds = %109
  %134 = load ptr, ptr @stdin, align 8, !tbaa !5
  %135 = call i32 @fclose(ptr noundef %134)
  %136 = load ptr, ptr @stdout, align 8, !tbaa !5
  %137 = call i32 @fclose(ptr noundef %136)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #3
  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

declare i32 @printf(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 = { 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !12}


; 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
@cnt = external dso_local local_unnamed_addr global [7 x i32], align 16
@.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 [3 x i8], align 1
@_ZL3num = external hidden local_unnamed_addr constant [3 x [10 x [7 x i32]]], align 16
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1
@_ZL2ch = external hidden local_unnamed_addr constant [7 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)
  %6 = load i32, ptr @n, align 4, !tbaa !9
  %cnt.promoted = load i32, ptr @cnt, align 16, !tbaa !9
  %.promoted40 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 4), align 4, !tbaa !9
  %.not41 = icmp slt i32 %6, 1
  br i1 %.not41, label %.preheader, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %0
  %.promoted39 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 12), align 4, !tbaa !9
  %.promoted38 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 8), align 8, !tbaa !9
  %.promoted37 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 20), align 4, !tbaa !9
  %.promoted36 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 16), align 16, !tbaa !9
  %.promoted = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 24), align 8, !tbaa !9
  br label %.lr.ph

..preheader_crit_edge:                            ; preds = %57
  store i32 %70, ptr getelementptr inbounds (i8, ptr @cnt, i64 8), align 8, !tbaa !9
  store i32 %64, ptr @cnt, align 16, !tbaa !9
  store i32 %67, ptr getelementptr inbounds (i8, ptr @cnt, i64 4), align 4, !tbaa !9
  br label %.preheader

.preheader:                                       ; preds = %..preheader_crit_edge, %0
  %7 = phi i32 [ %67, %..preheader_crit_edge ], [ %.promoted40, %0 ]
  %8 = phi i32 [ %64, %..preheader_crit_edge ], [ %cnt.promoted, %0 ]
  %.not29 = icmp eq i32 %8, 0
  br i1 %.not29, label %76, label %72

.lr.ph:                                           ; preds = %.lr.ph.preheader, %57
  %.02642 = phi i32 [ %71, %57 ], [ 1, %.lr.ph.preheader ]
  %9 = phi i32 [ %41, %57 ], [ %.promoted, %.lr.ph.preheader ]
  %10 = phi i32 [ %60, %57 ], [ %.promoted36, %.lr.ph.preheader ]
  %11 = phi i32 [ %39, %57 ], [ %.promoted37, %.lr.ph.preheader ]
  %12 = phi i32 [ %70, %57 ], [ %.promoted38, %.lr.ph.preheader ]
  %13 = phi i32 [ %58, %57 ], [ %.promoted39, %.lr.ph.preheader ]
  %14 = phi i32 [ %64, %57 ], [ %cnt.promoted, %.lr.ph.preheader ]
  %15 = phi i32 [ %67, %57 ], [ %.promoted40, %.lr.ph.preheader ]
  %16 = icmp ugt i32 %.02642, 999
  br i1 %16, label %17, label %21

17:                                               ; preds = %.lr.ph
  %18 = udiv i32 %.02642, 1000
  %19 = add nsw i32 %9, %18
  store i32 %19, ptr getelementptr inbounds (i8, ptr @cnt, i64 24), align 8, !tbaa !9
  %20 = urem i32 %.02642, 1000
  br label %21

21:                                               ; preds = %17, %.lr.ph
  %22 = phi i32 [ %19, %17 ], [ %9, %.lr.ph ]
  %.0 = phi i32 [ %20, %17 ], [ %.02642, %.lr.ph ]
  %23 = icmp ugt i32 %.0, 99
  br i1 %23, label %24, label %38

24:                                               ; preds = %21
  %.lhs.trunc = trunc nuw i32 %.0 to i16
  %25 = udiv i16 %.lhs.trunc, 100
  %26 = zext nneg i16 %25 to i64
  %27 = getelementptr inbounds [10 x [7 x i32]], ptr getelementptr inbounds (i8, ptr @_ZL3num, i64 560), i64 0, i64 %26
  %28 = getelementptr inbounds i8, ptr %27, i64 16
  %29 = load i32, ptr %28, align 4, !tbaa !9
  %30 = add nsw i32 %10, %29
  store i32 %30, ptr getelementptr inbounds (i8, ptr @cnt, i64 16), align 16, !tbaa !9
  %31 = getelementptr inbounds i8, ptr %27, i64 20
  %32 = load i32, ptr %31, align 4, !tbaa !9
  %33 = add nsw i32 %11, %32
  store i32 %33, ptr getelementptr inbounds (i8, ptr @cnt, i64 20), align 4, !tbaa !9
  %34 = getelementptr inbounds i8, ptr %27, i64 24
  %35 = load i32, ptr %34, align 4, !tbaa !9
  %36 = add nsw i32 %22, %35
  store i32 %36, ptr getelementptr inbounds (i8, ptr @cnt, i64 24), align 8, !tbaa !9
  %37 = urem i16 %.lhs.trunc, 100
  %.zext31 = zext nneg i16 %37 to i32
  br label %38

38:                                               ; preds = %24, %21
  %39 = phi i32 [ %33, %24 ], [ %11, %21 ]
  %40 = phi i32 [ %30, %24 ], [ %10, %21 ]
  %41 = phi i32 [ %36, %24 ], [ %22, %21 ]
  %.1 = phi i32 [ %.zext31, %24 ], [ %.0, %21 ]
  %42 = icmp ugt i32 %.1, 9
  br i1 %42, label %43, label %57

43:                                               ; preds = %38
  %.lhs.trunc32 = trunc i32 %.1 to i8
  %44 = udiv i8 %.lhs.trunc32, 10
  %45 = zext nneg i8 %44 to i64
  %46 = getelementptr inbounds [10 x [7 x i32]], ptr getelementptr inbounds (i8, ptr @_ZL3num, i64 280), i64 0, i64 %45
  %47 = getelementptr inbounds i8, ptr %46, i64 8
  %48 = load i32, ptr %47, align 4, !tbaa !9
  %49 = add nsw i32 %12, %48
  %50 = getelementptr inbounds i8, ptr %46, i64 12
  %51 = load i32, ptr %50, align 4, !tbaa !9
  %52 = add nsw i32 %13, %51
  store i32 %52, ptr getelementptr inbounds (i8, ptr @cnt, i64 12), align 4, !tbaa !9
  %53 = getelementptr inbounds i8, ptr %46, i64 16
  %54 = load i32, ptr %53, align 4, !tbaa !9
  %55 = add nsw i32 %40, %54
  store i32 %55, ptr getelementptr inbounds (i8, ptr @cnt, i64 16), align 16, !tbaa !9
  %56 = urem i8 %.lhs.trunc32, 10
  %.zext35 = zext nneg i8 %56 to i32
  br label %57

57:                                               ; preds = %43, %38
  %58 = phi i32 [ %52, %43 ], [ %13, %38 ]
  %59 = phi i32 [ %49, %43 ], [ %12, %38 ]
  %60 = phi i32 [ %55, %43 ], [ %40, %38 ]
  %.2 = phi i32 [ %.zext35, %43 ], [ %.1, %38 ]
  %61 = zext nneg i32 %.2 to i64
  %62 = getelementptr inbounds [10 x [7 x i32]], ptr @_ZL3num, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !9
  %64 = add nsw i32 %14, %63
  %65 = getelementptr inbounds i8, ptr %62, i64 4
  %66 = load i32, ptr %65, align 4, !tbaa !9
  %67 = add nsw i32 %15, %66
  %68 = getelementptr inbounds i8, ptr %62, i64 8
  %69 = load i32, ptr %68, align 4, !tbaa !9
  %70 = add nsw i32 %59, %69
  %71 = add nuw i32 %.02642, 1
  %exitcond.not = icmp eq i32 %.02642, %6
  br i1 %exitcond.not, label %..preheader_crit_edge, label %.lr.ph, !llvm.loop !11

72:                                               ; preds = %.preheader
  %73 = load i8, ptr @_ZL2ch, align 1, !tbaa !13
  %74 = sext i8 %73 to i32
  %75 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %74, i32 noundef %8)
  %.pre = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 4), align 4, !tbaa !9
  br label %76

76:                                               ; preds = %.preheader, %72
  %77 = phi i32 [ %7, %.preheader ], [ %.pre, %72 ]
  %.not29.1 = icmp eq i32 %77, 0
  br i1 %.not29.1, label %82, label %78

78:                                               ; preds = %76
  %79 = load i8, ptr getelementptr inbounds (i8, ptr @_ZL2ch, i64 1), align 1, !tbaa !13
  %80 = sext i8 %79 to i32
  %81 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %80, i32 noundef %77)
  br label %82

82:                                               ; preds = %78, %76
  %83 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 8), align 8, !tbaa !9
  %.not29.2 = icmp eq i32 %83, 0
  br i1 %.not29.2, label %88, label %84

84:                                               ; preds = %82
  %85 = load i8, ptr getelementptr inbounds (i8, ptr @_ZL2ch, i64 2), align 1, !tbaa !13
  %86 = sext i8 %85 to i32
  %87 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %86, i32 noundef %83)
  br label %88

88:                                               ; preds = %84, %82
  %89 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 12), align 4, !tbaa !9
  %.not29.3 = icmp eq i32 %89, 0
  br i1 %.not29.3, label %94, label %90

90:                                               ; preds = %88
  %91 = load i8, ptr getelementptr inbounds (i8, ptr @_ZL2ch, i64 3), align 1, !tbaa !13
  %92 = sext i8 %91 to i32
  %93 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %92, i32 noundef %89)
  br label %94

94:                                               ; preds = %90, %88
  %95 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 16), align 16, !tbaa !9
  %.not29.4 = icmp eq i32 %95, 0
  br i1 %.not29.4, label %100, label %96

96:                                               ; preds = %94
  %97 = load i8, ptr getelementptr inbounds (i8, ptr @_ZL2ch, i64 4), align 1, !tbaa !13
  %98 = sext i8 %97 to i32
  %99 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %98, i32 noundef %95)
  br label %100

100:                                              ; preds = %96, %94
  %101 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 20), align 4, !tbaa !9
  %.not29.5 = icmp eq i32 %101, 0
  br i1 %.not29.5, label %106, label %102

102:                                              ; preds = %100
  %103 = load i8, ptr getelementptr inbounds (i8, ptr @_ZL2ch, i64 5), align 1, !tbaa !13
  %104 = sext i8 %103 to i32
  %105 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %104, i32 noundef %101)
  br label %106

106:                                              ; preds = %102, %100
  %107 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 24), align 8, !tbaa !9
  %.not29.6 = icmp eq i32 %107, 0
  br i1 %.not29.6, label %112, label %108

108:                                              ; preds = %106
  %109 = load i8, ptr getelementptr inbounds (i8, ptr @_ZL2ch, i64 6), align 1, !tbaa !13
  %110 = sext i8 %109 to i32
  %111 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %110, i32 noundef %107)
  br label %112

112:                                              ; preds = %108, %106
  %113 = load ptr, ptr @stdin, align 8, !tbaa !5
  %114 = tail call i32 @fclose(ptr noundef %113)
  %115 = load ptr, ptr @stdout, align 8, !tbaa !5
  %116 = tail call i32 @fclose(ptr noundef %115)
  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: nofree nounwind
declare noundef i32 @printf(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" }

!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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!7, !7, i64 0}


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