; LLVM IR from lynx-family/primjs :: src/napi/napi.ll/ZN4Napi12CallbackInfoC2EP10napi_env (P20napi_callback_info__)

; 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::CallbackInfo" = type { i64, ptr, ptr, ptr, i64, ptr, [6 x ptr], ptr, ptr }
%struct.napi_env__ = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

@.str.59 = external hidden unnamed_addr constant [32 x i8], align 1

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

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN4NapiL11CheckStatusEP10napi_env__11napi_statusPKc(ptr noundef, i32 noundef, ptr noundef) #1

; 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
define dso_local void @_ZN4Napi12CallbackInfoC2EP10napi_env__P20napi_callback_info__(ptr noundef nonnull align 8 dereferenceable(112) %0, ptr noundef %1, ptr noundef %2) unnamed_addr #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = 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
  %8 = load ptr, ptr %4, align 8
  %9 = getelementptr inbounds %"class.Napi::CallbackInfo", ptr %8, i32 0, i32 0
  store i64 6, ptr %9, align 8, !tbaa !9
  %10 = getelementptr inbounds %"class.Napi::CallbackInfo", ptr %8, i32 0, i32 1
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %11, ptr %10, align 8, !tbaa !12
  %12 = getelementptr inbounds %"class.Napi::CallbackInfo", ptr %8, i32 0, i32 2
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %13, ptr %12, align 8, !tbaa !13
  %14 = getelementptr inbounds %"class.Napi::CallbackInfo", ptr %8, i32 0, i32 3
  store ptr null, ptr %14, align 8, !tbaa !14
  %15 = getelementptr inbounds %"class.Napi::CallbackInfo", ptr %8, i32 0, i32 7
  store ptr null, ptr %15, align 8, !tbaa !15
  %16 = getelementptr inbounds %"class.Napi::CallbackInfo", ptr %8, i32 0, i32 8
  store ptr null, ptr %16, align 8, !tbaa !16
  %17 = getelementptr inbounds %"class.Napi::CallbackInfo", ptr %8, i32 0, i32 0
  %18 = load i64, ptr %17, align 8, !tbaa !9
  %19 = getelementptr inbounds %"class.Napi::CallbackInfo", ptr %8, i32 0, i32 4
  store i64 %18, ptr %19, align 8, !tbaa !17
  %20 = getelementptr inbounds %"class.Napi::CallbackInfo", ptr %8, i32 0, i32 6
  %21 = getelementptr inbounds [6 x ptr], ptr %20, i64 0, i64 0
  %22 = getelementptr inbounds %"class.Napi::CallbackInfo", ptr %8, i32 0, i32 5
  store ptr %21, ptr %22, align 8, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.napi_env__, ptr %23, i32 0, i32 57
  %25 = load ptr, ptr %24, align 8, !tbaa !19
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = getelementptr inbounds %"class.Napi::CallbackInfo", ptr %8, i32 0, i32 4
  %29 = getelementptr inbounds %"class.Napi::CallbackInfo", ptr %8, i32 0, i32 5
  %30 = load ptr, ptr %29, align 8, !tbaa !18
  %31 = getelementptr inbounds %"class.Napi::CallbackInfo", ptr %8, i32 0, i32 3
  %32 = getelementptr inbounds %"class.Napi::CallbackInfo", ptr %8, i32 0, i32 8
  %33 = call noundef i32 %25(ptr noundef %26, ptr noundef %27, ptr noundef %28, ptr noundef %30, ptr noundef %31, ptr noundef %32)
  store i32 %33, ptr %7, align 4, !tbaa !21
  %34 = getelementptr inbounds %"class.Napi::CallbackInfo", ptr %8, i32 0, i32 1
  %35 = load ptr, ptr %34, align 8, !tbaa !12
  %36 = load i32, ptr %7, align 4, !tbaa !21
  call void @_ZN4NapiL11CheckStatusEP10napi_env__11napi_statusPKc(ptr noundef %35, i32 noundef %36, ptr noundef @.str.59)
  %37 = getelementptr inbounds %"class.Napi::CallbackInfo", ptr %8, i32 0, i32 4
  %38 = load i64, ptr %37, align 8, !tbaa !17
  %39 = getelementptr inbounds %"class.Napi::CallbackInfo", ptr %8, i32 0, i32 0
  %40 = load i64, ptr %39, align 8, !tbaa !9
  %41 = icmp ugt i64 %38, %40
  br i1 %41, label %42, label %66

42:                                               ; preds = %3
  %43 = getelementptr inbounds %"class.Napi::CallbackInfo", ptr %8, i32 0, i32 4
  %44 = load i64, ptr %43, align 8, !tbaa !17
  %45 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %44, i64 8)
  %46 = extractvalue { i64, i1 } %45, 1
  %47 = extractvalue { i64, i1 } %45, 0
  %48 = select i1 %46, i64 -1, i64 %47
  %49 = call noalias noundef nonnull ptr @_Znam(i64 noundef %48) #5
  %50 = getelementptr inbounds %"class.Napi::CallbackInfo", ptr %8, i32 0, i32 7
  store ptr %49, ptr %50, align 8, !tbaa !15
  %51 = getelementptr inbounds %"class.Napi::CallbackInfo", ptr %8, i32 0, i32 7
  %52 = load ptr, ptr %51, align 8, !tbaa !15
  %53 = getelementptr inbounds %"class.Napi::CallbackInfo", ptr %8, i32 0, i32 5
  store ptr %52, ptr %53, align 8, !tbaa !18
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.napi_env__, ptr %54, i32 0, i32 57
  %56 = load ptr, ptr %55, align 8, !tbaa !19
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  %59 = getelementptr inbounds %"class.Napi::CallbackInfo", ptr %8, i32 0, i32 4
  %60 = getelementptr inbounds %"class.Napi::CallbackInfo", ptr %8, i32 0, i32 5
  %61 = load ptr, ptr %60, align 8, !tbaa !18
  %62 = call noundef i32 %56(ptr noundef %57, ptr noundef %58, ptr noundef %59, ptr noundef %61, ptr noundef null, ptr noundef null)
  store i32 %62, ptr %7, align 4, !tbaa !21
  %63 = getelementptr inbounds %"class.Napi::CallbackInfo", ptr %8, i32 0, i32 1
  %64 = load ptr, ptr %63, align 8, !tbaa !12
  %65 = load i32, ptr %7, align 4, !tbaa !21
  call void @_ZN4NapiL11CheckStatusEP10napi_env__11napi_statusPKc(ptr noundef %64, i32 noundef %65, ptr noundef @.str.59)
  br label %66

66:                                               ; preds = %42, %3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #2

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

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 #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, !11, i64 0}
!10 = !{!"_ZTSN4Napi12CallbackInfoE", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !11, i64 32, !6, i64 40, !7, i64 48, !6, i64 96, !6, i64 104}
!11 = !{!"long", !7, i64 0}
!12 = !{!10, !6, i64 8}
!13 = !{!10, !6, i64 16}
!14 = !{!10, !6, i64 24}
!15 = !{!10, !6, i64 96}
!16 = !{!10, !6, i64 104}
!17 = !{!10, !11, i64 32}
!18 = !{!10, !6, i64 40}
!19 = !{!20, !6, i64 456}
!20 = !{!"_ZTS10napi_env__", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !6, i64 392, !6, i64 400, !6, i64 408, !6, i64 416, !6, i64 424, !6, i64 432, !6, i64 440, !6, i64 448, !6, i64 456, !6, i64 464, !6, i64 472, !6, i64 480, !6, i64 488, !6, i64 496, !6, i64 504, !6, i64 512, !6, i64 520, !6, i64 528, !6, i64 536, !6, i64 544, !6, i64 552, !6, i64 560, !6, i64 568, !6, i64 576, !6, i64 584, !6, i64 592, !6, i64 600, !6, i64 608, !6, i64 616, !6, i64 624, !6, i64 632, !6, i64 640, !6, i64 648, !6, i64 656, !6, i64 664, !6, i64 672, !6, i64 680, !6, i64 688, !6, i64 696, !6, i64 704, !6, i64 712, !6, i64 720, !6, i64 728, !6, i64 736, !6, i64 744, !6, i64 752, !6, i64 760, !6, i64 768, !6, i64 776, !6, i64 784, !6, i64 792, !6, i64 800, !6, i64 808, !6, i64 816, !6, i64 824, !6, i64 832, !6, i64 840, !6, i64 848, !6, i64 856, !6, i64 864, !6, i64 872, !6, i64 880, !6, i64 888, !6, i64 896, !6, i64 904, !6, i64 912, !6, i64 920, !6, i64 928, !6, i64 936, !6, i64 944, !6, i64 952, !6, i64 960, !6, i64 968, !6, i64 976, !6, i64 984, !6, i64 992}
!21 = !{!22, !22, i64 0}
!22 = !{!"_ZTS11napi_status", !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"

@.str.59 = external hidden unnamed_addr constant [32 x i8], align 1

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN4NapiL11CheckStatusEP10napi_env__11napi_statusPKc(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Napi12CallbackInfoC2EP10napi_env__P20napi_callback_info__(ptr noundef nonnull align 8 dereferenceable(112) %0, ptr noundef %1, ptr noundef %2) unnamed_addr #0 align 2 {
  store i64 6, ptr %0, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  store ptr %1, ptr %4, align 8, !tbaa !11
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  store ptr %2, ptr %5, align 8, !tbaa !12
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  store ptr null, ptr %6, align 8, !tbaa !13
  %7 = getelementptr inbounds i8, ptr %0, i64 96
  %8 = getelementptr inbounds i8, ptr %0, i64 104
  %9 = getelementptr inbounds i8, ptr %0, i64 32
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %7, i8 0, i64 16, i1 false)
  store i64 6, ptr %9, align 8, !tbaa !14
  %10 = getelementptr inbounds i8, ptr %0, i64 48
  %11 = getelementptr inbounds i8, ptr %0, i64 40
  store ptr %10, ptr %11, align 8, !tbaa !15
  %12 = getelementptr inbounds i8, ptr %1, i64 456
  %13 = load ptr, ptr %12, align 8, !tbaa !16
  %14 = tail call noundef i32 %13(ptr noundef %1, ptr noundef %2, ptr noundef nonnull %9, ptr noundef nonnull %10, ptr noundef nonnull %6, ptr noundef nonnull %8)
  %15 = load ptr, ptr %4, align 8, !tbaa !11
  tail call void @_ZN4NapiL11CheckStatusEP10napi_env__11napi_statusPKc(ptr noundef %15, i32 noundef %14, ptr noundef nonnull @.str.59)
  %16 = load i64, ptr %9, align 8, !tbaa !14
  %17 = load i64, ptr %0, align 8, !tbaa !5
  %18 = icmp ugt i64 %16, %17
  br i1 %18, label %19, label %27

19:                                               ; preds = %3
  %20 = icmp ugt i64 %16, 2305843009213693951
  %21 = shl i64 %16, 3
  %22 = select i1 %20, i64 -1, i64 %21
  %23 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %22) #3
  store ptr %23, ptr %7, align 8, !tbaa !18
  store ptr %23, ptr %11, align 8, !tbaa !15
  %24 = load ptr, ptr %12, align 8, !tbaa !16
  %25 = tail call noundef i32 %24(ptr noundef nonnull %1, ptr noundef %2, ptr noundef nonnull %9, ptr noundef nonnull %23, ptr noundef null, ptr noundef null)
  %26 = load ptr, ptr %4, align 8, !tbaa !11
  tail call void @_ZN4NapiL11CheckStatusEP10napi_env__11napi_statusPKc(ptr noundef %26, i32 noundef %25, ptr noundef nonnull @.str.59)
  br label %27

27:                                               ; preds = %19, %3
  ret void
}

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

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

attributes #0 = { 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 = { 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 #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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, !7, i64 0}
!6 = !{!"_ZTSN4Napi12CallbackInfoE", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !7, i64 32, !10, i64 40, !8, i64 48, !10, i64 96, !10, i64 104}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !10, i64 8}
!12 = !{!6, !10, i64 16}
!13 = !{!6, !10, i64 24}
!14 = !{!6, !7, i64 32}
!15 = !{!6, !10, i64 40}
!16 = !{!17, !10, i64 456}
!17 = !{!"_ZTS10napi_env__", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !10, i64 176, !10, i64 184, !10, i64 192, !10, i64 200, !10, i64 208, !10, i64 216, !10, i64 224, !10, i64 232, !10, i64 240, !10, i64 248, !10, i64 256, !10, i64 264, !10, i64 272, !10, i64 280, !10, i64 288, !10, i64 296, !10, i64 304, !10, i64 312, !10, i64 320, !10, i64 328, !10, i64 336, !10, i64 344, !10, i64 352, !10, i64 360, !10, i64 368, !10, i64 376, !10, i64 384, !10, i64 392, !10, i64 400, !10, i64 408, !10, i64 416, !10, i64 424, !10, i64 432, !10, i64 440, !10, i64 448, !10, i64 456, !10, i64 464, !10, i64 472, !10, i64 480, !10, i64 488, !10, i64 496, !10, i64 504, !10, i64 512, !10, i64 520, !10, i64 528, !10, i64 536, !10, i64 544, !10, i64 552, !10, i64 560, !10, i64 568, !10, i64 576, !10, i64 584, !10, i64 592, !10, i64 600, !10, i64 608, !10, i64 616, !10, i64 624, !10, i64 632, !10, i64 640, !10, i64 648, !10, i64 656, !10, i64 664, !10, i64 672, !10, i64 680, !10, i64 688, !10, i64 696, !10, i64 704, !10, i64 712, !10, i64 720, !10, i64 728, !10, i64 736, !10, i64 744, !10, i64 752, !10, i64 760, !10, i64 768, !10, i64 776, !10, i64 784, !10, i64 792, !10, i64 800, !10, i64 808, !10, i64 816, !10, i64 824, !10, i64 832, !10, i64 840, !10, i64 848, !10, i64 856, !10, i64 864, !10, i64 872, !10, i64 880, !10, i64 888, !10, i64 896, !10, i64 904, !10, i64 912, !10, i64 920, !10, i64 928, !10, i64 936, !10, i64 944, !10, i64 952, !10, i64 960, !10, i64 968, !10, i64 976, !10, i64 984, !10, i64 992}
!18 = !{!6, !10, i64 96}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,SROAPass,TailCallElimPass