; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/407 Div 1/B (B)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@g = external dso_local global [1001000 x %"class.std::vector"], align 16
@d = external dso_local global [1001000 x i64], align 16
@loop = external dso_local global i64, align 8
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@vis = external dso_local global [1001000 x i32], align 16
@longd = external dso_local global [1001000 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [98 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsi(i32 noundef) #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %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 i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %11

11:                                               ; preds = %52, %0
  %12 = load i32, ptr %2, align 4, !tbaa !5
  %13 = load i32, ptr @m, align 4, !tbaa !5
  %14 = icmp slt i32 %12, %13
  br i1 %14, label %16, label %15

15:                                               ; preds = %11
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %55

16:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %3, ptr noundef %4)
  %18 = load i32, ptr %3, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [1001000 x i32], ptr @longd, i64 0, i64 %19
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = add nsw i32 %21, 1
  store i32 %22, ptr %20, align 4, !tbaa !5
  %23 = load i32, ptr %4, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [1001000 x i32], ptr @longd, i64 0, i64 %24
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr %25, align 4, !tbaa !5
  %28 = load i32, ptr %3, align 4, !tbaa !5
  %29 = load i32, ptr %4, align 4, !tbaa !5
  %30 = icmp eq i32 %28, %29
  br i1 %30, label %31, label %34

31:                                               ; preds = %16
  %32 = load i64, ptr @loop, align 8, !tbaa !9
  %33 = add nsw i64 %32, 1
  store i64 %33, ptr @loop, align 8, !tbaa !9
  br label %51

34:                                               ; preds = %16
  %35 = load i32, ptr %3, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [1001000 x i64], ptr @d, i64 0, i64 %36
  %38 = load i64, ptr %37, align 8, !tbaa !9
  %39 = add nsw i64 %38, 1
  store i64 %39, ptr %37, align 8, !tbaa !9
  %40 = load i32, ptr %4, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [1001000 x i64], ptr @d, i64 0, i64 %41
  %43 = load i64, ptr %42, align 8, !tbaa !9
  %44 = add nsw i64 %43, 1
  store i64 %44, ptr %42, align 8, !tbaa !9
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [1001000 x %"class.std::vector"], ptr @g, i64 0, i64 %46
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %47, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %48 = load i32, ptr %4, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [1001000 x %"class.std::vector"], ptr @g, i64 0, i64 %49
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %50, ptr noundef nonnull align 4 dereferenceable(4) %3)
  br label %51

51:                                               ; preds = %34, %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %52

52:                                               ; preds = %51
  %53 = load i32, ptr %2, align 4, !tbaa !5
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %2, align 4, !tbaa !5
  br label %11, !llvm.loop !11

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

56:                                               ; preds = %70, %55
  %57 = load i32, ptr %5, align 4, !tbaa !5
  %58 = load i32, ptr @n, align 4, !tbaa !5
  %59 = icmp sle i32 %57, %58
  br i1 %59, label %61, label %60

60:                                               ; preds = %56
  store i32 5, ptr %6, align 4
  br label %73

61:                                               ; preds = %56
  %62 = load i32, ptr %5, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [1001000 x i32], ptr @longd, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = icmp sgt i32 %65, 0
  br i1 %66, label %67, label %69

67:                                               ; preds = %61
  %68 = load i32, ptr %5, align 4, !tbaa !5
  call void @_Z3dfsi(i32 noundef %68)
  store i32 5, ptr %6, align 4
  br label %73

69:                                               ; preds = %61
  br label %70

70:                                               ; preds = %69
  %71 = load i32, ptr %5, align 4, !tbaa !5
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %5, align 4, !tbaa !5
  br label %56, !llvm.loop !13

73:                                               ; preds = %67, %60
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %74

74:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %75

75:                                               ; preds = %95, %74
  %76 = load i32, ptr %7, align 4, !tbaa !5
  %77 = load i32, ptr @n, align 4, !tbaa !5
  %78 = icmp sle i32 %76, %77
  br i1 %78, label %80, label %79

79:                                               ; preds = %75
  store i32 8, ptr %6, align 4
  br label %98

80:                                               ; preds = %75
  %81 = load i32, ptr %7, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [1001000 x i32], ptr @vis, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = icmp ne i32 %84, 0
  br i1 %85, label %94, label %86

86:                                               ; preds = %80
  %87 = load i32, ptr %7, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [1001000 x i32], ptr @longd, i64 0, i64 %88
  %90 = load i32, ptr %89, align 4, !tbaa !5
  %91 = icmp sgt i32 %90, 0
  br i1 %91, label %92, label %94

92:                                               ; preds = %86
  %93 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  br label %98

94:                                               ; preds = %86, %80
  br label %95

95:                                               ; preds = %94
  %96 = load i32, ptr %7, align 4, !tbaa !5
  %97 = add nsw i32 %96, 1
  store i32 %97, ptr %7, align 4, !tbaa !5
  br label %75, !llvm.loop !14

98:                                               ; preds = %92, %79
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  %99 = load i32, ptr %6, align 4
  switch i32 %99, label %149 [
    i32 8, label %100
    i32 1, label %147
  ]

100:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  store i64 0, ptr %8, align 8, !tbaa !9
  %101 = load i64, ptr @loop, align 8, !tbaa !9
  %102 = load i32, ptr @m, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = load i64, ptr @loop, align 8, !tbaa !9
  %105 = sub nsw i64 %103, %104
  %106 = mul nsw i64 %101, %105
  %107 = load i64, ptr %8, align 8, !tbaa !9
  %108 = add nsw i64 %107, %106
  store i64 %108, ptr %8, align 8, !tbaa !9
  %109 = load i64, ptr @loop, align 8, !tbaa !9
  %110 = load i64, ptr @loop, align 8, !tbaa !9
  %111 = sub nsw i64 %110, 1
  %112 = mul nsw i64 %109, %111
  %113 = sdiv i64 %112, 2
  %114 = load i64, ptr %8, align 8, !tbaa !9
  %115 = add nsw i64 %114, %113
  store i64 %115, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %116

116:                                              ; preds = %135, %100
  %117 = load i32, ptr %9, align 4, !tbaa !5
  %118 = load i32, ptr @n, align 4, !tbaa !5
  %119 = icmp sle i32 %117, %118
  br i1 %119, label %121, label %120

120:                                              ; preds = %116
  store i32 11, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %138

121:                                              ; preds = %116
  %122 = load i32, ptr %9, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [1001000 x i64], ptr @d, i64 0, i64 %123
  %125 = load i64, ptr %124, align 8, !tbaa !9
  %126 = load i32, ptr %9, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [1001000 x i64], ptr @d, i64 0, i64 %127
  %129 = load i64, ptr %128, align 8, !tbaa !9
  %130 = sub nsw i64 %129, 1
  %131 = mul nsw i64 %125, %130
  %132 = sdiv i64 %131, 2
  %133 = load i64, ptr %8, align 8, !tbaa !9
  %134 = add nsw i64 %133, %132
  store i64 %134, ptr %8, align 8, !tbaa !9
  br label %135

135:                                              ; preds = %121
  %136 = load i32, ptr %9, align 4, !tbaa !5
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr %9, align 4, !tbaa !5
  br label %116, !llvm.loop !15

138:                                              ; preds = %120
  %139 = load i64, ptr %8, align 8, !tbaa !9
  %140 = icmp sge i64 %139, 0
  br i1 %140, label %141, label %142

141:                                              ; preds = %138
  br label %144

142:                                              ; preds = %138
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.4, i32 noundef 96, ptr noundef @__PRETTY_FUNCTION__.main) #6
  unreachable

143:                                              ; No predecessors!
  br label %144

144:                                              ; preds = %143, %141
  %145 = load i64, ptr %8, align 8, !tbaa !9
  %146 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i64 noundef %145)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %147

147:                                              ; preds = %144, %98
  %148 = load i32, ptr %1, align 4
  ret i32 %148

149:                                              ; preds = %98
  unreachable
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) #0 align 2

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

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "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 = { 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 #5 = { nounwind }
attributes #6 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@g = external dso_local global [1001000 x %"class.std::vector"], align 16
@d = external dso_local local_unnamed_addr global [1001000 x i64], align 16
@loop = external dso_local local_unnamed_addr global i64, align 8
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@vis = external dso_local local_unnamed_addr global [1001000 x i32], align 16
@longd = external dso_local local_unnamed_addr global [1001000 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [98 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsi(i32 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %4 = load i32, ptr @m, align 4, !tbaa !5
  %5 = icmp sgt i32 %4, 0
  br i1 %5, label %.lr.ph, label %.preheader

.preheader:                                       ; preds = %34, %0
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %.not36 = icmp slt i32 %6, 1
  br i1 %.not36, label %._crit_edge, label %.lr.ph38.preheader

.lr.ph38.preheader:                               ; preds = %.preheader
  %7 = add nuw i32 %6, 1
  %wide.trip.count = zext i32 %7 to i64
  br label %.lr.ph38

.lr.ph:                                           ; preds = %0, %34
  %.02535 = phi i32 [ %35, %34 ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %9 = load i32, ptr %1, align 4, !tbaa !5
  %10 = sext i32 %9 to i64
  %11 = getelementptr inbounds [1001000 x i32], ptr @longd, i64 0, i64 %10
  %12 = load i32, ptr %11, align 4, !tbaa !5
  %13 = add nsw i32 %12, 1
  store i32 %13, ptr %11, align 4, !tbaa !5
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds [1001000 x i32], ptr @longd, i64 0, i64 %15
  %17 = load i32, ptr %16, align 4, !tbaa !5
  %18 = add nsw i32 %17, 1
  store i32 %18, ptr %16, align 4, !tbaa !5
  %19 = icmp eq i32 %9, %14
  br i1 %19, label %20, label %23

20:                                               ; preds = %.lr.ph
  %21 = load i64, ptr @loop, align 8, !tbaa !9
  %22 = add nsw i64 %21, 1
  store i64 %22, ptr @loop, align 8, !tbaa !9
  br label %34

23:                                               ; preds = %.lr.ph
  %24 = getelementptr inbounds [1001000 x i64], ptr @d, i64 0, i64 %10
  %25 = load i64, ptr %24, align 8, !tbaa !9
  %26 = add nsw i64 %25, 1
  store i64 %26, ptr %24, align 8, !tbaa !9
  %27 = getelementptr inbounds [1001000 x i64], ptr @d, i64 0, i64 %15
  %28 = load i64, ptr %27, align 8, !tbaa !9
  %29 = add nsw i64 %28, 1
  store i64 %29, ptr %27, align 8, !tbaa !9
  %30 = getelementptr inbounds [1001000 x %"class.std::vector"], ptr @g, i64 0, i64 %10
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %30, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [1001000 x %"class.std::vector"], ptr @g, i64 0, i64 %32
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %33, ptr noundef nonnull align 4 dereferenceable(4) %1)
  br label %34

34:                                               ; preds = %23, %20
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %35 = add nuw nsw i32 %.02535, 1
  %36 = load i32, ptr @m, align 4, !tbaa !5
  %37 = icmp slt i32 %35, %36
  br i1 %37, label %.lr.ph, label %.preheader, !llvm.loop !11

.lr.ph38:                                         ; preds = %.lr.ph38.preheader, %43
  %indvars.iv = phi i64 [ 1, %.lr.ph38.preheader ], [ %indvars.iv.next, %43 ]
  %38 = getelementptr inbounds [1001000 x i32], ptr @longd, i64 0, i64 %indvars.iv
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = icmp sgt i32 %39, 0
  br i1 %40, label %41, label %43

41:                                               ; preds = %.lr.ph38
  %42 = trunc nuw nsw i64 %indvars.iv to i32
  call void @_Z3dfsi(i32 noundef %42)
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %.loopexit

43:                                               ; preds = %.lr.ph38
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph38, !llvm.loop !13

.loopexit:                                        ; preds = %43, %41
  %44 = phi i32 [ %.pre, %41 ], [ %6, %43 ]
  %.not2839 = icmp slt i32 %44, 1
  br i1 %.not2839, label %._crit_edge, label %.lr.ph41.preheader

.lr.ph41.preheader:                               ; preds = %.loopexit
  %45 = add nuw i32 %44, 1
  %wide.trip.count53 = zext i32 %45 to i64
  br label %.lr.ph41

.lr.ph41:                                         ; preds = %.lr.ph41.preheader, %52
  %indvars.iv50 = phi i64 [ 1, %.lr.ph41.preheader ], [ %indvars.iv.next51, %52 ]
  %46 = getelementptr inbounds [1001000 x i32], ptr @vis, i64 0, i64 %indvars.iv50
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %.not29 = icmp eq i32 %47, 0
  br i1 %.not29, label %48, label %52

48:                                               ; preds = %.lr.ph41
  %49 = getelementptr inbounds [1001000 x i32], ptr @longd, i64 0, i64 %indvars.iv50
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = icmp sgt i32 %50, 0
  br i1 %51, label %53, label %52

52:                                               ; preds = %.lr.ph41, %48
  %indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
  %exitcond54.not = icmp eq i64 %indvars.iv.next51, %wide.trip.count53
  br i1 %exitcond54.not, label %._crit_edge, label %.lr.ph41, !llvm.loop !14

53:                                               ; preds = %48
  %54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %90

._crit_edge:                                      ; preds = %52, %.preheader, %.loopexit
  %.not283961 = phi i1 [ true, %.loopexit ], [ true, %.preheader ], [ %.not2839, %52 ]
  %55 = phi i32 [ %44, %.loopexit ], [ %6, %.preheader ], [ %44, %52 ]
  %56 = load i64, ptr @loop, align 8, !tbaa !9
  %57 = load i32, ptr @m, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = sub nsw i64 %58, %56
  %60 = mul nsw i64 %59, %56
  %61 = add nsw i64 %56, -1
  %62 = mul nsw i64 %61, %56
  %63 = sdiv i64 %62, 2
  %64 = add nsw i64 %60, %63
  br i1 %.not283961, label %._crit_edge47, label %.lr.ph46.preheader

.lr.ph46.preheader:                               ; preds = %._crit_edge
  %65 = add nuw i32 %55, 1
  %wide.trip.count58 = zext i32 %65 to i64
  %66 = zext i32 %55 to i64
  %min.iters.check = icmp ult i32 %55, 4
  br i1 %min.iters.check, label %.lr.ph46.preheader66, label %vector.ph

.lr.ph46.preheader66:                             ; preds = %middle.block, %.lr.ph46.preheader
  %indvars.iv55.ph = phi i64 [ 1, %.lr.ph46.preheader ], [ %ind.end, %middle.block ]
  %.02143.ph = phi i64 [ %64, %.lr.ph46.preheader ], [ %79, %middle.block ]
  br label %.lr.ph46

vector.ph:                                        ; preds = %.lr.ph46.preheader
  %n.vec = and i64 %66, 4294967292
  %ind.end = or disjoint i64 %n.vec, 1
  %67 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %64, i64 0
  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> [ %67, %vector.ph ], [ %76, %vector.body ]
  %vec.phi64 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %77, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %68 = getelementptr inbounds [1001000 x i64], ptr @d, i64 0, i64 %offset.idx
  %69 = getelementptr inbounds i8, ptr %68, i64 16
  %wide.load = load <2 x i64>, ptr %68, align 8, !tbaa !9
  %wide.load65 = load <2 x i64>, ptr %69, align 8, !tbaa !9
  %70 = add nsw <2 x i64> %wide.load, <i64 -1, i64 -1>
  %71 = add nsw <2 x i64> %wide.load65, <i64 -1, i64 -1>
  %72 = mul nsw <2 x i64> %70, %wide.load
  %73 = mul nsw <2 x i64> %71, %wide.load65
  %74 = sdiv <2 x i64> %72, <i64 2, i64 2>
  %75 = sdiv <2 x i64> %73, <i64 2, i64 2>
  %76 = add <2 x i64> %74, %vec.phi
  %77 = add <2 x i64> %75, %vec.phi64
  %index.next = add nuw i64 %index, 4
  %78 = icmp eq i64 %index.next, %n.vec
  br i1 %78, label %middle.block, label %vector.body, !llvm.loop !15

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <2 x i64> %77, %76
  %79 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  %cmp.n = icmp eq i64 %n.vec, %66
  br i1 %cmp.n, label %._crit_edge47, label %.lr.ph46.preheader66

._crit_edge47:                                    ; preds = %.lr.ph46, %middle.block, %._crit_edge
  %.021.lcssa = phi i64 [ %64, %._crit_edge ], [ %79, %middle.block ], [ %86, %.lr.ph46 ]
  %80 = icmp sgt i64 %.021.lcssa, -1
  br i1 %80, label %88, label %87

.lr.ph46:                                         ; preds = %.lr.ph46.preheader66, %.lr.ph46
  %indvars.iv55 = phi i64 [ %indvars.iv.next56, %.lr.ph46 ], [ %indvars.iv55.ph, %.lr.ph46.preheader66 ]
  %.02143 = phi i64 [ %86, %.lr.ph46 ], [ %.02143.ph, %.lr.ph46.preheader66 ]
  %81 = getelementptr inbounds [1001000 x i64], ptr @d, i64 0, i64 %indvars.iv55
  %82 = load i64, ptr %81, align 8, !tbaa !9
  %83 = add nsw i64 %82, -1
  %84 = mul nsw i64 %83, %82
  %85 = sdiv i64 %84, 2
  %86 = add nsw i64 %85, %.02143
  %indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
  %exitcond59.not = icmp eq i64 %indvars.iv.next56, %wide.trip.count58
  br i1 %exitcond59.not, label %._crit_edge47, label %.lr.ph46, !llvm.loop !18

87:                                               ; preds = %._crit_edge47
  call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4, i32 noundef 96, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #7
  unreachable

88:                                               ; preds = %._crit_edge47
  %89 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i64 noundef %.021.lcssa)
  br label %90

90:                                               ; preds = %53, %88
  ret i32 0
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 align 2

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

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

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

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12, !16, !17}
!16 = !{!"llvm.loop.isvectorized", i32 1}
!17 = !{!"llvm.loop.unroll.runtime.disable"}
!18 = distinct !{!18, !12, !17, !16}


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