; LLVM IR from JayXon/Leanify :: lib/zopfli (squeeze)

; 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.ZopfliLZ77Store = type { ptr, ptr, i64, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.ZopfliHash = type { ptr, ptr, ptr, i32, ptr, ptr, ptr, i32, ptr }
%struct.SymbolStats = type { [288 x i64], [32 x i64], [288 x double], [32 x double] }
%struct.RanState = type { i32, i32 }
%struct.ZopfliBlockState = type { ptr, ptr, i64, i64 }
%struct.ZopfliOptions = type { i32, i32, i32, i32, i32, i32 }

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [22 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @ZopfliLZ77Optimal(ptr noundef %0, ptr noundef %1, i64 noundef %2, i64 noundef %3, i32 noundef %4, ptr noundef %5) #0 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i64, align 8
  %17 = alloca %struct.ZopfliLZ77Store, align 8
  %18 = alloca %struct.ZopfliHash, align 8
  %19 = alloca ptr, align 8
  %20 = alloca %struct.SymbolStats, align 8
  %21 = alloca %struct.SymbolStats, align 8
  %22 = alloca %struct.SymbolStats, align 8
  %23 = alloca i32, align 4
  %24 = alloca ptr, align 8
  %25 = alloca double, align 8
  %26 = alloca double, align 8
  %27 = alloca double, align 8
  %28 = alloca %struct.RanState, align 4
  %29 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store i64 %2, ptr %9, align 8, !tbaa !9
  store i64 %3, ptr %10, align 8, !tbaa !9
  store i32 %4, ptr %11, align 4, !tbaa !11
  store ptr %5, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %30 = load i64, ptr %10, align 8, !tbaa !9
  %31 = load i64, ptr %9, align 8, !tbaa !9
  %32 = sub i64 %30, %31
  store i64 %32, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %33 = load i64, ptr %13, align 8, !tbaa !9
  %34 = add i64 %33, 1
  %35 = mul i64 2, %34
  %36 = call noalias ptr @malloc(i64 noundef %35) #7
  store ptr %36, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  store ptr null, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  store i64 0, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 72, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 72, ptr %18) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  store ptr %18, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 5120, ptr %20) #6
  call void @llvm.lifetime.start.p0(i64 5120, ptr %21) #6
  call void @llvm.lifetime.start.p0(i64 5120, ptr %22) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #6
  %37 = load i64, ptr %13, align 8, !tbaa !9
  %38 = add i64 %37, 1
  %39 = mul i64 4, %38
  %40 = call noalias ptr @malloc(i64 noundef %39) #7
  store ptr %40, ptr %24, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #6
  store double 1.000000e+30, ptr %26, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #6
  store double 0.000000e+00, ptr %27, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #6
  store i32 -1, ptr %29, align 4, !tbaa !11
  %41 = load ptr, ptr %24, align 8, !tbaa !5
  %42 = icmp ne ptr %41, null
  br i1 %42, label %44, label %43

43:                                               ; preds = %6
  call void @exit(i32 noundef -1) #8
  unreachable

44:                                               ; preds = %6
  %45 = load ptr, ptr %14, align 8, !tbaa !5
  %46 = icmp ne ptr %45, null
  br i1 %46, label %48, label %47

47:                                               ; preds = %44
  call void @exit(i32 noundef -1) #8
  unreachable

48:                                               ; preds = %44
  call void @InitRanState(ptr noundef %28)
  call void @InitStats(ptr noundef %20)
  %49 = load ptr, ptr %8, align 8, !tbaa !5
  call void @ZopfliInitLZ77Store(ptr noundef %49, ptr noundef %17)
  %50 = load ptr, ptr %19, align 8, !tbaa !5
  call void @ZopfliAllocHash(i64 noundef 32768, ptr noundef %50)
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  %52 = load ptr, ptr %8, align 8, !tbaa !5
  %53 = load i64, ptr %9, align 8, !tbaa !9
  %54 = load i64, ptr %10, align 8, !tbaa !9
  %55 = load ptr, ptr %19, align 8, !tbaa !5
  call void @ZopfliLZ77Greedy(ptr noundef %51, ptr noundef %52, i64 noundef %53, i64 noundef %54, ptr noundef %17, ptr noundef %55)
  call void @GetStatistics(ptr noundef %17, ptr noundef %20)
  store i32 0, ptr %23, align 4, !tbaa !11
  br label %56

56:                                               ; preds = %118, %48
  %57 = load i32, ptr %23, align 4, !tbaa !11
  %58 = load i32, ptr %11, align 4, !tbaa !11
  %59 = icmp slt i32 %57, %58
  br i1 %59, label %60, label %121

60:                                               ; preds = %56
  call void @ZopfliCleanLZ77Store(ptr noundef %17)
  %61 = load ptr, ptr %8, align 8, !tbaa !5
  call void @ZopfliInitLZ77Store(ptr noundef %61, ptr noundef %17)
  %62 = load ptr, ptr %7, align 8, !tbaa !5
  %63 = load ptr, ptr %8, align 8, !tbaa !5
  %64 = load i64, ptr %9, align 8, !tbaa !9
  %65 = load i64, ptr %10, align 8, !tbaa !9
  %66 = load ptr, ptr %14, align 8, !tbaa !5
  %67 = load ptr, ptr %19, align 8, !tbaa !5
  %68 = load ptr, ptr %24, align 8, !tbaa !5
  %69 = call double @LZ77OptimalRun(ptr noundef %62, ptr noundef %63, i64 noundef %64, i64 noundef %65, ptr noundef %15, ptr noundef %16, ptr noundef %66, ptr noundef %20, ptr noundef %17, ptr noundef %67, ptr noundef %68)
  %70 = getelementptr inbounds %struct.ZopfliLZ77Store, ptr %17, i32 0, i32 2
  %71 = load i64, ptr %70, align 8, !tbaa !15
  %72 = call double @ZopfliCalculateBlockSize(ptr noundef %17, i64 noundef 0, i64 noundef %71, i32 noundef 2)
  store double %72, ptr %25, align 8, !tbaa !13
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.ZopfliBlockState, ptr %73, i32 0, i32 0
  %75 = load ptr, ptr %74, align 8, !tbaa !17
  %76 = getelementptr inbounds %struct.ZopfliOptions, ptr %75, i32 0, i32 1
  %77 = load i32, ptr %76, align 4, !tbaa !19
  %78 = icmp ne i32 %77, 0
  br i1 %78, label %90, label %79

79:                                               ; preds = %60
  %80 = load ptr, ptr %7, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.ZopfliBlockState, ptr %80, i32 0, i32 0
  %82 = load ptr, ptr %81, align 8, !tbaa !17
  %83 = getelementptr inbounds %struct.ZopfliOptions, ptr %82, i32 0, i32 0
  %84 = load i32, ptr %83, align 4, !tbaa !21
  %85 = icmp ne i32 %84, 0
  br i1 %85, label %86, label %96

86:                                               ; preds = %79
  %87 = load double, ptr %25, align 8, !tbaa !13
  %88 = load double, ptr %26, align 8, !tbaa !13
  %89 = fcmp olt double %87, %88
  br i1 %89, label %90, label %96

90:                                               ; preds = %86, %60
  %91 = load ptr, ptr @stderr, align 8, !tbaa !5
  %92 = load i32, ptr %23, align 4, !tbaa !11
  %93 = load double, ptr %25, align 8, !tbaa !13
  %94 = fptosi double %93 to i32
  %95 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %91, ptr noundef @.str, i32 noundef %92, i32 noundef %94) #6
  br label %96

96:                                               ; preds = %90, %86, %79
  %97 = load double, ptr %25, align 8, !tbaa !13
  %98 = load double, ptr %26, align 8, !tbaa !13
  %99 = fcmp olt double %97, %98
  br i1 %99, label %100, label %103

100:                                              ; preds = %96
  %101 = load ptr, ptr %12, align 8, !tbaa !5
  call void @ZopfliCopyLZ77Store(ptr noundef %17, ptr noundef %101)
  call void @CopyStats(ptr noundef %20, ptr noundef %21)
  %102 = load double, ptr %25, align 8, !tbaa !13
  store double %102, ptr %26, align 8, !tbaa !13
  br label %103

103:                                              ; preds = %100, %96
  call void @CopyStats(ptr noundef %20, ptr noundef %22)
  call void @ClearStatFreqs(ptr noundef %20)
  call void @GetStatistics(ptr noundef %17, ptr noundef %20)
  %104 = load i32, ptr %29, align 4, !tbaa !11
  %105 = icmp ne i32 %104, -1
  br i1 %105, label %106, label %107

106:                                              ; preds = %103
  call void @AddWeighedStatFreqs(ptr noundef %20, double noundef 1.000000e+00, ptr noundef %22, double noundef 5.000000e-01, ptr noundef %20)
  call void @CalculateStatistics(ptr noundef %20)
  br label %107

107:                                              ; preds = %106, %103
  %108 = load i32, ptr %23, align 4, !tbaa !11
  %109 = icmp sgt i32 %108, 5
  br i1 %109, label %110, label %116

110:                                              ; preds = %107
  %111 = load double, ptr %25, align 8, !tbaa !13
  %112 = load double, ptr %27, align 8, !tbaa !13
  %113 = fcmp oeq double %111, %112
  br i1 %113, label %114, label %116

114:                                              ; preds = %110
  call void @CopyStats(ptr noundef %21, ptr noundef %20)
  call void @RandomizeStatFreqs(ptr noundef %28, ptr noundef %20)
  call void @CalculateStatistics(ptr noundef %20)
  %115 = load i32, ptr %23, align 4, !tbaa !11
  store i32 %115, ptr %29, align 4, !tbaa !11
  br label %116

116:                                              ; preds = %114, %110, %107
  %117 = load double, ptr %25, align 8, !tbaa !13
  store double %117, ptr %27, align 8, !tbaa !13
  br label %118

118:                                              ; preds = %116
  %119 = load i32, ptr %23, align 4, !tbaa !11
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %23, align 4, !tbaa !11
  br label %56, !llvm.loop !22

121:                                              ; preds = %56
  %122 = load ptr, ptr %14, align 8, !tbaa !5
  call void @free(ptr noundef %122) #6
  %123 = load ptr, ptr %15, align 8, !tbaa !5
  call void @free(ptr noundef %123) #6
  %124 = load ptr, ptr %24, align 8, !tbaa !5
  call void @free(ptr noundef %124) #6
  call void @ZopfliCleanLZ77Store(ptr noundef %17)
  %125 = load ptr, ptr %19, align 8, !tbaa !5
  call void @ZopfliCleanHash(ptr noundef %125)
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 5120, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 5120, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 5120, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 72, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 72, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  ret void
}

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #3

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

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

declare void @ZopfliInitLZ77Store(ptr noundef, ptr noundef) #4

declare void @ZopfliAllocHash(i64 noundef, ptr noundef) #4

declare void @ZopfliLZ77Greedy(ptr noundef, ptr noundef, i64 noundef, i64 noundef, ptr noundef, ptr noundef) #4

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

declare void @ZopfliCleanLZ77Store(ptr noundef) #4

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

declare double @ZopfliCalculateBlockSize(ptr noundef, i64 noundef, i64 noundef, i32 noundef) #4

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #5

declare void @ZopfliCopyLZ77Store(ptr noundef, ptr noundef) #4

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

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

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

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

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

; Function Attrs: nounwind
declare void @free(ptr noundef) #5

declare void @ZopfliCleanHash(ptr noundef) #4

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind allocsize(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 = { noreturn 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 = { "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 "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 #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
attributes #8 = { noreturn 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 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = !{!16, !10, i64 16}
!16 = !{!"ZopfliLZ77Store", !6, i64 0, !6, i64 8, !10, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64}
!17 = !{!18, !6, i64 0}
!18 = !{!"ZopfliBlockState", !6, i64 0, !6, i64 8, !10, i64 16, !10, i64 24}
!19 = !{!20, !12, i64 4}
!20 = !{!"ZopfliOptions", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20}
!21 = !{!20, !12, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}


; 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.ZopfliLZ77Store = type { ptr, ptr, i64, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.ZopfliHash = type { ptr, ptr, ptr, i32, ptr, ptr, ptr, i32, ptr }
%struct.SymbolStats = type { [288 x i64], [32 x i64], [288 x double], [32 x double] }
%struct.RanState = type { i32, i32 }

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [22 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @ZopfliLZ77Optimal(ptr noundef %0, ptr noundef %1, i64 noundef %2, i64 noundef %3, i32 noundef %4, ptr noundef %5) local_unnamed_addr #0 {
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca %struct.ZopfliLZ77Store, align 8
  %10 = alloca %struct.ZopfliHash, align 8
  %11 = alloca %struct.SymbolStats, align 8
  %12 = alloca %struct.SymbolStats, align 8
  %13 = alloca %struct.SymbolStats, align 8
  %14 = alloca %struct.RanState, align 4
  %15 = sub i64 %3, %2
  %16 = add i64 %15, 1
  %17 = shl i64 %16, 1
  %18 = tail call noalias ptr @malloc(i64 noundef %17) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  store ptr null, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  store i64 0, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %9) #8
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %10) #8
  call void @llvm.lifetime.start.p0(i64 5120, ptr nonnull %11) #8
  call void @llvm.lifetime.start.p0(i64 5120, ptr nonnull %12) #8
  call void @llvm.lifetime.start.p0(i64 5120, ptr nonnull %13) #8
  %19 = shl i64 %16, 2
  %20 = tail call noalias ptr @malloc(i64 noundef %19) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #8
  %.not = icmp eq ptr %20, null
  br i1 %.not, label %21, label %22

21:                                               ; preds = %6
  tail call void @exit(i32 noundef -1) #9
  unreachable

22:                                               ; preds = %6
  %.not49 = icmp eq ptr %18, null
  br i1 %.not49, label %23, label %24

23:                                               ; preds = %22
  tail call void @exit(i32 noundef -1) #9
  unreachable

24:                                               ; preds = %22
  call void @InitRanState(ptr noundef nonnull %14)
  call void @InitStats(ptr noundef nonnull %11)
  call void @ZopfliInitLZ77Store(ptr noundef %1, ptr noundef nonnull %9) #8
  call void @ZopfliAllocHash(i64 noundef 32768, ptr noundef nonnull %10) #8
  call void @ZopfliLZ77Greedy(ptr noundef %0, ptr noundef %1, i64 noundef %2, i64 noundef %3, ptr noundef nonnull %9, ptr noundef nonnull %10) #8
  call void @GetStatistics(ptr noundef nonnull %9, ptr noundef nonnull %11)
  %25 = icmp sgt i32 %4, 0
  br i1 %25, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %24
  %26 = getelementptr inbounds i8, ptr %9, i64 16
  br label %27

27:                                               ; preds = %.lr.ph, %50
  %.058 = phi i32 [ -1, %.lr.ph ], [ %.1, %50 ]
  %.04257 = phi double [ 0.000000e+00, %.lr.ph ], [ %30, %50 ]
  %.04355 = phi double [ 1.000000e+30, %.lr.ph ], [ %.144, %50 ]
  %.04554 = phi i32 [ 0, %.lr.ph ], [ %51, %50 ]
  call void @ZopfliCleanLZ77Store(ptr noundef nonnull %9) #8
  call void @ZopfliInitLZ77Store(ptr noundef %1, ptr noundef nonnull %9) #8
  %28 = call double @LZ77OptimalRun(ptr noundef %0, ptr noundef %1, i64 noundef %2, i64 noundef %3, ptr noundef nonnull %7, ptr noundef nonnull %8, ptr noundef nonnull %18, ptr noundef nonnull %11, ptr noundef nonnull %9, ptr noundef nonnull %10, ptr noundef nonnull %20)
  %29 = load i64, ptr %26, align 8, !tbaa !11
  %30 = call double @ZopfliCalculateBlockSize(ptr noundef nonnull %9, i64 noundef 0, i64 noundef %29, i32 noundef 2) #8
  %31 = load ptr, ptr %0, align 8, !tbaa !13
  %32 = getelementptr inbounds i8, ptr %31, i64 4
  %33 = load i32, ptr %32, align 4, !tbaa !15
  %.not50 = icmp eq i32 %33, 0
  br i1 %.not50, label %34, label %37

34:                                               ; preds = %27
  %35 = load i32, ptr %31, align 4, !tbaa !18
  %.not51 = icmp ne i32 %35, 0
  %36 = fcmp olt double %30, %.04355
  %or.cond = select i1 %.not51, i1 %36, i1 false
  br i1 %or.cond, label %37, label %41

37:                                               ; preds = %34, %27
  %38 = load ptr, ptr @stderr, align 8, !tbaa !5
  %39 = fptosi double %30 to i32
  %40 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef nonnull @.str, i32 noundef %.04554, i32 noundef %39) #10
  br label %41

41:                                               ; preds = %37, %34
  %42 = fcmp olt double %30, %.04355
  br i1 %42, label %43, label %44

43:                                               ; preds = %41
  call void @ZopfliCopyLZ77Store(ptr noundef nonnull %9, ptr noundef %5) #8
  call void @CopyStats(ptr noundef nonnull %11, ptr noundef nonnull %12)
  br label %44

44:                                               ; preds = %43, %41
  %.144 = phi double [ %30, %43 ], [ %.04355, %41 ]
  call void @CopyStats(ptr noundef nonnull %11, ptr noundef nonnull %13)
  call void @ClearStatFreqs(ptr noundef nonnull %11)
  call void @GetStatistics(ptr noundef nonnull %9, ptr noundef nonnull %11)
  %.not52 = icmp eq i32 %.058, -1
  br i1 %.not52, label %46, label %45

45:                                               ; preds = %44
  call void @AddWeighedStatFreqs(ptr noundef nonnull %11, double noundef 1.000000e+00, ptr noundef nonnull %13, double noundef 5.000000e-01, ptr noundef nonnull %11)
  call void @CalculateStatistics(ptr noundef nonnull %11)
  br label %46

46:                                               ; preds = %45, %44
  %47 = icmp ugt i32 %.04554, 5
  %48 = fcmp oeq double %30, %.04257
  %or.cond53 = select i1 %47, i1 %48, i1 false
  br i1 %or.cond53, label %49, label %50

49:                                               ; preds = %46
  call void @CopyStats(ptr noundef nonnull %12, ptr noundef nonnull %11)
  call void @RandomizeStatFreqs(ptr noundef nonnull %14, ptr noundef nonnull %11)
  call void @CalculateStatistics(ptr noundef nonnull %11)
  br label %50

50:                                               ; preds = %49, %46
  %.1 = phi i32 [ %.04554, %49 ], [ %.058, %46 ]
  %51 = add nuw nsw i32 %.04554, 1
  %exitcond.not = icmp eq i32 %51, %4
  br i1 %exitcond.not, label %._crit_edge.loopexit, label %27, !llvm.loop !19

._crit_edge.loopexit:                             ; preds = %50
  %.pre = load ptr, ptr %7, align 8, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %24
  %52 = phi ptr [ %.pre, %._crit_edge.loopexit ], [ null, %24 ]
  call void @free(ptr noundef %18) #8
  call void @free(ptr noundef %52) #8
  call void @free(ptr noundef %20) #8
  call void @ZopfliCleanLZ77Store(ptr noundef nonnull %9) #8
  call void @ZopfliCleanHash(ptr noundef nonnull %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #8
  call void @llvm.lifetime.end.p0(i64 5120, ptr nonnull %13) #8
  call void @llvm.lifetime.end.p0(i64 5120, ptr nonnull %12) #8
  call void @llvm.lifetime.end.p0(i64 5120, ptr nonnull %11) #8
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %10) #8
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  ret void
}

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #3

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

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

declare void @ZopfliInitLZ77Store(ptr noundef, ptr noundef) local_unnamed_addr #4

declare void @ZopfliAllocHash(i64 noundef, ptr noundef) local_unnamed_addr #4

declare void @ZopfliLZ77Greedy(ptr noundef, ptr noundef, i64 noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

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

declare void @ZopfliCleanLZ77Store(ptr noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
declare hidden double @LZ77OptimalRun(ptr noundef, ptr noundef, i64 noundef, i64 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

declare double @ZopfliCalculateBlockSize(ptr noundef, i64 noundef, i64 noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #5

declare void @ZopfliCopyLZ77Store(ptr noundef, ptr noundef) local_unnamed_addr #4

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

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

; Function Attrs: nounwind uwtable
declare hidden void @AddWeighedStatFreqs(ptr noundef, double noundef, ptr noundef, double noundef, ptr noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #6

declare void @ZopfliCleanHash(ptr noundef) local_unnamed_addr #4

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

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { noreturn 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 = { "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 = { nofree 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 #6 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #7 = { nounwind allocsize(0) }
attributes #8 = { nounwind }
attributes #9 = { noreturn nounwind }
attributes #10 = { cold 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 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !10, i64 16}
!12 = !{!"ZopfliLZ77Store", !6, i64 0, !6, i64 8, !10, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64}
!13 = !{!14, !6, i64 0}
!14 = !{!"ZopfliBlockState", !6, i64 0, !6, i64 8, !10, i64 16, !10, i64 24}
!15 = !{!16, !17, i64 4}
!16 = !{!"ZopfliOptions", !17, i64 0, !17, i64 4, !17, i64 8, !17, i64 12, !17, i64 16, !17, i64 20}
!17 = !{!"int", !7, i64 0}
!18 = !{!16, !17, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,LoopSimplifyPass,SROAPass,SimplifyCFGPass,TailCallElimPass