; 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.drwav = type { ptr, ptr, ptr, ptr, %struct.drwav_allocation_callbacks, i32, %struct.drwav_fmt, i32, i16, i16, i16, i64, i64, i64, i64, i64, i64, i32, i32, ptr, i32, %struct.drwav__memory_stream, %struct.drwav__memory_stream_write, %struct.anon.57, %struct.anon.58 }
%struct.drwav_allocation_callbacks = type { ptr, ptr, ptr, ptr }
%struct.drwav_fmt = type { i16, i16, i32, i32, i16, i16, i16, i16, i32, [16 x i8] }
%struct.drwav__memory_stream = type { ptr, i64, i64 }
%struct.drwav__memory_stream_write = type { ptr, ptr, i64, i64, i64 }
%struct.anon.57 = type { i32, [2 x i16], [2 x i32], [4 x i32], i32, [2 x [2 x i32]] }
%struct.anon.58 = type { i32, [2 x i32], [2 x i32], [16 x i32], i32 }

@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [104 x i8], align 1
@__PRETTY_FUNCTION__.drwav_seek_to_pcm_frame = external hidden unnamed_addr constant [60 x i8], align 1
@.str.166 = external hidden unnamed_addr constant [41 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 i32 @drwav_seek_to_pcm_frame(ptr noundef %0, i64 noundef %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca [2048 x i16], align 16
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !9
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = icmp eq ptr %17, null
  br i1 %18, label %24, label %19

19:                                               ; preds = %2
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.drwav, ptr %20, i32 0, i32 2
  %22 = load ptr, ptr %21, align 8, !tbaa !11
  %23 = icmp eq ptr %22, null
  br i1 %23, label %24, label %25

24:                                               ; preds = %19, %2
  store i32 0, ptr %3, align 4
  br label %231

25:                                               ; preds = %19
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.drwav, ptr %26, i32 0, i32 1
  %28 = load ptr, ptr %27, align 8, !tbaa !24
  %29 = icmp ne ptr %28, null
  br i1 %29, label %30, label %31

30:                                               ; preds = %25
  store i32 0, ptr %3, align 4
  br label %231

31:                                               ; preds = %25
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.drwav, ptr %32, i32 0, i32 11
  %34 = load i64, ptr %33, align 8, !tbaa !25
  %35 = icmp eq i64 %34, 0
  br i1 %35, label %36, label %37

36:                                               ; preds = %31
  store i32 1, ptr %3, align 4
  br label %231

37:                                               ; preds = %31
  %38 = load i64, ptr %5, align 8, !tbaa !9
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.drwav, ptr %39, i32 0, i32 11
  %41 = load i64, ptr %40, align 8, !tbaa !25
  %42 = icmp ugt i64 %38, %41
  br i1 %42, label %43, label %47

43:                                               ; preds = %37
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.drwav, ptr %44, i32 0, i32 11
  %46 = load i64, ptr %45, align 8, !tbaa !25
  store i64 %46, ptr %5, align 8, !tbaa !9
  br label %47

47:                                               ; preds = %43, %37
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.drwav, ptr %48, i32 0, i32 10
  %50 = load i16, ptr %49, align 4, !tbaa !26
  %51 = call noundef i32 @_ZL31drwav__is_compressed_format_tagt(i16 noundef zeroext %50)
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %53, label %136

53:                                               ; preds = %47
  %54 = load i64, ptr %5, align 8, !tbaa !9
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.drwav, ptr %55, i32 0, i32 15
  %57 = load i64, ptr %56, align 8, !tbaa !27
  %58 = icmp ult i64 %54, %57
  br i1 %58, label %59, label %65

59:                                               ; preds = %53
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = call noundef i32 @_ZL29drwav_seek_to_first_pcm_frameP5drwav(ptr noundef %60)
  %62 = icmp ne i32 %61, 0
  br i1 %62, label %64, label %63

63:                                               ; preds = %59
  store i32 0, ptr %3, align 4
  br label %231

64:                                               ; preds = %59
  br label %65

65:                                               ; preds = %64, %53
  %66 = load i64, ptr %5, align 8, !tbaa !9
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.drwav, ptr %67, i32 0, i32 15
  %69 = load i64, ptr %68, align 8, !tbaa !27
  %70 = icmp ugt i64 %66, %69
  br i1 %70, label %71, label %135

71:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %72 = load i64, ptr %5, align 8, !tbaa !9
  %73 = load ptr, ptr %4, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.drwav, ptr %73, i32 0, i32 15
  %75 = load i64, ptr %74, align 8, !tbaa !27
  %76 = sub i64 %72, %75
  store i64 %76, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4096, ptr %7) #5
  br label %77

77:                                               ; preds = %130, %71
  %78 = load i64, ptr %6, align 8, !tbaa !9
  %79 = icmp ugt i64 %78, 0
  br i1 %79, label %80, label %131

80:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  store i64 0, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %81 = load i64, ptr %6, align 8, !tbaa !9
  store i64 %81, ptr %9, align 8, !tbaa !9
  %82 = load i64, ptr %9, align 8, !tbaa !9
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.drwav, ptr %83, i32 0, i32 8
  %85 = load i16, ptr %84, align 8, !tbaa !28
  %86 = zext i16 %85 to i64
  %87 = udiv i64 2048, %86
  %88 = icmp ugt i64 %82, %87
  br i1 %88, label %89, label %95

89:                                               ; preds = %80
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.drwav, ptr %90, i32 0, i32 8
  %92 = load i16, ptr %91, align 8, !tbaa !28
  %93 = zext i16 %92 to i64
  %94 = udiv i64 2048, %93
  store i64 %94, ptr %9, align 8, !tbaa !9
  br label %95

95:                                               ; preds = %89, %80
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.drwav, ptr %96, i32 0, i32 10
  %98 = load i16, ptr %97, align 4, !tbaa !26
  %99 = zext i16 %98 to i32
  %100 = icmp eq i32 %99, 2
  br i1 %100, label %101, label %106

101:                                              ; preds = %95
  %102 = load ptr, ptr %4, align 8, !tbaa !5
  %103 = load i64, ptr %9, align 8, !tbaa !9
  %104 = getelementptr inbounds [2048 x i16], ptr %7, i64 0, i64 0
  %105 = call noundef i64 @_ZL34drwav_read_pcm_frames_s16__msadpcmP5drwavyPs(ptr noundef %102, i64 noundef %103, ptr noundef %104)
  store i64 %105, ptr %8, align 8, !tbaa !9
  br label %119

106:                                              ; preds = %95
  %107 = load ptr, ptr %4, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.drwav, ptr %107, i32 0, i32 10
  %109 = load i16, ptr %108, align 4, !tbaa !26
  %110 = zext i16 %109 to i32
  %111 = icmp eq i32 %110, 17
  br i1 %111, label %112, label %117

112:                                              ; preds = %106
  %113 = load ptr, ptr %4, align 8, !tbaa !5
  %114 = load i64, ptr %9, align 8, !tbaa !9
  %115 = getelementptr inbounds [2048 x i16], ptr %7, i64 0, i64 0
  %116 = call noundef i64 @_ZL30drwav_read_pcm_frames_s16__imaP5drwavyPs(ptr noundef %113, i64 noundef %114, ptr noundef %115)
  store i64 %116, ptr %8, align 8, !tbaa !9
  br label %118

117:                                              ; preds = %106
  call void @__assert_fail(ptr noundef @.str.5, ptr noundef @.str.6, i32 noundef 77057, ptr noundef @__PRETTY_FUNCTION__.drwav_seek_to_pcm_frame) #6
  unreachable

118:                                              ; preds = %112
  br label %119

119:                                              ; preds = %118, %101
  %120 = load i64, ptr %8, align 8, !tbaa !9
  %121 = load i64, ptr %9, align 8, !tbaa !9
  %122 = icmp ne i64 %120, %121
  br i1 %122, label %123, label %124

123:                                              ; preds = %119
  store i32 0, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %128

124:                                              ; preds = %119
  %125 = load i64, ptr %8, align 8, !tbaa !9
  %126 = load i64, ptr %6, align 8, !tbaa !9
  %127 = sub i64 %126, %125
  store i64 %127, ptr %6, align 8, !tbaa !9
  store i32 0, ptr %10, align 4
  br label %128

128:                                              ; preds = %124, %123
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  %129 = load i32, ptr %10, align 4
  switch i32 %129, label %132 [
    i32 0, label %130
  ]

130:                                              ; preds = %128
  br label %77, !llvm.loop !29

131:                                              ; preds = %77
  store i32 0, ptr %10, align 4
  br label %132

132:                                              ; preds = %131, %128
  call void @llvm.lifetime.end.p0(i64 4096, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  %133 = load i32, ptr %10, align 4
  switch i32 %133, label %233 [
    i32 0, label %134
    i32 1, label %231
  ]

134:                                              ; preds = %132
  br label %135

135:                                              ; preds = %134, %65
  br label %230

136:                                              ; preds = %47
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %137 = load ptr, ptr %4, align 8, !tbaa !5
  %138 = call noundef i32 @_ZL29drwav_get_bytes_per_pcm_frameP5drwav(ptr noundef %137)
  store i32 %138, ptr %15, align 4, !tbaa !31
  %139 = load i32, ptr %15, align 4, !tbaa !31
  %140 = icmp eq i32 %139, 0
  br i1 %140, label %141, label %142

141:                                              ; preds = %136
  store i32 0, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %227

142:                                              ; preds = %136
  %143 = load ptr, ptr %4, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.drwav, ptr %143, i32 0, i32 11
  %145 = load i64, ptr %144, align 8, !tbaa !25
  %146 = load i32, ptr %15, align 4, !tbaa !31
  %147 = zext i32 %146 to i64
  %148 = mul i64 %145, %147
  store i64 %148, ptr %11, align 8, !tbaa !9
  %149 = load i64, ptr %11, align 8, !tbaa !9
  %150 = load ptr, ptr %4, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.drwav, ptr %150, i32 0, i32 14
  %152 = load i64, ptr %151, align 8, !tbaa !32
  %153 = icmp uge i64 %149, %152
  br i1 %153, label %154, label %155

154:                                              ; preds = %142
  br label %157

155:                                              ; preds = %142
  call void @__assert_fail(ptr noundef @.str.166, ptr noundef @.str.6, i32 noundef 77076, ptr noundef @__PRETTY_FUNCTION__.drwav_seek_to_pcm_frame) #6
  unreachable

156:                                              ; No predecessors!
  br label %157

157:                                              ; preds = %156, %154
  %158 = load i64, ptr %11, align 8, !tbaa !9
  %159 = load ptr, ptr %4, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.drwav, ptr %159, i32 0, i32 14
  %161 = load i64, ptr %160, align 8, !tbaa !32
  %162 = sub i64 %158, %161
  store i64 %162, ptr %12, align 8, !tbaa !9
  %163 = load i64, ptr %5, align 8, !tbaa !9
  %164 = load i32, ptr %15, align 4, !tbaa !31
  %165 = zext i32 %164 to i64
  %166 = mul i64 %163, %165
  store i64 %166, ptr %13, align 8, !tbaa !9
  %167 = load i64, ptr %12, align 8, !tbaa !9
  %168 = load i64, ptr %13, align 8, !tbaa !9
  %169 = icmp ult i64 %167, %168
  br i1 %169, label %170, label %174

170:                                              ; preds = %157
  %171 = load i64, ptr %13, align 8, !tbaa !9
  %172 = load i64, ptr %12, align 8, !tbaa !9
  %173 = sub i64 %171, %172
  store i64 %173, ptr %14, align 8, !tbaa !9
  br label %181

174:                                              ; preds = %157
  %175 = load ptr, ptr %4, align 8, !tbaa !5
  %176 = call noundef i32 @_ZL29drwav_seek_to_first_pcm_frameP5drwav(ptr noundef %175)
  %177 = icmp ne i32 %176, 0
  br i1 %177, label %179, label %178

178:                                              ; preds = %174
  store i32 0, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %227

179:                                              ; preds = %174
  %180 = load i64, ptr %13, align 8, !tbaa !9
  store i64 %180, ptr %14, align 8, !tbaa !9
  br label %181

181:                                              ; preds = %179, %170
  br label %182

182:                                              ; preds = %225, %181
  %183 = load i64, ptr %14, align 8, !tbaa !9
  %184 = icmp ugt i64 %183, 0
  br i1 %184, label %185, label %226

185:                                              ; preds = %182
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %186 = load i64, ptr %14, align 8, !tbaa !9
  %187 = icmp ugt i64 %186, 2147483647
  br i1 %187, label %188, label %189

188:                                              ; preds = %185
  br label %192

189:                                              ; preds = %185
  %190 = load i64, ptr %14, align 8, !tbaa !9
  %191 = trunc i64 %190 to i32
  br label %192

192:                                              ; preds = %189, %188
  %193 = phi i32 [ 2147483647, %188 ], [ %191, %189 ]
  store i32 %193, ptr %16, align 4, !tbaa !31
  %194 = load ptr, ptr %4, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.drwav, ptr %194, i32 0, i32 2
  %196 = load ptr, ptr %195, align 8, !tbaa !11
  %197 = load ptr, ptr %4, align 8, !tbaa !5
  %198 = getelementptr inbounds %struct.drwav, ptr %197, i32 0, i32 3
  %199 = load ptr, ptr %198, align 8, !tbaa !33
  %200 = load i32, ptr %16, align 4, !tbaa !31
  %201 = call noundef i32 %196(ptr noundef %199, i32 noundef %200, i32 noundef 1)
  %202 = icmp ne i32 %201, 0
  br i1 %202, label %204, label %203

203:                                              ; preds = %192
  store i32 0, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %223

204:                                              ; preds = %192
  %205 = load i32, ptr %16, align 4, !tbaa !31
  %206 = load i32, ptr %15, align 4, !tbaa !31
  %207 = udiv i32 %205, %206
  %208 = zext i32 %207 to i64
  %209 = load ptr, ptr %4, align 8, !tbaa !5
  %210 = getelementptr inbounds %struct.drwav, ptr %209, i32 0, i32 15
  %211 = load i64, ptr %210, align 8, !tbaa !27
  %212 = add i64 %211, %208
  store i64 %212, ptr %210, align 8, !tbaa !27
  %213 = load i32, ptr %16, align 4, !tbaa !31
  %214 = sext i32 %213 to i64
  %215 = load ptr, ptr %4, align 8, !tbaa !5
  %216 = getelementptr inbounds %struct.drwav, ptr %215, i32 0, i32 14
  %217 = load i64, ptr %216, align 8, !tbaa !32
  %218 = sub i64 %217, %214
  store i64 %218, ptr %216, align 8, !tbaa !32
  %219 = load i32, ptr %16, align 4, !tbaa !31
  %220 = sext i32 %219 to i64
  %221 = load i64, ptr %14, align 8, !tbaa !9
  %222 = sub i64 %221, %220
  store i64 %222, ptr %14, align 8, !tbaa !9
  store i32 0, ptr %10, align 4
  br label %223

223:                                              ; preds = %204, %203
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  %224 = load i32, ptr %10, align 4
  switch i32 %224, label %227 [
    i32 0, label %225
  ]

225:                                              ; preds = %223
  br label %182, !llvm.loop !34

226:                                              ; preds = %182
  store i32 0, ptr %10, align 4
  br label %227

227:                                              ; preds = %226, %223, %178, %141
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  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 8, ptr %11) #5
  %228 = load i32, ptr %10, align 4
  switch i32 %228, label %233 [
    i32 0, label %229
    i32 1, label %231
  ]

229:                                              ; preds = %227
  br label %230

230:                                              ; preds = %229, %135
  store i32 1, ptr %3, align 4
  br label %231

231:                                              ; preds = %230, %227, %132, %63, %36, %30, %24
  %232 = load i32, ptr %3, align 4
  ret i32 %232

233:                                              ; preds = %227, %132
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL29drwav_get_bytes_per_pcm_frameP5drwav(ptr noundef) #3

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL31drwav__is_compressed_format_tagt(i16 noundef zeroext) #4

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

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

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

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 = { 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 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 #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, !6, i64 16}
!12 = !{!"_ZTS5drwav", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !13, i64 32, !14, i64 64, !15, i64 68, !17, i64 108, !16, i64 112, !16, i64 114, !16, i64 116, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !17, i64 168, !18, i64 172, !6, i64 176, !17, i64 184, !19, i64 192, !21, i64 216, !22, i64 256, !23, i64 308}
!13 = !{!"_ZTS26drwav_allocation_callbacks", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!14 = !{!"_ZTS15drwav_container", !7, i64 0}
!15 = !{!"_ZTS9drwav_fmt", !16, i64 0, !16, i64 2, !17, i64 4, !17, i64 8, !16, i64 12, !16, i64 14, !16, i64 16, !16, i64 18, !17, i64 20, !7, i64 24}
!16 = !{!"short", !7, i64 0}
!17 = !{!"int", !7, i64 0}
!18 = !{!"_ZTS19drwav_metadata_type", !7, i64 0}
!19 = !{!"_ZTS20drwav__memory_stream", !6, i64 0, !20, i64 8, !20, i64 16}
!20 = !{!"long", !7, i64 0}
!21 = !{!"_ZTS26drwav__memory_stream_write", !6, i64 0, !6, i64 8, !20, i64 16, !20, i64 24, !20, i64 32}
!22 = !{!"_ZTSN5drwavUt_E", !17, i64 0, !7, i64 4, !7, i64 8, !7, i64 16, !17, i64 32, !7, i64 36}
!23 = !{!"_ZTSN5drwavUt0_E", !17, i64 0, !7, i64 4, !7, i64 12, !7, i64 20, !17, i64 84}
!24 = !{!12, !6, i64 8}
!25 = !{!12, !10, i64 120}
!26 = !{!12, !16, i64 116}
!27 = !{!12, !10, i64 152}
!28 = !{!12, !16, i64 112}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = !{!17, !17, i64 0}
!32 = !{!12, !10, i64 144}
!33 = !{!12, !6, i64 24}
!34 = distinct !{!34, !30}


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

@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [104 x i8], align 1
@__PRETTY_FUNCTION__.drwav_seek_to_pcm_frame = external hidden unnamed_addr constant [60 x i8], align 1
@.str.166 = external hidden unnamed_addr constant [41 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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @drwav_seek_to_pcm_frame(ptr noundef %0, i64 noundef %1) local_unnamed_addr #2 {
  %3 = alloca [2048 x i16], align 16
  %4 = icmp eq ptr %0, null
  br i1 %4, label %.thread102, label %5

5:                                                ; preds = %2
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = icmp eq ptr %7, null
  br i1 %8, label %.thread102, label %9

9:                                                ; preds = %5
  %10 = getelementptr inbounds i8, ptr %0, i64 8
  %11 = load ptr, ptr %10, align 8, !tbaa !22
  %.not = icmp eq ptr %11, null
  br i1 %.not, label %12, label %.thread102

12:                                               ; preds = %9
  %13 = getelementptr inbounds i8, ptr %0, i64 120
  %14 = load i64, ptr %13, align 8, !tbaa !23
  %15 = icmp eq i64 %14, 0
  br i1 %15, label %.thread102, label %16

16:                                               ; preds = %12
  %spec.select = tail call i64 @llvm.umin.i64(i64 %14, i64 %1)
  %17 = getelementptr inbounds i8, ptr %0, i64 116
  %18 = load i16, ptr %17, align 4, !tbaa !24
  %19 = tail call noundef i32 @_ZL31drwav__is_compressed_format_tagt(i16 noundef zeroext %18)
  %.not88 = icmp eq i32 %19, 0
  br i1 %.not88, label %46, label %20

20:                                               ; preds = %16
  %21 = getelementptr inbounds i8, ptr %0, i64 152
  %22 = load i64, ptr %21, align 8, !tbaa !25
  %23 = icmp ult i64 %spec.select, %22
  br i1 %23, label %24, label %26

24:                                               ; preds = %20
  %25 = tail call noundef i32 @_ZL29drwav_seek_to_first_pcm_frameP5drwav(ptr noundef nonnull %0)
  %.not93 = icmp eq i32 %25, 0
  br i1 %.not93, label %.thread102, label %._crit_edge

._crit_edge:                                      ; preds = %24
  %.pre = load i64, ptr %21, align 8, !tbaa !25
  br label %26

26:                                               ; preds = %._crit_edge, %20
  %27 = phi i64 [ %.pre, %._crit_edge ], [ %22, %20 ]
  %28 = icmp ugt i64 %spec.select, %27
  br i1 %28, label %29, label %.thread102

29:                                               ; preds = %26
  %30 = sub i64 %spec.select, %27
  call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %3) #6
  %31 = getelementptr inbounds i8, ptr %0, i64 112
  br label %32

32:                                               ; preds = %43, %29
  %.068 = phi i64 [ %30, %29 ], [ %44, %43 ]
  %.not94.not = icmp eq i64 %.068, 0
  br i1 %.not94.not, label %.thread, label %33

.thread:                                          ; preds = %32
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %3) #6
  br label %.thread102

33:                                               ; preds = %32
  %34 = load i16, ptr %31, align 8, !tbaa !26
  %35 = udiv i16 2048, %34
  %36 = zext nneg i16 %35 to i64
  %spec.select96 = call i64 @llvm.umin.i64(i64 %.068, i64 %36)
  %37 = load i16, ptr %17, align 4, !tbaa !24
  switch i16 %37, label %42 [
    i16 2, label %38
    i16 17, label %40
  ]

38:                                               ; preds = %33
  %39 = call noundef i64 @_ZL34drwav_read_pcm_frames_s16__msadpcmP5drwavyPs(ptr noundef nonnull %0, i64 noundef %spec.select96, ptr noundef nonnull %3)
  br label %43

40:                                               ; preds = %33
  %41 = call noundef i64 @_ZL30drwav_read_pcm_frames_s16__imaP5drwavyPs(ptr noundef nonnull %0, i64 noundef %spec.select96, ptr noundef nonnull %3)
  br label %43

42:                                               ; preds = %33
  call void @__assert_fail(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.6, i32 noundef 77057, ptr noundef nonnull @__PRETTY_FUNCTION__.drwav_seek_to_pcm_frame) #7
  unreachable

43:                                               ; preds = %40, %38
  %.070 = phi i64 [ %39, %38 ], [ %41, %40 ]
  %.not95 = icmp eq i64 %.070, %spec.select96
  %44 = sub i64 %.068, %.070
  br i1 %.not95, label %32, label %45, !llvm.loop !27

45:                                               ; preds = %43
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %3) #6
  br label %.thread102

46:                                               ; preds = %16
  %47 = tail call noundef i32 @_ZL29drwav_get_bytes_per_pcm_frameP5drwav(ptr noundef nonnull %0)
  %48 = icmp eq i32 %47, 0
  br i1 %48, label %.thread102, label %49

49:                                               ; preds = %46
  %50 = load i64, ptr %13, align 8, !tbaa !23
  %51 = zext i32 %47 to i64
  %52 = mul i64 %50, %51
  %53 = getelementptr inbounds i8, ptr %0, i64 144
  %54 = load i64, ptr %53, align 8, !tbaa !29
  %.not89 = icmp ult i64 %52, %54
  br i1 %.not89, label %55, label %56

55:                                               ; preds = %49
  tail call void @__assert_fail(ptr noundef nonnull @.str.166, ptr noundef nonnull @.str.6, i32 noundef 77076, ptr noundef nonnull @__PRETTY_FUNCTION__.drwav_seek_to_pcm_frame) #7
  unreachable

56:                                               ; preds = %49
  %57 = sub i64 %52, %54
  %58 = mul i64 %spec.select, %51
  %59 = icmp ult i64 %57, %58
  br i1 %59, label %60, label %62

60:                                               ; preds = %56
  %61 = sub i64 %58, %57
  br label %64

62:                                               ; preds = %56
  %63 = tail call noundef i32 @_ZL29drwav_seek_to_first_pcm_frameP5drwav(ptr noundef nonnull %0)
  %.not90 = icmp eq i32 %63, 0
  br i1 %.not90, label %.thread102, label %64

64:                                               ; preds = %62, %60
  %.065 = phi i64 [ %61, %60 ], [ %58, %62 ]
  %.not91105 = icmp eq i64 %.065, 0
  br i1 %.not91105, label %.thread102, label %.lr.ph

.lr.ph:                                           ; preds = %64
  %65 = getelementptr inbounds i8, ptr %0, i64 24
  %66 = getelementptr inbounds i8, ptr %0, i64 152
  br label %67

67:                                               ; preds = %.lr.ph, %73
  %.166106 = phi i64 [ %.065, %.lr.ph ], [ %80, %73 ]
  %68 = tail call i64 @llvm.umin.i64(i64 %.166106, i64 2147483647)
  %69 = trunc nuw nsw i64 %68 to i32
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = load ptr, ptr %65, align 8, !tbaa !30
  %72 = tail call noundef i32 %70(ptr noundef %71, i32 noundef %69, i32 noundef 1)
  %.not92.not = icmp eq i32 %72, 0
  br i1 %.not92.not, label %.thread102, label %73

73:                                               ; preds = %67
  %74 = udiv i32 %69, %47
  %75 = zext nneg i32 %74 to i64
  %76 = load i64, ptr %66, align 8, !tbaa !25
  %77 = add i64 %76, %75
  store i64 %77, ptr %66, align 8, !tbaa !25
  %78 = load i64, ptr %53, align 8, !tbaa !29
  %79 = sub i64 %78, %68
  store i64 %79, ptr %53, align 8, !tbaa !29
  %80 = sub i64 %.166106, %68
  %.not91 = icmp eq i64 %80, 0
  br i1 %.not91, label %.thread102, label %67, !llvm.loop !31

.thread102:                                       ; preds = %73, %67, %64, %62, %46, %26, %.thread, %45, %24, %12, %9, %2, %5
  %.6 = phi i32 [ 0, %45 ], [ 0, %5 ], [ 0, %2 ], [ 0, %9 ], [ 1, %12 ], [ 0, %24 ], [ 1, %.thread ], [ 1, %26 ], [ 0, %46 ], [ 0, %62 ], [ 1, %64 ], [ 1, %73 ], [ 0, %67 ]
  ret i32 %.6
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL29drwav_get_bytes_per_pcm_frameP5drwav(ptr noundef) local_unnamed_addr #3

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL31drwav__is_compressed_format_tagt(i16 noundef zeroext) local_unnamed_addr #4

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

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

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

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

attributes #0 = { mustprogress 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 = { 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 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { 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, !7, i64 16}
!6 = !{!"_ZTS5drwav", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !11, i64 64, !12, i64 68, !14, i64 108, !13, i64 112, !13, i64 114, !13, i64 116, !15, i64 120, !15, i64 128, !15, i64 136, !15, i64 144, !15, i64 152, !15, i64 160, !14, i64 168, !16, i64 172, !7, i64 176, !14, i64 184, !17, i64 192, !19, i64 216, !20, i64 256, !21, i64 308}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTS26drwav_allocation_callbacks", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!11 = !{!"_ZTS15drwav_container", !8, i64 0}
!12 = !{!"_ZTS9drwav_fmt", !13, i64 0, !13, i64 2, !14, i64 4, !14, i64 8, !13, i64 12, !13, i64 14, !13, i64 16, !13, i64 18, !14, i64 20, !8, i64 24}
!13 = !{!"short", !8, i64 0}
!14 = !{!"int", !8, i64 0}
!15 = !{!"long long", !8, i64 0}
!16 = !{!"_ZTS19drwav_metadata_type", !8, i64 0}
!17 = !{!"_ZTS20drwav__memory_stream", !7, i64 0, !18, i64 8, !18, i64 16}
!18 = !{!"long", !8, i64 0}
!19 = !{!"_ZTS26drwav__memory_stream_write", !7, i64 0, !7, i64 8, !18, i64 16, !18, i64 24, !18, i64 32}
!20 = !{!"_ZTSN5drwavUt_E", !14, i64 0, !8, i64 4, !8, i64 8, !8, i64 16, !14, i64 32, !8, i64 36}
!21 = !{!"_ZTSN5drwavUt0_E", !14, i64 0, !8, i64 4, !8, i64 12, !8, i64 20, !14, i64 84}
!22 = !{!6, !7, i64 8}
!23 = !{!6, !15, i64 120}
!24 = !{!6, !13, i64 116}
!25 = !{!6, !15, i64 152}
!26 = !{!6, !13, i64 112}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = !{!6, !15, i64 144}
!30 = !{!6, !7, i64 24}
!31 = distinct !{!31, !28}


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