; LLVM IR from tangjz/acm-icpc :: hdu (5865)

; 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<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@sg = external dso_local global [5001 x i32], align 16
@seq = external dso_local global [301 x i32], align 16
@pw3 = external dso_local global [13 x i32], align 16
@f = external dso_local global [1600001 x i32], align 16
@e = external dso_local global [5001 x %"class.std::vector"], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z7mod_incRiii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #4 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %17 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %18 = alloca i32, align 4
  %19 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %20 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca %"class.std::vector", align 8
  store i32 0, ptr %1, align 4
  store i32 1, ptr @pw3, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %38, %0
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = icmp slt i32 %25, 13
  br i1 %26, label %28, label %27

27:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %41

28:                                               ; preds = %24
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sub nsw i32 %29, 1
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [13 x i32], ptr @pw3, i64 0, i64 %31
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = mul nsw i32 %33, 3
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [13 x i32], ptr @pw3, i64 0, i64 %36
  store i32 %34, ptr %37, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %28
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %2, align 4, !tbaa !5
  br label %24, !llvm.loop !9

41:                                               ; preds = %27
  br label %42

42:                                               ; preds = %232, %41
  %43 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m, ptr noundef @q)
  %44 = icmp eq i32 %43, 3
  br i1 %44, label %45, label %233

45:                                               ; preds = %42
  call void @llvm.memset.p0.i64(ptr align 16 @sg, i8 -1, i64 20004, i1 false)
  call void @llvm.memset.p0.i64(ptr align 16 @f, i8 0, i64 6400004, i1 false)
  br label %46

46:                                               ; preds = %50, %45
  %47 = load i32, ptr @m, align 4, !tbaa !5
  %48 = add nsw i32 %47, -1
  store i32 %48, ptr @m, align 4, !tbaa !5
  %49 = icmp ne i32 %47, 0
  br i1 %49, label %50, label %55

50:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  %51 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %3, ptr noundef %4)
  %52 = load i32, ptr %3, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [5001 x %"class.std::vector"], ptr @e, i64 0, i64 %53
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %54, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %46, !llvm.loop !11

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

56:                                               ; preds = %64, %55
  %57 = load i32, ptr %5, align 4, !tbaa !5
  %58 = load i32, ptr @n, align 4, !tbaa !5
  %59 = icmp sle i32 %57, %58
  br i1 %59, label %61, label %60

60:                                               ; preds = %56
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %67

61:                                               ; preds = %56
  %62 = load i32, ptr %5, align 4, !tbaa !5
  %63 = call noundef i32 @_Z3dfsi(i32 noundef %62)
  br label %64

64:                                               ; preds = %61
  %65 = load i32, ptr %5, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %5, align 4, !tbaa !5
  br label %56, !llvm.loop !12

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

68:                                               ; preds = %109, %67
  %69 = load i32, ptr %6, align 4, !tbaa !5
  %70 = load i32, ptr @n, align 4, !tbaa !5
  %71 = icmp sle i32 %69, %70
  br i1 %71, label %73, label %72

72:                                               ; preds = %68
  store i32 12, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %112

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

74:                                               ; preds = %96, %73
  %75 = load i32, ptr %6, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [5001 x i32], ptr @sg, i64 0, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = icmp ne i32 %78, 0
  br i1 %79, label %81, label %80

80:                                               ; preds = %74
  store i32 15, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %104

81:                                               ; preds = %74
  %82 = load i32, ptr %6, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [5001 x i32], ptr @sg, i64 0, i64 %83
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = and i32 %85, 1
  %87 = icmp ne i32 %86, 0
  br i1 %87, label %88, label %95

88:                                               ; preds = %81
  %89 = load i32, ptr %9, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [13 x i32], ptr @pw3, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = load i32, ptr %8, align 4, !tbaa !5
  %94 = add nsw i32 %93, %92
  store i32 %94, ptr %8, align 4, !tbaa !5
  br label %95

95:                                               ; preds = %88, %81
  br label %96

96:                                               ; preds = %95
  %97 = load i32, ptr %9, align 4, !tbaa !5
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %9, align 4, !tbaa !5
  %99 = load i32, ptr %6, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [5001 x i32], ptr @sg, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = ashr i32 %102, 1
  store i32 %103, ptr %101, align 4, !tbaa !5
  br label %74, !llvm.loop !13

104:                                              ; preds = %80
  %105 = load i32, ptr %8, align 4, !tbaa !5
  %106 = load i32, ptr %6, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [5001 x i32], ptr @sg, i64 0, i64 %107
  store i32 %105, ptr %108, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %109

109:                                              ; preds = %104
  %110 = load i32, ptr %6, align 4, !tbaa !5
  %111 = add nsw i32 %110, 1
  store i32 %111, ptr %6, align 4, !tbaa !5
  br label %68, !llvm.loop !14

112:                                              ; preds = %72
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 0, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %113

113:                                              ; preds = %130, %112
  %114 = load i32, ptr %12, align 4, !tbaa !5
  %115 = load i32, ptr @q, align 4, !tbaa !5
  %116 = icmp slt i32 %114, %115
  br i1 %116, label %118, label %117

117:                                              ; preds = %113
  store i32 18, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %133

118:                                              ; preds = %113
  %119 = load i32, ptr %12, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds i32, ptr @seq, i64 %120
  %122 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %121)
  %123 = load i32, ptr %12, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [301 x i32], ptr @seq, i64 0, i64 %124
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [5001 x i32], ptr @sg, i64 0, i64 %127
  %129 = load i32, ptr %128, align 4, !tbaa !5
  call void @_Z7mod_incRiii(ptr noundef nonnull align 4 dereferenceable(4) %10, i32 noundef %129, i32 noundef 2)
  br label %130

130:                                              ; preds = %118
  %131 = load i32, ptr %12, align 4, !tbaa !5
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %12, align 4, !tbaa !5
  br label %113, !llvm.loop !15

133:                                              ; preds = %117
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %134

134:                                              ; preds = %214, %133
  %135 = load i32, ptr %13, align 4, !tbaa !5
  %136 = load i32, ptr @q, align 4, !tbaa !5
  %137 = icmp slt i32 %135, %136
  br i1 %137, label %139, label %138

138:                                              ; preds = %134
  store i32 21, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %217

139:                                              ; preds = %134
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %140 = load i32, ptr %13, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [301 x i32], ptr @seq, i64 0, i64 %141
  %143 = load i32, ptr %142, align 4, !tbaa !5
  store i32 %143, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %144 = load i32, ptr %10, align 4, !tbaa !5
  store i32 %144, ptr %15, align 4, !tbaa !5
  %145 = load i32, ptr %14, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [5001 x i32], ptr @sg, i64 0, i64 %146
  %148 = load i32, ptr %147, align 4, !tbaa !5
  call void @_Z7mod_incRiii(ptr noundef nonnull align 4 dereferenceable(4) %15, i32 noundef %148, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %149 = load i32, ptr %14, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [5001 x %"class.std::vector"], ptr @e, i64 0, i64 %150
  %152 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %151) #7
  %153 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %16, i32 0, i32 0
  store ptr %152, ptr %153, align 8
  br label %154

154:                                              ; preds = %180, %139
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %155 = load i32, ptr %14, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [5001 x %"class.std::vector"], ptr @e, i64 0, i64 %156
  %158 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %157) #7
  %159 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %17, i32 0, i32 0
  store ptr %158, ptr %159, align 8
  %160 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(8) %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  br i1 %160, label %162, label %161

161:                                              ; preds = %154
  store i32 24, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  br label %182

162:                                              ; preds = %154
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  %163 = load i32, ptr %15, align 4, !tbaa !5
  store i32 %163, ptr %18, align 4, !tbaa !5
  %164 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %16) #7
  %165 = load i32, ptr %164, align 4, !tbaa !5
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [5001 x i32], ptr @sg, i64 0, i64 %166
  %168 = load i32, ptr %167, align 4, !tbaa !5
  call void @_Z7mod_incRiii(ptr noundef nonnull align 4 dereferenceable(4) %18, i32 noundef %168, i32 noundef 2)
  %169 = load i32, ptr %18, align 4, !tbaa !5
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [1600001 x i32], ptr @f, i64 0, i64 %170
  %172 = load i32, ptr %171, align 4, !tbaa !5
  %173 = load i32, ptr %18, align 4, !tbaa !5
  %174 = icmp ne i32 %173, 0
  %175 = xor i1 %174, true
  %176 = zext i1 %175 to i32
  %177 = add nsw i32 %172, %176
  %178 = load i32, ptr %11, align 4, !tbaa !5
  %179 = add nsw i32 %178, %177
  store i32 %179, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  br label %180

180:                                              ; preds = %162
  %181 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %16) #7
  br label %154, !llvm.loop !16

182:                                              ; preds = %161
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %183 = load i32, ptr %14, align 4, !tbaa !5
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [5001 x %"class.std::vector"], ptr @e, i64 0, i64 %184
  %186 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %185) #7
  %187 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %19, i32 0, i32 0
  store ptr %186, ptr %187, align 8
  br label %188

188:                                              ; preds = %211, %182
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %189 = load i32, ptr %14, align 4, !tbaa !5
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds [5001 x %"class.std::vector"], ptr @e, i64 0, i64 %190
  %192 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %191) #7
  %193 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %20, i32 0, i32 0
  store ptr %192, ptr %193, align 8
  %194 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %19, ptr noundef nonnull align 8 dereferenceable(8) %20) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  br i1 %194, label %196, label %195

195:                                              ; preds = %188
  store i32 27, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  br label %213

196:                                              ; preds = %188
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  %197 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %19) #7
  %198 = load i32, ptr %197, align 4, !tbaa !5
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [5001 x i32], ptr @sg, i64 0, i64 %199
  %201 = load i32, ptr %200, align 4, !tbaa !5
  store i32 %201, ptr %21, align 4, !tbaa !5
  %202 = load i32, ptr %14, align 4, !tbaa !5
  %203 = sext i32 %202 to i64
  %204 = getelementptr inbounds [5001 x i32], ptr @sg, i64 0, i64 %203
  %205 = load i32, ptr %204, align 4, !tbaa !5
  call void @_Z7mod_incRiii(ptr noundef nonnull align 4 dereferenceable(4) %21, i32 noundef %205, i32 noundef 2)
  %206 = load i32, ptr %21, align 4, !tbaa !5
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds [1600001 x i32], ptr @f, i64 0, i64 %207
  %209 = load i32, ptr %208, align 4, !tbaa !5
  %210 = add nsw i32 %209, 1
  store i32 %210, ptr %208, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %211

211:                                              ; preds = %196
  %212 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %19) #7
  br label %188, !llvm.loop !17

213:                                              ; preds = %195
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %214

214:                                              ; preds = %213
  %215 = load i32, ptr %13, align 4, !tbaa !5
  %216 = add nsw i32 %215, 1
  store i32 %216, ptr %13, align 4, !tbaa !5
  br label %134, !llvm.loop !18

217:                                              ; preds = %138
  %218 = load i32, ptr %11, align 4, !tbaa !5
  %219 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %218)
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  store i32 1, ptr %22, align 4, !tbaa !5
  br label %220

220:                                              ; preds = %229, %217
  %221 = load i32, ptr %22, align 4, !tbaa !5
  %222 = load i32, ptr @n, align 4, !tbaa !5
  %223 = icmp sle i32 %221, %222
  br i1 %223, label %225, label %224

224:                                              ; preds = %220
  store i32 30, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  br label %232

225:                                              ; preds = %220
  call void @llvm.lifetime.start.p0(i64 24, ptr %23) #7
  call void @llvm.memset.p0.i64(ptr align 8 %23, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %23) #7
  %226 = load i32, ptr %22, align 4, !tbaa !5
  %227 = sext i32 %226 to i64
  %228 = getelementptr inbounds [5001 x %"class.std::vector"], ptr @e, i64 0, i64 %227
  call void @_ZNSt6vectorIiSaIiEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24) %23, ptr noundef nonnull align 8 dereferenceable(24) %228) #7
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %23) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %23) #7
  br label %229

229:                                              ; preds = %225
  %230 = load i32, ptr %22, align 4, !tbaa !5
  %231 = add nsw i32 %230, 1
  store i32 %231, ptr %22, align 4, !tbaa !5
  br label %220, !llvm.loop !19

232:                                              ; preds = %224
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %42, !llvm.loop !20

233:                                              ; preds = %42
  ret i32 0
}

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

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

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

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

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

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!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}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !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<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@sg = external dso_local local_unnamed_addr global [5001 x i32], align 16
@seq = external dso_local global [301 x i32], align 16
@pw3 = external dso_local local_unnamed_addr global [13 x i32], align 16
@f = external dso_local local_unnamed_addr global [1600001 x i32], align 16
@e = external dso_local global [5001 x %"class.std::vector"], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z3dfsi(i32 noundef) 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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 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: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z7mod_incRiii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 {
.preheader54:
  %0 = alloca i32, align 4
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %6 = alloca i32, align 4
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca i32, align 4
  %10 = alloca %"class.std::vector", align 8
  store <4 x i32> <i32 1, i32 3, i32 9, i32 27>, ptr @pw3, align 16, !tbaa !5
  store <4 x i32> <i32 81, i32 243, i32 729, i32 2187>, ptr getelementptr inbounds (i8, ptr @pw3, i64 16), align 16, !tbaa !5
  store <4 x i32> <i32 6561, i32 19683, i32 59049, i32 177147>, ptr getelementptr inbounds (i8, ptr @pw3, i64 32), align 16, !tbaa !5
  store i32 531441, ptr getelementptr inbounds (i8, ptr @pw3, i64 48), align 16, !tbaa !5
  %11 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @q)
  %12 = icmp eq i32 %11, 3
  br i1 %12, label %.lr.ph92, label %._crit_edge93

.lr.ph92:                                         ; preds = %.preheader54, %._crit_edge91
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(20004) @sg, i8 -1, i64 20004, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(6400004) @f, i8 0, i64 6400004, i1 false)
  %13 = load i32, ptr @m, align 4, !tbaa !5
  %14 = add nsw i32 %13, -1
  store i32 %14, ptr @m, align 4, !tbaa !5
  %.not57 = icmp eq i32 %13, 0
  br i1 %.not57, label %.preheader53, label %.lr.ph

.preheader53:                                     ; preds = %.lr.ph, %.lr.ph92
  %15 = load i32, ptr @n, align 4, !tbaa !5
  %.not4558 = icmp slt i32 %15, 1
  br i1 %.not4558, label %._crit_edge70, label %.lr.ph60

.lr.ph:                                           ; preds = %.lr.ph92, %.lr.ph
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %0) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %0, ptr noundef nonnull %1)
  %17 = load i32, ptr %0, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [5001 x %"class.std::vector"], ptr @e, i64 0, i64 %18
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %19, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %0) #7
  %20 = load i32, ptr @m, align 4, !tbaa !5
  %21 = add nsw i32 %20, -1
  store i32 %21, ptr @m, align 4, !tbaa !5
  %.not = icmp eq i32 %20, 0
  br i1 %.not, label %.preheader53, label %.lr.ph, !llvm.loop !9

.preheader52:                                     ; preds = %.lr.ph60
  %.not4668 = icmp slt i32 %25, 1
  br i1 %.not4668, label %._crit_edge70, label %.preheader.preheader

.preheader.preheader:                             ; preds = %.preheader52
  %22 = add nuw i32 %25, 1
  %wide.trip.count = zext i32 %22 to i64
  br label %.preheader

.lr.ph60:                                         ; preds = %.preheader53, %.lr.ph60
  %.04359 = phi i32 [ %24, %.lr.ph60 ], [ 1, %.preheader53 ]
  %23 = call noundef i32 @_Z3dfsi(i32 noundef %.04359)
  %24 = add nuw nsw i32 %.04359, 1
  %25 = load i32, ptr @n, align 4, !tbaa !5
  %.not45.not = icmp slt i32 %.04359, %25
  br i1 %.not45.not, label %.lr.ph60, label %.preheader52, !llvm.loop !11

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge
  %indvars.iv99 = phi i64 [ 1, %.preheader.preheader ], [ %indvars.iv.next100, %._crit_edge ]
  %26 = getelementptr inbounds [5001 x i32], ptr @sg, i64 0, i64 %indvars.iv99
  %.promoted = load i32, ptr %26, align 4, !tbaa !5
  %.not4961 = icmp eq i32 %.promoted, 0
  br i1 %.not4961, label %._crit_edge, label %.lr.ph64

._crit_edge70:                                    ; preds = %._crit_edge, %.preheader53, %.preheader52
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  store i32 0, ptr %2, align 4, !tbaa !5
  %27 = load i32, ptr @q, align 4, !tbaa !5
  %28 = icmp sgt i32 %27, 0
  br i1 %28, label %.lr.ph73, label %._crit_edge85

._crit_edge:                                      ; preds = %35, %.preheader
  %.040.lcssa = phi i32 [ 0, %.preheader ], [ %.141, %35 ]
  store i32 %.040.lcssa, ptr %26, align 4, !tbaa !5
  %indvars.iv.next100 = add nuw nsw i64 %indvars.iv99, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next100, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge70, label %.preheader, !llvm.loop !12

.lr.ph64:                                         ; preds = %.preheader, %35
  %indvars.iv = phi i64 [ %indvars.iv.next, %35 ], [ 0, %.preheader ]
  %.04062 = phi i32 [ %.141, %35 ], [ 0, %.preheader ]
  %29 = phi i32 [ %36, %35 ], [ %.promoted, %.preheader ]
  %30 = and i32 %29, 1
  %.not50 = icmp eq i32 %30, 0
  br i1 %.not50, label %35, label %31

31:                                               ; preds = %.lr.ph64
  %32 = getelementptr inbounds [13 x i32], ptr @pw3, i64 0, i64 %indvars.iv
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = add nsw i32 %33, %.04062
  br label %35

35:                                               ; preds = %.lr.ph64, %31
  %.141 = phi i32 [ %34, %31 ], [ %.04062, %.lr.ph64 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %36 = ashr i32 %29, 1
  %.not49 = icmp ult i32 %29, 2
  br i1 %.not49, label %._crit_edge, label %.lr.ph64, !llvm.loop !13

.preheader51:                                     ; preds = %.lr.ph73
  %37 = icmp sgt i32 %44, 0
  br i1 %37, label %.lr.ph84, label %._crit_edge85

.lr.ph73:                                         ; preds = %._crit_edge70, %.lr.ph73
  %indvars.iv102 = phi i64 [ %indvars.iv.next103, %.lr.ph73 ], [ 0, %._crit_edge70 ]
  %38 = getelementptr inbounds i32, ptr @seq, i64 %indvars.iv102
  %39 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %38)
  %40 = load i32, ptr %38, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [5001 x i32], ptr @sg, i64 0, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !5
  call void @_Z7mod_incRiii(ptr noundef nonnull align 4 dereferenceable(4) %2, i32 noundef %43, i32 noundef 2)
  %indvars.iv.next103 = add nuw nsw i64 %indvars.iv102, 1
  %44 = load i32, ptr @q, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = icmp slt i64 %indvars.iv.next103, %45
  br i1 %46, label %.lr.ph73, label %.preheader51, !llvm.loop !14

._crit_edge85:                                    ; preds = %._crit_edge81, %._crit_edge70, %.preheader51
  %.038.lcssa = phi i32 [ 0, %.preheader51 ], [ 0, %._crit_edge70 ], [ %.1.lcssa, %._crit_edge81 ]
  %47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %.038.lcssa)
  %48 = load i32, ptr @n, align 4, !tbaa !5
  %.not4787 = icmp slt i32 %48, 1
  br i1 %.not4787, label %._crit_edge91, label %.lr.ph90

.lr.ph84:                                         ; preds = %.preheader51, %._crit_edge81
  %indvars.iv105 = phi i64 [ %indvars.iv.next106, %._crit_edge81 ], [ 0, %.preheader51 ]
  %.03882 = phi i32 [ %.1.lcssa, %._crit_edge81 ], [ 0, %.preheader51 ]
  %49 = getelementptr inbounds [301 x i32], ptr @seq, i64 0, i64 %indvars.iv105
  %50 = load i32, ptr %49, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %51 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %51, ptr %3, align 4, !tbaa !5
  %52 = sext i32 %50 to i64
  %53 = getelementptr inbounds [5001 x i32], ptr @sg, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  call void @_Z7mod_incRiii(ptr noundef nonnull align 4 dereferenceable(4) %3, i32 noundef %54, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %55 = getelementptr inbounds [5001 x %"class.std::vector"], ptr @e, i64 0, i64 %52
  %56 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %55) #7
  store ptr %56, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %57 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %55) #7
  store ptr %57, ptr %5, align 8
  %58 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  br i1 %58, label %.lr.ph76, label %._crit_edge77

._crit_edge77:                                    ; preds = %.lr.ph76, %.lr.ph84
  %.1.lcssa = phi i32 [ %.03882, %.lr.ph84 ], [ %74, %.lr.ph76 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #7
  %59 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %55) #7
  store ptr %59, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #7
  %60 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %55) #7
  store ptr %60, ptr %8, align 8
  %61 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  br i1 %61, label %.lr.ph80, label %._crit_edge81

.lr.ph76:                                         ; preds = %.lr.ph84, %.lr.ph76
  %.174 = phi i32 [ %74, %.lr.ph76 ], [ %.03882, %.lr.ph84 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  %62 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %62, ptr %6, align 4, !tbaa !5
  %63 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [5001 x i32], ptr @sg, i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  call void @_Z7mod_incRiii(ptr noundef nonnull align 4 dereferenceable(4) %6, i32 noundef %67, i32 noundef 2)
  %68 = load i32, ptr %6, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [1600001 x i32], ptr @f, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %.not48 = icmp eq i32 %68, 0
  %72 = zext i1 %.not48 to i32
  %73 = add i32 %71, %.174
  %74 = add i32 %73, %72
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  %75 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %76 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %55) #7
  store ptr %76, ptr %5, align 8
  %77 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  br i1 %77, label %.lr.ph76, label %._crit_edge77, !llvm.loop !15

._crit_edge81:                                    ; preds = %.lr.ph80, %._crit_edge77
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  %indvars.iv.next106 = add nuw nsw i64 %indvars.iv105, 1
  %78 = load i32, ptr @q, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = icmp slt i64 %indvars.iv.next106, %79
  br i1 %80, label %.lr.ph84, label %._crit_edge85, !llvm.loop !16

.lr.ph80:                                         ; preds = %._crit_edge77, %.lr.ph80
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #7
  %81 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [5001 x i32], ptr @sg, i64 0, i64 %83
  %85 = load i32, ptr %84, align 4, !tbaa !5
  store i32 %85, ptr %9, align 4, !tbaa !5
  %86 = load i32, ptr %53, align 4, !tbaa !5
  call void @_Z7mod_incRiii(ptr noundef nonnull align 4 dereferenceable(4) %9, i32 noundef %86, i32 noundef 2)
  %87 = load i32, ptr %9, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [1600001 x i32], ptr @f, i64 0, i64 %88
  %90 = load i32, ptr %89, align 4, !tbaa !5
  %91 = add nsw i32 %90, 1
  store i32 %91, ptr %89, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #7
  %92 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #7
  %93 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %55) #7
  store ptr %93, ptr %8, align 8
  %94 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  br i1 %94, label %.lr.ph80, label %._crit_edge81, !llvm.loop !17

._crit_edge91:                                    ; preds = %.lr.ph90, %._crit_edge85
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  %95 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @q)
  %96 = icmp eq i32 %95, 3
  br i1 %96, label %.lr.ph92, label %._crit_edge93, !llvm.loop !18

.lr.ph90:                                         ; preds = %._crit_edge85, %.lr.ph90
  %indvars.iv108 = phi i64 [ %indvars.iv.next109, %.lr.ph90 ], [ 1, %._crit_edge85 ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %10) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %10, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  %97 = getelementptr inbounds [5001 x %"class.std::vector"], ptr @e, i64 0, i64 %indvars.iv108
  call void @_ZNSt6vectorIiSaIiEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 8 dereferenceable(24) %97) #7
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #7
  %indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1
  %98 = load i32, ptr @n, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %.not47.not = icmp slt i64 %indvars.iv108, %99
  br i1 %.not47.not, label %.lr.ph90, label %._crit_edge91, !llvm.loop !19

._crit_edge93:                                    ; preds = %._crit_edge91, %.preheader54
  ret i32 0
}

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

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

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

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

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

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { 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 #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!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}
!19 = distinct !{!19, !10}


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