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

; 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::plugin::GenerateDetection" = type { %"class.nvinfer1::IPluginV2Ext", i32, i32, i32, float, float, i32, i32, %"class.std::shared_ptr", i32, %struct.RefineNMSParameters, %"class.std::shared_ptr.17", %"class.nvinfer1::Dims64", %"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 }
%struct.RefineNMSParameters = type { i32, i32, i32, float, float }
%"class.std::shared_ptr.17" = type { %"class.std::__shared_ptr.18" }
%"class.std::__shared_ptr.18" = type { ptr, %"class.std::__shared_count" }
%"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.101 = external hidden unnamed_addr constant [108 x i8], align 1
@.str.116 = external hidden unnamed_addr constant [11 x i8], align 1

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8nvinfer16plugin17GenerateDetection18check_valid_inputsEPKNS_6Dims64Ei(ptr noundef nonnull align 8 dereferenceable(200), ptr noundef, i32 noundef) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN8nvinfer16plugin17GenerateDetection19getOutputDimensionsEiPKNS_6Dims64Ei(ptr dead_on_unwind noalias writable sret(%"class.nvinfer1::Dims64") align 8 %0, ptr noundef nonnull align 8 dereferenceable(200) %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 i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  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
  %10 = load ptr, ptr %6, align 8
  %11 = load ptr, ptr %8, align 8, !tbaa !5
  %12 = load i32, ptr %9, align 4, !tbaa !9
  call void @_ZN8nvinfer16plugin17GenerateDetection18check_valid_inputsEPKNS_6Dims64Ei(ptr noundef nonnull align 8 dereferenceable(200) %10, ptr noundef %11, i32 noundef %12) #4
  %13 = load i32, ptr %7, align 4, !tbaa !9
  %14 = icmp eq i32 %13, 0
  br i1 %14, label %17, label %15

15:                                               ; preds = %5
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef @.str.116, ptr noundef @.str.101, i32 noundef 295)
          to label %16 unwind label %24

16:                                               ; preds = %15
  br label %17

17:                                               ; preds = %16, %5
  %18 = getelementptr inbounds %"class.nvinfer1::Dims64", ptr %0, i32 0, i32 0
  store i32 2, ptr %18, align 8, !tbaa !11
  %19 = getelementptr inbounds %"class.nvinfer1::Dims64", ptr %0, i32 0, i32 1
  call void @llvm.memset.p0.i64(ptr align 8 %19, i8 0, i64 64, i1 false)
  %20 = getelementptr inbounds %"class.nvinfer1::plugin::GenerateDetection", ptr %10, i32 0, i32 3
  %21 = load i32, ptr %20, align 8, !tbaa !13
  %22 = sext i32 %21 to i64
  store i64 %22, ptr %19, align 8, !tbaa !28
  %23 = getelementptr inbounds i64, ptr %19, i64 1
  store i64 6, ptr %23, align 8, !tbaa !28
  ret void

24:                                               ; preds = %15
  %25 = landingpad { ptr, i32 }
          catch ptr null
  %26 = extractvalue { ptr, i32 } %25, 0
  call void @__clang_call_terminate(ptr %26) #5
  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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !10, i64 0}
!12 = !{!"_ZTSN8nvinfer16Dims64E", !10, i64 0, !7, i64 8}
!13 = !{!14, !10, i64 16}
!14 = !{!"_ZTSN8nvinfer16plugin17GenerateDetectionE", !15, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !17, i64 20, !17, i64 24, !10, i64 28, !10, i64 32, !18, i64 40, !21, i64 56, !22, i64 60, !23, i64 80, !12, i64 96, !25, i64 168}
!15 = !{!"_ZTSN8nvinfer112IPluginV2ExtE", !16, i64 0}
!16 = !{!"_ZTSN8nvinfer19IPluginV2E"}
!17 = !{!"float", !7, i64 0}
!18 = !{!"_ZTSSt10shared_ptrIN8nvinfer16plugin8CudaBindIiEEE", !19, i64 0}
!19 = !{!"_ZTSSt12__shared_ptrIN8nvinfer16plugin8CudaBindIiEELN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !20, i64 8}
!20 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0}
!21 = !{!"_ZTSN8nvinfer18DataTypeE", !7, i64 0}
!22 = !{!"_ZTS19RefineNMSParameters", !10, i64 0, !10, i64 4, !10, i64 8, !17, i64 12, !17, i64 16}
!23 = !{!"_ZTSSt10shared_ptrIN8nvinfer16plugin8CudaBindIfEEE", !24, i64 0}
!24 = !{!"_ZTSSt12__shared_ptrIN8nvinfer16plugin8CudaBindIfEELN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !20, i64 8}
!25 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !26, i64 0, !27, i64 8, !7, i64 16}
!26 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!27 = !{!"long", !7, i64 0}
!28 = !{!27, !27, 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] }

@.str.101 = external hidden unnamed_addr constant [108 x i8], align 1
@.str.116 = external hidden unnamed_addr constant [11 x i8], align 1

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8nvinfer16plugin17GenerateDetection18check_valid_inputsEPKNS_6Dims64Ei(ptr noundef nonnull align 8 dereferenceable(200), ptr noundef, i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN8nvinfer16plugin17GenerateDetection19getOutputDimensionsEiPKNS_6Dims64Ei(ptr dead_on_unwind noalias nocapture writable writeonly sret(%"class.nvinfer1::Dims64") align 8 %0, ptr noundef nonnull align 8 dereferenceable(200) %1, i32 noundef %2, ptr noundef %3, i32 noundef %4) unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN8nvinfer16plugin17GenerateDetection18check_valid_inputsEPKNS_6Dims64Ei(ptr noundef nonnull align 8 dereferenceable(200) %1, ptr noundef %3, i32 noundef %4) #4
  %6 = icmp eq i32 %2, 0
  br i1 %6, label %8, label %7

7:                                                ; preds = %5
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef nonnull @.str.116, ptr noundef nonnull @.str.101, i32 noundef 295)
          to label %8 unwind label %15

8:                                                ; preds = %7, %5
  store i32 2, ptr %0, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 8
  %10 = getelementptr inbounds i8, ptr %0, i64 24
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(64) %10, i8 0, i64 48, i1 false)
  %11 = getelementptr inbounds i8, ptr %1, i64 16
  %12 = load i32, ptr %11, align 8, !tbaa !10
  %13 = sext i32 %12 to i64
  store i64 %13, ptr %9, align 8, !tbaa !26
  %14 = getelementptr inbounds i8, ptr %0, i64 16
  store i64 6, ptr %14, align 8, !tbaa !26
  ret void

15:                                               ; preds = %7
  %16 = landingpad { ptr, i32 }
          catch ptr null
  %17 = extractvalue { ptr, i32 } %16, 0
  tail call void @__clang_call_terminate(ptr %17) #5
  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 nocallback nofree nounwind willreturn memory(argmem: write) }
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, !7, i64 0}
!6 = !{!"_ZTSN8nvinfer16Dims64E", !7, i64 0, !8, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !7, i64 16}
!11 = !{!"_ZTSN8nvinfer16plugin17GenerateDetectionE", !12, i64 0, !7, i64 8, !7, i64 12, !7, i64 16, !14, i64 20, !14, i64 24, !7, i64 28, !7, i64 32, !15, i64 40, !19, i64 56, !20, i64 60, !21, i64 80, !6, i64 96, !23, i64 168}
!12 = !{!"_ZTSN8nvinfer112IPluginV2ExtE", !13, i64 0}
!13 = !{!"_ZTSN8nvinfer19IPluginV2E"}
!14 = !{!"float", !8, i64 0}
!15 = !{!"_ZTSSt10shared_ptrIN8nvinfer16plugin8CudaBindIiEEE", !16, i64 0}
!16 = !{!"_ZTSSt12__shared_ptrIN8nvinfer16plugin8CudaBindIiEELN9__gnu_cxx12_Lock_policyE2EE", !17, i64 0, !18, i64 8}
!17 = !{!"any pointer", !8, i64 0}
!18 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !17, i64 0}
!19 = !{!"_ZTSN8nvinfer18DataTypeE", !8, i64 0}
!20 = !{!"_ZTS19RefineNMSParameters", !7, i64 0, !7, i64 4, !7, i64 8, !14, i64 12, !14, i64 16}
!21 = !{!"_ZTSSt10shared_ptrIN8nvinfer16plugin8CudaBindIfEEE", !22, i64 0}
!22 = !{!"_ZTSSt12__shared_ptrIN8nvinfer16plugin8CudaBindIfEELN9__gnu_cxx12_Lock_policyE2EE", !17, i64 0, !18, i64 8}
!23 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !24, i64 0, !25, i64 8, !8, i64 16}
!24 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !17, i64 0}
!25 = !{!"long", !8, i64 0}
!26 = !{!25, !25, i64 0}


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