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

; 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
@typ = external dso_local global [5001 x i32], align 16
@f = external dso_local global [5001 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 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
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  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
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %2, ptr noundef %3)
  br label %18

18:                                               ; preds = %22, %0
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = add nsw i32 %19, -1
  store i32 %20, ptr %2, align 4, !tbaa !5
  %21 = icmp ne i32 %19, 0
  br i1 %21, label %22, label %35

22:                                               ; preds = %18
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %4)
  %24 = load i32, ptr %4, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [5001 x i32], ptr @typ, i64 0, i64 %25
  %27 = load i32, ptr %26, align 4, !tbaa !5
  %28 = or i32 %27, 2
  store i32 %28, ptr %26, align 4, !tbaa !5
  %29 = load i32, ptr %4, align 4, !tbaa !5
  %30 = add nsw i32 %29, 1
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [5001 x i32], ptr @typ, i64 0, i64 %31
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = or i32 %33, 1
  store i32 %34, ptr %32, align 4, !tbaa !5
  br label %18, !llvm.loop !9

35:                                               ; preds = %18
  br label %36

36:                                               ; preds = %40, %35
  %37 = load i32, ptr %3, align 4, !tbaa !5
  %38 = add nsw i32 %37, -1
  store i32 %38, ptr %3, align 4, !tbaa !5
  %39 = icmp ne i32 %37, 0
  br i1 %39, label %40, label %53

40:                                               ; preds = %36
  %41 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %4)
  %42 = load i32, ptr %4, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [5001 x i32], ptr @typ, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = or i32 %45, 1
  store i32 %46, ptr %44, align 4, !tbaa !5
  %47 = load i32, ptr %4, align 4, !tbaa !5
  %48 = add nsw i32 %47, 1
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [5001 x i32], ptr @typ, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = or i32 %51, 2
  store i32 %52, ptr %50, align 4, !tbaa !5
  br label %36, !llvm.loop !11

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

54:                                               ; preds = %68, %53
  %55 = load i32, ptr %5, align 4, !tbaa !5
  %56 = load i32, ptr @n, align 4, !tbaa !5
  %57 = icmp slt i32 %55, %56
  br i1 %57, label %59, label %58

58:                                               ; preds = %54
  store i32 6, ptr %6, align 4
  br label %71

59:                                               ; preds = %54
  %60 = load i32, ptr %5, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [5001 x i32], ptr @typ, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = icmp eq i32 %63, 3
  br i1 %64, label %65, label %67

65:                                               ; preds = %59
  %66 = call i32 @puts(ptr noundef @.str.2)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  br label %71

67:                                               ; preds = %59
  br label %68

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

71:                                               ; preds = %65, %58
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  %72 = load i32, ptr %6, align 4
  switch i32 %72, label %74 [
    i32 6, label %73
  ]

73:                                               ; preds = %71
  store i32 0, ptr %6, align 4
  br label %74

74:                                               ; preds = %73, %71
  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
  %75 = load i32, ptr %6, align 4
  switch i32 %75, label %186 [
    i32 0, label %76
    i32 1, label %184
  ]

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

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

81:                                               ; preds = %77
  store i32 9, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %167

82:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !5
  %83 = load i32, ptr %7, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [5001 x i32], ptr @typ, i64 0, i64 %84
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = icmp eq i32 %86, 1
  br i1 %87, label %88, label %108

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

89:                                               ; preds = %103, %88
  %90 = load i32, ptr %9, align 4, !tbaa !5
  %91 = load i32, ptr %7, align 4, !tbaa !5
  %92 = icmp sle i32 %90, %91
  br i1 %92, label %94, label %93

93:                                               ; preds = %89
  store i32 12, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %107

94:                                               ; preds = %89
  %95 = load i32, ptr %9, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [5001 x i32], ptr @f, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %8, i32 noundef %98)
  %99 = load i32, ptr %10, align 4, !tbaa !5
  %100 = load i32, ptr %9, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [5001 x i32], ptr @f, i64 0, i64 %101
  store i32 %99, ptr %102, align 4, !tbaa !5
  br label %103

103:                                              ; preds = %94
  %104 = load i32, ptr %9, align 4, !tbaa !5
  %105 = add nsw i32 %104, 1
  store i32 %105, ptr %9, align 4, !tbaa !5
  %106 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %106, ptr %10, align 4, !tbaa !5
  br label %89, !llvm.loop !13

107:                                              ; preds = %93
  br label %163

108:                                              ; preds = %82
  %109 = load i32, ptr %7, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [5001 x i32], ptr @typ, i64 0, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !5
  %113 = icmp eq i32 %112, 2
  br i1 %113, label %114, label %133

114:                                              ; preds = %108
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %115 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %115, ptr %11, align 4, !tbaa !5
  br label %116

116:                                              ; preds = %129, %114
  %117 = load i32, ptr %11, align 4, !tbaa !5
  %118 = icmp sge i32 %117, 0
  br i1 %118, label %120, label %119

119:                                              ; preds = %116
  store i32 15, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %132

120:                                              ; preds = %116
  %121 = load i32, ptr %11, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [5001 x i32], ptr @f, i64 0, i64 %122
  %124 = load i32, ptr %123, align 4, !tbaa !5
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %8, i32 noundef %124)
  %125 = load i32, ptr %8, align 4, !tbaa !5
  %126 = load i32, ptr %11, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [5001 x i32], ptr @f, i64 0, i64 %127
  store i32 %125, ptr %128, align 4, !tbaa !5
  br label %129

129:                                              ; preds = %120
  %130 = load i32, ptr %11, align 4, !tbaa !5
  %131 = add nsw i32 %130, -1
  store i32 %131, ptr %11, align 4, !tbaa !5
  br label %116, !llvm.loop !14

132:                                              ; preds = %119
  br label %162

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

134:                                              ; preds = %144, %133
  %135 = load i32, ptr %12, align 4, !tbaa !5
  %136 = load i32, ptr %7, align 4, !tbaa !5
  %137 = icmp slt i32 %135, %136
  br i1 %137, label %139, label %138

138:                                              ; preds = %134
  store i32 18, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %147

139:                                              ; preds = %134
  %140 = load i32, ptr %12, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [5001 x i32], ptr @f, i64 0, i64 %141
  %143 = load i32, ptr %142, align 4, !tbaa !5
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %8, i32 noundef %143)
  br label %144

144:                                              ; preds = %139
  %145 = load i32, ptr %12, align 4, !tbaa !5
  %146 = add nsw i32 %145, 1
  store i32 %146, ptr %12, align 4, !tbaa !5
  br label %134, !llvm.loop !15

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

148:                                              ; preds = %158, %147
  %149 = load i32, ptr %13, align 4, !tbaa !5
  %150 = load i32, ptr %7, align 4, !tbaa !5
  %151 = icmp sle i32 %149, %150
  br i1 %151, label %153, label %152

152:                                              ; preds = %148
  store i32 21, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %161

153:                                              ; preds = %148
  %154 = load i32, ptr %8, align 4, !tbaa !5
  %155 = load i32, ptr %13, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [5001 x i32], ptr @f, i64 0, i64 %156
  store i32 %154, ptr %157, align 4, !tbaa !5
  br label %158

158:                                              ; preds = %153
  %159 = load i32, ptr %13, align 4, !tbaa !5
  %160 = add nsw i32 %159, 1
  store i32 %160, ptr %13, align 4, !tbaa !5
  br label %148, !llvm.loop !16

161:                                              ; preds = %152
  br label %162

162:                                              ; preds = %161, %132
  br label %163

163:                                              ; preds = %162, %107
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %164

164:                                              ; preds = %163
  %165 = load i32, ptr %7, align 4, !tbaa !5
  %166 = add nsw i32 %165, 1
  store i32 %166, ptr %7, align 4, !tbaa !5
  br label %77, !llvm.loop !17

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

168:                                              ; preds = %178, %167
  %169 = load i32, ptr %15, align 4, !tbaa !5
  %170 = load i32, ptr @n, align 4, !tbaa !5
  %171 = icmp slt i32 %169, %170
  br i1 %171, label %173, label %172

172:                                              ; preds = %168
  store i32 24, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %181

173:                                              ; preds = %168
  %174 = load i32, ptr %15, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [5001 x i32], ptr @f, i64 0, i64 %175
  %177 = load i32, ptr %176, align 4, !tbaa !5
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %14, i32 noundef %177)
  br label %178

178:                                              ; preds = %173
  %179 = load i32, ptr %15, align 4, !tbaa !5
  %180 = add nsw i32 %179, 1
  store i32 %180, ptr %15, align 4, !tbaa !5
  br label %168, !llvm.loop !18

181:                                              ; preds = %172
  %182 = load i32, ptr %14, align 4, !tbaa !5
  %183 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %182)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  br label %184

184:                                              ; preds = %181, %74
  %185 = load i32, ptr %1, align 4
  ret i32 %185

186:                                              ; preds = %74
  unreachable
}

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

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

declare i32 @puts(ptr noundef) #1

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) #3

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

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

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

@n = external dso_local global i32, align 4
@typ = external dso_local local_unnamed_addr global [5001 x i32], align 16
@f = external dso_local local_unnamed_addr global [5001 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %8 = load i32, ptr %1, align 4, !tbaa !5
  %9 = add nsw i32 %8, -1
  store i32 %9, ptr %1, align 4, !tbaa !5
  %.not54 = icmp eq i32 %8, 0
  br i1 %.not54, label %.preheader53, label %.lr.ph

.preheader53:                                     ; preds = %.lr.ph, %0
  %10 = load i32, ptr %2, align 4, !tbaa !5
  %11 = add nsw i32 %10, -1
  store i32 %11, ptr %2, align 4, !tbaa !5
  %.not4255 = icmp eq i32 %10, 0
  br i1 %.not4255, label %.preheader52, label %.lr.ph56

.lr.ph:                                           ; preds = %0, %.lr.ph
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %3)
  %13 = load i32, ptr %3, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds [5001 x i32], ptr @typ, i64 0, i64 %14
  %16 = load <2 x i32>, ptr %15, align 4, !tbaa !5
  %17 = or <2 x i32> %16, <i32 2, i32 1>
  store <2 x i32> %17, ptr %15, align 4, !tbaa !5
  %18 = load i32, ptr %1, align 4, !tbaa !5
  %19 = add nsw i32 %18, -1
  store i32 %19, ptr %1, align 4, !tbaa !5
  %.not = icmp eq i32 %18, 0
  br i1 %.not, label %.preheader53, label %.lr.ph, !llvm.loop !9

.preheader52:                                     ; preds = %.lr.ph56, %.preheader53
  %20 = load i32, ptr @n, align 4, !tbaa !5
  %.not4357 = icmp sgt i32 %20, 1
  br i1 %.not4357, label %.lr.ph59.preheader, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %.preheader52
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  store i32 1, ptr @f, align 16, !tbaa !5
  br label %._crit_edge70

.lr.ph59.preheader:                               ; preds = %.preheader52
  %wide.trip.count = zext nneg i32 %20 to i64
  br label %.lr.ph59

.lr.ph56:                                         ; preds = %.preheader53, %.lr.ph56
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %3)
  %22 = load i32, ptr %3, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [5001 x i32], ptr @typ, i64 0, i64 %23
  %25 = load <2 x i32>, ptr %24, align 4, !tbaa !5
  %26 = or <2 x i32> %25, <i32 1, i32 2>
  store <2 x i32> %26, ptr %24, align 4, !tbaa !5
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = add nsw i32 %27, -1
  store i32 %28, ptr %2, align 4, !tbaa !5
  %.not42 = icmp eq i32 %27, 0
  br i1 %.not42, label %.preheader52, label %.lr.ph56, !llvm.loop !11

29:                                               ; preds = %.lr.ph59
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph59, !llvm.loop !12

.lr.ph59:                                         ; preds = %.lr.ph59.preheader, %29
  %indvars.iv = phi i64 [ 1, %.lr.ph59.preheader ], [ %indvars.iv.next, %29 ]
  %30 = getelementptr inbounds [5001 x i32], ptr @typ, i64 0, i64 %indvars.iv
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = icmp eq i32 %31, 3
  br i1 %32, label %33, label %29

33:                                               ; preds = %.lr.ph59
  %34 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  br label %63

._crit_edge:                                      ; preds = %29
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  store i32 1, ptr @f, align 16, !tbaa !5
  br i1 %.not4357, label %.lr.ph69, label %._crit_edge70

._crit_edge70:                                    ; preds = %.loopexit, %._crit_edge.thread, %._crit_edge
  %35 = phi i32 [ %20, %._crit_edge ], [ %20, %._crit_edge.thread ], [ %53, %.loopexit ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #4
  store i32 0, ptr %5, align 4, !tbaa !5
  %36 = icmp sgt i32 %35, 0
  br i1 %36, label %.lr.ph73, label %._crit_edge74

.lr.ph69:                                         ; preds = %._crit_edge, %.loopexit
  %indvars.iv100 = phi i64 [ %indvars.iv.next101, %.loopexit ], [ 2, %._crit_edge ]
  %indvars.iv78 = phi i64 [ %indvars.iv.next79, %.loopexit ], [ 1, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  store i32 0, ptr %4, align 4, !tbaa !5
  %37 = getelementptr inbounds [5001 x i32], ptr @typ, i64 0, i64 %indvars.iv78
  %38 = load i32, ptr %37, align 4, !tbaa !5
  switch i32 %38, label %.preheader47 [
    i32 1, label %.preheader48
    i32 2, label %.lr.ph61
  ]

.preheader48:                                     ; preds = %.lr.ph69, %.preheader48
  %indvars.iv83 = phi i64 [ %indvars.iv.next84, %.preheader48 ], [ 0, %.lr.ph69 ]
  %.03563 = phi i32 [ %41, %.preheader48 ], [ 0, %.lr.ph69 ]
  %39 = getelementptr inbounds [5001 x i32], ptr @f, i64 0, i64 %indvars.iv83
  %40 = load i32, ptr %39, align 4, !tbaa !5
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %4, i32 noundef %40)
  store i32 %.03563, ptr %39, align 4, !tbaa !5
  %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
  %41 = load i32, ptr %4, align 4, !tbaa !5
  %exitcond89.not = icmp eq i64 %indvars.iv.next84, %indvars.iv100
  br i1 %exitcond89.not, label %.loopexit, label %.preheader48, !llvm.loop !13

.lr.ph61:                                         ; preds = %.lr.ph69, %.lr.ph61
  %indvars.iv80 = phi i64 [ %indvars.iv.next81, %.lr.ph61 ], [ %indvars.iv78, %.lr.ph69 ]
  %42 = getelementptr inbounds [5001 x i32], ptr @f, i64 0, i64 %indvars.iv80
  %43 = load i32, ptr %42, align 4, !tbaa !5
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %4, i32 noundef %43)
  %44 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %44, ptr %42, align 4, !tbaa !5
  %indvars.iv.next81 = add nsw i64 %indvars.iv80, -1
  %45 = icmp sgt i64 %indvars.iv80, 0
  br i1 %45, label %.lr.ph61, label %.loopexit, !llvm.loop !14

.preheader:                                       ; preds = %.preheader47
  %46 = load i32, ptr %4, align 4, !tbaa !5
  %min.iters.check = icmp ult i64 %indvars.iv100, 8
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %.preheader
  %indvars.iv95.ph = phi i64 [ 0, %.preheader ], [ %n.vec, %middle.block ]
  br label %scalar.ph

vector.ph:                                        ; preds = %.preheader
  %n.vec = and i64 %indvars.iv100, 9223372036854775800
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %46, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %47 = getelementptr inbounds [5001 x i32], ptr @f, i64 0, i64 %index
  %48 = getelementptr inbounds i8, ptr %47, i64 16
  store <4 x i32> %broadcast.splat, ptr %47, align 16, !tbaa !5
  store <4 x i32> %broadcast.splat, ptr %48, align 16, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %49 = icmp eq i64 %index.next, %n.vec
  br i1 %49, label %middle.block, label %vector.body, !llvm.loop !15

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %indvars.iv100, %n.vec
  br i1 %cmp.n, label %.loopexit, label %scalar.ph.preheader

.preheader47:                                     ; preds = %.lr.ph69, %.preheader47
  %indvars.iv90 = phi i64 [ %indvars.iv.next91, %.preheader47 ], [ 0, %.lr.ph69 ]
  %50 = getelementptr inbounds [5001 x i32], ptr @f, i64 0, i64 %indvars.iv90
  %51 = load i32, ptr %50, align 4, !tbaa !5
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %4, i32 noundef %51)
  %indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
  %exitcond94.not = icmp eq i64 %indvars.iv.next91, %indvars.iv78
  br i1 %exitcond94.not, label %.preheader, label %.preheader47, !llvm.loop !18

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv95 = phi i64 [ %indvars.iv.next96, %scalar.ph ], [ %indvars.iv95.ph, %scalar.ph.preheader ]
  %52 = getelementptr inbounds [5001 x i32], ptr @f, i64 0, i64 %indvars.iv95
  store i32 %46, ptr %52, align 4, !tbaa !5
  %indvars.iv.next96 = add nuw nsw i64 %indvars.iv95, 1
  %exitcond99.not = icmp eq i64 %indvars.iv.next96, %indvars.iv100
  br i1 %exitcond99.not, label %.loopexit, label %scalar.ph, !llvm.loop !19

.loopexit:                                        ; preds = %.lr.ph61, %.preheader48, %scalar.ph, %middle.block
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
  %53 = load i32, ptr @n, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = icmp slt i64 %indvars.iv.next79, %54
  %indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
  br i1 %55, label %.lr.ph69, label %._crit_edge70, !llvm.loop !20

._crit_edge74.loopexit:                           ; preds = %.lr.ph73
  %.pre = load i32, ptr %5, align 4, !tbaa !5
  br label %._crit_edge74

._crit_edge74:                                    ; preds = %._crit_edge74.loopexit, %._crit_edge70
  %56 = phi i32 [ %.pre, %._crit_edge74.loopexit ], [ 0, %._crit_edge70 ]
  %57 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %56)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #4
  br label %63

.lr.ph73:                                         ; preds = %._crit_edge70, %.lr.ph73
  %indvars.iv105 = phi i64 [ %indvars.iv.next106, %.lr.ph73 ], [ 0, %._crit_edge70 ]
  %58 = getelementptr inbounds [5001 x i32], ptr @f, i64 0, i64 %indvars.iv105
  %59 = load i32, ptr %58, align 4, !tbaa !5
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %5, i32 noundef %59)
  %indvars.iv.next106 = add nuw nsw i64 %indvars.iv105, 1
  %60 = load i32, ptr @n, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = icmp slt i64 %indvars.iv.next106, %61
  br i1 %62, label %.lr.ph73, label %._crit_edge74.loopexit, !llvm.loop !21

63:                                               ; preds = %33, %._crit_edge74
  ret i32 0
}

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) local_unnamed_addr #3

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

attributes #0 = { 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 #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

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

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,SCCPPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass