; LLVM IR from SelfishOlex/MiniAudioO3DE :: MiniAudio/Code/Source/Clients (MiniAudioImplementation)

; 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 }

@.str.6 = external hidden unnamed_addr constant [104 x i8], align 1
@.str.170 = external hidden unnamed_addr constant [27 x i8], align 1
@__PRETTY_FUNCTION__.drflac_read_pcm_frames_s16 = external hidden unnamed_addr constant [82 x i8], align 1

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local i64 @drflac_read_pcm_frames_s16(ptr noundef %0, i64 noundef %1, ptr noundef %2) #2 {
  %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
  %18 = 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) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = icmp eq ptr %19, null
  br i1 %20, label %24, label %21

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

24:                                               ; preds = %21, %3
  store i64 0, ptr %4, align 8
  store i32 1, ptr %10, align 4
  br label %236

25:                                               ; preds = %21
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = icmp eq ptr %26, null
  br i1 %27, label %28, label %32

28:                                               ; preds = %25
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = load i64, ptr %6, align 8, !tbaa !9
  %31 = call noundef i64 @_ZL34drflac__seek_forward_by_pcm_framesP6drflacy(ptr noundef %29, i64 noundef %30)
  store i64 %31, ptr %4, align 8
  store i32 1, ptr %10, align 4
  br label %236

32:                                               ; preds = %25
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.drflac, ptr %33, i32 0, i32 5
  %35 = load i8, ptr %34, align 1, !tbaa !11
  %36 = zext i8 %35 to i32
  %37 = icmp sle i32 %36, 32
  br i1 %37, label %38, label %39

38:                                               ; preds = %32
  br label %41

39:                                               ; preds = %32
  call void @__assert_fail(ptr noundef @.str.170, ptr noundef @.str.6, i32 noundef 85971, ptr noundef @__PRETTY_FUNCTION__.drflac_read_pcm_frames_s16) #6
  unreachable

40:                                               ; No predecessors!
  br label %41

41:                                               ; preds = %40, %38
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.drflac, ptr %42, i32 0, i32 5
  %44 = load i8, ptr %43, align 1, !tbaa !11
  %45 = zext i8 %44 to i32
  %46 = sub nsw i32 32, %45
  store i32 %46, ptr %9, align 4, !tbaa !22
  store i64 0, ptr %8, align 8, !tbaa !9
  br label %47

47:                                               ; preds = %233, %41
  %48 = load i64, ptr %6, align 8, !tbaa !9
  %49 = icmp ugt i64 %48, 0
  br i1 %49, label %50, label %234

50:                                               ; preds = %47
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.drflac, ptr %51, i32 0, i32 10
  %53 = getelementptr inbounds %struct.drflac_frame, ptr %52, i32 0, i32 1
  %54 = load i32, ptr %53, align 8, !tbaa !23
  %55 = icmp eq i32 %54, 0
  br i1 %55, label %56, label %62

56:                                               ; preds = %50
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = call noundef i32 @_ZL39drflac__read_and_decode_next_flac_frameP6drflac(ptr noundef %57)
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %61, label %60

60:                                               ; preds = %56
  br label %234

61:                                               ; preds = %56
  br label %233

62:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.drflac, ptr %63, i32 0, i32 10
  %65 = getelementptr inbounds %struct.drflac_frame, ptr %64, i32 0, i32 0
  %66 = getelementptr inbounds %struct.drflac_frame_header, ptr %65, i32 0, i32 4
  %67 = load i8, ptr %66, align 2, !tbaa !24
  %68 = call noundef zeroext i8 @_ZL49drflac__get_channel_count_from_channel_assignmenta(i8 noundef signext %67)
  %69 = zext i8 %68 to i32
  store i32 %69, ptr %11, align 4, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.drflac, ptr %70, i32 0, i32 10
  %72 = getelementptr inbounds %struct.drflac_frame, ptr %71, i32 0, i32 0
  %73 = getelementptr inbounds %struct.drflac_frame_header, ptr %72, i32 0, i32 3
  %74 = load i16, ptr %73, align 8, !tbaa !25
  %75 = zext i16 %74 to i32
  %76 = load ptr, ptr %5, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.drflac, ptr %76, i32 0, i32 10
  %78 = getelementptr inbounds %struct.drflac_frame, ptr %77, i32 0, i32 1
  %79 = load i32, ptr %78, align 8, !tbaa !23
  %80 = sub i32 %75, %79
  %81 = zext i32 %80 to i64
  store i64 %81, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %82 = load i64, ptr %6, align 8, !tbaa !9
  store i64 %82, ptr %13, align 8, !tbaa !9
  %83 = load i64, ptr %13, align 8, !tbaa !9
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.drflac, ptr %84, i32 0, i32 10
  %86 = getelementptr inbounds %struct.drflac_frame, ptr %85, i32 0, i32 1
  %87 = load i32, ptr %86, align 8, !tbaa !23
  %88 = zext i32 %87 to i64
  %89 = icmp ugt i64 %83, %88
  br i1 %89, label %90, label %96

90:                                               ; preds = %62
  %91 = load ptr, ptr %5, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.drflac, ptr %91, i32 0, i32 10
  %93 = getelementptr inbounds %struct.drflac_frame, ptr %92, i32 0, i32 1
  %94 = load i32, ptr %93, align 8, !tbaa !23
  %95 = zext i32 %94 to i64
  store i64 %95, ptr %13, align 8, !tbaa !9
  br label %96

96:                                               ; preds = %90, %62
  %97 = load i32, ptr %11, align 4, !tbaa !22
  %98 = icmp eq i32 %97, 2
  br i1 %98, label %99, label %152

99:                                               ; preds = %96
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %100 = load ptr, ptr %5, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.drflac, ptr %100, i32 0, i32 10
  %102 = getelementptr inbounds %struct.drflac_frame, ptr %101, i32 0, i32 2
  %103 = getelementptr inbounds [8 x %struct.drflac_subframe], ptr %102, i64 0, i64 0
  %104 = getelementptr inbounds %struct.drflac_subframe, ptr %103, i32 0, i32 3
  %105 = load ptr, ptr %104, align 8, !tbaa !26
  %106 = load i64, ptr %12, align 8, !tbaa !9
  %107 = getelementptr inbounds i32, ptr %105, i64 %106
  store ptr %107, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %108 = load ptr, ptr %5, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.drflac, ptr %108, i32 0, i32 10
  %110 = getelementptr inbounds %struct.drflac_frame, ptr %109, i32 0, i32 2
  %111 = getelementptr inbounds [8 x %struct.drflac_subframe], ptr %110, i64 0, i64 1
  %112 = getelementptr inbounds %struct.drflac_subframe, ptr %111, i32 0, i32 3
  %113 = load ptr, ptr %112, align 8, !tbaa !26
  %114 = load i64, ptr %12, align 8, !tbaa !9
  %115 = getelementptr inbounds i32, ptr %113, i64 %114
  store ptr %115, ptr %15, align 8, !tbaa !5
  %116 = load ptr, ptr %5, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.drflac, ptr %116, i32 0, i32 10
  %118 = getelementptr inbounds %struct.drflac_frame, ptr %117, i32 0, i32 0
  %119 = getelementptr inbounds %struct.drflac_frame_header, ptr %118, i32 0, i32 4
  %120 = load i8, ptr %119, align 2, !tbaa !24
  %121 = zext i8 %120 to i32
  switch i32 %121, label %144 [
    i32 8, label %122
    i32 9, label %129
    i32 10, label %136
    i32 0, label %143
  ]

122:                                              ; preds = %99
  %123 = load ptr, ptr %5, align 8, !tbaa !5
  %124 = load i64, ptr %13, align 8, !tbaa !9
  %125 = load i32, ptr %9, align 4, !tbaa !22
  %126 = load ptr, ptr %14, align 8, !tbaa !5
  %127 = load ptr, ptr %15, align 8, !tbaa !5
  %128 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZL44drflac_read_pcm_frames_s16__decode_left_sideP6drflacyjPKiS2_Ps(ptr noundef %123, i64 noundef %124, i32 noundef %125, ptr noundef %126, ptr noundef %127, ptr noundef %128)
  br label %151

129:                                              ; preds = %99
  %130 = load ptr, ptr %5, align 8, !tbaa !5
  %131 = load i64, ptr %13, align 8, !tbaa !9
  %132 = load i32, ptr %9, align 4, !tbaa !22
  %133 = load ptr, ptr %14, align 8, !tbaa !5
  %134 = load ptr, ptr %15, align 8, !tbaa !5
  %135 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZL45drflac_read_pcm_frames_s16__decode_right_sideP6drflacyjPKiS2_Ps(ptr noundef %130, i64 noundef %131, i32 noundef %132, ptr noundef %133, ptr noundef %134, ptr noundef %135)
  br label %151

136:                                              ; preds = %99
  %137 = load ptr, ptr %5, align 8, !tbaa !5
  %138 = load i64, ptr %13, align 8, !tbaa !9
  %139 = load i32, ptr %9, align 4, !tbaa !22
  %140 = load ptr, ptr %14, align 8, !tbaa !5
  %141 = load ptr, ptr %15, align 8, !tbaa !5
  %142 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZL43drflac_read_pcm_frames_s16__decode_mid_sideP6drflacyjPKiS2_Ps(ptr noundef %137, i64 noundef %138, i32 noundef %139, ptr noundef %140, ptr noundef %141, ptr noundef %142)
  br label %151

143:                                              ; preds = %99
  br label %144

144:                                              ; preds = %143, %99
  %145 = load ptr, ptr %5, align 8, !tbaa !5
  %146 = load i64, ptr %13, align 8, !tbaa !9
  %147 = load i32, ptr %9, align 4, !tbaa !22
  %148 = load ptr, ptr %14, align 8, !tbaa !5
  %149 = load ptr, ptr %15, align 8, !tbaa !5
  %150 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZL53drflac_read_pcm_frames_s16__decode_independent_stereoP6drflacyjPKiS2_Ps(ptr noundef %145, i64 noundef %146, i32 noundef %147, ptr noundef %148, ptr noundef %149, ptr noundef %150)
  br label %151

151:                                              ; preds = %144, %136, %129, %122
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %208

152:                                              ; preds = %96
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  store i64 0, ptr %16, align 8, !tbaa !9
  br label %153

153:                                              ; preds = %204, %152
  %154 = load i64, ptr %16, align 8, !tbaa !9
  %155 = load i64, ptr %13, align 8, !tbaa !9
  %156 = icmp ult i64 %154, %155
  br i1 %156, label %157, label %207

157:                                              ; preds = %153
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  store i32 0, ptr %17, align 4, !tbaa !22
  br label %158

158:                                              ; preds = %200, %157
  %159 = load i32, ptr %17, align 4, !tbaa !22
  %160 = load i32, ptr %11, align 4, !tbaa !22
  %161 = icmp ult i32 %159, %160
  br i1 %161, label %162, label %203

162:                                              ; preds = %158
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  %163 = load ptr, ptr %5, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.drflac, ptr %163, i32 0, i32 10
  %165 = getelementptr inbounds %struct.drflac_frame, ptr %164, i32 0, i32 2
  %166 = load i32, ptr %17, align 4, !tbaa !22
  %167 = zext i32 %166 to i64
  %168 = getelementptr inbounds [8 x %struct.drflac_subframe], ptr %165, i64 0, i64 %167
  %169 = getelementptr inbounds %struct.drflac_subframe, ptr %168, i32 0, i32 3
  %170 = load ptr, ptr %169, align 8, !tbaa !26
  %171 = load i64, ptr %12, align 8, !tbaa !9
  %172 = load i64, ptr %16, align 8, !tbaa !9
  %173 = add i64 %171, %172
  %174 = getelementptr inbounds i32, ptr %170, i64 %173
  %175 = load i32, ptr %174, align 4, !tbaa !22
  %176 = load i32, ptr %9, align 4, !tbaa !22
  %177 = load ptr, ptr %5, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.drflac, ptr %177, i32 0, i32 10
  %179 = getelementptr inbounds %struct.drflac_frame, ptr %178, i32 0, i32 2
  %180 = load i32, ptr %17, align 4, !tbaa !22
  %181 = zext i32 %180 to i64
  %182 = getelementptr inbounds [8 x %struct.drflac_subframe], ptr %179, i64 0, i64 %181
  %183 = getelementptr inbounds %struct.drflac_subframe, ptr %182, i32 0, i32 1
  %184 = load i8, ptr %183, align 1, !tbaa !28
  %185 = zext i8 %184 to i32
  %186 = add i32 %176, %185
  %187 = shl i32 %175, %186
  store i32 %187, ptr %18, align 4, !tbaa !22
  %188 = load i32, ptr %18, align 4, !tbaa !22
  %189 = ashr i32 %188, 16
  %190 = trunc i32 %189 to i16
  %191 = load ptr, ptr %7, align 8, !tbaa !5
  %192 = load i64, ptr %16, align 8, !tbaa !9
  %193 = load i32, ptr %11, align 4, !tbaa !22
  %194 = zext i32 %193 to i64
  %195 = mul i64 %192, %194
  %196 = load i32, ptr %17, align 4, !tbaa !22
  %197 = zext i32 %196 to i64
  %198 = add i64 %195, %197
  %199 = getelementptr inbounds i16, ptr %191, i64 %198
  store i16 %190, ptr %199, align 2, !tbaa !29
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %200

200:                                              ; preds = %162
  %201 = load i32, ptr %17, align 4, !tbaa !22
  %202 = add i32 %201, 1
  store i32 %202, ptr %17, align 4, !tbaa !22
  br label %158, !llvm.loop !30

203:                                              ; preds = %158
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %204

204:                                              ; preds = %203
  %205 = load i64, ptr %16, align 8, !tbaa !9
  %206 = add i64 %205, 1
  store i64 %206, ptr %16, align 8, !tbaa !9
  br label %153, !llvm.loop !32

207:                                              ; preds = %153
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  br label %208

208:                                              ; preds = %207, %151
  %209 = load i64, ptr %13, align 8, !tbaa !9
  %210 = load i64, ptr %8, align 8, !tbaa !9
  %211 = add i64 %210, %209
  store i64 %211, ptr %8, align 8, !tbaa !9
  %212 = load i64, ptr %13, align 8, !tbaa !9
  %213 = load i32, ptr %11, align 4, !tbaa !22
  %214 = zext i32 %213 to i64
  %215 = mul i64 %212, %214
  %216 = load ptr, ptr %7, align 8, !tbaa !5
  %217 = getelementptr inbounds i16, ptr %216, i64 %215
  store ptr %217, ptr %7, align 8, !tbaa !5
  %218 = load i64, ptr %13, align 8, !tbaa !9
  %219 = load i64, ptr %6, align 8, !tbaa !9
  %220 = sub i64 %219, %218
  store i64 %220, ptr %6, align 8, !tbaa !9
  %221 = load i64, ptr %13, align 8, !tbaa !9
  %222 = load ptr, ptr %5, align 8, !tbaa !5
  %223 = getelementptr inbounds %struct.drflac, ptr %222, i32 0, i32 11
  %224 = load i64, ptr %223, align 8, !tbaa !33
  %225 = add i64 %224, %221
  store i64 %225, ptr %223, align 8, !tbaa !33
  %226 = load i64, ptr %13, align 8, !tbaa !9
  %227 = trunc i64 %226 to i32
  %228 = load ptr, ptr %5, align 8, !tbaa !5
  %229 = getelementptr inbounds %struct.drflac, ptr %228, i32 0, i32 10
  %230 = getelementptr inbounds %struct.drflac_frame, ptr %229, i32 0, i32 1
  %231 = load i32, ptr %230, align 8, !tbaa !23
  %232 = sub i32 %231, %227
  store i32 %232, ptr %230, align 8, !tbaa !23
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %233

233:                                              ; preds = %208, %61
  br label %47, !llvm.loop !34

234:                                              ; preds = %60, %47
  %235 = load i64, ptr %8, align 8, !tbaa !9
  store i64 %235, ptr %4, align 8
  store i32 1, ptr %10, align 4
  br label %236

236:                                              ; preds = %234, %28, %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  %237 = load i64, ptr %4, align 8
  ret i64 %237
}

; Function Attrs: mustprogress uwtable
declare hidden noundef i64 @_ZL34drflac__seek_forward_by_pcm_framesP6drflacy(ptr noundef, i64 noundef) #2

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

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

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

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

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long 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, !21, 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, !20, i64 8, !20, i64 16}
!20 = !{!"long", !7, i64 0}
!21 = !{!"_ZTS9drflac_bs", !6, i64 0, !6, i64 8, !6, i64 16, !20, 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}
!22 = !{!14, !14, i64 0}
!23 = !{!12, !14, i64 96}
!24 = !{!12, !7, i64 90}
!25 = !{!12, !15, i64 88}
!26 = !{!27, !6, i64 8}
!27 = !{!"_ZTS15drflac_subframe", !7, i64 0, !7, i64 1, !7, i64 2, !6, i64 8}
!28 = !{!27, !7, i64 1}
!29 = !{!15, !15, i64 0}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}
!32 = distinct !{!32, !31}
!33 = !{!12, !10, i64 232}
!34 = distinct !{!34, !31}


; 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 }

@.str.6 = external hidden unnamed_addr constant [104 x i8], align 1
@.str.170 = external hidden unnamed_addr constant [27 x i8], align 1
@__PRETTY_FUNCTION__.drflac_read_pcm_frames_s16 = external hidden unnamed_addr constant [82 x i8], align 1

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

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

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

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

10:                                               ; preds = %6
  %11 = getelementptr inbounds i8, ptr %0, i64 53
  %12 = load i8, ptr %11, align 1, !tbaa !5
  %13 = icmp ult i8 %12, 33
  br i1 %13, label %.lr.ph, label %14

14:                                               ; preds = %10
  tail call void @__assert_fail(ptr noundef nonnull @.str.170, ptr noundef nonnull @.str.6, i32 noundef 85971, ptr noundef nonnull @__PRETTY_FUNCTION__.drflac_read_pcm_frames_s16) #5
  unreachable

.lr.ph:                                           ; preds = %10
  %15 = zext nneg i8 %12 to i32
  %16 = sub nuw nsw i32 32, %15
  %17 = getelementptr inbounds i8, ptr %0, i64 96
  %18 = getelementptr inbounds i8, ptr %0, i64 90
  %19 = getelementptr inbounds i8, ptr %0, i64 88
  %20 = getelementptr inbounds i8, ptr %0, i64 104
  %21 = getelementptr inbounds i8, ptr %0, i64 112
  %22 = getelementptr inbounds i8, ptr %0, i64 128
  %23 = getelementptr inbounds i8, ptr %0, i64 232
  br label %24

24:                                               ; preds = %.lr.ph, %108
  %.080102 = phi i64 [ %1, %.lr.ph ], [ %.1, %108 ]
  %.08199 = phi ptr [ %2, %.lr.ph ], [ %.182, %108 ]
  %.08498 = phi i64 [ 0, %.lr.ph ], [ %.185, %108 ]
  %25 = load i32, ptr %17, align 8, !tbaa !20
  %26 = icmp eq i32 %25, 0
  br i1 %26, label %27, label %29

27:                                               ; preds = %24
  %28 = tail call noundef i32 @_ZL39drflac__read_and_decode_next_flac_frameP6drflac(ptr noundef nonnull %0)
  %.not92 = icmp eq i32 %28, 0
  br i1 %.not92, label %.loopexit94, label %108

29:                                               ; preds = %24
  %30 = load i8, ptr %18, align 2, !tbaa !21
  %31 = tail call noundef zeroext i8 @_ZL49drflac__get_channel_count_from_channel_assignmenta(i8 noundef signext %30)
  %32 = load i16, ptr %19, align 8, !tbaa !22
  %33 = zext i16 %32 to i32
  %34 = load i32, ptr %17, align 8, !tbaa !20
  %35 = sub i32 %33, %34
  %36 = zext i32 %35 to i64
  %37 = zext i32 %34 to i64
  %spec.select = tail call i64 @llvm.umin.i64(i64 %.080102, i64 %37)
  %38 = icmp eq i8 %31, 2
  br i1 %38, label %88, label %.preheader93

.preheader93:                                     ; preds = %29
  %.not105 = icmp eq i32 %34, 0
  br i1 %.not105, label %.loopexit, label %.preheader.lr.ph

.preheader.lr.ph:                                 ; preds = %.preheader93
  %.not106 = icmp eq i8 %31, 0
  %39 = zext i8 %31 to i64
  br i1 %.not106, 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 %31 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %40 = icmp eq i8 %31, 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
  %.07996.us = phi i64 [ %87, %._crit_edge.us ], [ 0, %.preheader.us.preheader ]
  %41 = mul nuw nsw i64 %.07996.us, %39
  br i1 %40, 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 ]
  %42 = getelementptr inbounds [8 x %struct.drflac_subframe], ptr %20, i64 0, i64 %indvars.iv
  %43 = getelementptr inbounds i8, ptr %42, i64 8
  %44 = load ptr, ptr %43, align 8, !tbaa !23
  %45 = getelementptr inbounds i32, ptr %44, i64 %.07996.us
  %46 = getelementptr inbounds i32, ptr %45, i64 %36
  %47 = load i32, ptr %46, align 4, !tbaa !25
  %48 = getelementptr inbounds i8, ptr %42, i64 1
  %49 = load i8, ptr %48, align 1, !tbaa !26
  %50 = zext i8 %49 to i32
  %51 = add nuw nsw i32 %16, %50
  %52 = shl i32 %47, %51
  %53 = lshr i32 %52, 16
  %54 = trunc nuw i32 %53 to i16
  %55 = add nuw nsw i64 %41, %indvars.iv
  %56 = getelementptr inbounds i16, ptr %.08199, i64 %55
  store i16 %54, ptr %56, align 2, !tbaa !27
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %57 = getelementptr inbounds [8 x %struct.drflac_subframe], ptr %20, i64 0, i64 %indvars.iv.next
  %58 = getelementptr inbounds i8, ptr %57, i64 8
  %59 = load ptr, ptr %58, align 8, !tbaa !23
  %60 = getelementptr inbounds i32, ptr %59, i64 %.07996.us
  %61 = getelementptr inbounds i32, ptr %60, i64 %36
  %62 = load i32, ptr %61, align 4, !tbaa !25
  %63 = getelementptr inbounds i8, ptr %57, i64 1
  %64 = load i8, ptr %63, align 1, !tbaa !26
  %65 = zext i8 %64 to i32
  %66 = add nuw nsw i32 %16, %65
  %67 = shl i32 %62, %66
  %68 = lshr i32 %67, 16
  %69 = trunc nuw i32 %68 to i16
  %70 = add nuw nsw i64 %41, %indvars.iv.next
  %71 = getelementptr inbounds i16, ptr %.08199, i64 %70
  store i16 %69, ptr %71, align 2, !tbaa !27
  %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 !28

._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
  %72 = getelementptr inbounds [8 x %struct.drflac_subframe], ptr %20, i64 0, i64 %indvars.iv.unr
  %73 = getelementptr inbounds i8, ptr %72, i64 8
  %74 = load ptr, ptr %73, align 8, !tbaa !23
  %75 = getelementptr inbounds i32, ptr %74, i64 %.07996.us
  %76 = getelementptr inbounds i32, ptr %75, i64 %36
  %77 = load i32, ptr %76, align 4, !tbaa !25
  %78 = getelementptr inbounds i8, ptr %72, i64 1
  %79 = load i8, ptr %78, align 1, !tbaa !26
  %80 = zext i8 %79 to i32
  %81 = add nuw nsw i32 %16, %80
  %82 = shl i32 %77, %81
  %83 = lshr i32 %82, 16
  %84 = trunc nuw i32 %83 to i16
  %85 = add nuw nsw i64 %41, %indvars.iv.unr
  %86 = getelementptr inbounds i16, ptr %.08199, i64 %85
  store i16 %84, ptr %86, align 2, !tbaa !27
  br label %._crit_edge.us

._crit_edge.us:                                   ; preds = %._crit_edge.us.unr-lcssa, %._crit_edge.us.epilog-lcssa
  %87 = add nuw nsw i64 %.07996.us, 1
  %exitcond109.not = icmp eq i64 %87, %umax
  br i1 %exitcond109.not, label %.loopexit, label %.preheader.us, !llvm.loop !30

88:                                               ; preds = %29
  %89 = load ptr, ptr %21, align 8, !tbaa !23
  %90 = getelementptr inbounds i32, ptr %89, i64 %36
  %91 = load ptr, ptr %22, align 8, !tbaa !23
  %92 = getelementptr inbounds i32, ptr %91, i64 %36
  %93 = load i8, ptr %18, align 2, !tbaa !21
  switch i8 %93, label %97 [
    i8 8, label %94
    i8 9, label %95
    i8 10, label %96
  ]

94:                                               ; preds = %88
  tail call void @_ZL44drflac_read_pcm_frames_s16__decode_left_sideP6drflacyjPKiS2_Ps(ptr noundef nonnull %0, i64 noundef %spec.select, i32 noundef %16, ptr noundef %90, ptr noundef %92, ptr noundef %.08199)
  br label %.loopexit

95:                                               ; preds = %88
  tail call void @_ZL45drflac_read_pcm_frames_s16__decode_right_sideP6drflacyjPKiS2_Ps(ptr noundef nonnull %0, i64 noundef %spec.select, i32 noundef %16, ptr noundef %90, ptr noundef %92, ptr noundef %.08199)
  br label %.loopexit

96:                                               ; preds = %88
  tail call void @_ZL43drflac_read_pcm_frames_s16__decode_mid_sideP6drflacyjPKiS2_Ps(ptr noundef nonnull %0, i64 noundef %spec.select, i32 noundef %16, ptr noundef %90, ptr noundef %92, ptr noundef %.08199)
  br label %.loopexit

97:                                               ; preds = %88
  tail call void @_ZL53drflac_read_pcm_frames_s16__decode_independent_stereoP6drflacyjPKiS2_Ps(ptr noundef nonnull %0, i64 noundef %spec.select, i32 noundef %16, ptr noundef %90, ptr noundef %92, ptr noundef %.08199)
  br label %.loopexit

.loopexit:                                        ; preds = %._crit_edge.us, %.preheader.lr.ph, %.preheader93, %94, %95, %96, %97
  %98 = add i64 %spec.select, %.08498
  %99 = zext i8 %31 to i64
  %100 = mul nuw nsw i64 %spec.select, %99
  %101 = getelementptr inbounds i16, ptr %.08199, i64 %100
  %102 = sub i64 %.080102, %spec.select
  %103 = load i64, ptr %23, align 8, !tbaa !31
  %104 = add i64 %103, %spec.select
  store i64 %104, ptr %23, align 8, !tbaa !31
  %105 = trunc nuw i64 %spec.select to i32
  %106 = load i32, ptr %17, align 8, !tbaa !20
  %107 = sub i32 %106, %105
  store i32 %107, ptr %17, align 8, !tbaa !20
  br label %108

108:                                              ; preds = %27, %.loopexit
  %.185 = phi i64 [ %.08498, %27 ], [ %98, %.loopexit ]
  %.182 = phi ptr [ %.08199, %27 ], [ %101, %.loopexit ]
  %.1 = phi i64 [ %.080102, %27 ], [ %102, %.loopexit ]
  %.not = icmp eq i64 %.1, 0
  br i1 %.not, label %.loopexit94, label %24, !llvm.loop !32

.loopexit94:                                      ; preds = %27, %108, %3, %8
  %.0 = phi i64 [ %9, %8 ], [ 0, %3 ], [ %.08498, %27 ], [ %.185, %108 ]
  ret i64 %.0
}

; Function Attrs: mustprogress uwtable
declare hidden noundef i64 @_ZL34drflac__seek_forward_by_pcm_framesP6drflacy(ptr noundef, i64 noundef) local_unnamed_addr #1

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

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

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

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

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

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

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

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

attributes #0 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { noreturn nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !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, !19, 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 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, !18, i64 8, !18, i64 16}
!18 = !{!"long", !8, i64 0}
!19 = !{!"_ZTS9drflac_bs", !7, i64 0, !7, i64 8, !7, i64 16, !18, 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}
!20 = !{!6, !11, i64 96}
!21 = !{!6, !8, i64 90}
!22 = !{!6, !12, i64 88}
!23 = !{!24, !7, i64 8}
!24 = !{!"_ZTS15drflac_subframe", !8, i64 0, !8, i64 1, !8, i64 2, !7, i64 8}
!25 = !{!11, !11, i64 0}
!26 = !{!24, !8, i64 1}
!27 = !{!12, !12, i64 0}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}
!30 = distinct !{!30, !29}
!31 = !{!6, !13, i64 232}
!32 = distinct !{!32, !29}


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