; LLVM IR from liyuming1978/NativeLibCompression :: DecRawso/jni/7zC (Lzma2Dec)

; 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.CLzma2Dec = type { %struct.CLzmaDec, i32, i32, i32, i8, i32, i32, i32 }
%struct.CLzmaDec = type { %struct._CLzmaProps, ptr, ptr, ptr, i32, i32, i64, i64, i32, i32, i32, [4 x i32], i32, i32, i32, i32, i32, [20 x i8] }
%struct._CLzmaProps = type { 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: nounwind uwtable
declare hidden i32 @Lzma2Dec_GetOldProps(i8 noundef zeroext, ptr noundef) #1

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

declare i32 @LzmaDec_AllocateProbs(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @Lzma2Dec_DecodeToDic(ptr noundef, i64 noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @Lzma2Decode(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i8 noundef zeroext %4, i32 noundef %5, ptr noundef %6, ptr noundef %7) #1 {
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i8, align 1
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca %struct.CLzma2Dec, align 8
  %19 = alloca i32, align 4
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  %22 = alloca [5 x i8], align 1
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  store ptr %0, ptr %10, align 8, !tbaa !5
  store ptr %1, ptr %11, align 8, !tbaa !5
  store ptr %2, ptr %12, align 8, !tbaa !5
  store ptr %3, ptr %13, align 8, !tbaa !5
  store i8 %4, ptr %14, align 1, !tbaa !9
  store i32 %5, ptr %15, align 4, !tbaa !10
  store ptr %6, ptr %16, align 8, !tbaa !5
  store ptr %7, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 168, ptr %18) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  %26 = load ptr, ptr %11, align 8, !tbaa !5
  %27 = load i64, ptr %26, align 8, !tbaa !12
  store i64 %27, ptr %20, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #3
  %28 = load ptr, ptr %13, align 8, !tbaa !5
  %29 = load i64, ptr %28, align 8, !tbaa !12
  store i64 %29, ptr %21, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 5, ptr %22) #3
  %30 = getelementptr inbounds %struct.CLzma2Dec, ptr %18, i32 0, i32 0
  %31 = getelementptr inbounds %struct.CLzmaDec, ptr %30, i32 0, i32 2
  store ptr null, ptr %31, align 8, !tbaa !14
  %32 = getelementptr inbounds %struct.CLzma2Dec, ptr %18, i32 0, i32 0
  %33 = getelementptr inbounds %struct.CLzmaDec, ptr %32, i32 0, i32 1
  store ptr null, ptr %33, align 8, !tbaa !18
  %34 = load ptr, ptr %13, align 8, !tbaa !5
  store i64 0, ptr %34, align 8, !tbaa !12
  %35 = load ptr, ptr %11, align 8, !tbaa !5
  store i64 0, ptr %35, align 8, !tbaa !12
  %36 = load ptr, ptr %16, align 8, !tbaa !5
  store i32 0, ptr %36, align 4, !tbaa !10
  %37 = load ptr, ptr %10, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.CLzma2Dec, ptr %18, i32 0, i32 0
  %39 = getelementptr inbounds %struct.CLzmaDec, ptr %38, i32 0, i32 2
  store ptr %37, ptr %39, align 8, !tbaa !14
  %40 = load i64, ptr %20, align 8, !tbaa !12
  %41 = getelementptr inbounds %struct.CLzma2Dec, ptr %18, i32 0, i32 0
  %42 = getelementptr inbounds %struct.CLzmaDec, ptr %41, i32 0, i32 7
  store i64 %40, ptr %42, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #3
  %43 = load i8, ptr %14, align 1, !tbaa !9
  %44 = getelementptr inbounds [5 x i8], ptr %22, i64 0, i64 0
  %45 = call i32 @Lzma2Dec_GetOldProps(i8 noundef zeroext %43, ptr noundef %44)
  store i32 %45, ptr %23, align 4, !tbaa !10
  %46 = load i32, ptr %23, align 4, !tbaa !10
  %47 = icmp ne i32 %46, 0
  br i1 %47, label %48, label %50

48:                                               ; preds = %8
  %49 = load i32, ptr %23, align 4, !tbaa !10
  store i32 %49, ptr %9, align 4
  store i32 1, ptr %24, align 4
  br label %51

50:                                               ; preds = %8
  store i32 0, ptr %24, align 4
  br label %51

51:                                               ; preds = %50, %48
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #3
  %52 = load i32, ptr %24, align 4
  switch i32 %52, label %89 [
    i32 0, label %53
  ]

53:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #3
  %54 = getelementptr inbounds %struct.CLzma2Dec, ptr %18, i32 0, i32 0
  %55 = getelementptr inbounds [5 x i8], ptr %22, i64 0, i64 0
  %56 = load ptr, ptr %17, align 8, !tbaa !5
  %57 = call i32 @LzmaDec_AllocateProbs(ptr noundef %54, ptr noundef %55, i32 noundef 5, ptr noundef %56)
  store i32 %57, ptr %25, align 4, !tbaa !10
  %58 = load i32, ptr %25, align 4, !tbaa !10
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %62

60:                                               ; preds = %53
  %61 = load i32, ptr %25, align 4, !tbaa !10
  store i32 %61, ptr %9, align 4
  store i32 1, ptr %24, align 4
  br label %63

62:                                               ; preds = %53
  store i32 0, ptr %24, align 4
  br label %63

63:                                               ; preds = %62, %60
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #3
  %64 = load i32, ptr %24, align 4
  switch i32 %64, label %89 [
    i32 0, label %65
  ]

65:                                               ; preds = %63
  %66 = load i64, ptr %21, align 8, !tbaa !12
  %67 = load ptr, ptr %13, align 8, !tbaa !5
  store i64 %66, ptr %67, align 8, !tbaa !12
  %68 = load i64, ptr %20, align 8, !tbaa !12
  %69 = load ptr, ptr %12, align 8, !tbaa !5
  %70 = load ptr, ptr %13, align 8, !tbaa !5
  %71 = load i32, ptr %15, align 4, !tbaa !10
  %72 = load ptr, ptr %16, align 8, !tbaa !5
  %73 = call i32 @Lzma2Dec_DecodeToDic(ptr noundef %18, i64 noundef %68, ptr noundef %69, ptr noundef %70, i32 noundef %71, ptr noundef %72)
  store i32 %73, ptr %19, align 4, !tbaa !10
  %74 = getelementptr inbounds %struct.CLzma2Dec, ptr %18, i32 0, i32 0
  %75 = getelementptr inbounds %struct.CLzmaDec, ptr %74, i32 0, i32 6
  %76 = load i64, ptr %75, align 8, !tbaa !20
  %77 = load ptr, ptr %11, align 8, !tbaa !5
  store i64 %76, ptr %77, align 8, !tbaa !12
  %78 = load i32, ptr %19, align 4, !tbaa !10
  %79 = icmp eq i32 %78, 0
  br i1 %79, label %80, label %85

80:                                               ; preds = %65
  %81 = load ptr, ptr %16, align 8, !tbaa !5
  %82 = load i32, ptr %81, align 4, !tbaa !10
  %83 = icmp eq i32 %82, 3
  br i1 %83, label %84, label %85

84:                                               ; preds = %80
  store i32 6, ptr %19, align 4, !tbaa !10
  br label %85

85:                                               ; preds = %84, %80, %65
  %86 = getelementptr inbounds %struct.CLzma2Dec, ptr %18, i32 0, i32 0
  %87 = load ptr, ptr %17, align 8, !tbaa !5
  call void @LzmaDec_FreeProbs(ptr noundef %86, ptr noundef %87)
  %88 = load i32, ptr %19, align 4, !tbaa !10
  store i32 %88, ptr %9, align 4
  store i32 1, ptr %24, align 4
  br label %89

89:                                               ; preds = %85, %63, %51
  call void @llvm.lifetime.end.p0(i64 5, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 168, ptr %18) #3
  %90 = load i32, ptr %9, align 4
  ret i32 %90
}

declare void @LzmaDec_FreeProbs(ptr noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { "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 = { 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/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!15, !6, i64 24}
!15 = !{!"", !16, i64 0, !11, i64 136, !11, i64 140, !11, i64 144, !7, i64 148, !11, i64 152, !11, i64 156, !11, i64 160}
!16 = !{!"", !17, i64 0, !6, i64 16, !6, i64 24, !6, i64 32, !11, i64 40, !11, i64 44, !13, i64 48, !13, i64 56, !11, i64 64, !11, i64 68, !11, i64 72, !7, i64 76, !11, i64 92, !11, i64 96, !11, i64 100, !11, i64 104, !11, i64 108, !7, i64 112}
!17 = !{!"_CLzmaProps", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12}
!18 = !{!15, !6, i64 16}
!19 = !{!15, !13, i64 56}
!20 = !{!15, !13, 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.CLzma2Dec = type { %struct.CLzmaDec, i32, i32, i32, i8, i32, i32, i32 }
%struct.CLzmaDec = type { %struct._CLzmaProps, ptr, ptr, ptr, i32, i32, i64, i64, i32, i32, i32, [4 x i32], i32, i32, i32, i32, i32, [20 x i8] }
%struct._CLzmaProps = type { i32, i32, i32, i32 }

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

; Function Attrs: nounwind uwtable
declare hidden i32 @Lzma2Dec_GetOldProps(i8 noundef zeroext, ptr noundef) local_unnamed_addr #1

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

declare i32 @LzmaDec_AllocateProbs(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @Lzma2Dec_DecodeToDic(ptr noundef, i64 noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i32 @Lzma2Decode(ptr noundef %0, ptr nocapture noundef %1, ptr noundef %2, ptr noundef %3, i8 noundef zeroext %4, i32 noundef %5, ptr noundef %6, ptr noundef %7) local_unnamed_addr #1 {
  %9 = alloca %struct.CLzma2Dec, align 8
  %10 = alloca [5 x i8], align 1
  call void @llvm.lifetime.start.p0(i64 168, ptr nonnull %9) #3
  %11 = load i64, ptr %1, align 8, !tbaa !5
  %12 = load i64, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %10) #3
  %13 = getelementptr inbounds i8, ptr %9, i64 24
  %14 = getelementptr inbounds i8, ptr %9, i64 16
  store i64 0, ptr %14, align 8
  store i64 0, ptr %3, align 8, !tbaa !5
  store i64 0, ptr %1, align 8, !tbaa !5
  store i32 0, ptr %6, align 4, !tbaa !9
  store ptr %0, ptr %13, align 8, !tbaa !11
  %15 = getelementptr inbounds i8, ptr %9, i64 56
  store i64 %11, ptr %15, align 8, !tbaa !16
  %16 = call i32 @Lzma2Dec_GetOldProps(i8 noundef zeroext %4, ptr noundef nonnull %10)
  %.not = icmp eq i32 %16, 0
  br i1 %.not, label %17, label %28

17:                                               ; preds = %8
  %18 = call i32 @LzmaDec_AllocateProbs(ptr noundef nonnull %9, ptr noundef nonnull %10, i32 noundef 5, ptr noundef %7) #3
  %.not33 = icmp eq i32 %18, 0
  br i1 %.not33, label %19, label %28

19:                                               ; preds = %17
  store i64 %12, ptr %3, align 8, !tbaa !5
  %20 = call i32 @Lzma2Dec_DecodeToDic(ptr noundef nonnull %9, i64 noundef %11, ptr noundef %2, ptr noundef nonnull %3, i32 noundef %5, ptr noundef nonnull %6)
  %21 = getelementptr inbounds i8, ptr %9, i64 48
  %22 = load i64, ptr %21, align 8, !tbaa !17
  store i64 %22, ptr %1, align 8, !tbaa !5
  %23 = icmp eq i32 %20, 0
  br i1 %23, label %24, label %27

24:                                               ; preds = %19
  %25 = load i32, ptr %6, align 4, !tbaa !9
  %26 = icmp eq i32 %25, 3
  %spec.select = select i1 %26, i32 6, i32 0
  br label %27

27:                                               ; preds = %24, %19
  %.030 = phi i32 [ %20, %19 ], [ %spec.select, %24 ]
  call void @LzmaDec_FreeProbs(ptr noundef nonnull %9, ptr noundef %7) #3
  br label %28

28:                                               ; preds = %17, %8, %27
  %.2 = phi i32 [ %.030, %27 ], [ %18, %17 ], [ %16, %8 ]
  call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %10) #3
  call void @llvm.lifetime.end.p0(i64 168, ptr nonnull %9) #3
  ret i32 %.2
}

declare void @LzmaDec_FreeProbs(ptr noundef, ptr noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { "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 = { 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !15, i64 24}
!12 = !{!"", !13, i64 0, !10, i64 136, !10, i64 140, !10, i64 144, !7, i64 148, !10, i64 152, !10, i64 156, !10, i64 160}
!13 = !{!"", !14, i64 0, !15, i64 16, !15, i64 24, !15, i64 32, !10, i64 40, !10, i64 44, !6, i64 48, !6, i64 56, !10, i64 64, !10, i64 68, !10, i64 72, !7, i64 76, !10, i64 92, !10, i64 96, !10, i64 100, !10, i64 104, !10, i64 108, !7, i64 112}
!14 = !{!"_CLzmaProps", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12}
!15 = !{!"any pointer", !7, i64 0}
!16 = !{!12, !6, i64 56}
!17 = !{!12, !6, i64 48}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass