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

; 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::Decoder" = type { ptr, i32, i32, i32, [4 x i8], %"class.libzpaq::Predictor", %"class.libzpaq::Array.4" }
%"class.libzpaq::Predictor" = type <{ i32, i32, [256 x i32], [256 x i32], ptr, [256 x %"struct.libzpaq::Component"], [256 x i32], [1024 x i32], [4096 x i16], [32768 x i16], %"class.libzpaq::StateTable", ptr, i32, [4 x i8] }>
%"struct.libzpaq::Component" = type { i64, i64, i64, i64, i64, %"class.libzpaq::Array", %"class.libzpaq::Array.0", %"class.libzpaq::Array.2" }
%"class.libzpaq::Array" = type <{ ptr, i64, i32, [4 x i8] }>
%"class.libzpaq::Array.0" = type <{ ptr, i64, i32, [4 x i8] }>
%"class.libzpaq::Array.2" = type <{ ptr, i64, i32, [4 x i8] }>
%"class.libzpaq::StateTable" = type { [1024 x i8] }
%"class.libzpaq::Array.4" = type <{ ptr, i64, i32, [4 x i8] }>

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7libzpaq7Decoder4initEv(ptr noundef nonnull align 8 dereferenceable(110672) %0) #0 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  %4 = getelementptr inbounds %"class.libzpaq::Decoder", ptr %3, i32 0, i32 5
  call void @_ZN7libzpaq9Predictor4initEv(ptr noundef nonnull align 8 dereferenceable(110620) %4)
  %5 = getelementptr inbounds %"class.libzpaq::Decoder", ptr %3, i32 0, i32 5
  %6 = call noundef zeroext i1 @_ZN7libzpaq9Predictor9isModeledEv(ptr noundef nonnull align 8 dereferenceable(110620) %5)
  br i1 %6, label %7, label %11

7:                                                ; preds = %1
  %8 = getelementptr inbounds %"class.libzpaq::Decoder", ptr %3, i32 0, i32 1
  store i32 1, ptr %8, align 8, !tbaa !9
  %9 = getelementptr inbounds %"class.libzpaq::Decoder", ptr %3, i32 0, i32 2
  store i32 -1, ptr %9, align 4, !tbaa !16
  %10 = getelementptr inbounds %"class.libzpaq::Decoder", ptr %3, i32 0, i32 3
  store i32 0, ptr %10, align 8, !tbaa !17
  br label %15

11:                                               ; preds = %1
  %12 = getelementptr inbounds %"class.libzpaq::Decoder", ptr %3, i32 0, i32 3
  store i32 0, ptr %12, align 8, !tbaa !17
  %13 = getelementptr inbounds %"class.libzpaq::Decoder", ptr %3, i32 0, i32 2
  store i32 0, ptr %13, align 4, !tbaa !16
  %14 = getelementptr inbounds %"class.libzpaq::Decoder", ptr %3, i32 0, i32 1
  store i32 0, ptr %14, align 8, !tbaa !9
  br label %15

15:                                               ; preds = %11, %7
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7libzpaq9Predictor9isModeledEv(ptr noundef nonnull align 8 dereferenceable(110620)) #0 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" }

!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 8}
!10 = !{!"_ZTSN7libzpaq7DecoderE", !6, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !12, i64 24, !14, i64 110648}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTSN7libzpaq9PredictorE", !11, i64 0, !11, i64 4, !7, i64 8, !7, i64 1032, !6, i64 2056, !7, i64 2064, !7, i64 30736, !7, i64 31760, !7, i64 35856, !7, i64 44048, !13, i64 109584, !6, i64 110608, !11, i64 110616}
!13 = !{!"_ZTSN7libzpaq10StateTableE", !7, i64 0}
!14 = !{!"_ZTSN7libzpaq5ArrayIcEE", !6, i64 0, !15, i64 8, !11, i64 16}
!15 = !{!"long", !7, i64 0}
!16 = !{!10, !11, i64 12}
!17 = !{!10, !11, i64 16}


; 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 @_ZN7libzpaq9Predictor4initEv(ptr noundef nonnull align 8 dereferenceable(110620)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7libzpaq7Decoder4initEv(ptr noundef nonnull align 8 dereferenceable(110672) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 24
  tail call void @_ZN7libzpaq9Predictor4initEv(ptr noundef nonnull align 8 dereferenceable(110620) %2)
  %3 = tail call noundef zeroext i1 @_ZN7libzpaq9Predictor9isModeledEv(ptr noundef nonnull align 8 dereferenceable(110620) %2)
  %spec.select = zext i1 %3 to i32
  %spec.select2 = sext i1 %3 to i32
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %spec.select, ptr %4, align 8
  %5 = getelementptr inbounds i8, ptr %0, i64 12
  store i32 %spec.select2, ptr %5, align 4
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  store i32 0, ptr %6, align 8
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7libzpaq9Predictor9isModeledEv(ptr noundef nonnull align 8 dereferenceable(110620)) local_unnamed_addr #0 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" }

!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)"}


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