; LLVM IR from ShahjalalShohag/code-library :: Number Theory/Discrete Root Faster.ll (Z9peth_rootxxix)

; 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 }
%"struct.std::_Rb_tree_iterator" = type { ptr }

@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [101 x i8], align 1
@__PRETTY_FUNCTION__._Z9peth_rootxxix = external hidden unnamed_addr constant [30 x i8], align 1

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z9peth_rootxxix(i64 noundef %0, i64 noundef %1, i32 noundef %2, i64 noundef %3) #2 personality ptr @__gxx_personality_v0 {
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca %"class.std::map", align 8
  %15 = alloca i64, align 8
  %16 = alloca i32, align 4
  %17 = alloca i64, align 8
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i64, align 8
  %24 = alloca i64, align 8
  %25 = alloca i32, align 4
  %26 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %27 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %28 = alloca i32, align 4
  store i64 %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  store i64 %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %29 = load i64, ptr %8, align 8, !tbaa !5
  %30 = sub nsw i64 %29, 1
  store i64 %30, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %31

31:                                               ; preds = %36, %4
  %32 = load i64, ptr %9, align 8, !tbaa !5
  %33 = load i64, ptr %6, align 8, !tbaa !5
  %34 = srem i64 %32, %33
  %35 = icmp eq i64 %34, 0
  br i1 %35, label %36, label %42

36:                                               ; preds = %31
  %37 = load i64, ptr %6, align 8, !tbaa !5
  %38 = load i64, ptr %9, align 8, !tbaa !5
  %39 = sdiv i64 %38, %37
  store i64 %39, ptr %9, align 8, !tbaa !5
  %40 = load i32, ptr %10, align 4, !tbaa !9
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %10, align 4, !tbaa !9
  br label %31, !llvm.loop !11

42:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %43 = load i64, ptr %6, align 8, !tbaa !5
  %44 = load i32, ptr %7, align 4, !tbaa !9
  %45 = sext i32 %44 to i64
  %46 = load i64, ptr %8, align 8, !tbaa !5
  %47 = call noundef i64 @_Z5powerxxx(i64 noundef %43, i64 noundef %45, i64 noundef %46)
  store i64 %47, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %48 = load i64, ptr %5, align 8, !tbaa !5
  %49 = load i64, ptr %11, align 8, !tbaa !5
  %50 = sub nsw i64 %49, 1
  %51 = load i64, ptr %9, align 8, !tbaa !5
  %52 = load i64, ptr %11, align 8, !tbaa !5
  %53 = call noundef i64 @_Z7inversexx(i64 noundef %51, i64 noundef %52)
  %54 = mul nsw i64 %50, %53
  %55 = load i64, ptr %11, align 8, !tbaa !5
  %56 = srem i64 %54, %55
  %57 = load i64, ptr %9, align 8, !tbaa !5
  %58 = mul nsw i64 %56, %57
  %59 = add nsw i64 %58, 1
  %60 = load i64, ptr %11, align 8, !tbaa !5
  %61 = sdiv i64 %59, %60
  %62 = load i64, ptr %8, align 8, !tbaa !5
  %63 = call noundef i64 @_Z5powerxxx(i64 noundef %48, i64 noundef %61, i64 noundef %62)
  store i64 %63, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  store i64 2, ptr %13, align 8, !tbaa !5
  br label %64

64:                                               ; preds = %73, %42
  %65 = load i64, ptr %13, align 8, !tbaa !5
  %66 = load i64, ptr %8, align 8, !tbaa !5
  %67 = sub nsw i64 %66, 1
  %68 = load i64, ptr %6, align 8, !tbaa !5
  %69 = sdiv i64 %67, %68
  %70 = load i64, ptr %8, align 8, !tbaa !5
  %71 = call noundef i64 @_Z5powerxxx(i64 noundef %65, i64 noundef %69, i64 noundef %70)
  %72 = icmp eq i64 %71, 1
  br i1 %72, label %73, label %76

73:                                               ; preds = %64
  %74 = load i64, ptr %13, align 8, !tbaa !5
  %75 = add nsw i64 %74, 1
  store i64 %75, ptr %13, align 8, !tbaa !5
  br label %64, !llvm.loop !13

76:                                               ; preds = %64
  %77 = load i64, ptr %13, align 8, !tbaa !5
  %78 = load i64, ptr %9, align 8, !tbaa !5
  %79 = load i64, ptr %8, align 8, !tbaa !5
  %80 = call noundef i64 @_Z5powerxxx(i64 noundef %77, i64 noundef %78, i64 noundef %79)
  store i64 %80, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 48, ptr %14) #5
  call void @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %14) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  store i64 1, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %81 = load i32, ptr %10, align 4, !tbaa !9
  %82 = load i32, ptr %7, align 4, !tbaa !9
  %83 = sub nsw i32 %81, %82
  %84 = sitofp i32 %83 to double
  %85 = load i64, ptr %6, align 8, !tbaa !5
  %86 = sitofp i64 %85 to double
  %87 = fmul double %84, %86
  %88 = call double @sqrt(double noundef %87) #5
  %89 = fptosi double %88 to i32
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %91 = load i64, ptr %13, align 8, !tbaa !5
  %92 = load i32, ptr %16, align 4, !tbaa !9
  %93 = sext i32 %92 to i64
  %94 = load i64, ptr %6, align 8, !tbaa !5
  %95 = load i32, ptr %10, align 4, !tbaa !9
  %96 = sub nsw i32 %95, 1
  %97 = sext i32 %96 to i64
  %98 = load i64, ptr %8, align 8, !tbaa !5
  %99 = sub nsw i64 %98, 1
  %100 = call noundef i64 @_Z5powerxxx(i64 noundef %94, i64 noundef %97, i64 noundef %99)
  %101 = mul nsw i64 %93, %100
  %102 = load i64, ptr %8, align 8, !tbaa !5
  %103 = sub nsw i64 %102, 1
  %104 = srem i64 %101, %103
  %105 = load i64, ptr %8, align 8, !tbaa !5
  %106 = call noundef i64 @_Z5powerxxx(i64 noundef %91, i64 noundef %104, i64 noundef %105)
  store i64 %106, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %107

107:                                              ; preds = %121, %76
  %108 = load i32, ptr %18, align 4, !tbaa !9
  %109 = load i32, ptr %16, align 4, !tbaa !9
  %110 = icmp sle i32 %108, %109
  br i1 %110, label %112, label %111

111:                                              ; preds = %107
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %128

112:                                              ; preds = %107
  %113 = load i32, ptr %18, align 4, !tbaa !9
  %114 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %14, ptr noundef nonnull align 8 dereferenceable(8) %15)
          to label %115 unwind label %124

115:                                              ; preds = %112
  store i32 %113, ptr %114, align 4, !tbaa !9
  %116 = load i64, ptr %15, align 8, !tbaa !5
  %117 = load i64, ptr %17, align 8, !tbaa !5
  %118 = mul nsw i64 %116, %117
  %119 = load i64, ptr %8, align 8, !tbaa !5
  %120 = srem i64 %118, %119
  store i64 %120, ptr %15, align 8, !tbaa !5
  br label %121

121:                                              ; preds = %115
  %122 = load i32, ptr %18, align 4, !tbaa !9
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %18, align 4, !tbaa !9
  br label %107, !llvm.loop !14

124:                                              ; preds = %112
  %125 = landingpad { ptr, i32 }
          cleanup
  %126 = extractvalue { ptr, i32 } %125, 0
  store ptr %126, ptr %19, align 8
  %127 = extractvalue { ptr, i32 } %125, 1
  store i32 %127, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %243

128:                                              ; preds = %111
  %129 = load i64, ptr %13, align 8, !tbaa !5
  %130 = load i64, ptr %6, align 8, !tbaa !5
  %131 = load i32, ptr %10, align 4, !tbaa !9
  %132 = sub nsw i32 %131, 1
  %133 = sext i32 %132 to i64
  %134 = load i64, ptr %8, align 8, !tbaa !5
  %135 = sub nsw i64 %134, 1
  %136 = call noundef i64 @_Z5powerxxx(i64 noundef %130, i64 noundef %133, i64 noundef %135)
  %137 = load i64, ptr %8, align 8, !tbaa !5
  %138 = call noundef i64 @_Z5powerxxx(i64 noundef %129, i64 noundef %136, i64 noundef %137)
  %139 = load i64, ptr %8, align 8, !tbaa !5
  %140 = call noundef i64 @_Z7inversexx(i64 noundef %138, i64 noundef %139)
  store i64 %140, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  %141 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %141, ptr %21, align 4, !tbaa !9
  br label %142

142:                                              ; preds = %238, %128
  %143 = load i32, ptr %21, align 4, !tbaa !9
  %144 = load i32, ptr %10, align 4, !tbaa !9
  %145 = icmp slt i32 %143, %144
  br i1 %145, label %147, label %146

146:                                              ; preds = %142
  store i32 9, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  br label %241

147:                                              ; preds = %142
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #5
  %148 = load i64, ptr %12, align 8, !tbaa !5
  %149 = load i64, ptr %11, align 8, !tbaa !5
  %150 = load i64, ptr %8, align 8, !tbaa !5
  %151 = call noundef i64 @_Z5powerxxx(i64 noundef %148, i64 noundef %149, i64 noundef %150)
  %152 = load i64, ptr %8, align 8, !tbaa !5
  %153 = call noundef i64 @_Z7inversexx(i64 noundef %151, i64 noundef %152)
  %154 = load i64, ptr %5, align 8, !tbaa !5
  %155 = mul nsw i64 %153, %154
  %156 = load i64, ptr %8, align 8, !tbaa !5
  %157 = srem i64 %155, %156
  store i64 %157, ptr %23, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #5
  %158 = load i64, ptr %23, align 8, !tbaa !5
  %159 = load i64, ptr %6, align 8, !tbaa !5
  %160 = load i32, ptr %10, align 4, !tbaa !9
  %161 = sub nsw i32 %160, 1
  %162 = load i32, ptr %21, align 4, !tbaa !9
  %163 = sub nsw i32 %161, %162
  %164 = sext i32 %163 to i64
  %165 = load i64, ptr %8, align 8, !tbaa !5
  %166 = sub nsw i64 %165, 1
  %167 = call noundef i64 @_Z5powerxxx(i64 noundef %159, i64 noundef %164, i64 noundef %166)
  %168 = load i64, ptr %8, align 8, !tbaa !5
  %169 = call noundef i64 @_Z5powerxxx(i64 noundef %158, i64 noundef %167, i64 noundef %168)
  store i64 %169, ptr %24, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #5
  store i32 0, ptr %25, align 4, !tbaa !9
  br label %170

170:                                              ; preds = %232, %147
  %171 = load i32, ptr %25, align 4, !tbaa !9
  %172 = load i32, ptr %16, align 4, !tbaa !9
  %173 = icmp sle i32 %171, %172
  br i1 %173, label %175, label %174

174:                                              ; preds = %170
  store i32 12, ptr %22, align 4
  br label %235

175:                                              ; preds = %170
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #5
  %176 = invoke ptr @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEE4findERS3_(ptr noundef nonnull align 8 dereferenceable(48) %14, ptr noundef nonnull align 8 dereferenceable(8) %24)
          to label %177 unwind label %211

177:                                              ; preds = %175
  %178 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %26, i32 0, i32 0
  store ptr %176, ptr %178, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #5
  %179 = call ptr @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %14) #5
  %180 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %27, i32 0, i32 0
  store ptr %179, ptr %180, align 8
  %181 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKxiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %26, ptr noundef nonnull align 8 dereferenceable(8) %27) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #5
  br i1 %181, label %182, label %219

182:                                              ; preds = %177
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #5
  %183 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %14, ptr noundef nonnull align 8 dereferenceable(8) %24)
          to label %184 unwind label %215

184:                                              ; preds = %182
  %185 = load i32, ptr %183, align 4, !tbaa !9
  store i32 %185, ptr %28, align 4, !tbaa !9
  %186 = load i64, ptr %12, align 8, !tbaa !5
  %187 = load i64, ptr %13, align 8, !tbaa !5
  %188 = load i32, ptr %25, align 4, !tbaa !9
  %189 = load i32, ptr %16, align 4, !tbaa !9
  %190 = load i32, ptr %28, align 4, !tbaa !9
  %191 = mul nsw i32 %189, %190
  %192 = add nsw i32 %188, %191
  %193 = sext i32 %192 to i64
  %194 = load i64, ptr %6, align 8, !tbaa !5
  %195 = load i32, ptr %21, align 4, !tbaa !9
  %196 = load i32, ptr %7, align 4, !tbaa !9
  %197 = sub nsw i32 %195, %196
  %198 = sext i32 %197 to i64
  %199 = load i64, ptr %8, align 8, !tbaa !5
  %200 = sub nsw i64 %199, 1
  %201 = call noundef i64 @_Z5powerxxx(i64 noundef %194, i64 noundef %198, i64 noundef %200)
  %202 = mul nsw i64 %193, %201
  %203 = load i64, ptr %8, align 8, !tbaa !5
  %204 = sub nsw i64 %203, 1
  %205 = srem i64 %202, %204
  %206 = load i64, ptr %8, align 8, !tbaa !5
  %207 = call noundef i64 @_Z5powerxxx(i64 noundef %187, i64 noundef %205, i64 noundef %206)
  %208 = mul nsw i64 %186, %207
  %209 = load i64, ptr %8, align 8, !tbaa !5
  %210 = srem i64 %208, %209
  store i64 %210, ptr %12, align 8, !tbaa !5
  store i32 12, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #5
  br label %235

211:                                              ; preds = %175
  %212 = landingpad { ptr, i32 }
          cleanup
  %213 = extractvalue { ptr, i32 } %212, 0
  store ptr %213, ptr %19, align 8
  %214 = extractvalue { ptr, i32 } %212, 1
  store i32 %214, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #5
  br label %236

215:                                              ; preds = %182
  %216 = landingpad { ptr, i32 }
          cleanup
  %217 = extractvalue { ptr, i32 } %216, 0
  store ptr %217, ptr %19, align 8
  %218 = extractvalue { ptr, i32 } %216, 1
  store i32 %218, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #5
  br label %236

219:                                              ; preds = %177
  %220 = load i64, ptr %24, align 8, !tbaa !5
  %221 = load i64, ptr %17, align 8, !tbaa !5
  %222 = mul nsw i64 %220, %221
  %223 = load i64, ptr %8, align 8, !tbaa !5
  %224 = srem i64 %222, %223
  store i64 %224, ptr %24, align 8, !tbaa !5
  %225 = load i32, ptr %25, align 4, !tbaa !9
  %226 = load i32, ptr %16, align 4, !tbaa !9
  %227 = icmp ne i32 %225, %226
  br i1 %227, label %228, label %229

228:                                              ; preds = %219
  br label %231

229:                                              ; preds = %219
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 67, ptr noundef @__PRETTY_FUNCTION__._Z9peth_rootxxix) #6
  unreachable

230:                                              ; No predecessors!
  br label %231

231:                                              ; preds = %230, %228
  br label %232

232:                                              ; preds = %231
  %233 = load i32, ptr %25, align 4, !tbaa !9
  %234 = add nsw i32 %233, 1
  store i32 %234, ptr %25, align 4, !tbaa !9
  br label %170, !llvm.loop !15

235:                                              ; preds = %184, %174
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #5
  br label %237

236:                                              ; preds = %215, %211
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  br label %243

237:                                              ; preds = %235
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #5
  br label %238

238:                                              ; preds = %237
  %239 = load i32, ptr %21, align 4, !tbaa !9
  %240 = add nsw i32 %239, 1
  store i32 %240, ptr %21, align 4, !tbaa !9
  br label %142, !llvm.loop !16

241:                                              ; preds = %146
  %242 = load i64, ptr %12, align 8, !tbaa !5
  store i32 1, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %14) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  ret i64 %242

243:                                              ; preds = %236, %124
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %14) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %244

244:                                              ; preds = %243
  %245 = load ptr, ptr %19, align 8
  %246 = load i32, ptr %20, align 4
  %247 = insertvalue { ptr, i32 } poison, ptr %245, 0
  %248 = insertvalue { ptr, i32 } %247, i32 %246, 1
  resume { ptr, i32 } %248
}

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

; Function Attrs: nounwind
declare double @sqrt(double noundef) #3

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

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #4

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

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { noreturn 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 #5 = { nounwind }
attributes #6 = { noreturn 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !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::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 }
%"struct.std::_Rb_tree_iterator" = type { ptr }

@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [101 x i8], align 1
@__PRETTY_FUNCTION__._Z9peth_rootxxix = external hidden unnamed_addr constant [30 x i8], align 1

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z9peth_rootxxix(i64 noundef %0, i64 noundef %1, i32 noundef %2, i64 noundef %3) local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %5 = alloca %"class.std::map", align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %9 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %10 = add nsw i64 %3, -1
  %11 = srem i64 %10, %1
  %12 = sdiv i64 %10, %1
  %13 = icmp eq i64 %11, 0
  br i1 %13, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %4, %.lr.ph
  %.0107 = phi i64 [ %14, %.lr.ph ], [ %10, %4 ]
  %.085106 = phi i32 [ %15, %.lr.ph ], [ 0, %4 ]
  %14 = sdiv i64 %.0107, %1
  %15 = add nuw nsw i32 %.085106, 1
  %16 = srem i64 %14, %1
  %17 = icmp eq i64 %16, 0
  br i1 %17, label %.lr.ph, label %._crit_edge, !llvm.loop !5

._crit_edge:                                      ; preds = %.lr.ph, %4
  %.085.lcssa = phi i32 [ 0, %4 ], [ %15, %.lr.ph ]
  %.0.lcssa = phi i64 [ %10, %4 ], [ %14, %.lr.ph ]
  %18 = sext i32 %2 to i64
  %19 = tail call noundef i64 @_Z5powerxxx(i64 noundef %1, i64 noundef %18, i64 noundef %3)
  %20 = add nsw i64 %19, -1
  %21 = tail call noundef i64 @_Z7inversexx(i64 noundef %.0.lcssa, i64 noundef %19)
  %22 = mul nsw i64 %20, %21
  %23 = srem i64 %22, %19
  %24 = mul nsw i64 %23, %.0.lcssa
  %25 = add nsw i64 %24, 1
  %26 = sdiv i64 %25, %19
  %27 = tail call noundef i64 @_Z5powerxxx(i64 noundef %0, i64 noundef %26, i64 noundef %3)
  br label %28

28:                                               ; preds = %28, %._crit_edge
  %.093 = phi i64 [ 2, %._crit_edge ], [ %31, %28 ]
  %29 = tail call noundef i64 @_Z5powerxxx(i64 noundef %.093, i64 noundef %12, i64 noundef %3)
  %30 = icmp eq i64 %29, 1
  %31 = add nuw nsw i64 %.093, 1
  br i1 %30, label %28, label %32, !llvm.loop !7

32:                                               ; preds = %28
  %33 = tail call noundef i64 @_Z5powerxxx(i64 noundef %.093, i64 noundef %.0.lcssa, i64 noundef %3)
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %5) #5
  call void @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  store i64 1, ptr %6, align 8, !tbaa !8
  %34 = sub nsw i32 %.085.lcssa, %2
  %35 = sitofp i32 %34 to double
  %36 = sitofp i64 %1 to double
  %37 = fmul double %36, %35
  %38 = call double @sqrt(double noundef %37) #5
  %39 = fptosi double %38 to i32
  %40 = add nsw i32 %39, 1
  %41 = sext i32 %40 to i64
  %42 = add nsw i32 %.085.lcssa, -1
  %43 = sext i32 %42 to i64
  %44 = call noundef i64 @_Z5powerxxx(i64 noundef %1, i64 noundef %43, i64 noundef %10)
  %45 = mul nsw i64 %44, %41
  %46 = srem i64 %45, %10
  %47 = call noundef i64 @_Z5powerxxx(i64 noundef %33, i64 noundef %46, i64 noundef %3)
  %.not109 = icmp slt i32 %39, -1
  br i1 %.not109, label %._crit_edge113, label %.lr.ph112.preheader

.lr.ph112.preheader:                              ; preds = %32
  %48 = add i32 %39, 1
  br label %.lr.ph112

._crit_edge113:                                   ; preds = %54, %32
  %49 = call noundef i64 @_Z5powerxxx(i64 noundef %1, i64 noundef %43, i64 noundef %10)
  %50 = call noundef i64 @_Z5powerxxx(i64 noundef %33, i64 noundef %49, i64 noundef %3)
  %51 = call noundef i64 @_Z7inversexx(i64 noundef %50, i64 noundef %3)
  %52 = icmp sgt i32 %.085.lcssa, %2
  br i1 %52, label %.lr.ph122, label %._crit_edge123

.lr.ph112:                                        ; preds = %.lr.ph112.preheader, %54
  %.090110 = phi i32 [ %58, %54 ], [ 0, %.lr.ph112.preheader ]
  %53 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %5, ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %54 unwind label %59

54:                                               ; preds = %.lr.ph112
  store i32 %.090110, ptr %53, align 4, !tbaa !12
  %55 = load i64, ptr %6, align 8, !tbaa !8
  %56 = mul nsw i64 %55, %47
  %57 = srem i64 %56, %3
  store i64 %57, ptr %6, align 8, !tbaa !8
  %58 = add nuw i32 %.090110, 1
  %exitcond = icmp eq i32 %.090110, %48
  br i1 %exitcond, label %._crit_edge113, label %.lr.ph112, !llvm.loop !14

59:                                               ; preds = %.lr.ph112
  %60 = landingpad { ptr, i32 }
          cleanup
  br label %98

._crit_edge123:                                   ; preds = %.loopexit, %._crit_edge113
  %.091.lcssa = phi i64 [ %27, %._crit_edge113 ], [ %.192, %.loopexit ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  call void @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %5) #5
  ret i64 %.091.lcssa

.lr.ph122:                                        ; preds = %._crit_edge113, %.loopexit
  %indvars.iv = phi i64 [ %indvars.iv.next, %.loopexit ], [ %18, %._crit_edge113 ]
  %.091118 = phi i64 [ %.192, %.loopexit ], [ %27, %._crit_edge113 ]
  %61 = call noundef i64 @_Z5powerxxx(i64 noundef %.091118, i64 noundef %19, i64 noundef %3)
  %62 = call noundef i64 @_Z7inversexx(i64 noundef %61, i64 noundef %3)
  %63 = mul nsw i64 %62, %0
  %64 = srem i64 %63, %3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  %65 = sub nsw i64 %43, %indvars.iv
  %66 = call noundef i64 @_Z5powerxxx(i64 noundef %1, i64 noundef %65, i64 noundef %10)
  %67 = call noundef i64 @_Z5powerxxx(i64 noundef %64, i64 noundef %66, i64 noundef %3)
  store i64 %67, ptr %7, align 8, !tbaa !8
  br i1 %.not109, label %.loopexit, label %.lr.ph117

.lr.ph117:                                        ; preds = %.lr.ph122, %95
  %.084115 = phi i32 [ %96, %95 ], [ 0, %.lr.ph122 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #5
  %68 = invoke ptr @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEE4findERS3_(ptr noundef nonnull align 8 dereferenceable(48) %5, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %69 unwind label %86

69:                                               ; preds = %.lr.ph117
  store ptr %68, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #5
  %70 = call ptr @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %5) #5
  store ptr %70, ptr %9, align 8
  %71 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKxiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  br i1 %71, label %72, label %90

72:                                               ; preds = %69
  %73 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %5, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %74 unwind label %88

74:                                               ; preds = %72
  %75 = load i32, ptr %73, align 4, !tbaa !12
  %76 = mul nsw i32 %75, %40
  %77 = add nsw i32 %76, %.084115
  %78 = sext i32 %77 to i64
  %79 = sub nsw i64 %indvars.iv, %18
  %80 = call noundef i64 @_Z5powerxxx(i64 noundef %1, i64 noundef %79, i64 noundef %10)
  %81 = mul nsw i64 %80, %78
  %82 = srem i64 %81, %10
  %83 = call noundef i64 @_Z5powerxxx(i64 noundef %33, i64 noundef %82, i64 noundef %3)
  %84 = mul nsw i64 %83, %.091118
  %85 = srem i64 %84, %3
  br label %.loopexit

86:                                               ; preds = %.lr.ph117
  %87 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  br label %97

88:                                               ; preds = %72
  %89 = landingpad { ptr, i32 }
          cleanup
  br label %97

90:                                               ; preds = %69
  %91 = load i64, ptr %7, align 8, !tbaa !8
  %92 = mul nsw i64 %91, %51
  %93 = srem i64 %92, %3
  store i64 %93, ptr %7, align 8, !tbaa !8
  %.not96 = icmp eq i32 %.084115, %40
  br i1 %.not96, label %94, label %95

94:                                               ; preds = %90
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 67, ptr noundef nonnull @__PRETTY_FUNCTION__._Z9peth_rootxxix) #6
  unreachable

95:                                               ; preds = %90
  %96 = add nuw nsw i32 %.084115, 1
  br label %.lr.ph117

.loopexit:                                        ; preds = %.lr.ph122, %74
  %.192 = phi i64 [ %85, %74 ], [ %.091118, %.lr.ph122 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
  %exitcond130.not = icmp eq i32 %.085.lcssa, %lftr.wideiv
  br i1 %exitcond130.not, label %._crit_edge123, label %.lr.ph122, !llvm.loop !15

97:                                               ; preds = %88, %86
  %.pn = phi { ptr, i32 } [ %89, %88 ], [ %87, %86 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  br label %98

98:                                               ; preds = %97, %59
  %.pn98 = phi { ptr, i32 } [ %60, %59 ], [ %.pn, %97 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  call void @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %5) #5
  resume { ptr, i32 } %.pn98
}

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3

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

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

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

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


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