; LLVM IR from Tunghohin/Competitive_Coding :: Daimayuan (202)

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

@a = external dso_local global [510 x i32], align 16
@dp = external dso_local global [510 x [510 x i64]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; 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 i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  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 4, ptr %2) #7
  %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)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 1, ptr %3, align 4, !tbaa !8
  br label %24

24:                                               ; preds = %34, %0
  %25 = load i32, ptr %3, align 4, !tbaa !8
  %26 = load i32, ptr %2, align 4, !tbaa !8
  %27 = icmp sle i32 %25, %26
  br i1 %27, label %29, label %28

28:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %37

29:                                               ; preds = %24
  %30 = load i32, ptr %3, align 4, !tbaa !8
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [510 x i32], ptr @a, i64 0, i64 %31
  %33 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %32)
  br label %34

34:                                               ; preds = %29
  %35 = load i32, ptr %3, align 4, !tbaa !8
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %3, align 4, !tbaa !8
  br label %24, !llvm.loop !11

37:                                               ; preds = %28
  call void @llvm.memset.p0.i64(ptr align 16 @dp, i8 63, i64 2080800, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 1, ptr %4, align 4, !tbaa !8
  br label %38

38:                                               ; preds = %51, %37
  %39 = load i32, ptr %4, align 4, !tbaa !8
  %40 = load i32, ptr %2, align 4, !tbaa !8
  %41 = icmp slt i32 %39, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %38
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %54

43:                                               ; preds = %38
  %44 = load i32, ptr %4, align 4, !tbaa !8
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [510 x [510 x i64]], ptr @dp, i64 0, i64 %45
  %47 = load i32, ptr %4, align 4, !tbaa !8
  %48 = add nsw i32 %47, 1
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [510 x i64], ptr %46, i64 0, i64 %49
  store i64 0, ptr %50, align 8, !tbaa !13
  br label %51

51:                                               ; preds = %43
  %52 = load i32, ptr %4, align 4, !tbaa !8
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %4, align 4, !tbaa !8
  br label %38, !llvm.loop !15

54:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  store i32 2, ptr %5, align 4, !tbaa !8
  br label %55

55:                                               ; preds = %141, %54
  %56 = load i32, ptr %5, align 4, !tbaa !8
  %57 = load i32, ptr %2, align 4, !tbaa !8
  %58 = icmp slt i32 %56, %57
  br i1 %58, label %60, label %59

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

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

61:                                               ; preds = %137, %60
  %62 = load i32, ptr %7, align 4, !tbaa !8
  %63 = load i32, ptr %2, align 4, !tbaa !8
  %64 = icmp sle i32 %62, %63
  br i1 %64, label %66, label %65

65:                                               ; preds = %61
  store i32 11, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %140

66:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %67 = load i32, ptr %7, align 4, !tbaa !8
  store i32 %67, ptr %8, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %68 = load i32, ptr %7, align 4, !tbaa !8
  %69 = load i32, ptr %5, align 4, !tbaa !8
  %70 = add nsw i32 %68, %69
  store i32 %70, ptr %9, align 4, !tbaa !8
  %71 = load i32, ptr %9, align 4, !tbaa !8
  %72 = load i32, ptr %2, align 4, !tbaa !8
  %73 = icmp sgt i32 %71, %72
  br i1 %73, label %74, label %75

74:                                               ; preds = %66
  store i32 13, ptr %6, align 4
  br label %134

75:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %76 = load i32, ptr %7, align 4, !tbaa !8
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %10, align 4, !tbaa !8
  br label %78

78:                                               ; preds = %130, %75
  %79 = load i32, ptr %10, align 4, !tbaa !8
  %80 = load i32, ptr %9, align 4, !tbaa !8
  %81 = sub nsw i32 %80, 1
  %82 = icmp sle i32 %79, %81
  br i1 %82, label %84, label %83

83:                                               ; preds = %78
  store i32 14, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %133

84:                                               ; preds = %78
  %85 = load i32, ptr %8, align 4, !tbaa !8
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [510 x [510 x i64]], ptr @dp, i64 0, i64 %86
  %88 = load i32, ptr %9, align 4, !tbaa !8
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [510 x i64], ptr %87, i64 0, i64 %89
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %91 = load i32, ptr %8, align 4, !tbaa !8
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [510 x [510 x i64]], ptr @dp, i64 0, i64 %92
  %94 = load i32, ptr %10, align 4, !tbaa !8
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [510 x i64], ptr %93, i64 0, i64 %95
  %97 = load i64, ptr %96, align 8, !tbaa !13
  %98 = load i32, ptr %10, align 4, !tbaa !8
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [510 x [510 x i64]], ptr @dp, i64 0, i64 %99
  %101 = load i32, ptr %9, align 4, !tbaa !8
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [510 x i64], ptr %100, i64 0, i64 %102
  %104 = load i64, ptr %103, align 8, !tbaa !13
  %105 = add nsw i64 %97, %104
  %106 = load i32, ptr %10, align 4, !tbaa !8
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [510 x i32], ptr @a, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !8
  %110 = load i32, ptr %8, align 4, !tbaa !8
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [510 x i32], ptr @a, i64 0, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !8
  %114 = mul nsw i32 %109, %113
  %115 = load i32, ptr %9, align 4, !tbaa !8
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [510 x i32], ptr @a, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !8
  %119 = mul nsw i32 %114, %118
  %120 = sext i32 %119 to i64
  %121 = add nsw i64 %105, %120
  store i64 %121, ptr %11, align 8, !tbaa !13
  %122 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %90, ptr noundef nonnull align 8 dereferenceable(8) %11)
  %123 = load i64, ptr %122, align 8, !tbaa !13
  %124 = load i32, ptr %8, align 4, !tbaa !8
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [510 x [510 x i64]], ptr @dp, i64 0, i64 %125
  %127 = load i32, ptr %9, align 4, !tbaa !8
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [510 x i64], ptr %126, i64 0, i64 %128
  store i64 %123, ptr %129, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br label %130

130:                                              ; preds = %84
  %131 = load i32, ptr %10, align 4, !tbaa !8
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %10, align 4, !tbaa !8
  br label %78, !llvm.loop !16

133:                                              ; preds = %83
  store i32 0, ptr %6, align 4
  br label %134

134:                                              ; preds = %133, %74
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  %135 = load i32, ptr %6, align 4
  switch i32 %135, label %151 [
    i32 0, label %136
    i32 13, label %137
  ]

136:                                              ; preds = %134
  br label %137

137:                                              ; preds = %136, %134
  %138 = load i32, ptr %7, align 4, !tbaa !8
  %139 = add nsw i32 %138, 1
  store i32 %139, ptr %7, align 4, !tbaa !8
  br label %61, !llvm.loop !17

140:                                              ; preds = %65
  br label %141

141:                                              ; preds = %140
  %142 = load i32, ptr %5, align 4, !tbaa !8
  %143 = add nsw i32 %142, 1
  store i32 %143, ptr %5, align 4, !tbaa !8
  br label %55, !llvm.loop !18

144:                                              ; preds = %59
  %145 = load i32, ptr %2, align 4, !tbaa !8
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [510 x i64], ptr getelementptr inbounds ([510 x [510 x i64]], ptr @dp, i64 0, i64 1), i64 0, i64 %146
  %148 = load i64, ptr %147, align 8, !tbaa !13
  %149 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %148)
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  %150 = load i32, ptr %1, align 4
  ret i32 %150

151:                                              ; preds = %134
  unreachable
}

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

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

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.end.p0(i64 immarg, ptr nocapture) #3

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #6 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 #6 = { 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 #7 = { 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"long long", !10, i64 0}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


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

@a = external dso_local global [510 x i32], align 16
@dp = external dso_local global [510 x [510 x i64]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %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 4, ptr nonnull %1) #7
  %14 = 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)
  %15 = load i32, ptr %1, align 4, !tbaa !8
  %.not43 = icmp slt i32 %15, 1
  br i1 %.not43, label %._crit_edge.thread, label %.lr.ph

._crit_edge.thread:                               ; preds = %0
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2080800) @dp, i8 63, i64 2080800, i1 false)
  br label %._crit_edge57

._crit_edge:                                      ; preds = %.lr.ph
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(2080800) @dp, i8 63, i64 2080800, i1 false)
  %16 = icmp sgt i32 %22, 1
  br i1 %16, label %.lr.ph47.preheader, label %._crit_edge57

.lr.ph47.preheader:                               ; preds = %._crit_edge
  %wide.trip.count = zext nneg i32 %22 to i64
  %17 = add nsw i64 %wide.trip.count, -1
  %18 = add nsw i64 %wide.trip.count, -2
  %xtraiter = and i64 %17, 3
  %19 = icmp ult i64 %18, 3
  br i1 %19, label %.preheader41.unr-lcssa, label %.lr.ph47.preheader.new

.lr.ph47.preheader.new:                           ; preds = %.lr.ph47.preheader
  %unroll_iter = and i64 %17, -4
  br label %.lr.ph47

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %20 = getelementptr inbounds [510 x i32], ptr @a, i64 0, i64 %indvars.iv
  %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) %20)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %22 = load i32, ptr %1, align 4, !tbaa !8
  %23 = sext i32 %22 to i64
  %.not.not = icmp slt i64 %indvars.iv, %23
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !11

.preheader41.unr-lcssa:                           ; preds = %.lr.ph47, %.lr.ph47.preheader
  %indvars.iv63.unr = phi i64 [ 1, %.lr.ph47.preheader ], [ %indvars.iv.next64.3, %.lr.ph47 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader41, label %.lr.ph47.epil

.lr.ph47.epil:                                    ; preds = %.preheader41.unr-lcssa, %.lr.ph47.epil
  %indvars.iv63.epil = phi i64 [ %indvars.iv.next64.epil, %.lr.ph47.epil ], [ %indvars.iv63.unr, %.preheader41.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph47.epil ], [ 0, %.preheader41.unr-lcssa ]
  %indvars.iv.next64.epil = add nuw nsw i64 %indvars.iv63.epil, 1
  %24 = getelementptr inbounds [510 x [510 x i64]], ptr @dp, i64 0, i64 %indvars.iv63.epil, i64 %indvars.iv.next64.epil
  store i64 0, ptr %24, align 8, !tbaa !13
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.preheader41, label %.lr.ph47.epil, !llvm.loop !15

.preheader41:                                     ; preds = %.lr.ph47.epil, %.preheader41.unr-lcssa
  %.not = icmp eq i32 %22, 2
  br i1 %.not, label %._crit_edge57, label %.preheader40

.lr.ph47:                                         ; preds = %.lr.ph47, %.lr.ph47.preheader.new
  %indvars.iv63 = phi i64 [ 1, %.lr.ph47.preheader.new ], [ %indvars.iv.next64.3, %.lr.ph47 ]
  %niter = phi i64 [ 0, %.lr.ph47.preheader.new ], [ %niter.next.3, %.lr.ph47 ]
  %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
  %25 = getelementptr inbounds [510 x [510 x i64]], ptr @dp, i64 0, i64 %indvars.iv63, i64 %indvars.iv.next64
  store i64 0, ptr %25, align 8, !tbaa !13
  %indvars.iv.next64.1 = add nuw nsw i64 %indvars.iv63, 2
  %26 = getelementptr inbounds [510 x [510 x i64]], ptr @dp, i64 0, i64 %indvars.iv.next64, i64 %indvars.iv.next64.1
  store i64 0, ptr %26, align 8, !tbaa !13
  %indvars.iv.next64.2 = add nuw nsw i64 %indvars.iv63, 3
  %27 = getelementptr inbounds [510 x [510 x i64]], ptr @dp, i64 0, i64 %indvars.iv.next64.1, i64 %indvars.iv.next64.2
  store i64 0, ptr %27, align 8, !tbaa !13
  %indvars.iv.next64.3 = add nuw nsw i64 %indvars.iv63, 4
  %28 = getelementptr inbounds [510 x [510 x i64]], ptr @dp, i64 0, i64 %indvars.iv.next64.2, i64 %indvars.iv.next64.3
  store i64 0, ptr %28, align 8, !tbaa !13
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.preheader41.unr-lcssa, label %.lr.ph47, !llvm.loop !17

.preheader40:                                     ; preds = %.preheader41, %._crit_edge55
  %29 = phi i32 [ %34, %._crit_edge55 ], [ %22, %.preheader41 ]
  %indvars.iv75 = phi i64 [ %indvars.iv.next76, %._crit_edge55 ], [ 2, %.preheader41 ]
  %.not3851 = icmp slt i32 %29, 1
  br i1 %.not3851, label %._crit_edge55, label %.lr.ph54

._crit_edge57:                                    ; preds = %._crit_edge55, %._crit_edge, %._crit_edge.thread, %.preheader41
  %.lcssa = phi i32 [ %22, %.preheader41 ], [ %22, %._crit_edge ], [ %15, %._crit_edge.thread ], [ %34, %._crit_edge55 ]
  %30 = sext i32 %.lcssa to i64
  %31 = getelementptr inbounds [510 x i64], ptr getelementptr inbounds (i8, ptr @dp, i64 4080), i64 0, i64 %30
  %32 = load i64, ptr %31, align 8, !tbaa !13
  %33 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %32)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret i32 0

._crit_edge55:                                    ; preds = %.loopexit, %.preheader40
  %34 = phi i32 [ %29, %.preheader40 ], [ %61, %.loopexit ]
  %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
  %35 = sext i32 %34 to i64
  %36 = icmp slt i64 %indvars.iv.next76, %35
  br i1 %36, label %.preheader40, label %._crit_edge57, !llvm.loop !18

.lr.ph54:                                         ; preds = %.preheader40, %.loopexit
  %37 = phi i32 [ %61, %.loopexit ], [ %29, %.preheader40 ]
  %38 = phi i32 [ %62, %.loopexit ], [ %29, %.preheader40 ]
  %indvars.iv77 = phi i64 [ %indvars.iv.next78, %.loopexit ], [ %indvars.iv75, %.preheader40 ]
  %indvars.iv66 = phi i64 [ %indvars.iv.next67, %.loopexit ], [ 1, %.preheader40 ]
  %39 = add nuw nsw i64 %indvars.iv66, %indvars.iv75
  %40 = sext i32 %38 to i64
  %41 = icmp sgt i64 %39, %40
  br i1 %41, label %.loopexit, label %.lr.ph50

.lr.ph50:                                         ; preds = %.lr.ph54
  %42 = getelementptr inbounds [510 x [510 x i64]], ptr @dp, i64 0, i64 %indvars.iv66, i64 %39
  %43 = getelementptr inbounds [510 x i32], ptr @a, i64 0, i64 %indvars.iv66
  %44 = getelementptr inbounds [510 x i32], ptr @a, i64 0, i64 %39
  br label %45

45:                                               ; preds = %.lr.ph50, %45
  %indvars.iv68 = phi i64 [ %indvars.iv66, %.lr.ph50 ], [ %indvars.iv.next69, %45 ]
  %indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  %46 = getelementptr inbounds [510 x [510 x i64]], ptr @dp, i64 0, i64 %indvars.iv66, i64 %indvars.iv.next69
  %47 = load i64, ptr %46, align 8, !tbaa !13
  %48 = getelementptr inbounds [510 x [510 x i64]], ptr @dp, i64 0, i64 %indvars.iv.next69, i64 %39
  %49 = load i64, ptr %48, align 8, !tbaa !13
  %50 = add nsw i64 %49, %47
  %51 = getelementptr inbounds [510 x i32], ptr @a, i64 0, i64 %indvars.iv.next69
  %52 = load i32, ptr %51, align 4, !tbaa !8
  %53 = load i32, ptr %43, align 4, !tbaa !8
  %54 = mul nsw i32 %53, %52
  %55 = load i32, ptr %44, align 4, !tbaa !8
  %56 = mul nsw i32 %54, %55
  %57 = sext i32 %56 to i64
  %58 = add nsw i64 %50, %57
  store i64 %58, ptr %2, align 8, !tbaa !13
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %42, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %60 = load i64, ptr %59, align 8, !tbaa !13
  store i64 %60, ptr %42, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  %exitcond74.not = icmp eq i64 %indvars.iv.next69, %indvars.iv77
  br i1 %exitcond74.not, label %.loopexit.loopexit, label %45, !llvm.loop !20

.loopexit.loopexit:                               ; preds = %45
  %.pre = load i32, ptr %1, align 4, !tbaa !8
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %.lr.ph54
  %61 = phi i32 [ %.pre, %.loopexit.loopexit ], [ %37, %.lr.ph54 ]
  %62 = phi i32 [ %.pre, %.loopexit.loopexit ], [ %38, %.lr.ph54 ]
  %indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
  %63 = sext i32 %62 to i64
  %.not38.not = icmp slt i64 %indvars.iv66, %63
  %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
  br i1 %.not38.not, label %.lr.ph54, label %._crit_edge55, !llvm.loop !21
}

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

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

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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) 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 #6 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 #6 = { 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 #7 = { 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"long long", !10, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12, !19}
!19 = !{!"llvm.loop.unswitch.partial.disable"}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}


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