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

; 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.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.private_state = type { ptr, [2 x i32], [2 x ptr], [2 x %struct.drft_lookup], i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, %struct.bitrate_manager_state, i64 }
%struct.drft_lookup = type { i32, ptr, ptr }
%struct.bitrate_manager_state = type { i32, i64, i64, i64, i64, i64, i64, double, ptr, i32 }
%struct.ogg_packet = type { ptr, i64, i64, i64, i64, i64 }

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

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

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

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

; Function Attrs: nounwind
declare void @free(ptr noundef) #3

declare void @oggpack_writeinit(ptr noundef) #4

; Function Attrs: nounwind uwtable
declare hidden i32 @_vorbis_pack_comment(ptr noundef, ptr noundef) #5

declare i64 @oggpack_bytes(ptr noundef) #4

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

; Function Attrs: nounwind uwtable
define dso_local i32 @vorbis_analysis_headerout(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #5 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca %struct.oggpack_buffer, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 -130, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %17 = load ptr, ptr %7, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.vorbis_dsp_state, ptr %17, i32 0, i32 1
  %19 = load ptr, ptr %18, align 8, !tbaa !11
  store ptr %19, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 40, ptr %14) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.vorbis_dsp_state, ptr %20, i32 0, i32 19
  %22 = load ptr, ptr %21, align 8, !tbaa !14
  store ptr %22, ptr %15, align 8, !tbaa !5
  %23 = load ptr, ptr %15, align 8, !tbaa !5
  %24 = icmp ne ptr %23, null
  br i1 %24, label %26, label %25

25:                                               ; preds = %5
  store i32 -129, ptr %12, align 4, !tbaa !9
  br label %147

26:                                               ; preds = %5
  call void @oggpack_writeinit(ptr noundef %14)
  %27 = load ptr, ptr %13, align 8, !tbaa !5
  %28 = call i32 @_vorbis_pack_info(ptr noundef %14, ptr noundef %27)
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %30, label %31

30:                                               ; preds = %26
  br label %147

31:                                               ; preds = %26
  %32 = load ptr, ptr %15, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.private_state, ptr %32, i32 0, i32 9
  %34 = load ptr, ptr %33, align 8, !tbaa !15
  %35 = icmp ne ptr %34, null
  br i1 %35, label %36, label %40

36:                                               ; preds = %31
  %37 = load ptr, ptr %15, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.private_state, ptr %37, i32 0, i32 9
  %39 = load ptr, ptr %38, align 8, !tbaa !15
  call void @free(ptr noundef %39) #7
  br label %40

40:                                               ; preds = %36, %31
  %41 = call i64 @oggpack_bytes(ptr noundef %14)
  %42 = call noalias ptr @malloc(i64 noundef %41) #8
  %43 = load ptr, ptr %15, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.private_state, ptr %43, i32 0, i32 9
  store ptr %42, ptr %44, align 8, !tbaa !15
  %45 = load ptr, ptr %15, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.private_state, ptr %45, i32 0, i32 9
  %47 = load ptr, ptr %46, align 8, !tbaa !15
  %48 = getelementptr inbounds %struct.oggpack_buffer, ptr %14, i32 0, i32 2
  %49 = load ptr, ptr %48, align 8, !tbaa !19
  %50 = call i64 @oggpack_bytes(ptr noundef %14)
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %47, ptr align 1 %49, i64 %50, i1 false)
  %51 = load ptr, ptr %15, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.private_state, ptr %51, i32 0, i32 9
  %53 = load ptr, ptr %52, align 8, !tbaa !15
  %54 = load ptr, ptr %9, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.ogg_packet, ptr %54, i32 0, i32 0
  store ptr %53, ptr %55, align 8, !tbaa !21
  %56 = call i64 @oggpack_bytes(ptr noundef %14)
  %57 = load ptr, ptr %9, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.ogg_packet, ptr %57, i32 0, i32 1
  store i64 %56, ptr %58, align 8, !tbaa !23
  %59 = load ptr, ptr %9, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.ogg_packet, ptr %59, i32 0, i32 2
  store i64 1, ptr %60, align 8, !tbaa !24
  %61 = load ptr, ptr %9, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.ogg_packet, ptr %61, i32 0, i32 3
  store i64 0, ptr %62, align 8, !tbaa !25
  %63 = load ptr, ptr %9, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.ogg_packet, ptr %63, i32 0, i32 4
  store i64 0, ptr %64, align 8, !tbaa !26
  %65 = load ptr, ptr %9, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.ogg_packet, ptr %65, i32 0, i32 5
  store i64 0, ptr %66, align 8, !tbaa !27
  call void @oggpack_reset(ptr noundef %14)
  %67 = load ptr, ptr %8, align 8, !tbaa !5
  %68 = call i32 @_vorbis_pack_comment(ptr noundef %14, ptr noundef %67)
  %69 = icmp ne i32 %68, 0
  br i1 %69, label %70, label %71

70:                                               ; preds = %40
  br label %147

71:                                               ; preds = %40
  %72 = load ptr, ptr %15, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.private_state, ptr %72, i32 0, i32 10
  %74 = load ptr, ptr %73, align 8, !tbaa !28
  %75 = icmp ne ptr %74, null
  br i1 %75, label %76, label %80

76:                                               ; preds = %71
  %77 = load ptr, ptr %15, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.private_state, ptr %77, i32 0, i32 10
  %79 = load ptr, ptr %78, align 8, !tbaa !28
  call void @free(ptr noundef %79) #7
  br label %80

80:                                               ; preds = %76, %71
  %81 = call i64 @oggpack_bytes(ptr noundef %14)
  %82 = call noalias ptr @malloc(i64 noundef %81) #8
  %83 = load ptr, ptr %15, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.private_state, ptr %83, i32 0, i32 10
  store ptr %82, ptr %84, align 8, !tbaa !28
  %85 = load ptr, ptr %15, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.private_state, ptr %85, i32 0, i32 10
  %87 = load ptr, ptr %86, align 8, !tbaa !28
  %88 = getelementptr inbounds %struct.oggpack_buffer, ptr %14, i32 0, i32 2
  %89 = load ptr, ptr %88, align 8, !tbaa !19
  %90 = call i64 @oggpack_bytes(ptr noundef %14)
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %87, ptr align 1 %89, i64 %90, i1 false)
  %91 = load ptr, ptr %15, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.private_state, ptr %91, i32 0, i32 10
  %93 = load ptr, ptr %92, align 8, !tbaa !28
  %94 = load ptr, ptr %10, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.ogg_packet, ptr %94, i32 0, i32 0
  store ptr %93, ptr %95, align 8, !tbaa !21
  %96 = call i64 @oggpack_bytes(ptr noundef %14)
  %97 = load ptr, ptr %10, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.ogg_packet, ptr %97, i32 0, i32 1
  store i64 %96, ptr %98, align 8, !tbaa !23
  %99 = load ptr, ptr %10, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.ogg_packet, ptr %99, i32 0, i32 2
  store i64 0, ptr %100, align 8, !tbaa !24
  %101 = load ptr, ptr %10, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.ogg_packet, ptr %101, i32 0, i32 3
  store i64 0, ptr %102, align 8, !tbaa !25
  %103 = load ptr, ptr %10, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.ogg_packet, ptr %103, i32 0, i32 4
  store i64 0, ptr %104, align 8, !tbaa !26
  %105 = load ptr, ptr %10, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.ogg_packet, ptr %105, i32 0, i32 5
  store i64 1, ptr %106, align 8, !tbaa !27
  call void @oggpack_reset(ptr noundef %14)
  %107 = load ptr, ptr %13, align 8, !tbaa !5
  %108 = call i32 @_vorbis_pack_books(ptr noundef %14, ptr noundef %107)
  %109 = icmp ne i32 %108, 0
  br i1 %109, label %110, label %111

110:                                              ; preds = %80
  br label %147

111:                                              ; preds = %80
  %112 = load ptr, ptr %15, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.private_state, ptr %112, i32 0, i32 11
  %114 = load ptr, ptr %113, align 8, !tbaa !29
  %115 = icmp ne ptr %114, null
  br i1 %115, label %116, label %120

116:                                              ; preds = %111
  %117 = load ptr, ptr %15, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.private_state, ptr %117, i32 0, i32 11
  %119 = load ptr, ptr %118, align 8, !tbaa !29
  call void @free(ptr noundef %119) #7
  br label %120

120:                                              ; preds = %116, %111
  %121 = call i64 @oggpack_bytes(ptr noundef %14)
  %122 = call noalias ptr @malloc(i64 noundef %121) #8
  %123 = load ptr, ptr %15, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.private_state, ptr %123, i32 0, i32 11
  store ptr %122, ptr %124, align 8, !tbaa !29
  %125 = load ptr, ptr %15, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.private_state, ptr %125, i32 0, i32 11
  %127 = load ptr, ptr %126, align 8, !tbaa !29
  %128 = getelementptr inbounds %struct.oggpack_buffer, ptr %14, i32 0, i32 2
  %129 = load ptr, ptr %128, align 8, !tbaa !19
  %130 = call i64 @oggpack_bytes(ptr noundef %14)
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %127, ptr align 1 %129, i64 %130, i1 false)
  %131 = load ptr, ptr %15, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.private_state, ptr %131, i32 0, i32 11
  %133 = load ptr, ptr %132, align 8, !tbaa !29
  %134 = load ptr, ptr %11, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.ogg_packet, ptr %134, i32 0, i32 0
  store ptr %133, ptr %135, align 8, !tbaa !21
  %136 = call i64 @oggpack_bytes(ptr noundef %14)
  %137 = load ptr, ptr %11, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.ogg_packet, ptr %137, i32 0, i32 1
  store i64 %136, ptr %138, align 8, !tbaa !23
  %139 = load ptr, ptr %11, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.ogg_packet, ptr %139, i32 0, i32 2
  store i64 0, ptr %140, align 8, !tbaa !24
  %141 = load ptr, ptr %11, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.ogg_packet, ptr %141, i32 0, i32 3
  store i64 0, ptr %142, align 8, !tbaa !25
  %143 = load ptr, ptr %11, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.ogg_packet, ptr %143, i32 0, i32 4
  store i64 0, ptr %144, align 8, !tbaa !26
  %145 = load ptr, ptr %11, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.ogg_packet, ptr %145, i32 0, i32 5
  store i64 2, ptr %146, align 8, !tbaa !27
  call void @oggpack_writeclear(ptr noundef %14)
  store i32 0, ptr %6, align 4
  store i32 1, ptr %16, align 4
  br label %189

147:                                              ; preds = %110, %70, %30, %25
  %148 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %148, i8 0, i64 48, i1 false)
  %149 = load ptr, ptr %10, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %149, i8 0, i64 48, i1 false)
  %150 = load ptr, ptr %11, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %150, i8 0, i64 48, i1 false)
  %151 = load ptr, ptr %15, align 8, !tbaa !5
  %152 = icmp ne ptr %151, null
  br i1 %152, label %153, label %187

153:                                              ; preds = %147
  call void @oggpack_writeclear(ptr noundef %14)
  %154 = load ptr, ptr %15, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.private_state, ptr %154, i32 0, i32 9
  %156 = load ptr, ptr %155, align 8, !tbaa !15
  %157 = icmp ne ptr %156, null
  br i1 %157, label %158, label %162

158:                                              ; preds = %153
  %159 = load ptr, ptr %15, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.private_state, ptr %159, i32 0, i32 9
  %161 = load ptr, ptr %160, align 8, !tbaa !15
  call void @free(ptr noundef %161) #7
  br label %162

162:                                              ; preds = %158, %153
  %163 = load ptr, ptr %15, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.private_state, ptr %163, i32 0, i32 10
  %165 = load ptr, ptr %164, align 8, !tbaa !28
  %166 = icmp ne ptr %165, null
  br i1 %166, label %167, label %171

167:                                              ; preds = %162
  %168 = load ptr, ptr %15, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.private_state, ptr %168, i32 0, i32 10
  %170 = load ptr, ptr %169, align 8, !tbaa !28
  call void @free(ptr noundef %170) #7
  br label %171

171:                                              ; preds = %167, %162
  %172 = load ptr, ptr %15, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.private_state, ptr %172, i32 0, i32 11
  %174 = load ptr, ptr %173, align 8, !tbaa !29
  %175 = icmp ne ptr %174, null
  br i1 %175, label %176, label %180

176:                                              ; preds = %171
  %177 = load ptr, ptr %15, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.private_state, ptr %177, i32 0, i32 11
  %179 = load ptr, ptr %178, align 8, !tbaa !29
  call void @free(ptr noundef %179) #7
  br label %180

180:                                              ; preds = %176, %171
  %181 = load ptr, ptr %15, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.private_state, ptr %181, i32 0, i32 9
  store ptr null, ptr %182, align 8, !tbaa !15
  %183 = load ptr, ptr %15, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.private_state, ptr %183, i32 0, i32 10
  store ptr null, ptr %184, align 8, !tbaa !28
  %185 = load ptr, ptr %15, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct.private_state, ptr %185, i32 0, i32 11
  store ptr null, ptr %186, align 8, !tbaa !29
  br label %187

187:                                              ; preds = %180, %147
  %188 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %188, ptr %6, align 4
  store i32 1, ptr %16, align 4
  br label %189

189:                                              ; preds = %187, %120
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 40, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  %190 = load i32, ptr %6, align 4
  ret i32 %190
}

; Function Attrs: nounwind uwtable
declare hidden i32 @_vorbis_pack_info(ptr noundef, ptr noundef) #5

declare void @oggpack_reset(ptr noundef) #4

; Function Attrs: nounwind uwtable
declare hidden i32 @_vorbis_pack_books(ptr noundef, ptr noundef) #5

declare void @oggpack_writeclear(ptr noundef) #4

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 = { "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 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 #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }

!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, !6, i64 8}
!12 = !{!"vorbis_dsp_state", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !13, i64 56, !13, i64 64, !13, i64 72, !13, i64 80, !13, i64 88, !13, i64 96, !13, i64 104, !13, i64 112, !13, i64 120, !13, i64 128, !6, i64 136}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !6, i64 136}
!15 = !{!16, !6, i64 120}
!16 = !{!"private_state", !6, i64 0, !7, i64 8, !7, i64 16, !7, i64 32, !10, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !17, i64 144, !13, i64 224}
!17 = !{!"bitrate_manager_state", !10, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32, !13, i64 40, !13, i64 48, !18, i64 56, !6, i64 64, !10, i64 72}
!18 = !{!"double", !7, i64 0}
!19 = !{!20, !6, i64 16}
!20 = !{!"", !13, i64 0, !10, i64 8, !6, i64 16, !6, i64 24, !13, i64 32}
!21 = !{!22, !6, i64 0}
!22 = !{!"", !6, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32, !13, i64 40}
!23 = !{!22, !13, i64 8}
!24 = !{!22, !13, i64 16}
!25 = !{!22, !13, i64 24}
!26 = !{!22, !13, i64 32}
!27 = !{!22, !13, i64 40}
!28 = !{!16, !6, i64 128}
!29 = !{!16, !6, i64 136}


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

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

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

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

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

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #3

declare void @oggpack_writeinit(ptr noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
declare hidden i32 @_vorbis_pack_comment(ptr noundef, ptr noundef) local_unnamed_addr #5

declare i64 @oggpack_bytes(ptr noundef) local_unnamed_addr #4

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 -130, 1) i32 @vorbis_analysis_headerout(ptr nocapture noundef readonly %0, ptr noundef %1, ptr nocapture noundef writeonly %2, ptr nocapture noundef writeonly %3, ptr nocapture noundef writeonly %4) local_unnamed_addr #5 {
  %6 = alloca %struct.oggpack_buffer, align 8
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  %8 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %6) #7
  %9 = getelementptr inbounds i8, ptr %0, i64 136
  %10 = load ptr, ptr %9, align 8, !tbaa !12
  %.not = icmp eq ptr %10, null
  br i1 %.not, label %58, label %11

11:                                               ; preds = %5
  call void @oggpack_writeinit(ptr noundef nonnull %6) #7
  %12 = call i32 @_vorbis_pack_info(ptr noundef nonnull %6, ptr noundef %8)
  %.not61 = icmp eq i32 %12, 0
  br i1 %.not61, label %13, label %59

13:                                               ; preds = %11
  %14 = getelementptr inbounds i8, ptr %10, i64 120
  %15 = load ptr, ptr %14, align 8, !tbaa !13
  %.not62 = icmp eq ptr %15, null
  br i1 %.not62, label %17, label %16

16:                                               ; preds = %13
  call void @free(ptr noundef nonnull %15) #7
  br label %17

17:                                               ; preds = %16, %13
  %18 = call i64 @oggpack_bytes(ptr noundef nonnull %6) #7
  %19 = call noalias ptr @malloc(i64 noundef %18) #8
  store ptr %19, ptr %14, align 8, !tbaa !13
  %20 = getelementptr inbounds i8, ptr %6, i64 16
  %21 = load ptr, ptr %20, align 8, !tbaa !17
  %22 = call i64 @oggpack_bytes(ptr noundef nonnull %6) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %19, ptr align 1 %21, i64 %22, i1 false)
  %23 = load ptr, ptr %14, align 8, !tbaa !13
  store ptr %23, ptr %2, align 8, !tbaa !19
  %24 = call i64 @oggpack_bytes(ptr noundef nonnull %6) #7
  %25 = getelementptr inbounds i8, ptr %2, i64 8
  store i64 %24, ptr %25, align 8, !tbaa !21
  %26 = getelementptr inbounds i8, ptr %2, i64 16
  store i64 1, ptr %26, align 8, !tbaa !22
  %27 = getelementptr inbounds i8, ptr %2, i64 24
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %27, i8 0, i64 24, i1 false)
  call void @oggpack_reset(ptr noundef nonnull %6) #7
  %28 = call i32 @_vorbis_pack_comment(ptr noundef nonnull %6, ptr noundef %1)
  %.not63 = icmp eq i32 %28, 0
  br i1 %.not63, label %29, label %59

29:                                               ; preds = %17
  %30 = getelementptr inbounds i8, ptr %10, i64 128
  %31 = load ptr, ptr %30, align 8, !tbaa !23
  %.not64 = icmp eq ptr %31, null
  br i1 %.not64, label %33, label %32

32:                                               ; preds = %29
  call void @free(ptr noundef nonnull %31) #7
  br label %33

33:                                               ; preds = %32, %29
  %34 = call i64 @oggpack_bytes(ptr noundef nonnull %6) #7
  %35 = call noalias ptr @malloc(i64 noundef %34) #8
  store ptr %35, ptr %30, align 8, !tbaa !23
  %36 = load ptr, ptr %20, align 8, !tbaa !17
  %37 = call i64 @oggpack_bytes(ptr noundef nonnull %6) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %35, ptr align 1 %36, i64 %37, i1 false)
  %38 = load ptr, ptr %30, align 8, !tbaa !23
  store ptr %38, ptr %3, align 8, !tbaa !19
  %39 = call i64 @oggpack_bytes(ptr noundef nonnull %6) #7
  %40 = getelementptr inbounds i8, ptr %3, i64 8
  store i64 %39, ptr %40, align 8, !tbaa !21
  %41 = getelementptr inbounds i8, ptr %3, i64 16
  %42 = getelementptr inbounds i8, ptr %3, i64 40
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %41, i8 0, i64 24, i1 false)
  store i64 1, ptr %42, align 8, !tbaa !24
  call void @oggpack_reset(ptr noundef nonnull %6) #7
  %43 = call i32 @_vorbis_pack_books(ptr noundef nonnull %6, ptr noundef %8)
  %.not65 = icmp eq i32 %43, 0
  br i1 %.not65, label %44, label %59

44:                                               ; preds = %33
  %45 = getelementptr inbounds i8, ptr %10, i64 136
  %46 = load ptr, ptr %45, align 8, !tbaa !25
  %.not66 = icmp eq ptr %46, null
  br i1 %.not66, label %48, label %47

47:                                               ; preds = %44
  call void @free(ptr noundef nonnull %46) #7
  br label %48

48:                                               ; preds = %47, %44
  %49 = call i64 @oggpack_bytes(ptr noundef nonnull %6) #7
  %50 = call noalias ptr @malloc(i64 noundef %49) #8
  store ptr %50, ptr %45, align 8, !tbaa !25
  %51 = load ptr, ptr %20, align 8, !tbaa !17
  %52 = call i64 @oggpack_bytes(ptr noundef nonnull %6) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %50, ptr align 1 %51, i64 %52, i1 false)
  %53 = load ptr, ptr %45, align 8, !tbaa !25
  store ptr %53, ptr %4, align 8, !tbaa !19
  %54 = call i64 @oggpack_bytes(ptr noundef nonnull %6) #7
  %55 = getelementptr inbounds i8, ptr %4, i64 8
  store i64 %54, ptr %55, align 8, !tbaa !21
  %56 = getelementptr inbounds i8, ptr %4, i64 16
  %57 = getelementptr inbounds i8, ptr %4, i64 40
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %56, i8 0, i64 24, i1 false)
  store i64 2, ptr %57, align 8, !tbaa !24
  call void @oggpack_writeclear(ptr noundef nonnull %6) #7
  br label %72

58:                                               ; preds = %5
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %2, i8 0, i64 48, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %3, i8 0, i64 48, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %4, i8 0, i64 48, i1 false)
  br label %72

59:                                               ; preds = %33, %17, %11
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %2, i8 0, i64 48, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %3, i8 0, i64 48, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %4, i8 0, i64 48, i1 false)
  call void @oggpack_writeclear(ptr noundef nonnull %6) #7
  %60 = getelementptr inbounds i8, ptr %10, i64 120
  %61 = load ptr, ptr %60, align 8, !tbaa !13
  %.not67 = icmp eq ptr %61, null
  br i1 %.not67, label %63, label %62

62:                                               ; preds = %59
  call void @free(ptr noundef nonnull %61) #7
  br label %63

63:                                               ; preds = %62, %59
  %64 = getelementptr inbounds i8, ptr %10, i64 128
  %65 = load ptr, ptr %64, align 8, !tbaa !23
  %.not68 = icmp eq ptr %65, null
  br i1 %.not68, label %67, label %66

66:                                               ; preds = %63
  call void @free(ptr noundef nonnull %65) #7
  br label %67

67:                                               ; preds = %66, %63
  %68 = getelementptr inbounds i8, ptr %10, i64 136
  %69 = load ptr, ptr %68, align 8, !tbaa !25
  %.not69 = icmp eq ptr %69, null
  br i1 %.not69, label %71, label %70

70:                                               ; preds = %67
  call void @free(ptr noundef nonnull %69) #7
  br label %71

71:                                               ; preds = %70, %67
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %60, i8 0, i64 24, i1 false)
  br label %72

72:                                               ; preds = %58, %71, %48
  %.0 = phi i32 [ 0, %48 ], [ -130, %71 ], [ -129, %58 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %6) #7
  ret i32 %.0
}

; Function Attrs: nounwind uwtable
declare hidden i32 @_vorbis_pack_info(ptr noundef, ptr noundef) local_unnamed_addr #5

declare void @oggpack_reset(ptr noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
declare hidden i32 @_vorbis_pack_books(ptr noundef, ptr noundef) local_unnamed_addr #5

declare void @oggpack_writeclear(ptr noundef) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, 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 = { "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 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 #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }

!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, !10, i64 8}
!6 = !{!"vorbis_dsp_state", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !7, i64 32, !7, i64 36, !7, i64 40, !7, i64 44, !7, 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, !10, i64 136}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!6, !10, i64 136}
!13 = !{!14, !10, i64 120}
!14 = !{!"private_state", !10, i64 0, !8, i64 8, !8, i64 16, !8, i64 32, !7, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !15, i64 144, !11, i64 224}
!15 = !{!"bitrate_manager_state", !7, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !16, i64 56, !10, i64 64, !7, i64 72}
!16 = !{!"double", !8, i64 0}
!17 = !{!18, !10, i64 16}
!18 = !{!"", !11, i64 0, !7, i64 8, !10, i64 16, !10, i64 24, !11, i64 32}
!19 = !{!20, !10, i64 0}
!20 = !{!"", !10, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40}
!21 = !{!20, !11, i64 8}
!22 = !{!20, !11, i64 16}
!23 = !{!14, !10, i64 128}
!24 = !{!20, !11, i64 40}
!25 = !{!14, !10, i64 136}


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