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

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

@.str = external hidden unnamed_addr constant [86 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [34 x i8], align 1

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN8nvinfer16plugin6Region15configurePluginEPKNS_6Dims64EiS4_iPKNS_8DataTypeES7_PKbS9_NS_12TensorFormatEi(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, i32 noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7, ptr noundef %8, i32 noundef %9, i32 noundef %10) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  store ptr %0, ptr %12, align 8, !tbaa !5
  store ptr %1, ptr %13, align 8, !tbaa !5
  store i32 %2, ptr %14, align 4, !tbaa !9
  store ptr %3, ptr %15, align 8, !tbaa !5
  store i32 %4, ptr %16, align 4, !tbaa !9
  store ptr %5, ptr %17, align 8, !tbaa !5
  store ptr %6, ptr %18, align 8, !tbaa !5
  store ptr %7, ptr %19, align 8, !tbaa !5
  store ptr %8, ptr %20, align 8, !tbaa !5
  store i32 %9, ptr %21, align 4, !tbaa !11
  store i32 %10, ptr %22, align 4, !tbaa !9
  %23 = load ptr, ptr %12, align 8
  %24 = load ptr, ptr %17, align 8, !tbaa !5
  %25 = load i32, ptr %24, align 4, !tbaa !13
  %26 = icmp eq i32 %25, 0
  br i1 %26, label %27, label %30

27:                                               ; preds = %11
  %28 = load i32, ptr %21, align 4, !tbaa !11
  %29 = icmp eq i32 %28, 0
  br i1 %29, label %32, label %30

30:                                               ; preds = %27, %11
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef @.str.8, ptr noundef @.str, i32 noundef 456)
          to label %31 unwind label %79

31:                                               ; preds = %30
  br label %32

32:                                               ; preds = %31, %27
  %33 = load i32, ptr %14, 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.9, ptr noundef @.str, i32 noundef 457)
          to label %36 unwind label %79

36:                                               ; preds = %35
  br label %37

37:                                               ; preds = %36, %32
  %38 = load i32, ptr %16, align 4, !tbaa !9
  %39 = icmp eq i32 %38, 1
  br i1 %39, label %42, label %40

40:                                               ; preds = %37
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef @.str.10, ptr noundef @.str, i32 noundef 458)
          to label %41 unwind label %79

41:                                               ; preds = %40
  br label %42

42:                                               ; preds = %41, %37
  %43 = load ptr, ptr %13, align 8, !tbaa !5
  %44 = getelementptr inbounds %"class.nvinfer1::Dims64", ptr %43, i64 0
  %45 = getelementptr inbounds %"class.nvinfer1::Dims64", ptr %44, i32 0, i32 1
  %46 = getelementptr inbounds [8 x i64], ptr %45, i64 0, i64 0
  %47 = load i64, ptr %46, align 8, !tbaa !15
  %48 = trunc i64 %47 to i32
  %49 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %23, i32 0, i32 5
  store i32 %48, ptr %49, align 8, !tbaa !17
  %50 = load ptr, ptr %13, align 8, !tbaa !5
  %51 = getelementptr inbounds %"class.nvinfer1::Dims64", ptr %50, i64 0
  %52 = getelementptr inbounds %"class.nvinfer1::Dims64", ptr %51, i32 0, i32 1
  %53 = getelementptr inbounds [8 x i64], ptr %52, i64 0, i64 1
  %54 = load i64, ptr %53, align 8, !tbaa !15
  %55 = trunc i64 %54 to i32
  %56 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %23, i32 0, i32 6
  store i32 %55, ptr %56, align 4, !tbaa !27
  %57 = load ptr, ptr %13, align 8, !tbaa !5
  %58 = getelementptr inbounds %"class.nvinfer1::Dims64", ptr %57, i64 0
  %59 = getelementptr inbounds %"class.nvinfer1::Dims64", ptr %58, i32 0, i32 1
  %60 = getelementptr inbounds [8 x i64], ptr %59, i64 0, i64 2
  %61 = load i64, ptr %60, align 8, !tbaa !15
  %62 = trunc i64 %61 to i32
  %63 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %23, i32 0, i32 7
  store i32 %62, ptr %63, align 8, !tbaa !28
  %64 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %23, i32 0, i32 5
  %65 = load i32, ptr %64, align 8, !tbaa !17
  %66 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %23, i32 0, i32 1
  %67 = load i32, ptr %66, align 8, !tbaa !29
  %68 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %23, i32 0, i32 2
  %69 = load i32, ptr %68, align 4, !tbaa !30
  %70 = add nsw i32 %69, 1
  %71 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %23, i32 0, i32 3
  %72 = load i32, ptr %71, align 8, !tbaa !31
  %73 = add nsw i32 %70, %72
  %74 = mul nsw i32 %67, %73
  %75 = icmp eq i32 %65, %74
  br i1 %75, label %78, label %76

76:                                               ; preds = %42
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef @.str.11, ptr noundef @.str, i32 noundef 467)
          to label %77 unwind label %79

77:                                               ; preds = %76
  br label %78

78:                                               ; preds = %77, %42
  ret void

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

attributes #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 = { 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 = { 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 = !{!"_ZTSN8nvinfer112TensorFormatE", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"_ZTSN8nvinfer18DataTypeE", !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{!18, !10, i64 40}
!18 = !{!"_ZTSN8nvinfer16plugin6RegionE", !19, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !21, i64 24, !10, i64 40, !10, i64 44, !10, i64 48, !24, i64 52, !25, i64 56}
!19 = !{!"_ZTSN8nvinfer112IPluginV2ExtE", !20, i64 0}
!20 = !{!"_ZTSN8nvinfer19IPluginV2E"}
!21 = !{!"_ZTSSt10shared_ptrIN8nvinfer16plugin11softmaxTreeEE", !22, i64 0}
!22 = !{!"_ZTSSt12__shared_ptrIN8nvinfer16plugin11softmaxTreeELN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !23, i64 8}
!23 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0}
!24 = !{!"bool", !7, i64 0}
!25 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !26, i64 0, !16, i64 8, !7, i64 16}
!26 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!27 = !{!18, !10, i64 44}
!28 = !{!18, !10, i64 48}
!29 = !{!18, !10, i64 8}
!30 = !{!18, !10, i64 12}
!31 = !{!18, !10, i64 16}


; 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 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [34 x i8], align 1

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN8nvinfer16plugin6Region15configurePluginEPKNS_6Dims64EiS4_iPKNS_8DataTypeES7_PKbS9_NS_12TensorFormatEi(ptr nocapture noundef nonnull align 8 dereferenceable(88) %0, ptr nocapture noundef readonly %1, i32 noundef %2, ptr nocapture noundef readnone %3, i32 noundef %4, ptr nocapture noundef readonly %5, ptr nocapture noundef readnone %6, ptr nocapture noundef readnone %7, ptr nocapture noundef readnone %8, i32 noundef %9, i32 noundef %10) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %12 = load i32, ptr %5, align 4, !tbaa !5
  %13 = or i32 %12, %9
  %or.cond = icmp eq i32 %13, 0
  br i1 %or.cond, label %15, label %14

14:                                               ; preds = %11
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str, i32 noundef 456)
          to label %15 unwind label %42

15:                                               ; preds = %14, %11
  %16 = icmp eq i32 %2, 1
  br i1 %16, label %18, label %17

17:                                               ; preds = %15
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str, i32 noundef 457)
          to label %18 unwind label %42

18:                                               ; preds = %17, %15
  %19 = icmp eq i32 %4, 1
  br i1 %19, label %21, label %20

20:                                               ; preds = %18
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str, i32 noundef 458)
          to label %21 unwind label %42

21:                                               ; preds = %20, %18
  %22 = getelementptr inbounds i8, ptr %1, i64 8
  %23 = load i64, ptr %22, align 8, !tbaa !9
  %24 = trunc i64 %23 to i32
  %25 = getelementptr inbounds i8, ptr %0, i64 40
  store i32 %24, ptr %25, align 8, !tbaa !11
  %26 = getelementptr inbounds i8, ptr %1, i64 16
  %27 = getelementptr inbounds i8, ptr %0, i64 44
  %28 = load <2 x i64>, ptr %26, align 8, !tbaa !9
  %29 = trunc <2 x i64> %28 to <2 x i32>
  store <2 x i32> %29, ptr %27, align 4, !tbaa !23
  %30 = getelementptr inbounds i8, ptr %0, i64 8
  %31 = load i32, ptr %30, align 8, !tbaa !24
  %32 = getelementptr inbounds i8, ptr %0, i64 12
  %33 = load i32, ptr %32, align 4, !tbaa !25
  %34 = add nsw i32 %33, 1
  %35 = getelementptr inbounds i8, ptr %0, i64 16
  %36 = load i32, ptr %35, align 8, !tbaa !26
  %37 = add nsw i32 %34, %36
  %38 = mul nsw i32 %37, %31
  %39 = icmp eq i32 %38, %24
  br i1 %39, label %41, label %40

40:                                               ; preds = %21
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef nonnull @.str.11, ptr noundef nonnull @.str, i32 noundef 467)
          to label %41 unwind label %42

41:                                               ; preds = %40, %21
  ret void

42:                                               ; preds = %40, %20, %17, %14
  %43 = landingpad { ptr, i32 }
          catch ptr null
  %44 = extractvalue { ptr, i32 } %43, 0
  tail call void @__clang_call_terminate(ptr %44) #3
  unreachable
}

attributes #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 = { 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 = { 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 = !{!"_ZTSN8nvinfer18DataTypeE", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !15, i64 40}
!12 = !{!"_ZTSN8nvinfer16plugin6RegionE", !13, i64 0, !15, i64 8, !15, i64 12, !15, i64 16, !16, i64 24, !15, i64 40, !15, i64 44, !15, i64 48, !20, i64 52, !21, i64 56}
!13 = !{!"_ZTSN8nvinfer112IPluginV2ExtE", !14, i64 0}
!14 = !{!"_ZTSN8nvinfer19IPluginV2E"}
!15 = !{!"int", !7, i64 0}
!16 = !{!"_ZTSSt10shared_ptrIN8nvinfer16plugin11softmaxTreeEE", !17, i64 0}
!17 = !{!"_ZTSSt12__shared_ptrIN8nvinfer16plugin11softmaxTreeELN9__gnu_cxx12_Lock_policyE2EE", !18, i64 0, !19, i64 8}
!18 = !{!"any pointer", !7, i64 0}
!19 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !18, i64 0}
!20 = !{!"bool", !7, i64 0}
!21 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !22, i64 0, !10, i64 8, !7, i64 16}
!22 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !18, i64 0}
!23 = !{!15, !15, i64 0}
!24 = !{!12, !15, i64 8}
!25 = !{!12, !15, i64 12}
!26 = !{!12, !15, i64 16}


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