; LLVM IR from niessner/Matterport :: code/gaps/pkgs/R3Graphics/R3SceneNode.ll (ZNK11R3SceneNode24CumulativeTransformationEv)

; 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.R3Affine = type { %class.R3Transformation, %class.R4Matrix, %class.R4Matrix, %class.RNFlags }
%class.R3Transformation = type { ptr }
%class.R4Matrix = type { [4 x [4 x double]] }
%class.RNFlags = type { i64 }

@R3identity_affine = external global %class.R3Affine, align 8

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: nounwind
declare void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272)) unnamed_addr #1

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK11R3SceneNode6ParentEv(ptr noundef nonnull align 8 dereferenceable(432)) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(272) ptr @_ZNK11R3SceneNode14TransformationEv(ptr noundef nonnull align 8 dereferenceable(432)) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK11R3SceneNode24CumulativeTransformationEv(ptr dead_on_unwind noalias writable sret(%class.R3Affine) align 8 %0, ptr noundef nonnull align 8 dereferenceable(432) %1) #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i1, align 1
  %6 = alloca ptr, align 8
  %7 = alloca %class.R3Affine, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  store ptr %0, ptr %3, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  %10 = load ptr, ptr %4, align 8
  store i1 false, ptr %5, align 1
  call void @_ZN8R3AffineC2ERKS_(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef nonnull align 8 dereferenceable(272) @R3identity_affine)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store ptr %10, ptr %6, align 8, !tbaa !5
  br label %11

11:                                               ; preds = %25, %2
  %12 = load ptr, ptr %6, align 8, !tbaa !5
  %13 = icmp ne ptr %12, null
  br i1 %13, label %14, label %35

14:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 272, ptr %7) #6
  invoke void @_ZN8R3AffineC2ERKS_(ptr noundef nonnull align 8 dereferenceable(272) %7, ptr noundef nonnull align 8 dereferenceable(272) @R3identity_affine)
          to label %15 unwind label %26

15:                                               ; preds = %14
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = invoke noundef nonnull align 8 dereferenceable(272) ptr @_ZNK11R3SceneNode14TransformationEv(ptr noundef nonnull align 8 dereferenceable(432) %16)
          to label %18 unwind label %30

18:                                               ; preds = %15
  invoke void @_ZN8R3Affine9TransformERKS_(ptr noundef nonnull align 8 dereferenceable(272) %7, ptr noundef nonnull align 8 dereferenceable(272) %17)
          to label %19 unwind label %30

19:                                               ; preds = %18
  invoke void @_ZN8R3Affine9TransformERKS_(ptr noundef nonnull align 8 dereferenceable(272) %7, ptr noundef nonnull align 8 dereferenceable(272) %0)
          to label %20 unwind label %30

20:                                               ; preds = %19
  %21 = invoke noundef nonnull align 8 dereferenceable(272) ptr @_ZN8R3AffineaSERKS_(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef nonnull align 8 dereferenceable(272) %7)
          to label %22 unwind label %30

22:                                               ; preds = %20
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = invoke noundef ptr @_ZNK11R3SceneNode6ParentEv(ptr noundef nonnull align 8 dereferenceable(432) %23)
          to label %25 unwind label %30

25:                                               ; preds = %22
  store ptr %24, ptr %6, align 8, !tbaa !5
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %7) #6
  call void @llvm.lifetime.end.p0(i64 272, ptr %7) #6
  br label %11, !llvm.loop !9

26:                                               ; preds = %14
  %27 = landingpad { ptr, i32 }
          cleanup
  %28 = extractvalue { ptr, i32 } %27, 0
  store ptr %28, ptr %8, align 8
  %29 = extractvalue { ptr, i32 } %27, 1
  store i32 %29, ptr %9, align 4
  br label %34

30:                                               ; preds = %22, %20, %19, %18, %15
  %31 = landingpad { ptr, i32 }
          cleanup
  %32 = extractvalue { ptr, i32 } %31, 0
  store ptr %32, ptr %8, align 8
  %33 = extractvalue { ptr, i32 } %31, 1
  store i32 %33, ptr %9, align 4
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %7) #6
  br label %34

34:                                               ; preds = %30, %26
  call void @llvm.lifetime.end.p0(i64 272, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %0) #6
  br label %39

35:                                               ; preds = %11
  store i1 true, ptr %5, align 1
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  %36 = load i1, ptr %5, align 1
  br i1 %36, label %38, label %37

37:                                               ; preds = %35
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %0) #6
  br label %38

38:                                               ; preds = %37, %35
  ret void

39:                                               ; preds = %34
  %40 = load ptr, ptr %8, align 8
  %41 = load i32, ptr %9, align 4
  %42 = insertvalue { ptr, i32 } poison, ptr %40, 0
  %43 = insertvalue { ptr, i32 } %42, i32 %41, 1
  resume { ptr, i32 } %43
}

declare void @_ZN8R3Affine9TransformERKS_(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef nonnull align 8 dereferenceable(272)) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(272) ptr @_ZN8R3AffineaSERKS_(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef nonnull align 8 dereferenceable(272)) #0 align 2

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 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 = { "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 #6 = { 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 = distinct !{!9, !10}
!10 = !{!"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"

%class.R3Affine = type { %class.R3Transformation, %class.R4Matrix, %class.R4Matrix, %class.RNFlags }
%class.R3Transformation = type { ptr }
%class.R4Matrix = type { [4 x [4 x double]] }
%class.RNFlags = type { i64 }

@R3identity_affine = external global %class.R3Affine, align 8

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: nounwind
declare void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272)) unnamed_addr #1

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK11R3SceneNode6ParentEv(ptr noundef nonnull align 8 dereferenceable(432)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(272) ptr @_ZNK11R3SceneNode14TransformationEv(ptr noundef nonnull align 8 dereferenceable(432)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK11R3SceneNode24CumulativeTransformationEv(ptr dead_on_unwind noalias nonnull writable sret(%class.R3Affine) align 8 %0, ptr noundef nonnull align 8 dereferenceable(432) %1) local_unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %class.R3Affine, align 8
  tail call void @_ZN8R3AffineC2ERKS_(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef nonnull align 8 dereferenceable(272) @R3identity_affine)
  br label %4

4:                                                ; preds = %2, %10
  %.079 = phi ptr [ %1, %2 ], [ %11, %10 ]
  call void @llvm.lifetime.start.p0(i64 272, ptr nonnull %3) #6
  invoke void @_ZN8R3AffineC2ERKS_(ptr noundef nonnull align 8 dereferenceable(272) %3, ptr noundef nonnull align 8 dereferenceable(272) @R3identity_affine)
          to label %5 unwind label %12

5:                                                ; preds = %4
  %6 = call noundef nonnull align 8 dereferenceable(272) ptr @_ZNK11R3SceneNode14TransformationEv(ptr noundef nonnull align 8 dereferenceable(432) %.079)
  invoke void @_ZN8R3Affine9TransformERKS_(ptr noundef nonnull align 8 dereferenceable(272) %3, ptr noundef nonnull align 8 dereferenceable(272) %6)
          to label %7 unwind label %14

7:                                                ; preds = %5
  invoke void @_ZN8R3Affine9TransformERKS_(ptr noundef nonnull align 8 dereferenceable(272) %3, ptr noundef nonnull align 8 dereferenceable(272) %0)
          to label %8 unwind label %14

8:                                                ; preds = %7
  %9 = invoke noundef nonnull align 8 dereferenceable(272) ptr @_ZN8R3AffineaSERKS_(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef nonnull align 8 dereferenceable(272) %3)
          to label %10 unwind label %14

10:                                               ; preds = %8
  %11 = call noundef ptr @_ZNK11R3SceneNode6ParentEv(ptr noundef nonnull align 8 dereferenceable(432) %.079)
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %3) #6
  call void @llvm.lifetime.end.p0(i64 272, ptr nonnull %3) #6
  %.not = icmp eq ptr %11, null
  br i1 %.not, label %17, label %4, !llvm.loop !5

12:                                               ; preds = %4
  %13 = landingpad { ptr, i32 }
          cleanup
  br label %16

14:                                               ; preds = %8, %7, %5
  %15 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %3) #6
  br label %16

16:                                               ; preds = %14, %12
  %.pn = phi { ptr, i32 } [ %15, %14 ], [ %13, %12 ]
  call void @llvm.lifetime.end.p0(i64 272, ptr nonnull %3) #6
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %0) #6
  resume { ptr, i32 } %.pn

17:                                               ; preds = %10
  ret void
}

declare void @_ZN8R3Affine9TransformERKS_(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef nonnull align 8 dereferenceable(272)) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(272) ptr @_ZN8R3AffineaSERKS_(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef nonnull align 8 dereferenceable(272)) local_unnamed_addr #0 align 2

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 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 = { "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 #6 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass