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

; 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" }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@sr = external dso_local global i32, align 4
@sb = external dso_local global i32, align 4
@sg = external dso_local global i32, align 4
@p = external dso_local global i32, align 4
@g = external dso_local global [70 x [70 x i32]], align 16
@ans = external dso_local global i32, align 4
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3gcdiiRiS_(i32 noundef, i32 noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z2dpi(i32 noundef) #1

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %6 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %7 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @sr)
  %8 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 4 dereferenceable(4) @sb)
  %9 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 4 dereferenceable(4) @sg)
  %10 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %11 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 4 dereferenceable(4) @p)
  %12 = load i32, ptr @sr, align 4, !tbaa !5
  %13 = load i32, ptr @sb, align 4, !tbaa !5
  %14 = add nsw i32 %12, %13
  %15 = load i32, ptr @sg, align 4, !tbaa !5
  %16 = add nsw i32 %14, %15
  store i32 %16, ptr @n, align 4, !tbaa !5
  %17 = load i32, ptr @m, align 4, !tbaa !5
  %18 = add nsw i32 %17, 1
  store i32 %18, ptr @m, align 4, !tbaa !5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %19

19:                                               ; preds = %40, %0
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = load i32, ptr @m, align 4, !tbaa !5
  %22 = icmp slt i32 %20, %21
  br i1 %22, label %23, label %43

23:                                               ; preds = %19
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %36, %23
  %25 = load i32, ptr %3, align 4, !tbaa !5
  %26 = load i32, ptr @n, align 4, !tbaa !5
  %27 = icmp sle i32 %25, %26
  br i1 %27, label %28, label %39

28:                                               ; preds = %24
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [70 x [70 x i32]], ptr @g, i64 0, i64 %30
  %32 = load i32, ptr %3, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [70 x i32], ptr %31, i64 0, i64 %33
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %34)
  br label %36

36:                                               ; preds = %28
  %37 = load i32, ptr %3, align 4, !tbaa !5
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %3, align 4, !tbaa !5
  br label %24, !llvm.loop !9

39:                                               ; preds = %24
  br label %40

40:                                               ; preds = %39
  %41 = load i32, ptr %2, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %2, align 4, !tbaa !5
  br label %19, !llvm.loop !11

43:                                               ; preds = %19
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %56, %43
  %45 = load i32, ptr %2, align 4, !tbaa !5
  %46 = load i32, ptr @n, align 4, !tbaa !5
  %47 = icmp sle i32 %45, %46
  br i1 %47, label %48, label %59

48:                                               ; preds = %44
  %49 = load i32, ptr %2, align 4, !tbaa !5
  %50 = load i32, ptr @m, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [70 x [70 x i32]], ptr @g, i64 0, i64 %51
  %53 = load i32, ptr %2, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [70 x i32], ptr %52, i64 0, i64 %54
  store i32 %49, ptr %55, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %48
  %57 = load i32, ptr %2, align 4, !tbaa !5
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %2, align 4, !tbaa !5
  br label %44, !llvm.loop !12

59:                                               ; preds = %44
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %60

60:                                               ; preds = %71, %59
  %61 = load i32, ptr %2, align 4, !tbaa !5
  %62 = load i32, ptr @m, align 4, !tbaa !5
  %63 = icmp sle i32 %61, %62
  br i1 %63, label %64, label %74

64:                                               ; preds = %60
  %65 = load i32, ptr @ans, align 4, !tbaa !5
  %66 = load i32, ptr %2, align 4, !tbaa !5
  %67 = call noundef i32 @_Z2dpi(i32 noundef %66)
  %68 = add nsw i32 %65, %67
  %69 = load i32, ptr @p, align 4, !tbaa !5
  %70 = srem i32 %68, %69
  store i32 %70, ptr @ans, align 4, !tbaa !5
  br label %71

71:                                               ; preds = %64
  %72 = load i32, ptr %2, align 4, !tbaa !5
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %2, align 4, !tbaa !5
  br label %60, !llvm.loop !13

74:                                               ; preds = %60
  %75 = load i32, ptr @m, align 4, !tbaa !5
  %76 = load i32, ptr @p, align 4, !tbaa !5
  call void @_Z3gcdiiRiS_(i32 noundef %75, i32 noundef %76, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %77 = load i32, ptr @ans, align 4, !tbaa !5
  %78 = load i32, ptr %4, align 4, !tbaa !5
  %79 = load i32, ptr @p, align 4, !tbaa !5
  %80 = add nsw i32 %78, %79
  %81 = mul nsw i32 %77, %80
  %82 = load i32, ptr @p, align 4, !tbaa !5
  %83 = srem i32 %81, %82
  store i32 %83, ptr @ans, align 4, !tbaa !5
  %84 = load i32, ptr @ans, align 4, !tbaa !5
  %85 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %84)
  %86 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %85, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  ret i32 0
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #4

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #5

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

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

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


; 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" }

@n = external dso_local local_unnamed_addr global i32, align 4
@m = external dso_local global i32, align 4
@sr = external dso_local global i32, align 4
@sb = external dso_local global i32, align 4
@sg = external dso_local global i32, align 4
@p = external dso_local global i32, align 4
@g = external dso_local global [70 x [70 x i32]], align 16
@ans = external dso_local local_unnamed_addr global i32, align 4
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3gcdiiRiS_(i32 noundef, i32 noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z2dpi(i32 noundef) local_unnamed_addr #1

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %3 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %4 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @sr)
  %5 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 4 dereferenceable(4) @sb)
  %6 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 4 dereferenceable(4) @sg)
  %7 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %8 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 4 dereferenceable(4) @p)
  %9 = load i32, ptr @sr, align 4, !tbaa !5
  %10 = load i32, ptr @sb, align 4, !tbaa !5
  %11 = add nsw i32 %10, %9
  %12 = load i32, ptr @sg, align 4, !tbaa !5
  %13 = add nsw i32 %11, %12
  store i32 %13, ptr @n, align 4, !tbaa !5
  %14 = load i32, ptr @m, align 4, !tbaa !5
  %15 = add nsw i32 %14, 1
  store i32 %15, ptr @m, align 4, !tbaa !5
  %16 = icmp sgt i32 %14, 0
  br i1 %16, label %.preheader18.lr.ph, label %.preheader17

.preheader18.lr.ph:                               ; preds = %0
  %17 = icmp slt i32 %13, 1
  br i1 %17, label %.lr.ph28.preheader, label %.preheader18

.preheader18:                                     ; preds = %.preheader18.lr.ph, %._crit_edge
  %18 = phi i32 [ %32, %._crit_edge ], [ %15, %.preheader18.lr.ph ]
  %19 = phi i32 [ %33, %._crit_edge ], [ %13, %.preheader18.lr.ph ]
  %indvars.iv35 = phi i64 [ %indvars.iv.next36, %._crit_edge ], [ 1, %.preheader18.lr.ph ]
  %.not1620 = icmp slt i32 %19, 1
  br i1 %.not1620, label %._crit_edge, label %.lr.ph

.preheader17:                                     ; preds = %._crit_edge, %0
  %20 = phi i32 [ %13, %0 ], [ %33, %._crit_edge ]
  %21 = phi i32 [ %15, %0 ], [ %32, %._crit_edge ]
  %.not23 = icmp slt i32 %20, 1
  br i1 %.not23, label %.preheader, label %.lr.ph25

.lr.ph25:                                         ; preds = %.preheader17
  %22 = sext i32 %21 to i64
  %23 = add nuw i32 %20, 1
  %wide.trip.count = zext i32 %23 to i64
  %24 = zext nneg i32 %20 to i64
  %min.iters.check = icmp ult i32 %20, 8
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph25
  %indvars.iv38.ph = phi i64 [ 1, %.lr.ph25 ], [ %ind.end, %middle.block ]
  br label %scalar.ph

vector.ph:                                        ; preds = %.lr.ph25
  %n.vec = and i64 %24, 2147483640
  %ind.end = or disjoint i64 %n.vec, 1
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
  %offset.idx = or disjoint i64 %index, 1
  %25 = getelementptr inbounds [70 x [70 x i32]], ptr @g, i64 0, i64 %22, i64 %offset.idx
  %26 = getelementptr inbounds i8, ptr %25, i64 16
  store <4 x i32> %vec.ind, ptr %25, align 4, !tbaa !5
  store <4 x i32> %step.add, ptr %26, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %27 = icmp eq i64 %index.next, %n.vec
  br i1 %27, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %24
  br i1 %cmp.n, label %.preheader, label %scalar.ph.preheader

.lr.ph:                                           ; preds = %.preheader18, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.preheader18 ]
  %28 = getelementptr inbounds [70 x [70 x i32]], ptr @g, i64 0, i64 %indvars.iv35, i64 %indvars.iv
  %29 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %28)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %30 = load i32, ptr @n, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %.not16.not = icmp slt i64 %indvars.iv, %31
  br i1 %.not16.not, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !13

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre = load i32, ptr @m, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader18
  %32 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %18, %.preheader18 ]
  %33 = phi i32 [ %30, %._crit_edge.loopexit ], [ %19, %.preheader18 ]
  %indvars.iv.next36 = add nuw nsw i64 %indvars.iv35, 1
  %34 = sext i32 %32 to i64
  %35 = icmp slt i64 %indvars.iv.next36, %34
  br i1 %35, label %.preheader18, label %.preheader17, !llvm.loop !14

.preheader:                                       ; preds = %scalar.ph, %middle.block, %.preheader17
  %.not1526 = icmp slt i32 %21, 1
  br i1 %.not1526, label %.preheader.._crit_edge29_crit_edge, label %.lr.ph28.preheader

.preheader.._crit_edge29_crit_edge:               ; preds = %.preheader
  %.pre42 = load i32, ptr @p, align 4, !tbaa !5
  br label %._crit_edge29

.lr.ph28.preheader:                               ; preds = %.preheader18.lr.ph, %.preheader
  %.pre41 = load i32, ptr @ans, align 4, !tbaa !5
  br label %.lr.ph28

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv38 = phi i64 [ %indvars.iv.next39, %scalar.ph ], [ %indvars.iv38.ph, %scalar.ph.preheader ]
  %36 = getelementptr inbounds [70 x [70 x i32]], ptr @g, i64 0, i64 %22, i64 %indvars.iv38
  %37 = trunc nuw nsw i64 %indvars.iv38 to i32
  store i32 %37, ptr %36, align 4, !tbaa !5
  %indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next39, %wide.trip.count
  br i1 %exitcond.not, label %.preheader, label %scalar.ph, !llvm.loop !16

.lr.ph28:                                         ; preds = %.lr.ph28.preheader, %.lr.ph28
  %38 = phi i32 [ %42, %.lr.ph28 ], [ %.pre41, %.lr.ph28.preheader ]
  %.227 = phi i32 [ %43, %.lr.ph28 ], [ 1, %.lr.ph28.preheader ]
  %39 = tail call noundef i32 @_Z2dpi(i32 noundef %.227)
  %40 = add nsw i32 %39, %38
  %41 = load i32, ptr @p, align 4, !tbaa !5
  %42 = srem i32 %40, %41
  store i32 %42, ptr @ans, align 4, !tbaa !5
  %43 = add nuw nsw i32 %.227, 1
  %44 = load i32, ptr @m, align 4, !tbaa !5
  %.not15.not = icmp slt i32 %.227, %44
  br i1 %.not15.not, label %.lr.ph28, label %._crit_edge29, !llvm.loop !17

._crit_edge29:                                    ; preds = %.lr.ph28, %.preheader.._crit_edge29_crit_edge
  %45 = phi i32 [ %.pre42, %.preheader.._crit_edge29_crit_edge ], [ %41, %.lr.ph28 ]
  %.lcssa = phi i32 [ %21, %.preheader.._crit_edge29_crit_edge ], [ %44, %.lr.ph28 ]
  call void @_Z3gcdiiRiS_(i32 noundef %.lcssa, i32 noundef %45, ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %46 = load i32, ptr @ans, align 4, !tbaa !5
  %47 = load i32, ptr %1, align 4, !tbaa !5
  %48 = load i32, ptr @p, align 4, !tbaa !5
  %49 = add nsw i32 %48, %47
  %50 = mul nsw i32 %49, %46
  %51 = srem i32 %50, %48
  store i32 %51, ptr @ans, align 4, !tbaa !5
  %52 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %51)
  %53 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %52, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #4

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #5

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "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 = { 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, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !15}
!15 = !{!"llvm.loop.unswitch.partial.disable"}
!16 = distinct !{!16, !10, !12, !11}
!17 = distinct !{!17, !10}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass