; LLVM IR from NVIDIA/TensorRT :: plugin/nvFasterRCNN (nvFasterRCNNPlugin)

; 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::plugin::RPROIPlugin" = type <{ %"class.nvinfer1::IPluginV2IOExt", ptr, %"class.std::__cxx11::basic_string", i32, i32, i64, %"struct.nvinfer1::plugin::RPROIParams", i32, i32, i32, i32, ptr, ptr, i32, i32, i32, [4 x i8] }>
%"class.nvinfer1::IPluginV2IOExt" = type { %"class.nvinfer1::IPluginV2Ext" }
%"class.nvinfer1::IPluginV2Ext" = type { %"class.nvinfer1::IPluginV2" }
%"class.nvinfer1::IPluginV2" = type { 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::RPROIParams" = type { i32, i32, i32, i32, i32, i32, i32, float, float, float }

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

; 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
define dso_local noundef i64 @_ZNK8nvinfer16plugin11RPROIPlugin20getSerializationSizeEv(ptr noundef nonnull align 8 dereferenceable(148) %0) unnamed_addr #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %9 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #2
  store i64 40, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #2
  store i64 16, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #2
  %10 = getelementptr inbounds %"class.nvinfer1::plugin::RPROIPlugin", ptr %9, i32 0, i32 6
  %11 = getelementptr inbounds %"struct.nvinfer1::plugin::RPROIParams", ptr %10, i32 0, i32 5
  %12 = load i32, ptr %11, align 4, !tbaa !11
  %13 = sext i32 %12 to i64
  %14 = mul i64 4, %13
  store i64 %14, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #2
  %15 = getelementptr inbounds %"class.nvinfer1::plugin::RPROIPlugin", ptr %9, i32 0, i32 6
  %16 = getelementptr inbounds %"struct.nvinfer1::plugin::RPROIParams", ptr %15, i32 0, i32 6
  %17 = load i32, ptr %16, align 8, !tbaa !23
  %18 = sext i32 %17 to i64
  %19 = mul i64 4, %18
  store i64 %19, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #2
  store i64 8, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  store i64 4, ptr %8, align 8, !tbaa !9
  %20 = load i64, ptr %3, align 8, !tbaa !9
  %21 = load i64, ptr %4, align 8, !tbaa !9
  %22 = add i64 %20, %21
  %23 = load i64, ptr %5, align 8, !tbaa !9
  %24 = add i64 %22, %23
  %25 = load i64, ptr %6, align 8, !tbaa !9
  %26 = add i64 %24, %25
  %27 = load i64, ptr %7, align 8, !tbaa !9
  %28 = add i64 %26, %27
  %29 = load i64, ptr %8, align 8, !tbaa !9
  %30 = add i64 %28, %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #2
  ret i64 %30
}

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 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !18, i64 84}
!12 = !{!"_ZTSN8nvinfer16plugin11RPROIPluginE", !13, i64 0, !6, i64 8, !16, i64 16, !18, i64 48, !18, i64 52, !10, i64 56, !19, i64 64, !18, i64 104, !18, i64 108, !18, i64 112, !18, i64 116, !6, i64 120, !6, i64 128, !21, i64 136, !21, i64 140, !22, i64 144}
!13 = !{!"_ZTSN8nvinfer114IPluginV2IOExtE", !14, i64 0}
!14 = !{!"_ZTSN8nvinfer112IPluginV2ExtE", !15, i64 0}
!15 = !{!"_ZTSN8nvinfer19IPluginV2E"}
!16 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !17, i64 0, !10, i64 8, !7, i64 16}
!17 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!18 = !{!"int", !7, i64 0}
!19 = !{!"_ZTSN8nvinfer16plugin11RPROIParamsE", !18, i64 0, !18, i64 4, !18, i64 8, !18, i64 12, !18, i64 16, !18, i64 20, !18, i64 24, !20, i64 28, !20, i64 32, !20, i64 36}
!20 = !{!"float", !7, i64 0}
!21 = !{!"_ZTSN8nvinfer18DataTypeE", !7, i64 0}
!22 = !{!"_ZTSN8nvinfer16plugin9DLayout_tE", !7, i64 0}
!23 = !{!12, !18, i64 88}


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

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local noundef range(i64 -17179869116, 17179869245) i64 @_ZNK8nvinfer16plugin11RPROIPlugin20getSerializationSizeEv(ptr nocapture noundef nonnull readonly align 8 dereferenceable(148) %0) unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 84
  %3 = load i32, ptr %2, align 4, !tbaa !5
  %4 = sext i32 %3 to i64
  %5 = getelementptr inbounds i8, ptr %0, i64 88
  %6 = load i32, ptr %5, align 8, !tbaa !21
  %7 = sext i32 %6 to i64
  %8 = add nsw i64 %7, %4
  %9 = shl nsw i64 %8, 2
  %10 = add nsw i64 %9, 68
  ret i64 %10
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) 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" }

!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, !16, i64 84}
!6 = !{!"_ZTSN8nvinfer16plugin11RPROIPluginE", !7, i64 0, !10, i64 8, !13, i64 16, !16, i64 48, !16, i64 52, !15, i64 56, !17, i64 64, !16, i64 104, !16, i64 108, !16, i64 112, !16, i64 116, !10, i64 120, !10, i64 128, !19, i64 136, !19, i64 140, !20, i64 144}
!7 = !{!"_ZTSN8nvinfer114IPluginV2IOExtE", !8, i64 0}
!8 = !{!"_ZTSN8nvinfer112IPluginV2ExtE", !9, i64 0}
!9 = !{!"_ZTSN8nvinfer19IPluginV2E"}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C++ TBAA"}
!13 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !14, i64 0, !15, i64 8, !11, i64 16}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !10, i64 0}
!15 = !{!"long", !11, i64 0}
!16 = !{!"int", !11, i64 0}
!17 = !{!"_ZTSN8nvinfer16plugin11RPROIParamsE", !16, i64 0, !16, i64 4, !16, i64 8, !16, i64 12, !16, i64 16, !16, i64 20, !16, i64 24, !18, i64 28, !18, i64 32, !18, i64 36}
!18 = !{!"float", !11, i64 0}
!19 = !{!"_ZTSN8nvinfer18DataTypeE", !11, i64 0}
!20 = !{!"_ZTSN8nvinfer16plugin9DLayout_tE", !11, i64 0}
!21 = !{!6, !16, i64 88}


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