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

; 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::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 }
%"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 }
%"struct.std::pair" = 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
@a = external dso_local global [6000 x i32], align 16
@gcd = external dso_local global [6000 x i32], align 16
@bad = external dso_local global i32, align 4
@b = external dso_local global %"class.std::set", align 8
@primes = external dso_local global %"class.std::vector", align 8
@.str = 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 uwtable
declare dso_local noundef zeroext i1 @_Z4goodi(i32 noundef) #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(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 @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNKSt3setIiSt4lessIiESaIiEE5countERKi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) #0 align 2

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i8, align 1
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %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 i32, align 4
  %11 = alloca %"struct.std::pair", align 8
  %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 = alloca i32, align 4
  %19 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 2, ptr %2, align 4, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) @primes, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 3, ptr %3, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %49, %0
  %21 = load i32, ptr %3, align 4, !tbaa !5
  %22 = icmp slt i32 %21, 33000
  br i1 %22, label %24, label %23

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

24:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #6
  store i8 1, ptr %5, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %25 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @primes) #6
  %26 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %6, i32 0, i32 0
  store ptr %25, ptr %26, align 8
  br label %27

27:                                               ; preds = %40, %24
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %28 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @primes) #6
  %29 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %7, i32 0, i32 0
  store ptr %28, ptr %29, align 8
  %30 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br i1 %30, label %32, label %31

31:                                               ; preds = %27
  store i32 5, ptr %4, align 4
  br label %43

32:                                               ; preds = %27
  %33 = load i32, ptr %3, align 4, !tbaa !5
  %34 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = srem i32 %33, %35
  %37 = icmp eq i32 %36, 0
  br i1 %37, label %38, label %39

38:                                               ; preds = %32
  store i8 0, ptr %5, align 1, !tbaa !9
  store i32 5, ptr %4, align 4
  br label %43

39:                                               ; preds = %32
  br label %40

40:                                               ; preds = %39
  %41 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %6, i32 noundef 0) #6
  %42 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %8, i32 0, i32 0
  store ptr %41, ptr %42, align 8
  br label %27, !llvm.loop !11

43:                                               ; preds = %38, %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %44

44:                                               ; preds = %43
  %45 = load i8, ptr %5, align 1, !tbaa !9, !range !13, !noundef !14
  %46 = trunc i8 %45 to i1
  br i1 %46, label %47, label %48

47:                                               ; preds = %44
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @primes, ptr noundef nonnull align 4 dereferenceable(4) %3)
  br label %48

48:                                               ; preds = %47, %44
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #6
  br label %49

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

52:                                               ; preds = %23
  %53 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %64, %52
  %55 = load i32, ptr %9, align 4, !tbaa !5
  %56 = load i32, ptr @n, align 4, !tbaa !5
  %57 = icmp slt i32 %55, %56
  br i1 %57, label %59, label %58

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

59:                                               ; preds = %54
  %60 = load i32, ptr %9, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [6000 x i32], ptr @a, i64 0, i64 %61
  %63 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %62)
  br label %64

64:                                               ; preds = %59
  %65 = load i32, ptr %9, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %9, align 4, !tbaa !5
  br label %54, !llvm.loop !16

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

68:                                               ; preds = %80, %67
  %69 = load i32, ptr %10, align 4, !tbaa !5
  %70 = load i32, ptr @m, align 4, !tbaa !5
  %71 = icmp slt i32 %69, %70
  br i1 %71, label %73, label %72

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

73:                                               ; preds = %68
  %74 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef @bad)
  %75 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) @b, ptr noundef nonnull align 4 dereferenceable(4) @bad)
  %76 = getelementptr inbounds { ptr, i8 }, ptr %11, i32 0, i32 0
  %77 = extractvalue { ptr, i8 } %75, 0
  store ptr %77, ptr %76, align 8
  %78 = getelementptr inbounds { ptr, i8 }, ptr %11, i32 0, i32 1
  %79 = extractvalue { ptr, i8 } %75, 1
  store i8 %79, ptr %78, align 8
  br label %80

80:                                               ; preds = %73
  %81 = load i32, ptr %10, align 4, !tbaa !5
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %10, align 4, !tbaa !5
  br label %68, !llvm.loop !17

83:                                               ; preds = %72
  %84 = load i32, ptr @a, align 16, !tbaa !5
  store i32 %84, ptr @gcd, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %85

85:                                               ; preds = %104, %83
  %86 = load i32, ptr %12, align 4, !tbaa !5
  %87 = load i32, ptr @n, align 4, !tbaa !5
  %88 = icmp slt i32 %86, %87
  br i1 %88, label %90, label %89

89:                                               ; preds = %85
  store i32 14, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %107

90:                                               ; preds = %85
  %91 = load i32, ptr %12, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [6000 x i32], ptr @a, i64 0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = load i32, ptr %12, align 4, !tbaa !5
  %96 = sub nsw i32 %95, 1
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [6000 x i32], ptr @gcd, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = call noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef %94, i32 noundef %99)
  %101 = load i32, ptr %12, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [6000 x i32], ptr @gcd, i64 0, i64 %102
  store i32 %100, ptr %103, align 4, !tbaa !5
  br label %104

104:                                              ; preds = %90
  %105 = load i32, ptr %12, align 4, !tbaa !5
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr %12, align 4, !tbaa !5
  br label %85, !llvm.loop !18

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

108:                                              ; preds = %120, %107
  %109 = load i32, ptr %13, align 4, !tbaa !5
  %110 = load i32, ptr @n, align 4, !tbaa !5
  %111 = icmp slt i32 %109, %110
  br i1 %111, label %112, label %118

112:                                              ; preds = %108
  %113 = load i32, ptr %13, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [6000 x i32], ptr @gcd, i64 0, i64 %114
  %116 = load i32, ptr %115, align 4, !tbaa !5
  %117 = icmp sgt i32 %116, 1
  br label %118

118:                                              ; preds = %112, %108
  %119 = phi i1 [ false, %108 ], [ %117, %112 ]
  br i1 %119, label %120, label %123

120:                                              ; preds = %118
  %121 = load i32, ptr %13, align 4, !tbaa !5
  %122 = add nsw i32 %121, 1
  store i32 %122, ptr %13, align 4, !tbaa !5
  br label %108, !llvm.loop !19

123:                                              ; preds = %118
  %124 = load i32, ptr %13, align 4, !tbaa !5
  %125 = add nsw i32 %124, -1
  store i32 %125, ptr %13, align 4, !tbaa !5
  br label %126

126:                                              ; preds = %186, %123
  %127 = load i32, ptr %13, align 4, !tbaa !5
  %128 = icmp sge i32 %127, 0
  br i1 %128, label %129, label %187

129:                                              ; preds = %126
  br label %130

130:                                              ; preds = %141, %129
  %131 = load i32, ptr %13, align 4, !tbaa !5
  %132 = icmp sge i32 %131, 0
  br i1 %132, label %133, label %139

133:                                              ; preds = %130
  %134 = load i32, ptr %13, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [6000 x i32], ptr @gcd, i64 0, i64 %135
  %137 = load i32, ptr %136, align 4, !tbaa !5
  %138 = icmp eq i32 %137, 1
  br label %139

139:                                              ; preds = %133, %130
  %140 = phi i1 [ false, %130 ], [ %138, %133 ]
  br i1 %140, label %141, label %144

141:                                              ; preds = %139
  %142 = load i32, ptr %13, align 4, !tbaa !5
  %143 = add nsw i32 %142, -1
  store i32 %143, ptr %13, align 4, !tbaa !5
  br label %130, !llvm.loop !20

144:                                              ; preds = %139
  %145 = load i32, ptr %13, align 4, !tbaa !5
  %146 = icmp slt i32 %145, 0
  br i1 %146, label %147, label %148

147:                                              ; preds = %144
  br label %187

148:                                              ; preds = %144
  %149 = load i32, ptr %13, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [6000 x i32], ptr @gcd, i64 0, i64 %150
  %152 = load i32, ptr %151, align 4, !tbaa !5
  %153 = call noundef zeroext i1 @_Z4goodi(i32 noundef %152)
  br i1 %153, label %154, label %183

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

155:                                              ; preds = %179, %154
  %156 = load i32, ptr %14, align 4, !tbaa !5
  %157 = load i32, ptr %13, align 4, !tbaa !5
  %158 = icmp sle i32 %156, %157
  br i1 %158, label %160, label %159

159:                                              ; preds = %155
  store i32 23, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %182

160:                                              ; preds = %155
  %161 = load i32, ptr %13, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [6000 x i32], ptr @gcd, i64 0, i64 %162
  %164 = load i32, ptr %163, align 4, !tbaa !5
  %165 = load i32, ptr %14, align 4, !tbaa !5
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [6000 x i32], ptr @a, i64 0, i64 %166
  %168 = load i32, ptr %167, align 4, !tbaa !5
  %169 = sdiv i32 %168, %164
  store i32 %169, ptr %167, align 4, !tbaa !5
  %170 = load i32, ptr %13, align 4, !tbaa !5
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [6000 x i32], ptr @gcd, i64 0, i64 %171
  %173 = load i32, ptr %172, align 4, !tbaa !5
  %174 = load i32, ptr %14, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [6000 x i32], ptr @gcd, i64 0, i64 %175
  %177 = load i32, ptr %176, align 4, !tbaa !5
  %178 = sdiv i32 %177, %173
  store i32 %178, ptr %176, align 4, !tbaa !5
  br label %179

179:                                              ; preds = %160
  %180 = load i32, ptr %14, align 4, !tbaa !5
  %181 = add nsw i32 %180, 1
  store i32 %181, ptr %14, align 4, !tbaa !5
  br label %155, !llvm.loop !21

182:                                              ; preds = %159
  br label %186

183:                                              ; preds = %148
  %184 = load i32, ptr %13, align 4, !tbaa !5
  %185 = add nsw i32 %184, -1
  store i32 %185, ptr %13, align 4, !tbaa !5
  br label %186

186:                                              ; preds = %183, %182
  br label %126, !llvm.loop !22

187:                                              ; preds = %147, %126
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store i32 0, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %188 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @primes) #6
  %189 = trunc i64 %188 to i32
  store i32 %189, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  store i32 0, ptr %17, align 4, !tbaa !5
  br label %190

190:                                              ; preds = %276, %187
  %191 = load i32, ptr %17, align 4, !tbaa !5
  %192 = load i32, ptr @n, align 4, !tbaa !5
  %193 = icmp slt i32 %191, %192
  br i1 %193, label %195, label %194

194:                                              ; preds = %190
  store i32 26, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %279

195:                                              ; preds = %190
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  store i32 0, ptr %18, align 4, !tbaa !5
  br label %196

196:                                              ; preds = %253, %195
  %197 = load i32, ptr %18, align 4, !tbaa !5
  %198 = sext i32 %197 to i64
  %199 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @primes) #6
  %200 = icmp ult i64 %198, %199
  br i1 %200, label %201, label %211

201:                                              ; preds = %196
  %202 = load i32, ptr %18, align 4, !tbaa !5
  %203 = sext i32 %202 to i64
  %204 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @primes, i64 noundef %203) #6
  %205 = load i32, ptr %204, align 4, !tbaa !5
  %206 = load i32, ptr %17, align 4, !tbaa !5
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds [6000 x i32], ptr @a, i64 0, i64 %207
  %209 = load i32, ptr %208, align 4, !tbaa !5
  %210 = icmp sle i32 %205, %209
  br label %211

211:                                              ; preds = %201, %196
  %212 = phi i1 [ false, %196 ], [ %210, %201 ]
  br i1 %212, label %214, label %213

213:                                              ; preds = %211
  store i32 29, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %256

214:                                              ; preds = %211
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  store i32 0, ptr %19, align 4, !tbaa !5
  br label %215

215:                                              ; preds = %226, %214
  %216 = load i32, ptr %17, align 4, !tbaa !5
  %217 = sext i32 %216 to i64
  %218 = getelementptr inbounds [6000 x i32], ptr @a, i64 0, i64 %217
  %219 = load i32, ptr %218, align 4, !tbaa !5
  %220 = load i32, ptr %18, align 4, !tbaa !5
  %221 = sext i32 %220 to i64
  %222 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @primes, i64 noundef %221) #6
  %223 = load i32, ptr %222, align 4, !tbaa !5
  %224 = srem i32 %219, %223
  %225 = icmp eq i32 %224, 0
  br i1 %225, label %226, label %238

226:                                              ; preds = %215
  %227 = load i32, ptr %19, align 4, !tbaa !5
  %228 = add nsw i32 %227, 1
  store i32 %228, ptr %19, align 4, !tbaa !5
  %229 = load i32, ptr %18, align 4, !tbaa !5
  %230 = sext i32 %229 to i64
  %231 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @primes, i64 noundef %230) #6
  %232 = load i32, ptr %231, align 4, !tbaa !5
  %233 = load i32, ptr %17, align 4, !tbaa !5
  %234 = sext i32 %233 to i64
  %235 = getelementptr inbounds [6000 x i32], ptr @a, i64 0, i64 %234
  %236 = load i32, ptr %235, align 4, !tbaa !5
  %237 = sdiv i32 %236, %232
  store i32 %237, ptr %235, align 4, !tbaa !5
  br label %215, !llvm.loop !23

238:                                              ; preds = %215
  %239 = load i32, ptr %18, align 4, !tbaa !5
  %240 = sext i32 %239 to i64
  %241 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @primes, i64 noundef %240) #6
  %242 = call noundef i64 @_ZNKSt3setIiSt4lessIiESaIiEE5countERKi(ptr noundef nonnull align 8 dereferenceable(48) @b, ptr noundef nonnull align 4 dereferenceable(4) %241)
  %243 = icmp ne i64 %242, 0
  br i1 %243, label %244, label %248

244:                                              ; preds = %238
  %245 = load i32, ptr %19, align 4, !tbaa !5
  %246 = load i32, ptr %15, align 4, !tbaa !5
  %247 = sub nsw i32 %246, %245
  store i32 %247, ptr %15, align 4, !tbaa !5
  br label %252

248:                                              ; preds = %238
  %249 = load i32, ptr %19, align 4, !tbaa !5
  %250 = load i32, ptr %15, align 4, !tbaa !5
  %251 = add nsw i32 %250, %249
  store i32 %251, ptr %15, align 4, !tbaa !5
  br label %252

252:                                              ; preds = %248, %244
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %253

253:                                              ; preds = %252
  %254 = load i32, ptr %18, align 4, !tbaa !5
  %255 = add nsw i32 %254, 1
  store i32 %255, ptr %18, align 4, !tbaa !5
  br label %196, !llvm.loop !24

256:                                              ; preds = %213
  %257 = load i32, ptr %17, align 4, !tbaa !5
  %258 = sext i32 %257 to i64
  %259 = getelementptr inbounds [6000 x i32], ptr @a, i64 0, i64 %258
  %260 = load i32, ptr %259, align 4, !tbaa !5
  %261 = icmp sgt i32 %260, 1
  br i1 %261, label %262, label %275

262:                                              ; preds = %256
  %263 = load i32, ptr %17, align 4, !tbaa !5
  %264 = sext i32 %263 to i64
  %265 = getelementptr inbounds [6000 x i32], ptr @a, i64 0, i64 %264
  %266 = call noundef i64 @_ZNKSt3setIiSt4lessIiESaIiEE5countERKi(ptr noundef nonnull align 8 dereferenceable(48) @b, ptr noundef nonnull align 4 dereferenceable(4) %265)
  %267 = icmp ne i64 %266, 0
  br i1 %267, label %268, label %271

268:                                              ; preds = %262
  %269 = load i32, ptr %15, align 4, !tbaa !5
  %270 = add nsw i32 %269, -1
  store i32 %270, ptr %15, align 4, !tbaa !5
  br label %274

271:                                              ; preds = %262
  %272 = load i32, ptr %15, align 4, !tbaa !5
  %273 = add nsw i32 %272, 1
  store i32 %273, ptr %15, align 4, !tbaa !5
  br label %274

274:                                              ; preds = %271, %268
  br label %275

275:                                              ; preds = %274, %256
  br label %276

276:                                              ; preds = %275
  %277 = load i32, ptr %17, align 4, !tbaa !5
  %278 = add nsw i32 %277, 1
  store i32 %278, ptr %17, align 4, !tbaa !5
  br label %190, !llvm.loop !25

279:                                              ; preds = %194
  %280 = load i32, ptr %15, align 4, !tbaa !5
  %281 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %280)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  %282 = load i32, ptr %1, align 4
  ret i32 %282
}

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

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

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

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

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

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

; 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 noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef, i32 noundef) #2

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

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

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

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


; 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::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 }
%"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
@a = external dso_local global [6000 x i32], align 16
@gcd = external dso_local local_unnamed_addr global [6000 x i32], align 16
@bad = external dso_local global i32, align 4
@b = external dso_local global %"class.std::set", align 8
@primes = external dso_local global %"class.std::vector", align 8
@.str = 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 uwtable
declare dso_local noundef zeroext i1 @_Z4goodi(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 nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(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 @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNKSt3setIiSt4lessIiESaIiEE5countERKi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) 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) #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  store i32 2, ptr %1, align 4, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) @primes, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  store i32 3, ptr %2, align 4, !tbaa !5
  br label %9

5:                                                ; preds = %23
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %7 = load i32, ptr @n, align 4, !tbaa !5
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.lr.ph83, label %.preheader79

9:                                                ; preds = %0, %23
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %10 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @primes) #6
  store ptr %10, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %11 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @primes) #6
  store ptr %11, ptr %4, align 8
  %12 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  br i1 %12, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %9, %18
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  %15 = load i32, ptr %14, align 4, !tbaa !5
  %16 = srem i32 %13, %15
  %17 = icmp eq i32 %16, 0
  br i1 %17, label %22, label %18

18:                                               ; preds = %.lr.ph
  %19 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %3, i32 noundef 0) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %20 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @primes) #6
  store ptr %20, ptr %4, align 8
  %21 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  br i1 %21, label %.lr.ph, label %._crit_edge, !llvm.loop !9

22:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  br label %23

._crit_edge:                                      ; preds = %18, %9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @primes, ptr noundef nonnull align 4 dereferenceable(4) %2)
  br label %23

23:                                               ; preds = %22, %._crit_edge
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = add nsw i32 %24, 2
  store i32 %25, ptr %2, align 4, !tbaa !5
  %26 = icmp slt i32 %24, 32998
  br i1 %26, label %9, label %5, !llvm.loop !11

.preheader79:                                     ; preds = %.lr.ph83, %5
  %27 = phi i32 [ %7, %5 ], [ %32, %.lr.ph83 ]
  %28 = load i32, ptr @m, align 4, !tbaa !5
  %29 = icmp sgt i32 %28, 0
  br i1 %29, label %.lr.ph85, label %._crit_edge86

.lr.ph83:                                         ; preds = %5, %.lr.ph83
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph83 ], [ 0, %5 ]
  %30 = getelementptr inbounds [6000 x i32], ptr @a, i64 0, i64 %indvars.iv
  %31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %30)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %32 = load i32, ptr @n, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = icmp slt i64 %indvars.iv.next, %33
  br i1 %34, label %.lr.ph83, label %.preheader79, !llvm.loop !12

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

._crit_edge86:                                    ; preds = %._crit_edge86.loopexit, %.preheader79
  %35 = phi i32 [ %.pre, %._crit_edge86.loopexit ], [ %27, %.preheader79 ]
  %36 = load i32, ptr @a, align 16, !tbaa !5
  store i32 %36, ptr @gcd, align 16, !tbaa !5
  %37 = icmp sgt i32 %35, 1
  br i1 %37, label %.lr.ph89, label %.preheader78

.lr.ph85:                                         ; preds = %.preheader79, %.lr.ph85
  %.06684 = phi i32 [ %40, %.lr.ph85 ], [ 0, %.preheader79 ]
  %38 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull @bad)
  %39 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) @b, ptr noundef nonnull align 4 dereferenceable(4) @bad)
  %40 = add nuw nsw i32 %.06684, 1
  %41 = load i32, ptr @m, align 4, !tbaa !5
  %42 = icmp slt i32 %40, %41
  br i1 %42, label %.lr.ph85, label %._crit_edge86.loopexit, !llvm.loop !13

.preheader78:                                     ; preds = %.lr.ph89, %._crit_edge86
  %.lcssa = phi i32 [ %35, %._crit_edge86 ], [ %49, %.lr.ph89 ]
  %43 = icmp sgt i32 %.lcssa, 0
  br i1 %43, label %.lr.ph91.preheader, label %.critedge2.thread

.lr.ph91.preheader:                               ; preds = %.preheader78
  %wide.trip.count = zext nneg i32 %.lcssa to i64
  br label %.lr.ph91

.lr.ph89:                                         ; preds = %._crit_edge86, %.lr.ph89
  %44 = phi i32 [ %47, %.lr.ph89 ], [ %36, %._crit_edge86 ]
  %indvars.iv119 = phi i64 [ %indvars.iv.next120, %.lr.ph89 ], [ 1, %._crit_edge86 ]
  %45 = getelementptr inbounds [6000 x i32], ptr @a, i64 0, i64 %indvars.iv119
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = call noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef %46, i32 noundef %44)
  %48 = getelementptr inbounds [6000 x i32], ptr @gcd, i64 0, i64 %indvars.iv119
  store i32 %47, ptr %48, align 4, !tbaa !5
  %indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1
  %49 = load i32, ptr @n, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = icmp slt i64 %indvars.iv.next120, %50
  br i1 %51, label %.lr.ph89, label %.preheader78, !llvm.loop !14

.lr.ph91:                                         ; preds = %.lr.ph91.preheader, %55
  %indvars.iv122 = phi i64 [ 0, %.lr.ph91.preheader ], [ %indvars.iv.next123, %55 ]
  %52 = getelementptr inbounds [6000 x i32], ptr @gcd, i64 0, i64 %indvars.iv122
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = icmp sgt i32 %53, 1
  br i1 %54, label %55, label %.critedge.split.loop.exit

55:                                               ; preds = %.lr.ph91
  %indvars.iv.next123 = add nuw nsw i64 %indvars.iv122, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next123, %wide.trip.count
  br i1 %exitcond.not, label %.critedge, label %.lr.ph91, !llvm.loop !15

.critedge.split.loop.exit:                        ; preds = %.lr.ph91
  %56 = trunc nuw nsw i64 %indvars.iv122 to i32
  br label %.critedge

.critedge:                                        ; preds = %55, %.critedge.split.loop.exit
  %.060.lcssa = phi i32 [ %56, %.critedge.split.loop.exit ], [ %.lcssa, %55 ]
  %57 = icmp sgt i32 %.060.lcssa, 0
  br i1 %57, label %.preheader76.preheader, label %.critedge2.thread

.preheader76.preheader:                           ; preds = %.critedge
  %58 = add nsw i32 %.060.lcssa, -1
  br label %.preheader76

.preheader76:                                     ; preds = %.preheader76.preheader, %.loopexit
  %.16199 = phi i32 [ %.363, %.loopexit ], [ %58, %.preheader76.preheader ]
  %59 = add nuw nsw i32 %.16199, 1
  br label %60

60:                                               ; preds = %.preheader76, %65
  %indvars.iv128 = phi i32 [ %59, %.preheader76 ], [ %indvars.iv.next129, %65 ]
  %.26295 = phi i32 [ %.16199, %.preheader76 ], [ %66, %65 ]
  %61 = zext nneg i32 %.26295 to i64
  %62 = getelementptr inbounds [6000 x i32], ptr @gcd, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = icmp eq i32 %63, 1
  br i1 %64, label %65, label %.critedge2

65:                                               ; preds = %60
  %66 = add nsw i32 %.26295, -1
  %67 = icmp sgt i32 %.26295, 0
  %indvars.iv.next129 = add i32 %indvars.iv128, -1
  br i1 %67, label %60, label %.critedge2.thread, !llvm.loop !16

.critedge2:                                       ; preds = %60
  %68 = getelementptr inbounds [6000 x i32], ptr @gcd, i64 0, i64 %61
  %69 = call noundef zeroext i1 @_Z4goodi(i32 noundef %63)
  br i1 %69, label %.preheader75, label %77

.preheader75:                                     ; preds = %.critedge2
  %.not96 = icmp slt i32 %.26295, 0
  br i1 %.not96, label %.critedge2.thread, label %.lr.ph98.preheader

.lr.ph98.preheader:                               ; preds = %.preheader75
  %wide.trip.count131 = zext i32 %indvars.iv128 to i64
  br label %.lr.ph98

.lr.ph98:                                         ; preds = %.lr.ph98.preheader, %.lr.ph98
  %indvars.iv125 = phi i64 [ 0, %.lr.ph98.preheader ], [ %indvars.iv.next126, %.lr.ph98 ]
  %70 = load i32, ptr %68, align 4, !tbaa !5
  %71 = getelementptr inbounds [6000 x i32], ptr @a, i64 0, i64 %indvars.iv125
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = sdiv i32 %72, %70
  store i32 %73, ptr %71, align 4, !tbaa !5
  %74 = getelementptr inbounds [6000 x i32], ptr @gcd, i64 0, i64 %indvars.iv125
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = sdiv i32 %75, %70
  store i32 %76, ptr %74, align 4, !tbaa !5
  %indvars.iv.next126 = add nuw nsw i64 %indvars.iv125, 1
  %exitcond132.not = icmp eq i64 %indvars.iv.next126, %wide.trip.count131
  br i1 %exitcond132.not, label %.loopexit, label %.lr.ph98, !llvm.loop !17

77:                                               ; preds = %.critedge2
  %78 = add nsw i32 %.26295, -1
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph98, %77
  %.363 = phi i32 [ %78, %77 ], [ %.26295, %.lr.ph98 ]
  %79 = icmp sgt i32 %.363, -1
  br i1 %79, label %.preheader76, label %.critedge2.thread, !llvm.loop !18

.critedge2.thread:                                ; preds = %.preheader75, %.loopexit, %65, %.preheader78, %.critedge
  %80 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @primes) #6
  %81 = load i32, ptr @n, align 4, !tbaa !5
  %82 = icmp sgt i32 %81, 0
  br i1 %82, label %.preheader74, label %._crit_edge112

.preheader74:                                     ; preds = %.critedge2.thread, %117
  %indvars.iv136 = phi i64 [ %indvars.iv.next137, %117 ], [ 0, %.critedge2.thread ]
  %.058110 = phi i32 [ %.3, %117 ], [ 0, %.critedge2.thread ]
  %83 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @primes) #6
  %.not = icmp eq i64 %83, 0
  br i1 %.not, label %.critedge4, label %.lr.ph106

.lr.ph106:                                        ; preds = %.preheader74
  %84 = getelementptr inbounds [6000 x i32], ptr @a, i64 0, i64 %indvars.iv136
  br label %86

._crit_edge112:                                   ; preds = %117, %.critedge2.thread
  %.058.lcssa = phi i32 [ 0, %.critedge2.thread ], [ %.3, %117 ]
  %85 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %.058.lcssa)
  ret i32 0

86:                                               ; preds = %.lr.ph106, %._crit_edge102
  %indvars.iv133 = phi i64 [ 0, %.lr.ph106 ], [ %indvars.iv.next134, %._crit_edge102 ]
  %.1104 = phi i32 [ %.058110, %.lr.ph106 ], [ %.2, %._crit_edge102 ]
  %87 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @primes, i64 noundef %indvars.iv133) #6
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = load i32, ptr %84, align 4, !tbaa !5
  %.not69 = icmp sgt i32 %88, %89
  br i1 %.not69, label %.critedge4, label %.preheader

.preheader:                                       ; preds = %86
  %90 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @primes, i64 noundef %indvars.iv133) #6
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = srem i32 %89, %91
  %93 = icmp eq i32 %92, 0
  br i1 %93, label %.lr.ph101, label %._crit_edge102

.critedge4:                                       ; preds = %86, %._crit_edge102, %.preheader74
  %.1.lcssa = phi i32 [ %.058110, %.preheader74 ], [ %.2, %._crit_edge102 ], [ %.1104, %86 ]
  %94 = getelementptr inbounds [6000 x i32], ptr @a, i64 0, i64 %indvars.iv136
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = icmp sgt i32 %95, 1
  br i1 %96, label %111, label %117

.lr.ph101:                                        ; preds = %.preheader, %.lr.ph101
  %.0100 = phi i32 [ %97, %.lr.ph101 ], [ 0, %.preheader ]
  %97 = add nuw nsw i32 %.0100, 1
  %98 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @primes, i64 noundef %indvars.iv133) #6
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = load i32, ptr %84, align 4, !tbaa !5
  %101 = sdiv i32 %100, %99
  store i32 %101, ptr %84, align 4, !tbaa !5
  %102 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @primes, i64 noundef %indvars.iv133) #6
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = srem i32 %101, %103
  %105 = icmp eq i32 %104, 0
  br i1 %105, label %.lr.ph101, label %._crit_edge102, !llvm.loop !19

._crit_edge102:                                   ; preds = %.lr.ph101, %.preheader
  %.0.lcssa = phi i32 [ 0, %.preheader ], [ %97, %.lr.ph101 ]
  %106 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @primes, i64 noundef %indvars.iv133) #6
  %107 = call noundef i64 @_ZNKSt3setIiSt4lessIiESaIiEE5countERKi(ptr noundef nonnull align 8 dereferenceable(48) @b, ptr noundef nonnull align 4 dereferenceable(4) %106)
  %.not71 = icmp eq i64 %107, 0
  %108 = sub nsw i32 0, %.0.lcssa
  %.2.p = select i1 %.not71, i32 %.0.lcssa, i32 %108
  %.2 = add i32 %.2.p, %.1104
  %indvars.iv.next134 = add nuw nsw i64 %indvars.iv133, 1
  %109 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @primes) #6
  %110 = icmp ugt i64 %109, %indvars.iv.next134
  br i1 %110, label %86, label %.critedge4, !llvm.loop !20

111:                                              ; preds = %.critedge4
  %112 = call noundef i64 @_ZNKSt3setIiSt4lessIiESaIiEE5countERKi(ptr noundef nonnull align 8 dereferenceable(48) @b, ptr noundef nonnull align 4 dereferenceable(4) %94)
  %.not70 = icmp eq i64 %112, 0
  br i1 %.not70, label %115, label %113

113:                                              ; preds = %111
  %114 = add nsw i32 %.1.lcssa, -1
  br label %117

115:                                              ; preds = %111
  %116 = add nsw i32 %.1.lcssa, 1
  br label %117

117:                                              ; preds = %.critedge4, %115, %113
  %.3 = phi i32 [ %114, %113 ], [ %116, %115 ], [ %.1.lcssa, %.critedge4 ]
  %indvars.iv.next137 = add nuw nsw i64 %indvars.iv136, 1
  %118 = load i32, ptr @n, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = icmp slt i64 %indvars.iv.next137, %119
  br i1 %120, label %.preheader74, label %._crit_edge112, !llvm.loop !21
}

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

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

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

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

; 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 #0 align 2

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

; 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 noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = { 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}
!21 = distinct !{!21, !10}


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