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

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

%"struct.std::pair" = type { i32, i64 }

@p = external dso_local global i32, align 4
@nk = external dso_local global i32, align 4
@pp = external dso_local global i32, align 4
@prod = external dso_local global i32, align 4
@ans = external dso_local global i32, align 4
@mod = external dso_local global i32, align 4
@f = external dso_local global [20 x i32], align 16
@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@all = external dso_local global %"struct.std::pair", align 8
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z7mod_invi(i32 noundef) #0

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4calci(i32 noundef) #0

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5solvev() #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5checkv() #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #4 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"struct.std::pair", align 8
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  br label %8

8:                                                ; preds = %41, %0
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @M, ptr noundef @N, ptr noundef @nk)
  %10 = icmp eq i32 %9, 3
  br i1 %10, label %11, label %68

11:                                               ; preds = %8
  store i32 0, ptr @ans, align 4, !tbaa !5
  store i32 1, ptr @mod, align 4, !tbaa !5
  store i32 2, ptr @p, align 4, !tbaa !5
  store i32 1, ptr @pp, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %12

12:                                               ; preds = %21, %11
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = load i32, ptr @nk, align 4, !tbaa !5
  %15 = icmp slt i32 %13, %14
  br i1 %15, label %17, label %16

16:                                               ; preds = %12
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %24

17:                                               ; preds = %12
  %18 = load i32, ptr @p, align 4, !tbaa !5
  %19 = load i32, ptr @pp, align 4, !tbaa !5
  %20 = mul nsw i32 %19, %18
  store i32 %20, ptr @pp, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %17
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = add nsw i32 %22, 1
  store i32 %23, ptr %2, align 4, !tbaa !5
  br label %12, !llvm.loop !9

24:                                               ; preds = %16
  %25 = load i32, ptr @pp, align 4, !tbaa !5
  call void @_Z4calci(i32 noundef %25)
  %26 = load i32, ptr @f, align 16, !tbaa !5
  store i32 %26, ptr @prod, align 4, !tbaa !5
  call void @_Z5solvev()
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  %27 = load i32, ptr @p, align 4, !tbaa !5
  store i32 %27, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  %28 = load i32, ptr @pp, align 4, !tbaa !5
  store i32 %28, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %5, ptr align 8 @all, i64 16, i1 false)
  store i32 5, ptr @p, align 4, !tbaa !5
  store i32 1, ptr @pp, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %38, %24
  %30 = load i32, ptr %6, align 4, !tbaa !5
  %31 = load i32, ptr @nk, align 4, !tbaa !5
  %32 = icmp slt i32 %30, %31
  br i1 %32, label %34, label %33

33:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %41

34:                                               ; preds = %29
  %35 = load i32, ptr @p, align 4, !tbaa !5
  %36 = load i32, ptr @pp, align 4, !tbaa !5
  %37 = mul nsw i32 %36, %35
  store i32 %37, ptr @pp, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %34
  %39 = load i32, ptr %6, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %6, align 4, !tbaa !5
  br label %29, !llvm.loop !11

41:                                               ; preds = %33
  %42 = load i32, ptr @pp, align 4, !tbaa !5
  call void @_Z4calci(i32 noundef %42)
  %43 = load i32, ptr @f, align 16, !tbaa !5
  store i32 %43, ptr @prod, align 4, !tbaa !5
  call void @_Z5solvev()
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %44 = getelementptr inbounds %"struct.std::pair", ptr %5, i32 0, i32 1
  %45 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %44, ptr noundef nonnull align 8 dereferenceable(8) getelementptr inbounds (%"struct.std::pair", ptr @all, i32 0, i32 1))
  %46 = load i64, ptr %45, align 8, !tbaa !12
  store i64 %46, ptr %7, align 8, !tbaa !12
  %47 = load i32, ptr @all, align 8, !tbaa !14
  %48 = load i32, ptr %3, align 4, !tbaa !5
  %49 = load i64, ptr %7, align 8, !tbaa !12
  %50 = call noundef i32 @_Z7mod_powix(i32 noundef %48, i64 noundef %49)
  %51 = call noundef i32 @_Z7mod_invi(i32 noundef %50)
  %52 = call noundef i32 @_Z7mod_mulii(i32 noundef %47, i32 noundef %51)
  store i32 %52, ptr @all, align 8, !tbaa !14
  %53 = load i64, ptr %7, align 8, !tbaa !12
  %54 = load i64, ptr getelementptr inbounds (%"struct.std::pair", ptr @all, i32 0, i32 1), align 8, !tbaa !16
  %55 = sub nsw i64 %54, %53
  store i64 %55, ptr getelementptr inbounds (%"struct.std::pair", ptr @all, i32 0, i32 1), align 8, !tbaa !16
  call void @_Z5checkv()
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) @p, ptr noundef nonnull align 4 dereferenceable(4) %3) #6
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) @pp, ptr noundef nonnull align 4 dereferenceable(4) %4) #6
  call void @_ZSt4swapIixENSt9enable_ifIXsr6__and_ISt14__is_swappableIT_ES1_IT0_EEE5valueEvE4typeERSt4pairIS2_S4_ESA_(ptr noundef nonnull align 8 dereferenceable(16) @all, ptr noundef nonnull align 8 dereferenceable(16) %5) #6
  %56 = load i32, ptr @all, align 8, !tbaa !14
  %57 = load i32, ptr %3, align 4, !tbaa !5
  %58 = load i64, ptr %7, align 8, !tbaa !12
  %59 = call noundef i32 @_Z7mod_powix(i32 noundef %57, i64 noundef %58)
  %60 = call noundef i32 @_Z7mod_invi(i32 noundef %59)
  %61 = call noundef i32 @_Z7mod_mulii(i32 noundef %56, i32 noundef %60)
  store i32 %61, ptr @all, align 8, !tbaa !14
  %62 = load i64, ptr %7, align 8, !tbaa !12
  %63 = load i64, ptr getelementptr inbounds (%"struct.std::pair", ptr @all, i32 0, i32 1), align 8, !tbaa !16
  %64 = sub nsw i64 %63, %62
  store i64 %64, ptr getelementptr inbounds (%"struct.std::pair", ptr @all, i32 0, i32 1), align 8, !tbaa !16
  call void @_Z5checkv()
  %65 = load i32, ptr @nk, align 4, !tbaa !5
  %66 = load i32, ptr @ans, align 4, !tbaa !5
  %67 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %65, i32 noundef %66)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 16, 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
  br label %8, !llvm.loop !17

68:                                               ; preds = %8
  ret i32 0
}

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIixENSt9enable_ifIXsr6__and_ISt14__is_swappableIT_ES1_IT0_EEE5valueEvE4typeERSt4pairIS2_S4_ESA_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #2

declare i32 @printf(ptr noundef, ...) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { "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 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = !{!15, !6, i64 0}
!15 = !{!"_ZTSSt4pairIixE", !6, i64 0, !13, i64 8}
!16 = !{!15, !13, i64 8}
!17 = distinct !{!17, !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"

%"struct.std::pair" = type { i32, i64 }

@p = external dso_local global i32, align 4
@nk = external dso_local global i32, align 4
@pp = external dso_local global i32, align 4
@prod = external dso_local local_unnamed_addr global i32, align 4
@ans = external dso_local local_unnamed_addr global i32, align 4
@mod = external dso_local local_unnamed_addr global i32, align 4
@f = external dso_local local_unnamed_addr global [20 x i32], align 16
@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@all = external dso_local global %"struct.std::pair", align 8
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z7mod_invi(i32 noundef) local_unnamed_addr #0

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4calci(i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress 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) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5solvev() local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5checkv() local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"struct.std::pair", align 8
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @M, ptr noundef nonnull @N, ptr noundef nonnull @nk)
  %5 = icmp eq i32 %4, 3
  br i1 %5, label %.lr.ph17, label %._crit_edge18

.lr.ph17:                                         ; preds = %0
  %6 = getelementptr inbounds i8, ptr %3, i64 8
  br label %7

7:                                                ; preds = %.lr.ph17, %26
  store i32 0, ptr @ans, align 4, !tbaa !5
  store i32 1, ptr @mod, align 4, !tbaa !5
  store i32 2, ptr @p, align 4, !tbaa !5
  store i32 1, ptr @pp, align 4, !tbaa !5
  %8 = load i32, ptr @nk, align 4, !tbaa !5
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.lr.ph.preheader, label %13

.lr.ph.preheader:                                 ; preds = %7
  %xtraiter = and i32 %8, 7
  %10 = icmp ult i32 %8, 8
  br i1 %10, label %._crit_edge.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i32 %8, 2147483640
  br label %.lr.ph

._crit_edge.unr-lcssa:                            ; preds = %.lr.ph, %.lr.ph.preheader
  %.lcssa.ph = phi i32 [ poison, %.lr.ph.preheader ], [ %25, %.lr.ph ]
  %.unr = phi i32 [ 1, %.lr.ph.preheader ], [ %25, %.lr.ph ]
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.unr-lcssa, %.lr.ph.epil
  %11 = phi i32 [ %12, %.lr.ph.epil ], [ %.unr, %._crit_edge.unr-lcssa ]
  %epil.iter = phi i32 [ %epil.iter.next, %.lr.ph.epil ], [ 0, %._crit_edge.unr-lcssa ]
  %12 = shl nsw i32 %11, 1
  %epil.iter.next = add i32 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.lr.ph.epil, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph.epil, %._crit_edge.unr-lcssa
  %.lcssa = phi i32 [ %.lcssa.ph, %._crit_edge.unr-lcssa ], [ %12, %.lr.ph.epil ]
  store i32 %.lcssa, ptr @pp, align 4, !tbaa !5
  br label %13

13:                                               ; preds = %._crit_edge, %7
  %14 = phi i32 [ %.lcssa, %._crit_edge ], [ 1, %7 ]
  call void @_Z4calci(i32 noundef %14)
  %15 = load i32, ptr @f, align 16, !tbaa !5
  store i32 %15, ptr @prod, align 4, !tbaa !5
  call void @_Z5solvev()
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %16 = load i32, ptr @p, align 4, !tbaa !5
  store i32 %16, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %17 = load i32, ptr @pp, align 4, !tbaa !5
  store i32 %17, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #7
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) @all, i64 16, i1 false)
  store i32 5, ptr @p, align 4, !tbaa !5
  store i32 1, ptr @pp, align 4, !tbaa !5
  %18 = load i32, ptr @nk, align 4, !tbaa !5
  %19 = icmp sgt i32 %18, 0
  br i1 %19, label %.lr.ph13.preheader, label %26

.lr.ph13.preheader:                               ; preds = %13
  %min.iters.check = icmp ult i32 %18, 8
  br i1 %min.iters.check, label %.lr.ph13.preheader24, label %vector.ph

.lr.ph13.preheader24:                             ; preds = %middle.block, %.lr.ph13.preheader
  %.0811.ph = phi i32 [ 0, %.lr.ph13.preheader ], [ %n.vec, %middle.block ]
  %.ph = phi i32 [ 1, %.lr.ph13.preheader ], [ %23, %middle.block ]
  br label %.lr.ph13

vector.ph:                                        ; preds = %.lr.ph13.preheader
  %n.vec = and i32 %18, 2147483640
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %20, %vector.body ]
  %vec.phi23 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %21, %vector.body ]
  %20 = mul <4 x i32> %vec.phi, <i32 5, i32 5, i32 5, i32 5>
  %21 = mul <4 x i32> %vec.phi23, <i32 5, i32 5, i32 5, i32 5>
  %index.next = add nuw i32 %index, 8
  %22 = icmp eq i32 %index.next, %n.vec
  br i1 %22, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  %bin.rdx = mul <4 x i32> %21, %20
  %23 = call i32 @llvm.vector.reduce.mul.v4i32(<4 x i32> %bin.rdx)
  %cmp.n = icmp eq i32 %18, %n.vec
  br i1 %cmp.n, label %._crit_edge14, label %.lr.ph13.preheader24

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %24 = phi i32 [ 1, %.lr.ph.preheader.new ], [ %25, %.lr.ph ]
  %niter = phi i32 [ 0, %.lr.ph.preheader.new ], [ %niter.next.7, %.lr.ph ]
  %25 = shl i32 %24, 8
  %niter.next.7 = add i32 %niter, 8
  %niter.ncmp.7 = icmp eq i32 %niter.next.7, %unroll_iter
  br i1 %niter.ncmp.7, label %._crit_edge.unr-lcssa, label %.lr.ph, !llvm.loop !15

._crit_edge14:                                    ; preds = %.lr.ph13, %middle.block
  %.lcssa22 = phi i32 [ %23, %middle.block ], [ %51, %.lr.ph13 ]
  store i32 %.lcssa22, ptr @pp, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %._crit_edge14, %13
  %27 = phi i32 [ %.lcssa22, %._crit_edge14 ], [ 1, %13 ]
  call void @_Z4calci(i32 noundef %27)
  %28 = load i32, ptr @f, align 16, !tbaa !5
  store i32 %28, ptr @prod, align 4, !tbaa !5
  call void @_Z5solvev()
  %29 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) getelementptr inbounds (i8, ptr @all, i64 8))
  %30 = load i64, ptr %29, align 8, !tbaa !16
  %31 = load i32, ptr @all, align 8, !tbaa !18
  %32 = load i32, ptr %1, align 4, !tbaa !5
  %33 = call noundef i32 @_Z7mod_powix(i32 noundef %32, i64 noundef %30)
  %34 = call noundef i32 @_Z7mod_invi(i32 noundef %33)
  %35 = call noundef i32 @_Z7mod_mulii(i32 noundef %31, i32 noundef %34)
  store i32 %35, ptr @all, align 8, !tbaa !18
  %36 = load i64, ptr getelementptr inbounds (i8, ptr @all, i64 8), align 8, !tbaa !20
  %37 = sub nsw i64 %36, %30
  store i64 %37, ptr getelementptr inbounds (i8, ptr @all, i64 8), align 8, !tbaa !20
  call void @_Z5checkv()
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) @p, ptr noundef nonnull align 4 dereferenceable(4) %1) #7
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) @pp, ptr noundef nonnull align 4 dereferenceable(4) %2) #7
  call void @_ZSt4swapIixENSt9enable_ifIXsr6__and_ISt14__is_swappableIT_ES1_IT0_EEE5valueEvE4typeERSt4pairIS2_S4_ESA_(ptr noundef nonnull align 8 dereferenceable(16) @all, ptr noundef nonnull align 8 dereferenceable(16) %3) #7
  %38 = load i32, ptr @all, align 8, !tbaa !18
  %39 = load i32, ptr %1, align 4, !tbaa !5
  %40 = call noundef i32 @_Z7mod_powix(i32 noundef %39, i64 noundef %30)
  %41 = call noundef i32 @_Z7mod_invi(i32 noundef %40)
  %42 = call noundef i32 @_Z7mod_mulii(i32 noundef %38, i32 noundef %41)
  store i32 %42, ptr @all, align 8, !tbaa !18
  %43 = load i64, ptr getelementptr inbounds (i8, ptr @all, i64 8), align 8, !tbaa !20
  %44 = sub nsw i64 %43, %30
  store i64 %44, ptr getelementptr inbounds (i8, ptr @all, i64 8), align 8, !tbaa !20
  call void @_Z5checkv()
  %45 = load i32, ptr @nk, align 4, !tbaa !5
  %46 = load i32, ptr @ans, align 4, !tbaa !5
  %47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %45, i32 noundef %46)
  call void @llvm.lifetime.end.p0(i64 16, 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
  %48 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @M, ptr noundef nonnull @N, ptr noundef nonnull @nk)
  %49 = icmp eq i32 %48, 3
  br i1 %49, label %7, label %._crit_edge18, !llvm.loop !21

.lr.ph13:                                         ; preds = %.lr.ph13.preheader24, %.lr.ph13
  %.0811 = phi i32 [ %52, %.lr.ph13 ], [ %.0811.ph, %.lr.ph13.preheader24 ]
  %50 = phi i32 [ %51, %.lr.ph13 ], [ %.ph, %.lr.ph13.preheader24 ]
  %51 = mul nuw nsw i32 %50, 5
  %52 = add nuw nsw i32 %.0811, 1
  %exitcond20.not = icmp eq i32 %52, %18
  br i1 %exitcond20.not, label %._crit_edge14, label %.lr.ph13, !llvm.loop !22

._crit_edge18:                                    ; preds = %26, %0
  ret i32 0
}

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIixENSt9enable_ifIXsr6__and_ISt14__is_swappableIT_ES1_IT0_EEE5valueEvE4typeERSt4pairIS2_S4_ESA_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.mul.v4i32(<4 x i32>) #6

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 = { 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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.unroll.disable"}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !12}
!16 = !{!17, !17, i64 0}
!17 = !{!"long long", !7, i64 0}
!18 = !{!19, !6, i64 0}
!19 = !{!"_ZTSSt4pairIixE", !6, i64 0, !17, i64 8}
!20 = !{!19, !17, i64 8}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12, !14, !13}


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