; LLVM IR from suxiaojack/sapDecoder :: src/sapdecoder.ll (ZN10SAPDecoder15ProcessDecodingEPKcS1_)

; 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.ov_callbacks = type { ptr, ptr, ptr, ptr }
%struct.OggVorbis_File = type { ptr, i32, i64, i64, %struct.ogg_sync_state, i32, ptr, ptr, ptr, ptr, ptr, ptr, i64, i32, i64, i32, double, double, %struct.ogg_stream_state, %struct.vorbis_dsp_state, %struct.vorbis_block, %struct.ov_callbacks }
%struct.ogg_sync_state = type { ptr, i32, i32, i32, i32, i32, i32 }
%struct.ogg_stream_state = type { ptr, i64, i64, i64, ptr, ptr, i64, i64, i64, i64, [282 x i8], i32, i32, i32, i64, i64, i64, i64 }
%struct.vorbis_dsp_state = type { i32, ptr, ptr, ptr, i32, i32, i32, i32, i32, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, ptr }
%struct.vorbis_block = type { ptr, %struct.oggpack_buffer, i64, i64, i64, i32, i32, i32, i64, i64, ptr, ptr, i64, i64, i64, ptr, i64, i64, i64, i64, ptr }
%struct.oggpack_buffer = type { i64, i32, ptr, ptr, i64 }
%class.SAPDecoder = type { ptr, float, float, float, float, i32, i32, [2 x float], %"class.std::vector", %"class.std::vector", ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl" }
%"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl" = type { %"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl_data" }
%"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.vorbis_comment = type { ptr, ptr, i32, ptr }
%struct.vorbis_info = type { i32, i32, i64, i64, i64, i64, i64, ptr }

@.str.8 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [44 x i8], align 1
@_ZL20OV_CALLBACKS_NOCLOSE = external hidden global %struct.ov_callbacks, align 8
@stderr = external global ptr, align 8
@.str.10 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [9 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: mustprogress uwtable
define dso_local void @_ZN10SAPDecoder15ProcessDecodingEPKcS1_(ptr noundef nonnull align 8 dereferenceable(144) %0, ptr noundef %1, ptr noundef %2) #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca double, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca [2048 x i8], align 16
  %18 = alloca [1024 x float], align 16
  %19 = alloca [1024 x float], align 16
  %20 = alloca [3072 x float], align 16
  %21 = alloca ptr, align 8
  %22 = alloca %struct.OggVorbis_File, align 8
  %23 = alloca i8, align 1
  %24 = alloca i32, align 4
  %25 = alloca %struct.ov_callbacks, align 8
  %26 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %27 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 2048, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.start.p0(i64 2048, ptr %17) #5
  call void @llvm.lifetime.start.p0(i64 4096, ptr %18) #5
  call void @llvm.lifetime.start.p0(i64 4096, ptr %19) #5
  call void @llvm.lifetime.start.p0(i64 12288, ptr %20) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.start.p0(i64 944, ptr %22) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr %23) #5
  store i8 0, ptr %23, align 1, !tbaa !11
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = icmp eq ptr %28, null
  br i1 %29, label %30, label %31

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

31:                                               ; preds = %3
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = icmp eq ptr %32, null
  br i1 %33, label %34, label %35

34:                                               ; preds = %31
  store i8 1, ptr %23, align 1, !tbaa !11
  br label %35

35:                                               ; preds = %34, %31
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = call noalias ptr @fopen(ptr noundef %36, ptr noundef @.str.8)
  %38 = getelementptr inbounds %class.SAPDecoder, ptr %27, i32 0, i32 15
  store ptr %37, ptr %38, align 8, !tbaa !13
  %39 = icmp eq ptr %37, null
  br i1 %39, label %40, label %42

40:                                               ; preds = %35
  %41 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  store i32 1, ptr %24, align 4
  br label %206

42:                                               ; preds = %35
  %43 = getelementptr inbounds %class.SAPDecoder, ptr %27, i32 0, i32 15
  %44 = load ptr, ptr %43, align 8, !tbaa !13
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %25, ptr align 8 @_ZL20OV_CALLBACKS_NOCLOSE, i64 32, i1 false), !tbaa.struct !20
  %45 = call i32 @ov_open_callbacks(ptr noundef %44, ptr noundef %22, ptr noundef null, i64 noundef 0, ptr noundef byval(%struct.ov_callbacks) align 8 %25)
  %46 = icmp slt i32 %45, 0
  br i1 %46, label %47, label %49

47:                                               ; preds = %42
  %48 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  store i32 1, ptr %24, align 4
  br label %206

49:                                               ; preds = %42
  %50 = call ptr @ov_comment(ptr noundef %22, i32 noundef -1)
  %51 = getelementptr inbounds %struct.vorbis_comment, ptr %50, i32 0, i32 0
  %52 = load ptr, ptr %51, align 8, !tbaa !21
  store ptr %52, ptr %16, align 8, !tbaa !5
  %53 = call ptr @ov_info(ptr noundef %22, i32 noundef -1)
  store ptr %53, ptr %21, align 8, !tbaa !5
  br label %54

54:                                               ; preds = %58, %49
  %55 = load ptr, ptr %16, align 8, !tbaa !5
  %56 = load ptr, ptr %55, align 8, !tbaa !5
  %57 = icmp ne ptr %56, null
  br i1 %57, label %58, label %65

58:                                               ; preds = %54
  %59 = load ptr, ptr @stderr, align 8, !tbaa !5
  %60 = load ptr, ptr %16, align 8, !tbaa !5
  %61 = load ptr, ptr %60, align 8, !tbaa !5
  %62 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %59, ptr noundef @.str.10, ptr noundef %61) #5
  %63 = load ptr, ptr %16, align 8, !tbaa !5
  %64 = getelementptr inbounds ptr, ptr %63, i32 1
  store ptr %64, ptr %16, align 8, !tbaa !5
  br label %54, !llvm.loop !23

65:                                               ; preds = %54
  %66 = load ptr, ptr @stderr, align 8, !tbaa !5
  %67 = load ptr, ptr %21, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.vorbis_info, ptr %67, i32 0, i32 1
  %69 = load i32, ptr %68, align 4, !tbaa !25
  %70 = load ptr, ptr %21, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.vorbis_info, ptr %70, i32 0, i32 2
  %72 = load i64, ptr %71, align 8, !tbaa !28
  %73 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %66, ptr noundef @.str.11, i32 noundef %69, i64 noundef %72) #5
  %74 = load ptr, ptr @stderr, align 8, !tbaa !5
  %75 = call i64 @ov_pcm_total(ptr noundef %22, i32 noundef -1)
  %76 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %74, ptr noundef @.str.12, i64 noundef %75) #5
  %77 = load ptr, ptr %21, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.vorbis_info, ptr %77, i32 0, i32 2
  %79 = load i64, ptr %78, align 8, !tbaa !28
  %80 = sitofp i64 %79 to double
  store double %80, ptr %9, align 8, !tbaa !29
  %81 = load ptr, ptr %21, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.vorbis_info, ptr %81, i32 0, i32 1
  %83 = load i32, ptr %82, align 4, !tbaa !25
  %84 = sext i32 %83 to i64
  store i64 %84, ptr %8, align 8, !tbaa !31
  %85 = call i64 @ov_pcm_total(ptr noundef %22, i32 noundef -1)
  store i64 %85, ptr %7, align 8, !tbaa !31
  %86 = load i64, ptr %8, align 8, !tbaa !31
  %87 = icmp ne i64 %86, 2
  br i1 %87, label %88, label %89

88:                                               ; preds = %65
  store i32 1, ptr %24, align 4
  br label %206

89:                                               ; preds = %65
  %90 = load ptr, ptr %6, align 8, !tbaa !5
  %91 = getelementptr inbounds %class.SAPDecoder, ptr %27, i32 0, i32 5
  %92 = load i32, ptr %91, align 8, !tbaa !32
  %93 = sext i32 %92 to i64
  %94 = load double, ptr %9, align 8, !tbaa !29
  %95 = call ptr @AFopnWrite(ptr noundef %90, i32 noundef 2, i32 noundef 5, i64 noundef %93, double noundef %94, ptr noundef null)
  %96 = getelementptr inbounds %class.SAPDecoder, ptr %27, i32 0, i32 16
  store ptr %95, ptr %96, align 8, !tbaa !33
  br label %97

97:                                               ; preds = %188, %89
  %98 = load i32, ptr %10, align 4, !tbaa !9
  %99 = icmp ne i32 %98, 0
  %100 = xor i1 %99, true
  br i1 %100, label %101, label %189

101:                                              ; preds = %97
  br label %102

102:                                              ; preds = %130, %101
  %103 = load i32, ptr %11, align 4, !tbaa !9
  %104 = load i32, ptr %15, align 4, !tbaa !9
  %105 = icmp slt i32 %103, %104
  br i1 %105, label %106, label %131

106:                                              ; preds = %102
  %107 = getelementptr inbounds [2048 x i8], ptr %17, i64 0, i64 0
  %108 = load i32, ptr %11, align 4, !tbaa !9
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds i8, ptr %107, i64 %109
  %111 = load i32, ptr %15, align 4, !tbaa !9
  %112 = load i32, ptr %11, align 4, !tbaa !9
  %113 = sub nsw i32 %111, %112
  %114 = call i64 @ov_read(ptr noundef %22, ptr noundef %110, i32 noundef %113, i32 noundef 0, i32 noundef 2, i32 noundef 1, ptr noundef %14)
  %115 = trunc i64 %114 to i32
  store i32 %115, ptr %12, align 4, !tbaa !9
  %116 = load i32, ptr %12, align 4, !tbaa !9
  %117 = load i32, ptr %11, align 4, !tbaa !9
  %118 = add nsw i32 %117, %116
  store i32 %118, ptr %11, align 4, !tbaa !9
  %119 = load i32, ptr %12, align 4, !tbaa !9
  %120 = icmp slt i32 %119, 0
  br i1 %120, label %121, label %124

121:                                              ; preds = %106
  %122 = load i32, ptr %14, align 4, !tbaa !9
  %123 = call i32 (ptr, ...) @printf(ptr noundef @.str.13, i32 noundef %122)
  br label %131

124:                                              ; preds = %106
  %125 = load i32, ptr %12, align 4, !tbaa !9
  %126 = icmp eq i32 %125, 0
  br i1 %126, label %127, label %130

127:                                              ; preds = %124
  %128 = load i32, ptr %14, align 4, !tbaa !9
  %129 = call i32 (ptr, ...) @printf(ptr noundef @.str.14, i32 noundef %128)
  br label %131

130:                                              ; preds = %124
  br label %102, !llvm.loop !34

131:                                              ; preds = %127, %121, %102
  %132 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %132, ptr %12, align 4, !tbaa !9
  store i32 0, ptr %11, align 4, !tbaa !9
  %133 = load i32, ptr %12, align 4, !tbaa !9
  %134 = load i32, ptr %15, align 4, !tbaa !9
  %135 = icmp ne i32 %133, %134
  br i1 %135, label %136, label %137

136:                                              ; preds = %131
  store i32 1, ptr %10, align 4, !tbaa !9
  br label %137

137:                                              ; preds = %136, %131
  %138 = load i32, ptr %10, align 4, !tbaa !9
  %139 = icmp ne i32 %138, 0
  br i1 %139, label %188, label %140

140:                                              ; preds = %137
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #5
  %141 = getelementptr inbounds [1024 x float], ptr %18, i64 0, i64 0
  %142 = getelementptr inbounds [2048 x i8], ptr %17, i64 0, i64 0
  %143 = load i32, ptr %15, align 4, !tbaa !9
  %144 = sext i32 %143 to i64
  %145 = udiv i64 %144, 2
  %146 = trunc i64 %145 to i32
  %147 = call noundef i32 @_Z10Char2FloatPfPci(ptr noundef %141, ptr noundef %142, i32 noundef %146)
  store i32 %147, ptr %26, align 4, !tbaa !9
  %148 = getelementptr inbounds %class.SAPDecoder, ptr %27, i32 0, i32 5
  %149 = load i32, ptr %148, align 8, !tbaa !32
  %150 = icmp eq i32 %149, 2
  br i1 %150, label %151, label %162

151:                                              ; preds = %140
  %152 = load i32, ptr %26, align 4, !tbaa !9
  %153 = icmp sgt i32 %152, 0
  br i1 %153, label %154, label %162

154:                                              ; preds = %151
  %155 = getelementptr inbounds [1024 x float], ptr %19, i64 0, i64 0
  %156 = getelementptr inbounds [1024 x float], ptr %18, i64 0, i64 0
  %157 = load i32, ptr %26, align 4, !tbaa !9
  call void @_ZN10SAPDecoder20ApplyVirtualSurroundEPfS0_i(ptr noundef nonnull align 8 dereferenceable(144) %27, ptr noundef %155, ptr noundef %156, i32 noundef %157)
  %158 = getelementptr inbounds %class.SAPDecoder, ptr %27, i32 0, i32 16
  %159 = load ptr, ptr %158, align 8, !tbaa !33
  %160 = getelementptr inbounds [1024 x float], ptr %19, i64 0, i64 0
  %161 = call i32 @AFfWriteData(ptr noundef %159, ptr noundef %160, i32 noundef 1024)
  br label %162

162:                                              ; preds = %154, %151, %140
  %163 = getelementptr inbounds %class.SAPDecoder, ptr %27, i32 0, i32 5
  %164 = load i32, ptr %163, align 8, !tbaa !32
  %165 = icmp eq i32 %164, 6
  br i1 %165, label %166, label %177

166:                                              ; preds = %162
  %167 = load i32, ptr %26, align 4, !tbaa !9
  %168 = icmp sgt i32 %167, 0
  br i1 %168, label %169, label %177

169:                                              ; preds = %166
  %170 = getelementptr inbounds [3072 x float], ptr %20, i64 0, i64 0
  %171 = getelementptr inbounds [1024 x float], ptr %18, i64 0, i64 0
  %172 = load i32, ptr %26, align 4, !tbaa !9
  call void @_ZN10SAPDecoder17ApplyRealSurroundEPfS0_i(ptr noundef nonnull align 8 dereferenceable(144) %27, ptr noundef %170, ptr noundef %171, i32 noundef %172)
  %173 = getelementptr inbounds %class.SAPDecoder, ptr %27, i32 0, i32 16
  %174 = load ptr, ptr %173, align 8, !tbaa !33
  %175 = getelementptr inbounds [3072 x float], ptr %20, i64 0, i64 0
  %176 = call i32 @AFfWriteData(ptr noundef %174, ptr noundef %175, i32 noundef 3072)
  br label %177

177:                                              ; preds = %169, %166, %162
  %178 = load i32, ptr %12, align 4, !tbaa !9
  %179 = mul nsw i32 25, %178
  %180 = load i32, ptr %13, align 4, !tbaa !9
  %181 = mul nsw i32 %179, %180
  %182 = sext i32 %181 to i64
  %183 = load i64, ptr %7, align 8, !tbaa !31
  %184 = sdiv i64 %182, %183
  %185 = call i32 (ptr, ...) @printf(ptr noundef @.str.15, i64 noundef %184)
  %186 = load i32, ptr %13, align 4, !tbaa !9
  %187 = add nsw i32 %186, 1
  store i32 %187, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #5
  br label %188

188:                                              ; preds = %177, %137
  br label %97, !llvm.loop !35

189:                                              ; preds = %97
  %190 = call i32 @ov_clear(ptr noundef %22)
  %191 = getelementptr inbounds %class.SAPDecoder, ptr %27, i32 0, i32 15
  %192 = load ptr, ptr %191, align 8, !tbaa !13
  %193 = icmp ne ptr %192, null
  br i1 %193, label %194, label %198

194:                                              ; preds = %189
  %195 = getelementptr inbounds %class.SAPDecoder, ptr %27, i32 0, i32 15
  %196 = load ptr, ptr %195, align 8, !tbaa !13
  %197 = call i32 @fclose(ptr noundef %196)
  br label %198

198:                                              ; preds = %194, %189
  %199 = getelementptr inbounds %class.SAPDecoder, ptr %27, i32 0, i32 16
  %200 = load ptr, ptr %199, align 8, !tbaa !33
  %201 = icmp ne ptr %200, null
  br i1 %201, label %202, label %205

202:                                              ; preds = %198
  %203 = getelementptr inbounds %class.SAPDecoder, ptr %27, i32 0, i32 16
  %204 = load ptr, ptr %203, align 8, !tbaa !33
  call void @AFclose(ptr noundef %204)
  br label %205

205:                                              ; preds = %202, %198
  store i32 0, ptr %24, align 4
  br label %206

206:                                              ; preds = %205, %88, %47, %40, %30
  call void @llvm.lifetime.end.p0(i64 1, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 944, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 12288, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 4096, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4096, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 2048, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  %207 = load i32, ptr %24, align 4
  switch i32 %207, label %209 [
    i32 0, label %208
    i32 1, label %208
  ]

208:                                              ; preds = %206, %206
  ret void

209:                                              ; preds = %206
  unreachable
}

declare noalias ptr @fopen(ptr noundef, ptr noundef) #2

declare i32 @printf(ptr noundef, ...) #2

declare i32 @ov_open_callbacks(ptr noundef, ptr noundef, ptr noundef, i64 noundef, ptr noundef byval(%struct.ov_callbacks) align 8) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

declare ptr @ov_comment(ptr noundef, i32 noundef) #2

declare ptr @ov_info(ptr noundef, i32 noundef) #2

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #4

declare i64 @ov_pcm_total(ptr noundef, i32 noundef) #2

declare ptr @AFopnWrite(ptr noundef, i32 noundef, i32 noundef, i64 noundef, double noundef, ptr noundef) #2

declare i64 @ov_read(ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) #2

declare noundef i32 @_Z10Char2FloatPfPci(ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10SAPDecoder20ApplyVirtualSurroundEPfS0_i(ptr noundef nonnull align 8 dereferenceable(144), ptr noundef, ptr noundef, i32 noundef) #1 align 2

declare i32 @AFfWriteData(ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10SAPDecoder17ApplyRealSurroundEPfS0_i(ptr noundef nonnull align 8 dereferenceable(144), ptr noundef, ptr noundef, i32 noundef) #1 align 2

declare i32 @ov_clear(ptr noundef) #2

declare i32 @fclose(ptr noundef) #2

declare void @AFclose(ptr noundef) #2

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { 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, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!14, !6, i64 128}
!14 = !{!"_ZTS10SAPDecoder", !15, i64 8, !15, i64 12, !15, i64 16, !15, i64 20, !10, i64 24, !10, i64 28, !7, i64 32, !16, i64 40, !16, i64 64, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136}
!15 = !{!"float", !7, i64 0}
!16 = !{!"_ZTSSt6vectorIfSaIfEE", !17, i64 0}
!17 = !{!"_ZTSSt12_Vector_baseIfSaIfEE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE12_Vector_implE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!20 = !{i64 0, i64 8, !5, i64 8, i64 8, !5, i64 16, i64 8, !5, i64 24, i64 8, !5}
!21 = !{!22, !6, i64 0}
!22 = !{!"_ZTS14vorbis_comment", !6, i64 0, !6, i64 8, !10, i64 16, !6, i64 24}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!26, !10, i64 4}
!26 = !{!"_ZTS11vorbis_info", !10, i64 0, !10, i64 4, !27, i64 8, !27, i64 16, !27, i64 24, !27, i64 32, !27, i64 40, !6, i64 48}
!27 = !{!"long", !7, i64 0}
!28 = !{!26, !27, i64 8}
!29 = !{!30, !30, i64 0}
!30 = !{!"double", !7, i64 0}
!31 = !{!27, !27, i64 0}
!32 = !{!14, !10, i64 24}
!33 = !{!14, !6, i64 136}
!34 = distinct !{!34, !24}
!35 = distinct !{!35, !24}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.ov_callbacks = type { ptr, ptr, ptr, ptr }
%struct.OggVorbis_File = type { ptr, i32, i64, i64, %struct.ogg_sync_state, i32, ptr, ptr, ptr, ptr, ptr, ptr, i64, i32, i64, i32, double, double, %struct.ogg_stream_state, %struct.vorbis_dsp_state, %struct.vorbis_block, %struct.ov_callbacks }
%struct.ogg_sync_state = type { ptr, i32, i32, i32, i32, i32, i32 }
%struct.ogg_stream_state = type { ptr, i64, i64, i64, ptr, ptr, i64, i64, i64, i64, [282 x i8], i32, i32, i32, i64, i64, i64, i64 }
%struct.vorbis_dsp_state = type { i32, ptr, ptr, ptr, i32, i32, i32, i32, i32, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, ptr }
%struct.vorbis_block = type { ptr, %struct.oggpack_buffer, i64, i64, i64, i32, i32, i32, i64, i64, ptr, ptr, i64, i64, i64, ptr, i64, i64, i64, i64, ptr }
%struct.oggpack_buffer = type { i64, i32, ptr, ptr, i64 }

@.str.8 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [44 x i8], align 1
@_ZL20OV_CALLBACKS_NOCLOSE = external hidden local_unnamed_addr global %struct.ov_callbacks, align 8
@stderr = external local_unnamed_addr global ptr, align 8
@.str.10 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [9 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: mustprogress uwtable
define dso_local void @_ZN10SAPDecoder15ProcessDecodingEPKcS1_(ptr noundef nonnull align 8 dereferenceable(144) %0, ptr noundef readonly %1, ptr noundef %2) local_unnamed_addr #1 align 2 {
  %4 = alloca i32, align 4
  %5 = alloca [2048 x i8], align 16
  %6 = alloca [1024 x float], align 16
  %7 = alloca [1024 x float], align 16
  %8 = alloca [3072 x float], align 16
  %9 = alloca %struct.OggVorbis_File, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 2048, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 12288, ptr nonnull %8) #4
  call void @llvm.lifetime.start.p0(i64 944, ptr nonnull %9) #4
  %10 = icmp eq ptr %1, null
  br i1 %10, label %97, label %11

11:                                               ; preds = %3
  %12 = tail call noalias ptr @fopen(ptr noundef nonnull %1, ptr noundef nonnull @.str.8)
  %13 = getelementptr inbounds i8, ptr %0, i64 128
  store ptr %12, ptr %13, align 8, !tbaa !5
  %14 = icmp eq ptr %12, null
  br i1 %14, label %15, label %17

15:                                               ; preds = %11
  %16 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  br label %97

17:                                               ; preds = %11
  %18 = call i32 @ov_open_callbacks(ptr noundef nonnull %12, ptr noundef nonnull %9, ptr noundef null, i64 noundef 0, ptr noundef nonnull byval(%struct.ov_callbacks) align 8 @_ZL20OV_CALLBACKS_NOCLOSE)
  %19 = icmp slt i32 %18, 0
  br i1 %19, label %20, label %22

20:                                               ; preds = %17
  %21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  br label %97

22:                                               ; preds = %17
  %23 = call ptr @ov_comment(ptr noundef nonnull %9, i32 noundef -1)
  %24 = load ptr, ptr %23, align 8, !tbaa !16
  %25 = call ptr @ov_info(ptr noundef nonnull %9, i32 noundef -1)
  %26 = load ptr, ptr %24, align 8, !tbaa !18
  %.not61 = icmp eq ptr %26, null
  br i1 %.not61, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %22, %.lr.ph
  %27 = phi ptr [ %31, %.lr.ph ], [ %26, %22 ]
  %.04162 = phi ptr [ %30, %.lr.ph ], [ %24, %22 ]
  %28 = load ptr, ptr @stderr, align 8, !tbaa !18
  %29 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %28, ptr noundef nonnull @.str.10, ptr noundef nonnull %27) #5
  %30 = getelementptr inbounds i8, ptr %.04162, i64 8
  %31 = load ptr, ptr %30, align 8, !tbaa !18
  %.not = icmp eq ptr %31, null
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !19

._crit_edge:                                      ; preds = %.lr.ph, %22
  %32 = load ptr, ptr @stderr, align 8, !tbaa !18
  %33 = getelementptr inbounds i8, ptr %25, i64 4
  %34 = load i32, ptr %33, align 4, !tbaa !21
  %35 = getelementptr inbounds i8, ptr %25, i64 8
  %36 = load i64, ptr %35, align 8, !tbaa !24
  %37 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %32, ptr noundef nonnull @.str.11, i32 noundef %34, i64 noundef %36) #5
  %38 = load ptr, ptr @stderr, align 8, !tbaa !18
  %39 = call i64 @ov_pcm_total(ptr noundef nonnull %9, i32 noundef -1)
  %40 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef nonnull @.str.12, i64 noundef %39) #5
  %41 = load i64, ptr %35, align 8, !tbaa !24
  %42 = load i32, ptr %33, align 4, !tbaa !21
  %43 = call i64 @ov_pcm_total(ptr noundef nonnull %9, i32 noundef -1)
  %.not52 = icmp eq i32 %42, 2
  br i1 %.not52, label %44, label %97

44:                                               ; preds = %._crit_edge
  %45 = sitofp i64 %41 to double
  %46 = getelementptr inbounds i8, ptr %0, i64 24
  %47 = load i32, ptr %46, align 8, !tbaa !25
  %48 = sext i32 %47 to i64
  %49 = call ptr @AFopnWrite(ptr noundef %2, i32 noundef 2, i32 noundef 5, i64 noundef %48, double noundef %45, ptr noundef null)
  %50 = getelementptr inbounds i8, ptr %0, i64 136
  store ptr %49, ptr %50, align 8, !tbaa !26
  br label %.preheader

.preheader:                                       ; preds = %83, %44
  %.04263 = phi i32 [ 0, %44 ], [ %88, %83 ]
  br label %51

51:                                               ; preds = %.preheader, %64
  %.140 = phi i32 [ %59, %64 ], [ 0, %.preheader ]
  %52 = icmp slt i32 %.140, 2048
  br i1 %52, label %53, label %.loopexit

53:                                               ; preds = %51
  %54 = sext i32 %.140 to i64
  %55 = getelementptr inbounds i8, ptr %5, i64 %54
  %56 = sub nsw i32 2048, %.140
  %57 = call i64 @ov_read(ptr noundef nonnull %9, ptr noundef nonnull %55, i32 noundef %56, i32 noundef 0, i32 noundef 2, i32 noundef 1, ptr noundef nonnull %4)
  %58 = trunc i64 %57 to i32
  %59 = add nsw i32 %.140, %58
  %60 = icmp slt i32 %58, 0
  br i1 %60, label %61, label %64

61:                                               ; preds = %53
  %62 = load i32, ptr %4, align 4, !tbaa !27
  %63 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13, i32 noundef %62)
  br label %.loopexit

64:                                               ; preds = %53
  %65 = icmp eq i32 %58, 0
  br i1 %65, label %66, label %51, !llvm.loop !28

66:                                               ; preds = %64
  %67 = load i32, ptr %4, align 4, !tbaa !27
  %68 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14, i32 noundef %67)
  br label %.loopexit

.loopexit:                                        ; preds = %51, %66, %61
  %.2 = phi i32 [ %59, %61 ], [ %59, %66 ], [ %.140, %51 ]
  %.not56 = icmp eq i32 %.2, 2048
  br i1 %.not56, label %69, label %89

69:                                               ; preds = %.loopexit
  %70 = call noundef i32 @_Z10Char2FloatPfPci(ptr noundef nonnull %6, ptr noundef nonnull %5, i32 noundef 1024)
  %71 = load i32, ptr %46, align 8, !tbaa !25
  %72 = icmp eq i32 %71, 2
  %73 = icmp sgt i32 %70, 0
  %or.cond = and i1 %73, %72
  br i1 %or.cond, label %74, label %77

74:                                               ; preds = %69
  call void @_ZN10SAPDecoder20ApplyVirtualSurroundEPfS0_i(ptr noundef nonnull align 8 dereferenceable(144) %0, ptr noundef nonnull %7, ptr noundef nonnull %6, i32 noundef %70)
  %75 = load ptr, ptr %50, align 8, !tbaa !26
  %76 = call i32 @AFfWriteData(ptr noundef %75, ptr noundef nonnull %7, i32 noundef 1024)
  %.pre = load i32, ptr %46, align 8, !tbaa !25
  br label %77

77:                                               ; preds = %74, %69
  %78 = phi i32 [ %.pre, %74 ], [ %71, %69 ]
  %79 = icmp eq i32 %78, 6
  %or.cond3 = and i1 %73, %79
  br i1 %or.cond3, label %80, label %83

80:                                               ; preds = %77
  call void @_ZN10SAPDecoder17ApplyRealSurroundEPfS0_i(ptr noundef nonnull align 8 dereferenceable(144) %0, ptr noundef nonnull %8, ptr noundef nonnull %6, i32 noundef %70)
  %81 = load ptr, ptr %50, align 8, !tbaa !26
  %82 = call i32 @AFfWriteData(ptr noundef %81, ptr noundef nonnull %8, i32 noundef 3072)
  br label %83

83:                                               ; preds = %77, %80
  %84 = mul i32 %.04263, 51200
  %85 = sext i32 %84 to i64
  %86 = sdiv i64 %85, %43
  %87 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15, i64 noundef %86)
  %88 = add nuw nsw i32 %.04263, 1
  br label %.preheader, !llvm.loop !29

89:                                               ; preds = %.loopexit
  %90 = call i32 @ov_clear(ptr noundef nonnull %9)
  %91 = load ptr, ptr %13, align 8, !tbaa !5
  %.not54 = icmp eq ptr %91, null
  br i1 %.not54, label %94, label %92

92:                                               ; preds = %89
  %93 = call i32 @fclose(ptr noundef nonnull %91)
  br label %94

94:                                               ; preds = %92, %89
  %95 = load ptr, ptr %50, align 8, !tbaa !26
  %.not55 = icmp eq ptr %95, null
  br i1 %.not55, label %97, label %96

96:                                               ; preds = %94
  call void @AFclose(ptr noundef nonnull %95)
  br label %97

97:                                               ; preds = %94, %96, %._crit_edge, %3, %20, %15
  call void @llvm.lifetime.end.p0(i64 944, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 12288, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 2048, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  ret void
}

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

declare i32 @ov_open_callbacks(ptr noundef, ptr noundef, ptr noundef, i64 noundef, ptr noundef byval(%struct.ov_callbacks) align 8) local_unnamed_addr #3

declare ptr @ov_comment(ptr noundef, i32 noundef) local_unnamed_addr #3

declare ptr @ov_info(ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

declare i64 @ov_pcm_total(ptr noundef, i32 noundef) local_unnamed_addr #3

declare ptr @AFopnWrite(ptr noundef, i32 noundef, i32 noundef, i64 noundef, double noundef, ptr noundef) local_unnamed_addr #3

declare i64 @ov_read(ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

declare noundef i32 @_Z10Char2FloatPfPci(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10SAPDecoder20ApplyVirtualSurroundEPfS0_i(ptr noundef nonnull align 8 dereferenceable(144), ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1 align 2

declare i32 @AFfWriteData(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10SAPDecoder17ApplyRealSurroundEPfS0_i(ptr noundef nonnull align 8 dereferenceable(144), ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1 align 2

declare i32 @ov_clear(ptr noundef) local_unnamed_addr #3

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

declare void @AFclose(ptr 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 = { 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 #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 }
attributes #5 = { cold 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, !15, i64 128}
!6 = !{!"_ZTS10SAPDecoder", !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !10, i64 24, !10, i64 28, !8, i64 32, !11, i64 40, !11, i64 64, !15, i64 88, !15, i64 96, !15, i64 104, !15, i64 112, !15, i64 120, !15, i64 128, !15, i64 136}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"_ZTSSt6vectorIfSaIfEE", !12, i64 0}
!12 = !{!"_ZTSSt12_Vector_baseIfSaIfEE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE12_Vector_implE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE17_Vector_impl_dataE", !15, i64 0, !15, i64 8, !15, i64 16}
!15 = !{!"any pointer", !8, i64 0}
!16 = !{!17, !15, i64 0}
!17 = !{!"_ZTS14vorbis_comment", !15, i64 0, !15, i64 8, !10, i64 16, !15, i64 24}
!18 = !{!15, !15, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!22, !10, i64 4}
!22 = !{!"_ZTS11vorbis_info", !10, i64 0, !10, i64 4, !23, i64 8, !23, i64 16, !23, i64 24, !23, i64 32, !23, i64 40, !15, i64 48}
!23 = !{!"long", !8, i64 0}
!24 = !{!22, !23, i64 8}
!25 = !{!6, !10, i64 24}
!26 = !{!6, !15, i64 136}
!27 = !{!10, !10, i64 0}
!28 = distinct !{!28, !20}
!29 = distinct !{!29, !20}


; Effective O3 passes: BDCEPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass