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

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

; 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 void @_ZN8nvinfer16plugin19GridAnchorGenerator19getOutputDimensionsEiPKNS_6Dims64Ei(ptr dead_on_unwind noalias writable sret(%"class.nvinfer1::Dims64") align 8 %0, ptr noundef nonnull align 8 dereferenceable(128) %1, i32 noundef %2, ptr noundef %3, i32 noundef %4) unnamed_addr #1 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
  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
  %11 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 72, ptr %10) #5
  %12 = getelementptr inbounds %"class.nvinfer1::plugin::GridAnchorGenerator", ptr %11, i32 0, i32 3
  %13 = load i32, ptr %7, align 4, !tbaa !9
  %14 = sext i32 %13 to i64
  %15 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt6vectorIN8nvinfer16plugin20GridAnchorParametersESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %14) #5
  %16 = getelementptr inbounds %"struct.nvinfer1::plugin::GridAnchorParameters", ptr %15, i32 0, i32 4
  %17 = load i32, ptr %16, align 4, !tbaa !11
  %18 = getelementptr inbounds %"class.nvinfer1::plugin::GridAnchorGenerator", ptr %11, i32 0, i32 3
  %19 = load i32, ptr %7, align 4, !tbaa !9
  %20 = sext i32 %19 to i64
  %21 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt6vectorIN8nvinfer16plugin20GridAnchorParametersESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %18, i64 noundef %20) #5
  %22 = getelementptr inbounds %"struct.nvinfer1::plugin::GridAnchorParameters", ptr %21, i32 0, i32 5
  %23 = load i32, ptr %22, align 8, !tbaa !14
  %24 = mul nsw i32 %17, %23
  %25 = getelementptr inbounds %"class.nvinfer1::plugin::GridAnchorGenerator", ptr %11, i32 0, i32 4
  %26 = load ptr, ptr %25, align 8, !tbaa !15
  %27 = load i32, ptr %7, align 4, !tbaa !9
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds i32, ptr %26, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !9
  %31 = mul nsw i32 %24, %30
  %32 = mul nsw i32 %31, 4
  %33 = sext i32 %32 to i64
  invoke void @_ZN8nvinfer15Dims3C2Elll(ptr noundef nonnull align 8 dereferenceable(72) %10, i64 noundef 2, i64 noundef %33, i64 noundef 1)
          to label %34 unwind label %35

34:                                               ; preds = %5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %0, ptr align 8 %10, i64 72, i1 false), !tbaa.struct !26
  call void @llvm.lifetime.end.p0(i64 72, ptr %10) #5
  ret void

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

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

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 = { 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 #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 20}
!12 = !{!"_ZTSN8nvinfer16plugin20GridAnchorParametersE", !13, i64 0, !13, i64 4, !6, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !7, i64 28}
!13 = !{!"float", !7, i64 0}
!14 = !{!12, !10, i64 24}
!15 = !{!16, !6, i64 72}
!16 = !{!"_ZTSN8nvinfer16plugin19GridAnchorGeneratorE", !17, i64 0, !19, i64 8, !10, i64 40, !22, i64 48, !6, i64 72, !6, i64 80, !6, i64 88, !19, i64 96}
!17 = !{!"_ZTSN8nvinfer112IPluginV2ExtE", !18, i64 0}
!18 = !{!"_ZTSN8nvinfer19IPluginV2E"}
!19 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !20, i64 0, !21, i64 8, !7, i64 16}
!20 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!21 = !{!"long", !7, i64 0}
!22 = !{!"_ZTSSt6vectorIN8nvinfer16plugin20GridAnchorParametersESaIS2_EE", !23, i64 0}
!23 = !{!"_ZTSSt12_Vector_baseIN8nvinfer16plugin20GridAnchorParametersESaIS2_EE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIN8nvinfer16plugin20GridAnchorParametersESaIS2_EE12_Vector_implE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIN8nvinfer16plugin20GridAnchorParametersESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!26 = !{i64 0, i64 4, !9, i64 8, i64 64, !27}
!27 = !{!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" }

; Function Attrs: mustprogress 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: mustprogress 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) local_unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN8nvinfer16plugin19GridAnchorGenerator19getOutputDimensionsEiPKNS_6Dims64Ei(ptr dead_on_unwind noalias nocapture writable writeonly sret(%"class.nvinfer1::Dims64") align 8 %0, ptr noundef nonnull align 8 dereferenceable(128) %1, i32 noundef %2, ptr nocapture noundef readnone %3, i32 noundef %4) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca %"class.nvinfer1::Dims3", align 8
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %6) #5
  %7 = getelementptr inbounds i8, ptr %1, i64 48
  %8 = sext i32 %2 to i64
  %9 = tail call noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt6vectorIN8nvinfer16plugin20GridAnchorParametersESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %8) #5
  %10 = getelementptr inbounds i8, ptr %9, i64 20
  %11 = load i32, ptr %10, align 4, !tbaa !5
  %12 = tail call noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt6vectorIN8nvinfer16plugin20GridAnchorParametersESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %8) #5
  %13 = getelementptr inbounds i8, ptr %12, i64 24
  %14 = load i32, ptr %13, align 8, !tbaa !12
  %15 = getelementptr inbounds i8, ptr %1, i64 72
  %16 = load ptr, ptr %15, align 8, !tbaa !13
  %17 = getelementptr inbounds i32, ptr %16, i64 %8
  %18 = load i32, ptr %17, align 4, !tbaa !24
  %19 = shl i32 %11, 2
  %20 = mul i32 %19, %14
  %21 = mul i32 %20, %18
  %22 = sext i32 %21 to i64
  invoke void @_ZN8nvinfer15Dims3C2Elll(ptr noundef nonnull align 8 dereferenceable(72) %6, i64 noundef 2, i64 noundef %22, i64 noundef 1)
          to label %23 unwind label %24

23:                                               ; preds = %5
  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 !25
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %6) #5
  ret void

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

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

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


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