; LLVM IR from JayXon/Leanify :: lib/zopflipng (zopflipng_lib)

; 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.ZopfliPNGOptions = type { i8, i8, i8, %"class.std::vector", i8, %"class.std::vector.0", i8, i32, i32, i32 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<ZopfliPNGFilterStrategy, std::allocator<ZopfliPNGFilterStrategy>>::_Vector_impl" }
%"struct.std::_Vector_base<ZopfliPNGFilterStrategy, std::allocator<ZopfliPNGFilterStrategy>>::_Vector_impl" = type { %"struct.std::_Vector_base<ZopfliPNGFilterStrategy, std::allocator<ZopfliPNGFilterStrategy>>::_Vector_impl_data" }
%"struct.std::_Vector_base<ZopfliPNGFilterStrategy, std::allocator<ZopfliPNGFilterStrategy>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.CZopfliPNGOptions = type { i32, i32, ptr, i32, i32, ptr, i32, i32, i32, i32, i32 }

; 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: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: mustprogress uwtable
define dso_local void @CZopfliPNGSetDefaults(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca %struct.ZopfliPNGOptions, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %4, i8 0, i64 56, i1 false)
  call void @llvm.lifetime.start.p0(i64 80, ptr %3) #4
  call void @_ZN16ZopfliPNGOptionsC1Ev(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %5 = getelementptr inbounds %struct.ZopfliPNGOptions, ptr %3, i32 0, i32 1
  %6 = load i8, ptr %5, align 1, !tbaa !9, !range !21, !noundef !22
  %7 = trunc i8 %6 to i1
  %8 = zext i1 %7 to i32
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.CZopfliPNGOptions, ptr %9, i32 0, i32 0
  store i32 %8, ptr %10, align 8, !tbaa !23
  %11 = getelementptr inbounds %struct.ZopfliPNGOptions, ptr %3, i32 0, i32 2
  %12 = load i8, ptr %11, align 2, !tbaa !25, !range !21, !noundef !22
  %13 = trunc i8 %12 to i1
  %14 = zext i1 %13 to i32
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.CZopfliPNGOptions, ptr %15, i32 0, i32 1
  store i32 %14, ptr %16, align 4, !tbaa !26
  %17 = getelementptr inbounds %struct.ZopfliPNGOptions, ptr %3, i32 0, i32 4
  %18 = load i8, ptr %17, align 8, !tbaa !27, !range !21, !noundef !22
  %19 = trunc i8 %18 to i1
  %20 = zext i1 %19 to i32
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.CZopfliPNGOptions, ptr %21, i32 0, i32 4
  store i32 %20, ptr %22, align 4, !tbaa !28
  %23 = getelementptr inbounds %struct.ZopfliPNGOptions, ptr %3, i32 0, i32 6
  %24 = load i8, ptr %23, align 8, !tbaa !29, !range !21, !noundef !22
  %25 = trunc i8 %24 to i1
  %26 = zext i1 %25 to i32
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.CZopfliPNGOptions, ptr %27, i32 0, i32 7
  store i32 %26, ptr %28, align 4, !tbaa !30
  %29 = getelementptr inbounds %struct.ZopfliPNGOptions, ptr %3, i32 0, i32 7
  %30 = load i32, ptr %29, align 4, !tbaa !31
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.CZopfliPNGOptions, ptr %31, i32 0, i32 8
  store i32 %30, ptr %32, align 8, !tbaa !32
  %33 = getelementptr inbounds %struct.ZopfliPNGOptions, ptr %3, i32 0, i32 8
  %34 = load i32, ptr %33, align 8, !tbaa !33
  %35 = load ptr, ptr %2, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.CZopfliPNGOptions, ptr %35, i32 0, i32 9
  store i32 %34, ptr %36, align 4, !tbaa !34
  %37 = getelementptr inbounds %struct.ZopfliPNGOptions, ptr %3, i32 0, i32 9
  %38 = load i32, ptr %37, align 4, !tbaa !35
  %39 = load ptr, ptr %2, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.CZopfliPNGOptions, ptr %39, i32 0, i32 10
  store i32 %38, ptr %40, align 8, !tbaa !36
  call void @_ZN16ZopfliPNGOptionsD2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr %3) #4
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN16ZopfliPNGOptionsD2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #3 align 2

declare void @_ZN16ZopfliPNGOptionsC1Ev(ptr)

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { inlinehint 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 1}
!10 = !{!"_ZTS16ZopfliPNGOptions", !11, i64 0, !11, i64 1, !11, i64 2, !12, i64 8, !11, i64 32, !16, i64 40, !11, i64 64, !20, i64 68, !20, i64 72, !20, i64 76}
!11 = !{!"bool", !7, i64 0}
!12 = !{!"_ZTSSt6vectorI23ZopfliPNGFilterStrategySaIS0_EE", !13, i64 0}
!13 = !{!"_ZTSSt12_Vector_baseI23ZopfliPNGFilterStrategySaIS0_EE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseI23ZopfliPNGFilterStrategySaIS0_EE12_Vector_implE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseI23ZopfliPNGFilterStrategySaIS0_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!16 = !{!"_ZTSSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE", !17, i64 0}
!17 = !{!"_ZTSSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE12_Vector_implE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!20 = !{!"int", !7, i64 0}
!21 = !{i8 0, i8 2}
!22 = !{}
!23 = !{!24, !20, i64 0}
!24 = !{!"_ZTS17CZopfliPNGOptions", !20, i64 0, !20, i64 4, !6, i64 8, !20, i64 16, !20, i64 20, !6, i64 24, !20, i64 32, !20, i64 36, !20, i64 40, !20, i64 44, !20, i64 48}
!25 = !{!10, !11, i64 2}
!26 = !{!24, !20, i64 4}
!27 = !{!10, !11, i64 32}
!28 = !{!24, !20, i64 20}
!29 = !{!10, !11, i64 64}
!30 = !{!24, !20, i64 36}
!31 = !{!10, !20, i64 68}
!32 = !{!24, !20, i64 40}
!33 = !{!10, !20, i64 72}
!34 = !{!24, !20, i64 44}
!35 = !{!10, !20, i64 76}
!36 = !{!24, !20, i64 48}


; 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.ZopfliPNGOptions = type { i8, i8, i8, %"class.std::vector", i8, %"class.std::vector.0", i8, i32, i32, i32 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<ZopfliPNGFilterStrategy, std::allocator<ZopfliPNGFilterStrategy>>::_Vector_impl" }
%"struct.std::_Vector_base<ZopfliPNGFilterStrategy, std::allocator<ZopfliPNGFilterStrategy>>::_Vector_impl" = type { %"struct.std::_Vector_base<ZopfliPNGFilterStrategy, std::allocator<ZopfliPNGFilterStrategy>>::_Vector_impl_data" }
%"struct.std::_Vector_base<ZopfliPNGFilterStrategy, std::allocator<ZopfliPNGFilterStrategy>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl_data" = type { ptr, ptr, ptr }

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @CZopfliPNGSetDefaults(ptr nocapture noundef writeonly %0) local_unnamed_addr #2 {
  %2 = alloca %struct.ZopfliPNGOptions, align 8
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(56) %0, i8 0, i64 56, i1 false)
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %2) #4
  call void @_ZN16ZopfliPNGOptionsC1Ev(ptr noundef nonnull align 8 dereferenceable(80) %2)
  %3 = getelementptr inbounds i8, ptr %2, i64 1
  %4 = load i8, ptr %3, align 1, !tbaa !5, !range !20, !noundef !21
  %5 = zext nneg i8 %4 to i32
  store i32 %5, ptr %0, align 8, !tbaa !22
  %6 = getelementptr inbounds i8, ptr %2, i64 2
  %7 = load i8, ptr %6, align 2, !tbaa !24, !range !20, !noundef !21
  %8 = zext nneg i8 %7 to i32
  %9 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 %8, ptr %9, align 4, !tbaa !25
  %10 = getelementptr inbounds i8, ptr %2, i64 32
  %11 = load i8, ptr %10, align 8, !tbaa !26, !range !20, !noundef !21
  %12 = zext nneg i8 %11 to i32
  %13 = getelementptr inbounds i8, ptr %0, i64 20
  store i32 %12, ptr %13, align 4, !tbaa !27
  %14 = getelementptr inbounds i8, ptr %2, i64 64
  %15 = load i8, ptr %14, align 8, !tbaa !28, !range !20, !noundef !21
  %16 = zext nneg i8 %15 to i32
  %17 = getelementptr inbounds i8, ptr %0, i64 36
  store i32 %16, ptr %17, align 4, !tbaa !29
  %18 = getelementptr inbounds i8, ptr %2, i64 68
  %19 = getelementptr inbounds i8, ptr %0, i64 40
  %20 = load <2 x i32>, ptr %18, align 4, !tbaa !30
  store <2 x i32> %20, ptr %19, align 8, !tbaa !30
  %21 = getelementptr inbounds i8, ptr %2, i64 76
  %22 = load i32, ptr %21, align 4, !tbaa !31
  %23 = getelementptr inbounds i8, ptr %0, i64 48
  store i32 %22, ptr %23, align 8, !tbaa !32
  call void @_ZN16ZopfliPNGOptionsD2Ev(ptr noundef nonnull align 8 dereferenceable(80) %2) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %2) #4
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN16ZopfliPNGOptionsD2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #3 align 2

declare void @_ZN16ZopfliPNGOptionsC1Ev(ptr) local_unnamed_addr

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { inlinehint 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 #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, !7, i64 1}
!6 = !{!"_ZTS16ZopfliPNGOptions", !7, i64 0, !7, i64 1, !7, i64 2, !10, i64 8, !7, i64 32, !15, i64 40, !7, i64 64, !19, i64 68, !19, i64 72, !19, i64 76}
!7 = !{!"bool", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSSt6vectorI23ZopfliPNGFilterStrategySaIS0_EE", !11, i64 0}
!11 = !{!"_ZTSSt12_Vector_baseI23ZopfliPNGFilterStrategySaIS0_EE", !12, i64 0}
!12 = !{!"_ZTSNSt12_Vector_baseI23ZopfliPNGFilterStrategySaIS0_EE12_Vector_implE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseI23ZopfliPNGFilterStrategySaIS0_EE17_Vector_impl_dataE", !14, i64 0, !14, i64 8, !14, i64 16}
!14 = !{!"any pointer", !8, i64 0}
!15 = !{!"_ZTSSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE17_Vector_impl_dataE", !14, i64 0, !14, i64 8, !14, i64 16}
!19 = !{!"int", !8, i64 0}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = !{!23, !19, i64 0}
!23 = !{!"_ZTS17CZopfliPNGOptions", !19, i64 0, !19, i64 4, !14, i64 8, !19, i64 16, !19, i64 20, !14, i64 24, !19, i64 32, !19, i64 36, !19, i64 40, !19, i64 44, !19, i64 48}
!24 = !{!6, !7, i64 2}
!25 = !{!23, !19, i64 4}
!26 = !{!6, !7, i64 32}
!27 = !{!23, !19, i64 20}
!28 = !{!6, !7, i64 64}
!29 = !{!23, !19, i64 36}
!30 = !{!19, !19, i64 0}
!31 = !{!6, !19, i64 76}
!32 = !{!23, !19, i64 48}


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