; LLVM IR from tangjz/acm-icpc :: lydsy (1051)

; 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 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@tot = external dso_local global i32, align 4
@scc = external dso_local global [10001 x i32], align 16
@ans = external dso_local global i32, align 4
@g = external dso_local global [10001 x %"class.std::vector"], align 16
@rg = external dso_local global [10001 x %"class.std::vector"], align 16
@seq = external dso_local global %"class.std::vector", align 8
@vis = external dso_local global [10001 x i8], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4dfs1i(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: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

; 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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  br label %12

12:                                               ; preds = %16, %0
  %13 = load i32, ptr @m, align 4, !tbaa !5
  %14 = add nsw i32 %13, -1
  store i32 %14, ptr @m, align 4, !tbaa !5
  %15 = icmp ne i32 %13, 0
  br i1 %15, label %16, label %24

16:                                               ; preds = %12
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2, ptr noundef %3)
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [10001 x %"class.std::vector"], ptr @g, i64 0, i64 %19
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %20, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %21 = load i32, ptr %3, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [10001 x %"class.std::vector"], ptr @rg, i64 0, i64 %22
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %23, ptr noundef nonnull align 4 dereferenceable(4) %2)
  br label %12, !llvm.loop !9

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

25:                                               ; preds = %39, %24
  %26 = load i32, ptr %4, align 4, !tbaa !5
  %27 = load i32, ptr @n, align 4, !tbaa !5
  %28 = icmp sle i32 %26, %27
  br i1 %28, label %30, label %29

29:                                               ; preds = %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  br label %42

30:                                               ; preds = %25
  %31 = load i32, ptr %4, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [10001 x i8], ptr @vis, i64 0, i64 %32
  %34 = load i8, ptr %33, align 1, !tbaa !11, !range !13, !noundef !14
  %35 = trunc i8 %34 to i1
  br i1 %35, label %38, label %36

36:                                               ; preds = %30
  %37 = load i32, ptr %4, align 4, !tbaa !5
  call void @_Z4dfs1i(i32 noundef %37)
  br label %38

38:                                               ; preds = %36, %30
  br label %39

39:                                               ; preds = %38
  %40 = load i32, ptr %4, align 4, !tbaa !5
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %4, align 4, !tbaa !5
  br label %25, !llvm.loop !15

42:                                               ; preds = %29
  call void @llvm.memset.p0.i64(ptr align 16 @vis, i8 0, i64 10001, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  %43 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @seq) #8
  %44 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %6, i32 0, i32 0
  store ptr %43, ptr %44, align 8
  %45 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEmmEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %5, ptr align 8 %45, i64 8, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  br label %46

46:                                               ; preds = %64, %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  %47 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @seq) #8
  %48 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %7, i32 0, i32 0
  store ptr %47, ptr %48, align 8
  %49 = call noundef zeroext i1 @_ZN9__gnu_cxxgeIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  br i1 %49, label %51, label %50

50:                                               ; preds = %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  br label %66

51:                                               ; preds = %46
  %52 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #8
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [10001 x i8], ptr @vis, i64 0, i64 %54
  %56 = load i8, ptr %55, align 1, !tbaa !11, !range !13, !noundef !14
  %57 = trunc i8 %56 to i1
  br i1 %57, label %63, label %58

58:                                               ; preds = %51
  %59 = load i32, ptr @tot, align 4, !tbaa !5
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr @tot, align 4, !tbaa !5
  %61 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #8
  %62 = load i32, ptr %61, align 4, !tbaa !5
  call void @_Z4dfs2i(i32 noundef %62)
  br label %63

63:                                               ; preds = %58, %51
  br label %64

64:                                               ; preds = %63
  %65 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEmmEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #8
  br label %46, !llvm.loop !19

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

67:                                               ; preds = %84, %66
  %68 = load i32, ptr %8, align 4, !tbaa !5
  %69 = load i32, ptr @n, align 4, !tbaa !5
  %70 = icmp sle i32 %68, %69
  br i1 %70, label %72, label %71

71:                                               ; preds = %67
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %87

72:                                               ; preds = %67
  %73 = load i32, ptr %8, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [10001 x i32], ptr @scc, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = load i32, ptr @tot, align 4, !tbaa !5
  %78 = icmp eq i32 %76, %77
  br i1 %78, label %79, label %83

79:                                               ; preds = %72
  %80 = load i32, ptr @ans, align 4, !tbaa !5
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr @ans, align 4, !tbaa !5
  %82 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %82, ptr %2, align 4, !tbaa !5
  br label %83

83:                                               ; preds = %79, %72
  br label %84

84:                                               ; preds = %83
  %85 = load i32, ptr %8, align 4, !tbaa !5
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %8, align 4, !tbaa !5
  br label %67, !llvm.loop !20

87:                                               ; preds = %71
  call void @llvm.memset.p0.i64(ptr align 16 @vis, i8 0, i64 10001, i1 false)
  %88 = load i32, ptr %2, align 4, !tbaa !5
  call void @_Z4dfs2i(i32 noundef %88)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %89

89:                                               ; preds = %102, %87
  %90 = load i32, ptr %9, align 4, !tbaa !5
  %91 = load i32, ptr @n, align 4, !tbaa !5
  %92 = icmp sle i32 %90, %91
  br i1 %92, label %94, label %93

93:                                               ; preds = %89
  store i32 13, ptr %10, align 4
  br label %105

94:                                               ; preds = %89
  %95 = load i32, ptr %9, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [10001 x i8], ptr @vis, i64 0, i64 %96
  %98 = load i8, ptr %97, align 1, !tbaa !11, !range !13, !noundef !14
  %99 = trunc i8 %98 to i1
  br i1 %99, label %101, label %100

100:                                              ; preds = %94
  store i32 0, ptr @ans, align 4, !tbaa !5
  store i32 13, ptr %10, align 4
  br label %105

101:                                              ; preds = %94
  br label %102

102:                                              ; preds = %101
  %103 = load i32, ptr %9, align 4, !tbaa !5
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %9, align 4, !tbaa !5
  br label %89, !llvm.loop !21

105:                                              ; preds = %100, %93
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %106

106:                                              ; preds = %105
  %107 = load i32, ptr @ans, align 4, !tbaa !5
  %108 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %107)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  %109 = load i32, ptr %1, align 4
  ret i32 %109
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEmmEv(ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxgeIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #7

declare i32 @printf(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 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 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 #4 = { "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 nounwind willreturn memory(argmem: write) }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { 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 #8 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !10}
!16 = !{i64 0, i64 8, !17}
!17 = !{!18, !18, i64 0}
!18 = !{!"any pointer", !7, i64 0}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}


; 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 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@tot = external dso_local local_unnamed_addr global i32, align 4
@scc = external dso_local local_unnamed_addr global [10001 x i32], align 16
@ans = external dso_local local_unnamed_addr global i32, align 4
@g = external dso_local global [10001 x %"class.std::vector"], align 16
@rg = external dso_local global [10001 x %"class.std::vector"], align 16
@seq = external dso_local global %"class.std::vector", align 8
@vis = external dso_local local_unnamed_addr global [10001 x i8], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4dfs1i(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 nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; 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 nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

; 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: mustprogress uwtable
declare dso_local void @_Z4dfs2i(i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %7 = load i32, ptr @m, align 4, !tbaa !5
  %8 = add nsw i32 %7, -1
  store i32 %8, ptr @m, align 4, !tbaa !5
  %.not17 = icmp eq i32 %7, 0
  br i1 %.not17, label %.preheader, label %.lr.ph

.preheader:                                       ; preds = %.lr.ph, %0
  %9 = load i32, ptr @n, align 4, !tbaa !5
  %.not1418 = icmp slt i32 %9, 1
  br i1 %.not1418, label %._crit_edge, label %.lr.ph20

.lr.ph:                                           ; preds = %0, %.lr.ph
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %11 = load i32, ptr %1, align 4, !tbaa !5
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds [10001 x %"class.std::vector"], ptr @g, i64 0, i64 %12
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %13, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds [10001 x %"class.std::vector"], ptr @rg, i64 0, i64 %15
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %16, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %17 = load i32, ptr @m, align 4, !tbaa !5
  %18 = add nsw i32 %17, -1
  store i32 %18, ptr @m, align 4, !tbaa !5
  %.not = icmp eq i32 %17, 0
  br i1 %.not, label %.preheader, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %30, %.preheader
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(10001) @vis, i8 0, i64 10001, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %19 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @seq) #7
  store ptr %19, ptr %4, align 8
  %20 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEmmEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  %21 = load i64, ptr %20, align 8, !tbaa !11
  store i64 %21, ptr %3, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %22 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @seq) #7
  store ptr %22, ptr %5, align 8
  %23 = call noundef zeroext i1 @_ZN9__gnu_cxxgeIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  br i1 %23, label %.lr.ph22, label %._crit_edge23

.lr.ph20:                                         ; preds = %.preheader, %30
  %24 = phi i32 [ %31, %30 ], [ %9, %.preheader ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %30 ], [ 1, %.preheader ]
  %25 = getelementptr inbounds [10001 x i8], ptr @vis, i64 0, i64 %indvars.iv
  %26 = load i8, ptr %25, align 1, !tbaa !13, !range !15, !noundef !16
  %27 = trunc nuw i8 %26 to i1
  br i1 %27, label %30, label %28

28:                                               ; preds = %.lr.ph20
  %29 = trunc nuw nsw i64 %indvars.iv to i32
  call void @_Z4dfs1i(i32 noundef %29)
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %.lr.ph20, %28
  %31 = phi i32 [ %24, %.lr.ph20 ], [ %.pre, %28 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %32 = sext i32 %31 to i64
  %.not14.not = icmp slt i64 %indvars.iv, %32
  br i1 %.not14.not, label %.lr.ph20, label %._crit_edge, !llvm.loop !17

._crit_edge23:                                    ; preds = %48, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  %33 = load i32, ptr @n, align 4, !tbaa !5
  %.not1524 = icmp slt i32 %33, 1
  br i1 %.not1524, label %._crit_edge28, label %.lr.ph27

.lr.ph27:                                         ; preds = %._crit_edge23
  %ans.promoted = load i32, ptr @ans, align 4, !tbaa !5
  %34 = load i32, ptr @tot, align 4, !tbaa !5
  %35 = zext nneg i32 %33 to i64
  %xtraiter = and i64 %35, 1
  %36 = icmp eq i32 %33, 1
  br i1 %36, label %._crit_edge28.loopexit.unr-lcssa, label %.lr.ph27.new

.lr.ph27.new:                                     ; preds = %.lr.ph27
  %unroll_iter = and i64 %35, 2147483646
  br label %61

.lr.ph22:                                         ; preds = %._crit_edge, %48
  %37 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #7
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [10001 x i8], ptr @vis, i64 0, i64 %39
  %41 = load i8, ptr %40, align 1, !tbaa !13, !range !15, !noundef !16
  %42 = trunc nuw i8 %41 to i1
  br i1 %42, label %48, label %43

43:                                               ; preds = %.lr.ph22
  %44 = load i32, ptr @tot, align 4, !tbaa !5
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr @tot, align 4, !tbaa !5
  %46 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #7
  %47 = load i32, ptr %46, align 4, !tbaa !5
  call void @_Z4dfs2i(i32 noundef %47)
  br label %48

48:                                               ; preds = %.lr.ph22, %43
  %49 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEmmEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %50 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @seq) #7
  store ptr %50, ptr %5, align 8
  %51 = call noundef zeroext i1 @_ZN9__gnu_cxxgeIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  br i1 %51, label %.lr.ph22, label %._crit_edge23, !llvm.loop !18

._crit_edge28.loopexit.unr-lcssa:                 ; preds = %77, %.lr.ph27
  %indvars.iv34.unr = phi i64 [ 1, %.lr.ph27 ], [ %indvars.iv.next35.1, %77 ]
  %.unr = phi i32 [ %ans.promoted, %.lr.ph27 ], [ %78, %77 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge28, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge28.loopexit.unr-lcssa
  %52 = getelementptr inbounds [10001 x i32], ptr @scc, i64 0, i64 %indvars.iv34.unr
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = icmp eq i32 %53, %34
  br i1 %54, label %55, label %._crit_edge28

55:                                               ; preds = %.epil.preheader
  %56 = add nsw i32 %.unr, 1
  store i32 %56, ptr @ans, align 4, !tbaa !5
  %57 = trunc nuw nsw i64 %indvars.iv34.unr to i32
  store i32 %57, ptr %1, align 4, !tbaa !5
  br label %._crit_edge28

._crit_edge28:                                    ; preds = %._crit_edge28.loopexit.unr-lcssa, %55, %.epil.preheader, %._crit_edge23
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(10001) @vis, i8 0, i64 10001, i1 false)
  %58 = load i32, ptr %1, align 4, !tbaa !5
  call void @_Z4dfs2i(i32 noundef %58)
  %59 = load i32, ptr @n, align 4, !tbaa !5
  %.not1629 = icmp slt i32 %59, 1
  br i1 %.not1629, label %.loopexit, label %.lr.ph32.preheader

.lr.ph32.preheader:                               ; preds = %._crit_edge28
  %60 = add nuw i32 %59, 1
  %wide.trip.count40 = zext i32 %60 to i64
  br label %.lr.ph32

61:                                               ; preds = %77, %.lr.ph27.new
  %indvars.iv34 = phi i64 [ 1, %.lr.ph27.new ], [ %indvars.iv.next35.1, %77 ]
  %62 = phi i32 [ %ans.promoted, %.lr.ph27.new ], [ %78, %77 ]
  %niter = phi i64 [ 0, %.lr.ph27.new ], [ %niter.next.1, %77 ]
  %63 = getelementptr inbounds [10001 x i32], ptr @scc, i64 0, i64 %indvars.iv34
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = icmp eq i32 %64, %34
  br i1 %65, label %66, label %69

66:                                               ; preds = %61
  %67 = add nsw i32 %62, 1
  store i32 %67, ptr @ans, align 4, !tbaa !5
  %68 = trunc nuw nsw i64 %indvars.iv34 to i32
  store i32 %68, ptr %1, align 4, !tbaa !5
  br label %69

69:                                               ; preds = %61, %66
  %70 = phi i32 [ %62, %61 ], [ %67, %66 ]
  %indvars.iv.next35 = add nuw nsw i64 %indvars.iv34, 1
  %71 = getelementptr inbounds [10001 x i32], ptr @scc, i64 0, i64 %indvars.iv.next35
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = icmp eq i32 %72, %34
  br i1 %73, label %74, label %77

74:                                               ; preds = %69
  %75 = add nsw i32 %70, 1
  store i32 %75, ptr @ans, align 4, !tbaa !5
  %76 = trunc nuw nsw i64 %indvars.iv.next35 to i32
  store i32 %76, ptr %1, align 4, !tbaa !5
  br label %77

77:                                               ; preds = %74, %69
  %78 = phi i32 [ %70, %69 ], [ %75, %74 ]
  %indvars.iv.next35.1 = add nuw nsw i64 %indvars.iv34, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge28.loopexit.unr-lcssa, label %61, !llvm.loop !19

79:                                               ; preds = %.lr.ph32
  %indvars.iv.next38 = add nuw nsw i64 %indvars.iv37, 1
  %exitcond41.not = icmp eq i64 %indvars.iv.next38, %wide.trip.count40
  br i1 %exitcond41.not, label %.loopexit, label %.lr.ph32, !llvm.loop !20

.lr.ph32:                                         ; preds = %.lr.ph32.preheader, %79
  %indvars.iv37 = phi i64 [ 1, %.lr.ph32.preheader ], [ %indvars.iv.next38, %79 ]
  %80 = getelementptr inbounds [10001 x i8], ptr @vis, i64 0, i64 %indvars.iv37
  %81 = load i8, ptr %80, align 1, !tbaa !13, !range !15, !noundef !16
  %82 = trunc nuw i8 %81 to i1
  br i1 %82, label %79, label %83

83:                                               ; preds = %.lr.ph32
  store i32 0, ptr @ans, align 4, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %79, %._crit_edge28, %83
  %84 = load i32, ptr @ans, align 4, !tbaa !5
  %85 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %84)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret i32 0
}

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxgeIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #6

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 #4 = { 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 #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}


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