; LLVM IR from ahr9n/psolving-paradigms :: 4.dynamic-programming/15.dp-speed-up-with-matrix-power (Gym 102875G - Grid Coloring)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%struct.Matrix = type <{ [15 x [15 x i64]], i32, [4 x i8] }>

@mod = external dso_local global i64, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6MatrixC2Ei(ptr noundef nonnull align 8 dereferenceable(1804), i32 noundef) unnamed_addr #0 align 2

; 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 void @_Z5power6Matrixxi(ptr dead_on_unwind noalias writable sret(%struct.Matrix) align 8, ptr noundef byval(%struct.Matrix) align 8, i64 noundef, i32 noundef) #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) #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z3fibxxx(i64 noundef, i64 noundef, i64 noundef) #2

; 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 i64, align 8
  %6 = alloca %struct.Matrix, align 8
  %7 = alloca %struct.Matrix, align 8
  %8 = alloca %struct.Matrix, align 8
  %9 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %10 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %11 = getelementptr i8, ptr %10, i64 -24
  %12 = load i64, ptr %11, align 8
  %13 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %12
  %14 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %13, ptr noundef null)
  %15 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  br label %17

17:                                               ; preds = %143, %0
  %18 = load i32, ptr %2, align 4, !tbaa !8
  %19 = add nsw i32 %18, -1
  store i32 %19, ptr %2, align 4, !tbaa !8
  %20 = icmp ne i32 %18, 0
  br i1 %20, label %21, label %144

21:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  %22 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %22, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %24 = load i32, ptr %3, align 4, !tbaa !8
  %25 = load i32, ptr %4, align 4, !tbaa !8
  %26 = icmp sgt i32 %24, %25
  br i1 %26, label %27, label %28

27:                                               ; preds = %21
  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) %3, ptr noundef nonnull align 4 dereferenceable(4) %4) #8
  br label %28

28:                                               ; preds = %27, %21
  %29 = load i32, ptr %3, align 4, !tbaa !8
  %30 = icmp eq i32 %29, 1
  br i1 %30, label %31, label %37

31:                                               ; preds = %28
  %32 = load i32, ptr %4, align 4, !tbaa !8
  %33 = sext i32 %32 to i64
  %34 = call noundef i64 @_Z3fibxxx(i64 noundef 2, i64 noundef 4, i64 noundef %33)
  %35 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %34)
  %36 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %35, ptr noundef @.str)
  br label %143

37:                                               ; preds = %28
  %38 = load i32, ptr %3, align 4, !tbaa !8
  %39 = icmp eq i32 %38, 2
  br i1 %39, label %40, label %52

40:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #8
  %41 = load i32, ptr %4, align 4, !tbaa !8
  %42 = sext i32 %41 to i64
  %43 = call noundef i64 @_Z3fibxxx(i64 noundef 2, i64 noundef 4, i64 noundef %42)
  store i64 %43, ptr %5, align 8, !tbaa !11
  %44 = load i64, ptr %5, align 8, !tbaa !11
  %45 = load i64, ptr %5, align 8, !tbaa !11
  %46 = mul nsw i64 %44, %45
  %47 = load i64, ptr @mod, align 8, !tbaa !11
  %48 = srem i64 %46, %47
  store i64 %48, ptr %5, align 8, !tbaa !11
  %49 = load i64, ptr %5, align 8, !tbaa !11
  %50 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %49)
  %51 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %50, ptr noundef @.str)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  br label %142

52:                                               ; preds = %37
  %53 = load i32, ptr %3, align 4, !tbaa !8
  %54 = icmp eq i32 %53, 3
  br i1 %54, label %55, label %127

55:                                               ; preds = %52
  %56 = load i32, ptr %4, align 4, !tbaa !8
  %57 = icmp eq i32 %56, 3
  br i1 %57, label %58, label %60

58:                                               ; preds = %55
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.1)
  br label %126

60:                                               ; preds = %55
  %61 = load i32, ptr %4, align 4, !tbaa !8
  %62 = sub nsw i32 %61, 3
  store i32 %62, ptr %4, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 1808, ptr %6) #8
  call void @_ZN6MatrixC2Ei(ptr noundef nonnull align 8 dereferenceable(1804) %6, i32 noundef 3)
  %63 = getelementptr inbounds %struct.Matrix, ptr %6, i32 0, i32 0
  %64 = getelementptr inbounds [15 x [15 x i64]], ptr %63, i64 0, i64 0
  %65 = getelementptr inbounds [15 x i64], ptr %64, i64 0, i64 0
  store i64 0, ptr %65, align 8, !tbaa !11
  %66 = getelementptr inbounds %struct.Matrix, ptr %6, i32 0, i32 0
  %67 = getelementptr inbounds [15 x [15 x i64]], ptr %66, i64 0, i64 0
  %68 = getelementptr inbounds [15 x i64], ptr %67, i64 0, i64 1
  store i64 1, ptr %68, align 8, !tbaa !11
  %69 = getelementptr inbounds %struct.Matrix, ptr %6, i32 0, i32 0
  %70 = getelementptr inbounds [15 x [15 x i64]], ptr %69, i64 0, i64 0
  %71 = getelementptr inbounds [15 x i64], ptr %70, i64 0, i64 2
  store i64 0, ptr %71, align 8, !tbaa !11
  %72 = getelementptr inbounds %struct.Matrix, ptr %6, i32 0, i32 0
  %73 = getelementptr inbounds [15 x [15 x i64]], ptr %72, i64 0, i64 1
  %74 = getelementptr inbounds [15 x i64], ptr %73, i64 0, i64 0
  store i64 1, ptr %74, align 8, !tbaa !11
  %75 = getelementptr inbounds %struct.Matrix, ptr %6, i32 0, i32 0
  %76 = getelementptr inbounds [15 x [15 x i64]], ptr %75, i64 0, i64 1
  %77 = getelementptr inbounds [15 x i64], ptr %76, i64 0, i64 1
  store i64 1, ptr %77, align 8, !tbaa !11
  %78 = getelementptr inbounds %struct.Matrix, ptr %6, i32 0, i32 0
  %79 = getelementptr inbounds [15 x [15 x i64]], ptr %78, i64 0, i64 1
  %80 = getelementptr inbounds [15 x i64], ptr %79, i64 0, i64 2
  store i64 -1, ptr %80, align 8, !tbaa !11
  %81 = getelementptr inbounds %struct.Matrix, ptr %6, i32 0, i32 0
  %82 = getelementptr inbounds [15 x [15 x i64]], ptr %81, i64 0, i64 2
  %83 = getelementptr inbounds [15 x i64], ptr %82, i64 0, i64 0
  store i64 0, ptr %83, align 8, !tbaa !11
  %84 = getelementptr inbounds %struct.Matrix, ptr %6, i32 0, i32 0
  %85 = getelementptr inbounds [15 x [15 x i64]], ptr %84, i64 0, i64 2
  %86 = getelementptr inbounds [15 x i64], ptr %85, i64 0, i64 1
  store i64 0, ptr %86, align 8, !tbaa !11
  %87 = getelementptr inbounds %struct.Matrix, ptr %6, i32 0, i32 0
  %88 = getelementptr inbounds [15 x [15 x i64]], ptr %87, i64 0, i64 2
  %89 = getelementptr inbounds [15 x i64], ptr %88, i64 0, i64 2
  store i64 1, ptr %89, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1808, ptr %7) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %8, ptr align 8 %6, i64 1808, i1 false), !tbaa.struct !13
  %90 = load i32, ptr %4, align 4, !tbaa !8
  %91 = sub nsw i32 %90, 1
  %92 = sext i32 %91 to i64
  call void @_Z5power6Matrixxi(ptr dead_on_unwind writable sret(%struct.Matrix) align 8 %7, ptr noundef byval(%struct.Matrix) align 8 %8, i64 noundef %92, i32 noundef 3)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %6, ptr align 8 %7, i64 1804, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 1808, ptr %7) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  %93 = getelementptr inbounds %struct.Matrix, ptr %6, i32 0, i32 0
  %94 = getelementptr inbounds [15 x [15 x i64]], ptr %93, i64 0, i64 0
  %95 = getelementptr inbounds [15 x i64], ptr %94, i64 0, i64 0
  %96 = load i64, ptr %95, align 8, !tbaa !11
  %97 = mul nsw i64 %96, 44
  %98 = load i64, ptr @mod, align 8, !tbaa !11
  %99 = srem i64 %97, %98
  %100 = getelementptr inbounds %struct.Matrix, ptr %6, i32 0, i32 0
  %101 = getelementptr inbounds [15 x [15 x i64]], ptr %100, i64 0, i64 0
  %102 = getelementptr inbounds [15 x i64], ptr %101, i64 0, i64 1
  %103 = load i64, ptr %102, align 8, !tbaa !11
  %104 = mul nsw i64 %103, 64
  %105 = load i64, ptr @mod, align 8, !tbaa !11
  %106 = srem i64 %104, %105
  %107 = add nsw i64 %99, %106
  %108 = getelementptr inbounds %struct.Matrix, ptr %6, i32 0, i32 0
  %109 = getelementptr inbounds [15 x [15 x i64]], ptr %108, i64 0, i64 0
  %110 = getelementptr inbounds [15 x i64], ptr %109, i64 0, i64 2
  %111 = load i64, ptr %110, align 8, !tbaa !11
  %112 = mul nsw i64 %111, 4
  %113 = load i64, ptr @mod, align 8, !tbaa !11
  %114 = srem i64 %112, %113
  %115 = add nsw i64 %107, %114
  store i64 %115, ptr %9, align 8, !tbaa !11
  %116 = load i64, ptr %9, align 8, !tbaa !11
  %117 = load i64, ptr @mod, align 8, !tbaa !11
  %118 = srem i64 %116, %117
  %119 = load i64, ptr @mod, align 8, !tbaa !11
  %120 = add nsw i64 %118, %119
  %121 = load i64, ptr @mod, align 8, !tbaa !11
  %122 = srem i64 %120, %121
  store i64 %122, ptr %9, align 8, !tbaa !11
  %123 = load i64, ptr %9, align 8, !tbaa !11
  %124 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %123)
  %125 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %124, ptr noundef @.str)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 1808, ptr %6) #8
  br label %126

126:                                              ; preds = %60, %58
  br label %141

127:                                              ; preds = %52
  %128 = load i32, ptr %3, align 4, !tbaa !8
  %129 = icmp eq i32 %128, 4
  br i1 %129, label %130, label %138

130:                                              ; preds = %127
  %131 = load i32, ptr %4, align 4, !tbaa !8
  %132 = icmp eq i32 %131, 4
  br i1 %132, label %133, label %135

133:                                              ; preds = %130
  %134 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.2)
  br label %137

135:                                              ; preds = %130
  %136 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.3)
  br label %137

137:                                              ; preds = %135, %133
  br label %140

138:                                              ; preds = %127
  %139 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.4)
  br label %140

140:                                              ; preds = %138, %137
  br label %141

141:                                              ; preds = %140, %126
  br label %142

142:                                              ; preds = %141, %40
  br label %143

143:                                              ; preds = %142, %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  br label %17, !llvm.loop !15

144:                                              ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  %145 = load i32, ptr %1, align 4
  ret i32 %145
}

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #7

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { 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 #7 = { 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 #8 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !10, i64 0}
!13 = !{i64 0, i64 1800, !14, i64 1800, i64 4, !8}
!14 = !{!10, !10, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%struct.Matrix = type <{ [15 x [15 x i64]], i32, [4 x i8] }>

@mod = external dso_local local_unnamed_addr global i64, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6MatrixC2Ei(ptr noundef nonnull align 8 dereferenceable(1804), i32 noundef) unnamed_addr #0 align 2

; 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 void @_Z5power6Matrixxi(ptr dead_on_unwind noalias writable sret(%struct.Matrix) align 8, ptr noundef byval(%struct.Matrix) align 8, i64 noundef, i32 noundef) local_unnamed_addr #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) #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z3fibxxx(i64 noundef, i64 noundef, i64 noundef) local_unnamed_addr #2

; 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 i32, align 4
  %4 = alloca %struct.Matrix, align 8
  %5 = alloca %struct.Matrix, align 8
  %6 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %7 = getelementptr i8, ptr %6, i64 -24
  %8 = load i64, ptr %7, align 8
  %9 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %8
  %10 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %9, ptr noundef null)
  %11 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #9
  %12 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %13 = load i32, ptr %1, align 4, !tbaa !8
  %14 = add nsw i32 %13, -1
  store i32 %14, ptr %1, align 4, !tbaa !8
  %.not7 = icmp eq i32 %13, 0
  br i1 %.not7, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %0
  %15 = getelementptr inbounds i8, ptr %4, i64 8
  %16 = getelementptr inbounds i8, ptr %4, i64 16
  %17 = getelementptr inbounds i8, ptr %4, i64 120
  %18 = getelementptr inbounds i8, ptr %4, i64 128
  %19 = getelementptr inbounds i8, ptr %4, i64 136
  %20 = getelementptr inbounds i8, ptr %4, i64 240
  %21 = getelementptr inbounds i8, ptr %4, i64 256
  br label %22

22:                                               ; preds = %.lr.ph, %82
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #9
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %25 = load i32, ptr %2, align 4, !tbaa !8
  %26 = load i32, ptr %3, align 4, !tbaa !8
  %27 = icmp sgt i32 %25, %26
  br i1 %27, label %28, label %29

28:                                               ; preds = %22
  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) %2, ptr noundef nonnull align 4 dereferenceable(4) %3) #9
  %.pr = load i32, ptr %2, align 4, !tbaa !8
  br label %29

29:                                               ; preds = %28, %22
  %30 = phi i32 [ %.pr, %28 ], [ %25, %22 ]
  switch i32 %30, label %80 [
    i32 1, label %31
    i32 2, label %37
    i32 3, label %46
    i32 4, label %73
  ]

31:                                               ; preds = %29
  %32 = load i32, ptr %3, align 4, !tbaa !8
  %33 = sext i32 %32 to i64
  %34 = call noundef i64 @_Z3fibxxx(i64 noundef 2, i64 noundef 4, i64 noundef %33)
  %35 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %34)
  %36 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %35, ptr noundef nonnull @.str)
  br label %82

37:                                               ; preds = %29
  %38 = load i32, ptr %3, align 4, !tbaa !8
  %39 = sext i32 %38 to i64
  %40 = call noundef i64 @_Z3fibxxx(i64 noundef 2, i64 noundef 4, i64 noundef %39)
  %41 = mul nsw i64 %40, %40
  %42 = load i64, ptr @mod, align 8, !tbaa !11
  %43 = srem i64 %41, %42
  %44 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %43)
  %45 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %44, ptr noundef nonnull @.str)
  br label %82

46:                                               ; preds = %29
  %47 = load i32, ptr %3, align 4, !tbaa !8
  %48 = icmp eq i32 %47, 3
  br i1 %48, label %49, label %51

49:                                               ; preds = %46
  %50 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.1)
  br label %82

51:                                               ; preds = %46
  %52 = add nsw i32 %47, -3
  store i32 %52, ptr %3, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 1808, ptr nonnull %4) #9
  call void @_ZN6MatrixC2Ei(ptr noundef nonnull align 8 dereferenceable(1804) %4, i32 noundef 3)
  store i64 0, ptr %4, align 8, !tbaa !11
  store i64 1, ptr %15, align 8, !tbaa !11
  store i64 0, ptr %16, align 8, !tbaa !11
  store i64 1, ptr %17, align 8, !tbaa !11
  store i64 1, ptr %18, align 8, !tbaa !11
  store i64 -1, ptr %19, align 8, !tbaa !11
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %20, i8 0, i64 16, i1 false)
  store i64 1, ptr %21, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1808, ptr nonnull %5) #9
  %53 = load i32, ptr %3, align 4, !tbaa !8
  %54 = add nsw i32 %53, -1
  %55 = sext i32 %54 to i64
  call void @_Z5power6Matrixxi(ptr dead_on_unwind nonnull writable sret(%struct.Matrix) align 8 %5, ptr noundef nonnull byval(%struct.Matrix) align 8 %4, i64 noundef %55, i32 noundef 3)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(1804) %4, ptr noundef nonnull align 8 dereferenceable(1804) %5, i64 1804, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 1808, ptr nonnull %5) #9
  %56 = load i64, ptr %4, align 8, !tbaa !11
  %57 = mul nsw i64 %56, 44
  %58 = load i64, ptr @mod, align 8, !tbaa !11
  %59 = srem i64 %57, %58
  %60 = load i64, ptr %15, align 8, !tbaa !11
  %61 = shl nsw i64 %60, 6
  %62 = srem i64 %61, %58
  %63 = add nsw i64 %62, %59
  %64 = load i64, ptr %16, align 8, !tbaa !11
  %65 = shl nsw i64 %64, 2
  %66 = srem i64 %65, %58
  %67 = add nsw i64 %63, %66
  %68 = srem i64 %67, %58
  %69 = add nsw i64 %68, %58
  %70 = srem i64 %69, %58
  %71 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %70)
  %72 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %71, ptr noundef nonnull @.str)
  call void @llvm.lifetime.end.p0(i64 1808, ptr nonnull %4) #9
  br label %82

73:                                               ; preds = %29
  %74 = load i32, ptr %3, align 4, !tbaa !8
  %75 = icmp eq i32 %74, 4
  br i1 %75, label %76, label %78

76:                                               ; preds = %73
  %77 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.2)
  br label %82

78:                                               ; preds = %73
  %79 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.3)
  br label %82

80:                                               ; preds = %29
  %81 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.4)
  br label %82

82:                                               ; preds = %37, %80, %78, %76, %49, %51, %31
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #9
  %83 = load i32, ptr %1, align 4, !tbaa !8
  %84 = add nsw i32 %83, -1
  store i32 %84, ptr %1, align 4, !tbaa !8
  %.not = icmp eq i32 %83, 0
  br i1 %.not, label %._crit_edge, label %22, !llvm.loop !15

._crit_edge:                                      ; preds = %82, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #9
  ret i32 0
}

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #7

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

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { "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 = { 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 #7 = { 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 #8 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #9 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !10, i64 0}
!13 = !{i64 0, i64 1800, !14, i64 1800, i64 4, !8}
!14 = !{!10, !10, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


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