; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/9 Beta Division 2/Problem D (D)

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

@n = external dso_local global i32, align 4
@h = external dso_local global i32, align 4
@dp = external dso_local global [36 x [36 x i64]], align 16
@_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

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

23:                                               ; preds = %125, %0
  %24 = load i32, ptr %2, align 4, !tbaa !11
  %25 = load i32, ptr @n, align 4, !tbaa !11
  %26 = icmp sle i32 %24, %25
  br i1 %26, label %28, label %27

27:                                               ; preds = %23
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %128

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

29:                                               ; preds = %121, %28
  %30 = load i32, ptr %4, align 4, !tbaa !11
  %31 = load i32, ptr %2, align 4, !tbaa !11
  %32 = icmp sle i32 %30, %31
  br i1 %32, label %34, label %33

33:                                               ; preds = %29
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %124

34:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 1, ptr %5, align 4, !tbaa !11
  br label %35

35:                                               ; preds = %117, %34
  %36 = load i32, ptr %5, align 4, !tbaa !11
  %37 = load i32, ptr %2, align 4, !tbaa !11
  %38 = icmp sle i32 %36, %37
  br i1 %38, label %40, label %39

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

40:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !11
  br label %41

41:                                               ; preds = %75, %40
  %42 = load i32, ptr %6, align 4, !tbaa !11
  %43 = load i32, ptr %4, align 4, !tbaa !11
  %44 = sub nsw i32 %43, 1
  %45 = icmp sle i32 %42, %44
  br i1 %45, label %47, label %46

46:                                               ; preds = %41
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %78

47:                                               ; preds = %41
  %48 = load i32, ptr %5, align 4, !tbaa !11
  %49 = sub nsw i32 %48, 1
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [36 x [36 x i64]], ptr @dp, i64 0, i64 %50
  %52 = load i32, ptr %4, align 4, !tbaa !11
  %53 = sub nsw i32 %52, 1
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [36 x i64], ptr %51, i64 0, i64 %54
  %56 = load i64, ptr %55, align 8, !tbaa !8
  %57 = load i32, ptr %2, align 4, !tbaa !11
  %58 = load i32, ptr %5, align 4, !tbaa !11
  %59 = sub nsw i32 %57, %58
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [36 x [36 x i64]], ptr @dp, i64 0, i64 %60
  %62 = load i32, ptr %6, align 4, !tbaa !11
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [36 x i64], ptr %61, i64 0, i64 %63
  %65 = load i64, ptr %64, align 8, !tbaa !8
  %66 = mul nsw i64 %56, %65
  %67 = load i32, ptr %2, align 4, !tbaa !11
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [36 x [36 x i64]], ptr @dp, i64 0, i64 %68
  %70 = load i32, ptr %4, align 4, !tbaa !11
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [36 x i64], ptr %69, i64 0, i64 %71
  %73 = load i64, ptr %72, align 8, !tbaa !8
  %74 = add nsw i64 %73, %66
  store i64 %74, ptr %72, align 8, !tbaa !8
  br label %75

75:                                               ; preds = %47
  %76 = load i32, ptr %6, align 4, !tbaa !11
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %6, align 4, !tbaa !11
  br label %41, !llvm.loop !13

78:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !11
  br label %79

79:                                               ; preds = %113, %78
  %80 = load i32, ptr %7, align 4, !tbaa !11
  %81 = load i32, ptr %4, align 4, !tbaa !11
  %82 = sub nsw i32 %81, 2
  %83 = icmp sle i32 %80, %82
  br i1 %83, label %85, label %84

84:                                               ; preds = %79
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %116

85:                                               ; preds = %79
  %86 = load i32, ptr %2, align 4, !tbaa !11
  %87 = load i32, ptr %5, align 4, !tbaa !11
  %88 = sub nsw i32 %86, %87
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [36 x [36 x i64]], ptr @dp, i64 0, i64 %89
  %91 = load i32, ptr %4, align 4, !tbaa !11
  %92 = sub nsw i32 %91, 1
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [36 x i64], ptr %90, i64 0, i64 %93
  %95 = load i64, ptr %94, align 8, !tbaa !8
  %96 = load i32, ptr %5, align 4, !tbaa !11
  %97 = sub nsw i32 %96, 1
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [36 x [36 x i64]], ptr @dp, i64 0, i64 %98
  %100 = load i32, ptr %7, align 4, !tbaa !11
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [36 x i64], ptr %99, i64 0, i64 %101
  %103 = load i64, ptr %102, align 8, !tbaa !8
  %104 = mul nsw i64 %95, %103
  %105 = load i32, ptr %2, align 4, !tbaa !11
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [36 x [36 x i64]], ptr @dp, i64 0, i64 %106
  %108 = load i32, ptr %4, align 4, !tbaa !11
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [36 x i64], ptr %107, i64 0, i64 %109
  %111 = load i64, ptr %110, align 8, !tbaa !8
  %112 = add nsw i64 %111, %104
  store i64 %112, ptr %110, align 8, !tbaa !8
  br label %113

113:                                              ; preds = %85
  %114 = load i32, ptr %7, align 4, !tbaa !11
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %7, align 4, !tbaa !11
  br label %79, !llvm.loop !15

116:                                              ; preds = %84
  br label %117

117:                                              ; preds = %116
  %118 = load i32, ptr %5, align 4, !tbaa !11
  %119 = add nsw i32 %118, 1
  store i32 %119, ptr %5, align 4, !tbaa !11
  br label %35, !llvm.loop !16

120:                                              ; preds = %39
  br label %121

121:                                              ; preds = %120
  %122 = load i32, ptr %4, align 4, !tbaa !11
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %4, align 4, !tbaa !11
  br label %29, !llvm.loop !17

124:                                              ; preds = %33
  br label %125

125:                                              ; preds = %124
  %126 = load i32, ptr %2, align 4, !tbaa !11
  %127 = add nsw i32 %126, 1
  store i32 %127, ptr %2, align 4, !tbaa !11
  br label %23, !llvm.loop !18

128:                                              ; preds = %27
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store i64 0, ptr %8, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %129 = load i32, ptr @h, align 4, !tbaa !11
  store i32 %129, ptr %9, align 4, !tbaa !11
  br label %130

130:                                              ; preds = %145, %128
  %131 = load i32, ptr %9, align 4, !tbaa !11
  %132 = load i32, ptr @n, align 4, !tbaa !11
  %133 = icmp sle i32 %131, %132
  br i1 %133, label %135, label %134

134:                                              ; preds = %130
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %148

135:                                              ; preds = %130
  %136 = load i32, ptr @n, align 4, !tbaa !11
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [36 x [36 x i64]], ptr @dp, i64 0, i64 %137
  %139 = load i32, ptr %9, align 4, !tbaa !11
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [36 x i64], ptr %138, i64 0, i64 %140
  %142 = load i64, ptr %141, align 8, !tbaa !8
  %143 = load i64, ptr %8, align 8, !tbaa !8
  %144 = add nsw i64 %143, %142
  store i64 %144, ptr %8, align 8, !tbaa !8
  br label %145

145:                                              ; preds = %135
  %146 = load i32, ptr %9, align 4, !tbaa !11
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %9, align 4, !tbaa !11
  br label %130, !llvm.loop !19

148:                                              ; preds = %134
  %149 = load i64, ptr %8, align 8, !tbaa !8
  %150 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %149)
  %151 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %150, ptr noundef @.str)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  %152 = load i32, ptr %1, align 4
  ret i32 %152
}

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #5 align 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 = { "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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #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 = { 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}
!19 = distinct !{!19, !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_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" }

@n = external dso_local global i32, align 4
@h = external dso_local global i32, align 4
@dp = external dso_local local_unnamed_addr global [36 x [36 x i64]], align 16
@_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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %2 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %3 = getelementptr i8, ptr %2, i64 -24
  %4 = load i64, ptr %3, align 8
  %5 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %4
  %6 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %5, ptr noundef null)
  %7 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %8 = getelementptr i8, ptr %7, i64 -24
  %9 = load i64, ptr %8, align 8
  %10 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %9
  %11 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %10, ptr noundef null)
  %12 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %13 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 4 dereferenceable(4) @h)
  store i64 1, ptr @dp, align 16, !tbaa !8
  %14 = load i32, ptr @n, align 4, !tbaa !11
  %.not61 = icmp slt i32 %14, 1
  br i1 %.not61, label %._crit_edge63, label %.preheader49.preheader

.preheader49.preheader:                           ; preds = %0
  %15 = add nuw i32 %14, 1
  %wide.trip.count = zext i32 %15 to i64
  br label %.preheader49

.preheader49:                                     ; preds = %.preheader49.preheader, %50
  %indvars.iv110 = phi i64 [ 1, %.preheader49.preheader ], [ %indvars.iv.next111, %50 ]
  %indvars.iv108 = phi i64 [ 2, %.preheader49.preheader ], [ %indvars.iv.next109, %50 ]
  br label %.preheader48

._crit_edge63:                                    ; preds = %50, %0
  %16 = load i32, ptr @h, align 4, !tbaa !11
  %.not4264 = icmp sgt i32 %16, %14
  br i1 %.not4264, label %._crit_edge68, label %.lr.ph

.lr.ph:                                           ; preds = %._crit_edge63
  %17 = sext i32 %14 to i64
  %18 = sext i32 %16 to i64
  %19 = add i32 %14, 1
  %20 = sub i32 %14, %16
  %21 = zext i32 %20 to i64
  %22 = add nuw nsw i64 %21, 1
  %min.iters.check = icmp ult i32 %20, 3
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph
  %indvars.iv116.ph = phi i64 [ %18, %.lr.ph ], [ %ind.end, %middle.block ]
  %.03465.ph = phi i64 [ 0, %.lr.ph ], [ %28, %middle.block ]
  br label %scalar.ph

vector.ph:                                        ; preds = %.lr.ph
  %n.vec = and i64 %22, 8589934588
  %ind.end = add nsw i64 %n.vec, %18
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %25, %vector.body ]
  %vec.phi130 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %26, %vector.body ]
  %offset.idx = add i64 %index, %18
  %23 = getelementptr inbounds [36 x [36 x i64]], ptr @dp, i64 0, i64 %17, i64 %offset.idx
  %24 = getelementptr inbounds i8, ptr %23, i64 16
  %wide.load = load <2 x i64>, ptr %23, align 8, !tbaa !8
  %wide.load131 = load <2 x i64>, ptr %24, align 8, !tbaa !8
  %25 = add <2 x i64> %wide.load, %vec.phi
  %26 = add <2 x i64> %wide.load131, %vec.phi130
  %index.next = add nuw i64 %index, 4
  %27 = icmp eq i64 %index.next, %n.vec
  br i1 %27, label %middle.block, label %vector.body, !llvm.loop !13

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <2 x i64> %26, %25
  %28 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  %cmp.n = icmp eq i64 %22, %n.vec
  br i1 %cmp.n, label %._crit_edge68, label %scalar.ph.preheader

.preheader48:                                     ; preds = %.preheader49, %.split.us
  %indvars.iv101 = phi i64 [ 1, %.preheader49 ], [ %indvars.iv.next102, %.split.us ]
  %indvars.iv99 = phi i64 [ 0, %.preheader49 ], [ %indvars.iv.next100, %.split.us ]
  %29 = add nsw i64 %indvars.iv101, -1
  %30 = getelementptr inbounds [36 x [36 x i64]], ptr @dp, i64 0, i64 %indvars.iv110, i64 %indvars.iv101
  %.not4652 = icmp ult i64 %indvars.iv101, 2
  %.promoted55 = load i64, ptr %30, align 8, !tbaa !8
  br i1 %.not4652, label %.preheader47.us.preheader, label %.preheader47.preheader

.preheader47.preheader:                           ; preds = %.preheader48
  %xtraiter = and i64 %indvars.iv101, 1
  %31 = icmp eq i64 %indvars.iv99, 0
  %unroll_iter = and i64 %indvars.iv101, 9223372036854775806
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  %xtraiter140 = and i64 %indvars.iv99, 1
  %32 = icmp eq i64 %indvars.iv99, 1
  %unroll_iter143 = and i64 %indvars.iv99, 9223372036854775806
  %lcmp.mod141.not = icmp eq i64 %xtraiter140, 0
  br label %.preheader47

.preheader47.us.preheader:                        ; preds = %.preheader48
  %33 = icmp eq i64 %indvars.iv99, 0
  br label %.preheader47.us

.preheader47.us:                                  ; preds = %.preheader47.us.preheader, %.preheader.us.epilog-lcssa
  %indvars.iv94 = phi i64 [ %indvars.iv.next95, %.preheader.us.epilog-lcssa ], [ 1, %.preheader47.us.preheader ]
  %.promoted56.us = phi i64 [ %49, %.preheader.us.epilog-lcssa ], [ %.promoted55, %.preheader47.us.preheader ]
  %34 = add nsw i64 %indvars.iv94, -1
  %35 = getelementptr inbounds [36 x [36 x i64]], ptr @dp, i64 0, i64 %34, i64 %29
  %36 = sub nsw i64 %indvars.iv110, %indvars.iv94
  %.pre121 = load i64, ptr %35, align 8, !tbaa !8
  br i1 %33, label %.preheader.us.epilog-lcssa, label %.preheader47.us.new

.preheader47.us.new:                              ; preds = %.preheader47.us, %.preheader47.us.new
  %indvars.iv89 = phi i64 [ %indvars.iv.next90.1, %.preheader47.us.new ], [ 0, %.preheader47.us ]
  %37 = phi i64 [ %45, %.preheader47.us.new ], [ %.promoted56.us, %.preheader47.us ]
  %niter151 = phi i64 [ %niter151.next.1, %.preheader47.us.new ], [ 0, %.preheader47.us ]
  %38 = getelementptr inbounds [36 x [36 x i64]], ptr @dp, i64 0, i64 %36, i64 %indvars.iv89
  %39 = load i64, ptr %38, align 16, !tbaa !8
  %40 = mul nsw i64 %39, %.pre121
  %41 = add nsw i64 %37, %40
  store i64 %41, ptr %30, align 8, !tbaa !8
  %indvars.iv.next90 = or disjoint i64 %indvars.iv89, 1
  %42 = getelementptr inbounds [36 x [36 x i64]], ptr @dp, i64 0, i64 %36, i64 %indvars.iv.next90
  %43 = load i64, ptr %42, align 8, !tbaa !8
  %44 = mul nsw i64 %43, %.pre121
  %45 = add nsw i64 %41, %44
  store i64 %45, ptr %30, align 8, !tbaa !8
  %indvars.iv.next90.1 = add nuw nsw i64 %indvars.iv89, 2
  %niter151.next.1 = add i64 %niter151, 2
  %niter151.ncmp.1 = icmp eq i64 %niter151.next.1, 0
  br i1 %niter151.ncmp.1, label %.preheader.us.epilog-lcssa, label %.preheader47.us.new, !llvm.loop !17

.preheader.us.epilog-lcssa:                       ; preds = %.preheader47.us.new, %.preheader47.us
  %indvars.iv89.unr = phi i64 [ 0, %.preheader47.us ], [ %indvars.iv.next90.1, %.preheader47.us.new ]
  %.unr147 = phi i64 [ %.promoted56.us, %.preheader47.us ], [ %45, %.preheader47.us.new ]
  %46 = getelementptr inbounds [36 x [36 x i64]], ptr @dp, i64 0, i64 %36, i64 %indvars.iv89.unr
  %47 = load i64, ptr %46, align 8, !tbaa !8
  %48 = mul nsw i64 %47, %.pre121
  %49 = add nsw i64 %.unr147, %48
  store i64 %49, ptr %30, align 8, !tbaa !8
  %indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
  %exitcond98.not = icmp eq i64 %indvars.iv.next95, %indvars.iv108
  br i1 %exitcond98.not, label %.split.us, label %.preheader47.us, !llvm.loop !18

50:                                               ; preds = %.split.us
  %indvars.iv.next111 = add nuw nsw i64 %indvars.iv110, 1
  %indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1
  %exitcond115.not = icmp eq i64 %indvars.iv.next111, %wide.trip.count
  br i1 %exitcond115.not, label %._crit_edge63, label %.preheader49, !llvm.loop !19

.preheader47:                                     ; preds = %.preheader47.preheader, %._crit_edge
  %indvars.iv82 = phi i64 [ %indvars.iv.next83, %._crit_edge ], [ 1, %.preheader47.preheader ]
  %.promoted56 = phi i64 [ %.lcssa136, %._crit_edge ], [ %.promoted55, %.preheader47.preheader ]
  %51 = add nsw i64 %indvars.iv82, -1
  %52 = getelementptr inbounds [36 x [36 x i64]], ptr @dp, i64 0, i64 %51, i64 %29
  %53 = sub nsw i64 %indvars.iv110, %indvars.iv82
  %.pre = load i64, ptr %52, align 8, !tbaa !8
  br i1 %31, label %.preheader.unr-lcssa, label %.preheader47.new

.split.us:                                        ; preds = %._crit_edge, %.preheader.us.epilog-lcssa
  %indvars.iv.next102 = add nuw nsw i64 %indvars.iv101, 1
  %indvars.iv.next100 = add nuw nsw i64 %indvars.iv99, 1
  %exitcond107.not = icmp eq i64 %indvars.iv.next100, %indvars.iv110
  br i1 %exitcond107.not, label %50, label %.preheader48, !llvm.loop !20

.preheader.unr-lcssa:                             ; preds = %.preheader47.new, %.preheader47
  %.lcssa135.ph = phi i64 [ poison, %.preheader47 ], [ %67, %.preheader47.new ]
  %indvars.iv.unr = phi i64 [ 0, %.preheader47 ], [ %indvars.iv.next.1, %.preheader47.new ]
  %.unr = phi i64 [ %.promoted56, %.preheader47 ], [ %67, %.preheader47.new ]
  br i1 %lcmp.mod.not, label %.preheader, label %.preheader.epilog-lcssa

.preheader.epilog-lcssa:                          ; preds = %.preheader.unr-lcssa
  %54 = getelementptr inbounds [36 x [36 x i64]], ptr @dp, i64 0, i64 %53, i64 %indvars.iv.unr
  %55 = load i64, ptr %54, align 8, !tbaa !8
  %56 = mul nsw i64 %55, %.pre
  %57 = add nsw i64 %.unr, %56
  store i64 %57, ptr %30, align 8, !tbaa !8
  br label %.preheader

.preheader:                                       ; preds = %.preheader.unr-lcssa, %.preheader.epilog-lcssa
  %.lcssa135 = phi i64 [ %.lcssa135.ph, %.preheader.unr-lcssa ], [ %57, %.preheader.epilog-lcssa ]
  %58 = getelementptr inbounds [36 x [36 x i64]], ptr @dp, i64 0, i64 %53, i64 %29
  %.pre120 = load i64, ptr %58, align 8, !tbaa !8
  br i1 %32, label %._crit_edge.unr-lcssa, label %.preheader.new

.preheader47.new:                                 ; preds = %.preheader47, %.preheader47.new
  %indvars.iv = phi i64 [ %indvars.iv.next.1, %.preheader47.new ], [ 0, %.preheader47 ]
  %59 = phi i64 [ %67, %.preheader47.new ], [ %.promoted56, %.preheader47 ]
  %niter = phi i64 [ %niter.next.1, %.preheader47.new ], [ 0, %.preheader47 ]
  %60 = getelementptr inbounds [36 x [36 x i64]], ptr @dp, i64 0, i64 %53, i64 %indvars.iv
  %61 = load i64, ptr %60, align 16, !tbaa !8
  %62 = mul nsw i64 %61, %.pre
  %63 = add nsw i64 %59, %62
  store i64 %63, ptr %30, align 8, !tbaa !8
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %64 = getelementptr inbounds [36 x [36 x i64]], ptr @dp, i64 0, i64 %53, i64 %indvars.iv.next
  %65 = load i64, ptr %64, align 8, !tbaa !8
  %66 = mul nsw i64 %65, %.pre
  %67 = add nsw i64 %63, %66
  store i64 %67, ptr %30, align 8, !tbaa !8
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 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 %.preheader.unr-lcssa, label %.preheader47.new, !llvm.loop !17

._crit_edge.unr-lcssa:                            ; preds = %.preheader.new, %.preheader
  %.lcssa136.ph = phi i64 [ poison, %.preheader ], [ %79, %.preheader.new ]
  %indvars.iv75.unr = phi i64 [ 0, %.preheader ], [ %indvars.iv.next76.1, %.preheader.new ]
  %.promoted58.unr = phi i64 [ %.lcssa135, %.preheader ], [ %79, %.preheader.new ]
  br i1 %lcmp.mod141.not, label %._crit_edge, label %._crit_edge.epilog-lcssa

._crit_edge.epilog-lcssa:                         ; preds = %._crit_edge.unr-lcssa
  %68 = getelementptr inbounds [36 x [36 x i64]], ptr @dp, i64 0, i64 %51, i64 %indvars.iv75.unr
  %69 = load i64, ptr %68, align 8, !tbaa !8
  %70 = mul nsw i64 %69, %.pre120
  %71 = add nsw i64 %.promoted58.unr, %70
  store i64 %71, ptr %30, align 8, !tbaa !8
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.unr-lcssa, %._crit_edge.epilog-lcssa
  %.lcssa136 = phi i64 [ %.lcssa136.ph, %._crit_edge.unr-lcssa ], [ %71, %._crit_edge.epilog-lcssa ]
  %indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
  %exitcond88.not = icmp eq i64 %indvars.iv.next83, %indvars.iv108
  br i1 %exitcond88.not, label %.split.us, label %.preheader47, !llvm.loop !18

.preheader.new:                                   ; preds = %.preheader, %.preheader.new
  %indvars.iv75 = phi i64 [ %indvars.iv.next76.1, %.preheader.new ], [ 0, %.preheader ]
  %.promoted58 = phi i64 [ %79, %.preheader.new ], [ %.lcssa135, %.preheader ]
  %niter144 = phi i64 [ %niter144.next.1, %.preheader.new ], [ 0, %.preheader ]
  %72 = getelementptr inbounds [36 x [36 x i64]], ptr @dp, i64 0, i64 %51, i64 %indvars.iv75
  %73 = load i64, ptr %72, align 16, !tbaa !8
  %74 = mul nsw i64 %73, %.pre120
  %75 = add nsw i64 %.promoted58, %74
  store i64 %75, ptr %30, align 8, !tbaa !8
  %indvars.iv.next76 = or disjoint i64 %indvars.iv75, 1
  %76 = getelementptr inbounds [36 x [36 x i64]], ptr @dp, i64 0, i64 %51, i64 %indvars.iv.next76
  %77 = load i64, ptr %76, align 8, !tbaa !8
  %78 = mul nsw i64 %77, %.pre120
  %79 = add nsw i64 %75, %78
  store i64 %79, ptr %30, align 8, !tbaa !8
  %indvars.iv.next76.1 = add nuw nsw i64 %indvars.iv75, 2
  %niter144.next.1 = add i64 %niter144, 2
  %niter144.ncmp.1 = icmp eq i64 %niter144.next.1, %unroll_iter143
  br i1 %niter144.ncmp.1, label %._crit_edge.unr-lcssa, label %.preheader.new, !llvm.loop !21

._crit_edge68:                                    ; preds = %scalar.ph, %middle.block, %._crit_edge63
  %.034.lcssa = phi i64 [ 0, %._crit_edge63 ], [ %28, %middle.block ], [ %84, %scalar.ph ]
  %80 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.034.lcssa)
  %81 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %80, ptr noundef nonnull @.str)
  ret i32 0

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv116 = phi i64 [ %indvars.iv.next117, %scalar.ph ], [ %indvars.iv116.ph, %scalar.ph.preheader ]
  %.03465 = phi i64 [ %84, %scalar.ph ], [ %.03465.ph, %scalar.ph.preheader ]
  %82 = getelementptr inbounds [36 x [36 x i64]], ptr @dp, i64 0, i64 %17, i64 %indvars.iv116
  %83 = load i64, ptr %82, align 8, !tbaa !8
  %84 = add nsw i64 %83, %.03465
  %indvars.iv.next117 = add nsw i64 %indvars.iv116, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next117 to i32
  %exitcond119.not = icmp eq i32 %19, %lftr.wideiv
  br i1 %exitcond119.not, label %._crit_edge68, label %scalar.ph, !llvm.loop !22
}

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

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

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 #1

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

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

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

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 = { "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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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, !15, !16}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !14, !16, !15}


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