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

; 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::plugin::NMSParameters" = type { i8, i32, i32, i32, i32, float, float, i8 }

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN8nvinfer16plugin5writeINS0_13NMSParametersEcEEvRPT0_RKT_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 4 dereferenceable(32) %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %6 = load ptr, ptr %3, align 8, !tbaa !5
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %7, ptr %5, align 8, !tbaa !5
  %8 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 4 %8, i8 0, i64 32, i1 false)
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds %"struct.nvinfer1::plugin::NMSParameters", ptr %9, i32 0, i32 0
  %11 = load i8, ptr %10, align 4, !tbaa !9, !range !14, !noundef !15
  %12 = trunc i8 %11 to i1
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = getelementptr inbounds %"struct.nvinfer1::plugin::NMSParameters", ptr %13, i32 0, i32 0
  %15 = zext i1 %12 to i8
  store i8 %15, ptr %14, align 4, !tbaa !9
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %"struct.nvinfer1::plugin::NMSParameters", ptr %16, i32 0, i32 1
  %18 = load i32, ptr %17, align 4, !tbaa !16
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %"struct.nvinfer1::plugin::NMSParameters", ptr %19, i32 0, i32 1
  store i32 %18, ptr %20, align 4, !tbaa !16
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %"struct.nvinfer1::plugin::NMSParameters", ptr %21, i32 0, i32 2
  %23 = load i32, ptr %22, align 4, !tbaa !17
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds %"struct.nvinfer1::plugin::NMSParameters", ptr %24, i32 0, i32 2
  store i32 %23, ptr %25, align 4, !tbaa !17
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %"struct.nvinfer1::plugin::NMSParameters", ptr %26, i32 0, i32 3
  %28 = load i32, ptr %27, align 4, !tbaa !18
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = getelementptr inbounds %"struct.nvinfer1::plugin::NMSParameters", ptr %29, i32 0, i32 3
  store i32 %28, ptr %30, align 4, !tbaa !18
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds %"struct.nvinfer1::plugin::NMSParameters", ptr %31, i32 0, i32 4
  %33 = load i32, ptr %32, align 4, !tbaa !19
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = getelementptr inbounds %"struct.nvinfer1::plugin::NMSParameters", ptr %34, i32 0, i32 4
  store i32 %33, ptr %35, align 4, !tbaa !19
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds %"struct.nvinfer1::plugin::NMSParameters", ptr %36, i32 0, i32 5
  %38 = load float, ptr %37, align 4, !tbaa !20
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = getelementptr inbounds %"struct.nvinfer1::plugin::NMSParameters", ptr %39, i32 0, i32 5
  store float %38, ptr %40, align 4, !tbaa !20
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds %"struct.nvinfer1::plugin::NMSParameters", ptr %41, i32 0, i32 6
  %43 = load float, ptr %42, align 4, !tbaa !21
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds %"struct.nvinfer1::plugin::NMSParameters", ptr %44, i32 0, i32 6
  store float %43, ptr %45, align 4, !tbaa !21
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %"struct.nvinfer1::plugin::NMSParameters", ptr %46, i32 0, i32 7
  %48 = load i8, ptr %47, align 4, !tbaa !22, !range !14, !noundef !15
  %49 = trunc i8 %48 to i1
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %"struct.nvinfer1::plugin::NMSParameters", ptr %50, i32 0, i32 7
  %52 = zext i1 %49 to i8
  store i8 %52, ptr %51, align 4, !tbaa !22
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = load ptr, ptr %53, align 8, !tbaa !5
  %55 = getelementptr inbounds i8, ptr %54, i64 32
  store ptr %55, ptr %53, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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, !11, i64 0}
!10 = !{!"_ZTSN8nvinfer16plugin13NMSParametersE", !11, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !13, i64 20, !13, i64 24, !11, i64 28}
!11 = !{!"bool", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!"float", !7, i64 0}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = !{!10, !12, i64 4}
!17 = !{!10, !12, i64 8}
!18 = !{!10, !12, i64 12}
!19 = !{!10, !12, i64 16}
!20 = !{!10, !13, i64 20}
!21 = !{!10, !13, i64 24}
!22 = !{!10, !11, i64 28}


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

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @_ZN8nvinfer16plugin5writeINS0_13NMSParametersEcEEvRPT0_RKT_(ptr nocapture noundef nonnull align 8 dereferenceable(8) %0, ptr nocapture noundef nonnull readonly align 4 dereferenceable(32) %1) local_unnamed_addr #0 {
  %3 = load ptr, ptr %0, align 8, !tbaa !5
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(32) %3, i8 0, i64 32, i1 false)
  %4 = load i8, ptr %1, align 4, !tbaa !9, !range !14, !noundef !15
  store i8 %4, ptr %3, align 4, !tbaa !9
  %5 = getelementptr inbounds i8, ptr %1, i64 4
  %6 = getelementptr inbounds i8, ptr %3, i64 4
  %7 = load <4 x i32>, ptr %5, align 4, !tbaa !16
  store <4 x i32> %7, ptr %6, align 4, !tbaa !16
  %8 = getelementptr inbounds i8, ptr %1, i64 20
  %9 = getelementptr inbounds i8, ptr %3, i64 20
  %10 = load <2 x float>, ptr %8, align 4, !tbaa !17
  store <2 x float> %10, ptr %9, align 4, !tbaa !17
  %11 = getelementptr inbounds i8, ptr %1, i64 28
  %12 = load i8, ptr %11, align 4, !tbaa !18, !range !14, !noundef !15
  %13 = getelementptr inbounds i8, ptr %3, i64 28
  store i8 %12, ptr %13, align 4, !tbaa !18
  %14 = load ptr, ptr %0, align 8, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %14, i64 32
  store ptr %15, ptr %0, align 8, !tbaa !5
  ret void
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: readwrite, inaccessiblemem: none) 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 #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }

!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, !11, i64 0}
!10 = !{!"_ZTSN8nvinfer16plugin13NMSParametersE", !11, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !13, i64 20, !13, i64 24, !11, i64 28}
!11 = !{!"bool", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!"float", !7, i64 0}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = !{!12, !12, i64 0}
!17 = !{!13, !13, i64 0}
!18 = !{!10, !11, i64 28}


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