; LLVM IR from INMOST-DEV/INMOST-FEM :: anifem++/fem/tetdofmap.ll (ZNK3Ani4DofT13ComplexDofMap12NumDofsOnTetEv)

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

%"struct.std::array.2" = type { [6 x i32] }
%"struct.Ani::DofT::ComplexDofMap" = type { %"struct.Ani::DofT::BaseDofMap", %"class.std::vector", %"struct.std::array.8", %"struct.std::array.8", %"class.std::vector.9" }
%"struct.Ani::DofT::BaseDofMap" = type { ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::shared_ptr<Ani::DofT::BaseDofMap>, std::allocator<std::shared_ptr<Ani::DofT::BaseDofMap>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::shared_ptr<Ani::DofT::BaseDofMap>, std::allocator<std::shared_ptr<Ani::DofT::BaseDofMap>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::shared_ptr<Ani::DofT::BaseDofMap>, std::allocator<std::shared_ptr<Ani::DofT::BaseDofMap>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::shared_ptr<Ani::DofT::BaseDofMap>, std::allocator<std::shared_ptr<Ani::DofT::BaseDofMap>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::array.8" = type { [6 x %"class.std::vector.9"] }
%"class.std::vector.9" = type { %"struct.std::_Vector_base.10" }
%"struct.std::_Vector_base.10" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

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

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

; 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: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24), i64 noundef) #2 align 2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZNK3Ani4DofT13ComplexDofMap12NumDofsOnTetEv(ptr dead_on_unwind noalias writable sret(%"struct.std::array.2") align 4 %0, ptr noundef nonnull align 8 dereferenceable(344) %1) unnamed_addr #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %1, ptr %3, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8
  call void @llvm.memset.p0.i64(ptr align 4 %0, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %6

6:                                                ; preds = %29, %2
  %7 = load i32, ptr %4, align 4, !tbaa !9
  %8 = icmp slt i32 %7, 6
  br i1 %8, label %10, label %9

9:                                                ; preds = %6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  br label %32

10:                                               ; preds = %6
  %11 = getelementptr inbounds %"struct.Ani::DofT::ComplexDofMap", ptr %5, i32 0, i32 2
  %12 = load i32, ptr %4, align 4, !tbaa !9
  %13 = sext i32 %12 to i64
  %14 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt5arrayISt6vectorIjSaIjEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(144) %11, i64 noundef %13) #3
  %15 = getelementptr inbounds %"struct.Ani::DofT::ComplexDofMap", ptr %5, i32 0, i32 1
  %16 = call noundef i64 @_ZNKSt6vectorISt10shared_ptrIN3Ani4DofT10BaseDofMapEESaIS4_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %15) #3
  %17 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %14, i64 noundef %16) #3
  %18 = load i32, ptr %17, align 4, !tbaa !9
  %19 = getelementptr inbounds %"struct.Ani::DofT::ComplexDofMap", ptr %5, i32 0, i32 2
  %20 = load i32, ptr %4, align 4, !tbaa !9
  %21 = sext i32 %20 to i64
  %22 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt5arrayISt6vectorIjSaIjEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(144) %19, i64 noundef %21) #3
  %23 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %22, i64 noundef 0) #3
  %24 = load i32, ptr %23, align 4, !tbaa !9
  %25 = sub i32 %18, %24
  %26 = load i32, ptr %4, align 4, !tbaa !9
  %27 = sext i32 %26 to i64
  %28 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24) %0, i64 noundef %27) #3
  store i32 %25, ptr %28, align 4, !tbaa !9
  br label %29

29:                                               ; preds = %10
  %30 = load i32, ptr %4, align 4, !tbaa !9
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr %4, align 4, !tbaa !9
  br label %6, !llvm.loop !11

32:                                               ; preds = %9
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"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"

%"struct.std::array.2" = type { [6 x i32] }

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt5arrayISt6vectorIjSaIjEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(144), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZNK3Ani4DofT13ComplexDofMap12NumDofsOnTetEv(ptr dead_on_unwind noalias writable sret(%"struct.std::array.2") align 4 %0, ptr noundef nonnull align 8 dereferenceable(344) %1) unnamed_addr #1 align 2 {
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(24) %0, i8 0, i64 24, i1 false)
  %3 = getelementptr inbounds i8, ptr %1, i64 32
  %4 = getelementptr inbounds i8, ptr %1, i64 8
  %5 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt5arrayISt6vectorIjSaIjEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(144) %3, i64 noundef 0) #2
  %6 = tail call noundef i64 @_ZNKSt6vectorISt10shared_ptrIN3Ani4DofT10BaseDofMapEESaIS4_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #2
  %7 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %6) #2
  %8 = load i32, ptr %7, align 4, !tbaa !5
  %9 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt5arrayISt6vectorIjSaIjEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(144) %3, i64 noundef 0) #2
  %10 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef 0) #2
  %11 = load i32, ptr %10, align 4, !tbaa !5
  %12 = sub i32 %8, %11
  %13 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24) %0, i64 noundef 0) #2
  store i32 %12, ptr %13, align 4, !tbaa !5
  %14 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt5arrayISt6vectorIjSaIjEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(144) %3, i64 noundef 1) #2
  %15 = tail call noundef i64 @_ZNKSt6vectorISt10shared_ptrIN3Ani4DofT10BaseDofMapEESaIS4_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #2
  %16 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %14, i64 noundef %15) #2
  %17 = load i32, ptr %16, align 4, !tbaa !5
  %18 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt5arrayISt6vectorIjSaIjEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(144) %3, i64 noundef 1) #2
  %19 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %18, i64 noundef 0) #2
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = sub i32 %17, %20
  %22 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24) %0, i64 noundef 1) #2
  store i32 %21, ptr %22, align 4, !tbaa !5
  %23 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt5arrayISt6vectorIjSaIjEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(144) %3, i64 noundef 2) #2
  %24 = tail call noundef i64 @_ZNKSt6vectorISt10shared_ptrIN3Ani4DofT10BaseDofMapEESaIS4_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #2
  %25 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %23, i64 noundef %24) #2
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt5arrayISt6vectorIjSaIjEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(144) %3, i64 noundef 2) #2
  %28 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %27, i64 noundef 0) #2
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = sub i32 %26, %29
  %31 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24) %0, i64 noundef 2) #2
  store i32 %30, ptr %31, align 4, !tbaa !5
  %32 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt5arrayISt6vectorIjSaIjEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(144) %3, i64 noundef 3) #2
  %33 = tail call noundef i64 @_ZNKSt6vectorISt10shared_ptrIN3Ani4DofT10BaseDofMapEESaIS4_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #2
  %34 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %32, i64 noundef %33) #2
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt5arrayISt6vectorIjSaIjEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(144) %3, i64 noundef 3) #2
  %37 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %36, i64 noundef 0) #2
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = sub i32 %35, %38
  %40 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24) %0, i64 noundef 3) #2
  store i32 %39, ptr %40, align 4, !tbaa !5
  %41 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt5arrayISt6vectorIjSaIjEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(144) %3, i64 noundef 4) #2
  %42 = tail call noundef i64 @_ZNKSt6vectorISt10shared_ptrIN3Ani4DofT10BaseDofMapEESaIS4_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #2
  %43 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %41, i64 noundef %42) #2
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt5arrayISt6vectorIjSaIjEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(144) %3, i64 noundef 4) #2
  %46 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %45, i64 noundef 0) #2
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = sub i32 %44, %47
  %49 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24) %0, i64 noundef 4) #2
  store i32 %48, ptr %49, align 4, !tbaa !5
  %50 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt5arrayISt6vectorIjSaIjEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(144) %3, i64 noundef 5) #2
  %51 = tail call noundef i64 @_ZNKSt6vectorISt10shared_ptrIN3Ani4DofT10BaseDofMapEESaIS4_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #2
  %52 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %50, i64 noundef %51) #2
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt5arrayISt6vectorIjSaIjEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(144) %3, i64 noundef 5) #2
  %55 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %54, i64 noundef 0) #2
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = sub i32 %53, %56
  %58 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24) %0, i64 noundef 5) #2
  store i32 %57, ptr %58, align 4, !tbaa !5
  ret void
}

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { 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 #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,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,SROAPass,SimplifyCFGPass,TailCallElimPass