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

; 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.std::array.2" = type { [6 x i32] }

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3Ani4DofT10BaseDofMap12NumDofsOnTetEv(ptr dead_on_unwind noalias writable sret(%"struct.std::array.2") align 4 %0, ptr noundef nonnull align 8 dereferenceable(8) %1) unnamed_addr #3 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i8, align 1
  store ptr %1, ptr %3, align 8, !tbaa !5
  %6 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %7

7:                                                ; preds = %26, %2
  %8 = load i32, ptr %4, align 4, !tbaa !9
  %9 = icmp slt i32 %8, 6
  br i1 %9, label %11, label %10

10:                                               ; preds = %7
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %29

11:                                               ; preds = %7
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #5
  %12 = load i32, ptr %4, align 4, !tbaa !9
  %13 = call noundef zeroext i8 @_ZN3Ani4DofT13NumToGeomTypeEi(i32 noundef %12)
  store i8 %13, ptr %5, align 1, !tbaa !11
  %14 = load i8, ptr %5, align 1, !tbaa !11
  %15 = call noundef zeroext i8 @_ZN3Ani4DofT16GeomTypeTetElemsEh(i8 noundef zeroext %14)
  %16 = zext i8 %15 to i32
  %17 = load i8, ptr %5, align 1, !tbaa !11
  %18 = load ptr, ptr %6, align 8, !tbaa !12
  %19 = getelementptr inbounds ptr, ptr %18, i64 1
  %20 = load ptr, ptr %19, align 8
  %21 = call noundef i32 %20(ptr noundef nonnull align 8 dereferenceable(8) %6, i8 noundef zeroext %17)
  %22 = mul i32 %16, %21
  %23 = load i32, ptr %4, align 4, !tbaa !9
  %24 = sext i32 %23 to i64
  %25 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24) %0, i64 noundef %24) #5
  store i32 %22, ptr %25, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #5
  br label %26

26:                                               ; preds = %11
  %27 = load i32, ptr %4, align 4, !tbaa !9
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %4, align 4, !tbaa !9
  br label %7, !llvm.loop !14

29:                                               ; preds = %10
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i8 @_ZN3Ani4DofT16GeomTypeTetElemsEh(i8 noundef zeroext) #4

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 = { 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 #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 = { 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 #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 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"vtable pointer", !8, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"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.std::array.2" = type { [6 x i32] }

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3Ani4DofT10BaseDofMap12NumDofsOnTetEv(ptr dead_on_unwind noalias writable sret(%"struct.std::array.2") align 4 %0, ptr noundef nonnull align 8 dereferenceable(8) %1) unnamed_addr #2 align 2 {
  %3 = tail call noundef zeroext i8 @_ZN3Ani4DofT13NumToGeomTypeEi(i32 noundef 0)
  %4 = tail call noundef zeroext i8 @_ZN3Ani4DofT16GeomTypeTetElemsEh(i8 noundef zeroext %3)
  %5 = zext i8 %4 to i32
  %6 = load ptr, ptr %1, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %6, i64 8
  %8 = load ptr, ptr %7, align 8
  %9 = tail call noundef i32 %8(ptr noundef nonnull align 8 dereferenceable(8) %1, i8 noundef zeroext %3)
  %10 = mul i32 %9, %5
  %11 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24) %0, i64 noundef 0) #4
  store i32 %10, ptr %11, align 4, !tbaa !8
  %12 = tail call noundef zeroext i8 @_ZN3Ani4DofT13NumToGeomTypeEi(i32 noundef 1)
  %13 = tail call noundef zeroext i8 @_ZN3Ani4DofT16GeomTypeTetElemsEh(i8 noundef zeroext %12)
  %14 = zext i8 %13 to i32
  %15 = load ptr, ptr %1, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %15, i64 8
  %17 = load ptr, ptr %16, align 8
  %18 = tail call noundef i32 %17(ptr noundef nonnull align 8 dereferenceable(8) %1, i8 noundef zeroext %12)
  %19 = mul i32 %18, %14
  %20 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24) %0, i64 noundef 1) #4
  store i32 %19, ptr %20, align 4, !tbaa !8
  %21 = tail call noundef zeroext i8 @_ZN3Ani4DofT13NumToGeomTypeEi(i32 noundef 2)
  %22 = tail call noundef zeroext i8 @_ZN3Ani4DofT16GeomTypeTetElemsEh(i8 noundef zeroext %21)
  %23 = zext i8 %22 to i32
  %24 = load ptr, ptr %1, align 8, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %24, i64 8
  %26 = load ptr, ptr %25, align 8
  %27 = tail call noundef i32 %26(ptr noundef nonnull align 8 dereferenceable(8) %1, i8 noundef zeroext %21)
  %28 = mul i32 %27, %23
  %29 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24) %0, i64 noundef 2) #4
  store i32 %28, ptr %29, align 4, !tbaa !8
  %30 = tail call noundef zeroext i8 @_ZN3Ani4DofT13NumToGeomTypeEi(i32 noundef 3)
  %31 = tail call noundef zeroext i8 @_ZN3Ani4DofT16GeomTypeTetElemsEh(i8 noundef zeroext %30)
  %32 = zext i8 %31 to i32
  %33 = load ptr, ptr %1, align 8, !tbaa !5
  %34 = getelementptr inbounds i8, ptr %33, i64 8
  %35 = load ptr, ptr %34, align 8
  %36 = tail call noundef i32 %35(ptr noundef nonnull align 8 dereferenceable(8) %1, i8 noundef zeroext %30)
  %37 = mul i32 %36, %32
  %38 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24) %0, i64 noundef 3) #4
  store i32 %37, ptr %38, align 4, !tbaa !8
  %39 = tail call noundef zeroext i8 @_ZN3Ani4DofT13NumToGeomTypeEi(i32 noundef 4)
  %40 = tail call noundef zeroext i8 @_ZN3Ani4DofT16GeomTypeTetElemsEh(i8 noundef zeroext %39)
  %41 = zext i8 %40 to i32
  %42 = load ptr, ptr %1, align 8, !tbaa !5
  %43 = getelementptr inbounds i8, ptr %42, i64 8
  %44 = load ptr, ptr %43, align 8
  %45 = tail call noundef i32 %44(ptr noundef nonnull align 8 dereferenceable(8) %1, i8 noundef zeroext %39)
  %46 = mul i32 %45, %41
  %47 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24) %0, i64 noundef 4) #4
  store i32 %46, ptr %47, align 4, !tbaa !8
  %48 = tail call noundef zeroext i8 @_ZN3Ani4DofT13NumToGeomTypeEi(i32 noundef 5)
  %49 = tail call noundef zeroext i8 @_ZN3Ani4DofT16GeomTypeTetElemsEh(i8 noundef zeroext %48)
  %50 = zext i8 %49 to i32
  %51 = load ptr, ptr %1, align 8, !tbaa !5
  %52 = getelementptr inbounds i8, ptr %51, i64 8
  %53 = load ptr, ptr %52, align 8
  %54 = tail call noundef i32 %53(ptr noundef nonnull align 8 dereferenceable(8) %1, i8 noundef zeroext %48)
  %55 = mul i32 %54, %50
  %56 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIjLm6EEixEm(ptr noundef nonnull align 4 dereferenceable(24) %0, i64 noundef 5) #4
  store i32 %55, ptr %56, align 4, !tbaa !8
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i8 @_ZN3Ani4DofT16GeomTypeTetElemsEh(i8 noundef zeroext) local_unnamed_addr #3

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 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}


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