; LLVM IR from Overload-Technologies/Overload :: Dependencies/assimp/code/Common (SpatialSort)

; 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.aiVector3t = type { float, float, float }
%"class.Assimp::SpatialSort" = type <{ %class.aiVector3t, %class.aiVector3t, %"class.std::vector", i8, [7 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<Assimp::SpatialSort::Entry, std::allocator<Assimp::SpatialSort::Entry>>::_Vector_impl" }
%"struct.std::_Vector_base<Assimp::SpatialSort::Entry, std::allocator<Assimp::SpatialSort::Entry>>::_Vector_impl" = type { %"struct.std::_Vector_base<Assimp::SpatialSort::Entry, std::allocator<Assimp::SpatialSort::Entry>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Assimp::SpatialSort::Entry, std::allocator<Assimp::SpatialSort::Entry>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.Assimp::SpatialSort::Entry" = type { i32, %class.aiVector3t, float }

@.str.1 = external hidden unnamed_addr constant [112 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [100 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [28 x i8], align 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) #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZmlIfET_RK10aiVector3tIS0_ES4_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #1

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { <2 x float>, float } @_ZmiIfE10aiVector3tIT_ERKS2_S4_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #3

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIN6Assimp11SpatialSort5EntryESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

declare void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef, ptr noundef, i32 noundef) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(20) ptr @_ZNKSt6vectorIN6Assimp11SpatialSort5EntryESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK10aiVector3tIfE12SquareLengthEv(ptr noundef nonnull align 4 dereferenceable(12)) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK6Assimp11SpatialSort20GenerateMappingTableERSt6vectorIjSaIjEEf(ptr noundef nonnull align 8 dereferenceable(49) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, float noundef %2) #6 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca float, align 4
  %7 = alloca i32, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca i32, align 4
  %11 = alloca float, align 4
  %12 = alloca i64, align 8
  %13 = alloca %class.aiVector3t, align 4
  %14 = alloca { <2 x float>, float }, align 8
  %15 = alloca ptr, align 8
  %16 = alloca %class.aiVector3t, align 4
  %17 = alloca { <2 x float>, float }, align 8
  %18 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store float %2, ptr %6, align 4, !tbaa !9
  %19 = load ptr, ptr %4, align 8
  %20 = getelementptr inbounds %"class.Assimp::SpatialSort", ptr %19, i32 0, i32 3
  %21 = load i8, ptr %20, align 8, !tbaa !11, !range !19, !noundef !20
  %22 = trunc i8 %21 to i1
  br i1 %22, label %24, label %23

23:                                               ; preds = %3
  call void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 311)
  br label %24

24:                                               ; preds = %23, %3
  %25 = phi i1 [ true, %3 ], [ false, %23 ]
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds %"class.Assimp::SpatialSort", ptr %19, i32 0, i32 2
  %28 = call noundef i64 @_ZNKSt6vectorIN6Assimp11SpatialSort5EntryESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %27) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  store i32 -1, ptr %7, align 4, !tbaa !21
  call void @_ZNSt6vectorIjSaIjEE6resizeEmRKj(ptr noundef nonnull align 8 dereferenceable(24) %26, i64 noundef %28, ptr noundef nonnull align 4 dereferenceable(4) %7)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  store i32 0, ptr %10, align 4, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  %29 = load float, ptr %6, align 4, !tbaa !9
  %30 = load float, ptr %6, align 4, !tbaa !9
  %31 = fmul float %29, %30
  store float %31, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  store i64 0, ptr %12, align 8, !tbaa !23
  br label %32

32:                                               ; preds = %103, %24
  %33 = load i64, ptr %12, align 8, !tbaa !23
  %34 = getelementptr inbounds %"class.Assimp::SpatialSort", ptr %19, i32 0, i32 2
  %35 = call noundef i64 @_ZNKSt6vectorIN6Assimp11SpatialSort5EntryESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %34) #8
  %36 = icmp ult i64 %33, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %32
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  br label %106

38:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 12, ptr %13) #8
  %39 = getelementptr inbounds %"class.Assimp::SpatialSort", ptr %19, i32 0, i32 2
  %40 = load i64, ptr %12, align 8, !tbaa !23
  %41 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNKSt6vectorIN6Assimp11SpatialSort5EntryESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %39, i64 noundef %40) #8
  %42 = getelementptr inbounds %"struct.Assimp::SpatialSort::Entry", ptr %41, i32 0, i32 1
  %43 = getelementptr inbounds %"class.Assimp::SpatialSort", ptr %19, i32 0, i32 1
  %44 = call { <2 x float>, float } @_ZmiIfE10aiVector3tIT_ERKS2_S4_(ptr noundef nonnull align 4 dereferenceable(12) %42, ptr noundef nonnull align 4 dereferenceable(12) %43)
  store { <2 x float>, float } %44, ptr %14, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 8 %14, i64 12, i1 false)
  %45 = getelementptr inbounds %"class.Assimp::SpatialSort", ptr %19, i32 0, i32 0
  %46 = call noundef float @_ZmlIfET_RK10aiVector3tIS0_ES4_(ptr noundef nonnull align 4 dereferenceable(12) %13, ptr noundef nonnull align 4 dereferenceable(12) %45)
  store float %46, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 12, ptr %13) #8
  %47 = load float, ptr %8, align 4, !tbaa !9
  %48 = load float, ptr %6, align 4, !tbaa !9
  %49 = fadd float %47, %48
  store float %49, ptr %9, align 4, !tbaa !9
  %50 = load i32, ptr %10, align 4, !tbaa !21
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = getelementptr inbounds %"class.Assimp::SpatialSort", ptr %19, i32 0, i32 2
  %53 = load i64, ptr %12, align 8, !tbaa !23
  %54 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNKSt6vectorIN6Assimp11SpatialSort5EntryESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %52, i64 noundef %53) #8
  %55 = getelementptr inbounds %"struct.Assimp::SpatialSort::Entry", ptr %54, i32 0, i32 0
  %56 = load i32, ptr %55, align 4, !tbaa !25
  %57 = zext i32 %56 to i64
  %58 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %51, i64 noundef %57) #8
  store i32 %50, ptr %58, align 4, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  %59 = getelementptr inbounds %"class.Assimp::SpatialSort", ptr %19, i32 0, i32 2
  %60 = load i64, ptr %12, align 8, !tbaa !23
  %61 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNKSt6vectorIN6Assimp11SpatialSort5EntryESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %59, i64 noundef %60) #8
  %62 = getelementptr inbounds %"struct.Assimp::SpatialSort::Entry", ptr %61, i32 0, i32 1
  store ptr %62, ptr %15, align 8, !tbaa !5
  %63 = load i64, ptr %12, align 8, !tbaa !23
  %64 = add i64 %63, 1
  store i64 %64, ptr %12, align 8, !tbaa !23
  br label %65

65:                                               ; preds = %100, %38
  %66 = load i64, ptr %12, align 8, !tbaa !23
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %67) #8
  %69 = icmp ult i64 %66, %68
  call void @llvm.lifetime.start.p0(i64 12, ptr %16) #8
  br i1 %69, label %70, label %88

70:                                               ; preds = %65
  %71 = getelementptr inbounds %"class.Assimp::SpatialSort", ptr %19, i32 0, i32 2
  %72 = load i64, ptr %12, align 8, !tbaa !23
  %73 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNKSt6vectorIN6Assimp11SpatialSort5EntryESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %71, i64 noundef %72) #8
  %74 = getelementptr inbounds %"struct.Assimp::SpatialSort::Entry", ptr %73, i32 0, i32 2
  %75 = load float, ptr %74, align 4, !tbaa !27
  %76 = load float, ptr %9, align 4, !tbaa !9
  %77 = fcmp olt float %75, %76
  br i1 %77, label %78, label %88

78:                                               ; preds = %70
  %79 = getelementptr inbounds %"class.Assimp::SpatialSort", ptr %19, i32 0, i32 2
  %80 = load i64, ptr %12, align 8, !tbaa !23
  %81 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNKSt6vectorIN6Assimp11SpatialSort5EntryESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %79, i64 noundef %80) #8
  %82 = getelementptr inbounds %"struct.Assimp::SpatialSort::Entry", ptr %81, i32 0, i32 1
  %83 = load ptr, ptr %15, align 8, !tbaa !5
  %84 = call { <2 x float>, float } @_ZmiIfE10aiVector3tIT_ERKS2_S4_(ptr noundef nonnull align 4 dereferenceable(12) %82, ptr noundef nonnull align 4 dereferenceable(12) %83)
  store { <2 x float>, float } %84, ptr %17, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %16, ptr align 8 %17, i64 12, i1 false)
  %85 = call noundef float @_ZNK10aiVector3tIfE12SquareLengthEv(ptr noundef nonnull align 4 dereferenceable(12) %16)
  %86 = load float, ptr %11, align 4, !tbaa !9
  %87 = fcmp olt float %85, %86
  br label %88

88:                                               ; preds = %78, %70, %65
  %89 = phi i1 [ false, %70 ], [ false, %65 ], [ %87, %78 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr %16) #8
  br i1 %89, label %90, label %103

90:                                               ; preds = %88
  %91 = load i32, ptr %10, align 4, !tbaa !21
  %92 = load ptr, ptr %5, align 8, !tbaa !5
  %93 = getelementptr inbounds %"class.Assimp::SpatialSort", ptr %19, i32 0, i32 2
  %94 = load i64, ptr %12, align 8, !tbaa !23
  %95 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNKSt6vectorIN6Assimp11SpatialSort5EntryESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %93, i64 noundef %94) #8
  %96 = getelementptr inbounds %"struct.Assimp::SpatialSort::Entry", ptr %95, i32 0, i32 0
  %97 = load i32, ptr %96, align 4, !tbaa !25
  %98 = zext i32 %97 to i64
  %99 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %92, i64 noundef %98) #8
  store i32 %91, ptr %99, align 4, !tbaa !21
  br label %100

100:                                              ; preds = %90
  %101 = load i64, ptr %12, align 8, !tbaa !23
  %102 = add i64 %101, 1
  store i64 %102, ptr %12, align 8, !tbaa !23
  br label %65, !llvm.loop !28

103:                                              ; preds = %88
  %104 = load i32, ptr %10, align 4, !tbaa !21
  %105 = add i32 %104, 1
  store i32 %105, ptr %10, align 4, !tbaa !21
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  br label %32, !llvm.loop !30

106:                                              ; preds = %37
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  store i64 0, ptr %18, align 8, !tbaa !23
  br label %107

107:                                              ; preds = %125, %106
  %108 = load i64, ptr %18, align 8, !tbaa !23
  %109 = load ptr, ptr %5, align 8, !tbaa !5
  %110 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %109) #8
  %111 = icmp ult i64 %108, %110
  br i1 %111, label %113, label %112

112:                                              ; preds = %107
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  br label %128

113:                                              ; preds = %107
  %114 = load ptr, ptr %5, align 8, !tbaa !5
  %115 = load i64, ptr %18, align 8, !tbaa !23
  %116 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %114, i64 noundef %115) #8
  %117 = load i32, ptr %116, align 4, !tbaa !21
  %118 = zext i32 %117 to i64
  %119 = getelementptr inbounds %"class.Assimp::SpatialSort", ptr %19, i32 0, i32 2
  %120 = call noundef i64 @_ZNKSt6vectorIN6Assimp11SpatialSort5EntryESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %119) #8
  %121 = icmp ult i64 %118, %120
  br i1 %121, label %123, label %122

122:                                              ; preds = %113
  call void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef @.str.5, ptr noundef @.str.1, i32 noundef 333)
  br label %123

123:                                              ; preds = %122, %113
  %124 = phi i1 [ true, %113 ], [ false, %122 ]
  br label %125

125:                                              ; preds = %123
  %126 = load i64, ptr %18, align 8, !tbaa !23
  %127 = add i64 %126, 1
  store i64 %127, ptr %18, align 8, !tbaa !23
  br label %107, !llvm.loop !31

128:                                              ; preds = %112
  %129 = load i32, ptr %10, align 4, !tbaa !21
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  ret i32 %129
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIjSaIjEE6resizeEmRKj(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 4 dereferenceable(4)) #7 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint mustprogress 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 = { 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 #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 = { mustprogress 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 #7 = { mustprogress 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 #8 = { 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 = !{!"float", !7, i64 0}
!11 = !{!12, !18, i64 48}
!12 = !{!"_ZTSN6Assimp11SpatialSortE", !13, i64 0, !13, i64 12, !14, i64 24, !18, i64 48}
!13 = !{!"_ZTS10aiVector3tIfE", !10, i64 0, !10, i64 4, !10, i64 8}
!14 = !{!"_ZTSSt6vectorIN6Assimp11SpatialSort5EntryESaIS2_EE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseIN6Assimp11SpatialSort5EntryESaIS2_EE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIN6Assimp11SpatialSort5EntryESaIS2_EE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIN6Assimp11SpatialSort5EntryESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!18 = !{!"bool", !7, i64 0}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = !{!22, !22, i64 0}
!22 = !{!"int", !7, i64 0}
!23 = !{!24, !24, i64 0}
!24 = !{!"long", !7, i64 0}
!25 = !{!26, !22, i64 0}
!26 = !{!"_ZTSN6Assimp11SpatialSort5EntryE", !22, i64 0, !13, i64 4, !10, i64 16}
!27 = !{!26, !10, i64 16}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}
!30 = distinct !{!30, !29}
!31 = distinct !{!31, !29}


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

%class.aiVector3t = type { float, float, float }

@.str.1 = external hidden unnamed_addr constant [112 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [100 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [28 x i8], align 1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZmlIfET_RK10aiVector3tIS0_ES4_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #0

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { <2 x float>, float } @_ZmiIfE10aiVector3tIT_ERKS2_S4_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIN6Assimp11SpatialSort5EntryESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

declare void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(20) ptr @_ZNKSt6vectorIN6Assimp11SpatialSort5EntryESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK10aiVector3tIfE12SquareLengthEv(ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK6Assimp11SpatialSort20GenerateMappingTableERSt6vectorIjSaIjEEf(ptr noundef nonnull align 8 dereferenceable(49) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, float noundef %2) local_unnamed_addr #5 align 2 {
  %4 = alloca i32, align 4
  %5 = alloca %class.aiVector3t, align 8
  %6 = alloca %class.aiVector3t, align 8
  %7 = getelementptr inbounds i8, ptr %0, i64 48
  %8 = load i8, ptr %7, align 8, !tbaa !5, !range !17, !noundef !18
  %9 = trunc nuw i8 %8 to i1
  br i1 %9, label %11, label %10

10:                                               ; preds = %3
  tail call void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 311)
  br label %11

11:                                               ; preds = %10, %3
  %12 = getelementptr inbounds i8, ptr %0, i64 24
  %13 = tail call noundef i64 @_ZNKSt6vectorIN6Assimp11SpatialSort5EntryESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  store i32 -1, ptr %4, align 4, !tbaa !19
  call void @_ZNSt6vectorIjSaIjEE6resizeEmRKj(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %13, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  %14 = fmul float %2, %2
  %15 = call noundef i64 @_ZNKSt6vectorIN6Assimp11SpatialSort5EntryESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  %.not = icmp eq i64 %15, 0
  br i1 %.not, label %.preheader, label %.lr.ph44

.lr.ph44:                                         ; preds = %11
  %16 = getelementptr inbounds i8, ptr %0, i64 12
  %.sroa.26.0..sroa_idx = getelementptr inbounds i8, ptr %5, i64 8
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %6, i64 8
  br label %18

.preheader:                                       ; preds = %.loopexit, %11
  %.034.lcssa = phi i32 [ 0, %11 ], [ %49, %.loopexit ]
  %17 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #7
  %.not48 = icmp eq i64 %17, 0
  br i1 %.not48, label %._crit_edge, label %.lr.ph47

18:                                               ; preds = %.lr.ph44, %.loopexit
  %.03443 = phi i32 [ 0, %.lr.ph44 ], [ %49, %.loopexit ]
  %.03542 = phi i64 [ 0, %.lr.ph44 ], [ %.137, %.loopexit ]
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %5) #7
  %19 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNKSt6vectorIN6Assimp11SpatialSort5EntryESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %.03542) #7
  %20 = getelementptr inbounds i8, ptr %19, i64 4
  %21 = call { <2 x float>, float } @_ZmiIfE10aiVector3tIT_ERKS2_S4_(ptr noundef nonnull align 4 dereferenceable(12) %20, ptr noundef nonnull align 4 dereferenceable(12) %16)
  %.fca.0.extract3 = extractvalue { <2 x float>, float } %21, 0
  %.fca.1.extract4 = extractvalue { <2 x float>, float } %21, 1
  store <2 x float> %.fca.0.extract3, ptr %5, align 8
  store float %.fca.1.extract4, ptr %.sroa.26.0..sroa_idx, align 8
  %22 = call noundef float @_ZmlIfET_RK10aiVector3tIS0_ES4_(ptr noundef nonnull align 4 dereferenceable(12) %5, ptr noundef nonnull align 4 dereferenceable(12) %0)
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #7
  %23 = fadd float %22, %2
  %24 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNKSt6vectorIN6Assimp11SpatialSort5EntryESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %.03542) #7
  %25 = load i32, ptr %24, align 4, !tbaa !21
  %26 = zext i32 %25 to i64
  %27 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %26) #7
  store i32 %.03443, ptr %27, align 4, !tbaa !19
  %28 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNKSt6vectorIN6Assimp11SpatialSort5EntryESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %.03542) #7
  %29 = getelementptr inbounds i8, ptr %28, i64 4
  %.138 = add nuw i64 %.03542, 1
  %30 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #7
  %31 = icmp ult i64 %.138, %30
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #7
  br i1 %31, label %.lr.ph, label %.critedge

.lr.ph:                                           ; preds = %18, %42
  %.139 = phi i64 [ %.1, %42 ], [ %.138, %18 ]
  %32 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNKSt6vectorIN6Assimp11SpatialSort5EntryESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %.139) #7
  %33 = getelementptr inbounds i8, ptr %32, i64 16
  %34 = load float, ptr %33, align 4, !tbaa !23
  %35 = fcmp olt float %34, %23
  br i1 %35, label %36, label %.critedge

36:                                               ; preds = %.lr.ph
  %37 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNKSt6vectorIN6Assimp11SpatialSort5EntryESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %.139) #7
  %38 = getelementptr inbounds i8, ptr %37, i64 4
  %39 = call { <2 x float>, float } @_ZmiIfE10aiVector3tIT_ERKS2_S4_(ptr noundef nonnull align 4 dereferenceable(12) %38, ptr noundef nonnull align 4 dereferenceable(12) %29)
  %.fca.0.extract = extractvalue { <2 x float>, float } %39, 0
  %.fca.1.extract = extractvalue { <2 x float>, float } %39, 1
  store <2 x float> %.fca.0.extract, ptr %6, align 8
  store float %.fca.1.extract, ptr %.sroa.2.0..sroa_idx, align 8
  %40 = call noundef float @_ZNK10aiVector3tIfE12SquareLengthEv(ptr noundef nonnull align 4 dereferenceable(12) %6)
  %41 = fcmp olt float %40, %14
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #7
  br i1 %41, label %42, label %.loopexit

42:                                               ; preds = %36
  %43 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNKSt6vectorIN6Assimp11SpatialSort5EntryESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %.139) #7
  %44 = load i32, ptr %43, align 4, !tbaa !21
  %45 = zext i32 %44 to i64
  %46 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %45) #7
  store i32 %.03443, ptr %46, align 4, !tbaa !19
  %.1 = add nuw i64 %.139, 1
  %47 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #7
  %48 = icmp ult i64 %.1, %47
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #7
  br i1 %48, label %.lr.ph, label %.critedge, !llvm.loop !24

.critedge:                                        ; preds = %.lr.ph, %42, %18
  %.1.lcssa = phi i64 [ %.138, %18 ], [ %.1, %42 ], [ %.139, %.lr.ph ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #7
  br label %.loopexit

.loopexit:                                        ; preds = %36, %.critedge
  %.137 = phi i64 [ %.1.lcssa, %.critedge ], [ %.139, %36 ]
  %49 = add i32 %.03443, 1
  %50 = call noundef i64 @_ZNKSt6vectorIN6Assimp11SpatialSort5EntryESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  %51 = icmp ult i64 %.137, %50
  br i1 %51, label %18, label %.preheader, !llvm.loop !26

._crit_edge:                                      ; preds = %58, %.preheader
  ret i32 %.034.lcssa

.lr.ph47:                                         ; preds = %.preheader, %58
  %.046 = phi i64 [ %59, %58 ], [ 0, %.preheader ]
  %52 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %.046) #7
  %53 = load i32, ptr %52, align 4, !tbaa !19
  %54 = zext i32 %53 to i64
  %55 = call noundef i64 @_ZNKSt6vectorIN6Assimp11SpatialSort5EntryESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #7
  %56 = icmp ugt i64 %55, %54
  br i1 %56, label %58, label %57

57:                                               ; preds = %.lr.ph47
  call void @_ZN6Assimp17aiAssertViolationEPKcS1_i(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.1, i32 noundef 333)
  br label %58

58:                                               ; preds = %.lr.ph47, %57
  %59 = add nuw i64 %.046, 1
  %60 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #7
  %61 = icmp ult i64 %59, %60
  br i1 %61, label %.lr.ph47, label %._crit_edge, !llvm.loop !27
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIjSaIjEE6resizeEmRKj(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #6 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIjSaIjEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

attributes #0 = { inlinehint 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint mustprogress 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 = { 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 #4 = { "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 = { mustprogress 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 #6 = { mustprogress 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 #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, !16, i64 48}
!6 = !{!"_ZTSN6Assimp11SpatialSortE", !7, i64 0, !7, i64 12, !11, i64 24, !16, i64 48}
!7 = !{!"_ZTS10aiVector3tIfE", !8, i64 0, !8, i64 4, !8, i64 8}
!8 = !{!"float", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"_ZTSSt6vectorIN6Assimp11SpatialSort5EntryESaIS2_EE", !12, i64 0}
!12 = !{!"_ZTSSt12_Vector_baseIN6Assimp11SpatialSort5EntryESaIS2_EE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIN6Assimp11SpatialSort5EntryESaIS2_EE12_Vector_implE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIN6Assimp11SpatialSort5EntryESaIS2_EE17_Vector_impl_dataE", !15, i64 0, !15, i64 8, !15, i64 16}
!15 = !{!"any pointer", !9, i64 0}
!16 = !{!"bool", !9, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!20, !20, i64 0}
!20 = !{!"int", !9, i64 0}
!21 = !{!22, !20, i64 0}
!22 = !{!"_ZTSN6Assimp11SpatialSort5EntryE", !20, i64 0, !7, i64 4, !8, i64 16}
!23 = !{!22, !8, i64 16}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = distinct !{!26, !25}
!27 = distinct !{!27, !25}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass