; LLVM IR from hadryansalles/Luz :: deps/optick (optick_miniz)

; 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.mz_stream_s = type { ptr, i32, i64, ptr, i32, i64, ptr, ptr, ptr, ptr, ptr, i32, i64, i64 }
%struct.inflate_state = type { %struct.tinfl_decompressor_tag, i32, i32, i32, i32, i32, [32768 x i8], i32 }
%struct.tinfl_decompressor_tag = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [3 x i32], i64, i64, [3 x %struct.tinfl_huff_table], [4 x i8], [457 x i8] }
%struct.tinfl_huff_table = type { [288 x i8], [1024 x i16], [576 x i16] }

; 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 dso_local ptr @miniz_def_alloc_func(ptr noundef, i64 noundef, i64 noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @miniz_def_free_func(ptr noundef, ptr noundef) #1

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

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

11:                                               ; preds = %2
  %12 = load i32, ptr %5, align 4, !tbaa !9
  %13 = icmp ne i32 %12, 15
  br i1 %13, label %14, label %19

14:                                               ; preds = %11
  %15 = load i32, ptr %5, align 4, !tbaa !9
  %16 = sub nsw i32 0, %15
  %17 = icmp ne i32 %16, 15
  br i1 %17, label %18, label %19

18:                                               ; preds = %14
  store i32 -10000, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %81

19:                                               ; preds = %14, %11
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.mz_stream_s, ptr %20, i32 0, i32 11
  store i32 0, ptr %21, align 8, !tbaa !11
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.mz_stream_s, ptr %22, i32 0, i32 12
  store i64 0, ptr %23, align 8, !tbaa !14
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.mz_stream_s, ptr %24, i32 0, i32 6
  store ptr null, ptr %25, align 8, !tbaa !15
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.mz_stream_s, ptr %26, i32 0, i32 2
  store i64 0, ptr %27, align 8, !tbaa !16
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.mz_stream_s, ptr %28, i32 0, i32 5
  store i64 0, ptr %29, align 8, !tbaa !17
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.mz_stream_s, ptr %30, i32 0, i32 13
  store i64 0, ptr %31, align 8, !tbaa !18
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.mz_stream_s, ptr %32, i32 0, i32 8
  %34 = load ptr, ptr %33, align 8, !tbaa !19
  %35 = icmp ne ptr %34, null
  br i1 %35, label %39, label %36

36:                                               ; preds = %19
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.mz_stream_s, ptr %37, i32 0, i32 8
  store ptr @miniz_def_alloc_func, ptr %38, align 8, !tbaa !19
  br label %39

39:                                               ; preds = %36, %19
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.mz_stream_s, ptr %40, i32 0, i32 9
  %42 = load ptr, ptr %41, align 8, !tbaa !20
  %43 = icmp ne ptr %42, null
  br i1 %43, label %47, label %44

44:                                               ; preds = %39
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.mz_stream_s, ptr %45, i32 0, i32 9
  store ptr @miniz_def_free_func, ptr %46, align 8, !tbaa !20
  br label %47

47:                                               ; preds = %44, %39
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.mz_stream_s, ptr %48, i32 0, i32 8
  %50 = load ptr, ptr %49, align 8, !tbaa !19
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.mz_stream_s, ptr %51, i32 0, i32 10
  %53 = load ptr, ptr %52, align 8, !tbaa !21
  %54 = call noundef ptr %50(ptr noundef %53, i64 noundef 1, i64 noundef 43792)
  store ptr %54, ptr %6, align 8, !tbaa !5
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = icmp ne ptr %55, null
  br i1 %56, label %58, label %57

57:                                               ; preds = %47
  store i32 -4, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %81

58:                                               ; preds = %47
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.mz_stream_s, ptr %60, i32 0, i32 7
  store ptr %59, ptr %61, align 8, !tbaa !22
  br label %62

62:                                               ; preds = %58
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.inflate_state, ptr %63, i32 0, i32 0
  %65 = getelementptr inbounds %struct.tinfl_decompressor_tag, ptr %64, i32 0, i32 0
  store i32 0, ptr %65, align 8, !tbaa !23
  br label %66

66:                                               ; preds = %62
  br label %67

67:                                               ; preds = %66
  %68 = load ptr, ptr %6, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.inflate_state, ptr %68, i32 0, i32 1
  store i32 0, ptr %69, align 8, !tbaa !27
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.inflate_state, ptr %70, i32 0, i32 2
  store i32 0, ptr %71, align 4, !tbaa !28
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.inflate_state, ptr %72, i32 0, i32 7
  store i32 1, ptr %73, align 4, !tbaa !29
  %74 = load ptr, ptr %6, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.inflate_state, ptr %74, i32 0, i32 3
  store i32 1, ptr %75, align 8, !tbaa !30
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.inflate_state, ptr %76, i32 0, i32 4
  store i32 0, ptr %77, align 4, !tbaa !31
  %78 = load i32, ptr %5, align 4, !tbaa !9
  %79 = load ptr, ptr %6, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.inflate_state, ptr %79, i32 0, i32 5
  store i32 %78, ptr %80, align 8, !tbaa !32
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %81

81:                                               ; preds = %67, %57, %18, %10
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %82 = load i32, ptr %3, align 4
  ret i32 %82
}

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 = { 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 88}
!12 = !{!"_ZTS11mz_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 = !{!12, !13, i64 96}
!15 = !{!12, !6, i64 48}
!16 = !{!12, !13, i64 16}
!17 = !{!12, !13, i64 40}
!18 = !{!12, !13, i64 104}
!19 = !{!12, !6, i64 64}
!20 = !{!12, !6, i64 72}
!21 = !{!12, !6, i64 80}
!22 = !{!12, !6, i64 56}
!23 = !{!24, !10, i64 0}
!24 = !{!"_ZTS13inflate_state", !25, i64 0, !10, i64 11000, !10, i64 11004, !10, i64 11008, !10, i64 11012, !10, i64 11016, !7, i64 11020, !26, i64 43788}
!25 = !{!"_ZTS22tinfl_decompressor_tag", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !7, i64 44, !13, i64 56, !13, i64 64, !7, i64 72, !7, i64 10536, !7, i64 10540}
!26 = !{!"_ZTS12tinfl_status", !7, i64 0}
!27 = !{!24, !10, i64 11000}
!28 = !{!24, !10, i64 11004}
!29 = !{!24, !26, i64 43788}
!30 = !{!24, !10, i64 11008}
!31 = !{!24, !10, i64 11012}
!32 = !{!24, !10, i64 11016}


; 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 nounwind uwtable
declare dso_local ptr @miniz_def_alloc_func(ptr noundef, i64 noundef, i64 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @miniz_def_free_func(ptr noundef, ptr noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local range(i32 -10000, 1) i32 @mz_inflateInit2(ptr noundef %0, i32 noundef %1) local_unnamed_addr #1 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %26, label %3

3:                                                ; preds = %2
  switch i32 %1, label %26 [
    i32 15, label %4
    i32 -15, label %4
  ]

4:                                                ; preds = %3, %3
  %5 = getelementptr inbounds i8, ptr %0, i64 88
  store i32 0, ptr %5, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 96
  %7 = getelementptr inbounds i8, ptr %0, i64 16
  store i64 0, ptr %7, align 8, !tbaa !12
  %8 = getelementptr inbounds i8, ptr %0, i64 40
  %9 = getelementptr inbounds i8, ptr %0, i64 64
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %8, i8 0, i64 16, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %6, i8 0, i64 16, i1 false)
  %10 = load ptr, ptr %9, align 8, !tbaa !13
  %.not31 = icmp eq ptr %10, null
  br i1 %.not31, label %11, label %12

11:                                               ; preds = %4
  store ptr @miniz_def_alloc_func, ptr %9, align 8, !tbaa !13
  br label %12

12:                                               ; preds = %11, %4
  %13 = phi ptr [ @miniz_def_alloc_func, %11 ], [ %10, %4 ]
  %14 = getelementptr inbounds i8, ptr %0, i64 72
  %15 = load ptr, ptr %14, align 8, !tbaa !14
  %.not32 = icmp eq ptr %15, null
  br i1 %.not32, label %16, label %17

16:                                               ; preds = %12
  store ptr @miniz_def_free_func, ptr %14, align 8, !tbaa !14
  br label %17

17:                                               ; preds = %16, %12
  %18 = getelementptr inbounds i8, ptr %0, i64 80
  %19 = load ptr, ptr %18, align 8, !tbaa !15
  %20 = tail call noundef ptr %13(ptr noundef %19, i64 noundef 1, i64 noundef 43792)
  %.not33 = icmp eq ptr %20, null
  br i1 %.not33, label %26, label %21

21:                                               ; preds = %17
  %22 = getelementptr inbounds i8, ptr %0, i64 56
  store ptr %20, ptr %22, align 8, !tbaa !16
  store i32 0, ptr %20, align 8, !tbaa !17
  %23 = getelementptr inbounds i8, ptr %20, i64 11000
  %24 = getelementptr inbounds i8, ptr %20, i64 43788
  store i32 1, ptr %24, align 4, !tbaa !21
  store <4 x i32> <i32 0, i32 0, i32 1, i32 0>, ptr %23, align 8, !tbaa !22
  %25 = getelementptr inbounds i8, ptr %20, i64 11016
  store i32 %1, ptr %25, align 8, !tbaa !23
  br label %26

26:                                               ; preds = %17, %3, %2, %21
  %.0 = phi i32 [ 0, %21 ], [ -2, %2 ], [ -10000, %3 ], [ -4, %17 ]
  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) #2

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 = { 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, !10, i64 88}
!6 = !{!"_ZTS11mz_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++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!6, !11, i64 16}
!13 = !{!6, !7, i64 64}
!14 = !{!6, !7, i64 72}
!15 = !{!6, !7, i64 80}
!16 = !{!6, !7, i64 56}
!17 = !{!18, !10, i64 0}
!18 = !{!"_ZTS13inflate_state", !19, i64 0, !10, i64 11000, !10, i64 11004, !10, i64 11008, !10, i64 11012, !10, i64 11016, !8, i64 11020, !20, i64 43788}
!19 = !{!"_ZTS22tinfl_decompressor_tag", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !8, i64 44, !11, i64 56, !11, i64 64, !8, i64 72, !8, i64 10536, !8, i64 10540}
!20 = !{!"_ZTS12tinfl_status", !8, i64 0}
!21 = !{!18, !20, i64 43788}
!22 = !{!10, !10, i64 0}
!23 = !{!18, !10, i64 11016}


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