; LLVM IR from reworks-org/galaxy :: deps/sfml_deps/vorbis-src/vq (vqgen)

; 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.vqgen = type { i32, i32, i32, i32, i32, float, i32, ptr, i64, i64, ptr, ptr, ptr, i64, ptr, ptr, ptr, ptr }

; Function Attrs: nounwind uwtable
declare dso_local float @_dist(ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @_weight_null(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local void @vqgen_init(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, float noundef %4, ptr noundef %5, ptr noundef %6, i32 noundef %7) #0 {
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca float, align 4
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store i32 %1, ptr %10, align 4, !tbaa !9
  store i32 %2, ptr %11, align 4, !tbaa !9
  store i32 %3, ptr %12, align 4, !tbaa !9
  store float %4, ptr %13, align 4, !tbaa !11
  store ptr %5, ptr %14, align 8, !tbaa !5
  store ptr %6, ptr %15, align 8, !tbaa !5
  store i32 %7, ptr %16, align 4, !tbaa !9
  %17 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %17, i8 0, i64 120, i1 false)
  %18 = load i32, ptr %16, align 4, !tbaa !9
  %19 = load ptr, ptr %9, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.vqgen, ptr %19, i32 0, i32 6
  store i32 %18, ptr %20, align 8, !tbaa !13
  %21 = load i32, ptr %10, align 4, !tbaa !9
  %22 = load ptr, ptr %9, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.vqgen, ptr %22, i32 0, i32 3
  store i32 %21, ptr %23, align 4, !tbaa !16
  %24 = load i32, ptr %11, align 4, !tbaa !9
  %25 = load ptr, ptr %9, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.vqgen, ptr %25, i32 0, i32 4
  store i32 %24, ptr %26, align 8, !tbaa !17
  %27 = load float, ptr %13, align 4, !tbaa !11
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.vqgen, ptr %28, i32 0, i32 5
  store float %27, ptr %29, align 4, !tbaa !18
  %30 = load ptr, ptr %9, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.vqgen, ptr %30, i32 0, i32 9
  store i64 32768, ptr %31, align 8, !tbaa !19
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.vqgen, ptr %32, i32 0, i32 9
  %34 = load i64, ptr %33, align 8, !tbaa !19
  %35 = load ptr, ptr %9, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.vqgen, ptr %35, i32 0, i32 3
  %37 = load i32, ptr %36, align 4, !tbaa !16
  %38 = load ptr, ptr %9, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.vqgen, ptr %38, i32 0, i32 4
  %40 = load i32, ptr %39, align 8, !tbaa !17
  %41 = add nsw i32 %37, %40
  %42 = sext i32 %41 to i64
  %43 = mul nsw i64 %34, %42
  %44 = mul i64 %43, 4
  %45 = call noalias ptr @malloc(i64 noundef %44) #5
  %46 = load ptr, ptr %9, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.vqgen, ptr %46, i32 0, i32 7
  store ptr %45, ptr %47, align 8, !tbaa !20
  %48 = load i32, ptr %12, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  %50 = load ptr, ptr %9, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.vqgen, ptr %50, i32 0, i32 13
  store i64 %49, ptr %51, align 8, !tbaa !21
  %52 = load ptr, ptr %9, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.vqgen, ptr %52, i32 0, i32 13
  %54 = load i64, ptr %53, align 8, !tbaa !21
  %55 = load ptr, ptr %9, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.vqgen, ptr %55, i32 0, i32 3
  %57 = load i32, ptr %56, align 4, !tbaa !16
  %58 = sext i32 %57 to i64
  %59 = mul nsw i64 %54, %58
  %60 = mul i64 %59, 4
  %61 = call noalias ptr @malloc(i64 noundef %60) #5
  %62 = load ptr, ptr %9, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.vqgen, ptr %62, i32 0, i32 10
  store ptr %61, ptr %63, align 8, !tbaa !22
  %64 = load ptr, ptr %9, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.vqgen, ptr %64, i32 0, i32 13
  %66 = load i64, ptr %65, align 8, !tbaa !21
  %67 = mul i64 %66, 8
  %68 = call noalias ptr @malloc(i64 noundef %67) #5
  %69 = load ptr, ptr %9, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.vqgen, ptr %69, i32 0, i32 11
  store ptr %68, ptr %70, align 8, !tbaa !23
  %71 = load ptr, ptr %9, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.vqgen, ptr %71, i32 0, i32 13
  %73 = load i64, ptr %72, align 8, !tbaa !21
  %74 = call noalias ptr @calloc(i64 noundef %73, i64 noundef 4) #6
  %75 = load ptr, ptr %9, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.vqgen, ptr %75, i32 0, i32 12
  store ptr %74, ptr %76, align 8, !tbaa !24
  %77 = load ptr, ptr %9, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.vqgen, ptr %77, i32 0, i32 13
  %79 = load i64, ptr %78, align 8, !tbaa !21
  %80 = call noalias ptr @calloc(i64 noundef %79, i64 noundef 4) #6
  %81 = load ptr, ptr %9, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.vqgen, ptr %81, i32 0, i32 14
  store ptr %80, ptr %82, align 8, !tbaa !25
  %83 = load ptr, ptr %14, align 8, !tbaa !5
  %84 = icmp ne ptr %83, null
  br i1 %84, label %85, label %89

85:                                               ; preds = %8
  %86 = load ptr, ptr %14, align 8, !tbaa !5
  %87 = load ptr, ptr %9, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.vqgen, ptr %87, i32 0, i32 15
  store ptr %86, ptr %88, align 8, !tbaa !26
  br label %92

89:                                               ; preds = %8
  %90 = load ptr, ptr %9, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.vqgen, ptr %90, i32 0, i32 15
  store ptr @_dist, ptr %91, align 8, !tbaa !26
  br label %92

92:                                               ; preds = %89, %85
  %93 = load ptr, ptr %15, align 8, !tbaa !5
  %94 = icmp ne ptr %93, null
  br i1 %94, label %95, label %99

95:                                               ; preds = %92
  %96 = load ptr, ptr %15, align 8, !tbaa !5
  %97 = load ptr, ptr %9, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.vqgen, ptr %97, i32 0, i32 16
  store ptr %96, ptr %98, align 8, !tbaa !27
  br label %102

99:                                               ; preds = %92
  %100 = load ptr, ptr %9, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.vqgen, ptr %100, i32 0, i32 16
  store ptr @_weight_null, ptr %101, align 8, !tbaa !27
  br label %102

102:                                              ; preds = %99, %95
  %103 = call noalias ptr @tmpfile()
  %104 = load ptr, ptr %9, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.vqgen, ptr %104, i32 0, i32 17
  store ptr %103, ptr %105, align 8, !tbaa !28
  ret void
}

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

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

declare noalias ptr @tmpfile() #4

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 nounwind willreturn memory(argmem: write) }
attributes #2 = { nounwind allocsize(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 = { 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 allocsize(0) }
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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !10, i64 24}
!14 = !{!"vqgen", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !12, i64 20, !10, i64 24, !6, i64 32, !15, i64 40, !15, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !15, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112}
!15 = !{!"long", !7, i64 0}
!16 = !{!14, !10, i64 12}
!17 = !{!14, !10, i64 16}
!18 = !{!14, !12, i64 20}
!19 = !{!14, !15, i64 48}
!20 = !{!14, !6, i64 32}
!21 = !{!14, !15, i64 80}
!22 = !{!14, !6, i64 56}
!23 = !{!14, !6, i64 64}
!24 = !{!14, !6, i64 72}
!25 = !{!14, !6, i64 88}
!26 = !{!14, !6, i64 96}
!27 = !{!14, !6, i64 104}
!28 = !{!14, !6, i64 112}


; 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
declare dso_local float @_dist(ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @_weight_null(ptr noundef, ptr noundef) #0

; Function Attrs: nofree nounwind uwtable
define dso_local void @vqgen_init(ptr nocapture noundef writeonly %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, float noundef %4, ptr noundef %5, ptr noundef %6, i32 noundef %7) local_unnamed_addr #1 {
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(120) %0, i8 0, i64 120, i1 false)
  %9 = getelementptr inbounds i8, ptr %0, i64 24
  store i32 %7, ptr %9, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %0, i64 12
  store i32 %1, ptr %10, align 4, !tbaa !13
  %11 = getelementptr inbounds i8, ptr %0, i64 16
  store i32 %2, ptr %11, align 8, !tbaa !14
  %12 = getelementptr inbounds i8, ptr %0, i64 20
  store float %4, ptr %12, align 4, !tbaa !15
  %13 = getelementptr inbounds i8, ptr %0, i64 48
  store i64 32768, ptr %13, align 8, !tbaa !16
  %14 = add nsw i32 %2, %1
  %15 = sext i32 %14 to i64
  %16 = shl nsw i64 %15, 17
  %17 = tail call noalias ptr @malloc(i64 noundef %16) #6
  %18 = getelementptr inbounds i8, ptr %0, i64 32
  store ptr %17, ptr %18, align 8, !tbaa !17
  %19 = sext i32 %3 to i64
  %20 = getelementptr inbounds i8, ptr %0, i64 80
  store i64 %19, ptr %20, align 8, !tbaa !18
  %21 = sext i32 %1 to i64
  %22 = shl nsw i64 %21, 2
  %23 = mul i64 %22, %19
  %24 = tail call noalias ptr @malloc(i64 noundef %23) #6
  %25 = getelementptr inbounds i8, ptr %0, i64 56
  store ptr %24, ptr %25, align 8, !tbaa !19
  %26 = shl nsw i64 %19, 3
  %27 = tail call noalias ptr @malloc(i64 noundef %26) #6
  %28 = getelementptr inbounds i8, ptr %0, i64 64
  store ptr %27, ptr %28, align 8, !tbaa !20
  %29 = tail call noalias ptr @calloc(i64 noundef %19, i64 noundef 4) #7
  %30 = getelementptr inbounds i8, ptr %0, i64 72
  store ptr %29, ptr %30, align 8, !tbaa !21
  %31 = tail call noalias ptr @calloc(i64 noundef %19, i64 noundef 4) #7
  %32 = getelementptr inbounds i8, ptr %0, i64 88
  store ptr %31, ptr %32, align 8, !tbaa !22
  %33 = insertelement <2 x ptr> poison, ptr %5, i64 0
  %34 = insertelement <2 x ptr> %33, ptr %6, i64 1
  %35 = icmp eq <2 x ptr> %34, zeroinitializer
  %36 = getelementptr inbounds i8, ptr %0, i64 96
  %37 = select <2 x i1> %35, <2 x ptr> <ptr @_dist, ptr @_weight_null>, <2 x ptr> %34
  store <2 x ptr> %37, ptr %36, align 8
  %38 = tail call noalias ptr @tmpfile()
  %39 = getelementptr inbounds i8, ptr %0, i64 112
  store ptr %38, ptr %39, align 8, !tbaa !23
  ret void
}

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3

; 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 #4

; Function Attrs: nofree nounwind
declare noalias noundef ptr @tmpfile() local_unnamed_addr #5

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 = { nofree 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: write) }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) 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 #4 = { 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 #5 = { 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 #6 = { nounwind allocsize(0) }
attributes #7 = { 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, !7, i64 24}
!6 = !{!"vqgen", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !10, i64 20, !7, i64 24, !11, i64 32, !12, i64 40, !12, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !12, i64 80, !11, i64 88, !11, i64 96, !11, i64 104, !11, i64 112}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"float", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"long", !8, i64 0}
!13 = !{!6, !7, i64 12}
!14 = !{!6, !7, i64 16}
!15 = !{!6, !10, i64 20}
!16 = !{!6, !12, i64 48}
!17 = !{!6, !11, i64 32}
!18 = !{!6, !12, i64 80}
!19 = !{!6, !11, i64 56}
!20 = !{!6, !11, i64 64}
!21 = !{!6, !11, i64 72}
!22 = !{!6, !11, i64 88}
!23 = !{!6, !11, i64 112}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,MergedLoadStoreMotionPass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass