; LLVM IR from reworks-org/galaxy :: deps/sfml_deps/flac-src/src/test_libFLAC++ (decoders)

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

%class.DecoderCommon = type <{ ptr, i32, i32, i8, i8, [6 x i8] }>
%struct.FLAC__Frame = type { %struct.FLAC__FrameHeader, [8 x %struct.FLAC__Subframe], %struct.FLAC__FrameFooter }
%struct.FLAC__FrameHeader = type { i32, i32, i32, i32, i32, i32, %union.anon, i8 }
%union.anon = type { i64 }
%struct.FLAC__Subframe = type { i32, %union.anon.0, i32 }
%union.anon.0 = type { %struct.FLAC__Subframe_LPC }
%struct.FLAC__Subframe_LPC = type { %struct.FLAC__EntropyCodingMethod, i32, i32, i32, [32 x i32], [32 x i64], ptr }
%struct.FLAC__EntropyCodingMethod = type { i32, %union.anon.1 }
%union.anon.1 = type { %struct.FLAC__EntropyCodingMethod_PartitionedRice }
%struct.FLAC__EntropyCodingMethod_PartitionedRice = type { i32, ptr }
%struct.FLAC__FrameFooter = type { i16 }

@.str = external hidden unnamed_addr constant [12 x i8], align 1
@stdout = external global ptr, align 8

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN13DecoderCommon22common_write_callback_EPK11FLAC__Frame(ptr noundef nonnull align 8 dereferenceable(18) %0, ptr noundef %1) #0 align 2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %6 = load ptr, ptr %4, align 8
  %7 = getelementptr inbounds %class.DecoderCommon, ptr %6, i32 0, i32 4
  %8 = load i8, ptr %7, align 1, !tbaa !9, !range !14, !noundef !15
  %9 = trunc i8 %8 to i1
  br i1 %9, label %10, label %11

10:                                               ; preds = %2
  store i32 1, ptr %3, align 4
  br label %40

11:                                               ; preds = %2
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.FLAC__Frame, ptr %12, i32 0, i32 0
  %14 = getelementptr inbounds %struct.FLAC__FrameHeader, ptr %13, i32 0, i32 5
  %15 = load i32, ptr %14, align 4, !tbaa !16
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %17, label %23

17:                                               ; preds = %11
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.FLAC__Frame, ptr %18, i32 0, i32 0
  %20 = getelementptr inbounds %struct.FLAC__FrameHeader, ptr %19, i32 0, i32 6
  %21 = load i32, ptr %20, align 8, !tbaa !23
  %22 = icmp eq i32 %21, 0
  br i1 %22, label %35, label %23

23:                                               ; preds = %17, %11
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.FLAC__Frame, ptr %24, i32 0, i32 0
  %26 = getelementptr inbounds %struct.FLAC__FrameHeader, ptr %25, i32 0, i32 5
  %27 = load i32, ptr %26, align 4, !tbaa !16
  %28 = icmp eq i32 %27, 1
  br i1 %28, label %29, label %39

29:                                               ; preds = %23
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.FLAC__Frame, ptr %30, i32 0, i32 0
  %32 = getelementptr inbounds %struct.FLAC__FrameHeader, ptr %31, i32 0, i32 6
  %33 = load i64, ptr %32, align 8, !tbaa !23
  %34 = icmp eq i64 %33, 0
  br i1 %34, label %35, label %39

35:                                               ; preds = %29, %17
  %36 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %37 = load ptr, ptr @stdout, align 8, !tbaa !5
  %38 = call i32 @fflush(ptr noundef %37)
  br label %39

39:                                               ; preds = %35, %29, %23
  store i32 0, ptr %3, align 4
  br label %40

40:                                               ; preds = %39, %10
  %41 = load i32, ptr %3, align 4
  ret i32 %41
}

declare i32 @printf(ptr noundef, ...) #1

declare i32 @fflush(ptr noundef) #1

attributes #0 = { mustprogress 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 = { "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++ TBAA"}
!9 = !{!10, !13, i64 17}
!10 = !{!"_ZTS13DecoderCommon", !11, i64 8, !12, i64 12, !13, i64 16, !13, i64 17}
!11 = !{!"_ZTS5Layer", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = !{!17, !20, i64 20}
!17 = !{!"_ZTS11FLAC__Frame", !18, i64 0, !7, i64 40, !21, i64 3624}
!18 = !{!"_ZTS17FLAC__FrameHeader", !12, i64 0, !12, i64 4, !12, i64 8, !19, i64 12, !12, i64 16, !20, i64 20, !7, i64 24, !7, i64 32}
!19 = !{!"_ZTS23FLAC__ChannelAssignment", !7, i64 0}
!20 = !{!"_ZTS21FLAC__FrameNumberType", !7, i64 0}
!21 = !{!"_ZTS17FLAC__FrameFooter", !22, i64 0}
!22 = !{!"short", !7, i64 0}
!23 = !{!7, !7, i64 0}


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

@.str = external hidden unnamed_addr constant [12 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8

; Function Attrs: mustprogress nofree nounwind uwtable
define dso_local noundef range(i32 0, 2) i32 @_ZN13DecoderCommon22common_write_callback_EPK11FLAC__Frame(ptr nocapture noundef nonnull readonly align 8 dereferenceable(18) %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 17
  %4 = load i8, ptr %3, align 1, !tbaa !5, !range !12, !noundef !13
  %5 = trunc nuw i8 %4 to i1
  br i1 %5, label %.thread, label %6

6:                                                ; preds = %2
  %7 = getelementptr inbounds i8, ptr %1, i64 20
  %8 = load i32, ptr %7, align 4, !tbaa !14
  switch i32 %8, label %.thread [
    i32 0, label %9
    i32 1, label %13
  ]

9:                                                ; preds = %6
  %10 = getelementptr inbounds i8, ptr %1, i64 24
  %11 = load i32, ptr %10, align 8, !tbaa !21
  %12 = icmp eq i32 %11, 0
  br i1 %12, label %17, label %.thread

13:                                               ; preds = %6
  %14 = getelementptr inbounds i8, ptr %1, i64 24
  %15 = load i64, ptr %14, align 8, !tbaa !21
  %16 = icmp eq i64 %15, 0
  br i1 %16, label %17, label %.thread

17:                                               ; preds = %13, %9
  %18 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %19 = load ptr, ptr @stdout, align 8, !tbaa !22
  %20 = tail call i32 @fflush(ptr noundef %19)
  br label %.thread

.thread:                                          ; preds = %6, %9, %13, %17, %2
  %.0 = phi i32 [ 1, %2 ], [ 0, %17 ], [ 0, %13 ], [ 0, %9 ], [ 0, %6 ]
  ret i32 %.0
}

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #1

attributes #0 = { mustprogress 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 #1 = { 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" }

!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, !11, i64 17}
!6 = !{!"_ZTS13DecoderCommon", !7, i64 8, !10, i64 12, !11, i64 16, !11, i64 17}
!7 = !{!"_ZTS5Layer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{i8 0, i8 2}
!13 = !{}
!14 = !{!15, !18, i64 20}
!15 = !{!"_ZTS11FLAC__Frame", !16, i64 0, !8, i64 40, !19, i64 3624}
!16 = !{!"_ZTS17FLAC__FrameHeader", !10, i64 0, !10, i64 4, !10, i64 8, !17, i64 12, !10, i64 16, !18, i64 20, !8, i64 24, !8, i64 32}
!17 = !{!"_ZTS23FLAC__ChannelAssignment", !8, i64 0}
!18 = !{!"_ZTS21FLAC__FrameNumberType", !8, i64 0}
!19 = !{!"_ZTS17FLAC__FrameFooter", !20, i64 0}
!20 = !{!"short", !8, i64 0}
!21 = !{!8, !8, i64 0}
!22 = !{!23, !23, i64 0}
!23 = !{!"any pointer", !8, i64 0}


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