; LLVM IR from tangjz/acm-icpc :: codeforces/gym (100540J)

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@seed = external dso_local global i32, align 4
@mod = external dso_local global i32, align 4
@pw = external dso_local global [100001 x i32], align 16
@a = external dso_local global [100001 x i32], align 16
@bit = external dso_local global [100001 x i32], align 16
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; 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
declare dso_local noundef i32 @_Z7mod_invi(i32 noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3addii(i32 noundef, i32 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3sumi(i32 noundef) #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
  %6 = alloca [2 x i8], align 1
  store i32 0, ptr %1, align 4
  br label %7

7:                                                ; preds = %127, %0
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @seed, ptr noundef @mod, ptr noundef @n, ptr noundef @m)
  %9 = icmp eq i32 %8, 4
  br i1 %9, label %10, label %19

10:                                               ; preds = %7
  %11 = load i32, ptr @seed, align 4, !tbaa !5
  %12 = load i32, ptr @mod, align 4, !tbaa !5
  %13 = add nsw i32 %11, %12
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %15 = add nsw i32 %13, %14
  %16 = load i32, ptr @m, align 4, !tbaa !5
  %17 = add nsw i32 %15, %16
  %18 = icmp ne i32 %17, 0
  br label %19

19:                                               ; preds = %10, %7
  %20 = phi i1 [ false, %7 ], [ %18, %10 ]
  br i1 %20, label %21, label %130

21:                                               ; preds = %19
  store i32 1, ptr @pw, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %44, %21
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = load i32, ptr @n, align 4, !tbaa !5
  %25 = icmp sle i32 %23, %24
  br i1 %25, label %27, label %26

26:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %47

27:                                               ; preds = %22
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = sub nsw i32 %28, 1
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [100001 x i32], ptr @pw, i64 0, i64 %30
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = load i32, ptr @seed, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = mul nsw i64 %33, %35
  %37 = load i32, ptr @mod, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = srem i64 %36, %38
  %40 = trunc i64 %39 to i32
  %41 = load i32, ptr %2, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [100001 x i32], ptr @pw, i64 0, i64 %42
  store i32 %40, ptr %43, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %27
  %45 = load i32, ptr %2, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %2, align 4, !tbaa !5
  br label %22, !llvm.loop !9

47:                                               ; preds = %26
  %48 = load i32, ptr @n, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = mul i64 %49, 4
  call void @llvm.memset.p0.i64(ptr align 4 getelementptr inbounds (i32, ptr @a, i64 1), i8 0, i64 %50, i1 false)
  %51 = load i32, ptr @n, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = mul i64 %52, 4
  call void @llvm.memset.p0.i64(ptr align 4 getelementptr inbounds (i32, ptr @bit, i64 1), i8 0, i64 %53, i1 false)
  br label %54

54:                                               ; preds = %126, %47
  %55 = load i32, ptr @m, align 4, !tbaa !5
  %56 = add nsw i32 %55, -1
  store i32 %56, ptr @m, align 4, !tbaa !5
  %57 = icmp ne i32 %55, 0
  br i1 %57, label %58, label %127

58:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.start.p0(i64 2, ptr %6) #7
  %59 = getelementptr inbounds [2 x i8], ptr %6, i64 0, i64 0
  %60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %59, ptr noundef %3, ptr noundef %4)
  %61 = getelementptr inbounds [2 x i8], ptr %6, i64 0, i64 0
  %62 = load i8, ptr %61, align 1, !tbaa !11
  %63 = sext i8 %62 to i32
  %64 = icmp eq i32 %63, 69
  br i1 %64, label %65, label %97

65:                                               ; preds = %58
  %66 = load i32, ptr %4, align 4, !tbaa !5
  %67 = load i32, ptr %3, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = sub nsw i32 %66, %70
  %72 = sext i32 %71 to i64
  %73 = load i32, ptr @n, align 4, !tbaa !5
  %74 = load i32, ptr %3, align 4, !tbaa !5
  %75 = sub nsw i32 %73, %74
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [100001 x i32], ptr @pw, i64 0, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = mul nsw i64 %72, %79
  %81 = load i32, ptr @mod, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = srem i64 %80, %82
  %84 = trunc i64 %83 to i32
  store i32 %84, ptr %5, align 4, !tbaa !5
  %85 = icmp slt i32 %84, 0
  br i1 %85, label %86, label %90

86:                                               ; preds = %65
  %87 = load i32, ptr @mod, align 4, !tbaa !5
  %88 = load i32, ptr %5, align 4, !tbaa !5
  %89 = add nsw i32 %88, %87
  store i32 %89, ptr %5, align 4, !tbaa !5
  br label %90

90:                                               ; preds = %86, %65
  %91 = load i32, ptr %3, align 4, !tbaa !5
  %92 = load i32, ptr %5, align 4, !tbaa !5
  call void @_Z3addii(i32 noundef %91, i32 noundef %92)
  %93 = load i32, ptr %4, align 4, !tbaa !5
  %94 = load i32, ptr %3, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %95
  store i32 %93, ptr %96, align 4, !tbaa !5
  br label %126

97:                                               ; preds = %58
  %98 = load i32, ptr %4, align 4, !tbaa !5
  %99 = call noundef i32 @_Z3sumi(i32 noundef %98)
  %100 = load i32, ptr %3, align 4, !tbaa !5
  %101 = sub nsw i32 %100, 1
  %102 = call noundef i32 @_Z3sumi(i32 noundef %101)
  %103 = sub nsw i32 %99, %102
  %104 = sext i32 %103 to i64
  %105 = load i32, ptr @n, align 4, !tbaa !5
  %106 = load i32, ptr %4, align 4, !tbaa !5
  %107 = sub nsw i32 %105, %106
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [100001 x i32], ptr @pw, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = call noundef i32 @_Z7mod_invi(i32 noundef %110)
  %112 = sext i32 %111 to i64
  %113 = mul nsw i64 %104, %112
  %114 = load i32, ptr @mod, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = srem i64 %113, %115
  %117 = trunc i64 %116 to i32
  store i32 %117, ptr %5, align 4, !tbaa !5
  %118 = icmp slt i32 %117, 0
  br i1 %118, label %119, label %123

119:                                              ; preds = %97
  %120 = load i32, ptr @mod, align 4, !tbaa !5
  %121 = load i32, ptr %5, align 4, !tbaa !5
  %122 = add nsw i32 %121, %120
  store i32 %122, ptr %5, align 4, !tbaa !5
  br label %123

123:                                              ; preds = %119, %97
  %124 = load i32, ptr %5, align 4, !tbaa !5
  %125 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %124)
  br label %126

126:                                              ; preds = %123, %90
  call void @llvm.lifetime.end.p0(i64 2, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %54, !llvm.loop !12

127:                                              ; preds = %54
  %128 = call i32 @putchar(i32 noundef 45)
  %129 = call i32 @putchar(i32 noundef 10)
  br label %7, !llvm.loop !13

130:                                              ; preds = %19
  ret i32 0
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

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

; Function Attrs: inlinehint mustprogress uwtable
declare i32 @putchar(i32 noundef) #6

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 = { 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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 #7 = { nounwind }

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

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@seed = external dso_local global i32, align 4
@mod = external dso_local global i32, align 4
@pw = external dso_local local_unnamed_addr global [100001 x i32], align 16
@a = external dso_local local_unnamed_addr global [100001 x i32], align 16
@bit = external dso_local local_unnamed_addr global [100001 x i32], align 16
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; 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
declare dso_local noundef i32 @_Z7mod_invi(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3addii(i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3sumi(i32 noundef) local_unnamed_addr #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
  %3 = alloca [2 x i8], align 1
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @seed, ptr noundef nonnull @mod, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %5 = icmp eq i32 %4, 4
  br i1 %5, label %.lr.ph24, label %.critedge

.lr.ph24:                                         ; preds = %0, %._crit_edge22
  %6 = load i32, ptr @seed, align 4, !tbaa !5
  %7 = load i32, ptr @mod, align 4, !tbaa !5
  %8 = add nsw i32 %7, %6
  %9 = load i32, ptr @n, align 4, !tbaa !5
  %10 = add nsw i32 %8, %9
  %11 = load i32, ptr @m, align 4, !tbaa !5
  %12 = sub i32 0, %11
  %.not = icmp eq i32 %10, %12
  br i1 %.not, label %.critedge, label %13

13:                                               ; preds = %.lr.ph24
  store i32 1, ptr @pw, align 16, !tbaa !5
  %.not1417 = icmp slt i32 %9, 1
  br i1 %.not1417, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %13
  %14 = sext i32 %6 to i64
  %15 = sext i32 %7 to i64
  %16 = zext nneg i32 %9 to i64
  %xtraiter = and i64 %16, 1
  %17 = icmp eq i32 %9, 1
  br i1 %17, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i64 %16, 2147483646
  br label %26

._crit_edge.loopexit.unr-lcssa:                   ; preds = %26, %.lr.ph
  %.unr = phi i64 [ 1, %.lr.ph ], [ %35, %26 ]
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph ], [ %indvars.iv.next.1, %26 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %._crit_edge.loopexit.epilog-lcssa

._crit_edge.loopexit.epilog-lcssa:                ; preds = %._crit_edge.loopexit.unr-lcssa
  %sext.epil = shl i64 %.unr, 32
  %18 = ashr exact i64 %sext.epil, 32
  %19 = mul nsw i64 %18, %14
  %20 = srem i64 %19, %15
  %21 = trunc nsw i64 %20 to i32
  %22 = getelementptr inbounds [100001 x i32], ptr @pw, i64 0, i64 %indvars.iv.unr
  store i32 %21, ptr %22, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit.epilog-lcssa, %._crit_edge.loopexit.unr-lcssa, %13
  %23 = sext i32 %9 to i64
  %24 = shl nsw i64 %23, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @a, i64 4), i8 0, i64 %24, i1 false)
  call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @bit, i64 4), i8 0, i64 %24, i1 false)
  %25 = add nsw i32 %11, -1
  store i32 %25, ptr @m, align 4, !tbaa !5
  %.not1519 = icmp eq i32 %11, 0
  br i1 %.not1519, label %._crit_edge22, label %.lr.ph21

26:                                               ; preds = %26, %.lr.ph.new
  %27 = phi i64 [ 1, %.lr.ph.new ], [ %35, %26 ]
  %indvars.iv = phi i64 [ 1, %.lr.ph.new ], [ %indvars.iv.next.1, %26 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.1, %26 ]
  %sext = shl i64 %27, 32
  %28 = ashr exact i64 %sext, 32
  %29 = mul nsw i64 %28, %14
  %30 = srem i64 %29, %15
  %31 = trunc nsw i64 %30 to i32
  %32 = getelementptr inbounds [100001 x i32], ptr @pw, i64 0, i64 %indvars.iv
  store i32 %31, ptr %32, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %sext.1 = shl i64 %30, 32
  %33 = ashr exact i64 %sext.1, 32
  %34 = mul nsw i64 %33, %14
  %35 = srem i64 %34, %15
  %36 = trunc nsw i64 %35 to i32
  %37 = getelementptr inbounds [100001 x i32], ptr @pw, i64 0, i64 %indvars.iv.next
  store i32 %36, ptr %37, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.loopexit.unr-lcssa, label %26, !llvm.loop !9

.lr.ph21:                                         ; preds = %._crit_edge, %89
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %3) #7
  %38 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %3, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %39 = load i8, ptr %3, align 1, !tbaa !11
  %40 = icmp eq i8 %39, 69
  %41 = load i32, ptr %2, align 4, !tbaa !5
  br i1 %40, label %42, label %66

42:                                               ; preds = %.lr.ph21
  %43 = load i32, ptr %1, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = sub nsw i32 %41, %46
  %48 = sext i32 %47 to i64
  %49 = load i32, ptr @n, align 4, !tbaa !5
  %50 = sub nsw i32 %49, %43
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [100001 x i32], ptr @pw, i64 0, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = mul nsw i64 %54, %48
  %56 = load i32, ptr @mod, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = srem i64 %55, %57
  %59 = trunc nsw i64 %58 to i32
  %60 = icmp slt i64 %58, 0
  %61 = select i1 %60, i32 %56, i32 0
  %spec.select = add nsw i32 %61, %59
  call void @_Z3addii(i32 noundef %43, i32 noundef %spec.select)
  %62 = load i32, ptr %2, align 4, !tbaa !5
  %63 = load i32, ptr %1, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %64
  store i32 %62, ptr %65, align 4, !tbaa !5
  br label %89

66:                                               ; preds = %.lr.ph21
  %67 = call noundef i32 @_Z3sumi(i32 noundef %41)
  %68 = load i32, ptr %1, align 4, !tbaa !5
  %69 = add nsw i32 %68, -1
  %70 = call noundef i32 @_Z3sumi(i32 noundef %69)
  %71 = sub nsw i32 %67, %70
  %72 = sext i32 %71 to i64
  %73 = load i32, ptr @n, align 4, !tbaa !5
  %74 = load i32, ptr %2, align 4, !tbaa !5
  %75 = sub nsw i32 %73, %74
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [100001 x i32], ptr @pw, i64 0, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = call noundef i32 @_Z7mod_invi(i32 noundef %78)
  %80 = sext i32 %79 to i64
  %81 = mul nsw i64 %80, %72
  %82 = load i32, ptr @mod, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = srem i64 %81, %83
  %85 = trunc nsw i64 %84 to i32
  %86 = icmp slt i64 %84, 0
  %87 = select i1 %86, i32 %82, i32 0
  %spec.select16 = add nsw i32 %87, %85
  %88 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %spec.select16)
  br label %89

89:                                               ; preds = %66, %42
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  %90 = load i32, ptr @m, align 4, !tbaa !5
  %91 = add nsw i32 %90, -1
  store i32 %91, ptr @m, align 4, !tbaa !5
  %.not15 = icmp eq i32 %90, 0
  br i1 %.not15, label %._crit_edge22, label %.lr.ph21, !llvm.loop !12

._crit_edge22:                                    ; preds = %89, %._crit_edge
  %92 = call i32 @putchar(i32 noundef 45)
  %93 = call i32 @putchar(i32 noundef 10)
  %94 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @seed, ptr noundef nonnull @mod, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %95 = icmp eq i32 %94, 4
  br i1 %95, label %.lr.ph24, label %.critedge, !llvm.loop !13

.critedge:                                        ; preds = %.lr.ph24, %._crit_edge22, %0
  ret i32 0
}

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

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

; Function Attrs: inlinehint mustprogress nofree nounwind uwtable
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6

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

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

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


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