; LLVM IR from Lut1n/ImpGears :: src/ImpGears/Renderer (RenderVisitor)

; 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 }
%"class.imp::Matrix" = type { %"class.imp::Object", [16 x float] }
%"class.imp::Object" = type { ptr, %"class.std::shared_ptr.0" }
%"class.std::shared_ptr.0" = type { %"class.std::__shared_ptr.1" }
%"class.std::__shared_ptr.1" = type { ptr, %"class.std::__shared_count" }
%"struct.imp::StateStack" = type <{ %"class.std::vector", i32, [4 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<imp::StackItem, std::allocator<imp::StackItem>>::_Vector_impl" }
%"struct.std::_Vector_base<imp::StackItem, std::allocator<imp::StackItem>>::_Vector_impl" = type { %"struct.std::_Vector_base<imp::StackItem, std::allocator<imp::StackItem>>::_Vector_impl_data" }
%"struct.std::_Vector_base<imp::StackItem, std::allocator<imp::StackItem>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.imp::StackItem" = type { %"class.std::shared_ptr", %"class.std::shared_ptr", %"class.imp::Matrix4" }
%"class.imp::Matrix4" = type { %"class.imp::Matrix" }

declare i32 @__gxx_personality_v0(...)

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

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

; 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 void @_ZNSt10shared_ptrIN3imp5StateEEC2EDn(ptr noundef nonnull align 8 dereferenceable(16), ptr) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3imp9StackItem5resetEv(ptr noundef nonnull align 8 dereferenceable(120)) #2 align 2

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

declare void @_ZN3imp5State5cloneERKSt10shared_ptrIS0_ENS0_8CloneOptE(ptr noundef nonnull align 8 dereferenceable(306), ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(88) ptr @_ZN3imp7Matrix4aSERKS0_(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef nonnull align 8 dereferenceable(88)) #4 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3imp10StateStack4pushESt10shared_ptrINS_5StateEERKNS_7Matrix4E(ptr noundef nonnull align 8 dereferenceable(28) %0, ptr noundef %1, ptr noundef nonnull align 8 dereferenceable(88) %2) #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %"class.std::shared_ptr", align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca %"class.imp::Matrix", align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %14 = load ptr, ptr %4, align 8
  %15 = getelementptr inbounds %"struct.imp::StateStack", ptr %14, i32 0, i32 1
  %16 = load i32, ptr %15, align 8, !tbaa !9
  %17 = add nsw i32 %16, 1
  store i32 %17, ptr %15, align 8, !tbaa !9
  %18 = call noundef i32 @_ZN3imp10StateStack4sizeEv(ptr noundef nonnull align 8 dereferenceable(28) %14)
  %19 = getelementptr inbounds %"struct.imp::StateStack", ptr %14, i32 0, i32 0
  %20 = call noundef i64 @_ZNKSt6vectorIN3imp9StackItemESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %19) #5
  %21 = trunc i64 %20 to i32
  %22 = icmp sgt i32 %18, %21
  br i1 %22, label %23, label %27

23:                                               ; preds = %3
  %24 = getelementptr inbounds %"struct.imp::StateStack", ptr %14, i32 0, i32 0
  %25 = call noundef i32 @_ZN3imp10StateStack4sizeEv(ptr noundef nonnull align 8 dereferenceable(28) %14)
  %26 = sext i32 %25 to i64
  call void @_ZNSt6vectorIN3imp9StackItemESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %24, i64 noundef %26)
  br label %27

27:                                               ; preds = %23, %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %28 = getelementptr inbounds %"struct.imp::StateStack", ptr %14, i32 0, i32 0
  %29 = getelementptr inbounds %"struct.imp::StateStack", ptr %14, i32 0, i32 1
  %30 = load i32, ptr %29, align 8, !tbaa !9
  %31 = sext i32 %30 to i64
  %32 = call noundef nonnull align 8 dereferenceable(120) ptr @_ZNSt6vectorIN3imp9StackItemESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %28, i64 noundef %31) #5
  store ptr %32, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #5
  call void @_ZNSt10shared_ptrIN3imp5StateEEC2EDn(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr null) #5
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = getelementptr inbounds %"struct.imp::StackItem", ptr %33, i32 0, i32 1
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrIN3imp5StateEEaSEOS2_(ptr noundef nonnull align 8 dereferenceable(16) %34, ptr noundef nonnull align 8 dereferenceable(16) %8) #5
  call void @_ZNSt12__shared_ptrIN3imp5StateELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #5
  %36 = getelementptr inbounds %"struct.imp::StateStack", ptr %14, i32 0, i32 1
  %37 = load i32, ptr %36, align 8, !tbaa !9
  %38 = icmp eq i32 %37, 0
  br i1 %38, label %39, label %52

39:                                               ; preds = %27
  %40 = call noundef zeroext i1 @_ZNKSt12__shared_ptrIN3imp5StateELN9__gnu_cxx12_Lock_policyE2EEcvbEv(ptr noundef nonnull align 8 dereferenceable(16) %1) #5
  br i1 %40, label %41, label %45

41:                                               ; preds = %39
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = getelementptr inbounds %"struct.imp::StackItem", ptr %42, i32 0, i32 0
  %44 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3imp5StateELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %43) #5
  call void @_ZN3imp5State5cloneERKSt10shared_ptrIS0_ENS0_8CloneOptE(ptr noundef nonnull align 8 dereferenceable(306) %44, ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef 3)
  br label %47

45:                                               ; preds = %39
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN3imp9StackItem5resetEv(ptr noundef nonnull align 8 dereferenceable(120) %46)
  br label %47

47:                                               ; preds = %45, %41
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  %50 = getelementptr inbounds %"struct.imp::StackItem", ptr %49, i32 0, i32 2
  %51 = call noundef nonnull align 8 dereferenceable(88) ptr @_ZN3imp7Matrix4aSERKS0_(ptr noundef nonnull align 8 dereferenceable(88) %50, ptr noundef nonnull align 8 dereferenceable(88) %48)
  br label %96

52:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %53 = getelementptr inbounds %"struct.imp::StateStack", ptr %14, i32 0, i32 0
  %54 = getelementptr inbounds %"struct.imp::StateStack", ptr %14, i32 0, i32 1
  %55 = load i32, ptr %54, align 8, !tbaa !9
  %56 = sub nsw i32 %55, 1
  %57 = sext i32 %56 to i64
  %58 = call noundef nonnull align 8 dereferenceable(120) ptr @_ZNSt6vectorIN3imp9StackItemESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %53, i64 noundef %57) #5
  store ptr %58, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %59 = load ptr, ptr %9, align 8, !tbaa !5
  %60 = getelementptr inbounds %"struct.imp::StackItem", ptr %59, i32 0, i32 1
  %61 = call noundef zeroext i1 @_ZNKSt12__shared_ptrIN3imp5StateELN9__gnu_cxx12_Lock_policyE2EEcvbEv(ptr noundef nonnull align 8 dereferenceable(16) %60) #5
  br i1 %61, label %62, label %65

62:                                               ; preds = %52
  %63 = load ptr, ptr %9, align 8, !tbaa !5
  %64 = getelementptr inbounds %"struct.imp::StackItem", ptr %63, i32 0, i32 1
  br label %68

65:                                               ; preds = %52
  %66 = load ptr, ptr %9, align 8, !tbaa !5
  %67 = getelementptr inbounds %"struct.imp::StackItem", ptr %66, i32 0, i32 0
  br label %68

68:                                               ; preds = %65, %62
  %69 = phi ptr [ %64, %62 ], [ %67, %65 ]
  store ptr %69, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 88, ptr %11) #5
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = load ptr, ptr %9, align 8, !tbaa !5
  %72 = getelementptr inbounds %"struct.imp::StackItem", ptr %71, i32 0, i32 2
  call void @_ZNK3imp6MatrixILi4ELi4EfEmlERKS1_(ptr dead_on_unwind writable sret(%"class.imp::Matrix") align 8 %11, ptr noundef nonnull align 8 dereferenceable(88) %70, ptr noundef nonnull align 8 dereferenceable(88) %72)
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  %74 = getelementptr inbounds %"struct.imp::StackItem", ptr %73, i32 0, i32 2
  %75 = invoke noundef nonnull align 8 dereferenceable(88) ptr @_ZN3imp7Matrix4aSERKNS_6MatrixILi4ELi4EfEE(ptr noundef nonnull align 8 dereferenceable(88) %74, ptr noundef nonnull align 8 dereferenceable(88) %11)
          to label %76 unwind label %86

76:                                               ; preds = %68
  call void @_ZN3imp6ObjectD2Ev(ptr noundef nonnull align 8 dereferenceable(88) %11) #5
  call void @llvm.lifetime.end.p0(i64 88, ptr %11) #5
  %77 = call noundef zeroext i1 @_ZNKSt12__shared_ptrIN3imp5StateELN9__gnu_cxx12_Lock_policyE2EEcvbEv(ptr noundef nonnull align 8 dereferenceable(16) %1) #5
  br i1 %77, label %78, label %90

78:                                               ; preds = %76
  %79 = load ptr, ptr %7, align 8, !tbaa !5
  %80 = getelementptr inbounds %"struct.imp::StackItem", ptr %79, i32 0, i32 0
  %81 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3imp5StateELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %80) #5
  %82 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN3imp5State5cloneERKSt10shared_ptrIS0_ENS0_8CloneOptE(ptr noundef nonnull align 8 dereferenceable(306) %81, ptr noundef nonnull align 8 dereferenceable(16) %82, i32 noundef 3)
  %83 = load ptr, ptr %7, align 8, !tbaa !5
  %84 = getelementptr inbounds %"struct.imp::StackItem", ptr %83, i32 0, i32 0
  %85 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3imp5StateELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %84) #5
  call void @_ZN3imp5State5cloneERKSt10shared_ptrIS0_ENS0_8CloneOptE(ptr noundef nonnull align 8 dereferenceable(306) %85, ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef 4)
  br label %95

86:                                               ; preds = %68
  %87 = landingpad { ptr, i32 }
          cleanup
  %88 = extractvalue { ptr, i32 } %87, 0
  store ptr %88, ptr %12, align 8
  %89 = extractvalue { ptr, i32 } %87, 1
  store i32 %89, ptr %13, align 4
  call void @_ZN3imp6ObjectD2Ev(ptr noundef nonnull align 8 dereferenceable(88) %11) #5
  call void @llvm.lifetime.end.p0(i64 88, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %97

90:                                               ; preds = %76
  %91 = load ptr, ptr %10, align 8, !tbaa !5
  %92 = load ptr, ptr %7, align 8, !tbaa !5
  %93 = getelementptr inbounds %"struct.imp::StackItem", ptr %92, i32 0, i32 1
  %94 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrIN3imp5StateEEaSERKS2_(ptr noundef nonnull align 8 dereferenceable(16) %93, ptr noundef nonnull align 8 dereferenceable(16) %91) #5
  br label %95

95:                                               ; preds = %90, %78
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %96

96:                                               ; preds = %95, %47
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  ret void

97:                                               ; preds = %86
  %98 = load ptr, ptr %12, align 8
  %99 = load i32, ptr %13, align 4
  %100 = insertvalue { ptr, i32 } poison, ptr %98, 0
  %101 = insertvalue { ptr, i32 } %100, i32 %99, 1
  resume { ptr, i32 } %101
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIN3imp9StackItemESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt12__shared_ptrIN3imp5StateELN9__gnu_cxx12_Lock_policyE2EEcvbEv(ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3imp6MatrixILi4ELi4EfEmlERKS1_(ptr dead_on_unwind noalias writable sret(%"class.imp::Matrix") align 8, ptr noundef nonnull align 8 dereferenceable(88), ptr noundef nonnull align 8 dereferenceable(88)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(88) ptr @_ZN3imp7Matrix4aSERKNS_6MatrixILi4ELi4EfEE(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef nonnull align 8 dereferenceable(88)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3imp6ObjectD2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt12__shared_ptrIN3imp5StateELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1 align 2

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 = { "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, !15, i64 24}
!10 = !{!"_ZTSN3imp10StateStackE", !11, i64 0, !15, i64 24}
!11 = !{!"_ZTSSt6vectorIN3imp9StackItemESaIS1_EE", !12, i64 0}
!12 = !{!"_ZTSSt12_Vector_baseIN3imp9StackItemESaIS1_EE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIN3imp9StackItemESaIS1_EE12_Vector_implE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIN3imp9StackItemESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!15 = !{!"int", !7, 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"

%"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 }
%"class.imp::Matrix" = type { %"class.imp::Object", [16 x float] }
%"class.imp::Object" = type { ptr, %"class.std::shared_ptr.0" }
%"class.std::shared_ptr.0" = type { %"class.std::__shared_ptr.1" }
%"class.std::__shared_ptr.1" = type { ptr, %"class.std::__shared_count" }

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrIN3imp5StateEEaSEOS2_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress 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 void @_ZNSt10shared_ptrIN3imp5StateEEC2EDn(ptr noundef nonnull align 8 dereferenceable(16), ptr) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3imp9StackItem5resetEv(ptr noundef nonnull align 8 dereferenceable(120)) local_unnamed_addr #2 align 2

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

declare void @_ZN3imp5State5cloneERKSt10shared_ptrIS0_ENS0_8CloneOptE(ptr noundef nonnull align 8 dereferenceable(306), ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(88) ptr @_ZN3imp7Matrix4aSERKS0_(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef nonnull align 8 dereferenceable(88)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3imp10StateStack4pushESt10shared_ptrINS_5StateEERKNS_7Matrix4E(ptr noundef nonnull align 8 dereferenceable(28) %0, ptr noundef %1, ptr noundef nonnull align 8 dereferenceable(88) %2) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.std::shared_ptr", align 8
  %5 = alloca %"class.imp::Matrix", align 8
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  %7 = load i32, ptr %6, align 8, !tbaa !5
  %8 = add nsw i32 %7, 1
  store i32 %8, ptr %6, align 8, !tbaa !5
  %9 = tail call noundef i32 @_ZN3imp10StateStack4sizeEv(ptr noundef nonnull align 8 dereferenceable(28) %0)
  %10 = tail call noundef i64 @_ZNKSt6vectorIN3imp9StackItemESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  %11 = trunc i64 %10 to i32
  %12 = icmp sgt i32 %9, %11
  br i1 %12, label %13, label %16

13:                                               ; preds = %3
  %14 = tail call noundef i32 @_ZN3imp10StateStack4sizeEv(ptr noundef nonnull align 8 dereferenceable(28) %0)
  %15 = sext i32 %14 to i64
  tail call void @_ZNSt6vectorIN3imp9StackItemESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %15)
  br label %16

16:                                               ; preds = %13, %3
  %17 = load i32, ptr %6, align 8, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = tail call noundef nonnull align 8 dereferenceable(120) ptr @_ZNSt6vectorIN3imp9StackItemESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %18) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #5
  call void @_ZNSt10shared_ptrIN3imp5StateEEC2EDn(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr null) #5
  %20 = getelementptr inbounds i8, ptr %19, i64 16
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrIN3imp5StateEEaSEOS2_(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 8 dereferenceable(16) %4) #5
  call void @_ZNSt12__shared_ptrIN3imp5StateELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #5
  %22 = load i32, ptr %6, align 8, !tbaa !5
  %23 = icmp eq i32 %22, 0
  br i1 %23, label %24, label %32

24:                                               ; preds = %16
  %25 = call noundef zeroext i1 @_ZNKSt12__shared_ptrIN3imp5StateELN9__gnu_cxx12_Lock_policyE2EEcvbEv(ptr noundef nonnull align 8 dereferenceable(16) %1) #5
  br i1 %25, label %26, label %28

26:                                               ; preds = %24
  %27 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3imp5StateELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %19) #5
  call void @_ZN3imp5State5cloneERKSt10shared_ptrIS0_ENS0_8CloneOptE(ptr noundef nonnull align 8 dereferenceable(306) %27, ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef 3)
  br label %29

28:                                               ; preds = %24
  call void @_ZN3imp9StackItem5resetEv(ptr noundef nonnull align 8 dereferenceable(120) %19)
  br label %29

29:                                               ; preds = %28, %26
  %30 = getelementptr inbounds i8, ptr %19, i64 32
  %31 = call noundef nonnull align 8 dereferenceable(88) ptr @_ZN3imp7Matrix4aSERKS0_(ptr noundef nonnull align 8 dereferenceable(88) %30, ptr noundef nonnull align 8 dereferenceable(88) %2)
  br label %51

32:                                               ; preds = %16
  %33 = add nsw i32 %22, -1
  %34 = sext i32 %33 to i64
  %35 = call noundef nonnull align 8 dereferenceable(120) ptr @_ZNSt6vectorIN3imp9StackItemESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %34) #5
  %36 = getelementptr inbounds i8, ptr %35, i64 16
  %37 = call noundef zeroext i1 @_ZNKSt12__shared_ptrIN3imp5StateELN9__gnu_cxx12_Lock_policyE2EEcvbEv(ptr noundef nonnull align 8 dereferenceable(16) %36) #5
  %38 = select i1 %37, ptr %36, ptr %35
  call void @llvm.lifetime.start.p0(i64 88, ptr nonnull %5) #5
  %39 = getelementptr inbounds i8, ptr %35, i64 32
  call void @_ZNK3imp6MatrixILi4ELi4EfEmlERKS1_(ptr dead_on_unwind nonnull writable sret(%"class.imp::Matrix") align 8 %5, ptr noundef nonnull align 8 dereferenceable(88) %2, ptr noundef nonnull align 8 dereferenceable(88) %39)
  %40 = getelementptr inbounds i8, ptr %19, i64 32
  %41 = invoke noundef nonnull align 8 dereferenceable(88) ptr @_ZN3imp7Matrix4aSERKNS_6MatrixILi4ELi4EfEE(ptr noundef nonnull align 8 dereferenceable(88) %40, ptr noundef nonnull align 8 dereferenceable(88) %5)
          to label %42 unwind label %47

42:                                               ; preds = %32
  call void @_ZN3imp6ObjectD2Ev(ptr noundef nonnull align 8 dereferenceable(88) %5) #5
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %5) #5
  %43 = call noundef zeroext i1 @_ZNKSt12__shared_ptrIN3imp5StateELN9__gnu_cxx12_Lock_policyE2EEcvbEv(ptr noundef nonnull align 8 dereferenceable(16) %1) #5
  br i1 %43, label %44, label %49

44:                                               ; preds = %42
  %45 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3imp5StateELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %19) #5
  call void @_ZN3imp5State5cloneERKSt10shared_ptrIS0_ENS0_8CloneOptE(ptr noundef nonnull align 8 dereferenceable(306) %45, ptr noundef nonnull align 8 dereferenceable(16) %38, i32 noundef 3)
  %46 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3imp5StateELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %19) #5
  call void @_ZN3imp5State5cloneERKSt10shared_ptrIS0_ENS0_8CloneOptE(ptr noundef nonnull align 8 dereferenceable(306) %46, ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef 4)
  br label %51

47:                                               ; preds = %32
  %48 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3imp6ObjectD2Ev(ptr noundef nonnull align 8 dereferenceable(88) %5) #5
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %5) #5
  resume { ptr, i32 } %48

49:                                               ; preds = %42
  %50 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrIN3imp5StateEEaSERKS2_(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 8 dereferenceable(16) %38) #5
  br label %51

51:                                               ; preds = %44, %49, %29
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN3imp10StateStack4sizeEv(ptr noundef nonnull align 8 dereferenceable(28)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIN3imp9StackItemESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIN3imp9StackItemESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(120) ptr @_ZNSt6vectorIN3imp9StackItemESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt12__shared_ptrIN3imp5StateELN9__gnu_cxx12_Lock_policyE2EEcvbEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3imp6MatrixILi4ELi4EfEmlERKS1_(ptr dead_on_unwind noalias writable sret(%"class.imp::Matrix") align 8, ptr noundef nonnull align 8 dereferenceable(88), ptr noundef nonnull align 8 dereferenceable(88)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(88) ptr @_ZN3imp7Matrix4aSERKNS_6MatrixILi4ELi4EfEE(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef nonnull align 8 dereferenceable(88)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3imp6ObjectD2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrIN3imp5StateEEaSERKS2_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt12__shared_ptrIN3imp5StateELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1 align 2

attributes #0 = { mustprogress 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 = { "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, !14, i64 24}
!6 = !{!"_ZTSN3imp10StateStackE", !7, i64 0, !14, i64 24}
!7 = !{!"_ZTSSt6vectorIN3imp9StackItemESaIS1_EE", !8, i64 0}
!8 = !{!"_ZTSSt12_Vector_baseIN3imp9StackItemESaIS1_EE", !9, i64 0}
!9 = !{!"_ZTSNSt12_Vector_baseIN3imp9StackItemESaIS1_EE12_Vector_implE", !10, i64 0}
!10 = !{!"_ZTSNSt12_Vector_baseIN3imp9StackItemESaIS1_EE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!11 = !{!"any pointer", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C++ TBAA"}
!14 = !{!"int", !12, i64 0}


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