; 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::PluginTensorDesc" = type { %"class.nvinfer1::Dims64", i32, i32, float }
%"class.nvinfer1::Dims64" = type { i32, [8 x i64] }

@.str.7 = external hidden unnamed_addr constant [96 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [21 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

; 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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN8nvinfer16plugin8ROIAlign25supportsFormatCombinationEiPKNS_16PluginTensorDescEii(ptr noundef nonnull align 8 dereferenceable(88) %0, i32 noundef %1, ptr noundef %2, i32 noundef %3, i32 noundef %4) unnamed_addr #2 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.12, ptr noundef @.str.7, i32 noundef 174)
          to label %18 unwind label %93

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.13, ptr noundef @.str.7, i32 noundef 175)
          to label %26 unwind label %93

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.14, ptr noundef @.str.7, i32 noundef 176)
          to label %31 unwind label %93

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.15, ptr noundef @.str.7, i32 noundef 177)
          to label %36 unwind label %93

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::PluginTensorDesc", ptr %38, i64 %40
  store ptr %41, ptr %12, align 8, !tbaa !5
  %42 = load ptr, ptr %12, align 8, !tbaa !5
  %43 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %42, i32 0, i32 2
  %44 = load i32, ptr %43, align 4, !tbaa !11
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %46, label %47

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

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

50:                                               ; preds = %47
  %51 = load ptr, ptr %9, align 8, !tbaa !5
  %52 = load i32, ptr %8, align 4, !tbaa !9
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %51, i64 %53
  %55 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %54, i32 0, i32 1
  %56 = load i32, ptr %55, align 8, !tbaa !17
  %57 = icmp eq i32 %56, 0
  br i1 %57, label %66, label %58

58:                                               ; preds = %50
  %59 = load ptr, ptr %9, align 8, !tbaa !5
  %60 = load i32, ptr %8, align 4, !tbaa !9
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %59, i64 %61
  %63 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %62, i32 0, i32 1
  %64 = load i32, ptr %63, align 8, !tbaa !17
  %65 = icmp eq i32 %64, 1
  br label %66

66:                                               ; preds = %58, %50
  %67 = phi i1 [ true, %50 ], [ %65, %58 ]
  store i1 %67, ptr %6, align 1
  store i32 1, ptr %13, align 4
  br label %91

68:                                               ; preds = %47
  %69 = load i32, ptr %8, align 4, !tbaa !9
  %70 = icmp eq i32 %69, 2
  br i1 %70, label %71, label %79

71:                                               ; preds = %68
  %72 = load ptr, ptr %9, align 8, !tbaa !5
  %73 = load i32, ptr %8, align 4, !tbaa !9
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %72, i64 %74
  %76 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %75, i32 0, i32 1
  %77 = load i32, ptr %76, align 8, !tbaa !17
  %78 = icmp eq i32 %77, 3
  store i1 %78, ptr %6, align 1
  store i32 1, ptr %13, align 4
  br label %91

79:                                               ; preds = %68
  %80 = load ptr, ptr %9, align 8, !tbaa !5
  %81 = load i32, ptr %8, align 4, !tbaa !9
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %80, i64 %82
  %84 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %83, i32 0, i32 1
  %85 = load i32, ptr %84, align 8, !tbaa !17
  %86 = load ptr, ptr %9, align 8, !tbaa !5
  %87 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %86, i64 0
  %88 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %87, i32 0, i32 1
  %89 = load i32, ptr %88, align 8, !tbaa !17
  %90 = icmp eq i32 %85, %89
  store i1 %90, ptr %6, align 1
  store i32 1, ptr %13, align 4
  br label %91

91:                                               ; preds = %79, %71, %66, %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  %92 = load i1, ptr %6, align 1
  ret i1 %92

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

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

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 = { 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 = { "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}


; 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::PluginTensorDesc" = type { %"class.nvinfer1::Dims64", i32, i32, float }
%"class.nvinfer1::Dims64" = type { i32, [8 x i64] }

@.str.7 = external hidden unnamed_addr constant [96 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [21 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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN8nvinfer16plugin8ROIAlign25supportsFormatCombinationEiPKNS_16PluginTensorDescEii(ptr nocapture noundef nonnull readnone align 8 dereferenceable(88) %0, i32 noundef %1, ptr noundef readonly %2, i32 noundef %3, i32 noundef %4) unnamed_addr #1 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.12, ptr noundef nonnull @.str.7, i32 noundef 174)
          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.13, ptr noundef nonnull @.str.7, i32 noundef 175)
          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.14, ptr noundef nonnull @.str.7, i32 noundef 176)
          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.15, ptr noundef nonnull @.str.7, i32 noundef 177)
          to label %15 unwind label %31

15:                                               ; preds = %14, %12
  %16 = sext i32 %1 to i64
  %17 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %2, i64 %16
  %18 = getelementptr inbounds i8, ptr %17, i64 76
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %.not23 = icmp eq i32 %19, 0
  br i1 %.not23, 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 !14
  %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
}

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

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 = { 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 = { "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}


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