; LLVM IR from yangfengzzz/DigitalVox3 :: vox.geometry/surfaces/triangle3.ll (ZNK3vox8geometry9Triangle37Builder10makeSharedEv)

; 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"

%"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 }
%"struct.std::array.3" = type { [3 x %"class.vox::geometry::Matrix"] }
%"class.vox::geometry::Matrix" = type { double, double, double }
%"struct.std::array.4" = type { [3 x %"class.vox::geometry::Matrix.5"] }
%"class.vox::geometry::Matrix.5" = type { double, double }
%class.anon = type { i8 }
%"class.vox::geometry::Triangle3::Builder" = type { %"class.vox::geometry::SurfaceBuilderBase", %"struct.std::array.3", %"struct.std::array.3", %"struct.std::array.4" }
%"class.vox::geometry::SurfaceBuilderBase" = type { i8, %"class.vox::geometry::Transform" }
%"class.vox::geometry::Transform" = type { %"class.vox::geometry::Matrix", %"class.vox::geometry::Orientation" }
%"class.vox::geometry::Orientation" = type { %"class.vox::geometry::Quaternion", %"class.vox::geometry::Matrix.0", %"class.vox::geometry::Matrix.0" }
%"class.vox::geometry::Quaternion" = type { double, double, double, double }
%"class.vox::geometry::Matrix.0" = type { %"struct.std::array" }
%"struct.std::array" = type { [9 x double] }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNSt5arrayIN3vox8geometry6MatrixIdLm3ELm1EEELm3EEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef nonnull align 8 dereferenceable(72)) unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNSt5arrayIN3vox8geometry6MatrixIdLm2ELm1EEELm3EEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3vox8geometry9Triangle37Builder10makeSharedEv(ptr dead_on_unwind noalias writable sret(%"class.std::shared_ptr") align 8 %0, ptr noundef nonnull align 8 dereferenceable(400) %1) #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"struct.std::array.3", align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca %"struct.std::array.3", align 8
  %9 = alloca %"struct.std::array.4", align 8
  %10 = alloca %class.anon, align 1
  store ptr %0, ptr %3, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  %11 = load ptr, ptr %4, align 8
  %12 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 408) #4
  %13 = getelementptr inbounds %"class.vox::geometry::Triangle3::Builder", ptr %11, i32 0, i32 1
  invoke void @_ZNSt5arrayIN3vox8geometry6MatrixIdLm3ELm1EEELm3EEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(72) %5, ptr noundef nonnull align 8 dereferenceable(72) %13)
          to label %14 unwind label %24

14:                                               ; preds = %2
  %15 = getelementptr inbounds %"class.vox::geometry::Triangle3::Builder", ptr %11, i32 0, i32 2
  invoke void @_ZNSt5arrayIN3vox8geometry6MatrixIdLm3ELm1EEELm3EEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(72) %8, ptr noundef nonnull align 8 dereferenceable(72) %15)
          to label %16 unwind label %24

16:                                               ; preds = %14
  %17 = getelementptr inbounds %"class.vox::geometry::Triangle3::Builder", ptr %11, i32 0, i32 3
  invoke void @_ZNSt5arrayIN3vox8geometry6MatrixIdLm2ELm1EEELm3EEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(48) %9, ptr noundef nonnull align 8 dereferenceable(48) %17)
          to label %18 unwind label %24

18:                                               ; preds = %16
  %19 = getelementptr inbounds %"class.vox::geometry::SurfaceBuilderBase", ptr %11, i32 0, i32 1
  %20 = getelementptr inbounds %"class.vox::geometry::SurfaceBuilderBase", ptr %11, i32 0, i32 0
  %21 = load i8, ptr %20, align 8, !tbaa !9, !range !19, !noundef !20
  %22 = trunc i8 %21 to i1
  invoke void @_ZN3vox8geometry9Triangle3C1ESt5arrayINS0_6MatrixIdLm3ELm1EEELm3EES5_S2_INS3_IdLm2ELm1EEELm3EERKNS0_9TransformILm3EEEb(ptr noundef nonnull align 8 dereferenceable(408) %12, ptr noundef %5, ptr noundef %8, ptr noundef %9, ptr noundef nonnull align 8 dereferenceable(200) %19, i1 noundef zeroext %22)
          to label %23 unwind label %24

23:                                               ; preds = %18
  call void @"_ZNSt10shared_ptrIN3vox8geometry9Triangle3EEC2IS2_ZNKS2_7Builder10makeSharedEvE3$_0vEEPT_T0_"(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef %12)
  ret void

24:                                               ; preds = %18, %16, %14, %2
  %25 = landingpad { ptr, i32 }
          cleanup
  %26 = extractvalue { ptr, i32 } %25, 0
  store ptr %26, ptr %6, align 8
  %27 = extractvalue { ptr, i32 } %25, 1
  store i32 %27, ptr %7, align 4
  call void @_ZdlPvm(ptr noundef %12, i64 noundef 408) #5
  br label %28

28:                                               ; preds = %24
  %29 = load ptr, ptr %6, align 8
  %30 = load i32, ptr %7, align 4
  %31 = insertvalue { ptr, i32 } poison, ptr %29, 0
  %32 = insertvalue { ptr, i32 } %31, i32 %30, 1
  resume { ptr, i32 } %32
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #2

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #3

; Function Attrs: mustprogress uwtable
declare hidden void @"_ZNSt10shared_ptrIN3vox8geometry9Triangle3EEC2IS2_ZNKS2_7Builder10makeSharedEvE3$_0vEEPT_T0_"(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #1 align 2

declare void @_ZN3vox8geometry9Triangle3C1ESt5arrayINS0_6MatrixIdLm3ELm1EEELm3EES5_S2_INS3_IdLm2ELm1EEELm3EERKNS0_9TransformILm3EEEb(ptr, ptr, ptr, ptr, ptr, i1)

attributes #0 = { 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 #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 = { nobuiltin allocsize(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 = { nobuiltin nounwind "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 = { builtin allocsize(0) }
attributes #5 = { builtin 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, !11, i64 0}
!10 = !{!"_ZTSN3vox8geometry18SurfaceBuilderBaseILm3ENS0_9Triangle37BuilderEEE", !11, i64 0, !12, i64 8}
!11 = !{!"bool", !7, i64 0}
!12 = !{!"_ZTSN3vox8geometry9TransformILm3EEE", !13, i64 0, !15, i64 24}
!13 = !{!"_ZTSN3vox8geometry6MatrixIdLm3ELm1EEE", !14, i64 0, !14, i64 8, !14, i64 16}
!14 = !{!"double", !7, i64 0}
!15 = !{!"_ZTSN3vox8geometry11OrientationILm3EEE", !16, i64 0, !17, i64 32, !17, i64 104}
!16 = !{!"_ZTSN3vox8geometry10QuaternionIdEE", !14, i64 0, !14, i64 8, !14, i64 16, !14, i64 24}
!17 = !{!"_ZTSN3vox8geometry6MatrixIdLm3ELm3EEE", !18, i64 0}
!18 = !{!"_ZTSSt5arrayIdLm9EE", !7, i64 0}
!19 = !{i8 0, i8 2}
!20 = !{}


; 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"

%"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 }
%"struct.std::array.3" = type { [3 x %"class.vox::geometry::Matrix"] }
%"class.vox::geometry::Matrix" = type { double, double, double }
%"struct.std::array.4" = type { [3 x %"class.vox::geometry::Matrix.5"] }
%"class.vox::geometry::Matrix.5" = type { double, double }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNSt5arrayIN3vox8geometry6MatrixIdLm3ELm1EEELm3EEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef nonnull align 8 dereferenceable(72)) unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNSt5arrayIN3vox8geometry6MatrixIdLm2ELm1EEELm3EEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3vox8geometry9Triangle37Builder10makeSharedEv(ptr dead_on_unwind noalias writable sret(%"class.std::shared_ptr") align 8 %0, ptr noundef nonnull align 8 dereferenceable(400) %1) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"struct.std::array.3", align 8
  %4 = alloca %"struct.std::array.3", align 8
  %5 = alloca %"struct.std::array.4", align 8
  %6 = tail call noalias noundef nonnull dereferenceable(408) ptr @_Znwm(i64 noundef 408) #4
  %7 = getelementptr inbounds i8, ptr %1, i64 208
  invoke void @_ZNSt5arrayIN3vox8geometry6MatrixIdLm3ELm1EEELm3EEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(72) %3, ptr noundef nonnull align 8 dereferenceable(72) %7)
          to label %8 unwind label %17

8:                                                ; preds = %2
  %9 = getelementptr inbounds i8, ptr %1, i64 280
  invoke void @_ZNSt5arrayIN3vox8geometry6MatrixIdLm3ELm1EEELm3EEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(72) %4, ptr noundef nonnull align 8 dereferenceable(72) %9)
          to label %10 unwind label %17

10:                                               ; preds = %8
  %11 = getelementptr inbounds i8, ptr %1, i64 352
  invoke void @_ZNSt5arrayIN3vox8geometry6MatrixIdLm2ELm1EEELm3EEC2ERKS4_(ptr noundef nonnull align 8 dereferenceable(48) %5, ptr noundef nonnull align 8 dereferenceable(48) %11)
          to label %12 unwind label %17

12:                                               ; preds = %10
  %13 = getelementptr inbounds i8, ptr %1, i64 8
  %14 = load i8, ptr %1, align 8, !tbaa !5, !range !17, !noundef !18
  %15 = trunc nuw i8 %14 to i1
  invoke void @_ZN3vox8geometry9Triangle3C1ESt5arrayINS0_6MatrixIdLm3ELm1EEELm3EES5_S2_INS3_IdLm2ELm1EEELm3EERKNS0_9TransformILm3EEEb(ptr noundef nonnull align 8 dereferenceable(408) %6, ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef nonnull %5, ptr noundef nonnull align 8 dereferenceable(200) %13, i1 noundef zeroext %15)
          to label %16 unwind label %17

16:                                               ; preds = %12
  call void @"_ZNSt10shared_ptrIN3vox8geometry9Triangle3EEC2IS2_ZNKS2_7Builder10makeSharedEvE3$_0vEEPT_T0_"(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull %6)
  ret void

17:                                               ; preds = %12, %10, %8, %2
  %18 = landingpad { ptr, i32 }
          cleanup
  call void @_ZdlPvm(ptr noundef nonnull %6, i64 noundef 408) #5
  resume { ptr, i32 } %18
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #2

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare hidden void @"_ZNSt10shared_ptrIN3vox8geometry9Triangle3EEC2IS2_ZNKS2_7Builder10makeSharedEvE3$_0vEEPT_T0_"(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #1 align 2

declare void @_ZN3vox8geometry9Triangle3C1ESt5arrayINS0_6MatrixIdLm3ELm1EEELm3EES5_S2_INS3_IdLm2ELm1EEELm3EERKNS0_9TransformILm3EEEb(ptr, ptr, ptr, ptr, ptr, i1) local_unnamed_addr

attributes #0 = { 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 #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 = { nobuiltin allocsize(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 = { nobuiltin nounwind "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 = { builtin allocsize(0) }
attributes #5 = { builtin 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 = !{!"_ZTSN3vox8geometry18SurfaceBuilderBaseILm3ENS0_9Triangle37BuilderEEE", !7, i64 0, !10, i64 8}
!7 = !{!"bool", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN3vox8geometry9TransformILm3EEE", !11, i64 0, !13, i64 24}
!11 = !{!"_ZTSN3vox8geometry6MatrixIdLm3ELm1EEE", !12, i64 0, !12, i64 8, !12, i64 16}
!12 = !{!"double", !8, i64 0}
!13 = !{!"_ZTSN3vox8geometry11OrientationILm3EEE", !14, i64 0, !15, i64 32, !15, i64 104}
!14 = !{!"_ZTSN3vox8geometry10QuaternionIdEE", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!15 = !{!"_ZTSN3vox8geometry6MatrixIdLm3ELm3EEE", !16, i64 0}
!16 = !{!"_ZTSSt5arrayIdLm9EE", !8, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass