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

; 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::Dims64" = type { i32, [8 x i64] }
%"class.nvinfer1::Dims3" = type { %"class.nvinfer1::Dims2" }
%"class.nvinfer1::Dims2" = type { %"class.nvinfer1::Dims64" }
%"class.nvinfer1::plugin::DetectionOutput" = type { %"class.nvinfer1::IPluginV2Ext", %"struct.nvinfer1::plugin::DetectionOutputParameters", i32, i32, i32, i32, i32, %"class.std::__cxx11::basic_string" }
%"class.nvinfer1::IPluginV2Ext" = type { %"class.nvinfer1::IPluginV2" }
%"class.nvinfer1::IPluginV2" = type { ptr }
%"struct.nvinfer1::plugin::DetectionOutputParameters" = type <{ i8, i8, [2 x i8], i32, i32, i32, i32, float, float, i32, [3 x i32], i8, i8, i8, 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] }

@.str.2 = external hidden unnamed_addr constant [80 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [25 x i8], align 1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

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) #1

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN8nvinfer16plugin15DetectionOutput19getOutputDimensionsEiPKNS_6Dims64Ei(ptr dead_on_unwind noalias writable sret(%"class.nvinfer1::Dims64") align 8 %0, ptr noundef nonnull align 8 dereferenceable(112) %1, i32 noundef %2, ptr noundef %3, i32 noundef %4) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca %"class.nvinfer1::Dims3", align 8
  %11 = alloca %"class.nvinfer1::Dims3", align 8
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !5
  store i32 %4, ptr %9, align 4, !tbaa !9
  %12 = load ptr, ptr %6, align 8
  %13 = load i32, ptr %9, align 4, !tbaa !9
  %14 = icmp eq i32 %13, 3
  br i1 %14, label %17, label %15

15:                                               ; preds = %5
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef @.str.4, ptr noundef @.str.2, i32 noundef 149)
          to label %16 unwind label %37

16:                                               ; preds = %15
  br label %17

17:                                               ; preds = %16, %5
  %18 = load i32, ptr %7, align 4, !tbaa !9
  %19 = icmp eq i32 %18, 0
  br i1 %19, label %25, label %20

20:                                               ; preds = %17
  %21 = load i32, ptr %7, align 4, !tbaa !9
  %22 = icmp eq i32 %21, 1
  br i1 %22, label %25, label %23

23:                                               ; preds = %20
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef @.str.5, ptr noundef @.str.2, i32 noundef 150)
          to label %24 unwind label %37

24:                                               ; preds = %23
  br label %25

25:                                               ; preds = %24, %20, %17
  %26 = load i32, ptr %7, align 4, !tbaa !9
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %28, label %34

28:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 72, ptr %10) #6
  %29 = getelementptr inbounds %"class.nvinfer1::plugin::DetectionOutput", ptr %12, i32 0, i32 1
  %30 = getelementptr inbounds %"struct.nvinfer1::plugin::DetectionOutputParameters", ptr %29, i32 0, i32 6
  %31 = load i32, ptr %30, align 8, !tbaa !11
  %32 = sext i32 %31 to i64
  invoke void @_ZN8nvinfer15Dims3C2Elll(ptr noundef nonnull align 8 dereferenceable(72) %10, i64 noundef 1, i64 noundef %32, i64 noundef 7)
          to label %33 unwind label %37

33:                                               ; preds = %28
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %0, ptr align 8 %10, i64 72, i1 false), !tbaa.struct !23
  call void @llvm.lifetime.end.p0(i64 72, ptr %10) #6
  br label %36

34:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 72, ptr %11) #6
  invoke void @_ZN8nvinfer15Dims3C2Elll(ptr noundef nonnull align 8 dereferenceable(72) %11, i64 noundef 1, i64 noundef 1, i64 noundef 1)
          to label %35 unwind label %37

35:                                               ; preds = %34
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %0, ptr align 8 %11, i64 72, i1 false), !tbaa.struct !23
  call void @llvm.lifetime.end.p0(i64 72, ptr %11) #6
  br label %36

36:                                               ; preds = %35, %33
  ret void

37:                                               ; preds = %34, %28, %23, %15
  %38 = landingpad { ptr, i32 }
          catch ptr null
  %39 = extractvalue { ptr, i32 } %38, 0
  call void @__clang_call_terminate(ptr %39) #7
  unreachable
}

declare void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef, ptr noundef, i32 noundef) #3

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8nvinfer15Dims3C2Elll(ptr noundef nonnull align 8 dereferenceable(72), i64 noundef, i64 noundef, i64 noundef) unnamed_addr #5 align 2

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #5 = { 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 #6 = { nounwind }
attributes #7 = { 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, !10, i64 24}
!12 = !{!"_ZTSN8nvinfer16plugin15DetectionOutputE", !13, i64 0, !15, i64 8, !10, i64 56, !10, i64 60, !10, i64 64, !19, i64 68, !10, i64 72, !20, i64 80}
!13 = !{!"_ZTSN8nvinfer112IPluginV2ExtE", !14, i64 0}
!14 = !{!"_ZTSN8nvinfer19IPluginV2E"}
!15 = !{!"_ZTSN8nvinfer16plugin25DetectionOutputParametersE", !16, i64 0, !16, i64 1, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !17, i64 20, !17, i64 24, !18, i64 28, !7, i64 32, !16, i64 44, !16, i64 45, !16, i64 46}
!16 = !{!"bool", !7, i64 0}
!17 = !{!"float", !7, i64 0}
!18 = !{!"_ZTSN8nvinfer16plugin11CodeTypeSSDE", !7, i64 0}
!19 = !{!"_ZTSN8nvinfer18DataTypeE", !7, i64 0}
!20 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !21, i64 0, !22, i64 8, !7, i64 16}
!21 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!22 = !{!"long", !7, i64 0}
!23 = !{i64 0, i64 4, !9, i64 8, i64 64, !24}
!24 = !{!7, !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.nvinfer1::Dims64" = type { i32, [8 x i64] }
%"class.nvinfer1::Dims3" = type { %"class.nvinfer1::Dims2" }
%"class.nvinfer1::Dims2" = type { %"class.nvinfer1::Dims64" }

@.str.2 = external hidden unnamed_addr constant [80 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [25 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

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) #1

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN8nvinfer16plugin15DetectionOutput19getOutputDimensionsEiPKNS_6Dims64Ei(ptr dead_on_unwind noalias nocapture writable writeonly sret(%"class.nvinfer1::Dims64") align 8 %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(112) %1, i32 noundef %2, ptr nocapture noundef readnone %3, i32 noundef %4) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca %"class.nvinfer1::Dims3", align 8
  %7 = alloca %"class.nvinfer1::Dims3", align 8
  %8 = icmp eq i32 %4, 3
  br i1 %8, label %10, label %9

9:                                                ; preds = %5
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.2, i32 noundef 149)
          to label %10 unwind label %21

10:                                               ; preds = %9, %5
  %or.cond = icmp ult i32 %2, 2
  br i1 %or.cond, label %12, label %11

11:                                               ; preds = %10
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.2, i32 noundef 150)
          to label %.thread unwind label %21

12:                                               ; preds = %10
  %13 = icmp eq i32 %2, 0
  br i1 %13, label %14, label %.thread

14:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %6) #6
  %15 = getelementptr inbounds i8, ptr %1, i64 24
  %16 = load i32, ptr %15, align 8, !tbaa !5
  %17 = sext i32 %16 to i64
  invoke void @_ZN8nvinfer15Dims3C2Elll(ptr noundef nonnull align 8 dereferenceable(72) %6, i64 noundef 1, i64 noundef %17, i64 noundef 7)
          to label %18 unwind label %21

18:                                               ; preds = %14
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr noundef nonnull align 8 dereferenceable(72) %6, i64 72, i1 false), !tbaa.struct !21
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %6) #6
  br label %20

.thread:                                          ; preds = %11, %12
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %7) #6
  invoke void @_ZN8nvinfer15Dims3C2Elll(ptr noundef nonnull align 8 dereferenceable(72) %7, i64 noundef 1, i64 noundef 1, i64 noundef 1)
          to label %19 unwind label %21

19:                                               ; preds = %.thread
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr noundef nonnull align 8 dereferenceable(72) %7, i64 72, i1 false), !tbaa.struct !21
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %7) #6
  br label %20

20:                                               ; preds = %19, %18
  ret void

21:                                               ; preds = %.thread, %14, %11, %9
  %22 = landingpad { ptr, i32 }
          catch ptr null
  %23 = extractvalue { ptr, i32 } %22, 0
  call void @__clang_call_terminate(ptr %23) #7
  unreachable
}

declare void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8nvinfer15Dims3C2Elll(ptr noundef nonnull align 8 dereferenceable(72), i64 noundef, i64 noundef, i64 noundef) unnamed_addr #5 align 2

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #5 = { 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 #6 = { nounwind }
attributes #7 = { 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, !13, i64 24}
!6 = !{!"_ZTSN8nvinfer16plugin15DetectionOutputE", !7, i64 0, !9, i64 8, !13, i64 56, !13, i64 60, !13, i64 64, !16, i64 68, !13, i64 72, !17, i64 80}
!7 = !{!"_ZTSN8nvinfer112IPluginV2ExtE", !8, i64 0}
!8 = !{!"_ZTSN8nvinfer19IPluginV2E"}
!9 = !{!"_ZTSN8nvinfer16plugin25DetectionOutputParametersE", !10, i64 0, !10, i64 1, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !14, i64 20, !14, i64 24, !15, i64 28, !11, i64 32, !10, i64 44, !10, i64 45, !10, i64 46}
!10 = !{!"bool", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C++ TBAA"}
!13 = !{!"int", !11, i64 0}
!14 = !{!"float", !11, i64 0}
!15 = !{!"_ZTSN8nvinfer16plugin11CodeTypeSSDE", !11, i64 0}
!16 = !{!"_ZTSN8nvinfer18DataTypeE", !11, i64 0}
!17 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !18, i64 0, !20, i64 8, !11, i64 16}
!18 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !19, i64 0}
!19 = !{!"any pointer", !11, i64 0}
!20 = !{!"long", !11, i64 0}
!21 = !{i64 0, i64 4, !22, i64 8, i64 64, !23}
!22 = !{!13, !13, i64 0}
!23 = !{!11, !11, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass