; LLVM IR from NVIDIA/TensorRT :: plugin/regionPlugin (regionPlugin)

; 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.nvinfer1::plugin::Region" = type { %"class.nvinfer1::IPluginV2Ext", i32, i32, i32, %"class.std::shared_ptr", i32, i32, i32, i8, %"class.std::__cxx11::basic_string" }
%"class.nvinfer1::IPluginV2Ext" = type { %"class.nvinfer1::IPluginV2" }
%"class.nvinfer1::IPluginV2" = type { ptr }
%"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.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

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

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @_ZN8nvinfer16plugin6Region7enqueueEiPKPKvPKPvS6_P11CUstream_st(ptr noundef nonnull align 8 dereferenceable(88) %0, i32 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  store ptr %5, ptr %12, align 8, !tbaa !5
  %16 = load ptr, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %17 = load ptr, ptr %9, align 8, !tbaa !5
  %18 = getelementptr inbounds ptr, ptr %17, i64 0
  %19 = load ptr, ptr %18, align 8, !tbaa !5
  store ptr %19, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %20 = load ptr, ptr %10, align 8, !tbaa !5
  %21 = getelementptr inbounds ptr, ptr %20, i64 0
  %22 = load ptr, ptr %21, align 8, !tbaa !5
  store ptr %22, ptr %14, align 8, !tbaa !5
  %23 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %16, i32 0, i32 4
  %24 = call noundef ptr @_ZNKSt12__shared_ptrIN8nvinfer16plugin11softmaxTreeELN9__gnu_cxx12_Lock_policyE2EE3getEv(ptr noundef nonnull align 8 dereferenceable(16) %23) #4
  %25 = icmp ne ptr %24, null
  br i1 %25, label %26, label %28

26:                                               ; preds = %6
  %27 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %16, i32 0, i32 8
  store i8 1, ptr %27, align 4, !tbaa !11
  br label %30

28:                                               ; preds = %6
  %29 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %16, i32 0, i32 8
  store i8 0, ptr %29, align 4, !tbaa !11
  br label %30

30:                                               ; preds = %28, %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %31 = load ptr, ptr %12, align 8, !tbaa !5
  %32 = load i32, ptr %8, align 4, !tbaa !9
  %33 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %16, i32 0, i32 5
  %34 = load i32, ptr %33, align 8, !tbaa !22
  %35 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %16, i32 0, i32 6
  %36 = load i32, ptr %35, align 4, !tbaa !23
  %37 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %16, i32 0, i32 7
  %38 = load i32, ptr %37, align 8, !tbaa !24
  %39 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %16, i32 0, i32 1
  %40 = load i32, ptr %39, align 8, !tbaa !25
  %41 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %16, i32 0, i32 2
  %42 = load i32, ptr %41, align 4, !tbaa !26
  %43 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %16, i32 0, i32 3
  %44 = load i32, ptr %43, align 8, !tbaa !27
  %45 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %16, i32 0, i32 8
  %46 = load i8, ptr %45, align 4, !tbaa !11, !range !28, !noundef !29
  %47 = trunc i8 %46 to i1
  %48 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %16, i32 0, i32 4
  %49 = call noundef ptr @_ZNKSt12__shared_ptrIN8nvinfer16plugin11softmaxTreeELN9__gnu_cxx12_Lock_policyE2EE3getEv(ptr noundef nonnull align 8 dereferenceable(16) %48) #4
  %50 = load ptr, ptr %13, align 8, !tbaa !5
  %51 = load ptr, ptr %14, align 8, !tbaa !5
  %52 = invoke noundef i32 @_ZN8nvinfer16plugin15regionInferenceEP11CUstream_stiiiiiiibPKNS0_11softmaxTreeEPKvPv(ptr noundef %31, i32 noundef %32, i32 noundef %34, i32 noundef %36, i32 noundef %38, i32 noundef %40, i32 noundef %42, i32 noundef %44, i1 noundef zeroext %47, ptr noundef %49, ptr noundef %50, ptr noundef %51)
          to label %53 unwind label %55

53:                                               ; preds = %30
  store i32 %52, ptr %15, align 4, !tbaa !30
  %54 = load i32, ptr %15, align 4, !tbaa !30
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  ret i32 %54

55:                                               ; preds = %30
  %56 = landingpad { ptr, i32 }
          catch ptr null
  %57 = extractvalue { ptr, i32 } %56, 0
  call void @__clang_call_terminate(ptr %57) #5
  unreachable
}

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

declare noundef i32 @_ZN8nvinfer16plugin15regionInferenceEP11CUstream_stiiiiiiibPKNS0_11softmaxTreeEPKvPv(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i1 noundef zeroext, ptr noundef, ptr noundef, ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noinline noreturn nounwind uwtable "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 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 #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 = { nounwind }
attributes #5 = { noreturn 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !18, i64 52}
!12 = !{!"_ZTSN8nvinfer16plugin6RegionE", !13, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !15, i64 24, !10, i64 40, !10, i64 44, !10, i64 48, !18, i64 52, !19, i64 56}
!13 = !{!"_ZTSN8nvinfer112IPluginV2ExtE", !14, i64 0}
!14 = !{!"_ZTSN8nvinfer19IPluginV2E"}
!15 = !{!"_ZTSSt10shared_ptrIN8nvinfer16plugin11softmaxTreeEE", !16, i64 0}
!16 = !{!"_ZTSSt12__shared_ptrIN8nvinfer16plugin11softmaxTreeELN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !17, i64 8}
!17 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0}
!18 = !{!"bool", !7, i64 0}
!19 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !20, i64 0, !21, i64 8, !7, i64 16}
!20 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!21 = !{!"long", !7, i64 0}
!22 = !{!12, !10, i64 40}
!23 = !{!12, !10, i64 44}
!24 = !{!12, !10, i64 48}
!25 = !{!12, !10, i64 8}
!26 = !{!12, !10, i64 12}
!27 = !{!12, !10, i64 16}
!28 = !{i8 0, i8 2}
!29 = !{}
!30 = !{!31, !31, i64 0}
!31 = !{!"_ZTS14pluginStatus_t", !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"

declare i32 @__gxx_personality_v0(...)

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @_ZN8nvinfer16plugin6Region7enqueueEiPKPKvPKPvS6_P11CUstream_st(ptr noundef nonnull align 8 dereferenceable(88) %0, i32 noundef %1, ptr nocapture noundef readonly %2, ptr nocapture noundef readonly %3, ptr nocapture noundef readnone %4, ptr noundef %5) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %7 = load ptr, ptr %2, align 8, !tbaa !5
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 24
  %10 = tail call noundef ptr @_ZNKSt12__shared_ptrIN8nvinfer16plugin11softmaxTreeELN9__gnu_cxx12_Lock_policyE2EE3getEv(ptr noundef nonnull align 8 dereferenceable(16) %9) #3
  %.not = icmp ne ptr %10, null
  %spec.select = zext i1 %.not to i8
  %11 = getelementptr inbounds i8, ptr %0, i64 52
  store i8 %spec.select, ptr %11, align 4
  %12 = getelementptr inbounds i8, ptr %0, i64 40
  %13 = load i32, ptr %12, align 8, !tbaa !9
  %14 = getelementptr inbounds i8, ptr %0, i64 44
  %15 = load i32, ptr %14, align 4, !tbaa !21
  %16 = getelementptr inbounds i8, ptr %0, i64 48
  %17 = load i32, ptr %16, align 8, !tbaa !22
  %18 = getelementptr inbounds i8, ptr %0, i64 8
  %19 = load i32, ptr %18, align 8, !tbaa !23
  %20 = getelementptr inbounds i8, ptr %0, i64 12
  %21 = load i32, ptr %20, align 4, !tbaa !24
  %22 = getelementptr inbounds i8, ptr %0, i64 16
  %23 = load i32, ptr %22, align 8, !tbaa !25
  %24 = tail call noundef ptr @_ZNKSt12__shared_ptrIN8nvinfer16plugin11softmaxTreeELN9__gnu_cxx12_Lock_policyE2EE3getEv(ptr noundef nonnull align 8 dereferenceable(16) %9) #3
  %25 = invoke noundef i32 @_ZN8nvinfer16plugin15regionInferenceEP11CUstream_stiiiiiiibPKNS0_11softmaxTreeEPKvPv(ptr noundef %5, i32 noundef %1, i32 noundef %13, i32 noundef %15, i32 noundef %17, i32 noundef %19, i32 noundef %21, i32 noundef %23, i1 noundef zeroext %.not, ptr noundef %24, ptr noundef %7, ptr noundef %8)
          to label %26 unwind label %27

26:                                               ; preds = %6
  ret i32 %25

27:                                               ; preds = %6
  %28 = landingpad { ptr, i32 }
          catch ptr null
  %29 = extractvalue { ptr, i32 } %28, 0
  tail call void @__clang_call_terminate(ptr %29) #4
  unreachable
}

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

declare noundef i32 @_ZN8nvinfer16plugin15regionInferenceEP11CUstream_stiiiiiiibPKNS0_11softmaxTreeEPKvPv(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i1 noundef zeroext, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

attributes #0 = { noinline noreturn nounwind uwtable "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 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 = { "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 = { nounwind }
attributes #4 = { noreturn 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, !13, i64 40}
!10 = !{!"_ZTSN8nvinfer16plugin6RegionE", !11, i64 0, !13, i64 8, !13, i64 12, !13, i64 16, !14, i64 24, !13, i64 40, !13, i64 44, !13, i64 48, !17, i64 52, !18, i64 56}
!11 = !{!"_ZTSN8nvinfer112IPluginV2ExtE", !12, i64 0}
!12 = !{!"_ZTSN8nvinfer19IPluginV2E"}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTSSt10shared_ptrIN8nvinfer16plugin11softmaxTreeEE", !15, i64 0}
!15 = !{!"_ZTSSt12__shared_ptrIN8nvinfer16plugin11softmaxTreeELN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !16, i64 8}
!16 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0}
!17 = !{!"bool", !7, i64 0}
!18 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !19, i64 0, !20, i64 8, !7, i64 16}
!19 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!20 = !{!"long", !7, i64 0}
!21 = !{!10, !13, i64 44}
!22 = !{!10, !13, i64 48}
!23 = !{!10, !13, i64 8}
!24 = !{!10, !13, i64 12}
!25 = !{!10, !13, i64 16}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,MergedLoadStoreMotionPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass