; LLVM IR from JayXon/Leanify :: lib/LZMA (LzFind)

; 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._IMatchFinder = type { ptr, ptr, ptr, ptr, ptr }
%struct._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 }

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

; Function Attrs: nounwind uwtable
define dso_local void @MatchFinder_CreateVTable(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = getelementptr inbounds %struct._IMatchFinder, ptr %5, i32 0, i32 0
  store ptr @MatchFinder_Init, ptr %6, align 8, !tbaa !9
  %7 = load ptr, ptr %4, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct._IMatchFinder, ptr %7, i32 0, i32 1
  store ptr @MatchFinder_GetNumAvailableBytes, ptr %8, align 8, !tbaa !11
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct._IMatchFinder, ptr %9, i32 0, i32 2
  store ptr @MatchFinder_GetPointerToCurrentPos, ptr %10, align 8, !tbaa !12
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct._CMatchFinder, ptr %11, i32 0, i32 8
  %13 = load i8, ptr %12, align 1, !tbaa !13
  %14 = icmp ne i8 %13, 0
  br i1 %14, label %31, label %15

15:                                               ; preds = %2
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct._CMatchFinder, ptr %16, i32 0, i32 21
  %18 = load i32, ptr %17, align 4, !tbaa !18
  %19 = icmp ule i32 %18, 4
  br i1 %19, label %20, label %25

20:                                               ; preds = %15
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct._IMatchFinder, ptr %21, i32 0, i32 3
  store ptr @Hc4_MatchFinder_GetMatches, ptr %22, align 8, !tbaa !19
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct._IMatchFinder, ptr %23, i32 0, i32 4
  store ptr @Hc4_MatchFinder_Skip, ptr %24, align 8, !tbaa !20
  br label %30

25:                                               ; preds = %15
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct._IMatchFinder, ptr %26, i32 0, i32 3
  store ptr @Hc5_MatchFinder_GetMatches, ptr %27, align 8, !tbaa !19
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct._IMatchFinder, ptr %28, i32 0, i32 4
  store ptr @Hc5_MatchFinder_Skip, ptr %29, align 8, !tbaa !20
  br label %30

30:                                               ; preds = %25, %20
  br label %69

31:                                               ; preds = %2
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct._CMatchFinder, ptr %32, i32 0, i32 21
  %34 = load i32, ptr %33, align 4, !tbaa !18
  %35 = icmp eq i32 %34, 2
  br i1 %35, label %36, label %41

36:                                               ; preds = %31
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct._IMatchFinder, ptr %37, i32 0, i32 3
  store ptr @Bt2_MatchFinder_GetMatches, ptr %38, align 8, !tbaa !19
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct._IMatchFinder, ptr %39, i32 0, i32 4
  store ptr @Bt2_MatchFinder_Skip, ptr %40, align 8, !tbaa !20
  br label %68

41:                                               ; preds = %31
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct._CMatchFinder, ptr %42, i32 0, i32 21
  %44 = load i32, ptr %43, align 4, !tbaa !18
  %45 = icmp eq i32 %44, 3
  br i1 %45, label %46, label %51

46:                                               ; preds = %41
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct._IMatchFinder, ptr %47, i32 0, i32 3
  store ptr @Bt3_MatchFinder_GetMatches, ptr %48, align 8, !tbaa !19
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct._IMatchFinder, ptr %49, i32 0, i32 4
  store ptr @Bt3_MatchFinder_Skip, ptr %50, align 8, !tbaa !20
  br label %67

51:                                               ; preds = %41
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct._CMatchFinder, ptr %52, i32 0, i32 21
  %54 = load i32, ptr %53, align 4, !tbaa !18
  %55 = icmp eq i32 %54, 4
  br i1 %55, label %56, label %61

56:                                               ; preds = %51
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct._IMatchFinder, ptr %57, i32 0, i32 3
  store ptr @Bt4_MatchFinder_GetMatches, ptr %58, align 8, !tbaa !19
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct._IMatchFinder, ptr %59, i32 0, i32 4
  store ptr @Bt4_MatchFinder_Skip, ptr %60, align 8, !tbaa !20
  br label %66

61:                                               ; preds = %51
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct._IMatchFinder, ptr %62, i32 0, i32 3
  store ptr @Bt5_MatchFinder_GetMatches, ptr %63, align 8, !tbaa !19
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct._IMatchFinder, ptr %64, i32 0, i32 4
  store ptr @Bt5_MatchFinder_Skip, ptr %65, align 8, !tbaa !20
  br label %66

66:                                               ; preds = %61, %56
  br label %67

67:                                               ; preds = %66, %46
  br label %68

68:                                               ; preds = %67, %36
  br label %69

69:                                               ; preds = %68, %30
  ret void
}

; Function Attrs: nounwind uwtable
declare hidden i32 @MatchFinder_GetNumAvailableBytes(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden ptr @MatchFinder_GetPointerToCurrentPos(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden ptr @Hc4_MatchFinder_GetMatches(ptr noundef, ptr noundef) #0

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

; Function Attrs: nounwind uwtable
declare hidden ptr @Hc5_MatchFinder_GetMatches(ptr noundef, ptr noundef) #0

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

; Function Attrs: nounwind uwtable
declare hidden ptr @Bt2_MatchFinder_GetMatches(ptr noundef, ptr noundef) #0

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

; Function Attrs: nounwind uwtable
declare hidden ptr @Bt3_MatchFinder_GetMatches(ptr noundef, ptr noundef) #0

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

; Function Attrs: nounwind uwtable
declare hidden ptr @Bt4_MatchFinder_GetMatches(ptr noundef, ptr noundef) #0

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

; Function Attrs: nounwind uwtable
declare hidden ptr @Bt5_MatchFinder_GetMatches(ptr noundef, ptr noundef) #0

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

attributes #0 = { 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/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"_IMatchFinder", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!11 = !{!10, !6, i64 8}
!12 = !{!10, !6, i64 16}
!13 = !{!14, !7, i64 33}
!14 = !{!"_CMatchFinder", !6, i64 0, !15, i64 8, !15, i64 12, !15, i64 16, !15, i64 20, !15, i64 24, !15, i64 28, !7, i64 32, !7, i64 33, !7, i64 34, !7, i64 35, !15, i64 36, !6, i64 40, !6, i64 48, !15, i64 56, !15, i64 60, !6, i64 64, !6, i64 72, !15, i64 80, !15, i64 84, !15, i64 88, !15, i64 92, !16, i64 96, !15, i64 104, !15, i64 108, !15, i64 112, !15, i64 116, !7, i64 120, !16, i64 1144, !17, i64 1152}
!15 = !{!"int", !7, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{!"long long", !7, i64 0}
!18 = !{!14, !15, i64 92}
!19 = !{!10, !6, i64 24}
!20 = !{!10, !6, i64 32}


; 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: nounwind uwtable
declare dso_local void @MatchFinder_Init(ptr noundef) #0

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @MatchFinder_CreateVTable(ptr nocapture noundef readonly %0, ptr nocapture noundef writeonly %1) local_unnamed_addr #1 {
  store ptr @MatchFinder_Init, ptr %1, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %1, i64 8
  store ptr @MatchFinder_GetNumAvailableBytes, ptr %3, align 8, !tbaa !10
  %4 = getelementptr inbounds i8, ptr %1, i64 16
  store ptr @MatchFinder_GetPointerToCurrentPos, ptr %4, align 8, !tbaa !11
  %5 = getelementptr inbounds i8, ptr %0, i64 33
  %6 = load i8, ptr %5, align 1, !tbaa !12
  %.not = icmp eq i8 %6, 0
  %7 = getelementptr inbounds i8, ptr %0, i64 92
  %8 = load i32, ptr %7, align 4, !tbaa !17
  br i1 %.not, label %9, label %15

9:                                                ; preds = %2
  %10 = icmp ult i32 %8, 5
  %11 = getelementptr inbounds i8, ptr %1, i64 24
  %12 = getelementptr inbounds i8, ptr %1, i64 32
  br i1 %10, label %13, label %14

13:                                               ; preds = %9
  store ptr @Hc4_MatchFinder_GetMatches, ptr %11, align 8, !tbaa !18
  store ptr @Hc4_MatchFinder_Skip, ptr %12, align 8, !tbaa !19
  br label %22

14:                                               ; preds = %9
  store ptr @Hc5_MatchFinder_GetMatches, ptr %11, align 8, !tbaa !18
  store ptr @Hc5_MatchFinder_Skip, ptr %12, align 8, !tbaa !19
  br label %22

15:                                               ; preds = %2
  %16 = getelementptr inbounds i8, ptr %1, i64 24
  %17 = getelementptr inbounds i8, ptr %1, i64 32
  switch i32 %8, label %21 [
    i32 2, label %18
    i32 3, label %19
    i32 4, label %20
  ]

18:                                               ; preds = %15
  store ptr @Bt2_MatchFinder_GetMatches, ptr %16, align 8, !tbaa !18
  store ptr @Bt2_MatchFinder_Skip, ptr %17, align 8, !tbaa !19
  br label %22

19:                                               ; preds = %15
  store ptr @Bt3_MatchFinder_GetMatches, ptr %16, align 8, !tbaa !18
  store ptr @Bt3_MatchFinder_Skip, ptr %17, align 8, !tbaa !19
  br label %22

20:                                               ; preds = %15
  store ptr @Bt4_MatchFinder_GetMatches, ptr %16, align 8, !tbaa !18
  store ptr @Bt4_MatchFinder_Skip, ptr %17, align 8, !tbaa !19
  br label %22

21:                                               ; preds = %15
  store ptr @Bt5_MatchFinder_GetMatches, ptr %16, align 8, !tbaa !18
  store ptr @Bt5_MatchFinder_Skip, ptr %17, align 8, !tbaa !19
  br label %22

22:                                               ; preds = %18, %20, %21, %19, %13, %14
  ret void
}

; Function Attrs: nounwind uwtable
declare hidden i32 @MatchFinder_GetNumAvailableBytes(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden ptr @MatchFinder_GetPointerToCurrentPos(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden ptr @Hc4_MatchFinder_GetMatches(ptr noundef, ptr noundef) #0

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

; Function Attrs: nounwind uwtable
declare hidden ptr @Hc5_MatchFinder_GetMatches(ptr noundef, ptr noundef) #0

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

; Function Attrs: nounwind uwtable
declare hidden ptr @Bt2_MatchFinder_GetMatches(ptr noundef, ptr noundef) #0

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

; Function Attrs: nounwind uwtable
declare hidden ptr @Bt3_MatchFinder_GetMatches(ptr noundef, ptr noundef) #0

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

; Function Attrs: nounwind uwtable
declare hidden ptr @Bt4_MatchFinder_GetMatches(ptr noundef, ptr noundef) #0

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

; Function Attrs: nounwind uwtable
declare hidden ptr @Bt5_MatchFinder_GetMatches(ptr noundef, ptr noundef) #0

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

attributes #0 = { 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 nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) 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, !7, i64 0}
!6 = !{!"_IMatchFinder", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!6, !7, i64 16}
!12 = !{!13, !8, i64 33}
!13 = !{!"_CMatchFinder", !7, i64 0, !14, i64 8, !14, i64 12, !14, i64 16, !14, i64 20, !14, i64 24, !14, i64 28, !8, i64 32, !8, i64 33, !8, i64 34, !8, i64 35, !14, i64 36, !7, i64 40, !7, i64 48, !14, i64 56, !14, i64 60, !7, i64 64, !7, i64 72, !14, i64 80, !14, i64 84, !14, i64 88, !14, i64 92, !15, i64 96, !14, i64 104, !14, i64 108, !14, i64 112, !14, i64 116, !8, i64 120, !15, i64 1144, !16, i64 1152}
!14 = !{!"int", !8, i64 0}
!15 = !{!"long", !8, i64 0}
!16 = !{!"long long", !8, i64 0}
!17 = !{!13, !14, i64 92}
!18 = !{!6, !7, i64 24}
!19 = !{!6, !7, i64 32}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass