; LLVM IR from mncoppola/rpef :: utilities_src/squashfs4.2/lzma465/CPP/7zip/Compress/LZMA_Alone (LzmaBench)

; 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.CBenchInfo = type <{ i64, i64, i64, i64, i64, i64, i32, [4 x i8] }>
%class.CBenchProgressInfo = type { %struct.ICompressProgressInfo, %class.CMyUnknownImp, ptr, %struct.CBenchInfo, i32, ptr }
%struct.ICompressProgressInfo = type { %struct.IUnknown }
%struct.IUnknown = type { ptr }
%class.CMyUnknownImp = type { i32 }
%class.CBenchProgressStatus = type { i32, i8 }

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z13SetFinishTimeRK10CBenchInfoRS_(ptr noundef nonnull align 8 dereferenceable(52), ptr noundef nonnull align 8 dereferenceable(52)) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN18CBenchProgressInfo12SetRatioInfoEPKyS1_(ptr noundef nonnull align 8 dereferenceable(96) %0, ptr noundef %1, ptr noundef %2) unnamed_addr #2 align 2 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %struct.CBenchInfo, 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
  %11 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %12 = getelementptr inbounds %class.CBenchProgressInfo, ptr %11, i32 0, i32 2
  %13 = load ptr, ptr %12, align 8, !tbaa !9
  %14 = call noundef i32 @_ZN20CBenchProgressStatus9GetResultEv(ptr noundef nonnull align 4 dereferenceable(8) %13)
  store i32 %14, ptr %8, align 4, !tbaa !17
  %15 = load i32, ptr %8, align 4, !tbaa !17
  %16 = icmp ne i32 %15, 0
  br i1 %16, label %17, label %19

17:                                               ; preds = %3
  %18 = load i32, ptr %8, align 4, !tbaa !17
  store i32 %18, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %76

19:                                               ; preds = %3
  %20 = getelementptr inbounds %class.CBenchProgressInfo, ptr %11, i32 0, i32 5
  %21 = load ptr, ptr %20, align 8, !tbaa !18
  %22 = icmp ne ptr %21, null
  br i1 %22, label %25, label %23

23:                                               ; preds = %19
  %24 = load i32, ptr %8, align 4, !tbaa !17
  store i32 %24, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %76

25:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 56, ptr %10) #4
  %26 = getelementptr inbounds %class.CBenchProgressInfo, ptr %11, i32 0, i32 3
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %26, i64 56, i1 false), !tbaa.struct !19
  %27 = getelementptr inbounds %class.CBenchProgressInfo, ptr %11, i32 0, i32 3
  call void @_Z13SetFinishTimeRK10CBenchInfoRS_(ptr noundef nonnull align 8 dereferenceable(52) %27, ptr noundef nonnull align 8 dereferenceable(52) %10)
  %28 = getelementptr inbounds %class.CBenchProgressInfo, ptr %11, i32 0, i32 2
  %29 = load ptr, ptr %28, align 8, !tbaa !9
  %30 = getelementptr inbounds %class.CBenchProgressStatus, ptr %29, i32 0, i32 1
  %31 = load i8, ptr %30, align 4, !tbaa !21, !range !24, !noundef !25
  %32 = trunc i8 %31 to i1
  br i1 %32, label %33, label %46

33:                                               ; preds = %25
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = load i64, ptr %34, align 8, !tbaa !20
  %36 = getelementptr inbounds %struct.CBenchInfo, ptr %10, i32 0, i32 4
  store i64 %35, ptr %36, align 8, !tbaa !26
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = load i64, ptr %37, align 8, !tbaa !20
  %39 = getelementptr inbounds %struct.CBenchInfo, ptr %10, i32 0, i32 5
  store i64 %38, ptr %39, align 8, !tbaa !27
  %40 = getelementptr inbounds %class.CBenchProgressInfo, ptr %11, i32 0, i32 5
  %41 = load ptr, ptr %40, align 8, !tbaa !18
  %42 = load ptr, ptr %41, align 8, !tbaa !28
  %43 = getelementptr inbounds ptr, ptr %42, i64 0
  %44 = load ptr, ptr %43, align 8
  %45 = call noundef i32 %44(ptr noundef nonnull align 8 dereferenceable(8) %41, ptr noundef nonnull align 8 dereferenceable(52) %10, i1 noundef zeroext false)
  store i32 %45, ptr %8, align 4, !tbaa !17
  br label %67

46:                                               ; preds = %25
  %47 = getelementptr inbounds %class.CBenchProgressInfo, ptr %11, i32 0, i32 3
  %48 = getelementptr inbounds %struct.CBenchInfo, ptr %47, i32 0, i32 5
  %49 = load i64, ptr %48, align 8, !tbaa !30
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = load i64, ptr %50, align 8, !tbaa !20
  %52 = add i64 %49, %51
  %53 = getelementptr inbounds %struct.CBenchInfo, ptr %10, i32 0, i32 5
  store i64 %52, ptr %53, align 8, !tbaa !27
  %54 = getelementptr inbounds %class.CBenchProgressInfo, ptr %11, i32 0, i32 3
  %55 = getelementptr inbounds %struct.CBenchInfo, ptr %54, i32 0, i32 4
  %56 = load i64, ptr %55, align 8, !tbaa !31
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  %58 = load i64, ptr %57, align 8, !tbaa !20
  %59 = add i64 %56, %58
  %60 = getelementptr inbounds %struct.CBenchInfo, ptr %10, i32 0, i32 4
  store i64 %59, ptr %60, align 8, !tbaa !26
  %61 = getelementptr inbounds %class.CBenchProgressInfo, ptr %11, i32 0, i32 5
  %62 = load ptr, ptr %61, align 8, !tbaa !18
  %63 = load ptr, ptr %62, align 8, !tbaa !28
  %64 = getelementptr inbounds ptr, ptr %63, i64 1
  %65 = load ptr, ptr %64, align 8
  %66 = call noundef i32 %65(ptr noundef nonnull align 8 dereferenceable(8) %62, ptr noundef nonnull align 8 dereferenceable(52) %10, i1 noundef zeroext false)
  store i32 %66, ptr %8, align 4, !tbaa !17
  br label %67

67:                                               ; preds = %46, %33
  %68 = load i32, ptr %8, align 4, !tbaa !17
  %69 = icmp ne i32 %68, 0
  br i1 %69, label %70, label %74

70:                                               ; preds = %67
  %71 = getelementptr inbounds %class.CBenchProgressInfo, ptr %11, i32 0, i32 2
  %72 = load ptr, ptr %71, align 8, !tbaa !9
  %73 = load i32, ptr %8, align 4, !tbaa !17
  call void @_ZN20CBenchProgressStatus9SetResultEi(ptr noundef nonnull align 4 dereferenceable(8) %72, i32 noundef %73)
  br label %74

74:                                               ; preds = %70, %67
  %75 = load i32, ptr %8, align 4, !tbaa !17
  store i32 %75, ptr %4, align 4
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 56, ptr %10) #4
  br label %76

76:                                               ; preds = %74, %23, %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  %77 = load i32, ptr %4, align 4
  ret i32 %77
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN20CBenchProgressStatus9GetResultEv(ptr noundef nonnull align 4 dereferenceable(8)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN20CBenchProgressStatus9SetResultEi(ptr noundef nonnull align 4 dereferenceable(8), i32 noundef) #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { 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, !6, i64 16}
!10 = !{!"_ZTS18CBenchProgressInfo", !11, i64 0, !13, i64 8, !6, i64 16, !15, i64 24, !14, i64 80, !6, i64 88}
!11 = !{!"_ZTS21ICompressProgressInfo", !12, i64 0}
!12 = !{!"_ZTS8IUnknown"}
!13 = !{!"_ZTS13CMyUnknownImp", !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!"_ZTS10CBenchInfo", !16, i64 0, !16, i64 8, !16, i64 16, !16, i64 24, !16, i64 32, !16, i64 40, !14, i64 48}
!16 = !{!"long long", !7, i64 0}
!17 = !{!14, !14, i64 0}
!18 = !{!10, !6, i64 88}
!19 = !{i64 0, i64 8, !20, i64 8, i64 8, !20, i64 16, i64 8, !20, i64 24, i64 8, !20, i64 32, i64 8, !20, i64 40, i64 8, !20, i64 48, i64 4, !17}
!20 = !{!16, !16, i64 0}
!21 = !{!22, !23, i64 4}
!22 = !{!"_ZTS20CBenchProgressStatus", !14, i64 0, !23, i64 4}
!23 = !{!"bool", !7, i64 0}
!24 = !{i8 0, i8 2}
!25 = !{}
!26 = !{!15, !16, i64 32}
!27 = !{!15, !16, i64 40}
!28 = !{!29, !29, i64 0}
!29 = !{!"vtable pointer", !8, i64 0}
!30 = !{!10, !16, i64 64}
!31 = !{!10, !16, i64 56}


; 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.CBenchInfo = type <{ i64, i64, i64, i64, i64, i64, i32, [4 x i8] }>

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

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z13SetFinishTimeRK10CBenchInfoRS_(ptr noundef nonnull align 8 dereferenceable(52), ptr noundef nonnull align 8 dereferenceable(52)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN18CBenchProgressInfo12SetRatioInfoEPKyS1_(ptr noundef nonnull align 8 dereferenceable(96) %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2) unnamed_addr #2 align 2 {
  %4 = alloca %struct.CBenchInfo, align 8
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %7 = tail call noundef i32 @_ZN20CBenchProgressStatus9GetResultEv(ptr noundef nonnull align 4 dereferenceable(8) %6)
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %8, label %43

8:                                                ; preds = %3
  %9 = getelementptr inbounds i8, ptr %0, i64 88
  %10 = load ptr, ptr %9, align 8, !tbaa !16
  %.not13 = icmp eq ptr %10, null
  br i1 %.not13, label %43, label %11

11:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %4) #4
  %12 = getelementptr inbounds i8, ptr %0, i64 24
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(56) %4, ptr noundef nonnull align 8 dereferenceable(56) %12, i64 56, i1 false), !tbaa.struct !17
  call void @_Z13SetFinishTimeRK10CBenchInfoRS_(ptr noundef nonnull align 8 dereferenceable(52) %12, ptr noundef nonnull align 8 dereferenceable(52) %4)
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %13, i64 4
  %15 = load i8, ptr %14, align 4, !tbaa !20, !range !23, !noundef !24
  %16 = trunc nuw i8 %15 to i1
  %17 = getelementptr inbounds i8, ptr %4, i64 40
  br i1 %16, label %18, label %24

18:                                               ; preds = %11
  %19 = load i64, ptr %1, align 8, !tbaa !18
  %20 = getelementptr inbounds i8, ptr %4, i64 32
  store i64 %19, ptr %20, align 8, !tbaa !25
  %21 = load i64, ptr %2, align 8, !tbaa !18
  store i64 %21, ptr %17, align 8, !tbaa !26
  %22 = load ptr, ptr %9, align 8, !tbaa !16
  %23 = load ptr, ptr %22, align 8, !tbaa !27
  br label %37

24:                                               ; preds = %11
  %25 = getelementptr inbounds i8, ptr %0, i64 64
  %26 = load i64, ptr %25, align 8, !tbaa !29
  %27 = load i64, ptr %1, align 8, !tbaa !18
  %28 = add i64 %27, %26
  store i64 %28, ptr %17, align 8, !tbaa !26
  %29 = getelementptr inbounds i8, ptr %0, i64 56
  %30 = load i64, ptr %29, align 8, !tbaa !30
  %31 = load i64, ptr %2, align 8, !tbaa !18
  %32 = add i64 %31, %30
  %33 = getelementptr inbounds i8, ptr %4, i64 32
  store i64 %32, ptr %33, align 8, !tbaa !25
  %34 = load ptr, ptr %9, align 8, !tbaa !16
  %35 = load ptr, ptr %34, align 8, !tbaa !27
  %36 = getelementptr inbounds i8, ptr %35, i64 8
  br label %37

37:                                               ; preds = %24, %18
  %.sink16 = phi ptr [ %36, %24 ], [ %23, %18 ]
  %.sink = phi ptr [ %34, %24 ], [ %22, %18 ]
  %38 = load ptr, ptr %.sink16, align 8
  %39 = call noundef i32 %38(ptr noundef nonnull align 8 dereferenceable(8) %.sink, ptr noundef nonnull align 8 dereferenceable(52) %4, i1 noundef zeroext false)
  %.not14 = icmp eq i32 %39, 0
  br i1 %.not14, label %42, label %40

40:                                               ; preds = %37
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN20CBenchProgressStatus9SetResultEi(ptr noundef nonnull align 4 dereferenceable(8) %41, i32 noundef %39)
  br label %42

42:                                               ; preds = %40, %37
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %4) #4
  br label %43

43:                                               ; preds = %8, %3, %42
  %.011 = phi i32 [ %39, %42 ], [ %7, %3 ], [ 0, %8 ]
  ret i32 %.011
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN20CBenchProgressStatus9GetResultEv(ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN20CBenchProgressStatus9SetResultEi(ptr noundef nonnull align 4 dereferenceable(8), i32 noundef) local_unnamed_addr #3 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { 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, !13, i64 16}
!6 = !{!"_ZTS18CBenchProgressInfo", !7, i64 0, !9, i64 8, !13, i64 16, !14, i64 24, !10, i64 80, !13, i64 88}
!7 = !{!"_ZTS21ICompressProgressInfo", !8, i64 0}
!8 = !{!"_ZTS8IUnknown"}
!9 = !{!"_ZTS13CMyUnknownImp", !10, i64 0}
!10 = !{!"int", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C++ TBAA"}
!13 = !{!"any pointer", !11, i64 0}
!14 = !{!"_ZTS10CBenchInfo", !15, i64 0, !15, i64 8, !15, i64 16, !15, i64 24, !15, i64 32, !15, i64 40, !10, i64 48}
!15 = !{!"long long", !11, i64 0}
!16 = !{!6, !13, i64 88}
!17 = !{i64 0, i64 8, !18, i64 8, i64 8, !18, i64 16, i64 8, !18, i64 24, i64 8, !18, i64 32, i64 8, !18, i64 40, i64 8, !18, i64 48, i64 4, !19}
!18 = !{!15, !15, i64 0}
!19 = !{!10, !10, i64 0}
!20 = !{!21, !22, i64 4}
!21 = !{!"_ZTS20CBenchProgressStatus", !10, i64 0, !22, i64 4}
!22 = !{!"bool", !11, i64 0}
!23 = !{i8 0, i8 2}
!24 = !{}
!25 = !{!14, !15, i64 32}
!26 = !{!14, !15, i64 40}
!27 = !{!28, !28, i64 0}
!28 = !{!"vtable pointer", !12, i64 0}
!29 = !{!6, !15, i64 64}
!30 = !{!6, !15, i64 56}


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