; LLVM IR from tangjz/acm-icpc :: hdu (6140)

; 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
@m = external dso_local global i32, align 4
@a = external dso_local global [1001 x i32], align 16
@mx = external dso_local global i32, align 4
@low = external dso_local global i32, align 4
@upp = external dso_local global i32, align 4
@vis = external dso_local global [2003 x i8], 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 [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 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 [3 x i8], align 1
  %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 = %218, %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 %223

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

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

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

22:                                               ; preds = %17
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds i32, ptr @a, i64 %24
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %25)
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %28
  %30 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @mx, ptr noundef nonnull align 4 dereferenceable(4) %29)
  %31 = load i32, ptr %30, align 4, !tbaa !5
  store i32 %31, ptr @mx, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %22
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %2, align 4, !tbaa !5
  br label %17, !llvm.loop !9

35:                                               ; preds = %21
  store i32 0, ptr @upp, align 4, !tbaa !5
  store i32 0, ptr @low, align 4, !tbaa !5
  %36 = load i32, ptr @mx, align 4, !tbaa !5
  %37 = shl i32 %36, 1
  %38 = or i32 %37, 1
  %39 = sext i32 %38 to i64
  %40 = mul i64 %39, 1
  call void @llvm.memset.p0.i64(ptr align 16 @vis, i8 0, i64 %40, i1 false)
  %41 = load i32, ptr @mx, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [2003 x i8], ptr @vis, i64 0, i64 %42
  store i8 1, ptr %43, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %188, %35
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = load i32, ptr @n, align 4, !tbaa !5
  %47 = icmp sle i32 %45, %46
  br i1 %47, label %49, label %48

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

49:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 3, ptr %5) #5
  %50 = getelementptr inbounds [3 x i8], ptr %5, i64 0, i64 0
  %51 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %50)
  %52 = getelementptr inbounds [3 x i8], ptr %5, i64 0, i64 0
  %53 = load i8, ptr %52, align 1, !tbaa !13
  %54 = sext i8 %53 to i32
  %55 = icmp ne i32 %54, 68
  br i1 %55, label %56, label %118

56:                                               ; preds = %49
  %57 = load i32, ptr @upp, align 4, !tbaa !5
  %58 = load i32, ptr @mx, align 4, !tbaa !5
  %59 = icmp sgt i32 %57, %58
  br i1 %59, label %60, label %67

60:                                               ; preds = %56
  %61 = load i32, ptr %3, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = load i32, ptr @upp, align 4, !tbaa !5
  %66 = add nsw i32 %65, %64
  store i32 %66, ptr @upp, align 4, !tbaa !5
  br label %67

67:                                               ; preds = %60, %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %68 = load i32, ptr @mx, align 4, !tbaa !5
  store i32 %68, ptr %6, align 4, !tbaa !5
  br label %69

69:                                               ; preds = %114, %67
  %70 = load i32, ptr %6, align 4, !tbaa !5
  %71 = load i32, ptr @mx, align 4, !tbaa !5
  %72 = sub nsw i32 0, %71
  %73 = icmp sge i32 %70, %72
  br i1 %73, label %75, label %74

74:                                               ; preds = %69
  store i32 10, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %117

75:                                               ; preds = %69
  %76 = load i32, ptr @mx, align 4, !tbaa !5
  %77 = load i32, ptr %6, align 4, !tbaa !5
  %78 = add nsw i32 %76, %77
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [2003 x i8], ptr @vis, i64 0, i64 %79
  %81 = load i8, ptr %80, align 1, !tbaa !11, !range !14, !noundef !15
  %82 = trunc i8 %81 to i1
  br i1 %82, label %83, label %113

83:                                               ; preds = %75
  %84 = load i32, ptr %6, align 4, !tbaa !5
  %85 = load i32, ptr %3, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = add nsw i32 %84, %88
  %90 = load i32, ptr @mx, align 4, !tbaa !5
  %91 = icmp sle i32 %89, %90
  br i1 %91, label %92, label %103

92:                                               ; preds = %83
  %93 = load i32, ptr @mx, align 4, !tbaa !5
  %94 = load i32, ptr %6, align 4, !tbaa !5
  %95 = add nsw i32 %93, %94
  %96 = load i32, ptr %3, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = add nsw i32 %95, %99
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [2003 x i8], ptr @vis, i64 0, i64 %101
  store i8 1, ptr %102, align 1, !tbaa !11
  br label %112

103:                                              ; preds = %83
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %104 = load i32, ptr %6, align 4, !tbaa !5
  %105 = load i32, ptr %3, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = add nsw i32 %104, %108
  store i32 %109, ptr %7, align 4, !tbaa !5
  %110 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @upp, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %111 = load i32, ptr %110, align 4, !tbaa !5
  store i32 %111, ptr @upp, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %112

112:                                              ; preds = %103, %92
  br label %113

113:                                              ; preds = %112, %75
  br label %114

114:                                              ; preds = %113
  %115 = load i32, ptr %6, align 4, !tbaa !5
  %116 = add nsw i32 %115, -1
  store i32 %116, ptr %6, align 4, !tbaa !5
  br label %69, !llvm.loop !16

117:                                              ; preds = %74
  br label %118

118:                                              ; preds = %117, %49
  %119 = getelementptr inbounds [3 x i8], ptr %5, i64 0, i64 0
  %120 = load i8, ptr %119, align 1, !tbaa !13
  %121 = sext i8 %120 to i32
  %122 = icmp ne i32 %121, 76
  br i1 %122, label %123, label %187

123:                                              ; preds = %118
  %124 = load i32, ptr @low, align 4, !tbaa !5
  %125 = load i32, ptr @mx, align 4, !tbaa !5
  %126 = sub nsw i32 0, %125
  %127 = icmp slt i32 %124, %126
  br i1 %127, label %128, label %135

128:                                              ; preds = %123
  %129 = load i32, ptr %3, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %130
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = load i32, ptr @low, align 4, !tbaa !5
  %134 = sub nsw i32 %133, %132
  store i32 %134, ptr @low, align 4, !tbaa !5
  br label %135

135:                                              ; preds = %128, %123
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %136 = load i32, ptr @mx, align 4, !tbaa !5
  %137 = sub nsw i32 0, %136
  store i32 %137, ptr %8, align 4, !tbaa !5
  br label %138

138:                                              ; preds = %183, %135
  %139 = load i32, ptr %8, align 4, !tbaa !5
  %140 = load i32, ptr @mx, align 4, !tbaa !5
  %141 = icmp sle i32 %139, %140
  br i1 %141, label %143, label %142

142:                                              ; preds = %138
  store i32 13, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %186

143:                                              ; preds = %138
  %144 = load i32, ptr @mx, align 4, !tbaa !5
  %145 = load i32, ptr %8, align 4, !tbaa !5
  %146 = add nsw i32 %144, %145
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [2003 x i8], ptr @vis, i64 0, i64 %147
  %149 = load i8, ptr %148, align 1, !tbaa !11, !range !14, !noundef !15
  %150 = trunc i8 %149 to i1
  br i1 %150, label %151, label %182

151:                                              ; preds = %143
  %152 = load i32, ptr %8, align 4, !tbaa !5
  %153 = load i32, ptr %3, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %154
  %156 = load i32, ptr %155, align 4, !tbaa !5
  %157 = sub nsw i32 %152, %156
  %158 = load i32, ptr @mx, align 4, !tbaa !5
  %159 = sub nsw i32 0, %158
  %160 = icmp sge i32 %157, %159
  br i1 %160, label %161, label %172

161:                                              ; preds = %151
  %162 = load i32, ptr @mx, align 4, !tbaa !5
  %163 = load i32, ptr %8, align 4, !tbaa !5
  %164 = add nsw i32 %162, %163
  %165 = load i32, ptr %3, align 4, !tbaa !5
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %166
  %168 = load i32, ptr %167, align 4, !tbaa !5
  %169 = sub nsw i32 %164, %168
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [2003 x i8], ptr @vis, i64 0, i64 %170
  store i8 1, ptr %171, align 1, !tbaa !11
  br label %181

172:                                              ; preds = %151
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %173 = load i32, ptr %8, align 4, !tbaa !5
  %174 = load i32, ptr %3, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %175
  %177 = load i32, ptr %176, align 4, !tbaa !5
  %178 = sub nsw i32 %173, %177
  store i32 %178, ptr %9, align 4, !tbaa !5
  %179 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @low, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %180 = load i32, ptr %179, align 4, !tbaa !5
  store i32 %180, ptr @low, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %181

181:                                              ; preds = %172, %161
  br label %182

182:                                              ; preds = %181, %143
  br label %183

183:                                              ; preds = %182
  %184 = load i32, ptr %8, align 4, !tbaa !5
  %185 = add nsw i32 %184, 1
  store i32 %185, ptr %8, align 4, !tbaa !5
  br label %138, !llvm.loop !17

186:                                              ; preds = %142
  br label %187

187:                                              ; preds = %186, %118
  call void @llvm.lifetime.end.p0(i64 3, ptr %5) #5
  br label %188

188:                                              ; preds = %187
  %189 = load i32, ptr %3, align 4, !tbaa !5
  %190 = add nsw i32 %189, 1
  store i32 %190, ptr %3, align 4, !tbaa !5
  br label %44, !llvm.loop !18

191:                                              ; preds = %48
  %192 = load i32, ptr @m, align 4, !tbaa !5
  %193 = load i32, ptr @mx, align 4, !tbaa !5
  %194 = sub nsw i32 0, %193
  %195 = icmp slt i32 %192, %194
  br i1 %195, label %196, label %200

196:                                              ; preds = %191
  %197 = load i32, ptr @low, align 4, !tbaa !5
  %198 = load i32, ptr @m, align 4, !tbaa !5
  %199 = icmp sle i32 %197, %198
  br label %218

200:                                              ; preds = %191
  %201 = load i32, ptr @m, align 4, !tbaa !5
  %202 = load i32, ptr @mx, align 4, !tbaa !5
  %203 = icmp sgt i32 %201, %202
  br i1 %203, label %204, label %208

204:                                              ; preds = %200
  %205 = load i32, ptr @m, align 4, !tbaa !5
  %206 = load i32, ptr @upp, align 4, !tbaa !5
  %207 = icmp sle i32 %205, %206
  br label %216

208:                                              ; preds = %200
  %209 = load i32, ptr @mx, align 4, !tbaa !5
  %210 = load i32, ptr @m, align 4, !tbaa !5
  %211 = add nsw i32 %209, %210
  %212 = sext i32 %211 to i64
  %213 = getelementptr inbounds [2003 x i8], ptr @vis, i64 0, i64 %212
  %214 = load i8, ptr %213, align 1, !tbaa !11, !range !14, !noundef !15
  %215 = trunc i8 %214 to i1
  br label %216

216:                                              ; preds = %208, %204
  %217 = phi i1 [ %207, %204 ], [ %215, %208 ]
  br label %218

218:                                              ; preds = %216, %196
  %219 = phi i1 [ %199, %196 ], [ %217, %216 ]
  %220 = zext i1 %219 to i64
  %221 = select i1 %219, ptr @.str.3, ptr @.str.4
  %222 = call i32 @puts(ptr noundef %221)
  br label %11, !llvm.loop !19

223:                                              ; preds = %11
  ret i32 0
}

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

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

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

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

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

declare i32 @puts(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 = { 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 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{i8 0, i8 2}
!15 = !{}
!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
@m = external dso_local global i32, align 4
@a = external dso_local global [1001 x i32], align 16
@mx = external dso_local global i32, align 4
@low = external dso_local global i32, align 4
@upp = external dso_local global i32, align 4
@vis = external dso_local local_unnamed_addr global [2003 x i8], 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 [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1

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

.lr.ph63:                                         ; preds = %0, %107
  %7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @m)
  store i32 0, ptr @mx, align 4, !tbaa !5
  %8 = load i32, ptr @n, align 4, !tbaa !5
  %.not3443 = icmp slt i32 %8, 1
  br i1 %.not3443, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph63
  %9 = phi i32 [ %8, %.lr.ph63 ], [ %20, %.lr.ph ]
  %10 = phi i32 [ 0, %.lr.ph63 ], [ %19, %.lr.ph ]
  store i32 0, ptr @upp, align 4, !tbaa !5
  store i32 0, ptr @low, align 4, !tbaa !5
  %11 = shl i32 %10, 1
  %12 = or disjoint i32 %11, 1
  %13 = sext i32 %12 to i64
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @vis, i8 0, i64 %13, i1 false)
  %14 = sext i32 %10 to i64
  %15 = getelementptr inbounds [2003 x i8], ptr @vis, i64 0, i64 %14
  store i8 1, ptr %15, align 1, !tbaa !9
  %.not3554 = icmp slt i32 %9, 1
  br i1 %.not3554, label %._crit_edge60, label %.lr.ph59

.lr.ph:                                           ; preds = %.lr.ph63, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.lr.ph63 ]
  %16 = getelementptr inbounds i32, ptr @a, i64 %indvars.iv
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %16)
  %18 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @mx, ptr noundef nonnull align 4 dereferenceable(4) %16)
  %19 = load i32, ptr %18, align 4, !tbaa !5
  store i32 %19, ptr @mx, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %20 = load i32, ptr @n, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %.not34.not = icmp slt i64 %indvars.iv, %21
  br i1 %.not34.not, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge60:                                    ; preds = %.loopexit, %._crit_edge
  %22 = phi i32 [ %10, %._crit_edge ], [ %90, %.loopexit ]
  %23 = load i32, ptr @m, align 4, !tbaa !5
  %24 = sub nsw i32 0, %22
  %25 = icmp slt i32 %23, %24
  br i1 %25, label %93, label %96

.lr.ph59:                                         ; preds = %._crit_edge, %.loopexit
  %indvars.iv66 = phi i64 [ %indvars.iv.next67, %.loopexit ], [ 1, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %1) #5
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %1)
  %27 = load i8, ptr %1, align 1, !tbaa !13
  %.not36 = icmp eq i8 %27, 68
  %.pre70 = load i32, ptr @mx, align 4, !tbaa !5
  br i1 %.not36, label %.thread, label %28

28:                                               ; preds = %.lr.ph59
  %29 = load i32, ptr @upp, align 4, !tbaa !5
  %30 = icmp sgt i32 %29, %.pre70
  br i1 %30, label %31, label %35

31:                                               ; preds = %28
  %32 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %indvars.iv66
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = add nsw i32 %33, %29
  store i32 %34, ptr @upp, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %31, %28
  %.not3745 = icmp slt i32 %.pre70, 0
  br i1 %.not3745, label %._crit_edge49, label %.lr.ph48

.lr.ph48:                                         ; preds = %35
  %36 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %indvars.iv66
  br label %37

37:                                               ; preds = %.lr.ph48, %54
  %38 = phi i32 [ %.pre70, %.lr.ph48 ], [ %55, %54 ]
  %.02646 = phi i32 [ %.pre70, %.lr.ph48 ], [ %56, %54 ]
  %39 = add nsw i32 %38, %.02646
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [2003 x i8], ptr @vis, i64 0, i64 %40
  %42 = load i8, ptr %41, align 1, !tbaa !9, !range !14, !noundef !15
  %43 = trunc nuw i8 %42 to i1
  br i1 %43, label %44, label %54

44:                                               ; preds = %37
  %45 = load i32, ptr %36, align 4, !tbaa !5
  %46 = add nsw i32 %45, %.02646
  %.not41 = icmp sgt i32 %46, %38
  br i1 %.not41, label %51, label %47

47:                                               ; preds = %44
  %48 = add nsw i32 %45, %39
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [2003 x i8], ptr @vis, i64 0, i64 %49
  store i8 1, ptr %50, align 1, !tbaa !9
  br label %54

51:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  store i32 %46, ptr %2, align 4, !tbaa !5
  %52 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @upp, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %53 = load i32, ptr %52, align 4, !tbaa !5
  store i32 %53, ptr @upp, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  %.pre = load i32, ptr @mx, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %37, %51, %47
  %55 = phi i32 [ %38, %37 ], [ %.pre, %51 ], [ %38, %47 ]
  %56 = add nsw i32 %.02646, -1
  %57 = sub nsw i32 0, %55
  %.not37.not = icmp sgt i32 %.02646, %57
  br i1 %.not37.not, label %37, label %._crit_edge49.loopexit, !llvm.loop !16

._crit_edge49.loopexit:                           ; preds = %54
  %.pr.pre = load i8, ptr %1, align 1, !tbaa !13
  br label %._crit_edge49

._crit_edge49:                                    ; preds = %._crit_edge49.loopexit, %35
  %58 = phi i32 [ %55, %._crit_edge49.loopexit ], [ %.pre70, %35 ]
  %.pr = phi i8 [ %.pr.pre, %._crit_edge49.loopexit ], [ %27, %35 ]
  %.not38 = icmp eq i8 %.pr, 76
  br i1 %.not38, label %.loopexit, label %.thread

.thread:                                          ; preds = %.lr.ph59, %._crit_edge49
  %59 = phi i32 [ %.pre70, %.lr.ph59 ], [ %58, %._crit_edge49 ]
  %60 = load i32, ptr @low, align 4, !tbaa !5
  %61 = sub nsw i32 0, %59
  %62 = icmp slt i32 %60, %61
  br i1 %62, label %63, label %67

63:                                               ; preds = %.thread
  %64 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %indvars.iv66
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = sub nsw i32 %60, %65
  store i32 %66, ptr @low, align 4, !tbaa !5
  br label %67

67:                                               ; preds = %63, %.thread
  %.not3950 = icmp slt i32 %59, 0
  br i1 %.not3950, label %.loopexit, label %.lr.ph53

.lr.ph53:                                         ; preds = %67
  %68 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %indvars.iv66
  br label %69

69:                                               ; preds = %.lr.ph53, %87
  %70 = phi i32 [ %59, %.lr.ph53 ], [ %88, %87 ]
  %.051 = phi i32 [ %61, %.lr.ph53 ], [ %89, %87 ]
  %71 = add nsw i32 %70, %.051
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [2003 x i8], ptr @vis, i64 0, i64 %72
  %74 = load i8, ptr %73, align 1, !tbaa !9, !range !14, !noundef !15
  %75 = trunc nuw i8 %74 to i1
  br i1 %75, label %76, label %87

76:                                               ; preds = %69
  %77 = load i32, ptr %68, align 4, !tbaa !5
  %78 = sub nsw i32 %.051, %77
  %79 = sub nsw i32 0, %70
  %.not40 = icmp slt i32 %78, %79
  br i1 %.not40, label %84, label %80

80:                                               ; preds = %76
  %81 = sub nsw i32 %71, %77
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [2003 x i8], ptr @vis, i64 0, i64 %82
  store i8 1, ptr %83, align 1, !tbaa !9
  br label %87

84:                                               ; preds = %76
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  store i32 %78, ptr %3, align 4, !tbaa !5
  %85 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @low, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %86 = load i32, ptr %85, align 4, !tbaa !5
  store i32 %86, ptr @low, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  %.pre71 = load i32, ptr @mx, align 4, !tbaa !5
  br label %87

87:                                               ; preds = %69, %84, %80
  %88 = phi i32 [ %70, %69 ], [ %.pre71, %84 ], [ %70, %80 ]
  %89 = add nsw i32 %.051, 1
  %.not39.not = icmp slt i32 %.051, %88
  br i1 %.not39.not, label %69, label %.loopexit, !llvm.loop !17

.loopexit:                                        ; preds = %87, %67, %._crit_edge49
  %90 = phi i32 [ %59, %67 ], [ %58, %._crit_edge49 ], [ %88, %87 ]
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %1) #5
  %indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
  %91 = load i32, ptr @n, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %.not35.not = icmp slt i64 %indvars.iv66, %92
  br i1 %.not35.not, label %.lr.ph59, label %._crit_edge60, !llvm.loop !18

93:                                               ; preds = %._crit_edge60
  %94 = load i32, ptr @low, align 4, !tbaa !5
  %95 = icmp sle i32 %94, %23
  br label %107

96:                                               ; preds = %._crit_edge60
  %97 = icmp sgt i32 %23, %22
  br i1 %97, label %98, label %101

98:                                               ; preds = %96
  %99 = load i32, ptr @upp, align 4, !tbaa !5
  %100 = icmp sle i32 %23, %99
  br label %107

101:                                              ; preds = %96
  %102 = add nsw i32 %22, %23
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [2003 x i8], ptr @vis, i64 0, i64 %103
  %105 = load i8, ptr %104, align 1, !tbaa !9, !range !14, !noundef !15
  %106 = trunc nuw i8 %105 to i1
  br label %107

107:                                              ; preds = %98, %101, %93
  %108 = phi i1 [ %95, %93 ], [ %100, %98 ], [ %106, %101 ]
  %109 = select i1 %108, ptr @.str.3, ptr @.str.4
  %110 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %109)
  %111 = load i32, ptr @t, align 4, !tbaa !5
  %112 = add nsw i32 %111, -1
  store i32 %112, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %111, 0
  br i1 %.not, label %._crit_edge64, label %.lr.ph63, !llvm.loop !19

._crit_edge64:                                    ; preds = %107, %0
  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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

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

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @puts(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 = { mustprogress 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 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!7, !7, i64 0}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}


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