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

; 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::RegionParameters" = type { i32, i32, i32, ptr }
%"struct.nvinfer1::plugin::(anonymous namespace)::SoftmaxTreeDeleter" = type { i8 }
%"class.nvinfer1::plugin::Region" = type { %"class.nvinfer1::IPluginV2Ext", i32, i32, i32, %"class.std::shared_ptr", i32, i32, i32, i8, %"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 }
%"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] }

@_ZTVN8nvinfer16plugin6RegionE = external dso_local unnamed_addr constant { [27 x ptr] }, align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8nvinfer112IPluginV2ExtC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZNSt10shared_ptrIN8nvinfer16plugin11softmaxTreeEEC2IS2_NS1_12_GLOBAL__N_118SoftmaxTreeDeleterEvEEPT_T0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8nvinfer16plugin6RegionC2ENS0_16RegionParametersEiii(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr noundef byval(%"struct.nvinfer1::plugin::RegionParameters") align 8 %1, i32 noundef %2, i32 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 i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %"struct.nvinfer1::plugin::(anonymous namespace)::SoftmaxTreeDeleter", align 1
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !9
  store i32 %4, ptr %9, align 4, !tbaa !9
  %13 = load ptr, ptr %6, align 8
  call void @_ZN8nvinfer112IPluginV2ExtC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %13) #2
  store ptr getelementptr inbounds inrange(-16, 200) ({ [27 x ptr] }, ptr @_ZTVN8nvinfer16plugin6RegionE, i32 0, i32 0, i32 2), ptr %13, align 8, !tbaa !11
  %14 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %13, i32 0, i32 1
  %15 = getelementptr inbounds %"struct.nvinfer1::plugin::RegionParameters", ptr %1, i32 0, i32 0
  %16 = load i32, ptr %15, align 8, !tbaa !13
  store i32 %16, ptr %14, align 8, !tbaa !15
  %17 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %13, i32 0, i32 2
  %18 = getelementptr inbounds %"struct.nvinfer1::plugin::RegionParameters", ptr %1, i32 0, i32 1
  %19 = load i32, ptr %18, align 4, !tbaa !26
  store i32 %19, ptr %17, align 4, !tbaa !27
  %20 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %13, i32 0, i32 3
  %21 = getelementptr inbounds %"struct.nvinfer1::plugin::RegionParameters", ptr %1, i32 0, i32 2
  %22 = load i32, ptr %21, align 8, !tbaa !28
  store i32 %22, ptr %20, align 8, !tbaa !29
  %23 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %13, i32 0, i32 4
  %24 = getelementptr inbounds %"struct.nvinfer1::plugin::RegionParameters", ptr %1, i32 0, i32 3
  %25 = load ptr, ptr %24, align 8, !tbaa !30
  invoke void @_ZNSt10shared_ptrIN8nvinfer16plugin11softmaxTreeEEC2IS2_NS1_12_GLOBAL__N_118SoftmaxTreeDeleterEvEEPT_T0_(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef %25)
          to label %26 unwind label %34

26:                                               ; preds = %5
  %27 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %13, i32 0, i32 5
  %28 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %28, ptr %27, align 8, !tbaa !31
  %29 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %13, i32 0, i32 6
  %30 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %30, ptr %29, align 4, !tbaa !32
  %31 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %13, i32 0, i32 7
  %32 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %32, ptr %31, align 8, !tbaa !33
  %33 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %13, i32 0, i32 9
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %33) #2
  ret void

34:                                               ; preds = %5
  %35 = landingpad { ptr, i32 }
          cleanup
  %36 = extractvalue { ptr, i32 } %35, 0
  store ptr %36, ptr %11, align 8
  %37 = extractvalue { ptr, i32 } %35, 1
  store i32 %37, ptr %12, align 4
  call void @_ZN8nvinfer19IPluginV2D2Ev(ptr noundef nonnull align 8 dereferenceable(8) %13) #2
  br label %38

38:                                               ; preds = %34
  %39 = load ptr, ptr %11, align 8
  %40 = load i32, ptr %12, align 4
  %41 = insertvalue { ptr, i32 } poison, ptr %39, 0
  %42 = insertvalue { ptr, i32 } %41, i32 %40, 1
  resume { ptr, i32 } %42
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8nvinfer19IPluginV2D2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #0 align 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 = { 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 #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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"vtable pointer", !8, i64 0}
!13 = !{!14, !10, i64 0}
!14 = !{!"_ZTSN8nvinfer16plugin16RegionParametersE", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16}
!15 = !{!16, !10, i64 8}
!16 = !{!"_ZTSN8nvinfer16plugin6RegionE", !17, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !19, i64 24, !10, i64 40, !10, i64 44, !10, i64 48, !22, i64 52, !23, i64 56}
!17 = !{!"_ZTSN8nvinfer112IPluginV2ExtE", !18, i64 0}
!18 = !{!"_ZTSN8nvinfer19IPluginV2E"}
!19 = !{!"_ZTSSt10shared_ptrIN8nvinfer16plugin11softmaxTreeEE", !20, i64 0}
!20 = !{!"_ZTSSt12__shared_ptrIN8nvinfer16plugin11softmaxTreeELN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !21, i64 8}
!21 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0}
!22 = !{!"bool", !7, i64 0}
!23 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !24, i64 0, !25, i64 8, !7, i64 16}
!24 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!25 = !{!"long", !7, i64 0}
!26 = !{!14, !10, i64 4}
!27 = !{!16, !10, i64 12}
!28 = !{!14, !10, i64 8}
!29 = !{!16, !10, i64 16}
!30 = !{!14, !6, i64 16}
!31 = !{!16, !10, i64 40}
!32 = !{!16, !10, i64 44}
!33 = !{!16, !10, i64 48}


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

%"struct.nvinfer1::plugin::RegionParameters" = type { i32, i32, i32, ptr }

@_ZTVN8nvinfer16plugin6RegionE = external dso_local unnamed_addr constant { [27 x ptr] }, align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8nvinfer112IPluginV2ExtC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZNSt10shared_ptrIN8nvinfer16plugin11softmaxTreeEEC2IS2_NS1_12_GLOBAL__N_118SoftmaxTreeDeleterEvEEPT_T0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8nvinfer16plugin6RegionC2ENS0_16RegionParametersEiii(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr nocapture noundef readonly byval(%"struct.nvinfer1::plugin::RegionParameters") align 8 %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN8nvinfer112IPluginV2ExtC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #2
  store ptr getelementptr inbounds inrange(-16, 200) (i8, ptr @_ZTVN8nvinfer16plugin6RegionE, i64 16), ptr %0, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = load <2 x i32>, ptr %1, align 8, !tbaa !8
  store <2 x i32> %7, ptr %6, align 8, !tbaa !8
  %8 = getelementptr inbounds i8, ptr %0, i64 16
  %9 = getelementptr inbounds i8, ptr %1, i64 8
  %10 = load i32, ptr %9, align 8, !tbaa !11
  store i32 %10, ptr %8, align 8, !tbaa !14
  %11 = getelementptr inbounds i8, ptr %0, i64 24
  %12 = getelementptr inbounds i8, ptr %1, i64 16
  %13 = load ptr, ptr %12, align 8, !tbaa !25
  invoke void @_ZNSt10shared_ptrIN8nvinfer16plugin11softmaxTreeEEC2IS2_NS1_12_GLOBAL__N_118SoftmaxTreeDeleterEvEEPT_T0_(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef %13)
          to label %14 unwind label %19

14:                                               ; preds = %5
  %15 = getelementptr inbounds i8, ptr %0, i64 40
  store i32 %2, ptr %15, align 8, !tbaa !26
  %16 = getelementptr inbounds i8, ptr %0, i64 44
  store i32 %3, ptr %16, align 4, !tbaa !27
  %17 = getelementptr inbounds i8, ptr %0, i64 48
  store i32 %4, ptr %17, align 8, !tbaa !28
  %18 = getelementptr inbounds i8, ptr %0, i64 56
  tail call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %18) #2
  ret void

19:                                               ; preds = %5
  %20 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN8nvinfer19IPluginV2D2Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #2
  resume { ptr, i32 } %20
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8nvinfer19IPluginV2D2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #0 align 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 = { 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 #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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !9, i64 8}
!12 = !{!"_ZTSN8nvinfer16plugin16RegionParametersE", !9, i64 0, !9, i64 4, !9, i64 8, !13, i64 16}
!13 = !{!"any pointer", !10, i64 0}
!14 = !{!15, !9, i64 16}
!15 = !{!"_ZTSN8nvinfer16plugin6RegionE", !16, i64 0, !9, i64 8, !9, i64 12, !9, i64 16, !18, i64 24, !9, i64 40, !9, i64 44, !9, i64 48, !21, i64 52, !22, i64 56}
!16 = !{!"_ZTSN8nvinfer112IPluginV2ExtE", !17, i64 0}
!17 = !{!"_ZTSN8nvinfer19IPluginV2E"}
!18 = !{!"_ZTSSt10shared_ptrIN8nvinfer16plugin11softmaxTreeEE", !19, i64 0}
!19 = !{!"_ZTSSt12__shared_ptrIN8nvinfer16plugin11softmaxTreeELN9__gnu_cxx12_Lock_policyE2EE", !13, i64 0, !20, i64 8}
!20 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !13, i64 0}
!21 = !{!"bool", !10, i64 0}
!22 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !23, i64 0, !24, i64 8, !10, i64 16}
!23 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !13, i64 0}
!24 = !{!"long", !10, i64 0}
!25 = !{!12, !13, i64 16}
!26 = !{!15, !9, i64 40}
!27 = !{!15, !9, i64 44}
!28 = !{!15, !9, i64 48}


; Effective O3 passes: EarlyCSEPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass