; 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::PlainMemoryX" = type { ptr, ptr, ptr, i64, i64, i64 }
%"struct.Ani::DynMem<>::MemPart" = type { %"struct.Ani::PlainMemoryX", ptr, i64, i64 }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3Ani12BaseFemSpace16interpolateOnDOFERKNS_5TetraIKdEERKPFiRKSt5arrayIdLm3EEPdjPvEPNS_9ArrayViewIdEEiiRNS_6DynMemIdiEESB_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 noundef %3, i32 noundef %4, i32 noundef %5, ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef %7, i32 noundef %8) #0 align 2 personality ptr @__gxx_personality_v0 {
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca %"struct.Ani::PlainMemoryX", align 8
  %20 = alloca %"struct.Ani::DynMem<>::MemPart", align 8
  %21 = alloca %"struct.Ani::PlainMemoryX", align 8
  %22 = alloca ptr, align 8
  %23 = alloca i32, align 4
  store ptr %0, ptr %10, align 8, !tbaa !5
  store ptr %1, ptr %11, align 8, !tbaa !5
  store ptr %2, ptr %12, align 8, !tbaa !5
  store ptr %3, ptr %13, align 8, !tbaa !5
  store i32 %4, ptr %14, align 4, !tbaa !9
  store i32 %5, ptr %15, align 4, !tbaa !9
  store ptr %6, ptr %16, align 8, !tbaa !5
  store ptr %7, ptr %17, align 8, !tbaa !5
  store i32 %8, ptr %18, align 4, !tbaa !9
  %24 = load ptr, ptr %10, align 8
  call void @llvm.lifetime.start.p0(i64 48, ptr %19) #4
  %25 = load i32, ptr %14, align 4, !tbaa !9
  %26 = load i32, ptr %15, align 4, !tbaa !9
  %27 = load i32, ptr %18, align 4, !tbaa !9
  %28 = load ptr, ptr %24, align 8, !tbaa !11
  %29 = getelementptr inbounds ptr, ptr %28, i64 7
  %30 = load ptr, ptr %29, align 8
  call void %30(ptr dead_on_unwind writable sret(%"struct.Ani::PlainMemoryX") align 8 %19, ptr noundef nonnull align 8 dereferenceable(24) %24, i32 noundef %25, i32 noundef %26, i32 noundef %27)
  call void @llvm.lifetime.start.p0(i64 72, ptr %20) #4
  %31 = load ptr, ptr %16, align 8, !tbaa !5
  %32 = getelementptr inbounds %"struct.Ani::PlainMemoryX", ptr %19, i32 0, i32 3
  %33 = load i64, ptr %32, align 8, !tbaa !13
  %34 = getelementptr inbounds %"struct.Ani::PlainMemoryX", ptr %19, i32 0, i32 4
  %35 = load i64, ptr %34, align 8, !tbaa !16
  %36 = getelementptr inbounds %"struct.Ani::PlainMemoryX", ptr %19, i32 0, i32 5
  %37 = load i64, ptr %36, align 8, !tbaa !17
  %38 = load ptr, ptr %31, align 8, !tbaa !11
  %39 = getelementptr inbounds ptr, ptr %38, i64 0
  %40 = load ptr, ptr %39, align 8
  call void %40(ptr dead_on_unwind writable sret(%"struct.Ani::DynMem<>::MemPart") align 8 %20, ptr noundef nonnull align 8 dereferenceable(32) %31, i64 noundef %33, i64 noundef %35, i64 noundef %37)
  %41 = load ptr, ptr %11, align 8, !tbaa !5
  %42 = load ptr, ptr %12, align 8, !tbaa !5
  %43 = load ptr, ptr %13, align 8, !tbaa !5
  %44 = load i32, ptr %14, align 4, !tbaa !9
  %45 = load i32, ptr %15, align 4, !tbaa !9
  %46 = getelementptr inbounds %"struct.Ani::DynMem<>::MemPart", ptr %20, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %21, ptr align 8 %46, i64 48, i1 false), !tbaa.struct !18
  %47 = load ptr, ptr %17, align 8, !tbaa !5
  %48 = load i32, ptr %18, align 4, !tbaa !9
  %49 = load ptr, ptr %24, align 8, !tbaa !11
  %50 = getelementptr inbounds ptr, ptr %49, i64 6
  %51 = load ptr, ptr %50, align 8
  invoke void %51(ptr noundef nonnull align 8 dereferenceable(24) %24, ptr noundef nonnull align 8 dereferenceable(132) %41, ptr noundef nonnull align 8 dereferenceable(8) %42, ptr noundef %43, i32 noundef %44, i32 noundef %45, ptr noundef byval(%"struct.Ani::PlainMemoryX") align 8 %21, ptr noundef %47, i32 noundef %48)
          to label %52 unwind label %53

52:                                               ; preds = %9
  call void @_ZN3Ani6DynMemIdiE7MemPartD2Ev(ptr noundef nonnull align 8 dereferenceable(72) %20) #4
  call void @llvm.lifetime.end.p0(i64 72, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 48, ptr %19) #4
  ret void

53:                                               ; preds = %9
  %54 = landingpad { ptr, i32 }
          cleanup
  %55 = extractvalue { ptr, i32 } %54, 0
  store ptr %55, ptr %22, align 8
  %56 = extractvalue { ptr, i32 } %54, 1
  store i32 %56, ptr %23, align 4
  call void @_ZN3Ani6DynMemIdiE7MemPartD2Ev(ptr noundef nonnull align 8 dereferenceable(72) %20) #4
  call void @llvm.lifetime.end.p0(i64 72, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 48, ptr %19) #4
  br label %57

57:                                               ; preds = %53
  %58 = load ptr, ptr %22, align 8
  %59 = load i32, ptr %23, align 4
  %60 = insertvalue { ptr, i32 } poison, ptr %58, 0
  %61 = insertvalue { ptr, i32 } %60, i32 %59, 1
  resume { ptr, i32 } %61
}

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

; 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) #2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3Ani6DynMemIdiE7MemPartD2Ev(ptr noundef nonnull align 8 dereferenceable(72)) unnamed_addr #3 align 2

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

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !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, !12, i64 0}
!12 = !{!"vtable pointer", !8, i64 0}
!13 = !{!14, !15, i64 24}
!14 = !{!"_ZTSN3Ani12PlainMemoryXIdiEE", !6, i64 0, !6, i64 8, !6, i64 16, !15, i64 24, !15, i64 32, !15, i64 40}
!15 = !{!"long", !7, i64 0}
!16 = !{!14, !15, i64 32}
!17 = !{!14, !15, i64 40}
!18 = !{i64 0, i64 8, !5, i64 8, i64 8, !5, i64 16, i64 8, !5, i64 24, i64 8, !19, i64 32, i64 8, !19, i64 40, i64 8, !19}
!19 = !{!15, !15, i64 0}


; 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::DynMem<>::MemPart" = type { %"struct.Ani::PlainMemoryX", ptr, i64, i64 }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3Ani12BaseFemSpace16interpolateOnDOFERKNS_5TetraIKdEERKPFiRKSt5arrayIdLm3EEPdjPvEPNS_9ArrayViewIdEEiiRNS_6DynMemIdiEESB_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 noundef %3, i32 noundef %4, i32 noundef %5, ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef %7, i32 noundef %8) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %10 = alloca %"struct.Ani::PlainMemoryX", align 8
  %11 = alloca %"struct.Ani::DynMem<>::MemPart", align 8
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %10) #3
  %12 = load ptr, ptr %0, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %12, i64 56
  %14 = load ptr, ptr %13, align 8
  call void %14(ptr dead_on_unwind nonnull writable sret(%"struct.Ani::PlainMemoryX") align 8 %10, ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %4, i32 noundef %5, i32 noundef %8)
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %11) #3
  %15 = getelementptr inbounds i8, ptr %10, i64 24
  %16 = load i64, ptr %15, align 8, !tbaa !8
  %17 = getelementptr inbounds i8, ptr %10, i64 32
  %18 = load i64, ptr %17, align 8, !tbaa !13
  %19 = getelementptr inbounds i8, ptr %10, i64 40
  %20 = load i64, ptr %19, align 8, !tbaa !14
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = load ptr, ptr %21, align 8
  call void %22(ptr dead_on_unwind nonnull writable sret(%"struct.Ani::DynMem<>::MemPart") align 8 %11, ptr noundef nonnull align 8 dereferenceable(32) %6, i64 noundef %16, i64 noundef %18, i64 noundef %20)
  %23 = load ptr, ptr %0, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %23, i64 48
  %25 = load ptr, ptr %24, align 8
  invoke void %25(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 noundef %3, i32 noundef %4, i32 noundef %5, ptr noundef nonnull byval(%"struct.Ani::PlainMemoryX") align 8 %11, ptr noundef %7, i32 noundef %8)
          to label %26 unwind label %27

26:                                               ; preds = %9
  call void @_ZN3Ani6DynMemIdiE7MemPartD2Ev(ptr noundef nonnull align 8 dereferenceable(72) %11) #3
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %11) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %10) #3
  ret void

27:                                               ; preds = %9
  %28 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3Ani6DynMemIdiE7MemPartD2Ev(ptr noundef nonnull align 8 dereferenceable(72) %11) #3
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %11) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %10) #3
  resume { ptr, i32 } %28
}

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3Ani6DynMemIdiE7MemPartD2Ev(ptr noundef nonnull align 8 dereferenceable(72)) 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

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 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !12, i64 24}
!9 = !{!"_ZTSN3Ani12PlainMemoryXIdiEE", !10, i64 0, !10, i64 8, !10, i64 16, !12, i64 24, !12, i64 32, !12, i64 40}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"long", !11, i64 0}
!13 = !{!9, !12, i64 32}
!14 = !{!9, !12, i64 40}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,SROAPass,SimplifyCFGPass