; LLVM IR from AdarshGaur/Competitive-Programming :: Codeforces/Random Problems/C. Representative Edges.ll (Z5solvev)

; 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::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #0 {
  %1 = alloca i32, align 4
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #8
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %19 = load i32, ptr %1, align 4, !tbaa !5
  %20 = zext i32 %19 to i64
  %21 = call ptr @llvm.stacksave.p0()
  store ptr %21, ptr %2, align 8
  %22 = alloca i32, i64 %20, align 16
  store i64 %20, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #8
  store ptr %22, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #8
  %23 = load ptr, ptr %4, align 8, !tbaa !9
  store ptr %23, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  %24 = load ptr, ptr %4, align 8, !tbaa !9
  %25 = mul nuw i64 4, %20
  %26 = udiv i64 %25, 4
  %27 = getelementptr inbounds i32, ptr %24, i64 %26
  store ptr %27, ptr %6, align 8, !tbaa !9
  br label %28

28:                                               ; preds = %37, %0
  %29 = load ptr, ptr %5, align 8, !tbaa !9
  %30 = load ptr, ptr %6, align 8, !tbaa !9
  %31 = icmp ne ptr %29, %30
  br i1 %31, label %33, label %32

32:                                               ; preds = %28
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #8
  br label %40

33:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  %34 = load ptr, ptr %5, align 8, !tbaa !9
  store ptr %34, ptr %7, align 8, !tbaa !9
  %35 = load ptr, ptr %7, align 8, !tbaa !9
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %35)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  br label %37

37:                                               ; preds = %33
  %38 = load ptr, ptr %5, align 8, !tbaa !9
  %39 = getelementptr inbounds i32, ptr %38, i32 1
  store ptr %39, ptr %5, align 8, !tbaa !9
  br label %28

40:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  store i32 2, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %115, %40
  %42 = load i32, ptr %9, align 4, !tbaa !5
  %43 = load i32, ptr %1, align 4, !tbaa !5
  %44 = icmp slt i32 %42, %43
  br i1 %44, label %46, label %45

45:                                               ; preds = %41
  store i32 4, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %118

46:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  %47 = load i32, ptr %9, align 4, !tbaa !5
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %11, align 4, !tbaa !5
  br label %49

49:                                               ; preds = %111, %46
  %50 = load i32, ptr %11, align 4, !tbaa !5
  %51 = load i32, ptr %1, align 4, !tbaa !5
  %52 = icmp slt i32 %50, %51
  br i1 %52, label %54, label %53

53:                                               ; preds = %49
  store i32 7, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  br label %114

54:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  %55 = load i32, ptr %11, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds i32, ptr %22, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = load i32, ptr %9, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds i32, ptr %22, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = sub nsw i32 %58, %62
  store i32 %63, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  %64 = load i32, ptr %11, align 4, !tbaa !5
  %65 = load i32, ptr %9, align 4, !tbaa !5
  %66 = sub nsw i32 %64, %65
  store i32 %66, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  %67 = load i32, ptr %13, align 4, !tbaa !5
  %68 = load i32, ptr %12, align 4, !tbaa !5
  %69 = call i32 @llvm.abs.i32(i32 %68, i1 true)
  %70 = call noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef %67, i32 noundef %69)
  store i32 %70, ptr %14, align 4, !tbaa !5
  %71 = load i32, ptr %14, align 4, !tbaa !5
  %72 = load i32, ptr %12, align 4, !tbaa !5
  %73 = sdiv i32 %72, %71
  store i32 %73, ptr %12, align 4, !tbaa !5
  %74 = load i32, ptr %14, align 4, !tbaa !5
  %75 = load i32, ptr %13, align 4, !tbaa !5
  %76 = sdiv i32 %75, %74
  store i32 %76, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  store i32 1, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  store i32 0, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  %77 = load i32, ptr %9, align 4, !tbaa !5
  %78 = load i32, ptr %13, align 4, !tbaa !5
  %79 = add nsw i32 %77, %78
  store i32 %79, ptr %17, align 4, !tbaa !5
  br label %80

80:                                               ; preds = %104, %54
  %81 = load i32, ptr %17, align 4, !tbaa !5
  %82 = load i32, ptr %1, align 4, !tbaa !5
  %83 = icmp slt i32 %81, %82
  br i1 %83, label %85, label %84

84:                                               ; preds = %80
  store i32 10, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  br label %108

85:                                               ; preds = %80
  %86 = load i32, ptr %12, align 4, !tbaa !5
  %87 = load i32, ptr %16, align 4, !tbaa !5
  %88 = add nsw i32 %87, %86
  store i32 %88, ptr %16, align 4, !tbaa !5
  %89 = load i32, ptr %9, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds i32, ptr %22, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = load i32, ptr %16, align 4, !tbaa !5
  %94 = add nsw i32 %92, %93
  %95 = load i32, ptr %17, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds i32, ptr %22, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = icmp eq i32 %94, %98
  br i1 %99, label %100, label %103

100:                                              ; preds = %85
  %101 = load i32, ptr %15, align 4, !tbaa !5
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %15, align 4, !tbaa !5
  br label %103

103:                                              ; preds = %100, %85
  br label %104

104:                                              ; preds = %103
  %105 = load i32, ptr %13, align 4, !tbaa !5
  %106 = load i32, ptr %17, align 4, !tbaa !5
  %107 = add nsw i32 %106, %105
  store i32 %107, ptr %17, align 4, !tbaa !5
  br label %80, !llvm.loop !11

108:                                              ; preds = %84
  %109 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %15)
  %110 = load i32, ptr %109, align 4, !tbaa !5
  store i32 %110, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %111

111:                                              ; preds = %108
  %112 = load i32, ptr %11, align 4, !tbaa !5
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %11, align 4, !tbaa !5
  br label %49, !llvm.loop !13

114:                                              ; preds = %53
  br label %115

115:                                              ; preds = %114
  %116 = load i32, ptr %9, align 4, !tbaa !5
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %9, align 4, !tbaa !5
  br label %41, !llvm.loop !14

118:                                              ; preds = %45
  %119 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %120 = load i32, ptr %119, align 4, !tbaa !5
  store i32 %120, ptr %8, align 4, !tbaa !5
  %121 = load i32, ptr %1, align 4, !tbaa !5
  %122 = load i32, ptr %8, align 4, !tbaa !5
  %123 = sub nsw i32 %121, %122
  %124 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %123)
  %125 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %124, ptr noundef @.str)
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  %126 = load ptr, ptr %2, align 8
  call void @llvm.stackrestore.p0(ptr %126)
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #8
  ret void
}

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #6

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #6

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #7

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = { nocallback nofree nosync nounwind willreturn }
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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { 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 #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 = !{!"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 = distinct !{!14, !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::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  %4 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %5 = load i32, ptr %1, align 4, !tbaa !5
  %6 = zext i32 %5 to i64
  %7 = call ptr @llvm.stacksave.p0()
  %8 = alloca i32, i64 %6, align 16
  %9 = getelementptr inbounds i32, ptr %8, i64 %6
  %.not36 = icmp eq i32 %5, 0
  br i1 %.not36, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  store i32 2, ptr %2, align 4, !tbaa !5
  %10 = load i32, ptr %1, align 4, !tbaa !5
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %.lr.ph49, label %._crit_edge50

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.03337 = phi ptr [ %13, %.lr.ph ], [ %8, %0 ]
  %12 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %.03337)
  %13 = getelementptr inbounds i8, ptr %.03337, i64 4
  %.not = icmp eq ptr %13, %9
  br i1 %.not, label %._crit_edge, label %.lr.ph

.loopexit.loopexit:                               ; preds = %._crit_edge43
  %.pre = sext i32 %46 to i64
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %.lr.ph49
  %.pre-phi = phi i64 [ %.pre, %.loopexit.loopexit ], [ %23, %.lr.ph49 ]
  %14 = phi i32 [ %46, %.loopexit.loopexit ], [ %22, %.lr.ph49 ]
  %15 = icmp slt i64 %indvars.iv.next, %.pre-phi
  %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
  br i1 %15, label %.lr.ph49, label %._crit_edge50, !llvm.loop !9

._crit_edge50:                                    ; preds = %.loopexit, %._crit_edge
  %16 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %17 = load i32, ptr %16, align 4, !tbaa !5
  store i32 %17, ptr %2, align 4, !tbaa !5
  %18 = load i32, ptr %1, align 4, !tbaa !5
  %19 = sub nsw i32 %18, %17
  %20 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %19)
  %21 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %20, ptr noundef nonnull @.str)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.stackrestore.p0(ptr %7)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  ret void

.lr.ph49:                                         ; preds = %._crit_edge, %.loopexit
  %22 = phi i32 [ %14, %.loopexit ], [ %10, %._crit_edge ]
  %indvars.iv54 = phi i64 [ %indvars.iv.next55, %.loopexit ], [ 1, %._crit_edge ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %.loopexit ], [ 0, %._crit_edge ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %23 = sext i32 %22 to i64
  %24 = icmp slt i64 %indvars.iv.next, %23
  br i1 %24, label %.lr.ph46, label %.loopexit

.lr.ph46:                                         ; preds = %.lr.ph49
  %25 = getelementptr inbounds i32, ptr %8, i64 %indvars.iv
  %26 = trunc nuw nsw i64 %indvars.iv to i32
  br label %27

27:                                               ; preds = %.lr.ph46, %._crit_edge43
  %indvars.iv56 = phi i64 [ %indvars.iv54, %.lr.ph46 ], [ %indvars.iv.next57, %._crit_edge43 ]
  %28 = getelementptr inbounds i32, ptr %8, i64 %indvars.iv56
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = load i32, ptr %25, align 4, !tbaa !5
  %31 = sub nsw i32 %29, %30
  %32 = sub nuw nsw i64 %indvars.iv56, %indvars.iv
  %33 = call i32 @llvm.abs.i32(i32 %31, i1 true)
  %34 = trunc nuw nsw i64 %32 to i32
  %35 = call noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef %34, i32 noundef %33)
  %36 = sdiv i32 %31, %35
  %37 = sdiv i32 %34, %35
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  store i32 1, ptr %3, align 4, !tbaa !5
  %38 = load i32, ptr %1, align 4, !tbaa !5
  %.038 = add nsw i32 %37, %26
  %39 = icmp slt i32 %.038, %38
  br i1 %39, label %.lr.ph42, label %._crit_edge43

.lr.ph42:                                         ; preds = %27
  %40 = load i32, ptr %25, align 4, !tbaa !5
  %41 = sext i32 %37 to i64
  %42 = add nsw i64 %indvars.iv, %41
  %43 = sext i32 %38 to i64
  br label %49

._crit_edge43:                                    ; preds = %58, %27
  %44 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %45 = load i32, ptr %44, align 4, !tbaa !5
  store i32 %45, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  %indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
  %46 = load i32, ptr %1, align 4, !tbaa !5
  %47 = trunc nuw i64 %indvars.iv.next57 to i32
  %48 = icmp sgt i32 %46, %47
  br i1 %48, label %27, label %.loopexit.loopexit, !llvm.loop !11

49:                                               ; preds = %.lr.ph42, %58
  %indvars.iv51 = phi i64 [ %42, %.lr.ph42 ], [ %indvars.iv.next52, %58 ]
  %.03239 = phi i32 [ 0, %.lr.ph42 ], [ %51, %58 ]
  %50 = phi i32 [ 1, %.lr.ph42 ], [ %59, %58 ]
  %51 = add nsw i32 %.03239, %36
  %52 = add nsw i32 %40, %51
  %53 = getelementptr inbounds i32, ptr %8, i64 %indvars.iv51
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = icmp eq i32 %52, %54
  br i1 %55, label %56, label %58

56:                                               ; preds = %49
  %57 = add nsw i32 %50, 1
  store i32 %57, ptr %3, align 4, !tbaa !5
  br label %58

58:                                               ; preds = %49, %56
  %59 = phi i32 [ %50, %49 ], [ %57, %56 ]
  %indvars.iv.next52 = add nsw i64 %indvars.iv51, %41
  %60 = icmp slt i64 %indvars.iv.next52, %43
  br i1 %60, label %49, label %._crit_edge43, !llvm.loop !12
}

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #7

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

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


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