; 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.118 = external hidden unnamed_addr constant [81 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: mustprogress nounwind uwtable
declare dso_local void @_ZN8nvinfer16plugin17GenerateDetection18check_valid_inputsEPKNS_6Dims64Ei(ptr noundef nonnull align 8 dereferenceable(200), ptr noundef, i32 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN8nvinfer16plugin17GenerateDetection15configurePluginEPKNS_6Dims64EiS4_iPKNS_8DataTypeES7_PKbS9_NS_12TensorFormatEi(ptr noundef nonnull align 8 dereferenceable(200) %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, i32 noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7, ptr noundef %8, i32 noundef %9, i32 noundef %10) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  store ptr %0, ptr %12, align 8, !tbaa !5
  store ptr %1, ptr %13, align 8, !tbaa !5
  store i32 %2, ptr %14, align 4, !tbaa !9
  store ptr %3, ptr %15, align 8, !tbaa !5
  store i32 %4, ptr %16, align 4, !tbaa !9
  store ptr %5, ptr %17, align 8, !tbaa !5
  store ptr %6, ptr %18, align 8, !tbaa !5
  store ptr %7, ptr %19, align 8, !tbaa !5
  store ptr %8, ptr %20, align 8, !tbaa !5
  store i32 %9, ptr %21, align 4, !tbaa !11
  store i32 %10, ptr %22, align 4, !tbaa !9
  %23 = load ptr, ptr %12, align 8
  %24 = load ptr, ptr %13, align 8, !tbaa !5
  %25 = load i32, ptr %14, align 4, !tbaa !9
  call void @_ZN8nvinfer16plugin17GenerateDetection18check_valid_inputsEPKNS_6Dims64Ei(ptr noundef nonnull align 8 dereferenceable(200) %23, ptr noundef %24, i32 noundef %25) #3
  %26 = load ptr, ptr %13, align 8, !tbaa !5
  %27 = getelementptr inbounds %"class.nvinfer1::Dims64", ptr %26, i64 0
  %28 = getelementptr inbounds %"class.nvinfer1::Dims64", ptr %27, i32 0, i32 1
  %29 = getelementptr inbounds [8 x i64], ptr %28, i64 0, i64 0
  %30 = load i64, ptr %29, align 8, !tbaa !13
  %31 = load ptr, ptr %13, align 8, !tbaa !5
  %32 = getelementptr inbounds %"class.nvinfer1::Dims64", ptr %31, i64 1
  %33 = getelementptr inbounds %"class.nvinfer1::Dims64", ptr %32, i32 0, i32 1
  %34 = getelementptr inbounds [8 x i64], ptr %33, i64 0, i64 0
  %35 = load i64, ptr %34, align 8, !tbaa !13
  %36 = icmp eq i64 %30, %35
  br i1 %36, label %37, label %49

37:                                               ; preds = %11
  %38 = load ptr, ptr %13, align 8, !tbaa !5
  %39 = getelementptr inbounds %"class.nvinfer1::Dims64", ptr %38, i64 1
  %40 = getelementptr inbounds %"class.nvinfer1::Dims64", ptr %39, i32 0, i32 1
  %41 = getelementptr inbounds [8 x i64], ptr %40, i64 0, i64 0
  %42 = load i64, ptr %41, align 8, !tbaa !13
  %43 = load ptr, ptr %13, align 8, !tbaa !5
  %44 = getelementptr inbounds %"class.nvinfer1::Dims64", ptr %43, i64 2
  %45 = getelementptr inbounds %"class.nvinfer1::Dims64", ptr %44, i32 0, i32 1
  %46 = getelementptr inbounds [8 x i64], ptr %45, i64 0, i64 0
  %47 = load i64, ptr %46, align 8, !tbaa !13
  %48 = icmp eq i64 %42, %47
  br i1 %48, label %51, label %49

49:                                               ; preds = %37, %11
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef @.str.118, ptr noundef @.str.101, i32 noundef 350)
          to label %50 unwind label %65

50:                                               ; preds = %49
  br label %51

51:                                               ; preds = %50, %37
  %52 = load ptr, ptr %13, align 8, !tbaa !5
  %53 = getelementptr inbounds %"class.nvinfer1::Dims64", ptr %52, i64 2
  %54 = getelementptr inbounds %"class.nvinfer1::Dims64", ptr %53, i32 0, i32 1
  %55 = getelementptr inbounds [8 x i64], ptr %54, i64 0, i64 0
  %56 = load i64, ptr %55, align 8, !tbaa !13
  %57 = trunc i64 %56 to i32
  %58 = getelementptr inbounds %"class.nvinfer1::plugin::GenerateDetection", ptr %23, i32 0, i32 7
  store i32 %57, ptr %58, align 8, !tbaa !15
  %59 = load ptr, ptr %17, align 8, !tbaa !5
  %60 = getelementptr inbounds i32, ptr %59, i64 0
  %61 = load i32, ptr %60, align 4, !tbaa !30
  %62 = getelementptr inbounds %"class.nvinfer1::plugin::GenerateDetection", ptr %23, i32 0, i32 9
  store i32 %61, ptr %62, align 8, !tbaa !31
  %63 = load i32, ptr %22, align 4, !tbaa !9
  %64 = getelementptr inbounds %"class.nvinfer1::plugin::GenerateDetection", ptr %23, i32 0, i32 6
  store i32 %63, ptr %64, align 4, !tbaa !32
  ret void

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


; 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.101 = external hidden unnamed_addr constant [108 x i8], align 1
@.str.118 = external hidden unnamed_addr constant [81 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 nounwind uwtable
declare dso_local void @_ZN8nvinfer16plugin17GenerateDetection18check_valid_inputsEPKNS_6Dims64Ei(ptr noundef nonnull align 8 dereferenceable(200), ptr noundef, i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN8nvinfer16plugin17GenerateDetection15configurePluginEPKNS_6Dims64EiS4_iPKNS_8DataTypeES7_PKbS9_NS_12TensorFormatEi(ptr noundef nonnull align 8 dereferenceable(200) %0, ptr noundef %1, i32 noundef %2, ptr nocapture noundef readnone %3, i32 noundef %4, ptr nocapture noundef readonly %5, ptr nocapture noundef readnone %6, ptr nocapture noundef readnone %7, ptr nocapture noundef readnone %8, i32 noundef %9, i32 noundef %10) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN8nvinfer16plugin17GenerateDetection18check_valid_inputsEPKNS_6Dims64Ei(ptr noundef nonnull align 8 dereferenceable(200) %0, ptr noundef %1, i32 noundef %2) #3
  %12 = getelementptr inbounds i8, ptr %1, i64 8
  %13 = load i64, ptr %12, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %1, i64 80
  %15 = load i64, ptr %14, align 8, !tbaa !5
  %16 = icmp eq i64 %13, %15
  br i1 %16, label %17, label %21

17:                                               ; preds = %11
  %18 = getelementptr inbounds i8, ptr %1, i64 152
  %19 = load i64, ptr %18, align 8, !tbaa !5
  %20 = icmp eq i64 %13, %19
  br i1 %20, label %22, label %21

21:                                               ; preds = %17, %11
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef nonnull @.str.118, ptr noundef nonnull @.str.101, i32 noundef 350)
          to label %._crit_edge unwind label %29

._crit_edge:                                      ; preds = %21
  %.phi.trans.insert = getelementptr inbounds i8, ptr %1, i64 152
  %.pre = load i64, ptr %.phi.trans.insert, align 8, !tbaa !5
  br label %22

22:                                               ; preds = %._crit_edge, %17
  %23 = phi i64 [ %.pre, %._crit_edge ], [ %13, %17 ]
  %24 = trunc i64 %23 to i32
  %25 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 %24, ptr %25, align 8, !tbaa !9
  %26 = load i32, ptr %5, align 4, !tbaa !26
  %27 = getelementptr inbounds i8, ptr %0, i64 56
  store i32 %26, ptr %27, align 8, !tbaa !27
  %28 = getelementptr inbounds i8, ptr %0, i64 28
  store i32 %10, ptr %28, align 4, !tbaa !28
  ret void

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


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass