; LLVM IR from sunkafei/xcpc-algorithm-templates :: 算法/字符串算法/非势能分析回文自动机.ll (ZN21Palindromic_Tree_Back4initEv)

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

@_ZN21Palindromic_Tree_Back4infoE = external dso_local global [300007 x i32], align 16
@_ZN21Palindromic_Tree_Back2chE = external dso_local global [300007 x [26 x i32]], align 16
@_ZN21Palindromic_Tree_Back5quickE = external dso_local global [300007 x [26 x i32]], align 16
@_ZN21Palindromic_Tree_Back4failE = external dso_local global [300007 x i32], align 16
@_ZN21Palindromic_Tree_Back3lenE = external dso_local global [300007 x i32], align 16
@_ZN21Palindromic_Tree_Back4lastE = external dso_local global i32, align 4
@_ZN21Palindromic_Tree_Back3curE = external dso_local global i32, align 4
@_ZN21Palindromic_Tree_Back2szE = external dso_local global i32, align 4
@_ZN21Palindromic_Tree_Back4nodeE = external dso_local global %"class.std::vector", align 8

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN21Palindromic_Tree_Back4initEv() #0 {
  %1 = alloca i32, align 4
  call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @_ZN21Palindromic_Tree_Back4nodeE) #3
  call void @llvm.memset.p0.i64(ptr align 16 @_ZN21Palindromic_Tree_Back2chE, i8 0, i64 520, i1 false)
  store i32 1, ptr @_ZN21Palindromic_Tree_Back4failE, align 16, !tbaa !5
  store i32 -1, ptr getelementptr inbounds ([300007 x i32], ptr @_ZN21Palindromic_Tree_Back3lenE, i64 0, i64 1), align 4, !tbaa !5
  store i32 -1, ptr @_ZN21Palindromic_Tree_Back4infoE, align 16, !tbaa !5
  store i32 1, ptr @_ZN21Palindromic_Tree_Back4lastE, align 4, !tbaa !5
  store i32 1, ptr @_ZN21Palindromic_Tree_Back3curE, align 4, !tbaa !5
  store i32 0, ptr @_ZN21Palindromic_Tree_Back2szE, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #3
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %2

2:                                                ; preds = %13, %0
  %3 = load i32, ptr %1, align 4, !tbaa !5
  %4 = icmp slt i32 %3, 26
  br i1 %4, label %6, label %5

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

6:                                                ; preds = %2
  %7 = load i32, ptr %1, align 4, !tbaa !5
  %8 = sext i32 %7 to i64
  %9 = getelementptr inbounds [26 x i32], ptr @_ZN21Palindromic_Tree_Back5quickE, i64 0, i64 %8
  store i32 1, ptr %9, align 4, !tbaa !5
  %10 = load i32, ptr %1, align 4, !tbaa !5
  %11 = sext i32 %10 to i64
  %12 = getelementptr inbounds [26 x i32], ptr getelementptr inbounds ([300007 x [26 x i32]], ptr @_ZN21Palindromic_Tree_Back5quickE, i64 0, i64 1), i64 0, i64 %11
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %13

13:                                               ; preds = %6
  %14 = load i32, ptr %1, align 4, !tbaa !5
  %15 = add nsw i32 %14, 1
  store i32 %15, ptr %1, align 4, !tbaa !5
  br label %2, !llvm.loop !9

16:                                               ; preds = %5
  ret void
}

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

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

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

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

attributes #0 = { 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 #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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"}


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

@_ZN21Palindromic_Tree_Back4infoE = external dso_local local_unnamed_addr global [300007 x i32], align 16
@_ZN21Palindromic_Tree_Back2chE = external dso_local local_unnamed_addr global [300007 x [26 x i32]], align 16
@_ZN21Palindromic_Tree_Back5quickE = external dso_local local_unnamed_addr global [300007 x [26 x i32]], align 16
@_ZN21Palindromic_Tree_Back4failE = external dso_local local_unnamed_addr global [300007 x i32], align 16
@_ZN21Palindromic_Tree_Back3lenE = external dso_local local_unnamed_addr global [300007 x i32], align 16
@_ZN21Palindromic_Tree_Back4lastE = external dso_local local_unnamed_addr global i32, align 4
@_ZN21Palindromic_Tree_Back3curE = external dso_local local_unnamed_addr global i32, align 4
@_ZN21Palindromic_Tree_Back2szE = external dso_local local_unnamed_addr global i32, align 4
@_ZN21Palindromic_Tree_Back4nodeE = external dso_local global %"class.std::vector", align 8

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN21Palindromic_Tree_Back4initEv() local_unnamed_addr #0 {
  tail call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @_ZN21Palindromic_Tree_Back4nodeE) #2
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(520) @_ZN21Palindromic_Tree_Back2chE, i8 0, i64 520, i1 false)
  store i32 1, ptr @_ZN21Palindromic_Tree_Back4failE, align 16, !tbaa !5
  store i32 -1, ptr getelementptr inbounds (i8, ptr @_ZN21Palindromic_Tree_Back3lenE, i64 4), align 4, !tbaa !5
  store i32 -1, ptr @_ZN21Palindromic_Tree_Back4infoE, align 16, !tbaa !5
  store i32 1, ptr @_ZN21Palindromic_Tree_Back4lastE, align 4, !tbaa !5
  store i32 1, ptr @_ZN21Palindromic_Tree_Back3curE, align 4, !tbaa !5
  store i32 0, ptr @_ZN21Palindromic_Tree_Back2szE, align 4, !tbaa !5
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr @_ZN21Palindromic_Tree_Back5quickE, align 16, !tbaa !5
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr getelementptr inbounds (i8, ptr @_ZN21Palindromic_Tree_Back5quickE, i64 112), align 16, !tbaa !5
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr getelementptr inbounds (i8, ptr @_ZN21Palindromic_Tree_Back5quickE, i64 16), align 16, !tbaa !5
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr getelementptr inbounds (i8, ptr @_ZN21Palindromic_Tree_Back5quickE, i64 128), align 16, !tbaa !5
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr getelementptr inbounds (i8, ptr @_ZN21Palindromic_Tree_Back5quickE, i64 32), align 16, !tbaa !5
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr getelementptr inbounds (i8, ptr @_ZN21Palindromic_Tree_Back5quickE, i64 144), align 16, !tbaa !5
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr getelementptr inbounds (i8, ptr @_ZN21Palindromic_Tree_Back5quickE, i64 48), align 16, !tbaa !5
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr getelementptr inbounds (i8, ptr @_ZN21Palindromic_Tree_Back5quickE, i64 160), align 16, !tbaa !5
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr getelementptr inbounds (i8, ptr @_ZN21Palindromic_Tree_Back5quickE, i64 64), align 16, !tbaa !5
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr getelementptr inbounds (i8, ptr @_ZN21Palindromic_Tree_Back5quickE, i64 176), align 16, !tbaa !5
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr getelementptr inbounds (i8, ptr @_ZN21Palindromic_Tree_Back5quickE, i64 80), align 16, !tbaa !5
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr getelementptr inbounds (i8, ptr @_ZN21Palindromic_Tree_Back5quickE, i64 96), align 16, !tbaa !5
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr getelementptr inbounds (i8, ptr @_ZN21Palindromic_Tree_Back5quickE, i64 192), align 16, !tbaa !5
  ret void
}

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

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { 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"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass