; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/Educational 14/Problem E (E)

; 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_ostream" = type { ptr, %"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_istream" = type { ptr, i64, %"class.std::basic_ios" }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@m = external dso_local global [110 x [110 x i64]], align 16
@n = external dso_local global i64, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [23 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [111 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #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 void @_Z4fastx(i64 noundef) #3

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #4 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca [110 x i64], align 16
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %12 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %13 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %14 = getelementptr i8, ptr %13, i64 -24
  %15 = load i64, ptr %14, align 8
  %16 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %15
  %17 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %16, ptr noundef null)
  %18 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %19 = getelementptr i8, ptr %18, i64 -24
  %20 = load i64, ptr %19, align 8
  %21 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %20
  %22 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %21, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #8
  call void @llvm.lifetime.start.p0(i64 880, ptr %3) #8
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @n)
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %25 = load i64, ptr @n, align 8, !tbaa !8
  %26 = icmp eq i64 %25, 1
  br i1 %26, label %27, label %30

27:                                               ; preds = %0
  %28 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef 1)
  %29 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %28, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  br label %150

30:                                               ; preds = %0
  %31 = load i64, ptr %2, align 8, !tbaa !8
  %32 = icmp eq i64 %31, 1
  br i1 %32, label %33, label %37

33:                                               ; preds = %30
  %34 = load i64, ptr @n, align 8, !tbaa !8
  %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 @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %35, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  br label %150

37:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  store i32 1, ptr %5, align 4, !tbaa !11
  br label %38

38:                                               ; preds = %49, %37
  %39 = load i32, ptr %5, align 4, !tbaa !11
  %40 = sext i32 %39 to i64
  %41 = load i64, ptr @n, align 8, !tbaa !8
  %42 = icmp sle i64 %40, %41
  br i1 %42, label %44, label %43

43:                                               ; preds = %38
  store i32 2, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  br label %52

44:                                               ; preds = %38
  %45 = load i32, ptr %5, align 4, !tbaa !11
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [110 x i64], ptr %3, i64 0, i64 %46
  %48 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %47)
  br label %49

49:                                               ; preds = %44
  %50 = load i32, ptr %5, align 4, !tbaa !11
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %5, align 4, !tbaa !11
  br label %38, !llvm.loop !13

52:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  store i32 1, ptr %6, align 4, !tbaa !11
  br label %53

53:                                               ; preds = %93, %52
  %54 = load i32, ptr %6, align 4, !tbaa !11
  %55 = sext i32 %54 to i64
  %56 = load i64, ptr @n, align 8, !tbaa !8
  %57 = icmp sle i64 %55, %56
  br i1 %57, label %59, label %58

58:                                               ; preds = %53
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  br label %96

59:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  store i32 1, ptr %7, align 4, !tbaa !11
  br label %60

60:                                               ; preds = %89, %59
  %61 = load i32, ptr %7, align 4, !tbaa !11
  %62 = sext i32 %61 to i64
  %63 = load i64, ptr @n, align 8, !tbaa !8
  %64 = icmp sle i64 %62, %63
  br i1 %64, label %66, label %65

65:                                               ; preds = %60
  store i32 8, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  br label %92

66:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  %67 = load i32, ptr %6, align 4, !tbaa !11
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [110 x i64], ptr %3, i64 0, i64 %68
  %70 = load i64, ptr %69, align 8, !tbaa !8
  %71 = load i32, ptr %7, align 4, !tbaa !11
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [110 x i64], ptr %3, i64 0, i64 %72
  %74 = load i64, ptr %73, align 8, !tbaa !8
  %75 = xor i64 %70, %74
  store i64 %75, ptr %8, align 8, !tbaa !8
  %76 = load i64, ptr %8, align 8, !tbaa !8
  %77 = call i64 @llvm.ctpop.i64(i64 %76)
  %78 = trunc i64 %77 to i32
  %79 = srem i32 %78, 3
  %80 = icmp eq i32 %79, 0
  br i1 %80, label %81, label %88

81:                                               ; preds = %66
  %82 = load i32, ptr %6, align 4, !tbaa !11
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [110 x [110 x i64]], ptr @m, i64 0, i64 %83
  %85 = load i32, ptr %7, align 4, !tbaa !11
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [110 x i64], ptr %84, i64 0, i64 %86
  store i64 1, ptr %87, align 8, !tbaa !8
  br label %88

88:                                               ; preds = %81, %66
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  br label %89

89:                                               ; preds = %88
  %90 = load i32, ptr %7, align 4, !tbaa !11
  %91 = add nsw i32 %90, 1
  store i32 %91, ptr %7, align 4, !tbaa !11
  br label %60, !llvm.loop !15

92:                                               ; preds = %65
  br label %93

93:                                               ; preds = %92
  %94 = load i32, ptr %6, align 4, !tbaa !11
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %6, align 4, !tbaa !11
  br label %53, !llvm.loop !16

96:                                               ; preds = %58
  %97 = load i64, ptr %2, align 8, !tbaa !8
  %98 = sub nsw i64 %97, 1
  call void @_Z4fastx(i64 noundef %98)
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  store i64 0, ptr %9, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  store i32 1, ptr %10, align 4, !tbaa !11
  br label %99

99:                                               ; preds = %132, %96
  %100 = load i32, ptr %10, align 4, !tbaa !11
  %101 = sext i32 %100 to i64
  %102 = load i64, ptr @n, align 8, !tbaa !8
  %103 = icmp sle i64 %101, %102
  br i1 %103, label %105, label %104

104:                                              ; preds = %99
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  br label %135

105:                                              ; preds = %99
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  store i32 1, ptr %11, align 4, !tbaa !11
  br label %106

106:                                              ; preds = %128, %105
  %107 = load i32, ptr %11, align 4, !tbaa !11
  %108 = sext i32 %107 to i64
  %109 = load i64, ptr @n, align 8, !tbaa !8
  %110 = icmp sle i64 %108, %109
  br i1 %110, label %112, label %111

111:                                              ; preds = %106
  store i32 14, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  br label %131

112:                                              ; preds = %106
  %113 = load i32, ptr %10, align 4, !tbaa !11
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [110 x [110 x i64]], ptr @m, i64 0, i64 %114
  %116 = load i32, ptr %11, align 4, !tbaa !11
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [110 x i64], ptr %115, i64 0, i64 %117
  %119 = load i64, ptr %118, align 8, !tbaa !8
  %120 = load i64, ptr %9, align 8, !tbaa !8
  %121 = add nsw i64 %120, %119
  store i64 %121, ptr %9, align 8, !tbaa !8
  %122 = load i64, ptr %9, align 8, !tbaa !8
  %123 = icmp sge i64 %122, 1000000007
  br i1 %123, label %124, label %127

124:                                              ; preds = %112
  %125 = load i64, ptr %9, align 8, !tbaa !8
  %126 = sub nsw i64 %125, 1000000007
  store i64 %126, ptr %9, align 8, !tbaa !8
  br label %127

127:                                              ; preds = %124, %112
  br label %128

128:                                              ; preds = %127
  %129 = load i32, ptr %11, align 4, !tbaa !11
  %130 = add nsw i32 %129, 1
  store i32 %130, ptr %11, align 4, !tbaa !11
  br label %106, !llvm.loop !17

131:                                              ; preds = %111
  br label %132

132:                                              ; preds = %131
  %133 = load i32, ptr %10, align 4, !tbaa !11
  %134 = add nsw i32 %133, 1
  store i32 %134, ptr %10, align 4, !tbaa !11
  br label %99, !llvm.loop !18

135:                                              ; preds = %104
  %136 = load i64, ptr %9, align 8, !tbaa !8
  %137 = icmp sge i64 %136, 0
  br i1 %137, label %138, label %141

138:                                              ; preds = %135
  %139 = load i64, ptr %9, align 8, !tbaa !8
  %140 = icmp slt i64 %139, 1000000007
  br label %141

141:                                              ; preds = %138, %135
  %142 = phi i1 [ false, %135 ], [ %140, %138 ]
  br i1 %142, label %143, label %144

143:                                              ; preds = %141
  br label %146

144:                                              ; preds = %141
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 107, ptr noundef @__PRETTY_FUNCTION__.main) #9
  unreachable

145:                                              ; No predecessors!
  br label %146

146:                                              ; preds = %145, %143
  %147 = load i64, ptr %9, align 8, !tbaa !8
  %148 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %147)
  %149 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %148, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  br label %150

150:                                              ; preds = %146, %33, %27
  call void @llvm.lifetime.end.p0(i64 880, ptr %3) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #8
  %151 = load i32, ptr %1, align 4
  ret i32 %151
}

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

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #5

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.ctpop.i64(i64) #6

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #7

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 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { noreturn 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 #8 = { nounwind }
attributes #9 = { noreturn 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 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}


; 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_ostream" = type { ptr, %"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_istream" = type { ptr, i64, %"class.std::basic_ios" }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@m = external dso_local local_unnamed_addr global [110 x [110 x i64]], align 16
@n = external dso_local global i64, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [23 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [111 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #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 void @_Z4fastx(i64 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 {
  %1 = alloca i64, align 8
  %2 = alloca [110 x i64], align 16
  %3 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %4 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %5 = getelementptr i8, ptr %4, i64 -24
  %6 = load i64, ptr %5, align 8
  %7 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %6
  %8 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %7, ptr noundef null)
  %9 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %10 = getelementptr i8, ptr %9, i64 -24
  %11 = load i64, ptr %10, align 8
  %12 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %11
  %13 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %12, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #9
  call void @llvm.lifetime.start.p0(i64 880, ptr nonnull %2) #9
  %14 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @n)
  %15 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %16 = load i64, ptr @n, align 8, !tbaa !8
  %17 = icmp eq i64 %16, 1
  br i1 %17, label %18, label %20

18:                                               ; preds = %0
  %19 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef 1)
  br label %73

20:                                               ; preds = %0
  %21 = load i64, ptr %1, align 8, !tbaa !8
  %22 = icmp eq i64 %21, 1
  br i1 %22, label %23, label %.preheader45

.preheader45:                                     ; preds = %20
  %.not46 = icmp slt i64 %16, 1
  br i1 %.not46, label %._crit_edge53, label %.lr.ph

23:                                               ; preds = %20
  %24 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %16)
  br label %73

.preheader44:                                     ; preds = %.lr.ph
  %.not3951 = icmp slt i64 %27, 1
  br i1 %.not3951, label %._crit_edge53, label %.preheader43.preheader

.preheader43.preheader:                           ; preds = %.preheader44
  %min.iters.check = icmp eq i64 %27, 1
  %n.vec = and i64 %27, 9223372036854775806
  %ind.end = or i64 %27, 1
  %cmp.n = icmp eq i64 %27, %n.vec
  br label %.preheader43

.lr.ph:                                           ; preds = %.preheader45, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.preheader45 ]
  %25 = getelementptr inbounds [110 x i64], ptr %2, i64 0, i64 %indvars.iv
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %25)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %27 = load i64, ptr @n, align 8, !tbaa !8
  %.not.not = icmp sgt i64 %27, %indvars.iv
  br i1 %.not.not, label %.lr.ph, label %.preheader44, !llvm.loop !11

.preheader43:                                     ; preds = %.preheader43.preheader, %._crit_edge
  %indvars.iv70 = phi i64 [ %indvars.iv.next71, %._crit_edge ], [ 1, %.preheader43.preheader ]
  %28 = getelementptr inbounds [110 x i64], ptr %2, i64 0, i64 %indvars.iv70
  %29 = load i64, ptr %28, align 8, !tbaa !8
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %.preheader43
  %indvars.iv67.ph = phi i64 [ 1, %.preheader43 ], [ %ind.end, %middle.block ]
  br label %scalar.ph

vector.ph:                                        ; preds = %.preheader43
  %broadcast.splatinsert = insertelement <2 x i64> poison, i64 %29, i64 0
  %broadcast.splat = shufflevector <2 x i64> %broadcast.splatinsert, <2 x i64> poison, <2 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %pred.store.continue87, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %pred.store.continue87 ]
  %offset.idx = or disjoint i64 %index, 1
  %30 = getelementptr inbounds [110 x i64], ptr %2, i64 0, i64 %offset.idx
  %wide.load = load <2 x i64>, ptr %30, align 8, !tbaa !8
  %31 = xor <2 x i64> %wide.load, %broadcast.splat
  %32 = call range(i64 0, 65) <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %31)
  %33 = trunc nuw nsw <2 x i64> %32 to <2 x i8>
  %34 = urem <2 x i8> %33, <i8 3, i8 3>
  %35 = icmp eq <2 x i8> %34, zeroinitializer
  %36 = extractelement <2 x i1> %35, i64 0
  br i1 %36, label %pred.store.if, label %pred.store.continue

pred.store.if:                                    ; preds = %vector.body
  %37 = getelementptr inbounds [110 x [110 x i64]], ptr @m, i64 0, i64 %indvars.iv70, i64 %offset.idx
  store i64 1, ptr %37, align 8, !tbaa !8
  br label %pred.store.continue

pred.store.continue:                              ; preds = %pred.store.if, %vector.body
  %38 = extractelement <2 x i1> %35, i64 1
  br i1 %38, label %pred.store.if86, label %pred.store.continue87

pred.store.if86:                                  ; preds = %pred.store.continue
  %39 = add i64 %index, 2
  %40 = getelementptr inbounds [110 x [110 x i64]], ptr @m, i64 0, i64 %indvars.iv70, i64 %39
  store i64 1, ptr %40, align 16, !tbaa !8
  br label %pred.store.continue87

pred.store.continue87:                            ; preds = %pred.store.if86, %pred.store.continue
  %index.next = add nuw i64 %index, 2
  %41 = icmp eq i64 %index.next, %n.vec
  br i1 %41, label %middle.block, label %vector.body, !llvm.loop !13

middle.block:                                     ; preds = %pred.store.continue87
  br i1 %cmp.n, label %._crit_edge, label %scalar.ph.preheader

._crit_edge53:                                    ; preds = %._crit_edge, %.preheader45, %.preheader44
  %42 = load i64, ptr %1, align 8, !tbaa !8
  %43 = add nsw i64 %42, -1
  call void @_Z4fastx(i64 noundef %43)
  %44 = load i64, ptr @n, align 8, !tbaa !8
  %.not4060 = icmp slt i64 %44, 1
  br i1 %.not4060, label %._crit_edge63.thread, label %.preheader.preheader

.preheader.preheader:                             ; preds = %._crit_edge53
  %xtraiter = and i64 %44, 1
  %45 = icmp eq i64 %44, 1
  %unroll_iter = and i64 %44, 9223372036854775806
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader

._crit_edge:                                      ; preds = %54, %middle.block
  %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
  %exitcond73 = icmp eq i64 %indvars.iv70, %27
  br i1 %exitcond73, label %._crit_edge53, label %.preheader43, !llvm.loop !16

scalar.ph:                                        ; preds = %scalar.ph.preheader, %54
  %indvars.iv67 = phi i64 [ %indvars.iv.next68, %54 ], [ %indvars.iv67.ph, %scalar.ph.preheader ]
  %46 = getelementptr inbounds [110 x i64], ptr %2, i64 0, i64 %indvars.iv67
  %47 = load i64, ptr %46, align 8, !tbaa !8
  %48 = xor i64 %47, %29
  %49 = call range(i64 0, 65) i64 @llvm.ctpop.i64(i64 %48)
  %.lhs.trunc = trunc nuw nsw i64 %49 to i8
  %50 = urem i8 %.lhs.trunc, 3
  %51 = icmp eq i8 %50, 0
  br i1 %51, label %52, label %54

52:                                               ; preds = %scalar.ph
  %53 = getelementptr inbounds [110 x [110 x i64]], ptr @m, i64 0, i64 %indvars.iv70, i64 %indvars.iv67
  store i64 1, ptr %53, align 8, !tbaa !8
  br label %54

54:                                               ; preds = %52, %scalar.ph
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %exitcond = icmp eq i64 %indvars.iv67, %27
  br i1 %exitcond, label %._crit_edge, label %scalar.ph, !llvm.loop !17

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge58
  %indvars.iv78 = phi i64 [ %indvars.iv.next79, %._crit_edge58 ], [ 1, %.preheader.preheader ]
  %.02661 = phi i64 [ %spec.select.lcssa, %._crit_edge58 ], [ 0, %.preheader.preheader ]
  br i1 %45, label %._crit_edge58.unr-lcssa, label %.preheader.new

._crit_edge63:                                    ; preds = %._crit_edge58
  %55 = icmp ult i64 %spec.select.lcssa, 1000000007
  br i1 %55, label %._crit_edge63.thread, label %71

._crit_edge58.unr-lcssa:                          ; preds = %.preheader.new, %.preheader
  %spec.select.lcssa.ph = phi i64 [ poison, %.preheader ], [ %spec.select.1, %.preheader.new ]
  %indvars.iv74.unr = phi i64 [ 1, %.preheader ], [ %indvars.iv.next75.1, %.preheader.new ]
  %.155.unr = phi i64 [ %.02661, %.preheader ], [ %spec.select.1, %.preheader.new ]
  br i1 %lcmp.mod.not, label %._crit_edge58, label %._crit_edge58.epilog-lcssa

._crit_edge58.epilog-lcssa:                       ; preds = %._crit_edge58.unr-lcssa
  %56 = getelementptr inbounds [110 x [110 x i64]], ptr @m, i64 0, i64 %indvars.iv78, i64 %indvars.iv74.unr
  %57 = load i64, ptr %56, align 8, !tbaa !8
  %58 = add nsw i64 %57, %.155.unr
  %59 = icmp sgt i64 %58, 1000000006
  %60 = add nsw i64 %58, -1000000007
  %spec.select.epil = select i1 %59, i64 %60, i64 %58
  br label %._crit_edge58

._crit_edge58:                                    ; preds = %._crit_edge58.unr-lcssa, %._crit_edge58.epilog-lcssa
  %spec.select.lcssa = phi i64 [ %spec.select.lcssa.ph, %._crit_edge58.unr-lcssa ], [ %spec.select.epil, %._crit_edge58.epilog-lcssa ]
  %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
  %exitcond81 = icmp eq i64 %indvars.iv78, %44
  br i1 %exitcond81, label %._crit_edge63, label %.preheader, !llvm.loop !18

.preheader.new:                                   ; preds = %.preheader, %.preheader.new
  %indvars.iv74 = phi i64 [ %indvars.iv.next75.1, %.preheader.new ], [ 1, %.preheader ]
  %.155 = phi i64 [ %spec.select.1, %.preheader.new ], [ %.02661, %.preheader ]
  %niter = phi i64 [ %niter.next.1, %.preheader.new ], [ 0, %.preheader ]
  %61 = getelementptr inbounds [110 x [110 x i64]], ptr @m, i64 0, i64 %indvars.iv78, i64 %indvars.iv74
  %62 = load i64, ptr %61, align 8, !tbaa !8
  %63 = add nsw i64 %62, %.155
  %64 = icmp sgt i64 %63, 1000000006
  %65 = add nsw i64 %63, -1000000007
  %spec.select = select i1 %64, i64 %65, i64 %63
  %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
  %66 = getelementptr inbounds [110 x [110 x i64]], ptr @m, i64 0, i64 %indvars.iv78, i64 %indvars.iv.next75
  %67 = load i64, ptr %66, align 8, !tbaa !8
  %68 = add nsw i64 %67, %spec.select
  %69 = icmp sgt i64 %68, 1000000006
  %70 = add nsw i64 %68, -1000000007
  %spec.select.1 = select i1 %69, i64 %70, i64 %68
  %indvars.iv.next75.1 = add nuw nsw i64 %indvars.iv74, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge58.unr-lcssa, label %.preheader.new, !llvm.loop !19

71:                                               ; preds = %._crit_edge63
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 107, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #10
  unreachable

._crit_edge63.thread:                             ; preds = %._crit_edge53, %._crit_edge63
  %.026.lcssa85 = phi i64 [ %spec.select.lcssa, %._crit_edge63 ], [ 0, %._crit_edge53 ]
  %72 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.026.lcssa85)
  br label %73

73:                                               ; preds = %._crit_edge63.thread, %23, %18
  %.sink = phi ptr [ %72, %._crit_edge63.thread ], [ %24, %23 ], [ %19, %18 ]
  %74 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %.sink, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 880, ptr nonnull %2) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #9
  ret i32 0
}

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

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #5

; 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 #0 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.ctpop.i64(i64) #6

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #7

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i64> @llvm.ctpop.v2i64(<2 x i64>) #8

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 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { noreturn 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 #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { nounwind }
attributes #10 = { noreturn 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 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12, !15, !14}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}


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