; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/192 Division 1/Problem A (A)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"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::locale" = type { ptr }
%"struct.std::pair" = type { i32, i32 }

@n = external dso_local global i32, align 4
@grid = external dso_local global [101 x [101 x i32]], align 16
@row = external dso_local global i8, align 1
@col = external dso_local global i8, align 1
@res = external dso_local global %"class.std::vector", align 8
@_Z1sB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %"struct.std::pair", align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %16

16:                                               ; preds = %49, %0
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = load i32, ptr @n, align 4, !tbaa !5
  %19 = icmp slt i32 %17, %18
  br i1 %19, label %21, label %20

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

21:                                               ; preds = %16
  %22 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %23

23:                                               ; preds = %45, %21
  %24 = load i32, ptr %4, align 4, !tbaa !5
  %25 = load i32, ptr @n, align 4, !tbaa !5
  %26 = icmp slt i32 %24, %25
  br i1 %26, label %28, label %27

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

28:                                               ; preds = %23
  %29 = load i32, ptr %4, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %30)
  %32 = load i8, ptr %31, align 1, !tbaa !9
  %33 = sext i8 %32 to i32
  %34 = icmp eq i32 %33, 69
  br i1 %34, label %35, label %44

35:                                               ; preds = %28
  %36 = load i32, ptr %2, align 4, !tbaa !5
  %37 = add nsw i32 %36, 1
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [101 x [101 x i32]], ptr @grid, i64 0, i64 %38
  %40 = load i32, ptr %4, align 4, !tbaa !5
  %41 = add nsw i32 %40, 1
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [101 x i32], ptr %39, i64 0, i64 %42
  store i32 1, ptr %43, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %35, %28
  br label %45

45:                                               ; preds = %44
  %46 = load i32, ptr %4, align 4, !tbaa !5
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %4, align 4, !tbaa !5
  br label %23, !llvm.loop !10

48:                                               ; preds = %27
  br label %49

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

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

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

57:                                               ; preds = %53
  store i32 8, ptr %3, align 4
  br label %86

58:                                               ; preds = %53
  store i8 1, ptr @row, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %59

59:                                               ; preds = %75, %58
  %60 = load i32, ptr %6, align 4, !tbaa !5
  %61 = load i32, ptr @n, align 4, !tbaa !5
  %62 = icmp sle i32 %60, %61
  br i1 %62, label %64, label %63

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

64:                                               ; preds = %59
  %65 = load i32, ptr %5, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [101 x [101 x i32]], ptr @grid, i64 0, i64 %66
  %68 = load i32, ptr %6, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [101 x i32], ptr %67, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = icmp ne i32 %71, 1
  br i1 %72, label %73, label %74

73:                                               ; preds = %64
  store i8 0, ptr @row, align 1, !tbaa !13
  br label %74

74:                                               ; preds = %73, %64
  br label %75

75:                                               ; preds = %74
  %76 = load i32, ptr %6, align 4, !tbaa !5
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %6, align 4, !tbaa !5
  br label %59, !llvm.loop !15

78:                                               ; preds = %63
  %79 = load i8, ptr @row, align 1, !tbaa !13, !range !16, !noundef !17
  %80 = trunc i8 %79 to i1
  br i1 %80, label %81, label %82

81:                                               ; preds = %78
  store i32 8, ptr %3, align 4
  br label %86

82:                                               ; preds = %78
  br label %83

83:                                               ; preds = %82
  %84 = load i32, ptr %5, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %5, align 4, !tbaa !5
  br label %53, !llvm.loop !18

86:                                               ; preds = %81, %57
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %87

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

88:                                               ; preds = %118, %87
  %89 = load i32, ptr %7, align 4, !tbaa !5
  %90 = load i32, ptr @n, align 4, !tbaa !5
  %91 = icmp sle i32 %89, %90
  br i1 %91, label %93, label %92

92:                                               ; preds = %88
  store i32 14, ptr %3, align 4
  br label %121

93:                                               ; preds = %88
  store i8 1, ptr @col, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %94

94:                                               ; preds = %110, %93
  %95 = load i32, ptr %8, align 4, !tbaa !5
  %96 = load i32, ptr @n, align 4, !tbaa !5
  %97 = icmp sle i32 %95, %96
  br i1 %97, label %99, label %98

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

99:                                               ; preds = %94
  %100 = load i32, ptr %8, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [101 x [101 x i32]], ptr @grid, i64 0, i64 %101
  %103 = load i32, ptr %7, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [101 x i32], ptr %102, i64 0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = icmp ne i32 %106, 1
  br i1 %107, label %108, label %109

108:                                              ; preds = %99
  store i8 0, ptr @col, align 1, !tbaa !13
  br label %109

109:                                              ; preds = %108, %99
  br label %110

110:                                              ; preds = %109
  %111 = load i32, ptr %8, align 4, !tbaa !5
  %112 = add nsw i32 %111, 1
  store i32 %112, ptr %8, align 4, !tbaa !5
  br label %94, !llvm.loop !19

113:                                              ; preds = %98
  %114 = load i8, ptr @col, align 1, !tbaa !13, !range !16, !noundef !17
  %115 = trunc i8 %114 to i1
  br i1 %115, label %116, label %117

116:                                              ; preds = %113
  store i32 14, ptr %3, align 4
  br label %121

117:                                              ; preds = %113
  br label %118

118:                                              ; preds = %117
  %119 = load i32, ptr %7, align 4, !tbaa !5
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %7, align 4, !tbaa !5
  br label %88, !llvm.loop !20

121:                                              ; preds = %116, %92
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %122

122:                                              ; preds = %121
  %123 = load i8, ptr @row, align 1, !tbaa !13, !range !16, !noundef !17
  %124 = trunc i8 %123 to i1
  br i1 %124, label %125, label %130

125:                                              ; preds = %122
  %126 = load i8, ptr @col, align 1, !tbaa !13, !range !16, !noundef !17
  %127 = trunc i8 %126 to i1
  br i1 %127, label %128, label %130

128:                                              ; preds = %125
  %129 = call i32 @puts(ptr noundef @.str.3)
  store i32 0, ptr %1, align 4
  br label %225

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

131:                                              ; preds = %159, %130
  %132 = load i32, ptr %9, align 4, !tbaa !5
  %133 = load i32, ptr @n, align 4, !tbaa !5
  %134 = icmp sle i32 %132, %133
  br i1 %134, label %136, label %135

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

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

137:                                              ; preds = %154, %136
  %138 = load i32, ptr %10, align 4, !tbaa !5
  %139 = load i32, ptr @n, align 4, !tbaa !5
  %140 = icmp sle i32 %138, %139
  br i1 %140, label %142, label %141

141:                                              ; preds = %137
  store i32 23, ptr %3, align 4
  br label %157

142:                                              ; preds = %137
  %143 = load i32, ptr %9, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [101 x [101 x i32]], ptr @grid, i64 0, i64 %144
  %146 = load i32, ptr %10, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [101 x i32], ptr %145, i64 0, i64 %147
  %149 = load i32, ptr %148, align 4, !tbaa !5
  %150 = icmp eq i32 %149, 0
  br i1 %150, label %151, label %153

151:                                              ; preds = %142
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %152 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %10)
  store i64 %152, ptr %11, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) @res, ptr noundef nonnull align 4 dereferenceable(8) %11)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  store i32 23, ptr %3, align 4
  br label %157

153:                                              ; preds = %142
  br label %154

154:                                              ; preds = %153
  %155 = load i32, ptr %10, align 4, !tbaa !5
  %156 = add nsw i32 %155, 1
  store i32 %156, ptr %10, align 4, !tbaa !5
  br label %137, !llvm.loop !21

157:                                              ; preds = %151, %141
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %158

158:                                              ; preds = %157
  br label %159

159:                                              ; preds = %158
  %160 = load i32, ptr %9, align 4, !tbaa !5
  %161 = add nsw i32 %160, 1
  store i32 %161, ptr %9, align 4, !tbaa !5
  br label %131, !llvm.loop !22

162:                                              ; preds = %135
  %163 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @res) #5
  %164 = load i32, ptr @n, align 4, !tbaa !5
  %165 = sext i32 %164 to i64
  %166 = icmp ne i64 %163, %165
  br i1 %166, label %167, label %202

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

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

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

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

174:                                              ; preds = %193, %173
  %175 = load i32, ptr %13, align 4, !tbaa !5
  %176 = load i32, ptr @n, align 4, !tbaa !5
  %177 = icmp sle i32 %175, %176
  br i1 %177, label %179, label %178

178:                                              ; preds = %174
  store i32 29, ptr %3, align 4
  br label %196

179:                                              ; preds = %174
  %180 = load i32, ptr %13, align 4, !tbaa !5
  %181 = sext i32 %180 to i64
  %182 = getelementptr inbounds [101 x [101 x i32]], ptr @grid, i64 0, i64 %181
  %183 = load i32, ptr %12, align 4, !tbaa !5
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [101 x i32], ptr %182, i64 0, i64 %184
  %186 = load i32, ptr %185, align 4, !tbaa !5
  %187 = icmp eq i32 %186, 0
  br i1 %187, label %188, label %192

188:                                              ; preds = %179
  %189 = load i32, ptr %13, align 4, !tbaa !5
  %190 = load i32, ptr %12, align 4, !tbaa !5
  %191 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %189, i32 noundef %190)
  store i32 29, ptr %3, align 4
  br label %196

192:                                              ; preds = %179
  br label %193

193:                                              ; preds = %192
  %194 = load i32, ptr %13, align 4, !tbaa !5
  %195 = add nsw i32 %194, 1
  store i32 %195, ptr %13, align 4, !tbaa !5
  br label %174, !llvm.loop !23

196:                                              ; preds = %188, %178
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %197

197:                                              ; preds = %196
  br label %198

198:                                              ; preds = %197
  %199 = load i32, ptr %12, align 4, !tbaa !5
  %200 = add nsw i32 %199, 1
  store i32 %200, ptr %12, align 4, !tbaa !5
  br label %168, !llvm.loop !24

201:                                              ; preds = %172
  br label %224

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

203:                                              ; preds = %220, %202
  %204 = load i32, ptr %14, align 4, !tbaa !5
  %205 = load i32, ptr @n, align 4, !tbaa !5
  %206 = icmp slt i32 %204, %205
  br i1 %206, label %208, label %207

207:                                              ; preds = %203
  store i32 32, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %223

208:                                              ; preds = %203
  %209 = load i32, ptr %14, align 4, !tbaa !5
  %210 = sext i32 %209 to i64
  %211 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @res, i64 noundef %210) #5
  %212 = getelementptr inbounds %"struct.std::pair", ptr %211, i32 0, i32 0
  %213 = load i32, ptr %212, align 4, !tbaa !25
  %214 = load i32, ptr %14, align 4, !tbaa !5
  %215 = sext i32 %214 to i64
  %216 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @res, i64 noundef %215) #5
  %217 = getelementptr inbounds %"struct.std::pair", ptr %216, i32 0, i32 1
  %218 = load i32, ptr %217, align 4, !tbaa !27
  %219 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %213, i32 noundef %218)
  br label %220

220:                                              ; preds = %208
  %221 = load i32, ptr %14, align 4, !tbaa !5
  %222 = add nsw i32 %221, 1
  store i32 %222, ptr %14, align 4, !tbaa !5
  br label %203, !llvm.loop !28

223:                                              ; preds = %207
  br label %224

224:                                              ; preds = %223, %201
  store i32 0, ptr %1, align 4
  br label %225

225:                                              ; preds = %224, %128
  %226 = load i32, ptr %1, align 4
  ret i32 %226
}

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) #1

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #3 align 2

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

declare i32 @puts(ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(8)) #4 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #3 align 2

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress 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 = !{!"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 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = distinct !{!15, !11}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !11}
!19 = distinct !{!19, !11}
!20 = distinct !{!20, !11}
!21 = distinct !{!21, !11}
!22 = distinct !{!22, !11}
!23 = distinct !{!23, !11}
!24 = distinct !{!24, !11}
!25 = !{!26, !6, i64 0}
!26 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!27 = !{!26, !6, i64 4}
!28 = distinct !{!28, !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"

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"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::locale" = type { ptr }
%"struct.std::pair" = type { i32, i32 }

@n = external dso_local global i32, align 4
@grid = external dso_local local_unnamed_addr global [101 x [101 x i32]], align 16
@row = external dso_local local_unnamed_addr global i8, align 1
@col = external dso_local local_unnamed_addr global i8, align 1
@res = external dso_local global %"class.std::vector", align 8
@_Z1sB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"struct.std::pair", align 8
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph63, label %.thread

.preheader58:                                     ; preds = %._crit_edge
  %.not70 = icmp slt i32 %13, 1
  br i1 %.not70, label %.thread, label %.lr.ph67.preheader

.lr.ph67.preheader:                               ; preds = %.preheader58
  %7 = add nuw i32 %13, 1
  %wide.trip.count132 = zext i32 %7 to i64
  %8 = zext nneg i32 %13 to i64
  %min.iters.check = icmp ult i32 %13, 8
  %n.vec = and i64 %8, 2147483640
  %ind.end = or disjoint i64 %n.vec, 1
  %cmp.n = icmp eq i64 %n.vec, %8
  br label %.lr.ph67

.lr.ph63:                                         ; preds = %0, %._crit_edge
  %indvars.iv124 = phi i64 [ %12, %._crit_edge ], [ 0, %0 ]
  %9 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11)
  %10 = load i32, ptr @n, align 4, !tbaa !5
  %11 = icmp sgt i32 %10, 0
  %12 = add nuw nsw i64 %indvars.iv124, 1
  br i1 %11, label %.lr.ph, label %.lr.ph63.._crit_edge_crit_edge

.lr.ph63.._crit_edge_crit_edge:                   ; preds = %.lr.ph63
  %.pre164 = sext i32 %10 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge161, %.lr.ph63.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre164, %.lr.ph63.._crit_edge_crit_edge ], [ %22, %._crit_edge161 ]
  %13 = phi i32 [ %10, %.lr.ph63.._crit_edge_crit_edge ], [ %21, %._crit_edge161 ]
  %14 = icmp slt i64 %12, %.pre-phi
  br i1 %14, label %.lr.ph63, label %.preheader58, !llvm.loop !9

.lr.ph:                                           ; preds = %.lr.ph63, %._crit_edge161
  %indvars.iv = phi i64 [ %18, %._crit_edge161 ], [ 0, %.lr.ph63 ]
  %15 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %indvars.iv)
  %16 = load i8, ptr %15, align 1, !tbaa !11
  %17 = icmp eq i8 %16, 69
  %18 = add nuw nsw i64 %indvars.iv, 1
  br i1 %17, label %19, label %._crit_edge161

19:                                               ; preds = %.lr.ph
  %20 = getelementptr inbounds [101 x [101 x i32]], ptr @grid, i64 0, i64 %12, i64 %18
  store i32 1, ptr %20, align 4, !tbaa !5
  br label %._crit_edge161

._crit_edge161:                                   ; preds = %.lr.ph, %19
  %21 = load i32, ptr @n, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = icmp slt i64 %18, %22
  br i1 %23, label %.lr.ph, label %._crit_edge, !llvm.loop !12

24:                                               ; preds = %._crit_edge68
  %indvars.iv.next130 = add nuw nsw i64 %indvars.iv129, 1
  %exitcond133.not = icmp eq i64 %indvars.iv.next130, %wide.trip.count132
  br i1 %exitcond133.not, label %._crit_edge74, label %.lr.ph67, !llvm.loop !13

.lr.ph67:                                         ; preds = %.lr.ph67.preheader, %24
  %indvars.iv129 = phi i64 [ 1, %.lr.ph67.preheader ], [ %indvars.iv.next130, %24 ]
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.body

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph67
  %indvars.iv127.ph = phi i64 [ 1, %.lr.ph67 ], [ %ind.end, %middle.block ]
  %.ph209 = phi i8 [ 1, %.lr.ph67 ], [ %rdx.select, %middle.block ]
  br label %scalar.ph

vector.body:                                      ; preds = %.lr.ph67, %vector.body
  %index = phi i64 [ %index.next, %vector.body ], [ 0, %.lr.ph67 ]
  %vec.phi = phi <4 x i1> [ %29, %vector.body ], [ zeroinitializer, %.lr.ph67 ]
  %vec.phi183 = phi <4 x i1> [ %30, %vector.body ], [ zeroinitializer, %.lr.ph67 ]
  %offset.idx = or disjoint i64 %index, 1
  %25 = getelementptr inbounds [101 x [101 x i32]], ptr @grid, i64 0, i64 %indvars.iv129, i64 %offset.idx
  %26 = getelementptr inbounds i8, ptr %25, i64 16
  %wide.load = load <4 x i32>, ptr %25, align 4, !tbaa !5
  %wide.load184 = load <4 x i32>, ptr %26, align 4, !tbaa !5
  %27 = icmp ne <4 x i32> %wide.load, <i32 1, i32 1, i32 1, i32 1>
  %28 = icmp ne <4 x i32> %wide.load184, <i32 1, i32 1, i32 1, i32 1>
  %29 = or <4 x i1> %vec.phi, %27
  %30 = or <4 x i1> %vec.phi183, %28
  %index.next = add nuw i64 %index, 8
  %31 = icmp eq i64 %index.next, %n.vec
  br i1 %31, label %middle.block, label %vector.body, !llvm.loop !14

middle.block:                                     ; preds = %vector.body
  %bin.rdx = or <4 x i1> %30, %29
  %bin.rdx.fr = freeze <4 x i1> %bin.rdx
  %32 = bitcast <4 x i1> %bin.rdx.fr to i4
  %.not = icmp eq i4 %32, 0
  %rdx.select = zext i1 %.not to i8
  br i1 %cmp.n, label %._crit_edge68, label %scalar.ph.preheader

._crit_edge68:                                    ; preds = %scalar.ph, %middle.block
  %spec.select.lcssa = phi i8 [ %rdx.select, %middle.block ], [ %spec.select, %scalar.ph ]
  %33 = trunc nuw i8 %spec.select.lcssa to i1
  br i1 %33, label %37, label %24

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv127 = phi i64 [ %indvars.iv.next128, %scalar.ph ], [ %indvars.iv127.ph, %scalar.ph.preheader ]
  %34 = phi i8 [ %spec.select, %scalar.ph ], [ %.ph209, %scalar.ph.preheader ]
  %35 = getelementptr inbounds [101 x [101 x i32]], ptr @grid, i64 0, i64 %indvars.iv129, i64 %indvars.iv127
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %.not52 = icmp eq i32 %36, 1
  %spec.select = select i1 %.not52, i8 %34, i8 0
  %indvars.iv.next128 = add nuw nsw i64 %indvars.iv127, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next128, %wide.trip.count132
  br i1 %exitcond.not, label %._crit_edge68, label %scalar.ph, !llvm.loop !17

._crit_edge74:                                    ; preds = %24
  store i8 %spec.select.lcssa, ptr @row, align 1, !tbaa !18
  br i1 %.not70, label %.thread, label %.lr.ph82.preheader

37:                                               ; preds = %._crit_edge68
  store i8 %spec.select.lcssa, ptr @row, align 1, !tbaa !18
  br i1 %.not70, label %.thread, label %.lr.ph82.preheader

.lr.ph82.preheader:                               ; preds = %._crit_edge74, %37
  %38 = add nuw i32 %13, 1
  %wide.trip.count141 = zext i32 %38 to i64
  %39 = zext nneg i32 %13 to i64
  %min.iters.check187 = icmp ult i32 %13, 8
  %n.vec190 = and i64 %39, 2147483640
  %ind.end191 = or disjoint i64 %n.vec190, 1
  %cmp.n201 = icmp eq i64 %n.vec190, %39
  br label %.lr.ph82

.lr.ph82:                                         ; preds = %._crit_edge83, %.lr.ph82.preheader
  %indvars.iv138 = phi i64 [ 1, %.lr.ph82.preheader ], [ %indvars.iv.next139, %._crit_edge83 ]
  br i1 %min.iters.check187, label %scalar.ph186.preheader, label %vector.body193

scalar.ph186.preheader:                           ; preds = %middle.block185, %.lr.ph82
  %indvars.iv134.ph = phi i64 [ 1, %.lr.ph82 ], [ %ind.end191, %middle.block185 ]
  %.ph = phi i8 [ 1, %.lr.ph82 ], [ %rdx.select200, %middle.block185 ]
  br label %scalar.ph186

vector.body193:                                   ; preds = %.lr.ph82, %vector.body193
  %index194 = phi i64 [ %index.next198, %vector.body193 ], [ 0, %.lr.ph82 ]
  %vec.phi195 = phi <4 x i1> [ %73, %vector.body193 ], [ zeroinitializer, %.lr.ph82 ]
  %vec.phi196 = phi <4 x i1> [ %74, %vector.body193 ], [ zeroinitializer, %.lr.ph82 ]
  %offset.idx197 = or disjoint i64 %index194, 1
  %40 = or disjoint i64 %index194, 2
  %41 = or disjoint i64 %index194, 3
  %42 = or disjoint i64 %index194, 4
  %43 = or disjoint i64 %index194, 5
  %44 = or disjoint i64 %index194, 6
  %45 = or disjoint i64 %index194, 7
  %46 = add i64 %index194, 8
  %47 = getelementptr inbounds [101 x [101 x i32]], ptr @grid, i64 0, i64 %offset.idx197, i64 %indvars.iv138
  %48 = getelementptr inbounds [101 x [101 x i32]], ptr @grid, i64 0, i64 %40, i64 %indvars.iv138
  %49 = getelementptr inbounds [101 x [101 x i32]], ptr @grid, i64 0, i64 %41, i64 %indvars.iv138
  %50 = getelementptr inbounds [101 x [101 x i32]], ptr @grid, i64 0, i64 %42, i64 %indvars.iv138
  %51 = getelementptr inbounds [101 x [101 x i32]], ptr @grid, i64 0, i64 %43, i64 %indvars.iv138
  %52 = getelementptr inbounds [101 x [101 x i32]], ptr @grid, i64 0, i64 %44, i64 %indvars.iv138
  %53 = getelementptr inbounds [101 x [101 x i32]], ptr @grid, i64 0, i64 %45, i64 %indvars.iv138
  %54 = getelementptr inbounds [101 x [101 x i32]], ptr @grid, i64 0, i64 %46, i64 %indvars.iv138
  %55 = load i32, ptr %47, align 4, !tbaa !5
  %56 = load i32, ptr %48, align 4, !tbaa !5
  %57 = load i32, ptr %49, align 4, !tbaa !5
  %58 = load i32, ptr %50, align 4, !tbaa !5
  %59 = insertelement <4 x i32> poison, i32 %55, i64 0
  %60 = insertelement <4 x i32> %59, i32 %56, i64 1
  %61 = insertelement <4 x i32> %60, i32 %57, i64 2
  %62 = insertelement <4 x i32> %61, i32 %58, i64 3
  %63 = load i32, ptr %51, align 4, !tbaa !5
  %64 = load i32, ptr %52, align 4, !tbaa !5
  %65 = load i32, ptr %53, align 4, !tbaa !5
  %66 = load i32, ptr %54, align 4, !tbaa !5
  %67 = insertelement <4 x i32> poison, i32 %63, i64 0
  %68 = insertelement <4 x i32> %67, i32 %64, i64 1
  %69 = insertelement <4 x i32> %68, i32 %65, i64 2
  %70 = insertelement <4 x i32> %69, i32 %66, i64 3
  %71 = icmp ne <4 x i32> %62, <i32 1, i32 1, i32 1, i32 1>
  %72 = icmp ne <4 x i32> %70, <i32 1, i32 1, i32 1, i32 1>
  %73 = or <4 x i1> %vec.phi195, %71
  %74 = or <4 x i1> %vec.phi196, %72
  %index.next198 = add nuw i64 %index194, 8
  %75 = icmp eq i64 %index.next198, %n.vec190
  br i1 %75, label %middle.block185, label %vector.body193, !llvm.loop !20

middle.block185:                                  ; preds = %vector.body193
  %bin.rdx199 = or <4 x i1> %74, %73
  %bin.rdx199.fr = freeze <4 x i1> %bin.rdx199
  %76 = bitcast <4 x i1> %bin.rdx199.fr to i4
  %.not203 = icmp eq i4 %76, 0
  %rdx.select200 = zext i1 %.not203 to i8
  br i1 %cmp.n201, label %._crit_edge83, label %scalar.ph186.preheader

._crit_edge83:                                    ; preds = %scalar.ph186, %middle.block185
  %spec.select115.lcssa = phi i8 [ %rdx.select200, %middle.block185 ], [ %spec.select115, %scalar.ph186 ]
  %77 = trunc nuw i8 %spec.select115.lcssa to i1
  %indvars.iv.next139 = add nuw nsw i64 %indvars.iv138, 1
  %exitcond142.not = icmp eq i64 %indvars.iv.next139, %wide.trip.count141
  %or.cond = select i1 %77, i1 true, i1 %exitcond142.not
  br i1 %or.cond, label %.thread.sink.split, label %.lr.ph82, !llvm.loop !21

scalar.ph186:                                     ; preds = %scalar.ph186.preheader, %scalar.ph186
  %indvars.iv134 = phi i64 [ %indvars.iv.next135, %scalar.ph186 ], [ %indvars.iv134.ph, %scalar.ph186.preheader ]
  %78 = phi i8 [ %spec.select115, %scalar.ph186 ], [ %.ph, %scalar.ph186.preheader ]
  %79 = getelementptr inbounds [101 x [101 x i32]], ptr @grid, i64 0, i64 %indvars.iv134, i64 %indvars.iv138
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %.not51 = icmp eq i32 %80, 1
  %spec.select115 = select i1 %.not51, i8 %78, i8 0
  %indvars.iv.next135 = add nuw nsw i64 %indvars.iv134, 1
  %exitcond137.not = icmp eq i64 %indvars.iv.next135, %wide.trip.count141
  br i1 %exitcond137.not, label %._crit_edge83, label %scalar.ph186, !llvm.loop !22

.thread.sink.split:                               ; preds = %._crit_edge83
  store i8 %spec.select115.lcssa, ptr @col, align 1, !tbaa !18
  br label %.thread

.thread:                                          ; preds = %.thread.sink.split, %0, %.preheader58, %._crit_edge74, %37
  %81 = phi i32 [ %13, %37 ], [ %13, %._crit_edge74 ], [ %13, %.preheader58 ], [ %5, %0 ], [ %13, %.thread.sink.split ]
  %.not70166168 = phi i1 [ true, %37 ], [ true, %._crit_edge74 ], [ true, %.preheader58 ], [ true, %0 ], [ false, %.thread.sink.split ]
  %82 = load i8, ptr @row, align 1, !tbaa !18, !range !23, !noundef !24
  %83 = trunc nuw i8 %82 to i1
  br i1 %83, label %84, label %89

84:                                               ; preds = %.thread
  %85 = load i8, ptr @col, align 1, !tbaa !18, !range !23, !noundef !24
  %86 = trunc nuw i8 %85 to i1
  br i1 %86, label %87, label %89

87:                                               ; preds = %84
  %88 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %.loopexit

89:                                               ; preds = %84, %.thread
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  store i32 1, ptr %1, align 4, !tbaa !5
  br i1 %.not70166168, label %._crit_edge106, label %.lr.ph105

._crit_edge106:                                   ; preds = %.loopexit57, %89
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %90 = call noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @res) #6
  %91 = load i32, ptr @n, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %.not46 = icmp eq i64 %90, %92
  br i1 %.not46, label %.preheader, label %.preheader55

.preheader55:                                     ; preds = %._crit_edge106
  %.not47110 = icmp slt i32 %91, 1
  br i1 %.not47110, label %.loopexit, label %.preheader53

.preheader:                                       ; preds = %._crit_edge106
  %93 = icmp sgt i32 %91, 0
  br i1 %93, label %.lr.ph114, label %.loopexit

.lr.ph105:                                        ; preds = %89, %.loopexit57
  %94 = phi i32 [ %105, %.loopexit57 ], [ %81, %89 ]
  %storemerge103 = phi i32 [ %107, %.loopexit57 ], [ 1, %89 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %.not5097 = icmp slt i32 %94, 1
  br i1 %.not5097, label %.loopexit57, label %.lr.ph100

.lr.ph100:                                        ; preds = %.lr.ph105
  %95 = sext i32 %storemerge103 to i64
  %96 = add nuw i32 %94, 1
  %wide.trip.count146 = zext i32 %96 to i64
  br label %97

97:                                               ; preds = %.lr.ph100, %104
  %indvars.iv143 = phi i64 [ 1, %.lr.ph100 ], [ %indvars.iv.next144, %104 ]
  %98 = getelementptr inbounds [101 x [101 x i32]], ptr @grid, i64 0, i64 %95, i64 %indvars.iv143
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = icmp eq i32 %99, 0
  br i1 %100, label %101, label %104

101:                                              ; preds = %97
  %102 = trunc nuw nsw i64 %indvars.iv143 to i32
  store i32 %102, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %103 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
  store i64 %103, ptr %3, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) @res, ptr noundef nonnull align 4 dereferenceable(8) %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  %.pre = load i32, ptr %1, align 4, !tbaa !5
  %.pre159 = load i32, ptr @n, align 4, !tbaa !5
  br label %.loopexit57

104:                                              ; preds = %97
  %indvars.iv.next144 = add nuw nsw i64 %indvars.iv143, 1
  %exitcond147.not = icmp eq i64 %indvars.iv.next144, %wide.trip.count146
  br i1 %exitcond147.not, label %.loopexit57, label %97, !llvm.loop !25

.loopexit57:                                      ; preds = %104, %.lr.ph105, %101
  %105 = phi i32 [ %.pre159, %101 ], [ %94, %.lr.ph105 ], [ %94, %104 ]
  %106 = phi i32 [ %.pre, %101 ], [ %storemerge103, %.lr.ph105 ], [ %storemerge103, %104 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  %107 = add nsw i32 %106, 1
  store i32 %107, ptr %1, align 4, !tbaa !5
  %.not45.not = icmp slt i32 %106, %105
  br i1 %.not45.not, label %.lr.ph105, label %._crit_edge106, !llvm.loop !26

.preheader53:                                     ; preds = %.preheader55, %.loopexit54
  %108 = phi i32 [ %119, %.loopexit54 ], [ %91, %.preheader55 ]
  %indvars.iv153 = phi i64 [ %indvars.iv.next154, %.loopexit54 ], [ 1, %.preheader55 ]
  %.not48107 = icmp slt i32 %108, 1
  br i1 %.not48107, label %.loopexit54, label %.lr.ph109

.lr.ph109:                                        ; preds = %.preheader53
  %109 = add nuw i32 %108, 1
  %wide.trip.count151 = zext i32 %109 to i64
  br label %110

110:                                              ; preds = %.lr.ph109, %118
  %indvars.iv148 = phi i64 [ 1, %.lr.ph109 ], [ %indvars.iv.next149, %118 ]
  %111 = getelementptr inbounds [101 x [101 x i32]], ptr @grid, i64 0, i64 %indvars.iv148, i64 %indvars.iv153
  %112 = load i32, ptr %111, align 4, !tbaa !5
  %113 = icmp eq i32 %112, 0
  br i1 %113, label %114, label %118

114:                                              ; preds = %110
  %115 = trunc nuw nsw i64 %indvars.iv148 to i32
  %116 = trunc nuw nsw i64 %indvars.iv153 to i32
  %117 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %115, i32 noundef %116)
  %.pre160 = load i32, ptr @n, align 4, !tbaa !5
  br label %.loopexit54

118:                                              ; preds = %110
  %indvars.iv.next149 = add nuw nsw i64 %indvars.iv148, 1
  %exitcond152.not = icmp eq i64 %indvars.iv.next149, %wide.trip.count151
  br i1 %exitcond152.not, label %.loopexit54, label %110, !llvm.loop !27

.loopexit54:                                      ; preds = %118, %.preheader53, %114
  %119 = phi i32 [ %108, %.preheader53 ], [ %.pre160, %114 ], [ %108, %118 ]
  %indvars.iv.next154 = add nuw nsw i64 %indvars.iv153, 1
  %120 = sext i32 %119 to i64
  %.not47.not = icmp slt i64 %indvars.iv153, %120
  br i1 %.not47.not, label %.preheader53, label %.loopexit, !llvm.loop !28

.lr.ph114:                                        ; preds = %.preheader, %.lr.ph114
  %indvars.iv156 = phi i64 [ %indvars.iv.next157, %.lr.ph114 ], [ 0, %.preheader ]
  %121 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @res, i64 noundef %indvars.iv156) #6
  %122 = load i32, ptr %121, align 4, !tbaa !29
  %123 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @res, i64 noundef %indvars.iv156) #6
  %124 = getelementptr inbounds i8, ptr %123, i64 4
  %125 = load i32, ptr %124, align 4, !tbaa !31
  %126 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %122, i32 noundef %125)
  %indvars.iv.next157 = add nuw nsw i64 %indvars.iv156, 1
  %127 = load i32, ptr @n, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = icmp slt i64 %indvars.iv.next157, %128
  br i1 %129, label %.lr.ph114, label %.loopexit, !llvm.loop !32

.loopexit:                                        ; preds = %.loopexit54, %.lr.ph114, %.preheader55, %.preheader, %87
  ret i32 0
}

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #4 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #5 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorISt4pairIiiESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #4 align 2

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 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 = { 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 = { 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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !15, !16}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !10, !16, !15}
!18 = !{!19, !19, i64 0}
!19 = !{!"bool", !7, i64 0}
!20 = distinct !{!20, !10, !15, !16}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10, !16, !15}
!23 = !{i8 0, i8 2}
!24 = !{}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10}
!27 = distinct !{!27, !10}
!28 = distinct !{!28, !10}
!29 = !{!30, !6, i64 0}
!30 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!31 = !{!30, !6, i64 4}
!32 = distinct !{!32, !10}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalDCEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,SROAPass,SimplifyCFGPass,TailCallElimPass