; LLVM IR from Natrox/RaptorAudio :: RaptorAudio/src (stb_vorbis)

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

; 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: nounwind uwtable
declare dso_local void @dct_iv_slow(ptr noundef, i32 noundef) #1

; 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) #2

; Function Attrs: nounwind uwtable
define dso_local void @inverse_mdct_slow(ptr noundef %0, i32 noundef %1, ptr noundef %2, i32 noundef %3) #1 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca [4096 x float], align 16
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  store i32 %3, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %14 = load i32, ptr %6, align 4, !tbaa !9
  %15 = ashr i32 %14, 2
  store i32 %15, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %16 = load i32, ptr %6, align 4, !tbaa !9
  %17 = ashr i32 %16, 1
  store i32 %17, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  %18 = load i32, ptr %6, align 4, !tbaa !9
  %19 = load i32, ptr %10, align 4, !tbaa !9
  %20 = sub nsw i32 %18, %19
  store i32 %20, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16384, ptr %13) #3
  %21 = getelementptr inbounds [4096 x float], ptr %13, i64 0, i64 0
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = load i32, ptr %11, align 4, !tbaa !9
  %24 = sext i32 %23 to i64
  %25 = mul i64 %24, 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %21, ptr align 4 %22, i64 %25, i1 false)
  %26 = getelementptr inbounds [4096 x float], ptr %13, i64 0, i64 0
  %27 = load i32, ptr %11, align 4, !tbaa !9
  call void @dct_iv_slow(ptr noundef %26, i32 noundef %27)
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %28

28:                                               ; preds = %43, %4
  %29 = load i32, ptr %9, align 4, !tbaa !9
  %30 = load i32, ptr %10, align 4, !tbaa !9
  %31 = icmp slt i32 %29, %30
  br i1 %31, label %32, label %46

32:                                               ; preds = %28
  %33 = load i32, ptr %9, align 4, !tbaa !9
  %34 = load i32, ptr %10, align 4, !tbaa !9
  %35 = add nsw i32 %33, %34
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [4096 x float], ptr %13, i64 0, i64 %36
  %38 = load float, ptr %37, align 4, !tbaa !11
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = load i32, ptr %9, align 4, !tbaa !9
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds float, ptr %39, i64 %41
  store float %38, ptr %42, align 4, !tbaa !11
  br label %43

43:                                               ; preds = %32
  %44 = load i32, ptr %9, align 4, !tbaa !9
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %9, align 4, !tbaa !9
  br label %28, !llvm.loop !13

46:                                               ; preds = %28
  br label %47

47:                                               ; preds = %64, %46
  %48 = load i32, ptr %9, align 4, !tbaa !9
  %49 = load i32, ptr %12, align 4, !tbaa !9
  %50 = icmp slt i32 %48, %49
  br i1 %50, label %51, label %67

51:                                               ; preds = %47
  %52 = load i32, ptr %12, align 4, !tbaa !9
  %53 = load i32, ptr %9, align 4, !tbaa !9
  %54 = sub nsw i32 %52, %53
  %55 = sub nsw i32 %54, 1
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [4096 x float], ptr %13, i64 0, i64 %56
  %58 = load float, ptr %57, align 4, !tbaa !11
  %59 = fneg float %58
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = load i32, ptr %9, align 4, !tbaa !9
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds float, ptr %60, i64 %62
  store float %59, ptr %63, align 4, !tbaa !11
  br label %64

64:                                               ; preds = %51
  %65 = load i32, ptr %9, align 4, !tbaa !9
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %9, align 4, !tbaa !9
  br label %47, !llvm.loop !15

67:                                               ; preds = %47
  br label %68

68:                                               ; preds = %84, %67
  %69 = load i32, ptr %9, align 4, !tbaa !9
  %70 = load i32, ptr %6, align 4, !tbaa !9
  %71 = icmp slt i32 %69, %70
  br i1 %71, label %72, label %87

72:                                               ; preds = %68
  %73 = load i32, ptr %9, align 4, !tbaa !9
  %74 = load i32, ptr %12, align 4, !tbaa !9
  %75 = sub nsw i32 %73, %74
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [4096 x float], ptr %13, i64 0, i64 %76
  %78 = load float, ptr %77, align 4, !tbaa !11
  %79 = fneg float %78
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = load i32, ptr %9, align 4, !tbaa !9
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds float, ptr %80, i64 %82
  store float %79, ptr %83, align 4, !tbaa !11
  br label %84

84:                                               ; preds = %72
  %85 = load i32, ptr %9, align 4, !tbaa !9
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %9, align 4, !tbaa !9
  br label %68, !llvm.loop !16

87:                                               ; preds = %68
  call void @llvm.lifetime.end.p0(i64 16384, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}


; 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: nounwind uwtable
declare dso_local void @dct_iv_slow(ptr noundef, i32 noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local void @inverse_mdct_slow(ptr nocapture noundef %0, i32 noundef %1, ptr nocapture noundef readnone %2, i32 noundef %3) local_unnamed_addr #1 {
  %5 = alloca [4096 x float], align 16
  %6 = ashr i32 %1, 2
  %7 = ashr i32 %1, 1
  %8 = sub nsw i32 %1, %6
  call void @llvm.lifetime.start.p0(i64 16384, ptr nonnull %5) #4
  %9 = sext i32 %7 to i64
  %10 = shl nsw i64 %9, 2
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %5, ptr align 4 %0, i64 %10, i1 false)
  call void @dct_iv_slow(ptr noundef nonnull %5, i32 noundef %7)
  %11 = icmp sgt i32 %6, 0
  br i1 %11, label %.lr.ph.preheader, label %.preheader29

.lr.ph.preheader:                                 ; preds = %4
  %12 = zext nneg i32 %6 to i64
  %13 = shl nuw nsw i64 %12, 2
  %scevgep = getelementptr i8, ptr %5, i64 %13
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %0, ptr align 4 %scevgep, i64 %13, i1 false), !tbaa !5
  br label %.preheader29

.preheader29:                                     ; preds = %.lr.ph.preheader, %4
  %.0.lcssa = phi i32 [ 0, %4 ], [ %6, %.lr.ph.preheader ]
  %14 = icmp slt i32 %.0.lcssa, %8
  br i1 %14, label %.lr.ph32.preheader, label %.preheader

.lr.ph32.preheader:                               ; preds = %.preheader29
  %15 = zext nneg i32 %.0.lcssa to i64
  %16 = zext nneg i32 %8 to i64
  %17 = add nuw nsw i64 %15, 1
  %umax43 = call i64 @llvm.umax.i64(i64 %17, i64 %16)
  %18 = sub nsw i64 %umax43, %15
  %min.iters.check = icmp ult i64 %18, 20
  br i1 %min.iters.check, label %.lr.ph32.preheader63, label %vector.scevcheck

.lr.ph32.preheader63:                             ; preds = %middle.block, %vector.scevcheck, %.lr.ph32.preheader
  %indvars.iv.ph = phi i64 [ %15, %vector.scevcheck ], [ %15, %.lr.ph32.preheader ], [ %ind.end, %middle.block ]
  br label %.lr.ph32

vector.scevcheck:                                 ; preds = %.lr.ph32.preheader
  %19 = add nuw nsw i64 %15, 1
  %umax = call i64 @llvm.umax.i64(i64 %19, i64 %16)
  %20 = xor i64 %15, -1
  %21 = add nsw i64 %umax, %20
  %22 = xor i32 %6, -1
  %23 = add i32 %22, %1
  %24 = sub i32 %23, %.0.lcssa
  %25 = trunc i64 %21 to i32
  %26 = sub i32 %24, %25
  %27 = icmp sgt i32 %26, %24
  %28 = icmp ugt i64 %21, 4294967295
  %29 = or i1 %27, %28
  br i1 %29, label %.lr.ph32.preheader63, label %vector.ph

vector.ph:                                        ; preds = %vector.scevcheck
  %n.vec = and i64 %18, -8
  %ind.end = add nsw i64 %n.vec, %15
  %invariant.gep = getelementptr float, ptr %0, i64 %15
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %30 = trunc i64 %index to i32
  %31 = add i32 %.0.lcssa, %30
  %32 = xor i32 %31, -1
  %33 = add i32 %8, %32
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [4096 x float], ptr %5, i64 0, i64 %34
  %36 = getelementptr inbounds i8, ptr %35, i64 -12
  %37 = getelementptr inbounds i8, ptr %35, i64 -28
  %wide.load = load <4 x float>, ptr %36, align 4, !tbaa !5
  %reverse = shufflevector <4 x float> %wide.load, <4 x float> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
  %wide.load45 = load <4 x float>, ptr %37, align 4, !tbaa !5
  %reverse46 = shufflevector <4 x float> %wide.load45, <4 x float> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
  %38 = fneg <4 x float> %reverse
  %39 = fneg <4 x float> %reverse46
  %gep = getelementptr float, ptr %invariant.gep, i64 %index
  %40 = getelementptr inbounds i8, ptr %gep, i64 16
  store <4 x float> %38, ptr %gep, align 4, !tbaa !5
  store <4 x float> %39, ptr %40, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %41 = icmp eq i64 %index.next, %n.vec
  br i1 %41, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %18, %n.vec
  br i1 %cmp.n, label %.preheader.loopexit, label %.lr.ph32.preheader63

.preheader.loopexit:                              ; preds = %.lr.ph32, %middle.block
  %indvars.iv.next.lcssa = phi i64 [ %ind.end, %middle.block ], [ %indvars.iv.next, %.lr.ph32 ]
  %42 = trunc nuw nsw i64 %indvars.iv.next.lcssa to i32
  br label %.preheader

.preheader:                                       ; preds = %.preheader.loopexit, %.preheader29
  %.1.lcssa = phi i32 [ %.0.lcssa, %.preheader29 ], [ %42, %.preheader.loopexit ]
  %43 = icmp slt i32 %.1.lcssa, %1
  br i1 %43, label %.lr.ph35.preheader, label %._crit_edge

.lr.ph35.preheader:                               ; preds = %.preheader
  %44 = zext i32 %.1.lcssa to i64
  %45 = sext i32 %8 to i64
  %wide.trip.count42 = zext i32 %1 to i64
  %46 = sub nsw i64 %wide.trip.count42, %44
  %min.iters.check49 = icmp ult i64 %46, 8
  br i1 %min.iters.check49, label %.lr.ph35.preheader62, label %vector.ph50

.lr.ph35.preheader62:                             ; preds = %middle.block47, %.lr.ph35.preheader
  %indvars.iv39.ph = phi i64 [ %44, %.lr.ph35.preheader ], [ %ind.end53, %middle.block47 ]
  br label %.lr.ph35

vector.ph50:                                      ; preds = %.lr.ph35.preheader
  %n.vec52 = and i64 %46, -8
  %ind.end53 = add nsw i64 %n.vec52, %44
  br label %vector.body55

vector.body55:                                    ; preds = %vector.body55, %vector.ph50
  %index56 = phi i64 [ 0, %vector.ph50 ], [ %index.next60, %vector.body55 ]
  %offset.idx57 = add i64 %index56, %44
  %47 = sub nsw i64 %offset.idx57, %45
  %48 = getelementptr inbounds [4096 x float], ptr %5, i64 0, i64 %47
  %49 = getelementptr inbounds i8, ptr %48, i64 16
  %wide.load58 = load <4 x float>, ptr %48, align 4, !tbaa !5
  %wide.load59 = load <4 x float>, ptr %49, align 4, !tbaa !5
  %50 = fneg <4 x float> %wide.load58
  %51 = fneg <4 x float> %wide.load59
  %52 = getelementptr inbounds float, ptr %0, i64 %offset.idx57
  %53 = getelementptr inbounds i8, ptr %52, i64 16
  store <4 x float> %50, ptr %52, align 4, !tbaa !5
  store <4 x float> %51, ptr %53, align 4, !tbaa !5
  %index.next60 = add nuw i64 %index56, 8
  %54 = icmp eq i64 %index.next60, %n.vec52
  br i1 %54, label %middle.block47, label %vector.body55, !llvm.loop !13

middle.block47:                                   ; preds = %vector.body55
  %cmp.n61 = icmp eq i64 %46, %n.vec52
  br i1 %cmp.n61, label %._crit_edge, label %.lr.ph35.preheader62

.lr.ph32:                                         ; preds = %.lr.ph32.preheader63, %.lr.ph32
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph32 ], [ %indvars.iv.ph, %.lr.ph32.preheader63 ]
  %55 = trunc nuw nsw i64 %indvars.iv to i32
  %56 = xor i32 %55, -1
  %57 = add i32 %8, %56
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [4096 x float], ptr %5, i64 0, i64 %58
  %60 = load float, ptr %59, align 4, !tbaa !5
  %61 = fneg float %60
  %62 = getelementptr inbounds float, ptr %0, i64 %indvars.iv
  store float %61, ptr %62, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %63 = icmp ult i64 %indvars.iv.next, %16
  br i1 %63, label %.lr.ph32, label %.preheader.loopexit, !llvm.loop !14

.lr.ph35:                                         ; preds = %.lr.ph35.preheader62, %.lr.ph35
  %indvars.iv39 = phi i64 [ %indvars.iv.next40, %.lr.ph35 ], [ %indvars.iv39.ph, %.lr.ph35.preheader62 ]
  %64 = sub nsw i64 %indvars.iv39, %45
  %65 = getelementptr inbounds [4096 x float], ptr %5, i64 0, i64 %64
  %66 = load float, ptr %65, align 4, !tbaa !5
  %67 = fneg float %66
  %68 = getelementptr inbounds float, ptr %0, i64 %indvars.iv39
  store float %67, ptr %68, align 4, !tbaa !5
  %indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next40, %wide.trip.count42
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph35, !llvm.loop !15

._crit_edge:                                      ; preds = %.lr.ph35, %middle.block47, %.preheader
  call void @llvm.lifetime.end.p0(i64 16384, ptr nonnull %5) #4
  ret void
}

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !11, !12}
!14 = distinct !{!14, !10, !11}
!15 = distinct !{!15, !10, !12, !11}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalDCEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopIdiomRecognizePass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass