; LLVM IR from fwip/fastqz :: libzpaq.ll (ZN7libzpaq5ZPAQLC2Ev)

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

%"class.libzpaq::ZPAQL" = type { ptr, ptr, %"class.libzpaq::Array.0", i32, i32, i32, [4 x i8], %"class.libzpaq::Array.0", %"class.libzpaq::Array", %"class.libzpaq::Array", %"class.libzpaq::Array.4", i32, i32, i32, i32, i32, i32, i32, i32, ptr }
%"class.libzpaq::Array.0" = type <{ ptr, i64, i32, [4 x i8] }>
%"class.libzpaq::Array" = type <{ ptr, i64, i32, [4 x i8] }>
%"class.libzpaq::Array.4" = type <{ ptr, i64, i32, [4 x i8] }>

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7libzpaq5ZPAQL5clearEv(ptr noundef nonnull align 8 dereferenceable(192)) #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7libzpaq5ZPAQLC2Ev(ptr noundef nonnull align 8 dereferenceable(192) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  %6 = getelementptr inbounds %"class.libzpaq::ZPAQL", ptr %5, i32 0, i32 2
  call void @_ZN7libzpaq5ArrayIhEC2Emi(ptr noundef nonnull align 8 dereferenceable(20) %6, i64 noundef 0, i32 noundef 0)
  %7 = getelementptr inbounds %"class.libzpaq::ZPAQL", ptr %5, i32 0, i32 7
  invoke void @_ZN7libzpaq5ArrayIhEC2Emi(ptr noundef nonnull align 8 dereferenceable(20) %7, i64 noundef 0, i32 noundef 0)
          to label %8 unwind label %23

8:                                                ; preds = %1
  %9 = getelementptr inbounds %"class.libzpaq::ZPAQL", ptr %5, i32 0, i32 8
  invoke void @_ZN7libzpaq5ArrayIjEC2Emi(ptr noundef nonnull align 8 dereferenceable(20) %9, i64 noundef 0, i32 noundef 0)
          to label %10 unwind label %27

10:                                               ; preds = %8
  %11 = getelementptr inbounds %"class.libzpaq::ZPAQL", ptr %5, i32 0, i32 9
  invoke void @_ZN7libzpaq5ArrayIjEC2Emi(ptr noundef nonnull align 8 dereferenceable(20) %11, i64 noundef 0, i32 noundef 0)
          to label %12 unwind label %31

12:                                               ; preds = %10
  %13 = getelementptr inbounds %"class.libzpaq::ZPAQL", ptr %5, i32 0, i32 10
  invoke void @_ZN7libzpaq5ArrayIcEC2Emi(ptr noundef nonnull align 8 dereferenceable(20) %13, i64 noundef 0, i32 noundef 0)
          to label %14 unwind label %35

14:                                               ; preds = %12
  %15 = getelementptr inbounds %"class.libzpaq::ZPAQL", ptr %5, i32 0, i32 0
  store ptr null, ptr %15, align 8, !tbaa !9
  %16 = getelementptr inbounds %"class.libzpaq::ZPAQL", ptr %5, i32 0, i32 1
  store ptr null, ptr %16, align 8, !tbaa !16
  %17 = getelementptr inbounds %"class.libzpaq::ZPAQL", ptr %5, i32 0, i32 19
  store ptr null, ptr %17, align 8, !tbaa !17
  %18 = getelementptr inbounds %"class.libzpaq::ZPAQL", ptr %5, i32 0, i32 18
  store i32 0, ptr %18, align 4, !tbaa !18
  invoke void @_ZN7libzpaq5ZPAQL5clearEv(ptr noundef nonnull align 8 dereferenceable(192) %5)
          to label %19 unwind label %39

19:                                               ; preds = %14
  %20 = getelementptr inbounds %"class.libzpaq::ZPAQL", ptr %5, i32 0, i32 10
  invoke void @_ZN7libzpaq5ArrayIcE6resizeEmi(ptr noundef nonnull align 8 dereferenceable(20) %20, i64 noundef 16384, i32 noundef 0)
          to label %21 unwind label %39

21:                                               ; preds = %19
  %22 = getelementptr inbounds %"class.libzpaq::ZPAQL", ptr %5, i32 0, i32 11
  store i32 0, ptr %22, align 8, !tbaa !19
  ret void

23:                                               ; preds = %1
  %24 = landingpad { ptr, i32 }
          cleanup
  %25 = extractvalue { ptr, i32 } %24, 0
  store ptr %25, ptr %3, align 8
  %26 = extractvalue { ptr, i32 } %24, 1
  store i32 %26, ptr %4, align 4
  br label %46

27:                                               ; preds = %8
  %28 = landingpad { ptr, i32 }
          cleanup
  %29 = extractvalue { ptr, i32 } %28, 0
  store ptr %29, ptr %3, align 8
  %30 = extractvalue { ptr, i32 } %28, 1
  store i32 %30, ptr %4, align 4
  br label %45

31:                                               ; preds = %10
  %32 = landingpad { ptr, i32 }
          cleanup
  %33 = extractvalue { ptr, i32 } %32, 0
  store ptr %33, ptr %3, align 8
  %34 = extractvalue { ptr, i32 } %32, 1
  store i32 %34, ptr %4, align 4
  br label %44

35:                                               ; preds = %12
  %36 = landingpad { ptr, i32 }
          cleanup
  %37 = extractvalue { ptr, i32 } %36, 0
  store ptr %37, ptr %3, align 8
  %38 = extractvalue { ptr, i32 } %36, 1
  store i32 %38, ptr %4, align 4
  br label %43

39:                                               ; preds = %19, %14
  %40 = landingpad { ptr, i32 }
          cleanup
  %41 = extractvalue { ptr, i32 } %40, 0
  store ptr %41, ptr %3, align 8
  %42 = extractvalue { ptr, i32 } %40, 1
  store i32 %42, ptr %4, align 4
  call void @_ZN7libzpaq5ArrayIcED2Ev(ptr noundef nonnull align 8 dereferenceable(20) %13) #2
  br label %43

43:                                               ; preds = %39, %35
  call void @_ZN7libzpaq5ArrayIjED2Ev(ptr noundef nonnull align 8 dereferenceable(20) %11) #2
  br label %44

44:                                               ; preds = %43, %31
  call void @_ZN7libzpaq5ArrayIjED2Ev(ptr noundef nonnull align 8 dereferenceable(20) %9) #2
  br label %45

45:                                               ; preds = %44, %27
  call void @_ZN7libzpaq5ArrayIhED2Ev(ptr noundef nonnull align 8 dereferenceable(20) %7) #2
  br label %46

46:                                               ; preds = %45, %23
  call void @_ZN7libzpaq5ArrayIhED2Ev(ptr noundef nonnull align 8 dereferenceable(20) %6) #2
  br label %47

47:                                               ; preds = %46
  %48 = load ptr, ptr %3, align 8
  %49 = load i32, ptr %4, align 4
  %50 = insertvalue { ptr, i32 } poison, ptr %48, 0
  %51 = insertvalue { ptr, i32 } %50, i32 %49, 1
  resume { ptr, i32 } %51
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7libzpaq5ArrayIhEC2Emi(ptr noundef nonnull align 8 dereferenceable(20), i64 noundef, i32 noundef) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7libzpaq5ArrayIjEC2Emi(ptr noundef nonnull align 8 dereferenceable(20), i64 noundef, i32 noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7libzpaq5ArrayIcEC2Emi(ptr noundef nonnull align 8 dereferenceable(20), i64 noundef, i32 noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7libzpaq5ArrayIcE6resizeEmi(ptr noundef nonnull align 8 dereferenceable(20), i64 noundef, i32 noundef) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7libzpaq5ArrayIcED2Ev(ptr noundef nonnull align 8 dereferenceable(20)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7libzpaq5ArrayIjED2Ev(ptr noundef nonnull align 8 dereferenceable(20)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7libzpaq5ArrayIhED2Ev(ptr noundef nonnull align 8 dereferenceable(20)) unnamed_addr #1 align 2

attributes #0 = { 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 #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 = { 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, !6, i64 0}
!10 = !{!"_ZTSN7libzpaq5ZPAQLE", !6, i64 0, !6, i64 8, !11, i64 16, !13, i64 40, !13, i64 44, !13, i64 48, !11, i64 56, !14, i64 80, !14, i64 104, !15, i64 128, !13, i64 152, !13, i64 156, !13, i64 160, !13, i64 164, !13, i64 168, !13, i64 172, !13, i64 176, !13, i64 180, !6, i64 184}
!11 = !{!"_ZTSN7libzpaq5ArrayIhEE", !6, i64 0, !12, i64 8, !13, i64 16}
!12 = !{!"long", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTSN7libzpaq5ArrayIjEE", !6, i64 0, !12, i64 8, !13, i64 16}
!15 = !{!"_ZTSN7libzpaq5ArrayIcEE", !6, i64 0, !12, i64 8, !13, i64 16}
!16 = !{!10, !6, i64 8}
!17 = !{!10, !6, i64 184}
!18 = !{!10, !13, i64 180}
!19 = !{!10, !13, i64 152}


; 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 uwtable
declare dso_local void @_ZN7libzpaq5ZPAQL5clearEv(ptr noundef nonnull align 8 dereferenceable(192)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7libzpaq5ZPAQLC2Ev(ptr noundef nonnull align 8 dereferenceable(192) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 16
  tail call void @_ZN7libzpaq5ArrayIhEC2Emi(ptr noundef nonnull align 8 dereferenceable(20) %2, i64 noundef 0, i32 noundef 0)
  %3 = getelementptr inbounds i8, ptr %0, i64 56
  invoke void @_ZN7libzpaq5ArrayIhEC2Emi(ptr noundef nonnull align 8 dereferenceable(20) %3, i64 noundef 0, i32 noundef 0)
          to label %4 unwind label %16

4:                                                ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 80
  invoke void @_ZN7libzpaq5ArrayIjEC2Emi(ptr noundef nonnull align 8 dereferenceable(20) %5, i64 noundef 0, i32 noundef 0)
          to label %6 unwind label %18

6:                                                ; preds = %4
  %7 = getelementptr inbounds i8, ptr %0, i64 104
  invoke void @_ZN7libzpaq5ArrayIjEC2Emi(ptr noundef nonnull align 8 dereferenceable(20) %7, i64 noundef 0, i32 noundef 0)
          to label %8 unwind label %20

8:                                                ; preds = %6
  %9 = getelementptr inbounds i8, ptr %0, i64 128
  invoke void @_ZN7libzpaq5ArrayIcEC2Emi(ptr noundef nonnull align 8 dereferenceable(20) %9, i64 noundef 0, i32 noundef 0)
          to label %10 unwind label %22

10:                                               ; preds = %8
  %11 = getelementptr inbounds i8, ptr %0, i64 184
  store ptr null, ptr %11, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %0, i64 180
  store i32 0, ptr %12, align 4, !tbaa !15
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %0, i8 0, i64 16, i1 false)
  invoke void @_ZN7libzpaq5ZPAQL5clearEv(ptr noundef nonnull align 8 dereferenceable(192) %0)
          to label %13 unwind label %24

13:                                               ; preds = %10
  invoke void @_ZN7libzpaq5ArrayIcE6resizeEmi(ptr noundef nonnull align 8 dereferenceable(20) %9, i64 noundef 16384, i32 noundef 0)
          to label %14 unwind label %24

14:                                               ; preds = %13
  %15 = getelementptr inbounds i8, ptr %0, i64 152
  store i32 0, ptr %15, align 8, !tbaa !16
  ret void

16:                                               ; preds = %1
  %17 = landingpad { ptr, i32 }
          cleanup
  br label %29

18:                                               ; preds = %4
  %19 = landingpad { ptr, i32 }
          cleanup
  br label %28

20:                                               ; preds = %6
  %21 = landingpad { ptr, i32 }
          cleanup
  br label %27

22:                                               ; preds = %8
  %23 = landingpad { ptr, i32 }
          cleanup
  br label %26

24:                                               ; preds = %13, %10
  %25 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN7libzpaq5ArrayIcED2Ev(ptr noundef nonnull align 8 dereferenceable(20) %9) #3
  br label %26

26:                                               ; preds = %24, %22
  %.pn = phi { ptr, i32 } [ %25, %24 ], [ %23, %22 ]
  tail call void @_ZN7libzpaq5ArrayIjED2Ev(ptr noundef nonnull align 8 dereferenceable(20) %7) #3
  br label %27

27:                                               ; preds = %26, %20
  %.pn.pn = phi { ptr, i32 } [ %.pn, %26 ], [ %21, %20 ]
  tail call void @_ZN7libzpaq5ArrayIjED2Ev(ptr noundef nonnull align 8 dereferenceable(20) %5) #3
  br label %28

28:                                               ; preds = %27, %18
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %27 ], [ %19, %18 ]
  tail call void @_ZN7libzpaq5ArrayIhED2Ev(ptr noundef nonnull align 8 dereferenceable(20) %3) #3
  br label %29

29:                                               ; preds = %28, %16
  %.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn, %28 ], [ %17, %16 ]
  tail call void @_ZN7libzpaq5ArrayIhED2Ev(ptr noundef nonnull align 8 dereferenceable(20) %2) #3
  resume { ptr, i32 } %.pn.pn.pn.pn
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7libzpaq5ArrayIhEC2Emi(ptr noundef nonnull align 8 dereferenceable(20), i64 noundef, i32 noundef) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7libzpaq5ArrayIjEC2Emi(ptr noundef nonnull align 8 dereferenceable(20), i64 noundef, i32 noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7libzpaq5ArrayIcEC2Emi(ptr noundef nonnull align 8 dereferenceable(20), i64 noundef, i32 noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7libzpaq5ArrayIcE6resizeEmi(ptr noundef nonnull align 8 dereferenceable(20), i64 noundef, i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7libzpaq5ArrayIcED2Ev(ptr noundef nonnull align 8 dereferenceable(20)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7libzpaq5ArrayIjED2Ev(ptr noundef nonnull align 8 dereferenceable(20)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7libzpaq5ArrayIhED2Ev(ptr noundef nonnull align 8 dereferenceable(20)) unnamed_addr #1 align 2

; 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 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 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !7, i64 184}
!6 = !{!"_ZTSN7libzpaq5ZPAQLE", !7, i64 0, !7, i64 8, !10, i64 16, !12, i64 40, !12, i64 44, !12, i64 48, !10, i64 56, !13, i64 80, !13, i64 104, !14, i64 128, !12, i64 152, !12, i64 156, !12, i64 160, !12, i64 164, !12, i64 168, !12, i64 172, !12, i64 176, !12, i64 180, !7, i64 184}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN7libzpaq5ArrayIhEE", !7, i64 0, !11, i64 8, !12, i64 16}
!11 = !{!"long", !8, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!"_ZTSN7libzpaq5ArrayIjEE", !7, i64 0, !11, i64 8, !12, i64 16}
!14 = !{!"_ZTSN7libzpaq5ArrayIcEE", !7, i64 0, !11, i64 8, !12, i64 16}
!15 = !{!6, !12, i64 180}
!16 = !{!6, !12, i64 152}


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