; LLVM IR from ybubnov/libhuffman :: src (decoder)

; 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.__huf_decoder = type { ptr, ptr, ptr, ptr, ptr, ptr }
%struct.__huf_encoder_config = type { i64, i64, i64, i64, ptr, ptr }
%struct.__huf_bufio_read_writer = type { ptr, i64, i64, i64, i64, ptr }

; Function Attrs: nounwind uwtable
declare dso_local i32 @huf_decoder_init(ptr noundef, ptr noundef) #0

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

declare i32 @huf_malloc(ptr noundef, i64 noundef, i64 noundef) #2

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @huf_decoder_free(ptr noundef) #0

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

; Function Attrs: nounwind uwtable
define dso_local i32 @huf_decode(ptr noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i16, align 2
  %9 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  store ptr null, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store ptr null, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 2, ptr %8) #4
  store i16 0, ptr %8, align 2, !tbaa !11
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = call i32 @huf_decoder_init(ptr noundef %5, ptr noundef %10)
  store i32 %11, ptr %6, align 4, !tbaa !9
  %12 = load i32, ptr %6, align 4, !tbaa !9
  %13 = icmp ne i32 %12, 0
  br i1 %13, label %14, label %19

14:                                               ; preds = %1
  br label %15

15:                                               ; preds = %14
  %16 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %16, ptr %4, align 4, !tbaa !9
  br label %158

17:                                               ; No predecessors!
  br label %18

18:                                               ; preds = %17
  br label %19

19:                                               ; preds = %18, %1
  br label %20

20:                                               ; preds = %141, %19
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.__huf_decoder, ptr %21, i32 0, i32 0
  %23 = load ptr, ptr %22, align 8, !tbaa !13
  %24 = getelementptr inbounds %struct.__huf_encoder_config, ptr %23, i32 0, i32 0
  %25 = load i64, ptr %24, align 8, !tbaa !15
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.__huf_decoder, ptr %26, i32 0, i32 5
  %28 = load ptr, ptr %27, align 8, !tbaa !18
  %29 = getelementptr inbounds %struct.__huf_bufio_read_writer, ptr %28, i32 0, i32 4
  %30 = load i64, ptr %29, align 8, !tbaa !19
  %31 = icmp ugt i64 %25, %30
  br i1 %31, label %32, label %145

32:                                               ; preds = %20
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.__huf_decoder, ptr %33, i32 0, i32 5
  %35 = load ptr, ptr %34, align 8, !tbaa !18
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.__huf_decoder, ptr %36, i32 0, i32 0
  %38 = load ptr, ptr %37, align 8, !tbaa !13
  %39 = getelementptr inbounds %struct.__huf_encoder_config, ptr %38, i32 0, i32 1
  %40 = call i32 @huf_bufio_read(ptr noundef %35, ptr noundef %39, i64 noundef 8)
  store i32 %40, ptr %6, align 4, !tbaa !9
  %41 = load i32, ptr %6, align 4, !tbaa !9
  %42 = icmp ne i32 %41, 0
  br i1 %42, label %43, label %48

43:                                               ; preds = %32
  br label %44

44:                                               ; preds = %43
  %45 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %45, ptr %4, align 4, !tbaa !9
  br label %158

46:                                               ; No predecessors!
  br label %47

47:                                               ; preds = %46
  br label %48

48:                                               ; preds = %47, %32
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.__huf_decoder, ptr %49, i32 0, i32 5
  %51 = load ptr, ptr %50, align 8, !tbaa !18
  %52 = call i32 @huf_bufio_read(ptr noundef %51, ptr noundef %8, i64 noundef 2)
  store i32 %52, ptr %6, align 4, !tbaa !9
  %53 = load i32, ptr %6, align 4, !tbaa !9
  %54 = icmp ne i32 %53, 0
  br i1 %54, label %55, label %60

55:                                               ; preds = %48
  br label %56

56:                                               ; preds = %55
  %57 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %57, ptr %4, align 4, !tbaa !9
  br label %158

58:                                               ; No predecessors!
  br label %59

59:                                               ; preds = %58
  br label %60

60:                                               ; preds = %59, %48
  %61 = load i16, ptr %8, align 2, !tbaa !11
  %62 = sext i16 %61 to i32
  %63 = icmp slt i32 %62, 0
  br i1 %63, label %68, label %64

64:                                               ; preds = %60
  %65 = load i16, ptr %8, align 2, !tbaa !11
  %66 = sext i16 %65 to i32
  %67 = icmp sgt i32 %66, 1024
  br i1 %67, label %68, label %72

68:                                               ; preds = %64, %60
  br label %69

69:                                               ; preds = %68
  store i32 5, ptr %4, align 4, !tbaa !9
  br label %158

70:                                               ; No predecessors!
  br label %71

71:                                               ; preds = %70
  br label %72

72:                                               ; preds = %71, %64
  %73 = load i16, ptr %8, align 2, !tbaa !11
  %74 = sext i16 %73 to i64
  %75 = call i32 @huf_malloc(ptr noundef %7, i64 noundef 2, i64 noundef %74)
  store i32 %75, ptr %6, align 4, !tbaa !9
  %76 = load i32, ptr %6, align 4, !tbaa !9
  %77 = icmp ne i32 %76, 0
  br i1 %77, label %78, label %83

78:                                               ; preds = %72
  br label %79

79:                                               ; preds = %78
  %80 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %80, ptr %4, align 4, !tbaa !9
  br label %158

81:                                               ; No predecessors!
  br label %82

82:                                               ; preds = %81
  br label %83

83:                                               ; preds = %82, %72
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.__huf_decoder, ptr %84, i32 0, i32 5
  %86 = load ptr, ptr %85, align 8, !tbaa !18
  %87 = load ptr, ptr %7, align 8, !tbaa !5
  %88 = load i16, ptr %8, align 2, !tbaa !11
  %89 = sext i16 %88 to i64
  %90 = mul i64 %89, 2
  %91 = call i32 @huf_bufio_read(ptr noundef %86, ptr noundef %87, i64 noundef %90)
  store i32 %91, ptr %6, align 4, !tbaa !9
  %92 = load i32, ptr %6, align 4, !tbaa !9
  %93 = icmp ne i32 %92, 0
  br i1 %93, label %94, label %99

94:                                               ; preds = %83
  br label %95

95:                                               ; preds = %94
  %96 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %96, ptr %4, align 4, !tbaa !9
  br label %158

97:                                               ; No predecessors!
  br label %98

98:                                               ; preds = %97
  br label %99

99:                                               ; preds = %98, %83
  %100 = load ptr, ptr %5, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.__huf_decoder, ptr %100, i32 0, i32 1
  %102 = load ptr, ptr %101, align 8, !tbaa !21
  %103 = load ptr, ptr %7, align 8, !tbaa !5
  %104 = load i16, ptr %8, align 2, !tbaa !11
  %105 = sext i16 %104 to i64
  %106 = call i32 @huf_tree_deserialize(ptr noundef %102, ptr noundef %103, i64 noundef %105)
  store i32 %106, ptr %6, align 4, !tbaa !9
  %107 = load i32, ptr %6, align 4, !tbaa !9
  %108 = icmp ne i32 %107, 0
  br i1 %108, label %109, label %114

109:                                              ; preds = %99
  br label %110

110:                                              ; preds = %109
  %111 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %111, ptr %4, align 4, !tbaa !9
  br label %158

112:                                              ; No predecessors!
  br label %113

113:                                              ; preds = %112
  br label %114

114:                                              ; preds = %113, %99
  %115 = load ptr, ptr %5, align 8, !tbaa !5
  %116 = load ptr, ptr %5, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.__huf_decoder, ptr %116, i32 0, i32 0
  %118 = load ptr, ptr %117, align 8, !tbaa !13
  %119 = getelementptr inbounds %struct.__huf_encoder_config, ptr %118, i32 0, i32 1
  %120 = load i64, ptr %119, align 8, !tbaa !22
  %121 = call i32 @__huf_decode_block(ptr noundef %115, i64 noundef %120)
  store i32 %121, ptr %6, align 4, !tbaa !9
  %122 = load i32, ptr %6, align 4, !tbaa !9
  %123 = icmp ne i32 %122, 0
  br i1 %123, label %124, label %129

124:                                              ; preds = %114
  br label %125

125:                                              ; preds = %124
  %126 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %126, ptr %4, align 4, !tbaa !9
  br label %158

127:                                              ; No predecessors!
  br label %128

128:                                              ; preds = %127
  br label %129

129:                                              ; preds = %128, %114
  %130 = load ptr, ptr %5, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.__huf_decoder, ptr %130, i32 0, i32 1
  %132 = load ptr, ptr %131, align 8, !tbaa !21
  %133 = call i32 @huf_tree_reset(ptr noundef %132)
  store i32 %133, ptr %6, align 4, !tbaa !9
  %134 = load i32, ptr %6, align 4, !tbaa !9
  %135 = icmp ne i32 %134, 0
  br i1 %135, label %136, label %141

136:                                              ; preds = %129
  br label %137

137:                                              ; preds = %136
  %138 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %138, ptr %4, align 4, !tbaa !9
  br label %158

139:                                              ; No predecessors!
  br label %140

140:                                              ; preds = %139
  br label %141

141:                                              ; preds = %140, %129
  %142 = load ptr, ptr %5, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.__huf_decoder, ptr %142, i32 0, i32 2
  store ptr null, ptr %143, align 8, !tbaa !23
  %144 = load ptr, ptr %7, align 8, !tbaa !5
  call void @free(ptr noundef %144) #4
  store ptr null, ptr %7, align 8, !tbaa !5
  br label %20, !llvm.loop !24

145:                                              ; preds = %20
  %146 = load ptr, ptr %5, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.__huf_decoder, ptr %146, i32 0, i32 4
  %148 = load ptr, ptr %147, align 8, !tbaa !26
  %149 = call i32 @huf_bufio_read_writer_flush(ptr noundef %148)
  store i32 %149, ptr %6, align 4, !tbaa !9
  %150 = load i32, ptr %6, align 4, !tbaa !9
  %151 = icmp ne i32 %150, 0
  br i1 %151, label %152, label %157

152:                                              ; preds = %145
  br label %153

153:                                              ; preds = %152
  %154 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %154, ptr %4, align 4, !tbaa !9
  br label %158

155:                                              ; No predecessors!
  br label %156

156:                                              ; preds = %155
  br label %157

157:                                              ; preds = %156, %145
  br label %158

158:                                              ; preds = %157, %153, %137, %125, %110, %95, %79, %69, %56, %44, %15
  %159 = call i32 @huf_decoder_free(ptr noundef %5)
  br label %160

160:                                              ; preds = %158
  %161 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %161, ptr %2, align 4
  store i32 1, ptr %9, align 4
  br label %164

162:                                              ; No predecessors!
  br label %163

163:                                              ; preds = %162
  store i32 0, ptr %9, align 4
  br label %164

164:                                              ; preds = %163, %160
  call void @llvm.lifetime.end.p0(i64 2, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  %165 = load i32, ptr %9, align 4
  switch i32 %165, label %168 [
    i32 0, label %166
    i32 1, label %166
  ]

166:                                              ; preds = %164, %164
  %167 = load i32, ptr %2, align 4
  ret i32 %167

168:                                              ; preds = %164
  unreachable
}

declare i32 @huf_bufio_read(ptr noundef, ptr noundef, i64 noundef) #2

declare i32 @huf_tree_deserialize(ptr noundef, ptr noundef, i64 noundef) #2

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

declare i32 @huf_tree_reset(ptr noundef) #2

declare i32 @huf_bufio_read_writer_flush(ptr noundef) #2

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 = { "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 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!14, !6, i64 0}
!14 = !{!"__huf_decoder", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!15 = !{!16, !17, i64 0}
!16 = !{!"__huf_encoder_config", !17, i64 0, !17, i64 8, !17, i64 16, !17, i64 24, !6, i64 32, !6, i64 40}
!17 = !{!"long", !7, i64 0}
!18 = !{!14, !6, i64 40}
!19 = !{!20, !17, i64 32}
!20 = !{!"__huf_bufio_read_writer", !6, i64 0, !17, i64 8, !17, i64 16, !17, i64 24, !17, i64 32, !6, i64 40}
!21 = !{!14, !6, i64 8}
!22 = !{!16, !17, i64 8}
!23 = !{!14, !6, i64 16}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!14, !6, i64 32}


; 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"

; Function Attrs: nounwind uwtable
declare dso_local i32 @huf_decoder_init(ptr noundef, ptr noundef) local_unnamed_addr #0

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

declare i32 @huf_malloc(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @huf_decoder_free(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 #3

; Function Attrs: nounwind uwtable
define dso_local i32 @huf_decode(ptr noundef %0) local_unnamed_addr #0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i16, align 2
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  store ptr null, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  store ptr null, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %4) #4
  store i16 0, ptr %4, align 2, !tbaa !9
  %5 = call i32 @huf_decoder_init(ptr noundef nonnull %2, ptr noundef %0)
  %.not = icmp eq i32 %5, 0
  br i1 %.not, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %1
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %7 = load ptr, ptr %6, align 8, !tbaa !11
  %8 = load i64, ptr %7, align 8, !tbaa !13
  %9 = getelementptr inbounds i8, ptr %6, i64 40
  %10 = load ptr, ptr %9, align 8, !tbaa !16
  %11 = getelementptr inbounds i8, ptr %10, i64 32
  %12 = load i64, ptr %11, align 8, !tbaa !17
  %13 = icmp ugt i64 %8, %12
  br i1 %13, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader, %56
  %14 = phi ptr [ %64, %56 ], [ %10, %.preheader ]
  %15 = phi ptr [ %61, %56 ], [ %7, %.preheader ]
  %16 = getelementptr inbounds i8, ptr %15, i64 8
  %17 = call i32 @huf_bufio_read(ptr noundef nonnull %14, ptr noundef nonnull %16, i64 noundef 8) #4
  %.not32 = icmp eq i32 %17, 0
  br i1 %.not32, label %18, label %.loopexit

18:                                               ; preds = %.lr.ph
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %19, i64 40
  %21 = load ptr, ptr %20, align 8, !tbaa !16
  %22 = call i32 @huf_bufio_read(ptr noundef %21, ptr noundef nonnull %4, i64 noundef 2) #4
  %.not33 = icmp eq i32 %22, 0
  br i1 %.not33, label %23, label %.loopexit

23:                                               ; preds = %18
  %24 = load i16, ptr %4, align 2
  %or.cond = icmp ugt i16 %24, 1024
  br i1 %or.cond, label %.loopexit, label %25

25:                                               ; preds = %23
  %26 = zext nneg i16 %24 to i64
  %27 = call i32 @huf_malloc(ptr noundef nonnull %3, i64 noundef 2, i64 noundef %26) #4
  %.not34 = icmp eq i32 %27, 0
  br i1 %.not34, label %28, label %.loopexit

28:                                               ; preds = %25
  %29 = load ptr, ptr %2, align 8, !tbaa !5
  %30 = getelementptr inbounds i8, ptr %29, i64 40
  %31 = load ptr, ptr %30, align 8, !tbaa !16
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = load i16, ptr %4, align 2, !tbaa !9
  %34 = sext i16 %33 to i64
  %35 = shl nsw i64 %34, 1
  %36 = call i32 @huf_bufio_read(ptr noundef %31, ptr noundef %32, i64 noundef %35) #4
  %.not35 = icmp eq i32 %36, 0
  br i1 %.not35, label %37, label %.loopexit

37:                                               ; preds = %28
  %38 = load ptr, ptr %2, align 8, !tbaa !5
  %39 = getelementptr inbounds i8, ptr %38, i64 8
  %40 = load ptr, ptr %39, align 8, !tbaa !19
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = load i16, ptr %4, align 2, !tbaa !9
  %43 = sext i16 %42 to i64
  %44 = call i32 @huf_tree_deserialize(ptr noundef %40, ptr noundef %41, i64 noundef %43) #4
  %.not36 = icmp eq i32 %44, 0
  br i1 %.not36, label %45, label %.loopexit

45:                                               ; preds = %37
  %46 = load ptr, ptr %2, align 8, !tbaa !5
  %47 = load ptr, ptr %46, align 8, !tbaa !11
  %48 = getelementptr inbounds i8, ptr %47, i64 8
  %49 = load i64, ptr %48, align 8, !tbaa !20
  %50 = call i32 @__huf_decode_block(ptr noundef nonnull %46, i64 noundef %49)
  %.not37 = icmp eq i32 %50, 0
  br i1 %.not37, label %51, label %.loopexit

51:                                               ; preds = %45
  %52 = load ptr, ptr %2, align 8, !tbaa !5
  %53 = getelementptr inbounds i8, ptr %52, i64 8
  %54 = load ptr, ptr %53, align 8, !tbaa !19
  %55 = call i32 @huf_tree_reset(ptr noundef %54) #4
  %.not38 = icmp eq i32 %55, 0
  br i1 %.not38, label %56, label %.loopexit

56:                                               ; preds = %51
  %57 = load ptr, ptr %2, align 8, !tbaa !5
  %58 = getelementptr inbounds i8, ptr %57, i64 16
  store ptr null, ptr %58, align 8, !tbaa !21
  %59 = load ptr, ptr %3, align 8, !tbaa !5
  call void @free(ptr noundef %59) #4
  store ptr null, ptr %3, align 8, !tbaa !5
  %60 = load ptr, ptr %2, align 8, !tbaa !5
  %61 = load ptr, ptr %60, align 8, !tbaa !11
  %62 = load i64, ptr %61, align 8, !tbaa !13
  %63 = getelementptr inbounds i8, ptr %60, i64 40
  %64 = load ptr, ptr %63, align 8, !tbaa !16
  %65 = getelementptr inbounds i8, ptr %64, i64 32
  %66 = load i64, ptr %65, align 8, !tbaa !17
  %67 = icmp ugt i64 %62, %66
  br i1 %67, label %.lr.ph, label %._crit_edge, !llvm.loop !22

._crit_edge:                                      ; preds = %56, %.preheader
  %.lcssa = phi ptr [ %6, %.preheader ], [ %60, %56 ]
  %68 = getelementptr inbounds i8, ptr %.lcssa, i64 32
  %69 = load ptr, ptr %68, align 8, !tbaa !24
  %70 = call i32 @huf_bufio_read_writer_flush(ptr noundef %69) #4
  br label %.loopexit

.loopexit:                                        ; preds = %51, %45, %37, %28, %25, %23, %18, %.lr.ph, %._crit_edge, %1
  %.0 = phi i32 [ %5, %1 ], [ %70, %._crit_edge ], [ %55, %51 ], [ %50, %45 ], [ %44, %37 ], [ %36, %28 ], [ %27, %25 ], [ 5, %23 ], [ %22, %18 ], [ %17, %.lr.ph ]
  %71 = call i32 @huf_decoder_free(ptr noundef nonnull %2)
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  ret i32 %.0
}

declare i32 @huf_bufio_read(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

declare i32 @huf_tree_deserialize(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

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

declare i32 @huf_tree_reset(ptr noundef) local_unnamed_addr #2

declare i32 @huf_bufio_read_writer_flush(ptr noundef) local_unnamed_addr #2

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 = { "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 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 #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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"short", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"__huf_decoder", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!13 = !{!14, !15, i64 0}
!14 = !{!"__huf_encoder_config", !15, i64 0, !15, i64 8, !15, i64 16, !15, i64 24, !6, i64 32, !6, i64 40}
!15 = !{!"long", !7, i64 0}
!16 = !{!12, !6, i64 40}
!17 = !{!18, !15, i64 32}
!18 = !{!"__huf_bufio_read_writer", !6, i64 0, !15, i64 8, !15, i64 16, !15, i64 24, !15, i64 32, !6, i64 40}
!19 = !{!12, !6, i64 8}
!20 = !{!14, !15, i64 8}
!21 = !{!12, !6, i64 16}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!12, !6, i64 32}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass