; LLVM IR from tangjz/acm-icpc :: hdu/5848.ll (Z8mod_sqrtii)

; 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::mersenne_twister_engine" = type { [624 x i64], i64 }
%class.anon = type { ptr }
%class.anon.0 = type { ptr, ptr }
%"struct.std::pair" = type { i32, i32 }

@rnd = external dso_local global %"class.std::mersenne_twister_engine", align 8

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z8mod_sqrtii(i32 noundef %0, i32 noundef %1) #1 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %class.anon, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %class.anon.0, align 8
  %11 = alloca %"struct.std::pair", align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %"struct.std::pair", align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca %"struct.std::pair", align 4
  %18 = alloca %"struct.std::pair", align 4
  %19 = alloca %"struct.std::pair", align 4
  %20 = alloca %"struct.std::pair", align 4
  %21 = alloca %"struct.std::pair", align 4
  %22 = alloca %"struct.std::pair", align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !5
  %23 = load i32, ptr %4, align 4, !tbaa !5
  %24 = icmp slt i32 %23, 2
  br i1 %24, label %25, label %27

25:                                               ; preds = %2
  %26 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %26, ptr %3, align 4
  br label %95

27:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %28 = getelementptr inbounds %class.anon, ptr %6, i32 0, i32 0
  store ptr %5, ptr %28, align 8, !tbaa !9
  %29 = load i32, ptr %4, align 4, !tbaa !5
  %30 = call noundef zeroext i1 @"_ZZ8mod_sqrtiiENK3$_0clEi"(ptr noundef nonnull align 8 dereferenceable(8) %6, i32 noundef %29)
  br i1 %30, label %32, label %31

31:                                               ; preds = %27
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %94

32:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  br label %33

33:                                               ; preds = %59, %32
  %34 = call noundef i64 @_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv(ptr noundef nonnull align 8 dereferenceable(5000) @rnd)
  %35 = load i32, ptr %5, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = urem i64 %34, %36
  %38 = trunc i64 %37 to i32
  store i32 %38, ptr %8, align 4, !tbaa !5
  %39 = load i32, ptr %8, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = load i32, ptr %8, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = mul nsw i64 %40, %42
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = sub nsw i64 %43, %45
  %47 = load i32, ptr %5, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = srem i64 %46, %48
  %50 = trunc i64 %49 to i32
  store i32 %50, ptr %9, align 4, !tbaa !5
  %51 = icmp slt i32 %50, 0
  br i1 %51, label %52, label %57

52:                                               ; preds = %33
  %53 = load i32, ptr %5, align 4, !tbaa !5
  %54 = load i32, ptr %9, align 4, !tbaa !5
  %55 = add nsw i32 %54, %53
  store i32 %55, ptr %9, align 4, !tbaa !5
  %56 = icmp ne i32 %55, 0
  br label %57

57:                                               ; preds = %52, %33
  %58 = phi i1 [ false, %33 ], [ %56, %52 ]
  br label %59

59:                                               ; preds = %57
  %60 = load i32, ptr %9, align 4, !tbaa !5
  %61 = call noundef zeroext i1 @"_ZZ8mod_sqrtiiENK3$_0clEi"(ptr noundef nonnull align 8 dereferenceable(8) %6, i32 noundef %60)
  br i1 %61, label %33, label %62, !llvm.loop !11

62:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #6
  %63 = getelementptr inbounds %class.anon.0, ptr %10, i32 0, i32 0
  store ptr %5, ptr %63, align 8, !tbaa !9
  %64 = getelementptr inbounds %class.anon.0, ptr %10, i32 0, i32 1
  store ptr %9, ptr %64, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 1, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !5
  %65 = call i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %13)
  store i64 %65, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store i32 1, ptr %15, align 4, !tbaa !5
  %66 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %15)
  store i64 %66, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %67 = load i32, ptr %5, align 4, !tbaa !5
  %68 = add nsw i32 %67, 1
  %69 = ashr i32 %68, 1
  store i32 %69, ptr %16, align 4, !tbaa !5
  br label %70

70:                                               ; preds = %84, %62
  %71 = load i32, ptr %16, align 4, !tbaa !5
  %72 = icmp sgt i32 %71, 0
  br i1 %72, label %74, label %73

73:                                               ; preds = %70
  store i32 4, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %91

74:                                               ; preds = %70
  %75 = load i32, ptr %16, align 4, !tbaa !5
  %76 = and i32 %75, 1
  %77 = icmp ne i32 %76, 0
  br i1 %77, label %78, label %83

78:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %18, ptr align 4 %11, i64 8, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 4 %14, i64 8, i1 false)
  %79 = load i64, ptr %18, align 4
  %80 = load i64, ptr %19, align 4
  %81 = call i64 @"_ZZ8mod_sqrtiiENK3$_1clESt4pairIiiES1_"(ptr noundef nonnull align 8 dereferenceable(16) %10, i64 %79, i64 %80)
  store i64 %81, ptr %17, align 4
  %82 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %11, ptr noundef nonnull align 4 dereferenceable(8) %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  br label %83

83:                                               ; preds = %78, %74
  br label %84

84:                                               ; preds = %83
  %85 = load i32, ptr %16, align 4, !tbaa !5
  %86 = ashr i32 %85, 1
  store i32 %86, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %21, ptr align 4 %14, i64 8, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %22, ptr align 4 %14, i64 8, i1 false)
  %87 = load i64, ptr %21, align 4
  %88 = load i64, ptr %22, align 4
  %89 = call i64 @"_ZZ8mod_sqrtiiENK3$_1clESt4pairIiiES1_"(ptr noundef nonnull align 8 dereferenceable(16) %10, i64 %87, i64 %88)
  store i64 %89, ptr %20, align 4
  %90 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %14, ptr noundef nonnull align 4 dereferenceable(8) %20) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  br label %70, !llvm.loop !13

91:                                               ; preds = %73
  %92 = getelementptr inbounds %"struct.std::pair", ptr %11, i32 0, i32 0
  %93 = load i32, ptr %92, align 4, !tbaa !14
  store i32 %93, ptr %3, align 4
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %94

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

95:                                               ; preds = %94, %25
  %96 = load i32, ptr %3, align 4
  ret i32 %96
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @"_ZZ8mod_sqrtiiENK3$_0clEi"(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv(ptr noundef nonnull align 8 dereferenceable(5000)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #1

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #1

; Function Attrs: inlinehint mustprogress uwtable
declare hidden i64 @"_ZZ8mod_sqrtiiENK3$_1clESt4pairIiiES1_"(ptr noundef nonnull align 8 dereferenceable(16), i64, i64) #3 align 2

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

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

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

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

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


; 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::mersenne_twister_engine" = type { [624 x i64], i64 }
%class.anon = type { ptr }
%class.anon.0 = type { ptr, ptr }
%"struct.std::pair" = type { i32, i32 }

@rnd = external dso_local global %"class.std::mersenne_twister_engine", align 8

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z8mod_sqrtii(i32 noundef %0, i32 noundef %1) local_unnamed_addr #1 {
  %3 = alloca i32, align 4
  %4 = alloca %class.anon, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %class.anon.0, align 8
  %8 = alloca %"struct.std::pair", align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %"struct.std::pair", align 8
  %12 = alloca i32, align 4
  %13 = alloca %"struct.std::pair", align 8
  %14 = alloca %"struct.std::pair", align 8
  store i32 %1, ptr %3, align 4, !tbaa !5
  %15 = icmp slt i32 %0, 2
  br i1 %15, label %53, label %16

16:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  store ptr %3, ptr %4, align 8, !tbaa !9
  %17 = call noundef zeroext i1 @"_ZZ8mod_sqrtiiENK3$_0clEi"(ptr noundef nonnull align 8 dereferenceable(8) %4, i32 noundef %0)
  br i1 %17, label %18, label %52

18:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  %19 = zext nneg i32 %0 to i64
  br label %20

20:                                               ; preds = %20, %18
  %21 = call noundef i64 @_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv(ptr noundef nonnull align 8 dereferenceable(5000) @rnd)
  %22 = load i32, ptr %3, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = urem i64 %21, %23
  %25 = trunc i64 %24 to i32
  store i32 %25, ptr %5, align 4, !tbaa !5
  %sext = shl i64 %24, 32
  %26 = ashr exact i64 %sext, 32
  %27 = mul nsw i64 %26, %26
  %28 = sub nsw i64 %27, %19
  %29 = srem i64 %28, %23
  %30 = trunc nsw i64 %29 to i32
  %31 = icmp slt i64 %29, 0
  %32 = select i1 %31, i32 %22, i32 0
  %spec.select = add nsw i32 %32, %30
  store i32 %spec.select, ptr %6, align 4, !tbaa !5
  %33 = call noundef zeroext i1 @"_ZZ8mod_sqrtiiENK3$_0clEi"(ptr noundef nonnull align 8 dereferenceable(8) %4, i32 noundef %spec.select)
  br i1 %33, label %20, label %34, !llvm.loop !11

34:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #5
  store ptr %3, ptr %7, align 8, !tbaa !9
  %35 = getelementptr inbounds i8, ptr %7, i64 8
  store ptr %6, ptr %35, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #5
  store i32 1, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #5
  store i32 0, ptr %10, align 4, !tbaa !5
  %36 = call i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %10)
  store i64 %36, ptr %8, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #5
  store i32 1, ptr %12, align 4, !tbaa !5
  %37 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %12)
  store i64 %37, ptr %11, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #5
  %38 = load i32, ptr %3, align 4, !tbaa !5
  %39 = add nsw i32 %38, 1
  %40 = ashr i32 %39, 1
  %41 = icmp sgt i32 %40, 0
  %42 = trunc i64 %36 to i32
  br i1 %41, label %.lr.ph, label %._crit_edge

._crit_edge.loopexit:                             ; preds = %48
  %.pre = load i32, ptr %8, align 8, !tbaa !13
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %34
  %43 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %42, %34 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  br label %52

.lr.ph:                                           ; preds = %34, %48
  %.01115 = phi i32 [ %49, %48 ], [ %40, %34 ]
  %44 = and i32 %.01115, 1
  %.not = icmp eq i32 %44, 0
  %.sroa.01.0.copyload.pre17 = load i64, ptr %11, align 8
  br i1 %.not, label %48, label %45

45:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #5
  %.sroa.03.0.copyload = load i64, ptr %8, align 8
  %46 = call i64 @"_ZZ8mod_sqrtiiENK3$_1clESt4pairIiiES1_"(ptr noundef nonnull align 8 dereferenceable(16) %7, i64 %.sroa.03.0.copyload, i64 %.sroa.01.0.copyload.pre17)
  store i64 %46, ptr %13, align 8
  %47 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %8, ptr noundef nonnull align 4 dereferenceable(8) %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #5
  %.sroa.01.0.copyload.pre = load i64, ptr %11, align 8
  br label %48

48:                                               ; preds = %.lr.ph, %45
  %.sroa.01.0.copyload = phi i64 [ %.sroa.01.0.copyload.pre17, %.lr.ph ], [ %.sroa.01.0.copyload.pre, %45 ]
  %49 = lshr i32 %.01115, 1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #5
  %50 = call i64 @"_ZZ8mod_sqrtiiENK3$_1clESt4pairIiiES1_"(ptr noundef nonnull align 8 dereferenceable(16) %7, i64 %.sroa.01.0.copyload, i64 %.sroa.01.0.copyload)
  store i64 %50, ptr %14, align 8
  %51 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %11, ptr noundef nonnull align 4 dereferenceable(8) %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #5
  %.not16 = icmp ult i32 %.01115, 2
  br i1 %.not16, label %._crit_edge.loopexit, label %.lr.ph, !llvm.loop !15

52:                                               ; preds = %16, %._crit_edge
  %.0 = phi i32 [ %43, %._crit_edge ], [ -1, %16 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  br label %53

53:                                               ; preds = %2, %52
  %.1 = phi i32 [ %.0, %52 ], [ %0, %2 ]
  ret i32 %.1
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @"_ZZ8mod_sqrtiiENK3$_0clEi"(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEclEv(ptr noundef nonnull align 8 dereferenceable(5000)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare hidden i64 @"_ZZ8mod_sqrtiiENK3$_1clESt4pairIiiES1_"(ptr noundef nonnull align 8 dereferenceable(16), i64, i64) local_unnamed_addr #3 align 2

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

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

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

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass