; LLVM IR from SSBMTonberry/pocketlzma :: ref_spec/lzma1900/CPP/7zip/Compress (PpmdEncoder)

; 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.ISzAlloc = type { ptr, ptr }
%"class.NCompress::NPpmd::CEncoder" = type <{ %struct.ICompressCoder, %struct.ICompressSetCoderProperties, %struct.ICompressWriteCoderProperties, %class.CMyUnknownImp, [4 x i8], ptr, %struct.CByteOutBufWrap, %struct.CPpmd7z_RangeEnc, %struct.CPpmd7, %"struct.NCompress::NPpmd::CEncProps", [4 x i8] }>
%struct.ICompressCoder = type { %struct.IUnknown }
%struct.IUnknown = type { ptr }
%struct.ICompressSetCoderProperties = type { %struct.IUnknown }
%struct.ICompressWriteCoderProperties = type { %struct.IUnknown }
%class.CMyUnknownImp = type { i32 }
%struct.CByteOutBufWrap = type <{ %struct.IByteOut, ptr, ptr, ptr, i64, ptr, i64, i32, [4 x i8] }>
%struct.IByteOut = type { ptr }
%struct.CPpmd7z_RangeEnc = type { i64, i32, i8, i64, ptr }
%struct.CPpmd7 = type { ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, i32, [38 x i8], [128 x i8], [38 x i32], [256 x i8], [256 x i8], [256 x i8], %struct.CPpmd_See, [25 x [16 x %struct.CPpmd_See]], [128 x [64 x i16]] }
%struct.CPpmd_See = type { i16, i8, i8 }
%"struct.NCompress::NPpmd::CEncProps" = type { i32, i32, i32 }

@g_BigAlloc = external global %struct.ISzAlloc, align 8

; 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: mustprogress uwtable
define dso_local noundef i32 @_ZN9NCompress5NPpmd8CEncoder4CodeEP19ISequentialInStreamP20ISequentialOutStreamPKyS7_P21ICompressProgressInfo(ptr noundef nonnull align 8 dereferenceable(19332) %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) unnamed_addr #1 align 2 {
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i64, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i64, align 8
  %21 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  %22 = load ptr, ptr %8, align 8
  %23 = getelementptr inbounds %"class.NCompress::NPpmd::CEncoder", ptr %22, i32 0, i32 5
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  %25 = icmp ne ptr %24, null
  br i1 %25, label %34, label %26

26:                                               ; preds = %6
  %27 = call ptr @MyAlloc(i64 noundef 1048576)
  %28 = getelementptr inbounds %"class.NCompress::NPpmd::CEncoder", ptr %22, i32 0, i32 5
  store ptr %27, ptr %28, align 8, !tbaa !9
  %29 = getelementptr inbounds %"class.NCompress::NPpmd::CEncoder", ptr %22, i32 0, i32 5
  %30 = load ptr, ptr %29, align 8, !tbaa !9
  %31 = icmp ne ptr %30, null
  br i1 %31, label %33, label %32

32:                                               ; preds = %26
  store i32 -2147024882, ptr %7, align 4
  br label %141

33:                                               ; preds = %26
  br label %34

34:                                               ; preds = %33, %6
  %35 = getelementptr inbounds %"class.NCompress::NPpmd::CEncoder", ptr %22, i32 0, i32 6
  %36 = call noundef zeroext i1 @_ZN15CByteOutBufWrap5AllocEm(ptr noundef nonnull align 8 dereferenceable(60) %35, i64 noundef 1048576) #5
  br i1 %36, label %38, label %37

37:                                               ; preds = %34
  store i32 -2147024882, ptr %7, align 4
  br label %141

38:                                               ; preds = %34
  %39 = getelementptr inbounds %"class.NCompress::NPpmd::CEncoder", ptr %22, i32 0, i32 8
  %40 = getelementptr inbounds %"class.NCompress::NPpmd::CEncoder", ptr %22, i32 0, i32 9
  %41 = getelementptr inbounds %"struct.NCompress::NPpmd::CEncProps", ptr %40, i32 0, i32 0
  %42 = load i32, ptr %41, align 8, !tbaa !26
  %43 = call i32 @Ppmd7_Alloc(ptr noundef %39, i32 noundef %42, ptr noundef @g_BigAlloc)
  %44 = icmp ne i32 %43, 0
  br i1 %44, label %46, label %45

45:                                               ; preds = %38
  store i32 -2147024882, ptr %7, align 4
  br label %141

46:                                               ; preds = %38
  %47 = load ptr, ptr %10, align 8, !tbaa !5
  %48 = getelementptr inbounds %"class.NCompress::NPpmd::CEncoder", ptr %22, i32 0, i32 6
  %49 = getelementptr inbounds %struct.CByteOutBufWrap, ptr %48, i32 0, i32 5
  store ptr %47, ptr %49, align 8, !tbaa !27
  %50 = getelementptr inbounds %"class.NCompress::NPpmd::CEncoder", ptr %22, i32 0, i32 6
  call void @_ZN15CByteOutBufWrap4InitEv(ptr noundef nonnull align 8 dereferenceable(60) %50)
  %51 = getelementptr inbounds %"class.NCompress::NPpmd::CEncoder", ptr %22, i32 0, i32 7
  call void @Ppmd7z_RangeEnc_Init(ptr noundef %51)
  %52 = getelementptr inbounds %"class.NCompress::NPpmd::CEncoder", ptr %22, i32 0, i32 8
  %53 = getelementptr inbounds %"class.NCompress::NPpmd::CEncoder", ptr %22, i32 0, i32 9
  %54 = getelementptr inbounds %"struct.NCompress::NPpmd::CEncProps", ptr %53, i32 0, i32 2
  %55 = load i32, ptr %54, align 8, !tbaa !28
  call void @Ppmd7_Init(ptr noundef %52, i32 noundef %55)
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  store i64 0, ptr %14, align 8, !tbaa !29
  br label %56

56:                                               ; preds = %139, %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %57 = load ptr, ptr %9, align 8, !tbaa !5
  %58 = getelementptr inbounds %"class.NCompress::NPpmd::CEncoder", ptr %22, i32 0, i32 5
  %59 = load ptr, ptr %58, align 8, !tbaa !9
  %60 = load ptr, ptr %57, align 8, !tbaa !30
  %61 = getelementptr inbounds ptr, ptr %60, i64 5
  %62 = load ptr, ptr %61, align 8
  %63 = call noundef i32 %62(ptr noundef nonnull align 8 dereferenceable(8) %57, ptr noundef %59, i32 noundef 1048576, ptr noundef %15)
  store i32 %63, ptr %16, align 4, !tbaa !32
  %64 = load i32, ptr %16, align 4, !tbaa !32
  %65 = icmp ne i32 %64, 0
  br i1 %65, label %66, label %68

66:                                               ; preds = %56
  %67 = load i32, ptr %16, align 4, !tbaa !32
  store i32 %67, ptr %7, align 4
  store i32 1, ptr %17, align 4
  br label %69

68:                                               ; preds = %56
  store i32 0, ptr %17, align 4
  br label %69

69:                                               ; preds = %68, %66
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  %70 = load i32, ptr %17, align 4
  switch i32 %70, label %137 [
    i32 0, label %71
  ]

71:                                               ; preds = %69
  %72 = load i32, ptr %15, align 4, !tbaa !32
  %73 = icmp eq i32 %72, 0
  br i1 %73, label %74, label %78

74:                                               ; preds = %71
  %75 = getelementptr inbounds %"class.NCompress::NPpmd::CEncoder", ptr %22, i32 0, i32 7
  call void @Ppmd7z_RangeEnc_FlushData(ptr noundef %75)
  %76 = getelementptr inbounds %"class.NCompress::NPpmd::CEncoder", ptr %22, i32 0, i32 6
  %77 = call noundef i32 @_ZN15CByteOutBufWrap5FlushEv(ptr noundef nonnull align 8 dereferenceable(60) %76) #5
  store i32 %77, ptr %7, align 4
  store i32 1, ptr %17, align 4
  br label %137

78:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  store i32 0, ptr %18, align 4, !tbaa !32
  br label %79

79:                                               ; preds = %105, %78
  %80 = load i32, ptr %18, align 4, !tbaa !32
  %81 = load i32, ptr %15, align 4, !tbaa !32
  %82 = icmp ult i32 %80, %81
  br i1 %82, label %84, label %83

83:                                               ; preds = %79
  store i32 4, ptr %17, align 4
  br label %108

84:                                               ; preds = %79
  %85 = getelementptr inbounds %"class.NCompress::NPpmd::CEncoder", ptr %22, i32 0, i32 8
  %86 = getelementptr inbounds %"class.NCompress::NPpmd::CEncoder", ptr %22, i32 0, i32 7
  %87 = getelementptr inbounds %"class.NCompress::NPpmd::CEncoder", ptr %22, i32 0, i32 5
  %88 = load ptr, ptr %87, align 8, !tbaa !9
  %89 = load i32, ptr %18, align 4, !tbaa !32
  %90 = zext i32 %89 to i64
  %91 = getelementptr inbounds i8, ptr %88, i64 %90
  %92 = load i8, ptr %91, align 1, !tbaa !33
  %93 = zext i8 %92 to i32
  call void @Ppmd7_EncodeSymbol(ptr noundef %85, ptr noundef %86, i32 noundef %93)
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  %94 = getelementptr inbounds %"class.NCompress::NPpmd::CEncoder", ptr %22, i32 0, i32 6
  %95 = getelementptr inbounds %struct.CByteOutBufWrap, ptr %94, i32 0, i32 7
  %96 = load i32, ptr %95, align 8, !tbaa !34
  store i32 %96, ptr %19, align 4, !tbaa !32
  %97 = load i32, ptr %19, align 4, !tbaa !32
  %98 = icmp ne i32 %97, 0
  br i1 %98, label %99, label %101

99:                                               ; preds = %84
  %100 = load i32, ptr %19, align 4, !tbaa !32
  store i32 %100, ptr %7, align 4
  store i32 1, ptr %17, align 4
  br label %102

101:                                              ; preds = %84
  store i32 0, ptr %17, align 4
  br label %102

102:                                              ; preds = %101, %99
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  %103 = load i32, ptr %17, align 4
  switch i32 %103, label %108 [
    i32 0, label %104
  ]

104:                                              ; preds = %102
  br label %105

105:                                              ; preds = %104
  %106 = load i32, ptr %18, align 4, !tbaa !32
  %107 = add i32 %106, 1
  store i32 %107, ptr %18, align 4, !tbaa !32
  br label %79, !llvm.loop !35

108:                                              ; preds = %102, %83
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  %109 = load i32, ptr %17, align 4
  switch i32 %109, label %137 [
    i32 4, label %110
  ]

110:                                              ; preds = %108
  %111 = load i32, ptr %15, align 4, !tbaa !32
  %112 = zext i32 %111 to i64
  %113 = load i64, ptr %14, align 8, !tbaa !29
  %114 = add i64 %113, %112
  store i64 %114, ptr %14, align 8, !tbaa !29
  %115 = load ptr, ptr %13, align 8, !tbaa !5
  %116 = icmp ne ptr %115, null
  br i1 %116, label %117, label %136

117:                                              ; preds = %110
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %118 = getelementptr inbounds %"class.NCompress::NPpmd::CEncoder", ptr %22, i32 0, i32 6
  %119 = call noundef i64 @_ZNK15CByteOutBufWrap12GetProcessedEv(ptr noundef nonnull align 8 dereferenceable(60) %118)
  store i64 %119, ptr %20, align 8, !tbaa !29
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  %120 = load ptr, ptr %13, align 8, !tbaa !5
  %121 = load ptr, ptr %120, align 8, !tbaa !30
  %122 = getelementptr inbounds ptr, ptr %121, i64 5
  %123 = load ptr, ptr %122, align 8
  %124 = call noundef i32 %123(ptr noundef nonnull align 8 dereferenceable(8) %120, ptr noundef %14, ptr noundef %20)
  store i32 %124, ptr %21, align 4, !tbaa !32
  %125 = load i32, ptr %21, align 4, !tbaa !32
  %126 = icmp ne i32 %125, 0
  br i1 %126, label %127, label %129

127:                                              ; preds = %117
  %128 = load i32, ptr %21, align 4, !tbaa !32
  store i32 %128, ptr %7, align 4
  store i32 1, ptr %17, align 4
  br label %130

129:                                              ; preds = %117
  store i32 0, ptr %17, align 4
  br label %130

130:                                              ; preds = %129, %127
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  %131 = load i32, ptr %17, align 4
  switch i32 %131, label %133 [
    i32 0, label %132
  ]

132:                                              ; preds = %130
  store i32 0, ptr %17, align 4
  br label %133

133:                                              ; preds = %132, %130
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  %134 = load i32, ptr %17, align 4
  switch i32 %134, label %137 [
    i32 0, label %135
  ]

135:                                              ; preds = %133
  br label %136

136:                                              ; preds = %135, %110
  store i32 0, ptr %17, align 4
  br label %137

137:                                              ; preds = %136, %133, %108, %74, %69
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  %138 = load i32, ptr %17, align 4
  switch i32 %138, label %140 [
    i32 0, label %139
  ]

139:                                              ; preds = %137
  br label %56, !llvm.loop !37

140:                                              ; preds = %137
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %141

141:                                              ; preds = %140, %45, %37, %32
  %142 = load i32, ptr %7, align 4
  ret i32 %142
}

declare ptr @MyAlloc(i64 noundef) #2

; Function Attrs: nounwind
declare noundef zeroext i1 @_ZN15CByteOutBufWrap5AllocEm(ptr noundef nonnull align 8 dereferenceable(60), i64 noundef) #3

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN15CByteOutBufWrap4InitEv(ptr noundef nonnull align 8 dereferenceable(60)) #4 align 2

declare void @Ppmd7z_RangeEnc_Init(ptr noundef) #2

declare void @Ppmd7_Init(ptr noundef, i32 noundef) #2

declare void @Ppmd7z_RangeEnc_FlushData(ptr noundef) #2

; Function Attrs: nounwind
declare noundef i32 @_ZN15CByteOutBufWrap5FlushEv(ptr noundef nonnull align 8 dereferenceable(60)) #3

declare void @Ppmd7_EncodeSymbol(ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK15CByteOutBufWrap12GetProcessedEv(ptr noundef nonnull align 8 dereferenceable(60)) #4 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 "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 = { 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 #5 = { 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 32}
!10 = !{!"_ZTSN9NCompress5NPpmd8CEncoderE", !11, i64 0, !13, i64 8, !14, i64 16, !15, i64 24, !6, i64 32, !17, i64 40, !21, i64 104, !22, i64 136, !25, i64 19320}
!11 = !{!"_ZTS14ICompressCoder", !12, i64 0}
!12 = !{!"_ZTS8IUnknown"}
!13 = !{!"_ZTS27ICompressSetCoderProperties", !12, i64 0}
!14 = !{!"_ZTS29ICompressWriteCoderProperties", !12, i64 0}
!15 = !{!"_ZTS13CMyUnknownImp", !16, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = !{!"_ZTS15CByteOutBufWrap", !18, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !19, i64 32, !6, i64 40, !20, i64 48, !16, i64 56}
!18 = !{!"_ZTS8IByteOut", !6, i64 0}
!19 = !{!"long", !7, i64 0}
!20 = !{!"long long", !7, i64 0}
!21 = !{!"_ZTS16CPpmd7z_RangeEnc", !20, i64 0, !16, i64 8, !7, i64 12, !20, i64 16, !6, i64 24}
!22 = !{!"_ZTS6CPpmd7", !6, i64 0, !6, i64 8, !6, i64 16, !16, i64 24, !16, i64 28, !16, i64 32, !16, i64 36, !16, i64 40, !16, i64 44, !16, i64 48, !16, i64 52, !16, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !16, i64 104, !7, i64 108, !7, i64 146, !7, i64 276, !7, i64 428, !7, i64 684, !7, i64 940, !23, i64 1196, !7, i64 1200, !7, i64 2800}
!23 = !{!"_ZTS9CPpmd_See", !24, i64 0, !7, i64 2, !7, i64 3}
!24 = !{!"short", !7, i64 0}
!25 = !{!"_ZTSN9NCompress5NPpmd9CEncPropsE", !16, i64 0, !16, i64 4, !16, i64 8}
!26 = !{!10, !16, i64 19320}
!27 = !{!10, !6, i64 80}
!28 = !{!10, !16, i64 19328}
!29 = !{!20, !20, i64 0}
!30 = !{!31, !31, i64 0}
!31 = !{!"vtable pointer", !8, i64 0}
!32 = !{!16, !16, i64 0}
!33 = !{!7, !7, i64 0}
!34 = !{!10, !16, i64 96}
!35 = distinct !{!35, !36}
!36 = !{!"llvm.loop.mustprogress"}
!37 = distinct !{!37, !36}


; 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.ISzAlloc = type { ptr, ptr }

@g_BigAlloc = external global %struct.ISzAlloc, align 8

; 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 uwtable
define dso_local noundef i32 @_ZN9NCompress5NPpmd8CEncoder4CodeEP19ISequentialInStreamP20ISequentialOutStreamPKyS7_P21ICompressProgressInfo(ptr noundef nonnull align 8 dereferenceable(19332) %0, ptr noundef %1, ptr noundef %2, ptr nocapture noundef readnone %3, ptr nocapture noundef readnone %4, ptr noundef %5) unnamed_addr #1 align 2 {
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = getelementptr inbounds i8, ptr %0, i64 32
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %.not = icmp eq ptr %11, null
  br i1 %.not, label %12, label %14

12:                                               ; preds = %6
  %13 = tail call ptr @MyAlloc(i64 noundef 1048576)
  store ptr %13, ptr %10, align 8, !tbaa !5
  %.not35 = icmp eq ptr %13, null
  br i1 %.not35, label %73, label %14

14:                                               ; preds = %12, %6
  %15 = getelementptr inbounds i8, ptr %0, i64 40
  %16 = tail call noundef zeroext i1 @_ZN15CByteOutBufWrap5AllocEm(ptr noundef nonnull align 8 dereferenceable(60) %15, i64 noundef 1048576) #5
  br i1 %16, label %17, label %73

17:                                               ; preds = %14
  %18 = getelementptr inbounds i8, ptr %0, i64 136
  %19 = getelementptr inbounds i8, ptr %0, i64 19320
  %20 = load i32, ptr %19, align 8, !tbaa !25
  %21 = tail call i32 @Ppmd7_Alloc(ptr noundef nonnull %18, i32 noundef %20, ptr noundef nonnull @g_BigAlloc)
  %.not36 = icmp eq i32 %21, 0
  br i1 %.not36, label %73, label %22

22:                                               ; preds = %17
  %23 = getelementptr inbounds i8, ptr %0, i64 80
  store ptr %2, ptr %23, align 8, !tbaa !26
  tail call void @_ZN15CByteOutBufWrap4InitEv(ptr noundef nonnull align 8 dereferenceable(60) %15)
  %24 = getelementptr inbounds i8, ptr %0, i64 104
  tail call void @Ppmd7z_RangeEnc_Init(ptr noundef nonnull %24)
  %25 = getelementptr inbounds i8, ptr %0, i64 19328
  %26 = load i32, ptr %25, align 8, !tbaa !27
  tail call void @Ppmd7_Init(ptr noundef nonnull %18, i32 noundef %26)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  store i64 0, ptr %7, align 8, !tbaa !28
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #5
  %27 = load ptr, ptr %10, align 8, !tbaa !5
  %28 = load ptr, ptr %1, align 8, !tbaa !29
  %29 = getelementptr inbounds i8, ptr %28, i64 40
  %30 = load ptr, ptr %29, align 8
  %31 = call noundef i32 %30(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef %27, i32 noundef 1048576, ptr noundef nonnull %8)
  %.not3755 = icmp eq i32 %31, 0
  br i1 %.not3755, label %.lr.ph57, label %.thread43

.lr.ph57:                                         ; preds = %22
  %32 = getelementptr inbounds i8, ptr %0, i64 96
  %.not40 = icmp eq ptr %5, null
  br i1 %.not40, label %.lr.ph57.split.us, label %.lr.ph57.split

.lr.ph57.split.us:                                ; preds = %.lr.ph57, %.backedge.us
  %33 = phi i64 [ %39, %.backedge.us ], [ 0, %.lr.ph57 ]
  %34 = load i32, ptr %8, align 4, !tbaa !31
  %35 = icmp eq i32 %34, 0
  br i1 %35, label %.split.us, label %.lr.ph.us

36:                                               ; preds = %.lr.ph.us
  %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
  %37 = load i32, ptr %8, align 4, !tbaa !31
  %38 = zext i32 %37 to i64
  %.not39.us = icmp ult i64 %indvars.iv.next72, %38
  br i1 %.not39.us, label %.lr.ph.us, label %.backedge.us, !llvm.loop !32

.backedge.us:                                     ; preds = %36
  %39 = add i64 %33, %38
  store i64 %39, ptr %7, align 8, !tbaa !28
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #5
  %40 = load ptr, ptr %10, align 8, !tbaa !5
  %41 = load ptr, ptr %1, align 8, !tbaa !29
  %42 = getelementptr inbounds i8, ptr %41, i64 40
  %43 = load ptr, ptr %42, align 8
  %44 = call noundef i32 %43(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef %40, i32 noundef 1048576, ptr noundef nonnull %8)
  %.not37.us = icmp eq i32 %44, 0
  br i1 %.not37.us, label %.lr.ph57.split.us, label %.thread43, !llvm.loop !34

.lr.ph.us:                                        ; preds = %.lr.ph57.split.us, %36
  %indvars.iv71 = phi i64 [ %indvars.iv.next72, %36 ], [ 0, %.lr.ph57.split.us ]
  %45 = load ptr, ptr %10, align 8, !tbaa !5
  %46 = getelementptr inbounds i8, ptr %45, i64 %indvars.iv71
  %47 = load i8, ptr %46, align 1, !tbaa !35
  %48 = zext i8 %47 to i32
  call void @Ppmd7_EncodeSymbol(ptr noundef nonnull %18, ptr noundef nonnull %24, i32 noundef %48)
  %49 = load i32, ptr %32, align 8, !tbaa !36
  %.not38.us = icmp eq i32 %49, 0
  br i1 %.not38.us, label %36, label %.thread43

.lr.ph57.split:                                   ; preds = %.lr.ph57, %.backedge
  %50 = load i32, ptr %8, align 4, !tbaa !31
  %51 = icmp eq i32 %50, 0
  br i1 %51, label %.split.us, label %.lr.ph

.split.us:                                        ; preds = %.lr.ph57.split, %.lr.ph57.split.us
  call void @Ppmd7z_RangeEnc_FlushData(ptr noundef nonnull %24)
  %52 = call noundef i32 @_ZN15CByteOutBufWrap5FlushEv(ptr noundef nonnull align 8 dereferenceable(60) %15) #5
  br label %.thread43

53:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %54 = load i32, ptr %8, align 4, !tbaa !31
  %55 = zext i32 %54 to i64
  %.not39 = icmp ult i64 %indvars.iv.next, %55
  br i1 %.not39, label %.lr.ph, label %._crit_edge, !llvm.loop !32

.lr.ph:                                           ; preds = %.lr.ph57.split, %53
  %indvars.iv = phi i64 [ %indvars.iv.next, %53 ], [ 0, %.lr.ph57.split ]
  %56 = load ptr, ptr %10, align 8, !tbaa !5
  %57 = getelementptr inbounds i8, ptr %56, i64 %indvars.iv
  %58 = load i8, ptr %57, align 1, !tbaa !35
  %59 = zext i8 %58 to i32
  call void @Ppmd7_EncodeSymbol(ptr noundef nonnull %18, ptr noundef nonnull %24, i32 noundef %59)
  %60 = load i32, ptr %32, align 8, !tbaa !36
  %.not38 = icmp eq i32 %60, 0
  br i1 %.not38, label %53, label %.thread43

._crit_edge:                                      ; preds = %53
  %61 = load i64, ptr %7, align 8, !tbaa !28
  %62 = add i64 %61, %55
  store i64 %62, ptr %7, align 8, !tbaa !28
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #5
  %63 = call noundef i64 @_ZNK15CByteOutBufWrap12GetProcessedEv(ptr noundef nonnull align 8 dereferenceable(60) %15)
  store i64 %63, ptr %9, align 8, !tbaa !28
  %64 = load ptr, ptr %5, align 8, !tbaa !29
  %65 = getelementptr inbounds i8, ptr %64, i64 40
  %66 = load ptr, ptr %65, align 8
  %67 = call noundef i32 %66(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull %7, ptr noundef nonnull %9)
  %.not41 = icmp eq i32 %67, 0
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  br i1 %.not41, label %.backedge, label %.loopexit

.backedge:                                        ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #5
  %68 = load ptr, ptr %10, align 8, !tbaa !5
  %69 = load ptr, ptr %1, align 8, !tbaa !29
  %70 = getelementptr inbounds i8, ptr %69, i64 40
  %71 = load ptr, ptr %70, align 8
  %72 = call noundef i32 %71(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef %68, i32 noundef 1048576, ptr noundef nonnull %8)
  %.not37 = icmp eq i32 %72, 0
  br i1 %.not37, label %.lr.ph57.split, label %.thread43, !llvm.loop !34

.thread43:                                        ; preds = %.backedge, %.lr.ph, %.backedge.us, %.lr.ph.us, %22, %.split.us
  %.7.ph = phi i32 [ %52, %.split.us ], [ %31, %22 ], [ %49, %.lr.ph.us ], [ %44, %.backedge.us ], [ %60, %.lr.ph ], [ %72, %.backedge ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  br label %.loopexit

.loopexit:                                        ; preds = %._crit_edge, %.thread43
  %.746 = phi i32 [ %.7.ph, %.thread43 ], [ %67, %._crit_edge ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  br label %73

73:                                               ; preds = %17, %14, %12, %.loopexit
  %.8 = phi i32 [ %.746, %.loopexit ], [ -2147024882, %12 ], [ -2147024882, %14 ], [ -2147024882, %17 ]
  ret i32 %.8
}

declare ptr @MyAlloc(i64 noundef) local_unnamed_addr #2

; Function Attrs: nounwind
declare noundef zeroext i1 @_ZN15CByteOutBufWrap5AllocEm(ptr noundef nonnull align 8 dereferenceable(60), i64 noundef) local_unnamed_addr #3

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN15CByteOutBufWrap4InitEv(ptr noundef nonnull align 8 dereferenceable(60)) local_unnamed_addr #4 align 2

declare void @Ppmd7z_RangeEnc_Init(ptr noundef) local_unnamed_addr #2

declare void @Ppmd7_Init(ptr noundef, i32 noundef) local_unnamed_addr #2

declare void @Ppmd7z_RangeEnc_FlushData(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind
declare noundef i32 @_ZN15CByteOutBufWrap5FlushEv(ptr noundef nonnull align 8 dereferenceable(60)) local_unnamed_addr #3

declare void @Ppmd7_EncodeSymbol(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK15CByteOutBufWrap12GetProcessedEv(ptr noundef nonnull align 8 dereferenceable(60)) local_unnamed_addr #4 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 "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 = { 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 #5 = { 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, !15, i64 32}
!6 = !{!"_ZTSN9NCompress5NPpmd8CEncoderE", !7, i64 0, !9, i64 8, !10, i64 16, !11, i64 24, !15, i64 32, !16, i64 40, !20, i64 104, !21, i64 136, !24, i64 19320}
!7 = !{!"_ZTS14ICompressCoder", !8, i64 0}
!8 = !{!"_ZTS8IUnknown"}
!9 = !{!"_ZTS27ICompressSetCoderProperties", !8, i64 0}
!10 = !{!"_ZTS29ICompressWriteCoderProperties", !8, i64 0}
!11 = !{!"_ZTS13CMyUnknownImp", !12, i64 0}
!12 = !{!"int", !13, i64 0}
!13 = !{!"omnipotent char", !14, i64 0}
!14 = !{!"Simple C++ TBAA"}
!15 = !{!"any pointer", !13, i64 0}
!16 = !{!"_ZTS15CByteOutBufWrap", !17, i64 0, !15, i64 8, !15, i64 16, !15, i64 24, !18, i64 32, !15, i64 40, !19, i64 48, !12, i64 56}
!17 = !{!"_ZTS8IByteOut", !15, i64 0}
!18 = !{!"long", !13, i64 0}
!19 = !{!"long long", !13, i64 0}
!20 = !{!"_ZTS16CPpmd7z_RangeEnc", !19, i64 0, !12, i64 8, !13, i64 12, !19, i64 16, !15, i64 24}
!21 = !{!"_ZTS6CPpmd7", !15, i64 0, !15, i64 8, !15, i64 16, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 40, !12, i64 44, !12, i64 48, !12, i64 52, !12, i64 56, !15, i64 64, !15, i64 72, !15, i64 80, !15, i64 88, !15, i64 96, !12, i64 104, !13, i64 108, !13, i64 146, !13, i64 276, !13, i64 428, !13, i64 684, !13, i64 940, !22, i64 1196, !13, i64 1200, !13, i64 2800}
!22 = !{!"_ZTS9CPpmd_See", !23, i64 0, !13, i64 2, !13, i64 3}
!23 = !{!"short", !13, i64 0}
!24 = !{!"_ZTSN9NCompress5NPpmd9CEncPropsE", !12, i64 0, !12, i64 4, !12, i64 8}
!25 = !{!6, !12, i64 19320}
!26 = !{!6, !15, i64 80}
!27 = !{!6, !12, i64 19328}
!28 = !{!19, !19, i64 0}
!29 = !{!30, !30, i64 0}
!30 = !{!"vtable pointer", !14, i64 0}
!31 = !{!12, !12, i64 0}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}
!34 = distinct !{!34, !33}
!35 = !{!13, !13, i64 0}
!36 = !{!6, !12, i64 96}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass