; LLVM IR from INMOST-DEV/INMOST-FEM :: anifem++/fem (fem_space)

; 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.Ani::DofT::DofSparsedIterator" = type <{ %"struct.Ani::DofT::TetGeomSparsity", %"struct.Ani::DofT::LocalOrder", ptr, i8, [7 x i8] }>
%"struct.Ani::DofT::TetGeomSparsity" = type { %"struct.std::array" }
%"struct.std::array" = type { [4 x i8] }
%"struct.Ani::DofT::LocalOrder" = type { i32, i32, i8, i8, i8, i8 }
%"struct.Ani::PlainMemoryX" = type { ptr, ptr, ptr, i64, i64, i64 }
%"struct.Ani::ArrayView" = type { ptr, i64 }
%"struct.Ani::BaseFemSpace" = type { ptr, %"struct.Ani::DofT::DofMap" }
%"struct.Ani::DofT::DofMap" = type { %"class.std::shared_ptr" }
%"class.std::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK3Ani4DofT6DofMap15beginBySparsityERKNS0_15TetGeomSparsityEb(ptr dead_on_unwind noalias writable sret(%"struct.Ani::DofT::DofSparsedIterator") align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(4), i1 noundef zeroext) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK3Ani4DofT18DofSparsedIteratorneERKS1_(ptr noundef nonnull align 8 dereferenceable(25), ptr noundef nonnull align 8 dereferenceable(25)) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK3Ani4DofT6DofMap13endBySparsityEv(ptr dead_on_unwind noalias writable sret(%"struct.Ani::DofT::DofSparsedIterator") align 8, ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(25) ptr @_ZN3Ani4DofT18DofSparsedIteratorppEv(ptr noundef nonnull align 8 dereferenceable(25)) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3Ani12BaseFemSpace17interpolateByDOFsERKNS_5TetraIKdEERKPFiRKSt5arrayIdLm3EEPdjPvENS_9ArrayViewIdEERKNS_4DofT15TetGeomSparsityENS_12PlainMemoryXIdiEESB_j(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(132) %1, ptr noundef nonnull align 8 dereferenceable(8) %2, ptr %3, i64 %4, ptr noundef nonnull align 1 dereferenceable(4) %5, ptr noundef byval(%"struct.Ani::PlainMemoryX") align 8 %6, ptr noundef %7, i32 noundef %8) unnamed_addr #3 align 2 {
  %10 = alloca %"struct.Ani::ArrayView", align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca %"struct.Ani::DofT::DofSparsedIterator", align 8
  %18 = alloca %"struct.Ani::DofT::DofSparsedIterator", align 8
  %19 = alloca %"struct.Ani::ArrayView", align 8
  %20 = alloca %"struct.Ani::PlainMemoryX", align 8
  %21 = getelementptr inbounds { ptr, i64 }, ptr %10, i32 0, i32 0
  store ptr %3, ptr %21, align 8
  %22 = getelementptr inbounds { ptr, i64 }, ptr %10, i32 0, i32 1
  store i64 %4, ptr %22, align 8
  store ptr %0, ptr %11, align 8, !tbaa !5
  store ptr %1, ptr %12, align 8, !tbaa !5
  store ptr %2, ptr %13, align 8, !tbaa !5
  store ptr %5, ptr %14, align 8, !tbaa !5
  store ptr %7, ptr %15, align 8, !tbaa !5
  store i32 %8, ptr %16, align 4, !tbaa !9
  %23 = load ptr, ptr %11, align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr %17) #5
  %24 = getelementptr inbounds %"struct.Ani::BaseFemSpace", ptr %23, i32 0, i32 1
  %25 = load ptr, ptr %14, align 8, !tbaa !5
  call void @_ZNK3Ani4DofT6DofMap15beginBySparsityERKNS0_15TetGeomSparsityEb(ptr dead_on_unwind writable sret(%"struct.Ani::DofT::DofSparsedIterator") align 8 %17, ptr noundef nonnull align 8 dereferenceable(16) %24, ptr noundef nonnull align 1 dereferenceable(4) %25, i1 noundef zeroext false)
  br label %26

26:                                               ; preds = %42, %9
  call void @llvm.lifetime.start.p0(i64 32, ptr %18) #5
  %27 = getelementptr inbounds %"struct.Ani::BaseFemSpace", ptr %23, i32 0, i32 1
  call void @_ZNK3Ani4DofT6DofMap13endBySparsityEv(ptr dead_on_unwind writable sret(%"struct.Ani::DofT::DofSparsedIterator") align 8 %18, ptr noundef nonnull align 8 dereferenceable(16) %27)
  %28 = call noundef zeroext i1 @_ZNK3Ani4DofT18DofSparsedIteratorneERKS1_(ptr noundef nonnull align 8 dereferenceable(25) %17, ptr noundef nonnull align 8 dereferenceable(25) %18)
  call void @llvm.lifetime.end.p0(i64 32, ptr %18) #5
  br i1 %28, label %30, label %29

29:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 32, ptr %17) #5
  br label %44

30:                                               ; preds = %26
  %31 = load ptr, ptr %12, align 8, !tbaa !5
  %32 = load ptr, ptr %13, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %19, ptr align 8 %10, i64 16, i1 false), !tbaa.struct !11
  %33 = call noundef ptr @_ZNK3Ani4DofT18DofSparsedIteratorptEv(ptr noundef nonnull align 8 dereferenceable(25) %17)
  %34 = getelementptr inbounds %"struct.Ani::DofT::LocalOrder", ptr %33, i32 0, i32 0
  %35 = load i32, ptr %34, align 4, !tbaa !14
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %20, ptr align 8 %6, i64 48, i1 false), !tbaa.struct !16
  %36 = load ptr, ptr %15, align 8, !tbaa !5
  %37 = load i32, ptr %16, align 4, !tbaa !9
  %38 = getelementptr inbounds { ptr, i64 }, ptr %19, i32 0, i32 0
  %39 = load ptr, ptr %38, align 8
  %40 = getelementptr inbounds { ptr, i64 }, ptr %19, i32 0, i32 1
  %41 = load i64, ptr %40, align 8
  call void @_ZNK3Ani12BaseFemSpace16interpolateOnDOFERKNS_5TetraIKdEERKPFiRKSt5arrayIdLm3EEPdjPvENS_9ArrayViewIdEEiNS_12PlainMemoryXIdiEESB_j(ptr noundef nonnull align 8 dereferenceable(24) %23, ptr noundef nonnull align 8 dereferenceable(132) %31, ptr noundef nonnull align 8 dereferenceable(8) %32, ptr %39, i64 %41, i32 noundef %35, ptr noundef byval(%"struct.Ani::PlainMemoryX") align 8 %20, ptr noundef %36, i32 noundef %37)
  br label %42

42:                                               ; preds = %30
  %43 = call noundef nonnull align 8 dereferenceable(25) ptr @_ZN3Ani4DofT18DofSparsedIteratorppEv(ptr noundef nonnull align 8 dereferenceable(25) %17)
  br label %26, !llvm.loop !17

44:                                               ; preds = %29
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3Ani12BaseFemSpace16interpolateOnDOFERKNS_5TetraIKdEERKPFiRKSt5arrayIdLm3EEPdjPvENS_9ArrayViewIdEEiNS_12PlainMemoryXIdiEESB_j(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(132), ptr noundef nonnull align 8 dereferenceable(8), ptr, i64, i32 noundef, ptr noundef byval(%"struct.Ani::PlainMemoryX") align 8, ptr noundef, i32 noundef) #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint 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 #3 = { 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 #4 = { 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 #5 = { 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 = !{i64 0, i64 8, !5, i64 8, i64 8, !12}
!12 = !{!13, !13, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!15, !10, i64 0}
!15 = !{!"_ZTSN3Ani4DofT10LocalOrderE", !10, i64 0, !10, i64 4, !7, i64 8, !7, i64 9, !7, i64 10, !7, i64 11}
!16 = !{i64 0, i64 8, !5, i64 8, i64 8, !5, i64 16, i64 8, !5, i64 24, i64 8, !12, i64 32, i64 8, !12, i64 40, i64 8, !12}
!17 = distinct !{!17, !18}
!18 = !{!"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.Ani::DofT::DofSparsedIterator" = type <{ %"struct.Ani::DofT::TetGeomSparsity", %"struct.Ani::DofT::LocalOrder", ptr, i8, [7 x i8] }>
%"struct.Ani::DofT::TetGeomSparsity" = type { %"struct.std::array" }
%"struct.std::array" = type { [4 x i8] }
%"struct.Ani::DofT::LocalOrder" = type { i32, i32, i8, i8, i8, i8 }
%"struct.Ani::PlainMemoryX" = type { ptr, ptr, ptr, i64, i64, i64 }

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK3Ani4DofT6DofMap15beginBySparsityERKNS0_15TetGeomSparsityEb(ptr dead_on_unwind noalias writable sret(%"struct.Ani::DofT::DofSparsedIterator") align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(4), i1 noundef zeroext) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK3Ani4DofT18DofSparsedIteratorneERKS1_(ptr noundef nonnull align 8 dereferenceable(25), ptr noundef nonnull align 8 dereferenceable(25)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK3Ani4DofT6DofMap13endBySparsityEv(ptr dead_on_unwind noalias writable sret(%"struct.Ani::DofT::DofSparsedIterator") align 8, ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3Ani12BaseFemSpace17interpolateByDOFsERKNS_5TetraIKdEERKPFiRKSt5arrayIdLm3EEPdjPvENS_9ArrayViewIdEERKNS_4DofT15TetGeomSparsityENS_12PlainMemoryXIdiEESB_j(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(132) %1, ptr noundef nonnull align 8 dereferenceable(8) %2, ptr %3, i64 %4, ptr noundef nonnull align 1 dereferenceable(4) %5, ptr nocapture noundef readonly byval(%"struct.Ani::PlainMemoryX") align 8 %6, ptr noundef %7, i32 noundef %8) unnamed_addr #2 align 2 {
  %10 = alloca %"struct.Ani::DofT::DofSparsedIterator", align 8
  %11 = alloca %"struct.Ani::DofT::DofSparsedIterator", align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %10) #4
  %12 = getelementptr inbounds i8, ptr %0, i64 8
  call void @_ZNK3Ani4DofT6DofMap15beginBySparsityERKNS0_15TetGeomSparsityEb(ptr dead_on_unwind nonnull writable sret(%"struct.Ani::DofT::DofSparsedIterator") align 8 %10, ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 1 dereferenceable(4) %5, i1 noundef zeroext false)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %11) #4
  call void @_ZNK3Ani4DofT6DofMap13endBySparsityEv(ptr dead_on_unwind nonnull writable sret(%"struct.Ani::DofT::DofSparsedIterator") align 8 %11, ptr noundef nonnull align 8 dereferenceable(16) %12)
  %13 = call noundef zeroext i1 @_ZNK3Ani4DofT18DofSparsedIteratorneERKS1_(ptr noundef nonnull align 8 dereferenceable(25) %10, ptr noundef nonnull align 8 dereferenceable(25) %11)
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %11) #4
  br i1 %13, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %9
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %10) #4
  ret void

.lr.ph:                                           ; preds = %9, %.lr.ph
  %14 = call noundef ptr @_ZNK3Ani4DofT18DofSparsedIteratorptEv(ptr noundef nonnull align 8 dereferenceable(25) %10)
  %15 = load i32, ptr %14, align 4, !tbaa !5
  call void @_ZNK3Ani12BaseFemSpace16interpolateOnDOFERKNS_5TetraIKdEERKPFiRKSt5arrayIdLm3EEPdjPvENS_9ArrayViewIdEEiNS_12PlainMemoryXIdiEESB_j(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(132) %1, ptr noundef nonnull align 8 dereferenceable(8) %2, ptr %3, i64 %4, i32 noundef %15, ptr noundef nonnull byval(%"struct.Ani::PlainMemoryX") align 8 %6, ptr noundef %7, i32 noundef %8)
  %16 = call noundef nonnull align 8 dereferenceable(25) ptr @_ZN3Ani4DofT18DofSparsedIteratorppEv(ptr noundef nonnull align 8 dereferenceable(25) %10)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %11) #4
  call void @_ZNK3Ani4DofT6DofMap13endBySparsityEv(ptr dead_on_unwind nonnull writable sret(%"struct.Ani::DofT::DofSparsedIterator") align 8 %11, ptr noundef nonnull align 8 dereferenceable(16) %12)
  %17 = call noundef zeroext i1 @_ZNK3Ani4DofT18DofSparsedIteratorneERKS1_(ptr noundef nonnull align 8 dereferenceable(25) %10, ptr noundef nonnull align 8 dereferenceable(25) %11)
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %11) #4
  br i1 %17, label %.lr.ph, label %._crit_edge, !llvm.loop !10
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3Ani12BaseFemSpace16interpolateOnDOFERKNS_5TetraIKdEERKPFiRKSt5arrayIdLm3EEPdjPvENS_9ArrayViewIdEEiNS_12PlainMemoryXIdiEESB_j(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(132), ptr noundef nonnull align 8 dereferenceable(8), ptr, i64, i32 noundef, ptr noundef byval(%"struct.Ani::PlainMemoryX") align 8, ptr noundef, i32 noundef) local_unnamed_addr #2 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 #2 = { 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 #3 = { 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 #4 = { 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, !7, i64 0}
!6 = !{!"_ZTSN3Ani4DofT10LocalOrderE", !7, i64 0, !7, i64 4, !8, i64 8, !8, i64 9, !8, i64 10, !8, i64 11}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass