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

; 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 { [5 x [5 x i64]] }

@mod = external dso_local global i64, align 8
@buf = external dso_local global [100001 x i8], align 16
@A = external dso_local global %struct.Matrix, align 8
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca %struct.Matrix, align 8
  %17 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 0, ptr %4, align 4, !tbaa !5
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @buf, ptr noundef %3, ptr noundef @mod)
  %19 = call i64 @strlen(ptr noundef @buf) #8
  %20 = trunc i64 %19 to i32
  store i32 %20, ptr %2, align 4, !tbaa !5
  %21 = load i64, ptr @mod, align 8, !tbaa !9
  %22 = mul nsw i64 %21, 9
  store i64 %22, ptr @mod, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  %23 = load i64, ptr @mod, align 8, !tbaa !9
  %24 = srem i64 1, %23
  store i64 %24, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  store i64 0, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  store i64 0, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  store i64 0, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  store i64 0, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = sub nsw i32 %25, 1
  store i32 %26, ptr %10, align 4, !tbaa !5
  br label %27

27:                                               ; preds = %68, %0
  %28 = load i32, ptr %10, align 4, !tbaa !5
  %29 = icmp sge i32 %28, 0
  br i1 %29, label %31, label %30

30:                                               ; preds = %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %75

31:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %32 = load i32, ptr %10, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [100001 x i8], ptr @buf, i64 0, i64 %33
  %35 = load i8, ptr %34, align 1, !tbaa !11
  %36 = sext i8 %35 to i32
  %37 = sub nsw i32 %36, 48
  %38 = sext i32 %37 to i64
  %39 = load i64, ptr @mod, align 8, !tbaa !9
  %40 = srem i64 %38, %39
  %41 = trunc i64 %40 to i32
  store i32 %41, ptr %11, align 4, !tbaa !5
  %42 = load i64, ptr %6, align 8, !tbaa !9
  %43 = load i32, ptr %11, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = call noundef i64 @_Z7mod_addxx(i64 noundef %42, i64 noundef %44)
  store i64 %45, ptr %6, align 8, !tbaa !9
  %46 = load i64, ptr %7, align 8, !tbaa !9
  %47 = load i32, ptr %4, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = load i32, ptr %11, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = call noundef i64 @_Z7mod_mulxx(i64 noundef %48, i64 noundef %50)
  %52 = call noundef i64 @_Z7mod_addxx(i64 noundef %46, i64 noundef %51)
  store i64 %52, ptr %7, align 8, !tbaa !9
  %53 = load i64, ptr %8, align 8, !tbaa !9
  %54 = load i64, ptr %5, align 8, !tbaa !9
  %55 = load i32, ptr %11, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = call noundef i64 @_Z7mod_mulxx(i64 noundef %54, i64 noundef %56)
  %58 = call noundef i64 @_Z7mod_addxx(i64 noundef %53, i64 noundef %57)
  store i64 %58, ptr %8, align 8, !tbaa !9
  %59 = load i64, ptr %9, align 8, !tbaa !9
  %60 = load i32, ptr %4, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = load i64, ptr %5, align 8, !tbaa !9
  %63 = load i32, ptr %11, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = call noundef i64 @_Z7mod_mulxx(i64 noundef %62, i64 noundef %64)
  %66 = call noundef i64 @_Z7mod_mulxx(i64 noundef %61, i64 noundef %65)
  %67 = call noundef i64 @_Z7mod_addxx(i64 noundef %59, i64 noundef %66)
  store i64 %67, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %68

68:                                               ; preds = %31
  %69 = load i32, ptr %10, align 4, !tbaa !5
  %70 = add nsw i32 %69, -1
  store i32 %70, ptr %10, align 4, !tbaa !5
  %71 = load i32, ptr %4, align 4, !tbaa !5
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %4, align 4, !tbaa !5
  %73 = load i64, ptr %5, align 8, !tbaa !9
  %74 = call noundef i64 @_Z7mod_mulxx(i64 noundef %73, i64 noundef 10)
  store i64 %74, ptr %5, align 8, !tbaa !9
  br label %27, !llvm.loop !12

75:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %76 = load i32, ptr %3, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = load i64, ptr @mod, align 8, !tbaa !9
  %79 = srem i64 %77, %78
  store i64 %79, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %80 = load i64, ptr %12, align 8, !tbaa !9
  %81 = load i64, ptr %12, align 8, !tbaa !9
  %82 = add nsw i64 %81, 1
  %83 = mul nsw i64 %80, %82
  %84 = sdiv i64 %83, 2
  %85 = load i64, ptr @mod, align 8, !tbaa !9
  %86 = srem i64 %84, %85
  store i64 %86, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %87 = load i64, ptr %5, align 8, !tbaa !9
  store i64 %87, ptr getelementptr inbounds ([5 x i64], ptr getelementptr inbounds ([5 x [5 x i64]], ptr @A, i64 0, i64 1), i64 0, i64 1), align 8, !tbaa !9
  store i64 %87, ptr @A, align 8, !tbaa !9
  %88 = load i64, ptr %5, align 8, !tbaa !9
  %89 = icmp ne i64 %88, 0
  br i1 %89, label %90, label %94

90:                                               ; preds = %75
  %91 = load i64, ptr @mod, align 8, !tbaa !9
  %92 = load i64, ptr %5, align 8, !tbaa !9
  %93 = sub nsw i64 %91, %92
  br label %95

94:                                               ; preds = %75
  br label %95

95:                                               ; preds = %94, %90
  %96 = phi i64 [ %93, %90 ], [ 0, %94 ]
  store i64 %96, ptr getelementptr inbounds ([5 x i64], ptr @A, i64 0, i64 1), align 8, !tbaa !9
  %97 = load i64, ptr @mod, align 8, !tbaa !9
  %98 = srem i64 1, %97
  store i64 %98, ptr getelementptr inbounds ([5 x i64], ptr getelementptr inbounds ([5 x [5 x i64]], ptr @A, i64 0, i64 3), i64 0, i64 3), align 8, !tbaa !9
  store i64 %98, ptr getelementptr inbounds ([5 x i64], ptr getelementptr inbounds ([5 x [5 x i64]], ptr @A, i64 0, i64 2), i64 0, i64 2), align 8, !tbaa !9
  store i64 %98, ptr getelementptr inbounds ([5 x i64], ptr getelementptr inbounds ([5 x [5 x i64]], ptr @A, i64 0, i64 1), i64 0, i64 3), align 8, !tbaa !9
  store i64 %98, ptr getelementptr inbounds ([5 x i64], ptr @A, i64 0, i64 2), align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 200, ptr %16) #7
  %99 = load i32, ptr %3, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  call void @_ZNK6Matrix3powEx(ptr dead_on_unwind writable sret(%struct.Matrix) align 8 %16, ptr noundef nonnull align 8 dereferenceable(200) @A, i64 noundef %100)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 @A, ptr align 8 %16, i64 200, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 200, ptr %16) #7
  %101 = load i64, ptr getelementptr inbounds ([5 x i64], ptr @A, i64 0, i64 2), align 8, !tbaa !9
  %102 = load i32, ptr %3, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = load i64, ptr getelementptr inbounds ([5 x i64], ptr getelementptr inbounds ([5 x [5 x i64]], ptr @A, i64 0, i64 1), i64 0, i64 2), align 8, !tbaa !9
  %105 = call noundef i64 @_Z7mod_mulxx(i64 noundef %103, i64 noundef %104)
  %106 = call noundef i64 @_Z7mod_addxx(i64 noundef %101, i64 noundef %105)
  store i64 %106, ptr %14, align 8, !tbaa !9
  %107 = load i64, ptr getelementptr inbounds ([5 x i64], ptr @A, i64 0, i64 3), align 8, !tbaa !9
  %108 = load i32, ptr %3, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = load i64, ptr getelementptr inbounds ([5 x i64], ptr getelementptr inbounds ([5 x [5 x i64]], ptr @A, i64 0, i64 1), i64 0, i64 3), align 8, !tbaa !9
  %111 = call noundef i64 @_Z7mod_mulxx(i64 noundef %109, i64 noundef %110)
  %112 = call noundef i64 @_Z7mod_addxx(i64 noundef %107, i64 noundef %111)
  store i64 %112, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %113 = load i32, ptr %4, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = load i64, ptr %15, align 8, !tbaa !9
  %116 = load i64, ptr %8, align 8, !tbaa !9
  %117 = call noundef i64 @_Z7mod_mulxx(i64 noundef %115, i64 noundef %116)
  %118 = call noundef i64 @_Z7mod_mulxx(i64 noundef %114, i64 noundef %117)
  %119 = call noundef i64 @_Z7mod_mulxx(i64 noundef 10, i64 noundef %118)
  %120 = load i64, ptr %14, align 8, !tbaa !9
  %121 = load i64, ptr %9, align 8, !tbaa !9
  %122 = call noundef i64 @_Z7mod_mulxx(i64 noundef %120, i64 noundef %121)
  %123 = call noundef i64 @_Z7mod_mulxx(i64 noundef 10, i64 noundef %122)
  %124 = call noundef i64 @_Z7mod_subxx(i64 noundef %119, i64 noundef %123)
  %125 = load i32, ptr %4, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = load i64, ptr %13, align 8, !tbaa !9
  %128 = load i64, ptr %6, align 8, !tbaa !9
  %129 = call noundef i64 @_Z7mod_mulxx(i64 noundef %127, i64 noundef %128)
  %130 = call noundef i64 @_Z7mod_mulxx(i64 noundef %126, i64 noundef %129)
  %131 = call noundef i64 @_Z7mod_subxx(i64 noundef %124, i64 noundef %130)
  %132 = load i64, ptr %12, align 8, !tbaa !9
  %133 = load i64, ptr %7, align 8, !tbaa !9
  %134 = call noundef i64 @_Z7mod_mulxx(i64 noundef %132, i64 noundef %133)
  %135 = call noundef i64 @_Z7mod_addxx(i64 noundef %131, i64 noundef %134)
  store i64 %135, ptr %17, align 8, !tbaa !9
  %136 = load i64, ptr %17, align 8, !tbaa !9
  %137 = sdiv i64 %136, 9
  %138 = trunc i64 %137 to i32
  %139 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %138)
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 8, 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
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  ret i32 0
}

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

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

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z7mod_addxx(i64 noundef, i64 noundef) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z7mod_mulxx(i64 noundef, i64 noundef) #4

; 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 void @_ZNK6Matrix3powEx(ptr dead_on_unwind noalias writable sret(%struct.Matrix) align 8, ptr noundef nonnull align 8 dereferenceable(200), i64 noundef) #5 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z7mod_subxx(i64 noundef, i64 noundef) #4

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

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

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

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


; 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 { [5 x [5 x i64]] }

@mod = external dso_local global i64, align 8
@buf = external dso_local global [100001 x i8], align 16
@A = external dso_local global %struct.Matrix, align 8
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca %struct.Matrix, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @buf, ptr noundef nonnull %1, ptr noundef nonnull @mod)
  %4 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) @buf) #8
  %5 = trunc i64 %4 to i32
  %6 = load i64, ptr @mod, align 8, !tbaa !5
  %7 = mul nsw i64 %6, 9
  store i64 %7, ptr @mod, align 8, !tbaa !5
  %8 = srem i64 1, %7
  %9 = icmp sgt i32 %5, 0
  br i1 %9, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %0
  %10 = and i64 %4, 2147483647
  br label %.lr.ph

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre = load i64, ptr @mod, align 8
  %.pre62 = srem i64 1, %.pre
  %11 = and i64 %4, 2147483647
  br label %._crit_edge

._crit_edge:                                      ; preds = %0, %._crit_edge.loopexit
  %.pre-phi = phi i64 [ %.pre62, %._crit_edge.loopexit ], [ %8, %0 ]
  %12 = phi i64 [ %.pre, %._crit_edge.loopexit ], [ %7, %0 ]
  %.038.lcssa = phi i64 [ %61, %._crit_edge.loopexit ], [ 0, %0 ]
  %.037.lcssa = phi i64 [ %58, %._crit_edge.loopexit ], [ 0, %0 ]
  %.036.lcssa = phi i64 [ %56, %._crit_edge.loopexit ], [ 0, %0 ]
  %.035.lcssa = phi i64 [ %54, %._crit_edge.loopexit ], [ 0, %0 ]
  %.034.lcssa = phi i64 [ %62, %._crit_edge.loopexit ], [ %8, %0 ]
  %.0.lcssa = phi i64 [ %11, %._crit_edge.loopexit ], [ 0, %0 ]
  %13 = load i32, ptr %1, align 4, !tbaa !9
  %14 = sext i32 %13 to i64
  %15 = srem i64 %14, %12
  %16 = add nsw i64 %15, 1
  %17 = mul nsw i64 %16, %15
  %18 = sdiv i64 %17, 2
  %19 = srem i64 %18, %12
  store i64 %.034.lcssa, ptr getelementptr inbounds (i8, ptr @A, i64 48), align 8, !tbaa !5
  store i64 %.034.lcssa, ptr @A, align 8, !tbaa !5
  %.not = icmp eq i64 %.034.lcssa, 0
  %20 = sub nsw i64 %12, %.034.lcssa
  %21 = select i1 %.not, i64 0, i64 %20
  store i64 %21, ptr getelementptr inbounds (i8, ptr @A, i64 8), align 8, !tbaa !5
  store i64 %.pre-phi, ptr getelementptr inbounds (i8, ptr @A, i64 144), align 8, !tbaa !5
  store i64 %.pre-phi, ptr getelementptr inbounds (i8, ptr @A, i64 96), align 8, !tbaa !5
  store i64 %.pre-phi, ptr getelementptr inbounds (i8, ptr @A, i64 64), align 8, !tbaa !5
  store i64 %.pre-phi, ptr getelementptr inbounds (i8, ptr @A, i64 16), align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %2) #7
  call void @_ZNK6Matrix3powEx(ptr dead_on_unwind nonnull writable sret(%struct.Matrix) align 8 %2, ptr noundef nonnull align 8 dereferenceable(200) @A, i64 noundef %14)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(200) @A, ptr noundef nonnull align 8 dereferenceable(200) %2, i64 200, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %2) #7
  %22 = load i64, ptr getelementptr inbounds (i8, ptr @A, i64 16), align 8, !tbaa !5
  %23 = load i32, ptr %1, align 4, !tbaa !9
  %24 = sext i32 %23 to i64
  %25 = load i64, ptr getelementptr inbounds (i8, ptr @A, i64 56), align 8, !tbaa !5
  %26 = call noundef i64 @_Z7mod_mulxx(i64 noundef %24, i64 noundef %25)
  %27 = call noundef i64 @_Z7mod_addxx(i64 noundef %22, i64 noundef %26)
  %28 = load i64, ptr getelementptr inbounds (i8, ptr @A, i64 24), align 8, !tbaa !5
  %29 = load i32, ptr %1, align 4, !tbaa !9
  %30 = sext i32 %29 to i64
  %31 = load i64, ptr getelementptr inbounds (i8, ptr @A, i64 64), align 8, !tbaa !5
  %32 = call noundef i64 @_Z7mod_mulxx(i64 noundef %30, i64 noundef %31)
  %33 = call noundef i64 @_Z7mod_addxx(i64 noundef %28, i64 noundef %32)
  %34 = call noundef i64 @_Z7mod_mulxx(i64 noundef %33, i64 noundef %.037.lcssa)
  %35 = call noundef i64 @_Z7mod_mulxx(i64 noundef %.0.lcssa, i64 noundef %34)
  %36 = call noundef i64 @_Z7mod_mulxx(i64 noundef 10, i64 noundef %35)
  %37 = call noundef i64 @_Z7mod_mulxx(i64 noundef %27, i64 noundef %.038.lcssa)
  %38 = call noundef i64 @_Z7mod_mulxx(i64 noundef 10, i64 noundef %37)
  %39 = call noundef i64 @_Z7mod_subxx(i64 noundef %36, i64 noundef %38)
  %40 = call noundef i64 @_Z7mod_mulxx(i64 noundef %19, i64 noundef %.035.lcssa)
  %41 = call noundef i64 @_Z7mod_mulxx(i64 noundef %.0.lcssa, i64 noundef %40)
  %42 = call noundef i64 @_Z7mod_subxx(i64 noundef %39, i64 noundef %41)
  %43 = call noundef i64 @_Z7mod_mulxx(i64 noundef %15, i64 noundef %.036.lcssa)
  %44 = call noundef i64 @_Z7mod_addxx(i64 noundef %42, i64 noundef %43)
  %45 = sdiv i64 %44, 9
  %46 = trunc i64 %45 to i32
  %47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %46)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret i32 0

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv57 = phi i64 [ %10, %.lr.ph.preheader ], [ %indvars.iv.next58, %.lr.ph ]
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %.03445 = phi i64 [ %8, %.lr.ph.preheader ], [ %62, %.lr.ph ]
  %.03544 = phi i64 [ 0, %.lr.ph.preheader ], [ %54, %.lr.ph ]
  %.03643 = phi i64 [ 0, %.lr.ph.preheader ], [ %56, %.lr.ph ]
  %.03742 = phi i64 [ 0, %.lr.ph.preheader ], [ %58, %.lr.ph ]
  %.03841 = phi i64 [ 0, %.lr.ph.preheader ], [ %61, %.lr.ph ]
  %indvars.iv.next58 = add nsw i64 %indvars.iv57, -1
  %48 = getelementptr inbounds [100001 x i8], ptr @buf, i64 0, i64 %indvars.iv.next58
  %49 = load i8, ptr %48, align 1, !tbaa !12
  %50 = sext i8 %49 to i64
  %51 = add nsw i64 %50, -48
  %52 = load i64, ptr @mod, align 8, !tbaa !5
  %53 = srem i64 %51, %52
  %54 = call noundef i64 @_Z7mod_addxx(i64 noundef %.03544, i64 noundef %53)
  %55 = call noundef i64 @_Z7mod_mulxx(i64 noundef %indvars.iv, i64 noundef %53)
  %56 = call noundef i64 @_Z7mod_addxx(i64 noundef %.03643, i64 noundef %55)
  %57 = call noundef i64 @_Z7mod_mulxx(i64 noundef %.03445, i64 noundef %53)
  %58 = call noundef i64 @_Z7mod_addxx(i64 noundef %.03742, i64 noundef %57)
  %59 = call noundef i64 @_Z7mod_mulxx(i64 noundef %.03445, i64 noundef %53)
  %60 = call noundef i64 @_Z7mod_mulxx(i64 noundef %indvars.iv, i64 noundef %59)
  %61 = call noundef i64 @_Z7mod_addxx(i64 noundef %.03841, i64 noundef %60)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %62 = call noundef i64 @_Z7mod_mulxx(i64 noundef %.03445, i64 noundef 10)
  %exitcond.not = icmp eq i64 %indvars.iv.next, %10
  br i1 %exitcond.not, label %._crit_edge.loopexit, label %.lr.ph, !llvm.loop !13
}

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z7mod_addxx(i64 noundef, i64 noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z7mod_mulxx(i64 noundef, i64 noundef) local_unnamed_addr #4

; 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 void @_ZNK6Matrix3powEx(ptr dead_on_unwind noalias writable sret(%struct.Matrix) align 8, ptr noundef nonnull align 8 dereferenceable(200), i64 noundef) local_unnamed_addr #5 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z7mod_subxx(i64 noundef, i64 noundef) local_unnamed_addr #4

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 = { 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 #5 = { 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }

!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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{i64 0, i64 200, !12}
!12 = !{!7, !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


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