; LLVM IR from NVIDIA/TensorRT :: plugin/roiAlignPlugin (roiAlignPluginLegacy)

; 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::DynamicPluginTensorDesc" = type { %"struct.nvinfer1::PluginTensorDesc", %"class.nvinfer1::Dims64", %"class.nvinfer1::Dims64", %"class.nvinfer1::Dims64" }
%"struct.nvinfer1::PluginTensorDesc" = type { %"class.nvinfer1::Dims64", i32, i32, float }
%"class.nvinfer1::Dims64" = type { i32, [8 x i64] }
%"class.nvinfer1::plugin::ROIAlign" = type { %"class.nvinfer1::IPluginV2DynamicExt", i32, i32, i32, float, i32, i32, i32, i32, i32, i32, i32, %"class.std::__cxx11::basic_string" }
%"class.nvinfer1::IPluginV2DynamicExt" = 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] }

@.str.7 = external hidden unnamed_addr constant [96 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [15 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 uwtable
declare dso_local void @_ZN8nvinfer16plugin8ROIAlign16checkValidInputsEPKNS_23DynamicPluginTensorDescEi(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef, i32 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN8nvinfer16plugin8ROIAlign15configurePluginEPKNS_23DynamicPluginTensorDescEiS4_i(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, i32 noundef %4) unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i32 %2, ptr %8, align 4, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !5
  store i32 %4, ptr %10, align 4, !tbaa !9
  %11 = load ptr, ptr %6, align 8
  %12 = load ptr, ptr %7, align 8, !tbaa !5
  %13 = icmp ne ptr %12, null
  br i1 %13, label %16, label %14

14:                                               ; preds = %5
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef @.str.40, ptr noundef @.str.7, i32 noundef 416)
          to label %15 unwind label %71

15:                                               ; preds = %14
  br label %16

16:                                               ; preds = %15, %5
  %17 = load ptr, ptr %9, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %21, label %19

19:                                               ; preds = %16
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef @.str.41, ptr noundef @.str.7, i32 noundef 417)
          to label %20 unwind label %71

20:                                               ; preds = %19
  br label %21

21:                                               ; preds = %20, %16
  %22 = load i32, ptr %10, align 4, !tbaa !9
  %23 = icmp eq i32 %22, 1
  br i1 %23, label %26, label %24

24:                                               ; preds = %21
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef @.str.15, ptr noundef @.str.7, i32 noundef 418)
          to label %25 unwind label %71

25:                                               ; preds = %24
  br label %26

26:                                               ; preds = %25, %21
  %27 = load i32, ptr %8, align 4, !tbaa !9
  %28 = icmp eq i32 %27, 3
  br i1 %28, label %31, label %29

29:                                               ; preds = %26
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef @.str.14, ptr noundef @.str.7, i32 noundef 419)
          to label %30 unwind label %71

30:                                               ; preds = %29
  br label %31

31:                                               ; preds = %30, %26
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = load i32, ptr %8, align 4, !tbaa !9
  invoke void @_ZN8nvinfer16plugin8ROIAlign16checkValidInputsEPKNS_23DynamicPluginTensorDescEi(ptr noundef nonnull align 8 dereferenceable(88) %11, ptr noundef %32, i32 noundef %33)
          to label %34 unwind label %71

34:                                               ; preds = %31
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = getelementptr inbounds %"struct.nvinfer1::DynamicPluginTensorDesc", ptr %35, i64 0
  %37 = getelementptr inbounds %"struct.nvinfer1::DynamicPluginTensorDesc", ptr %36, i32 0, i32 0
  %38 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %37, i32 0, i32 0
  %39 = getelementptr inbounds %"class.nvinfer1::Dims64", ptr %38, i32 0, i32 1
  %40 = getelementptr inbounds [8 x i64], ptr %39, i64 0, i64 1
  %41 = load i64, ptr %40, align 8, !tbaa !11
  %42 = trunc i64 %41 to i32
  %43 = getelementptr inbounds %"class.nvinfer1::plugin::ROIAlign", ptr %11, i32 0, i32 8
  store i32 %42, ptr %43, align 4, !tbaa !13
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  %45 = getelementptr inbounds %"struct.nvinfer1::DynamicPluginTensorDesc", ptr %44, i64 0
  %46 = getelementptr inbounds %"struct.nvinfer1::DynamicPluginTensorDesc", ptr %45, i32 0, i32 0
  %47 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %46, i32 0, i32 0
  %48 = getelementptr inbounds %"class.nvinfer1::Dims64", ptr %47, i32 0, i32 1
  %49 = getelementptr inbounds [8 x i64], ptr %48, i64 0, i64 2
  %50 = load i64, ptr %49, align 8, !tbaa !11
  %51 = trunc i64 %50 to i32
  %52 = getelementptr inbounds %"class.nvinfer1::plugin::ROIAlign", ptr %11, i32 0, i32 9
  store i32 %51, ptr %52, align 8, !tbaa !21
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = getelementptr inbounds %"struct.nvinfer1::DynamicPluginTensorDesc", ptr %53, i64 0
  %55 = getelementptr inbounds %"struct.nvinfer1::DynamicPluginTensorDesc", ptr %54, i32 0, i32 0
  %56 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %55, i32 0, i32 0
  %57 = getelementptr inbounds %"class.nvinfer1::Dims64", ptr %56, i32 0, i32 1
  %58 = getelementptr inbounds [8 x i64], ptr %57, i64 0, i64 3
  %59 = load i64, ptr %58, align 8, !tbaa !11
  %60 = trunc i64 %59 to i32
  %61 = getelementptr inbounds %"class.nvinfer1::plugin::ROIAlign", ptr %11, i32 0, i32 10
  store i32 %60, ptr %61, align 4, !tbaa !22
  %62 = load ptr, ptr %7, align 8, !tbaa !5
  %63 = getelementptr inbounds %"struct.nvinfer1::DynamicPluginTensorDesc", ptr %62, i64 1
  %64 = getelementptr inbounds %"struct.nvinfer1::DynamicPluginTensorDesc", ptr %63, i32 0, i32 0
  %65 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %64, i32 0, i32 0
  %66 = getelementptr inbounds %"class.nvinfer1::Dims64", ptr %65, i32 0, i32 1
  %67 = getelementptr inbounds [8 x i64], ptr %66, i64 0, i64 0
  %68 = load i64, ptr %67, align 8, !tbaa !11
  %69 = trunc i64 %68 to i32
  %70 = getelementptr inbounds %"class.nvinfer1::plugin::ROIAlign", ptr %11, i32 0, i32 7
  store i32 %69, ptr %70, align 8, !tbaa !23
  ret void

71:                                               ; preds = %31, %29, %24, %19, %14
  %72 = landingpad { ptr, i32 }
          catch ptr null
  %73 = extractvalue { ptr, i32 } %72, 0
  call void @__clang_call_terminate(ptr %73) #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 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 = { 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 #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 = !{!"long", !7, i64 0}
!13 = !{!14, !10, i64 36}
!14 = !{!"_ZTSN8nvinfer16plugin8ROIAlignE", !15, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !18, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !19, i64 56}
!15 = !{!"_ZTSN8nvinfer119IPluginV2DynamicExtE", !16, i64 0}
!16 = !{!"_ZTSN8nvinfer112IPluginV2ExtE", !17, i64 0}
!17 = !{!"_ZTSN8nvinfer19IPluginV2E"}
!18 = !{!"float", !7, i64 0}
!19 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !20, i64 0, !12, i64 8, !7, i64 16}
!20 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!21 = !{!14, !10, i64 40}
!22 = !{!14, !10, i64 44}
!23 = !{!14, !10, i64 32}


; 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.7 = external hidden unnamed_addr constant [96 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [15 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 uwtable
declare dso_local void @_ZN8nvinfer16plugin8ROIAlign16checkValidInputsEPKNS_23DynamicPluginTensorDescEi(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef, i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN8nvinfer16plugin8ROIAlign15configurePluginEPKNS_23DynamicPluginTensorDescEiS4_i(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr noundef %1, i32 noundef %2, ptr noundef readnone %3, i32 noundef %4) unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %6, label %7

6:                                                ; preds = %5
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef nonnull @.str.40, ptr noundef nonnull @.str.7, i32 noundef 416)
          to label %7 unwind label %29

7:                                                ; preds = %6, %5
  %.not10 = icmp eq ptr %3, null
  br i1 %.not10, label %8, label %9

8:                                                ; preds = %7
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef nonnull @.str.41, ptr noundef nonnull @.str.7, i32 noundef 417)
          to label %9 unwind label %29

9:                                                ; preds = %8, %7
  %10 = icmp eq i32 %4, 1
  br i1 %10, label %12, label %11

11:                                               ; preds = %9
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef nonnull @.str.15, ptr noundef nonnull @.str.7, i32 noundef 418)
          to label %12 unwind label %29

12:                                               ; preds = %11, %9
  %13 = icmp eq i32 %2, 3
  br i1 %13, label %15, label %14

14:                                               ; preds = %12
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.7, i32 noundef 419)
          to label %15 unwind label %29

15:                                               ; preds = %14, %12
  invoke void @_ZN8nvinfer16plugin8ROIAlign16checkValidInputsEPKNS_23DynamicPluginTensorDescEi(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr noundef %1, i32 noundef %2)
          to label %16 unwind label %29

16:                                               ; preds = %15
  %17 = getelementptr inbounds i8, ptr %1, i64 16
  %18 = getelementptr inbounds i8, ptr %0, i64 36
  %19 = load <2 x i64>, ptr %17, align 8, !tbaa !5
  %20 = trunc <2 x i64> %19 to <2 x i32>
  store <2 x i32> %20, ptr %18, align 4, !tbaa !9
  %21 = getelementptr inbounds i8, ptr %1, i64 32
  %22 = load i64, ptr %21, align 8, !tbaa !5
  %23 = trunc i64 %22 to i32
  %24 = getelementptr inbounds i8, ptr %0, i64 44
  store i32 %23, ptr %24, align 4, !tbaa !11
  %25 = getelementptr inbounds i8, ptr %1, i64 312
  %26 = load i64, ptr %25, align 8, !tbaa !5
  %27 = trunc i64 %26 to i32
  %28 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 %27, ptr %28, align 8, !tbaa !20
  ret void

29:                                               ; preds = %15, %14, %11, %8, %6
  %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 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 = { 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 #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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 44}
!12 = !{!"_ZTSN8nvinfer16plugin8ROIAlignE", !13, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !16, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !17, i64 56}
!13 = !{!"_ZTSN8nvinfer119IPluginV2DynamicExtE", !14, i64 0}
!14 = !{!"_ZTSN8nvinfer112IPluginV2ExtE", !15, i64 0}
!15 = !{!"_ZTSN8nvinfer19IPluginV2E"}
!16 = !{!"float", !7, i64 0}
!17 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !18, i64 0, !6, i64 8, !7, i64 16}
!18 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !19, i64 0}
!19 = !{!"any pointer", !7, i64 0}
!20 = !{!12, !10, i64 32}


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