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

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

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

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

17:                                               ; preds = %1
  store i32 -2, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %261

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

23:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !9
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.drwav, ptr %24, i32 0, i32 5
  %26 = load i32, ptr %25, align 8, !tbaa !24
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %33, label %28

28:                                               ; preds = %23
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.drwav, ptr %29, i32 0, i32 5
  %31 = load i32, ptr %30, align 8, !tbaa !24
  %32 = icmp eq i32 %31, 2
  br i1 %32, label %33, label %38

33:                                               ; preds = %28, %23
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.drwav, ptr %34, i32 0, i32 12
  %36 = load i64, ptr %35, align 8, !tbaa !25
  %37 = call noundef i32 @_ZL30drwav__chunk_padding_size_riffy(i64 noundef %36)
  store i32 %37, ptr %6, align 4, !tbaa !9
  br label %43

38:                                               ; preds = %28
  %39 = load ptr, ptr %3, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.drwav, ptr %39, i32 0, i32 12
  %41 = load i64, ptr %40, align 8, !tbaa !25
  %42 = call noundef i32 @_ZL29drwav__chunk_padding_size_w64y(i64 noundef %41)
  store i32 %42, ptr %6, align 4, !tbaa !9
  br label %43

43:                                               ; preds = %38, %33
  %44 = load i32, ptr %6, align 4, !tbaa !9
  %45 = icmp ugt i32 %44, 0
  br i1 %45, label %46, label %51

46:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store i64 0, ptr %7, align 8, !tbaa !26
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = load i32, ptr %6, align 4, !tbaa !9
  %49 = zext i32 %48 to i64
  %50 = call noundef i64 @_ZL12drwav__writeP5drwavPKvm(ptr noundef %47, ptr noundef %7, i64 noundef %49)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %51

51:                                               ; preds = %46, %43
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.drwav, ptr %52, i32 0, i32 2
  %54 = load ptr, ptr %53, align 8, !tbaa !27
  %55 = icmp ne ptr %54, null
  br i1 %55, label %56, label %210

56:                                               ; preds = %51
  %57 = load ptr, ptr %3, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.drwav, ptr %57, i32 0, i32 17
  %59 = load i32, ptr %58, align 8, !tbaa !28
  %60 = icmp ne i32 %59, 0
  br i1 %60, label %210, label %61

61:                                               ; preds = %56
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.drwav, ptr %62, i32 0, i32 5
  %64 = load i32, ptr %63, align 8, !tbaa !24
  %65 = icmp eq i32 %64, 0
  br i1 %65, label %66, label %112

66:                                               ; preds = %61
  %67 = load ptr, ptr %3, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.drwav, ptr %67, i32 0, i32 2
  %69 = load ptr, ptr %68, align 8, !tbaa !27
  %70 = load ptr, ptr %3, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.drwav, ptr %70, i32 0, i32 3
  %72 = load ptr, ptr %71, align 8, !tbaa !29
  %73 = call noundef i32 %69(ptr noundef %72, i32 noundef 4, i32 noundef 0)
  %74 = icmp ne i32 %73, 0
  br i1 %74, label %75, label %89

75:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %76 = load ptr, ptr %3, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.drwav, ptr %76, i32 0, i32 12
  %78 = load i64, ptr %77, align 8, !tbaa !25
  %79 = load ptr, ptr %3, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.drwav, ptr %79, i32 0, i32 19
  %81 = load ptr, ptr %80, align 8, !tbaa !30
  %82 = load ptr, ptr %3, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.drwav, ptr %82, i32 0, i32 20
  %84 = load i32, ptr %83, align 8, !tbaa !31
  %85 = call noundef i32 @_ZL27drwav__riff_chunk_size_riffyP14drwav_metadataj(i64 noundef %78, ptr noundef %81, i32 noundef %84)
  store i32 %85, ptr %8, align 4, !tbaa !9
  %86 = load ptr, ptr %3, align 8, !tbaa !5
  %87 = load i32, ptr %8, align 4, !tbaa !9
  %88 = call noundef i64 @_ZL24drwav__write_u32ne_to_leP5drwavj(ptr noundef %86, i32 noundef %87)
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %89

89:                                               ; preds = %75, %66
  %90 = load ptr, ptr %3, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.drwav, ptr %90, i32 0, i32 2
  %92 = load ptr, ptr %91, align 8, !tbaa !27
  %93 = load ptr, ptr %3, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.drwav, ptr %93, i32 0, i32 3
  %95 = load ptr, ptr %94, align 8, !tbaa !29
  %96 = load ptr, ptr %3, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.drwav, ptr %96, i32 0, i32 13
  %98 = load i64, ptr %97, align 8, !tbaa !32
  %99 = trunc i64 %98 to i32
  %100 = sub nsw i32 %99, 4
  %101 = call noundef i32 %92(ptr noundef %95, i32 noundef %100, i32 noundef 0)
  %102 = icmp ne i32 %101, 0
  br i1 %102, label %103, label %111

103:                                              ; preds = %89
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %104 = load ptr, ptr %3, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.drwav, ptr %104, i32 0, i32 12
  %106 = load i64, ptr %105, align 8, !tbaa !25
  %107 = call noundef i32 @_ZL27drwav__data_chunk_size_riffy(i64 noundef %106)
  store i32 %107, ptr %9, align 4, !tbaa !9
  %108 = load ptr, ptr %3, align 8, !tbaa !5
  %109 = load i32, ptr %9, align 4, !tbaa !9
  %110 = call noundef i64 @_ZL24drwav__write_u32ne_to_leP5drwavj(ptr noundef %108, i32 noundef %109)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %111

111:                                              ; preds = %103, %89
  br label %209

112:                                              ; preds = %61
  %113 = load ptr, ptr %3, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.drwav, ptr %113, i32 0, i32 5
  %115 = load i32, ptr %114, align 8, !tbaa !24
  %116 = icmp eq i32 %115, 1
  br i1 %116, label %117, label %157

117:                                              ; preds = %112
  %118 = load ptr, ptr %3, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.drwav, ptr %118, i32 0, i32 2
  %120 = load ptr, ptr %119, align 8, !tbaa !27
  %121 = load ptr, ptr %3, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.drwav, ptr %121, i32 0, i32 3
  %123 = load ptr, ptr %122, align 8, !tbaa !29
  %124 = call noundef i32 %120(ptr noundef %123, i32 noundef 16, i32 noundef 0)
  %125 = icmp ne i32 %124, 0
  br i1 %125, label %126, label %134

126:                                              ; preds = %117
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %127 = load ptr, ptr %3, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.drwav, ptr %127, i32 0, i32 12
  %129 = load i64, ptr %128, align 8, !tbaa !25
  %130 = call noundef i64 @_ZL26drwav__riff_chunk_size_w64y(i64 noundef %129)
  store i64 %130, ptr %10, align 8, !tbaa !26
  %131 = load ptr, ptr %3, align 8, !tbaa !5
  %132 = load i64, ptr %10, align 8, !tbaa !26
  %133 = call noundef i64 @_ZL24drwav__write_u64ne_to_leP5drwavy(ptr noundef %131, i64 noundef %132)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %134

134:                                              ; preds = %126, %117
  %135 = load ptr, ptr %3, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.drwav, ptr %135, i32 0, i32 2
  %137 = load ptr, ptr %136, align 8, !tbaa !27
  %138 = load ptr, ptr %3, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.drwav, ptr %138, i32 0, i32 3
  %140 = load ptr, ptr %139, align 8, !tbaa !29
  %141 = load ptr, ptr %3, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.drwav, ptr %141, i32 0, i32 13
  %143 = load i64, ptr %142, align 8, !tbaa !32
  %144 = trunc i64 %143 to i32
  %145 = sub nsw i32 %144, 8
  %146 = call noundef i32 %137(ptr noundef %140, i32 noundef %145, i32 noundef 0)
  %147 = icmp ne i32 %146, 0
  br i1 %147, label %148, label %156

148:                                              ; preds = %134
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %149 = load ptr, ptr %3, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.drwav, ptr %149, i32 0, i32 12
  %151 = load i64, ptr %150, align 8, !tbaa !25
  %152 = call noundef i64 @_ZL26drwav__data_chunk_size_w64y(i64 noundef %151)
  store i64 %152, ptr %11, align 8, !tbaa !26
  %153 = load ptr, ptr %3, align 8, !tbaa !5
  %154 = load i64, ptr %11, align 8, !tbaa !26
  %155 = call noundef i64 @_ZL24drwav__write_u64ne_to_leP5drwavy(ptr noundef %153, i64 noundef %154)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br label %156

156:                                              ; preds = %148, %134
  br label %208

157:                                              ; preds = %112
  %158 = load ptr, ptr %3, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.drwav, ptr %158, i32 0, i32 5
  %160 = load i32, ptr %159, align 8, !tbaa !24
  %161 = icmp eq i32 %160, 2
  br i1 %161, label %162, label %207

162:                                              ; preds = %157
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 20, ptr %12, align 4, !tbaa !9
  %163 = load ptr, ptr %3, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.drwav, ptr %163, i32 0, i32 2
  %165 = load ptr, ptr %164, align 8, !tbaa !27
  %166 = load ptr, ptr %3, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.drwav, ptr %166, i32 0, i32 3
  %168 = load ptr, ptr %167, align 8, !tbaa !29
  %169 = load i32, ptr %12, align 4, !tbaa !9
  %170 = add nsw i32 %169, 0
  %171 = call noundef i32 %165(ptr noundef %168, i32 noundef %170, i32 noundef 0)
  %172 = icmp ne i32 %171, 0
  br i1 %172, label %173, label %187

173:                                              ; preds = %162
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %174 = load ptr, ptr %3, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.drwav, ptr %174, i32 0, i32 12
  %176 = load i64, ptr %175, align 8, !tbaa !25
  %177 = load ptr, ptr %3, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.drwav, ptr %177, i32 0, i32 19
  %179 = load ptr, ptr %178, align 8, !tbaa !30
  %180 = load ptr, ptr %3, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.drwav, ptr %180, i32 0, i32 20
  %182 = load i32, ptr %181, align 8, !tbaa !31
  %183 = call noundef i64 @_ZL27drwav__riff_chunk_size_rf64yP14drwav_metadataj(i64 noundef %176, ptr noundef %179, i32 noundef %182)
  store i64 %183, ptr %13, align 8, !tbaa !26
  %184 = load ptr, ptr %3, align 8, !tbaa !5
  %185 = load i64, ptr %13, align 8, !tbaa !26
  %186 = call noundef i64 @_ZL24drwav__write_u64ne_to_leP5drwavy(ptr noundef %184, i64 noundef %185)
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  br label %187

187:                                              ; preds = %173, %162
  %188 = load ptr, ptr %3, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct.drwav, ptr %188, i32 0, i32 2
  %190 = load ptr, ptr %189, align 8, !tbaa !27
  %191 = load ptr, ptr %3, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct.drwav, ptr %191, i32 0, i32 3
  %193 = load ptr, ptr %192, align 8, !tbaa !29
  %194 = load i32, ptr %12, align 4, !tbaa !9
  %195 = add nsw i32 %194, 8
  %196 = call noundef i32 %190(ptr noundef %193, i32 noundef %195, i32 noundef 0)
  %197 = icmp ne i32 %196, 0
  br i1 %197, label %198, label %206

198:                                              ; preds = %187
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %199 = load ptr, ptr %3, align 8, !tbaa !5
  %200 = getelementptr inbounds %struct.drwav, ptr %199, i32 0, i32 12
  %201 = load i64, ptr %200, align 8, !tbaa !25
  %202 = call noundef i64 @_ZL27drwav__data_chunk_size_rf64y(i64 noundef %201)
  store i64 %202, ptr %14, align 8, !tbaa !26
  %203 = load ptr, ptr %3, align 8, !tbaa !5
  %204 = load i64, ptr %14, align 8, !tbaa !26
  %205 = call noundef i64 @_ZL24drwav__write_u64ne_to_leP5drwavy(ptr noundef %203, i64 noundef %204)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  br label %206

206:                                              ; preds = %198, %187
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %207

207:                                              ; preds = %206, %157
  br label %208

208:                                              ; preds = %207, %156
  br label %209

209:                                              ; preds = %208, %111
  br label %210

210:                                              ; preds = %209, %56, %51
  %211 = load ptr, ptr %3, align 8, !tbaa !5
  %212 = getelementptr inbounds %struct.drwav, ptr %211, i32 0, i32 17
  %213 = load i32, ptr %212, align 8, !tbaa !28
  %214 = icmp ne i32 %213, 0
  br i1 %214, label %215, label %225

215:                                              ; preds = %210
  %216 = load ptr, ptr %3, align 8, !tbaa !5
  %217 = getelementptr inbounds %struct.drwav, ptr %216, i32 0, i32 12
  %218 = load i64, ptr %217, align 8, !tbaa !25
  %219 = load ptr, ptr %3, align 8, !tbaa !5
  %220 = getelementptr inbounds %struct.drwav, ptr %219, i32 0, i32 16
  %221 = load i64, ptr %220, align 8, !tbaa !33
  %222 = icmp ne i64 %218, %221
  br i1 %222, label %223, label %224

223:                                              ; preds = %215
  store i32 -10, ptr %4, align 4, !tbaa !9
  br label %224

224:                                              ; preds = %223, %215
  br label %225

225:                                              ; preds = %224, %210
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %244

226:                                              ; preds = %18
  %227 = load ptr, ptr %3, align 8, !tbaa !5
  %228 = getelementptr inbounds %struct.drwav, ptr %227, i32 0, i32 19
  %229 = load ptr, ptr %228, align 8, !tbaa !30
  %230 = icmp ne ptr %229, null
  br i1 %230, label %231, label %243

231:                                              ; preds = %226
  %232 = load ptr, ptr %3, align 8, !tbaa !5
  %233 = getelementptr inbounds %struct.drwav, ptr %232, i32 0, i32 4
  %234 = getelementptr inbounds %struct.drwav_allocation_callbacks, ptr %233, i32 0, i32 3
  %235 = load ptr, ptr %234, align 8, !tbaa !34
  %236 = load ptr, ptr %3, align 8, !tbaa !5
  %237 = getelementptr inbounds %struct.drwav, ptr %236, i32 0, i32 19
  %238 = load ptr, ptr %237, align 8, !tbaa !30
  %239 = load ptr, ptr %3, align 8, !tbaa !5
  %240 = getelementptr inbounds %struct.drwav, ptr %239, i32 0, i32 4
  %241 = getelementptr inbounds %struct.drwav_allocation_callbacks, ptr %240, i32 0, i32 0
  %242 = load ptr, ptr %241, align 8, !tbaa !35
  call void %235(ptr noundef %238, ptr noundef %242)
  br label %243

243:                                              ; preds = %231, %226
  br label %244

244:                                              ; preds = %243, %225
  %245 = load ptr, ptr %3, align 8, !tbaa !5
  %246 = getelementptr inbounds %struct.drwav, ptr %245, i32 0, i32 0
  %247 = load ptr, ptr %246, align 8, !tbaa !36
  %248 = icmp eq ptr %247, @_ZL20drwav__on_read_stdioPvS_m
  br i1 %248, label %254, label %249

249:                                              ; preds = %244
  %250 = load ptr, ptr %3, align 8, !tbaa !5
  %251 = getelementptr inbounds %struct.drwav, ptr %250, i32 0, i32 1
  %252 = load ptr, ptr %251, align 8, !tbaa !11
  %253 = icmp eq ptr %252, @_ZL21drwav__on_write_stdioPvPKvm
  br i1 %253, label %254, label %259

254:                                              ; preds = %249, %244
  %255 = load ptr, ptr %3, align 8, !tbaa !5
  %256 = getelementptr inbounds %struct.drwav, ptr %255, i32 0, i32 3
  %257 = load ptr, ptr %256, align 8, !tbaa !29
  %258 = call i32 @fclose(ptr noundef %257)
  br label %259

259:                                              ; preds = %254, %249
  %260 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %260, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %261

261:                                              ; preds = %259, %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  %262 = load i32, ptr %2, align 4
  ret i32 %262
}

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

; Function Attrs: mustprogress uwtable
declare hidden noundef i64 @_ZL26drwav__riff_chunk_size_w64y(i64 noundef) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL30drwav__chunk_padding_size_riffy(i64 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL29drwav__chunk_padding_size_w64y(i64 noundef) #2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL27drwav__data_chunk_size_riffy(i64 noundef) #2

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i64 @_ZL26drwav__data_chunk_size_w64y(i64 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i64 @_ZL27drwav__data_chunk_size_rf64y(i64 noundef) #2

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

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

declare i32 @fclose(ptr noundef) #3

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 8}
!12 = !{!"_ZTS5drwav", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !13, i64 32, !14, i64 64, !15, i64 68, !10, i64 108, !16, i64 112, !16, i64 114, !16, i64 116, !17, i64 120, !17, i64 128, !17, i64 136, !17, i64 144, !17, i64 152, !17, i64 160, !10, i64 168, !18, i64 172, !6, i64 176, !10, 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, !10, i64 4, !10, i64 8, !16, i64 12, !16, i64 14, !16, i64 16, !16, i64 18, !10, i64 20, !7, i64 24}
!16 = !{!"short", !7, i64 0}
!17 = !{!"long long", !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", !10, i64 0, !7, i64 4, !7, i64 8, !7, i64 16, !10, i64 32, !7, i64 36}
!23 = !{!"_ZTSN5drwavUt0_E", !10, i64 0, !7, i64 4, !7, i64 12, !7, i64 20, !10, i64 84}
!24 = !{!12, !14, i64 64}
!25 = !{!12, !17, i64 128}
!26 = !{!17, !17, i64 0}
!27 = !{!12, !6, i64 16}
!28 = !{!12, !10, i64 168}
!29 = !{!12, !6, i64 24}
!30 = !{!12, !6, i64 176}
!31 = !{!12, !10, i64 184}
!32 = !{!12, !17, i64 136}
!33 = !{!12, !17, i64 160}
!34 = !{!12, !6, i64 56}
!35 = !{!12, !6, i64 32}
!36 = !{!12, !6, i64 0}


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

; 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: mustprogress uwtable
define dso_local range(i32 -10, 1) i32 @drwav_uninit(ptr noundef %0) local_unnamed_addr #1 {
  %2 = alloca i64, align 8
  %3 = icmp eq ptr %0, null
  br i1 %3, label %126, label %4

4:                                                ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %.not = icmp eq ptr %6, null
  br i1 %.not, label %108, label %7

7:                                                ; preds = %4
  %8 = getelementptr inbounds i8, ptr %0, i64 64
  %9 = load i32, ptr %8, align 8, !tbaa !22
  switch i32 %9, label %14 [
    i32 0, label %10
    i32 2, label %10
  ]

10:                                               ; preds = %7, %7
  %11 = getelementptr inbounds i8, ptr %0, i64 128
  %12 = load i64, ptr %11, align 8, !tbaa !23
  %13 = tail call noundef i32 @_ZL30drwav__chunk_padding_size_riffy(i64 noundef %12)
  br label %18

14:                                               ; preds = %7
  %15 = getelementptr inbounds i8, ptr %0, i64 128
  %16 = load i64, ptr %15, align 8, !tbaa !23
  %17 = tail call noundef i32 @_ZL29drwav__chunk_padding_size_w64y(i64 noundef %16)
  br label %18

18:                                               ; preds = %14, %10
  %.064 = phi i32 [ %13, %10 ], [ %17, %14 ]
  %.not71 = icmp eq i32 %.064, 0
  br i1 %.not71, label %22, label %19

19:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  store i64 0, ptr %2, align 8, !tbaa !24
  %20 = zext i32 %.064 to i64
  %21 = call noundef i64 @_ZL12drwav__writeP5drwavPKvm(ptr noundef nonnull %0, ptr noundef nonnull %2, i64 noundef %20)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  br label %22

22:                                               ; preds = %19, %18
  %23 = getelementptr inbounds i8, ptr %0, i64 16
  %24 = load ptr, ptr %23, align 8, !tbaa !25
  %.not72 = icmp eq ptr %24, null
  br i1 %.not72, label %100, label %25

25:                                               ; preds = %22
  %26 = getelementptr inbounds i8, ptr %0, i64 168
  %27 = load i32, ptr %26, align 8, !tbaa !26
  %.not73 = icmp eq i32 %27, 0
  br i1 %.not73, label %28, label %100

28:                                               ; preds = %25
  %29 = load i32, ptr %8, align 8, !tbaa !22
  switch i32 %29, label %100 [
    i32 0, label %30
    i32 1, label %56
    i32 2, label %78
  ]

30:                                               ; preds = %28
  %31 = getelementptr inbounds i8, ptr %0, i64 24
  %32 = load ptr, ptr %31, align 8, !tbaa !27
  %33 = call noundef i32 %24(ptr noundef %32, i32 noundef 4, i32 noundef 0)
  %.not78 = icmp eq i32 %33, 0
  br i1 %.not78, label %43, label %34

34:                                               ; preds = %30
  %35 = getelementptr inbounds i8, ptr %0, i64 128
  %36 = load i64, ptr %35, align 8, !tbaa !23
  %37 = getelementptr inbounds i8, ptr %0, i64 176
  %38 = load ptr, ptr %37, align 8, !tbaa !28
  %39 = getelementptr inbounds i8, ptr %0, i64 184
  %40 = load i32, ptr %39, align 8, !tbaa !29
  %41 = call noundef i32 @_ZL27drwav__riff_chunk_size_riffyP14drwav_metadataj(i64 noundef %36, ptr noundef %38, i32 noundef %40)
  %42 = call noundef i64 @_ZL24drwav__write_u32ne_to_leP5drwavj(ptr noundef nonnull %0, i32 noundef %41)
  br label %43

43:                                               ; preds = %34, %30
  %44 = load ptr, ptr %23, align 8, !tbaa !25
  %45 = load ptr, ptr %31, align 8, !tbaa !27
  %46 = getelementptr inbounds i8, ptr %0, i64 136
  %47 = load i64, ptr %46, align 8, !tbaa !30
  %48 = trunc i64 %47 to i32
  %49 = add nsw i32 %48, -4
  %50 = call noundef i32 %44(ptr noundef %45, i32 noundef %49, i32 noundef 0)
  %.not79 = icmp eq i32 %50, 0
  br i1 %.not79, label %100, label %51

51:                                               ; preds = %43
  %52 = getelementptr inbounds i8, ptr %0, i64 128
  %53 = load i64, ptr %52, align 8, !tbaa !23
  %54 = call noundef i32 @_ZL27drwav__data_chunk_size_riffy(i64 noundef %53)
  %55 = call noundef i64 @_ZL24drwav__write_u32ne_to_leP5drwavj(ptr noundef nonnull %0, i32 noundef %54)
  br label %100

56:                                               ; preds = %28
  %57 = getelementptr inbounds i8, ptr %0, i64 24
  %58 = load ptr, ptr %57, align 8, !tbaa !27
  %59 = call noundef i32 %24(ptr noundef %58, i32 noundef 16, i32 noundef 0)
  %.not76 = icmp eq i32 %59, 0
  br i1 %.not76, label %65, label %60

60:                                               ; preds = %56
  %61 = getelementptr inbounds i8, ptr %0, i64 128
  %62 = load i64, ptr %61, align 8, !tbaa !23
  %63 = call noundef i64 @_ZL26drwav__riff_chunk_size_w64y(i64 noundef %62)
  %64 = call noundef i64 @_ZL24drwav__write_u64ne_to_leP5drwavy(ptr noundef nonnull %0, i64 noundef %63)
  br label %65

65:                                               ; preds = %60, %56
  %66 = load ptr, ptr %23, align 8, !tbaa !25
  %67 = load ptr, ptr %57, align 8, !tbaa !27
  %68 = getelementptr inbounds i8, ptr %0, i64 136
  %69 = load i64, ptr %68, align 8, !tbaa !30
  %70 = trunc i64 %69 to i32
  %71 = add nsw i32 %70, -8
  %72 = call noundef i32 %66(ptr noundef %67, i32 noundef %71, i32 noundef 0)
  %.not77 = icmp eq i32 %72, 0
  br i1 %.not77, label %100, label %73

73:                                               ; preds = %65
  %74 = getelementptr inbounds i8, ptr %0, i64 128
  %75 = load i64, ptr %74, align 8, !tbaa !23
  %76 = call noundef i64 @_ZL26drwav__data_chunk_size_w64y(i64 noundef %75)
  %77 = call noundef i64 @_ZL24drwav__write_u64ne_to_leP5drwavy(ptr noundef nonnull %0, i64 noundef %76)
  br label %100

78:                                               ; preds = %28
  %79 = getelementptr inbounds i8, ptr %0, i64 24
  %80 = load ptr, ptr %79, align 8, !tbaa !27
  %81 = call noundef i32 %24(ptr noundef %80, i32 noundef 20, i32 noundef 0)
  %.not74 = icmp eq i32 %81, 0
  br i1 %.not74, label %91, label %82

82:                                               ; preds = %78
  %83 = getelementptr inbounds i8, ptr %0, i64 128
  %84 = load i64, ptr %83, align 8, !tbaa !23
  %85 = getelementptr inbounds i8, ptr %0, i64 176
  %86 = load ptr, ptr %85, align 8, !tbaa !28
  %87 = getelementptr inbounds i8, ptr %0, i64 184
  %88 = load i32, ptr %87, align 8, !tbaa !29
  %89 = call noundef i64 @_ZL27drwav__riff_chunk_size_rf64yP14drwav_metadataj(i64 noundef %84, ptr noundef %86, i32 noundef %88)
  %90 = call noundef i64 @_ZL24drwav__write_u64ne_to_leP5drwavy(ptr noundef nonnull %0, i64 noundef %89)
  br label %91

91:                                               ; preds = %82, %78
  %92 = load ptr, ptr %23, align 8, !tbaa !25
  %93 = load ptr, ptr %79, align 8, !tbaa !27
  %94 = call noundef i32 %92(ptr noundef %93, i32 noundef 28, i32 noundef 0)
  %.not75 = icmp eq i32 %94, 0
  br i1 %.not75, label %100, label %95

95:                                               ; preds = %91
  %96 = getelementptr inbounds i8, ptr %0, i64 128
  %97 = load i64, ptr %96, align 8, !tbaa !23
  %98 = call noundef i64 @_ZL27drwav__data_chunk_size_rf64y(i64 noundef %97)
  %99 = call noundef i64 @_ZL24drwav__write_u64ne_to_leP5drwavy(ptr noundef nonnull %0, i64 noundef %98)
  br label %100

100:                                              ; preds = %91, %95, %28, %51, %43, %65, %73, %25, %22
  %101 = getelementptr inbounds i8, ptr %0, i64 168
  %102 = load i32, ptr %101, align 8, !tbaa !26
  %.not80 = icmp eq i32 %102, 0
  br i1 %.not80, label %116, label %103

103:                                              ; preds = %100
  %104 = getelementptr inbounds i8, ptr %0, i64 128
  %105 = load i64, ptr %104, align 8, !tbaa !23
  %106 = getelementptr inbounds i8, ptr %0, i64 160
  %107 = load i64, ptr %106, align 8, !tbaa !31
  %.not81 = icmp eq i64 %105, %107
  %spec.select = select i1 %.not81, i32 0, i32 -10
  br label %116

108:                                              ; preds = %4
  %109 = getelementptr inbounds i8, ptr %0, i64 176
  %110 = load ptr, ptr %109, align 8, !tbaa !28
  %.not70 = icmp eq ptr %110, null
  br i1 %.not70, label %116, label %111

111:                                              ; preds = %108
  %112 = getelementptr inbounds i8, ptr %0, i64 32
  %113 = getelementptr inbounds i8, ptr %0, i64 56
  %114 = load ptr, ptr %113, align 8, !tbaa !32
  %115 = load ptr, ptr %112, align 8, !tbaa !33
  tail call void %114(ptr noundef nonnull %110, ptr noundef %115)
  br label %116

116:                                              ; preds = %103, %100, %108, %111
  %.1 = phi i32 [ 0, %111 ], [ 0, %108 ], [ 0, %100 ], [ %spec.select, %103 ]
  %117 = load ptr, ptr %0, align 8, !tbaa !34
  %118 = icmp eq ptr %117, @_ZL20drwav__on_read_stdioPvS_m
  br i1 %118, label %122, label %119

119:                                              ; preds = %116
  %120 = load ptr, ptr %5, align 8, !tbaa !5
  %121 = icmp eq ptr %120, @_ZL21drwav__on_write_stdioPvPKvm
  br i1 %121, label %122, label %126

122:                                              ; preds = %119, %116
  %123 = getelementptr inbounds i8, ptr %0, i64 24
  %124 = load ptr, ptr %123, align 8, !tbaa !27
  %125 = call i32 @fclose(ptr noundef %124)
  br label %126

126:                                              ; preds = %119, %122, %1
  %.0 = phi i32 [ -2, %1 ], [ %.1, %122 ], [ %.1, %119 ]
  ret i32 %.0
}

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL30drwav__chunk_padding_size_riffy(i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL29drwav__chunk_padding_size_w64y(i64 noundef) local_unnamed_addr #2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL27drwav__data_chunk_size_riffy(i64 noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i64 @_ZL26drwav__data_chunk_size_w64y(i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i64 @_ZL27drwav__data_chunk_size_rf64y(i64 noundef) local_unnamed_addr #2

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #3

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 8}
!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, !11, i64 64}
!23 = !{!6, !15, i64 128}
!24 = !{!15, !15, i64 0}
!25 = !{!6, !7, i64 16}
!26 = !{!6, !14, i64 168}
!27 = !{!6, !7, i64 24}
!28 = !{!6, !7, i64 176}
!29 = !{!6, !14, i64 184}
!30 = !{!6, !15, i64 136}
!31 = !{!6, !15, i64 160}
!32 = !{!6, !7, i64 56}
!33 = !{!6, !7, i64 32}
!34 = !{!6, !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass