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

%struct.stb_vorbis = type { i32, i32, i32, i32, i32, ptr, i32, i32, ptr, ptr, ptr, i32, i8, i32, %struct.ProbedPage, %struct.ProbedPage, %struct.stb_vorbis_alloc, i32, i32, i32, i32, [2 x i32], i32, i32, i32, ptr, i32, [64 x i16], ptr, i32, [64 x i16], ptr, i32, ptr, i32, [64 x %struct.Mode], i32, [16 x ptr], [16 x ptr], [16 x ptr], i32, [16 x ptr], i32, i32, [2 x ptr], [2 x ptr], [2 x ptr], [2 x ptr], [2 x ptr], i32, i32, i32, [255 x i8], i8, i8, i8, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [4 x %struct.CRCscan], i32, i32 }
%struct.ProbedPage = type { i32, i32, i32, i32, i32 }
%struct.stb_vorbis_alloc = type { ptr, i32 }
%struct.Mode = type { i8, i8, i16, i16 }
%struct.CRCscan = type { i32, i32, i32, i32, i32 }

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

; Function Attrs: nounwind uwtable
define dso_local void @stb_vorbis_seek_start(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds %struct.stb_vorbis, ptr %3, i32 0, i32 12
  %5 = load i8, ptr %4, align 4, !tbaa !9
  %6 = icmp ne i8 %5, 0
  br i1 %6, label %7, label %10

7:                                                ; preds = %1
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = call i32 @error(ptr noundef %8, i32 noundef 2)
  br label %23

10:                                               ; preds = %1
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.stb_vorbis, ptr %12, i32 0, i32 13
  %14 = load i32, ptr %13, align 8, !tbaa !14
  %15 = call i32 @set_file_offset(ptr noundef %11, i32 noundef %14)
  %16 = load ptr, ptr %2, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.stb_vorbis, ptr %16, i32 0, i32 40
  store i32 0, ptr %17, align 8, !tbaa !15
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.stb_vorbis, ptr %18, i32 0, i32 55
  store i8 1, ptr %19, align 1, !tbaa !16
  %20 = load ptr, ptr %2, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.stb_vorbis, ptr %20, i32 0, i32 56
  store i32 -1, ptr %21, align 8, !tbaa !17
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  call void @vorbis_pump_first_frame(ptr noundef %22)
  br label %23

23:                                               ; preds = %10, %7
  ret void
}

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

; Function Attrs: nounwind uwtable
declare hidden void @vorbis_pump_first_frame(ptr noundef) #0

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

!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, !7, i64 68}
!10 = !{!"stb_vorbis", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !6, i64 24, !11, i64 32, !11, i64 36, !6, i64 40, !6, i64 48, !6, i64 56, !11, i64 64, !7, i64 68, !11, i64 72, !12, i64 76, !12, i64 96, !13, i64 120, !11, i64 136, !11, i64 140, !11, i64 144, !11, i64 148, !7, i64 152, !11, i64 160, !11, i64 164, !11, i64 168, !6, i64 176, !11, i64 184, !7, i64 188, !6, i64 320, !11, i64 328, !7, i64 332, !6, i64 464, !11, i64 472, !6, i64 480, !11, i64 488, !7, i64 492, !11, i64 876, !7, i64 880, !7, i64 1008, !7, i64 1136, !11, i64 1264, !7, i64 1272, !11, i64 1400, !11, i64 1404, !7, i64 1408, !7, i64 1424, !7, i64 1440, !7, i64 1456, !7, i64 1472, !11, i64 1488, !11, i64 1492, !11, i64 1496, !7, i64 1500, !7, i64 1755, !7, i64 1756, !7, i64 1757, !11, i64 1760, !11, i64 1764, !11, i64 1768, !11, i64 1772, !11, i64 1776, !11, i64 1780, !11, i64 1784, !11, i64 1788, !11, i64 1792, !11, i64 1796, !11, i64 1800, !7, i64 1804, !11, i64 1884, !11, i64 1888}
!11 = !{!"int", !7, i64 0}
!12 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16}
!13 = !{!"", !6, i64 0, !11, i64 8}
!14 = !{!10, !11, i64 72}
!15 = !{!10, !11, i64 1264}
!16 = !{!10, !7, i64 1757}
!17 = !{!10, !11, i64 1760}


; 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 hidden i32 @error(ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @stb_vorbis_seek_start(ptr noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 68
  %3 = load i8, ptr %2, align 4, !tbaa !5
  %.not = icmp eq i8 %3, 0
  br i1 %.not, label %6, label %4

4:                                                ; preds = %1
  %5 = tail call i32 @error(ptr noundef nonnull %0, i32 noundef 2)
  br label %13

6:                                                ; preds = %1
  %7 = getelementptr inbounds i8, ptr %0, i64 72
  %8 = load i32, ptr %7, align 8, !tbaa !13
  %9 = tail call i32 @set_file_offset(ptr noundef nonnull %0, i32 noundef %8)
  %10 = getelementptr inbounds i8, ptr %0, i64 1264
  store i32 0, ptr %10, align 8, !tbaa !14
  %11 = getelementptr inbounds i8, ptr %0, i64 1757
  store i8 1, ptr %11, align 1, !tbaa !15
  %12 = getelementptr inbounds i8, ptr %0, i64 1760
  store i32 -1, ptr %12, align 8, !tbaa !16
  tail call void @vorbis_pump_first_frame(ptr noundef nonnull %0)
  br label %13

13:                                               ; preds = %6, %4
  ret void
}

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

; Function Attrs: nounwind uwtable
declare hidden void @vorbis_pump_first_frame(ptr noundef) local_unnamed_addr #0

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

!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, !8, i64 68}
!6 = !{!"stb_vorbis", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !10, i64 24, !7, i64 32, !7, i64 36, !10, i64 40, !10, i64 48, !10, i64 56, !7, i64 64, !8, i64 68, !7, i64 72, !11, i64 76, !11, i64 96, !12, i64 120, !7, i64 136, !7, i64 140, !7, i64 144, !7, i64 148, !8, i64 152, !7, i64 160, !7, i64 164, !7, i64 168, !10, i64 176, !7, i64 184, !8, i64 188, !10, i64 320, !7, i64 328, !8, i64 332, !10, i64 464, !7, i64 472, !10, i64 480, !7, i64 488, !8, i64 492, !7, i64 876, !8, i64 880, !8, i64 1008, !8, i64 1136, !7, i64 1264, !8, i64 1272, !7, i64 1400, !7, i64 1404, !8, i64 1408, !8, i64 1424, !8, i64 1440, !8, i64 1456, !8, i64 1472, !7, i64 1488, !7, i64 1492, !7, i64 1496, !8, i64 1500, !8, i64 1755, !8, i64 1756, !8, i64 1757, !7, i64 1760, !7, i64 1764, !7, i64 1768, !7, i64 1772, !7, i64 1776, !7, i64 1780, !7, i64 1784, !7, i64 1788, !7, i64 1792, !7, i64 1796, !7, i64 1800, !8, i64 1804, !7, i64 1884, !7, i64 1888}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16}
!12 = !{!"", !10, i64 0, !7, i64 8}
!13 = !{!6, !7, i64 72}
!14 = !{!6, !7, i64 1264}
!15 = !{!6, !8, i64 1757}
!16 = !{!6, !7, i64 1760}


; Effective O3 passes: CorrelatedValuePropagationPass,GlobalOptPass,InstCombinePass,SROAPass,TailCallElimPass