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

; 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.z_stream_s = type { ptr, i32, i64, ptr, i32, i64, ptr, ptr, ptr, ptr, ptr, i32, i64, i64 }
%struct.inflate_state = type { i32, i32, i32, i32, i32, i32, i64, i64, ptr, i32, i32, i32, i32, ptr, i64, i32, i32, i32, i32, ptr, ptr, i32, i32, i32, i32, i32, i32, ptr, [320 x i16], [288 x i16], [2048 x %struct.code] }
%struct.code = type { i8, i8, i16 }

; Function Attrs: nounwind uwtable
define dso_local i32 @z_inflateReset(ptr noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #2
  %6 = load ptr, ptr %3, align 8, !tbaa !5
  %7 = icmp eq ptr %6, null
  br i1 %7, label %13, label %8

8:                                                ; preds = %1
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.z_stream_s, ptr %9, i32 0, i32 7
  %11 = load ptr, ptr %10, align 8, !tbaa !9
  %12 = icmp eq ptr %11, null
  br i1 %12, label %13, label %14

13:                                               ; preds = %8, %1
  store i32 -2, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %57

14:                                               ; preds = %8
  %15 = load ptr, ptr %3, 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 !9
  store ptr %17, ptr %4, align 8, !tbaa !5
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.inflate_state, ptr %18, i32 0, i32 7
  store i64 0, ptr %19, align 8, !tbaa !13
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.z_stream_s, ptr %20, i32 0, i32 5
  store i64 0, ptr %21, align 8, !tbaa !15
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.z_stream_s, ptr %22, i32 0, i32 2
  store i64 0, ptr %23, align 8, !tbaa !16
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.z_stream_s, ptr %24, i32 0, i32 6
  store ptr null, ptr %25, align 8, !tbaa !17
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.z_stream_s, ptr %26, i32 0, i32 12
  store i64 1, ptr %27, align 8, !tbaa !18
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.inflate_state, ptr %28, i32 0, i32 0
  store i32 0, ptr %29, align 8, !tbaa !19
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.inflate_state, ptr %30, i32 0, i32 1
  store i32 0, ptr %31, align 4, !tbaa !20
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.inflate_state, ptr %32, i32 0, i32 3
  store i32 0, ptr %33, align 4, !tbaa !21
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.inflate_state, ptr %34, i32 0, i32 5
  store i32 32768, ptr %35, align 4, !tbaa !22
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.inflate_state, ptr %36, i32 0, i32 8
  store ptr null, ptr %37, align 8, !tbaa !23
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.inflate_state, ptr %38, i32 0, i32 10
  store i32 0, ptr %39, align 4, !tbaa !24
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.inflate_state, ptr %40, i32 0, i32 11
  store i32 0, ptr %41, align 8, !tbaa !25
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.inflate_state, ptr %42, i32 0, i32 12
  store i32 0, ptr %43, align 4, !tbaa !26
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.inflate_state, ptr %44, i32 0, i32 14
  store i64 0, ptr %45, align 8, !tbaa !27
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.inflate_state, ptr %46, i32 0, i32 15
  store i32 0, ptr %47, align 8, !tbaa !28
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.inflate_state, ptr %48, i32 0, i32 30
  %50 = getelementptr inbounds [2048 x %struct.code], ptr %49, i64 0, i64 0
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.inflate_state, ptr %51, i32 0, i32 27
  store ptr %50, ptr %52, align 8, !tbaa !29
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.inflate_state, ptr %53, i32 0, i32 20
  store ptr %50, ptr %54, align 8, !tbaa !30
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.inflate_state, ptr %55, i32 0, i32 19
  store ptr %50, ptr %56, align 8, !tbaa !31
  store i32 0, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %57

57:                                               ; preds = %14, %13
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #2
  %58 = load i32, ptr %2, align 4
  ret i32 %58
}

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

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

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" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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, !6, i64 56}
!10 = !{!"z_stream_s", !6, i64 0, !11, i64 8, !12, i64 16, !6, i64 24, !11, i64 32, !12, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !11, i64 88, !12, i64 96, !12, i64 104}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !12, i64 32}
!14 = !{!"inflate_state", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !12, i64 24, !12, i64 32, !6, i64 40, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !6, i64 64, !12, i64 72, !11, i64 80, !11, i64 84, !11, i64 88, !11, i64 92, !6, i64 96, !6, i64 104, !11, i64 112, !11, i64 116, !11, i64 120, !11, i64 124, !11, i64 128, !11, i64 132, !6, i64 136, !7, i64 144, !7, i64 784, !7, i64 1360}
!15 = !{!10, !12, i64 40}
!16 = !{!10, !12, i64 16}
!17 = !{!10, !6, i64 48}
!18 = !{!10, !12, i64 96}
!19 = !{!14, !11, i64 0}
!20 = !{!14, !11, i64 4}
!21 = !{!14, !11, i64 12}
!22 = !{!14, !11, i64 20}
!23 = !{!14, !6, i64 40}
!24 = !{!14, !11, i64 52}
!25 = !{!14, !11, i64 56}
!26 = !{!14, !11, i64 60}
!27 = !{!14, !12, i64 72}
!28 = !{!14, !11, i64 80}
!29 = !{!14, !6, i64 136}
!30 = !{!14, !6, i64 104}
!31 = !{!14, !6, i64 96}


; 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: mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local range(i32 -2, 1) i32 @z_inflateReset(ptr noundef %0) local_unnamed_addr #0 {
  %2 = icmp eq ptr %0, null
  br i1 %2, label %25, label %3

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

7:                                                ; preds = %3
  %8 = getelementptr inbounds i8, ptr %5, i64 32
  store i64 0, ptr %8, align 8, !tbaa !12
  %9 = getelementptr inbounds i8, ptr %0, i64 40
  %10 = getelementptr inbounds i8, ptr %0, i64 16
  store i64 0, ptr %10, align 8, !tbaa !14
  %11 = getelementptr inbounds i8, ptr %0, i64 96
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %9, i8 0, i64 16, i1 false)
  store i64 1, ptr %11, align 8, !tbaa !15
  store i32 0, ptr %5, align 8, !tbaa !16
  %12 = getelementptr inbounds i8, ptr %5, i64 4
  store i32 0, ptr %12, align 4, !tbaa !17
  %13 = getelementptr inbounds i8, ptr %5, i64 12
  store i32 0, ptr %13, align 4, !tbaa !18
  %14 = getelementptr inbounds i8, ptr %5, i64 20
  store i32 32768, ptr %14, align 4, !tbaa !19
  %15 = getelementptr inbounds i8, ptr %5, i64 40
  store ptr null, ptr %15, align 8, !tbaa !20
  %16 = getelementptr inbounds i8, ptr %5, i64 52
  store i32 0, ptr %16, align 4, !tbaa !21
  %17 = getelementptr inbounds i8, ptr %5, i64 56
  store i32 0, ptr %17, align 8, !tbaa !22
  %18 = getelementptr inbounds i8, ptr %5, i64 60
  store i32 0, ptr %18, align 4, !tbaa !23
  %19 = getelementptr inbounds i8, ptr %5, i64 72
  store i64 0, ptr %19, align 8, !tbaa !24
  %20 = getelementptr inbounds i8, ptr %5, i64 80
  store i32 0, ptr %20, align 8, !tbaa !25
  %21 = getelementptr inbounds i8, ptr %5, i64 1360
  %22 = getelementptr inbounds i8, ptr %5, i64 136
  store ptr %21, ptr %22, align 8, !tbaa !26
  %23 = getelementptr inbounds i8, ptr %5, i64 104
  store ptr %21, ptr %23, align 8, !tbaa !27
  %24 = getelementptr inbounds i8, ptr %5, i64 96
  store ptr %21, ptr %24, align 8, !tbaa !28
  br label %25

25:                                               ; preds = %1, %3, %7
  %.0 = phi i32 [ 0, %7 ], [ -2, %3 ], [ -2, %1 ]
  ret i32 %.0
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: readwrite, inaccessiblemem: none) 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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, !11, i64 32}
!13 = !{!"inflate_state", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !11, i64 24, !11, i64 32, !7, i64 40, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !7, i64 64, !11, i64 72, !10, i64 80, !10, i64 84, !10, i64 88, !10, i64 92, !7, i64 96, !7, i64 104, !10, i64 112, !10, i64 116, !10, i64 120, !10, i64 124, !10, i64 128, !10, i64 132, !7, i64 136, !8, i64 144, !8, i64 784, !8, i64 1360}
!14 = !{!6, !11, i64 16}
!15 = !{!6, !11, i64 96}
!16 = !{!13, !10, i64 0}
!17 = !{!13, !10, i64 4}
!18 = !{!13, !10, i64 12}
!19 = !{!13, !10, i64 20}
!20 = !{!13, !7, i64 40}
!21 = !{!13, !10, i64 52}
!22 = !{!13, !10, i64 56}
!23 = !{!13, !10, i64 60}
!24 = !{!13, !11, i64 72}
!25 = !{!13, !10, i64 80}
!26 = !{!13, !7, i64 136}
!27 = !{!13, !7, i64 104}
!28 = !{!13, !7, i64 96}


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