; LLVM IR from modlfo/AudioEngine :: AudioEngine/JuceLibraryCode/modules/juce_core/zip/zlib (deflate)

; 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.config_s = type { i16, i16, i16, i16, ptr }
%struct.z_stream_s = type { ptr, i32, i64, ptr, i32, i64, ptr, ptr, ptr, ptr, ptr, i32, i64, i64 }
%struct.internal_state = type { ptr, i32, ptr, i64, ptr, i32, i32, ptr, i32, i8, i32, i32, i32, i32, ptr, i64, ptr, ptr, i32, i32, i32, i32, i32, i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [573 x %struct.ct_data_s], [61 x %struct.ct_data_s], [39 x %struct.ct_data_s], %struct.tree_desc_s, %struct.tree_desc_s, %struct.tree_desc_s, [16 x i16], [573 x i32], i32, i32, [573 x i8], ptr, i32, i32, ptr, i64, i64, i32, i32, i16, i32 }
%struct.ct_data_s = type { %union.anon, %union.anon.0 }
%union.anon = type { i16 }
%union.anon.0 = type { i16 }
%struct.tree_desc_s = type { ptr, i32, ptr }

@configuration_table = external hidden constant [10 x %struct.config_s], align 16

; 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: nounwind uwtable
define dso_local i32 @z_deflateParams(ptr noundef %0, i32 noundef %1, i32 noundef %2) #1 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #2
  store i32 0, ptr %10, align 4, !tbaa !9
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = icmp eq ptr %12, null
  br i1 %13, label %19, label %14

14:                                               ; preds = %3
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.z_stream_s, ptr %15, i32 0, i32 7
  %17 = load ptr, ptr %16, align 8, !tbaa !11
  %18 = icmp eq ptr %17, null
  br i1 %18, label %19, label %20

19:                                               ; preds = %14, %3
  store i32 -2, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %110

20:                                               ; preds = %14
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.z_stream_s, ptr %21, i32 0, i32 7
  %23 = load ptr, ptr %22, align 8, !tbaa !11
  store ptr %23, ptr %8, align 8, !tbaa !5
  %24 = load i32, ptr %6, align 4, !tbaa !9
  %25 = icmp eq i32 %24, -1
  br i1 %25, label %26, label %27

26:                                               ; preds = %20
  store i32 6, ptr %6, align 4, !tbaa !9
  br label %27

27:                                               ; preds = %26, %20
  %28 = load i32, ptr %6, align 4, !tbaa !9
  %29 = icmp slt i32 %28, 0
  br i1 %29, label %39, label %30

30:                                               ; preds = %27
  %31 = load i32, ptr %6, align 4, !tbaa !9
  %32 = icmp sgt i32 %31, 9
  br i1 %32, label %39, label %33

33:                                               ; preds = %30
  %34 = load i32, ptr %7, align 4, !tbaa !9
  %35 = icmp slt i32 %34, 0
  br i1 %35, label %39, label %36

36:                                               ; preds = %33
  %37 = load i32, ptr %7, align 4, !tbaa !9
  %38 = icmp sgt i32 %37, 4
  br i1 %38, label %39, label %40

39:                                               ; preds = %36, %33, %30, %27
  store i32 -2, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %110

40:                                               ; preds = %36
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.internal_state, ptr %41, i32 0, i32 33
  %43 = load i32, ptr %42, align 4, !tbaa !14
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [10 x %struct.config_s], ptr @configuration_table, i64 0, i64 %44
  %46 = getelementptr inbounds %struct.config_s, ptr %45, i32 0, i32 4
  %47 = load ptr, ptr %46, align 8, !tbaa !18
  store ptr %47, ptr %9, align 8, !tbaa !5
  %48 = load ptr, ptr %9, align 8, !tbaa !5
  %49 = load i32, ptr %6, align 4, !tbaa !9
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [10 x %struct.config_s], ptr @configuration_table, i64 0, i64 %50
  %52 = getelementptr inbounds %struct.config_s, ptr %51, i32 0, i32 4
  %53 = load ptr, ptr %52, align 8, !tbaa !18
  %54 = icmp ne ptr %48, %53
  br i1 %54, label %55, label %63

55:                                               ; preds = %40
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.z_stream_s, ptr %56, i32 0, i32 2
  %58 = load i64, ptr %57, align 8, !tbaa !20
  %59 = icmp ne i64 %58, 0
  br i1 %59, label %60, label %63

60:                                               ; preds = %55
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  %62 = call i32 @z_deflate(ptr noundef %61, i32 noundef 1)
  store i32 %62, ptr %10, align 4, !tbaa !9
  br label %63

63:                                               ; preds = %60, %55, %40
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.internal_state, ptr %64, i32 0, i32 33
  %66 = load i32, ptr %65, align 4, !tbaa !14
  %67 = load i32, ptr %6, align 4, !tbaa !9
  %68 = icmp ne i32 %66, %67
  br i1 %68, label %69, label %105

69:                                               ; preds = %63
  %70 = load i32, ptr %6, align 4, !tbaa !9
  %71 = load ptr, ptr %8, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.internal_state, ptr %71, i32 0, i32 33
  store i32 %70, ptr %72, align 4, !tbaa !14
  %73 = load i32, ptr %6, align 4, !tbaa !9
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [10 x %struct.config_s], ptr @configuration_table, i64 0, i64 %74
  %76 = getelementptr inbounds %struct.config_s, ptr %75, i32 0, i32 1
  %77 = load i16, ptr %76, align 2, !tbaa !21
  %78 = zext i16 %77 to i32
  %79 = load ptr, ptr %8, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.internal_state, ptr %79, i32 0, i32 32
  store i32 %78, ptr %80, align 8, !tbaa !22
  %81 = load i32, ptr %6, align 4, !tbaa !9
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [10 x %struct.config_s], ptr @configuration_table, i64 0, i64 %82
  %84 = getelementptr inbounds %struct.config_s, ptr %83, i32 0, i32 0
  %85 = load i16, ptr %84, align 16, !tbaa !23
  %86 = zext i16 %85 to i32
  %87 = load ptr, ptr %8, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.internal_state, ptr %87, i32 0, i32 35
  store i32 %86, ptr %88, align 4, !tbaa !24
  %89 = load i32, ptr %6, align 4, !tbaa !9
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [10 x %struct.config_s], ptr @configuration_table, i64 0, i64 %90
  %92 = getelementptr inbounds %struct.config_s, ptr %91, i32 0, i32 2
  %93 = load i16, ptr %92, align 4, !tbaa !25
  %94 = zext i16 %93 to i32
  %95 = load ptr, ptr %8, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.internal_state, ptr %95, i32 0, i32 36
  store i32 %94, ptr %96, align 8, !tbaa !26
  %97 = load i32, ptr %6, align 4, !tbaa !9
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [10 x %struct.config_s], ptr @configuration_table, i64 0, i64 %98
  %100 = getelementptr inbounds %struct.config_s, ptr %99, i32 0, i32 3
  %101 = load i16, ptr %100, align 2, !tbaa !27
  %102 = zext i16 %101 to i32
  %103 = load ptr, ptr %8, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.internal_state, ptr %103, i32 0, i32 31
  store i32 %102, ptr %104, align 4, !tbaa !28
  br label %105

105:                                              ; preds = %69, %63
  %106 = load i32, ptr %7, align 4, !tbaa !9
  %107 = load ptr, ptr %8, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.internal_state, ptr %107, i32 0, i32 34
  store i32 %106, ptr %108, align 8, !tbaa !29
  %109 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %109, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %110

110:                                              ; preds = %105, %39, %19
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  %111 = load i32, ptr %4, align 4
  ret i32 %111
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @z_deflate(ptr noundef, i32 noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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 = !{!"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 56}
!12 = !{!"z_stream_s", !6, i64 0, !10, i64 8, !13, i64 16, !6, i64 24, !10, i64 32, !13, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !10, i64 88, !13, i64 96, !13, i64 104}
!13 = !{!"long", !7, i64 0}
!14 = !{!15, !10, i64 180}
!15 = !{!"internal_state", !6, i64 0, !10, i64 8, !6, i64 16, !13, i64 24, !6, i64 32, !10, i64 40, !10, i64 44, !6, i64 48, !10, i64 56, !7, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !6, i64 80, !13, i64 88, !6, i64 96, !6, i64 104, !10, i64 112, !10, i64 116, !10, i64 120, !10, i64 124, !10, i64 128, !13, i64 136, !10, i64 144, !10, i64 148, !10, i64 152, !10, i64 156, !10, i64 160, !10, i64 164, !10, i64 168, !10, i64 172, !10, i64 176, !10, i64 180, !10, i64 184, !10, i64 188, !10, i64 192, !7, i64 196, !7, i64 2488, !7, i64 2732, !16, i64 2888, !16, i64 2912, !16, i64 2936, !7, i64 2960, !7, i64 2992, !10, i64 5284, !10, i64 5288, !7, i64 5292, !6, i64 5872, !10, i64 5880, !10, i64 5884, !6, i64 5888, !13, i64 5896, !13, i64 5904, !10, i64 5912, !10, i64 5916, !17, i64 5920, !10, i64 5924}
!16 = !{!"tree_desc_s", !6, i64 0, !10, i64 8, !6, i64 16}
!17 = !{!"short", !7, i64 0}
!18 = !{!19, !6, i64 8}
!19 = !{!"config_s", !17, i64 0, !17, i64 2, !17, i64 4, !17, i64 6, !6, i64 8}
!20 = !{!12, !13, i64 16}
!21 = !{!19, !17, i64 2}
!22 = !{!15, !10, i64 176}
!23 = !{!19, !17, i64 0}
!24 = !{!15, !10, i64 188}
!25 = !{!19, !17, i64 4}
!26 = !{!15, !10, i64 192}
!27 = !{!19, !17, i64 6}
!28 = !{!15, !10, i64 172}
!29 = !{!15, !10, i64 184}


; 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.config_s = type { i16, i16, i16, i16, ptr }

@configuration_table = external hidden local_unnamed_addr constant [10 x %struct.config_s], align 16

; Function Attrs: nounwind uwtable
define dso_local i32 @z_deflateParams(ptr noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = icmp eq ptr %0, null
  br i1 %4, label %47, label %5

5:                                                ; preds = %3
  %6 = getelementptr inbounds i8, ptr %0, i64 56
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = icmp eq ptr %7, null
  br i1 %8, label %47, label %9

9:                                                ; preds = %5
  %10 = icmp eq i32 %1, -1
  %spec.store.select = select i1 %10, i32 6, i32 %1
  %or.cond = icmp ugt i32 %spec.store.select, 9
  %11 = icmp ugt i32 %2, 4
  %or.cond5 = or i1 %11, %or.cond
  br i1 %or.cond5, label %47, label %12

12:                                               ; preds = %9
  %13 = getelementptr inbounds i8, ptr %7, i64 180
  %14 = load i32, ptr %13, align 4, !tbaa !12
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds [10 x %struct.config_s], ptr @configuration_table, i64 0, i64 %15, i32 4
  %17 = load ptr, ptr %16, align 8, !tbaa !16
  %18 = zext nneg i32 %spec.store.select to i64
  %19 = getelementptr inbounds [10 x %struct.config_s], ptr @configuration_table, i64 0, i64 %18
  %20 = getelementptr inbounds i8, ptr %19, i64 8
  %21 = load ptr, ptr %20, align 8, !tbaa !16
  %.not = icmp eq ptr %17, %21
  br i1 %.not, label %27, label %22

22:                                               ; preds = %12
  %23 = getelementptr inbounds i8, ptr %0, i64 16
  %24 = load i64, ptr %23, align 8, !tbaa !18
  %.not37 = icmp eq i64 %24, 0
  br i1 %.not37, label %27, label %25

25:                                               ; preds = %22
  %26 = tail call i32 @z_deflate(ptr noundef nonnull %0, i32 noundef 1)
  %.pre = load i32, ptr %13, align 4, !tbaa !12
  br label %27

27:                                               ; preds = %25, %22, %12
  %28 = phi i32 [ %.pre, %25 ], [ %14, %22 ], [ %14, %12 ]
  %.0 = phi i32 [ %26, %25 ], [ 0, %22 ], [ 0, %12 ]
  %.not38 = icmp eq i32 %28, %spec.store.select
  br i1 %.not38, label %45, label %29

29:                                               ; preds = %27
  store i32 %spec.store.select, ptr %13, align 4, !tbaa !12
  %30 = getelementptr inbounds i8, ptr %19, i64 2
  %31 = load i16, ptr %30, align 2, !tbaa !19
  %32 = zext i16 %31 to i32
  %33 = getelementptr inbounds i8, ptr %7, i64 176
  store i32 %32, ptr %33, align 8, !tbaa !20
  %34 = load i16, ptr %19, align 16, !tbaa !21
  %35 = zext i16 %34 to i32
  %36 = getelementptr inbounds i8, ptr %7, i64 188
  store i32 %35, ptr %36, align 4, !tbaa !22
  %37 = getelementptr inbounds i8, ptr %19, i64 4
  %38 = load i16, ptr %37, align 4, !tbaa !23
  %39 = zext i16 %38 to i32
  %40 = getelementptr inbounds i8, ptr %7, i64 192
  store i32 %39, ptr %40, align 8, !tbaa !24
  %41 = getelementptr inbounds i8, ptr %19, i64 6
  %42 = load i16, ptr %41, align 2, !tbaa !25
  %43 = zext i16 %42 to i32
  %44 = getelementptr inbounds i8, ptr %7, i64 172
  store i32 %43, ptr %44, align 4, !tbaa !26
  br label %45

45:                                               ; preds = %29, %27
  %46 = getelementptr inbounds i8, ptr %7, i64 184
  store i32 %2, ptr %46, align 8, !tbaa !27
  br label %47

47:                                               ; preds = %9, %3, %5, %45
  %.033 = phi i32 [ %.0, %45 ], [ -2, %5 ], [ -2, %3 ], [ -2, %9 ]
  ret i32 %.033
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @z_deflate(ptr noundef, i32 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, !7, i64 56}
!6 = !{!"z_stream_s", !7, i64 0, !10, i64 8, !11, i64 16, !7, i64 24, !10, i64 32, !11, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !10, i64 88, !11, i64 96, !11, i64 104}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!13, !10, i64 180}
!13 = !{!"internal_state", !7, i64 0, !10, i64 8, !7, i64 16, !11, i64 24, !7, i64 32, !10, i64 40, !10, i64 44, !7, i64 48, !10, i64 56, !8, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !7, i64 80, !11, i64 88, !7, i64 96, !7, i64 104, !10, i64 112, !10, i64 116, !10, i64 120, !10, i64 124, !10, i64 128, !11, i64 136, !10, i64 144, !10, i64 148, !10, i64 152, !10, i64 156, !10, i64 160, !10, i64 164, !10, i64 168, !10, i64 172, !10, i64 176, !10, i64 180, !10, i64 184, !10, i64 188, !10, i64 192, !8, i64 196, !8, i64 2488, !8, i64 2732, !14, i64 2888, !14, i64 2912, !14, i64 2936, !8, i64 2960, !8, i64 2992, !10, i64 5284, !10, i64 5288, !8, i64 5292, !7, i64 5872, !10, i64 5880, !10, i64 5884, !7, i64 5888, !11, i64 5896, !11, i64 5904, !10, i64 5912, !10, i64 5916, !15, i64 5920, !10, i64 5924}
!14 = !{!"tree_desc_s", !7, i64 0, !10, i64 8, !7, i64 16}
!15 = !{!"short", !8, i64 0}
!16 = !{!17, !7, i64 8}
!17 = !{!"config_s", !15, i64 0, !15, i64 2, !15, i64 4, !15, i64 6, !7, i64 8}
!18 = !{!6, !11, i64 16}
!19 = !{!17, !15, i64 2}
!20 = !{!13, !10, i64 176}
!21 = !{!17, !15, i64 0}
!22 = !{!13, !10, i64 188}
!23 = !{!17, !15, i64 4}
!24 = !{!13, !10, i64 192}
!25 = !{!17, !15, i64 6}
!26 = !{!13, !10, i64 172}
!27 = !{!13, !10, i64 184}


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