; LLVM IR from lynx-family/primjs :: src/napi (napi)

; 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.Napi::PropertyDescriptor" = type { %struct.napi_property_descriptor }
%struct.napi_property_descriptor = type { ptr, ptr, ptr, ptr, ptr, ptr, i32, ptr }
%"class.Napi::Env" = type { ptr }
%"class.Napi::Object" = type { %"class.Napi::Value" }
%"class.Napi::Value" = type { ptr, ptr }
%class.anon.9 = type { i8 }
%"struct.Napi::details::AccessorCallbackData" = 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: mustprogress uwtable
declare dso_local void @_ZN4Napi6Object12AddFinalizerEPvPFvP10napi_env__S1_S1_ES1_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, ptr noundef, ptr noundef) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Napi18PropertyDescriptor8AccessorENS_3EnvENS_6ObjectEPKcPFNS_5ValueERKNS_12CallbackInfoEEPFvS8_RKS5_E24napi_property_attributesPv(ptr dead_on_unwind noalias writable sret(%"class.Napi::PropertyDescriptor") align 8 %0, ptr %1, ptr %2, ptr %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, i32 noundef %7, ptr noundef %8) #1 align 2 {
  %10 = alloca %"class.Napi::Env", align 8
  %11 = alloca %"class.Napi::Object", align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca %class.anon.9, align 1
  %19 = alloca %struct.napi_property_descriptor, align 8
  %20 = getelementptr inbounds %"class.Napi::Env", ptr %10, i32 0, i32 0
  store ptr %1, ptr %20, align 8
  %21 = getelementptr inbounds { ptr, ptr }, ptr %11, i32 0, i32 0
  store ptr %2, ptr %21, align 8
  %22 = getelementptr inbounds { ptr, ptr }, ptr %11, i32 0, i32 1
  store ptr %3, ptr %22, align 8
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  store ptr %6, ptr %14, align 8, !tbaa !5
  store i32 %7, ptr %15, align 4, !tbaa !9
  store ptr %8, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %23 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 24) #5
  %24 = getelementptr inbounds %"struct.Napi::details::AccessorCallbackData", ptr %23, i32 0, i32 0
  %25 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %25, ptr %24, align 16, !tbaa !11
  %26 = getelementptr inbounds %"struct.Napi::details::AccessorCallbackData", ptr %23, i32 0, i32 1
  %27 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %27, ptr %26, align 8, !tbaa !13
  %28 = getelementptr inbounds %"struct.Napi::details::AccessorCallbackData", ptr %23, i32 0, i32 2
  %29 = load ptr, ptr %16, align 8, !tbaa !5
  store ptr %29, ptr %28, align 16, !tbaa !14
  store ptr %23, ptr %17, align 8, !tbaa !5
  %30 = load ptr, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %18) #4
  %31 = call noundef ptr @"_ZZN4Napi18PropertyDescriptor8AccessorENS_3EnvENS_6ObjectEPKcPFNS_5ValueERKNS_12CallbackInfoEEPFvS8_RKS5_E24napi_property_attributesPvENK3$_0cvPFvP10napi_env__SG_SG_EEv"(ptr noundef nonnull align 1 dereferenceable(1) %18) #4
  call void @_ZN4Napi6Object12AddFinalizerEPvPFvP10napi_env__S1_S1_ES1_(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef %30, ptr noundef %31, ptr noundef null)
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #4
  %32 = getelementptr inbounds %struct.napi_property_descriptor, ptr %19, i32 0, i32 0
  %33 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %33, ptr %32, align 8, !tbaa !15
  %34 = getelementptr inbounds %struct.napi_property_descriptor, ptr %19, i32 0, i32 1
  store ptr null, ptr %34, align 8, !tbaa !17
  %35 = getelementptr inbounds %struct.napi_property_descriptor, ptr %19, i32 0, i32 2
  store ptr null, ptr %35, align 8, !tbaa !18
  %36 = getelementptr inbounds %struct.napi_property_descriptor, ptr %19, i32 0, i32 3
  %37 = load ptr, ptr %13, align 8, !tbaa !5
  %38 = icmp ne ptr %37, null
  br i1 %38, label %39, label %41

39:                                               ; preds = %9
  %40 = load ptr, ptr %17, align 8, !tbaa !5
  br label %42

41:                                               ; preds = %9
  br label %42

42:                                               ; preds = %41, %39
  %43 = phi ptr [ @_ZN4Napi7details20AccessorCallbackData13GetterWrapperEP10napi_env__P20napi_callback_info__, %39 ], [ null, %41 ]
  store ptr %43, ptr %36, align 8, !tbaa !19
  %44 = getelementptr inbounds %struct.napi_property_descriptor, ptr %19, i32 0, i32 4
  %45 = load ptr, ptr %14, align 8, !tbaa !5
  %46 = icmp ne ptr %45, null
  br i1 %46, label %47, label %49

47:                                               ; preds = %42
  %48 = load ptr, ptr %17, align 8, !tbaa !5
  br label %50

49:                                               ; preds = %42
  br label %50

50:                                               ; preds = %49, %47
  %51 = phi ptr [ @_ZN4Napi7details20AccessorCallbackData13SetterWrapperEP10napi_env__P20napi_callback_info__, %47 ], [ null, %49 ]
  store ptr %51, ptr %44, align 8, !tbaa !20
  %52 = getelementptr inbounds %struct.napi_property_descriptor, ptr %19, i32 0, i32 5
  store ptr null, ptr %52, align 8, !tbaa !21
  %53 = getelementptr inbounds %struct.napi_property_descriptor, ptr %19, i32 0, i32 6
  %54 = load i32, ptr %15, align 4, !tbaa !9
  store i32 %54, ptr %53, align 8, !tbaa !22
  %55 = getelementptr inbounds %struct.napi_property_descriptor, ptr %19, i32 0, i32 7
  %56 = load ptr, ptr %17, align 8, !tbaa !5
  store ptr %56, ptr %55, align 8, !tbaa !23
  call void @_ZN4Napi18PropertyDescriptorC2E24napi_property_descriptor(ptr noundef nonnull align 8 dereferenceable(64) %0, ptr noundef byval(%struct.napi_property_descriptor) align 8 %19)
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef ptr @"_ZZN4Napi18PropertyDescriptor8AccessorENS_3EnvENS_6ObjectEPKcPFNS_5ValueERKNS_12CallbackInfoEEPFvS8_RKS5_E24napi_property_attributesPvENK3$_0cvPFvP10napi_env__SG_SG_EEv"(ptr noundef nonnull align 1 dereferenceable(1)) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN4Napi7details20AccessorCallbackData13GetterWrapperEP10napi_env__P20napi_callback_info__(ptr noundef, ptr noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN4Napi7details20AccessorCallbackData13SetterWrapperEP10napi_env__P20napi_callback_info__(ptr noundef, ptr noundef) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4Napi18PropertyDescriptorC2E24napi_property_descriptor(ptr noundef nonnull align 8 dereferenceable(64), ptr noundef byval(%struct.napi_property_descriptor) align 8) unnamed_addr #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { nounwind }
attributes #5 = { builtin allocsize(0) }

!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 = !{!"_ZTS24napi_property_attributes", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTSN4Napi7details20AccessorCallbackDataE", !6, i64 0, !6, i64 8, !6, i64 16}
!13 = !{!12, !6, i64 8}
!14 = !{!12, !6, i64 16}
!15 = !{!16, !6, i64 0}
!16 = !{!"_ZTS24napi_property_descriptor", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !10, i64 48, !6, i64 56}
!17 = !{!16, !6, i64 8}
!18 = !{!16, !6, i64 16}
!19 = !{!16, !6, i64 24}
!20 = !{!16, !6, i64 32}
!21 = !{!16, !6, i64 40}
!22 = !{!16, !10, i64 48}
!23 = !{!16, !6, i64 56}


; 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.Napi::PropertyDescriptor" = type { %struct.napi_property_descriptor }
%struct.napi_property_descriptor = type { ptr, ptr, ptr, ptr, ptr, ptr, i32, ptr }
%"class.Napi::Object" = type { %"class.Napi::Value" }
%"class.Napi::Value" = type { ptr, ptr }
%class.anon.9 = type { i8 }

; 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Napi18PropertyDescriptor8AccessorENS_3EnvENS_6ObjectEPKcPFNS_5ValueERKNS_12CallbackInfoEEPFvS8_RKS5_E24napi_property_attributesPv(ptr dead_on_unwind noalias writable sret(%"class.Napi::PropertyDescriptor") align 8 %0, ptr nocapture readnone %1, ptr %2, ptr %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, i32 noundef %7, ptr noundef %8) local_unnamed_addr #1 align 2 {
  %10 = alloca %"class.Napi::Object", align 8
  %11 = alloca %class.anon.9, align 1
  %12 = alloca %struct.napi_property_descriptor, align 8
  store ptr %2, ptr %10, align 8
  %13 = getelementptr inbounds i8, ptr %10, i64 8
  store ptr %3, ptr %13, align 8
  %14 = tail call noalias noundef nonnull dereferenceable(24) ptr @_Znwm(i64 noundef 24) #5
  store ptr %5, ptr %14, align 16, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %14, i64 8
  store ptr %6, ptr %15, align 8, !tbaa !10
  %16 = getelementptr inbounds i8, ptr %14, i64 16
  store ptr %8, ptr %16, align 16, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %11) #6
  %17 = call noundef ptr @"_ZZN4Napi18PropertyDescriptor8AccessorENS_3EnvENS_6ObjectEPKcPFNS_5ValueERKNS_12CallbackInfoEEPFvS8_RKS5_E24napi_property_attributesPvENK3$_0cvPFvP10napi_env__SG_SG_EEv"(ptr noundef nonnull align 1 dereferenceable(1) %11) #6
  call void @_ZN4Napi6Object12AddFinalizerEPvPFvP10napi_env__S1_S1_ES1_(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull %14, ptr noundef %17, ptr noundef null)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %11) #6
  store ptr %4, ptr %12, align 8, !tbaa !12
  %18 = getelementptr inbounds i8, ptr %12, i64 8
  %19 = getelementptr inbounds i8, ptr %12, i64 24
  %20 = insertelement <2 x ptr> poison, ptr %5, i64 0
  %21 = insertelement <2 x ptr> %20, ptr %6, i64 1
  %22 = icmp eq <2 x ptr> %21, zeroinitializer
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %18, i8 0, i64 16, i1 false)
  %23 = select <2 x i1> %22, <2 x ptr> zeroinitializer, <2 x ptr> <ptr @_ZN4Napi7details20AccessorCallbackData13GetterWrapperEP10napi_env__P20napi_callback_info__, ptr @_ZN4Napi7details20AccessorCallbackData13SetterWrapperEP10napi_env__P20napi_callback_info__>
  store <2 x ptr> %23, ptr %19, align 8, !tbaa !15
  %24 = getelementptr inbounds i8, ptr %12, i64 40
  store ptr null, ptr %24, align 8, !tbaa !16
  %25 = getelementptr inbounds i8, ptr %12, i64 48
  store i32 %7, ptr %25, align 8, !tbaa !17
  %26 = getelementptr inbounds i8, ptr %12, i64 56
  store ptr %14, ptr %26, align 8, !tbaa !18
  call void @_ZN4Napi18PropertyDescriptorC2E24napi_property_descriptor(ptr noundef nonnull align 8 dereferenceable(64) %0, ptr noundef nonnull byval(%struct.napi_property_descriptor) align 8 %12)
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef ptr @"_ZZN4Napi18PropertyDescriptor8AccessorENS_3EnvENS_6ObjectEPKcPFNS_5ValueERKNS_12CallbackInfoEEPFvS8_RKS5_E24napi_property_attributesPvENK3$_0cvPFvP10napi_env__SG_SG_EEv"(ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN4Napi7details20AccessorCallbackData13GetterWrapperEP10napi_env__P20napi_callback_info__(ptr noundef, ptr noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN4Napi7details20AccessorCallbackData13SetterWrapperEP10napi_env__P20napi_callback_info__(ptr noundef, ptr noundef) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4Napi18PropertyDescriptorC2E24napi_property_descriptor(ptr noundef nonnull align 8 dereferenceable(64), ptr noundef byval(%struct.napi_property_descriptor) align 8) unnamed_addr #3 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { builtin allocsize(0) }
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, !7, i64 0}
!6 = !{!"_ZTSN4Napi7details20AccessorCallbackDataE", !7, i64 0, !7, i64 8, !7, i64 16}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!6, !7, i64 16}
!12 = !{!13, !7, i64 0}
!13 = !{!"_ZTS24napi_property_descriptor", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !14, i64 48, !7, i64 56}
!14 = !{!"_ZTS24napi_property_attributes", !8, i64 0}
!15 = !{!7, !7, i64 0}
!16 = !{!13, !7, i64 40}
!17 = !{!13, !14, i64 48}
!18 = !{!13, !7, i64 56}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass