; LLVM IR from intel/qpl :: sources/c_api/serialization (huffman_table_serialization)

; 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.allocator_t = type { ptr, ptr }
%"struct.qpl::ml::compression::huffman_table_meta_t" = type { [4 x i8], i32, i8, i8, i8, i8, i32 }

; 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

declare void @_ZN3qpl2ml13serialization13get_meta_sizeERKNS0_11compression20huffman_table_meta_tEPm(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef) #1

; 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) #2

; Function Attrs: mustprogress uwtable
define dso_local i32 @qpl_huffman_table_deserialize(ptr noundef %0, i64 noundef %1, ptr %2, ptr %3, ptr noundef %4) #3 {
  %6 = alloca i32, align 4
  %7 = alloca %struct.allocator_t, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %struct.allocator_t, align 8
  %15 = alloca %struct.allocator_t, align 8
  %16 = alloca i64, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  %20 = alloca %struct.allocator_t, align 8
  %21 = alloca %struct.allocator_t, align 8
  %22 = alloca i64, align 8
  %23 = alloca ptr, align 8
  %24 = alloca ptr, align 8
  %25 = getelementptr inbounds { ptr, ptr }, ptr %7, i32 0, i32 0
  store ptr %2, ptr %25, align 8
  %26 = getelementptr inbounds { ptr, ptr }, ptr %7, i32 0, i32 1
  store ptr %3, ptr %26, align 8
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i64 %1, ptr %9, align 8, !tbaa !9
  store ptr %4, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %27 = load ptr, ptr %10, align 8, !tbaa !5
  %28 = call noundef i32 @_ZN3qpl2ml12bad_argumentL17check_for_nullptrIPP17qpl_huffman_tableJEEEjT_DpT0_(ptr noundef %27) #7
  store i32 %28, ptr %11, align 4, !tbaa !11
  %29 = load i32, ptr %11, align 4, !tbaa !11
  %30 = icmp ne i32 %29, 0
  br i1 %30, label %31, label %33

31:                                               ; preds = %5
  %32 = load i32, ptr %11, align 4, !tbaa !11
  store i32 %32, ptr %6, align 4
  store i32 1, ptr %12, align 4
  br label %34

33:                                               ; preds = %5
  store i32 0, ptr %12, align 4
  br label %34

34:                                               ; preds = %33, %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  %35 = load i32, ptr %12, align 4
  switch i32 %35, label %166 [
    i32 0, label %36
    i32 1, label %164
  ]

36:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %37 = load ptr, ptr %8, align 8, !tbaa !5
  %38 = call noundef i32 @_ZN3qpl2ml12bad_argumentL17check_for_nullptrIPKhJEEEjT_DpT0_(ptr noundef %37) #7
  store i32 %38, ptr %13, align 4, !tbaa !11
  %39 = load i32, ptr %13, align 4, !tbaa !11
  %40 = icmp ne i32 %39, 0
  br i1 %40, label %41, label %43

41:                                               ; preds = %36
  %42 = load i32, ptr %13, align 4, !tbaa !11
  store i32 %42, ptr %6, align 4
  store i32 1, ptr %12, align 4
  br label %44

43:                                               ; preds = %36
  store i32 0, ptr %12, align 4
  br label %44

44:                                               ; preds = %43, %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  %45 = load i32, ptr %12, align 4
  switch i32 %45, label %166 [
    i32 0, label %46
    i32 1, label %164
  ]

46:                                               ; preds = %44
  %47 = load i64, ptr %9, align 8, !tbaa !9
  %48 = icmp eq i64 %47, 0
  br i1 %48, label %49, label %50

49:                                               ; preds = %46
  store i32 57, ptr %6, align 4
  br label %164

50:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %15, ptr align 8 %7, i64 16, i1 false), !tbaa.struct !13
  %51 = getelementptr inbounds { ptr, ptr }, ptr %15, i32 0, i32 0
  %52 = load ptr, ptr %51, align 8
  %53 = getelementptr inbounds { ptr, ptr }, ptr %15, i32 0, i32 1
  %54 = load ptr, ptr %53, align 8
  %55 = call { ptr, ptr } @_ZN3qpl2ml11compression7detailsL13get_allocatorE11allocator_t(ptr %52, ptr %54)
  %56 = getelementptr inbounds { ptr, ptr }, ptr %14, i32 0, i32 0
  %57 = extractvalue { ptr, ptr } %55, 0
  store ptr %57, ptr %56, align 8
  %58 = getelementptr inbounds { ptr, ptr }, ptr %14, i32 0, i32 1
  %59 = extractvalue { ptr, ptr } %55, 1
  store ptr %59, ptr %58, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  store i64 16, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %60 = getelementptr inbounds %struct.allocator_t, ptr %14, i32 0, i32 0
  %61 = load ptr, ptr %60, align 8, !tbaa !14
  %62 = load i64, ptr %16, align 8, !tbaa !9
  %63 = call noundef ptr %61(i64 noundef %62)
  store ptr %63, ptr %17, align 8, !tbaa !5
  %64 = load ptr, ptr %17, align 8, !tbaa !5
  %65 = icmp ne ptr %64, null
  br i1 %65, label %67, label %66

66:                                               ; preds = %50
  store i32 106, ptr %6, align 4
  store i32 1, ptr %12, align 4
  br label %163

67:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %68 = load ptr, ptr %17, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 4 %68, i8 0, i64 16, i1 false)
  call void @_ZN3qpl2ml11compression20huffman_table_meta_tC2Ev(ptr noundef nonnull align 4 dereferenceable(16) %68) #7
  store ptr %68, ptr %18, align 8, !tbaa !5
  %69 = load ptr, ptr %8, align 8, !tbaa !5
  %70 = load ptr, ptr %18, align 8, !tbaa !5
  call void @_ZN3qpl2ml13serialization16deserialize_metaEPKhRNS0_11compression20huffman_table_meta_tE(ptr noundef %69, ptr noundef nonnull align 4 dereferenceable(16) %70)
  %71 = load ptr, ptr %18, align 8, !tbaa !5
  %72 = getelementptr inbounds %"struct.qpl::ml::compression::huffman_table_meta_t", ptr %71, i32 0, i32 3
  %73 = load i8, ptr %72, align 1, !tbaa !16
  %74 = icmp ne i8 %73, 1
  br i1 %74, label %75, label %80

75:                                               ; preds = %67
  %76 = load ptr, ptr %18, align 8, !tbaa !5
  call void @_ZSt10destroy_atIN3qpl2ml11compression20huffman_table_meta_tEEvPT_(ptr noundef %76)
  %77 = getelementptr inbounds %struct.allocator_t, ptr %14, i32 0, i32 1
  %78 = load ptr, ptr %77, align 8, !tbaa !22
  %79 = load ptr, ptr %17, align 8, !tbaa !5
  call void %78(ptr noundef %79)
  store i32 90, ptr %6, align 4
  store i32 1, ptr %12, align 4
  br label %162

80:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  store i32 0, ptr %19, align 4, !tbaa !23
  %81 = load ptr, ptr %18, align 8, !tbaa !5
  %82 = getelementptr inbounds %"struct.qpl::ml::compression::huffman_table_meta_t", ptr %81, i32 0, i32 2
  %83 = load i8, ptr %82, align 4, !tbaa !25
  %84 = icmp eq i8 %83, 0
  br i1 %84, label %85, label %100

85:                                               ; preds = %80
  %86 = load ptr, ptr %18, align 8, !tbaa !5
  %87 = getelementptr inbounds %"struct.qpl::ml::compression::huffman_table_meta_t", ptr %86, i32 0, i32 4
  %88 = load i8, ptr %87, align 2, !tbaa !26
  %89 = zext i8 %88 to i32
  %90 = load ptr, ptr %18, align 8, !tbaa !5
  %91 = getelementptr inbounds %"struct.qpl::ml::compression::huffman_table_meta_t", ptr %90, i32 0, i32 5
  %92 = load i8, ptr %91, align 1, !tbaa !27
  %93 = zext i8 %92 to i32
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %20, ptr align 8 %7, i64 16, i1 false), !tbaa.struct !13
  %94 = load ptr, ptr %10, align 8, !tbaa !5
  %95 = getelementptr inbounds { ptr, ptr }, ptr %20, i32 0, i32 0
  %96 = load ptr, ptr %95, align 8
  %97 = getelementptr inbounds { ptr, ptr }, ptr %20, i32 0, i32 1
  %98 = load ptr, ptr %97, align 8
  %99 = call i32 @qpl_deflate_huffman_table_create(i32 noundef %89, i32 noundef %93, ptr %96, ptr %98, ptr noundef %94)
  store i32 %99, ptr %19, align 4, !tbaa !23
  br label %100

100:                                              ; preds = %85, %80
  %101 = load ptr, ptr %18, align 8, !tbaa !5
  %102 = getelementptr inbounds %"struct.qpl::ml::compression::huffman_table_meta_t", ptr %101, i32 0, i32 2
  %103 = load i8, ptr %102, align 4, !tbaa !25
  %104 = icmp eq i8 %103, 2
  br i1 %104, label %105, label %120

105:                                              ; preds = %100
  %106 = load ptr, ptr %18, align 8, !tbaa !5
  %107 = getelementptr inbounds %"struct.qpl::ml::compression::huffman_table_meta_t", ptr %106, i32 0, i32 4
  %108 = load i8, ptr %107, align 2, !tbaa !26
  %109 = zext i8 %108 to i32
  %110 = load ptr, ptr %18, align 8, !tbaa !5
  %111 = getelementptr inbounds %"struct.qpl::ml::compression::huffman_table_meta_t", ptr %110, i32 0, i32 5
  %112 = load i8, ptr %111, align 1, !tbaa !27
  %113 = zext i8 %112 to i32
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %21, ptr align 8 %7, i64 16, i1 false), !tbaa.struct !13
  %114 = load ptr, ptr %10, align 8, !tbaa !5
  %115 = getelementptr inbounds { ptr, ptr }, ptr %21, i32 0, i32 0
  %116 = load ptr, ptr %115, align 8
  %117 = getelementptr inbounds { ptr, ptr }, ptr %21, i32 0, i32 1
  %118 = load ptr, ptr %117, align 8
  %119 = call i32 @qpl_huffman_only_table_create(i32 noundef %109, i32 noundef %113, ptr %116, ptr %118, ptr noundef %114)
  store i32 %119, ptr %19, align 4, !tbaa !23
  br label %120

120:                                              ; preds = %105, %100
  %121 = load i32, ptr %19, align 4, !tbaa !23
  %122 = icmp ne i32 %121, 0
  br i1 %122, label %123, label %128

123:                                              ; preds = %120
  %124 = load ptr, ptr %18, align 8, !tbaa !5
  call void @_ZSt10destroy_atIN3qpl2ml11compression20huffman_table_meta_tEEvPT_(ptr noundef %124)
  %125 = getelementptr inbounds %struct.allocator_t, ptr %14, i32 0, i32 1
  %126 = load ptr, ptr %125, align 8, !tbaa !22
  %127 = load ptr, ptr %17, align 8, !tbaa !5
  call void %126(ptr noundef %127)
  store i32 106, ptr %6, align 4
  store i32 1, ptr %12, align 4
  br label %161

128:                                              ; preds = %120
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  store i64 0, ptr %22, align 8, !tbaa !9
  %129 = load ptr, ptr %18, align 8, !tbaa !5
  call void @_ZN3qpl2ml13serialization13get_meta_sizeERKNS0_11compression20huffman_table_meta_tEPm(ptr noundef nonnull align 4 dereferenceable(16) %129, ptr noundef %22)
  %130 = load ptr, ptr %18, align 8, !tbaa !5
  %131 = getelementptr inbounds %"struct.qpl::ml::compression::huffman_table_meta_t", ptr %130, i32 0, i32 2
  %132 = load i8, ptr %131, align 4, !tbaa !25
  %133 = icmp eq i8 %132, 0
  br i1 %133, label %134, label %142

134:                                              ; preds = %128
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  %135 = load ptr, ptr %10, align 8, !tbaa !5
  %136 = load ptr, ptr %135, align 8, !tbaa !5
  store ptr %136, ptr %23, align 8, !tbaa !5
  %137 = load ptr, ptr %23, align 8, !tbaa !5
  %138 = load ptr, ptr %8, align 8, !tbaa !5
  %139 = load i64, ptr %22, align 8, !tbaa !9
  %140 = getelementptr inbounds i8, ptr %138, i64 %139
  %141 = call noundef i32 @_ZN3qpl2ml11compression15huffman_table_tILNS1_23compression_algorithm_eE0EE16init_with_streamEPKh(ptr noundef nonnull align 8 dereferenceable(72) %137, ptr noundef %140) #7
  store i32 %141, ptr %19, align 4, !tbaa !23
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  br label %142

142:                                              ; preds = %134, %128
  %143 = load ptr, ptr %18, align 8, !tbaa !5
  %144 = getelementptr inbounds %"struct.qpl::ml::compression::huffman_table_meta_t", ptr %143, i32 0, i32 2
  %145 = load i8, ptr %144, align 4, !tbaa !25
  %146 = icmp eq i8 %145, 2
  br i1 %146, label %147, label %155

147:                                              ; preds = %142
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #7
  %148 = load ptr, ptr %10, align 8, !tbaa !5
  %149 = load ptr, ptr %148, align 8, !tbaa !5
  store ptr %149, ptr %24, align 8, !tbaa !5
  %150 = load ptr, ptr %24, align 8, !tbaa !5
  %151 = load ptr, ptr %8, align 8, !tbaa !5
  %152 = load i64, ptr %22, align 8, !tbaa !9
  %153 = getelementptr inbounds i8, ptr %151, i64 %152
  %154 = call noundef i32 @_ZN3qpl2ml11compression15huffman_table_tILNS1_23compression_algorithm_eE2EE16init_with_streamEPKh(ptr noundef nonnull align 8 dereferenceable(72) %150, ptr noundef %153) #7
  store i32 %154, ptr %19, align 4, !tbaa !23
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  br label %155

155:                                              ; preds = %147, %142
  %156 = load ptr, ptr %18, align 8, !tbaa !5
  call void @_ZSt10destroy_atIN3qpl2ml11compression20huffman_table_meta_tEEvPT_(ptr noundef %156)
  %157 = getelementptr inbounds %struct.allocator_t, ptr %14, i32 0, i32 1
  %158 = load ptr, ptr %157, align 8, !tbaa !22
  %159 = load ptr, ptr %17, align 8, !tbaa !5
  call void %158(ptr noundef %159)
  %160 = load i32, ptr %19, align 4, !tbaa !23
  store i32 %160, ptr %6, align 4
  store i32 1, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  br label %161

161:                                              ; preds = %155, %123
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %162

162:                                              ; preds = %161, %75
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  br label %163

163:                                              ; preds = %162, %66
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #7
  br label %164

164:                                              ; preds = %163, %49, %44, %34
  %165 = load i32, ptr %6, align 4
  ret i32 %165

166:                                              ; preds = %44, %34
  unreachable
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i32 @_ZN3qpl2ml12bad_argumentL17check_for_nullptrIPP17qpl_huffman_tableJEEEjT_DpT0_(ptr noundef) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i32 @_ZN3qpl2ml12bad_argumentL17check_for_nullptrIPKhJEEEjT_DpT0_(ptr noundef) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden { ptr, ptr } @_ZN3qpl2ml11compression7detailsL13get_allocatorE11allocator_t(ptr, ptr) #4

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3qpl2ml11compression20huffman_table_meta_tC2Ev(ptr noundef nonnull align 4 dereferenceable(16)) unnamed_addr #4 align 2

declare void @_ZN3qpl2ml13serialization16deserialize_metaEPKhRNS0_11compression20huffman_table_meta_tE(ptr noundef, ptr noundef nonnull align 4 dereferenceable(16)) #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt10destroy_atIN3qpl2ml11compression20huffman_table_meta_tEEvPT_(ptr noundef) #4

declare i32 @qpl_deflate_huffman_table_create(i32 noundef, i32 noundef, ptr, ptr, ptr noundef) #1

declare i32 @qpl_huffman_only_table_create(i32 noundef, i32 noundef, ptr, ptr, ptr noundef) #1

; Function Attrs: nounwind
declare noundef i32 @_ZN3qpl2ml11compression15huffman_table_tILNS1_23compression_algorithm_eE0EE16init_with_streamEPKh(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef) #6

; Function Attrs: nounwind
declare noundef i32 @_ZN3qpl2ml11compression15huffman_table_tILNS1_23compression_algorithm_eE2EE16init_with_streamEPKh(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef) #6

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 #7 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{i64 0, i64 8, !5, i64 8, i64 8, !5}
!14 = !{!15, !6, i64 0}
!15 = !{!"_ZTS11allocator_t", !6, i64 0, !6, i64 8}
!16 = !{!17, !19, i64 9}
!17 = !{!"_ZTSN3qpl2ml11compression20huffman_table_meta_tE", !7, i64 0, !12, i64 4, !18, i64 8, !19, i64 9, !20, i64 10, !21, i64 11, !12, i64 12}
!18 = !{!"_ZTSN3qpl2ml11compression23compression_algorithm_eE", !7, i64 0}
!19 = !{!"_ZTSN3qpl2ml11compression15table_version_eE", !7, i64 0}
!20 = !{!"_ZTSN3qpl2ml11compression20huffman_table_type_eE", !7, i64 0}
!21 = !{!"_ZTSN3qpl2ml16execution_path_tE", !7, i64 0}
!22 = !{!15, !6, i64 8}
!23 = !{!24, !24, i64 0}
!24 = !{!"_ZTS10qpl_status", !7, i64 0}
!25 = !{!17, !18, i64 8}
!26 = !{!17, !20, i64 10}
!27 = !{!17, !21, i64 11}


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

declare void @_ZN3qpl2ml13serialization13get_meta_sizeERKNS0_11compression20huffman_table_meta_tEPm(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @qpl_huffman_table_deserialize(ptr noundef %0, i64 noundef %1, ptr %2, ptr %3, ptr noundef %4) local_unnamed_addr #2 {
  %6 = alloca i64, align 8
  %7 = tail call noundef i32 @_ZN3qpl2ml12bad_argumentL17check_for_nullptrIPP17qpl_huffman_tableJEEEjT_DpT0_(ptr noundef %4) #6
  %.not.not = icmp eq i32 %7, 0
  br i1 %.not.not, label %8, label %63

8:                                                ; preds = %5
  %9 = tail call noundef i32 @_ZN3qpl2ml12bad_argumentL17check_for_nullptrIPKhJEEEjT_DpT0_(ptr noundef %0) #6
  %.not56.not = icmp eq i32 %9, 0
  br i1 %.not56.not, label %10, label %63

10:                                               ; preds = %8
  %11 = icmp eq i64 %1, 0
  br i1 %11, label %63, label %12

12:                                               ; preds = %10
  %13 = tail call { ptr, ptr } @_ZN3qpl2ml11compression7detailsL13get_allocatorE11allocator_t(ptr %2, ptr %3)
  %14 = extractvalue { ptr, ptr } %13, 0
  %15 = extractvalue { ptr, ptr } %13, 1
  %16 = tail call noundef ptr %14(i64 noundef 16)
  %.not57 = icmp eq ptr %16, null
  br i1 %.not57, label %63, label %17

17:                                               ; preds = %12
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %16, i8 0, i64 16, i1 false)
  tail call void @_ZN3qpl2ml11compression20huffman_table_meta_tC2Ev(ptr noundef nonnull align 4 dereferenceable(16) %16) #6
  tail call void @_ZN3qpl2ml13serialization16deserialize_metaEPKhRNS0_11compression20huffman_table_meta_tE(ptr noundef %0, ptr noundef nonnull align 4 dereferenceable(16) %16)
  %18 = getelementptr inbounds i8, ptr %16, i64 9
  %19 = load i8, ptr %18, align 1, !tbaa !5
  %.not58 = icmp eq i8 %19, 1
  br i1 %.not58, label %21, label %20

20:                                               ; preds = %17
  tail call void @_ZSt10destroy_atIN3qpl2ml11compression20huffman_table_meta_tEEvPT_(ptr noundef nonnull %16)
  tail call void %15(ptr noundef nonnull %16)
  br label %63

21:                                               ; preds = %17
  %22 = getelementptr inbounds i8, ptr %16, i64 8
  %23 = load i8, ptr %22, align 4, !tbaa !14
  %24 = icmp eq i8 %23, 0
  br i1 %24, label %25, label %33

25:                                               ; preds = %21
  %26 = getelementptr inbounds i8, ptr %16, i64 10
  %27 = load i8, ptr %26, align 2, !tbaa !15
  %28 = zext i8 %27 to i32
  %29 = getelementptr inbounds i8, ptr %16, i64 11
  %30 = load i8, ptr %29, align 1, !tbaa !16
  %31 = zext i8 %30 to i32
  %32 = tail call i32 @qpl_deflate_huffman_table_create(i32 noundef %28, i32 noundef %31, ptr %2, ptr %3, ptr noundef %4)
  %.pr = load i8, ptr %22, align 4, !tbaa !14
  br label %33

33:                                               ; preds = %25, %21
  %34 = phi i8 [ %.pr, %25 ], [ %23, %21 ]
  %.051 = phi i32 [ %32, %25 ], [ 0, %21 ]
  %35 = icmp eq i8 %34, 2
  br i1 %35, label %36, label %44

36:                                               ; preds = %33
  %37 = getelementptr inbounds i8, ptr %16, i64 10
  %38 = load i8, ptr %37, align 2, !tbaa !15
  %39 = zext i8 %38 to i32
  %40 = getelementptr inbounds i8, ptr %16, i64 11
  %41 = load i8, ptr %40, align 1, !tbaa !16
  %42 = zext i8 %41 to i32
  %43 = tail call i32 @qpl_huffman_only_table_create(i32 noundef %39, i32 noundef %42, ptr %2, ptr %3, ptr noundef %4)
  br label %44

44:                                               ; preds = %36, %33
  %.152 = phi i32 [ %43, %36 ], [ %.051, %33 ]
  %.not59 = icmp eq i32 %.152, 0
  br i1 %.not59, label %46, label %45

45:                                               ; preds = %44
  tail call void @_ZSt10destroy_atIN3qpl2ml11compression20huffman_table_meta_tEEvPT_(ptr noundef nonnull %16)
  tail call void %15(ptr noundef nonnull %16)
  br label %63

46:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  store i64 0, ptr %6, align 8, !tbaa !17
  call void @_ZN3qpl2ml13serialization13get_meta_sizeERKNS0_11compression20huffman_table_meta_tEPm(ptr noundef nonnull align 4 dereferenceable(16) %16, ptr noundef nonnull %6)
  %47 = load i8, ptr %22, align 4, !tbaa !14
  %48 = icmp eq i8 %47, 0
  br i1 %48, label %49, label %54

49:                                               ; preds = %46
  %50 = load ptr, ptr %4, align 8, !tbaa !19
  %51 = load i64, ptr %6, align 8, !tbaa !17
  %52 = getelementptr inbounds i8, ptr %0, i64 %51
  %53 = call noundef i32 @_ZN3qpl2ml11compression15huffman_table_tILNS1_23compression_algorithm_eE0EE16init_with_streamEPKh(ptr noundef nonnull align 8 dereferenceable(72) %50, ptr noundef %52) #6
  %.pr62 = load i8, ptr %22, align 4, !tbaa !14
  br label %54

54:                                               ; preds = %49, %46
  %55 = phi i8 [ %.pr62, %49 ], [ %47, %46 ]
  %.253 = phi i32 [ %53, %49 ], [ 0, %46 ]
  %56 = icmp eq i8 %55, 2
  br i1 %56, label %57, label %62

57:                                               ; preds = %54
  %58 = load ptr, ptr %4, align 8, !tbaa !19
  %59 = load i64, ptr %6, align 8, !tbaa !17
  %60 = getelementptr inbounds i8, ptr %0, i64 %59
  %61 = call noundef i32 @_ZN3qpl2ml11compression15huffman_table_tILNS1_23compression_algorithm_eE2EE16init_with_streamEPKh(ptr noundef nonnull align 8 dereferenceable(72) %58, ptr noundef %60) #6
  br label %62

62:                                               ; preds = %57, %54
  %.354 = phi i32 [ %61, %57 ], [ %.253, %54 ]
  call void @_ZSt10destroy_atIN3qpl2ml11compression20huffman_table_meta_tEEvPT_(ptr noundef nonnull %16)
  call void %15(ptr noundef nonnull %16)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  br label %63

63:                                               ; preds = %8, %5, %12, %45, %62, %20, %10
  %.5 = phi i32 [ %7, %5 ], [ %9, %8 ], [ 57, %10 ], [ 106, %12 ], [ 90, %20 ], [ 106, %45 ], [ %.354, %62 ]
  ret i32 %.5
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i32 @_ZN3qpl2ml12bad_argumentL17check_for_nullptrIPP17qpl_huffman_tableJEEEjT_DpT0_(ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i32 @_ZN3qpl2ml12bad_argumentL17check_for_nullptrIPKhJEEEjT_DpT0_(ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden { ptr, ptr } @_ZN3qpl2ml11compression7detailsL13get_allocatorE11allocator_t(ptr, ptr) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3qpl2ml11compression20huffman_table_meta_tC2Ev(ptr noundef nonnull align 4 dereferenceable(16)) unnamed_addr #3 align 2

declare void @_ZN3qpl2ml13serialization16deserialize_metaEPKhRNS0_11compression20huffman_table_meta_tE(ptr noundef, ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt10destroy_atIN3qpl2ml11compression20huffman_table_meta_tEEvPT_(ptr noundef) local_unnamed_addr #3

declare i32 @qpl_deflate_huffman_table_create(i32 noundef, i32 noundef, ptr, ptr, ptr noundef) local_unnamed_addr #1

declare i32 @qpl_huffman_only_table_create(i32 noundef, i32 noundef, ptr, ptr, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind
declare noundef i32 @_ZN3qpl2ml11compression15huffman_table_tILNS1_23compression_algorithm_eE0EE16init_with_streamEPKh(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef) local_unnamed_addr #5

; Function Attrs: nounwind
declare noundef i32 @_ZN3qpl2ml11compression15huffman_table_tILNS1_23compression_algorithm_eE2EE16init_with_streamEPKh(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef) local_unnamed_addr #5

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 }

!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, !11, i64 9}
!6 = !{!"_ZTSN3qpl2ml11compression20huffman_table_meta_tE", !7, i64 0, !9, i64 4, !10, i64 8, !11, i64 9, !12, i64 10, !13, i64 11, !9, i64 12}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!"_ZTSN3qpl2ml11compression23compression_algorithm_eE", !7, i64 0}
!11 = !{!"_ZTSN3qpl2ml11compression15table_version_eE", !7, i64 0}
!12 = !{!"_ZTSN3qpl2ml11compression20huffman_table_type_eE", !7, i64 0}
!13 = !{!"_ZTSN3qpl2ml16execution_path_tE", !7, i64 0}
!14 = !{!6, !10, i64 8}
!15 = !{!6, !12, i64 10}
!16 = !{!6, !13, i64 11}
!17 = !{!18, !18, i64 0}
!18 = !{!"long", !7, i64 0}
!19 = !{!20, !20, i64 0}
!20 = !{!"any pointer", !7, i64 0}


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