; LLVM IR from dbry/wavpack-stream :: cli (caff)

; 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.CAFChunkHeader = type <{ [4 x i8], i64 }>
%struct.CAFChannelLayout = type { i32, i32, i32 }
%struct.CAFAudioFormat = type { double, [4 x i8], i32, i32, i32, i32, i32 }
%struct.CAFFileHeader = type { [4 x i8], i16, i16 }
%struct.CAFChannelDescription = type { i32, i32, [3 x float] }

@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1
@debug_logging_mode = external global i32, align 4
@.str.10 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.44 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.45 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [2 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

declare void @error_line(ptr noundef, ...) #2

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

; Function Attrs: nounwind uwtable
define dso_local i32 @WriteCaffHeader(ptr noundef %0, ptr noundef %1, i64 noundef %2, i32 noundef %3) #6 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca %struct.CAFChunkHeader, align 4
  %11 = alloca %struct.CAFChunkHeader, align 4
  %12 = alloca %struct.CAFChunkHeader, align 4
  %13 = alloca %struct.CAFChannelLayout, align 4
  %14 = alloca %struct.CAFAudioFormat, align 8
  %15 = alloca %struct.CAFFileHeader, align 2
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca ptr, align 8
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  %30 = alloca i32, align 4
  %31 = alloca %struct.CAFChannelDescription, align 4
  %32 = alloca ptr, align 8
  %33 = alloca i32, align 4
  %34 = alloca i8, align 1
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i64 %2, ptr %8, align 8, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 12, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 12, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 12, ptr %12) #7
  call void @llvm.lifetime.start.p0(i64 12, ptr %13) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr %14) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = call i32 @WavpackStreamGetNumChannels(ptr noundef %35)
  store i32 %36, ptr %18, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = call i32 @WavpackStreamGetChannelMask(ptr noundef %37)
  store i32 %38, ptr %19, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = call i32 @WavpackStreamGetSampleRate(ptr noundef %39)
  store i32 %40, ptr %20, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = call i32 @WavpackStreamGetBytesPerSample(ptr noundef %41)
  store i32 %42, ptr %21, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  %43 = load ptr, ptr %7, align 8, !tbaa !5
  %44 = call i32 @WavpackStreamGetBitsPerSample(ptr noundef %43)
  store i32 %44, ptr %22, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #7
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = call i32 @WavpackStreamGetFloatNormExp(ptr noundef %45)
  store i32 %46, ptr %23, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #7
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = call i32 @WavpackStreamGetChannelLayout(ptr noundef %47, ptr noundef null)
  store i32 %48, ptr %24, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #7
  %49 = load i32, ptr %18, align 4, !tbaa !11
  %50 = add nsw i32 %49, 1
  %51 = sext i32 %50 to i64
  %52 = call noalias ptr @malloc(i64 noundef %51) #8
  store ptr %52, ptr %25, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #7
  %53 = load i32, ptr %23, align 4, !tbaa !11
  %54 = icmp ne i32 %53, 0
  br i1 %54, label %55, label %60

55:                                               ; preds = %4
  %56 = load i32, ptr %23, align 4, !tbaa !11
  %57 = icmp ne i32 %56, 127
  br i1 %57, label %58, label %60

58:                                               ; preds = %55
  call void (ptr, ...) @error_line(ptr noundef @.str.41)
  %59 = load ptr, ptr %25, align 8, !tbaa !5
  call void @free(ptr noundef %59) #7
  store i32 0, ptr %5, align 4
  store i32 1, ptr %28, align 4
  br label %444

60:                                               ; preds = %55, %4
  %61 = load ptr, ptr %7, align 8, !tbaa !5
  %62 = load ptr, ptr %25, align 8, !tbaa !5
  call void @WavpackStreamGetChannelIdentities(ptr noundef %61, ptr noundef %62)
  store i32 0, ptr %27, align 4, !tbaa !11
  store i32 0, ptr %26, align 4, !tbaa !11
  br label %63

63:                                               ; preds = %79, %60
  %64 = load i32, ptr %27, align 4, !tbaa !11
  %65 = load i32, ptr %18, align 4, !tbaa !11
  %66 = icmp slt i32 %64, %65
  br i1 %66, label %67, label %82

67:                                               ; preds = %63
  %68 = load ptr, ptr %25, align 8, !tbaa !5
  %69 = load i32, ptr %27, align 4, !tbaa !11
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds i8, ptr %68, i64 %70
  %72 = load i8, ptr %71, align 1, !tbaa !13
  %73 = zext i8 %72 to i32
  %74 = icmp ne i32 %73, 255
  br i1 %74, label %75, label %78

75:                                               ; preds = %67
  %76 = load i32, ptr %26, align 4, !tbaa !11
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %26, align 4, !tbaa !11
  br label %78

78:                                               ; preds = %75, %67
  br label %79

79:                                               ; preds = %78
  %80 = load i32, ptr %27, align 4, !tbaa !11
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr %27, align 4, !tbaa !11
  br label %63, !llvm.loop !14

82:                                               ; preds = %63
  %83 = getelementptr inbounds %struct.CAFFileHeader, ptr %15, i32 0, i32 0
  %84 = getelementptr inbounds [4 x i8], ptr %83, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %84, ptr align 1 @.str.42, i64 4, i1 false)
  %85 = getelementptr inbounds %struct.CAFFileHeader, ptr %15, i32 0, i32 1
  store i16 1, ptr %85, align 2, !tbaa !16
  %86 = getelementptr inbounds %struct.CAFFileHeader, ptr %15, i32 0, i32 2
  store i16 0, ptr %86, align 2, !tbaa !19
  call void @WavpackStreamNativeToBigEndian(ptr noundef %15, ptr noundef @.str.2)
  %87 = load ptr, ptr %6, align 8, !tbaa !5
  %88 = call i32 @DoWriteFile(ptr noundef %87, ptr noundef %15, i32 noundef 8, ptr noundef %17)
  %89 = icmp ne i32 %88, 0
  br i1 %89, label %90, label %94

90:                                               ; preds = %82
  %91 = load i32, ptr %17, align 4, !tbaa !11
  %92 = zext i32 %91 to i64
  %93 = icmp ne i64 %92, 8
  br i1 %93, label %94, label %95

94:                                               ; preds = %90, %82
  store i32 0, ptr %5, align 4
  store i32 1, ptr %28, align 4
  br label %444

95:                                               ; preds = %90
  %96 = getelementptr inbounds %struct.CAFChunkHeader, ptr %10, i32 0, i32 0
  %97 = getelementptr inbounds [4 x i8], ptr %96, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %97, ptr align 1 @.str.5, i64 4, i1 false)
  %98 = getelementptr inbounds %struct.CAFChunkHeader, ptr %10, i32 0, i32 1
  store i64 32, ptr %98, align 4, !tbaa !20
  call void @WavpackStreamNativeToBigEndian(ptr noundef %10, ptr noundef @.str.4)
  %99 = load ptr, ptr %6, align 8, !tbaa !5
  %100 = call i32 @DoWriteFile(ptr noundef %99, ptr noundef %10, i32 noundef 12, ptr noundef %17)
  %101 = icmp ne i32 %100, 0
  br i1 %101, label %102, label %106

102:                                              ; preds = %95
  %103 = load i32, ptr %17, align 4, !tbaa !11
  %104 = zext i32 %103 to i64
  %105 = icmp ne i64 %104, 12
  br i1 %105, label %106, label %107

106:                                              ; preds = %102, %95
  store i32 0, ptr %5, align 4
  store i32 1, ptr %28, align 4
  br label %444

107:                                              ; preds = %102
  %108 = load i32, ptr %20, align 4, !tbaa !11
  %109 = sitofp i32 %108 to double
  %110 = getelementptr inbounds %struct.CAFAudioFormat, ptr %14, i32 0, i32 0
  store double %109, ptr %110, align 8, !tbaa !22
  %111 = getelementptr inbounds %struct.CAFAudioFormat, ptr %14, i32 0, i32 1
  %112 = getelementptr inbounds [4 x i8], ptr %111, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %112, ptr align 1 @.str.10, i64 4, i1 false)
  %113 = load i32, ptr %23, align 4, !tbaa !11
  %114 = icmp ne i32 %113, 0
  %115 = zext i1 %114 to i64
  %116 = select i1 %114, i32 1, i32 0
  %117 = getelementptr inbounds %struct.CAFAudioFormat, ptr %14, i32 0, i32 2
  store i32 %116, ptr %117, align 4, !tbaa !25
  %118 = load i32, ptr %9, align 4, !tbaa !11
  %119 = and i32 %118, 1
  %120 = icmp ne i32 %119, 0
  br i1 %120, label %125, label %121

121:                                              ; preds = %107
  %122 = getelementptr inbounds %struct.CAFAudioFormat, ptr %14, i32 0, i32 2
  %123 = load i32, ptr %122, align 4, !tbaa !25
  %124 = or i32 %123, 2
  store i32 %124, ptr %122, align 4, !tbaa !25
  br label %125

125:                                              ; preds = %121, %107
  %126 = load i32, ptr %21, align 4, !tbaa !11
  %127 = load i32, ptr %18, align 4, !tbaa !11
  %128 = mul nsw i32 %126, %127
  %129 = getelementptr inbounds %struct.CAFAudioFormat, ptr %14, i32 0, i32 3
  store i32 %128, ptr %129, align 8, !tbaa !26
  %130 = getelementptr inbounds %struct.CAFAudioFormat, ptr %14, i32 0, i32 4
  store i32 1, ptr %130, align 4, !tbaa !27
  %131 = load i32, ptr %18, align 4, !tbaa !11
  %132 = getelementptr inbounds %struct.CAFAudioFormat, ptr %14, i32 0, i32 5
  store i32 %131, ptr %132, align 8, !tbaa !28
  %133 = load i32, ptr %22, align 4, !tbaa !11
  %134 = getelementptr inbounds %struct.CAFAudioFormat, ptr %14, i32 0, i32 6
  store i32 %133, ptr %134, align 4, !tbaa !29
  call void @WavpackStreamNativeToBigEndian(ptr noundef %14, ptr noundef @.str.6)
  %135 = load ptr, ptr %6, align 8, !tbaa !5
  %136 = call i32 @DoWriteFile(ptr noundef %135, ptr noundef %14, i32 noundef 32, ptr noundef %17)
  %137 = icmp ne i32 %136, 0
  br i1 %137, label %138, label %142

138:                                              ; preds = %125
  %139 = load i32, ptr %17, align 4, !tbaa !11
  %140 = zext i32 %139 to i64
  %141 = icmp ne i64 %140, 32
  br i1 %141, label %142, label %143

142:                                              ; preds = %138, %125
  store i32 0, ptr %5, align 4
  store i32 1, ptr %28, align 4
  br label %444

143:                                              ; preds = %138
  %144 = load i32, ptr %24, align 4, !tbaa !11
  %145 = icmp ne i32 %144, 0
  br i1 %145, label %157, label %146

146:                                              ; preds = %143
  %147 = load i32, ptr %18, align 4, !tbaa !11
  %148 = icmp sgt i32 %147, 2
  br i1 %148, label %149, label %152

149:                                              ; preds = %146
  %150 = load i32, ptr %26, align 4, !tbaa !11
  %151 = icmp ne i32 %150, 0
  br i1 %151, label %157, label %407

152:                                              ; preds = %146
  %153 = load i32, ptr %19, align 4, !tbaa !11
  %154 = load i32, ptr %18, align 4, !tbaa !11
  %155 = sub nsw i32 5, %154
  %156 = icmp ne i32 %153, %155
  br i1 %156, label %157, label %407

157:                                              ; preds = %152, %149, %143
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #7
  store i32 0, ptr %29, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #7
  store i32 1, ptr %30, align 4, !tbaa !11
  br label %158

158:                                              ; preds = %170, %157
  %159 = load i32, ptr %30, align 4, !tbaa !11
  %160 = icmp ne i32 %159, 0
  br i1 %160, label %161, label %173

161:                                              ; preds = %158
  %162 = load i32, ptr %30, align 4, !tbaa !11
  %163 = load i32, ptr %19, align 4, !tbaa !11
  %164 = and i32 %162, %163
  %165 = icmp ne i32 %164, 0
  br i1 %165, label %166, label %169

166:                                              ; preds = %161
  %167 = load i32, ptr %29, align 4, !tbaa !11
  %168 = add i32 %167, 1
  store i32 %168, ptr %29, align 4, !tbaa !11
  br label %169

169:                                              ; preds = %166, %161
  br label %170

170:                                              ; preds = %169
  %171 = load i32, ptr %30, align 4, !tbaa !11
  %172 = shl i32 %171, 1
  store i32 %172, ptr %30, align 4, !tbaa !11
  br label %158, !llvm.loop !30

173:                                              ; preds = %158
  %174 = load i32, ptr %24, align 4, !tbaa !11
  %175 = and i32 %174, 16711680
  %176 = icmp ne i32 %175, 0
  br i1 %176, label %185, label %177

177:                                              ; preds = %173
  %178 = load i32, ptr %29, align 4, !tbaa !11
  %179 = load i32, ptr %18, align 4, !tbaa !11
  %180 = icmp eq i32 %178, %179
  br i1 %180, label %181, label %229

181:                                              ; preds = %177
  %182 = load i32, ptr %9, align 4, !tbaa !11
  %183 = and i32 %182, 8
  %184 = icmp ne i32 %183, 0
  br i1 %184, label %229, label %185

185:                                              ; preds = %181, %173
  %186 = getelementptr inbounds %struct.CAFChunkHeader, ptr %11, i32 0, i32 0
  %187 = getelementptr inbounds [4 x i8], ptr %186, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %187, ptr align 1 @.str.16, i64 4, i1 false)
  %188 = getelementptr inbounds %struct.CAFChunkHeader, ptr %11, i32 0, i32 1
  store i64 12, ptr %188, align 4, !tbaa !20
  call void @WavpackStreamNativeToBigEndian(ptr noundef %11, ptr noundef @.str.4)
  %189 = load ptr, ptr %6, align 8, !tbaa !5
  %190 = call i32 @DoWriteFile(ptr noundef %189, ptr noundef %11, i32 noundef 12, ptr noundef %17)
  %191 = icmp ne i32 %190, 0
  br i1 %191, label %192, label %196

192:                                              ; preds = %185
  %193 = load i32, ptr %17, align 4, !tbaa !11
  %194 = zext i32 %193 to i64
  %195 = icmp ne i64 %194, 12
  br i1 %195, label %196, label %197

196:                                              ; preds = %192, %185
  store i32 0, ptr %5, align 4
  store i32 1, ptr %28, align 4
  br label %404

197:                                              ; preds = %192
  %198 = load i32, ptr %24, align 4, !tbaa !11
  %199 = icmp ne i32 %198, 0
  br i1 %199, label %200, label %209

200:                                              ; preds = %197
  %201 = load i32, ptr @debug_logging_mode, align 4, !tbaa !11
  %202 = icmp ne i32 %201, 0
  br i1 %202, label %203, label %205

203:                                              ; preds = %200
  %204 = load i32, ptr %24, align 4, !tbaa !11
  call void (ptr, ...) @error_line(ptr noundef @.str.43, i32 noundef %204)
  br label %205

205:                                              ; preds = %203, %200
  %206 = load i32, ptr %24, align 4, !tbaa !11
  %207 = getelementptr inbounds %struct.CAFChannelLayout, ptr %13, i32 0, i32 0
  store i32 %206, ptr %207, align 4, !tbaa !31
  %208 = getelementptr inbounds %struct.CAFChannelLayout, ptr %13, i32 0, i32 1
  store i32 0, ptr %208, align 4, !tbaa !33
  br label %218

209:                                              ; preds = %197
  %210 = load i32, ptr @debug_logging_mode, align 4, !tbaa !11
  %211 = icmp ne i32 %210, 0
  br i1 %211, label %212, label %214

212:                                              ; preds = %209
  %213 = load i32, ptr %19, align 4, !tbaa !11
  call void (ptr, ...) @error_line(ptr noundef @.str.44, i32 noundef %213)
  br label %214

214:                                              ; preds = %212, %209
  %215 = getelementptr inbounds %struct.CAFChannelLayout, ptr %13, i32 0, i32 0
  store i32 65536, ptr %215, align 4, !tbaa !31
  %216 = load i32, ptr %19, align 4, !tbaa !11
  %217 = getelementptr inbounds %struct.CAFChannelLayout, ptr %13, i32 0, i32 1
  store i32 %216, ptr %217, align 4, !tbaa !33
  br label %218

218:                                              ; preds = %214, %205
  %219 = getelementptr inbounds %struct.CAFChannelLayout, ptr %13, i32 0, i32 2
  store i32 0, ptr %219, align 4, !tbaa !34
  call void @WavpackStreamNativeToBigEndian(ptr noundef %13, ptr noundef @.str.19)
  %220 = load ptr, ptr %6, align 8, !tbaa !5
  %221 = call i32 @DoWriteFile(ptr noundef %220, ptr noundef %13, i32 noundef 12, ptr noundef %17)
  %222 = icmp ne i32 %221, 0
  br i1 %222, label %223, label %227

223:                                              ; preds = %218
  %224 = load i32, ptr %17, align 4, !tbaa !11
  %225 = zext i32 %224 to i64
  %226 = icmp ne i64 %225, 12
  br i1 %226, label %227, label %228

227:                                              ; preds = %223, %218
  store i32 0, ptr %5, align 4
  store i32 1, ptr %28, align 4
  br label %404

228:                                              ; preds = %223
  br label %403

229:                                              ; preds = %181, %177
  call void @llvm.lifetime.start.p0(i64 20, ptr %31) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %32) #7
  store ptr null, ptr %32, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %33) #7
  %230 = load i32, ptr @debug_logging_mode, align 4, !tbaa !11
  %231 = icmp ne i32 %230, 0
  br i1 %231, label %232, label %239

232:                                              ; preds = %229
  %233 = load i32, ptr %19, align 4, !tbaa !11
  %234 = load i32, ptr %9, align 4, !tbaa !11
  %235 = and i32 %234, 8
  %236 = icmp ne i32 %235, 0
  %237 = zext i1 %236 to i64
  %238 = select i1 %236, ptr @.str.30, ptr @.str.31
  call void (ptr, ...) @error_line(ptr noundef @.str.45, i32 noundef %233, ptr noundef %238)
  br label %239

239:                                              ; preds = %232, %229
  %240 = load i32, ptr %9, align 4, !tbaa !11
  %241 = and i32 %240, 8
  %242 = icmp ne i32 %241, 0
  br i1 %242, label %243, label %271

243:                                              ; preds = %239
  %244 = load i32, ptr %24, align 4, !tbaa !11
  %245 = and i32 %244, 255
  %246 = load i32, ptr %18, align 4, !tbaa !11
  %247 = icmp sle i32 %245, %246
  br i1 %247, label %248, label %270

248:                                              ; preds = %243
  %249 = load i32, ptr %18, align 4, !tbaa !11
  %250 = sext i32 %249 to i64
  %251 = call noalias ptr @malloc(i64 noundef %250) #8
  store ptr %251, ptr %32, align 8, !tbaa !5
  store i32 0, ptr %33, align 4, !tbaa !11
  br label %252

252:                                              ; preds = %263, %248
  %253 = load i32, ptr %33, align 4, !tbaa !11
  %254 = load i32, ptr %18, align 4, !tbaa !11
  %255 = icmp slt i32 %253, %254
  br i1 %255, label %256, label %266

256:                                              ; preds = %252
  %257 = load i32, ptr %33, align 4, !tbaa !11
  %258 = trunc i32 %257 to i8
  %259 = load ptr, ptr %32, align 8, !tbaa !5
  %260 = load i32, ptr %33, align 4, !tbaa !11
  %261 = sext i32 %260 to i64
  %262 = getelementptr inbounds i8, ptr %259, i64 %261
  store i8 %258, ptr %262, align 1, !tbaa !13
  br label %263

263:                                              ; preds = %256
  %264 = load i32, ptr %33, align 4, !tbaa !11
  %265 = add nsw i32 %264, 1
  store i32 %265, ptr %33, align 4, !tbaa !11
  br label %252, !llvm.loop !35

266:                                              ; preds = %252
  %267 = load ptr, ptr %7, align 8, !tbaa !5
  %268 = load ptr, ptr %32, align 8, !tbaa !5
  %269 = call i32 @WavpackStreamGetChannelLayout(ptr noundef %267, ptr noundef %268)
  br label %270

270:                                              ; preds = %266, %243
  br label %271

271:                                              ; preds = %270, %239
  %272 = getelementptr inbounds %struct.CAFChunkHeader, ptr %11, i32 0, i32 0
  %273 = getelementptr inbounds [4 x i8], ptr %272, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %273, ptr align 1 @.str.16, i64 4, i1 false)
  %274 = load i32, ptr %18, align 4, !tbaa !11
  %275 = sext i32 %274 to i64
  %276 = mul i64 20, %275
  %277 = add i64 12, %276
  %278 = getelementptr inbounds %struct.CAFChunkHeader, ptr %11, i32 0, i32 1
  store i64 %277, ptr %278, align 4, !tbaa !20
  call void @WavpackStreamNativeToBigEndian(ptr noundef %11, ptr noundef @.str.4)
  %279 = load ptr, ptr %6, align 8, !tbaa !5
  %280 = call i32 @DoWriteFile(ptr noundef %279, ptr noundef %11, i32 noundef 12, ptr noundef %17)
  %281 = icmp ne i32 %280, 0
  br i1 %281, label %282, label %286

282:                                              ; preds = %271
  %283 = load i32, ptr %17, align 4, !tbaa !11
  %284 = zext i32 %283 to i64
  %285 = icmp ne i64 %284, 12
  br i1 %285, label %286, label %287

286:                                              ; preds = %282, %271
  store i32 0, ptr %5, align 4
  store i32 1, ptr %28, align 4
  br label %400

287:                                              ; preds = %282
  %288 = getelementptr inbounds %struct.CAFChannelLayout, ptr %13, i32 0, i32 0
  store i32 0, ptr %288, align 4, !tbaa !31
  %289 = getelementptr inbounds %struct.CAFChannelLayout, ptr %13, i32 0, i32 1
  store i32 0, ptr %289, align 4, !tbaa !33
  %290 = load i32, ptr %18, align 4, !tbaa !11
  %291 = getelementptr inbounds %struct.CAFChannelLayout, ptr %13, i32 0, i32 2
  store i32 %290, ptr %291, align 4, !tbaa !34
  call void @WavpackStreamNativeToBigEndian(ptr noundef %13, ptr noundef @.str.19)
  %292 = load ptr, ptr %6, align 8, !tbaa !5
  %293 = call i32 @DoWriteFile(ptr noundef %292, ptr noundef %13, i32 noundef 12, ptr noundef %17)
  %294 = icmp ne i32 %293, 0
  br i1 %294, label %295, label %299

295:                                              ; preds = %287
  %296 = load i32, ptr %17, align 4, !tbaa !11
  %297 = zext i32 %296 to i64
  %298 = icmp ne i64 %297, 12
  br i1 %298, label %299, label %300

299:                                              ; preds = %295, %287
  store i32 0, ptr %5, align 4
  store i32 1, ptr %28, align 4
  br label %400

300:                                              ; preds = %295
  store i32 0, ptr %33, align 4, !tbaa !11
  br label %301

301:                                              ; preds = %391, %300
  %302 = load i32, ptr %33, align 4, !tbaa !11
  %303 = load i32, ptr %18, align 4, !tbaa !11
  %304 = icmp slt i32 %302, %303
  br i1 %304, label %305, label %394

305:                                              ; preds = %301
  call void @llvm.lifetime.start.p0(i64 1, ptr %34) #7
  %306 = load ptr, ptr %32, align 8, !tbaa !5
  %307 = icmp ne ptr %306, null
  br i1 %307, label %308, label %319

308:                                              ; preds = %305
  %309 = load ptr, ptr %25, align 8, !tbaa !5
  %310 = load ptr, ptr %32, align 8, !tbaa !5
  %311 = load i32, ptr %33, align 4, !tbaa !11
  %312 = sext i32 %311 to i64
  %313 = getelementptr inbounds i8, ptr %310, i64 %312
  %314 = load i8, ptr %313, align 1, !tbaa !13
  %315 = zext i8 %314 to i64
  %316 = getelementptr inbounds i8, ptr %309, i64 %315
  %317 = load i8, ptr %316, align 1, !tbaa !13
  %318 = zext i8 %317 to i32
  br label %326

319:                                              ; preds = %305
  %320 = load ptr, ptr %25, align 8, !tbaa !5
  %321 = load i32, ptr %33, align 4, !tbaa !11
  %322 = sext i32 %321 to i64
  %323 = getelementptr inbounds i8, ptr %320, i64 %322
  %324 = load i8, ptr %323, align 1, !tbaa !13
  %325 = zext i8 %324 to i32
  br label %326

326:                                              ; preds = %319, %308
  %327 = phi i32 [ %318, %308 ], [ %325, %319 ]
  %328 = trunc i32 %327 to i8
  store i8 %328, ptr %34, align 1, !tbaa !13
  call void @llvm.memset.p0.i64(ptr align 4 %31, i8 0, i64 20, i1 false)
  %329 = load i8, ptr %34, align 1, !tbaa !13
  %330 = zext i8 %329 to i32
  %331 = icmp sge i32 %330, 1
  br i1 %331, label %332, label %336

332:                                              ; preds = %326
  %333 = load i8, ptr %34, align 1, !tbaa !13
  %334 = zext i8 %333 to i32
  %335 = icmp sle i32 %334, 18
  br i1 %335, label %352, label %336

336:                                              ; preds = %332, %326
  %337 = load i8, ptr %34, align 1, !tbaa !13
  %338 = zext i8 %337 to i32
  %339 = icmp sge i32 %338, 33
  br i1 %339, label %340, label %344

340:                                              ; preds = %336
  %341 = load i8, ptr %34, align 1, !tbaa !13
  %342 = zext i8 %341 to i32
  %343 = icmp sle i32 %342, 44
  br i1 %343, label %352, label %344

344:                                              ; preds = %340, %336
  %345 = load i8, ptr %34, align 1, !tbaa !13
  %346 = zext i8 %345 to i32
  %347 = icmp sge i32 %346, 200
  br i1 %347, label %348, label %356

348:                                              ; preds = %344
  %349 = load i8, ptr %34, align 1, !tbaa !13
  %350 = zext i8 %349 to i32
  %351 = icmp sle i32 %350, 207
  br i1 %351, label %352, label %356

352:                                              ; preds = %348, %340, %332
  %353 = load i8, ptr %34, align 1, !tbaa !13
  %354 = zext i8 %353 to i32
  %355 = getelementptr inbounds %struct.CAFChannelDescription, ptr %31, i32 0, i32 0
  store i32 %354, ptr %355, align 4, !tbaa !36
  br label %370

356:                                              ; preds = %348, %344
  %357 = load i8, ptr %34, align 1, !tbaa !13
  %358 = zext i8 %357 to i32
  %359 = icmp sge i32 %358, 221
  br i1 %359, label %360, label %369

360:                                              ; preds = %356
  %361 = load i8, ptr %34, align 1, !tbaa !13
  %362 = zext i8 %361 to i32
  %363 = icmp sle i32 %362, 225
  br i1 %363, label %364, label %369

364:                                              ; preds = %360
  %365 = load i8, ptr %34, align 1, !tbaa !13
  %366 = zext i8 %365 to i32
  %367 = add nsw i32 %366, 80
  %368 = getelementptr inbounds %struct.CAFChannelDescription, ptr %31, i32 0, i32 0
  store i32 %367, ptr %368, align 4, !tbaa !36
  br label %369

369:                                              ; preds = %364, %360, %356
  br label %370

370:                                              ; preds = %369, %352
  %371 = load i32, ptr @debug_logging_mode, align 4, !tbaa !11
  %372 = icmp ne i32 %371, 0
  br i1 %372, label %373, label %378

373:                                              ; preds = %370
  %374 = load i32, ptr %33, align 4, !tbaa !11
  %375 = add nsw i32 %374, 1
  %376 = getelementptr inbounds %struct.CAFChannelDescription, ptr %31, i32 0, i32 0
  %377 = load i32, ptr %376, align 4, !tbaa !36
  call void (ptr, ...) @error_line(ptr noundef @.str.24, i32 noundef %375, i32 noundef %377)
  br label %378

378:                                              ; preds = %373, %370
  call void @WavpackStreamNativeToBigEndian(ptr noundef %31, ptr noundef @.str.23)
  %379 = load ptr, ptr %6, align 8, !tbaa !5
  %380 = call i32 @DoWriteFile(ptr noundef %379, ptr noundef %31, i32 noundef 20, ptr noundef %17)
  %381 = icmp ne i32 %380, 0
  br i1 %381, label %382, label %386

382:                                              ; preds = %378
  %383 = load i32, ptr %17, align 4, !tbaa !11
  %384 = zext i32 %383 to i64
  %385 = icmp ne i64 %384, 20
  br i1 %385, label %386, label %387

386:                                              ; preds = %382, %378
  store i32 0, ptr %5, align 4
  store i32 1, ptr %28, align 4
  br label %388

387:                                              ; preds = %382
  store i32 0, ptr %28, align 4
  br label %388

388:                                              ; preds = %387, %386
  call void @llvm.lifetime.end.p0(i64 1, ptr %34) #7
  %389 = load i32, ptr %28, align 4
  switch i32 %389, label %400 [
    i32 0, label %390
  ]

390:                                              ; preds = %388
  br label %391

391:                                              ; preds = %390
  %392 = load i32, ptr %33, align 4, !tbaa !11
  %393 = add nsw i32 %392, 1
  store i32 %393, ptr %33, align 4, !tbaa !11
  br label %301, !llvm.loop !38

394:                                              ; preds = %301
  %395 = load ptr, ptr %32, align 8, !tbaa !5
  %396 = icmp ne ptr %395, null
  br i1 %396, label %397, label %399

397:                                              ; preds = %394
  %398 = load ptr, ptr %32, align 8, !tbaa !5
  call void @free(ptr noundef %398) #7
  br label %399

399:                                              ; preds = %397, %394
  store i32 0, ptr %28, align 4
  br label %400

400:                                              ; preds = %399, %388, %299, %286
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %32) #7
  call void @llvm.lifetime.end.p0(i64 20, ptr %31) #7
  %401 = load i32, ptr %28, align 4
  switch i32 %401, label %404 [
    i32 0, label %402
  ]

402:                                              ; preds = %400
  br label %403

403:                                              ; preds = %402, %228
  store i32 0, ptr %28, align 4
  br label %404

404:                                              ; preds = %403, %400, %227, %196
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #7
  %405 = load i32, ptr %28, align 4
  switch i32 %405, label %444 [
    i32 0, label %406
  ]

406:                                              ; preds = %404
  br label %407

407:                                              ; preds = %406, %152, %149
  %408 = getelementptr inbounds %struct.CAFChunkHeader, ptr %12, i32 0, i32 0
  %409 = getelementptr inbounds [4 x i8], ptr %408, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %409, ptr align 1 @.str.33, i64 4, i1 false)
  %410 = load i64, ptr %8, align 8, !tbaa !9
  %411 = icmp eq i64 %410, -1
  br i1 %411, label %412, label %414

412:                                              ; preds = %407
  %413 = getelementptr inbounds %struct.CAFChunkHeader, ptr %12, i32 0, i32 1
  store i64 -1, ptr %413, align 4, !tbaa !20
  br label %424

414:                                              ; preds = %407
  %415 = load i64, ptr %8, align 8, !tbaa !9
  %416 = load i32, ptr %21, align 4, !tbaa !11
  %417 = sext i32 %416 to i64
  %418 = mul nsw i64 %415, %417
  %419 = load i32, ptr %18, align 4, !tbaa !11
  %420 = sext i32 %419 to i64
  %421 = mul nsw i64 %418, %420
  %422 = add i64 %421, 4
  %423 = getelementptr inbounds %struct.CAFChunkHeader, ptr %12, i32 0, i32 1
  store i64 %422, ptr %423, align 4, !tbaa !20
  br label %424

424:                                              ; preds = %414, %412
  call void @WavpackStreamNativeToBigEndian(ptr noundef %12, ptr noundef @.str.4)
  %425 = load ptr, ptr %6, align 8, !tbaa !5
  %426 = call i32 @DoWriteFile(ptr noundef %425, ptr noundef %12, i32 noundef 12, ptr noundef %17)
  %427 = icmp ne i32 %426, 0
  br i1 %427, label %428, label %432

428:                                              ; preds = %424
  %429 = load i32, ptr %17, align 4, !tbaa !11
  %430 = zext i32 %429 to i64
  %431 = icmp ne i64 %430, 12
  br i1 %431, label %432, label %433

432:                                              ; preds = %428, %424
  store i32 0, ptr %5, align 4
  store i32 1, ptr %28, align 4
  br label %444

433:                                              ; preds = %428
  store i32 0, ptr %16, align 4, !tbaa !11
  call void @WavpackStreamNativeToBigEndian(ptr noundef %16, ptr noundef @.str.46)
  %434 = load ptr, ptr %6, align 8, !tbaa !5
  %435 = call i32 @DoWriteFile(ptr noundef %434, ptr noundef %16, i32 noundef 4, ptr noundef %17)
  %436 = icmp ne i32 %435, 0
  br i1 %436, label %437, label %441

437:                                              ; preds = %433
  %438 = load i32, ptr %17, align 4, !tbaa !11
  %439 = zext i32 %438 to i64
  %440 = icmp ne i64 %439, 4
  br i1 %440, label %441, label %442

441:                                              ; preds = %437, %433
  store i32 0, ptr %5, align 4
  store i32 1, ptr %28, align 4
  br label %444

442:                                              ; preds = %437
  %443 = load ptr, ptr %25, align 8, !tbaa !5
  call void @free(ptr noundef %443) #7
  store i32 1, ptr %5, align 4
  store i32 1, ptr %28, align 4
  br label %444

444:                                              ; preds = %442, %441, %432, %404, %142, %106, %94, %58
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %10) #7
  %445 = load i32, ptr %5, align 4
  ret i32 %445
}

declare i32 @WavpackStreamGetNumChannels(ptr noundef) #2

declare i32 @WavpackStreamGetChannelMask(ptr noundef) #2

declare i32 @WavpackStreamGetSampleRate(ptr noundef) #2

declare i32 @WavpackStreamGetBytesPerSample(ptr noundef) #2

declare i32 @WavpackStreamGetBitsPerSample(ptr noundef) #2

declare i32 @WavpackStreamGetFloatNormExp(ptr noundef) #2

declare i32 @WavpackStreamGetChannelLayout(ptr noundef, ptr noundef) #2

declare void @WavpackStreamGetChannelIdentities(ptr noundef, ptr noundef) #2

declare void @WavpackStreamNativeToBigEndian(ptr noundef, ptr noundef) #2

declare i32 @DoWriteFile(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 #7 = { nounwind }
attributes #8 = { 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, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!17, !18, i64 4}
!17 = !{!"", !7, i64 0, !18, i64 4, !18, i64 6}
!18 = !{!"short", !7, i64 0}
!19 = !{!17, !18, i64 6}
!20 = !{!21, !10, i64 4}
!21 = !{!"", !7, i64 0, !10, i64 4}
!22 = !{!23, !24, i64 0}
!23 = !{!"", !24, i64 0, !7, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28}
!24 = !{!"double", !7, i64 0}
!25 = !{!23, !12, i64 12}
!26 = !{!23, !12, i64 16}
!27 = !{!23, !12, i64 20}
!28 = !{!23, !12, i64 24}
!29 = !{!23, !12, i64 28}
!30 = distinct !{!30, !15}
!31 = !{!32, !12, i64 0}
!32 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8}
!33 = !{!32, !12, i64 4}
!34 = !{!32, !12, i64 8}
!35 = distinct !{!35, !15}
!36 = !{!37, !12, i64 0}
!37 = !{!"", !12, i64 0, !12, i64 4, !7, i64 8}
!38 = distinct !{!38, !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.CAFChunkHeader = type <{ [4 x i8], i64 }>
%struct.CAFChannelLayout = type { i32, i32, i32 }
%struct.CAFAudioFormat = type { double, [4 x i8], i32, i32, i32, i32, i32 }
%struct.CAFFileHeader = type { [4 x i8], i16, i16 }
%struct.CAFChannelDescription = type { i32, i32, [3 x float] }

@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1
@debug_logging_mode = external local_unnamed_addr global i32, align 4
@.str.10 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.44 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.45 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [2 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

declare void @error_line(ptr noundef, ...) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.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 #2

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @WriteCaffHeader(ptr noundef %0, ptr noundef %1, i64 noundef %2, i32 noundef %3) local_unnamed_addr #5 {
  %5 = alloca %struct.CAFChunkHeader, align 4
  %6 = alloca %struct.CAFChunkHeader, align 4
  %7 = alloca %struct.CAFChunkHeader, align 4
  %8 = alloca %struct.CAFChannelLayout, align 4
  %9 = alloca %struct.CAFAudioFormat, align 8
  %10 = alloca %struct.CAFFileHeader, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %struct.CAFChannelDescription, align 4
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #7
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %7) #7
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %8) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #7
  %14 = tail call i32 @WavpackStreamGetNumChannels(ptr noundef %1) #7
  %15 = tail call i32 @WavpackStreamGetChannelMask(ptr noundef %1) #7
  %16 = tail call i32 @WavpackStreamGetSampleRate(ptr noundef %1) #7
  %17 = tail call i32 @WavpackStreamGetBytesPerSample(ptr noundef %1) #7
  %18 = tail call i32 @WavpackStreamGetBitsPerSample(ptr noundef %1) #7
  %19 = tail call i32 @WavpackStreamGetFloatNormExp(ptr noundef %1) #7
  %20 = tail call i32 @WavpackStreamGetChannelLayout(ptr noundef %1, ptr noundef null) #7
  %21 = add nsw i32 %14, 1
  %22 = sext i32 %21 to i64
  %23 = tail call noalias ptr @malloc(i64 noundef %22) #8
  %24 = icmp ne i32 %19, 0
  switch i32 %19, label %25 [
    i32 127, label %26
    i32 0, label %26
  ]

25:                                               ; preds = %4
  tail call void (ptr, ...) @error_line(ptr noundef nonnull @.str.41) #7
  tail call void @free(ptr noundef %23) #7
  br label %217

26:                                               ; preds = %4, %4
  tail call void @WavpackStreamGetChannelIdentities(ptr noundef %1, ptr noundef %23) #7
  %27 = icmp sgt i32 %14, 0
  br i1 %27, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %26
  %wide.trip.count = zext nneg i32 %14 to i64
  %min.iters.check = icmp ult i32 %14, 8
  br i1 %min.iters.check, label %.lr.ph.preheader267, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %wide.trip.count, 2147483640
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %34, %vector.body ]
  %vec.phi244 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %35, %vector.body ]
  %28 = getelementptr inbounds i8, ptr %23, i64 %index
  %29 = getelementptr inbounds i8, ptr %28, i64 4
  %wide.load = load <4 x i8>, ptr %28, align 1, !tbaa !5
  %wide.load245 = load <4 x i8>, ptr %29, align 1, !tbaa !5
  %30 = icmp ne <4 x i8> %wide.load, <i8 -1, i8 -1, i8 -1, i8 -1>
  %31 = icmp ne <4 x i8> %wide.load245, <i8 -1, i8 -1, i8 -1, i8 -1>
  %32 = zext <4 x i1> %30 to <4 x i32>
  %33 = zext <4 x i1> %31 to <4 x i32>
  %34 = add <4 x i32> %vec.phi, %32
  %35 = add <4 x i32> %vec.phi244, %33
  %index.next = add nuw i64 %index, 8
  %36 = icmp eq i64 %index.next, %n.vec
  br i1 %36, label %middle.block, label %vector.body, !llvm.loop !8

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %35, %34
  %37 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader267

.lr.ph.preheader267:                              ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  %.0156189.ph = phi i32 [ 0, %.lr.ph.preheader ], [ %37, %middle.block ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader267, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader267 ]
  %.0156189 = phi i32 [ %spec.select, %.lr.ph ], [ %.0156189.ph, %.lr.ph.preheader267 ]
  %38 = getelementptr inbounds i8, ptr %23, i64 %indvars.iv
  %39 = load i8, ptr %38, align 1, !tbaa !5
  %.not181 = icmp ne i8 %39, -1
  %40 = zext i1 %.not181 to i32
  %spec.select = add nuw nsw i32 %.0156189, %40
  %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 %._crit_edge, label %.lr.ph, !llvm.loop !12

._crit_edge:                                      ; preds = %.lr.ph, %middle.block, %26
  %.0156.lcssa = phi i32 [ 0, %26 ], [ %37, %middle.block ], [ %spec.select, %.lr.ph ]
  %41 = load i32, ptr @.str.42, align 1
  store i32 %41, ptr %10, align 4
  %42 = getelementptr inbounds i8, ptr %10, i64 4
  store i16 1, ptr %42, align 4, !tbaa !13
  %43 = getelementptr inbounds i8, ptr %10, i64 6
  store i16 0, ptr %43, align 2, !tbaa !16
  call void @WavpackStreamNativeToBigEndian(ptr noundef nonnull %10, ptr noundef nonnull @.str.2) #7
  %44 = call i32 @DoWriteFile(ptr noundef %0, ptr noundef nonnull %10, i32 noundef 8, ptr noundef nonnull %12) #7
  %45 = icmp eq i32 %44, 0
  %46 = load i32, ptr %12, align 4
  %47 = icmp ne i32 %46, 8
  %or.cond6 = select i1 %45, i1 true, i1 %47
  br i1 %or.cond6, label %217, label %48

48:                                               ; preds = %._crit_edge
  %49 = load i32, ptr @.str.5, align 1
  store i32 %49, ptr %5, align 4
  %50 = getelementptr inbounds i8, ptr %5, i64 4
  store i64 32, ptr %50, align 4, !tbaa !17
  call void @WavpackStreamNativeToBigEndian(ptr noundef nonnull %5, ptr noundef nonnull @.str.4) #7
  %51 = call i32 @DoWriteFile(ptr noundef %0, ptr noundef nonnull %5, i32 noundef 12, ptr noundef nonnull %12) #7
  %52 = icmp eq i32 %51, 0
  %53 = load i32, ptr %12, align 4
  %54 = icmp ne i32 %53, 12
  %or.cond9 = select i1 %52, i1 true, i1 %54
  br i1 %or.cond9, label %217, label %55

55:                                               ; preds = %48
  %56 = sitofp i32 %16 to double
  store double %56, ptr %9, align 8, !tbaa !20
  %57 = getelementptr inbounds i8, ptr %9, i64 8
  %58 = load i32, ptr @.str.10, align 1
  store i32 %58, ptr %57, align 8
  %59 = zext i1 %24 to i32
  %60 = getelementptr inbounds i8, ptr %9, i64 12
  %61 = shl i32 %3, 1
  %62 = and i32 %61, 2
  %63 = or disjoint i32 %62, %59
  %spec.select182 = xor i32 %63, 2
  store i32 %spec.select182, ptr %60, align 4, !tbaa !24
  %64 = mul nsw i32 %17, %14
  %65 = getelementptr inbounds i8, ptr %9, i64 16
  store i32 %64, ptr %65, align 8, !tbaa !25
  %66 = getelementptr inbounds i8, ptr %9, i64 20
  store i32 1, ptr %66, align 4, !tbaa !26
  %67 = getelementptr inbounds i8, ptr %9, i64 24
  store i32 %14, ptr %67, align 8, !tbaa !27
  %68 = getelementptr inbounds i8, ptr %9, i64 28
  store i32 %18, ptr %68, align 4, !tbaa !28
  call void @WavpackStreamNativeToBigEndian(ptr noundef nonnull %9, ptr noundef nonnull @.str.6) #7
  %69 = call i32 @DoWriteFile(ptr noundef %0, ptr noundef nonnull %9, i32 noundef 32, ptr noundef nonnull %12) #7
  %70 = icmp eq i32 %69, 0
  %71 = load i32, ptr %12, align 4
  %72 = icmp ne i32 %71, 32
  %or.cond12 = select i1 %70, i1 true, i1 %72
  br i1 %or.cond12, label %217, label %73

73:                                               ; preds = %55
  %.not162 = icmp eq i32 %20, 0
  br i1 %.not162, label %74, label %79

74:                                               ; preds = %73
  %75 = icmp sgt i32 %14, 2
  br i1 %75, label %76, label %77

76:                                               ; preds = %74
  %.not164 = icmp eq i32 %.0156.lcssa, 0
  br i1 %.not164, label %.critedge188, label %.thread

77:                                               ; preds = %74
  %78 = sub nsw i32 5, %14
  %.not163 = icmp eq i32 %15, %78
  br i1 %.not163, label %.critedge188, label %.thread

79:                                               ; preds = %73
  %80 = and i32 %20, 16711680
  %.not166 = icmp eq i32 %80, 0
  br i1 %.not166, label %.thread, label %114

.thread:                                          ; preds = %76, %77, %79
  %81 = and i32 %15, 1
  %82 = lshr i32 %15, 1
  %.lobit = and i32 %82, 1
  %spec.select183.1 = add nuw nsw i32 %81, %.lobit
  %83 = lshr i32 %15, 2
  %.lobit211 = and i32 %83, 1
  %spec.select183.2 = add nuw nsw i32 %spec.select183.1, %.lobit211
  %84 = lshr i32 %15, 3
  %.lobit212 = and i32 %84, 1
  %spec.select183.3 = add nuw nsw i32 %spec.select183.2, %.lobit212
  %85 = lshr i32 %15, 4
  %.lobit213 = and i32 %85, 1
  %spec.select183.4 = add nuw nsw i32 %spec.select183.3, %.lobit213
  %86 = lshr i32 %15, 5
  %.lobit214 = and i32 %86, 1
  %spec.select183.5 = add nuw nsw i32 %spec.select183.4, %.lobit214
  %87 = lshr i32 %15, 6
  %.lobit215 = and i32 %87, 1
  %spec.select183.6 = add nuw nsw i32 %spec.select183.5, %.lobit215
  %88 = lshr i32 %15, 7
  %.lobit216 = and i32 %88, 1
  %spec.select183.7 = add nuw nsw i32 %spec.select183.6, %.lobit216
  %89 = lshr i32 %15, 8
  %.lobit217 = and i32 %89, 1
  %spec.select183.8 = add nuw nsw i32 %spec.select183.7, %.lobit217
  %90 = lshr i32 %15, 9
  %.lobit218 = and i32 %90, 1
  %spec.select183.9 = add nuw nsw i32 %spec.select183.8, %.lobit218
  %91 = lshr i32 %15, 10
  %.lobit219 = and i32 %91, 1
  %spec.select183.10 = add nuw nsw i32 %spec.select183.9, %.lobit219
  %92 = lshr i32 %15, 11
  %.lobit220 = and i32 %92, 1
  %spec.select183.11 = add nuw nsw i32 %spec.select183.10, %.lobit220
  %93 = lshr i32 %15, 12
  %.lobit221 = and i32 %93, 1
  %spec.select183.12 = add nuw nsw i32 %spec.select183.11, %.lobit221
  %94 = lshr i32 %15, 13
  %.lobit222 = and i32 %94, 1
  %spec.select183.13 = add nuw nsw i32 %spec.select183.12, %.lobit222
  %95 = lshr i32 %15, 14
  %.lobit223 = and i32 %95, 1
  %spec.select183.14 = add nuw nsw i32 %spec.select183.13, %.lobit223
  %96 = lshr i32 %15, 15
  %.lobit224 = and i32 %96, 1
  %spec.select183.15 = add nuw nsw i32 %spec.select183.14, %.lobit224
  %97 = lshr i32 %15, 16
  %.lobit225 = and i32 %97, 1
  %spec.select183.16 = add nuw nsw i32 %spec.select183.15, %.lobit225
  %98 = lshr i32 %15, 17
  %.lobit226 = and i32 %98, 1
  %spec.select183.17 = add nuw nsw i32 %spec.select183.16, %.lobit226
  %99 = lshr i32 %15, 18
  %.lobit227 = and i32 %99, 1
  %spec.select183.18 = add nuw nsw i32 %spec.select183.17, %.lobit227
  %100 = lshr i32 %15, 19
  %.lobit228 = and i32 %100, 1
  %spec.select183.19 = add nuw nsw i32 %spec.select183.18, %.lobit228
  %101 = lshr i32 %15, 20
  %.lobit229 = and i32 %101, 1
  %spec.select183.20 = add nuw nsw i32 %spec.select183.19, %.lobit229
  %102 = lshr i32 %15, 21
  %.lobit230 = and i32 %102, 1
  %spec.select183.21 = add nuw nsw i32 %spec.select183.20, %.lobit230
  %103 = lshr i32 %15, 22
  %.lobit231 = and i32 %103, 1
  %spec.select183.22 = add nuw nsw i32 %spec.select183.21, %.lobit231
  %104 = lshr i32 %15, 23
  %.lobit232 = and i32 %104, 1
  %spec.select183.23 = add nuw nsw i32 %spec.select183.22, %.lobit232
  %105 = lshr i32 %15, 24
  %.lobit233 = and i32 %105, 1
  %spec.select183.24 = add nuw nsw i32 %spec.select183.23, %.lobit233
  %106 = lshr i32 %15, 25
  %.lobit234 = and i32 %106, 1
  %spec.select183.25 = add nuw nsw i32 %spec.select183.24, %.lobit234
  %107 = lshr i32 %15, 26
  %.lobit235 = and i32 %107, 1
  %spec.select183.26 = add nuw nsw i32 %spec.select183.25, %.lobit235
  %108 = lshr i32 %15, 27
  %.lobit236 = and i32 %108, 1
  %spec.select183.27 = add nuw nsw i32 %spec.select183.26, %.lobit236
  %109 = lshr i32 %15, 28
  %.lobit237 = and i32 %109, 1
  %spec.select183.28 = add nuw nsw i32 %spec.select183.27, %.lobit237
  %110 = lshr i32 %15, 29
  %.lobit238 = and i32 %110, 1
  %spec.select183.29 = add nuw nsw i32 %spec.select183.28, %.lobit238
  %111 = lshr i32 %15, 30
  %.lobit239 = and i32 %111, 1
  %spec.select183.30 = add nuw nsw i32 %spec.select183.29, %.lobit239
  %.lobit240 = lshr i32 %15, 31
  %spec.select183.31 = add nuw nsw i32 %spec.select183.30, %.lobit240
  %112 = icmp eq i32 %spec.select183.31, %14
  %113 = and i32 %3, 8
  %.not167 = icmp eq i32 %113, 0
  %or.cond = and i1 %.not167, %112
  br i1 %or.cond, label %114, label %134

114:                                              ; preds = %.thread, %79
  %115 = load i32, ptr @.str.16, align 1
  store i32 %115, ptr %6, align 4
  %116 = getelementptr inbounds i8, ptr %6, i64 4
  store i64 12, ptr %116, align 4, !tbaa !17
  call void @WavpackStreamNativeToBigEndian(ptr noundef nonnull %6, ptr noundef nonnull @.str.4) #7
  %117 = call i32 @DoWriteFile(ptr noundef %0, ptr noundef nonnull %6, i32 noundef 12, ptr noundef nonnull %12) #7
  %118 = icmp eq i32 %117, 0
  %119 = load i32, ptr %12, align 4
  %120 = icmp ne i32 %119, 12
  %or.cond15 = select i1 %118, i1 true, i1 %120
  br i1 %or.cond15, label %217, label %121

121:                                              ; preds = %114
  %122 = load i32, ptr @debug_logging_mode, align 4, !tbaa !29
  %.not178 = icmp eq i32 %122, 0
  br i1 %.not162, label %125, label %123

123:                                              ; preds = %121
  br i1 %.not178, label %127, label %124

124:                                              ; preds = %123
  call void (ptr, ...) @error_line(ptr noundef nonnull @.str.43, i32 noundef %20) #7
  br label %127

125:                                              ; preds = %121
  br i1 %.not178, label %127, label %126

126:                                              ; preds = %125
  call void (ptr, ...) @error_line(ptr noundef nonnull @.str.44, i32 noundef %15) #7
  br label %127

127:                                              ; preds = %125, %126, %123, %124
  %storemerge = phi i32 [ %20, %124 ], [ %20, %123 ], [ 65536, %126 ], [ 65536, %125 ]
  %.sink242 = phi i32 [ 0, %124 ], [ 0, %123 ], [ %15, %126 ], [ %15, %125 ]
  store i32 %storemerge, ptr %8, align 4, !tbaa !30
  %128 = getelementptr inbounds i8, ptr %8, i64 4
  store i32 %.sink242, ptr %128, align 4, !tbaa !32
  %129 = getelementptr inbounds i8, ptr %8, i64 8
  store i32 0, ptr %129, align 4, !tbaa !33
  call void @WavpackStreamNativeToBigEndian(ptr noundef nonnull %8, ptr noundef nonnull @.str.19) #7
  %130 = call i32 @DoWriteFile(ptr noundef %0, ptr noundef nonnull %8, i32 noundef 12, ptr noundef nonnull %12) #7
  %131 = icmp eq i32 %130, 0
  %132 = load i32, ptr %12, align 4
  %133 = icmp ne i32 %132, 12
  %or.cond18 = select i1 %131, i1 true, i1 %133
  br i1 %or.cond18, label %217, label %.critedge188

134:                                              ; preds = %.thread
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %13) #7
  %135 = load i32, ptr @debug_logging_mode, align 4, !tbaa !29
  %.not168 = icmp eq i32 %135, 0
  br i1 %.not168, label %138, label %136

136:                                              ; preds = %134
  %137 = select i1 %.not167, ptr @.str.31, ptr @.str.30
  call void (ptr, ...) @error_line(ptr noundef nonnull @.str.45, i32 noundef %15, ptr noundef nonnull %137) #7
  br label %138

138:                                              ; preds = %136, %134
  %139 = and i32 %20, 255
  %.not171 = icmp sgt i32 %139, %14
  %or.cond184 = select i1 %.not167, i1 true, i1 %.not171
  br i1 %or.cond184, label %151, label %140

140:                                              ; preds = %138
  %141 = zext nneg i32 %14 to i64
  %142 = call noalias ptr @malloc(i64 noundef %141) #8
  br i1 %27, label %iter.check, label %._crit_edge196

iter.check:                                       ; preds = %140
  %min.iters.check248 = icmp ult i32 %14, 8
  br i1 %min.iters.check248, label %.lr.ph195.preheader, label %vector.main.loop.iter.check

vector.main.loop.iter.check:                      ; preds = %iter.check
  %min.iters.check250 = icmp ult i32 %14, 16
  br i1 %min.iters.check250, label %vec.epilog.ph, label %vector.ph251

vector.ph251:                                     ; preds = %vector.main.loop.iter.check
  %n.vec253 = and i64 %141, 2147483632
  br label %vector.body254

vector.body254:                                   ; preds = %vector.body254, %vector.ph251
  %index255 = phi i64 [ 0, %vector.ph251 ], [ %index.next256, %vector.body254 ]
  %vec.ind = phi <16 x i8> [ <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>, %vector.ph251 ], [ %vec.ind.next, %vector.body254 ]
  %143 = getelementptr inbounds i8, ptr %142, i64 %index255
  store <16 x i8> %vec.ind, ptr %143, align 1, !tbaa !5
  %index.next256 = add nuw i64 %index255, 16
  %vec.ind.next = add <16 x i8> %vec.ind, <i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16>
  %144 = icmp eq i64 %index.next256, %n.vec253
  br i1 %144, label %middle.block246, label %vector.body254, !llvm.loop !34

middle.block246:                                  ; preds = %vector.body254
  %cmp.n257 = icmp eq i64 %n.vec253, %141
  br i1 %cmp.n257, label %._crit_edge196, label %vec.epilog.iter.check

vec.epilog.iter.check:                            ; preds = %middle.block246
  %n.vec.remaining = and i64 %141, 8
  %min.epilog.iters.check.not.not = icmp eq i64 %n.vec.remaining, 0
  br i1 %min.epilog.iters.check.not.not, label %.lr.ph195.preheader, label %vec.epilog.ph

vec.epilog.ph:                                    ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
  %vec.epilog.resume.val = phi i64 [ %n.vec253, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
  %n.vec260 = and i64 %141, 2147483640
  %145 = trunc i64 %vec.epilog.resume.val to i8
  %.splatinsert = insertelement <8 x i8> poison, i8 %145, i64 0
  %.splat = shufflevector <8 x i8> %.splatinsert, <8 x i8> poison, <8 x i32> zeroinitializer
  %induction = or disjoint <8 x i8> %.splat, <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7>
  br label %vec.epilog.vector.body

vec.epilog.vector.body:                           ; preds = %vec.epilog.vector.body, %vec.epilog.ph
  %index262 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next265, %vec.epilog.vector.body ]
  %vec.ind263 = phi <8 x i8> [ %induction, %vec.epilog.ph ], [ %vec.ind.next264, %vec.epilog.vector.body ]
  %146 = getelementptr inbounds i8, ptr %142, i64 %index262
  store <8 x i8> %vec.ind263, ptr %146, align 1, !tbaa !5
  %index.next265 = add nuw i64 %index262, 8
  %vec.ind.next264 = add <8 x i8> %vec.ind263, <i8 8, i8 8, i8 8, i8 8, i8 8, i8 8, i8 8, i8 8>
  %147 = icmp eq i64 %index.next265, %n.vec260
  br i1 %147, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !35

vec.epilog.middle.block:                          ; preds = %vec.epilog.vector.body
  %cmp.n266 = icmp eq i64 %n.vec260, %141
  br i1 %cmp.n266, label %._crit_edge196, label %.lr.ph195.preheader

.lr.ph195.preheader:                              ; preds = %vec.epilog.middle.block, %iter.check, %vec.epilog.iter.check
  %indvars.iv201.ph = phi i64 [ 0, %iter.check ], [ %n.vec253, %vec.epilog.iter.check ], [ %n.vec260, %vec.epilog.middle.block ]
  br label %.lr.ph195

.lr.ph195:                                        ; preds = %.lr.ph195.preheader, %.lr.ph195
  %indvars.iv201 = phi i64 [ %indvars.iv.next202, %.lr.ph195 ], [ %indvars.iv201.ph, %.lr.ph195.preheader ]
  %148 = trunc i64 %indvars.iv201 to i8
  %149 = getelementptr inbounds i8, ptr %142, i64 %indvars.iv201
  store i8 %148, ptr %149, align 1, !tbaa !5
  %indvars.iv.next202 = add nuw nsw i64 %indvars.iv201, 1
  %exitcond205.not = icmp eq i64 %indvars.iv.next202, %141
  br i1 %exitcond205.not, label %._crit_edge196, label %.lr.ph195, !llvm.loop !36

._crit_edge196:                                   ; preds = %.lr.ph195, %middle.block246, %vec.epilog.middle.block, %140
  %150 = call i32 @WavpackStreamGetChannelLayout(ptr noundef %1, ptr noundef %142) #7
  br label %151

151:                                              ; preds = %._crit_edge196, %138
  %.0148 = phi ptr [ %142, %._crit_edge196 ], [ null, %138 ]
  %152 = load i32, ptr @.str.16, align 1
  store i32 %152, ptr %6, align 4
  %153 = sext i32 %14 to i64
  %154 = mul nsw i64 %153, 20
  %155 = add nsw i64 %154, 12
  %156 = getelementptr inbounds i8, ptr %6, i64 4
  store i64 %155, ptr %156, align 4, !tbaa !17
  call void @WavpackStreamNativeToBigEndian(ptr noundef nonnull %6, ptr noundef nonnull @.str.4) #7
  %157 = call i32 @DoWriteFile(ptr noundef %0, ptr noundef nonnull %6, i32 noundef 12, ptr noundef nonnull %12) #7
  %158 = icmp eq i32 %157, 0
  %159 = load i32, ptr %12, align 4
  %160 = icmp ne i32 %159, 12
  %or.cond21 = select i1 %158, i1 true, i1 %160
  br i1 %or.cond21, label %.critedge, label %161

161:                                              ; preds = %151
  store i32 0, ptr %8, align 4, !tbaa !30
  %162 = getelementptr inbounds i8, ptr %8, i64 4
  store i32 0, ptr %162, align 4, !tbaa !32
  %163 = getelementptr inbounds i8, ptr %8, i64 8
  store i32 %14, ptr %163, align 4, !tbaa !33
  call void @WavpackStreamNativeToBigEndian(ptr noundef nonnull %8, ptr noundef nonnull @.str.19) #7
  %164 = call i32 @DoWriteFile(ptr noundef %0, ptr noundef nonnull %8, i32 noundef 12, ptr noundef nonnull %12) #7
  %165 = icmp eq i32 %164, 0
  %166 = load i32, ptr %12, align 4
  %167 = icmp ne i32 %166, 12
  %or.cond24 = select i1 %165, i1 true, i1 %167
  br i1 %or.cond24, label %.critedge, label %.preheader

.preheader:                                       ; preds = %161
  br i1 %27, label %.lr.ph198, label %._crit_edge199

.lr.ph198:                                        ; preds = %.preheader
  %.not173 = icmp eq ptr %.0148, null
  %wide.trip.count209 = zext nneg i32 %14 to i64
  br label %169

168:                                              ; preds = %190
  %indvars.iv.next207 = add nuw nsw i64 %indvars.iv206, 1
  %exitcond210.not = icmp eq i64 %indvars.iv.next207, %wide.trip.count209
  br i1 %exitcond210.not, label %._crit_edge199, label %169, !llvm.loop !37

169:                                              ; preds = %.lr.ph198, %168
  %indvars.iv206 = phi i64 [ 0, %.lr.ph198 ], [ %indvars.iv.next207, %168 ]
  br i1 %.not173, label %174, label %170

170:                                              ; preds = %169
  %171 = getelementptr inbounds i8, ptr %.0148, i64 %indvars.iv206
  %172 = load i8, ptr %171, align 1, !tbaa !5
  %173 = zext i8 %172 to i64
  br label %174

174:                                              ; preds = %169, %170
  %.pn = phi i64 [ %173, %170 ], [ %indvars.iv206, %169 ]
  %.in.in = getelementptr inbounds i8, ptr %23, i64 %.pn
  %.in174 = load i8, ptr %.in.in, align 1, !tbaa !5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(20) %13, i8 0, i64 20, i1 false)
  %175 = zext i8 %.in174 to i32
  %176 = add i8 %.in174, -1
  %or.cond27 = icmp ult i8 %176, 18
  %177 = add i8 %.in174, -33
  %or.cond30 = icmp ult i8 %177, 12
  %or.cond185 = or i1 %or.cond27, %or.cond30
  %178 = and i8 %.in174, -8
  %or.cond33 = icmp eq i8 %178, -56
  %or.cond186 = or i1 %or.cond33, %or.cond185
  br i1 %or.cond186, label %179, label %180

179:                                              ; preds = %174
  store i32 %175, ptr %13, align 4, !tbaa !38
  br label %184

180:                                              ; preds = %174
  %181 = add i8 %.in174, 35
  %or.cond36 = icmp ult i8 %181, 5
  br i1 %or.cond36, label %182, label %184

182:                                              ; preds = %180
  %183 = add nuw nsw i32 %175, 80
  store i32 %183, ptr %13, align 4, !tbaa !38
  br label %184

184:                                              ; preds = %180, %182, %179
  %185 = phi i32 [ 0, %180 ], [ %183, %182 ], [ %175, %179 ]
  %186 = load i32, ptr @debug_logging_mode, align 4, !tbaa !29
  %.not175 = icmp eq i32 %186, 0
  br i1 %.not175, label %190, label %187

187:                                              ; preds = %184
  %188 = trunc i64 %indvars.iv206 to i32
  %189 = add i32 %188, 1
  call void (ptr, ...) @error_line(ptr noundef nonnull @.str.24, i32 noundef %189, i32 noundef %185) #7
  br label %190

190:                                              ; preds = %187, %184
  call void @WavpackStreamNativeToBigEndian(ptr noundef nonnull %13, ptr noundef nonnull @.str.23) #7
  %191 = call i32 @DoWriteFile(ptr noundef %0, ptr noundef nonnull %13, i32 noundef 20, ptr noundef nonnull %12) #7
  %192 = icmp ne i32 %191, 0
  %193 = load i32, ptr %12, align 4
  %194 = icmp eq i32 %193, 20
  %or.cond39.not = select i1 %192, i1 %194, i1 false
  br i1 %or.cond39.not, label %168, label %.critedge

._crit_edge199:                                   ; preds = %168, %.preheader
  %.not172 = icmp eq ptr %.0148, null
  br i1 %.not172, label %196, label %195

195:                                              ; preds = %._crit_edge199
  call void @free(ptr noundef nonnull %.0148) #7
  br label %196

196:                                              ; preds = %._crit_edge199, %195
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %13) #7
  br label %.critedge188

.critedge:                                        ; preds = %190, %161, %151
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %13) #7
  br label %217

.critedge188:                                     ; preds = %127, %196, %77, %76
  %197 = load i32, ptr @.str.33, align 1
  store i32 %197, ptr %7, align 4
  %198 = icmp eq i64 %2, -1
  br i1 %198, label %205, label %199

199:                                              ; preds = %.critedge188
  %200 = sext i32 %17 to i64
  %201 = sext i32 %14 to i64
  %202 = mul i64 %201, %2
  %203 = mul i64 %202, %200
  %204 = add i64 %203, 4
  br label %205

205:                                              ; preds = %.critedge188, %199
  %.sink = phi i64 [ %204, %199 ], [ -1, %.critedge188 ]
  %206 = getelementptr inbounds i8, ptr %7, i64 4
  store i64 %.sink, ptr %206, align 4
  call void @WavpackStreamNativeToBigEndian(ptr noundef nonnull %7, ptr noundef nonnull @.str.4) #7
  %207 = call i32 @DoWriteFile(ptr noundef %0, ptr noundef nonnull %7, i32 noundef 12, ptr noundef nonnull %12) #7
  %208 = icmp eq i32 %207, 0
  %209 = load i32, ptr %12, align 4
  %210 = icmp ne i32 %209, 12
  %or.cond42 = select i1 %208, i1 true, i1 %210
  br i1 %or.cond42, label %217, label %211

211:                                              ; preds = %205
  store i32 0, ptr %11, align 4, !tbaa !29
  call void @WavpackStreamNativeToBigEndian(ptr noundef nonnull %11, ptr noundef nonnull @.str.46) #7
  %212 = call i32 @DoWriteFile(ptr noundef %0, ptr noundef nonnull %11, i32 noundef 4, ptr noundef nonnull %12) #7
  %213 = icmp eq i32 %212, 0
  %214 = load i32, ptr %12, align 4
  %215 = icmp ne i32 %214, 4
  %or.cond45 = select i1 %213, i1 true, i1 %215
  br i1 %or.cond45, label %217, label %216

216:                                              ; preds = %211
  call void @free(ptr noundef %23) #7
  br label %217

217:                                              ; preds = %211, %205, %114, %127, %.critedge, %55, %48, %._crit_edge, %216, %25
  %.5 = phi i32 [ 0, %25 ], [ 1, %216 ], [ 0, %._crit_edge ], [ 0, %48 ], [ 0, %55 ], [ 0, %.critedge ], [ 0, %127 ], [ 0, %114 ], [ 0, %205 ], [ 0, %211 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #7
  ret i32 %.5
}

declare i32 @WavpackStreamGetNumChannels(ptr noundef) local_unnamed_addr #1

declare i32 @WavpackStreamGetChannelMask(ptr noundef) local_unnamed_addr #1

declare i32 @WavpackStreamGetSampleRate(ptr noundef) local_unnamed_addr #1

declare i32 @WavpackStreamGetBytesPerSample(ptr noundef) local_unnamed_addr #1

declare i32 @WavpackStreamGetBitsPerSample(ptr noundef) local_unnamed_addr #1

declare i32 @WavpackStreamGetFloatNormExp(ptr noundef) local_unnamed_addr #1

declare i32 @WavpackStreamGetChannelLayout(ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @WavpackStreamGetChannelIdentities(ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @WavpackStreamNativeToBigEndian(ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @DoWriteFile(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #6

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 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 #3 = { 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
attributes #8 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9, !10, !11}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!"llvm.loop.isvectorized", i32 1}
!11 = !{!"llvm.loop.unroll.runtime.disable"}
!12 = distinct !{!12, !9, !11, !10}
!13 = !{!14, !15, i64 4}
!14 = !{!"", !6, i64 0, !15, i64 4, !15, i64 6}
!15 = !{!"short", !6, i64 0}
!16 = !{!14, !15, i64 6}
!17 = !{!18, !19, i64 4}
!18 = !{!"", !6, i64 0, !19, i64 4}
!19 = !{!"long", !6, i64 0}
!20 = !{!21, !22, i64 0}
!21 = !{!"", !22, i64 0, !6, i64 8, !23, i64 12, !23, i64 16, !23, i64 20, !23, i64 24, !23, i64 28}
!22 = !{!"double", !6, i64 0}
!23 = !{!"int", !6, i64 0}
!24 = !{!21, !23, i64 12}
!25 = !{!21, !23, i64 16}
!26 = !{!21, !23, i64 20}
!27 = !{!21, !23, i64 24}
!28 = !{!21, !23, i64 28}
!29 = !{!23, !23, i64 0}
!30 = !{!31, !23, i64 0}
!31 = !{!"", !23, i64 0, !23, i64 4, !23, i64 8}
!32 = !{!31, !23, i64 4}
!33 = !{!31, !23, i64 8}
!34 = distinct !{!34, !9, !10, !11}
!35 = distinct !{!35, !9, !10, !11}
!36 = distinct !{!36, !9, !11, !10}
!37 = distinct !{!37, !9}
!38 = !{!39, !23, i64 0}
!39 = !{!"", !23, i64 0, !23, i64 4, !6, i64 8}


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