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

; 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::plugin::GridAnchorParameters" = type { float, float, ptr, i32, i32, i32, [4 x float] }
%"class.nvinfer1::plugin::GridAnchorGenerator" = type { %"class.nvinfer1::IPluginV2Ext", %"class.std::__cxx11::basic_string", i32, %"class.std::vector.3", ptr, ptr, ptr, %"class.std::__cxx11::basic_string" }
%"class.nvinfer1::IPluginV2Ext" = type { %"class.nvinfer1::IPluginV2" }
%"class.nvinfer1::IPluginV2" = type { ptr }
%"class.std::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = type { %"struct.std::_Vector_base<nvinfer1::plugin::GridAnchorParameters, std::allocator<nvinfer1::plugin::GridAnchorParameters>>::_Vector_impl" }
%"struct.std::_Vector_base<nvinfer1::plugin::GridAnchorParameters, std::allocator<nvinfer1::plugin::GridAnchorParameters>>::_Vector_impl" = type { %"struct.std::_Vector_base<nvinfer1::plugin::GridAnchorParameters, std::allocator<nvinfer1::plugin::GridAnchorParameters>>::_Vector_impl_data" }
%"struct.std::_Vector_base<nvinfer1::plugin::GridAnchorParameters, std::allocator<nvinfer1::plugin::GridAnchorParameters>>::_Vector_impl_data" = type { ptr, ptr, 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] }
%"class.nvinfer1::Weights" = type { i32, ptr, i64 }

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt6vectorIN8nvinfer16plugin20GridAnchorParametersESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

; 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) #2

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @_ZN8nvinfer16plugin19GridAnchorGenerator7enqueueEiPKPKvPKPvS6_P11CUstream_st(ptr noundef nonnull align 8 dereferenceable(128) %0, i32 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca %"struct.nvinfer1::plugin::GridAnchorParameters", align 8
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i32 %1, ptr %9, align 4, !tbaa !9
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  %19 = load ptr, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %20

20:                                               ; preds = %68, %6
  %21 = load i32, ptr %14, align 4, !tbaa !9
  %22 = getelementptr inbounds %"class.nvinfer1::plugin::GridAnchorGenerator", ptr %19, i32 0, i32 2
  %23 = load i32, ptr %22, align 8, !tbaa !11
  %24 = icmp slt i32 %21, %23
  br i1 %24, label %26, label %25

25:                                               ; preds = %20
  store i32 2, ptr %15, align 4
  br label %71

26:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %27 = load ptr, ptr %11, align 8, !tbaa !5
  %28 = load i32, ptr %14, align 4, !tbaa !9
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds ptr, ptr %27, i64 %29
  %31 = load ptr, ptr %30, align 8, !tbaa !5
  store ptr %31, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %32 = load ptr, ptr %13, align 8, !tbaa !5
  %33 = getelementptr inbounds %"class.nvinfer1::plugin::GridAnchorGenerator", ptr %19, i32 0, i32 3
  %34 = load i32, ptr %14, align 4, !tbaa !9
  %35 = sext i32 %34 to i64
  %36 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt6vectorIN8nvinfer16plugin20GridAnchorParametersESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %33, i64 noundef %35) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %18, ptr align 8 %36, i64 48, i1 false), !tbaa.struct !22
  %37 = getelementptr inbounds %"class.nvinfer1::plugin::GridAnchorGenerator", ptr %19, i32 0, i32 4
  %38 = load ptr, ptr %37, align 8, !tbaa !26
  %39 = load i32, ptr %14, align 4, !tbaa !9
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds i32, ptr %38, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !9
  %43 = getelementptr inbounds %"class.nvinfer1::plugin::GridAnchorGenerator", ptr %19, i32 0, i32 5
  %44 = load ptr, ptr %43, align 8, !tbaa !27
  %45 = load i32, ptr %14, align 4, !tbaa !9
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds %"class.nvinfer1::Weights", ptr %44, i64 %46
  %48 = getelementptr inbounds %"class.nvinfer1::Weights", ptr %47, i32 0, i32 1
  %49 = load ptr, ptr %48, align 8, !tbaa !28
  %50 = getelementptr inbounds %"class.nvinfer1::plugin::GridAnchorGenerator", ptr %19, i32 0, i32 6
  %51 = load ptr, ptr %50, align 8, !tbaa !31
  %52 = load i32, ptr %14, align 4, !tbaa !9
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds %"class.nvinfer1::Weights", ptr %51, i64 %53
  %55 = getelementptr inbounds %"class.nvinfer1::Weights", ptr %54, i32 0, i32 1
  %56 = load ptr, ptr %55, align 8, !tbaa !28
  %57 = load ptr, ptr %16, align 8, !tbaa !5
  %58 = invoke noundef i32 @_ZN8nvinfer16plugin19anchorGridInferenceEP11CUstream_stNS0_20GridAnchorParametersEiPKvS5_Pv(ptr noundef %32, ptr noundef byval(%"struct.nvinfer1::plugin::GridAnchorParameters") align 8 %18, i32 noundef %42, ptr noundef %49, ptr noundef %56, ptr noundef %57)
          to label %59 unwind label %76

59:                                               ; preds = %26
  store i32 %58, ptr %17, align 4, !tbaa !32
  %60 = load i32, ptr %17, align 4, !tbaa !32
  %61 = icmp ne i32 %60, 0
  br i1 %61, label %62, label %64

62:                                               ; preds = %59
  %63 = load i32, ptr %17, align 4, !tbaa !32
  store i32 %63, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %65

64:                                               ; preds = %59
  store i32 0, ptr %15, align 4
  br label %65

65:                                               ; preds = %64, %62
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  %66 = load i32, ptr %15, align 4
  switch i32 %66, label %71 [
    i32 0, label %67
  ]

67:                                               ; preds = %65
  br label %68

68:                                               ; preds = %67
  %69 = load i32, ptr %14, align 4, !tbaa !9
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %14, align 4, !tbaa !9
  br label %20, !llvm.loop !34

71:                                               ; preds = %65, %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  %72 = load i32, ptr %15, align 4
  switch i32 %72, label %79 [
    i32 2, label %73
    i32 1, label %74
  ]

73:                                               ; preds = %71
  store i32 0, ptr %7, align 4
  br label %74

74:                                               ; preds = %73, %71
  %75 = load i32, ptr %7, align 4
  ret i32 %75

76:                                               ; preds = %26
  %77 = landingpad { ptr, i32 }
          catch ptr null
  %78 = extractvalue { ptr, i32 } %77, 0
  call void @__clang_call_terminate(ptr %78) #6
  unreachable

79:                                               ; preds = %71
  unreachable
}

declare noundef i32 @_ZN8nvinfer16plugin19anchorGridInferenceEP11CUstream_stNS0_20GridAnchorParametersEiPKvS5_Pv(ptr noundef, ptr noundef byval(%"struct.nvinfer1::plugin::GridAnchorParameters") align 8, i32 noundef, ptr noundef, ptr noundef, ptr noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { "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 = { nounwind }
attributes #6 = { 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 40}
!12 = !{!"_ZTSN8nvinfer16plugin19GridAnchorGeneratorE", !13, i64 0, !15, i64 8, !10, i64 40, !18, i64 48, !6, i64 72, !6, i64 80, !6, i64 88, !15, i64 96}
!13 = !{!"_ZTSN8nvinfer112IPluginV2ExtE", !14, i64 0}
!14 = !{!"_ZTSN8nvinfer19IPluginV2E"}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !16, i64 0, !17, i64 8, !7, i64 16}
!16 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!17 = !{!"long", !7, i64 0}
!18 = !{!"_ZTSSt6vectorIN8nvinfer16plugin20GridAnchorParametersESaIS2_EE", !19, i64 0}
!19 = !{!"_ZTSSt12_Vector_baseIN8nvinfer16plugin20GridAnchorParametersESaIS2_EE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIN8nvinfer16plugin20GridAnchorParametersESaIS2_EE12_Vector_implE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIN8nvinfer16plugin20GridAnchorParametersESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!22 = !{i64 0, i64 4, !23, i64 4, i64 4, !23, i64 8, i64 8, !5, i64 16, i64 4, !9, i64 20, i64 4, !9, i64 24, i64 4, !9, i64 28, i64 16, !25}
!23 = !{!24, !24, i64 0}
!24 = !{!"float", !7, i64 0}
!25 = !{!7, !7, i64 0}
!26 = !{!12, !6, i64 72}
!27 = !{!12, !6, i64 80}
!28 = !{!29, !6, i64 8}
!29 = !{!"_ZTSN8nvinfer17WeightsE", !30, i64 0, !6, i64 8, !17, i64 16}
!30 = !{!"_ZTSN8nvinfer18DataTypeE", !7, i64 0}
!31 = !{!12, !6, i64 88}
!32 = !{!33, !33, i64 0}
!33 = !{!"_ZTS14pluginStatus_t", !7, i64 0}
!34 = distinct !{!34, !35}
!35 = !{!"llvm.loop.mustprogress"}


; 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::Weights" = type { i32, ptr, i64 }
%"struct.nvinfer1::plugin::GridAnchorParameters" = type { float, float, ptr, i32, i32, i32, [4 x float] }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt6vectorIN8nvinfer16plugin20GridAnchorParametersESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @_ZN8nvinfer16plugin19GridAnchorGenerator7enqueueEiPKPKvPKPvS6_P11CUstream_st(ptr noundef nonnull align 8 dereferenceable(128) %0, i32 noundef %1, ptr nocapture noundef readnone %2, ptr nocapture noundef readonly %3, ptr nocapture noundef readnone %4, ptr noundef %5) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %7 = getelementptr inbounds i8, ptr %0, i64 40
  %8 = load i32, ptr %7, align 8, !tbaa !5
  %.not1920 = icmp sgt i32 %8, 0
  br i1 %.not1920, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %6
  %9 = getelementptr inbounds i8, ptr %0, i64 48
  %10 = getelementptr inbounds i8, ptr %0, i64 72
  %11 = getelementptr inbounds i8, ptr %0, i64 80
  %12 = getelementptr inbounds i8, ptr %0, i64 88
  br label %16

13:                                               ; preds = %30
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %14 = load i32, ptr %7, align 8, !tbaa !5
  %15 = sext i32 %14 to i64
  %.not19 = icmp slt i64 %indvars.iv.next, %15
  br i1 %.not19, label %16, label %._crit_edge, !llvm.loop !20

16:                                               ; preds = %.lr.ph, %13
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %13 ]
  %17 = getelementptr inbounds ptr, ptr %3, i64 %indvars.iv
  %18 = load ptr, ptr %17, align 8, !tbaa !22
  %19 = tail call noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt6vectorIN8nvinfer16plugin20GridAnchorParametersESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef %indvars.iv) #3
  %20 = load ptr, ptr %10, align 8, !tbaa !23
  %21 = getelementptr inbounds i32, ptr %20, i64 %indvars.iv
  %22 = load i32, ptr %21, align 4, !tbaa !24
  %23 = load ptr, ptr %11, align 8, !tbaa !25
  %24 = getelementptr inbounds %"class.nvinfer1::Weights", ptr %23, i64 %indvars.iv, i32 1
  %25 = load ptr, ptr %24, align 8, !tbaa !26
  %26 = load ptr, ptr %12, align 8, !tbaa !29
  %27 = getelementptr inbounds %"class.nvinfer1::Weights", ptr %26, i64 %indvars.iv, i32 1
  %28 = load ptr, ptr %27, align 8, !tbaa !26
  %29 = invoke noundef i32 @_ZN8nvinfer16plugin19anchorGridInferenceEP11CUstream_stNS0_20GridAnchorParametersEiPKvS5_Pv(ptr noundef %5, ptr noundef nonnull byval(%"struct.nvinfer1::plugin::GridAnchorParameters") align 8 %19, i32 noundef %22, ptr noundef %25, ptr noundef %28, ptr noundef %18)
          to label %30 unwind label %31

30:                                               ; preds = %16
  %.not = icmp eq i32 %29, 0
  br i1 %.not, label %13, label %._crit_edge

._crit_edge:                                      ; preds = %30, %13, %6
  %spec.select = phi i32 [ 0, %6 ], [ 0, %13 ], [ %29, %30 ]
  ret i32 %spec.select

31:                                               ; preds = %16
  %32 = landingpad { ptr, i32 }
          catch ptr null
  %33 = extractvalue { ptr, i32 } %32, 0
  tail call void @__clang_call_terminate(ptr %33) #4
  unreachable
}

declare noundef i32 @_ZN8nvinfer16plugin19anchorGridInferenceEP11CUstream_stNS0_20GridAnchorParametersEiPKvS5_Pv(ptr noundef, ptr noundef byval(%"struct.nvinfer1::plugin::GridAnchorParameters") align 8, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

attributes #0 = { 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 #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 = { 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, !15, i64 40}
!6 = !{!"_ZTSN8nvinfer16plugin19GridAnchorGeneratorE", !7, i64 0, !9, i64 8, !15, i64 40, !16, i64 48, !11, i64 72, !11, i64 80, !11, i64 88, !9, i64 96}
!7 = !{!"_ZTSN8nvinfer112IPluginV2ExtE", !8, i64 0}
!8 = !{!"_ZTSN8nvinfer19IPluginV2E"}
!9 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !10, i64 0, !14, i64 8, !12, i64 16}
!10 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !11, i64 0}
!11 = !{!"any pointer", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C++ TBAA"}
!14 = !{!"long", !12, i64 0}
!15 = !{!"int", !12, i64 0}
!16 = !{!"_ZTSSt6vectorIN8nvinfer16plugin20GridAnchorParametersESaIS2_EE", !17, i64 0}
!17 = !{!"_ZTSSt12_Vector_baseIN8nvinfer16plugin20GridAnchorParametersESaIS2_EE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIN8nvinfer16plugin20GridAnchorParametersESaIS2_EE12_Vector_implE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIN8nvinfer16plugin20GridAnchorParametersESaIS2_EE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!11, !11, i64 0}
!23 = !{!6, !11, i64 72}
!24 = !{!15, !15, i64 0}
!25 = !{!6, !11, i64 80}
!26 = !{!27, !11, i64 8}
!27 = !{!"_ZTSN8nvinfer17WeightsE", !28, i64 0, !11, i64 8, !14, i64 16}
!28 = !{!"_ZTSN8nvinfer18DataTypeE", !12, i64 0}
!29 = !{!6, !11, i64 88}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass