; LLVM IR from merpheus-dev/LavaEngine :: src/Utils/soloud/src/audiosource/wav (dr_impl)

; 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.drflac = type { ptr, ptr, %struct.drflac_allocation_callbacks, i32, i8, i8, i16, i64, i32, i32, %struct.drflac_frame, i64, i64, %struct.drflac__memory_stream, ptr, ptr, ptr, i8, %struct.drflac_bs, [1 x i8] }
%struct.drflac_allocation_callbacks = type { ptr, ptr, ptr, ptr }
%struct.drflac_frame = type { %struct.drflac_frame_header, i32, [8 x %struct.drflac_subframe] }
%struct.drflac_frame_header = type { i64, i32, i32, i16, i8, i8, i8 }
%struct.drflac_subframe = type { i8, i8, i8, ptr }
%struct.drflac__memory_stream = type { ptr, i64, i64 }
%struct.drflac_bs = type { ptr, ptr, ptr, i64, i64, i32, i32, [512 x i64], i64, i16, i64, i32 }

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z34drflac__seek_forward_by_pcm_framesP6drflacm(ptr noundef, i64 noundef) #1

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL39drflac__read_and_decode_next_flac_frameP6drflac(ptr noundef) #1

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare hidden noundef zeroext i8 @_ZL49drflac__get_channel_count_from_channel_assignmenta(i8 noundef signext) #2

; Function Attrs: mustprogress uwtable
define dso_local i64 @drflac_read_pcm_frames_s32(ptr noundef %0, i64 noundef %1, ptr noundef %2) #1 {
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i64, align 8
  %17 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = icmp eq ptr %18, null
  br i1 %19, label %23, label %20

20:                                               ; preds = %3
  %21 = load i64, ptr %6, align 8, !tbaa !9
  %22 = icmp eq i64 %21, 0
  br i1 %22, label %23, label %24

23:                                               ; preds = %20, %3
  store i64 0, ptr %4, align 8
  store i32 1, ptr %10, align 4
  br label %223

24:                                               ; preds = %20
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = icmp eq ptr %25, null
  br i1 %26, label %27, label %31

27:                                               ; preds = %24
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = load i64, ptr %6, align 8, !tbaa !9
  %30 = call noundef i64 @_Z34drflac__seek_forward_by_pcm_framesP6drflacm(ptr noundef %28, i64 noundef %29)
  store i64 %30, ptr %4, align 8
  store i32 1, ptr %10, align 4
  br label %223

31:                                               ; preds = %24
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.drflac, ptr %32, i32 0, i32 5
  %34 = load i8, ptr %33, align 1, !tbaa !11
  %35 = zext i8 %34 to i32
  %36 = sub nsw i32 32, %35
  store i32 %36, ptr %9, align 4, !tbaa !21
  store i64 0, ptr %8, align 8, !tbaa !9
  br label %37

37:                                               ; preds = %220, %31
  %38 = load i64, ptr %6, align 8, !tbaa !9
  %39 = icmp ugt i64 %38, 0
  br i1 %39, label %40, label %221

40:                                               ; preds = %37
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.drflac, ptr %41, i32 0, i32 10
  %43 = getelementptr inbounds %struct.drflac_frame, ptr %42, i32 0, i32 1
  %44 = load i32, ptr %43, align 8, !tbaa !22
  %45 = icmp eq i32 %44, 0
  br i1 %45, label %46, label %52

46:                                               ; preds = %40
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = call noundef i32 @_ZL39drflac__read_and_decode_next_flac_frameP6drflac(ptr noundef %47)
  %49 = icmp ne i32 %48, 0
  br i1 %49, label %51, label %50

50:                                               ; preds = %46
  br label %221

51:                                               ; preds = %46
  br label %220

52:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.drflac, ptr %53, i32 0, i32 10
  %55 = getelementptr inbounds %struct.drflac_frame, ptr %54, i32 0, i32 0
  %56 = getelementptr inbounds %struct.drflac_frame_header, ptr %55, i32 0, i32 4
  %57 = load i8, ptr %56, align 2, !tbaa !23
  %58 = call noundef zeroext i8 @_ZL49drflac__get_channel_count_from_channel_assignmenta(i8 noundef signext %57)
  %59 = zext i8 %58 to i32
  store i32 %59, ptr %11, align 4, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.drflac, ptr %60, i32 0, i32 10
  %62 = getelementptr inbounds %struct.drflac_frame, ptr %61, i32 0, i32 0
  %63 = getelementptr inbounds %struct.drflac_frame_header, ptr %62, i32 0, i32 3
  %64 = load i16, ptr %63, align 8, !tbaa !24
  %65 = zext i16 %64 to i32
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.drflac, ptr %66, i32 0, i32 10
  %68 = getelementptr inbounds %struct.drflac_frame, ptr %67, i32 0, i32 1
  %69 = load i32, ptr %68, align 8, !tbaa !22
  %70 = sub i32 %65, %69
  %71 = zext i32 %70 to i64
  store i64 %71, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %72 = load i64, ptr %6, align 8, !tbaa !9
  store i64 %72, ptr %13, align 8, !tbaa !9
  %73 = load i64, ptr %13, align 8, !tbaa !9
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.drflac, ptr %74, i32 0, i32 10
  %76 = getelementptr inbounds %struct.drflac_frame, ptr %75, i32 0, i32 1
  %77 = load i32, ptr %76, align 8, !tbaa !22
  %78 = zext i32 %77 to i64
  %79 = icmp ugt i64 %73, %78
  br i1 %79, label %80, label %86

80:                                               ; preds = %52
  %81 = load ptr, ptr %5, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.drflac, ptr %81, i32 0, i32 10
  %83 = getelementptr inbounds %struct.drflac_frame, ptr %82, i32 0, i32 1
  %84 = load i32, ptr %83, align 8, !tbaa !22
  %85 = zext i32 %84 to i64
  store i64 %85, ptr %13, align 8, !tbaa !9
  br label %86

86:                                               ; preds = %80, %52
  %87 = load i32, ptr %11, align 4, !tbaa !21
  %88 = icmp eq i32 %87, 2
  br i1 %88, label %89, label %142

89:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %90 = load ptr, ptr %5, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.drflac, ptr %90, i32 0, i32 10
  %92 = getelementptr inbounds %struct.drflac_frame, ptr %91, i32 0, i32 2
  %93 = getelementptr inbounds [8 x %struct.drflac_subframe], ptr %92, i64 0, i64 0
  %94 = getelementptr inbounds %struct.drflac_subframe, ptr %93, i32 0, i32 3
  %95 = load ptr, ptr %94, align 8, !tbaa !25
  %96 = load i64, ptr %12, align 8, !tbaa !9
  %97 = getelementptr inbounds i32, ptr %95, i64 %96
  store ptr %97, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.drflac, ptr %98, i32 0, i32 10
  %100 = getelementptr inbounds %struct.drflac_frame, ptr %99, i32 0, i32 2
  %101 = getelementptr inbounds [8 x %struct.drflac_subframe], ptr %100, i64 0, i64 1
  %102 = getelementptr inbounds %struct.drflac_subframe, ptr %101, i32 0, i32 3
  %103 = load ptr, ptr %102, align 8, !tbaa !25
  %104 = load i64, ptr %12, align 8, !tbaa !9
  %105 = getelementptr inbounds i32, ptr %103, i64 %104
  store ptr %105, ptr %15, align 8, !tbaa !5
  %106 = load ptr, ptr %5, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.drflac, ptr %106, i32 0, i32 10
  %108 = getelementptr inbounds %struct.drflac_frame, ptr %107, i32 0, i32 0
  %109 = getelementptr inbounds %struct.drflac_frame_header, ptr %108, i32 0, i32 4
  %110 = load i8, ptr %109, align 2, !tbaa !23
  %111 = zext i8 %110 to i32
  switch i32 %111, label %134 [
    i32 8, label %112
    i32 9, label %119
    i32 10, label %126
    i32 0, label %133
  ]

112:                                              ; preds = %89
  %113 = load ptr, ptr %5, align 8, !tbaa !5
  %114 = load i64, ptr %13, align 8, !tbaa !9
  %115 = load i32, ptr %9, align 4, !tbaa !21
  %116 = load ptr, ptr %14, align 8, !tbaa !5
  %117 = load ptr, ptr %15, align 8, !tbaa !5
  %118 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZL44drflac_read_pcm_frames_s32__decode_left_sideP6drflacmiPKiS2_Pi(ptr noundef %113, i64 noundef %114, i32 noundef %115, ptr noundef %116, ptr noundef %117, ptr noundef %118)
  br label %141

119:                                              ; preds = %89
  %120 = load ptr, ptr %5, align 8, !tbaa !5
  %121 = load i64, ptr %13, align 8, !tbaa !9
  %122 = load i32, ptr %9, align 4, !tbaa !21
  %123 = load ptr, ptr %14, align 8, !tbaa !5
  %124 = load ptr, ptr %15, align 8, !tbaa !5
  %125 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZL45drflac_read_pcm_frames_s32__decode_right_sideP6drflacmiPKiS2_Pi(ptr noundef %120, i64 noundef %121, i32 noundef %122, ptr noundef %123, ptr noundef %124, ptr noundef %125)
  br label %141

126:                                              ; preds = %89
  %127 = load ptr, ptr %5, align 8, !tbaa !5
  %128 = load i64, ptr %13, align 8, !tbaa !9
  %129 = load i32, ptr %9, align 4, !tbaa !21
  %130 = load ptr, ptr %14, align 8, !tbaa !5
  %131 = load ptr, ptr %15, align 8, !tbaa !5
  %132 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZL43drflac_read_pcm_frames_s32__decode_mid_sideP6drflacmiPKiS2_Pi(ptr noundef %127, i64 noundef %128, i32 noundef %129, ptr noundef %130, ptr noundef %131, ptr noundef %132)
  br label %141

133:                                              ; preds = %89
  br label %134

134:                                              ; preds = %133, %89
  %135 = load ptr, ptr %5, align 8, !tbaa !5
  %136 = load i64, ptr %13, align 8, !tbaa !9
  %137 = load i32, ptr %9, align 4, !tbaa !21
  %138 = load ptr, ptr %14, align 8, !tbaa !5
  %139 = load ptr, ptr %15, align 8, !tbaa !5
  %140 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZL53drflac_read_pcm_frames_s32__decode_independent_stereoP6drflacmiPKiS2_Pi(ptr noundef %135, i64 noundef %136, i32 noundef %137, ptr noundef %138, ptr noundef %139, ptr noundef %140)
  br label %141

141:                                              ; preds = %134, %126, %119, %112
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  br label %195

142:                                              ; preds = %86
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  store i64 0, ptr %16, align 8, !tbaa !9
  br label %143

143:                                              ; preds = %191, %142
  %144 = load i64, ptr %16, align 8, !tbaa !9
  %145 = load i64, ptr %13, align 8, !tbaa !9
  %146 = icmp ult i64 %144, %145
  br i1 %146, label %147, label %194

147:                                              ; preds = %143
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  store i32 0, ptr %17, align 4, !tbaa !21
  br label %148

148:                                              ; preds = %187, %147
  %149 = load i32, ptr %17, align 4, !tbaa !21
  %150 = load i32, ptr %11, align 4, !tbaa !21
  %151 = icmp ult i32 %149, %150
  br i1 %151, label %152, label %190

152:                                              ; preds = %148
  %153 = load ptr, ptr %5, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.drflac, ptr %153, i32 0, i32 10
  %155 = getelementptr inbounds %struct.drflac_frame, ptr %154, i32 0, i32 2
  %156 = load i32, ptr %17, align 4, !tbaa !21
  %157 = zext i32 %156 to i64
  %158 = getelementptr inbounds [8 x %struct.drflac_subframe], ptr %155, i64 0, i64 %157
  %159 = getelementptr inbounds %struct.drflac_subframe, ptr %158, i32 0, i32 3
  %160 = load ptr, ptr %159, align 8, !tbaa !25
  %161 = load i64, ptr %12, align 8, !tbaa !9
  %162 = load i64, ptr %16, align 8, !tbaa !9
  %163 = add i64 %161, %162
  %164 = getelementptr inbounds i32, ptr %160, i64 %163
  %165 = load i32, ptr %164, align 4, !tbaa !21
  %166 = load i32, ptr %9, align 4, !tbaa !21
  %167 = load ptr, ptr %5, align 8, !tbaa !5
  %168 = getelementptr inbounds %struct.drflac, ptr %167, i32 0, i32 10
  %169 = getelementptr inbounds %struct.drflac_frame, ptr %168, i32 0, i32 2
  %170 = load i32, ptr %17, align 4, !tbaa !21
  %171 = zext i32 %170 to i64
  %172 = getelementptr inbounds [8 x %struct.drflac_subframe], ptr %169, i64 0, i64 %171
  %173 = getelementptr inbounds %struct.drflac_subframe, ptr %172, i32 0, i32 1
  %174 = load i8, ptr %173, align 1, !tbaa !27
  %175 = zext i8 %174 to i32
  %176 = add nsw i32 %166, %175
  %177 = shl i32 %165, %176
  %178 = load ptr, ptr %7, align 8, !tbaa !5
  %179 = load i64, ptr %16, align 8, !tbaa !9
  %180 = load i32, ptr %11, align 4, !tbaa !21
  %181 = zext i32 %180 to i64
  %182 = mul i64 %179, %181
  %183 = load i32, ptr %17, align 4, !tbaa !21
  %184 = zext i32 %183 to i64
  %185 = add i64 %182, %184
  %186 = getelementptr inbounds i32, ptr %178, i64 %185
  store i32 %177, ptr %186, align 4, !tbaa !21
  br label %187

187:                                              ; preds = %152
  %188 = load i32, ptr %17, align 4, !tbaa !21
  %189 = add i32 %188, 1
  store i32 %189, ptr %17, align 4, !tbaa !21
  br label %148, !llvm.loop !28

190:                                              ; preds = %148
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  br label %191

191:                                              ; preds = %190
  %192 = load i64, ptr %16, align 8, !tbaa !9
  %193 = add i64 %192, 1
  store i64 %193, ptr %16, align 8, !tbaa !9
  br label %143, !llvm.loop !30

194:                                              ; preds = %143
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  br label %195

195:                                              ; preds = %194, %141
  %196 = load i64, ptr %13, align 8, !tbaa !9
  %197 = load i64, ptr %8, align 8, !tbaa !9
  %198 = add i64 %197, %196
  store i64 %198, ptr %8, align 8, !tbaa !9
  %199 = load i64, ptr %13, align 8, !tbaa !9
  %200 = load i32, ptr %11, align 4, !tbaa !21
  %201 = zext i32 %200 to i64
  %202 = mul i64 %199, %201
  %203 = load ptr, ptr %7, align 8, !tbaa !5
  %204 = getelementptr inbounds i32, ptr %203, i64 %202
  store ptr %204, ptr %7, align 8, !tbaa !5
  %205 = load i64, ptr %13, align 8, !tbaa !9
  %206 = load i64, ptr %6, align 8, !tbaa !9
  %207 = sub i64 %206, %205
  store i64 %207, ptr %6, align 8, !tbaa !9
  %208 = load i64, ptr %13, align 8, !tbaa !9
  %209 = load ptr, ptr %5, align 8, !tbaa !5
  %210 = getelementptr inbounds %struct.drflac, ptr %209, i32 0, i32 11
  %211 = load i64, ptr %210, align 8, !tbaa !31
  %212 = add i64 %211, %208
  store i64 %212, ptr %210, align 8, !tbaa !31
  %213 = load i64, ptr %13, align 8, !tbaa !9
  %214 = trunc i64 %213 to i32
  %215 = load ptr, ptr %5, align 8, !tbaa !5
  %216 = getelementptr inbounds %struct.drflac, ptr %215, i32 0, i32 10
  %217 = getelementptr inbounds %struct.drflac_frame, ptr %216, i32 0, i32 1
  %218 = load i32, ptr %217, align 8, !tbaa !22
  %219 = sub i32 %218, %214
  store i32 %219, ptr %217, align 8, !tbaa !22
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %220

220:                                              ; preds = %195, %51
  br label %37, !llvm.loop !32

221:                                              ; preds = %50, %37
  %222 = load i64, ptr %8, align 8, !tbaa !9
  store i64 %222, ptr %4, align 8
  store i32 1, ptr %10, align 4
  br label %223

223:                                              ; preds = %221, %27, %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  %224 = load i64, ptr %4, align 8
  ret i64 %224
}

; Function Attrs: alwaysinline mustprogress uwtable
declare hidden void @_ZL44drflac_read_pcm_frames_s32__decode_left_sideP6drflacmiPKiS2_Pi(ptr noundef, i64 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) #3

; Function Attrs: alwaysinline mustprogress uwtable
declare hidden void @_ZL45drflac_read_pcm_frames_s32__decode_right_sideP6drflacmiPKiS2_Pi(ptr noundef, i64 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) #3

; Function Attrs: alwaysinline mustprogress uwtable
declare hidden void @_ZL43drflac_read_pcm_frames_s32__decode_mid_sideP6drflacmiPKiS2_Pi(ptr noundef, i64 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) #3

; Function Attrs: alwaysinline mustprogress uwtable
declare hidden void @_ZL53drflac_read_pcm_frames_s32__decode_independent_stereoP6drflacmiPKiS2_Pi(ptr noundef, i64 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) #3

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !7, i64 53}
!12 = !{!"_ZTS6drflac", !6, i64 0, !6, i64 8, !13, i64 16, !14, i64 48, !7, i64 52, !7, i64 53, !15, i64 54, !10, i64 56, !16, i64 64, !14, i64 68, !17, i64 72, !10, i64 232, !10, i64 240, !19, i64 248, !6, i64 272, !6, i64 280, !6, i64 288, !14, i64 296, !14, i64 296, !14, i64 296, !20, i64 304, !7, i64 4480}
!13 = !{!"_ZTS27drflac_allocation_callbacks", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!14 = !{!"int", !7, i64 0}
!15 = !{!"short", !7, i64 0}
!16 = !{!"_ZTS16drflac_container", !7, i64 0}
!17 = !{!"_ZTS12drflac_frame", !18, i64 0, !14, i64 24, !7, i64 32}
!18 = !{!"_ZTS19drflac_frame_header", !10, i64 0, !14, i64 8, !14, i64 12, !15, i64 16, !7, i64 18, !7, i64 19, !7, i64 20}
!19 = !{!"_ZTS21drflac__memory_stream", !6, i64 0, !10, i64 8, !10, i64 16}
!20 = !{!"_ZTS9drflac_bs", !6, i64 0, !6, i64 8, !6, i64 16, !10, i64 24, !10, i64 32, !14, i64 40, !14, i64 44, !7, i64 48, !10, i64 4144, !15, i64 4152, !10, i64 4160, !14, i64 4168}
!21 = !{!14, !14, i64 0}
!22 = !{!12, !14, i64 96}
!23 = !{!12, !7, i64 90}
!24 = !{!12, !15, i64 88}
!25 = !{!26, !6, i64 8}
!26 = !{!"_ZTS15drflac_subframe", !7, i64 0, !7, i64 1, !7, i64 2, !6, i64 8}
!27 = !{!26, !7, i64 1}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}
!30 = distinct !{!30, !29}
!31 = !{!12, !10, i64 232}
!32 = distinct !{!32, !29}


; 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.drflac_subframe = type { i8, i8, i8, ptr }

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z34drflac__seek_forward_by_pcm_framesP6drflacm(ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL39drflac__read_and_decode_next_flac_frameP6drflac(ptr noundef) local_unnamed_addr #0

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare hidden noundef zeroext i8 @_ZL49drflac__get_channel_count_from_channel_assignmenta(i8 noundef signext) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local i64 @drflac_read_pcm_frames_s32(ptr noundef %0, i64 noundef %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = icmp eq ptr %0, null
  %5 = icmp eq i64 %1, 0
  %or.cond = or i1 %4, %5
  br i1 %or.cond, label %.loopexit91, label %6

6:                                                ; preds = %3
  %7 = icmp eq ptr %2, null
  br i1 %7, label %8, label %.lr.ph

8:                                                ; preds = %6
  %9 = tail call noundef i64 @_Z34drflac__seek_forward_by_pcm_framesP6drflacm(ptr noundef nonnull %0, i64 noundef %1)
  br label %.loopexit91

.lr.ph:                                           ; preds = %6
  %10 = getelementptr inbounds i8, ptr %0, i64 53
  %11 = load i8, ptr %10, align 1, !tbaa !5
  %12 = zext i8 %11 to i32
  %13 = sub nsw i32 32, %12
  %14 = getelementptr inbounds i8, ptr %0, i64 96
  %15 = getelementptr inbounds i8, ptr %0, i64 90
  %16 = getelementptr inbounds i8, ptr %0, i64 88
  %17 = getelementptr inbounds i8, ptr %0, i64 104
  %18 = getelementptr inbounds i8, ptr %0, i64 112
  %19 = getelementptr inbounds i8, ptr %0, i64 128
  %20 = getelementptr inbounds i8, ptr %0, i64 232
  br label %21

21:                                               ; preds = %.lr.ph, %99
  %.07899 = phi i64 [ %1, %.lr.ph ], [ %.1, %99 ]
  %.08096 = phi ptr [ %2, %.lr.ph ], [ %.181, %99 ]
  %.08295 = phi i64 [ 0, %.lr.ph ], [ %.183, %99 ]
  %22 = load i32, ptr %14, align 8, !tbaa !19
  %23 = icmp eq i32 %22, 0
  br i1 %23, label %24, label %26

24:                                               ; preds = %21
  %25 = tail call noundef i32 @_ZL39drflac__read_and_decode_next_flac_frameP6drflac(ptr noundef nonnull %0)
  %.not89 = icmp eq i32 %25, 0
  br i1 %.not89, label %.loopexit91, label %99

26:                                               ; preds = %21
  %27 = load i8, ptr %15, align 2, !tbaa !20
  %28 = tail call noundef zeroext i8 @_ZL49drflac__get_channel_count_from_channel_assignmenta(i8 noundef signext %27)
  %29 = load i16, ptr %16, align 8, !tbaa !21
  %30 = zext i16 %29 to i32
  %31 = load i32, ptr %14, align 8, !tbaa !19
  %32 = sub i32 %30, %31
  %33 = zext i32 %32 to i64
  %34 = zext i32 %31 to i64
  %spec.select = tail call i64 @llvm.umin.i64(i64 %.07899, i64 %34)
  %35 = icmp eq i8 %28, 2
  br i1 %35, label %79, label %.preheader90

.preheader90:                                     ; preds = %26
  %.not102 = icmp eq i32 %31, 0
  br i1 %.not102, label %.loopexit, label %.preheader.lr.ph

.preheader.lr.ph:                                 ; preds = %.preheader90
  %.not103 = icmp eq i8 %28, 0
  %36 = zext i8 %28 to i64
  br i1 %.not103, label %.loopexit, label %.preheader.us.preheader

.preheader.us.preheader:                          ; preds = %.preheader.lr.ph
  %umax = tail call i64 @llvm.umax.i64(i64 %spec.select, i64 1)
  %wide.trip.count = zext i8 %28 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %37 = icmp eq i8 %28, 1
  %unroll_iter = and i64 %wide.trip.count, 254
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %._crit_edge.us
  %.07693.us = phi i64 [ %78, %._crit_edge.us ], [ 0, %.preheader.us.preheader ]
  %38 = mul nuw nsw i64 %.07693.us, %36
  br i1 %37, label %._crit_edge.us.unr-lcssa, label %.preheader.us.new

.preheader.us.new:                                ; preds = %.preheader.us, %.preheader.us.new
  %indvars.iv = phi i64 [ %indvars.iv.next.1, %.preheader.us.new ], [ 0, %.preheader.us ]
  %niter = phi i64 [ %niter.next.1, %.preheader.us.new ], [ 0, %.preheader.us ]
  %39 = getelementptr inbounds [8 x %struct.drflac_subframe], ptr %17, i64 0, i64 %indvars.iv
  %40 = getelementptr inbounds i8, ptr %39, i64 8
  %41 = load ptr, ptr %40, align 8, !tbaa !22
  %42 = getelementptr inbounds i32, ptr %41, i64 %.07693.us
  %43 = getelementptr inbounds i32, ptr %42, i64 %33
  %44 = load i32, ptr %43, align 4, !tbaa !24
  %45 = getelementptr inbounds i8, ptr %39, i64 1
  %46 = load i8, ptr %45, align 1, !tbaa !25
  %47 = zext i8 %46 to i32
  %48 = add nsw i32 %13, %47
  %49 = shl i32 %44, %48
  %50 = add nuw nsw i64 %38, %indvars.iv
  %51 = getelementptr inbounds i32, ptr %.08096, i64 %50
  store i32 %49, ptr %51, align 4, !tbaa !24
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %52 = getelementptr inbounds [8 x %struct.drflac_subframe], ptr %17, i64 0, i64 %indvars.iv.next
  %53 = getelementptr inbounds i8, ptr %52, i64 8
  %54 = load ptr, ptr %53, align 8, !tbaa !22
  %55 = getelementptr inbounds i32, ptr %54, i64 %.07693.us
  %56 = getelementptr inbounds i32, ptr %55, i64 %33
  %57 = load i32, ptr %56, align 4, !tbaa !24
  %58 = getelementptr inbounds i8, ptr %52, i64 1
  %59 = load i8, ptr %58, align 1, !tbaa !25
  %60 = zext i8 %59 to i32
  %61 = add nsw i32 %13, %60
  %62 = shl i32 %57, %61
  %63 = add nuw nsw i64 %38, %indvars.iv.next
  %64 = getelementptr inbounds i32, ptr %.08096, i64 %63
  store i32 %62, ptr %64, align 4, !tbaa !24
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.us.unr-lcssa, label %.preheader.us.new, !llvm.loop !26

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

._crit_edge.us.epilog-lcssa:                      ; preds = %._crit_edge.us.unr-lcssa
  %65 = getelementptr inbounds [8 x %struct.drflac_subframe], ptr %17, i64 0, i64 %indvars.iv.unr
  %66 = getelementptr inbounds i8, ptr %65, i64 8
  %67 = load ptr, ptr %66, align 8, !tbaa !22
  %68 = getelementptr inbounds i32, ptr %67, i64 %.07693.us
  %69 = getelementptr inbounds i32, ptr %68, i64 %33
  %70 = load i32, ptr %69, align 4, !tbaa !24
  %71 = getelementptr inbounds i8, ptr %65, i64 1
  %72 = load i8, ptr %71, align 1, !tbaa !25
  %73 = zext i8 %72 to i32
  %74 = add nsw i32 %13, %73
  %75 = shl i32 %70, %74
  %76 = add nuw nsw i64 %38, %indvars.iv.unr
  %77 = getelementptr inbounds i32, ptr %.08096, i64 %76
  store i32 %75, ptr %77, align 4, !tbaa !24
  br label %._crit_edge.us

._crit_edge.us:                                   ; preds = %._crit_edge.us.unr-lcssa, %._crit_edge.us.epilog-lcssa
  %78 = add nuw nsw i64 %.07693.us, 1
  %exitcond106.not = icmp eq i64 %78, %umax
  br i1 %exitcond106.not, label %.loopexit, label %.preheader.us, !llvm.loop !28

79:                                               ; preds = %26
  %80 = load ptr, ptr %18, align 8, !tbaa !22
  %81 = getelementptr inbounds i32, ptr %80, i64 %33
  %82 = load ptr, ptr %19, align 8, !tbaa !22
  %83 = getelementptr inbounds i32, ptr %82, i64 %33
  %84 = load i8, ptr %15, align 2, !tbaa !20
  switch i8 %84, label %88 [
    i8 8, label %85
    i8 9, label %86
    i8 10, label %87
  ]

85:                                               ; preds = %79
  tail call void @_ZL44drflac_read_pcm_frames_s32__decode_left_sideP6drflacmiPKiS2_Pi(ptr noundef nonnull %0, i64 noundef %spec.select, i32 noundef %13, ptr noundef %81, ptr noundef %83, ptr noundef %.08096)
  br label %.loopexit

86:                                               ; preds = %79
  tail call void @_ZL45drflac_read_pcm_frames_s32__decode_right_sideP6drflacmiPKiS2_Pi(ptr noundef nonnull %0, i64 noundef %spec.select, i32 noundef %13, ptr noundef %81, ptr noundef %83, ptr noundef %.08096)
  br label %.loopexit

87:                                               ; preds = %79
  tail call void @_ZL43drflac_read_pcm_frames_s32__decode_mid_sideP6drflacmiPKiS2_Pi(ptr noundef nonnull %0, i64 noundef %spec.select, i32 noundef %13, ptr noundef %81, ptr noundef %83, ptr noundef %.08096)
  br label %.loopexit

88:                                               ; preds = %79
  tail call void @_ZL53drflac_read_pcm_frames_s32__decode_independent_stereoP6drflacmiPKiS2_Pi(ptr noundef nonnull %0, i64 noundef %spec.select, i32 noundef %13, ptr noundef %81, ptr noundef %83, ptr noundef %.08096)
  br label %.loopexit

.loopexit:                                        ; preds = %._crit_edge.us, %.preheader.lr.ph, %.preheader90, %85, %86, %87, %88
  %89 = add i64 %spec.select, %.08295
  %90 = zext i8 %28 to i64
  %91 = mul nuw nsw i64 %spec.select, %90
  %92 = getelementptr inbounds i32, ptr %.08096, i64 %91
  %93 = sub i64 %.07899, %spec.select
  %94 = load i64, ptr %20, align 8, !tbaa !29
  %95 = add i64 %94, %spec.select
  store i64 %95, ptr %20, align 8, !tbaa !29
  %96 = trunc nuw i64 %spec.select to i32
  %97 = load i32, ptr %14, align 8, !tbaa !19
  %98 = sub i32 %97, %96
  store i32 %98, ptr %14, align 8, !tbaa !19
  br label %99

99:                                               ; preds = %24, %.loopexit
  %.183 = phi i64 [ %.08295, %24 ], [ %89, %.loopexit ]
  %.181 = phi ptr [ %.08096, %24 ], [ %92, %.loopexit ]
  %.1 = phi i64 [ %.07899, %24 ], [ %93, %.loopexit ]
  %.not = icmp eq i64 %.1, 0
  br i1 %.not, label %.loopexit91, label %21, !llvm.loop !30

.loopexit91:                                      ; preds = %24, %99, %3, %8
  %.077 = phi i64 [ %9, %8 ], [ 0, %3 ], [ %.08295, %24 ], [ %.183, %99 ]
  ret i64 %.077
}

; Function Attrs: alwaysinline mustprogress uwtable
declare hidden void @_ZL44drflac_read_pcm_frames_s32__decode_left_sideP6drflacmiPKiS2_Pi(ptr noundef, i64 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: alwaysinline mustprogress uwtable
declare hidden void @_ZL45drflac_read_pcm_frames_s32__decode_right_sideP6drflacmiPKiS2_Pi(ptr noundef, i64 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: alwaysinline mustprogress uwtable
declare hidden void @_ZL43drflac_read_pcm_frames_s32__decode_mid_sideP6drflacmiPKiS2_Pi(ptr noundef, i64 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: alwaysinline mustprogress uwtable
declare hidden void @_ZL53drflac_read_pcm_frames_s32__decode_independent_stereoP6drflacmiPKiS2_Pi(ptr noundef, i64 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { alwaysinline mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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, !8, i64 53}
!6 = !{!"_ZTS6drflac", !7, i64 0, !7, i64 8, !10, i64 16, !11, i64 48, !8, i64 52, !8, i64 53, !12, i64 54, !13, i64 56, !14, i64 64, !11, i64 68, !15, i64 72, !13, i64 232, !13, i64 240, !17, i64 248, !7, i64 272, !7, i64 280, !7, i64 288, !11, i64 296, !11, i64 296, !11, i64 296, !18, i64 304, !8, i64 4480}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTS27drflac_allocation_callbacks", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!11 = !{!"int", !8, i64 0}
!12 = !{!"short", !8, i64 0}
!13 = !{!"long", !8, i64 0}
!14 = !{!"_ZTS16drflac_container", !8, i64 0}
!15 = !{!"_ZTS12drflac_frame", !16, i64 0, !11, i64 24, !8, i64 32}
!16 = !{!"_ZTS19drflac_frame_header", !13, i64 0, !11, i64 8, !11, i64 12, !12, i64 16, !8, i64 18, !8, i64 19, !8, i64 20}
!17 = !{!"_ZTS21drflac__memory_stream", !7, i64 0, !13, i64 8, !13, i64 16}
!18 = !{!"_ZTS9drflac_bs", !7, i64 0, !7, i64 8, !7, i64 16, !13, i64 24, !13, i64 32, !11, i64 40, !11, i64 44, !8, i64 48, !13, i64 4144, !12, i64 4152, !13, i64 4160, !11, i64 4168}
!19 = !{!6, !11, i64 96}
!20 = !{!6, !8, i64 90}
!21 = !{!6, !12, i64 88}
!22 = !{!23, !7, i64 8}
!23 = !{!"_ZTS15drflac_subframe", !8, i64 0, !8, i64 1, !8, i64 2, !7, i64 8}
!24 = !{!11, !11, i64 0}
!25 = !{!23, !8, i64 1}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = distinct !{!28, !27}
!29 = !{!6, !13, i64 232}
!30 = distinct !{!30, !27}


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