; LLVM IR from tangjz/acm-icpc :: lydsy (5348)

; 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::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long long, std::pair<const long long, int>, std::_Select1st<std::pair<const long long, int>>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, std::pair<const long long, int>, std::_Select1st<std::pair<const long long, int>>, std::less<long long>>::_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::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl" }
%"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl" = type { %"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl_data" }
%"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"struct.std::_Rb_tree_iterator" = type { ptr }
%"struct.std::pair.6" = type <{ i64, i32, [4 x i8] }>
%"struct.std::pair.3" = type <{ %"struct.std::_Rb_tree_iterator", i8, [7 x i8] }>
%"struct.std::pair" = type <{ i64, i32, [4 x i8] }>

@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca %"class.std::map", align 8
  %6 = alloca %"class.std::queue", align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %11 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca %"struct.std::pair.6", align 8
  %15 = alloca i32, align 4
  %16 = alloca { i64, i32 }, align 8
  %17 = alloca %"struct.std::pair.3", align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %21 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %22 = alloca i64, align 8
  %23 = alloca i64, align 8
  %24 = alloca i64, align 8
  %25 = alloca i32, align 4
  %26 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #8
  store i64 1, ptr %4, align 8, !tbaa !5
  %27 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2, ptr noundef %3)
  call void @llvm.lifetime.start.p0(i64 48, ptr %5) #8
  call void @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #8
  call void @llvm.lifetime.start.p0(i64 80, ptr %6) #8
  invoke void @_ZNSt5queueIxSt5dequeIxSaIxEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %6)
          to label %28 unwind label %45

28:                                               ; preds = %0
  invoke void @_ZNSt5queueIxSt5dequeIxSaIxEEE4pushERKx(ptr noundef nonnull align 8 dereferenceable(80) %6, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %29 unwind label %49

29:                                               ; preds = %28
  br label %30

30:                                               ; preds = %120, %29
  %31 = invoke noundef zeroext i1 @_ZNKSt5queueIxSt5dequeIxSaIxEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %6)
          to label %32 unwind label %49

32:                                               ; preds = %30
  %33 = xor i1 %31, true
  br i1 %33, label %34, label %122

34:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  %35 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5queueIxSt5dequeIxSaIxEEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %6)
          to label %36 unwind label %53

36:                                               ; preds = %34
  %37 = load i64, ptr %35, align 8, !tbaa !5
  store i64 %37, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  %38 = call ptr @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %5) #8
  %39 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %10, i32 0, i32 0
  store ptr %38, ptr %39, align 8
  br label %40

40:                                               ; preds = %77, %36
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  %41 = call ptr @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %5) #8
  %42 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %11, i32 0, i32 0
  store ptr %41, ptr %42, align 8
  %43 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKxiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  br i1 %43, label %57, label %44

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

45:                                               ; preds = %0
  %46 = landingpad { ptr, i32 }
          cleanup
  %47 = extractvalue { ptr, i32 } %46, 0
  store ptr %47, ptr %7, align 8
  %48 = extractvalue { ptr, i32 } %46, 1
  store i32 %48, ptr %8, align 4
  br label %207

49:                                               ; preds = %201, %119, %30, %28
  %50 = landingpad { ptr, i32 }
          cleanup
  %51 = extractvalue { ptr, i32 } %50, 0
  store ptr %51, ptr %7, align 8
  %52 = extractvalue { ptr, i32 } %50, 1
  store i32 %52, ptr %8, align 4
  br label %206

53:                                               ; preds = %79, %34
  %54 = landingpad { ptr, i32 }
          cleanup
  %55 = extractvalue { ptr, i32 } %54, 0
  store ptr %55, ptr %7, align 8
  %56 = extractvalue { ptr, i32 } %54, 1
  store i32 %56, ptr %8, align 4
  br label %121

57:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  %58 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %10) #8
  %59 = getelementptr inbounds %"struct.std::pair", ptr %58, i32 0, i32 0
  %60 = load i64, ptr %59, align 8, !tbaa !9
  store i64 %60, ptr %13, align 8, !tbaa !5
  br label %61

61:                                               ; preds = %68, %57
  %62 = load i64, ptr %9, align 8, !tbaa !5
  %63 = load i64, ptr %13, align 8, !tbaa !5
  %64 = srem i64 %62, %63
  %65 = icmp eq i64 %64, 0
  br i1 %65, label %67, label %66

66:                                               ; preds = %61
  store i32 8, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  br label %76

67:                                               ; preds = %61
  br label %68

68:                                               ; preds = %67
  %69 = load i64, ptr %13, align 8, !tbaa !5
  %70 = load i64, ptr %9, align 8, !tbaa !5
  %71 = sdiv i64 %70, %69
  store i64 %71, ptr %9, align 8, !tbaa !5
  %72 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %10) #8
  %73 = getelementptr inbounds %"struct.std::pair", ptr %72, i32 0, i32 1
  %74 = load i32, ptr %73, align 8, !tbaa !12
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %73, align 8, !tbaa !12
  br label %61, !llvm.loop !13

76:                                               ; preds = %66
  br label %77

77:                                               ; preds = %76
  %78 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKxiEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %10) #8
  br label %40, !llvm.loop !15

79:                                               ; preds = %44
  %80 = load i64, ptr %9, align 8, !tbaa !5
  %81 = invoke noundef zeroext i1 @_Z12miller_rabinx(i64 noundef %80)
          to label %82 unwind label %53

82:                                               ; preds = %79
  br i1 %81, label %83, label %96

83:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  store i32 1, ptr %15, align 4, !tbaa !16
  %84 = invoke { i64, i32 } @_ZSt9make_pairIRxiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 4 dereferenceable(4) %15)
          to label %85 unwind label %92

85:                                               ; preds = %83
  store { i64, i32 } %84, ptr %16, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %14, ptr align 8 %16, i64 12, i1 false)
  %86 = invoke { ptr, i8 } @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEE6insertIS2_IxiEEENSt9enable_ifIXsr16is_constructibleIS4_T_EE5valueES2_ISt17_Rb_tree_iteratorIS4_EbEE4typeEOSA_(ptr noundef nonnull align 8 dereferenceable(48) %5, ptr noundef nonnull align 8 dereferenceable(12) %14)
          to label %87 unwind label %92

87:                                               ; preds = %85
  %88 = getelementptr inbounds { ptr, i8 }, ptr %17, i32 0, i32 0
  %89 = extractvalue { ptr, i8 } %86, 0
  store ptr %89, ptr %88, align 8
  %90 = getelementptr inbounds { ptr, i8 }, ptr %17, i32 0, i32 1
  %91 = extractvalue { ptr, i8 } %86, 1
  store i8 %91, ptr %90, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #8
  br label %118

92:                                               ; preds = %85, %83
  %93 = landingpad { ptr, i32 }
          cleanup
  %94 = extractvalue { ptr, i32 } %93, 0
  store ptr %94, ptr %7, align 8
  %95 = extractvalue { ptr, i32 } %93, 1
  store i32 %95, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #8
  br label %121

96:                                               ; preds = %82
  %97 = load i64, ptr %9, align 8, !tbaa !5
  %98 = icmp sgt i64 %97, 1
  br i1 %98, label %99, label %117

99:                                               ; preds = %96
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  %100 = load i64, ptr %9, align 8, !tbaa !5
  %101 = invoke noundef i64 @_Z11pollard_rhox(i64 noundef %100)
          to label %102 unwind label %108

102:                                              ; preds = %99
  store i64 %101, ptr %18, align 8, !tbaa !5
  invoke void @_ZNSt5queueIxSt5dequeIxSaIxEEE4pushERKx(ptr noundef nonnull align 8 dereferenceable(80) %6, ptr noundef nonnull align 8 dereferenceable(8) %18)
          to label %103 unwind label %108

103:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  %104 = load i64, ptr %9, align 8, !tbaa !5
  %105 = load i64, ptr %18, align 8, !tbaa !5
  %106 = sdiv i64 %104, %105
  store i64 %106, ptr %19, align 8, !tbaa !5
  invoke void @_ZNSt5queueIxSt5dequeIxSaIxEEE4pushEOx(ptr noundef nonnull align 8 dereferenceable(80) %6, ptr noundef nonnull align 8 dereferenceable(8) %19)
          to label %107 unwind label %112

107:                                              ; preds = %103
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  br label %117

108:                                              ; preds = %102, %99
  %109 = landingpad { ptr, i32 }
          cleanup
  %110 = extractvalue { ptr, i32 } %109, 0
  store ptr %110, ptr %7, align 8
  %111 = extractvalue { ptr, i32 } %109, 1
  store i32 %111, ptr %8, align 4
  br label %116

112:                                              ; preds = %103
  %113 = landingpad { ptr, i32 }
          cleanup
  %114 = extractvalue { ptr, i32 } %113, 0
  store ptr %114, ptr %7, align 8
  %115 = extractvalue { ptr, i32 } %113, 1
  store i32 %115, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  br label %116

116:                                              ; preds = %112, %108
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  br label %121

117:                                              ; preds = %107, %96
  br label %118

118:                                              ; preds = %117, %87
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  br label %119

119:                                              ; preds = %118
  invoke void @_ZNSt5queueIxSt5dequeIxSaIxEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %6)
          to label %120 unwind label %49

120:                                              ; preds = %119
  br label %30, !llvm.loop !17

121:                                              ; preds = %116, %92, %53
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  br label %206

122:                                              ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #8
  %123 = call ptr @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %5) #8
  %124 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %20, i32 0, i32 0
  store ptr %123, ptr %124, align 8
  br label %125

125:                                              ; preds = %199, %122
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #8
  %126 = call ptr @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %5) #8
  %127 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %21, i32 0, i32 0
  store ptr %126, ptr %127, align 8
  %128 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKxiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %20, ptr noundef nonnull align 8 dereferenceable(8) %21) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  br i1 %128, label %130, label %129

129:                                              ; preds = %125
  store i32 11, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  br label %201

130:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #8
  %131 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %20) #8
  %132 = getelementptr inbounds %"struct.std::pair", ptr %131, i32 0, i32 0
  %133 = load i64, ptr %132, align 8, !tbaa !9
  store i64 %133, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #8
  %134 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %20) #8
  %135 = getelementptr inbounds %"struct.std::pair", ptr %134, i32 0, i32 1
  %136 = load i32, ptr %135, align 8, !tbaa !12
  %137 = sext i32 %136 to i64
  store i64 %137, ptr %23, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #8
  %138 = load i64, ptr %22, align 8, !tbaa !5
  %139 = sub nsw i64 %138, 1
  store i64 %139, ptr %24, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #8
  store i32 1, ptr %25, align 4, !tbaa !16
  br label %140

140:                                              ; preds = %150, %130
  %141 = load i32, ptr %25, align 4, !tbaa !16
  %142 = sext i32 %141 to i64
  %143 = load i64, ptr %23, align 8, !tbaa !5
  %144 = icmp slt i64 %142, %143
  br i1 %144, label %146, label %145

145:                                              ; preds = %140
  store i32 14, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #8
  br label %153

146:                                              ; preds = %140
  %147 = load i64, ptr %22, align 8, !tbaa !5
  %148 = load i64, ptr %24, align 8, !tbaa !5
  %149 = mul nsw i64 %148, %147
  store i64 %149, ptr %24, align 8, !tbaa !5
  br label %150

150:                                              ; preds = %146
  %151 = load i32, ptr %25, align 4, !tbaa !16
  %152 = add nsw i32 %151, 1
  store i32 %152, ptr %25, align 4, !tbaa !16
  br label %140, !llvm.loop !18

153:                                              ; preds = %145
  %154 = load i64, ptr %22, align 8, !tbaa !5
  %155 = icmp eq i64 %154, 2
  br i1 %155, label %156, label %162

156:                                              ; preds = %153
  %157 = load i64, ptr %23, align 8, !tbaa !5
  %158 = icmp sge i64 %157, 3
  br i1 %158, label %159, label %162

159:                                              ; preds = %156
  %160 = load i64, ptr %24, align 8, !tbaa !5
  %161 = sdiv i64 %160, 2
  store i64 %161, ptr %24, align 8, !tbaa !5
  br label %162

162:                                              ; preds = %159, %156, %153
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #8
  br label %163

163:                                              ; preds = %175, %162
  %164 = load i64, ptr %24, align 8, !tbaa !5
  %165 = load i64, ptr %3, align 8, !tbaa !5
  %166 = invoke noundef i64 @_ZSt5__gcdIxET_S0_S0_(i64 noundef %164, i64 noundef %165)
          to label %167 unwind label %170

167:                                              ; preds = %163
  store i64 %166, ptr %26, align 8, !tbaa !5
  %168 = icmp sgt i64 %166, 1
  br i1 %168, label %174, label %169

169:                                              ; preds = %167
  store i32 17, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #8
  br label %179

170:                                              ; preds = %163
  %171 = landingpad { ptr, i32 }
          cleanup
  %172 = extractvalue { ptr, i32 } %171, 0
  store ptr %172, ptr %7, align 8
  %173 = extractvalue { ptr, i32 } %171, 1
  store i32 %173, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  br label %206

174:                                              ; preds = %167
  br label %175

175:                                              ; preds = %174
  %176 = load i64, ptr %26, align 8, !tbaa !5
  %177 = load i64, ptr %24, align 8, !tbaa !5
  %178 = sdiv i64 %177, %176
  store i64 %178, ptr %24, align 8, !tbaa !5
  br label %163, !llvm.loop !19

179:                                              ; preds = %169
  %180 = load i64, ptr %22, align 8, !tbaa !5
  %181 = icmp eq i64 %180, 2
  br i1 %181, label %182, label %194

182:                                              ; preds = %179
  %183 = load i64, ptr %23, align 8, !tbaa !5
  %184 = icmp sge i64 %183, 3
  br i1 %184, label %185, label %194

185:                                              ; preds = %182
  %186 = load i64, ptr %24, align 8, !tbaa !5
  %187 = mul nsw i64 %186, 2
  %188 = load i64, ptr %3, align 8, !tbaa !5
  %189 = and i64 %188, 1
  %190 = icmp ne i64 %189, 0
  %191 = xor i1 %190, true
  %192 = zext i1 %191 to i64
  %193 = sub nsw i64 %187, %192
  store i64 %193, ptr %24, align 8, !tbaa !5
  br label %194

194:                                              ; preds = %185, %182, %179
  %195 = load i64, ptr %24, align 8, !tbaa !5
  %196 = add nsw i64 %195, 1
  %197 = load i64, ptr %4, align 8, !tbaa !5
  %198 = mul nsw i64 %197, %196
  store i64 %198, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #8
  br label %199

199:                                              ; preds = %194
  %200 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKxiEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %20) #8
  br label %125, !llvm.loop !20

201:                                              ; preds = %129
  %202 = load i64, ptr %4, align 8, !tbaa !5
  %203 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %202)
          to label %204 unwind label %49

204:                                              ; preds = %201
  store i32 0, ptr %1, align 4
  store i32 1, ptr %12, align 4
  call void @_ZNSt5queueIxSt5dequeIxSaIxEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %6) #8
  call void @llvm.lifetime.end.p0(i64 80, ptr %6) #8
  call void @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #8
  %205 = load i32, ptr %1, align 4
  ret i32 %205

206:                                              ; preds = %170, %121, %49
  call void @_ZNSt5queueIxSt5dequeIxSaIxEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %6) #8
  br label %207

207:                                              ; preds = %206, %45
  call void @llvm.lifetime.end.p0(i64 80, ptr %6) #8
  call void @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #8
  br label %208

208:                                              ; preds = %207
  %209 = load ptr, ptr %7, align 8
  %210 = load i32, ptr %8, align 4
  %211 = insertvalue { ptr, i32 } poison, ptr %209, 0
  %212 = insertvalue { ptr, i32 } %211, i32 %210, 1
  resume { ptr, i32 } %212
}

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5queueIxSt5dequeIxSaIxEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #4 align 2

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z12miller_rabinx(i64 noundef) #5

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_Z11pollard_rhox(i64 noundef) #5

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZSt5__gcdIxET_S0_S0_(i64 noundef, i64 noundef) #3

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueIxSt5dequeIxSaIxEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #7 align 2

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

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

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

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


; 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::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long long, std::pair<const long long, int>, std::_Select1st<std::pair<const long long, int>>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, std::pair<const long long, int>, std::_Select1st<std::pair<const long long, int>>, std::less<long long>>::_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::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl" }
%"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl" = type { %"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl_data" }
%"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"struct.std::_Rb_tree_iterator" = type { ptr }
%"struct.std::pair.6" = type <{ i64, i32, [4 x i8] }>

@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca %"class.std::map", align 8
  %4 = alloca %"class.std::queue", align 8
  %5 = alloca i64, align 8
  %6 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %7 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %8 = alloca %"struct.std::pair.6", align 8
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %13 = alloca %"struct.std::_Rb_tree_iterator", align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2)
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %3) #7
  call void @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #7
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %4) #7
  invoke void @_ZNSt5queueIxSt5dequeIxSaIxEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
          to label %15 unwind label %25

15:                                               ; preds = %0
  invoke void @_ZNSt5queueIxSt5dequeIxSaIxEEE4pushERKx(ptr noundef nonnull align 8 dereferenceable(80) %4, ptr noundef nonnull align 8 dereferenceable(8) %1)
          to label %.preheader unwind label %27

.preheader:                                       ; preds = %15
  %16 = call noundef zeroext i1 @_ZNKSt5queueIxSt5dequeIxSaIxEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
  br i1 %16, label %._crit_edge47, label %.lr.ph46

.lr.ph46:                                         ; preds = %.preheader
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %8, i64 8
  br label %17

17:                                               ; preds = %.lr.ph46, %72
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %18 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5queueIxSt5dequeIxSaIxEEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
  %19 = load i64, ptr %18, align 8, !tbaa !5
  store i64 %19, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  %20 = call ptr @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %3) #7
  store ptr %20, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #7
  %21 = call ptr @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %3) #7
  store ptr %21, ptr %7, align 8
  %22 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKxiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  br i1 %22, label %.lr.ph44, label %._crit_edge45

._crit_edge45:                                    ; preds = %._crit_edge, %17
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  %23 = load i64, ptr %5, align 8, !tbaa !5
  %24 = invoke noundef zeroext i1 @_Z12miller_rabinx(i64 noundef %23)
          to label %48 unwind label %29

25:                                               ; preds = %0
  %26 = landingpad { ptr, i32 }
          cleanup
  br label %114

27:                                               ; preds = %15
  %28 = landingpad { ptr, i32 }
          cleanup
  br label %113

29:                                               ; preds = %._crit_edge45
  %30 = landingpad { ptr, i32 }
          cleanup
  br label %74

.lr.ph44:                                         ; preds = %17, %._crit_edge
  %31 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  %32 = load i64, ptr %31, align 8, !tbaa !9
  %33 = load i64, ptr %5, align 8, !tbaa !5
  %34 = srem i64 %33, %32
  %35 = icmp eq i64 %34, 0
  br i1 %35, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph44
  %36 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKxiEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #7
  %37 = call ptr @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %3) #7
  store ptr %37, ptr %7, align 8
  %38 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKxiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  br i1 %38, label %.lr.ph44, label %._crit_edge45, !llvm.loop !12

.lr.ph:                                           ; preds = %.lr.ph44, %.lr.ph
  %39 = phi i64 [ %45, %.lr.ph ], [ %33, %.lr.ph44 ]
  %40 = sdiv i64 %39, %32
  store i64 %40, ptr %5, align 8, !tbaa !5
  %41 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  %42 = getelementptr inbounds i8, ptr %41, i64 8
  %43 = load i32, ptr %42, align 8, !tbaa !14
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %42, align 8, !tbaa !14
  %45 = load i64, ptr %5, align 8, !tbaa !5
  %46 = srem i64 %45, %32
  %47 = icmp eq i64 %46, 0
  br i1 %47, label %.lr.ph, label %._crit_edge, !llvm.loop !15

48:                                               ; preds = %._crit_edge45
  br i1 %24, label %49, label %56

49:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #7
  store i32 1, ptr %9, align 4, !tbaa !16
  %50 = invoke { i64, i32 } @_ZSt9make_pairIRxiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %51 unwind label %54

51:                                               ; preds = %49
  %.fca.0.extract = extractvalue { i64, i32 } %50, 0
  %.fca.1.extract = extractvalue { i64, i32 } %50, 1
  store i64 %.fca.0.extract, ptr %8, align 8
  store i32 %.fca.1.extract, ptr %.sroa.2.0..sroa_idx, align 8
  %52 = invoke { ptr, i8 } @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEE6insertIS2_IxiEEENSt9enable_ifIXsr16is_constructibleIS4_T_EE5valueES2_ISt17_Rb_tree_iteratorIS4_EbEE4typeEOSA_(ptr noundef nonnull align 8 dereferenceable(48) %3, ptr noundef nonnull align 8 dereferenceable(12) %8)
          to label %53 unwind label %54

53:                                               ; preds = %51
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #7
  br label %72

54:                                               ; preds = %51, %49
  %55 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #7
  br label %74

56:                                               ; preds = %48
  %57 = load i64, ptr %5, align 8, !tbaa !5
  %58 = icmp sgt i64 %57, 1
  br i1 %58, label %59, label %72

59:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #7
  %60 = invoke noundef i64 @_Z11pollard_rhox(i64 noundef %57)
          to label %61 unwind label %67

61:                                               ; preds = %59
  store i64 %60, ptr %10, align 8, !tbaa !5
  invoke void @_ZNSt5queueIxSt5dequeIxSaIxEEE4pushERKx(ptr noundef nonnull align 8 dereferenceable(80) %4, ptr noundef nonnull align 8 dereferenceable(8) %10)
          to label %62 unwind label %67

62:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #7
  %63 = load i64, ptr %5, align 8, !tbaa !5
  %64 = load i64, ptr %10, align 8, !tbaa !5
  %65 = sdiv i64 %63, %64
  store i64 %65, ptr %11, align 8, !tbaa !5
  invoke void @_ZNSt5queueIxSt5dequeIxSaIxEEE4pushEOx(ptr noundef nonnull align 8 dereferenceable(80) %4, ptr noundef nonnull align 8 dereferenceable(8) %11)
          to label %66 unwind label %69

66:                                               ; preds = %62
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #7
  br label %72

67:                                               ; preds = %61, %59
  %68 = landingpad { ptr, i32 }
          cleanup
  br label %71

69:                                               ; preds = %62
  %70 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #7
  br label %71

71:                                               ; preds = %69, %67
  %.pn = phi { ptr, i32 } [ %70, %69 ], [ %68, %67 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #7
  br label %74

72:                                               ; preds = %56, %66, %53
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  call void @_ZNSt5queueIxSt5dequeIxSaIxEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
  %73 = call noundef zeroext i1 @_ZNKSt5queueIxSt5dequeIxSaIxEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
  br i1 %73, label %._crit_edge47, label %17, !llvm.loop !17

74:                                               ; preds = %71, %54, %29
  %.pn39 = phi { ptr, i32 } [ %55, %54 ], [ %.pn, %71 ], [ %30, %29 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  br label %113

._crit_edge47:                                    ; preds = %72, %.preheader
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #7
  %75 = call ptr @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %3) #7
  store ptr %75, ptr %12, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #7
  %76 = call ptr @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %3) #7
  store ptr %76, ptr %13, align 8
  %77 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKxiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(8) %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #7
  br i1 %77, label %.lr.ph60, label %._crit_edge61

._crit_edge61:                                    ; preds = %107, %._crit_edge47
  %.027.lcssa = phi i64 [ 1, %._crit_edge47 ], [ %109, %107 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #7
  %78 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %.027.lcssa)
  call void @_ZNSt5queueIxSt5dequeIxSaIxEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %4) #7
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %4) #7
  call void @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  ret i32 0

.lr.ph60:                                         ; preds = %._crit_edge47, %107
  %.02758 = phi i64 [ %109, %107 ], [ 1, %._crit_edge47 ]
  %79 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #7
  %80 = load i64, ptr %79, align 8, !tbaa !9
  %81 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #7
  %82 = getelementptr inbounds i8, ptr %81, i64 8
  %83 = load i32, ptr %82, align 8, !tbaa !14
  %84 = add nsw i64 %80, -1
  %85 = icmp sgt i32 %83, 1
  br i1 %85, label %.lr.ph51.preheader, label %._crit_edge52

.lr.ph51.preheader:                               ; preds = %.lr.ph60
  %86 = add nsw i32 %83, -1
  %87 = add nsw i32 %83, -2
  %xtraiter = and i32 %86, 7
  %88 = icmp ult i32 %87, 7
  br i1 %88, label %._crit_edge52.loopexit.unr-lcssa, label %.lr.ph51.preheader.new

.lr.ph51.preheader.new:                           ; preds = %.lr.ph51.preheader
  %unroll_iter = and i32 %86, -8
  %factor.op.mul = mul i64 %80, %80
  %factor.op.mul76 = mul i64 %factor.op.mul, %80
  %factor.op.mul77 = mul i64 %factor.op.mul76, %80
  %factor.op.mul78 = mul i64 %factor.op.mul77, %80
  %factor.op.mul79 = mul i64 %factor.op.mul78, %80
  %factor.op.mul80 = mul i64 %factor.op.mul79, %80
  %factor.op.mul81 = mul i64 %factor.op.mul80, %80
  br label %.lr.ph51

._crit_edge52.loopexit.unr-lcssa:                 ; preds = %.lr.ph51, %.lr.ph51.preheader
  %.lcssa.ph = phi i64 [ poison, %.lr.ph51.preheader ], [ %.reass.reass.reass.reass.reass.reass.reass, %.lr.ph51 ]
  %.02648.unr = phi i64 [ %84, %.lr.ph51.preheader ], [ %.reass.reass.reass.reass.reass.reass.reass, %.lr.ph51 ]
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge52, label %.lr.ph51.epil

.lr.ph51.epil:                                    ; preds = %._crit_edge52.loopexit.unr-lcssa, %.lr.ph51.epil
  %.02648.epil = phi i64 [ %89, %.lr.ph51.epil ], [ %.02648.unr, %._crit_edge52.loopexit.unr-lcssa ]
  %epil.iter = phi i32 [ %epil.iter.next, %.lr.ph51.epil ], [ 0, %._crit_edge52.loopexit.unr-lcssa ]
  %89 = mul nsw i64 %.02648.epil, %80
  %epil.iter.next = add i32 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge52, label %.lr.ph51.epil, !llvm.loop !18

._crit_edge52:                                    ; preds = %._crit_edge52.loopexit.unr-lcssa, %.lr.ph51.epil, %.lr.ph60
  %.026.lcssa = phi i64 [ %84, %.lr.ph60 ], [ %.lcssa.ph, %._crit_edge52.loopexit.unr-lcssa ], [ %89, %.lr.ph51.epil ]
  %90 = icmp eq i64 %80, 2
  %91 = icmp sgt i32 %83, 2
  %or.cond = and i1 %90, %91
  %92 = sdiv i64 %.026.lcssa, 2
  %.1 = select i1 %or.cond, i64 %92, i64 %.026.lcssa
  %93 = load i64, ptr %2, align 8, !tbaa !5
  %94 = call noundef i64 @_ZSt5__gcdIxET_S0_S0_(i64 noundef %.1, i64 noundef %93)
  %95 = icmp sgt i64 %94, 1
  br i1 %95, label %.lr.ph55, label %._crit_edge56

.lr.ph51:                                         ; preds = %.lr.ph51, %.lr.ph51.preheader.new
  %.02648 = phi i64 [ %84, %.lr.ph51.preheader.new ], [ %.reass.reass.reass.reass.reass.reass.reass, %.lr.ph51 ]
  %niter = phi i32 [ 0, %.lr.ph51.preheader.new ], [ %niter.next.7, %.lr.ph51 ]
  %.reass.reass.reass.reass.reass.reass.reass = mul i64 %.02648, %factor.op.mul81
  %niter.next.7 = add i32 %niter, 8
  %niter.ncmp.7 = icmp eq i32 %niter.next.7, %unroll_iter
  br i1 %niter.ncmp.7, label %._crit_edge52.loopexit.unr-lcssa, label %.lr.ph51, !llvm.loop !20

._crit_edge56:                                    ; preds = %.lr.ph55, %._crit_edge52
  %.2.lcssa = phi i64 [ %.1, %._crit_edge52 ], [ %97, %.lr.ph55 ]
  br i1 %or.cond, label %101, label %107

.lr.ph55:                                         ; preds = %._crit_edge52, %.lr.ph55
  %96 = phi i64 [ %99, %.lr.ph55 ], [ %94, %._crit_edge52 ]
  %.253 = phi i64 [ %97, %.lr.ph55 ], [ %.1, %._crit_edge52 ]
  %97 = sdiv i64 %.253, %96
  %98 = load i64, ptr %2, align 8, !tbaa !5
  %99 = call noundef i64 @_ZSt5__gcdIxET_S0_S0_(i64 noundef %97, i64 noundef %98)
  %100 = icmp sgt i64 %99, 1
  br i1 %100, label %.lr.ph55, label %._crit_edge56, !llvm.loop !21

101:                                              ; preds = %._crit_edge56
  %102 = shl nsw i64 %.2.lcssa, 1
  %103 = load i64, ptr %2, align 8, !tbaa !5
  %104 = and i64 %103, 1
  %105 = xor i64 %104, 1
  %106 = sub nsw i64 %102, %105
  br label %107

107:                                              ; preds = %101, %._crit_edge56
  %.3 = phi i64 [ %106, %101 ], [ %.2.lcssa, %._crit_edge56 ]
  %108 = add nsw i64 %.3, 1
  %109 = mul nsw i64 %108, %.02758
  %110 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKxiEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #7
  %111 = call ptr @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %3) #7
  store ptr %111, ptr %13, align 8
  %112 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKxiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(8) %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #7
  br i1 %112, label %.lr.ph60, label %._crit_edge61, !llvm.loop !22

113:                                              ; preds = %74, %27
  %.pn39.pn = phi { ptr, i32 } [ %.pn39, %74 ], [ %28, %27 ]
  call void @_ZNSt5queueIxSt5dequeIxSaIxEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %4) #7
  br label %114

114:                                              ; preds = %113, %25
  %.pn39.pn.pn = phi { ptr, i32 } [ %.pn39.pn, %113 ], [ %26, %25 ]
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %4) #7
  call void @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  resume { ptr, i32 } %.pn39.pn.pn
}

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5queueIxSt5dequeIxSaIxEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #4 align 2

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKxiEES5_(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 @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #3 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 nounwind uwtable
declare dso_local noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxiEEptEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z12miller_rabinx(i64 noundef) local_unnamed_addr #5

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_Z11pollard_rhox(i64 noundef) local_unnamed_addr #5

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZSt5__gcdIxET_S0_S0_(i64 noundef, i64 noundef) local_unnamed_addr #3

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueIxSt5dequeIxSaIxEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #6 align 2

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"_ZTSSt4pairIKxiE", !6, i64 0, !11, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!10, !11, i64 8}
!15 = distinct !{!15, !13}
!16 = !{!11, !11, i64 0}
!17 = distinct !{!17, !13}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.unroll.disable"}
!20 = distinct !{!20, !13}
!21 = distinct !{!21, !13}
!22 = distinct !{!22, !13}


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