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

; 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] }

@.str.7 = external hidden unnamed_addr constant [90 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [15 x i8], align 1

; 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: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) #1

declare void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef, ptr noundef, i32 noundef) #2

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

17:                                               ; preds = %5
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef @.str.18, ptr noundef @.str.7, i32 noundef 225)
          to label %18 unwind label %83

18:                                               ; preds = %17
  br label %19

19:                                               ; preds = %18, %5
  %20 = load i32, ptr %8, align 4, !tbaa !9
  %21 = icmp sge i32 %20, 0
  br i1 %21, label %22, label %25

22:                                               ; preds = %19
  %23 = load i32, ptr %8, align 4, !tbaa !9
  %24 = icmp sle i32 %23, 3
  br i1 %24, label %27, label %25

25:                                               ; preds = %22, %19
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef @.str.19, ptr noundef @.str.7, i32 noundef 226)
          to label %26 unwind label %83

26:                                               ; preds = %25
  br label %27

27:                                               ; preds = %26, %22
  %28 = load i32, ptr %10, align 4, !tbaa !9
  %29 = icmp eq i32 %28, 3
  br i1 %29, label %32, label %30

30:                                               ; preds = %27
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef @.str.20, ptr noundef @.str.7, i32 noundef 227)
          to label %31 unwind label %83

31:                                               ; preds = %30
  br label %32

32:                                               ; preds = %31, %27
  %33 = load i32, ptr %11, align 4, !tbaa !9
  %34 = icmp eq i32 %33, 1
  br i1 %34, label %37, label %35

35:                                               ; preds = %32
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef @.str.21, ptr noundef @.str.7, i32 noundef 228)
          to label %36 unwind label %83

36:                                               ; preds = %35
  br label %37

37:                                               ; preds = %36, %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %38 = load ptr, ptr %9, align 8, !tbaa !5
  %39 = load i32, ptr %8, align 4, !tbaa !9
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds %"struct.nvinfer1::DynamicPluginTensorDesc", ptr %38, i64 %40
  %42 = getelementptr inbounds %"struct.nvinfer1::DynamicPluginTensorDesc", ptr %41, i32 0, i32 0
  store ptr %42, ptr %12, align 8, !tbaa !5
  %43 = load ptr, ptr %12, align 8, !tbaa !5
  %44 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %43, i32 0, i32 2
  %45 = load i32, ptr %44, align 4, !tbaa !11
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %47, label %48

47:                                               ; preds = %37
  store i1 false, ptr %6, align 1
  store i32 1, ptr %13, align 4
  br label %81

48:                                               ; preds = %37
  %49 = load i32, ptr %8, align 4, !tbaa !9
  %50 = icmp eq i32 %49, 0
  br i1 %50, label %51, label %63

51:                                               ; preds = %48
  %52 = load ptr, ptr %12, align 8, !tbaa !5
  %53 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %52, i32 0, i32 1
  %54 = load i32, ptr %53, align 8, !tbaa !17
  %55 = icmp eq i32 %54, 0
  br i1 %55, label %61, label %56

56:                                               ; preds = %51
  %57 = load ptr, ptr %12, align 8, !tbaa !5
  %58 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %57, i32 0, i32 1
  %59 = load i32, ptr %58, align 8, !tbaa !17
  %60 = icmp eq i32 %59, 1
  br label %61

61:                                               ; preds = %56, %51
  %62 = phi i1 [ true, %51 ], [ %60, %56 ]
  store i1 %62, ptr %6, align 1
  store i32 1, ptr %13, align 4
  br label %81

63:                                               ; preds = %48
  %64 = load i32, ptr %8, align 4, !tbaa !9
  %65 = icmp eq i32 %64, 2
  br i1 %65, label %66, label %71

66:                                               ; preds = %63
  %67 = load ptr, ptr %12, align 8, !tbaa !5
  %68 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %67, i32 0, i32 1
  %69 = load i32, ptr %68, align 8, !tbaa !17
  %70 = icmp eq i32 %69, 3
  store i1 %70, ptr %6, align 1
  store i32 1, ptr %13, align 4
  br label %81

71:                                               ; preds = %63
  %72 = load ptr, ptr %12, align 8, !tbaa !5
  %73 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %72, i32 0, i32 1
  %74 = load i32, ptr %73, align 8, !tbaa !17
  %75 = load ptr, ptr %9, align 8, !tbaa !5
  %76 = getelementptr inbounds %"struct.nvinfer1::DynamicPluginTensorDesc", ptr %75, i64 0
  %77 = getelementptr inbounds %"struct.nvinfer1::DynamicPluginTensorDesc", ptr %76, i32 0, i32 0
  %78 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %77, i32 0, i32 1
  %79 = load i32, ptr %78, align 8, !tbaa !18
  %80 = icmp eq i32 %74, %79
  store i1 %80, ptr %6, align 1
  store i32 1, ptr %13, align 4
  br label %81

81:                                               ; preds = %71, %66, %61, %47
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  %82 = load i1, ptr %6, align 1
  ret i1 %82

83:                                               ; preds = %35, %30, %25, %17
  %84 = landingpad { ptr, i32 }
          catch ptr null
  %85 = extractvalue { ptr, i32 } %84, 0
  call void @__clang_call_terminate(ptr %85) #5
  unreachable
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { nounwind }
attributes #5 = { 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, !15, i64 76}
!12 = !{!"_ZTSN8nvinfer116PluginTensorDescE", !13, i64 0, !14, i64 72, !15, i64 76, !16, i64 80}
!13 = !{!"_ZTSN8nvinfer16Dims64E", !10, i64 0, !7, i64 8}
!14 = !{!"_ZTSN8nvinfer18DataTypeE", !7, i64 0}
!15 = !{!"_ZTSN8nvinfer112TensorFormatE", !7, i64 0}
!16 = !{!"float", !7, i64 0}
!17 = !{!12, !14, i64 72}
!18 = !{!19, !14, i64 72}
!19 = !{!"_ZTSN8nvinfer123DynamicPluginTensorDescE", !12, i64 0, !13, i64 88, !13, i64 160, !13, i64 232}


; 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::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] }

@.str.7 = external hidden unnamed_addr constant [90 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.21 = 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 nounwind uwtable
define dso_local noundef zeroext i1 @_ZN8nvinfer16plugin10ROIAlignV325supportsFormatCombinationEiPKNS_23DynamicPluginTensorDescEii(ptr nocapture noundef nonnull readnone align 8 dereferenceable(152) %0, i32 noundef %1, ptr noundef readonly %2, i32 noundef %3, i32 noundef %4) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %.not = icmp eq ptr %2, null
  br i1 %.not, label %6, label %7

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

7:                                                ; preds = %6, %5
  %or.cond = icmp ult i32 %1, 4
  br i1 %or.cond, label %9, label %8

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

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

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

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

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

15:                                               ; preds = %14, %12
  %16 = sext i32 %1 to i64
  %17 = getelementptr inbounds %"struct.nvinfer1::DynamicPluginTensorDesc", ptr %2, i64 %16
  %18 = getelementptr inbounds i8, ptr %17, i64 76
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %.not19 = icmp eq i32 %19, 0
  br i1 %.not19, label %20, label %30

20:                                               ; preds = %15
  %21 = getelementptr inbounds i8, ptr %17, i64 72
  %22 = load i32, ptr %21, align 8, !tbaa !14
  switch i32 %1, label %26 [
    i32 0, label %23
    i32 2, label %24
  ]

23:                                               ; preds = %20
  %spec.select = icmp ult i32 %22, 2
  br label %30

24:                                               ; preds = %20
  %25 = icmp eq i32 %22, 3
  br label %30

26:                                               ; preds = %20
  %27 = getelementptr inbounds i8, ptr %2, i64 72
  %28 = load i32, ptr %27, align 8, !tbaa !15
  %29 = icmp eq i32 %22, %28
  br label %30

30:                                               ; preds = %15, %26, %24, %23
  %.0 = phi i1 [ %spec.select, %23 ], [ %25, %24 ], [ %29, %26 ], [ false, %15 ]
  ret i1 %.0

31:                                               ; preds = %14, %11, %8, %6
  %32 = landingpad { ptr, i32 }
          catch ptr null
  %33 = extractvalue { ptr, i32 } %32, 0
  tail call void @__clang_call_terminate(ptr %33) #3
  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 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 #3 = { 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, !12, i64 76}
!6 = !{!"_ZTSN8nvinfer116PluginTensorDescE", !7, i64 0, !11, i64 72, !12, i64 76, !13, i64 80}
!7 = !{!"_ZTSN8nvinfer16Dims64E", !8, i64 0, !9, i64 8}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"_ZTSN8nvinfer18DataTypeE", !9, i64 0}
!12 = !{!"_ZTSN8nvinfer112TensorFormatE", !9, i64 0}
!13 = !{!"float", !9, i64 0}
!14 = !{!6, !11, i64 72}
!15 = !{!16, !11, i64 72}
!16 = !{!"_ZTSN8nvinfer123DynamicPluginTensorDescE", !6, i64 0, !7, i64 88, !7, i64 160, !7, i64 232}


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