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

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

@FLAC_API_SUPPORTS_OGG_FLAC = external global i32, align 4

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z13test_decodersv() #2 {
  %1 = alloca i1, align 1
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %4

4:                                                ; preds = %40, %0
  br label %5

5:                                                ; preds = %4
  call void @_ZL21init_metadata_blocks_v()
  %6 = load i32, ptr %2, align 4, !tbaa !5
  %7 = call noundef zeroext i1 @_ZL14generate_file_i(i32 noundef %6)
  br i1 %7, label %9, label %8

8:                                                ; preds = %5
  store i1 false, ptr %1, align 1
  store i32 1, ptr %3, align 4
  br label %42

9:                                                ; preds = %5
  %10 = load i32, ptr %2, align 4, !tbaa !5
  %11 = icmp ne i32 %10, 0
  %12 = call noundef zeroext i1 @_ZL19test_stream_decoder5Layerb(i32 noundef 0, i1 noundef zeroext %11)
  br i1 %12, label %14, label %13

13:                                               ; preds = %9
  store i1 false, ptr %1, align 1
  store i32 1, ptr %3, align 4
  br label %42

14:                                               ; preds = %9
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = icmp ne i32 %15, 0
  %17 = call noundef zeroext i1 @_ZL19test_stream_decoder5Layerb(i32 noundef 1, i1 noundef zeroext %16)
  br i1 %17, label %19, label %18

18:                                               ; preds = %14
  store i1 false, ptr %1, align 1
  store i32 1, ptr %3, align 4
  br label %42

19:                                               ; preds = %14
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = icmp ne i32 %20, 0
  %22 = call noundef zeroext i1 @_ZL19test_stream_decoder5Layerb(i32 noundef 2, i1 noundef zeroext %21)
  br i1 %22, label %24, label %23

23:                                               ; preds = %19
  store i1 false, ptr %1, align 1
  store i32 1, ptr %3, align 4
  br label %42

24:                                               ; preds = %19
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = icmp ne i32 %25, 0
  %27 = call noundef zeroext i1 @_ZL19test_stream_decoder5Layerb(i32 noundef 3, i1 noundef zeroext %26)
  br i1 %27, label %29, label %28

28:                                               ; preds = %24
  store i1 false, ptr %1, align 1
  store i32 1, ptr %3, align 4
  br label %42

29:                                               ; preds = %24
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = icmp ne i32 %30, 0
  %32 = call noundef ptr @_ZL12flacfilenameb(i1 noundef zeroext %31)
  %33 = call i32 @grabbag__file_remove_file(ptr noundef %32)
  call void @_ZL21free_metadata_blocks_v()
  %34 = load i32, ptr @FLAC_API_SUPPORTS_OGG_FLAC, align 4, !tbaa !5
  %35 = icmp ne i32 %34, 0
  br i1 %35, label %36, label %39

36:                                               ; preds = %29
  %37 = load i32, ptr %2, align 4, !tbaa !5
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %39, label %40

39:                                               ; preds = %36, %29
  br label %41

40:                                               ; preds = %36
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %4, !llvm.loop !9

41:                                               ; preds = %39
  store i1 true, ptr %1, align 1
  store i32 1, ptr %3, align 4
  br label %42

42:                                               ; preds = %41, %28, %23, %18, %13, %8
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  %43 = load i1, ptr %1, align 1
  ret i1 %43
}

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL21init_metadata_blocks_v() #2

; Function Attrs: mustprogress uwtable
declare hidden noundef zeroext i1 @_ZL14generate_file_i(i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden noundef zeroext i1 @_ZL19test_stream_decoder5Layerb(i32 noundef, i1 noundef zeroext) #2

declare i32 @grabbag__file_remove_file(ptr noundef) #3

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL21free_metadata_blocks_v() #2

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

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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

@FLAC_API_SUPPORTS_OGG_FLAC = external local_unnamed_addr global i32, align 4

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef ptr @_ZL12flacfilenameb(i1 noundef zeroext) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z13test_decodersv() local_unnamed_addr #1 {
.peel.begin:
  tail call void @_ZL21init_metadata_blocks_v()
  %0 = tail call noundef zeroext i1 @_ZL14generate_file_i(i32 noundef 0)
  br i1 %0, label %1, label %.loopexit

1:                                                ; preds = %.peel.begin
  %2 = tail call noundef zeroext i1 @_ZL19test_stream_decoder5Layerb(i32 noundef 0, i1 noundef zeroext false)
  br i1 %2, label %3, label %.loopexit

3:                                                ; preds = %1
  %4 = tail call noundef zeroext i1 @_ZL19test_stream_decoder5Layerb(i32 noundef 1, i1 noundef zeroext false)
  br i1 %4, label %5, label %.loopexit

5:                                                ; preds = %3
  %6 = tail call noundef zeroext i1 @_ZL19test_stream_decoder5Layerb(i32 noundef 2, i1 noundef zeroext false)
  br i1 %6, label %7, label %.loopexit

7:                                                ; preds = %5
  %8 = tail call noundef zeroext i1 @_ZL19test_stream_decoder5Layerb(i32 noundef 3, i1 noundef zeroext false)
  br i1 %8, label %9, label %.loopexit

9:                                                ; preds = %7
  %10 = tail call noundef ptr @_ZL12flacfilenameb(i1 noundef zeroext false)
  %11 = tail call i32 @grabbag__file_remove_file(ptr noundef %10)
  tail call void @_ZL21free_metadata_blocks_v()
  %12 = load i32, ptr @FLAC_API_SUPPORTS_OGG_FLAC, align 4, !tbaa !5
  %13 = icmp eq i32 %12, 0
  br i1 %13, label %.loopexit, label %.peel.next

.peel.next:                                       ; preds = %9
  tail call void @_ZL21init_metadata_blocks_v()
  %14 = tail call noundef zeroext i1 @_ZL14generate_file_i(i32 noundef 1)
  br i1 %14, label %15, label %.loopexit

15:                                               ; preds = %.peel.next
  %16 = tail call noundef zeroext i1 @_ZL19test_stream_decoder5Layerb(i32 noundef 0, i1 noundef zeroext true)
  br i1 %16, label %17, label %.loopexit

17:                                               ; preds = %15
  %18 = tail call noundef zeroext i1 @_ZL19test_stream_decoder5Layerb(i32 noundef 1, i1 noundef zeroext true)
  br i1 %18, label %19, label %.loopexit

19:                                               ; preds = %17
  %20 = tail call noundef zeroext i1 @_ZL19test_stream_decoder5Layerb(i32 noundef 2, i1 noundef zeroext true)
  br i1 %20, label %21, label %.loopexit

21:                                               ; preds = %19
  %22 = tail call noundef zeroext i1 @_ZL19test_stream_decoder5Layerb(i32 noundef 3, i1 noundef zeroext true)
  br i1 %22, label %23, label %.loopexit

23:                                               ; preds = %21
  %24 = tail call noundef ptr @_ZL12flacfilenameb(i1 noundef zeroext true)
  %25 = tail call i32 @grabbag__file_remove_file(ptr noundef %24)
  tail call void @_ZL21free_metadata_blocks_v()
  br label %.loopexit

.loopexit:                                        ; preds = %21, %19, %17, %15, %.peel.next, %23, %9, %7, %5, %3, %1, %.peel.begin
  %.08 = phi i1 [ false, %.peel.begin ], [ false, %1 ], [ false, %3 ], [ false, %5 ], [ false, %7 ], [ true, %9 ], [ true, %23 ], [ false, %21 ], [ false, %19 ], [ false, %17 ], [ false, %15 ], [ false, %.peel.next ]
  ret i1 %.08
}

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL21init_metadata_blocks_v() local_unnamed_addr #1

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

; Function Attrs: mustprogress uwtable
declare hidden noundef zeroext i1 @_ZL19test_stream_decoder5Layerb(i32 noundef, i1 noundef zeroext) local_unnamed_addr #1

declare i32 @grabbag__file_remove_file(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL21free_metadata_blocks_v() local_unnamed_addr #1

attributes #0 = { mustprogress 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 = { 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, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopFullUnrollPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass