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

; 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
@m = external dso_local global i32, align 4
@e = external dso_local global [102 x [102 x i32]], align 16
@dis = external dso_local global [2 x [102 x [102 x i32]]], align 16
@ans = external dso_local global i32, align 4
@str = external dso_local global [204 x i8], align 16
@.str = external hidden unnamed_addr constant [9 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 [10 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 [6 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3bfsii(i32 noundef, i32 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 norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %10 = load ptr, ptr @stdin, align 8, !tbaa !5
  %11 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.1, ptr noundef %10)
  %12 = load ptr, ptr @stdout, align 8, !tbaa !5
  %13 = call ptr @freopen(ptr noundef @.str.2, ptr noundef @.str.3, ptr noundef %12)
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef @m, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !9
  br label %15

15:                                               ; preds = %102, %0
  %16 = load i32, ptr %2, align 4, !tbaa !9
  %17 = load i32, ptr @n, align 4, !tbaa !9
  %18 = icmp sle i32 %16, %17
  br i1 %18, label %20, label %19

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

20:                                               ; preds = %15
  %21 = load i32, ptr %2, align 4, !tbaa !9
  %22 = icmp sgt i32 %21, 0
  br i1 %22, label %23, label %62

23:                                               ; preds = %20
  %24 = load ptr, ptr @stdin, align 8, !tbaa !5
  %25 = call ptr @fgets(ptr noundef @str, i32 noundef 102, ptr noundef %24)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %26

26:                                               ; preds = %58, %23
  %27 = load i32, ptr %4, align 4, !tbaa !9
  %28 = load i32, ptr @m, align 4, !tbaa !9
  %29 = icmp sle i32 %27, %28
  br i1 %29, label %31, label %30

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

31:                                               ; preds = %26
  %32 = load i32, ptr %4, align 4, !tbaa !9
  %33 = mul nsw i32 %32, 2
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [204 x i8], ptr @str, i64 0, i64 %34
  %36 = load i8, ptr %35, align 1, !tbaa !11
  %37 = sext i8 %36 to i32
  %38 = icmp eq i32 %37, 32
  br i1 %38, label %39, label %57

39:                                               ; preds = %31
  %40 = load i32, ptr %2, align 4, !tbaa !9
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [102 x [102 x i32]], ptr @e, i64 0, i64 %41
  %43 = load i32, ptr %4, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [102 x i32], ptr %42, i64 0, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !9
  %47 = or i32 %46, 2
  store i32 %47, ptr %45, align 4, !tbaa !9
  %48 = load i32, ptr %2, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [102 x [102 x i32]], ptr @e, i64 0, i64 %49
  %51 = load i32, ptr %4, align 4, !tbaa !9
  %52 = add nsw i32 %51, 1
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [102 x i32], ptr %50, i64 0, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !9
  %56 = or i32 %55, 8
  store i32 %56, ptr %54, align 4, !tbaa !9
  br label %57

57:                                               ; preds = %39, %31
  br label %58

58:                                               ; preds = %57
  %59 = load i32, ptr %4, align 4, !tbaa !9
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %4, align 4, !tbaa !9
  br label %26, !llvm.loop !12

61:                                               ; preds = %30
  br label %62

62:                                               ; preds = %61, %20
  %63 = load ptr, ptr @stdin, align 8, !tbaa !5
  %64 = call ptr @fgets(ptr noundef @str, i32 noundef 102, ptr noundef %63)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 1, ptr %5, align 4, !tbaa !9
  br label %65

65:                                               ; preds = %98, %62
  %66 = load i32, ptr %5, align 4, !tbaa !9
  %67 = load i32, ptr @m, align 4, !tbaa !9
  %68 = icmp sle i32 %66, %67
  br i1 %68, label %70, label %69

69:                                               ; preds = %65
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %101

70:                                               ; preds = %65
  %71 = load i32, ptr %5, align 4, !tbaa !9
  %72 = mul nsw i32 %71, 2
  %73 = sub nsw i32 %72, 1
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [204 x i8], ptr @str, i64 0, i64 %74
  %76 = load i8, ptr %75, align 1, !tbaa !11
  %77 = sext i8 %76 to i32
  %78 = icmp eq i32 %77, 32
  br i1 %78, label %79, label %97

79:                                               ; preds = %70
  %80 = load i32, ptr %2, align 4, !tbaa !9
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [102 x [102 x i32]], ptr @e, i64 0, i64 %81
  %83 = load i32, ptr %5, align 4, !tbaa !9
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [102 x i32], ptr %82, i64 0, i64 %84
  %86 = load i32, ptr %85, align 4, !tbaa !9
  %87 = or i32 %86, 4
  store i32 %87, ptr %85, align 4, !tbaa !9
  %88 = load i32, ptr %2, align 4, !tbaa !9
  %89 = add nsw i32 %88, 1
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [102 x [102 x i32]], ptr @e, i64 0, i64 %90
  %92 = load i32, ptr %5, align 4, !tbaa !9
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [102 x i32], ptr %91, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !9
  %96 = or i32 %95, 1
  store i32 %96, ptr %94, align 4, !tbaa !9
  br label %97

97:                                               ; preds = %79, %70
  br label %98

98:                                               ; preds = %97
  %99 = load i32, ptr %5, align 4, !tbaa !9
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr %5, align 4, !tbaa !9
  br label %65, !llvm.loop !14

101:                                              ; preds = %69
  br label %102

102:                                              ; preds = %101
  %103 = load i32, ptr %2, align 4, !tbaa !9
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %2, align 4, !tbaa !9
  br label %15, !llvm.loop !15

105:                                              ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 1, ptr %6, align 4, !tbaa !9
  br label %106

106:                                              ; preds = %135, %105
  %107 = load i32, ptr %6, align 4, !tbaa !9
  %108 = load i32, ptr @n, align 4, !tbaa !9
  %109 = icmp sle i32 %107, %108
  br i1 %109, label %111, label %110

110:                                              ; preds = %106
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %138

111:                                              ; preds = %106
  %112 = load i32, ptr %6, align 4, !tbaa !9
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [102 x [102 x i32]], ptr @e, i64 0, i64 %113
  %115 = getelementptr inbounds [102 x i32], ptr %114, i64 0, i64 1
  %116 = load i32, ptr %115, align 4, !tbaa !9
  %117 = and i32 %116, 8
  %118 = icmp ne i32 %117, 0
  br i1 %118, label %119, label %121

119:                                              ; preds = %111
  %120 = load i32, ptr %6, align 4, !tbaa !9
  call void @_Z3bfsii(i32 noundef %120, i32 noundef 1)
  br label %121

121:                                              ; preds = %119, %111
  %122 = load i32, ptr %6, align 4, !tbaa !9
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [102 x [102 x i32]], ptr @e, i64 0, i64 %123
  %125 = load i32, ptr @m, align 4, !tbaa !9
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [102 x i32], ptr %124, i64 0, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !9
  %129 = and i32 %128, 2
  %130 = icmp ne i32 %129, 0
  br i1 %130, label %131, label %134

131:                                              ; preds = %121
  %132 = load i32, ptr %6, align 4, !tbaa !9
  %133 = load i32, ptr @m, align 4, !tbaa !9
  call void @_Z3bfsii(i32 noundef %132, i32 noundef %133)
  br label %134

134:                                              ; preds = %131, %121
  br label %135

135:                                              ; preds = %134
  %136 = load i32, ptr %6, align 4, !tbaa !9
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr %6, align 4, !tbaa !9
  br label %106, !llvm.loop !16

138:                                              ; preds = %110
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 1, ptr %7, align 4, !tbaa !9
  br label %139

139:                                              ; preds = %167, %138
  %140 = load i32, ptr %7, align 4, !tbaa !9
  %141 = load i32, ptr @m, align 4, !tbaa !9
  %142 = icmp sle i32 %140, %141
  br i1 %142, label %144, label %143

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

144:                                              ; preds = %139
  %145 = load i32, ptr %7, align 4, !tbaa !9
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [102 x i32], ptr getelementptr inbounds ([102 x [102 x i32]], ptr @e, i64 0, i64 1), i64 0, i64 %146
  %148 = load i32, ptr %147, align 4, !tbaa !9
  %149 = and i32 %148, 1
  %150 = icmp ne i32 %149, 0
  br i1 %150, label %151, label %153

151:                                              ; preds = %144
  %152 = load i32, ptr %7, align 4, !tbaa !9
  call void @_Z3bfsii(i32 noundef 1, i32 noundef %152)
  br label %153

153:                                              ; preds = %151, %144
  %154 = load i32, ptr @n, align 4, !tbaa !9
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [102 x [102 x i32]], ptr @e, i64 0, i64 %155
  %157 = load i32, ptr %7, align 4, !tbaa !9
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [102 x i32], ptr %156, i64 0, i64 %158
  %160 = load i32, ptr %159, align 4, !tbaa !9
  %161 = and i32 %160, 4
  %162 = icmp ne i32 %161, 0
  br i1 %162, label %163, label %166

163:                                              ; preds = %153
  %164 = load i32, ptr @n, align 4, !tbaa !9
  %165 = load i32, ptr %7, align 4, !tbaa !9
  call void @_Z3bfsii(i32 noundef %164, i32 noundef %165)
  br label %166

166:                                              ; preds = %163, %153
  br label %167

167:                                              ; preds = %166
  %168 = load i32, ptr %7, align 4, !tbaa !9
  %169 = add nsw i32 %168, 1
  store i32 %169, ptr %7, align 4, !tbaa !9
  br label %139, !llvm.loop !17

170:                                              ; preds = %143
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 1, ptr %8, align 4, !tbaa !9
  br label %171

171:                                              ; preds = %202, %170
  %172 = load i32, ptr %8, align 4, !tbaa !9
  %173 = load i32, ptr @n, align 4, !tbaa !9
  %174 = icmp sle i32 %172, %173
  br i1 %174, label %176, label %175

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

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

177:                                              ; preds = %198, %176
  %178 = load i32, ptr %9, align 4, !tbaa !9
  %179 = load i32, ptr @m, align 4, !tbaa !9
  %180 = icmp sle i32 %178, %179
  br i1 %180, label %182, label %181

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

182:                                              ; preds = %177
  %183 = load i32, ptr %8, align 4, !tbaa !9
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [102 x [102 x i32]], ptr @dis, i64 0, i64 %184
  %186 = load i32, ptr %9, align 4, !tbaa !9
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [102 x i32], ptr %185, i64 0, i64 %187
  %189 = load i32, ptr %8, align 4, !tbaa !9
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds [102 x [102 x i32]], ptr getelementptr inbounds ([2 x [102 x [102 x i32]]], ptr @dis, i64 0, i64 1), i64 0, i64 %190
  %192 = load i32, ptr %9, align 4, !tbaa !9
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds [102 x i32], ptr %191, i64 0, i64 %193
  %195 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %188, ptr noundef nonnull align 4 dereferenceable(4) %194)
  %196 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) %195)
  %197 = load i32, ptr %196, align 4, !tbaa !9
  store i32 %197, ptr @ans, align 4, !tbaa !9
  br label %198

198:                                              ; preds = %182
  %199 = load i32, ptr %9, align 4, !tbaa !9
  %200 = add nsw i32 %199, 1
  store i32 %200, ptr %9, align 4, !tbaa !9
  br label %177, !llvm.loop !18

201:                                              ; preds = %181
  br label %202

202:                                              ; preds = %201
  %203 = load i32, ptr %8, align 4, !tbaa !9
  %204 = add nsw i32 %203, 1
  store i32 %204, ptr %8, align 4, !tbaa !9
  br label %171, !llvm.loop !19

205:                                              ; preds = %175
  %206 = load i32, ptr @ans, align 4, !tbaa !9
  %207 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %206)
  ret i32 0
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #3

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

declare ptr @fgets(ptr noundef, i32 noundef, ptr noundef) #3

; 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)) #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)) #4

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

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


; 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
@m = external dso_local global i32, align 4
@e = external dso_local local_unnamed_addr global [102 x [102 x i32]], align 16
@dis = external dso_local global [2 x [102 x [102 x i32]]], align 16
@ans = external dso_local global i32, align 4
@str = external dso_local global [204 x i8], align 16
@.str = external hidden unnamed_addr constant [9 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 [10 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 [6 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3bfsii(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %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 @m, ptr noundef nonnull @n)
  %6 = load i32, ptr @n, align 4, !tbaa !9
  %.not62 = icmp slt i32 %6, 0
  br i1 %.not62, label %.preheader55, label %.lr.ph65

.preheader56:                                     ; preds = %._crit_edge
  %.not4366 = icmp slt i32 %42, 1
  br i1 %.not4366, label %.preheader55, label %.lr.ph68

.lr.ph65:                                         ; preds = %0, %._crit_edge
  %indvars.iv86 = phi i64 [ %.pre103, %._crit_edge ], [ 0, %0 ]
  %.not51 = icmp eq i64 %indvars.iv86, 0
  br i1 %.not51, label %.loopexit, label %7

7:                                                ; preds = %.lr.ph65
  %8 = load ptr, ptr @stdin, align 8, !tbaa !5
  %9 = tail call ptr @fgets(ptr noundef nonnull @str, i32 noundef 102, ptr noundef %8)
  %10 = load i32, ptr @m, align 4, !tbaa !9
  %.not5257 = icmp slt i32 %10, 0
  br i1 %.not5257, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %7
  %11 = add nuw i32 %10, 1
  %wide.trip.count = zext i32 %11 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %12 = icmp eq i32 %10, 0
  br i1 %12, label %.loopexit.loopexit.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i64 %wide.trip.count, 4294967294
  br label %13

13:                                               ; preds = %._crit_edge102.1, %.lr.ph.new
  %indvars.iv = phi i64 [ 0, %.lr.ph.new ], [ %indvars.iv.next.pre-phi.1, %._crit_edge102.1 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.1, %._crit_edge102.1 ]
  %14 = shl nuw nsw i64 %indvars.iv, 1
  %15 = getelementptr inbounds [204 x i8], ptr @str, i64 0, i64 %14
  %16 = load i8, ptr %15, align 4, !tbaa !11
  %17 = icmp eq i8 %16, 32
  br i1 %17, label %18, label %._crit_edge102

18:                                               ; preds = %13
  %19 = getelementptr inbounds [102 x [102 x i32]], ptr @e, i64 0, i64 %indvars.iv86, i64 %indvars.iv
  %20 = load <2 x i32>, ptr %19, align 8, !tbaa !9
  %21 = or <2 x i32> %20, <i32 2, i32 8>
  store <2 x i32> %21, ptr %19, align 8, !tbaa !9
  br label %._crit_edge102

._crit_edge102:                                   ; preds = %13, %18
  %indvars.iv.next.pre-phi = or disjoint i64 %indvars.iv, 1
  %22 = shl nuw nsw i64 %indvars.iv.next.pre-phi, 1
  %23 = getelementptr inbounds [204 x i8], ptr @str, i64 0, i64 %22
  %24 = load i8, ptr %23, align 2, !tbaa !11
  %25 = icmp eq i8 %24, 32
  br i1 %25, label %26, label %._crit_edge102.1

26:                                               ; preds = %._crit_edge102
  %27 = getelementptr inbounds [102 x [102 x i32]], ptr @e, i64 0, i64 %indvars.iv86, i64 %indvars.iv.next.pre-phi
  %28 = load <2 x i32>, ptr %27, align 4, !tbaa !9
  %29 = or <2 x i32> %28, <i32 2, i32 8>
  store <2 x i32> %29, ptr %27, align 4, !tbaa !9
  br label %._crit_edge102.1

._crit_edge102.1:                                 ; preds = %._crit_edge102, %26
  %indvars.iv.next.pre-phi.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.loopexit.loopexit.unr-lcssa, label %13, !llvm.loop !12

.loopexit.loopexit.unr-lcssa:                     ; preds = %._crit_edge102.1, %.lr.ph
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next.pre-phi.1, %._crit_edge102.1 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.loopexit, label %.epil.preheader

.epil.preheader:                                  ; preds = %.loopexit.loopexit.unr-lcssa
  %30 = shl nuw nsw i64 %indvars.iv.unr, 1
  %31 = getelementptr inbounds [204 x i8], ptr @str, i64 0, i64 %30
  %32 = load i8, ptr %31, align 2, !tbaa !11
  %33 = icmp eq i8 %32, 32
  br i1 %33, label %34, label %.loopexit

34:                                               ; preds = %.epil.preheader
  %35 = getelementptr inbounds [102 x [102 x i32]], ptr @e, i64 0, i64 %indvars.iv86, i64 %indvars.iv.unr
  %36 = load <2 x i32>, ptr %35, align 4, !tbaa !9
  %37 = or <2 x i32> %36, <i32 2, i32 8>
  store <2 x i32> %37, ptr %35, align 4, !tbaa !9
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit.unr-lcssa, %.epil.preheader, %34, %7, %.lr.ph65
  %38 = load ptr, ptr @stdin, align 8, !tbaa !5
  %39 = tail call ptr @fgets(ptr noundef nonnull @str, i32 noundef 102, ptr noundef %38)
  %40 = load i32, ptr @m, align 4, !tbaa !9
  %.not5359 = icmp slt i32 %40, 1
  %.pre103 = add nuw nsw i64 %indvars.iv86, 1
  br i1 %.not5359, label %._crit_edge, label %.lr.ph61

.lr.ph61:                                         ; preds = %.loopexit
  %41 = add nuw i32 %40, 1
  %wide.trip.count84 = zext i32 %41 to i64
  br label %44

._crit_edge:                                      ; preds = %57, %.loopexit
  %42 = load i32, ptr @n, align 4, !tbaa !9
  %43 = sext i32 %42 to i64
  %.not.not = icmp slt i64 %indvars.iv86, %43
  br i1 %.not.not, label %.lr.ph65, label %.preheader56, !llvm.loop !14

44:                                               ; preds = %.lr.ph61, %57
  %indvars.iv81 = phi i64 [ 1, %.lr.ph61 ], [ %indvars.iv.next82, %57 ]
  %45 = shl nuw nsw i64 %indvars.iv81, 1
  %46 = add nsw i64 %45, -1
  %47 = getelementptr inbounds [204 x i8], ptr @str, i64 0, i64 %46
  %48 = load i8, ptr %47, align 1, !tbaa !11
  %49 = icmp eq i8 %48, 32
  br i1 %49, label %50, label %57

50:                                               ; preds = %44
  %51 = getelementptr inbounds [102 x [102 x i32]], ptr @e, i64 0, i64 %indvars.iv86, i64 %indvars.iv81
  %52 = load i32, ptr %51, align 4, !tbaa !9
  %53 = or i32 %52, 4
  store i32 %53, ptr %51, align 4, !tbaa !9
  %54 = getelementptr inbounds [102 x [102 x i32]], ptr @e, i64 0, i64 %.pre103, i64 %indvars.iv81
  %55 = load i32, ptr %54, align 4, !tbaa !9
  %56 = or i32 %55, 1
  store i32 %56, ptr %54, align 4, !tbaa !9
  br label %57

57:                                               ; preds = %44, %50
  %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
  %exitcond85.not = icmp eq i64 %indvars.iv.next82, %wide.trip.count84
  br i1 %exitcond85.not, label %._crit_edge, label %44, !llvm.loop !15

.preheader55:                                     ; preds = %73, %0, %.preheader56
  %58 = phi i32 [ %42, %.preheader56 ], [ %6, %0 ], [ %74, %73 ]
  %59 = load i32, ptr @m, align 4, !tbaa !9
  %.not4469 = icmp slt i32 %59, 1
  br i1 %.not4469, label %.preheader54, label %.lr.ph71

.lr.ph68:                                         ; preds = %.preheader56, %73
  %indvars.iv89 = phi i64 [ %indvars.iv.next90, %73 ], [ 1, %.preheader56 ]
  %60 = getelementptr inbounds [102 x [102 x i32]], ptr @e, i64 0, i64 %indvars.iv89, i64 1
  %61 = load i32, ptr %60, align 4, !tbaa !9
  %62 = and i32 %61, 8
  %.not49 = icmp eq i32 %62, 0
  br i1 %.not49, label %65, label %63

63:                                               ; preds = %.lr.ph68
  %64 = trunc nuw nsw i64 %indvars.iv89 to i32
  tail call void @_Z3bfsii(i32 noundef %64, i32 noundef 1)
  br label %65

65:                                               ; preds = %63, %.lr.ph68
  %66 = load i32, ptr @m, align 4, !tbaa !9
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [102 x [102 x i32]], ptr @e, i64 0, i64 %indvars.iv89, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !9
  %70 = and i32 %69, 2
  %.not50 = icmp eq i32 %70, 0
  br i1 %.not50, label %73, label %71

71:                                               ; preds = %65
  %72 = trunc nuw nsw i64 %indvars.iv89 to i32
  tail call void @_Z3bfsii(i32 noundef %72, i32 noundef %66)
  br label %73

73:                                               ; preds = %65, %71
  %indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1
  %74 = load i32, ptr @n, align 4, !tbaa !9
  %75 = sext i32 %74 to i64
  %.not43.not = icmp slt i64 %indvars.iv89, %75
  br i1 %.not43.not, label %.lr.ph68, label %.preheader55, !llvm.loop !16

.preheader54.loopexit:                            ; preds = %92
  %.pre = load i32, ptr @n, align 4, !tbaa !9
  br label %.preheader54

.preheader54:                                     ; preds = %.preheader54.loopexit, %.preheader55
  %76 = phi i32 [ %93, %.preheader54.loopexit ], [ %59, %.preheader55 ]
  %77 = phi i32 [ %.pre, %.preheader54.loopexit ], [ %58, %.preheader55 ]
  %.not4576 = icmp slt i32 %77, 1
  %78 = icmp slt i32 %76, 1
  %or.cond = or i1 %.not4576, %78
  br i1 %or.cond, label %._crit_edge78, label %.preheader

.lr.ph71:                                         ; preds = %.preheader55, %92
  %indvars.iv92 = phi i64 [ %indvars.iv.next93, %92 ], [ 1, %.preheader55 ]
  %79 = getelementptr inbounds [102 x i32], ptr getelementptr inbounds (i8, ptr @e, i64 408), i64 0, i64 %indvars.iv92
  %80 = load i32, ptr %79, align 4, !tbaa !9
  %81 = and i32 %80, 1
  %.not47 = icmp eq i32 %81, 0
  br i1 %.not47, label %84, label %82

82:                                               ; preds = %.lr.ph71
  %83 = trunc nuw nsw i64 %indvars.iv92 to i32
  tail call void @_Z3bfsii(i32 noundef 1, i32 noundef %83)
  br label %84

84:                                               ; preds = %82, %.lr.ph71
  %85 = load i32, ptr @n, align 4, !tbaa !9
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [102 x [102 x i32]], ptr @e, i64 0, i64 %86, i64 %indvars.iv92
  %88 = load i32, ptr %87, align 4, !tbaa !9
  %89 = and i32 %88, 4
  %.not48 = icmp eq i32 %89, 0
  br i1 %.not48, label %92, label %90

90:                                               ; preds = %84
  %91 = trunc nuw nsw i64 %indvars.iv92 to i32
  tail call void @_Z3bfsii(i32 noundef %85, i32 noundef %91)
  br label %92

92:                                               ; preds = %84, %90
  %indvars.iv.next93 = add nuw nsw i64 %indvars.iv92, 1
  %93 = load i32, ptr @m, align 4, !tbaa !9
  %94 = sext i32 %93 to i64
  %.not44.not = icmp slt i64 %indvars.iv92, %94
  br i1 %.not44.not, label %.lr.ph71, label %.preheader54.loopexit, !llvm.loop !17

.preheader:                                       ; preds = %.preheader54, %._crit_edge75
  %95 = phi i32 [ %99, %._crit_edge75 ], [ %77, %.preheader54 ]
  %96 = phi i32 [ %100, %._crit_edge75 ], [ %76, %.preheader54 ]
  %indvars.iv98 = phi i64 [ %indvars.iv.next99, %._crit_edge75 ], [ 1, %.preheader54 ]
  %.not4672 = icmp slt i32 %96, 1
  br i1 %.not4672, label %._crit_edge75, label %.lr.ph74

._crit_edge78:                                    ; preds = %._crit_edge75, %.preheader54
  %97 = load i32, ptr @ans, align 4, !tbaa !9
  %98 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %97)
  ret i32 0

._crit_edge75.loopexit:                           ; preds = %.lr.ph74
  %.pre101 = load i32, ptr @n, align 4, !tbaa !9
  br label %._crit_edge75

._crit_edge75:                                    ; preds = %._crit_edge75.loopexit, %.preheader
  %99 = phi i32 [ %.pre101, %._crit_edge75.loopexit ], [ %95, %.preheader ]
  %100 = phi i32 [ %107, %._crit_edge75.loopexit ], [ %96, %.preheader ]
  %indvars.iv.next99 = add nuw nsw i64 %indvars.iv98, 1
  %101 = sext i32 %99 to i64
  %.not45.not = icmp slt i64 %indvars.iv98, %101
  br i1 %.not45.not, label %.preheader, label %._crit_edge78, !llvm.loop !18

.lr.ph74:                                         ; preds = %.preheader, %.lr.ph74
  %indvars.iv95 = phi i64 [ %indvars.iv.next96, %.lr.ph74 ], [ 1, %.preheader ]
  %102 = getelementptr inbounds [102 x [102 x i32]], ptr @dis, i64 0, i64 %indvars.iv98, i64 %indvars.iv95
  %103 = getelementptr inbounds [102 x [102 x i32]], ptr getelementptr inbounds (i8, ptr @dis, i64 41616), i64 0, i64 %indvars.iv98, i64 %indvars.iv95
  %104 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %102, ptr noundef nonnull align 4 dereferenceable(4) %103)
  %105 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) %104)
  %106 = load i32, ptr %105, align 4, !tbaa !9
  store i32 %106, ptr @ans, align 4, !tbaa !9
  %indvars.iv.next96 = add nuw nsw i64 %indvars.iv95, 1
  %107 = load i32, ptr @m, align 4, !tbaa !9
  %108 = sext i32 %107 to i64
  %.not46.not = icmp slt i64 %indvars.iv95, %108
  br i1 %.not46.not, label %.lr.ph74, label %._crit_edge75.loopexit, !llvm.loop !20
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

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

; 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 #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 #4

; Function Attrs: nofree nounwind
declare noundef i32 @printf(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 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 #2 = { "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 = { 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" }

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


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