; LLVM IR from bqi343/cp-notebook :: Contests/USACO Training/Ch 2/2.1 castle (main)

; 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"

%"class.std::basic_ifstream" = type { %"class.std::basic_istream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_istream.base" = type { ptr, i64 }
%"class.std::basic_filebuf" = type { %"class.std::basic_streambuf", %union.pthread_mutex_t, %"class.std::__basic_file", i32, %struct.__mbstate_t, %struct.__mbstate_t, %struct.__mbstate_t, ptr, i64, i8, i8, i8, i8, ptr, ptr, i8, ptr, ptr, i64, ptr, ptr }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::__basic_file" = type <{ ptr, i8, [7 x i8] }>
%struct.__mbstate_t = type { i32, %union.anon }
%union.anon = type { i32 }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::basic_ofstream" = type { %"class.std::basic_ostream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }
%"struct.std::pair.0" = type { %"struct.std::pair", i32 }
%"struct.std::pair" = type { i32, i32 }

@cin = external dso_local global %"class.std::basic_ifstream", align 8
@cout = external dso_local global %"class.std::basic_ofstream", align 8
@ar = external dso_local global [50 x [50 x i32]], align 16
@comp = external dso_local global [50 x [50 x i32]], align 16
@sz = external dso_local global [2501 x i32], align 16
@num = external dso_local global i32, align 4
@mpos = external dso_local global i32, align 4
@cans = external dso_local global %"struct.std::pair.0", align 4
@xdir = external dso_local global [4 x i32], align 16
@ydir = external dso_local global [4 x i32], align 16
@dir = external dso_local global [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z10flood_fillii(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: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #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
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca %"struct.std::pair.0", align 4
  %16 = alloca %"struct.std::pair", align 4
  %17 = alloca { i64, i32 }, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %18, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  %20 = load i32, ptr %3, align 4, !tbaa !5
  %21 = sub nsw i32 %20, 1
  store i32 %21, ptr %4, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %44, %0
  %23 = load i32, ptr %4, align 4, !tbaa !5
  %24 = icmp sge i32 %23, 0
  br i1 %24, label %26, label %25

25:                                               ; preds = %22
  store i32 2, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  br label %47

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

27:                                               ; preds = %40, %26
  %28 = load i32, ptr %6, align 4, !tbaa !5
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = icmp slt i32 %28, %29
  br i1 %30, label %32, label %31

31:                                               ; preds = %27
  store i32 5, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  br label %43

32:                                               ; preds = %27
  %33 = load i32, ptr %6, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [50 x [50 x i32]], ptr @ar, i64 0, i64 %34
  %36 = load i32, ptr %4, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [50 x i32], ptr %35, i64 0, i64 %37
  %39 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @cin, ptr noundef nonnull align 4 dereferenceable(4) %38)
  br label %40

40:                                               ; preds = %32
  %41 = load i32, ptr %6, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %6, align 4, !tbaa !5
  br label %27, !llvm.loop !9

43:                                               ; preds = %31
  br label %44

44:                                               ; preds = %43
  %45 = load i32, ptr %4, align 4, !tbaa !5
  %46 = add nsw i32 %45, -1
  store i32 %46, ptr %4, align 4, !tbaa !5
  br label %22, !llvm.loop !11

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

48:                                               ; preds = %76, %47
  %49 = load i32, ptr %7, align 4, !tbaa !5
  %50 = load i32, ptr %3, align 4, !tbaa !5
  %51 = icmp slt i32 %49, %50
  br i1 %51, label %53, label %52

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

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

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

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

59:                                               ; preds = %54
  %60 = load i32, ptr %8, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [50 x [50 x i32]], ptr @comp, i64 0, i64 %61
  %63 = load i32, ptr %7, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [50 x i32], ptr %62, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = icmp eq i32 %66, 0
  br i1 %67, label %68, label %71

68:                                               ; preds = %59
  %69 = load i32, ptr %8, align 4, !tbaa !5
  %70 = load i32, ptr %7, align 4, !tbaa !5
  call void @_Z10flood_fillii(i32 noundef %69, i32 noundef %70)
  br label %71

71:                                               ; preds = %68, %59
  br label %72

72:                                               ; preds = %71
  %73 = load i32, ptr %8, align 4, !tbaa !5
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %8, align 4, !tbaa !5
  br label %54, !llvm.loop !12

75:                                               ; preds = %58
  br label %76

76:                                               ; preds = %75
  %77 = load i32, ptr %7, align 4, !tbaa !5
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %7, align 4, !tbaa !5
  br label %48, !llvm.loop !13

79:                                               ; preds = %52
  %80 = load i32, ptr @num, align 4, !tbaa !5
  %81 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @cout, i32 noundef %80)
  %82 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %81, ptr noundef @.str.4)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %83

83:                                               ; preds = %95, %79
  %84 = load i32, ptr %10, align 4, !tbaa !5
  %85 = load i32, ptr @num, align 4, !tbaa !5
  %86 = add nsw i32 %85, 1
  %87 = icmp slt i32 %84, %86
  br i1 %87, label %89, label %88

88:                                               ; preds = %83
  store i32 14, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  br label %98

89:                                               ; preds = %83
  %90 = load i32, ptr %10, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [2501 x i32], ptr @sz, i64 0, i64 %91
  %93 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %92)
  %94 = load i32, ptr %93, align 4, !tbaa !5
  store i32 %94, ptr %9, align 4, !tbaa !5
  br label %95

95:                                               ; preds = %89
  %96 = load i32, ptr %10, align 4, !tbaa !5
  %97 = add nsw i32 %96, 1
  store i32 %97, ptr %10, align 4, !tbaa !5
  br label %83, !llvm.loop !14

98:                                               ; preds = %88
  %99 = load i32, ptr %9, align 4, !tbaa !5
  %100 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @cout, i32 noundef %99)
  %101 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %100, ptr noundef @.str.4)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %102

102:                                              ; preds = %244, %98
  %103 = load i32, ptr %11, align 4, !tbaa !5
  %104 = load i32, ptr %2, align 4, !tbaa !5
  %105 = icmp slt i32 %103, %104
  br i1 %105, label %107, label %106

106:                                              ; preds = %102
  store i32 17, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  br label %247

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

108:                                              ; preds = %240, %107
  %109 = load i32, ptr %12, align 4, !tbaa !5
  %110 = load i32, ptr %3, align 4, !tbaa !5
  %111 = icmp slt i32 %109, %110
  br i1 %111, label %113, label %112

112:                                              ; preds = %108
  store i32 20, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %243

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

114:                                              ; preds = %236, %113
  %115 = load i32, ptr %13, align 4, !tbaa !5
  %116 = icmp slt i32 %115, 4
  br i1 %116, label %118, label %117

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

118:                                              ; preds = %114
  %119 = load i32, ptr %11, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [50 x [50 x i32]], ptr @ar, i64 0, i64 %120
  %122 = load i32, ptr %12, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [50 x i32], ptr %121, i64 0, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !5
  %126 = load i32, ptr %13, align 4, !tbaa !5
  %127 = shl i32 1, %126
  %128 = and i32 %125, %127
  %129 = icmp ne i32 %128, 0
  br i1 %129, label %130, label %235

130:                                              ; preds = %118
  %131 = load i32, ptr %11, align 4, !tbaa !5
  %132 = load i32, ptr %13, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [4 x i32], ptr @xdir, i64 0, i64 %133
  %135 = load i32, ptr %134, align 4, !tbaa !5
  %136 = add nsw i32 %131, %135
  %137 = icmp sge i32 %136, 0
  br i1 %137, label %138, label %234

138:                                              ; preds = %130
  %139 = load i32, ptr %11, align 4, !tbaa !5
  %140 = load i32, ptr %13, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [4 x i32], ptr @xdir, i64 0, i64 %141
  %143 = load i32, ptr %142, align 4, !tbaa !5
  %144 = add nsw i32 %139, %143
  %145 = load i32, ptr %2, align 4, !tbaa !5
  %146 = icmp slt i32 %144, %145
  br i1 %146, label %147, label %234

147:                                              ; preds = %138
  %148 = load i32, ptr %12, align 4, !tbaa !5
  %149 = load i32, ptr %13, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [4 x i32], ptr @ydir, i64 0, i64 %150
  %152 = load i32, ptr %151, align 4, !tbaa !5
  %153 = add nsw i32 %148, %152
  %154 = icmp sge i32 %153, 0
  br i1 %154, label %155, label %233

155:                                              ; preds = %147
  %156 = load i32, ptr %12, align 4, !tbaa !5
  %157 = load i32, ptr %13, align 4, !tbaa !5
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [4 x i32], ptr @ydir, i64 0, i64 %158
  %160 = load i32, ptr %159, align 4, !tbaa !5
  %161 = add nsw i32 %156, %160
  %162 = load i32, ptr %3, align 4, !tbaa !5
  %163 = icmp slt i32 %161, %162
  br i1 %163, label %164, label %233

164:                                              ; preds = %155
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  %165 = load i32, ptr %11, align 4, !tbaa !5
  %166 = load i32, ptr %13, align 4, !tbaa !5
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [4 x i32], ptr @xdir, i64 0, i64 %167
  %169 = load i32, ptr %168, align 4, !tbaa !5
  %170 = add nsw i32 %165, %169
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [50 x [50 x i32]], ptr @comp, i64 0, i64 %171
  %173 = load i32, ptr %12, align 4, !tbaa !5
  %174 = load i32, ptr %13, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [4 x i32], ptr @ydir, i64 0, i64 %175
  %177 = load i32, ptr %176, align 4, !tbaa !5
  %178 = add nsw i32 %173, %177
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [50 x i32], ptr %172, i64 0, i64 %179
  %181 = load i32, ptr %180, align 4, !tbaa !5
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [2501 x i32], ptr @sz, i64 0, i64 %182
  %184 = load i32, ptr %183, align 4, !tbaa !5
  store i32 %184, ptr %14, align 4, !tbaa !5
  %185 = load i32, ptr %11, align 4, !tbaa !5
  %186 = load i32, ptr %13, align 4, !tbaa !5
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [4 x i32], ptr @xdir, i64 0, i64 %187
  %189 = load i32, ptr %188, align 4, !tbaa !5
  %190 = add nsw i32 %185, %189
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [50 x [50 x i32]], ptr @comp, i64 0, i64 %191
  %193 = load i32, ptr %12, align 4, !tbaa !5
  %194 = load i32, ptr %13, align 4, !tbaa !5
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [4 x i32], ptr @ydir, i64 0, i64 %195
  %197 = load i32, ptr %196, align 4, !tbaa !5
  %198 = add nsw i32 %193, %197
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [50 x i32], ptr %192, i64 0, i64 %199
  %201 = load i32, ptr %200, align 4, !tbaa !5
  %202 = load i32, ptr %11, align 4, !tbaa !5
  %203 = sext i32 %202 to i64
  %204 = getelementptr inbounds [50 x [50 x i32]], ptr @comp, i64 0, i64 %203
  %205 = load i32, ptr %12, align 4, !tbaa !5
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds [50 x i32], ptr %204, i64 0, i64 %206
  %208 = load i32, ptr %207, align 4, !tbaa !5
  %209 = icmp ne i32 %201, %208
  br i1 %209, label %210, label %223

210:                                              ; preds = %164
  %211 = load i32, ptr %11, align 4, !tbaa !5
  %212 = sext i32 %211 to i64
  %213 = getelementptr inbounds [50 x [50 x i32]], ptr @comp, i64 0, i64 %212
  %214 = load i32, ptr %12, align 4, !tbaa !5
  %215 = sext i32 %214 to i64
  %216 = getelementptr inbounds [50 x i32], ptr %213, i64 0, i64 %215
  %217 = load i32, ptr %216, align 4, !tbaa !5
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds [2501 x i32], ptr @sz, i64 0, i64 %218
  %220 = load i32, ptr %219, align 4, !tbaa !5
  %221 = load i32, ptr %14, align 4, !tbaa !5
  %222 = add nsw i32 %221, %220
  store i32 %222, ptr %14, align 4, !tbaa !5
  br label %223

223:                                              ; preds = %210, %164
  %224 = load i32, ptr %14, align 4, !tbaa !5
  %225 = load i32, ptr @mpos, align 4, !tbaa !5
  %226 = icmp sgt i32 %224, %225
  br i1 %226, label %227, label %232

227:                                              ; preds = %223
  call void @llvm.lifetime.start.p0(i64 12, ptr %15) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  %228 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %12)
  store i64 %228, ptr %16, align 4
  %229 = call { i64, i32 } @_ZSt9make_pairISt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(8) %16, ptr noundef nonnull align 4 dereferenceable(4) %13)
  store { i64, i32 } %229, ptr %17, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 8 %17, i64 12, i1 false)
  %230 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt4pairIS_IiiEiEaSEOS1_(ptr noundef nonnull align 4 dereferenceable(12) @cans, ptr noundef nonnull align 4 dereferenceable(12) %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %15) #8
  %231 = load i32, ptr %14, align 4, !tbaa !5
  store i32 %231, ptr @mpos, align 4, !tbaa !5
  br label %232

232:                                              ; preds = %227, %223
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  br label %233

233:                                              ; preds = %232, %155, %147
  br label %234

234:                                              ; preds = %233, %138, %130
  br label %235

235:                                              ; preds = %234, %118
  br label %236

236:                                              ; preds = %235
  %237 = load i32, ptr %13, align 4, !tbaa !5
  %238 = add nsw i32 %237, 1
  store i32 %238, ptr %13, align 4, !tbaa !5
  br label %114, !llvm.loop !15

239:                                              ; preds = %117
  br label %240

240:                                              ; preds = %239
  %241 = load i32, ptr %12, align 4, !tbaa !5
  %242 = add nsw i32 %241, 1
  store i32 %242, ptr %12, align 4, !tbaa !5
  br label %108, !llvm.loop !16

243:                                              ; preds = %112
  br label %244

244:                                              ; preds = %243
  %245 = load i32, ptr %11, align 4, !tbaa !5
  %246 = add nsw i32 %245, 1
  store i32 %246, ptr %11, align 4, !tbaa !5
  br label %102, !llvm.loop !17

247:                                              ; preds = %106
  %248 = load i32, ptr @mpos, align 4, !tbaa !5
  %249 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @cout, i32 noundef %248)
  %250 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %249, ptr noundef @.str.4)
  %251 = load i32, ptr %3, align 4, !tbaa !5
  %252 = load i32, ptr getelementptr inbounds (%"struct.std::pair", ptr @cans, i32 0, i32 1), align 4, !tbaa !18
  %253 = sub nsw i32 %251, %252
  %254 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @cout, i32 noundef %253)
  %255 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %254, ptr noundef @.str.5)
  %256 = load i32, ptr @cans, align 4, !tbaa !21
  %257 = add nsw i32 %256, 1
  %258 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %255, i32 noundef %257)
  %259 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %258, ptr noundef @.str.5)
  %260 = load i32, ptr getelementptr inbounds (%"struct.std::pair.0", ptr @cans, i32 0, i32 1), align 4, !tbaa !22
  %261 = sext i32 %260 to i64
  %262 = getelementptr inbounds [4 x i8], ptr @dir, i64 0, i64 %261
  %263 = load i8, ptr %262, align 1, !tbaa !23
  %264 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %259, i8 noundef signext %263)
  %265 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %264, ptr noundef @.str.4)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  %266 = load i32, ptr %1, align 4
  ret i32 %266
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #4

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #5

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #4

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

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i32 } @_ZSt9make_pairISt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt4pairIS_IiiEiEaSEOS1_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #7 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #5

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { inlinehint 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 #6 = { 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 #7 = { 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 #8 = { nounwind }

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

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


; 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"

%"class.std::basic_ifstream" = type { %"class.std::basic_istream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_istream.base" = type { ptr, i64 }
%"class.std::basic_filebuf" = type { %"class.std::basic_streambuf", %union.pthread_mutex_t, %"class.std::__basic_file", i32, %struct.__mbstate_t, %struct.__mbstate_t, %struct.__mbstate_t, ptr, i64, i8, i8, i8, i8, ptr, ptr, i8, ptr, ptr, i64, ptr, ptr }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::__basic_file" = type <{ ptr, i8, [7 x i8] }>
%struct.__mbstate_t = type { i32, %union.anon }
%union.anon = type { i32 }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::basic_ofstream" = type { %"class.std::basic_ostream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }
%"struct.std::pair.0" = type { %"struct.std::pair", i32 }
%"struct.std::pair" = type { i32, i32 }

@cin = external dso_local global %"class.std::basic_ifstream", align 8
@cout = external dso_local global %"class.std::basic_ofstream", align 8
@ar = external dso_local global [50 x [50 x i32]], align 16
@comp = external dso_local local_unnamed_addr global [50 x [50 x i32]], align 16
@sz = external dso_local global [2501 x i32], align 16
@num = external dso_local local_unnamed_addr global i32, align 4
@mpos = external dso_local local_unnamed_addr global i32, align 4
@cans = external dso_local global %"struct.std::pair.0", align 4
@xdir = external dso_local local_unnamed_addr global [4 x i32], align 16
@ydir = external dso_local local_unnamed_addr global [4 x i32], align 16
@dir = external dso_local local_unnamed_addr global [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

; Function Attrs: mustprogress 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() local_unnamed_addr #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 %"struct.std::pair.0", align 8
  %8 = alloca %"struct.std::pair", align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %9 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %10 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %11 = load i32, ptr %2, align 4, !tbaa !5
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.preheader38.lr.ph, label %._crit_edge45

.preheader38.lr.ph:                               ; preds = %0
  %13 = load i32, ptr %1, align 4, !tbaa !5
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.preheader38.preheader, label %._crit_edge45

.preheader38.preheader:                           ; preds = %.preheader38.lr.ph
  %.040 = add nsw i32 %11, -1
  %15 = zext nneg i32 %.040 to i64
  br label %.preheader38

.loopexit:                                        ; preds = %.lr.ph, %.preheader38
  %16 = phi i32 [ %18, %.preheader38 ], [ %24, %.lr.ph ]
  %indvars.iv.next62 = add nsw i64 %indvars.iv61, -1
  %17 = icmp sgt i64 %indvars.iv61, 0
  br i1 %17, label %.preheader38, label %.preheader37, !llvm.loop !9

.preheader38:                                     ; preds = %.preheader38.preheader, %.loopexit
  %18 = phi i32 [ %13, %.preheader38.preheader ], [ %16, %.loopexit ]
  %indvars.iv61 = phi i64 [ %15, %.preheader38.preheader ], [ %indvars.iv.next62, %.loopexit ]
  %19 = icmp sgt i32 %18, 0
  br i1 %19, label %.lr.ph, label %.loopexit

.preheader37:                                     ; preds = %.loopexit
  %.pre = load i32, ptr %2, align 4, !tbaa !5
  %20 = icmp sgt i32 %.pre, 0
  %.pr = load i32, ptr %1, align 4
  %21 = icmp sgt i32 %.pr, 0
  %or.cond82 = select i1 %20, i1 %21, i1 false
  br i1 %or.cond82, label %.preheader, label %._crit_edge45

.lr.ph:                                           ; preds = %.preheader38, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader38 ]
  %22 = getelementptr inbounds [50 x [50 x i32]], ptr @ar, i64 0, i64 %indvars.iv, i64 %indvars.iv61
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @cin, ptr noundef nonnull align 4 dereferenceable(4) %22)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %24 = load i32, ptr %1, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = icmp slt i64 %indvars.iv.next, %25
  br i1 %26, label %.lr.ph, label %.loopexit, !llvm.loop !12

.preheader:                                       ; preds = %.preheader37, %._crit_edge
  %27 = phi i32 [ %36, %._crit_edge ], [ %.pre, %.preheader37 ]
  %28 = phi i32 [ %37, %._crit_edge ], [ %.pr, %.preheader37 ]
  %29 = phi i32 [ %38, %._crit_edge ], [ %.pr, %.preheader37 ]
  %indvars.iv67 = phi i64 [ %indvars.iv.next68, %._crit_edge ], [ 0, %.preheader37 ]
  %30 = icmp sgt i32 %29, 0
  br i1 %30, label %.lr.ph43, label %._crit_edge

.lr.ph43:                                         ; preds = %.preheader
  %31 = trunc nuw nsw i64 %indvars.iv67 to i32
  br label %41

._crit_edge45:                                    ; preds = %._crit_edge, %.preheader38.lr.ph, %0, %.preheader37
  %32 = load i32, ptr @num, align 4, !tbaa !5
  %33 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @cout, i32 noundef %32)
  %34 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %33, ptr noundef nonnull @.str.4)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  store i32 0, ptr %3, align 4, !tbaa !5
  %35 = load i32, ptr @num, align 4, !tbaa !5
  %.not46 = icmp slt i32 %35, 1
  br i1 %.not46, label %._crit_edge50, label %.lr.ph49

._crit_edge.loopexit:                             ; preds = %48
  %.pre74 = load i32, ptr %2, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %36 = phi i32 [ %.pre74, %._crit_edge.loopexit ], [ %27, %.preheader ]
  %37 = phi i32 [ %49, %._crit_edge.loopexit ], [ %28, %.preheader ]
  %38 = phi i32 [ %49, %._crit_edge.loopexit ], [ %29, %.preheader ]
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %39 = sext i32 %36 to i64
  %40 = icmp slt i64 %indvars.iv.next68, %39
  br i1 %40, label %.preheader, label %._crit_edge45, !llvm.loop !13

41:                                               ; preds = %.lr.ph43, %48
  %42 = phi i32 [ %28, %.lr.ph43 ], [ %49, %48 ]
  %indvars.iv64 = phi i64 [ 0, %.lr.ph43 ], [ %indvars.iv.next65, %48 ]
  %43 = getelementptr inbounds [50 x [50 x i32]], ptr @comp, i64 0, i64 %indvars.iv64, i64 %indvars.iv67
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = icmp eq i32 %44, 0
  br i1 %45, label %46, label %48

46:                                               ; preds = %41
  %47 = trunc nuw nsw i64 %indvars.iv64 to i32
  call void @_Z10flood_fillii(i32 noundef %47, i32 noundef %31)
  %.pre73 = load i32, ptr %1, align 4, !tbaa !5
  br label %48

48:                                               ; preds = %41, %46
  %49 = phi i32 [ %42, %41 ], [ %.pre73, %46 ]
  %indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
  %50 = sext i32 %49 to i64
  %51 = icmp slt i64 %indvars.iv.next65, %50
  br i1 %51, label %41, label %._crit_edge.loopexit, !llvm.loop !14

._crit_edge50:                                    ; preds = %.lr.ph49, %._crit_edge45
  %52 = phi i32 [ 0, %._crit_edge45 ], [ %61, %.lr.ph49 ]
  %53 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @cout, i32 noundef %52)
  %54 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %53, ptr noundef nonnull @.str.4)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  store i32 0, ptr %4, align 4, !tbaa !5
  %55 = load i32, ptr %1, align 4, !tbaa !5
  %56 = icmp sgt i32 %55, 0
  br i1 %56, label %.lr.ph56, label %._crit_edge57

.lr.ph56:                                         ; preds = %._crit_edge50
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %7, i64 8
  %57 = load i32, ptr %2, align 4, !tbaa !5
  %58 = icmp sgt i32 %57, 0
  br i1 %58, label %.lr.ph56.split, label %._crit_edge57

.lr.ph49:                                         ; preds = %._crit_edge45, %.lr.ph49
  %indvars.iv70 = phi i64 [ %indvars.iv.next71, %.lr.ph49 ], [ 1, %._crit_edge45 ]
  %59 = getelementptr inbounds [2501 x i32], ptr @sz, i64 0, i64 %indvars.iv70
  %60 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %59)
  %61 = load i32, ptr %60, align 4, !tbaa !5
  store i32 %61, ptr %3, align 4, !tbaa !5
  %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
  %62 = load i32, ptr @num, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %.not.not = icmp slt i64 %indvars.iv70, %63
  br i1 %.not.not, label %.lr.ph49, label %._crit_edge50, !llvm.loop !15

._crit_edge57:                                    ; preds = %._crit_edge54, %.lr.ph56, %._crit_edge50
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  %64 = load i32, ptr @mpos, align 4, !tbaa !5
  %65 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @cout, i32 noundef %64)
  %66 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %65, ptr noundef nonnull @.str.4)
  %67 = load i32, ptr %2, align 4, !tbaa !5
  %68 = load i32, ptr getelementptr inbounds (i8, ptr @cans, i64 4), align 4, !tbaa !16
  %69 = sub nsw i32 %67, %68
  %70 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @cout, i32 noundef %69)
  %71 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %70, ptr noundef nonnull @.str.5)
  %72 = load i32, ptr @cans, align 4, !tbaa !19
  %73 = add nsw i32 %72, 1
  %74 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %71, i32 noundef %73)
  %75 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %74, ptr noundef nonnull @.str.5)
  %76 = load i32, ptr getelementptr inbounds (i8, ptr @cans, i64 8), align 4, !tbaa !20
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [4 x i8], ptr @dir, i64 0, i64 %77
  %79 = load i8, ptr %78, align 1, !tbaa !21
  %80 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %75, i8 noundef signext %79)
  %81 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %80, ptr noundef nonnull @.str.4)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret i32 0

.lr.ph56.split:                                   ; preds = %.lr.ph56, %._crit_edge54
  %82 = phi i32 [ %86, %._crit_edge54 ], [ %55, %.lr.ph56 ]
  %83 = phi i32 [ %89, %._crit_edge54 ], [ 0, %.lr.ph56 ]
  %84 = phi i32 [ %88, %._crit_edge54 ], [ %57, %.lr.ph56 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  store i32 0, ptr %5, align 4, !tbaa !5
  %85 = icmp sgt i32 %84, 0
  br i1 %85, label %.lr.ph53, label %._crit_edge54

._crit_edge54.loopexit:                           ; preds = %91
  %.pre76 = load i32, ptr %4, align 4, !tbaa !5
  %.pre77 = load i32, ptr %1, align 4, !tbaa !5
  br label %._crit_edge54

._crit_edge54:                                    ; preds = %._crit_edge54.loopexit, %.lr.ph56.split
  %86 = phi i32 [ %.pre77, %._crit_edge54.loopexit ], [ %82, %.lr.ph56.split ]
  %87 = phi i32 [ %.pre76, %._crit_edge54.loopexit ], [ %83, %.lr.ph56.split ]
  %88 = phi i32 [ %94, %._crit_edge54.loopexit ], [ %84, %.lr.ph56.split ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  %89 = add nsw i32 %87, 1
  store i32 %89, ptr %4, align 4, !tbaa !5
  %90 = icmp slt i32 %89, %86
  br i1 %90, label %.lr.ph56.split, label %._crit_edge57, !llvm.loop !22

.lr.ph53:                                         ; preds = %.lr.ph56.split, %91
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %96

91:                                               ; preds = %142
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  %92 = load i32, ptr %5, align 4, !tbaa !5
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %5, align 4, !tbaa !5
  %94 = load i32, ptr %2, align 4, !tbaa !5
  %95 = icmp slt i32 %93, %94
  br i1 %95, label %.lr.ph53, label %._crit_edge54.loopexit, !llvm.loop !23

96:                                               ; preds = %.lr.ph53, %142
  %storemerge3151 = phi i32 [ 0, %.lr.ph53 ], [ %144, %142 ]
  %97 = load i32, ptr %4, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = load i32, ptr %5, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [50 x [50 x i32]], ptr @ar, i64 0, i64 %98, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = shl nuw nsw i32 1, %storemerge3151
  %104 = and i32 %102, %103
  %.not32 = icmp eq i32 %104, 0
  br i1 %.not32, label %142, label %105

105:                                              ; preds = %96
  %106 = sext i32 %storemerge3151 to i64
  %107 = getelementptr inbounds [4 x i32], ptr @xdir, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = add nsw i32 %108, %97
  %110 = icmp sgt i32 %109, -1
  %111 = load i32, ptr %1, align 4
  %112 = icmp slt i32 %109, %111
  %or.cond = select i1 %110, i1 %112, i1 false
  br i1 %or.cond, label %113, label %142

113:                                              ; preds = %105
  %114 = getelementptr inbounds [4 x i32], ptr @ydir, i64 0, i64 %106
  %115 = load i32, ptr %114, align 4, !tbaa !5
  %116 = add nsw i32 %115, %99
  %117 = icmp sgt i32 %116, -1
  %118 = load i32, ptr %2, align 4
  %119 = icmp slt i32 %116, %118
  %or.cond36 = select i1 %117, i1 %119, i1 false
  br i1 %or.cond36, label %120, label %142

120:                                              ; preds = %113
  %121 = zext nneg i32 %109 to i64
  %122 = zext nneg i32 %116 to i64
  %123 = getelementptr inbounds [50 x [50 x i32]], ptr @comp, i64 0, i64 %121, i64 %122
  %124 = load i32, ptr %123, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [2501 x i32], ptr @sz, i64 0, i64 %125
  %127 = load i32, ptr %126, align 4, !tbaa !5
  %128 = getelementptr inbounds [50 x [50 x i32]], ptr @comp, i64 0, i64 %98, i64 %100
  %129 = load i32, ptr %128, align 4, !tbaa !5
  %.not33 = icmp eq i32 %124, %129
  br i1 %.not33, label %135, label %130

130:                                              ; preds = %120
  %131 = sext i32 %129 to i64
  %132 = getelementptr inbounds [2501 x i32], ptr @sz, i64 0, i64 %131
  %133 = load i32, ptr %132, align 4, !tbaa !5
  %134 = add nsw i32 %133, %127
  br label %135

135:                                              ; preds = %130, %120
  %.021 = phi i32 [ %134, %130 ], [ %127, %120 ]
  %136 = load i32, ptr @mpos, align 4, !tbaa !5
  %137 = icmp sgt i32 %.021, %136
  br i1 %137, label %138, label %142

138:                                              ; preds = %135
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %7) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #7
  %139 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  store i64 %139, ptr %8, align 8
  %140 = call { i64, i32 } @_ZSt9make_pairISt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(8) %8, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %.fca.0.extract = extractvalue { i64, i32 } %140, 0
  %.fca.1.extract = extractvalue { i64, i32 } %140, 1
  store i64 %.fca.0.extract, ptr %7, align 8
  store i32 %.fca.1.extract, ptr %.sroa.2.0..sroa_idx, align 8
  %141 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt4pairIS_IiiEiEaSEOS1_(ptr noundef nonnull align 4 dereferenceable(12) @cans, ptr noundef nonnull align 4 dereferenceable(12) %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %7) #7
  store i32 %.021, ptr @mpos, align 4, !tbaa !5
  %.pre75 = load i32, ptr %6, align 4, !tbaa !5
  br label %142

142:                                              ; preds = %135, %138, %96, %113, %105
  %143 = phi i32 [ %storemerge3151, %135 ], [ %.pre75, %138 ], [ %storemerge3151, %96 ], [ %storemerge3151, %113 ], [ %storemerge3151, %105 ]
  %144 = add nsw i32 %143, 1
  store i32 %144, ptr %6, align 4, !tbaa !5
  %145 = icmp slt i32 %143, 3
  br i1 %145, label %96, label %91, !llvm.loop !24
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #4

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 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 #5

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i32 } @_ZSt9make_pairISt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt4pairIS_IiiEiEaSEOS1_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #6 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #4

attributes #0 = { 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 #1 = { mustprogress 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 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 = { 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 #6 = { 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 #7 = { 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, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.unswitch.partial.disable"}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = !{!17, !6, i64 4}
!17 = !{!"_ZTSSt4pairIS_IiiEiE", !18, i64 0, !6, i64 8}
!18 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!19 = !{!17, !6, i64 0}
!20 = !{!17, !6, i64 8}
!21 = !{!7, !7, i64 0}
!22 = distinct !{!22, !10, !11}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}


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