; LLVM IR from SSBMTonberry/pocketlzma :: ref_spec/lzma1900/CPP/7zip/Bundles/LzmaCon (LzmaAlone)

; 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.CProgressPrint = type { %struct.ICompressProgressInfo, %class.CMyUnknownImp, i64, i64 }
%struct.ICompressProgressInfo = type { %struct.IUnknown }
%struct.IUnknown = type { ptr }
%class.CMyUnknownImp = type { i32 }

@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN14CProgressPrint12SetRatioInfoEPKyS1_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef %1, ptr noundef %2) unnamed_addr #0 align 2 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %10 = load ptr, ptr %5, align 8
  %11 = call noundef zeroext i1 @_ZN13NConsoleClose15TestBreakSignalEv()
  br i1 %11, label %12, label %13

12:                                               ; preds = %3
  store i32 -2147467260, ptr %4, align 4
  br label %49

13:                                               ; preds = %3
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  %15 = icmp ne ptr %14, null
  br i1 %15, label %16, label %48

16:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = load i64, ptr %17, align 8, !tbaa !9
  %19 = lshr i64 %18, 20
  store i64 %19, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %20 = getelementptr inbounds %class.CProgressPrint, ptr %10, i32 0, i32 3
  %21 = load i64, ptr %20, align 8, !tbaa !11
  store i64 %21, ptr %9, align 8, !tbaa !9
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  %23 = icmp ne ptr %22, null
  br i1 %23, label %24, label %28

24:                                               ; preds = %16
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = load i64, ptr %25, align 8, !tbaa !9
  %27 = lshr i64 %26, 20
  store i64 %27, ptr %9, align 8, !tbaa !9
  br label %28

28:                                               ; preds = %24, %16
  %29 = load i64, ptr %8, align 8, !tbaa !9
  %30 = getelementptr inbounds %class.CProgressPrint, ptr %10, i32 0, i32 2
  %31 = load i64, ptr %30, align 8, !tbaa !17
  %32 = icmp ne i64 %29, %31
  br i1 %32, label %38, label %33

33:                                               ; preds = %28
  %34 = load i64, ptr %9, align 8, !tbaa !9
  %35 = getelementptr inbounds %class.CProgressPrint, ptr %10, i32 0, i32 3
  %36 = load i64, ptr %35, align 8, !tbaa !11
  %37 = icmp ne i64 %34, %36
  br i1 %37, label %38, label %47

38:                                               ; preds = %33, %28
  %39 = load i64, ptr %8, align 8, !tbaa !9
  %40 = getelementptr inbounds %class.CProgressPrint, ptr %10, i32 0, i32 2
  store i64 %39, ptr %40, align 8, !tbaa !17
  %41 = load i64, ptr %9, align 8, !tbaa !9
  %42 = getelementptr inbounds %class.CProgressPrint, ptr %10, i32 0, i32 3
  store i64 %41, ptr %42, align 8, !tbaa !11
  call void @_ZN14CProgressPrint10ClosePrintEv(ptr noundef nonnull align 8 dereferenceable(32) %10)
  %43 = getelementptr inbounds %class.CProgressPrint, ptr %10, i32 0, i32 2
  %44 = load i64, ptr %43, align 8, !tbaa !17
  call void @_ZL8Print_MBy(i64 noundef %44)
  call void @_ZL5PrintPKc(ptr noundef @.str.1)
  %45 = getelementptr inbounds %class.CProgressPrint, ptr %10, i32 0, i32 3
  %46 = load i64, ptr %45, align 8, !tbaa !11
  call void @_ZL8Print_MBy(i64 noundef %46)
  br label %47

47:                                               ; preds = %38, %33
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %48

48:                                               ; preds = %47, %13
  store i32 0, ptr %4, align 4
  br label %49

49:                                               ; preds = %48, %12
  %50 = load i32, ptr %4, align 4
  ret i32 %50
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN13NConsoleClose15TestBreakSignalEv() #1

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

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL8Print_MBy(i64 noundef) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { inlinehint 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 nosync nounwind willreturn memory(argmem: readwrite) }
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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !10, i64 24}
!12 = !{!"_ZTS14CProgressPrint", !13, i64 0, !15, i64 8, !10, i64 16, !10, i64 24}
!13 = !{!"_ZTS21ICompressProgressInfo", !14, i64 0}
!14 = !{!"_ZTS8IUnknown"}
!15 = !{!"_ZTS13CMyUnknownImp", !16, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = !{!12, !10, 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"

@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 -2147467260, 1) i32 @_ZN14CProgressPrint12SetRatioInfoEPKyS1_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef readonly %1, ptr noundef readonly %2) unnamed_addr #0 align 2 {
  %4 = tail call noundef zeroext i1 @_ZN13NConsoleClose15TestBreakSignalEv()
  br i1 %4, label %20, label %5

5:                                                ; preds = %3
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %20, label %6

6:                                                ; preds = %5
  %7 = load i64, ptr %1, align 8, !tbaa !5
  %8 = lshr i64 %7, 20
  %9 = getelementptr inbounds i8, ptr %0, i64 24
  %10 = load i64, ptr %9, align 8
  %.not12 = icmp eq ptr %2, null
  br i1 %.not12, label %14, label %11

11:                                               ; preds = %6
  %12 = load i64, ptr %2, align 8, !tbaa !5
  %13 = lshr i64 %12, 20
  br label %14

14:                                               ; preds = %11, %6
  %.0 = phi i64 [ %13, %11 ], [ %10, %6 ]
  %15 = getelementptr inbounds i8, ptr %0, i64 16
  %16 = load i64, ptr %15, align 8, !tbaa !9
  %.not13 = icmp eq i64 %8, %16
  %.not14 = icmp eq i64 %.0, %10
  %or.cond = select i1 %.not13, i1 %.not14, i1 false
  br i1 %or.cond, label %20, label %17

17:                                               ; preds = %14
  store i64 %8, ptr %15, align 8, !tbaa !9
  store i64 %.0, ptr %9, align 8, !tbaa !15
  tail call void @_ZN14CProgressPrint10ClosePrintEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %18 = load i64, ptr %15, align 8, !tbaa !9
  tail call void @_ZL8Print_MBy(i64 noundef %18)
  tail call void @_ZL5PrintPKc(ptr noundef nonnull @.str.1)
  %19 = load i64, ptr %9, align 8, !tbaa !15
  tail call void @_ZL8Print_MBy(i64 noundef %19)
  br label %20

20:                                               ; preds = %5, %14, %17, %3
  %.09 = phi i32 [ -2147467260, %3 ], [ 0, %17 ], [ 0, %14 ], [ 0, %5 ]
  ret i32 %.09
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN13NConsoleClose15TestBreakSignalEv() local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL8Print_MBy(i64 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 = { inlinehint 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 16}
!10 = !{!"_ZTS14CProgressPrint", !11, i64 0, !13, i64 8, !6, i64 16, !6, i64 24}
!11 = !{!"_ZTS21ICompressProgressInfo", !12, i64 0}
!12 = !{!"_ZTS8IUnknown"}
!13 = !{!"_ZTS13CMyUnknownImp", !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!10, !6, i64 24}


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