; LLVM IR from Overload-Technologies/Overload :: Dependencies/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.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.0, %struct.anon.1 }
%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.0 = type { i32, [2 x i16], [2 x i32], [4 x i32], i32, [2 x [2 x i32]] }
%struct.anon.1 = type { i32, [2 x i32], [2 x i32], [16 x i32], i32 }

@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [113 x i8], align 1
@__PRETTY_FUNCTION__.drwav_seek_to_pcm_frame = external hidden unnamed_addr constant [60 x i8], align 1
@.str.6 = 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 nounwind uwtable
declare hidden noundef i32 @_ZL29drwav_get_bytes_per_pcm_frameP5drwav(ptr noundef) #2

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

; Function Attrs: mustprogress uwtable
define dso_local i32 @drwav_seek_to_pcm_frame(ptr noundef %0, i64 noundef %1) #4 {
  %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
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !9
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = icmp eq ptr %16, null
  br i1 %17, label %23, label %18

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

23:                                               ; preds = %18, %2
  store i32 0, ptr %3, align 4
  br label %228

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

29:                                               ; preds = %24
  store i32 0, ptr %3, align 4
  br label %228

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

35:                                               ; preds = %30
  store i32 1, ptr %3, align 4
  br label %228

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

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

47:                                               ; preds = %42, %36
  %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 %228

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.4, ptr noundef @.str.5, i32 noundef 5332, 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 %230 [
    i32 0, label %134
    i32 1, label %228
  ]

134:                                              ; preds = %132
  br label %135

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

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
  %137 = load ptr, ptr %4, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.drwav, ptr %137, i32 0, i32 11
  %139 = load i64, ptr %138, align 8, !tbaa !25
  %140 = load ptr, ptr %4, align 8, !tbaa !5
  %141 = call noundef i32 @_ZL29drwav_get_bytes_per_pcm_frameP5drwav(ptr noundef %140)
  %142 = zext i32 %141 to i64
  %143 = mul i64 %139, %142
  store i64 %143, ptr %11, align 8, !tbaa !9
  %144 = load i64, ptr %11, align 8, !tbaa !9
  %145 = load ptr, ptr %4, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.drwav, ptr %145, i32 0, i32 14
  %147 = load i64, ptr %146, align 8, !tbaa !31
  %148 = icmp uge i64 %144, %147
  br i1 %148, label %149, label %150

149:                                              ; preds = %136
  br label %152

150:                                              ; preds = %136
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str.5, i32 noundef 5349, ptr noundef @__PRETTY_FUNCTION__.drwav_seek_to_pcm_frame) #6
  unreachable

151:                                              ; No predecessors!
  br label %152

152:                                              ; preds = %151, %149
  %153 = load i64, ptr %11, align 8, !tbaa !9
  %154 = load ptr, ptr %4, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.drwav, ptr %154, i32 0, i32 14
  %156 = load i64, ptr %155, align 8, !tbaa !31
  %157 = sub i64 %153, %156
  store i64 %157, ptr %12, align 8, !tbaa !9
  %158 = load i64, ptr %5, align 8, !tbaa !9
  %159 = load ptr, ptr %4, align 8, !tbaa !5
  %160 = call noundef i32 @_ZL29drwav_get_bytes_per_pcm_frameP5drwav(ptr noundef %159)
  %161 = zext i32 %160 to i64
  %162 = mul i64 %158, %161
  store i64 %162, ptr %13, align 8, !tbaa !9
  %163 = load i64, ptr %12, align 8, !tbaa !9
  %164 = load i64, ptr %13, align 8, !tbaa !9
  %165 = icmp ult i64 %163, %164
  br i1 %165, label %166, label %170

166:                                              ; preds = %152
  %167 = load i64, ptr %13, align 8, !tbaa !9
  %168 = load i64, ptr %12, align 8, !tbaa !9
  %169 = sub i64 %167, %168
  store i64 %169, ptr %14, align 8, !tbaa !9
  br label %177

170:                                              ; preds = %152
  %171 = load ptr, ptr %4, align 8, !tbaa !5
  %172 = call noundef i32 @_ZL29drwav_seek_to_first_pcm_frameP5drwav(ptr noundef %171)
  %173 = icmp ne i32 %172, 0
  br i1 %173, label %175, label %174

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

175:                                              ; preds = %170
  %176 = load i64, ptr %13, align 8, !tbaa !9
  store i64 %176, ptr %14, align 8, !tbaa !9
  br label %177

177:                                              ; preds = %175, %166
  br label %178

178:                                              ; preds = %222, %177
  %179 = load i64, ptr %14, align 8, !tbaa !9
  %180 = icmp ugt i64 %179, 0
  br i1 %180, label %181, label %223

181:                                              ; preds = %178
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %182 = load i64, ptr %14, align 8, !tbaa !9
  %183 = icmp ugt i64 %182, 2147483647
  br i1 %183, label %184, label %185

184:                                              ; preds = %181
  br label %188

185:                                              ; preds = %181
  %186 = load i64, ptr %14, align 8, !tbaa !9
  %187 = trunc i64 %186 to i32
  br label %188

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

199:                                              ; preds = %188
  store i32 0, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %220

200:                                              ; preds = %188
  %201 = load i32, ptr %15, align 4, !tbaa !32
  %202 = load ptr, ptr %4, align 8, !tbaa !5
  %203 = call noundef i32 @_ZL29drwav_get_bytes_per_pcm_frameP5drwav(ptr noundef %202)
  %204 = udiv i32 %201, %203
  %205 = zext i32 %204 to i64
  %206 = load ptr, ptr %4, align 8, !tbaa !5
  %207 = getelementptr inbounds %struct.drwav, ptr %206, i32 0, i32 15
  %208 = load i64, ptr %207, align 8, !tbaa !27
  %209 = add i64 %208, %205
  store i64 %209, ptr %207, align 8, !tbaa !27
  %210 = load i32, ptr %15, align 4, !tbaa !32
  %211 = sext i32 %210 to i64
  %212 = load ptr, ptr %4, align 8, !tbaa !5
  %213 = getelementptr inbounds %struct.drwav, ptr %212, i32 0, i32 14
  %214 = load i64, ptr %213, align 8, !tbaa !31
  %215 = sub i64 %214, %211
  store i64 %215, ptr %213, align 8, !tbaa !31
  %216 = load i32, ptr %15, align 4, !tbaa !32
  %217 = sext i32 %216 to i64
  %218 = load i64, ptr %14, align 8, !tbaa !9
  %219 = sub i64 %218, %217
  store i64 %219, ptr %14, align 8, !tbaa !9
  store i32 0, ptr %10, align 4
  br label %220

220:                                              ; preds = %200, %199
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  %221 = load i32, ptr %10, align 4
  switch i32 %221, label %224 [
    i32 0, label %222
  ]

222:                                              ; preds = %220
  br label %178, !llvm.loop !34

223:                                              ; preds = %178
  store i32 0, ptr %10, align 4
  br label %224

224:                                              ; preds = %223, %220, %174
  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
  %225 = load i32, ptr %10, align 4
  switch i32 %225, label %230 [
    i32 0, label %226
    i32 1, label %228
  ]

226:                                              ; preds = %224
  br label %227

227:                                              ; preds = %226, %135
  store i32 1, ptr %3, align 4
  br label %228

228:                                              ; preds = %227, %224, %132, %63, %35, %29, %23
  %229 = load i32, ptr %3, align 4
  ret i32 %229

230:                                              ; preds = %224, %132
  unreachable
}

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

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

; Function Attrs: mustprogress uwtable
declare hidden noundef i64 @_ZL30drwav_read_pcm_frames_s16__imaP5drwavyPs(ptr noundef, i64 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 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 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 = { 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, !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 = !{!12, !10, i64 144}
!32 = !{!17, !17, i64 0}
!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.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [113 x i8], align 1
@__PRETTY_FUNCTION__.drwav_seek_to_pcm_frame = external hidden unnamed_addr constant [60 x i8], align 1
@.str.6 = 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 nounwind uwtable
declare hidden noundef i32 @_ZL29drwav_get_bytes_per_pcm_frameP5drwav(ptr noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @drwav_seek_to_pcm_frame(ptr noundef %0, i64 noundef %1) local_unnamed_addr #4 {
  %3 = alloca [2048 x i16], align 16
  %4 = icmp eq ptr %0, null
  br i1 %4, label %.thread100, 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 %.thread100, 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 %.thread100

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 %.thread100, label %16

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

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

25:                                               ; preds = %21
  %26 = tail call noundef i32 @_ZL29drwav_seek_to_first_pcm_frameP5drwav(ptr noundef nonnull %0)
  %.not91 = icmp eq i32 %26, 0
  br i1 %.not91, label %.thread100, label %._crit_edge

._crit_edge:                                      ; preds = %25
  %.pre = load i64, ptr %22, align 8, !tbaa !25
  br label %27

27:                                               ; preds = %._crit_edge, %21
  %28 = phi i64 [ %.pre, %._crit_edge ], [ %23, %21 ]
  %29 = icmp ugt i64 %spec.select, %28
  br i1 %29, label %30, label %.thread100

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

33:                                               ; preds = %44, %30
  %.066 = phi i64 [ %31, %30 ], [ %45, %44 ]
  %.not92.not = icmp eq i64 %.066, 0
  br i1 %.not92.not, label %.thread, label %34

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

34:                                               ; preds = %33
  %35 = load i16, ptr %32, align 8, !tbaa !26
  %36 = udiv i16 2048, %35
  %37 = zext nneg i16 %36 to i64
  %spec.select94 = call i64 @llvm.umin.i64(i64 %.066, i64 %37)
  %38 = load i16, ptr %18, align 4, !tbaa !24
  switch i16 %38, label %43 [
    i16 2, label %39
    i16 17, label %41
  ]

39:                                               ; preds = %34
  %40 = call noundef i64 @_ZL34drwav_read_pcm_frames_s16__msadpcmP5drwavyPs(ptr noundef nonnull %0, i64 noundef %spec.select94, ptr noundef nonnull %3)
  br label %44

41:                                               ; preds = %34
  %42 = call noundef i64 @_ZL30drwav_read_pcm_frames_s16__imaP5drwavyPs(ptr noundef nonnull %0, i64 noundef %spec.select94, ptr noundef nonnull %3)
  br label %44

43:                                               ; preds = %34
  call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.5, i32 noundef 5332, ptr noundef nonnull @__PRETTY_FUNCTION__.drwav_seek_to_pcm_frame) #7
  unreachable

44:                                               ; preds = %41, %39
  %.068 = phi i64 [ %40, %39 ], [ %42, %41 ]
  %.not93 = icmp eq i64 %.068, %spec.select94
  %45 = sub i64 %.066, %.068
  br i1 %.not93, label %33, label %46, !llvm.loop !27

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

47:                                               ; preds = %16
  %48 = load i64, ptr %13, align 8, !tbaa !23
  %49 = tail call noundef i32 @_ZL29drwav_get_bytes_per_pcm_frameP5drwav(ptr noundef nonnull %0)
  %50 = zext i32 %49 to i64
  %51 = mul i64 %48, %50
  %52 = getelementptr inbounds i8, ptr %0, i64 144
  %53 = load i64, ptr %52, align 8, !tbaa !29
  %.not87 = icmp ult i64 %51, %53
  br i1 %.not87, label %54, label %55

54:                                               ; preds = %47
  tail call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.5, i32 noundef 5349, ptr noundef nonnull @__PRETTY_FUNCTION__.drwav_seek_to_pcm_frame) #7
  unreachable

55:                                               ; preds = %47
  %56 = sub i64 %51, %53
  %57 = tail call noundef i32 @_ZL29drwav_get_bytes_per_pcm_frameP5drwav(ptr noundef nonnull %0)
  %58 = zext i32 %57 to i64
  %59 = mul i64 %spec.select, %58
  %60 = icmp ult i64 %56, %59
  br i1 %60, label %61, label %63

61:                                               ; preds = %55
  %62 = sub i64 %59, %56
  br label %65

63:                                               ; preds = %55
  %64 = tail call noundef i32 @_ZL29drwav_seek_to_first_pcm_frameP5drwav(ptr noundef nonnull %0)
  %.not88 = icmp eq i32 %64, 0
  br i1 %.not88, label %.thread100, label %65

65:                                               ; preds = %63, %61
  %.062 = phi i64 [ %62, %61 ], [ %59, %63 ]
  %.not89103 = icmp eq i64 %.062, 0
  br i1 %.not89103, label %.thread100, label %.lr.ph

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

68:                                               ; preds = %.lr.ph, %74
  %.163104 = phi i64 [ %.062, %.lr.ph ], [ %82, %74 ]
  %69 = tail call i64 @llvm.umin.i64(i64 %.163104, i64 2147483647)
  %70 = trunc nuw nsw i64 %69 to i32
  %71 = load ptr, ptr %6, align 8, !tbaa !5
  %72 = load ptr, ptr %66, align 8, !tbaa !30
  %73 = tail call noundef i32 %71(ptr noundef %72, i32 noundef %70, i32 noundef 1)
  %.not90.not = icmp eq i32 %73, 0
  br i1 %.not90.not, label %.thread100, label %74

74:                                               ; preds = %68
  %75 = tail call noundef i32 @_ZL29drwav_get_bytes_per_pcm_frameP5drwav(ptr noundef nonnull %0)
  %76 = udiv i32 %70, %75
  %77 = zext nneg i32 %76 to i64
  %78 = load i64, ptr %67, align 8, !tbaa !25
  %79 = add i64 %78, %77
  store i64 %79, ptr %67, align 8, !tbaa !25
  %80 = load i64, ptr %52, align 8, !tbaa !29
  %81 = sub i64 %80, %69
  store i64 %81, ptr %52, align 8, !tbaa !29
  %82 = sub i64 %.163104, %69
  %.not89 = icmp eq i64 %82, 0
  br i1 %.not89, label %.thread100, label %68, !llvm.loop !31

.thread100:                                       ; preds = %74, %68, %65, %63, %27, %.thread, %46, %25, %12, %9, %2, %5
  %.6 = phi i32 [ 0, %46 ], [ 0, %5 ], [ 0, %2 ], [ 0, %9 ], [ 1, %12 ], [ 0, %25 ], [ 1, %.thread ], [ 1, %27 ], [ 0, %63 ], [ 1, %65 ], [ 1, %74 ], [ 0, %68 ]
  ret i32 %.6
}

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

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

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

; 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 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 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 = { 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 = { 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