; LLVM IR from facebookresearch/habitat-sim :: src/deps/basis-universal/encoder (basisu_enc)

; 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.basisu::sym_freq" = type { i32, i16 }

@.str.4 = external hidden unnamed_addr constant [110 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [19 x i8], align 1
@__PRETTY_FUNCTION__._ZN6basisu33canonical_huffman_radix_sort_symsEjPNS_8sym_freqES1_ = external hidden unnamed_addr constant [86 x i8], align 1

; 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #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: mustprogress uwtable
define dso_local noundef ptr @_ZN6basisu33canonical_huffman_radix_sort_symsEjPNS_8sym_freqES1_(i32 noundef %0, ptr noundef %1, ptr noundef %2) #3 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca [512 x i32], align 16
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca [256 x i32], align 16
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  store ptr %2, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 2, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 2048, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %19 = load ptr, ptr %5, align 8, !tbaa !9
  store ptr %19, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %20 = load ptr, ptr %6, align 8, !tbaa !9
  store ptr %20, ptr %13, align 8, !tbaa !9
  call void @_ZN6basisu9clear_objIA512_jEEvRT_(ptr noundef nonnull align 4 dereferenceable(2048) %11)
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %52, %3
  %22 = load i32, ptr %10, align 4, !tbaa !5
  %23 = load i32, ptr %4, align 4, !tbaa !5
  %24 = icmp ult i32 %22, %23
  br i1 %24, label %25, label %55

25:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %26 = load ptr, ptr %5, align 8, !tbaa !9
  %27 = load i32, ptr %10, align 4, !tbaa !5
  %28 = zext i32 %27 to i64
  %29 = getelementptr inbounds %"struct.basisu::sym_freq", ptr %26, i64 %28
  %30 = getelementptr inbounds %"struct.basisu::sym_freq", ptr %29, i32 0, i32 0
  %31 = load i32, ptr %30, align 4, !tbaa !11
  store i32 %31, ptr %14, align 4, !tbaa !5
  %32 = load i32, ptr %14, align 4, !tbaa !5
  %33 = icmp ule i32 %32, 65535
  br i1 %33, label %34, label %35

34:                                               ; preds = %25
  br label %37

35:                                               ; preds = %25
  call void @__assert_fail(ptr noundef @.str.19, ptr noundef @.str.4, i32 noundef 890, ptr noundef @__PRETTY_FUNCTION__._ZN6basisu33canonical_huffman_radix_sort_symsEjPNS_8sym_freqES1_) #6
  unreachable

36:                                               ; No predecessors!
  br label %37

37:                                               ; preds = %36, %34
  %38 = load i32, ptr %14, align 4, !tbaa !5
  %39 = and i32 %38, 255
  %40 = zext i32 %39 to i64
  %41 = getelementptr inbounds [512 x i32], ptr %11, i64 0, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = add i32 %42, 1
  store i32 %43, ptr %41, align 4, !tbaa !5
  %44 = load i32, ptr %14, align 4, !tbaa !5
  %45 = lshr i32 %44, 8
  %46 = and i32 %45, 255
  %47 = add i32 256, %46
  %48 = zext i32 %47 to i64
  %49 = getelementptr inbounds [512 x i32], ptr %11, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = add i32 %50, 1
  store i32 %51, ptr %49, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %52

52:                                               ; preds = %37
  %53 = load i32, ptr %10, align 4, !tbaa !5
  %54 = add i32 %53, 1
  store i32 %54, ptr %10, align 4, !tbaa !5
  br label %21, !llvm.loop !14

55:                                               ; preds = %21
  br label %56

56:                                               ; preds = %70, %55
  %57 = load i32, ptr %7, align 4, !tbaa !5
  %58 = icmp ugt i32 %57, 1
  br i1 %58, label %59, label %68

59:                                               ; preds = %56
  %60 = load i32, ptr %4, align 4, !tbaa !5
  %61 = load i32, ptr %7, align 4, !tbaa !5
  %62 = sub i32 %61, 1
  %63 = mul i32 %62, 256
  %64 = zext i32 %63 to i64
  %65 = getelementptr inbounds [512 x i32], ptr %11, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = icmp eq i32 %60, %66
  br label %68

68:                                               ; preds = %59, %56
  %69 = phi i1 [ false, %56 ], [ %67, %59 ]
  br i1 %69, label %70, label %73

70:                                               ; preds = %68
  %71 = load i32, ptr %7, align 4, !tbaa !5
  %72 = add i32 %71, -1
  store i32 %72, ptr %7, align 4, !tbaa !5
  br label %56, !llvm.loop !16

73:                                               ; preds = %68
  store i32 0, ptr %8, align 4, !tbaa !5
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %74

74:                                               ; preds = %134, %73
  %75 = load i32, ptr %9, align 4, !tbaa !5
  %76 = load i32, ptr %7, align 4, !tbaa !5
  %77 = icmp ult i32 %75, %76
  br i1 %77, label %78, label %139

78:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %79 = load i32, ptr %9, align 4, !tbaa !5
  %80 = shl i32 %79, 8
  %81 = zext i32 %80 to i64
  %82 = getelementptr inbounds [512 x i32], ptr %11, i64 0, i64 %81
  store ptr %82, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1024, ptr %16) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  store i32 0, ptr %17, align 4, !tbaa !5
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %83

83:                                               ; preds = %98, %78
  %84 = load i32, ptr %10, align 4, !tbaa !5
  %85 = icmp ult i32 %84, 256
  br i1 %85, label %86, label %101

86:                                               ; preds = %83
  %87 = load i32, ptr %17, align 4, !tbaa !5
  %88 = load i32, ptr %10, align 4, !tbaa !5
  %89 = zext i32 %88 to i64
  %90 = getelementptr inbounds [256 x i32], ptr %16, i64 0, i64 %89
  store i32 %87, ptr %90, align 4, !tbaa !5
  %91 = load ptr, ptr %15, align 8, !tbaa !9
  %92 = load i32, ptr %10, align 4, !tbaa !5
  %93 = zext i32 %92 to i64
  %94 = getelementptr inbounds i32, ptr %91, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = load i32, ptr %17, align 4, !tbaa !5
  %97 = add i32 %96, %95
  store i32 %97, ptr %17, align 4, !tbaa !5
  br label %98

98:                                               ; preds = %86
  %99 = load i32, ptr %10, align 4, !tbaa !5
  %100 = add i32 %99, 1
  store i32 %100, ptr %10, align 4, !tbaa !5
  br label %83, !llvm.loop !17

101:                                              ; preds = %83
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %102

102:                                              ; preds = %127, %101
  %103 = load i32, ptr %10, align 4, !tbaa !5
  %104 = load i32, ptr %4, align 4, !tbaa !5
  %105 = icmp ult i32 %103, %104
  br i1 %105, label %106, label %130

106:                                              ; preds = %102
  %107 = load ptr, ptr %12, align 8, !tbaa !9
  %108 = load i32, ptr %10, align 4, !tbaa !5
  %109 = zext i32 %108 to i64
  %110 = getelementptr inbounds %"struct.basisu::sym_freq", ptr %107, i64 %109
  %111 = load ptr, ptr %13, align 8, !tbaa !9
  %112 = load ptr, ptr %12, align 8, !tbaa !9
  %113 = load i32, ptr %10, align 4, !tbaa !5
  %114 = zext i32 %113 to i64
  %115 = getelementptr inbounds %"struct.basisu::sym_freq", ptr %112, i64 %114
  %116 = getelementptr inbounds %"struct.basisu::sym_freq", ptr %115, i32 0, i32 0
  %117 = load i32, ptr %116, align 4, !tbaa !11
  %118 = load i32, ptr %8, align 4, !tbaa !5
  %119 = lshr i32 %117, %118
  %120 = and i32 %119, 255
  %121 = zext i32 %120 to i64
  %122 = getelementptr inbounds [256 x i32], ptr %16, i64 0, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !5
  %124 = add i32 %123, 1
  store i32 %124, ptr %122, align 4, !tbaa !5
  %125 = zext i32 %123 to i64
  %126 = getelementptr inbounds %"struct.basisu::sym_freq", ptr %111, i64 %125
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %126, ptr align 4 %110, i64 8, i1 false), !tbaa.struct !18
  br label %127

127:                                              ; preds = %106
  %128 = load i32, ptr %10, align 4, !tbaa !5
  %129 = add i32 %128, 1
  store i32 %129, ptr %10, align 4, !tbaa !5
  br label %102, !llvm.loop !20

130:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %131 = load ptr, ptr %12, align 8, !tbaa !9
  store ptr %131, ptr %18, align 8, !tbaa !9
  %132 = load ptr, ptr %13, align 8, !tbaa !9
  store ptr %132, ptr %12, align 8, !tbaa !9
  %133 = load ptr, ptr %18, align 8, !tbaa !9
  store ptr %133, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 1024, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %134

134:                                              ; preds = %130
  %135 = load i32, ptr %9, align 4, !tbaa !5
  %136 = add i32 %135, 1
  store i32 %136, ptr %9, align 4, !tbaa !5
  %137 = load i32, ptr %8, align 4, !tbaa !5
  %138 = add i32 %137, 8
  store i32 %138, ptr %8, align 4, !tbaa !5
  br label %74, !llvm.loop !21

139:                                              ; preds = %74
  %140 = load ptr, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 2048, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  ret ptr %140
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6basisu9clear_objIA512_jEEvRT_(ptr noundef nonnull align 4 dereferenceable(2048)) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 = { 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 #5 = { nounwind }
attributes #6 = { noreturn nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTSN6basisu8sym_freqE", !6, i64 0, !13, i64 4}
!13 = !{!"short", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}
!18 = !{i64 0, i64 4, !5, i64 4, i64 2, !19}
!19 = !{!13, !13, i64 0}
!20 = distinct !{!20, !15}
!21 = distinct !{!21, !15}


; 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.basisu::sym_freq" = type { i32, i16 }

@.str.4 = external hidden unnamed_addr constant [110 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [19 x i8], align 1
@__PRETTY_FUNCTION__._ZN6basisu33canonical_huffman_radix_sort_symsEjPNS_8sym_freqES1_ = external hidden unnamed_addr constant [86 x i8], align 1

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

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef ptr @_ZN6basisu33canonical_huffman_radix_sort_symsEjPNS_8sym_freqES1_(i32 noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #2 {
  %4 = alloca [512 x i32], align 16
  %5 = alloca [256 x i32], align 16
  call void @llvm.lifetime.start.p0(i64 2048, ptr nonnull %4) #4
  call void @_ZN6basisu9clear_objIA512_jEEvRT_(ptr noundef nonnull align 4 dereferenceable(2048) %4)
  %.not = icmp eq i32 %0, 0
  br i1 %.not, label %.preheader47, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %3
  %wide.trip.count = zext i32 %0 to i64
  br label %.lr.ph

.preheader47:                                     ; preds = %13, %3
  %6 = getelementptr inbounds i8, ptr %4, i64 1024
  %7 = load i32, ptr %6, align 16
  %.fr59 = freeze i32 %7
  %8 = icmp eq i32 %.fr59, %0
  %spec.select = select i1 %8, i64 1, i64 2
  br i1 %.not, label %.critedge.preheader.split57, label %.critedge.preheader.split57.us.preheader

.lr.ph:                                           ; preds = %.lr.ph.preheader, %13
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %13 ]
  %9 = getelementptr inbounds %"struct.basisu::sym_freq", ptr %1, i64 %indvars.iv
  %10 = load i32, ptr %9, align 4, !tbaa !5
  %11 = icmp ult i32 %10, 65536
  br i1 %11, label %13, label %12

12:                                               ; preds = %.lr.ph
  call void @__assert_fail(ptr noundef nonnull @.str.19, ptr noundef nonnull @.str.4, i32 noundef 890, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6basisu33canonical_huffman_radix_sort_symsEjPNS_8sym_freqES1_) #5
  unreachable

13:                                               ; preds = %.lr.ph
  %14 = and i32 %10, 255
  %15 = zext nneg i32 %14 to i64
  %16 = getelementptr inbounds [512 x i32], ptr %4, i64 0, i64 %15
  %17 = load i32, ptr %16, align 4, !tbaa !11
  %18 = add i32 %17, 1
  store i32 %18, ptr %16, align 4, !tbaa !11
  %19 = lshr i32 %10, 8
  %20 = or disjoint i32 %19, 256
  %21 = zext nneg i32 %20 to i64
  %22 = getelementptr inbounds [512 x i32], ptr %4, i64 0, i64 %21
  %23 = load i32, ptr %22, align 4, !tbaa !11
  %24 = add i32 %23, 1
  store i32 %24, ptr %22, align 4, !tbaa !11
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.preheader47, label %.lr.ph, !llvm.loop !12

.critedge.preheader.split57.us.preheader:         ; preds = %.preheader47
  %wide.trip.count70 = zext i32 %0 to i64
  %xtraiter = and i64 %wide.trip.count70, 1
  %25 = icmp eq i32 %0, 1
  %unroll_iter = and i64 %wide.trip.count70, 4294967294
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.critedge.preheader.split57.us

.critedge.preheader.split57.us:                   ; preds = %.critedge.preheader.split57.us.preheader, %._crit_edge.us
  %indvars.iv72 = phi i64 [ 0, %.critedge.preheader.split57.us.preheader ], [ %indvars.iv.next73, %._crit_edge.us ]
  %.03956.us = phi i32 [ 0, %.critedge.preheader.split57.us.preheader ], [ %78, %._crit_edge.us ]
  %.04154.us = phi ptr [ %2, %.critedge.preheader.split57.us.preheader ], [ %.04253.us, %._crit_edge.us ]
  %.04253.us = phi ptr [ %1, %.critedge.preheader.split57.us.preheader ], [ %.04154.us, %._crit_edge.us ]
  %26 = shl nuw nsw i64 %indvars.iv72, 8
  %27 = getelementptr inbounds [512 x i32], ptr %4, i64 0, i64 %26
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %5) #4
  br label %50

.preheader.us:                                    ; preds = %.preheader.us.preheader, %.preheader.us
  %indvars.iv67 = phi i64 [ %indvars.iv.next68.1, %.preheader.us ], [ 0, %.preheader.us.preheader ]
  %niter = phi i64 [ %niter.next.1, %.preheader.us ], [ 0, %.preheader.us.preheader ]
  %28 = getelementptr inbounds %"struct.basisu::sym_freq", ptr %.04253.us, i64 %indvars.iv67
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = lshr i32 %29, %.03956.us
  %31 = and i32 %30, 255
  %32 = zext nneg i32 %31 to i64
  %33 = getelementptr inbounds [256 x i32], ptr %5, i64 0, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !11
  %35 = add i32 %34, 1
  store i32 %35, ptr %33, align 4, !tbaa !11
  %36 = zext i32 %34 to i64
  %37 = getelementptr inbounds %"struct.basisu::sym_freq", ptr %.04154.us, i64 %36
  %38 = load i64, ptr %28, align 4
  store i64 %38, ptr %37, align 4
  %indvars.iv.next68 = or disjoint i64 %indvars.iv67, 1
  %39 = getelementptr inbounds %"struct.basisu::sym_freq", ptr %.04253.us, i64 %indvars.iv.next68
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = lshr i32 %40, %.03956.us
  %42 = and i32 %41, 255
  %43 = zext nneg i32 %42 to i64
  %44 = getelementptr inbounds [256 x i32], ptr %5, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !11
  %46 = add i32 %45, 1
  store i32 %46, ptr %44, align 4, !tbaa !11
  %47 = zext i32 %45 to i64
  %48 = getelementptr inbounds %"struct.basisu::sym_freq", ptr %.04154.us, i64 %47
  %49 = load i64, ptr %39, align 4
  store i64 %49, ptr %48, align 4
  %indvars.iv.next68.1 = add nuw nsw i64 %indvars.iv67, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.us.unr-lcssa, label %.preheader.us, !llvm.loop !14

50:                                               ; preds = %50, %.critedge.preheader.split57.us
  %indvars.iv63 = phi i64 [ 0, %.critedge.preheader.split57.us ], [ %indvars.iv.next64.3, %50 ]
  %.03850.us = phi i32 [ 0, %.critedge.preheader.split57.us ], [ %66, %50 ]
  %51 = getelementptr inbounds [256 x i32], ptr %5, i64 0, i64 %indvars.iv63
  store i32 %.03850.us, ptr %51, align 16, !tbaa !11
  %52 = getelementptr inbounds i32, ptr %27, i64 %indvars.iv63
  %53 = load i32, ptr %52, align 16, !tbaa !11
  %54 = add i32 %53, %.03850.us
  %indvars.iv.next64 = or disjoint i64 %indvars.iv63, 1
  %55 = getelementptr inbounds [256 x i32], ptr %5, i64 0, i64 %indvars.iv.next64
  store i32 %54, ptr %55, align 4, !tbaa !11
  %56 = getelementptr inbounds i32, ptr %27, i64 %indvars.iv.next64
  %57 = load i32, ptr %56, align 4, !tbaa !11
  %58 = add i32 %57, %54
  %indvars.iv.next64.1 = or disjoint i64 %indvars.iv63, 2
  %59 = getelementptr inbounds [256 x i32], ptr %5, i64 0, i64 %indvars.iv.next64.1
  store i32 %58, ptr %59, align 8, !tbaa !11
  %60 = getelementptr inbounds i32, ptr %27, i64 %indvars.iv.next64.1
  %61 = load i32, ptr %60, align 8, !tbaa !11
  %62 = add i32 %61, %58
  %indvars.iv.next64.2 = or disjoint i64 %indvars.iv63, 3
  %63 = getelementptr inbounds [256 x i32], ptr %5, i64 0, i64 %indvars.iv.next64.2
  store i32 %62, ptr %63, align 4, !tbaa !11
  %64 = getelementptr inbounds i32, ptr %27, i64 %indvars.iv.next64.2
  %65 = load i32, ptr %64, align 4, !tbaa !11
  %66 = add i32 %65, %62
  %indvars.iv.next64.3 = add nuw nsw i64 %indvars.iv63, 4
  %exitcond66.not.3 = icmp eq i64 %indvars.iv.next64.3, 256
  br i1 %exitcond66.not.3, label %.preheader.us.preheader, label %50, !llvm.loop !15

.preheader.us.preheader:                          ; preds = %50
  br i1 %25, label %._crit_edge.us.unr-lcssa, label %.preheader.us

._crit_edge.us.unr-lcssa:                         ; preds = %.preheader.us, %.preheader.us.preheader
  %indvars.iv67.unr = phi i64 [ 0, %.preheader.us.preheader ], [ %indvars.iv.next68.1, %.preheader.us ]
  br i1 %lcmp.mod.not, label %._crit_edge.us, label %.preheader.us.epil

.preheader.us.epil:                               ; preds = %._crit_edge.us.unr-lcssa
  %67 = getelementptr inbounds %"struct.basisu::sym_freq", ptr %.04253.us, i64 %indvars.iv67.unr
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = lshr i32 %68, %.03956.us
  %70 = and i32 %69, 255
  %71 = zext nneg i32 %70 to i64
  %72 = getelementptr inbounds [256 x i32], ptr %5, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !11
  %74 = add i32 %73, 1
  store i32 %74, ptr %72, align 4, !tbaa !11
  %75 = zext i32 %73 to i64
  %76 = getelementptr inbounds %"struct.basisu::sym_freq", ptr %.04154.us, i64 %75
  %77 = load i64, ptr %67, align 4
  store i64 %77, ptr %76, align 4
  br label %._crit_edge.us

._crit_edge.us:                                   ; preds = %._crit_edge.us.unr-lcssa, %.preheader.us.epil
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %5) #4
  %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
  %78 = add nuw nsw i32 %.03956.us, 8
  %exitcond76.not = icmp eq i64 %indvars.iv.next73, %spec.select
  br i1 %exitcond76.not, label %.split.us, label %.critedge.preheader.split57.us, !llvm.loop !16

.critedge.preheader.split57:                      ; preds = %.preheader47, %.preheader
  %indvars.iv81 = phi i64 [ %indvars.iv.next82, %.preheader ], [ 0, %.preheader47 ]
  %.04154 = phi ptr [ %.04253, %.preheader ], [ %2, %.preheader47 ]
  %.04253 = phi ptr [ %.04154, %.preheader ], [ %1, %.preheader47 ]
  %79 = shl nuw nsw i64 %indvars.iv81, 8
  %80 = getelementptr inbounds [512 x i32], ptr %4, i64 0, i64 %79
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %5) #4
  br label %81

.preheader:                                       ; preds = %81
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %5) #4
  %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
  %exitcond85.not = icmp eq i64 %indvars.iv.next82, %spec.select
  br i1 %exitcond85.not, label %.split.us, label %.critedge.preheader.split57, !llvm.loop !16

81:                                               ; preds = %81, %.critedge.preheader.split57
  %indvars.iv77 = phi i64 [ 0, %.critedge.preheader.split57 ], [ %indvars.iv.next78.3, %81 ]
  %.03850 = phi i32 [ 0, %.critedge.preheader.split57 ], [ %97, %81 ]
  %82 = getelementptr inbounds [256 x i32], ptr %5, i64 0, i64 %indvars.iv77
  store i32 %.03850, ptr %82, align 16, !tbaa !11
  %83 = getelementptr inbounds i32, ptr %80, i64 %indvars.iv77
  %84 = load i32, ptr %83, align 16, !tbaa !11
  %85 = add i32 %84, %.03850
  %indvars.iv.next78 = or disjoint i64 %indvars.iv77, 1
  %86 = getelementptr inbounds [256 x i32], ptr %5, i64 0, i64 %indvars.iv.next78
  store i32 %85, ptr %86, align 4, !tbaa !11
  %87 = getelementptr inbounds i32, ptr %80, i64 %indvars.iv.next78
  %88 = load i32, ptr %87, align 4, !tbaa !11
  %89 = add i32 %88, %85
  %indvars.iv.next78.1 = or disjoint i64 %indvars.iv77, 2
  %90 = getelementptr inbounds [256 x i32], ptr %5, i64 0, i64 %indvars.iv.next78.1
  store i32 %89, ptr %90, align 8, !tbaa !11
  %91 = getelementptr inbounds i32, ptr %80, i64 %indvars.iv.next78.1
  %92 = load i32, ptr %91, align 8, !tbaa !11
  %93 = add i32 %92, %89
  %indvars.iv.next78.2 = or disjoint i64 %indvars.iv77, 3
  %94 = getelementptr inbounds [256 x i32], ptr %5, i64 0, i64 %indvars.iv.next78.2
  store i32 %93, ptr %94, align 4, !tbaa !11
  %95 = getelementptr inbounds i32, ptr %80, i64 %indvars.iv.next78.2
  %96 = load i32, ptr %95, align 4, !tbaa !11
  %97 = add i32 %96, %93
  %indvars.iv.next78.3 = add nuw nsw i64 %indvars.iv77, 4
  %exitcond80.not.3 = icmp eq i64 %indvars.iv.next78.3, 256
  br i1 %exitcond80.not.3, label %.preheader, label %81, !llvm.loop !15

.split.us:                                        ; preds = %._crit_edge.us, %.preheader
  %.us-phi58 = phi ptr [ %.04154, %.preheader ], [ %.04154.us, %._crit_edge.us ]
  call void @llvm.lifetime.end.p0(i64 2048, ptr nonnull %4) #4
  ret ptr %.us-phi58
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6basisu9clear_objIA512_jEEvRT_(ptr noundef nonnull align 4 dereferenceable(2048)) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { nounwind }
attributes #5 = { noreturn nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"_ZTSN6basisu8sym_freqE", !7, i64 0, !10, i64 4}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"short", !8, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}


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