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

; 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::PlainMemoryX" = type { ptr, ptr, ptr, i64, i64, i64 }
%"struct.Ani::DofT::DofIterator" = type { %"struct.Ani::DofT::LocalOrder", ptr }
%"struct.Ani::DofT::LocalOrder" = type { i32, i32, i8, i8, i8, i8 }
%"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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3Ani12PlainMemoryXIdiEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3Ani12BaseFemSpace24interpolateOnDOF_mem_reqEij(ptr dead_on_unwind noalias writable sret(%"struct.Ani::PlainMemoryX") align 8, ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3Ani12BaseFemSpace25interpolateByDOFs_mem_reqEj(ptr dead_on_unwind noalias writable sret(%"struct.Ani::PlainMemoryX") align 8 %0, ptr noundef nonnull align 8 dereferenceable(24) %1, i32 noundef %2) unnamed_addr #2 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca %"struct.Ani::DofT::DofIterator", align 8
  %7 = alloca %"struct.Ani::DofT::DofIterator", align 8
  %8 = alloca %"struct.Ani::PlainMemoryX", align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  store i32 %2, ptr %5, align 4, !tbaa !9
  %9 = load ptr, ptr %4, align 8
  call void @_ZN3Ani12PlainMemoryXIdiEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %0) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr %6) #4
  %10 = getelementptr inbounds %"struct.Ani::BaseFemSpace", ptr %9, i32 0, i32 1
  call void @_ZNK3Ani4DofT6DofMap5beginEv(ptr dead_on_unwind writable sret(%"struct.Ani::DofT::DofIterator") align 8 %6, ptr noundef nonnull align 8 dereferenceable(16) %10)
  br label %11

11:                                               ; preds = %35, %3
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #4
  %12 = getelementptr inbounds %"struct.Ani::BaseFemSpace", ptr %9, i32 0, i32 1
  call void @_ZNK3Ani4DofT6DofMap3endEv(ptr dead_on_unwind writable sret(%"struct.Ani::DofT::DofIterator") align 8 %7, ptr noundef nonnull align 8 dereferenceable(16) %12)
  %13 = call noundef zeroext i1 @_ZNK3Ani4DofT11DofIteratorneERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 8 dereferenceable(24) %7)
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #4
  br i1 %13, label %15, label %14

14:                                               ; preds = %11
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #4
  br label %37

15:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 48, ptr %8) #4
  %16 = call noundef ptr @_ZNK3Ani4DofT11DofIteratorptEv(ptr noundef nonnull align 8 dereferenceable(24) %6)
  %17 = getelementptr inbounds %"struct.Ani::DofT::LocalOrder", ptr %16, i32 0, i32 0
  %18 = load i32, ptr %17, align 4, !tbaa !11
  %19 = load i32, ptr %5, align 4, !tbaa !9
  call void @_ZNK3Ani12BaseFemSpace24interpolateOnDOF_mem_reqEij(ptr dead_on_unwind writable sret(%"struct.Ani::PlainMemoryX") align 8 %8, ptr noundef nonnull align 8 dereferenceable(24) %9, i32 noundef %18, i32 noundef %19)
  %20 = getelementptr inbounds %"struct.Ani::PlainMemoryX", ptr %0, i32 0, i32 3
  %21 = getelementptr inbounds %"struct.Ani::PlainMemoryX", ptr %8, i32 0, i32 3
  %22 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %20, ptr noundef nonnull align 8 dereferenceable(8) %21)
  %23 = load i64, ptr %22, align 8, !tbaa !13
  %24 = getelementptr inbounds %"struct.Ani::PlainMemoryX", ptr %0, i32 0, i32 3
  store i64 %23, ptr %24, align 8, !tbaa !15
  %25 = getelementptr inbounds %"struct.Ani::PlainMemoryX", ptr %0, i32 0, i32 4
  %26 = getelementptr inbounds %"struct.Ani::PlainMemoryX", ptr %8, i32 0, i32 4
  %27 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %25, ptr noundef nonnull align 8 dereferenceable(8) %26)
  %28 = load i64, ptr %27, align 8, !tbaa !13
  %29 = getelementptr inbounds %"struct.Ani::PlainMemoryX", ptr %0, i32 0, i32 4
  store i64 %28, ptr %29, align 8, !tbaa !17
  %30 = getelementptr inbounds %"struct.Ani::PlainMemoryX", ptr %0, i32 0, i32 5
  %31 = getelementptr inbounds %"struct.Ani::PlainMemoryX", ptr %8, i32 0, i32 5
  %32 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %30, ptr noundef nonnull align 8 dereferenceable(8) %31)
  %33 = load i64, ptr %32, align 8, !tbaa !13
  %34 = getelementptr inbounds %"struct.Ani::PlainMemoryX", ptr %0, i32 0, i32 5
  store i64 %33, ptr %34, align 8, !tbaa !18
  call void @llvm.lifetime.end.p0(i64 48, ptr %8) #4
  br label %35

35:                                               ; preds = %15
  %36 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN3Ani4DofT11DofIteratorppEv(ptr noundef nonnull align 8 dereferenceable(24) %6)
  br label %11, !llvm.loop !19

37:                                               ; preds = %14
  ret void
}

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

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

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

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 #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, !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 = !{!12, !10, i64 0}
!12 = !{!"_ZTSN3Ani4DofT10LocalOrderE", !10, i64 0, !10, i64 4, !7, i64 8, !7, i64 9, !7, i64 10, !7, i64 11}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!16, !14, i64 24}
!16 = !{!"_ZTSN3Ani12PlainMemoryXIdiEE", !6, i64 0, !6, i64 8, !6, i64 16, !14, i64 24, !14, i64 32, !14, i64 40}
!17 = !{!16, !14, i64 32}
!18 = !{!16, !14, i64 40}
!19 = distinct !{!19, !20}
!20 = !{!"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::PlainMemoryX" = type { ptr, ptr, ptr, i64, i64, i64 }
%"struct.Ani::DofT::DofIterator" = type { %"struct.Ani::DofT::LocalOrder", ptr }
%"struct.Ani::DofT::LocalOrder" = type { i32, i32, i8, i8, i8, i8 }

; 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 nounwind uwtable
declare dso_local void @_ZN3Ani12PlainMemoryXIdiEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3Ani12BaseFemSpace24interpolateOnDOF_mem_reqEij(ptr dead_on_unwind noalias writable sret(%"struct.Ani::PlainMemoryX") align 8, ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3Ani12BaseFemSpace25interpolateByDOFs_mem_reqEj(ptr dead_on_unwind noalias nonnull writable sret(%"struct.Ani::PlainMemoryX") align 8 %0, ptr noundef nonnull align 8 dereferenceable(24) %1, i32 noundef %2) unnamed_addr #2 align 2 {
  %4 = alloca %"struct.Ani::DofT::DofIterator", align 8
  %5 = alloca %"struct.Ani::DofT::DofIterator", align 8
  %6 = alloca %"struct.Ani::PlainMemoryX", align 8
  tail call void @_ZN3Ani12PlainMemoryXIdiEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %0) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #4
  %7 = getelementptr inbounds i8, ptr %1, i64 8
  call void @_ZNK3Ani4DofT6DofMap5beginEv(ptr dead_on_unwind nonnull writable sret(%"struct.Ani::DofT::DofIterator") align 8 %4, ptr noundef nonnull align 8 dereferenceable(16) %7)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #4
  call void @_ZNK3Ani4DofT6DofMap3endEv(ptr dead_on_unwind nonnull writable sret(%"struct.Ani::DofT::DofIterator") align 8 %5, ptr noundef nonnull align 8 dereferenceable(16) %7)
  %8 = call noundef zeroext i1 @_ZNK3Ani4DofT11DofIteratorneERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) %5)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #4
  br i1 %8, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %3
  %9 = getelementptr inbounds i8, ptr %0, i64 24
  %10 = getelementptr inbounds i8, ptr %6, i64 24
  %11 = getelementptr inbounds i8, ptr %0, i64 32
  %12 = getelementptr inbounds i8, ptr %6, i64 32
  %13 = getelementptr inbounds i8, ptr %0, i64 40
  %14 = getelementptr inbounds i8, ptr %6, i64 40
  br label %15

._crit_edge:                                      ; preds = %15, %3
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #4
  ret void

15:                                               ; preds = %.lr.ph, %15
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %6) #4
  %16 = call noundef ptr @_ZNK3Ani4DofT11DofIteratorptEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  %17 = load i32, ptr %16, align 4, !tbaa !5
  call void @_ZNK3Ani12BaseFemSpace24interpolateOnDOF_mem_reqEij(ptr dead_on_unwind nonnull writable sret(%"struct.Ani::PlainMemoryX") align 8 %6, ptr noundef nonnull align 8 dereferenceable(24) %1, i32 noundef %17, i32 noundef %2)
  %18 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10)
  %19 = load i64, ptr %18, align 8, !tbaa !10
  store i64 %19, ptr %9, align 8, !tbaa !12
  %20 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %21 = load i64, ptr %20, align 8, !tbaa !10
  store i64 %21, ptr %11, align 8, !tbaa !15
  %22 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %14)
  %23 = load i64, ptr %22, align 8, !tbaa !10
  store i64 %23, ptr %13, align 8, !tbaa !16
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %6) #4
  %24 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN3Ani4DofT11DofIteratorppEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #4
  call void @_ZNK3Ani4DofT6DofMap3endEv(ptr dead_on_unwind nonnull writable sret(%"struct.Ani::DofT::DofIterator") align 8 %5, ptr noundef nonnull align 8 dereferenceable(16) %7)
  %25 = call noundef zeroext i1 @_ZNK3Ani4DofT11DofIteratorneERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) %5)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #4
  br i1 %25, label %15, label %._crit_edge, !llvm.loop !17
}

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

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

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

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 #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 = !{!11, !11, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!13, !11, i64 24}
!13 = !{!"_ZTSN3Ani12PlainMemoryXIdiEE", !14, i64 0, !14, i64 8, !14, i64 16, !11, i64 24, !11, i64 32, !11, i64 40}
!14 = !{!"any pointer", !8, i64 0}
!15 = !{!13, !11, i64 32}
!16 = !{!13, !11, i64 40}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}


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