; LLVM IR from hans-ob1/neural_cam_ros :: src/detector (box)

; 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.box = type { float, float, float, float }
%struct.sortable_bbox = type { i32, i32, ptr }

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

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

; Function Attrs: nounwind uwtable
declare dso_local float @box_iou(<2 x float>, <2 x float>, <2 x float>, <2 x float>) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @nms_comparator(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local void @do_nms_obj(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, float noundef %4) #1 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca float, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca %struct.box, align 4
  %16 = alloca %struct.box, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i32 %2, ptr %8, align 4, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !9
  store float %4, ptr %10, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %17 = load i32, ptr %8, align 4, !tbaa !9
  %18 = sext i32 %17 to i64
  %19 = call noalias ptr @calloc(i64 noundef %18, i64 noundef 16) #8
  store ptr %19, ptr %14, align 8, !tbaa !5
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %20

20:                                               ; preds = %43, %5
  %21 = load i32, ptr %11, align 4, !tbaa !9
  %22 = load i32, ptr %8, align 4, !tbaa !9
  %23 = icmp slt i32 %21, %22
  br i1 %23, label %24, label %46

24:                                               ; preds = %20
  %25 = load i32, ptr %11, align 4, !tbaa !9
  %26 = load ptr, ptr %14, align 8, !tbaa !5
  %27 = load i32, ptr %11, align 4, !tbaa !9
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds %struct.sortable_bbox, ptr %26, i64 %28
  %30 = getelementptr inbounds %struct.sortable_bbox, ptr %29, i32 0, i32 0
  store i32 %25, ptr %30, align 8, !tbaa !13
  %31 = load i32, ptr %9, align 4, !tbaa !9
  %32 = load ptr, ptr %14, align 8, !tbaa !5
  %33 = load i32, ptr %11, align 4, !tbaa !9
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds %struct.sortable_bbox, ptr %32, i64 %34
  %36 = getelementptr inbounds %struct.sortable_bbox, ptr %35, i32 0, i32 1
  store i32 %31, ptr %36, align 4, !tbaa !15
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = load ptr, ptr %14, align 8, !tbaa !5
  %39 = load i32, ptr %11, align 4, !tbaa !9
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds %struct.sortable_bbox, ptr %38, i64 %40
  %42 = getelementptr inbounds %struct.sortable_bbox, ptr %41, i32 0, i32 2
  store ptr %37, ptr %42, align 8, !tbaa !16
  br label %43

43:                                               ; preds = %24
  %44 = load i32, ptr %11, align 4, !tbaa !9
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %11, align 4, !tbaa !9
  br label %20, !llvm.loop !17

46:                                               ; preds = %20
  %47 = load ptr, ptr %14, align 8, !tbaa !5
  %48 = load i32, ptr %8, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  call void @qsort(ptr noundef %47, i64 noundef %49, i64 noundef 16, ptr noundef @nms_comparator)
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %50

50:                                               ; preds = %137, %46
  %51 = load i32, ptr %11, align 4, !tbaa !9
  %52 = load i32, ptr %8, align 4, !tbaa !9
  %53 = icmp slt i32 %51, %52
  br i1 %53, label %54, label %140

54:                                               ; preds = %50
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  %56 = load ptr, ptr %14, align 8, !tbaa !5
  %57 = load i32, ptr %11, align 4, !tbaa !9
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds %struct.sortable_bbox, ptr %56, i64 %58
  %60 = getelementptr inbounds %struct.sortable_bbox, ptr %59, i32 0, i32 0
  %61 = load i32, ptr %60, align 8, !tbaa !13
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds ptr, ptr %55, i64 %62
  %64 = load ptr, ptr %63, align 8, !tbaa !5
  %65 = load i32, ptr %9, align 4, !tbaa !9
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds float, ptr %64, i64 %66
  %68 = load float, ptr %67, align 4, !tbaa !11
  %69 = fcmp oeq float %68, 0.000000e+00
  br i1 %69, label %70, label %71

70:                                               ; preds = %54
  br label %137

71:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #7
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = load ptr, ptr %14, align 8, !tbaa !5
  %74 = load i32, ptr %11, align 4, !tbaa !9
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds %struct.sortable_bbox, ptr %73, i64 %75
  %77 = getelementptr inbounds %struct.sortable_bbox, ptr %76, i32 0, i32 0
  %78 = load i32, ptr %77, align 8, !tbaa !13
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds %struct.box, ptr %72, i64 %79
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %80, i64 16, i1 false), !tbaa.struct !19
  %81 = load i32, ptr %11, align 4, !tbaa !9
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %12, align 4, !tbaa !9
  br label %83

83:                                               ; preds = %133, %71
  %84 = load i32, ptr %12, align 4, !tbaa !9
  %85 = load i32, ptr %8, align 4, !tbaa !9
  %86 = icmp slt i32 %84, %85
  br i1 %86, label %87, label %136

87:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 16, ptr %16) #7
  %88 = load ptr, ptr %6, align 8, !tbaa !5
  %89 = load ptr, ptr %14, align 8, !tbaa !5
  %90 = load i32, ptr %12, align 4, !tbaa !9
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds %struct.sortable_bbox, ptr %89, i64 %91
  %93 = getelementptr inbounds %struct.sortable_bbox, ptr %92, i32 0, i32 0
  %94 = load i32, ptr %93, align 8, !tbaa !13
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds %struct.box, ptr %88, i64 %95
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %16, ptr align 4 %96, i64 16, i1 false), !tbaa.struct !19
  %97 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %15, i32 0, i32 0
  %98 = load <2 x float>, ptr %97, align 4
  %99 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %15, i32 0, i32 1
  %100 = load <2 x float>, ptr %99, align 4
  %101 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %16, i32 0, i32 0
  %102 = load <2 x float>, ptr %101, align 4
  %103 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %16, i32 0, i32 1
  %104 = load <2 x float>, ptr %103, align 4
  %105 = call float @box_iou(<2 x float> %98, <2 x float> %100, <2 x float> %102, <2 x float> %104)
  %106 = load float, ptr %10, align 4, !tbaa !11
  %107 = fcmp ogt float %105, %106
  br i1 %107, label %108, label %132

108:                                              ; preds = %87
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %109

109:                                              ; preds = %128, %108
  %110 = load i32, ptr %13, align 4, !tbaa !9
  %111 = load i32, ptr %9, align 4, !tbaa !9
  %112 = add nsw i32 %111, 1
  %113 = icmp slt i32 %110, %112
  br i1 %113, label %114, label %131

114:                                              ; preds = %109
  %115 = load ptr, ptr %7, align 8, !tbaa !5
  %116 = load ptr, ptr %14, align 8, !tbaa !5
  %117 = load i32, ptr %12, align 4, !tbaa !9
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds %struct.sortable_bbox, ptr %116, i64 %118
  %120 = getelementptr inbounds %struct.sortable_bbox, ptr %119, i32 0, i32 0
  %121 = load i32, ptr %120, align 8, !tbaa !13
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds ptr, ptr %115, i64 %122
  %124 = load ptr, ptr %123, align 8, !tbaa !5
  %125 = load i32, ptr %13, align 4, !tbaa !9
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds float, ptr %124, i64 %126
  store float 0.000000e+00, ptr %127, align 4, !tbaa !11
  br label %128

128:                                              ; preds = %114
  %129 = load i32, ptr %13, align 4, !tbaa !9
  %130 = add nsw i32 %129, 1
  store i32 %130, ptr %13, align 4, !tbaa !9
  br label %109, !llvm.loop !20

131:                                              ; preds = %109
  br label %132

132:                                              ; preds = %131, %87
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #7
  br label %133

133:                                              ; preds = %132
  %134 = load i32, ptr %12, align 4, !tbaa !9
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr %12, align 4, !tbaa !9
  br label %83, !llvm.loop !21

136:                                              ; preds = %83
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #7
  br label %137

137:                                              ; preds = %136, %70
  %138 = load i32, ptr %11, align 4, !tbaa !9
  %139 = add nsw i32 %138, 1
  store i32 %139, ptr %11, align 4, !tbaa !9
  br label %50, !llvm.loop !22

140:                                              ; preds = %50
  %141 = load ptr, ptr %14, align 8, !tbaa !5
  call void @free(ptr noundef %141) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  ret void
}

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #4

declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #5

; Function Attrs: nounwind
declare void @free(ptr noundef) #6

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="64" "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 allocsize(0,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 #5 = { "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 #6 = { nounwind "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 #7 = { nounwind }
attributes #8 = { nounwind allocsize(0,1) }

!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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !10, i64 0}
!14 = !{!"", !10, i64 0, !10, i64 4, !6, i64 8}
!15 = !{!14, !10, i64 4}
!16 = !{!14, !6, i64 8}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{i64 0, i64 4, !11, i64 4, i64 4, !11, i64 8, i64 4, !11, i64 12, i64 4, !11}
!20 = distinct !{!20, !18}
!21 = distinct !{!21, !18}
!22 = distinct !{!22, !18}


; 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.sortable_bbox = type { i32, i32, ptr }
%struct.box = type { float, float, float, float }

; Function Attrs: nounwind uwtable
declare dso_local float @box_iou(<2 x float>, <2 x float>, <2 x float>, <2 x float>) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @nms_comparator(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @do_nms_obj(ptr nocapture noundef readonly %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, float noundef %4) local_unnamed_addr #0 {
  %6 = sext i32 %2 to i64
  %7 = tail call noalias ptr @calloc(i64 noundef %6, i64 noundef 16) #6
  %8 = icmp sgt i32 %2, 0
  br i1 %8, label %.lr.ph.preheader, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %5
  tail call void @qsort(ptr noundef %7, i64 noundef %6, i64 noundef 16, ptr noundef nonnull @nms_comparator) #7
  br label %._crit_edge57

.lr.ph.preheader:                                 ; preds = %5
  %wide.trip.count = zext nneg i32 %2 to i64
  %xtraiter = and i64 %wide.trip.count, 3
  %9 = icmp ult i32 %2, 4
  br i1 %9, label %._crit_edge.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483644
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader.new ], [ %indvars.iv.next.3, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.3, %.lr.ph ]
  %10 = getelementptr inbounds %struct.sortable_bbox, ptr %7, i64 %indvars.iv
  %11 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %11, ptr %10, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %10, i64 4
  store i32 %3, ptr %12, align 4, !tbaa !11
  %13 = getelementptr inbounds i8, ptr %10, i64 8
  store ptr %1, ptr %13, align 8, !tbaa !12
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %14 = getelementptr inbounds %struct.sortable_bbox, ptr %7, i64 %indvars.iv.next
  %15 = trunc nuw nsw i64 %indvars.iv.next to i32
  store i32 %15, ptr %14, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %14, i64 4
  store i32 %3, ptr %16, align 4, !tbaa !11
  %17 = getelementptr inbounds i8, ptr %14, i64 8
  store ptr %1, ptr %17, align 8, !tbaa !12
  %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 2
  %18 = getelementptr inbounds %struct.sortable_bbox, ptr %7, i64 %indvars.iv.next.1
  %19 = trunc nuw nsw i64 %indvars.iv.next.1 to i32
  store i32 %19, ptr %18, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %18, i64 4
  store i32 %3, ptr %20, align 4, !tbaa !11
  %21 = getelementptr inbounds i8, ptr %18, i64 8
  store ptr %1, ptr %21, align 8, !tbaa !12
  %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 3
  %22 = getelementptr inbounds %struct.sortable_bbox, ptr %7, i64 %indvars.iv.next.2
  %23 = trunc nuw nsw i64 %indvars.iv.next.2 to i32
  store i32 %23, ptr %22, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %22, i64 4
  store i32 %3, ptr %24, align 4, !tbaa !11
  %25 = getelementptr inbounds i8, ptr %22, i64 8
  store ptr %1, ptr %25, align 8, !tbaa !12
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.unr-lcssa, label %.lr.ph, !llvm.loop !13

._crit_edge.unr-lcssa:                            ; preds = %.lr.ph, %.lr.ph.preheader
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next.3, %.lr.ph ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.unr-lcssa, %.lr.ph.epil
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.lr.ph.epil ], [ %indvars.iv.unr, %._crit_edge.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph.epil ], [ 0, %._crit_edge.unr-lcssa ]
  %26 = getelementptr inbounds %struct.sortable_bbox, ptr %7, i64 %indvars.iv.epil
  %27 = trunc nuw nsw i64 %indvars.iv.epil to i32
  store i32 %27, ptr %26, align 8, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %26, i64 4
  store i32 %3, ptr %28, align 4, !tbaa !11
  %29 = getelementptr inbounds i8, ptr %26, i64 8
  store ptr %1, ptr %29, align 8, !tbaa !12
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.lr.ph.epil, !llvm.loop !15

._crit_edge:                                      ; preds = %.lr.ph.epil, %._crit_edge.unr-lcssa
  tail call void @qsort(ptr noundef nonnull %7, i64 noundef %6, i64 noundef 16, ptr noundef nonnull @nms_comparator) #7
  br i1 %8, label %.lr.ph56, label %._crit_edge57

.lr.ph56:                                         ; preds = %._crit_edge
  %30 = sext i32 %3 to i64
  %.not47 = icmp slt i32 %3, 0
  br i1 %.not47, label %.lr.ph56.split.us.preheader, label %.lr.ph56.split.preheader

.lr.ph56.split.preheader:                         ; preds = %.lr.ph56
  %31 = add nuw i32 %3, 1
  %32 = zext i32 %31 to i64
  %33 = shl nuw nsw i64 %32, 2
  %wide.trip.count74 = zext nneg i32 %2 to i64
  br label %.lr.ph56.split

.lr.ph56.split.us.preheader:                      ; preds = %.lr.ph56
  %wide.trip.count87 = zext nneg i32 %2 to i64
  br label %.lr.ph56.split.us

.lr.ph56.split.us:                                ; preds = %.lr.ph56.split.us.preheader, %.loopexit45.us
  %indvars.iv83 = phi i64 [ 0, %.lr.ph56.split.us.preheader ], [ %indvars.iv.next84.pre-phi, %.loopexit45.us ]
  %indvars.iv76 = phi i64 [ 1, %.lr.ph56.split.us.preheader ], [ %indvars.iv.next77, %.loopexit45.us ]
  %34 = getelementptr inbounds %struct.sortable_bbox, ptr %7, i64 %indvars.iv83
  %35 = load i32, ptr %34, align 8, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds ptr, ptr %1, i64 %36
  %38 = load ptr, ptr %37, align 8, !tbaa !17
  %39 = getelementptr inbounds float, ptr %38, i64 %30
  %40 = load float, ptr %39, align 4, !tbaa !18
  %41 = fcmp oeq float %40, 0.000000e+00
  br i1 %41, label %.lr.ph56.split.us..loopexit45.us_crit_edge, label %42

.lr.ph56.split.us..loopexit45.us_crit_edge:       ; preds = %.lr.ph56.split.us
  %.pre = add nuw nsw i64 %indvars.iv83, 1
  br label %.loopexit45.us

42:                                               ; preds = %.lr.ph56.split.us
  %43 = getelementptr inbounds %struct.box, ptr %0, i64 %36
  %.sroa.01.0.copyload.us = load <2 x float>, ptr %43, align 4
  %.sroa.42.0..sroa_idx.us = getelementptr inbounds i8, ptr %43, i64 8
  %.sroa.42.0.copyload.us = load <2 x float>, ptr %.sroa.42.0..sroa_idx.us, align 4
  %44 = add nuw nsw i64 %indvars.iv83, 1
  %45 = icmp slt i64 %44, %6
  br i1 %45, label %.lr.ph53.us, label %.loopexit45.us

.loopexit45.us:                                   ; preds = %.lr.ph53.us, %.lr.ph56.split.us..loopexit45.us_crit_edge, %42
  %indvars.iv.next84.pre-phi = phi i64 [ %.pre, %.lr.ph56.split.us..loopexit45.us_crit_edge ], [ %44, %42 ], [ %44, %.lr.ph53.us ]
  %indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
  %exitcond88.not = icmp eq i64 %indvars.iv.next84.pre-phi, %wide.trip.count87
  br i1 %exitcond88.not, label %._crit_edge57, label %.lr.ph56.split.us, !llvm.loop !20

.lr.ph53.us:                                      ; preds = %42, %.lr.ph53.us
  %indvars.iv78 = phi i64 [ %indvars.iv.next79, %.lr.ph53.us ], [ %indvars.iv76, %42 ]
  %46 = getelementptr inbounds %struct.sortable_bbox, ptr %7, i64 %indvars.iv78
  %47 = load i32, ptr %46, align 8, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds %struct.box, ptr %0, i64 %48
  %.sroa.0.0.copyload.us.us = load <2 x float>, ptr %49, align 4
  %.sroa.4.0..sroa_idx.us.us = getelementptr inbounds i8, ptr %49, i64 8
  %.sroa.4.0.copyload.us.us = load <2 x float>, ptr %.sroa.4.0..sroa_idx.us.us, align 4
  %50 = tail call float @box_iou(<2 x float> %.sroa.01.0.copyload.us, <2 x float> %.sroa.42.0.copyload.us, <2 x float> %.sroa.0.0.copyload.us.us, <2 x float> %.sroa.4.0.copyload.us.us)
  %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
  %exitcond82.not = icmp eq i64 %indvars.iv.next79, %wide.trip.count87
  br i1 %exitcond82.not, label %.loopexit45.us, label %.lr.ph53.us, !llvm.loop !21

.lr.ph56.split:                                   ; preds = %.lr.ph56.split.preheader, %.loopexit45
  %indvars.iv70 = phi i64 [ 0, %.lr.ph56.split.preheader ], [ %indvars.iv.next71.pre-phi, %.loopexit45 ]
  %indvars.iv63 = phi i64 [ 1, %.lr.ph56.split.preheader ], [ %indvars.iv.next64, %.loopexit45 ]
  %51 = getelementptr inbounds %struct.sortable_bbox, ptr %7, i64 %indvars.iv70
  %52 = load i32, ptr %51, align 8, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds ptr, ptr %1, i64 %53
  %55 = load ptr, ptr %54, align 8, !tbaa !17
  %56 = getelementptr inbounds float, ptr %55, i64 %30
  %57 = load float, ptr %56, align 4, !tbaa !18
  %58 = fcmp oeq float %57, 0.000000e+00
  br i1 %58, label %.lr.ph56.split..loopexit45_crit_edge, label %59

.lr.ph56.split..loopexit45_crit_edge:             ; preds = %.lr.ph56.split
  %.pre89 = add nuw nsw i64 %indvars.iv70, 1
  br label %.loopexit45

59:                                               ; preds = %.lr.ph56.split
  %60 = getelementptr inbounds %struct.box, ptr %0, i64 %53
  %.sroa.01.0.copyload = load <2 x float>, ptr %60, align 4
  %.sroa.42.0..sroa_idx = getelementptr inbounds i8, ptr %60, i64 8
  %.sroa.42.0.copyload = load <2 x float>, ptr %.sroa.42.0..sroa_idx, align 4
  %61 = add nuw nsw i64 %indvars.iv70, 1
  %62 = icmp slt i64 %61, %6
  br i1 %62, label %.lr.ph53, label %.loopexit45

.lr.ph53:                                         ; preds = %59, %..loopexit_crit_edge
  %indvars.iv65 = phi i64 [ %indvars.iv.next66, %..loopexit_crit_edge ], [ %indvars.iv63, %59 ]
  %63 = getelementptr inbounds %struct.sortable_bbox, ptr %7, i64 %indvars.iv65
  %64 = load i32, ptr %63, align 8, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds %struct.box, ptr %0, i64 %65
  %.sroa.0.0.copyload = load <2 x float>, ptr %66, align 4
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %66, i64 8
  %.sroa.4.0.copyload = load <2 x float>, ptr %.sroa.4.0..sroa_idx, align 4
  %67 = tail call float @box_iou(<2 x float> %.sroa.01.0.copyload, <2 x float> %.sroa.42.0.copyload, <2 x float> %.sroa.0.0.copyload, <2 x float> %.sroa.4.0.copyload)
  %68 = fcmp ogt float %67, %4
  br i1 %68, label %.preheader, label %..loopexit_crit_edge

.preheader:                                       ; preds = %.lr.ph53
  %69 = load i32, ptr %63, align 8, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds ptr, ptr %1, i64 %70
  %72 = load ptr, ptr %71, align 8, !tbaa !17
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %72, i8 0, i64 %33, i1 false), !tbaa !18
  br label %..loopexit_crit_edge

..loopexit_crit_edge:                             ; preds = %.preheader, %.lr.ph53
  %indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
  %exitcond69.not = icmp eq i64 %indvars.iv.next66, %wide.trip.count74
  br i1 %exitcond69.not, label %.loopexit45, label %.lr.ph53, !llvm.loop !21

.loopexit45:                                      ; preds = %..loopexit_crit_edge, %.lr.ph56.split..loopexit45_crit_edge, %59
  %indvars.iv.next71.pre-phi = phi i64 [ %.pre89, %.lr.ph56.split..loopexit45_crit_edge ], [ %61, %59 ], [ %61, %..loopexit_crit_edge ]
  %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
  %exitcond75.not = icmp eq i64 %indvars.iv.next71.pre-phi, %wide.trip.count74
  br i1 %exitcond75.not, label %._crit_edge57, label %.lr.ph56.split, !llvm.loop !20

._crit_edge57:                                    ; preds = %.loopexit45, %.loopexit45.us, %._crit_edge.thread, %._crit_edge
  tail call void @free(ptr noundef %7) #7
  ret void
}

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="64" "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 = { 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 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { nofree "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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind allocsize(0,1) }
attributes #7 = { 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, !7, i64 0}
!6 = !{!"", !7, i64 0, !7, i64 4, !10, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 4}
!12 = !{!6, !10, i64 8}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = !{!10, !10, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"float", !8, i64 0}
!20 = distinct !{!20, !14}
!21 = distinct !{!21, !14}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopIdiomRecognizePass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass