; LLVM IR from tangjz/acm-icpc :: codeforces/gym (100624E)

; 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
@rt = external dso_local global i32, align 4
@H = external dso_local global [501 x i32], align 16
@L = external dso_local global [501 x i32], align 16
@R = external dso_local global [501 x i32], align 16
@f = external dso_local global [501 x [2001 x i32]], align 16
@word = external dso_local global [501 x [6 x i8]], align 16
@str = external dso_local global [2001 x i8], align 16
@a = external dso_local global [6 x i8], align 1
@b = external dso_local global [6 x i8], align 1
@vis = external dso_local global [501 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4HashPc(ptr 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 uwtable
declare dso_local void @_Z3dfsi(i32 noundef) #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %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
  store i32 0, ptr %1, align 4
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %9

9:                                                ; preds = %144, %0
  %10 = load i32, ptr @t, align 4, !tbaa !5
  %11 = add nsw i32 %10, -1
  store i32 %11, ptr @t, align 4, !tbaa !5
  %12 = icmp ne i32 %10, 0
  br i1 %12, label %13, label %158

13:                                               ; preds = %9
  call void @llvm.memset.p0.i64(ptr align 16 @L, i8 -1, i64 2004, i1 false)
  call void @llvm.memset.p0.i64(ptr align 16 @vis, i8 0, i64 501, i1 false)
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %15

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

19:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  br label %53

20:                                               ; preds = %15
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @a, ptr noundef @b)
  %22 = call noundef i32 @_Z4HashPc(ptr noundef @a)
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [501 x i32], ptr @H, i64 0, i64 %24
  store i32 %22, ptr %25, align 4, !tbaa !5
  %26 = load i8, ptr @b, align 1, !tbaa !9
  %27 = sext i8 %26 to i32
  %28 = icmp sge i32 %27, 97
  br i1 %28, label %29, label %39

29:                                               ; preds = %20
  %30 = load i8, ptr @b, align 1, !tbaa !9
  %31 = sext i8 %30 to i32
  %32 = icmp sle i32 %31, 122
  br i1 %32, label %33, label %39

33:                                               ; preds = %29
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [501 x [6 x i8]], ptr @word, i64 0, i64 %35
  %37 = getelementptr inbounds [6 x i8], ptr %36, i64 0, i64 0
  %38 = call ptr @strcpy(ptr noundef %37, ptr noundef @b) #8
  br label %49

39:                                               ; preds = %29, %20
  %40 = call noundef i32 @_Z4HashPc(ptr noundef @b)
  %41 = load i32, ptr %2, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [501 x i32], ptr @L, i64 0, i64 %42
  store i32 %40, ptr %43, align 4, !tbaa !5
  %44 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef @b)
  %45 = call noundef i32 @_Z4HashPc(ptr noundef @b)
  %46 = load i32, ptr %2, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [501 x i32], ptr @R, i64 0, i64 %47
  store i32 %45, ptr %48, align 4, !tbaa !5
  br label %49

49:                                               ; preds = %39, %33
  br label %50

50:                                               ; preds = %49
  %51 = load i32, ptr %2, align 4, !tbaa !5
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %2, align 4, !tbaa !5
  br label %15, !llvm.loop !10

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

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

58:                                               ; preds = %54
  store i32 7, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  br label %122

59:                                               ; preds = %54
  %60 = load i32, ptr %3, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [501 x i32], ptr @L, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = icmp ne i32 %63, -1
  br i1 %64, label %65, label %118

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

66:                                               ; preds = %87, %65
  %67 = load i32, ptr %5, align 4, !tbaa !5
  %68 = load i32, ptr @m, align 4, !tbaa !5
  %69 = icmp slt i32 %67, %68
  br i1 %69, label %71, label %70

70:                                               ; preds = %66
  store i32 10, ptr %4, align 4
  br label %90

71:                                               ; preds = %66
  %72 = load i32, ptr %3, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [501 x i32], ptr @L, i64 0, i64 %73
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = load i32, ptr %5, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [501 x i32], ptr @H, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = icmp eq i32 %75, %79
  br i1 %80, label %81, label %86

81:                                               ; preds = %71
  %82 = load i32, ptr %5, align 4, !tbaa !5
  %83 = load i32, ptr %3, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [501 x i32], ptr @L, i64 0, i64 %84
  store i32 %82, ptr %85, align 4, !tbaa !5
  store i32 10, ptr %4, align 4
  br label %90

86:                                               ; preds = %71
  br label %87

87:                                               ; preds = %86
  %88 = load i32, ptr %5, align 4, !tbaa !5
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %5, align 4, !tbaa !5
  br label %66, !llvm.loop !12

90:                                               ; preds = %81, %70
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  br label %91

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

92:                                               ; preds = %113, %91
  %93 = load i32, ptr %6, align 4, !tbaa !5
  %94 = load i32, ptr @m, align 4, !tbaa !5
  %95 = icmp slt i32 %93, %94
  br i1 %95, label %97, label %96

96:                                               ; preds = %92
  store i32 13, ptr %4, align 4
  br label %116

97:                                               ; preds = %92
  %98 = load i32, ptr %3, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [501 x i32], ptr @R, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = load i32, ptr %6, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [501 x i32], ptr @H, i64 0, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = icmp eq i32 %101, %105
  br i1 %106, label %107, label %112

107:                                              ; preds = %97
  %108 = load i32, ptr %6, align 4, !tbaa !5
  %109 = load i32, ptr %3, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [501 x i32], ptr @R, i64 0, i64 %110
  store i32 %108, ptr %111, align 4, !tbaa !5
  store i32 13, ptr %4, align 4
  br label %116

112:                                              ; preds = %97
  br label %113

113:                                              ; preds = %112
  %114 = load i32, ptr %6, align 4, !tbaa !5
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %6, align 4, !tbaa !5
  br label %92, !llvm.loop !13

116:                                              ; preds = %107, %96
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  br label %117

117:                                              ; preds = %116
  br label %118

118:                                              ; preds = %117, %59
  br label %119

119:                                              ; preds = %118
  %120 = load i32, ptr %3, align 4, !tbaa !5
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %3, align 4, !tbaa !5
  br label %54, !llvm.loop !14

122:                                              ; preds = %58
  %123 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef @a, ptr noundef @str)
  %124 = call noundef i32 @_Z4HashPc(ptr noundef @a)
  store i32 %124, ptr @rt, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %125

125:                                              ; preds = %140, %122
  %126 = load i32, ptr %7, align 4, !tbaa !5
  %127 = load i32, ptr @m, align 4, !tbaa !5
  %128 = icmp slt i32 %126, %127
  br i1 %128, label %130, label %129

129:                                              ; preds = %125
  store i32 16, ptr %4, align 4
  br label %143

130:                                              ; preds = %125
  %131 = load i32, ptr @rt, align 4, !tbaa !5
  %132 = load i32, ptr %7, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [501 x i32], ptr @H, i64 0, i64 %133
  %135 = load i32, ptr %134, align 4, !tbaa !5
  %136 = icmp eq i32 %131, %135
  br i1 %136, label %137, label %139

137:                                              ; preds = %130
  %138 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %138, ptr @rt, align 4, !tbaa !5
  store i32 16, ptr %4, align 4
  br label %143

139:                                              ; preds = %130
  br label %140

140:                                              ; preds = %139
  %141 = load i32, ptr %7, align 4, !tbaa !5
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %7, align 4, !tbaa !5
  br label %125, !llvm.loop !15

143:                                              ; preds = %137, %129
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  br label %144

144:                                              ; preds = %143
  %145 = call i64 @strlen(ptr noundef @str) #9
  %146 = trunc i64 %145 to i32
  store i32 %146, ptr @n, align 4, !tbaa !5
  %147 = load i32, ptr @rt, align 4, !tbaa !5
  call void @_Z3dfsi(i32 noundef %147)
  %148 = load i32, ptr @rt, align 4, !tbaa !5
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [501 x [2001 x i32]], ptr @f, i64 0, i64 %149
  %151 = getelementptr inbounds [2001 x i32], ptr %150, i64 0, i64 0
  %152 = load i32, ptr %151, align 4, !tbaa !5
  %153 = load i32, ptr @n, align 4, !tbaa !5
  %154 = icmp eq i32 %152, %153
  %155 = zext i1 %154 to i64
  %156 = select i1 %154, ptr @.str.4, ptr @.str.5
  %157 = call i32 @puts(ptr noundef %156)
  br label %9, !llvm.loop !16

158:                                              ; preds = %9
  ret i32 0
}

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

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

; Function Attrs: nounwind
declare ptr @strcpy(ptr noundef, ptr noundef) #6

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #7

declare i32 @puts(ptr noundef) #4

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 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 = { 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 #4 = { "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 #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 #7 = { nounwind willreturn memory(read) "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 #8 = { nounwind }
attributes #9 = { nounwind willreturn memory(read) }

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


; 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 local_unnamed_addr global i32, align 4
@m = external dso_local global i32, align 4
@rt = external dso_local local_unnamed_addr global i32, align 4
@H = external dso_local local_unnamed_addr global [501 x i32], align 16
@L = external dso_local local_unnamed_addr global [501 x i32], align 16
@R = external dso_local local_unnamed_addr global [501 x i32], align 16
@f = external dso_local local_unnamed_addr global [501 x [2001 x i32]], align 16
@word = external dso_local global [501 x [6 x i8]], align 16
@str = external dso_local global [2001 x i8], align 16
@a = external dso_local global [6 x i8], align 1
@b = external dso_local global [6 x i8], align 1
@vis = external dso_local local_unnamed_addr global [501 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4HashPc(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsi(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %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
  %.not49 = icmp eq i32 %2, 0
  br i1 %.not49, label %._crit_edge52, label %.lr.ph51

.lr.ph51:                                         ; preds = %0, %.loopexit33
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2004) @L, i8 -1, i64 2004, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(501) @vis, i8 0, i64 501, i1 false)
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @m)
  %5 = load i32, ptr @m, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph, label %._crit_edge

.preheader34:                                     ; preds = %22
  %7 = icmp sgt i32 %23, 0
  br i1 %7, label %.lr.ph45.preheader, label %._crit_edge

.lr.ph45.preheader:                               ; preds = %.preheader34
  %wide.trip.count69 = zext nneg i32 %23 to i64
  br label %.lr.ph45

.lr.ph:                                           ; preds = %.lr.ph51, %22
  %indvars.iv = phi i64 [ %indvars.iv.next, %22 ], [ 0, %.lr.ph51 ]
  %8 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @a, ptr noundef nonnull @b)
  %9 = tail call noundef i32 @_Z4HashPc(ptr noundef nonnull @a)
  %10 = getelementptr inbounds [501 x i32], ptr @H, i64 0, i64 %indvars.iv
  store i32 %9, ptr %10, align 4, !tbaa !5
  %11 = load i8, ptr @b, align 1
  %12 = add i8 %11, -97
  %or.cond = icmp ult i8 %12, 26
  br i1 %or.cond, label %13, label %16

13:                                               ; preds = %.lr.ph
  %14 = getelementptr inbounds [501 x [6 x i8]], ptr @word, i64 0, i64 %indvars.iv
  %15 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %14, ptr noundef nonnull dereferenceable(1) @b) #7
  br label %22

16:                                               ; preds = %.lr.ph
  %17 = tail call noundef i32 @_Z4HashPc(ptr noundef nonnull @b)
  %18 = getelementptr inbounds [501 x i32], ptr @L, i64 0, i64 %indvars.iv
  store i32 %17, ptr %18, align 4, !tbaa !5
  %19 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @b)
  %20 = tail call noundef i32 @_Z4HashPc(ptr noundef nonnull @b)
  %21 = getelementptr inbounds [501 x i32], ptr @R, i64 0, i64 %indvars.iv
  store i32 %20, ptr %21, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %13, %16
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %23 = load i32, ptr @m, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = icmp slt i64 %indvars.iv.next, %24
  br i1 %25, label %.lr.ph, label %.preheader34, !llvm.loop !9

._crit_edge:                                      ; preds = %.loopexit, %.lr.ph51, %.preheader34
  %26 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull @a, ptr noundef nonnull @str)
  %27 = tail call noundef i32 @_Z4HashPc(ptr noundef nonnull @a)
  store i32 %27, ptr @rt, align 4, !tbaa !5
  %28 = load i32, ptr @m, align 4, !tbaa !5
  %29 = icmp sgt i32 %28, 0
  br i1 %29, label %.lr.ph48.preheader, label %.loopexit33

.lr.ph48.preheader:                               ; preds = %._crit_edge
  %wide.trip.count74 = zext nneg i32 %28 to i64
  br label %.lr.ph48

.lr.ph45:                                         ; preds = %.lr.ph45.preheader, %.loopexit
  %indvars.iv66 = phi i64 [ 0, %.lr.ph45.preheader ], [ %indvars.iv.next67, %.loopexit ]
  %30 = getelementptr inbounds [501 x i32], ptr @L, i64 0, i64 %indvars.iv66
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %.not31 = icmp eq i32 %31, -1
  br i1 %.not31, label %.loopexit, label %.lr.ph41

.lr.ph41:                                         ; preds = %.lr.ph45, %37
  %indvars.iv58 = phi i64 [ %indvars.iv.next59, %37 ], [ 0, %.lr.ph45 ]
  %32 = getelementptr inbounds [501 x i32], ptr @H, i64 0, i64 %indvars.iv58
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = icmp eq i32 %31, %33
  br i1 %34, label %35, label %37

35:                                               ; preds = %.lr.ph41
  %36 = trunc nuw nsw i64 %indvars.iv58 to i32
  store i32 %36, ptr %30, align 4, !tbaa !5
  br label %.lr.ph43

37:                                               ; preds = %.lr.ph41
  %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next59, %wide.trip.count69
  br i1 %exitcond.not, label %.lr.ph43, label %.lr.ph41, !llvm.loop !11

.lr.ph43:                                         ; preds = %37, %35
  %38 = getelementptr inbounds [501 x i32], ptr @R, i64 0, i64 %indvars.iv66
  %39 = load i32, ptr %38, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %.lr.ph43, %46
  %indvars.iv61 = phi i64 [ 0, %.lr.ph43 ], [ %indvars.iv.next62, %46 ]
  %41 = getelementptr inbounds [501 x i32], ptr @H, i64 0, i64 %indvars.iv61
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = icmp eq i32 %39, %42
  br i1 %43, label %44, label %46

44:                                               ; preds = %40
  %45 = trunc nuw nsw i64 %indvars.iv61 to i32
  store i32 %45, ptr %38, align 4, !tbaa !5
  br label %.loopexit

46:                                               ; preds = %40
  %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
  %exitcond65.not = icmp eq i64 %indvars.iv.next62, %wide.trip.count69
  br i1 %exitcond65.not, label %.loopexit, label %40, !llvm.loop !12

.loopexit:                                        ; preds = %46, %44, %.lr.ph45
  %indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
  %exitcond70.not = icmp eq i64 %indvars.iv.next67, %wide.trip.count69
  br i1 %exitcond70.not, label %._crit_edge, label %.lr.ph45, !llvm.loop !13

.lr.ph48:                                         ; preds = %.lr.ph48.preheader, %52
  %indvars.iv71 = phi i64 [ 0, %.lr.ph48.preheader ], [ %indvars.iv.next72, %52 ]
  %47 = getelementptr inbounds [501 x i32], ptr @H, i64 0, i64 %indvars.iv71
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = icmp eq i32 %27, %48
  br i1 %49, label %50, label %52

50:                                               ; preds = %.lr.ph48
  %51 = trunc nuw nsw i64 %indvars.iv71 to i32
  store i32 %51, ptr @rt, align 4, !tbaa !5
  br label %.loopexit33

52:                                               ; preds = %.lr.ph48
  %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
  %exitcond75.not = icmp eq i64 %indvars.iv.next72, %wide.trip.count74
  br i1 %exitcond75.not, label %.loopexit33, label %.lr.ph48, !llvm.loop !14

.loopexit33:                                      ; preds = %52, %._crit_edge, %50
  %53 = phi i32 [ %27, %._crit_edge ], [ %51, %50 ], [ %27, %52 ]
  %54 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @str) #8
  %55 = trunc i64 %54 to i32
  store i32 %55, ptr @n, align 4, !tbaa !5
  tail call void @_Z3dfsi(i32 noundef %53)
  %56 = load i32, ptr @rt, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [501 x [2001 x i32]], ptr @f, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = load i32, ptr @n, align 4, !tbaa !5
  %61 = icmp eq i32 %59, %60
  %62 = select i1 %61, ptr @.str.4, ptr @.str.5
  %63 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) %62)
  %64 = load i32, ptr @t, align 4, !tbaa !5
  %65 = add nsw i32 %64, -1
  store i32 %65, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %64, 0
  br i1 %.not, label %._crit_edge52, label %.lr.ph51, !llvm.loop !15

._crit_edge52:                                    ; preds = %.loopexit33, %0
  ret i32 0
}

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

; 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: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #5

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #6

; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #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 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 #6 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }

!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}


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