; LLVM IR from SSBMTonberry/pocketlzma :: pocketlzma_program.ll (ZN3plz1c18LzmaEnc_InitPricesEPNS0_8CLzmaEncE)

; 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.plz::c::CLzmaEnc" = type { ptr, %"struct.plz::c::_IMatchFinder", i32, i32, i32, i32, i32, i32, i32, i32, [4 x i32], i32, i32, ptr, %"struct.plz::c::CRangeEnc", i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i32, i32, i32, i32, i32, %"struct.plz::c::_CMatchFinder", [128 x i32], [549 x i32], [16 x i32], [4 x [64 x i32]], [4 x [128 x i32]], [16 x i16], [12 x i16], [12 x i16], [12 x i16], [12 x i16], [12 x [16 x i16]], [12 x [16 x i16]], [4 x [64 x i16]], [128 x i16], %"struct.plz::c::CLenEnc", %"struct.plz::c::CLenEnc", [8192 x i8], %"struct.plz::c::CLenPriceEnc", %"struct.plz::c::CLenPriceEnc", [2048 x %"struct.plz::c::COptimal"], %"struct.plz::c::CSaveState" }
%"struct.plz::c::_IMatchFinder" = type { ptr, ptr, ptr, ptr, ptr }
%"struct.plz::c::CRangeEnc" = type { i32, i32, i64, i64, ptr, ptr, ptr, ptr, i64, i32 }
%"struct.plz::c::_CMatchFinder" = type { ptr, i32, i32, i32, i32, i32, i32, i8, i8, i8, i8, i32, ptr, ptr, i32, i32, ptr, ptr, i32, i32, i32, i32, i64, i32, i32, i32, i32, [256 x i32], i64, i64 }
%"struct.plz::c::CLenEnc" = type { [256 x i16], [256 x i16] }
%"struct.plz::c::CLenPriceEnc" = type { i32, [16 x [272 x i32]] }
%"struct.plz::c::COptimal" = type { i32, i16, i16, i32, i32, [4 x i32] }
%"struct.plz::c::CSaveState" = type { ptr, i32, [4 x i32], [16 x i16], [12 x i16], [12 x i16], [12 x i16], [12 x i16], [12 x [16 x i16]], [12 x [16 x i16]], [4 x [64 x i16]], [128 x i16], %"struct.plz::c::CLenEnc", %"struct.plz::c::CLenEnc" }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3plz1c18LzmaEnc_InitPricesEPNS0_8CLzmaEncE(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds %"struct.plz::c::CLzmaEnc", ptr %3, i32 0, i32 20
  %5 = load i32, ptr %4, align 4, !tbaa !9
  %6 = icmp ne i32 %5, 0
  br i1 %6, label %10, label %7

7:                                                ; preds = %1
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_ZN3plz1cL19FillDistancesPricesEPNS0_8CLzmaEncE(ptr noundef %8)
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_ZN3plz1cL15FillAlignPricesEPNS0_8CLzmaEncE(ptr noundef %9)
  br label %10

10:                                               ; preds = %7, %1
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = getelementptr inbounds %"struct.plz::c::CLzmaEnc", ptr %11, i32 0, i32 8
  %13 = load i32, ptr %12, align 8, !tbaa !20
  %14 = add i32 %13, 1
  %15 = sub i32 %14, 2
  %16 = load ptr, ptr %2, align 8, !tbaa !5
  %17 = getelementptr inbounds %"struct.plz::c::CLzmaEnc", ptr %16, i32 0, i32 50
  %18 = getelementptr inbounds %"struct.plz::c::CLenPriceEnc", ptr %17, i32 0, i32 0
  store i32 %15, ptr %18, align 8, !tbaa !21
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = getelementptr inbounds %"struct.plz::c::CLzmaEnc", ptr %19, i32 0, i32 49
  %21 = getelementptr inbounds %"struct.plz::c::CLenPriceEnc", ptr %20, i32 0, i32 0
  store i32 %15, ptr %21, align 4, !tbaa !22
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  %23 = getelementptr inbounds %"struct.plz::c::CLzmaEnc", ptr %22, i32 0, i32 27
  store i32 64, ptr %23, align 4, !tbaa !23
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  %25 = getelementptr inbounds %"struct.plz::c::CLzmaEnc", ptr %24, i32 0, i32 49
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = getelementptr inbounds %"struct.plz::c::CLzmaEnc", ptr %26, i32 0, i32 18
  %28 = load i32, ptr %27, align 4, !tbaa !24
  %29 = shl i32 1, %28
  %30 = load ptr, ptr %2, align 8, !tbaa !5
  %31 = getelementptr inbounds %"struct.plz::c::CLzmaEnc", ptr %30, i32 0, i32 46
  %32 = load ptr, ptr %2, align 8, !tbaa !5
  %33 = getelementptr inbounds %"struct.plz::c::CLzmaEnc", ptr %32, i32 0, i32 32
  %34 = getelementptr inbounds [128 x i32], ptr %33, i64 0, i64 0
  call void @_ZN3plz1cL24LenPriceEnc_UpdateTablesEPNS0_12CLenPriceEncEjPKNS0_7CLenEncEPKj(ptr noundef %25, i32 noundef %29, ptr noundef %31, ptr noundef %34)
  %35 = load ptr, ptr %2, align 8, !tbaa !5
  %36 = getelementptr inbounds %"struct.plz::c::CLzmaEnc", ptr %35, i32 0, i32 50
  %37 = load ptr, ptr %2, align 8, !tbaa !5
  %38 = getelementptr inbounds %"struct.plz::c::CLzmaEnc", ptr %37, i32 0, i32 18
  %39 = load i32, ptr %38, align 4, !tbaa !24
  %40 = shl i32 1, %39
  %41 = load ptr, ptr %2, align 8, !tbaa !5
  %42 = getelementptr inbounds %"struct.plz::c::CLzmaEnc", ptr %41, i32 0, i32 47
  %43 = load ptr, ptr %2, align 8, !tbaa !5
  %44 = getelementptr inbounds %"struct.plz::c::CLzmaEnc", ptr %43, i32 0, i32 32
  %45 = getelementptr inbounds [128 x i32], ptr %44, i64 0, i64 0
  call void @_ZN3plz1cL24LenPriceEnc_UpdateTablesEPNS0_12CLenPriceEncEjPKNS0_7CLenEncEPKj(ptr noundef %36, i32 noundef %40, ptr noundef %42, ptr noundef %45)
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZN3plz1cL19FillDistancesPricesEPNS0_8CLzmaEncE(ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZN3plz1cL15FillAlignPricesEPNS0_8CLzmaEncE(ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN3plz1cL24LenPriceEnc_UpdateTablesEPNS0_12CLenPriceEncEjPKNS0_7CLenEncEPKj(ptr noundef, i32 noundef, ptr noundef, ptr noundef) #0

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

!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, !12, i64 204}
!10 = !{!"_ZTSN3plz1c8CLzmaEncE", !6, i64 0, !11, i64 8, !12, i64 48, !12, i64 52, !12, i64 56, !12, i64 60, !12, i64 64, !12, i64 68, !12, i64 72, !12, i64 76, !7, i64 80, !12, i64 96, !12, i64 100, !6, i64 104, !13, i64 112, !12, i64 184, !12, i64 188, !12, i64 192, !12, i64 196, !12, i64 200, !12, i64 204, !12, i64 208, !12, i64 212, !12, i64 216, !12, i64 220, !14, i64 224, !12, i64 232, !12, i64 236, !12, i64 240, !12, i64 244, !12, i64 248, !15, i64 256, !7, i64 1416, !7, i64 1928, !7, i64 4124, !7, i64 4188, !7, i64 5212, !7, i64 7260, !7, i64 7292, !7, i64 7316, !7, i64 7340, !7, i64 7364, !7, i64 7388, !7, i64 7772, !7, i64 8156, !7, i64 8668, !17, i64 8924, !17, i64 9948, !7, i64 10972, !18, i64 19164, !18, i64 36576, !7, i64 53988, !19, i64 119528}
!11 = !{!"_ZTSN3plz1c13_IMatchFinderE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!12 = !{!"int", !7, i64 0}
!13 = !{!"_ZTSN3plz1c9CRangeEncE", !12, i64 0, !12, i64 4, !14, i64 8, !14, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !14, i64 56, !12, i64 64}
!14 = !{!"long long", !7, i64 0}
!15 = !{!"_ZTSN3plz1c13_CMatchFinderE", !6, i64 0, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !7, i64 32, !7, i64 33, !7, i64 34, !7, i64 35, !12, i64 36, !6, i64 40, !6, i64 48, !12, i64 56, !12, i64 60, !6, i64 64, !6, i64 72, !12, i64 80, !12, i64 84, !12, i64 88, !12, i64 92, !16, i64 96, !12, i64 104, !12, i64 108, !12, i64 112, !12, i64 116, !7, i64 120, !16, i64 1144, !14, i64 1152}
!16 = !{!"long", !7, i64 0}
!17 = !{!"_ZTSN3plz1c7CLenEncE", !7, i64 0, !7, i64 512}
!18 = !{!"_ZTSN3plz1c12CLenPriceEncE", !12, i64 0, !7, i64 4}
!19 = !{!"_ZTSN3plz1c10CSaveStateE", !6, i64 0, !12, i64 8, !7, i64 12, !7, i64 28, !7, i64 60, !7, i64 84, !7, i64 108, !7, i64 132, !7, i64 156, !7, i64 540, !7, i64 924, !7, i64 1436, !17, i64 1692, !17, i64 2716}
!20 = !{!10, !12, i64 72}
!21 = !{!10, !12, i64 36576}
!22 = !{!10, !12, i64 19164}
!23 = !{!10, !12, i64 236}
!24 = !{!10, !12, i64 196}


; 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
define dso_local void @_ZN3plz1c18LzmaEnc_InitPricesEPNS0_8CLzmaEncE(ptr noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 204
  %3 = load i32, ptr %2, align 4, !tbaa !5
  %.not = icmp eq i32 %3, 0
  br i1 %.not, label %4, label %5

4:                                                ; preds = %1
  tail call void @_ZN3plz1cL19FillDistancesPricesEPNS0_8CLzmaEncE(ptr noundef nonnull %0)
  tail call void @_ZN3plz1cL15FillAlignPricesEPNS0_8CLzmaEncE(ptr noundef nonnull %0)
  br label %5

5:                                                ; preds = %4, %1
  %6 = getelementptr inbounds i8, ptr %0, i64 72
  %7 = load i32, ptr %6, align 8, !tbaa !19
  %8 = add i32 %7, -1
  %9 = getelementptr inbounds i8, ptr %0, i64 36576
  store i32 %8, ptr %9, align 8, !tbaa !20
  %10 = getelementptr inbounds i8, ptr %0, i64 19164
  store i32 %8, ptr %10, align 4, !tbaa !21
  %11 = getelementptr inbounds i8, ptr %0, i64 236
  store i32 64, ptr %11, align 4, !tbaa !22
  %12 = getelementptr inbounds i8, ptr %0, i64 196
  %13 = load i32, ptr %12, align 4, !tbaa !23
  %14 = shl nuw i32 1, %13
  %15 = getelementptr inbounds i8, ptr %0, i64 8924
  %16 = getelementptr inbounds i8, ptr %0, i64 1416
  tail call void @_ZN3plz1cL24LenPriceEnc_UpdateTablesEPNS0_12CLenPriceEncEjPKNS0_7CLenEncEPKj(ptr noundef nonnull %10, i32 noundef %14, ptr noundef nonnull %15, ptr noundef nonnull %16)
  %17 = load i32, ptr %12, align 4, !tbaa !23
  %18 = shl nuw i32 1, %17
  %19 = getelementptr inbounds i8, ptr %0, i64 9948
  tail call void @_ZN3plz1cL24LenPriceEnc_UpdateTablesEPNS0_12CLenPriceEncEjPKNS0_7CLenEncEPKj(ptr noundef nonnull %9, i32 noundef %18, ptr noundef nonnull %19, ptr noundef nonnull %16)
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZN3plz1cL19FillDistancesPricesEPNS0_8CLzmaEncE(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZN3plz1cL15FillAlignPricesEPNS0_8CLzmaEncE(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN3plz1cL24LenPriceEnc_UpdateTablesEPNS0_12CLenPriceEncEjPKNS0_7CLenEncEPKj(ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

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

!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, !11, i64 204}
!6 = !{!"_ZTSN3plz1c8CLzmaEncE", !7, i64 0, !10, i64 8, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !11, i64 64, !11, i64 68, !11, i64 72, !11, i64 76, !8, i64 80, !11, i64 96, !11, i64 100, !7, i64 104, !12, i64 112, !11, i64 184, !11, i64 188, !11, i64 192, !11, i64 196, !11, i64 200, !11, i64 204, !11, i64 208, !11, i64 212, !11, i64 216, !11, i64 220, !13, i64 224, !11, i64 232, !11, i64 236, !11, i64 240, !11, i64 244, !11, i64 248, !14, i64 256, !8, i64 1416, !8, i64 1928, !8, i64 4124, !8, i64 4188, !8, i64 5212, !8, i64 7260, !8, i64 7292, !8, i64 7316, !8, i64 7340, !8, i64 7364, !8, i64 7388, !8, i64 7772, !8, i64 8156, !8, i64 8668, !16, i64 8924, !16, i64 9948, !8, i64 10972, !17, i64 19164, !17, i64 36576, !8, i64 53988, !18, i64 119528}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN3plz1c13_IMatchFinderE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32}
!11 = !{!"int", !8, i64 0}
!12 = !{!"_ZTSN3plz1c9CRangeEncE", !11, i64 0, !11, i64 4, !13, i64 8, !13, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !13, i64 56, !11, i64 64}
!13 = !{!"long long", !8, i64 0}
!14 = !{!"_ZTSN3plz1c13_CMatchFinderE", !7, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !8, i64 32, !8, i64 33, !8, i64 34, !8, i64 35, !11, i64 36, !7, i64 40, !7, i64 48, !11, i64 56, !11, i64 60, !7, i64 64, !7, i64 72, !11, i64 80, !11, i64 84, !11, i64 88, !11, i64 92, !15, i64 96, !11, i64 104, !11, i64 108, !11, i64 112, !11, i64 116, !8, i64 120, !15, i64 1144, !13, i64 1152}
!15 = !{!"long", !8, i64 0}
!16 = !{!"_ZTSN3plz1c7CLenEncE", !8, i64 0, !8, i64 512}
!17 = !{!"_ZTSN3plz1c12CLenPriceEncE", !11, i64 0, !8, i64 4}
!18 = !{!"_ZTSN3plz1c10CSaveStateE", !7, i64 0, !11, i64 8, !8, i64 12, !8, i64 28, !8, i64 60, !8, i64 84, !8, i64 108, !8, i64 132, !8, i64 156, !8, i64 540, !8, i64 924, !8, i64 1436, !16, i64 1692, !16, i64 2716}
!19 = !{!6, !11, i64 72}
!20 = !{!6, !11, i64 36576}
!21 = !{!6, !11, i64 19164}
!22 = !{!6, !11, i64 236}
!23 = !{!6, !11, i64 196}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InstCombinePass,SROAPass,TailCallElimPass