; 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] }>

@stdout = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@_ZL13num_expected_ = external hidden global i32, align 4
@.str.2 = external hidden unnamed_addr constant [39 x i8], align 1
@_ZL27expected_metadata_sequence_ = external hidden global [9 x ptr], align 16
@.str.3 = external hidden unnamed_addr constant [24 x i8], align 1

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

declare i32 @fflush(ptr noundef) #0

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

9:                                                ; preds = %2
  br label %40

10:                                               ; preds = %2
  %11 = getelementptr inbounds %class.DecoderCommon, ptr %5, i32 0, i32 2
  %12 = load i32, ptr %11, align 4, !tbaa !16
  %13 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %12)
  %14 = load ptr, ptr @stdout, align 8, !tbaa !5
  %15 = call i32 @fflush(ptr noundef %14)
  %16 = getelementptr inbounds %class.DecoderCommon, ptr %5, i32 0, i32 2
  %17 = load i32, ptr %16, align 4, !tbaa !16
  %18 = load i32, ptr @_ZL13num_expected_, align 4, !tbaa !17
  %19 = icmp uge i32 %17, %18
  br i1 %19, label %20, label %23

20:                                               ; preds = %10
  %21 = call noundef zeroext i1 @_ZL4die_PKc(ptr noundef @.str.2)
  %22 = getelementptr inbounds %class.DecoderCommon, ptr %5, i32 0, i32 4
  store i8 1, ptr %22, align 1, !tbaa !9
  br label %36

23:                                               ; preds = %10
  %24 = getelementptr inbounds %class.DecoderCommon, ptr %5, i32 0, i32 2
  %25 = load i32, ptr %24, align 4, !tbaa !16
  %26 = zext i32 %25 to i64
  %27 = getelementptr inbounds [9 x ptr], ptr @_ZL27expected_metadata_sequence_, i64 0, i64 %26
  %28 = load ptr, ptr %27, align 8, !tbaa !5
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = call i32 @FLAC__metadata_object_is_equal(ptr noundef %28, ptr noundef %29)
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %35, label %32

32:                                               ; preds = %23
  %33 = call noundef zeroext i1 @_ZL4die_PKc(ptr noundef @.str.3)
  %34 = getelementptr inbounds %class.DecoderCommon, ptr %5, i32 0, i32 4
  store i8 1, ptr %34, align 1, !tbaa !9
  br label %35

35:                                               ; preds = %32, %23
  br label %36

36:                                               ; preds = %35, %20
  %37 = getelementptr inbounds %class.DecoderCommon, ptr %5, i32 0, i32 2
  %38 = load i32, ptr %37, align 4, !tbaa !16
  %39 = add i32 %38, 1
  store i32 %39, ptr %37, align 4, !tbaa !16
  br label %40

40:                                               ; preds = %36, %9
  ret void
}

; Function Attrs: mustprogress uwtable
declare hidden noundef zeroext i1 @_ZL4die_PKc(ptr noundef) #1

declare i32 @FLAC__metadata_object_is_equal(ptr noundef, ptr noundef) #0

attributes #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 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++ 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 = !{!10, !12, i64 12}
!17 = !{!12, !12, 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"

@stdout = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@_ZL13num_expected_ = external hidden local_unnamed_addr global i32, align 4
@.str.2 = external hidden unnamed_addr constant [39 x i8], align 1
@_ZL27expected_metadata_sequence_ = external hidden local_unnamed_addr global [9 x ptr], align 16
@.str.3 = external hidden unnamed_addr constant [24 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN13DecoderCommon25common_metadata_callback_EPK20FLAC__StreamMetadata(ptr nocapture noundef nonnull align 8 dereferenceable(18) %0, ptr noundef %1) local_unnamed_addr #1 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 %23, label %6

6:                                                ; preds = %2
  %7 = getelementptr inbounds i8, ptr %0, i64 12
  %8 = load i32, ptr %7, align 4, !tbaa !14
  %9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %8)
  %10 = load ptr, ptr @stdout, align 8, !tbaa !15
  %11 = tail call i32 @fflush(ptr noundef %10)
  %12 = load i32, ptr %7, align 4, !tbaa !14
  %13 = load i32, ptr @_ZL13num_expected_, align 4, !tbaa !17
  %.not = icmp ult i32 %12, %13
  br i1 %.not, label %14, label %.sink.split

14:                                               ; preds = %6
  %15 = zext i32 %12 to i64
  %16 = getelementptr inbounds [9 x ptr], ptr @_ZL27expected_metadata_sequence_, i64 0, i64 %15
  %17 = load ptr, ptr %16, align 8, !tbaa !15
  %18 = tail call i32 @FLAC__metadata_object_is_equal(ptr noundef %17, ptr noundef %1)
  %.not2 = icmp eq i32 %18, 0
  br i1 %.not2, label %.sink.split, label %20

.sink.split:                                      ; preds = %14, %6
  %.str.3.sink = phi ptr [ @.str.2, %6 ], [ @.str.3, %14 ]
  %19 = tail call noundef zeroext i1 @_ZL4die_PKc(ptr noundef nonnull %.str.3.sink)
  store i8 1, ptr %3, align 1, !tbaa !5
  br label %20

20:                                               ; preds = %.sink.split, %14
  %21 = load i32, ptr %7, align 4, !tbaa !14
  %22 = add i32 %21, 1
  store i32 %22, ptr %7, align 4, !tbaa !14
  br label %23

23:                                               ; preds = %2, %20
  ret void
}

; Function Attrs: mustprogress uwtable
declare hidden noundef zeroext i1 @_ZL4die_PKc(ptr noundef) local_unnamed_addr #1

declare i32 @FLAC__metadata_object_is_equal(ptr noundef, ptr noundef) local_unnamed_addr #2

attributes #0 = { 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 #1 = { 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 #2 = { "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 = !{!6, !10, i64 12}
!15 = !{!16, !16, i64 0}
!16 = !{!"any pointer", !8, i64 0}
!17 = !{!10, !10, i64 0}


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