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

; 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::NestedDofMapBase" = type <{ %"struct.Ani::DofT::BaseDofMap", %"struct.std::array.2", i32, [4 x i8] }>
%"struct.Ani::DofT::BaseDofMap" = type { ptr }
%"struct.std::array.2" = type { [6 x i32] }
%"struct.Ani::DofT::NestedDofMap" = type { %"struct.Ani::DofT::NestedDofMapBase.base", %"class.std::shared_ptr" }
%"struct.Ani::DofT::NestedDofMapBase.base" = type <{ %"struct.Ani::DofT::BaseDofMap", %"struct.std::array.2", i32 }>
%"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: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24), i64 noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt19__shared_ptr_accessIN3Ani4DofT10BaseDofMapELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1)) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3Ani4DofT12NestedDofMap18GetNestedComponentEPKiiRNS0_16NestedDofMapBaseE(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr noundef %1, i32 noundef %2, ptr noundef nonnull align 8 dereferenceable(36) %3) unnamed_addr #2 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !5
  %10 = load ptr, ptr %5, align 8
  %11 = load i32, ptr %7, align 4, !tbaa !9
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %13, label %65

13:                                               ; preds = %4
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  %15 = load i32, ptr %14, align 4, !tbaa !9
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %17, label %65

17:                                               ; preds = %13
  %18 = getelementptr inbounds %"struct.Ani::DofT::NestedDofMapBase", ptr %10, i32 0, i32 2
  %19 = load i32, ptr %18, align 8, !tbaa !11
  %20 = load ptr, ptr %8, align 8, !tbaa !5
  %21 = getelementptr inbounds %"struct.Ani::DofT::NestedDofMapBase", ptr %20, i32 0, i32 2
  %22 = load i32, ptr %21, align 8, !tbaa !11
  %23 = add i32 %22, %19
  store i32 %23, ptr %21, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %24

24:                                               ; preds = %41, %17
  %25 = load i32, ptr %9, align 4, !tbaa !9
  %26 = icmp slt i32 %25, 6
  br i1 %26, label %28, label %27

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

28:                                               ; preds = %24
  %29 = getelementptr inbounds %"struct.Ani::DofT::NestedDofMapBase", ptr %10, i32 0, i32 1
  %30 = load i32, ptr %9, align 4, !tbaa !9
  %31 = sext i32 %30 to i64
  %32 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24) %29, i64 noundef %31) #3
  %33 = load i32, ptr %32, align 4, !tbaa !9
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = getelementptr inbounds %"struct.Ani::DofT::NestedDofMapBase", ptr %34, i32 0, i32 1
  %36 = load i32, ptr %9, align 4, !tbaa !9
  %37 = sext i32 %36 to i64
  %38 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24) %35, i64 noundef %37) #3
  %39 = load i32, ptr %38, align 4, !tbaa !9
  %40 = add i32 %39, %33
  store i32 %40, ptr %38, align 4, !tbaa !9
  br label %41

41:                                               ; preds = %28
  %42 = load i32, ptr %9, align 4, !tbaa !9
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %9, align 4, !tbaa !9
  br label %24, !llvm.loop !15

44:                                               ; preds = %27
  %45 = load i32, ptr %7, align 4, !tbaa !9
  %46 = icmp eq i32 %45, 1
  br i1 %46, label %47, label %53

47:                                               ; preds = %44
  %48 = load ptr, ptr %8, align 8, !tbaa !5
  %49 = getelementptr inbounds %"struct.Ani::DofT::NestedDofMap", ptr %10, i32 0, i32 1
  %50 = load ptr, ptr %48, align 8, !tbaa !17
  %51 = getelementptr inbounds ptr, ptr %50, i64 23
  %52 = load ptr, ptr %51, align 8
  call void %52(ptr noundef nonnull align 8 dereferenceable(36) %48, ptr noundef nonnull align 8 dereferenceable(16) %49)
  br label %64

53:                                               ; preds = %44
  %54 = getelementptr inbounds %"struct.Ani::DofT::NestedDofMap", ptr %10, i32 0, i32 1
  %55 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3Ani4DofT10BaseDofMapELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %54) #3
  %56 = load ptr, ptr %6, align 8, !tbaa !5
  %57 = getelementptr inbounds i32, ptr %56, i64 1
  %58 = load i32, ptr %7, align 4, !tbaa !9
  %59 = sub nsw i32 %58, 1
  %60 = load ptr, ptr %8, align 8, !tbaa !5
  %61 = load ptr, ptr %55, align 8, !tbaa !17
  %62 = getelementptr inbounds ptr, ptr %61, i64 14
  %63 = load ptr, ptr %62, align 8
  call void %63(ptr noundef nonnull align 8 dereferenceable(8) %55, ptr noundef %57, i32 noundef %59, ptr noundef nonnull align 8 dereferenceable(36) %60)
  br label %64

64:                                               ; preds = %53, %47
  br label %70

65:                                               ; preds = %13, %4
  %66 = load ptr, ptr %8, align 8, !tbaa !5
  %67 = load ptr, ptr %66, align 8, !tbaa !17
  %68 = getelementptr inbounds ptr, ptr %67, i64 25
  %69 = load ptr, ptr %68, align 8
  call void %69(ptr noundef nonnull align 8 dereferenceable(36) %66)
  br label %70

70:                                               ; preds = %65, %64
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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 32}
!12 = !{!"_ZTSN3Ani4DofT16NestedDofMapBaseE", !13, i64 0, !14, i64 8, !10, i64 32}
!13 = !{!"_ZTSN3Ani4DofT10BaseDofMapE"}
!14 = !{!"_ZTSSt5arrayIjLm6EE", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!18, !18, i64 0}
!18 = !{!"vtable pointer", !8, 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"

; 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 #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt19__shared_ptr_accessIN3Ani4DofT10BaseDofMapELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3Ani4DofT12NestedDofMap18GetNestedComponentEPKiiRNS0_16NestedDofMapBaseE(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr noundef %1, i32 noundef %2, ptr noundef nonnull align 8 dereferenceable(36) %3) unnamed_addr #1 align 2 {
  %5 = icmp sgt i32 %2, 0
  br i1 %5, label %6, label %60

6:                                                ; preds = %4
  %7 = load i32, ptr %1, align 4, !tbaa !5
  %8 = icmp eq i32 %7, 0
  br i1 %8, label %9, label %60

9:                                                ; preds = %6
  %10 = getelementptr inbounds i8, ptr %0, i64 32
  %11 = load i32, ptr %10, align 8, !tbaa !9
  %12 = getelementptr inbounds i8, ptr %3, i64 32
  %13 = load i32, ptr %12, align 8, !tbaa !9
  %14 = add i32 %13, %11
  store i32 %14, ptr %12, align 8, !tbaa !9
  %15 = getelementptr inbounds i8, ptr %0, i64 8
  %16 = getelementptr inbounds i8, ptr %3, i64 8
  %17 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24) %15, i64 noundef 0) #2
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %19 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24) %16, i64 noundef 0) #2
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = add i32 %20, %18
  store i32 %21, ptr %19, align 4, !tbaa !5
  %22 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24) %15, i64 noundef 1) #2
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24) %16, i64 noundef 1) #2
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = add i32 %25, %23
  store i32 %26, ptr %24, align 4, !tbaa !5
  %27 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24) %15, i64 noundef 2) #2
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24) %16, i64 noundef 2) #2
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = add i32 %30, %28
  store i32 %31, ptr %29, align 4, !tbaa !5
  %32 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24) %15, i64 noundef 3) #2
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24) %16, i64 noundef 3) #2
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = add i32 %35, %33
  store i32 %36, ptr %34, align 4, !tbaa !5
  %37 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24) %15, i64 noundef 4) #2
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24) %16, i64 noundef 4) #2
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = add i32 %40, %38
  store i32 %41, ptr %39, align 4, !tbaa !5
  %42 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24) %15, i64 noundef 5) #2
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24) %16, i64 noundef 5) #2
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = add i32 %45, %43
  store i32 %46, ptr %44, align 4, !tbaa !5
  %47 = icmp eq i32 %2, 1
  %48 = getelementptr inbounds i8, ptr %0, i64 40
  br i1 %47, label %49, label %53

49:                                               ; preds = %9
  %50 = load ptr, ptr %3, align 8, !tbaa !13
  %51 = getelementptr inbounds i8, ptr %50, i64 184
  %52 = load ptr, ptr %51, align 8
  tail call void %52(ptr noundef nonnull align 8 dereferenceable(36) %3, ptr noundef nonnull align 8 dereferenceable(16) %48)
  br label %64

53:                                               ; preds = %9
  %54 = tail call noundef ptr @_ZNKSt19__shared_ptr_accessIN3Ani4DofT10BaseDofMapELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %48) #2
  %55 = getelementptr inbounds i8, ptr %1, i64 4
  %56 = add nsw i32 %2, -1
  %57 = load ptr, ptr %54, align 8, !tbaa !13
  %58 = getelementptr inbounds i8, ptr %57, i64 112
  %59 = load ptr, ptr %58, align 8
  tail call void %59(ptr noundef nonnull align 8 dereferenceable(8) %54, ptr noundef nonnull %55, i32 noundef %56, ptr noundef nonnull align 8 dereferenceable(36) %3)
  br label %64

60:                                               ; preds = %6, %4
  %61 = load ptr, ptr %3, align 8, !tbaa !13
  %62 = getelementptr inbounds i8, ptr %61, i64 200
  %63 = load ptr, ptr %62, align 8
  tail call void %63(ptr noundef nonnull align 8 dereferenceable(36) %3)
  br label %64

64:                                               ; preds = %49, %53, %60
  ret void
}

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 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"}
!9 = !{!10, !6, i64 32}
!10 = !{!"_ZTSN3Ani4DofT16NestedDofMapBaseE", !11, i64 0, !12, i64 8, !6, i64 32}
!11 = !{!"_ZTSN3Ani4DofT10BaseDofMapE"}
!12 = !{!"_ZTSSt5arrayIjLm6EE", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"vtable pointer", !8, i64 0}


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