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

; 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"

%"struct.nvinfer1::PluginTensorDesc" = type { %"class.nvinfer1::Dims64", i32, i32, float }
%"class.nvinfer1::Dims64" = type { i32, [8 x i64] }
%"class.nvinfer1::plugin::BatchedNMSDynamicPlugin" = type <{ %"class.nvinfer1::IPluginV2DynamicExt", %"struct.nvinfer1::plugin::NMSParameters", i32, i32, i32, [4 x i8], %"class.std::__cxx11::basic_string", i8, [3 x i8], i32, i32, i8, [3 x i8], i32, [4 x i8] }>
%"class.nvinfer1::IPluginV2DynamicExt" = type { %"class.nvinfer1::IPluginV2Ext" }
%"class.nvinfer1::IPluginV2Ext" = type { %"class.nvinfer1::IPluginV2" }
%"class.nvinfer1::IPluginV2" = type { ptr }
%"struct.nvinfer1::plugin::NMSParameters" = type { i8, i32, i32, i32, i32, float, float, i8 }
%"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] }

; 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

declare i32 @__gxx_personality_v0(...)

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

declare noundef i64 @_ZN8nvinfer16plugin31detectionInferenceWorkspaceSizeEbiiiiiiNS_8DataTypeES1_(i1 noundef zeroext, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i64 @_ZNK8nvinfer16plugin23BatchedNMSDynamicPlugin16getWorkspaceSizeEPKNS_16PluginTensorDescEiS4_i(ptr noundef nonnull align 8 dereferenceable(108) %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, i32 noundef %4) unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i32 %2, ptr %8, align 4, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !5
  store i32 %4, ptr %10, align 4, !tbaa !9
  %15 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %16 = load ptr, ptr %7, align 8, !tbaa !5
  %17 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %16, i64 0
  %18 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %17, i32 0, i32 0
  %19 = getelementptr inbounds %"class.nvinfer1::Dims64", ptr %18, i32 0, i32 1
  %20 = getelementptr inbounds [8 x i64], ptr %19, i64 0, i64 0
  %21 = load i64, ptr %20, align 8, !tbaa !11
  %22 = trunc i64 %21 to i32
  store i32 %22, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %23, i64 0
  %25 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %24, i32 0, i32 0
  %26 = getelementptr inbounds %"class.nvinfer1::Dims64", ptr %25, i32 0, i32 1
  %27 = getelementptr inbounds [8 x i64], ptr %26, i64 0, i64 1
  %28 = load i64, ptr %27, align 8, !tbaa !11
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %29, i64 0
  %31 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %30, i32 0, i32 0
  %32 = getelementptr inbounds %"class.nvinfer1::Dims64", ptr %31, i32 0, i32 1
  %33 = getelementptr inbounds [8 x i64], ptr %32, i64 0, i64 2
  %34 = load i64, ptr %33, align 8, !tbaa !11
  %35 = mul nsw i64 %28, %34
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %36, i64 0
  %38 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %37, i32 0, i32 0
  %39 = getelementptr inbounds %"class.nvinfer1::Dims64", ptr %38, i32 0, i32 1
  %40 = getelementptr inbounds [8 x i64], ptr %39, i64 0, i64 3
  %41 = load i64, ptr %40, align 8, !tbaa !11
  %42 = mul nsw i64 %35, %41
  %43 = trunc i64 %42 to i32
  store i32 %43, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  %45 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %44, i64 1
  %46 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %45, i32 0, i32 0
  %47 = getelementptr inbounds %"class.nvinfer1::Dims64", ptr %46, i32 0, i32 1
  %48 = getelementptr inbounds [8 x i64], ptr %47, i64 0, i64 1
  %49 = load i64, ptr %48, align 8, !tbaa !11
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %50, i64 1
  %52 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %51, i32 0, i32 0
  %53 = getelementptr inbounds %"class.nvinfer1::Dims64", ptr %52, i32 0, i32 1
  %54 = getelementptr inbounds [8 x i64], ptr %53, i64 0, i64 2
  %55 = load i64, ptr %54, align 8, !tbaa !11
  %56 = mul nsw i64 %49, %55
  %57 = trunc i64 %56 to i32
  store i32 %57, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  %59 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %58, i64 0
  %60 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %59, i32 0, i32 0
  %61 = getelementptr inbounds %"class.nvinfer1::Dims64", ptr %60, i32 0, i32 1
  %62 = getelementptr inbounds [8 x i64], ptr %61, i64 0, i64 1
  %63 = load i64, ptr %62, align 8, !tbaa !11
  %64 = trunc i64 %63 to i32
  store i32 %64, ptr %14, align 4, !tbaa !9
  %65 = getelementptr inbounds %"class.nvinfer1::plugin::BatchedNMSDynamicPlugin", ptr %15, i32 0, i32 1
  %66 = getelementptr inbounds %"struct.nvinfer1::plugin::NMSParameters", ptr %65, i32 0, i32 0
  %67 = load i8, ptr %66, align 8, !tbaa !13, !range !25, !noundef !26
  %68 = trunc i8 %67 to i1
  %69 = load i32, ptr %11, align 4, !tbaa !9
  %70 = load i32, ptr %12, align 4, !tbaa !9
  %71 = load i32, ptr %13, align 4, !tbaa !9
  %72 = getelementptr inbounds %"class.nvinfer1::plugin::BatchedNMSDynamicPlugin", ptr %15, i32 0, i32 1
  %73 = getelementptr inbounds %"struct.nvinfer1::plugin::NMSParameters", ptr %72, i32 0, i32 2
  %74 = load i32, ptr %73, align 8, !tbaa !27
  %75 = load i32, ptr %14, align 4, !tbaa !9
  %76 = getelementptr inbounds %"class.nvinfer1::plugin::BatchedNMSDynamicPlugin", ptr %15, i32 0, i32 1
  %77 = getelementptr inbounds %"struct.nvinfer1::plugin::NMSParameters", ptr %76, i32 0, i32 3
  %78 = load i32, ptr %77, align 4, !tbaa !28
  %79 = getelementptr inbounds %"class.nvinfer1::plugin::BatchedNMSDynamicPlugin", ptr %15, i32 0, i32 9
  %80 = load i32, ptr %79, align 4, !tbaa !29
  %81 = getelementptr inbounds %"class.nvinfer1::plugin::BatchedNMSDynamicPlugin", ptr %15, i32 0, i32 9
  %82 = load i32, ptr %81, align 4, !tbaa !29
  %83 = invoke noundef i64 @_ZN8nvinfer16plugin31detectionInferenceWorkspaceSizeEbiiiiiiNS_8DataTypeES1_(i1 noundef zeroext %68, i32 noundef %69, i32 noundef %70, i32 noundef %71, i32 noundef %74, i32 noundef %75, i32 noundef %78, i32 noundef %80, i32 noundef %82)
          to label %84 unwind label %85

84:                                               ; preds = %5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  ret i64 %83

85:                                               ; preds = %5
  %86 = landingpad { ptr, i32 }
          catch ptr null
  %87 = extractvalue { ptr, i32 } %86, 0
  call void @__clang_call_terminate(ptr %87) #5
  unreachable
}

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 = { "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 = { 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 = { 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, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !19, i64 8}
!14 = !{!"_ZTSN8nvinfer16plugin23BatchedNMSDynamicPluginE", !15, i64 0, !18, i64 8, !10, i64 40, !10, i64 44, !10, i64 48, !21, i64 56, !19, i64 88, !23, i64 92, !10, i64 96, !19, i64 100, !24, i64 104}
!15 = !{!"_ZTSN8nvinfer119IPluginV2DynamicExtE", !16, i64 0}
!16 = !{!"_ZTSN8nvinfer112IPluginV2ExtE", !17, i64 0}
!17 = !{!"_ZTSN8nvinfer19IPluginV2E"}
!18 = !{!"_ZTSN8nvinfer16plugin13NMSParametersE", !19, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !20, i64 20, !20, i64 24, !19, i64 28}
!19 = !{!"bool", !7, i64 0}
!20 = !{!"float", !7, i64 0}
!21 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !22, i64 0, !12, i64 8, !7, i64 16}
!22 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!23 = !{!"_ZTSN8nvinfer18DataTypeE", !7, i64 0}
!24 = !{!"_ZTS14pluginStatus_t", !7, i64 0}
!25 = !{i8 0, i8 2}
!26 = !{}
!27 = !{!14, !10, i64 16}
!28 = !{!14, !10, i64 20}
!29 = !{!14, !23, i64 92}


; 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

declare noundef i64 @_ZN8nvinfer16plugin31detectionInferenceWorkspaceSizeEbiiiiiiNS_8DataTypeES1_(i1 noundef zeroext, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i64 @_ZNK8nvinfer16plugin23BatchedNMSDynamicPlugin16getWorkspaceSizeEPKNS_16PluginTensorDescEiS4_i(ptr nocapture noundef nonnull readonly align 8 dereferenceable(108) %0, ptr nocapture noundef readonly %1, i32 noundef %2, ptr nocapture noundef readnone %3, i32 noundef %4) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %6 = getelementptr inbounds i8, ptr %1, i64 8
  %7 = load i64, ptr %6, align 8, !tbaa !5
  %8 = trunc i64 %7 to i32
  %9 = getelementptr inbounds i8, ptr %1, i64 16
  %10 = load i64, ptr %9, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %1, i64 24
  %12 = load i64, ptr %11, align 8, !tbaa !5
  %13 = mul nsw i64 %12, %10
  %14 = getelementptr inbounds i8, ptr %1, i64 32
  %15 = load i64, ptr %14, align 8, !tbaa !5
  %16 = mul nsw i64 %13, %15
  %17 = trunc i64 %16 to i32
  %18 = getelementptr inbounds i8, ptr %1, i64 104
  %19 = load i64, ptr %18, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %1, i64 112
  %21 = load i64, ptr %20, align 8, !tbaa !5
  %22 = mul nsw i64 %21, %19
  %23 = trunc i64 %22 to i32
  %24 = trunc i64 %10 to i32
  %25 = getelementptr inbounds i8, ptr %0, i64 8
  %26 = load i8, ptr %25, align 8, !tbaa !9, !range !23, !noundef !24
  %27 = trunc nuw i8 %26 to i1
  %28 = getelementptr inbounds i8, ptr %0, i64 16
  %29 = load i32, ptr %28, align 8, !tbaa !25
  %30 = getelementptr inbounds i8, ptr %0, i64 20
  %31 = load i32, ptr %30, align 4, !tbaa !26
  %32 = getelementptr inbounds i8, ptr %0, i64 92
  %33 = load i32, ptr %32, align 4, !tbaa !27
  %34 = invoke noundef i64 @_ZN8nvinfer16plugin31detectionInferenceWorkspaceSizeEbiiiiiiNS_8DataTypeES1_(i1 noundef zeroext %27, i32 noundef %8, i32 noundef %17, i32 noundef %23, i32 noundef %29, i32 noundef %24, i32 noundef %31, i32 noundef %33, i32 noundef %33)
          to label %35 unwind label %36

35:                                               ; preds = %5
  ret i64 %34

36:                                               ; preds = %5
  %37 = landingpad { ptr, i32 }
          catch ptr null
  %38 = extractvalue { ptr, i32 } %37, 0
  tail call void @__clang_call_terminate(ptr %38) #3
  unreachable
}

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 = { "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 = { 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !15, i64 8}
!10 = !{!"_ZTSN8nvinfer16plugin23BatchedNMSDynamicPluginE", !11, i64 0, !14, i64 8, !16, i64 40, !16, i64 44, !16, i64 48, !18, i64 56, !15, i64 88, !21, i64 92, !16, i64 96, !15, i64 100, !22, i64 104}
!11 = !{!"_ZTSN8nvinfer119IPluginV2DynamicExtE", !12, i64 0}
!12 = !{!"_ZTSN8nvinfer112IPluginV2ExtE", !13, i64 0}
!13 = !{!"_ZTSN8nvinfer19IPluginV2E"}
!14 = !{!"_ZTSN8nvinfer16plugin13NMSParametersE", !15, i64 0, !16, i64 4, !16, i64 8, !16, i64 12, !16, i64 16, !17, i64 20, !17, i64 24, !15, i64 28}
!15 = !{!"bool", !7, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = !{!"float", !7, i64 0}
!18 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !19, i64 0, !6, i64 8, !7, i64 16}
!19 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !20, i64 0}
!20 = !{!"any pointer", !7, i64 0}
!21 = !{!"_ZTSN8nvinfer18DataTypeE", !7, i64 0}
!22 = !{!"_ZTS14pluginStatus_t", !7, i64 0}
!23 = !{i8 0, i8 2}
!24 = !{}
!25 = !{!10, !16, i64 16}
!26 = !{!10, !16, i64 20}
!27 = !{!10, !21, i64 92}


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