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

; 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 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [122 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [17 x i8], align 1

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN8nvinfer16plugin30MultiscaleDeformableAttnPlugin25supportsFormatCombinationEiPKNS_16PluginTensorDescEii(ptr noundef nonnull align 8 dereferenceable(40) %0, i32 noundef %1, ptr noundef %2, i32 noundef %3, i32 noundef %4) unnamed_addr #1 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
  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
  %12 = load ptr, ptr %7, align 8
  %13 = load i32, ptr %10, align 4, !tbaa !9
  %14 = icmp eq i32 %13, 5
  br i1 %14, label %17, label %15

15:                                               ; preds = %5
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 70)
          to label %16 unwind label %79

16:                                               ; preds = %15
  br label %17

17:                                               ; preds = %16, %5
  %18 = load i32, ptr %11, align 4, !tbaa !9
  %19 = icmp eq i32 %18, 1
  br i1 %19, label %22, label %20

20:                                               ; preds = %17
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 71)
          to label %21 unwind label %79

21:                                               ; preds = %20
  br label %22

22:                                               ; preds = %21, %17
  %23 = load ptr, ptr %9, align 8, !tbaa !5
  %24 = load i32, ptr %8, align 4, !tbaa !9
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %23, i64 %25
  %27 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %26, i32 0, i32 2
  %28 = load i32, ptr %27, align 4, !tbaa !11
  %29 = icmp eq i32 %28, 0
  br i1 %29, label %30, label %76

30:                                               ; preds = %22
  %31 = load i32, ptr %8, align 4, !tbaa !9
  %32 = icmp eq i32 %31, 1
  br i1 %32, label %36, label %33

33:                                               ; preds = %30
  %34 = load i32, ptr %8, align 4, !tbaa !9
  %35 = icmp eq i32 %34, 2
  br i1 %35, label %36, label %44

36:                                               ; preds = %33, %30
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = load i32, ptr %8, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %37, i64 %39
  %41 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %40, i32 0, i32 1
  %42 = load i32, ptr %41, align 8, !tbaa !17
  %43 = icmp eq i32 %42, 3
  store i1 %43, ptr %6, align 1
  br label %77

44:                                               ; preds = %33
  %45 = load ptr, ptr %9, align 8, !tbaa !5
  %46 = load i32, ptr %8, align 4, !tbaa !9
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %45, i64 %47
  %49 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %48, i32 0, i32 1
  %50 = load i32, ptr %49, align 8, !tbaa !17
  %51 = load ptr, ptr %9, align 8, !tbaa !5
  %52 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %51, i64 0
  %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 %50, %54
  br i1 %55, label %56, label %74

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

64:                                               ; preds = %56
  %65 = load ptr, ptr %9, align 8, !tbaa !5
  %66 = load i32, ptr %8, align 4, !tbaa !9
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %65, i64 %67
  %69 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %68, i32 0, i32 1
  %70 = load i32, ptr %69, align 8, !tbaa !17
  %71 = icmp eq i32 %70, 1
  br label %72

72:                                               ; preds = %64, %56
  %73 = phi i1 [ true, %56 ], [ %71, %64 ]
  br label %74

74:                                               ; preds = %72, %44
  %75 = phi i1 [ false, %44 ], [ %73, %72 ]
  store i1 %75, ptr %6, align 1
  br label %77

76:                                               ; preds = %22
  store i1 false, ptr %6, align 1
  br label %77

77:                                               ; preds = %76, %74, %36
  %78 = load i1, ptr %6, align 1
  ret i1 %78

79:                                               ; preds = %20, %15
  %80 = landingpad { ptr, i32 }
          catch ptr null
  %81 = extractvalue { ptr, i32 } %80, 0
  call void @__clang_call_terminate(ptr %81) #3
  unreachable
}

declare void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef, ptr noundef, i32 noundef) #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, !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 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [122 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [17 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 @_ZN8nvinfer16plugin30MultiscaleDeformableAttnPlugin25supportsFormatCombinationEiPKNS_16PluginTensorDescEii(ptr nocapture noundef nonnull readnone align 8 dereferenceable(40) %0, i32 noundef %1, ptr nocapture noundef readonly %2, i32 noundef %3, i32 noundef %4) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %6 = icmp eq i32 %3, 5
  br i1 %6, label %8, label %7

7:                                                ; preds = %5
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 70)
          to label %8 unwind label %28

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

10:                                               ; preds = %8
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 71)
          to label %11 unwind label %28

11:                                               ; preds = %10, %8
  %12 = sext i32 %1 to i64
  %13 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %2, i64 %12
  %14 = getelementptr inbounds i8, ptr %13, i64 76
  %15 = load i32, ptr %14, align 4, !tbaa !5
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %17, label %27

17:                                               ; preds = %11
  %18 = add i32 %1, -1
  %or.cond = icmp ult i32 %18, 2
  %19 = getelementptr inbounds i8, ptr %13, i64 72
  %20 = load i32, ptr %19, align 8, !tbaa !14
  br i1 %or.cond, label %21, label %23

21:                                               ; preds = %17
  %22 = icmp eq i32 %20, 3
  br label %27

23:                                               ; preds = %17
  %24 = getelementptr inbounds i8, ptr %2, i64 72
  %25 = load i32, ptr %24, align 8, !tbaa !14
  %26 = icmp eq i32 %20, %25
  %spec.select = icmp ult i32 %20, 2
  %spec.select18 = and i1 %26, %spec.select
  br label %27

27:                                               ; preds = %23, %11, %21
  %.0 = phi i1 [ %22, %21 ], [ false, %11 ], [ %spec.select18, %23 ]
  ret i1 %.0

28:                                               ; preds = %10, %7
  %29 = landingpad { ptr, i32 }
          catch ptr null
  %30 = extractvalue { ptr, i32 } %29, 0
  tail call void @__clang_call_terminate(ptr %30) #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,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass