; LLVM IR from dbry/wavpack-stream :: src (pack_utils)

; 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.WavpackContext = type { %struct.WavpackStreamConfig, ptr, i32, i32, ptr, i32, ptr, ptr, ptr, ptr, ptr, ptr, i64, i64, i64, i64, i64, i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, i8, ptr, ptr, i32, i32, ptr, [8 x i8], ptr, [80 x i8] }
%struct.WavpackStreamConfig = type { float, float, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [16 x i8], i8, i32, ptr }
%struct.WavpackStream = type { %struct.WavpackHeader, %struct.words_data, ptr, ptr, ptr, ptr, ptr, i64, i64, i32, i32, i32, i8, i8, i8, i8, i8, i8, i8, i32, i32, i32, i32, i32, i32, i32, i32, %struct.bs, %struct.bs, %struct.bs, float, i8, i8, i8, i8, i8, i8, i8, i8, %struct.anon, [16 x %struct.decorr_pass], %struct.decorr_pass, ptr, %struct.anon.0 }
%struct.WavpackHeader = type { [4 x i8], i16, i16, i32 }
%struct.words_data = type { [2 x i32], [2 x i32], i32, i32, i32, i32, i32, [2 x %struct.entropy_data] }
%struct.entropy_data = type { [3 x i32], i32, i32 }
%struct.bs = type { ptr, ptr, ptr, ptr, i32, i32, i32 }
%struct.anon = type { [2 x i32], [2 x i32], [2 x i32], double, double, double, ptr, ptr, i32 }
%struct.decorr_pass = type { i32, i32, i32, i32, [8 x i32], [8 x i32], i32, i32, i32, i32 }
%struct.anon.0 = type { ptr, ptr, ptr, ptr, ptr, i8, i8, i32, i32, i32, ptr, i32, i32, i32, [2 x %struct.DSDfilters], ptr }
%struct.DSDfilters = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }

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

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

; 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
define dso_local i32 @WavpackStreamPackInit(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.WavpackContext, ptr %6, i32 0, i32 0
  %8 = getelementptr inbounds %struct.WavpackStreamConfig, ptr %7, i32 0, i32 12
  %9 = load i32, ptr %8, align 8, !tbaa !9
  store i32 %9, ptr %3, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 75, ptr %4, align 4, !tbaa !15
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.WavpackContext, ptr %10, i32 0, i32 2
  %12 = load i32, ptr %11, align 8, !tbaa !16
  %13 = icmp ugt i32 %12, 1000
  br i1 %13, label %14, label %17

14:                                               ; preds = %1
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = call i32 @write_metadata_block(ptr noundef %15)
  br label %17

17:                                               ; preds = %14, %1
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.WavpackContext, ptr %18, i32 0, i32 42
  %20 = load i32, ptr %19, align 4, !tbaa !17
  %21 = icmp ne i32 %20, 0
  br i1 %21, label %22, label %28

22:                                               ; preds = %17
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.WavpackContext, ptr %23, i32 0, i32 42
  %25 = load i32, ptr %24, align 4, !tbaa !17
  %26 = load i32, ptr %3, align 4, !tbaa !15
  %27 = mul i32 %26, %25
  store i32 %27, ptr %3, align 4, !tbaa !15
  br label %28

28:                                               ; preds = %22, %17
  %29 = load i32, ptr %3, align 4, !tbaa !15
  %30 = load i32, ptr %4, align 4, !tbaa !15
  %31 = srem i32 %29, %30
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %33, label %49

33:                                               ; preds = %28
  %34 = load i32, ptr %3, align 4, !tbaa !15
  %35 = srem i32 %34, 100
  %36 = icmp ne i32 %35, 0
  br i1 %36, label %37, label %47

37:                                               ; preds = %33
  br label %38

38:                                               ; preds = %43, %37
  %39 = load i32, ptr %3, align 4, !tbaa !15
  %40 = load i32, ptr %4, align 4, !tbaa !15
  %41 = srem i32 %39, %40
  %42 = icmp ne i32 %41, 0
  br i1 %42, label %43, label %46

43:                                               ; preds = %38
  %44 = load i32, ptr %4, align 4, !tbaa !15
  %45 = add nsw i32 %44, -1
  store i32 %45, ptr %4, align 4, !tbaa !15
  br label %38, !llvm.loop !18

46:                                               ; preds = %38
  br label %48

47:                                               ; preds = %33
  store i32 100, ptr %4, align 4, !tbaa !15
  br label %48

48:                                               ; preds = %47, %46
  br label %49

49:                                               ; preds = %48, %28
  %50 = load i32, ptr %3, align 4, !tbaa !15
  %51 = load i32, ptr %4, align 4, !tbaa !15
  %52 = sdiv i32 %50, %51
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.WavpackContext, ptr %53, i32 0, i32 26
  store i32 %52, ptr %54, align 8, !tbaa !20
  br label %55

55:                                               ; preds = %74, %49
  %56 = load ptr, ptr %2, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.WavpackContext, ptr %56, i32 0, i32 26
  %58 = load i32, ptr %57, align 8, !tbaa !20
  %59 = icmp ugt i32 %58, 8000
  br i1 %59, label %72, label %60

60:                                               ; preds = %55
  %61 = load ptr, ptr %2, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.WavpackContext, ptr %61, i32 0, i32 26
  %63 = load i32, ptr %62, align 8, !tbaa !20
  %64 = zext i32 %63 to i64
  %65 = load ptr, ptr %2, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.WavpackContext, ptr %65, i32 0, i32 0
  %67 = getelementptr inbounds %struct.WavpackStreamConfig, ptr %66, i32 0, i32 7
  %68 = load i32, ptr %67, align 4, !tbaa !21
  %69 = sext i32 %68 to i64
  %70 = mul nsw i64 %64, %69
  %71 = icmp sgt i64 %70, 25000
  br label %72

72:                                               ; preds = %60, %55
  %73 = phi i1 [ true, %55 ], [ %71, %60 ]
  br i1 %73, label %74, label %79

74:                                               ; preds = %72
  %75 = load ptr, ptr %2, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.WavpackContext, ptr %75, i32 0, i32 26
  %77 = load i32, ptr %76, align 8, !tbaa !20
  %78 = udiv i32 %77, 2
  store i32 %78, ptr %76, align 8, !tbaa !20
  br label %55, !llvm.loop !22

79:                                               ; preds = %72
  br label %80

80:                                               ; preds = %85, %79
  %81 = load ptr, ptr %2, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.WavpackContext, ptr %81, i32 0, i32 26
  %83 = load i32, ptr %82, align 8, !tbaa !20
  %84 = icmp ult i32 %83, 256
  br i1 %84, label %85, label %90

85:                                               ; preds = %80
  %86 = load ptr, ptr %2, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.WavpackContext, ptr %86, i32 0, i32 26
  %88 = load i32, ptr %87, align 8, !tbaa !20
  %89 = mul i32 %88, 2
  store i32 %89, ptr %87, align 8, !tbaa !20
  br label %80, !llvm.loop !23

90:                                               ; preds = %80
  %91 = load ptr, ptr %2, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.WavpackContext, ptr %91, i32 0, i32 0
  %93 = getelementptr inbounds %struct.WavpackStreamConfig, ptr %92, i32 0, i32 9
  %94 = load i32, ptr %93, align 4, !tbaa !24
  %95 = icmp ne i32 %94, 0
  br i1 %95, label %96, label %103

96:                                               ; preds = %90
  %97 = load ptr, ptr %2, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.WavpackContext, ptr %97, i32 0, i32 0
  %99 = getelementptr inbounds %struct.WavpackStreamConfig, ptr %98, i32 0, i32 9
  %100 = load i32, ptr %99, align 4, !tbaa !24
  %101 = load ptr, ptr %2, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.WavpackContext, ptr %101, i32 0, i32 26
  store i32 %100, ptr %102, align 8, !tbaa !20
  br label %103

103:                                              ; preds = %96, %90
  %104 = load ptr, ptr %2, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.WavpackContext, ptr %104, i32 0, i32 26
  %106 = load i32, ptr %105, align 8, !tbaa !20
  %107 = load ptr, ptr %2, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.WavpackContext, ptr %107, i32 0, i32 27
  store i32 %106, ptr %108, align 4, !tbaa !25
  %109 = load ptr, ptr %2, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.WavpackContext, ptr %109, i32 0, i32 33
  store i32 0, ptr %110, align 4, !tbaa !26
  br label %111

111:                                              ; preds = %146, %103
  %112 = load ptr, ptr %2, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.WavpackContext, ptr %112, i32 0, i32 33
  %114 = load i32, ptr %113, align 4, !tbaa !26
  %115 = load ptr, ptr %2, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.WavpackContext, ptr %115, i32 0, i32 34
  %117 = load i32, ptr %116, align 8, !tbaa !27
  %118 = icmp slt i32 %114, %117
  br i1 %118, label %119, label %151

119:                                              ; preds = %111
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %120 = load ptr, ptr %2, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.WavpackContext, ptr %120, i32 0, i32 36
  %122 = load ptr, ptr %121, align 8, !tbaa !28
  %123 = load ptr, ptr %2, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.WavpackContext, ptr %123, i32 0, i32 33
  %125 = load i32, ptr %124, align 4, !tbaa !26
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds ptr, ptr %122, i64 %126
  %128 = load ptr, ptr %127, align 8, !tbaa !5
  store ptr %128, ptr %5, align 8, !tbaa !5
  %129 = load ptr, ptr %2, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.WavpackContext, ptr %129, i32 0, i32 26
  %131 = load i32, ptr %130, align 8, !tbaa !20
  %132 = load ptr, ptr %5, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.WavpackStream, ptr %132, i32 0, i32 0
  %134 = getelementptr inbounds %struct.WavpackHeader, ptr %133, i32 0, i32 3
  %135 = load i32, ptr %134, align 8, !tbaa !29
  %136 = and i32 %135, 4
  %137 = icmp ne i32 %136, 0
  %138 = zext i1 %137 to i64
  %139 = select i1 %137, i32 4, i32 8
  %140 = mul i32 %131, %139
  %141 = zext i32 %140 to i64
  %142 = call noalias ptr @malloc(i64 noundef %141) #5
  %143 = load ptr, ptr %5, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.WavpackStream, ptr %143, i32 0, i32 6
  store ptr %142, ptr %144, align 8, !tbaa !39
  %145 = load ptr, ptr %2, align 8, !tbaa !5
  call void @pack_init(ptr noundef %145)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  br label %146

146:                                              ; preds = %119
  %147 = load ptr, ptr %2, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.WavpackContext, ptr %147, i32 0, i32 33
  %149 = load i32, ptr %148, align 4, !tbaa !26
  %150 = add nsw i32 %149, 1
  store i32 %150, ptr %148, align 4, !tbaa !26
  br label %111, !llvm.loop !40

151:                                              ; preds = %111
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  ret i32 1
}

; Function Attrs: nounwind uwtable
declare hidden i32 @write_metadata_block(ptr noundef) #2

declare void @pack_init(ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind allocsize(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 = { 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 = { "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 = { nounwind allocsize(0) }

!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, !13, i64 48}
!10 = !{!"WavpackContext", !11, i64 0, !6, i64 88, !13, i64 96, !13, i64 100, !6, i64 104, !13, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !14, i64 168, !14, i64 176, !14, i64 184, !14, i64 192, !14, i64 200, !14, i64 208, !13, i64 216, !13, i64 220, !13, i64 224, !13, i64 228, !13, i64 232, !13, i64 236, !13, i64 240, !13, i64 244, !13, i64 248, !13, i64 252, !13, i64 256, !13, i64 260, !13, i64 264, !13, i64 268, !13, i64 272, !13, i64 276, !13, i64 280, !13, i64 284, !6, i64 288, !6, i64 296, !7, i64 304, !6, i64 312, !6, i64 320, !13, i64 328, !13, i64 332, !6, i64 336, !7, i64 344, !6, i64 352, !7, i64 360}
!11 = !{!"", !12, i64 0, !12, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !13, i64 48, !13, i64 52, !7, i64 56, !7, i64 72, !13, i64 76, !6, i64 80}
!12 = !{!"float", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!13, !13, i64 0}
!16 = !{!10, !13, i64 96}
!17 = !{!10, !13, i64 332}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!10, !13, i64 248}
!21 = !{!10, !13, i64 28}
!22 = distinct !{!22, !19}
!23 = distinct !{!23, !19}
!24 = !{!10, !13, i64 36}
!25 = !{!10, !13, i64 252}
!26 = !{!10, !13, i64 276}
!27 = !{!10, !13, i64 280}
!28 = !{!10, !6, i64 288}
!29 = !{!30, !13, i64 8}
!30 = !{!"", !31, i64 0, !33, i64 12, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !14, i64 128, !14, i64 136, !13, i64 144, !13, i64 148, !13, i64 152, !7, i64 156, !7, i64 157, !7, i64 158, !7, i64 159, !7, i64 160, !7, i64 161, !7, i64 162, !13, i64 164, !13, i64 168, !13, i64 172, !13, i64 176, !13, i64 180, !13, i64 184, !13, i64 188, !13, i64 192, !34, i64 200, !34, i64 248, !34, i64 296, !12, i64 344, !7, i64 348, !7, i64 349, !7, i64 350, !7, i64 351, !7, i64 352, !7, i64 353, !7, i64 354, !7, i64 355, !35, i64 360, !7, i64 432, !37, i64 1968, !6, i64 2064, !38, i64 2072}
!31 = !{!"", !7, i64 0, !32, i64 4, !32, i64 6, !13, i64 8}
!32 = !{!"short", !7, i64 0}
!33 = !{!"words_data", !7, i64 0, !7, i64 8, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !7, i64 36}
!34 = !{!"bs", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !13, i64 32, !13, i64 36, !13, i64 40}
!35 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16, !36, i64 24, !36, i64 32, !36, i64 40, !6, i64 48, !6, i64 56, !13, i64 64}
!36 = !{!"double", !7, i64 0}
!37 = !{!"decorr_pass", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !7, i64 16, !7, i64 48, !13, i64 80, !13, i64 84, !13, i64 88, !13, i64 92}
!38 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !7, i64 40, !7, i64 41, !13, i64 44, !13, i64 48, !13, i64 52, !6, i64 56, !13, i64 64, !13, i64 68, !13, i64 72, !7, i64 76, !6, i64 160}
!39 = !{!30, !6, i64 120}
!40 = distinct !{!40, !19}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @WavpackStreamPackInit(ptr noundef %0) local_unnamed_addr #1 {
  %2 = getelementptr inbounds i8, ptr %0, i64 48
  %3 = load i32, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 96
  %5 = load i32, ptr %4, align 8, !tbaa !14
  %6 = icmp ugt i32 %5, 1000
  br i1 %6, label %7, label %9

7:                                                ; preds = %1
  %8 = tail call i32 @write_metadata_block(ptr noundef nonnull %0)
  br label %9

9:                                                ; preds = %7, %1
  %10 = getelementptr inbounds i8, ptr %0, i64 332
  %11 = load i32, ptr %10, align 4, !tbaa !15
  %12 = tail call i32 @llvm.umax.i32(i32 %11, i32 1)
  %spec.select = mul i32 %12, %3
  %13 = srem i32 %spec.select, 75
  %.not41 = icmp eq i32 %13, 0
  br i1 %.not41, label %.loopexit, label %14

14:                                               ; preds = %9
  %15 = srem i32 %spec.select, 100
  %.not42 = icmp eq i32 %15, 0
  br i1 %.not42, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %14, %.preheader
  %.035 = phi i32 [ %17, %.preheader ], [ 75, %14 ]
  %16 = srem i32 %spec.select, %.035
  %.not43 = icmp eq i32 %16, 0
  %17 = add nsw i32 %.035, -1
  br i1 %.not43, label %.loopexit, label %.preheader, !llvm.loop !16

.loopexit:                                        ; preds = %.preheader, %14, %9
  %.1 = phi i32 [ 75, %9 ], [ 100, %14 ], [ %.035, %.preheader ]
  %18 = sdiv i32 %spec.select, %.1
  %19 = getelementptr inbounds i8, ptr %0, i64 28
  br label %20

20:                                               ; preds = %.critedge, %.loopexit
  %storemerge = phi i32 [ %18, %.loopexit ], [ %28, %.critedge ]
  %21 = icmp ugt i32 %storemerge, 8000
  br i1 %21, label %.critedge, label %22

22:                                               ; preds = %20
  %23 = zext nneg i32 %storemerge to i64
  %24 = load i32, ptr %19, align 4, !tbaa !18
  %25 = sext i32 %24 to i64
  %26 = mul nsw i64 %25, %23
  %27 = icmp sgt i64 %26, 25000
  br i1 %27, label %.critedge, label %thread-pre-split

.critedge:                                        ; preds = %20, %22
  %28 = lshr i32 %storemerge, 1
  br label %20, !llvm.loop !19

thread-pre-split:                                 ; preds = %22
  %29 = getelementptr inbounds i8, ptr %0, i64 248
  store i32 %storemerge, ptr %29, align 8, !tbaa !20
  %30 = icmp ult i32 %storemerge, 256
  br i1 %30, label %.lr.ph, label %34

.lr.ph:                                           ; preds = %thread-pre-split, %.lr.ph
  %31 = phi i32 [ %32, %.lr.ph ], [ %storemerge, %thread-pre-split ]
  %32 = shl nuw nsw i32 %31, 1
  %33 = icmp ult i32 %31, 128
  br i1 %33, label %.lr.ph, label %._crit_edge, !llvm.loop !21

._crit_edge:                                      ; preds = %.lr.ph
  store i32 %32, ptr %29, align 8, !tbaa !20
  br label %34

34:                                               ; preds = %._crit_edge, %thread-pre-split
  %35 = phi i32 [ %32, %._crit_edge ], [ %storemerge, %thread-pre-split ]
  %36 = getelementptr inbounds i8, ptr %0, i64 36
  %37 = load i32, ptr %36, align 4, !tbaa !22
  %.not44 = icmp eq i32 %37, 0
  br i1 %.not44, label %39, label %38

38:                                               ; preds = %34
  store i32 %37, ptr %29, align 8, !tbaa !20
  br label %39

39:                                               ; preds = %38, %34
  %40 = phi i32 [ %37, %38 ], [ %35, %34 ]
  %41 = getelementptr inbounds i8, ptr %0, i64 252
  store i32 %40, ptr %41, align 4, !tbaa !23
  %42 = getelementptr inbounds i8, ptr %0, i64 276
  %43 = getelementptr inbounds i8, ptr %0, i64 280
  store i32 0, ptr %42, align 4, !tbaa !24
  %44 = load i32, ptr %43, align 8, !tbaa !25
  %45 = icmp sgt i32 %44, 0
  br i1 %45, label %.lr.ph49, label %._crit_edge50

.lr.ph49:                                         ; preds = %39
  %46 = getelementptr inbounds i8, ptr %0, i64 288
  br label %47

47:                                               ; preds = %.lr.ph49, %47
  %storemerge4547 = phi i32 [ 0, %.lr.ph49 ], [ %62, %47 ]
  %48 = load ptr, ptr %46, align 8, !tbaa !26
  %49 = sext i32 %storemerge4547 to i64
  %50 = getelementptr inbounds ptr, ptr %48, i64 %49
  %51 = load ptr, ptr %50, align 8, !tbaa !27
  %52 = load i32, ptr %29, align 8, !tbaa !20
  %53 = getelementptr inbounds i8, ptr %51, i64 8
  %54 = load i32, ptr %53, align 8, !tbaa !28
  %55 = and i32 %54, 4
  %.not46 = icmp eq i32 %55, 0
  %56 = select i1 %.not46, i32 3, i32 2
  %57 = shl i32 %52, %56
  %58 = zext i32 %57 to i64
  %59 = tail call noalias ptr @malloc(i64 noundef %58) #4
  %60 = getelementptr inbounds i8, ptr %51, i64 120
  store ptr %59, ptr %60, align 8, !tbaa !38
  tail call void @pack_init(ptr noundef nonnull %0) #5
  %61 = load i32, ptr %42, align 4, !tbaa !24
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %42, align 4, !tbaa !24
  %63 = load i32, ptr %43, align 8, !tbaa !25
  %64 = icmp slt i32 %62, %63
  br i1 %64, label %47, label %._crit_edge50, !llvm.loop !39

._crit_edge50:                                    ; preds = %47, %39
  ret i32 1
}

; Function Attrs: nounwind uwtable
declare hidden i32 @write_metadata_block(ptr noundef) local_unnamed_addr #1

declare void @pack_init(ptr noundef) local_unnamed_addr #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #3

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) 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 #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 = { "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind allocsize(0) }
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, !11, i64 48}
!6 = !{!"WavpackContext", !7, i64 0, !12, i64 88, !11, i64 96, !11, i64 100, !12, i64 104, !11, i64 112, !12, i64 120, !12, i64 128, !12, i64 136, !12, i64 144, !12, i64 152, !12, i64 160, !13, i64 168, !13, i64 176, !13, i64 184, !13, i64 192, !13, i64 200, !13, i64 208, !11, i64 216, !11, i64 220, !11, i64 224, !11, i64 228, !11, i64 232, !11, i64 236, !11, i64 240, !11, i64 244, !11, i64 248, !11, i64 252, !11, i64 256, !11, i64 260, !11, i64 264, !11, i64 268, !11, i64 272, !11, i64 276, !11, i64 280, !11, i64 284, !12, i64 288, !12, i64 296, !9, i64 304, !12, i64 312, !12, i64 320, !11, i64 328, !11, i64 332, !12, i64 336, !9, i64 344, !12, i64 352, !9, i64 360}
!7 = !{!"", !8, i64 0, !8, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !9, i64 56, !9, i64 72, !11, i64 76, !12, i64 80}
!8 = !{!"float", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!"any pointer", !9, i64 0}
!13 = !{!"long", !9, i64 0}
!14 = !{!6, !11, i64 96}
!15 = !{!6, !11, i64 332}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!6, !11, i64 28}
!19 = distinct !{!19, !17}
!20 = !{!6, !11, i64 248}
!21 = distinct !{!21, !17}
!22 = !{!6, !11, i64 36}
!23 = !{!6, !11, i64 252}
!24 = !{!6, !11, i64 276}
!25 = !{!6, !11, i64 280}
!26 = !{!6, !12, i64 288}
!27 = !{!12, !12, i64 0}
!28 = !{!29, !11, i64 8}
!29 = !{!"", !30, i64 0, !32, i64 12, !12, i64 88, !12, i64 96, !12, i64 104, !12, i64 112, !12, i64 120, !13, i64 128, !13, i64 136, !11, i64 144, !11, i64 148, !11, i64 152, !9, i64 156, !9, i64 157, !9, i64 158, !9, i64 159, !9, i64 160, !9, i64 161, !9, i64 162, !11, i64 164, !11, i64 168, !11, i64 172, !11, i64 176, !11, i64 180, !11, i64 184, !11, i64 188, !11, i64 192, !33, i64 200, !33, i64 248, !33, i64 296, !8, i64 344, !9, i64 348, !9, i64 349, !9, i64 350, !9, i64 351, !9, i64 352, !9, i64 353, !9, i64 354, !9, i64 355, !34, i64 360, !9, i64 432, !36, i64 1968, !12, i64 2064, !37, i64 2072}
!30 = !{!"", !9, i64 0, !31, i64 4, !31, i64 6, !11, i64 8}
!31 = !{!"short", !9, i64 0}
!32 = !{!"words_data", !9, i64 0, !9, i64 8, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !9, i64 36}
!33 = !{!"bs", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !11, i64 32, !11, i64 36, !11, i64 40}
!34 = !{!"", !9, i64 0, !9, i64 8, !9, i64 16, !35, i64 24, !35, i64 32, !35, i64 40, !12, i64 48, !12, i64 56, !11, i64 64}
!35 = !{!"double", !9, i64 0}
!36 = !{!"decorr_pass", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !9, i64 16, !9, i64 48, !11, i64 80, !11, i64 84, !11, i64 88, !11, i64 92}
!37 = !{!"", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !9, i64 40, !9, i64 41, !11, i64 44, !11, i64 48, !11, i64 52, !12, i64 56, !11, i64 64, !11, i64 68, !11, i64 72, !9, i64 76, !12, i64 160}
!38 = !{!29, !12, i64 120}
!39 = distinct !{!39, !17}


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