; LLVM IR from zeux/meshoptimizer :: src (spatialorder)

; 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.meshopt_Allocator = type { [24 x ptr], i64 }

@.str = external hidden unnamed_addr constant [64 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [73 x i8], align 1
@__PRETTY_FUNCTION__.meshopt_spatialSortRemap = external hidden unnamed_addr constant [77 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [45 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @meshopt_spatialSortRemap(ptr noundef %0, ptr noundef %1, i64 noundef %2, i64 noundef %3) #0 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca %class.meshopt_Allocator, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca [1024 x [5 x i32]], align 16
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i64 %2, ptr %7, align 8, !tbaa !9
  store i64 %3, ptr %8, align 8, !tbaa !9
  %17 = load i64, ptr %8, align 8, !tbaa !9
  %18 = icmp uge i64 %17, 12
  br i1 %18, label %19, label %22

19:                                               ; preds = %4
  %20 = load i64, ptr %8, align 8, !tbaa !9
  %21 = icmp ule i64 %20, 256
  br label %22

22:                                               ; preds = %19, %4
  %23 = phi i1 [ false, %4 ], [ %21, %19 ]
  br i1 %23, label %24, label %25

24:                                               ; preds = %22
  br label %27

25:                                               ; preds = %22
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 124, ptr noundef @__PRETTY_FUNCTION__.meshopt_spatialSortRemap) #4
  unreachable

26:                                               ; No predecessors!
  br label %27

27:                                               ; preds = %26, %24
  %28 = load i64, ptr %8, align 8, !tbaa !9
  %29 = urem i64 %28, 4
  %30 = icmp eq i64 %29, 0
  br i1 %30, label %31, label %32

31:                                               ; preds = %27
  br label %34

32:                                               ; preds = %27
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 125, ptr noundef @__PRETTY_FUNCTION__.meshopt_spatialSortRemap) #4
  unreachable

33:                                               ; No predecessors!
  br label %34

34:                                               ; preds = %33, %31
  call void @llvm.lifetime.start.p0(i64 200, ptr %9) #5
  call void @_ZN17meshopt_AllocatorC2Ev(ptr noundef nonnull align 8 dereferenceable(200) %9)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %35 = load i64, ptr %7, align 8, !tbaa !9
  %36 = invoke noundef ptr @_ZN17meshopt_Allocator8allocateIyEEPT_m(ptr noundef nonnull align 8 dereferenceable(200) %9, i64 noundef %35)
          to label %37 unwind label %54

37:                                               ; preds = %34
  store ptr %36, ptr %10, align 8, !tbaa !5
  %38 = load ptr, ptr %10, align 8, !tbaa !5
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = load i64, ptr %7, align 8, !tbaa !9
  %41 = load i64, ptr %8, align 8, !tbaa !9
  invoke void @_ZN7meshoptL12computeOrderEPyPKfmm(ptr noundef %38, ptr noundef %39, i64 noundef %40, i64 noundef %41)
          to label %42 unwind label %54

42:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 20480, ptr %13) #5
  %43 = load ptr, ptr %10, align 8, !tbaa !5
  %44 = load i64, ptr %7, align 8, !tbaa !9
  invoke void @_ZN7meshoptL16computeHistogramERA1024_A5_jPKym(ptr noundef nonnull align 4 dereferenceable(20480) %13, ptr noundef %43, i64 noundef %44)
          to label %45 unwind label %58

45:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %46 = load i64, ptr %7, align 8, !tbaa !9
  %47 = invoke noundef ptr @_ZN17meshopt_Allocator8allocateIjEEPT_m(ptr noundef nonnull align 8 dereferenceable(200) %9, i64 noundef %46)
          to label %48 unwind label %62

48:                                               ; preds = %45
  store ptr %47, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  store i64 0, ptr %15, align 8, !tbaa !9
  br label %49

49:                                               ; preds = %72, %48
  %50 = load i64, ptr %15, align 8, !tbaa !9
  %51 = load i64, ptr %7, align 8, !tbaa !9
  %52 = icmp ult i64 %50, %51
  br i1 %52, label %66, label %53

53:                                               ; preds = %49
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %75

54:                                               ; preds = %37, %34
  %55 = landingpad { ptr, i32 }
          cleanup
  %56 = extractvalue { ptr, i32 } %55, 0
  store ptr %56, ptr %11, align 8
  %57 = extractvalue { ptr, i32 } %55, 1
  store i32 %57, ptr %12, align 4
  br label %121

58:                                               ; preds = %42
  %59 = landingpad { ptr, i32 }
          cleanup
  %60 = extractvalue { ptr, i32 } %59, 0
  store ptr %60, ptr %11, align 8
  %61 = extractvalue { ptr, i32 } %59, 1
  store i32 %61, ptr %12, align 4
  br label %120

62:                                               ; preds = %95, %90, %85, %80, %75, %45
  %63 = landingpad { ptr, i32 }
          cleanup
  %64 = extractvalue { ptr, i32 } %63, 0
  store ptr %64, ptr %11, align 8
  %65 = extractvalue { ptr, i32 } %63, 1
  store i32 %65, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %120

66:                                               ; preds = %49
  %67 = load i64, ptr %15, align 8, !tbaa !9
  %68 = trunc i64 %67 to i32
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = load i64, ptr %15, align 8, !tbaa !9
  %71 = getelementptr inbounds i32, ptr %69, i64 %70
  store i32 %68, ptr %71, align 4, !tbaa !11
  br label %72

72:                                               ; preds = %66
  %73 = load i64, ptr %15, align 8, !tbaa !9
  %74 = add i64 %73, 1
  store i64 %74, ptr %15, align 8, !tbaa !9
  br label %49, !llvm.loop !13

75:                                               ; preds = %53
  %76 = load ptr, ptr %14, align 8, !tbaa !5
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  %78 = load ptr, ptr %10, align 8, !tbaa !5
  %79 = load i64, ptr %7, align 8, !tbaa !9
  invoke void @_ZN7meshoptL9radixPassEPjPKjPKymRA1024_A5_ji(ptr noundef %76, ptr noundef %77, ptr noundef %78, i64 noundef %79, ptr noundef nonnull align 4 dereferenceable(20480) %13, i32 noundef 0)
          to label %80 unwind label %62

80:                                               ; preds = %75
  %81 = load ptr, ptr %5, align 8, !tbaa !5
  %82 = load ptr, ptr %14, align 8, !tbaa !5
  %83 = load ptr, ptr %10, align 8, !tbaa !5
  %84 = load i64, ptr %7, align 8, !tbaa !9
  invoke void @_ZN7meshoptL9radixPassEPjPKjPKymRA1024_A5_ji(ptr noundef %81, ptr noundef %82, ptr noundef %83, i64 noundef %84, ptr noundef nonnull align 4 dereferenceable(20480) %13, i32 noundef 1)
          to label %85 unwind label %62

85:                                               ; preds = %80
  %86 = load ptr, ptr %14, align 8, !tbaa !5
  %87 = load ptr, ptr %5, align 8, !tbaa !5
  %88 = load ptr, ptr %10, align 8, !tbaa !5
  %89 = load i64, ptr %7, align 8, !tbaa !9
  invoke void @_ZN7meshoptL9radixPassEPjPKjPKymRA1024_A5_ji(ptr noundef %86, ptr noundef %87, ptr noundef %88, i64 noundef %89, ptr noundef nonnull align 4 dereferenceable(20480) %13, i32 noundef 2)
          to label %90 unwind label %62

90:                                               ; preds = %85
  %91 = load ptr, ptr %5, align 8, !tbaa !5
  %92 = load ptr, ptr %14, align 8, !tbaa !5
  %93 = load ptr, ptr %10, align 8, !tbaa !5
  %94 = load i64, ptr %7, align 8, !tbaa !9
  invoke void @_ZN7meshoptL9radixPassEPjPKjPKymRA1024_A5_ji(ptr noundef %91, ptr noundef %92, ptr noundef %93, i64 noundef %94, ptr noundef nonnull align 4 dereferenceable(20480) %13, i32 noundef 3)
          to label %95 unwind label %62

95:                                               ; preds = %90
  %96 = load ptr, ptr %14, align 8, !tbaa !5
  %97 = load ptr, ptr %5, align 8, !tbaa !5
  %98 = load ptr, ptr %10, align 8, !tbaa !5
  %99 = load i64, ptr %7, align 8, !tbaa !9
  invoke void @_ZN7meshoptL9radixPassEPjPKjPKymRA1024_A5_ji(ptr noundef %96, ptr noundef %97, ptr noundef %98, i64 noundef %99, ptr noundef nonnull align 4 dereferenceable(20480) %13, i32 noundef 4)
          to label %100 unwind label %62

100:                                              ; preds = %95
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  store i64 0, ptr %16, align 8, !tbaa !9
  br label %101

101:                                              ; preds = %116, %100
  %102 = load i64, ptr %16, align 8, !tbaa !9
  %103 = load i64, ptr %7, align 8, !tbaa !9
  %104 = icmp ult i64 %102, %103
  br i1 %104, label %106, label %105

105:                                              ; preds = %101
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  br label %119

106:                                              ; preds = %101
  %107 = load i64, ptr %16, align 8, !tbaa !9
  %108 = trunc i64 %107 to i32
  %109 = load ptr, ptr %5, align 8, !tbaa !5
  %110 = load ptr, ptr %14, align 8, !tbaa !5
  %111 = load i64, ptr %16, align 8, !tbaa !9
  %112 = getelementptr inbounds i32, ptr %110, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !11
  %114 = zext i32 %113 to i64
  %115 = getelementptr inbounds i32, ptr %109, i64 %114
  store i32 %108, ptr %115, align 4, !tbaa !11
  br label %116

116:                                              ; preds = %106
  %117 = load i64, ptr %16, align 8, !tbaa !9
  %118 = add i64 %117, 1
  store i64 %118, ptr %16, align 8, !tbaa !9
  br label %101, !llvm.loop !15

119:                                              ; preds = %105
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 20480, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @_ZN17meshopt_AllocatorD2Ev(ptr noundef nonnull align 8 dereferenceable(200) %9) #5
  call void @llvm.lifetime.end.p0(i64 200, ptr %9) #5
  ret void

120:                                              ; preds = %62, %58
  call void @llvm.lifetime.end.p0(i64 20480, ptr %13) #5
  br label %121

121:                                              ; preds = %120, %54
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @_ZN17meshopt_AllocatorD2Ev(ptr noundef nonnull align 8 dereferenceable(200) %9) #5
  call void @llvm.lifetime.end.p0(i64 200, ptr %9) #5
  br label %122

122:                                              ; preds = %121
  %123 = load ptr, ptr %11, align 8
  %124 = load i32, ptr %12, align 4
  %125 = insertvalue { ptr, i32 } poison, ptr %123, 0
  %126 = insertvalue { ptr, i32 } %125, i32 %124, 1
  resume { ptr, i32 } %126
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN17meshopt_AllocatorC2Ev(ptr noundef nonnull align 8 dereferenceable(200)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN17meshopt_Allocator8allocateIyEEPT_m(ptr noundef nonnull align 8 dereferenceable(200), i64 noundef) #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN7meshoptL12computeOrderEPyPKfmm(ptr noundef, ptr noundef, i64 noundef, i64 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZN7meshoptL16computeHistogramERA1024_A5_jPKym(ptr noundef nonnull align 4 dereferenceable(20480), ptr noundef, i64 noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN17meshopt_Allocator8allocateIjEEPT_m(ptr noundef nonnull align 8 dereferenceable(200), i64 noundef) #0 align 2

; 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 hidden void @_ZN7meshoptL9radixPassEPjPKjPKymRA1024_A5_ji(ptr noundef, ptr noundef, ptr noundef, i64 noundef, ptr noundef nonnull align 4 dereferenceable(20480), i32 noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN17meshopt_AllocatorD2Ev(ptr noundef nonnull align 8 dereferenceable(200)) unnamed_addr #3 align 2

attributes #0 = { 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 #1 = { noreturn 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { noreturn nounwind }
attributes #5 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; 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.meshopt_Allocator = type { [24 x ptr], i64 }

@.str = external hidden unnamed_addr constant [64 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [73 x i8], align 1
@__PRETTY_FUNCTION__.meshopt_spatialSortRemap = external hidden unnamed_addr constant [77 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [45 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @meshopt_spatialSortRemap(ptr noundef %0, ptr noundef %1, i64 noundef %2, i64 noundef %3) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %5 = alloca %class.meshopt_Allocator, align 8
  %6 = alloca [1024 x [5 x i32]], align 16
  %7 = add i64 %3, -12
  %8 = icmp ult i64 %7, 245
  br i1 %8, label %10, label %9

9:                                                ; preds = %4
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 124, ptr noundef nonnull @__PRETTY_FUNCTION__.meshopt_spatialSortRemap) #4
  unreachable

10:                                               ; preds = %4
  %11 = and i64 %3, 3
  %12 = icmp eq i64 %11, 0
  br i1 %12, label %14, label %13

13:                                               ; preds = %10
  tail call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 125, ptr noundef nonnull @__PRETTY_FUNCTION__.meshopt_spatialSortRemap) #4
  unreachable

14:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %5) #5
  call void @_ZN17meshopt_AllocatorC2Ev(ptr noundef nonnull align 8 dereferenceable(200) %5)
  %15 = invoke noundef ptr @_ZN17meshopt_Allocator8allocateIyEEPT_m(ptr noundef nonnull align 8 dereferenceable(200) %5, i64 noundef %2)
          to label %16 unwind label %23

16:                                               ; preds = %14
  invoke void @_ZN7meshoptL12computeOrderEPyPKfmm(ptr noundef %15, ptr noundef %1, i64 noundef %2, i64 noundef %3)
          to label %17 unwind label %23

17:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 20480, ptr nonnull %6) #5
  call void @_ZN7meshoptL16computeHistogramERA1024_A5_jPKym(ptr noundef nonnull align 4 dereferenceable(20480) %6, ptr noundef %15, i64 noundef %2)
  %18 = invoke noundef ptr @_ZN17meshopt_Allocator8allocateIjEEPT_m(ptr noundef nonnull align 8 dereferenceable(200) %5, i64 noundef %2)
          to label %.preheader unwind label %25

.preheader:                                       ; preds = %17
  %.not = icmp eq i64 %2, 0
  br i1 %.not, label %._crit_edge55.critedge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader
  %min.iters.check = icmp ult i64 %2, 8
  br i1 %min.iters.check, label %.lr.ph.preheader59, label %vector.ph

.lr.ph.preheader59:                               ; preds = %middle.block, %.lr.ph.preheader
  %.04551.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %2, -8
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
  %19 = getelementptr inbounds i32, ptr %0, i64 %index
  %20 = getelementptr inbounds i8, ptr %19, i64 16
  store <4 x i32> %vec.ind, ptr %19, align 4, !tbaa !5
  store <4 x i32> %step.add, ptr %20, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %21 = icmp eq i64 %index.next, %n.vec
  br i1 %21, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %2
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader59

._crit_edge:                                      ; preds = %.lr.ph, %middle.block
  call void @_ZN7meshoptL9radixPassEPjPKjPKymRA1024_A5_ji(ptr noundef %18, ptr noundef %0, ptr noundef %15, i64 noundef %2, ptr noundef nonnull align 4 dereferenceable(20480) %6, i32 noundef 0)
  call void @_ZN7meshoptL9radixPassEPjPKjPKymRA1024_A5_ji(ptr noundef %0, ptr noundef %18, ptr noundef %15, i64 noundef %2, ptr noundef nonnull align 4 dereferenceable(20480) %6, i32 noundef 1)
  call void @_ZN7meshoptL9radixPassEPjPKjPKymRA1024_A5_ji(ptr noundef %18, ptr noundef %0, ptr noundef %15, i64 noundef %2, ptr noundef nonnull align 4 dereferenceable(20480) %6, i32 noundef 2)
  call void @_ZN7meshoptL9radixPassEPjPKjPKymRA1024_A5_ji(ptr noundef %0, ptr noundef %18, ptr noundef %15, i64 noundef %2, ptr noundef nonnull align 4 dereferenceable(20480) %6, i32 noundef 3)
  call void @_ZN7meshoptL9radixPassEPjPKjPKymRA1024_A5_ji(ptr noundef %18, ptr noundef %0, ptr noundef %15, i64 noundef %2, ptr noundef nonnull align 4 dereferenceable(20480) %6, i32 noundef 4)
  %xtraiter = and i64 %2, 3
  %22 = icmp ult i64 %2, 4
  br i1 %22, label %._crit_edge55.loopexit.unr-lcssa, label %._crit_edge.new

._crit_edge.new:                                  ; preds = %._crit_edge
  %unroll_iter = and i64 %2, -4
  br label %.lr.ph54

23:                                               ; preds = %16, %14
  %24 = landingpad { ptr, i32 }
          cleanup
  br label %60

25:                                               ; preds = %17
  %26 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 20480, ptr nonnull %6) #5
  br label %60

.lr.ph:                                           ; preds = %.lr.ph.preheader59, %.lr.ph
  %.04551 = phi i64 [ %29, %.lr.ph ], [ %.04551.ph, %.lr.ph.preheader59 ]
  %27 = trunc i64 %.04551 to i32
  %28 = getelementptr inbounds i32, ptr %0, i64 %.04551
  store i32 %27, ptr %28, align 4, !tbaa !5
  %29 = add nuw i64 %.04551, 1
  %exitcond.not = icmp eq i64 %29, %2
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !13

._crit_edge55.critedge:                           ; preds = %.preheader
  call void @_ZN7meshoptL9radixPassEPjPKjPKymRA1024_A5_ji(ptr noundef %18, ptr noundef %0, ptr noundef %15, i64 noundef %2, ptr noundef nonnull align 4 dereferenceable(20480) %6, i32 noundef 0)
  call void @_ZN7meshoptL9radixPassEPjPKjPKymRA1024_A5_ji(ptr noundef %0, ptr noundef %18, ptr noundef %15, i64 noundef %2, ptr noundef nonnull align 4 dereferenceable(20480) %6, i32 noundef 1)
  call void @_ZN7meshoptL9radixPassEPjPKjPKymRA1024_A5_ji(ptr noundef %18, ptr noundef %0, ptr noundef %15, i64 noundef %2, ptr noundef nonnull align 4 dereferenceable(20480) %6, i32 noundef 2)
  call void @_ZN7meshoptL9radixPassEPjPKjPKymRA1024_A5_ji(ptr noundef %0, ptr noundef %18, ptr noundef %15, i64 noundef %2, ptr noundef nonnull align 4 dereferenceable(20480) %6, i32 noundef 3)
  call void @_ZN7meshoptL9radixPassEPjPKjPKymRA1024_A5_ji(ptr noundef %18, ptr noundef %0, ptr noundef %15, i64 noundef %2, ptr noundef nonnull align 4 dereferenceable(20480) %6, i32 noundef 4)
  br label %._crit_edge55

._crit_edge55.loopexit.unr-lcssa:                 ; preds = %.lr.ph54, %._crit_edge
  %.052.unr = phi i64 [ 0, %._crit_edge ], [ %59, %.lr.ph54 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge55, label %.lr.ph54.epil

.lr.ph54.epil:                                    ; preds = %._crit_edge55.loopexit.unr-lcssa, %.lr.ph54.epil
  %.052.epil = phi i64 [ %35, %.lr.ph54.epil ], [ %.052.unr, %._crit_edge55.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph54.epil ], [ 0, %._crit_edge55.loopexit.unr-lcssa ]
  %30 = trunc i64 %.052.epil to i32
  %31 = getelementptr inbounds i32, ptr %18, i64 %.052.epil
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = zext i32 %32 to i64
  %34 = getelementptr inbounds i32, ptr %0, i64 %33
  store i32 %30, ptr %34, align 4, !tbaa !5
  %35 = add nuw i64 %.052.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_edge55, label %.lr.ph54.epil, !llvm.loop !14

._crit_edge55:                                    ; preds = %._crit_edge55.loopexit.unr-lcssa, %.lr.ph54.epil, %._crit_edge55.critedge
  call void @llvm.lifetime.end.p0(i64 20480, ptr nonnull %6) #5
  call void @_ZN17meshopt_AllocatorD2Ev(ptr noundef nonnull align 8 dereferenceable(200) %5) #5
  call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %5) #5
  ret void

.lr.ph54:                                         ; preds = %.lr.ph54, %._crit_edge.new
  %.052 = phi i64 [ 0, %._crit_edge.new ], [ %59, %.lr.ph54 ]
  %niter = phi i64 [ 0, %._crit_edge.new ], [ %niter.next.3, %.lr.ph54 ]
  %36 = trunc i64 %.052 to i32
  %37 = getelementptr inbounds i32, ptr %18, i64 %.052
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = zext i32 %38 to i64
  %40 = getelementptr inbounds i32, ptr %0, i64 %39
  store i32 %36, ptr %40, align 4, !tbaa !5
  %41 = or disjoint i64 %.052, 1
  %42 = trunc i64 %41 to i32
  %43 = getelementptr inbounds i32, ptr %18, i64 %41
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = zext i32 %44 to i64
  %46 = getelementptr inbounds i32, ptr %0, i64 %45
  store i32 %42, ptr %46, align 4, !tbaa !5
  %47 = or disjoint i64 %.052, 2
  %48 = trunc i64 %47 to i32
  %49 = getelementptr inbounds i32, ptr %18, i64 %47
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = zext i32 %50 to i64
  %52 = getelementptr inbounds i32, ptr %0, i64 %51
  store i32 %48, ptr %52, align 4, !tbaa !5
  %53 = or disjoint i64 %.052, 3
  %54 = trunc i64 %53 to i32
  %55 = getelementptr inbounds i32, ptr %18, i64 %53
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = zext i32 %56 to i64
  %58 = getelementptr inbounds i32, ptr %0, i64 %57
  store i32 %54, ptr %58, align 4, !tbaa !5
  %59 = add nuw i64 %.052, 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_edge55.loopexit.unr-lcssa, label %.lr.ph54, !llvm.loop !16

60:                                               ; preds = %25, %23
  %.pn = phi { ptr, i32 } [ %26, %25 ], [ %24, %23 ]
  call void @_ZN17meshopt_AllocatorD2Ev(ptr noundef nonnull align 8 dereferenceable(200) %5) #5
  call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %5) #5
  resume { ptr, i32 } %.pn
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN17meshopt_AllocatorC2Ev(ptr noundef nonnull align 8 dereferenceable(200)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN17meshopt_Allocator8allocateIyEEPT_m(ptr noundef nonnull align 8 dereferenceable(200), i64 noundef) local_unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN7meshoptL12computeOrderEPyPKfmm(ptr noundef, ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZN7meshoptL16computeHistogramERA1024_A5_jPKym(ptr noundef nonnull align 4 dereferenceable(20480), ptr noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN17meshopt_Allocator8allocateIjEEPT_m(ptr noundef nonnull align 8 dereferenceable(200), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress 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 hidden void @_ZN7meshoptL9radixPassEPjPKjPKymRA1024_A5_ji(ptr noundef, ptr noundef, ptr noundef, i64 noundef, ptr noundef nonnull align 4 dereferenceable(20480), i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN17meshopt_AllocatorD2Ev(ptr noundef nonnull align 8 dereferenceable(200)) unnamed_addr #3 align 2

attributes #0 = { 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 #1 = { noreturn 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { noreturn nounwind }
attributes #5 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !10}


; Effective O3 passes: CorrelatedValuePropagationPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,SROAPass,SimplifyCFGPass,TailCallElimPass