; LLVM IR from dbry/wavpack-stream :: src (open_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.WavpackHeader = type { [4 x i8], i16, i16, i32 }
%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.WavpackReader64 = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, 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.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: nounwind uwtable
declare dso_local i32 @read_next_header(ptr noundef, ptr noundef, ptr noundef) #2

; 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) #3

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

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

; 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 @read_wvc_block(ptr noundef %0) #2 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca %struct.WavpackHeader, align 4
  %8 = alloca %struct.WavpackHeader, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.WavpackContext, ptr %11, i32 0, i32 36
  %13 = load ptr, ptr %12, align 8, !tbaa !9
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.WavpackContext, ptr %14, i32 0, i32 33
  %16 = load i32, ptr %15, align 4, !tbaa !15
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds ptr, ptr %13, i64 %17
  %19 = load ptr, ptr %18, align 8, !tbaa !5
  store ptr %19, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 12, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 12, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  br label %20

20:                                               ; preds = %177, %1
  br label %21

21:                                               ; preds = %20
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.WavpackContext, ptr %22, i32 0, i32 9
  %24 = load ptr, ptr %23, align 8, !tbaa !16
  %25 = getelementptr inbounds %struct.WavpackReader64, ptr %24, i32 0, i32 2
  %26 = load ptr, ptr %25, align 8, !tbaa !17
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.WavpackContext, ptr %27, i32 0, i32 11
  %29 = load ptr, ptr %28, align 8, !tbaa !19
  %30 = call i64 %26(ptr noundef %29)
  store i64 %30, ptr %6, align 8, !tbaa !20
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.WavpackContext, ptr %31, i32 0, i32 9
  %33 = load ptr, ptr %32, align 8, !tbaa !16
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.WavpackContext, ptr %34, i32 0, i32 11
  %36 = load ptr, ptr %35, align 8, !tbaa !19
  %37 = call i32 @read_next_header(ptr noundef %33, ptr noundef %36, ptr noundef %8)
  %38 = zext i32 %37 to i64
  store i64 %38, ptr %5, align 8, !tbaa !20
  %39 = load i64, ptr %5, align 8, !tbaa !20
  %40 = icmp eq i64 %39, 4294967295
  br i1 %40, label %41, label %48

41:                                               ; preds = %21
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.WavpackStream, ptr %42, i32 0, i32 16
  store i8 1, ptr %43, align 8, !tbaa !21
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.WavpackContext, ptr %44, i32 0, i32 18
  %46 = load i32, ptr %45, align 8, !tbaa !31
  %47 = add i32 %46, 1
  store i32 %47, ptr %45, align 8, !tbaa !31
  store i32 0, ptr %2, align 4
  store i32 1, ptr %10, align 4
  br label %178

48:                                               ; preds = %21
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %7, ptr align 4 %8, i64 12, i1 false)
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.WavpackStream, ptr %49, i32 0, i32 7
  %51 = load i64, ptr %50, align 8, !tbaa !32
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.WavpackStream, ptr %52, i32 0, i32 8
  store i64 %51, ptr %53, align 8, !tbaa !33
  %54 = getelementptr inbounds %struct.WavpackHeader, ptr %8, i32 0, i32 3
  %55 = load i32, ptr %54, align 4, !tbaa !34
  %56 = and i32 %55, 2048
  %57 = icmp ne i32 %56, 0
  br i1 %57, label %58, label %64

58:                                               ; preds = %48
  %59 = load i64, ptr %6, align 8, !tbaa !20
  %60 = load i64, ptr %5, align 8, !tbaa !20
  %61 = add nsw i64 %59, %60
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.WavpackContext, ptr %62, i32 0, i32 15
  store i64 %61, ptr %63, align 8, !tbaa !35
  br label %64

64:                                               ; preds = %58, %48
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.WavpackStream, ptr %65, i32 0, i32 0
  %67 = call i32 @match_wvc_header(ptr noundef %66, ptr noundef %8)
  store i32 %67, ptr %9, align 4, !tbaa !36
  %68 = load i32, ptr %9, align 4, !tbaa !36
  %69 = icmp ne i32 %68, 0
  br i1 %69, label %157, label %70

70:                                               ; preds = %64
  %71 = getelementptr inbounds %struct.WavpackHeader, ptr %8, i32 0, i32 1
  %72 = load i16, ptr %71, align 4, !tbaa !37
  %73 = zext i16 %72 to i32
  %74 = add nsw i32 %73, 6
  %75 = sext i32 %74 to i64
  %76 = call noalias ptr @malloc(i64 noundef %75) #6
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.WavpackStream, ptr %77, i32 0, i32 4
  store ptr %76, ptr %78, align 8, !tbaa !38
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.WavpackStream, ptr %79, i32 0, i32 4
  %81 = load ptr, ptr %80, align 8, !tbaa !38
  %82 = icmp ne ptr %81, null
  br i1 %82, label %84, label %83

83:                                               ; preds = %70
  store i32 0, ptr %2, align 4
  store i32 1, ptr %10, align 4
  br label %178

84:                                               ; preds = %70
  %85 = load ptr, ptr %3, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.WavpackContext, ptr %85, i32 0, i32 9
  %87 = load ptr, ptr %86, align 8, !tbaa !16
  %88 = getelementptr inbounds %struct.WavpackReader64, ptr %87, i32 0, i32 0
  %89 = load ptr, ptr %88, align 8, !tbaa !39
  %90 = load ptr, ptr %3, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.WavpackContext, ptr %90, i32 0, i32 11
  %92 = load ptr, ptr %91, align 8, !tbaa !19
  %93 = load ptr, ptr %4, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.WavpackStream, ptr %93, i32 0, i32 4
  %95 = load ptr, ptr %94, align 8, !tbaa !38
  %96 = getelementptr inbounds i8, ptr %95, i64 12
  %97 = getelementptr inbounds %struct.WavpackHeader, ptr %8, i32 0, i32 1
  %98 = load i16, ptr %97, align 4, !tbaa !37
  %99 = zext i16 %98 to i64
  %100 = sub i64 %99, 6
  %101 = trunc i64 %100 to i32
  %102 = call i32 %89(ptr noundef %92, ptr noundef %96, i32 noundef %101)
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds %struct.WavpackHeader, ptr %8, i32 0, i32 1
  %105 = load i16, ptr %104, align 4, !tbaa !37
  %106 = zext i16 %105 to i64
  %107 = sub i64 %106, 6
  %108 = icmp ne i64 %103, %107
  br i1 %108, label %109, label %121

109:                                              ; preds = %84
  %110 = load ptr, ptr %4, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.WavpackStream, ptr %110, i32 0, i32 4
  %112 = load ptr, ptr %111, align 8, !tbaa !38
  call void @free(ptr noundef %112) #5
  %113 = load ptr, ptr %4, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.WavpackStream, ptr %113, i32 0, i32 4
  store ptr null, ptr %114, align 8, !tbaa !38
  %115 = load ptr, ptr %4, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.WavpackStream, ptr %115, i32 0, i32 16
  store i8 1, ptr %116, align 8, !tbaa !21
  %117 = load ptr, ptr %3, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.WavpackContext, ptr %117, i32 0, i32 18
  %119 = load i32, ptr %118, align 8, !tbaa !31
  %120 = add i32 %119, 1
  store i32 %120, ptr %118, align 8, !tbaa !31
  store i32 0, ptr %2, align 4
  store i32 1, ptr %10, align 4
  br label %178

121:                                              ; preds = %84
  %122 = load ptr, ptr %4, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.WavpackStream, ptr %122, i32 0, i32 4
  %124 = load ptr, ptr %123, align 8, !tbaa !38
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %124, ptr align 4 %7, i64 12, i1 false)
  %125 = load ptr, ptr %4, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.WavpackStream, ptr %125, i32 0, i32 4
  %127 = load ptr, ptr %126, align 8, !tbaa !38
  %128 = load ptr, ptr %3, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.WavpackContext, ptr %128, i32 0, i32 21
  %130 = load i32, ptr %129, align 4, !tbaa !40
  %131 = and i32 %130, 2048
  %132 = icmp ne i32 %131, 0
  %133 = xor i1 %132, true
  %134 = zext i1 %133 to i32
  %135 = call i32 @WavpackStreamVerifySingleBlock(ptr noundef %127, i32 noundef %134)
  %136 = icmp ne i32 %135, 0
  br i1 %136, label %149, label %137

137:                                              ; preds = %121
  %138 = load ptr, ptr %4, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.WavpackStream, ptr %138, i32 0, i32 4
  %140 = load ptr, ptr %139, align 8, !tbaa !38
  call void @free(ptr noundef %140) #5
  %141 = load ptr, ptr %4, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.WavpackStream, ptr %141, i32 0, i32 4
  store ptr null, ptr %142, align 8, !tbaa !38
  %143 = load ptr, ptr %4, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.WavpackStream, ptr %143, i32 0, i32 16
  store i8 1, ptr %144, align 8, !tbaa !21
  %145 = load ptr, ptr %3, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.WavpackContext, ptr %145, i32 0, i32 18
  %147 = load i32, ptr %146, align 8, !tbaa !31
  %148 = add i32 %147, 1
  store i32 %148, ptr %146, align 8, !tbaa !31
  store i32 1, ptr %2, align 4
  store i32 1, ptr %10, align 4
  br label %178

149:                                              ; preds = %121
  %150 = load ptr, ptr %4, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.WavpackStream, ptr %150, i32 0, i32 16
  store i8 0, ptr %151, align 8, !tbaa !21
  %152 = load ptr, ptr %4, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.WavpackStream, ptr %152, i32 0, i32 4
  %154 = load ptr, ptr %153, align 8, !tbaa !38
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %154, ptr align 4 %8, i64 12, i1 false)
  %155 = load ptr, ptr %4, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.WavpackStream, ptr %155, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %156, ptr align 4 %8, i64 12, i1 false)
  store i32 1, ptr %2, align 4
  store i32 1, ptr %10, align 4
  br label %178

157:                                              ; preds = %64
  %158 = load i32, ptr %9, align 4, !tbaa !36
  %159 = icmp eq i32 %158, -1
  br i1 %159, label %160, label %176

160:                                              ; preds = %157
  %161 = load ptr, ptr %4, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.WavpackStream, ptr %161, i32 0, i32 16
  store i8 1, ptr %162, align 8, !tbaa !21
  %163 = load ptr, ptr %3, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.WavpackContext, ptr %163, i32 0, i32 9
  %165 = load ptr, ptr %164, align 8, !tbaa !16
  %166 = getelementptr inbounds %struct.WavpackReader64, ptr %165, i32 0, i32 4
  %167 = load ptr, ptr %166, align 8, !tbaa !41
  %168 = load ptr, ptr %3, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.WavpackContext, ptr %168, i32 0, i32 11
  %170 = load ptr, ptr %169, align 8, !tbaa !19
  %171 = call i32 %167(ptr noundef %170, i64 noundef -12, i32 noundef 1)
  %172 = load ptr, ptr %3, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.WavpackContext, ptr %172, i32 0, i32 18
  %174 = load i32, ptr %173, align 8, !tbaa !31
  %175 = add i32 %174, 1
  store i32 %175, ptr %173, align 8, !tbaa !31
  store i32 1, ptr %2, align 4
  store i32 1, ptr %10, align 4
  br label %178

176:                                              ; preds = %157
  br label %177

177:                                              ; preds = %176
  br label %20

178:                                              ; preds = %160, %149, %137, %109, %83, %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  %179 = load i32, ptr %2, align 4
  ret i32 %179
}

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

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { nounwind }
attributes #6 = { 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, !6, i64 288}
!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 = !{!10, !13, i64 276}
!16 = !{!10, !6, i64 144}
!17 = !{!18, !6, i64 16}
!18 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72}
!19 = !{!10, !6, i64 160}
!20 = !{!14, !14, i64 0}
!21 = !{!22, !7, i64 160}
!22 = !{!"", !23, i64 0, !25, 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, !26, i64 200, !26, i64 248, !26, 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, !27, i64 360, !7, i64 432, !29, i64 1968, !6, i64 2064, !30, i64 2072}
!23 = !{!"", !7, i64 0, !24, i64 4, !24, i64 6, !13, i64 8}
!24 = !{!"short", !7, i64 0}
!25 = !{!"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}
!26 = !{!"bs", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !13, i64 32, !13, i64 36, !13, i64 40}
!27 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16, !28, i64 24, !28, i64 32, !28, i64 40, !6, i64 48, !6, i64 56, !13, i64 64}
!28 = !{!"double", !7, i64 0}
!29 = !{!"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}
!30 = !{!"", !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}
!31 = !{!10, !13, i64 216}
!32 = !{!22, !14, i64 128}
!33 = !{!22, !14, i64 136}
!34 = !{!23, !13, i64 8}
!35 = !{!10, !14, i64 192}
!36 = !{!13, !13, i64 0}
!37 = !{!23, !24, i64 4}
!38 = !{!22, !6, i64 104}
!39 = !{!18, !6, i64 0}
!40 = !{!10, !13, i64 228}
!41 = !{!18, !6, i64 32}


; 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.WavpackHeader = type { [4 x i8], i16, i16, i32 }

; 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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @read_next_header(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress 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) #3

; Function Attrs: nounwind uwtable
declare dso_local i32 @WavpackStreamVerifySingleBlock(ptr noundef, i32 noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress 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 range(i32 0, 2) i32 @read_wvc_block(ptr nocapture noundef %0) local_unnamed_addr #2 {
  %2 = alloca %struct.WavpackHeader, align 4
  %3 = alloca %struct.WavpackHeader, align 4
  %4 = getelementptr inbounds i8, ptr %0, i64 288
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 276
  %7 = load i32, ptr %6, align 4, !tbaa !14
  %8 = sext i32 %7 to i64
  %9 = getelementptr inbounds ptr, ptr %5, i64 %8
  %10 = load ptr, ptr %9, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %2)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %3) #5
  %11 = getelementptr inbounds i8, ptr %0, i64 144
  %12 = getelementptr inbounds i8, ptr %0, i64 160
  %13 = getelementptr inbounds i8, ptr %10, i64 128
  %14 = getelementptr inbounds i8, ptr %10, i64 136
  %15 = getelementptr inbounds i8, ptr %3, i64 8
  %16 = getelementptr inbounds i8, ptr %0, i64 192
  br label %17

17:                                               ; preds = %39, %1
  %18 = load ptr, ptr %11, align 8, !tbaa !16
  %19 = getelementptr inbounds i8, ptr %18, i64 16
  %20 = load ptr, ptr %19, align 8, !tbaa !17
  %21 = load ptr, ptr %12, align 8, !tbaa !19
  %22 = call i64 %20(ptr noundef %21) #5
  %23 = load ptr, ptr %11, align 8, !tbaa !16
  %24 = load ptr, ptr %12, align 8, !tbaa !19
  %25 = call i32 @read_next_header(ptr noundef %23, ptr noundef %24, ptr noundef nonnull %3)
  %26 = zext i32 %25 to i64
  %27 = icmp eq i32 %25, -1
  br i1 %27, label %28, label %33

28:                                               ; preds = %17
  %29 = getelementptr inbounds i8, ptr %10, i64 160
  store i8 1, ptr %29, align 8, !tbaa !20
  %30 = getelementptr inbounds i8, ptr %0, i64 216
  %31 = load i32, ptr %30, align 8, !tbaa !30
  %32 = add i32 %31, 1
  store i32 %32, ptr %30, align 8, !tbaa !30
  br label %92

33:                                               ; preds = %17
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %2, ptr noundef nonnull align 4 dereferenceable(12) %3, i64 12, i1 false)
  %34 = load i64, ptr %13, align 8, !tbaa !31
  store i64 %34, ptr %14, align 8, !tbaa !32
  %35 = load i32, ptr %15, align 4, !tbaa !33
  %36 = and i32 %35, 2048
  %.not = icmp eq i32 %36, 0
  br i1 %.not, label %39, label %37

37:                                               ; preds = %33
  %38 = add nsw i64 %22, %26
  store i64 %38, ptr %16, align 8, !tbaa !34
  br label %39

39:                                               ; preds = %37, %33
  %40 = call i32 @match_wvc_header(ptr noundef nonnull %10, ptr noundef nonnull %3)
  switch i32 %40, label %17 [
    i32 0, label %41
    i32 -1, label %82
  ]

41:                                               ; preds = %39
  %42 = getelementptr inbounds i8, ptr %3, i64 4
  %43 = load i16, ptr %42, align 4, !tbaa !35
  %44 = zext i16 %43 to i64
  %45 = add nuw nsw i64 %44, 6
  %46 = call noalias ptr @malloc(i64 noundef %45) #6
  %47 = getelementptr inbounds i8, ptr %10, i64 104
  store ptr %46, ptr %47, align 8, !tbaa !36
  %.not44 = icmp eq ptr %46, null
  br i1 %.not44, label %92, label %48

48:                                               ; preds = %41
  %49 = load ptr, ptr %11, align 8, !tbaa !16
  %50 = load ptr, ptr %49, align 8, !tbaa !37
  %51 = load ptr, ptr %12, align 8, !tbaa !19
  %52 = getelementptr inbounds i8, ptr %46, i64 12
  %53 = zext i16 %43 to i32
  %54 = add nsw i32 %53, -6
  %55 = call i32 %50(ptr noundef %51, ptr noundef nonnull %52, i32 noundef %54) #5
  %56 = sext i32 %55 to i64
  %57 = load i16, ptr %42, align 4, !tbaa !35
  %58 = zext i16 %57 to i64
  %59 = add nsw i64 %58, -6
  %.not45 = icmp eq i64 %59, %56
  %60 = load ptr, ptr %47, align 8, !tbaa !36
  br i1 %.not45, label %66, label %61

61:                                               ; preds = %48
  call void @free(ptr noundef %60) #5
  store ptr null, ptr %47, align 8, !tbaa !36
  %62 = getelementptr inbounds i8, ptr %10, i64 160
  store i8 1, ptr %62, align 8, !tbaa !20
  %63 = getelementptr inbounds i8, ptr %0, i64 216
  %64 = load i32, ptr %63, align 8, !tbaa !30
  %65 = add i32 %64, 1
  store i32 %65, ptr %63, align 8, !tbaa !30
  br label %92

66:                                               ; preds = %48
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(12) %60, ptr noundef nonnull align 4 dereferenceable(12) %2, i64 12, i1 false)
  %67 = load ptr, ptr %47, align 8, !tbaa !36
  %68 = getelementptr inbounds i8, ptr %0, i64 228
  %69 = load i32, ptr %68, align 4, !tbaa !38
  %70 = lshr i32 %69, 11
  %.lobit = and i32 %70, 1
  %71 = xor i32 %.lobit, 1
  %72 = call i32 @WavpackStreamVerifySingleBlock(ptr noundef %67, i32 noundef %71)
  %.not47 = icmp eq i32 %72, 0
  br i1 %.not47, label %73, label %79

73:                                               ; preds = %66
  %74 = load ptr, ptr %47, align 8, !tbaa !36
  call void @free(ptr noundef %74) #5
  store ptr null, ptr %47, align 8, !tbaa !36
  %75 = getelementptr inbounds i8, ptr %10, i64 160
  store i8 1, ptr %75, align 8, !tbaa !20
  %76 = getelementptr inbounds i8, ptr %0, i64 216
  %77 = load i32, ptr %76, align 8, !tbaa !30
  %78 = add i32 %77, 1
  store i32 %78, ptr %76, align 8, !tbaa !30
  br label %92

79:                                               ; preds = %66
  %80 = getelementptr inbounds i8, ptr %10, i64 160
  store i8 0, ptr %80, align 8, !tbaa !20
  %81 = load ptr, ptr %47, align 8, !tbaa !36
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(12) %81, ptr noundef nonnull align 4 dereferenceable(12) %3, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(12) %10, ptr noundef nonnull align 4 dereferenceable(12) %3, i64 12, i1 false)
  br label %92

82:                                               ; preds = %39
  %83 = getelementptr inbounds i8, ptr %10, i64 160
  store i8 1, ptr %83, align 8, !tbaa !20
  %84 = load ptr, ptr %11, align 8, !tbaa !16
  %85 = getelementptr inbounds i8, ptr %84, i64 32
  %86 = load ptr, ptr %85, align 8, !tbaa !39
  %87 = load ptr, ptr %12, align 8, !tbaa !19
  %88 = call i32 %86(ptr noundef %87, i64 noundef -12, i32 noundef 1) #5
  %89 = getelementptr inbounds i8, ptr %0, i64 216
  %90 = load i32, ptr %89, align 8, !tbaa !30
  %91 = add i32 %90, 1
  store i32 %91, ptr %89, align 8, !tbaa !30
  br label %92

92:                                               ; preds = %41, %82, %79, %73, %61, %28
  %.0 = phi i32 [ 0, %28 ], [ 1, %82 ], [ 0, %61 ], [ 1, %79 ], [ 1, %73 ], [ 0, %41 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %2)
  ret i32 %.0
}

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { 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, !12, i64 288}
!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 276}
!15 = !{!12, !12, i64 0}
!16 = !{!6, !12, i64 144}
!17 = !{!18, !12, i64 16}
!18 = !{!"", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !12, i64 72}
!19 = !{!6, !12, i64 160}
!20 = !{!21, !9, i64 160}
!21 = !{!"", !22, i64 0, !24, 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, !25, i64 200, !25, i64 248, !25, 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, !26, i64 360, !9, i64 432, !28, i64 1968, !12, i64 2064, !29, i64 2072}
!22 = !{!"", !9, i64 0, !23, i64 4, !23, i64 6, !11, i64 8}
!23 = !{!"short", !9, i64 0}
!24 = !{!"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}
!25 = !{!"bs", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !11, i64 32, !11, i64 36, !11, i64 40}
!26 = !{!"", !9, i64 0, !9, i64 8, !9, i64 16, !27, i64 24, !27, i64 32, !27, i64 40, !12, i64 48, !12, i64 56, !11, i64 64}
!27 = !{!"double", !9, i64 0}
!28 = !{!"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}
!29 = !{!"", !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}
!30 = !{!6, !11, i64 216}
!31 = !{!21, !13, i64 128}
!32 = !{!21, !13, i64 136}
!33 = !{!22, !11, i64 8}
!34 = !{!6, !13, i64 192}
!35 = !{!22, !23, i64 4}
!36 = !{!21, !12, i64 104}
!37 = !{!18, !12, i64 0}
!38 = !{!6, !11, i64 228}
!39 = !{!18, !12, i64 32}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LICMPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass