; LLVM IR from VastoLorde95/Competitive-Programming :: Codejam/APAC 2017/Round A/Problem B/B.ll (Z5solvev)

; 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::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::pair.3" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@g = external dso_local global [51 x [51 x i32]], align 16
@w = external dso_local global [51 x [51 x i32]], align 16
@v = external dso_local global [51 x [51 x i32]], align 16
@comp = external dso_local global %"class.std::vector", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z9checkCompv() #2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::set", align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::pair.3", align 8
  %8 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %9 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %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 i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 48, ptr %1) #4
  call void @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %19

19:                                               ; preds = %78, %0
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = load i32, ptr @n, align 4, !tbaa !5
  %22 = icmp sle i32 %20, %21
  br i1 %22, label %24, label %23

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

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

25:                                               ; preds = %70, %24
  %26 = load i32, ptr %4, align 4, !tbaa !5
  %27 = load i32, ptr @m, align 4, !tbaa !5
  %28 = icmp sle i32 %26, %27
  br i1 %28, label %30, label %29

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

30:                                               ; preds = %25
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [51 x [51 x i32]], ptr @g, i64 0, i64 %32
  %34 = load i32, ptr %4, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [51 x i32], ptr %33, i64 0, i64 %35
  %37 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %36)
          to label %38 unwind label %73

38:                                               ; preds = %30
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [51 x [51 x i32]], ptr @g, i64 0, i64 %40
  %42 = load i32, ptr %4, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [51 x i32], ptr %41, i64 0, i64 %43
  %45 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 4 dereferenceable(4) %44)
          to label %46 unwind label %73

46:                                               ; preds = %38
  %47 = getelementptr inbounds { ptr, i8 }, ptr %7, i32 0, i32 0
  %48 = extractvalue { ptr, i8 } %45, 0
  store ptr %48, ptr %47, align 8
  %49 = getelementptr inbounds { ptr, i8 }, ptr %7, i32 0, i32 1
  %50 = extractvalue { ptr, i8 } %45, 1
  store i8 %50, ptr %49, align 8
  %51 = load i32, ptr %2, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [51 x [51 x i32]], ptr @g, i64 0, i64 %52
  %54 = load i32, ptr %4, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [51 x i32], ptr %53, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = load i32, ptr %2, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [51 x [51 x i32]], ptr @w, i64 0, i64 %59
  %61 = load i32, ptr %4, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [51 x i32], ptr %60, i64 0, i64 %62
  store i32 %57, ptr %63, align 4, !tbaa !5
  %64 = load i32, ptr %2, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [51 x [51 x i32]], ptr @v, i64 0, i64 %65
  %67 = load i32, ptr %4, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [51 x i32], ptr %66, i64 0, i64 %68
  store i32 0, ptr %69, align 4, !tbaa !5
  br label %70

70:                                               ; preds = %46
  %71 = load i32, ptr %4, align 4, !tbaa !5
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %4, align 4, !tbaa !5
  br label %25, !llvm.loop !9

73:                                               ; preds = %38, %30
  %74 = landingpad { ptr, i32 }
          cleanup
  %75 = extractvalue { ptr, i32 } %74, 0
  store ptr %75, ptr %5, align 8
  %76 = extractvalue { ptr, i32 } %74, 1
  store i32 %76, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %209

77:                                               ; preds = %29
  br label %78

78:                                               ; preds = %77
  %79 = load i32, ptr %2, align 4, !tbaa !5
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %2, align 4, !tbaa !5
  br label %19, !llvm.loop !11

81:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %82 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %1) #4
  %83 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %8, i32 0, i32 0
  store ptr %82, ptr %83, align 8
  br label %84

84:                                               ; preds = %162, %81
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %85 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %1) #4
  %86 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %9, i32 0, i32 0
  store ptr %85, ptr %86, align 8
  %87 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br i1 %87, label %89, label %88

88:                                               ; preds = %84
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %164

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

90:                                               ; preds = %112, %89
  %91 = load i32, ptr %10, align 4, !tbaa !5
  %92 = load i32, ptr @n, align 4, !tbaa !5
  %93 = icmp sle i32 %91, %92
  br i1 %93, label %95, label %94

94:                                               ; preds = %90
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %115

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

96:                                               ; preds = %108, %95
  %97 = load i32, ptr %11, align 4, !tbaa !5
  %98 = load i32, ptr @m, align 4, !tbaa !5
  %99 = icmp sle i32 %97, %98
  br i1 %99, label %101, label %100

100:                                              ; preds = %96
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %111

101:                                              ; preds = %96
  %102 = load i32, ptr %10, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [51 x [51 x i32]], ptr @v, i64 0, i64 %103
  %105 = load i32, ptr %11, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [51 x i32], ptr %104, i64 0, i64 %106
  store i32 0, ptr %107, align 4, !tbaa !5
  br label %108

108:                                              ; preds = %101
  %109 = load i32, ptr %11, align 4, !tbaa !5
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr %11, align 4, !tbaa !5
  br label %96, !llvm.loop !12

111:                                              ; preds = %100
  br label %112

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

115:                                              ; preds = %94
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 0, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 1, ptr %13, align 4, !tbaa !5
  br label %116

116:                                              ; preds = %158, %115
  %117 = load i32, ptr %13, align 4, !tbaa !5
  %118 = load i32, ptr @n, align 4, !tbaa !5
  %119 = icmp sle i32 %117, %118
  br i1 %119, label %121, label %120

120:                                              ; preds = %116
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %161

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

122:                                              ; preds = %154, %121
  %123 = load i32, ptr %14, align 4, !tbaa !5
  %124 = load i32, ptr @m, align 4, !tbaa !5
  %125 = icmp sle i32 %123, %124
  br i1 %125, label %127, label %126

126:                                              ; preds = %122
  store i32 20, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  br label %157

127:                                              ; preds = %122
  %128 = load i32, ptr %13, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [51 x [51 x i32]], ptr @v, i64 0, i64 %129
  %131 = load i32, ptr %14, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [51 x i32], ptr %130, i64 0, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = icmp ne i32 %134, 0
  br i1 %135, label %153, label %136

136:                                              ; preds = %127
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @comp) #4
  %137 = load i32, ptr %13, align 4, !tbaa !5
  %138 = load i32, ptr %14, align 4, !tbaa !5
  %139 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #4
  %140 = load i32, ptr %139, align 4, !tbaa !5
  %141 = load i32, ptr %12, align 4, !tbaa !5
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %12, align 4, !tbaa !5
  invoke void @_Z3dfsiiii(i32 noundef %137, i32 noundef %138, i32 noundef %140, i32 noundef %142)
          to label %143 unwind label %146

143:                                              ; preds = %136
  %144 = call noundef zeroext i1 @_Z9checkCompv()
  br i1 %144, label %150, label %145

145:                                              ; preds = %143
  br label %154

146:                                              ; preds = %150, %136
  %147 = landingpad { ptr, i32 }
          cleanup
  %148 = extractvalue { ptr, i32 } %147, 0
  store ptr %148, ptr %5, align 8
  %149 = extractvalue { ptr, i32 } %147, 1
  store i32 %149, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %209

150:                                              ; preds = %143
  %151 = load i32, ptr %12, align 4, !tbaa !5
  invoke void @_Z4getWi(i32 noundef %151)
          to label %152 unwind label %146

152:                                              ; preds = %150
  br label %153

153:                                              ; preds = %152, %127
  br label %154

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

157:                                              ; preds = %126
  br label %158

158:                                              ; preds = %157
  %159 = load i32, ptr %13, align 4, !tbaa !5
  %160 = add nsw i32 %159, 1
  store i32 %160, ptr %13, align 4, !tbaa !5
  br label %116, !llvm.loop !15

161:                                              ; preds = %120
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %162

162:                                              ; preds = %161
  %163 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorIiEppEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #4
  br label %84, !llvm.loop !16

164:                                              ; preds = %88
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  store i32 0, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  store i32 1, ptr %16, align 4, !tbaa !5
  br label %165

165:                                              ; preds = %198, %164
  %166 = load i32, ptr %16, align 4, !tbaa !5
  %167 = load i32, ptr @n, align 4, !tbaa !5
  %168 = icmp sle i32 %166, %167
  br i1 %168, label %170, label %169

169:                                              ; preds = %165
  store i32 23, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  br label %201

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

171:                                              ; preds = %194, %170
  %172 = load i32, ptr %17, align 4, !tbaa !5
  %173 = load i32, ptr @m, align 4, !tbaa !5
  %174 = icmp sle i32 %172, %173
  br i1 %174, label %176, label %175

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

176:                                              ; preds = %171
  %177 = load i32, ptr %16, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [51 x [51 x i32]], ptr @w, i64 0, i64 %178
  %180 = load i32, ptr %17, align 4, !tbaa !5
  %181 = sext i32 %180 to i64
  %182 = getelementptr inbounds [51 x i32], ptr %179, i64 0, i64 %181
  %183 = load i32, ptr %182, align 4, !tbaa !5
  %184 = load i32, ptr %16, align 4, !tbaa !5
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [51 x [51 x i32]], ptr @g, i64 0, i64 %185
  %187 = load i32, ptr %17, align 4, !tbaa !5
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds [51 x i32], ptr %186, i64 0, i64 %188
  %190 = load i32, ptr %189, align 4, !tbaa !5
  %191 = sub nsw i32 %183, %190
  %192 = load i32, ptr %15, align 4, !tbaa !5
  %193 = add nsw i32 %192, %191
  store i32 %193, ptr %15, align 4, !tbaa !5
  br label %194

194:                                              ; preds = %176
  %195 = load i32, ptr %17, align 4, !tbaa !5
  %196 = add nsw i32 %195, 1
  store i32 %196, ptr %17, align 4, !tbaa !5
  br label %171, !llvm.loop !17

197:                                              ; preds = %175
  br label %198

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

201:                                              ; preds = %169
  %202 = load i32, ptr %15, align 4, !tbaa !5
  %203 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %202)
          to label %204 unwind label %205

204:                                              ; preds = %201
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #4
  call void @llvm.lifetime.end.p0(i64 48, ptr %1) #4
  ret void

205:                                              ; preds = %201
  %206 = landingpad { ptr, i32 }
          cleanup
  %207 = extractvalue { ptr, i32 } %206, 0
  store ptr %207, ptr %5, align 8
  %208 = extractvalue { ptr, i32 } %206, 1
  store i32 %208, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %209

209:                                              ; preds = %205, %146, %73
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #4
  call void @llvm.lifetime.end.p0(i64 48, ptr %1) #4
  br label %210

210:                                              ; preds = %209
  %211 = load ptr, ptr %5, align 8
  %212 = load i32, ptr %6, align 4
  %213 = insertvalue { ptr, i32 } poison, ptr %211, 0
  %214 = insertvalue { ptr, i32 } %213, i32 %212, 1
  resume { ptr, i32 } %214
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48)) #2 align 2

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #2 align 2

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 = { 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 #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 = { 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 = distinct !{!18, !10}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"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::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@g = external dso_local global [51 x [51 x i32]], align 16
@w = external dso_local local_unnamed_addr global [51 x [51 x i32]], align 16
@v = external dso_local local_unnamed_addr global [51 x [51 x i32]], align 16
@comp = external dso_local global %"class.std::vector", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsiiii(i32 noundef, i32 noundef, 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z9checkCompv() local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::set", align 8
  %2 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %3 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %1) #6
  call void @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #6
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %.not70 = icmp slt i32 %5, 1
  %6 = load i32, ptr @m, align 4
  %7 = icmp slt i32 %6, 1
  %or.cond = select i1 %.not70, i1 true, i1 %7
  br i1 %or.cond, label %._crit_edge72, label %.preheader66

.preheader66:                                     ; preds = %0, %._crit_edge
  %8 = phi i32 [ %13, %._crit_edge ], [ %5, %0 ]
  %9 = phi i32 [ %14, %._crit_edge ], [ %6, %0 ]
  %indvars.iv105 = phi i64 [ %indvars.iv.next106, %._crit_edge ], [ 1, %0 ]
  %.not6068 = icmp slt i32 %9, 1
  br i1 %.not6068, label %._crit_edge, label %.lr.ph

._crit_edge72:                                    ; preds = %._crit_edge, %0
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %10 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %1) #6
  store ptr %10, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %11 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %1) #6
  store ptr %11, ptr %3, align 8
  %12 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  br i1 %12, label %.preheader65, label %._crit_edge88

._crit_edge.loopexit:                             ; preds = %19
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader66
  %13 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %8, %.preheader66 ]
  %14 = phi i32 [ %23, %._crit_edge.loopexit ], [ %9, %.preheader66 ]
  %indvars.iv.next106 = add nuw nsw i64 %indvars.iv105, 1
  %15 = sext i32 %13 to i64
  %.not.not = icmp slt i64 %indvars.iv105, %15
  br i1 %.not.not, label %.preheader66, label %._crit_edge72, !llvm.loop !9

.lr.ph:                                           ; preds = %.preheader66, %19
  %indvars.iv = phi i64 [ %indvars.iv.next, %19 ], [ 1, %.preheader66 ]
  %16 = getelementptr inbounds [51 x [51 x i32]], ptr @g, i64 0, i64 %indvars.iv105, i64 %indvars.iv
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %16)
  %18 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 4 dereferenceable(4) %16)
          to label %19 unwind label %25

19:                                               ; preds = %.lr.ph
  %20 = load i32, ptr %16, align 4, !tbaa !5
  %21 = getelementptr inbounds [51 x [51 x i32]], ptr @w, i64 0, i64 %indvars.iv105, i64 %indvars.iv
  store i32 %20, ptr %21, align 4, !tbaa !5
  %22 = getelementptr inbounds [51 x [51 x i32]], ptr @v, i64 0, i64 %indvars.iv105, i64 %indvars.iv
  store i32 0, ptr %22, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %23 = load i32, ptr @m, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %.not60.not = icmp slt i64 %indvars.iv, %24
  br i1 %.not60.not, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !12

25:                                               ; preds = %.lr.ph
  %26 = landingpad { ptr, i32 }
          cleanup
  br label %90

.preheader65:                                     ; preds = %._crit_edge72, %._crit_edge87
  %27 = load i32, ptr @n, align 4, !tbaa !5
  %.not5577 = icmp slt i32 %27, 1
  br i1 %.not5577, label %._crit_edge87, label %.preheader63.lr.ph

.preheader63.lr.ph:                               ; preds = %.preheader65
  %28 = load i32, ptr @m, align 4, !tbaa !5
  %.not5973 = icmp slt i32 %28, 1
  br i1 %.not5973, label %._crit_edge87, label %.preheader63.preheader

.preheader63.preheader:                           ; preds = %.preheader63.lr.ph
  %29 = zext nneg i32 %28 to i64
  %30 = shl nuw nsw i64 %29, 2
  %wide.trip.count = zext nneg i32 %27 to i64
  %xtraiter = and i64 %wide.trip.count, 7
  %31 = icmp ult i32 %27, 8
  br i1 %31, label %.preheader64.unr-lcssa, label %.preheader63.preheader.new

.preheader63.preheader.new:                       ; preds = %.preheader63.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483640
  br label %.preheader63

._crit_edge88:                                    ; preds = %._crit_edge87, %._crit_edge72
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  %32 = load i32, ptr @n, align 4, !tbaa !5
  %.not5395 = icmp slt i32 %32, 1
  br i1 %.not5395, label %._crit_edge98, label %.preheader.lr.ph

.preheader.lr.ph:                                 ; preds = %._crit_edge88
  %33 = load i32, ptr @m, align 4, !tbaa !5
  %.not5489 = icmp slt i32 %33, 1
  br i1 %.not5489, label %._crit_edge98, label %.preheader.preheader

.preheader.preheader:                             ; preds = %.preheader.lr.ph
  %34 = add nuw i32 %33, 1
  %35 = add nuw i32 %32, 1
  %wide.trip.count125 = zext i32 %35 to i64
  %wide.trip.count120 = zext i32 %34 to i64
  %36 = zext nneg i32 %33 to i64
  %min.iters.check = icmp ult i32 %33, 8
  %n.vec = and i64 %36, 2147483640
  %ind.end = or disjoint i64 %n.vec, 1
  %cmp.n = icmp eq i64 %n.vec, %36
  br label %.preheader

.preheader64.unr-lcssa:                           ; preds = %.preheader63, %.preheader63.preheader
  %indvar.unr = phi i64 [ 0, %.preheader63.preheader ], [ %indvar.next.7, %.preheader63 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader64, label %.preheader63.epil

.preheader63.epil:                                ; preds = %.preheader64.unr-lcssa, %.preheader63.epil
  %indvar.epil = phi i64 [ %indvar.next.epil, %.preheader63.epil ], [ %indvar.unr, %.preheader64.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.preheader63.epil ], [ 0, %.preheader64.unr-lcssa ]
  %37 = mul nuw nsw i64 %indvar.epil, 204
  %gep.epil = getelementptr i8, ptr getelementptr inbounds (i8, ptr @v, i64 208), i64 %37
  call void @llvm.memset.p0.i64(ptr align 4 %gep.epil, i8 0, i64 %30, i1 false), !tbaa !5
  %indvar.next.epil = add nuw nsw i64 %indvar.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.preheader64, label %.preheader63.epil, !llvm.loop !13

.preheader64:                                     ; preds = %.preheader63.epil, %.preheader64.unr-lcssa
  %.pr = load i32, ptr @m, align 4
  %38 = icmp slt i32 %.pr, 1
  %or.cond132 = select i1 %.not5577, i1 true, i1 %38
  br i1 %or.cond132, label %._crit_edge87, label %.preheader62

.preheader63:                                     ; preds = %.preheader63, %.preheader63.preheader.new
  %indvar = phi i64 [ 0, %.preheader63.preheader.new ], [ %indvar.next.7, %.preheader63 ]
  %niter = phi i64 [ 0, %.preheader63.preheader.new ], [ %niter.next.7, %.preheader63 ]
  %39 = mul nuw nsw i64 %indvar, 204
  %gep = getelementptr i8, ptr getelementptr inbounds (i8, ptr @v, i64 208), i64 %39
  call void @llvm.memset.p0.i64(ptr align 16 %gep, i8 0, i64 %30, i1 false), !tbaa !5
  %40 = mul nuw i64 %indvar, 204
  %gep149 = getelementptr i8, ptr getelementptr (i8, ptr getelementptr inbounds (i8, ptr @v, i64 208), i64 204), i64 %40
  call void @llvm.memset.p0.i64(ptr align 4 %gep149, i8 0, i64 %30, i1 false), !tbaa !5
  %41 = mul nuw i64 %indvar, 204
  %gep150 = getelementptr i8, ptr getelementptr (i8, ptr getelementptr inbounds (i8, ptr @v, i64 208), i64 408), i64 %41
  call void @llvm.memset.p0.i64(ptr align 8 %gep150, i8 0, i64 %30, i1 false), !tbaa !5
  %42 = mul nuw i64 %indvar, 204
  %gep151 = getelementptr i8, ptr getelementptr (i8, ptr getelementptr inbounds (i8, ptr @v, i64 208), i64 612), i64 %42
  call void @llvm.memset.p0.i64(ptr align 4 %gep151, i8 0, i64 %30, i1 false), !tbaa !5
  %43 = mul nuw i64 %indvar, 204
  %gep152 = getelementptr i8, ptr getelementptr (i8, ptr getelementptr inbounds (i8, ptr @v, i64 208), i64 816), i64 %43
  call void @llvm.memset.p0.i64(ptr align 16 %gep152, i8 0, i64 %30, i1 false), !tbaa !5
  %44 = mul nuw i64 %indvar, 204
  %gep153 = getelementptr i8, ptr getelementptr (i8, ptr getelementptr inbounds (i8, ptr @v, i64 208), i64 1020), i64 %44
  call void @llvm.memset.p0.i64(ptr align 4 %gep153, i8 0, i64 %30, i1 false), !tbaa !5
  %45 = mul nuw i64 %indvar, 204
  %gep154 = getelementptr i8, ptr getelementptr (i8, ptr getelementptr inbounds (i8, ptr @v, i64 208), i64 1224), i64 %45
  call void @llvm.memset.p0.i64(ptr align 8 %gep154, i8 0, i64 %30, i1 false), !tbaa !5
  %46 = mul nuw i64 %indvar, 204
  %gep155 = getelementptr i8, ptr getelementptr (i8, ptr getelementptr inbounds (i8, ptr @v, i64 208), i64 1428), i64 %46
  call void @llvm.memset.p0.i64(ptr align 4 %gep155, i8 0, i64 %30, i1 false), !tbaa !5
  %indvar.next.7 = add nuw nsw i64 %indvar, 8
  %niter.next.7 = add i64 %niter, 8
  %niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
  br i1 %niter.ncmp.7, label %.preheader64.unr-lcssa, label %.preheader63, !llvm.loop !15

.preheader62:                                     ; preds = %.preheader64, %._crit_edge83
  %47 = phi i32 [ %53, %._crit_edge83 ], [ %27, %.preheader64 ]
  %48 = phi i32 [ %54, %._crit_edge83 ], [ %.pr, %.preheader64 ]
  %indvars.iv114 = phi i64 [ %indvars.iv.next115, %._crit_edge83 ], [ 1, %.preheader64 ]
  %.04585 = phi i32 [ %.146.lcssa, %._crit_edge83 ], [ 0, %.preheader64 ]
  %.not5779 = icmp slt i32 %48, 1
  br i1 %.not5779, label %._crit_edge83, label %.lr.ph82

.lr.ph82:                                         ; preds = %.preheader62
  %49 = trunc nuw nsw i64 %indvars.iv114 to i32
  br label %56

._crit_edge87:                                    ; preds = %._crit_edge83, %.preheader63.lr.ph, %.preheader65, %.preheader64
  %50 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorIiEppEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %51 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %1) #6
  store ptr %51, ptr %3, align 8
  %52 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  br i1 %52, label %.preheader65, label %._crit_edge88, !llvm.loop !16

._crit_edge83.loopexit:                           ; preds = %69
  %.pre127 = load i32, ptr @n, align 4, !tbaa !5
  br label %._crit_edge83

._crit_edge83:                                    ; preds = %._crit_edge83.loopexit, %.preheader62
  %53 = phi i32 [ %47, %.preheader62 ], [ %.pre127, %._crit_edge83.loopexit ]
  %54 = phi i32 [ %48, %.preheader62 ], [ %70, %._crit_edge83.loopexit ]
  %.146.lcssa = phi i32 [ %.04585, %.preheader62 ], [ %.2, %._crit_edge83.loopexit ]
  %indvars.iv.next115 = add nuw nsw i64 %indvars.iv114, 1
  %55 = sext i32 %53 to i64
  %.not56.not = icmp slt i64 %indvars.iv114, %55
  br i1 %.not56.not, label %.preheader62, label %._crit_edge87, !llvm.loop !17

56:                                               ; preds = %.lr.ph82, %69
  %indvars.iv111 = phi i64 [ 1, %.lr.ph82 ], [ %indvars.iv.next112, %69 ]
  %.14680 = phi i32 [ %.04585, %.lr.ph82 ], [ %.2, %69 ]
  %57 = getelementptr inbounds [51 x [51 x i32]], ptr @v, i64 0, i64 %indvars.iv114, i64 %indvars.iv111
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %.not58 = icmp eq i32 %58, 0
  br i1 %.not58, label %59, label %69

59:                                               ; preds = %56
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @comp) #6
  %60 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = add nsw i32 %.14680, 1
  %63 = trunc nuw nsw i64 %indvars.iv111 to i32
  invoke void @_Z3dfsiiii(i32 noundef %49, i32 noundef %63, i32 noundef %61, i32 noundef %62)
          to label %64 unwind label %66

64:                                               ; preds = %59
  %65 = call noundef zeroext i1 @_Z9checkCompv()
  br i1 %65, label %68, label %69

66:                                               ; preds = %68, %59
  %67 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  br label %90

68:                                               ; preds = %64
  invoke void @_Z4getWi(i32 noundef %62)
          to label %69 unwind label %66

69:                                               ; preds = %56, %68, %64
  %.2 = phi i32 [ %.14680, %56 ], [ %62, %68 ], [ %62, %64 ]
  %indvars.iv.next112 = add nuw nsw i64 %indvars.iv111, 1
  %70 = load i32, ptr @m, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %.not57.not = icmp slt i64 %indvars.iv111, %71
  br i1 %.not57.not, label %56, label %._crit_edge83.loopexit, !llvm.loop !18

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge93
  %indvars.iv122 = phi i64 [ 1, %.preheader.preheader ], [ %indvars.iv.next123, %._crit_edge93 ]
  %.04296 = phi i32 [ 0, %.preheader.preheader ], [ %.lcssa, %._crit_edge93 ]
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %.preheader
  %indvars.iv117.ph = phi i64 [ 1, %.preheader ], [ %ind.end, %middle.block ]
  %.190.ph = phi i32 [ %.04296, %.preheader ], [ %82, %middle.block ]
  br label %scalar.ph

vector.ph:                                        ; preds = %.preheader
  %72 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %.04296, i64 0
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ %72, %vector.ph ], [ %79, %vector.body ]
  %vec.phi135 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %80, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %73 = getelementptr inbounds [51 x [51 x i32]], ptr @w, i64 0, i64 %indvars.iv122, i64 %offset.idx
  %74 = getelementptr inbounds i8, ptr %73, i64 16
  %wide.load = load <4 x i32>, ptr %73, align 4, !tbaa !5
  %wide.load136 = load <4 x i32>, ptr %74, align 4, !tbaa !5
  %75 = getelementptr inbounds [51 x [51 x i32]], ptr @g, i64 0, i64 %indvars.iv122, i64 %offset.idx
  %76 = getelementptr inbounds i8, ptr %75, i64 16
  %wide.load137 = load <4 x i32>, ptr %75, align 4, !tbaa !5
  %wide.load138 = load <4 x i32>, ptr %76, align 4, !tbaa !5
  %77 = add <4 x i32> %wide.load, %vec.phi
  %78 = add <4 x i32> %wide.load136, %vec.phi135
  %79 = sub <4 x i32> %77, %wide.load137
  %80 = sub <4 x i32> %78, %wide.load138
  %index.next = add nuw i64 %index, 8
  %81 = icmp eq i64 %index.next, %n.vec
  br i1 %81, label %middle.block, label %vector.body, !llvm.loop !19

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %80, %79
  %82 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  br i1 %cmp.n, label %._crit_edge93, label %scalar.ph.preheader

._crit_edge98:                                    ; preds = %._crit_edge93, %.preheader.lr.ph, %._crit_edge88
  %.042.lcssa = phi i32 [ 0, %._crit_edge88 ], [ 0, %.preheader.lr.ph ], [ %.lcssa, %._crit_edge93 ]
  %83 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.042.lcssa)
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %1) #6
  ret void

._crit_edge93:                                    ; preds = %scalar.ph, %middle.block
  %.lcssa = phi i32 [ %82, %middle.block ], [ %89, %scalar.ph ]
  %indvars.iv.next123 = add nuw nsw i64 %indvars.iv122, 1
  %exitcond126.not = icmp eq i64 %indvars.iv.next123, %wide.trip.count125
  br i1 %exitcond126.not, label %._crit_edge98, label %.preheader, !llvm.loop !22

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv117 = phi i64 [ %indvars.iv.next118, %scalar.ph ], [ %indvars.iv117.ph, %scalar.ph.preheader ]
  %.190 = phi i32 [ %89, %scalar.ph ], [ %.190.ph, %scalar.ph.preheader ]
  %84 = getelementptr inbounds [51 x [51 x i32]], ptr @w, i64 0, i64 %indvars.iv122, i64 %indvars.iv117
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = getelementptr inbounds [51 x [51 x i32]], ptr @g, i64 0, i64 %indvars.iv122, i64 %indvars.iv117
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = add i32 %85, %.190
  %89 = sub i32 %88, %87
  %indvars.iv.next118 = add nuw nsw i64 %indvars.iv117, 1
  %exitcond121.not = icmp eq i64 %indvars.iv.next118, %wide.trip.count120
  br i1 %exitcond121.not, label %._crit_edge93, label %scalar.ph, !llvm.loop !23

90:                                               ; preds = %66, %25
  %.pn = phi { ptr, i32 } [ %26, %25 ], [ %67, %66 ]
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %1) #6
  resume { ptr, i32 } %.pn
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #2 align 2

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #2 align 2

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.unswitch.partial.disable"}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !11}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10, !20, !21}
!20 = !{!"llvm.loop.isvectorized", i32 1}
!21 = !{!"llvm.loop.unroll.runtime.disable"}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10, !21, !20}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopIdiomRecognizePass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass