; LLVM IR from modlfo/AudioEngine :: AudioEngine/JuceLibraryCode/modules/juce_audio_formats/codecs/oggvorbis (init)

; 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.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 }
%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_internal = type { ptr, float, i32, [15 x ptr] }

; Function Attrs: nounwind uwtable
define dso_local i32 @vorbis_block_init(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %7 = load ptr, ptr %4, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %7, i8 0, i64 192, i1 false)
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.vorbis_block, ptr %9, i32 0, i32 10
  store ptr %8, ptr %10, align 8, !tbaa !9
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.vorbis_block, ptr %11, i32 0, i32 13
  store i64 0, ptr %12, align 8, !tbaa !14
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.vorbis_block, ptr %13, i32 0, i32 11
  store ptr null, ptr %14, align 8, !tbaa !15
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.vorbis_dsp_state, ptr %15, i32 0, i32 0
  %17 = load i32, ptr %16, align 8, !tbaa !16
  %18 = icmp ne i32 %17, 0
  br i1 %18, label %19, label %57

19:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %20 = call noalias ptr @calloc(i64 noundef 1, i64 noundef 136) #6
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.vorbis_block, ptr %21, i32 0, i32 20
  store ptr %20, ptr %22, align 8, !tbaa !18
  store ptr %20, ptr %6, align 8, !tbaa !5
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.vorbis_block_internal, ptr %23, i32 0, i32 1
  store float -9.999000e+03, ptr %24, align 8, !tbaa !19
  store i32 0, ptr %5, align 4, !tbaa !22
  br label %25

25:                                               ; preds = %53, %19
  %26 = load i32, ptr %5, align 4, !tbaa !22
  %27 = icmp slt i32 %26, 15
  br i1 %27, label %28, label %56

28:                                               ; preds = %25
  %29 = load i32, ptr %5, align 4, !tbaa !22
  %30 = icmp eq i32 %29, 7
  br i1 %30, label %31, label %39

31:                                               ; preds = %28
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.vorbis_block, ptr %32, i32 0, i32 1
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.vorbis_block_internal, ptr %34, i32 0, i32 3
  %36 = load i32, ptr %5, align 4, !tbaa !22
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [15 x ptr], ptr %35, i64 0, i64 %37
  store ptr %33, ptr %38, align 8, !tbaa !5
  br label %46

39:                                               ; preds = %28
  %40 = call noalias ptr @calloc(i64 noundef 1, i64 noundef 40) #6
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.vorbis_block_internal, ptr %41, i32 0, i32 3
  %43 = load i32, ptr %5, align 4, !tbaa !22
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [15 x ptr], ptr %42, i64 0, i64 %44
  store ptr %40, ptr %45, align 8, !tbaa !5
  br label %46

46:                                               ; preds = %39, %31
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.vorbis_block_internal, ptr %47, i32 0, i32 3
  %49 = load i32, ptr %5, align 4, !tbaa !22
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [15 x ptr], ptr %48, i64 0, i64 %50
  %52 = load ptr, ptr %51, align 8, !tbaa !5
  call void @oggpack_writeinit(ptr noundef %52)
  br label %53

53:                                               ; preds = %46
  %54 = load i32, ptr %5, align 4, !tbaa !22
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr %5, align 4, !tbaa !22
  br label %25, !llvm.loop !23

56:                                               ; preds = %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %57

57:                                               ; preds = %56, %2
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  ret i32 0
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #3

declare void @oggpack_writeinit(ptr noundef) #4

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

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

!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, !6, i64 104}
!10 = !{!"vorbis_block", !6, i64 0, !11, i64 8, !12, i64 48, !12, i64 56, !12, i64 64, !13, i64 72, !13, i64 76, !13, i64 80, !12, i64 88, !12, i64 96, !6, i64 104, !6, i64 112, !12, i64 120, !12, i64 128, !12, i64 136, !6, i64 144, !12, i64 152, !12, i64 160, !12, i64 168, !12, i64 176, !6, i64 184}
!11 = !{!"", !12, i64 0, !13, i64 8, !6, i64 16, !6, i64 24, !12, i64 32}
!12 = !{!"long", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!10, !12, i64 128}
!15 = !{!10, !6, i64 112}
!16 = !{!17, !13, i64 0}
!17 = !{!"vorbis_dsp_state", !13, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !13, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !12, i64 112, !12, i64 120, !12, i64 128, !6, i64 136}
!18 = !{!10, !6, i64 184}
!19 = !{!20, !21, i64 8}
!20 = !{!"vorbis_block_internal", !6, i64 0, !21, i64 8, !13, i64 12, !7, i64 16}
!21 = !{!"float", !7, i64 0}
!22 = !{!13, !13, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}


; 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: nounwind uwtable
define dso_local noundef i32 @vorbis_block_init(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(192) %1, i8 0, i64 192, i1 false)
  %3 = getelementptr inbounds i8, ptr %1, i64 104
  store ptr %0, ptr %3, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %1, i64 112
  store ptr null, ptr %4, align 8, !tbaa !13
  %5 = load i32, ptr %0, align 8, !tbaa !14
  %.not = icmp eq i32 %5, 0
  br i1 %.not, label %.loopexit, label %.loopexit.loopexit

.loopexit.loopexit:                               ; preds = %2
  %6 = tail call noalias dereferenceable_or_null(136) ptr @calloc(i64 noundef 1, i64 noundef 136) #4
  %7 = getelementptr inbounds i8, ptr %1, i64 184
  store ptr %6, ptr %7, align 8, !tbaa !16
  %8 = getelementptr inbounds i8, ptr %6, i64 8
  store float -9.999000e+03, ptr %8, align 8, !tbaa !17
  %9 = getelementptr inbounds i8, ptr %1, i64 8
  %10 = getelementptr inbounds i8, ptr %6, i64 72
  %11 = getelementptr inbounds i8, ptr %6, i64 16
  %12 = tail call noalias dereferenceable_or_null(40) ptr @calloc(i64 noundef 1, i64 noundef 40) #4
  store ptr %12, ptr %11, align 8, !tbaa !20
  tail call void @oggpack_writeinit(ptr noundef %12) #5
  %13 = tail call noalias dereferenceable_or_null(40) ptr @calloc(i64 noundef 1, i64 noundef 40) #4
  %14 = getelementptr inbounds i8, ptr %6, i64 24
  store ptr %13, ptr %14, align 8, !tbaa !20
  tail call void @oggpack_writeinit(ptr noundef %13) #5
  %15 = tail call noalias dereferenceable_or_null(40) ptr @calloc(i64 noundef 1, i64 noundef 40) #4
  %16 = getelementptr inbounds i8, ptr %6, i64 32
  store ptr %15, ptr %16, align 8, !tbaa !20
  tail call void @oggpack_writeinit(ptr noundef %15) #5
  %17 = tail call noalias dereferenceable_or_null(40) ptr @calloc(i64 noundef 1, i64 noundef 40) #4
  %18 = getelementptr inbounds i8, ptr %6, i64 40
  store ptr %17, ptr %18, align 8, !tbaa !20
  tail call void @oggpack_writeinit(ptr noundef %17) #5
  %19 = tail call noalias dereferenceable_or_null(40) ptr @calloc(i64 noundef 1, i64 noundef 40) #4
  %20 = getelementptr inbounds i8, ptr %6, i64 48
  store ptr %19, ptr %20, align 8, !tbaa !20
  tail call void @oggpack_writeinit(ptr noundef %19) #5
  %21 = tail call noalias dereferenceable_or_null(40) ptr @calloc(i64 noundef 1, i64 noundef 40) #4
  %22 = getelementptr inbounds i8, ptr %6, i64 56
  store ptr %21, ptr %22, align 8, !tbaa !20
  tail call void @oggpack_writeinit(ptr noundef %21) #5
  %23 = tail call noalias dereferenceable_or_null(40) ptr @calloc(i64 noundef 1, i64 noundef 40) #4
  %24 = getelementptr inbounds i8, ptr %6, i64 64
  store ptr %23, ptr %24, align 8, !tbaa !20
  tail call void @oggpack_writeinit(ptr noundef %23) #5
  store ptr %9, ptr %10, align 8, !tbaa !20
  tail call void @oggpack_writeinit(ptr noundef nonnull %9) #5
  %25 = tail call noalias dereferenceable_or_null(40) ptr @calloc(i64 noundef 1, i64 noundef 40) #4
  %26 = getelementptr inbounds i8, ptr %6, i64 80
  store ptr %25, ptr %26, align 8, !tbaa !20
  tail call void @oggpack_writeinit(ptr noundef %25) #5
  %27 = tail call noalias dereferenceable_or_null(40) ptr @calloc(i64 noundef 1, i64 noundef 40) #4
  %28 = getelementptr inbounds i8, ptr %6, i64 88
  store ptr %27, ptr %28, align 8, !tbaa !20
  tail call void @oggpack_writeinit(ptr noundef %27) #5
  %29 = tail call noalias dereferenceable_or_null(40) ptr @calloc(i64 noundef 1, i64 noundef 40) #4
  %30 = getelementptr inbounds i8, ptr %6, i64 96
  store ptr %29, ptr %30, align 8, !tbaa !20
  tail call void @oggpack_writeinit(ptr noundef %29) #5
  %31 = tail call noalias dereferenceable_or_null(40) ptr @calloc(i64 noundef 1, i64 noundef 40) #4
  %32 = getelementptr inbounds i8, ptr %6, i64 104
  store ptr %31, ptr %32, align 8, !tbaa !20
  tail call void @oggpack_writeinit(ptr noundef %31) #5
  %33 = tail call noalias dereferenceable_or_null(40) ptr @calloc(i64 noundef 1, i64 noundef 40) #4
  %34 = getelementptr inbounds i8, ptr %6, i64 112
  store ptr %33, ptr %34, align 8, !tbaa !20
  tail call void @oggpack_writeinit(ptr noundef %33) #5
  %35 = tail call noalias dereferenceable_or_null(40) ptr @calloc(i64 noundef 1, i64 noundef 40) #4
  %36 = getelementptr inbounds i8, ptr %6, i64 120
  store ptr %35, ptr %36, align 8, !tbaa !20
  tail call void @oggpack_writeinit(ptr noundef %35) #5
  %37 = tail call noalias dereferenceable_or_null(40) ptr @calloc(i64 noundef 1, i64 noundef 40) #4
  %38 = getelementptr inbounds i8, ptr %6, i64 128
  store ptr %37, ptr %38, align 8, !tbaa !20
  tail call void @oggpack_writeinit(ptr noundef %37) #5
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %2
  ret i32 0
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #2

declare void @oggpack_writeinit(ptr noundef) local_unnamed_addr #3

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 allocsize(0,1) }
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, !7, i64 104}
!6 = !{!"vorbis_block", !7, i64 0, !10, i64 8, !11, i64 48, !11, i64 56, !11, i64 64, !12, i64 72, !12, i64 76, !12, i64 80, !11, i64 88, !11, i64 96, !7, i64 104, !7, i64 112, !11, i64 120, !11, i64 128, !11, i64 136, !7, i64 144, !11, i64 152, !11, i64 160, !11, i64 168, !11, i64 176, !7, i64 184}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"", !11, i64 0, !12, i64 8, !7, i64 16, !7, i64 24, !11, i64 32}
!11 = !{!"long", !8, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!6, !7, i64 112}
!14 = !{!15, !12, i64 0}
!15 = !{!"vorbis_dsp_state", !12, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !12, i64 32, !12, i64 36, !12, i64 40, !12, i64 44, !12, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !11, i64 88, !11, i64 96, !11, i64 104, !11, i64 112, !11, i64 120, !11, i64 128, !7, i64 136}
!16 = !{!6, !7, i64 184}
!17 = !{!18, !19, i64 8}
!18 = !{!"vorbis_block_internal", !7, i64 0, !19, i64 8, !12, i64 12, !8, i64 16}
!19 = !{!"float", !8, i64 0}
!20 = !{!7, !7, i64 0}


; Effective O3 passes: BDCEPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass