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

; 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::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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i8 @_ZN3Ani4DofT13NumToGeomTypeEi(i32 noundef) #1

; 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 uwtable
define dso_local noundef i32 @_ZNK3Ani4DofT13ComplexDofMap11GetGeomMaskEv(ptr noundef nonnull align 8 dereferenceable(344) %0) unnamed_addr #3 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 0, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %6

6:                                                ; preds = %34, %1
  %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) #4
  br label %37

10:                                               ; preds = %6
  %11 = getelementptr inbounds %"struct.Ani::DofT::ComplexDofMap", ptr %5, i32 0, i32 3
  %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) #4
  %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) #4
  %17 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %14, i64 noundef %16) #4
  %18 = load i32, ptr %17, align 4, !tbaa !9
  %19 = getelementptr inbounds %"struct.Ani::DofT::ComplexDofMap", ptr %5, i32 0, i32 3
  %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) #4
  %23 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %22, i64 noundef 0) #4
  %24 = load i32, ptr %23, align 4, !tbaa !9
  %25 = sub i32 %18, %24
  %26 = icmp ugt i32 %25, 0
  br i1 %26, label %27, label %33

27:                                               ; preds = %10
  %28 = load i32, ptr %4, align 4, !tbaa !9
  %29 = call noundef zeroext i8 @_ZN3Ani4DofT13NumToGeomTypeEi(i32 noundef %28)
  %30 = zext i8 %29 to i32
  %31 = load i32, ptr %3, align 4, !tbaa !9
  %32 = or i32 %31, %30
  store i32 %32, ptr %3, align 4, !tbaa !9
  br label %33

33:                                               ; preds = %27, %10
  br label %34

34:                                               ; preds = %33
  %35 = load i32, ptr %4, align 4, !tbaa !9
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %4, align 4, !tbaa !9
  br label %6, !llvm.loop !11

37:                                               ; preds = %9
  %38 = load i32, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  ret i32 %38
}

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 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 = { 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 = 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"

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i8 @_ZN3Ani4DofT13NumToGeomTypeEi(i32 noundef) local_unnamed_addr #0

; 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 noundef range(i32 0, 256) i32 @_ZNK3Ani4DofT13ComplexDofMap11GetGeomMaskEv(ptr noundef nonnull align 8 dereferenceable(344) %0) unnamed_addr #1 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 176
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt5arrayISt6vectorIjSaIjEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(144) %2, i64 noundef 0) #2
  %5 = tail call noundef i64 @_ZNKSt6vectorISt10shared_ptrIN3Ani4DofT10BaseDofMapEESaIS4_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #2
  %6 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %5) #2
  %7 = load i32, ptr %6, align 4, !tbaa !5
  %8 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt5arrayISt6vectorIjSaIjEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(144) %2, i64 noundef 0) #2
  %9 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef 0) #2
  %10 = load i32, ptr %9, align 4, !tbaa !5
  %.not = icmp eq i32 %7, %10
  br i1 %.not, label %14, label %11

11:                                               ; preds = %1
  %12 = tail call noundef zeroext i8 @_ZN3Ani4DofT13NumToGeomTypeEi(i32 noundef 0)
  %13 = zext i8 %12 to i32
  br label %14

14:                                               ; preds = %1, %11
  %.1 = phi i32 [ %13, %11 ], [ 0, %1 ]
  %15 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt5arrayISt6vectorIjSaIjEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(144) %2, i64 noundef 1) #2
  %16 = tail call noundef i64 @_ZNKSt6vectorISt10shared_ptrIN3Ani4DofT10BaseDofMapEESaIS4_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #2
  %17 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %15, i64 noundef %16) #2
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %19 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt5arrayISt6vectorIjSaIjEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(144) %2, i64 noundef 1) #2
  %20 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %19, i64 noundef 0) #2
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %.not.1 = icmp eq i32 %18, %21
  br i1 %.not.1, label %26, label %22

22:                                               ; preds = %14
  %23 = tail call noundef zeroext i8 @_ZN3Ani4DofT13NumToGeomTypeEi(i32 noundef 1)
  %24 = zext i8 %23 to i32
  %25 = or i32 %.1, %24
  br label %26

26:                                               ; preds = %22, %14
  %.1.1 = phi i32 [ %25, %22 ], [ %.1, %14 ]
  %27 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt5arrayISt6vectorIjSaIjEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(144) %2, i64 noundef 2) #2
  %28 = tail call noundef i64 @_ZNKSt6vectorISt10shared_ptrIN3Ani4DofT10BaseDofMapEESaIS4_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #2
  %29 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %27, i64 noundef %28) #2
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt5arrayISt6vectorIjSaIjEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(144) %2, i64 noundef 2) #2
  %32 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %31, i64 noundef 0) #2
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %.not.2 = icmp eq i32 %30, %33
  br i1 %.not.2, label %38, label %34

34:                                               ; preds = %26
  %35 = tail call noundef zeroext i8 @_ZN3Ani4DofT13NumToGeomTypeEi(i32 noundef 2)
  %36 = zext i8 %35 to i32
  %37 = or i32 %.1.1, %36
  br label %38

38:                                               ; preds = %34, %26
  %.1.2 = phi i32 [ %37, %34 ], [ %.1.1, %26 ]
  %39 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt5arrayISt6vectorIjSaIjEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(144) %2, i64 noundef 3) #2
  %40 = tail call noundef i64 @_ZNKSt6vectorISt10shared_ptrIN3Ani4DofT10BaseDofMapEESaIS4_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #2
  %41 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %39, i64 noundef %40) #2
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt5arrayISt6vectorIjSaIjEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(144) %2, i64 noundef 3) #2
  %44 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %43, i64 noundef 0) #2
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %.not.3 = icmp eq i32 %42, %45
  br i1 %.not.3, label %50, label %46

46:                                               ; preds = %38
  %47 = tail call noundef zeroext i8 @_ZN3Ani4DofT13NumToGeomTypeEi(i32 noundef 3)
  %48 = zext i8 %47 to i32
  %49 = or i32 %.1.2, %48
  br label %50

50:                                               ; preds = %46, %38
  %.1.3 = phi i32 [ %49, %46 ], [ %.1.2, %38 ]
  %51 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt5arrayISt6vectorIjSaIjEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(144) %2, i64 noundef 4) #2
  %52 = tail call noundef i64 @_ZNKSt6vectorISt10shared_ptrIN3Ani4DofT10BaseDofMapEESaIS4_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #2
  %53 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %51, i64 noundef %52) #2
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt5arrayISt6vectorIjSaIjEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(144) %2, i64 noundef 4) #2
  %56 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %55, i64 noundef 0) #2
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %.not.4 = icmp eq i32 %54, %57
  br i1 %.not.4, label %62, label %58

58:                                               ; preds = %50
  %59 = tail call noundef zeroext i8 @_ZN3Ani4DofT13NumToGeomTypeEi(i32 noundef 4)
  %60 = zext i8 %59 to i32
  %61 = or i32 %.1.3, %60
  br label %62

62:                                               ; preds = %58, %50
  %.1.4 = phi i32 [ %61, %58 ], [ %.1.3, %50 ]
  %63 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt5arrayISt6vectorIjSaIjEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(144) %2, i64 noundef 5) #2
  %64 = tail call noundef i64 @_ZNKSt6vectorISt10shared_ptrIN3Ani4DofT10BaseDofMapEESaIS4_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #2
  %65 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %63, i64 noundef %64) #2
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt5arrayISt6vectorIjSaIjEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(144) %2, i64 noundef 5) #2
  %68 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %67, i64 noundef 0) #2
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %.not.5 = icmp eq i32 %66, %69
  br i1 %.not.5, label %74, label %70

70:                                               ; preds = %62
  %71 = tail call noundef zeroext i8 @_ZN3Ani4DofT13NumToGeomTypeEi(i32 noundef 5)
  %72 = zext i8 %71 to i32
  %73 = or i32 %.1.4, %72
  br label %74

74:                                               ; preds = %70, %62
  %.1.5 = phi i32 [ %73, %70 ], [ %.1.4, %62 ]
  ret i32 %.1.5
}

attributes #0 = { 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 #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,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LICMPass,LoopRotatePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass