; LLVM IR from tangjz/acm-icpc :: openjudge/poj (1058)

; 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.Matrix = type { i32, i32, [5 x [5 x i32]] }

@m = external dso_local global i32, align 4
@len = external dso_local global i32, align 4
@mod = external dso_local global i32, align 4
@ans = external dso_local global i32, align 4
@n = external dso_local global i64, align 8
@A = external dso_local global %struct.Matrix, align 4
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7mod_powii(i32 noundef, 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 nounwind uwtable
declare dso_local noundef i32 @_Z6originv() #1

; 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 i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %struct.Matrix, align 4
  %12 = alloca %struct.Matrix, align 4
  %13 = alloca %struct.Matrix, 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
  br label %14

14:                                               ; preds = %85, %0
  %15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @m, ptr noundef @n, ptr noundef @len, ptr noundef @mod)
  %16 = icmp eq i32 %15, 4
  br i1 %16, label %18, label %17

17:                                               ; preds = %14
  store i32 2, ptr %6, align 4
  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
  br label %98

18:                                               ; preds = %14
  call void @llvm.memset.p0.i64(ptr align 4 @A, i8 0, i64 108, i1 false)
  %19 = load i32, ptr @m, align 4, !tbaa !5
  store i32 %19, ptr getelementptr inbounds (%struct.Matrix, ptr @A, i32 0, i32 1), align 4, !tbaa !9
  store i32 %19, ptr @A, align 4, !tbaa !11
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %2, ptr noundef %3, ptr noundef %4)
  %21 = load i32, ptr %3, align 4, !tbaa !5
  %22 = add nsw i32 %21, -1
  store i32 %22, ptr %3, align 4, !tbaa !5
  %23 = load i32, ptr %4, align 4, !tbaa !5
  %24 = add nsw i32 %23, -1
  store i32 %24, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  br label %25

25:                                               ; preds = %30, %18
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = add nsw i32 %26, -1
  store i32 %27, ptr %2, align 4, !tbaa !5
  %28 = icmp ne i32 %26, 0
  br i1 %28, label %30, label %29

29:                                               ; preds = %25
  store i32 4, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %42

30:                                               ; preds = %25
  %31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %7, ptr noundef %8)
  %32 = load i32, ptr %7, align 4, !tbaa !5
  %33 = add nsw i32 %32, -1
  store i32 %33, ptr %7, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [5 x [5 x i32]], ptr getelementptr inbounds (%struct.Matrix, ptr @A, i32 0, i32 2), i64 0, i64 %34
  %36 = load i32, ptr %8, align 4, !tbaa !5
  %37 = add nsw i32 %36, -1
  store i32 %37, ptr %8, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [5 x i32], ptr %35, i64 0, i64 %38
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %39, align 4, !tbaa !5
  br label %25, !llvm.loop !12

42:                                               ; preds = %29
  store i32 0, ptr @ans, align 4, !tbaa !5
  %43 = call noundef i32 @_Z6originv()
  %44 = load i32, ptr @mod, align 4, !tbaa !5
  %45 = sub nsw i32 %44, 1
  %46 = load i32, ptr @len, align 4, !tbaa !5
  %47 = sdiv i32 %45, %46
  %48 = call noundef i32 @_Z7mod_powii(i32 noundef %43, i32 noundef %47)
  store i32 %48, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %49

49:                                               ; preds = %73, %42
  %50 = load i32, ptr %9, align 4, !tbaa !5
  %51 = load i32, ptr @len, align 4, !tbaa !5
  %52 = icmp slt i32 %50, %51
  br i1 %52, label %54, label %53

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

54:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 108, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 108, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 108, ptr %13) #6
  call void @_ZNK6MatrixmlERKi(ptr dead_on_unwind writable sret(%struct.Matrix) align 4 %13, ptr noundef nonnull align 4 dereferenceable(108) @A, ptr noundef nonnull align 4 dereferenceable(4) %10)
  call void @_ZN6Matrix3incEv(ptr dead_on_unwind writable sret(%struct.Matrix) align 4 %12, ptr noundef nonnull align 4 dereferenceable(108) %13)
  %55 = load i64, ptr @n, align 8, !tbaa !14
  call void @_ZN6Matrix3powEx(ptr dead_on_unwind writable sret(%struct.Matrix) align 4 %11, ptr noundef nonnull align 4 dereferenceable(108) %12, i64 noundef %55)
  %56 = getelementptr inbounds %struct.Matrix, ptr %11, i32 0, i32 2
  %57 = load i32, ptr %3, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [5 x [5 x i32]], ptr %56, i64 0, i64 %58
  %60 = load i32, ptr %4, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [5 x i32], ptr %59, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = load i32, ptr @ans, align 4, !tbaa !5
  %65 = add nsw i32 %64, %63
  store i32 %65, ptr @ans, align 4, !tbaa !5
  %66 = load i32, ptr @mod, align 4, !tbaa !5
  %67 = icmp sge i32 %65, %66
  call void @llvm.lifetime.end.p0(i64 108, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 108, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 108, ptr %11) #6
  br i1 %67, label %68, label %72

68:                                               ; preds = %54
  %69 = load i32, ptr @mod, align 4, !tbaa !5
  %70 = load i32, ptr @ans, align 4, !tbaa !5
  %71 = sub nsw i32 %70, %69
  store i32 %71, ptr @ans, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %68, %54
  br label %73

73:                                               ; preds = %72
  %74 = load i32, ptr %9, align 4, !tbaa !5
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %9, align 4, !tbaa !5
  %76 = load i32, ptr %10, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = load i32, ptr %5, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = mul nsw i64 %77, %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 %10, align 4, !tbaa !5
  br label %49, !llvm.loop !16

85:                                               ; preds = %53
  %86 = load i32, ptr @ans, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = load i32, ptr @len, align 4, !tbaa !5
  %89 = call noundef i32 @_Z7mod_invi(i32 noundef %88)
  %90 = sext i32 %89 to i64
  %91 = mul nsw i64 %87, %90
  %92 = load i32, ptr @mod, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = srem i64 %91, %93
  %95 = trunc i64 %94 to i32
  store i32 %95, ptr @ans, align 4, !tbaa !5
  %96 = load i32, ptr @ans, align 4, !tbaa !5
  %97 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %96)
  br label %14, !llvm.loop !17

98:                                               ; preds = %17
  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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNK6MatrixmlERKi(ptr dead_on_unwind noalias writable sret(%struct.Matrix) align 4, ptr noundef nonnull align 4 dereferenceable(108), ptr noundef nonnull align 4 dereferenceable(4)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6Matrix3incEv(ptr dead_on_unwind noalias writable sret(%struct.Matrix) align 4, ptr noundef nonnull align 4 dereferenceable(108)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6Matrix3powEx(ptr dead_on_unwind noalias writable sret(%struct.Matrix) align 4, ptr noundef nonnull align 4 dereferenceable(108), i64 noundef) #0 align 2

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

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

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

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


; 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.Matrix = type { i32, i32, [5 x [5 x i32]] }

@m = external dso_local global i32, align 4
@len = external dso_local global i32, align 4
@mod = external dso_local global i32, align 4
@ans = external dso_local local_unnamed_addr global i32, align 4
@n = external dso_local global i64, align 8
@A = external dso_local global %struct.Matrix, align 4
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7mod_powii(i32 noundef, 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 nounwind uwtable
declare dso_local noundef i32 @_Z6originv() local_unnamed_addr #1

; 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 i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %struct.Matrix, align 4
  %8 = alloca %struct.Matrix, align 4
  %9 = alloca %struct.Matrix, 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
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %10 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @m, ptr noundef nonnull @n, ptr noundef nonnull @len, ptr noundef nonnull @mod)
  %11 = icmp eq i32 %10, 4
  br i1 %11, label %.lr.ph10, label %._crit_edge11

.lr.ph10:                                         ; preds = %0
  %12 = getelementptr inbounds i8, ptr %7, i64 8
  br label %13

._crit_edge11:                                    ; preds = %._crit_edge8, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  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

13:                                               ; preds = %.lr.ph10, %._crit_edge8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(108) getelementptr inbounds (i8, ptr @A, i64 8), i8 0, i64 100, i1 false)
  %14 = load i32, ptr @m, align 4, !tbaa !5
  store i32 %14, ptr getelementptr inbounds (i8, ptr @A, i64 4), align 4, !tbaa !9
  store i32 %14, ptr @A, align 4, !tbaa !11
  %15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = add nsw i32 %16, -1
  store i32 %17, ptr %2, align 4, !tbaa !5
  %18 = load i32, ptr %3, align 4, !tbaa !5
  %19 = add nsw i32 %18, -1
  store i32 %19, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  %20 = load i32, ptr %1, align 4, !tbaa !5
  %21 = add nsw i32 %20, -1
  store i32 %21, ptr %1, align 4, !tbaa !5
  %.not4 = icmp eq i32 %20, 0
  br i1 %.not4, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %13
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  store i32 0, ptr @ans, align 4, !tbaa !5
  %22 = call noundef i32 @_Z6originv()
  %23 = load i32, ptr @mod, align 4, !tbaa !5
  %24 = add nsw i32 %23, -1
  %25 = load i32, ptr @len, align 4, !tbaa !5
  %26 = sdiv i32 %24, %25
  %27 = call noundef i32 @_Z7mod_powii(i32 noundef %22, i32 noundef %26)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  store i32 1, ptr %6, align 4, !tbaa !5
  %28 = load i32, ptr @len, align 4, !tbaa !5
  %29 = icmp sgt i32 %28, 0
  br i1 %29, label %.lr.ph7, label %._crit_edge.._crit_edge8_crit_edge

._crit_edge.._crit_edge8_crit_edge:               ; preds = %._crit_edge
  %.pre = load i32, ptr @ans, align 4, !tbaa !5
  br label %._crit_edge8

.lr.ph7:                                          ; preds = %._crit_edge
  %30 = sext i32 %27 to i64
  br label %55

.lr.ph:                                           ; preds = %13, %.lr.ph
  %31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %4, ptr noundef nonnull %5)
  %32 = load i32, ptr %4, align 4, !tbaa !5
  %33 = add nsw i32 %32, -1
  store i32 %33, ptr %4, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = load i32, ptr %5, align 4, !tbaa !5
  %36 = add nsw i32 %35, -1
  store i32 %36, ptr %5, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [5 x [5 x i32]], ptr getelementptr inbounds (i8, ptr @A, i64 8), i64 0, i64 %34, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %38, align 4, !tbaa !5
  %41 = load i32, ptr %1, align 4, !tbaa !5
  %42 = add nsw i32 %41, -1
  store i32 %42, ptr %1, align 4, !tbaa !5
  %.not = icmp eq i32 %41, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !12

._crit_edge8:                                     ; preds = %68, %._crit_edge.._crit_edge8_crit_edge
  %43 = phi i32 [ %.pre, %._crit_edge.._crit_edge8_crit_edge ], [ %69, %68 ]
  %.lcssa = phi i32 [ %28, %._crit_edge.._crit_edge8_crit_edge ], [ %77, %68 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  %44 = sext i32 %43 to i64
  %45 = call noundef i32 @_Z7mod_invi(i32 noundef %.lcssa)
  %46 = sext i32 %45 to i64
  %47 = mul nsw i64 %46, %44
  %48 = load i32, ptr @mod, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = srem i64 %47, %49
  %51 = trunc nsw i64 %50 to i32
  store i32 %51, ptr @ans, align 4, !tbaa !5
  %52 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %51)
  %53 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @m, ptr noundef nonnull @n, ptr noundef nonnull @len, ptr noundef nonnull @mod)
  %54 = icmp eq i32 %53, 4
  br i1 %54, label %13, label %._crit_edge11, !llvm.loop !14

55:                                               ; preds = %.lr.ph7, %68
  %.05 = phi i32 [ 0, %.lr.ph7 ], [ %70, %68 ]
  call void @llvm.lifetime.start.p0(i64 108, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 108, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 108, ptr nonnull %9) #6
  call void @_ZNK6MatrixmlERKi(ptr dead_on_unwind nonnull writable sret(%struct.Matrix) align 4 %9, ptr noundef nonnull align 4 dereferenceable(108) @A, ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @_ZN6Matrix3incEv(ptr dead_on_unwind nonnull writable sret(%struct.Matrix) align 4 %8, ptr noundef nonnull align 4 dereferenceable(108) %9)
  %56 = load i64, ptr @n, align 8, !tbaa !15
  call void @_ZN6Matrix3powEx(ptr dead_on_unwind nonnull writable sret(%struct.Matrix) align 4 %7, ptr noundef nonnull align 4 dereferenceable(108) %8, i64 noundef %56)
  %57 = load i32, ptr %2, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = load i32, ptr %3, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [5 x [5 x i32]], ptr %12, i64 0, i64 %58, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = load i32, ptr @ans, align 4, !tbaa !5
  %64 = add nsw i32 %63, %62
  store i32 %64, ptr @ans, align 4, !tbaa !5
  %65 = load i32, ptr @mod, align 4, !tbaa !5
  %.not3 = icmp slt i32 %64, %65
  call void @llvm.lifetime.end.p0(i64 108, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 108, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 108, ptr nonnull %7) #6
  br i1 %.not3, label %68, label %66

66:                                               ; preds = %55
  %67 = sub nsw i32 %64, %65
  store i32 %67, ptr @ans, align 4, !tbaa !5
  br label %68

68:                                               ; preds = %55, %66
  %69 = phi i32 [ %64, %55 ], [ %67, %66 ]
  %70 = add nuw nsw i32 %.05, 1
  %71 = load i32, ptr %6, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = mul nsw i64 %72, %30
  %74 = sext i32 %65 to i64
  %75 = srem i64 %73, %74
  %76 = trunc nsw i64 %75 to i32
  store i32 %76, ptr %6, align 4, !tbaa !5
  %77 = load i32, ptr @len, align 4, !tbaa !5
  %78 = icmp slt i32 %70, %77
  br i1 %78, label %55, label %._crit_edge8, !llvm.loop !17
}

; 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: mustprogress nounwind uwtable
declare dso_local void @_ZNK6MatrixmlERKi(ptr dead_on_unwind noalias writable sret(%struct.Matrix) align 4, ptr noundef nonnull align 4 dereferenceable(108), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6Matrix3incEv(ptr dead_on_unwind noalias writable sret(%struct.Matrix) align 4, ptr noundef nonnull align 4 dereferenceable(108)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6Matrix3powEx(ptr dead_on_unwind noalias writable sret(%struct.Matrix) align 4, ptr noundef nonnull align 4 dereferenceable(108), i64 noundef) local_unnamed_addr #0 align 2

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

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 = { 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 = { 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, !6, i64 4}
!10 = !{!"_ZTS6Matrix", !6, i64 0, !6, i64 4, !7, i64 8}
!11 = !{!10, !6, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = !{!16, !16, i64 0}
!16 = !{!"long long", !7, i64 0}
!17 = distinct !{!17, !13}


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